@wangtaizong/components 1.0.4 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Add.d.ts +2 -0
- package/dist/{base-80a1f760-4106f070.js → base-80a1f760-22b3368a.js} +1 -1
- package/dist/components/editor/WEditor.d.ts +2 -1
- package/dist/{consoleHook-59e792cb-38408587.js → consoleHook-59e792cb-0fba2dba.js} +1 -1
- package/dist/{index-83b70eea.js → index-3417dbcd.js} +2 -2
- package/dist/{index-585bceb7-0bf06f98.js → index-585bceb7-39d610b1.js} +3 -3
- package/dist/{index-6afdc2ce.js → index-6426660e.js} +10 -9
- package/dist/{index-e28d3e42.js → index-a63bd288.js} +3 -3
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +2 -2
- package/package.json +1 -1
package/dist/Add.d.ts
ADDED
|
@@ -7,6 +7,7 @@ interface MyEditorProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
7
7
|
[key: string]: string;
|
|
8
8
|
};
|
|
9
9
|
children: ReactNode;
|
|
10
|
+
[key: string]: any;
|
|
10
11
|
}
|
|
11
|
-
declare const WEditor: ({ type, children, showConsole, files, className, style, ...restProps }: MyEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare const WEditor: ({ type, children, showConsole, files, className, style, editorRef, ...restProps }: MyEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export default WEditor;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { _ as L, e as w, c as u, f as O, d as S, S as I, g as k, n as x, h as m, a as g, b as y, j as _ } from "./index-
|
|
2
|
-
import { S as R } from "./base-80a1f760-
|
|
1
|
+
import { _ as L, e as w, c as u, f as O, d as S, S as I, g as k, n as x, h as m, a as g, b as y, j as _ } from "./index-6426660e.js";
|
|
2
|
+
import { S as R } from "./base-80a1f760-22b3368a.js";
|
|
3
3
|
import "react";
|
|
4
4
|
var j = (
|
|
5
5
|
/** @class */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as k, a as j, b as z } from "./index-
|
|
2
|
-
import { a as q, E as _, c as U, b as F } from "./consoleHook-59e792cb-
|
|
3
|
-
import { S as T } from "./base-80a1f760-
|
|
1
|
+
import { _ as k, a as j, b as z } from "./index-6426660e.js";
|
|
2
|
+
import { a as q, E as _, c as U, b as F } from "./consoleHook-59e792cb-0fba2dba.js";
|
|
3
|
+
import { S as T } from "./base-80a1f760-22b3368a.js";
|
|
4
4
|
import "react";
|
|
5
5
|
var P = Object.create, u = Object.defineProperty, S = Object.getOwnPropertyDescriptor, d = Object.getOwnPropertyNames, E = Object.getPrototypeOf, C = Object.prototype.hasOwnProperty, x = (i, e) => function() {
|
|
6
6
|
return e || (0, i[d(i)[0]])((e = { exports: {} }).exports, e), e.exports;
|
|
@@ -1875,19 +1875,19 @@ function mw(t, e, r) {
|
|
|
1875
1875
|
}
|
|
1876
1876
|
return [3, 5];
|
|
1877
1877
|
case 1:
|
|
1878
|
-
return [4, import("./index-
|
|
1878
|
+
return [4, import("./index-a63bd288.js").then(function(l) {
|
|
1879
1879
|
return l.SandpackNode;
|
|
1880
1880
|
})];
|
|
1881
1881
|
case 2:
|
|
1882
1882
|
return s = a.sent(), [3, 7];
|
|
1883
1883
|
case 3:
|
|
1884
|
-
return [4, import("./index-585bceb7-
|
|
1884
|
+
return [4, import("./index-585bceb7-39d610b1.js").then(function(l) {
|
|
1885
1885
|
return l.SandpackStatic;
|
|
1886
1886
|
})];
|
|
1887
1887
|
case 4:
|
|
1888
1888
|
return s = a.sent(), [3, 7];
|
|
1889
1889
|
case 5:
|
|
1890
|
-
return [4, import("./index-
|
|
1890
|
+
return [4, import("./index-3417dbcd.js").then(function(l) {
|
|
1891
1891
|
return l.SandpackRuntime;
|
|
1892
1892
|
})];
|
|
1893
1893
|
case 6:
|
|
@@ -23785,7 +23785,7 @@ const BR = {
|
|
|
23785
23785
|
vue: "vue"
|
|
23786
23786
|
}, zR = (t) => {
|
|
23787
23787
|
const { code: e, updateCode: r } = nh(), { sandpack: n } = Re(), i = BR[n.activeFile.split(".").pop() ?? "js"];
|
|
23788
|
-
return t.
|
|
23788
|
+
return t.editorRef.current = n, /* @__PURE__ */ w.jsxs(Bs, { style: { height: "100vh", margin: 0 }, children: [
|
|
23789
23789
|
/* @__PURE__ */ w.jsx(sh, { closableTabs: !0 }),
|
|
23790
23790
|
/* @__PURE__ */ w.jsx(
|
|
23791
23791
|
"div",
|
|
@@ -32131,15 +32131,16 @@ const c_ = ({
|
|
|
32131
32131
|
files: n,
|
|
32132
32132
|
className: i,
|
|
32133
32133
|
style: s,
|
|
32134
|
-
|
|
32134
|
+
editorRef: o,
|
|
32135
|
+
...a
|
|
32135
32136
|
// 接受剩余属性
|
|
32136
32137
|
}) => {
|
|
32137
|
-
const
|
|
32138
|
-
return /* @__PURE__ */ w.jsxs("div", { className: i, style: s, ...
|
|
32139
|
-
|
|
32138
|
+
const l = le(), c = e ? _c(e, { ref: l }) : null;
|
|
32139
|
+
return /* @__PURE__ */ w.jsxs("div", { className: i, style: s, ...a, children: [
|
|
32140
|
+
c,
|
|
32140
32141
|
/* @__PURE__ */ w.jsx(E2, { template: t, theme: "dark", files: n, children: /* @__PURE__ */ w.jsx(Ty, { children: /* @__PURE__ */ w.jsxs(F2, { children: [
|
|
32141
32142
|
/* @__PURE__ */ w.jsx(h_, {}),
|
|
32142
|
-
/* @__PURE__ */ w.jsx(zR, {
|
|
32143
|
+
/* @__PURE__ */ w.jsx(zR, { editorRef: o }),
|
|
32143
32144
|
/* @__PURE__ */ w.jsxs("div", { children: [
|
|
32144
32145
|
/* @__PURE__ */ w.jsx(
|
|
32145
32146
|
ER,
|
|
@@ -10,9 +10,9 @@ var k = (e, r, t) => (T(e, r, "read from private field"), t ? t.call(e) : r.get(
|
|
|
10
10
|
r instanceof WeakSet ? r.add(e) : r.set(e, t);
|
|
11
11
|
}, V = (e, r, t, n) => (T(e, r, "write to private field"), n ? n.call(e, t) : r.set(e, t), t);
|
|
12
12
|
var F = (e, r, t) => (T(e, r, "access private method"), t);
|
|
13
|
-
import { _ as se, a as E, b as P, c as A, d as K, n as N } from "./index-
|
|
14
|
-
import { S as oe } from "./base-80a1f760-
|
|
15
|
-
import { c as ae, g as z, r as U, f as ce, w as W, a as de, b as le, E as ue } from "./consoleHook-59e792cb-
|
|
13
|
+
import { _ as se, a as E, b as P, c as A, d as K, n as N } from "./index-6426660e.js";
|
|
14
|
+
import { S as oe } from "./base-80a1f760-22b3368a.js";
|
|
15
|
+
import { c as ae, g as z, r as U, f as ce, w as W, a as de, b as le, E as ue } from "./consoleHook-59e792cb-0fba2dba.js";
|
|
16
16
|
import "react";
|
|
17
17
|
var he = Object.create, q = Object.defineProperty, fe = Object.getOwnPropertyDescriptor, X = Object.getOwnPropertyNames, pe = Object.getPrototypeOf, me = Object.prototype.hasOwnProperty, ve = (e, r, t) => r in e ? q(e, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[r] = t, b = (e, r) => function() {
|
|
18
18
|
return r || (0, e[X(e)[0]])((r = { exports: {} }).exports, r), r.exports;
|
package/dist/index.es.js
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -752,12 +752,12 @@ declare module "*.vue" {
|
|
|
752
752
|
|
|
753
753
|
`),a},hd=U.forwardRef(function(t,e){var n=t.code,i=n===void 0?"":n,r=t.filePath,s=t.fileType,o=t.onCodeUpdate,a=t.showLineNumbers,l=a===void 0?!1:a,c=t.showInlineErrors,u=c===void 0?!1:c,d=t.wrapContent,p=d===void 0?!1:d,f=t.editorState,h=f===void 0?"pristine":f,m=t.readOnly,g=m===void 0?!1:m,O=t.showReadOnly,v=O===void 0?!0:O,x=t.decorators,b=t.initMode,w=b===void 0?"lazy":b,y=t.extensions,k=y===void 0?[]:y,T=t.extensionsKeymap,E=T===void 0?[]:T,C=t.additionalLanguages,M=C===void 0?[]:C,Z=U.useRef(null),q=KO(Z,e),N=U.useRef(),_=oj(),G=_.theme,ee=_.themeId,le=U.useState(i),he=le[0],B=le[1],A=U.useState(w==="immediate"),V=A[0],X=A[1],D=Fe(),W=Ce(),se=W.listen,Ee=W.sandpack.autoReload,me=U.useRef([]),Ge=U.useRef([]),En=qQ(Z,{rootMargin:"600px 0px",threshold:.2}).isIntersecting;U.useImperativeHandle(e,function(){return{getCodemirror:function(){return N.current}}}),U.useEffect(function(){var De=w==="lazy"||w==="user-visible";De&&En&&X(!0)},[w,En]);var Et=uj(r,s,M),qn=dj(Et,M),bi=cj(G),_r=vj({langSupport:qn,highlightTheme:bi,code:i}),yi=U.useMemo(function(){return x&&x.sort(function(De,je){return De.line-je.line})},[x]);U.useEffect(function(){if(!(!Z.current||!V)){var De=[{key:"Tab",run:function(He){var Yt,jn;Sv(He);var zn=E.find(function(Yn){var wi=Yn.key;return wi==="Tab"});return(jn=(Yt=zn==null?void 0:zn.run)===null||Yt===void 0?void 0:Yt.call(zn,He))!==null&&jn!==void 0?jn:!0}},{key:"Shift-Tab",run:function(He){var Yt,jn,zn=He.state,Yn=He.dispatch;Pv({state:zn,dispatch:Yn});var wi=E.find(function(Il){var Zl=Il.key;return Zl==="Shift-Tab"});return(jn=(Yt=wi==null?void 0:wi.run)===null||Yt===void 0?void 0:Yt.call(wi,St))!==null&&jn!==void 0?jn:!0}},{key:"Escape",run:function(){return g||Z.current&&Z.current.focus(),!0}},{key:"mod-Backspace",run:Eu}],je=st(st([n$(),VT(),ST()],k,!0),[zo.of(st(st(st(st(st([],$T,!0),VQ,!0),HT,!0),De,!0),E,!0)),qn,aj(),G$(bi)],!1);g?(je.push(ve.readOnly.of(!0)),je.push(ne.editable.of(!1))):(je.push(rT()),je.push(l$())),yi&&je.push(pj(yi)),p&&je.push(ne.lineWrapping),l&&je.push(v$()),u&&je.push(fj());var at=Z.current,wt=at.querySelector(".sp-pre-placeholder");wt&&at.removeChild(wt);var St=new ne({doc:i,extensions:je,parent:at,dispatch:function(He){if(St.update([He]),He.docChanged){var Yt=He.newDoc.sliceString(0,He.newDoc.length);B(Yt),o==null||o(Yt)}}});return St.contentDOM.setAttribute("data-gramm","false"),St.contentDOM.setAttribute("data-lt-active","false"),St.contentDOM.setAttribute("aria-label",r?"Code Editor for ".concat(ja(r)):"Code Editor"),g?St.contentDOM.classList.add("cm-readonly"):St.contentDOM.setAttribute("tabIndex","-1"),N.current=St,function(){var He;(He=N.current)===null||He===void 0||He.destroy()}}},[V,l,p,ee,yi,g,Ee]),U.useEffect(function(){var je=N.current,at=!JO(k,me.current)||!JO(E,Ge.current);je&&at&&(je.dispatch({effects:Te.appendConfig.of(k)}),je.dispatch({effects:Te.appendConfig.of(zo.of(st([],E,!0)))}),me.current=k,Ge.current=E)},[k,E]),U.useEffect(function(){N.current&&h==="dirty"&&window.matchMedia("(min-width: 768px)").matches&&N.current.contentDOM.focus()},[]),U.useEffect(function(){if(N.current&&typeof i=="string"&&i!==he){var De=N.current,je=De.state.selection.ranges.some(function(wt){var St=wt.to,He=wt.from;return St>i.length||He>i.length})?R.cursor(i.length):De.state.selection,at={from:0,to:De.state.doc.length,insert:i};De.dispatch({changes:at,selection:je})}},[i]),U.useEffect(function(){if(u){var je=se(function(at){var wt=N.current;at.type==="success"?wt==null||wt.dispatch({annotations:[new Ft("remove-errors",!0)]}):at.type==="action"&&at.action==="show-error"&&at.path===r&&at.line&&(wt==null||wt.dispatch({annotations:[new Ft("show-error",at.line)]}))});return function(){return je()}}},[se,u]);var Ir=function(De){De.key==="Enter"&&N.current&&(De.preventDefault(),N.current.contentDOM.focus())},lo=function(){var De=4;return l&&(De+=6),g||(De+=1),"var(--".concat(be,"-space-").concat(De,")")};return g?S.jsxs(S.Fragment,{children:[S.jsx("pre",{ref:q,className:D("cm",[D(h),D(Et),nx,ex]),translate:"no",children:S.jsx("code",{className:D("pre-placeholder",[fd]),style:{marginLeft:lo()},children:_r})}),g&&v&&S.jsx("span",j({className:D("read-only",[gj])},{},{children:"Read-only"}))]}):S.jsx("div",{ref:q,"aria-autocomplete":"list","aria-label":r?"Code Editor for ".concat(ja(r)):"Code Editor","aria-multiline":"true",className:D("cm",[D(h),D(Et),nx,ex]),onKeyDown:Ir,role:"textbox",tabIndex:0,translate:"no",suppressHydrationWarning:!0,children:S.jsx("pre",{className:D("pre-placeholder",[fd]),style:{marginLeft:lo()},children:_r})})});P.forwardRef(function(t,e){var n=t.showTabs,i=t.showLineNumbers,r=i===void 0?!1:i,s=t.showInlineErrors,o=s===void 0?!1:s,a=t.showRunButton,l=a===void 0?!0:a,c=t.wrapContent,u=c===void 0?!1:c,d=t.closableTabs,p=d===void 0?!1:d,f=t.initMode,h=t.extensions,m=t.extensionsKeymap,g=t.readOnly,O=t.showReadOnly,v=t.additionalLanguages,x=t.className,b=Ye(t,["showTabs","showLineNumbers","showInlineErrors","showRunButton","wrapContent","closableTabs","initMode","extensions","extensionsKeymap","readOnly","showReadOnly","additionalLanguages","className"]),w=Ce().sandpack,y=rd(),k=y.code,T=y.updateCode,E=y.readOnly,C=w.activeFile,M=w.status,Z=w.editorState,q=n??w.visibleFiles.length>1,N=Fe(),_=function(G,ee){ee===void 0&&(ee=!0),T(G,ee)};return S.jsxs(Es,j({className:N("editor",[x])},b,{children:[q&&S.jsx(cd,{closableTabs:p}),S.jsxs("div",{className:N("code-editor",[tx]),children:[S.jsx(hd,{ref:e,additionalLanguages:v,code:k,editorState:Z,extensions:h,extensionsKeymap:m,filePath:C,initMode:f||w.initMode,onCodeUpdate:function(G){var ee;return _(G,(ee=w.autoReload)!==null&&ee!==void 0?ee:!0)},readOnly:g||E,showInlineErrors:o,showLineNumbers:r,showReadOnly:O,wrapContent:u},C),l&&(!w.autoReload||M==="idle")?S.jsx(GO,{}):null]})]}))}),U.forwardRef(function(t,e){var n=t.showTabs,i=t.showLineNumbers,r=t.decorators,s=t.code,o=t.initMode,a=t.wrapContent,l=t.additionalLanguages,c=Ye(t,["showTabs","showLineNumbers","decorators","code","initMode","wrapContent","additionalLanguages"]),u=Ce().sandpack,d=rd().code,p=Fe(),f=n??u.visibleFiles.length>1;return S.jsxs(Es,j({className:p("editor-viewer")},c,{children:[f?S.jsx(cd,{}):null,S.jsx("div",{className:p("code-editor",[tx]),children:S.jsx(hd,{ref:e,additionalLanguages:l,code:s??d,decorators:r,filePath:u.activeFile,initMode:o||u.initMode,showLineNumbers:i,showReadOnly:!1,wrapContent:a,readOnly:!0})}),u.status==="idle"?S.jsx(GO,{}):null]}))});var _a,Ia,Oj=Y((_a={border:"1px solid $colors$surface2",display:"flex",flexWrap:"wrap",alignItems:"stretch",borderRadius:"$border$radius",overflow:"hidden",position:"relative",backgroundColor:"$colors$surface2",gap:1},_a["> .".concat(HO)]={flexGrow:1,flexShrink:1,flexBasis:"0",height:"$layout$height",overflow:"hidden","@media print":{height:"auto",display:"block"},"@media screen and (max-width: 768px)":(Ia={},Ia["&:not(.".concat(be,"-preview, .").concat(be,"-editor, .").concat(be,"-preset-column)")]={height:"calc($layout$height / 2)"},Ia.minWidth="100%;",Ia)},_a["> .".concat(be,"-file-explorer")]={flex:.2,minWidth:200,"@media screen and (max-width: 768px)":{flex:1}},_a)),xj=U.forwardRef(function(t,e){var n=t.children,i=t.className,r=Ye(t,["children","className"]),s=Ce().sandpack,o=Fe(),a=KO(s.lazyAnchorRef,e);return S.jsx("div",j({ref:a,className:o("layout",[Oj,i])},r,{children:n}))}),bj=function(){var t,e=Ce().sandpack,n=e.error;return(t=n==null?void 0:n.message)!==null&&t!==void 0?t:null},ix=200,yj=function(t,e){var n=Ce(),i=n.sandpack,r=n.listen,s=U.useState("LOADING"),o=s[0],a=s[1];return U.useEffect(function(){var l=r(function(c){c.type==="start"&&c.firstLoad===!0&&a("LOADING"),c.type==="done"&&a(function(u){return u==="LOADING"?"PRE_FADING":"HIDDEN"})},t);return function(){l()}},[t,i.status==="idle"]),U.useEffect(function(){var l;return o==="PRE_FADING"&&!e?a("FADING"):o==="FADING"&&(l=setTimeout(function(){return a("HIDDEN")},ix)),function(){clearTimeout(l)}},[o,e]),i.status==="timeout"?"TIMEOUT":i.status!=="running"?"HIDDEN":o},wj=function(t){var e=Ce().dispatch;return{refresh:function(){return e({type:"refresh"},t)},back:function(){return e({type:"urlback"},t)},forward:function(){return e({type:"urlforward"},t)}}},rx=function(t){var e=Ce(),n=e.sandpack,i=e.listen,r=e.dispatch,s=U.useRef(null),o=U.useRef(Aa());U.useEffect(function(){var l=s.current,c=o.current;return l!==null&&n.registerBundler(l,c,t),function(){return n.unregisterBundler(c)}},[]);var a=function(){return n.clients[o.current]||null};return{sandpack:n,getClient:a,clientId:o.current,iframe:s,listen:function(l){return i(l,o.current)},dispatch:function(l){return r(l,o.current)}}},md=function(t){var e=Ce().dispatch;return{restart:function(){return e({type:"shell/restart"},t)},openPreview:function(){return e({type:"shell/openPreview"},t)}}},Sj=function(t,e){var n;switch(t.state){case"downloading_manifest":return"[1/3] Downloading manifest";case"downloaded_module":return"[2/3] Downloaded ".concat(t.name," (").concat(e-t.totalPending,"/").concat(e,")");case"starting_command":return"[3/3] Starting command";case"command_running":return'[3/3] Running "'.concat((n=t.command)===null||n===void 0?void 0:n.trim(),'"')}},sx=function(t){var e=U.useState(!1),n=e[0],i=e[1],r=U.useState(),s=r[0],o=r[1],a=U.useState(null),l=a[0],c=a[1],u=t==null?void 0:t.timeout,d=t==null?void 0:t.clientId,p=Ce().listen;return U.useEffect(function(){var f,h=p(function(m){m.type==="start"&&m.firstLoad&&i(!1),u&&(f=setTimeout(function(){c(null)},u)),m.type==="shell/progress"&&!n&&(!s&&m.data.state==="downloaded_module"&&o(m.data.totalPending),s!==void 0&&c(Sj(m.data,s))),m.type==="done"&&m.compilatonError===!1&&(c(null),i(!0),clearTimeout(f))},d);return function(){f&&clearTimeout(f),h()}},[d,n,s,u]),l},Pj=400*2,ox=function(t){var e=t.clientId,n=t.maxMessageCount,i=n===void 0?Pj:n;t.resetOnPreviewRestart;var r=U.useState([]),s=r[0],o=r[1],a=Ce().listen;return U.useEffect(function(){var l=a(function(c){c.type==="start"?o([]):c.type==="stdout"&&c.payload.data&&c.payload.data.trim()&&o(function(u){for(var d=st(st([],u,!0),[{data:c.payload.data,id:Aa()}],!1);d.length>i;)d.shift();return d})},e);return l},[i,e]),{logs:s,reset:function(){return o([])}}},kj=function(t){var e=t.replace("[sandpack-client]: ","");if(/process.exit/.test(e)){var n=e.match(/process.exit\((\d+)\)/);return n?Number(n[1])===0?"Server is not running, would you like to start it again?":"Server has crashed with status code ".concat(n[1],", would you like to restart the server?"):e}return e},$j=function(t){var e=t.children,n=t.className,i=Ye(t,["children","className"]),r=bj(),s=md().restart,o=Fe(),a=Ce().sandpack,l=a.runSandpack,c=a.teamId,u=Ce().dispatch;if(!r&&!e)return null;var d=r==null?void 0:r.startsWith("[sandpack-client]"),p=r==null?void 0:r.includes("NPM_REGISTRY_UNAUTHENTICATED_REQUEST"),f=function(){c&&u({type:"sign-in",teamId:c})};return p?S.jsxs("div",j({className:o("overlay",[o("error"),Qs,ad,n])},t,{children:[S.jsx("p",{className:o("error-message",[ci]),children:S.jsx("strong",{children:"Unable to fetch required dependency."})}),S.jsx("div",{className:o("error-message",[ci]),children:S.jsxs("p",{children:["Authentication required. Please sign in to your account (make sure to allow pop-ups to this page) and try again. If the issue persists, contact"," ",S.jsx("a",{href:"mailto:hello@codesandbox.io?subject=Sandpack Timeout Error",children:"support"})," ","for further assistance."]})}),S.jsx("div",{children:S.jsxs("button",{className:o("button",[pt,In,Ii]),onClick:f,children:[S.jsx(o2,{}),S.jsx("span",{children:"Sign in"})]})})]})):d&&r?S.jsx("div",j({className:o("overlay",[o("error"),Qs,ad,n])},i,{children:S.jsxs("div",{className:o("error-message",[ci]),children:[S.jsx("p",{className:o("error-title",[Y({fontWeight:"bold"})]),children:"Couldn't connect to server"}),S.jsx("p",{children:kj(r)}),S.jsx("div",{children:S.jsxs("button",{className:o("button",[o("icon-standalone"),pt,In,Ii]),onClick:function(){s(),l()},title:"Restart script",type:"button",children:[S.jsx(Ea,{})," ",S.jsx("span",{children:"Restart"})]})})]})})):S.jsxs("div",j({className:o("overlay",[o("error"),Qs,UO({solidBg:!0}),n]),translate:"no"},i,{children:[S.jsx("p",{className:o("error-message",[ci]),children:S.jsx("strong",{children:"Something went wrong"})}),S.jsx("p",{className:o("error-message",[ci({errorCode:!0})]),children:r||e})]}))};function Tj(t,e){return e===void 0&&(e=!1),t=i2(Aj(t)),e2.ansiToJson(t,{json:!0,remove_empty:!0,use_classes:e})}function Qj(t){var e="";return t.bg&&(e+="".concat(t.bg,"-bg ")),t.fg&&(e+="".concat(t.fg,"-fg ")),t.decoration&&(e+="ansi-".concat(t.decoration," ")),e===""?null:(e=e.substring(0,e.length-1),e)}function Cj(t){var e={};switch(t.bg&&(e.backgroundColor="rgb(".concat(t.bg,")")),t.fg&&(e.color="rgb(".concat(t.fg,")")),t.decoration){case"bold":e.fontWeight="bold";break;case"dim":e.opacity="0.5";break;case"italic":e.fontStyle="italic";break;case"hidden":e.visibility="hidden";break;case"strikethrough":e.textDecoration="line-through";break;case"underline":e.textDecoration="underline";break;case"blink":e.textDecoration="blink";break}return e}function Ej(t,e,n,i){var r=e?null:Cj(n),s=e?Qj(n):null;if(!t)return U.createElement("span",{style:r,key:i,className:s},n.content);for(var o=[],a=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,l=0,c;(c=a.exec(n.content))!==null;){var u=c[1],d=c[2],p=c.index+u.length;p>l&&o.push(n.content.substring(l,p));var f=d.startsWith("www.")?"http://".concat(d):d;o.push(U.createElement("a",{key:l,href:f,target:"_blank"},"".concat(d))),l=a.lastIndex}return l<n.content.length&&o.push(n.content.substring(l)),U.createElement("span",{style:r,key:i,className:s},o)}function jj(t){var e=t.className,n=t.useClasses,i=t.children,r=t.linkify;return U.createElement("code",{className:e},Tj(i??"",n??!1).map(Ej.bind(null,r??!1,n??!1)))}function Aj(t){var e=t;do t=e,e=t.replace(/[^\n]\x08/gm,"");while(e.length<t.length);return t}var ax=function(t){var e=t.data,n=Fe();return S.jsx(S.Fragment,{children:e.map(function(i){var r=i.data,s=i.id;return S.jsx("div",{className:n("console-item",[Dj]),children:S.jsx(jj,{children:r})},s)})})},Dj=Y({width:"100%",padding:"$space$3 $space$2",fontSize:".85em",position:"relative",whiteSpace:"pre","&:not(:first-child):after":{content:"",position:"absolute",top:0,left:0,right:0,height:1,background:"$colors$surface3"}}),Mj=function(t){return s2.compressToBase64(JSON.stringify(t)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},lx="https://codesandbox.io/api/v1/sandboxes/define",Rj=function(t,e){var n=Object.keys(t).reduce(function(i,r){var s,o=r.replace("/",""),a={content:t[r].code,isBinary:!1};return j(j({},i),(s={},s[o]=a,s))},{});return Mj(j({files:n},e?{template:e}:null))},_j=function(t){var e,n,i,r=t.children,s=Ye(t,["children"]),o=Ce().sandpack,a=U.useRef(null),l=U.useState(),c=l[0],u=l[1];return U.useEffect(function(){var p=setTimeout(function(){var f=Rj(o.files,o.environment),h=new URLSearchParams({parameters:f,query:new URLSearchParams({file:o.activeFile,utm_medium:"sandpack"}).toString()});u(h)},600);return function(){clearTimeout(p)}},[o.activeFile,o.environment,o.files]),((i=(n=(e=c==null?void 0:c.get)===null||e===void 0?void 0:e.call(c,"parameters"))===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0)>1500?S.jsxs("button",j({onClick:function(){var d;return(d=a.current)===null||d===void 0?void 0:d.submit()},title:"Open in CodeSandbox",type:"button"},s,{children:[S.jsxs("form",{ref:a,action:lx,method:"POST",style:{visibility:"hidden"},target:"_blank",children:[S.jsx("input",{name:"environment",type:"hidden",value:o.environment==="node"?"server":o.environment}),Array.from(c,function(d){var p=d[0],f=d[1];return S.jsx("input",{name:p,type:"hidden",value:f},p)})]}),r]})):S.jsx("a",j({href:"".concat(lx,"?").concat(c==null?void 0:c.toString(),"&environment=").concat(o.environment==="node"?"server":o.environment),rel:"noreferrer noopener",target:"_blank",title:"Open in CodeSandbox"},s,{children:r}))},cx=function(){var t=Fe();return S.jsxs(_j,{className:t("button",[t("icon-standalone"),pt,In,Ii]),children:[S.jsx(p2,{}),S.jsx("span",{children:"Open Sandbox"})]})},Zi,gd=Y({transform:"translate(-4px, 9px) scale(0.13, 0.13)","*":{position:"absolute",width:"96px",height:"96px"}}),Ij=Y((Zi={position:"absolute",right:"$space$2",bottom:"$space$2",zIndex:"$top",width:"32px",height:"32px",borderRadius:"$border$radius"},Zi[".".concat(gd)]={display:"flex"},Zi[".sp-button.".concat(pt)]={display:"none"},Zi["&:hover .sp-button.".concat(pt)]={display:"flex"},Zi["&:hover .sp-button.".concat(pt," > span")]={display:"none"},Zi["&:hover .".concat(gd)]={display:"none"},Zi)),Zj=VO({"0%":{transform:"rotateX(-25.5deg) rotateY(45deg)"},"100%":{transform:"rotateX(-25.5deg) rotateY(405deg)"}}),Nj=Y({animation:"".concat(Zj," 1s linear infinite"),animationFillMode:"forwards",transformStyle:"preserve-3d",transform:"rotateX(-25.5deg) rotateY(45deg)","*":{border:"10px solid $colors$clickable",borderRadius:"8px",background:"$colors$surface1"},".top":{transform:"rotateX(90deg) translateZ(44px)",transformOrigin:"50% 50%"},".bottom":{transform:"rotateX(-90deg) translateZ(44px)",transformOrigin:"50% 50%"},".front":{transform:"rotateY(0deg) translateZ(44px)",transformOrigin:"50% 50%"},".back":{transform:"rotateY(-180deg) translateZ(44px)",transformOrigin:"50% 50%"},".left":{transform:"rotateY(-90deg) translateZ(44px)",transformOrigin:"50% 50%"},".right":{transform:"rotateY(90deg) translateZ(44px)",transformOrigin:"50% 50%"}}),Lj=function(t){var e=t.className,n=t.showOpenInCodeSandbox,i=Ye(t,["className","showOpenInCodeSandbox"]),r=Fe();return S.jsxs("div",j({className:r("cube-wrapper",[Ij,e]),title:"Open in CodeSandbox"},i,{children:[n&&S.jsx(cx,{}),S.jsx("div",{className:r("cube",[gd]),children:S.jsxs("div",{className:r("sides",[Nj]),children:[S.jsx("div",{className:"top"}),S.jsx("div",{className:"right"}),S.jsx("div",{className:"bottom"}),S.jsx("div",{className:"left"}),S.jsx("div",{className:"front"}),S.jsx("div",{className:"back"})]})})]}))},Xj=Y({backgroundColor:"$colors$surface1"}),Vj=function(t){var e=t.clientId,n=t.loading,i=t.className,r=t.style,s=t.showOpenInCodeSandbox,o=Ye(t,["clientId","loading","className","style","showOpenInCodeSandbox"]),a=Fe(),l=Ce().sandpack,c=l.runSandpack,u=l.environment,d=U.useState(!1),p=d[0],f=d[1],h=yj(e,n),m=sx({clientId:e}),g=ox({clientId:e}).logs;if(U.useEffect(function(){var v;return m!=null&&m.includes("Running")&&(v=setTimeout(function(){f(!0)},3e3)),function(){v&&clearTimeout(v)}},[m]),h==="HIDDEN")return null;if(h==="TIMEOUT")return S.jsx("div",j({className:a("overlay",[a("error"),Qs,UO,ad,i])},o,{children:S.jsxs("div",{className:a("error-message",[ci]),children:[S.jsx("p",{className:a("error-title",[Y({fontWeight:"bold"})]),children:"Couldn't connect to server"}),S.jsx("div",{className:a("error-message",[ci]),children:S.jsxs("p",{children:["This means sandpack cannot connect to the runtime or your network is having some issues. Please check the network tab in your browser and try again. If the problem persists, report it via"," ",S.jsx("a",{href:"mailto:hello@codesandbox.io?subject=Sandpack Timeout Error",children:"email"})," ","or submit an issue on"," ",S.jsx("a",{href:"https://github.com/codesandbox/sandpack/issues",rel:"noreferrer noopener",target:"_blank",children:"GitHub."})]})}),S.jsxs("p",{className:a("error-message",[ci({errorCode:!0})]),children:["ENV: ",u,S.jsx("br",{}),"ERROR: TIME_OUT"]}),S.jsx("div",{children:S.jsxs("button",{className:a("button",[a("icon-standalone"),pt,In,Ii]),onClick:c,title:"Restart script",type:"button",children:[S.jsx(Ea,{})," ",S.jsx("span",{children:"Try again"})]})})]})}));var O=h==="LOADING"||h==="PRE_FADING";return S.jsxs(S.Fragment,{children:[S.jsxs("div",j({className:a("overlay",[a("loading"),Qs,Xj,i]),style:j(j({},r),{opacity:O?1:0,transition:"opacity ".concat(ix,"ms ease-out")})},o,{children:[p&&S.jsx("div",{className:Wj.toString(),children:S.jsx(ax,{data:g})}),S.jsx(Lj,{showOpenInCodeSandbox:s})]})),m&&S.jsx("div",{className:qj.toString(),children:S.jsx("p",{children:m})})]})},Wj=Y({position:"absolute",left:0,right:0,bottom:"$space$8",overflow:"auto",opacity:.5,overflowX:"hidden"}),qj=Y({position:"absolute",left:"$space$5",bottom:"$space$4",zIndex:"$top",color:"$colors$clickable",animation:"".concat(od," 150ms ease"),fontFamily:"$font$mono",fontSize:".8em",width:"75%",p:{whiteSpace:"nowrap",margin:0,textOverflow:"ellipsis",overflow:"hidden"}}),zj=function(t){var e=t.clientId,n=sx({timeout:3e3,clientId:e});return n?S.jsx("div",{className:Yj.toString(),children:S.jsx("p",{children:n})}):null},Yj=Y({position:"absolute",left:"$space$5",bottom:"$space$4",zIndex:"$top",color:"$colors$clickable",animation:"".concat(od," 150ms ease"),fontFamily:"$font$mono",fontSize:".8em",width:"75%",p:{whiteSpace:"nowrap",margin:0,textOverflow:"ellipsis",overflow:"hidden"}});Y({borderRadius:"0",width:"100%",padding:0,marginBottom:"$space$2",span:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"},svg:{marginRight:"$space$1"}}),Y({padding:"$space$3",overflow:"auto",height:"100%"});var Bj=function(t){var e=t.match(/(https?:\/\/.*?)\//);return e&&e[1]?[e[1],t.replace(e[1],"")]:[t,"/"]},Uj=Y({display:"flex",alignItems:"center",height:"$layout$headerHeight",borderBottom:"1px solid $colors$surface2",padding:"$space$3 $space$2",background:"$colors$surface1"}),Fj=Y({backgroundColor:"$colors$surface2",color:"$colors$clickable",padding:"$space$1 $space$3",borderRadius:"99999px",border:"1px solid $colors$surface2",height:"24px",lineHeight:"24px",fontSize:"inherit",outline:"none",flex:1,marginLeft:"$space$4",width:"0",transition:"background $transitions$default","&:hover":{backgroundColor:"$colors$surface3"},"&:focus":{backgroundColor:"$surface1",border:"1px solid $colors$accent",color:"$colors$base"}}),Gj=function(t){var e,n=t.clientId,i=t.onURLChange,r=t.className,s=t.startRoute,o=Ye(t,["clientId","onURLChange","className","startRoute"]),a=U.useState(""),l=a[0],c=a[1],u=Ce(),d=u.sandpack,p=u.dispatch,f=u.listen,h=U.useState((e=s??d.startRoute)!==null&&e!==void 0?e:"/"),m=h[0],g=h[1],O=U.useState(!1),v=O[0],x=O[1],b=U.useState(!1),w=b[0],y=b[1],k=Fe();U.useEffect(function(){var N=f(function(_){if(_.type==="urlchange"){var G=_.url,ee=_.back,le=_.forward,he=Bj(G),B=he[0],A=he[1];c(B),g(A),x(ee),y(le)}},n);return function(){return N()}},[]);var T=function(N){var _=N.target.value.startsWith("/")?N.target.value:"/".concat(N.target.value);g(_)},E=function(N){N.code==="Enter"&&(N.preventDefault(),N.stopPropagation(),typeof i=="function"&&i(l+N.currentTarget.value))},C=function(){p({type:"refresh"})},M=function(){p({type:"urlback"})},Z=function(){p({type:"urlforward"})},q=k("button",[k("icon"),pt,tj,Y({minWidth:"$space$6",justifyContent:"center"})]);return S.jsxs("div",j({className:k("navigator",[Uj,r])},o,{children:[S.jsx("button",{"aria-label":"Go back one page",className:q,disabled:!v,onClick:M,type:"button",children:S.jsx(c2,{})}),S.jsx("button",{"aria-label":"Go forward one page",className:q,disabled:!w,onClick:Z,type:"button",children:S.jsx(u2,{})}),S.jsx("button",{"aria-label":"Refresh page",className:q,onClick:C,type:"button",children:S.jsx(IO,{})}),S.jsx("input",{"aria-label":"Current Sandpack URL",className:k("input",[Fj]),name:"Current Sandpack URL",onChange:T,onKeyDown:E,type:"text",value:m})]}))},vd,Hj=Y((vd={flex:1,display:"flex",flexDirection:"column",background:"white",overflow:"auto",position:"relative"},vd[".".concat(be,"-bridge-frame")]={border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},vd)),Jj=Y({border:"0",outline:"0",width:"100%",height:"100%",minHeight:"160px",maxHeight:"2000px",flex:1}),Kj=Y({display:"flex",position:"absolute",bottom:"$space$2",right:"$space$2",zIndex:"$overlay",gap:"$space$2"}),eA=U.forwardRef(function(t,e){var n=t.showNavigator,i=n===void 0?!1:n,r=t.showRefreshButton,s=r===void 0?!0:r,o=t.showOpenInCodeSandbox,a=o===void 0?!0:o,l=t.showSandpackErrorOverlay,c=l===void 0?!0:l;t.showOpenNewtab;var u=t.showRestartButton,d=u===void 0?!0:u,p=t.actionsChildren,f=p===void 0?S.jsx(S.Fragment,{}):p,h=t.children,m=t.className,g=t.startRoute,O=g===void 0?"/":g,v=Ye(t,["showNavigator","showRefreshButton","showOpenInCodeSandbox","showSandpackErrorOverlay","showOpenNewtab","showRestartButton","actionsChildren","children","className","startRoute"]),x=rx({startRoute:O}),b=x.sandpack,w=x.listen,y=x.iframe,k=x.getClient,T=x.clientId,E=x.dispatch,C=U.useState(null),M=C[0],Z=C[1],q=b.status,N=wj(T).refresh,_=md(T).restart,G=Fe();U.useEffect(function(){var le=w(function(he){he.type==="resize"&&Z(he.height)});return le},[]),U.useImperativeHandle(e,function(){return{clientId:T,getClient:k}},[k,T]);var ee=function(le){y.current&&(y.current.src=le)};return S.jsxs(Es,j({className:G("preview",[m])},v,{children:[i&&S.jsx(Gj,{clientId:T,onURLChange:ee,startRoute:O}),S.jsxs("div",{className:G("preview-container",[Hj]),children:[S.jsx("iframe",{ref:y,className:G("preview-iframe",[Jj]),style:{height:M||void 0},title:"Sandpack Preview"}),S.jsxs("div",{className:G("preview-actions",[Kj]),children:[f,d&&b.environment==="node"&&S.jsx(Cs,{onClick:_,children:S.jsx(Ea,{})}),!i&&s&&q==="running"&&S.jsx(Cs,{onClick:N,children:S.jsx(IO,{})}),b.teamId&&S.jsx("button",{className:G("button",[G("icon-standalone"),pt,In,Ii]),onClick:function(){return E({type:"sign-out"})},title:"Sign out",type:"button",children:S.jsx(a2,{})}),a&&S.jsx(cx,{})]}),S.jsx(Vj,{clientId:T,showOpenInCodeSandbox:a}),c&&S.jsx($j,{}),h]})]}))}),Od;Y((Od={display:"flex",flexDirection:"column",width:"100%",position:"relative",overflow:"auto",minHeight:"160px",flex:1},Od[".".concat(be,"-stack")]={height:"100%"},Od)),Y({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"}),Y({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"});var Za=Y({variants:{status:{pass:{color:"var(--test-pass)"},fail:{color:"var(--test-fail)"},skip:{color:"var(--test-skip)"},title:{color:"var(--test-title)"}}}});Za({status:"pass"}),Za({status:"fail"}),Za({status:"skip"}),Za({status:"title"});var xd=Y({variants:{status:{pass:{background:"var(--test-pass)",color:"$colors$surface1"},fail:{background:"var(--test-fail)",color:"$colors$surface1"},run:{background:"var(--test-run)",color:"$colors$surface1"}}}});xd({status:"run"}),xd({status:"pass"}),xd({status:"fail"}),Y({marginLeft:"$space$4"}),Y({marginBottom:"$space$2",color:"$colors$clickable"}),Y({marginBottom:"$space$2",color:"$colors$hover"}),Y({marginLeft:"$space$2"}),Y({marginRight:"$space$2"}),Y({color:"$colors$hover",marginBottom:"$space$2"}),Y({marginLeft:"$space$4"}),Y({color:"$colors$hover",fontSize:"$font$size",padding:"$space$2",whiteSpace:"pre-wrap"}),Y({display:"flex",flexDirection:"row",alignItems:"center",marginBottom:"$space$2"}),Y({marginBottom:"$space$2"}),Y({fontWeight:"bold"}),Y({borderRadius:"calc($border$radius / 2)"}),Y({padding:"$space$1 $space$2",fontFamily:"$font$mono",textTransform:"uppercase",marginRight:"$space$2"}),Y({fontFamily:"$font$mono",cursor:"pointer",display:"inline-block"}),Y({color:"$colors$clickable",textDecorationStyle:"dotted",textDecorationLine:"underline"}),Y({color:"$colors$hover",fontWeight:"bold",textDecorationStyle:"dotted",textDecorationLine:"underline"}),Y({marginBottom:"$space$2"}),Y({fontWeight:"bold",color:"$colors$hover",whiteSpace:"pre-wrap"}),Y({fontWeight:"bold",color:"$colors$clickable"}),Y({display:"flex",position:"absolute",bottom:"$space$2",right:"$space$2",zIndex:"$overlay","> *":{marginLeft:"$space$2"}}),Y({padding:"$space$4",height:"100%",overflow:"auto",display:"flex",flexDirection:"column",position:"relative",fontFamily:"$font$mono"}),Y({fontWeight:"bold",color:"$colors$base"});var tA=["SyntaxError: ","Error in sandbox:"],nA={id:"random",method:"clear",data:["Console was cleared"]},ux="@t",dx="#@t",px="@r",fx=1e4,hx=2,bd=400,iA=bd*2,yd=function(){var e=eval;return e("this")}(),rA=typeof ArrayBuffer=="function",sA=typeof Map=="function",oA=typeof Set=="function",js;(function(t){t[t.infinity=0]="infinity",t[t.minusInfinity=1]="minusInfinity",t[t.minusZero=2]="minusZero"})(js||(js={}));var mx={Arithmetic:function(t){return t===js.infinity?1/0:t===js.minusInfinity?-1/0:t===js.minusZero?-0:t},HTMLElement:function(t){var e=document.implementation.createHTMLDocument("sandbox");try{var n=e.createElement(t.tagName);n.innerHTML=t.innerHTML;for(var i=0,r=Object.keys(t.attributes);i<r.length;i++){var s=r[i];try{n.setAttribute(s,t.attributes[s])}catch{}}return n}catch{return t}},Function:function(t){var e=function(){};return Object.defineProperty(e,"toString",{value:function(){return"function ".concat(t.name,"() {").concat(t.body,"}")}}),e},"[[NaN]]":function(){return NaN},"[[undefined]]":function(){},"[[Date]]":function(t){var e=new Date;return e.setTime(t),e},"[[RegExp]]":function(t){return new RegExp(t.src,t.flags)},"[[Error]]":function(t){var e=yd[t.name]||Error,n=new e(t.message);return n.stack=t.stack,n},"[[ArrayBuffer]]":function(t){if(rA){var e=new ArrayBuffer(t.length),n=new Int8Array(e);return n.set(t),e}return t},"[[TypedArray]]":function(t){return typeof yd[t.ctorName]=="function"?new yd[t.ctorName](t.arr):t.arr},"[[Map]]":function(t){if(sA){for(var e=new Map,n=0;n<t.length;n+=2)e.set(t[n],t[n+1]);return e}for(var i=[],r=0;r<t.length;r+=2)i.push([t[n],t[n+1]]);return i},"[[Set]]":function(t){if(oA){for(var e=new Set,n=0;n<t.length;n++)e.add(t[n]);return e}return t}},wd=function(t){var e;if(typeof t=="string"||typeof t=="number"||t===null)return t;if(Array.isArray(t))return t.map(wd);if(typeof t=="object"&&ux in t){var n=t[ux],i=mx[n];return i(t.data)}else if(typeof t=="object"&&dx in t){var n=t[dx],i=mx[n];return i(t.data)}else if(typeof t=="object"&&((e=t.constructor)===null||e===void 0?void 0:e.name)==="NodeList"){var r={};return Object.entries(t).forEach(function(s){var o=s[0],a=s[1];r[o]=wd(a)}),r}return t},aA=function(t,e,n){var i=t.reduce(function(r,s,o){return"".concat(r).concat(o?", ":"").concat(As(s,e,n))},"");return"[".concat(i,"]")},lA=function(t,e,n){var i=t.constructor.name!=="Object"?"".concat(t.constructor.name," "):"";if(n>hx)return i;var r=Object.entries(t),s=Object.entries(t).reduce(function(o,a,l){var c=a[0],u=a[1],d=l===0?"":", ",p=r.length>10?`
|
|
754
754
|
`:"",f=As(u,e,n);return l===bd?o+p+"...":l>bd?o:o+"".concat(d).concat(p).concat(c,": ")+f},"");return"".concat(i,"{ ").concat(s).concat(r.length>10?`
|
|
755
|
-
`:" ","}")},As=function(t,e,n){var i;n===void 0&&(n=0);try{var r=wd(t);if(Array.isArray(r))return aA(r,e,n+1);switch(typeof r){case"string":return'"'.concat(r,'"').slice(0,fx);case"number":case"function":case"symbol":return r.toString();case"boolean":return String(r);case"undefined":return"undefined";case"object":default:if(r instanceof RegExp||r instanceof Error||r instanceof Date)return r.toString();if(r===null)return String(null);if(r instanceof HTMLElement)return r.outerHTML.slice(0,fx);if(Object.entries(r).length===0)return"{}";if(px in r){if(n>hx)return"Unable to print information";var s=e[r[px]];return As(s,e,n+1)}if(((i=r.constructor)===null||i===void 0?void 0:i.name)==="NodeList"){var o=r.length,a=new Array(o).fill(null).map(function(l,c){return As(r[c],e)});return"NodeList(".concat(r.length,")[").concat(a,"]")}return lA(r,e,n+1)}}catch{return"Unable to print information"}},cA=function(t){switch(t){case"warn":return"warning";case"clear":return"clear";case"error":return"error";case"log":case"info":default:return"info"}},Na,uA=function(t){var e=t.data,n=Fe();return S.jsx(S.Fragment,{children:e.map(function(i,r,s){var o=i.data,a=i.id,l=i.method;return o&&Array.isArray(o)?S.jsx(U.Fragment,{children:o.map(function(c,u){var d=s.slice(r,s.length);return S.jsx("div",{className:n("console-item",[dA({variant:cA(l)})]),children:S.jsx(hd,{code:l==="clear"?c:As(c,d),fileType:"js",initMode:"user-visible",showReadOnly:!1,readOnly:!0,wrapContent:!0})},"".concat(a,"-").concat(u))})},a):null})})},dA=Y((Na={width:"100%",padding:"$space$3 $space$2",fontSize:".8em",position:"relative","&:not(:first-child):after":{content:"",position:"absolute",top:0,left:0,right:0,height:1,background:"$colors$surface3"},".sp-cm":{padding:0},".cm-editor":{background:"none"},".cm-content":{padding:0}},Na[".".concat(be,"-pre-placeholder")]={margin:"0 !important",fontSize:"1em"},Na.variants={variant:{error:{color:"$colors$error",background:"$colors$errorSurface","&:not(:first-child):after":{background:"$colors$error",opacity:.07}},warning:{color:"$colors$warning",background:"$colors$warningSurface","&:not(:first-child):after":{background:"$colors$warning",opacity:.07}},clear:{fontStyle:"italic"},info:{}}},Na)),pA=Y({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"}),gx=Y({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"}),fA=function(t){var e=t.currentTab,n=t.setCurrentTab,i=t.node,r=Fe(),s=r("console-header-button",[pt,Ii,Y({padding:"$space$1 $space$3"})]);return S.jsxs("div",{className:r("console-header",[pA,gx]),children:[S.jsxs("p",{className:r("console-header-title",[Y({lineHeight:1,margin:0,color:"$colors$base",fontSize:"$font$size",display:"flex",alignItems:"center",gap:"$space$2"})]),children:[S.jsx(h2,{}),S.jsx("span",{children:"Terminal"})]}),i&&S.jsxs("div",{className:r("console-header-actions",[gx]),children:[S.jsx("button",{className:s,"data-active":e==="server",onClick:function(){return n("server")},type:"button",children:"Server"}),S.jsx("button",{className:s,"data-active":e==="client",onClick:function(){return n("client")},type:"button",children:"Client"})]})]})},hA=function(t){var e=t.clientId,n=t.maxMessageCount,i=n===void 0?iA:n,r=t.showSyntaxError,s=r===void 0?!1:r,o=t.resetOnPreviewRestart,a=o===void 0?!1:o,l=U.useState([]),c=l[0],u=l[1],d=Ce().listen;return U.useEffect(function(){var p=d(function(f){if(a&&f.type==="start")u([]);else if(f.type==="console"&&f.codesandbox){var h=Array.isArray(f.log)?f.log:[f.log];if(h.find(function(g){var O=g.method;return O==="clear"}))return u([nA]);var m=s?h:h.filter(function(g){var O,v,x,b=(x=(v=(O=g==null?void 0:g.data)===null||O===void 0?void 0:O.filter)===null||v===void 0?void 0:v.call(O,function(w){if(typeof w!="string")return!0;var y=tA.filter(function(k){return w.startsWith(k)});return y.length===0}))!==null&&x!==void 0?x:[];return b.length>0});if(!m)return;u(function(g){for(var O=st(st([],g,!0),m,!0).filter(function(v,x,b){return x===b.findIndex(function(w){return w.id===v.id})});O.length>i;)O.shift();return O})}},e);return p},[s,i,e,a]),{logs:c,reset:function(){return u([])}}},mA=U.forwardRef(function(t,e){var n,i=t.showHeader,r=i===void 0?!0:i,s=t.showSyntaxError,o=s===void 0?!1:s,a=t.maxMessageCount,l=t.onLogsChange,c=t.className;t.showSetupProgress;var u=t.showResetConsoleButton,d=u===void 0?!0:u,p=t.showRestartButton,f=p===void 0?!0:p,h=t.resetOnPreviewRestart,m=h===void 0?!1:h,g=t.actionsChildren,O=g===void 0?S.jsx(S.Fragment,{}):g,v=t.standalone,x=v===void 0?!1:v,b=Ye(t,["showHeader","showSyntaxError","maxMessageCount","onLogsChange","className","showSetupProgress","showResetConsoleButton","showRestartButton","resetOnPreviewRestart","actionsChildren","standalone"]),w=Ce().sandpack.environment,y=rx(),k=y.iframe,T=y.clientId,E=md().restart,C=U.useState(w==="node"?"server":"client"),M=C[0],Z=C[1],q=x?T:void 0,N=hA({maxMessageCount:a,showSyntaxError:o,resetOnPreviewRestart:m,clientId:q}),_=N.logs,G=N.reset,ee=ox({maxMessageCount:a,resetOnPreviewRestart:m,clientId:q}),le=ee.logs,he=ee.reset,B=U.useRef(null);U.useEffect(function(){l==null||l(_),B.current&&(B.current.scrollTop=B.current.scrollHeight)},[l,_,le,M]);var A=M==="server",V=w==="node";U.useImperativeHandle(e,function(){return{reset:function(){G(),he()}}});var X=Fe();return S.jsxs(Es,j({className:X("console",[Y((n={height:"100%",background:"$surface1",iframe:{display:"none"}},n[".".concat(be,"-bridge-frame")]={display:"block",border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},n)),c])},b,{children:[r&&V&&S.jsx(fA,{currentTab:M,node:V,setCurrentTab:Z}),S.jsx("div",{ref:B,className:X("console-list",[Y({overflow:"auto",scrollBehavior:"smooth"})]),children:A?S.jsx(ax,{data:le}):S.jsx(uA,{data:_})}),S.jsxs("div",{className:X("console-actions",[Y({position:"absolute",bottom:"$space$2",right:"$space$2",display:"flex",gap:"$space$2"})]),children:[O,f&&A&&S.jsx(Cs,{onClick:function(){E(),G(),he()},children:S.jsx(Ea,{})}),d&&S.jsx(Cs,{onClick:function(){M==="client"?G():he()},children:S.jsx(d2,{})})]}),x&&S.jsxs(S.Fragment,{children:[S.jsx(zj,{clientId:q}),S.jsx("iframe",{ref:k})]})]}))});Y({position:"absolute",zIndex:"$top",variants:{direction:{vertical:{right:0,left:0,height:10,cursor:"ns-resize"},horizontal:{top:0,bottom:0,width:10,cursor:"ew-resize"}}},"@media screen and (max-width: 768px)":{display:"none"}}),Y({position:"relative",strong:{background:"$colors$clickable",color:"$colors$surface1",minWidth:12,height:12,padding:"0 2px",borderRadius:12,fontSize:8,lineHeight:"12px",position:"absolute",top:0,right:0,fontWeight:"normal"}}),Y({width:"100%",overflow:"hidden"}),Y({flexDirection:"row-reverse","@media screen and (max-width: 768px)":{flexFlow:"wrap-reverse !important",flexDirection:"initial"}});const gA={html:"html",css:"css",js:"javascript",jsx:"javascript",ts:"typescript",tsx:"javascript",json:"json",md:"markdown",txt:"plaintext",vue:"vue"},vA=t=>{const{code:e,updateCode:n}=rd(),{sandpack:i}=Ce(),r=gA[i.activeFile.split(".").pop()??"js"];return t.editorFiles.current=i,S.jsxs(Es,{style:{height:"100vh",margin:0},children:[S.jsx(cd,{closableTabs:!0}),S.jsx("div",{style:{flex:1,paddingTop:8,minWidth:600,background:"#1e1e1e"},children:S.jsx(cS,{width:"100%",height:"100%",language:r,theme:"vs-dark",defaultValue:e,onChange:s=>n(s||"")},i.activeFile)})]})};function OA(t){return t.reduceRight((e,n)=>({[n]:e}),null)}function Sd(t,e,n,i){var s,o,a,l,c,u;const r=Object.assign({},e);for(const d in n)r[d]||(r[d]={}),typeof n[d]=="object"?((s=Object.keys((e==null?void 0:e[d])||{}))==null?void 0:s.length)===0&&((o=Object.keys((n==null?void 0:n[d])||{}))==null?void 0:o.length)===0?r[d]=(a=t[`${d}`])==null?void 0:a.code:((l=Object.keys((e==null?void 0:e[d])||{}))==null?void 0:l.length)===0?r[d]=Object.entries(n[d]).reduce((p,[f,h])=>{var m;return h!==null?p[f]=Sd(t,r[d],h,i):p[f]=(m=t[`${d}/${f}`])==null?void 0:m.code,p},{}):((c=Object.keys((n==null?void 0:n[d])||{}))==null?void 0:c.length)===0?r[d]=e[d]:r[d]=Sd(t,r[d],n[d],i):r[d]=(u=t[`${i}`])==null?void 0:u.code;return r}const vx=(t,e)=>Object.fromEntries(Object.entries(t).filter(([n])=>!e.includes(n))),Ds=(t,e={})=>{const n=typeof e=="string"?{[e]:""}:e??{};return Object.keys({...t,...n}).reduce((r,s)=>{const o=s.split("/").splice(1),a=OA(o);return r=Sd(t,r,a,s),r},{})},Ni=(t,e)=>{let n="",i=e.find(({id:r})=>r===t.parent);return i&&(n=`${Ni(i,e)}/${n}`),n+=`${t.text}`,n},yr=(t,e="/",n=[])=>{for(let i in t)if(t.hasOwnProperty(i)){const r=i;let s=Ni({id:"",parent:e,text:r,droppable:!1,data:{path:""}},n);const o={id:s,parent:e,text:r,data:{path:`/${s}`},droppable:!1};typeof t[i]=="object"&&t[i]!==null?(o.droppable=!0,n.push(o),yr(t[i],s,n)):n.push(o)}return n},Ox=t=>{var n,i,r;let e="";try{e=(i=JSON.parse((n=t["/package.json"])==null?void 0:n.code))==null?void 0:i.main}catch{const o=/\"main\"\s*:\s*\"([^"]+)\"/.exec((r=t["/package.json"])==null?void 0:r.code);e=(o==null?void 0:o[1])??""}return e};function xA(t,e){const n=[];for(let i in t)t.hasOwnProperty(i)&&!e.hasOwnProperty(i)&&n.push(i);return n}function xx(t,e){let n={};for(let i=0;i<(e==null?void 0:e.length);i++){let r=e[i],s=Ni(r,e);n[`/${s}`]=t[`${r.data.path}`],r.droppable&&!n[`/${s}`]&&(n[`/${s}`]={code:".emptyDir",hidden:!0},n[`/${s}/`]={code:".emptyDir",hidden:!0}),r.data.path=`/${s}`}return n}const bx=P.createContext(null),yx=()=>{const t=P.useContext(bx);if(!t)throw Error("<SandpackFileTree/> must be used inside a <SandpackFilesProvider>, you may be looking for <SandpackFileExplorer/>?");return t},bA=({children:t,onMoveFile:e})=>{const{sandpack:n}=Ce(),[i,r]=P.useState(()=>yr(Ds({...n.files}))),[s,o]=P.useState([]),a=async f=>{var b,w;const h=(w=JSON.parse((b=n.files["/package.json"])==null?void 0:b.code))==null?void 0:w.main,m=typeof f=="string"?[f]:f;if(m.includes(h))return;const g={...n.files},O=(y,k)=>{const T=[];return(k==null?void 0:k.filter(({parent:C})=>C===y)).forEach(C=>{T.push(Ni(C,k)),C.id!=="/"&&C.id!==y&&T.push(...O(C.id,k))}),T},v=m.map(async y=>{if(y.endsWith("/")){const T=y.substring(0,y.length-1),E=T.substring(1);n.deleteFile(`${T}`),delete g[T],O(E,i).forEach(M=>{n.deleteFile(`/${M}`),delete g[`/${M}`]})}n.deleteFile(y),delete g[y]});await Promise.all(v);const x=vx(g,m);r(yr(Ds(x)))},l=async f=>{for(let O in f)(n.files[O]||n.files[O.endsWith("/")?O.substring(0,O.length-1):`${O}/`])&&delete f[O];n.addFile(f);const h=Object.keys(n.files).filter(O=>O.includes("addDir")||O.includes("addFile")),m=Object.keys(f);if(m.filter(O=>O.includes("addDir")||O.includes("addFile")).length){const O=yr(Ds({...n.files},f));r(O);const v=Object.keys(f)[0].substring(1),x=c({childId:v,tree:O});o(b=>Array.from(new Set([...b,...x])))}else{await a(h);const O=vx({...n.files},h);r(yr(Ds(O,f))),m.forEach(v=>{v.endsWith("/")||n.openFile(v)})}},c=({childId:f,tree:h})=>{var O;const m=[],g=(O=h.find(({id:v})=>v===f))==null?void 0:O.parent;return!g||g==="/"||(m.push(`${g}`),m.push(...c({childId:g,tree:h}))),m},p={addFile:l,treeData:i,setTreeData:r,buildPath:Ni,deleteFile:a,onFileMoved:async({node:f,newTree:h})=>{const m={...n.files},g=xx(m,i),O=xx(m,h),v=xA(g,O),x=v.map(k=>{a(k)});await Promise.all(x),n.addFile(O);const b=v.reduce((k,T)=>{var C,M,Z,q,N;const E=`/${Ni({parent:((C=f.dropTarget)==null?void 0:C.id)??"/",text:(M=f==null?void 0:f.dragSource)==null?void 0:M.text},h)}`;return k[T]=`${E}${T.substring(T.indexOf((Z=f==null?void 0:f.dragSource)==null?void 0:Z.id)+((N=(q=f==null?void 0:f.dragSource)==null?void 0:q.id)==null?void 0:N.length))}`,k},{});e==null||e(b);const w=n.activeFile;let y=n.activeFile;n.visibleFiles.forEach(k=>{b[k]&&(n.openFile(b[k]),w===k&&(y=b[k]))}),n.setActiveFile(y)},moveFiles:async f=>{const h={...n.files};for(let x in f)h[x]&&(h[f[x]]=h[x]);const m=Object.keys(f).map(x=>{h[x]&&(delete h[x],a(x))});await Promise.all(m),n.addFile(h);const g=n.activeFile;let O=n.activeFile;n.visibleFiles.forEach(x=>{f[x]&&(n.openFile(f[x]),g===x&&(O=x))}),n.setActiveFile(O);const v=yr(Ds({...h}));r(v)},openDirs:s,setOpenDirs:o};return S.jsx(bx.Provider,{value:p,children:t})};function wx(t){let e=null;return()=>(e==null&&(e=t()),e)}function yA(t,e){return t.filter(n=>n!==e)}function wA(t,e){const n=new Set,i=s=>n.add(s);t.forEach(i),e.forEach(i);const r=[];return n.forEach(s=>r.push(s)),r}class SA{enter(e){const n=this.entered.length,i=r=>this.isNodeInDocument(r)&&(!r.contains||r.contains(e));return this.entered=wA(this.entered.filter(i),[e]),n===0&&this.entered.length>0}leave(e){const n=this.entered.length;return this.entered=yA(this.entered.filter(this.isNodeInDocument),e),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class PA{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){const n={};Object.keys(this.config.exposeProperties).forEach(i=>{const r=this.config.exposeProperties[i];r!=null&&(n[i]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,n){return n===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Sx="__NATIVE_FILE__",Px="__NATIVE_URL__",kx="__NATIVE_TEXT__",$x="__NATIVE_HTML__",Tx=Object.freeze(Object.defineProperty({__proto__:null,FILE:Sx,HTML:$x,TEXT:kx,URL:Px},Symbol.toStringTag,{value:"Module"}));function Pd(t,e,n){const i=e.reduce((r,s)=>r||t.getData(s),"");return i??n}const kd={[Sx]:{exposeProperties:{files:t=>Array.prototype.slice.call(t.files),items:t=>t.items,dataTransfer:t=>t},matchesTypes:["Files"]},[$x]:{exposeProperties:{html:(t,e)=>Pd(t,e,""),dataTransfer:t=>t},matchesTypes:["Html","text/html"]},[Px]:{exposeProperties:{urls:(t,e)=>Pd(t,e,"").split(`
|
|
755
|
+
`:" ","}")},As=function(t,e,n){var i;n===void 0&&(n=0);try{var r=wd(t);if(Array.isArray(r))return aA(r,e,n+1);switch(typeof r){case"string":return'"'.concat(r,'"').slice(0,fx);case"number":case"function":case"symbol":return r.toString();case"boolean":return String(r);case"undefined":return"undefined";case"object":default:if(r instanceof RegExp||r instanceof Error||r instanceof Date)return r.toString();if(r===null)return String(null);if(r instanceof HTMLElement)return r.outerHTML.slice(0,fx);if(Object.entries(r).length===0)return"{}";if(px in r){if(n>hx)return"Unable to print information";var s=e[r[px]];return As(s,e,n+1)}if(((i=r.constructor)===null||i===void 0?void 0:i.name)==="NodeList"){var o=r.length,a=new Array(o).fill(null).map(function(l,c){return As(r[c],e)});return"NodeList(".concat(r.length,")[").concat(a,"]")}return lA(r,e,n+1)}}catch{return"Unable to print information"}},cA=function(t){switch(t){case"warn":return"warning";case"clear":return"clear";case"error":return"error";case"log":case"info":default:return"info"}},Na,uA=function(t){var e=t.data,n=Fe();return S.jsx(S.Fragment,{children:e.map(function(i,r,s){var o=i.data,a=i.id,l=i.method;return o&&Array.isArray(o)?S.jsx(U.Fragment,{children:o.map(function(c,u){var d=s.slice(r,s.length);return S.jsx("div",{className:n("console-item",[dA({variant:cA(l)})]),children:S.jsx(hd,{code:l==="clear"?c:As(c,d),fileType:"js",initMode:"user-visible",showReadOnly:!1,readOnly:!0,wrapContent:!0})},"".concat(a,"-").concat(u))})},a):null})})},dA=Y((Na={width:"100%",padding:"$space$3 $space$2",fontSize:".8em",position:"relative","&:not(:first-child):after":{content:"",position:"absolute",top:0,left:0,right:0,height:1,background:"$colors$surface3"},".sp-cm":{padding:0},".cm-editor":{background:"none"},".cm-content":{padding:0}},Na[".".concat(be,"-pre-placeholder")]={margin:"0 !important",fontSize:"1em"},Na.variants={variant:{error:{color:"$colors$error",background:"$colors$errorSurface","&:not(:first-child):after":{background:"$colors$error",opacity:.07}},warning:{color:"$colors$warning",background:"$colors$warningSurface","&:not(:first-child):after":{background:"$colors$warning",opacity:.07}},clear:{fontStyle:"italic"},info:{}}},Na)),pA=Y({justifyContent:"space-between",borderBottom:"1px solid $colors$surface2",padding:"0 $space$2",fontFamily:"$font$mono",height:"$layout$headerHeight",minHeight:"$layout$headerHeight",overflowX:"auto",whiteSpace:"nowrap"}),gx=Y({display:"flex",flexDirection:"row",alignItems:"center",gap:"$space$2"}),fA=function(t){var e=t.currentTab,n=t.setCurrentTab,i=t.node,r=Fe(),s=r("console-header-button",[pt,Ii,Y({padding:"$space$1 $space$3"})]);return S.jsxs("div",{className:r("console-header",[pA,gx]),children:[S.jsxs("p",{className:r("console-header-title",[Y({lineHeight:1,margin:0,color:"$colors$base",fontSize:"$font$size",display:"flex",alignItems:"center",gap:"$space$2"})]),children:[S.jsx(h2,{}),S.jsx("span",{children:"Terminal"})]}),i&&S.jsxs("div",{className:r("console-header-actions",[gx]),children:[S.jsx("button",{className:s,"data-active":e==="server",onClick:function(){return n("server")},type:"button",children:"Server"}),S.jsx("button",{className:s,"data-active":e==="client",onClick:function(){return n("client")},type:"button",children:"Client"})]})]})},hA=function(t){var e=t.clientId,n=t.maxMessageCount,i=n===void 0?iA:n,r=t.showSyntaxError,s=r===void 0?!1:r,o=t.resetOnPreviewRestart,a=o===void 0?!1:o,l=U.useState([]),c=l[0],u=l[1],d=Ce().listen;return U.useEffect(function(){var p=d(function(f){if(a&&f.type==="start")u([]);else if(f.type==="console"&&f.codesandbox){var h=Array.isArray(f.log)?f.log:[f.log];if(h.find(function(g){var O=g.method;return O==="clear"}))return u([nA]);var m=s?h:h.filter(function(g){var O,v,x,b=(x=(v=(O=g==null?void 0:g.data)===null||O===void 0?void 0:O.filter)===null||v===void 0?void 0:v.call(O,function(w){if(typeof w!="string")return!0;var y=tA.filter(function(k){return w.startsWith(k)});return y.length===0}))!==null&&x!==void 0?x:[];return b.length>0});if(!m)return;u(function(g){for(var O=st(st([],g,!0),m,!0).filter(function(v,x,b){return x===b.findIndex(function(w){return w.id===v.id})});O.length>i;)O.shift();return O})}},e);return p},[s,i,e,a]),{logs:c,reset:function(){return u([])}}},mA=U.forwardRef(function(t,e){var n,i=t.showHeader,r=i===void 0?!0:i,s=t.showSyntaxError,o=s===void 0?!1:s,a=t.maxMessageCount,l=t.onLogsChange,c=t.className;t.showSetupProgress;var u=t.showResetConsoleButton,d=u===void 0?!0:u,p=t.showRestartButton,f=p===void 0?!0:p,h=t.resetOnPreviewRestart,m=h===void 0?!1:h,g=t.actionsChildren,O=g===void 0?S.jsx(S.Fragment,{}):g,v=t.standalone,x=v===void 0?!1:v,b=Ye(t,["showHeader","showSyntaxError","maxMessageCount","onLogsChange","className","showSetupProgress","showResetConsoleButton","showRestartButton","resetOnPreviewRestart","actionsChildren","standalone"]),w=Ce().sandpack.environment,y=rx(),k=y.iframe,T=y.clientId,E=md().restart,C=U.useState(w==="node"?"server":"client"),M=C[0],Z=C[1],q=x?T:void 0,N=hA({maxMessageCount:a,showSyntaxError:o,resetOnPreviewRestart:m,clientId:q}),_=N.logs,G=N.reset,ee=ox({maxMessageCount:a,resetOnPreviewRestart:m,clientId:q}),le=ee.logs,he=ee.reset,B=U.useRef(null);U.useEffect(function(){l==null||l(_),B.current&&(B.current.scrollTop=B.current.scrollHeight)},[l,_,le,M]);var A=M==="server",V=w==="node";U.useImperativeHandle(e,function(){return{reset:function(){G(),he()}}});var X=Fe();return S.jsxs(Es,j({className:X("console",[Y((n={height:"100%",background:"$surface1",iframe:{display:"none"}},n[".".concat(be,"-bridge-frame")]={display:"block",border:0,position:"absolute",left:"$space$2",bottom:"$space$2",zIndex:"$top",height:12,width:"30%",mixBlendMode:"multiply",pointerEvents:"none"},n)),c])},b,{children:[r&&V&&S.jsx(fA,{currentTab:M,node:V,setCurrentTab:Z}),S.jsx("div",{ref:B,className:X("console-list",[Y({overflow:"auto",scrollBehavior:"smooth"})]),children:A?S.jsx(ax,{data:le}):S.jsx(uA,{data:_})}),S.jsxs("div",{className:X("console-actions",[Y({position:"absolute",bottom:"$space$2",right:"$space$2",display:"flex",gap:"$space$2"})]),children:[O,f&&A&&S.jsx(Cs,{onClick:function(){E(),G(),he()},children:S.jsx(Ea,{})}),d&&S.jsx(Cs,{onClick:function(){M==="client"?G():he()},children:S.jsx(d2,{})})]}),x&&S.jsxs(S.Fragment,{children:[S.jsx(zj,{clientId:q}),S.jsx("iframe",{ref:k})]})]}))});Y({position:"absolute",zIndex:"$top",variants:{direction:{vertical:{right:0,left:0,height:10,cursor:"ns-resize"},horizontal:{top:0,bottom:0,width:10,cursor:"ew-resize"}}},"@media screen and (max-width: 768px)":{display:"none"}}),Y({position:"relative",strong:{background:"$colors$clickable",color:"$colors$surface1",minWidth:12,height:12,padding:"0 2px",borderRadius:12,fontSize:8,lineHeight:"12px",position:"absolute",top:0,right:0,fontWeight:"normal"}}),Y({width:"100%",overflow:"hidden"}),Y({flexDirection:"row-reverse","@media screen and (max-width: 768px)":{flexFlow:"wrap-reverse !important",flexDirection:"initial"}});const gA={html:"html",css:"css",js:"javascript",jsx:"javascript",ts:"typescript",tsx:"javascript",json:"json",md:"markdown",txt:"plaintext",vue:"vue"},vA=t=>{const{code:e,updateCode:n}=rd(),{sandpack:i}=Ce(),r=gA[i.activeFile.split(".").pop()??"js"];return t.editorRef.current=i,S.jsxs(Es,{style:{height:"100vh",margin:0},children:[S.jsx(cd,{closableTabs:!0}),S.jsx("div",{style:{flex:1,paddingTop:8,minWidth:600,background:"#1e1e1e"},children:S.jsx(cS,{width:"100%",height:"100%",language:r,theme:"vs-dark",defaultValue:e,onChange:s=>n(s||"")},i.activeFile)})]})};function OA(t){return t.reduceRight((e,n)=>({[n]:e}),null)}function Sd(t,e,n,i){var s,o,a,l,c,u;const r=Object.assign({},e);for(const d in n)r[d]||(r[d]={}),typeof n[d]=="object"?((s=Object.keys((e==null?void 0:e[d])||{}))==null?void 0:s.length)===0&&((o=Object.keys((n==null?void 0:n[d])||{}))==null?void 0:o.length)===0?r[d]=(a=t[`${d}`])==null?void 0:a.code:((l=Object.keys((e==null?void 0:e[d])||{}))==null?void 0:l.length)===0?r[d]=Object.entries(n[d]).reduce((p,[f,h])=>{var m;return h!==null?p[f]=Sd(t,r[d],h,i):p[f]=(m=t[`${d}/${f}`])==null?void 0:m.code,p},{}):((c=Object.keys((n==null?void 0:n[d])||{}))==null?void 0:c.length)===0?r[d]=e[d]:r[d]=Sd(t,r[d],n[d],i):r[d]=(u=t[`${i}`])==null?void 0:u.code;return r}const vx=(t,e)=>Object.fromEntries(Object.entries(t).filter(([n])=>!e.includes(n))),Ds=(t,e={})=>{const n=typeof e=="string"?{[e]:""}:e??{};return Object.keys({...t,...n}).reduce((r,s)=>{const o=s.split("/").splice(1),a=OA(o);return r=Sd(t,r,a,s),r},{})},Ni=(t,e)=>{let n="",i=e.find(({id:r})=>r===t.parent);return i&&(n=`${Ni(i,e)}/${n}`),n+=`${t.text}`,n},yr=(t,e="/",n=[])=>{for(let i in t)if(t.hasOwnProperty(i)){const r=i;let s=Ni({id:"",parent:e,text:r,droppable:!1,data:{path:""}},n);const o={id:s,parent:e,text:r,data:{path:`/${s}`},droppable:!1};typeof t[i]=="object"&&t[i]!==null?(o.droppable=!0,n.push(o),yr(t[i],s,n)):n.push(o)}return n},Ox=t=>{var n,i,r;let e="";try{e=(i=JSON.parse((n=t["/package.json"])==null?void 0:n.code))==null?void 0:i.main}catch{const o=/\"main\"\s*:\s*\"([^"]+)\"/.exec((r=t["/package.json"])==null?void 0:r.code);e=(o==null?void 0:o[1])??""}return e};function xA(t,e){const n=[];for(let i in t)t.hasOwnProperty(i)&&!e.hasOwnProperty(i)&&n.push(i);return n}function xx(t,e){let n={};for(let i=0;i<(e==null?void 0:e.length);i++){let r=e[i],s=Ni(r,e);n[`/${s}`]=t[`${r.data.path}`],r.droppable&&!n[`/${s}`]&&(n[`/${s}`]={code:".emptyDir",hidden:!0},n[`/${s}/`]={code:".emptyDir",hidden:!0}),r.data.path=`/${s}`}return n}const bx=P.createContext(null),yx=()=>{const t=P.useContext(bx);if(!t)throw Error("<SandpackFileTree/> must be used inside a <SandpackFilesProvider>, you may be looking for <SandpackFileExplorer/>?");return t},bA=({children:t,onMoveFile:e})=>{const{sandpack:n}=Ce(),[i,r]=P.useState(()=>yr(Ds({...n.files}))),[s,o]=P.useState([]),a=async f=>{var b,w;const h=(w=JSON.parse((b=n.files["/package.json"])==null?void 0:b.code))==null?void 0:w.main,m=typeof f=="string"?[f]:f;if(m.includes(h))return;const g={...n.files},O=(y,k)=>{const T=[];return(k==null?void 0:k.filter(({parent:C})=>C===y)).forEach(C=>{T.push(Ni(C,k)),C.id!=="/"&&C.id!==y&&T.push(...O(C.id,k))}),T},v=m.map(async y=>{if(y.endsWith("/")){const T=y.substring(0,y.length-1),E=T.substring(1);n.deleteFile(`${T}`),delete g[T],O(E,i).forEach(M=>{n.deleteFile(`/${M}`),delete g[`/${M}`]})}n.deleteFile(y),delete g[y]});await Promise.all(v);const x=vx(g,m);r(yr(Ds(x)))},l=async f=>{for(let O in f)(n.files[O]||n.files[O.endsWith("/")?O.substring(0,O.length-1):`${O}/`])&&delete f[O];n.addFile(f);const h=Object.keys(n.files).filter(O=>O.includes("addDir")||O.includes("addFile")),m=Object.keys(f);if(m.filter(O=>O.includes("addDir")||O.includes("addFile")).length){const O=yr(Ds({...n.files},f));r(O);const v=Object.keys(f)[0].substring(1),x=c({childId:v,tree:O});o(b=>Array.from(new Set([...b,...x])))}else{await a(h);const O=vx({...n.files},h);r(yr(Ds(O,f))),m.forEach(v=>{v.endsWith("/")||n.openFile(v)})}},c=({childId:f,tree:h})=>{var O;const m=[],g=(O=h.find(({id:v})=>v===f))==null?void 0:O.parent;return!g||g==="/"||(m.push(`${g}`),m.push(...c({childId:g,tree:h}))),m},p={addFile:l,treeData:i,setTreeData:r,buildPath:Ni,deleteFile:a,onFileMoved:async({node:f,newTree:h})=>{const m={...n.files},g=xx(m,i),O=xx(m,h),v=xA(g,O),x=v.map(k=>{a(k)});await Promise.all(x),n.addFile(O);const b=v.reduce((k,T)=>{var C,M,Z,q,N;const E=`/${Ni({parent:((C=f.dropTarget)==null?void 0:C.id)??"/",text:(M=f==null?void 0:f.dragSource)==null?void 0:M.text},h)}`;return k[T]=`${E}${T.substring(T.indexOf((Z=f==null?void 0:f.dragSource)==null?void 0:Z.id)+((N=(q=f==null?void 0:f.dragSource)==null?void 0:q.id)==null?void 0:N.length))}`,k},{});e==null||e(b);const w=n.activeFile;let y=n.activeFile;n.visibleFiles.forEach(k=>{b[k]&&(n.openFile(b[k]),w===k&&(y=b[k]))}),n.setActiveFile(y)},moveFiles:async f=>{const h={...n.files};for(let x in f)h[x]&&(h[f[x]]=h[x]);const m=Object.keys(f).map(x=>{h[x]&&(delete h[x],a(x))});await Promise.all(m),n.addFile(h);const g=n.activeFile;let O=n.activeFile;n.visibleFiles.forEach(x=>{f[x]&&(n.openFile(f[x]),g===x&&(O=x))}),n.setActiveFile(O);const v=yr(Ds({...h}));r(v)},openDirs:s,setOpenDirs:o};return S.jsx(bx.Provider,{value:p,children:t})};function wx(t){let e=null;return()=>(e==null&&(e=t()),e)}function yA(t,e){return t.filter(n=>n!==e)}function wA(t,e){const n=new Set,i=s=>n.add(s);t.forEach(i),e.forEach(i);const r=[];return n.forEach(s=>r.push(s)),r}class SA{enter(e){const n=this.entered.length,i=r=>this.isNodeInDocument(r)&&(!r.contains||r.contains(e));return this.entered=wA(this.entered.filter(i),[e]),n===0&&this.entered.length>0}leave(e){const n=this.entered.length;return this.entered=yA(this.entered.filter(this.isNodeInDocument),e),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(e){this.entered=[],this.isNodeInDocument=e}}class PA{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(e=>{Object.defineProperty(this.item,e,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${e}" until the drop event.`),null}})})}loadDataTransfer(e){if(e){const n={};Object.keys(this.config.exposeProperties).forEach(i=>{const r=this.config.exposeProperties[i];r!=null&&(n[i]={value:r(e,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(e,n){return n===e.getSourceId()}endDrag(){}constructor(e){this.config=e,this.item={},this.initializeExposedProperties()}}const Sx="__NATIVE_FILE__",Px="__NATIVE_URL__",kx="__NATIVE_TEXT__",$x="__NATIVE_HTML__",Tx=Object.freeze(Object.defineProperty({__proto__:null,FILE:Sx,HTML:$x,TEXT:kx,URL:Px},Symbol.toStringTag,{value:"Module"}));function Pd(t,e,n){const i=e.reduce((r,s)=>r||t.getData(s),"");return i??n}const kd={[Sx]:{exposeProperties:{files:t=>Array.prototype.slice.call(t.files),items:t=>t.items,dataTransfer:t=>t},matchesTypes:["Files"]},[$x]:{exposeProperties:{html:(t,e)=>Pd(t,e,""),dataTransfer:t=>t},matchesTypes:["Html","text/html"]},[Px]:{exposeProperties:{urls:(t,e)=>Pd(t,e,"").split(`
|
|
756
756
|
`),dataTransfer:t=>t},matchesTypes:["Url","text/uri-list"]},[kx]:{exposeProperties:{text:(t,e)=>Pd(t,e,""),dataTransfer:t=>t},matchesTypes:["Text","text/plain"]}};function kA(t,e){const n=kd[t];if(!n)throw new Error(`native type ${t} has no configuration`);const i=new PA(n);return i.loadDataTransfer(e),i}function $d(t){if(!t)return null;const e=Array.prototype.slice.call(t.types||[]);return Object.keys(kd).filter(n=>{const i=kd[n];return i!=null&&i.matchesTypes?i.matchesTypes.some(r=>e.indexOf(r)>-1):!1})[0]||null}const $A=wx(()=>/firefox/i.test(navigator.userAgent)),Qx=wx(()=>!!window.safari);class Cx{interpolate(e){const{xs:n,ys:i,c1s:r,c2s:s,c3s:o}=this;let a=n.length-1;if(e===n[a])return i[a];let l=0,c=o.length-1,u;for(;l<=c;){u=Math.floor(.5*(l+c));const f=n[u];if(f<e)l=u+1;else if(f>e)c=u-1;else return i[u]}a=Math.max(0,c);const d=e-n[a],p=d*d;return i[a]+r[a]*d+s[a]*p+o[a]*d*p}constructor(e,n){const{length:i}=e,r=[];for(let f=0;f<i;f++)r.push(f);r.sort((f,h)=>e[f]<e[h]?-1:1);const s=[],o=[];let a,l;for(let f=0;f<i-1;f++)a=e[f+1]-e[f],l=n[f+1]-n[f],s.push(a),o.push(l/a);const c=[o[0]];for(let f=0;f<s.length-1;f++){const h=o[f],m=o[f+1];if(h*m<=0)c.push(0);else{a=s[f];const g=s[f+1],O=a+g;c.push(3*O/((O+g)/h+(O+a)/m))}}c.push(o[o.length-1]);const u=[],d=[];let p;for(let f=0;f<c.length-1;f++){p=o[f];const h=c[f],m=1/s[f],g=h+c[f+1]-p-p;u.push((p-h-g)*m),d.push(g*m*m)}this.xs=e,this.ys=n,this.c1s=c,this.c2s=u,this.c3s=d}}const TA=1;function Ex(t){const e=t.nodeType===TA?t:t.parentElement;if(!e)return null;const{top:n,left:i}=e.getBoundingClientRect();return{x:i,y:n}}function La(t){return{x:t.clientX,y:t.clientY}}function QA(t){var e;return t.nodeName==="IMG"&&($A()||!(!((e=document.documentElement)===null||e===void 0)&&e.contains(t)))}function CA(t,e,n,i){let r=t?e.width:n,s=t?e.height:i;return Qx()&&t&&(s/=window.devicePixelRatio,r/=window.devicePixelRatio),{dragPreviewWidth:r,dragPreviewHeight:s}}function EA(t,e,n,i,r){const s=QA(e),a=Ex(s?t:e),l={x:n.x-a.x,y:n.y-a.y},{offsetWidth:c,offsetHeight:u}=t,{anchorX:d,anchorY:p}=i,{dragPreviewWidth:f,dragPreviewHeight:h}=CA(s,e,c,u),m=()=>{let y=new Cx([0,.5,1],[l.y,l.y/u*h,l.y+h-u]).interpolate(p);return Qx()&&s&&(y+=(window.devicePixelRatio-1)*h),y},g=()=>new Cx([0,.5,1],[l.x,l.x/c*f,l.x+f-c]).interpolate(d),{offsetX:O,offsetY:v}=r,x=O===0||O,b=v===0||v;return{x:x?O:g(),y:b?v:m()}}let jA=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var e;return!((e=this.globalContext)===null||e===void 0)&&e.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var e;return((e=this.optionsArgs)===null||e===void 0?void 0:e.rootElement)||this.window}constructor(e,n){this.ownerDocument=null,this.globalContext=e,this.optionsArgs=n}};function AA(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jx(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},i=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),i.forEach(function(r){AA(t,r,n[r])})}return t}class DA{profile(){var e,n;return{sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,sourceNodeOptions:this.sourceNodeOptions.size,sourceNodes:this.sourceNodes.size,dragStartSourceIds:((e=this.dragStartSourceIds)===null||e===void 0?void 0:e.length)||0,dropTargetIds:this.dropTargetIds.length,dragEnterTargetIds:this.dragEnterTargetIds.length,dragOverTargetIds:((n=this.dragOverTargetIds)===null||n===void 0?void 0:n.length)||0}}get window(){return this.options.window}get document(){return this.options.document}get rootElement(){return this.options.rootElement}setup(){const e=this.rootElement;if(e!==void 0){if(e.__isReactDndBackendSetUp)throw new Error("Cannot have two HTML5 backends at the same time.");e.__isReactDndBackendSetUp=!0,this.addEventListeners(e)}}teardown(){const e=this.rootElement;if(e!==void 0&&(e.__isReactDndBackendSetUp=!1,this.removeEventListeners(this.rootElement),this.clearCurrentDragSourceNode(),this.asyncEndDragFrameId)){var n;(n=this.window)===null||n===void 0||n.cancelAnimationFrame(this.asyncEndDragFrameId)}}connectDragPreview(e,n,i){return this.sourcePreviewNodeOptions.set(e,i),this.sourcePreviewNodes.set(e,n),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDragSource(e,n,i){this.sourceNodes.set(e,n),this.sourceNodeOptions.set(e,i);const r=o=>this.handleDragStart(o,e),s=o=>this.handleSelectStart(o);return n.setAttribute("draggable","true"),n.addEventListener("dragstart",r),n.addEventListener("selectstart",s),()=>{this.sourceNodes.delete(e),this.sourceNodeOptions.delete(e),n.removeEventListener("dragstart",r),n.removeEventListener("selectstart",s),n.setAttribute("draggable","false")}}connectDropTarget(e,n){const i=o=>this.handleDragEnter(o,e),r=o=>this.handleDragOver(o,e),s=o=>this.handleDrop(o,e);return n.addEventListener("dragenter",i),n.addEventListener("dragover",r),n.addEventListener("drop",s),()=>{n.removeEventListener("dragenter",i),n.removeEventListener("dragover",r),n.removeEventListener("drop",s)}}addEventListeners(e){e.addEventListener&&(e.addEventListener("dragstart",this.handleTopDragStart),e.addEventListener("dragstart",this.handleTopDragStartCapture,!0),e.addEventListener("dragend",this.handleTopDragEndCapture,!0),e.addEventListener("dragenter",this.handleTopDragEnter),e.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.addEventListener("dragover",this.handleTopDragOver),e.addEventListener("dragover",this.handleTopDragOverCapture,!0),e.addEventListener("drop",this.handleTopDrop),e.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(e){e.removeEventListener&&(e.removeEventListener("dragstart",this.handleTopDragStart),e.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),e.removeEventListener("dragend",this.handleTopDragEndCapture,!0),e.removeEventListener("dragenter",this.handleTopDragEnter),e.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),e.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),e.removeEventListener("dragover",this.handleTopDragOver),e.removeEventListener("dragover",this.handleTopDragOverCapture,!0),e.removeEventListener("drop",this.handleTopDrop),e.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const e=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(e);return jx({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const e=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(e);return jx({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}isDraggingNativeItem(){const e=this.monitor.getItemType();return Object.keys(Tx).some(n=>Tx[n]===e)}beginDragNativeItem(e,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=kA(e,n),this.currentNativeHandle=this.registry.addSource(e,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(e){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=e;const n=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var i;return(i=this.rootElement)===null||i===void 0?void 0:i.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},n)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var e;(e=this.window)===null||e===void 0||e.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(e,n){e.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}handleDragEnter(e,n){this.dragEnterTargetIds.unshift(n)}handleDragOver(e,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}handleDrop(e,n){this.dropTargetIds.unshift(n)}constructor(e,n,i){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=r=>{const s=this.sourceNodes.get(r);return s&&Ex(s)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=r=>!!(r&&this.document&&this.document.body&&this.document.body.contains(r)),this.endDragIfSourceWasRemovedFromDOM=()=>{const r=this.currentDragSourceNode;r==null||this.isNodeInDocument(r)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=r=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(r||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=r=>{if(r.defaultPrevented)return;const{dragStartSourceIds:s}=this;this.dragStartSourceIds=null;const o=La(r);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(s||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:o});const{dataTransfer:a}=r,l=$d(a);if(this.monitor.isDragging()){if(a&&typeof a.setDragImage=="function"){const u=this.monitor.getSourceId(),d=this.sourceNodes.get(u),p=this.sourcePreviewNodes.get(u)||d;if(p){const{anchorX:f,anchorY:h,offsetX:m,offsetY:g}=this.getCurrentSourcePreviewNodeOptions(),x=EA(d,p,o,{anchorX:f,anchorY:h},{offsetX:m,offsetY:g});a.setDragImage(p,x.x,x.y)}}try{a==null||a.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(r.target);const{captureDraggingState:c}=this.getCurrentSourcePreviewNodeOptions();c?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(l)this.beginDragNativeItem(l);else{if(a&&!a.types&&(r.target&&!r.target.hasAttribute||!r.target.hasAttribute("draggable")))return;r.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=r=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var s;(s=this.currentNativeSource)===null||s===void 0||s.loadDataTransfer(r.dataTransfer)}if(!this.enterLeaveCounter.enter(r.target)||this.monitor.isDragging())return;const{dataTransfer:a}=r,l=$d(a);l&&this.beginDragNativeItem(l,a)},this.handleTopDragEnter=r=>{const{dragEnterTargetIds:s}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=r.altKey,s.length>0&&this.actions.hover(s,{clientOffset:La(r)}),s.some(a=>this.monitor.canDropOnTarget(a))&&(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=r=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var s;(s=this.currentNativeSource)===null||s===void 0||s.loadDataTransfer(r.dataTransfer)}},this.handleTopDragOver=r=>{const{dragOverTargetIds:s}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="none");return}this.altKeyPressed=r.altKey,this.lastClientOffset=La(r),this.scheduleHover(s),(s||[]).some(a=>this.monitor.canDropOnTarget(a))?(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?r.preventDefault():(r.preventDefault(),r.dataTransfer&&(r.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=r=>{this.isDraggingNativeItem()&&r.preventDefault(),this.enterLeaveCounter.leave(r.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=r=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var s;r.preventDefault(),(s=this.currentNativeSource)===null||s===void 0||s.loadDataTransfer(r.dataTransfer)}else $d(r.dataTransfer)&&r.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=r=>{const{dropTargetIds:s}=this;this.dropTargetIds=[],this.actions.hover(s,{clientOffset:La(r)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=r=>{const s=r.target;typeof s.dragDrop=="function"&&(s.tagName==="INPUT"||s.tagName==="SELECT"||s.tagName==="TEXTAREA"||s.isContentEditable||(r.preventDefault(),s.dragDrop()))},this.options=new jA(n,i),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.registry=e.getRegistry(),this.enterLeaveCounter=new SA(this.isNodeInDocument)}}let Xa;function MA(){return Xa||(Xa=new Image,Xa.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Xa}const RA=function(e,n,i){return new DA(e,n,i)};var Li=[],_A=function(){return Li.some(function(t){return t.activeTargets.length>0})},IA=function(){return Li.some(function(t){return t.skippedTargets.length>0})},Ax="ResizeObserver loop completed with undelivered notifications.",ZA=function(){var t;typeof ErrorEvent=="function"?t=new ErrorEvent("error",{message:Ax}):(t=document.createEvent("Event"),t.initEvent("error",!1,!1),t.message=Ax),window.dispatchEvent(t)},Ms;(function(t){t.BORDER_BOX="border-box",t.CONTENT_BOX="content-box",t.DEVICE_PIXEL_CONTENT_BOX="device-pixel-content-box"})(Ms||(Ms={}));var Xi=function(t){return Object.freeze(t)},NA=function(){function t(e,n){this.inlineSize=e,this.blockSize=n,Xi(this)}return t}(),Dx=function(){function t(e,n,i,r){return this.x=e,this.y=n,this.width=i,this.height=r,this.top=this.y,this.left=this.x,this.bottom=this.top+this.height,this.right=this.left+this.width,Xi(this)}return t.prototype.toJSON=function(){var e=this,n=e.x,i=e.y,r=e.top,s=e.right,o=e.bottom,a=e.left,l=e.width,c=e.height;return{x:n,y:i,top:r,right:s,bottom:o,left:a,width:l,height:c}},t.fromRect=function(e){return new t(e.x,e.y,e.width,e.height)},t}(),Td=function(t){return t instanceof SVGElement&&"getBBox"in t},Mx=function(t){if(Td(t)){var e=t.getBBox(),n=e.width,i=e.height;return!n&&!i}var r=t,s=r.offsetWidth,o=r.offsetHeight;return!(s||o||t.getClientRects().length)},Rx=function(t){var e;if(t instanceof Element)return!0;var n=(e=t==null?void 0:t.ownerDocument)===null||e===void 0?void 0:e.defaultView;return!!(n&&t instanceof n.Element)},LA=function(t){switch(t.tagName){case"INPUT":if(t.type!=="image")break;case"VIDEO":case"AUDIO":case"EMBED":case"OBJECT":case"CANVAS":case"IFRAME":case"IMG":return!0}return!1},Rs=typeof window<"u"?window:{},Va=new WeakMap,_x=/auto|scroll/,XA=/^tb|vertical/,VA=/msie|trident/i.test(Rs.navigator&&Rs.navigator.userAgent),Sn=function(t){return parseFloat(t||"0")},wr=function(t,e,n){return t===void 0&&(t=0),e===void 0&&(e=0),n===void 0&&(n=!1),new NA((n?e:t)||0,(n?t:e)||0)},Ix=Xi({devicePixelContentBoxSize:wr(),borderBoxSize:wr(),contentBoxSize:wr(),contentRect:new Dx(0,0,0,0)}),Zx=function(t,e){if(e===void 0&&(e=!1),Va.has(t)&&!e)return Va.get(t);if(Mx(t))return Va.set(t,Ix),Ix;var n=getComputedStyle(t),i=Td(t)&&t.ownerSVGElement&&t.getBBox(),r=!VA&&n.boxSizing==="border-box",s=XA.test(n.writingMode||""),o=!i&&_x.test(n.overflowY||""),a=!i&&_x.test(n.overflowX||""),l=i?0:Sn(n.paddingTop),c=i?0:Sn(n.paddingRight),u=i?0:Sn(n.paddingBottom),d=i?0:Sn(n.paddingLeft),p=i?0:Sn(n.borderTopWidth),f=i?0:Sn(n.borderRightWidth),h=i?0:Sn(n.borderBottomWidth),m=i?0:Sn(n.borderLeftWidth),g=d+c,O=l+u,v=m+f,x=p+h,b=a?t.offsetHeight-x-t.clientHeight:0,w=o?t.offsetWidth-v-t.clientWidth:0,y=r?g+v:0,k=r?O+x:0,T=i?i.width:Sn(n.width)-y-w,E=i?i.height:Sn(n.height)-k-b,C=T+g+w+v,M=E+O+b+x,Z=Xi({devicePixelContentBoxSize:wr(Math.round(T*devicePixelRatio),Math.round(E*devicePixelRatio),s),borderBoxSize:wr(C,M,s),contentBoxSize:wr(T,E,s),contentRect:new Dx(d,l,T,E)});return Va.set(t,Z),Z},Nx=function(t,e,n){var i=Zx(t,n),r=i.borderBoxSize,s=i.contentBoxSize,o=i.devicePixelContentBoxSize;switch(e){case Ms.DEVICE_PIXEL_CONTENT_BOX:return o;case Ms.BORDER_BOX:return r;default:return s}},WA=function(){function t(e){var n=Zx(e);this.target=e,this.contentRect=n.contentRect,this.borderBoxSize=Xi([n.borderBoxSize]),this.contentBoxSize=Xi([n.contentBoxSize]),this.devicePixelContentBoxSize=Xi([n.devicePixelContentBoxSize])}return t}(),Lx=function(t){if(Mx(t))return 1/0;for(var e=0,n=t.parentNode;n;)e+=1,n=n.parentNode;return e},qA=function(){var t=1/0,e=[];Li.forEach(function(o){if(o.activeTargets.length!==0){var a=[];o.activeTargets.forEach(function(c){var u=new WA(c.target),d=Lx(c.target);a.push(u),c.lastReportedSize=Nx(c.target,c.observedBox),d<t&&(t=d)}),e.push(function(){o.callback.call(o.observer,a,o.observer)}),o.activeTargets.splice(0,o.activeTargets.length)}});for(var n=0,i=e;n<i.length;n++){var r=i[n];r()}return t},Xx=function(t){Li.forEach(function(n){n.activeTargets.splice(0,n.activeTargets.length),n.skippedTargets.splice(0,n.skippedTargets.length),n.observationTargets.forEach(function(r){r.isActive()&&(Lx(r.target)>t?n.activeTargets.push(r):n.skippedTargets.push(r))})})},zA=function(){var t=0;for(Xx(t);_A();)t=qA(),Xx(t);return IA()&&ZA(),t>0},Qd,Vx=[],YA=function(){return Vx.splice(0).forEach(function(t){return t()})},BA=function(t){if(!Qd){var e=0,n=document.createTextNode(""),i={characterData:!0};new MutationObserver(function(){return YA()}).observe(n,i),Qd=function(){n.textContent="".concat(e?e--:e++)}}Vx.push(t),Qd()},UA=function(t){BA(function(){requestAnimationFrame(t)})},Wa=0,FA=function(){return!!Wa},GA=250,HA={attributes:!0,characterData:!0,childList:!0,subtree:!0},Wx=["resize","load","transitionend","animationend","animationstart","animationiteration","keyup","keydown","mouseup","mousedown","mouseover","mouseout","blur","focus"],qx=function(t){return t===void 0&&(t=0),Date.now()+t},Cd=!1,JA=function(){function t(){var e=this;this.stopped=!0,this.listener=function(){return e.schedule()}}return t.prototype.run=function(e){var n=this;if(e===void 0&&(e=GA),!Cd){Cd=!0;var i=qx(e);UA(function(){var r=!1;try{r=zA()}finally{if(Cd=!1,e=i-qx(),!FA())return;r?n.run(1e3):e>0?n.run(e):n.start()}})}},t.prototype.schedule=function(){this.stop(),this.run()},t.prototype.observe=function(){var e=this,n=function(){return e.observer&&e.observer.observe(document.body,HA)};document.body?n():Rs.addEventListener("DOMContentLoaded",n)},t.prototype.start=function(){var e=this;this.stopped&&(this.stopped=!1,this.observer=new MutationObserver(this.listener),this.observe(),Wx.forEach(function(n){return Rs.addEventListener(n,e.listener,!0)}))},t.prototype.stop=function(){var e=this;this.stopped||(this.observer&&this.observer.disconnect(),Wx.forEach(function(n){return Rs.removeEventListener(n,e.listener,!0)}),this.stopped=!0)},t}(),Ed=new JA,zx=function(t){!Wa&&t>0&&Ed.start(),Wa+=t,!Wa&&Ed.stop()},KA=function(t){return!Td(t)&&!LA(t)&&getComputedStyle(t).display==="inline"},eD=function(){function t(e,n){this.target=e,this.observedBox=n||Ms.CONTENT_BOX,this.lastReportedSize={inlineSize:0,blockSize:0}}return t.prototype.isActive=function(){var e=Nx(this.target,this.observedBox,!0);return KA(this.target)&&(this.lastReportedSize=e),this.lastReportedSize.inlineSize!==e.inlineSize||this.lastReportedSize.blockSize!==e.blockSize},t}(),tD=function(){function t(e,n){this.activeTargets=[],this.skippedTargets=[],this.observationTargets=[],this.observer=e,this.callback=n}return t}(),qa=new WeakMap,Yx=function(t,e){for(var n=0;n<t.length;n+=1)if(t[n].target===e)return n;return-1},za=function(){function t(){}return t.connect=function(e,n){var i=new tD(e,n);qa.set(e,i)},t.observe=function(e,n,i){var r=qa.get(e),s=r.observationTargets.length===0;Yx(r.observationTargets,n)<0&&(s&&Li.push(r),r.observationTargets.push(new eD(n,i&&i.box)),zx(1),Ed.schedule())},t.unobserve=function(e,n){var i=qa.get(e),r=Yx(i.observationTargets,n),s=i.observationTargets.length===1;r>=0&&(s&&Li.splice(Li.indexOf(i),1),i.observationTargets.splice(r,1),zx(-1))},t.disconnect=function(e){var n=this,i=qa.get(e);i.observationTargets.slice().forEach(function(r){return n.unobserve(e,r.target)}),i.activeTargets.splice(0,i.activeTargets.length)},t}(),nD=function(){function t(e){if(arguments.length===0)throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");if(typeof e!="function")throw new TypeError("Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.");za.connect(this,e)}return t.prototype.observe=function(e,n){if(arguments.length===0)throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Rx(e))throw new TypeError("Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element");za.observe(this,e,n)},t.prototype.unobserve=function(e){if(arguments.length===0)throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.");if(!Rx(e))throw new TypeError("Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element");za.unobserve(this,e)},t.prototype.disconnect=function(){za.disconnect(this)},t.toString=function(){return"function ResizeObserver () { [polyfill code] }"},t}(),jd=function(t,e){return jd=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])},jd(t,e)};function Bx(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");jd(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var L=function(){return L=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},L.apply(this,arguments)};function Zt(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]]);return n}function Be(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var i=n.call(t),r,s=[],o;try{for(;(e===void 0||e-- >0)&&!(r=i.next()).done;)s.push(r.value)}catch(a){o={error:a}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return s}function Pn(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}typeof SuppressedError=="function"&&SuppressedError;var Ux="production",Fx=typeof process>"u"||process.env===void 0?Ux:process.env.NODE_ENV||Ux,Zn=function(t){return{isEnabled:function(e){return t.some(function(n){return!!e[n]})}}},_s={measureLayout:Zn(["layout","layoutId","drag"]),animation:Zn(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:Zn(["exit"]),drag:Zn(["drag","dragControls"]),focus:Zn(["whileFocus"]),hover:Zn(["whileHover","onHoverStart","onHoverEnd"]),tap:Zn(["whileTap","onTap","onTapStart","onTapCancel"]),pan:Zn(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:Zn(["whileInView","onViewportEnter","onViewportLeave"])};function iD(t){for(var e in t)t[e]!==null&&(e==="projectionNodeConstructor"?_s.projectionNodeConstructor=t[e]:_s[e].Component=t[e])}var Is=function(){},Nt=function(){};process.env.NODE_ENV!=="production"&&(Is=function(t,e){!t&&typeof console<"u"&&console.warn(e)},Nt=function(t,e){if(!t)throw new Error(e)});var Gx=P.createContext({strict:!1}),Hx=Object.keys(_s),rD=Hx.length;function sD(t,e,n){var i=[],r=P.useContext(Gx);if(!e)return null;Fx!=="production"&&n&&r.strict&&Nt(!1,"You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.");for(var s=0;s<rD;s++){var o=Hx[s],a=_s[o],l=a.isEnabled,c=a.Component;l(t)&&c&&i.push(U.createElement(c,L({key:o},t,{visualElement:e})))}return i}var Ad=P.createContext({transformPagePoint:function(t){return t},isStatic:!1,reducedMotion:"never"}),Ya=P.createContext({});function oD(){return P.useContext(Ya).visualElement}var Ba=P.createContext(null),Sr=typeof document<"u",Jx=Sr?P.useLayoutEffect:P.useEffect,Dd={current:null},Kx=!1;function aD(){if(Kx=!0,!!Sr)if(window.matchMedia){var t=window.matchMedia("(prefers-reduced-motion)"),e=function(){return Dd.current=t.matches};t.addListener(e),e()}else Dd.current=!1}function lD(){!Kx&&aD();var t=Be(P.useState(Dd.current),1),e=t[0];return e}function cD(){var t=lD(),e=P.useContext(Ad).reducedMotion;return e==="never"?!1:e==="always"?!0:t}function uD(t,e,n,i){var r=P.useContext(Gx),s=oD(),o=P.useContext(Ba),a=cD(),l=P.useRef(void 0);i||(i=r.renderer),!l.current&&i&&(l.current=i(t,{visualState:e,parent:s,props:n,presenceId:o==null?void 0:o.id,blockInitialAnimation:(o==null?void 0:o.initial)===!1,shouldReduceMotion:a}));var c=l.current;return Jx(function(){c==null||c.syncRender()}),P.useEffect(function(){var u;(u=c==null?void 0:c.animationState)===null||u===void 0||u.animateChanges()}),Jx(function(){return function(){return c==null?void 0:c.notifyUnmount()}},[]),c}function Pr(t){return typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function dD(t,e,n){return P.useCallback(function(i){var r;i&&((r=t.mount)===null||r===void 0||r.call(t,i)),e&&(i?e.mount(i):e.unmount()),n&&(typeof n=="function"?n(i):Pr(n)&&(n.current=i))},[e])}function eb(t){return Array.isArray(t)}function nn(t){return typeof t=="string"||eb(t)}function pD(t){var e={};return t.forEachValue(function(n,i){return e[i]=n.get()}),e}function fD(t){var e={};return t.forEachValue(function(n,i){return e[i]=n.getVelocity()}),e}function tb(t,e,n,i,r){var s;return i===void 0&&(i={}),r===void 0&&(r={}),typeof e=="function"&&(e=e(n??t.custom,i,r)),typeof e=="string"&&(e=(s=t.variants)===null||s===void 0?void 0:s[e]),typeof e=="function"&&(e=e(n??t.custom,i,r)),e}function Ua(t,e,n){var i=t.getProps();return tb(i,e,n??i.custom,pD(t),fD(t))}function Fa(t){var e;return typeof((e=t.animate)===null||e===void 0?void 0:e.start)=="function"||nn(t.initial)||nn(t.animate)||nn(t.whileHover)||nn(t.whileDrag)||nn(t.whileTap)||nn(t.whileFocus)||nn(t.exit)}function nb(t){return!!(Fa(t)||t.variants)}function hD(t,e){if(Fa(t)){var n=t.initial,i=t.animate;return{initial:n===!1||nn(n)?n:void 0,animate:nn(i)?i:void 0}}return t.inherit!==!1?e:{}}function mD(t){var e=hD(t,P.useContext(Ya)),n=e.initial,i=e.animate;return P.useMemo(function(){return{initial:n,animate:i}},[ib(n),ib(i)])}function ib(t){return Array.isArray(t)?t.join(" "):t}function Ga(t){var e=P.useRef(null);return e.current===null&&(e.current=t()),e.current}var Zs={hasAnimatedSinceResize:!0,hasEverUpdated:!1},gD=1;function vD(){return Ga(function(){if(Zs.hasEverUpdated)return gD++})}var rb=P.createContext({}),sb=P.createContext({});function OD(t,e,n,i){var r,s=e.layoutId,o=e.layout,a=e.drag,l=e.dragConstraints,c=e.layoutScroll,u=P.useContext(sb);!i||!n||n!=null&&n.projection||(n.projection=new i(t,n.getLatestValues(),(r=n.parent)===null||r===void 0?void 0:r.projection),n.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!a||l&&Pr(l),visualElement:n,scheduleRender:function(){return n.scheduleRender()},animationType:typeof o=="string"?o:"both",initialPromotionConfig:u,layoutScroll:c}))}var xD=function(t){Bx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.getSnapshotBeforeUpdate=function(){return this.updateProps(),null},e.prototype.componentDidUpdate=function(){},e.prototype.updateProps=function(){var n=this.props,i=n.visualElement,r=n.props;i&&i.setProps(r)},e.prototype.render=function(){return this.props.children},e}(P.Component);function bD(t){var e=t.preloadedFeatures,n=t.createVisualElement,i=t.projectionNodeConstructor,r=t.useRender,s=t.useVisualState,o=t.Component;e&&iD(e);function a(l,c){var u=yD(l);l=L(L({},l),{layoutId:u});var d=P.useContext(Ad),p=null,f=mD(l),h=d.isStatic?void 0:vD(),m=s(l,d.isStatic);return!d.isStatic&&Sr&&(f.visualElement=uD(o,m,L(L({},d),l),n),OD(h,l,f.visualElement,i||_s.projectionNodeConstructor),p=sD(l,f.visualElement,e)),U.createElement(xD,{visualElement:f.visualElement,props:L(L({},d),l)},p,U.createElement(Ya.Provider,{value:f},r(o,l,h,dD(m,f.visualElement,c),m,d.isStatic,f.visualElement)))}return P.forwardRef(a)}function yD(t){var e,n=t.layoutId,i=(e=P.useContext(rb))===null||e===void 0?void 0:e.id;return i&&n!==void 0?i+"-"+n:n}function wD(t){function e(i,r){return r===void 0&&(r={}),bD(t(i,r))}if(typeof Proxy>"u")return e;var n=new Map;return new Proxy(e,{get:function(i,r){return n.has(r)||n.set(r,e(r)),n.get(r)}})}var SD=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function Md(t){return typeof t!="string"||t.includes("-")?!1:!!(SD.indexOf(t)>-1||/[A-Z]/.test(t))}var Ha={};function PD(t){Object.assign(Ha,t)}var Rd=["","X","Y","Z"],kD=["translate","scale","rotate","skew"],Ns=["transformPerspective","x","y","z"];kD.forEach(function(t){return Rd.forEach(function(e){return Ns.push(t+e)})});function $D(t,e){return Ns.indexOf(t)-Ns.indexOf(e)}var TD=new Set(Ns);function Ls(t){return TD.has(t)}var QD=new Set(["originX","originY","originZ"]);function ob(t){return QD.has(t)}function ab(t,e){var n=e.layout,i=e.layoutId;return Ls(t)||ob(t)||(n||i!==void 0)&&(!!Ha[t]||t==="opacity")}var Nn=function(t){return!!(t!==null&&typeof t=="object"&&t.getVelocity)},CD={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function ED(t,e,n,i){var r=t.transform,s=t.transformKeys,o=e.enableHardwareAcceleration,a=o===void 0?!0:o,l=e.allowTransformNone,c=l===void 0?!0:l,u="";s.sort($D);for(var d=!1,p=s.length,f=0;f<p;f++){var h=s[f];u+="".concat(CD[h]||h,"(").concat(r[h],") "),h==="z"&&(d=!0)}return!d&&a?u+="translateZ(0)":u=u.trim(),i?u=i(r,n?"":u):c&&n&&(u="none"),u}function jD(t){var e=t.originX,n=e===void 0?"50%":e,i=t.originY,r=i===void 0?"50%":i,s=t.originZ,o=s===void 0?0:s;return"".concat(n," ").concat(r," ").concat(o)}function lb(t){return t.startsWith("--")}var AD=function(t,e){return e&&typeof t=="number"?e.transform(t):t};const cb=(t,e)=>n=>Math.max(Math.min(n,e),t),Xs=t=>t%1?Number(t.toFixed(5)):t,Vs=/(-)?([\d]*\.?[\d])+/g,_d=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,DD=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function Ws(t){return typeof t=="string"}const Vi={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},qs=Object.assign(Object.assign({},Vi),{transform:cb(0,1)}),Ja=Object.assign(Object.assign({},Vi),{default:1}),zs=t=>({test:e=>Ws(e)&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ui=zs("deg"),kn=zs("%"),ie=zs("px"),MD=zs("vh"),RD=zs("vw"),ub=Object.assign(Object.assign({},kn),{parse:t=>kn.parse(t)/100,transform:t=>kn.transform(t*100)}),Id=(t,e)=>n=>!!(Ws(n)&&DD.test(n)&&n.startsWith(t)||e&&Object.prototype.hasOwnProperty.call(n,e)),db=(t,e,n)=>i=>{if(!Ws(i))return i;const[r,s,o,a]=i.match(Vs);return{[t]:parseFloat(r),[e]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},Wi={test:Id("hsl","hue"),parse:db("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+kn.transform(Xs(e))+", "+kn.transform(Xs(n))+", "+Xs(qs.transform(i))+")"},_D=cb(0,255),Zd=Object.assign(Object.assign({},Vi),{transform:t=>Math.round(_D(t))}),di={test:Id("rgb","red"),parse:db("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Zd.transform(t)+", "+Zd.transform(e)+", "+Zd.transform(n)+", "+Xs(qs.transform(i))+")"};function ID(t){let e="",n="",i="",r="";return t.length>5?(e=t.substr(1,2),n=t.substr(3,2),i=t.substr(5,2),r=t.substr(7,2)):(e=t.substr(1,1),n=t.substr(2,1),i=t.substr(3,1),r=t.substr(4,1),e+=e,n+=n,i+=i,r+=r),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:r?parseInt(r,16)/255:1}}const Nd={test:Id("#"),parse:ID,transform:di.transform},ft={test:t=>di.test(t)||Nd.test(t)||Wi.test(t),parse:t=>di.test(t)?di.parse(t):Wi.test(t)?Wi.parse(t):Nd.parse(t),transform:t=>Ws(t)?t:t.hasOwnProperty("red")?di.transform(t):Wi.transform(t)},pb="${c}",fb="${n}";function ZD(t){var e,n,i,r;return isNaN(t)&&Ws(t)&&((n=(e=t.match(Vs))===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:0)+((r=(i=t.match(_d))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0)>0}function hb(t){typeof t=="number"&&(t=`${t}`);const e=[];let n=0;const i=t.match(_d);i&&(n=i.length,t=t.replace(_d,pb),e.push(...i.map(ft.parse)));const r=t.match(Vs);return r&&(t=t.replace(Vs,fb),e.push(...r.map(Vi.parse))),{values:e,numColors:n,tokenised:t}}function mb(t){return hb(t).values}function gb(t){const{values:e,numColors:n,tokenised:i}=hb(t),r=e.length;return s=>{let o=i;for(let a=0;a<r;a++)o=o.replace(a<n?pb:fb,a<n?ft.transform(s[a]):Xs(s[a]));return o}}const ND=t=>typeof t=="number"?0:t;function LD(t){const e=mb(t);return gb(t)(e.map(ND))}const Ln={test:ZD,parse:mb,createTransformer:gb,getAnimatableNone:LD},XD=new Set(["brightness","contrast","saturate","opacity"]);function VD(t){let[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Vs)||[];if(!i)return t;const r=n.replace(i,"");let s=XD.has(e)?1:0;return i!==n&&(s*=100),e+"("+s+r+")"}const WD=/([a-z-]*)\(.*?\)/g,Ld=Object.assign(Object.assign({},Ln),{getAnimatableNone:t=>{const e=t.match(WD);return e?e.map(VD).join(" "):t}});var vb=L(L({},Vi),{transform:Math.round}),Ob={borderWidth:ie,borderTopWidth:ie,borderRightWidth:ie,borderBottomWidth:ie,borderLeftWidth:ie,borderRadius:ie,radius:ie,borderTopLeftRadius:ie,borderTopRightRadius:ie,borderBottomRightRadius:ie,borderBottomLeftRadius:ie,width:ie,maxWidth:ie,height:ie,maxHeight:ie,size:ie,top:ie,right:ie,bottom:ie,left:ie,padding:ie,paddingTop:ie,paddingRight:ie,paddingBottom:ie,paddingLeft:ie,margin:ie,marginTop:ie,marginRight:ie,marginBottom:ie,marginLeft:ie,rotate:ui,rotateX:ui,rotateY:ui,rotateZ:ui,scale:Ja,scaleX:Ja,scaleY:Ja,scaleZ:Ja,skew:ui,skewX:ui,skewY:ui,distance:ie,translateX:ie,translateY:ie,translateZ:ie,x:ie,y:ie,z:ie,perspective:ie,transformPerspective:ie,opacity:qs,originX:ub,originY:ub,originZ:ie,zIndex:vb,fillOpacity:qs,strokeOpacity:qs,numOctaves:vb};function Xd(t,e,n,i){var r,s=t.style,o=t.vars,a=t.transform,l=t.transformKeys,c=t.transformOrigin;l.length=0;var u=!1,d=!1,p=!0;for(var f in e){var h=e[f];if(lb(f)){o[f]=h;continue}var m=Ob[f],g=AD(h,m);if(Ls(f)){if(u=!0,a[f]=g,l.push(f),!p)continue;h!==((r=m.default)!==null&&r!==void 0?r:0)&&(p=!1)}else ob(f)?(c[f]=g,d=!0):s[f]=g}u?s.transform=ED(t,n,p,i):i?s.transform=i({},""):!e.transform&&s.transform&&(s.transform="none"),d&&(s.transformOrigin=jD(c))}var Vd=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function xb(t,e,n){for(var i in e)!Nn(e[i])&&!ab(i,n)&&(t[i]=e[i])}function qD(t,e,n){var i=t.transformTemplate;return P.useMemo(function(){var r=Vd();Xd(r,e,{enableHardwareAcceleration:!n},i);var s=r.vars,o=r.style;return L(L({},s),o)},[e])}function zD(t,e,n){var i=t.style||{},r={};return xb(r,i,t),Object.assign(r,qD(t,e,n)),t.transformValues&&(r=t.transformValues(r)),r}function YD(t,e,n){var i={},r=zD(t,e,n);return t.drag&&t.dragListener!==!1&&(i.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":"pan-".concat(t.drag==="x"?"y":"x")),i.style=r,i}var BD=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function Ka(t){return BD.has(t)}var bb=function(t){return!Ka(t)};function UD(t){t&&(bb=function(e){return e.startsWith("on")?!Ka(e):t(e)})}try{UD(require("@emotion/is-prop-valid").default)}catch{}function FD(t,e,n){var i={};for(var r in t)(bb(r)||n===!0&&Ka(r)||!e&&!Ka(r)||t.draggable&&r.startsWith("onDrag"))&&(i[r]=t[r]);return i}function yb(t,e,n){return typeof t=="string"?t:ie.transform(e+n*t)}function GD(t,e,n){var i=yb(e,t.x,t.width),r=yb(n,t.y,t.height);return"".concat(i," ").concat(r)}var HD={offset:"stroke-dashoffset",array:"stroke-dasharray"},JD={offset:"strokeDashoffset",array:"strokeDasharray"};function KD(t,e,n,i,r){n===void 0&&(n=1),i===void 0&&(i=0),r===void 0&&(r=!0),t.pathLength=1;var s=r?HD:JD;t[s.offset]=ie.transform(-i);var o=ie.transform(e),a=ie.transform(n);t[s.array]="".concat(o," ").concat(a)}function Wd(t,e,n,i){var r=e.attrX,s=e.attrY,o=e.originX,a=e.originY,l=e.pathLength,c=e.pathSpacing,u=c===void 0?1:c,d=e.pathOffset,p=d===void 0?0:d,f=Zt(e,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);Xd(t,f,n,i),t.attrs=t.style,t.style={};var h=t.attrs,m=t.style,g=t.dimensions;h.transform&&(g&&(m.transform=h.transform),delete h.transform),g&&(o!==void 0||a!==void 0||m.transform)&&(m.transformOrigin=GD(g,o!==void 0?o:.5,a!==void 0?a:.5)),r!==void 0&&(h.x=r),s!==void 0&&(h.y=s),l!==void 0&&KD(h,l,u,p,!1)}var wb=function(){return L(L({},Vd()),{attrs:{}})};function eM(t,e){var n=P.useMemo(function(){var r=wb();return Wd(r,e,{enableHardwareAcceleration:!1},t.transformTemplate),L(L({},r.attrs),{style:L({},r.style)})},[e]);if(t.style){var i={};xb(i,t.style,t),n.style=L(L({},i),n.style)}return n}function tM(t){t===void 0&&(t=!1);var e=function(n,i,r,s,o,a){var l=o.latestValues,c=Md(n)?eM:YD,u=c(i,l,a),d=FD(i,typeof n=="string",t),p=L(L(L({},d),u),{ref:s});return r&&(p["data-projection-id"]=r),P.createElement(n,p)};return e}var nM=/([a-z])([A-Z])/g,iM="$1-$2",Sb=function(t){return t.replace(nM,iM).toLowerCase()};function Pb(t,e,n,i){var r=e.style,s=e.vars;Object.assign(t.style,r,i&&i.getProjectionStyles(n));for(var o in s)t.style.setProperty(o,s[o])}var kb=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function $b(t,e,n,i){Pb(t,e,void 0,i);for(var r in e.attrs)t.setAttribute(kb.has(r)?r:Sb(r),e.attrs[r])}function qd(t){var e=t.style,n={};for(var i in e)(Nn(e[i])||ab(i,t))&&(n[i]=e[i]);return n}function Tb(t){var e=qd(t);for(var n in t)if(Nn(t[n])){var i=n==="x"||n==="y"?"attr"+n.toUpperCase():n;e[i]=t[n]}return e}function zd(t){return typeof t=="object"&&typeof t.start=="function"}var Ys=function(t){return Array.isArray(t)},rM=function(t){return!!(t&&typeof t=="object"&&t.mix&&t.toValue)},Qb=function(t){return Ys(t)?t[t.length-1]||0:t};function el(t){var e=Nn(t)?t.get():t;return rM(e)?e.toValue():e}function Cb(t,e,n,i){var r=t.scrapeMotionValuesFromProps,s=t.createRenderState,o=t.onMount,a={latestValues:sM(e,n,i,r),renderState:s()};return o&&(a.mount=function(l){return o(e,l,a)}),a}var Eb=function(t){return function(e,n){var i=P.useContext(Ya),r=P.useContext(Ba);return n?Cb(t,e,i,r):Ga(function(){return Cb(t,e,i,r)})}};function sM(t,e,n,i){var r={},s=(n==null?void 0:n.initial)===!1,o=i(t);for(var a in o)r[a]=el(o[a]);var l=t.initial,c=t.animate,u=Fa(t),d=nb(t);e&&d&&!u&&t.inherit!==!1&&(l??(l=e.initial),c??(c=e.animate));var p=s||l===!1,f=p?c:l;if(f&&typeof f!="boolean"&&!zd(f)){var h=Array.isArray(f)?f:[f];h.forEach(function(m){var g=tb(t,m);if(g){var O=g.transitionEnd;g.transition;var v=Zt(g,["transitionEnd","transition"]);for(var x in v){var b=v[x];if(Array.isArray(b)){var w=p?b.length-1:0;b=b[w]}b!==null&&(r[x]=b)}for(var x in O)r[x]=O[x]}})}return r}var oM={useVisualState:Eb({scrapeMotionValuesFromProps:Tb,createRenderState:wb,onMount:function(t,e,n){var i=n.renderState,r=n.latestValues;try{i.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{i.dimensions={x:0,y:0,width:0,height:0}}Wd(i,r,{enableHardwareAcceleration:!1},t.transformTemplate),$b(e,i)}})},aM={useVisualState:Eb({scrapeMotionValuesFromProps:qd,createRenderState:Vd})};function lM(t,e,n,i,r){var s=e.forwardMotionProps,o=s===void 0?!1:s,a=Md(t)?oM:aM;return L(L({},a),{preloadedFeatures:n,useRender:tM(o),createVisualElement:i,projectionNodeConstructor:r,Component:t})}var $e;(function(t){t.Animate="animate",t.Hover="whileHover",t.Tap="whileTap",t.Drag="whileDrag",t.Focus="whileFocus",t.InView="whileInView",t.Exit="exit"})($e||($e={}));function tl(t,e,n,i){return i===void 0&&(i={passive:!0}),t.addEventListener(e,n,i),function(){return t.removeEventListener(e,n)}}function Yd(t,e,n,i){P.useEffect(function(){var r=t.current;if(n&&r)return tl(r,e,n,i)},[t,e,n,i])}function cM(t){var e=t.whileFocus,n=t.visualElement,i=function(){var s;(s=n.animationState)===null||s===void 0||s.setActive($e.Focus,!0)},r=function(){var s;(s=n.animationState)===null||s===void 0||s.setActive($e.Focus,!1)};Yd(n,"focus",e?i:void 0),Yd(n,"blur",e?r:void 0)}function jb(t){return typeof PointerEvent<"u"&&t instanceof PointerEvent?t.pointerType==="mouse":t instanceof MouseEvent}function Ab(t){var e=!!t.touches;return e}function uM(t){return function(e){var n=e instanceof MouseEvent,i=!n||n&&e.button===0;i&&t(e)}}var dM={pageX:0,pageY:0};function pM(t,e){e===void 0&&(e="page");var n=t.touches[0]||t.changedTouches[0],i=n||dM;return{x:i[e+"X"],y:i[e+"Y"]}}function fM(t,e){return e===void 0&&(e="page"),{x:t[e+"X"],y:t[e+"Y"]}}function Bd(t,e){return e===void 0&&(e="page"),{point:Ab(t)?pM(t,e):fM(t,e)}}var Db=function(t,e){e===void 0&&(e=!1);var n=function(i){return t(i,Bd(i))};return e?uM(n):n},hM=function(){return Sr&&window.onpointerdown===null},mM=function(){return Sr&&window.ontouchstart===null},gM=function(){return Sr&&window.onmousedown===null},vM={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},OM={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function Mb(t){return hM()?t:mM()?OM[t]:gM()?vM[t]:t}function kr(t,e,n,i){return tl(t,Mb(e),Db(n,e==="pointerdown"),i)}function nl(t,e,n,i){return Yd(t,Mb(e),n&&Db(n,e==="pointerdown"),i)}function Rb(t){var e=null;return function(){var n=function(){e=null};return e===null?(e=t,n):!1}}var _b=Rb("dragHorizontal"),Ib=Rb("dragVertical");function Zb(t){var e=!1;if(t==="y")e=Ib();else if(t==="x")e=_b();else{var n=_b(),i=Ib();n&&i?e=function(){n(),i()}:(n&&n(),i&&i())}return e}function Nb(){var t=Zb(!0);return t?(t(),!1):!0}function Lb(t,e,n){return function(i,r){var s;!jb(i)||Nb()||((s=t.animationState)===null||s===void 0||s.setActive($e.Hover,e),n==null||n(i,r))}}function xM(t){var e=t.onHoverStart,n=t.onHoverEnd,i=t.whileHover,r=t.visualElement;nl(r,"pointerenter",e||i?Lb(r,!0,e):void 0,{passive:!e}),nl(r,"pointerleave",n||i?Lb(r,!1,n):void 0,{passive:!n})}var Xb=function(t,e){return e?t===e?!0:Xb(t,e.parentElement):!1};function Vb(t){return P.useEffect(function(){return function(){return t()}},[])}const il=(t,e,n)=>Math.min(Math.max(n,t),e),Ud=.001,bM=.01,Wb=10,yM=.05,wM=1;function SM({duration:t=800,bounce:e=.25,velocity:n=0,mass:i=1}){let r,s;Is(t<=Wb*1e3,"Spring duration must be 10 seconds or less");let o=1-e;o=il(yM,wM,o),t=il(bM,Wb,t/1e3),o<1?(r=c=>{const u=c*o,d=u*t,p=u-n,f=Fd(c,o),h=Math.exp(-d);return Ud-p/f*h},s=c=>{const d=c*o*t,p=d*n+n,f=Math.pow(o,2)*Math.pow(c,2)*t,h=Math.exp(-d),m=Fd(Math.pow(c,2),o);return(-r(c)+Ud>0?-1:1)*((p-f)*h)/m}):(r=c=>{const u=Math.exp(-c*t),d=(c-n)*t+1;return-Ud+u*d},s=c=>{const u=Math.exp(-c*t),d=(n-c)*(t*t);return u*d});const a=5/t,l=kM(r,s,a);if(t=t*1e3,isNaN(l))return{stiffness:100,damping:10,duration:t};{const c=Math.pow(l,2)*i;return{stiffness:c,damping:o*2*Math.sqrt(i*c),duration:t}}}const PM=12;function kM(t,e,n){let i=n;for(let r=1;r<PM;r++)i=i-t(i)/e(i);return i}function Fd(t,e){return t*Math.sqrt(1-e*e)}const $M=["duration","bounce"],TM=["stiffness","damping","mass"];function qb(t,e){return e.some(n=>t[n]!==void 0)}function QM(t){let e=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},t);if(!qb(t,TM)&&qb(t,$M)){const n=SM(t);e=Object.assign(Object.assign(Object.assign({},e),n),{velocity:0,mass:1}),e.isResolvedFromDuration=!0}return e}function Gd(t){var{from:e=0,to:n=1,restSpeed:i=2,restDelta:r}=t,s=Zt(t,["from","to","restSpeed","restDelta"]);const o={done:!1,value:e};let{stiffness:a,damping:l,mass:c,velocity:u,duration:d,isResolvedFromDuration:p}=QM(s),f=zb,h=zb;function m(){const g=u?-(u/1e3):0,O=n-e,v=l/(2*Math.sqrt(a*c)),x=Math.sqrt(a/c)/1e3;if(r===void 0&&(r=Math.min(Math.abs(n-e)/100,.4)),v<1){const b=Fd(x,v);f=w=>{const y=Math.exp(-v*x*w);return n-y*((g+v*x*O)/b*Math.sin(b*w)+O*Math.cos(b*w))},h=w=>{const y=Math.exp(-v*x*w);return v*x*y*(Math.sin(b*w)*(g+v*x*O)/b+O*Math.cos(b*w))-y*(Math.cos(b*w)*(g+v*x*O)-b*O*Math.sin(b*w))}}else if(v===1)f=b=>n-Math.exp(-x*b)*(O+(g+x*O)*b);else{const b=x*Math.sqrt(v*v-1);f=w=>{const y=Math.exp(-v*x*w),k=Math.min(b*w,300);return n-y*((g+v*x*O)*Math.sinh(k)+b*O*Math.cosh(k))/b}}}return m(),{next:g=>{const O=f(g);if(p)o.done=g>=d;else{const v=h(g)*1e3,x=Math.abs(v)<=i,b=Math.abs(n-O)<=r;o.done=x&&b}return o.value=o.done?n:O,o},flipTarget:()=>{u=-u,[e,n]=[n,e],m()}}}Gd.needsInterpolation=(t,e)=>typeof t=="string"||typeof e=="string";const zb=t=>0,Bs=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i},Ae=(t,e,n)=>-n*t+n*e+t;function Hd(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 Yb({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let r=0,s=0,o=0;if(!e)r=s=o=n;else{const a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;r=Hd(l,a,t+1/3),s=Hd(l,a,t),o=Hd(l,a,t-1/3)}return{red:Math.round(r*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:i}}const CM=(t,e,n)=>{const i=t*t,r=e*e;return Math.sqrt(Math.max(0,n*(r-i)+i))},EM=[Nd,di,Wi],Bb=t=>EM.find(e=>e.test(t)),Ub=t=>`'${t}' is not an animatable color. Use the equivalent color code instead.`,Fb=(t,e)=>{let n=Bb(t),i=Bb(e);Nt(!!n,Ub(t)),Nt(!!i,Ub(e));let r=n.parse(t),s=i.parse(e);n===Wi&&(r=Yb(r),n=di),i===Wi&&(s=Yb(s),i=di);const o=Object.assign({},r);return a=>{for(const l in o)l!=="alpha"&&(o[l]=CM(r[l],s[l],a));return o.alpha=Ae(r.alpha,s.alpha,a),n.transform(o)}},Jd=t=>typeof t=="number",jM=(t,e)=>n=>e(t(n)),rl=(...t)=>t.reduce(jM);function Gb(t,e){return Jd(t)?n=>Ae(t,e,n):ft.test(t)?Fb(t,e):Kb(t,e)}const Hb=(t,e)=>{const n=[...t],i=n.length,r=t.map((s,o)=>Gb(s,e[o]));return s=>{for(let o=0;o<i;o++)n[o]=r[o](s);return n}},AM=(t,e)=>{const n=Object.assign(Object.assign({},t),e),i={};for(const r in n)t[r]!==void 0&&e[r]!==void 0&&(i[r]=Gb(t[r],e[r]));return r=>{for(const s in i)n[s]=i[s](r);return n}};function Jb(t){const e=Ln.parse(t),n=e.length;let i=0,r=0,s=0;for(let o=0;o<n;o++)i||typeof e[o]=="number"?i++:e[o].hue!==void 0?s++:r++;return{parsed:e,numNumbers:i,numRGB:r,numHSL:s}}const Kb=(t,e)=>{const n=Ln.createTransformer(e),i=Jb(t),r=Jb(e);return i.numHSL===r.numHSL&&i.numRGB===r.numRGB&&i.numNumbers>=r.numNumbers?rl(Hb(i.parsed,r.parsed),n):(Is(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),o=>`${o>0?e:t}`)},DM=(t,e)=>n=>Ae(t,e,n);function MM(t){if(typeof t=="number")return DM;if(typeof t=="string")return ft.test(t)?Fb:Kb;if(Array.isArray(t))return Hb;if(typeof t=="object")return AM}function RM(t,e,n){const i=[],r=n||MM(t[0]),s=t.length-1;for(let o=0;o<s;o++){let a=r(t[o],t[o+1]);if(e){const l=Array.isArray(e)?e[o]:e;a=rl(l,a)}i.push(a)}return i}function _M([t,e],[n]){return i=>n(Bs(t,e,i))}function IM(t,e){const n=t.length,i=n-1;return r=>{let s=0,o=!1;if(r<=t[0]?o=!0:r>=t[i]&&(s=i-1,o=!0),!o){let l=1;for(;l<n&&!(t[l]>r||l===i);l++);s=l-1}const a=Bs(t[s],t[s+1],r);return e[s](a)}}function e0(t,e,{clamp:n=!0,ease:i,mixer:r}={}){const s=t.length;Nt(s===e.length,"Both input and output ranges must be the same length"),Nt(!i||!Array.isArray(i)||i.length===s-1,"Array of easing functions must be of length `input.length - 1`, as it applies to the transitions **between** the defined values."),t[0]>t[s-1]&&(t=[].concat(t),e=[].concat(e),t.reverse(),e.reverse());const o=RM(e,i,r),a=s===2?_M(t,o):IM(t,o);return n?l=>a(il(t[0],t[s-1],l)):a}const sl=t=>e=>1-t(1-e),Kd=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ZM=t=>e=>Math.pow(e,t),t0=t=>e=>e*e*((t+1)*e-t),NM=t=>{const e=t0(t);return n=>(n*=2)<1?.5*e(n):.5*(2-Math.pow(2,-10*(n-1)))},n0=1.525,LM=4/11,XM=8/11,VM=9/10,ep=t=>t,tp=ZM(2),WM=sl(tp),i0=Kd(tp),r0=t=>1-Math.sin(Math.acos(t)),np=sl(r0),qM=Kd(np),ip=t0(n0),zM=sl(ip),YM=Kd(ip),BM=NM(n0),UM=4356/361,FM=35442/1805,GM=16061/1805,ol=t=>{if(t===1||t===0)return t;const e=t*t;return t<LM?7.5625*e:t<XM?9.075*e-9.9*t+3.4:t<VM?UM*e-FM*t+GM:10.8*t*t-20.52*t+10.72},HM=sl(ol),JM=t=>t<.5?.5*(1-ol(1-t*2)):.5*ol(t*2-1)+.5;function KM(t,e){return t.map(()=>e||i0).splice(0,t.length-1)}function e5(t){const e=t.length;return t.map((n,i)=>i!==0?i/(e-1):0)}function t5(t,e){return t.map(n=>n*e)}function al({from:t=0,to:e=1,ease:n,offset:i,duration:r=300}){const s={done:!1,value:t},o=Array.isArray(e)?e:[t,e],a=t5(i&&i.length===o.length?i:e5(o),r);function l(){return e0(a,o,{ease:Array.isArray(n)?n:KM(o,n)})}let c=l();return{next:u=>(s.value=c(u),s.done=u>=r,s),flipTarget:()=>{o.reverse(),c=l()}}}function n5({velocity:t=0,from:e=0,power:n=.8,timeConstant:i=350,restDelta:r=.5,modifyTarget:s}){const o={done:!1,value:e};let a=n*t;const l=e+a,c=s===void 0?l:s(l);return c!==l&&(a=c-e),{next:u=>{const d=-a*Math.exp(-u/i);return o.done=!(d>r||d<-r),o.value=o.done?c:c+d,o},flipTarget:()=>{}}}const s0={keyframes:al,spring:Gd,decay:n5};function i5(t){if(Array.isArray(t.to))return al;if(s0[t.type])return s0[t.type];const e=new Set(Object.keys(t));return e.has("ease")||e.has("duration")&&!e.has("dampingRatio")?al:e.has("dampingRatio")||e.has("stiffness")||e.has("mass")||e.has("damping")||e.has("restSpeed")||e.has("restDelta")?Gd:al}const o0=1/60*1e3,r5=typeof performance<"u"?()=>performance.now():()=>Date.now(),a0=typeof window<"u"?t=>window.requestAnimationFrame(t):t=>setTimeout(()=>t(r5()),o0);function s5(t){let e=[],n=[],i=0,r=!1,s=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const d=u&&r,p=d?e:n;return c&&o.add(l),p.indexOf(l)===-1&&(p.push(l),d&&r&&(i=e.length)),l},cancel:l=>{const c=n.indexOf(l);c!==-1&&n.splice(c,1),o.delete(l)},process:l=>{if(r){s=!0;return}if(r=!0,[e,n]=[n,e],n.length=0,i=e.length,i)for(let c=0;c<i;c++){const u=e[c];u(l),o.has(u)&&(a.schedule(u),t())}r=!1,s&&(s=!1,a.process(l))}};return a}const o5=40;let rp=!0,Us=!1,sp=!1;const $r={delta:0,timestamp:0},Fs=["read","update","preRender","render","postRender"],ll=Fs.reduce((t,e)=>(t[e]=s5(()=>Us=!0),t),{}),$n=Fs.reduce((t,e)=>{const n=ll[e];return t[e]=(i,r=!1,s=!1)=>(Us||l5(),n.schedule(i,r,s)),t},{}),Tr=Fs.reduce((t,e)=>(t[e]=ll[e].cancel,t),{}),op=Fs.reduce((t,e)=>(t[e]=()=>ll[e].process($r),t),{}),a5=t=>ll[t].process($r),l0=t=>{Us=!1,$r.delta=rp?o0:Math.max(Math.min(t-$r.timestamp,o5),1),$r.timestamp=t,sp=!0,Fs.forEach(a5),sp=!1,Us&&(rp=!1,a0(l0))},l5=()=>{Us=!0,rp=!0,sp||a0(l0)},cl=()=>$r;function c0(t,e,n=0){return t-e-n}function c5(t,e,n=0,i=!0){return i?c0(e+-t,e,n):e-(t-e)+n}function u5(t,e,n,i){return i?t>=e+n:t<=-n}const d5=t=>{const e=({delta:n})=>t(n);return{start:()=>$n.update(e,!0),stop:()=>Tr.update(e)}};function u0(t){var e,n,{from:i,autoplay:r=!0,driver:s=d5,elapsed:o=0,repeat:a=0,repeatType:l="loop",repeatDelay:c=0,onPlay:u,onStop:d,onComplete:p,onRepeat:f,onUpdate:h}=t,m=Zt(t,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:g}=m,O,v=0,x=m.duration,b,w=!1,y=!0,k;const T=i5(m);!((n=(e=T).needsInterpolation)===null||n===void 0)&&n.call(e,i,g)&&(k=e0([0,100],[i,g],{clamp:!1}),i=0,g=100);const E=T(Object.assign(Object.assign({},m),{from:i,to:g}));function C(){v++,l==="reverse"?(y=v%2===0,o=c5(o,x,c,y)):(o=c0(o,x,c),l==="mirror"&&E.flipTarget()),w=!1,f&&f()}function M(){O.stop(),p&&p()}function Z(N){if(y||(N=-N),o+=N,!w){const _=E.next(Math.max(0,o));b=_.value,k&&(b=k(b)),w=y?_.done:o<=0}h==null||h(b),w&&(v===0&&(x??(x=o)),v<a?u5(o,x,c,y)&&C():M())}function q(){u==null||u(),O=s(Z),O.start()}return r&&q(),{stop:()=>{d==null||d(),O.stop()}}}function d0(t,e){return e?t*(1e3/e):0}function p5({from:t=0,velocity:e=0,min:n,max:i,power:r=.8,timeConstant:s=750,bounceStiffness:o=500,bounceDamping:a=10,restDelta:l=1,modifyTarget:c,driver:u,onUpdate:d,onComplete:p,onStop:f}){let h;function m(x){return n!==void 0&&x<n||i!==void 0&&x>i}function g(x){return n===void 0?i:i===void 0||Math.abs(n-x)<Math.abs(i-x)?n:i}function O(x){h==null||h.stop(),h=u0(Object.assign(Object.assign({},x),{driver:u,onUpdate:b=>{var w;d==null||d(b),(w=x.onUpdate)===null||w===void 0||w.call(x,b)},onComplete:p,onStop:f}))}function v(x){O(Object.assign({type:"spring",stiffness:o,damping:a,restDelta:l},x))}if(m(t))v({from:t,velocity:e,to:g(t)});else{let x=r*e+t;typeof c<"u"&&(x=c(x));const b=g(x),w=b===n?-1:1;let y,k;const T=E=>{y=k,k=E,e=d0(E-y,cl().delta),(w===1&&E>b||w===-1&&E<b)&&v({from:E,to:b,velocity:e})};O({type:"decay",from:t,velocity:e,timeConstant:s,power:r,restDelta:l,modifyTarget:c,onUpdate:m(x)?T:void 0})}return{stop:()=>h==null?void 0:h.stop()}}const ap=t=>t.hasOwnProperty("x")&&t.hasOwnProperty("y"),p0=t=>ap(t)&&t.hasOwnProperty("z"),ul=(t,e)=>Math.abs(t-e);function f0(t,e){if(Jd(t)&&Jd(e))return ul(t,e);if(ap(t)&&ap(e)){const n=ul(t.x,e.x),i=ul(t.y,e.y),r=p0(t)&&p0(e)?ul(t.z,e.z):0;return Math.sqrt(Math.pow(n,2)+Math.pow(i,2)+Math.pow(r,2))}}const h0=(t,e)=>1-3*e+3*t,m0=(t,e)=>3*e-6*t,g0=t=>3*t,dl=(t,e,n)=>((h0(e,n)*t+m0(e,n))*t+g0(e))*t,v0=(t,e,n)=>3*h0(e,n)*t*t+2*m0(e,n)*t+g0(e),f5=1e-7,h5=10;function m5(t,e,n,i,r){let s,o,a=0;do o=e+(n-e)/2,s=dl(o,i,r)-t,s>0?n=o:e=o;while(Math.abs(s)>f5&&++a<h5);return o}const g5=8,v5=.001;function O5(t,e,n,i){for(let r=0;r<g5;++r){const s=v0(e,n,i);if(s===0)return e;const o=dl(e,n,i)-t;e-=o/s}return e}const pl=11,fl=1/(pl-1);function x5(t,e,n,i){if(t===e&&n===i)return ep;const r=new Float32Array(pl);for(let o=0;o<pl;++o)r[o]=dl(o*fl,t,n);function s(o){let a=0,l=1;const c=pl-1;for(;l!==c&&r[l]<=o;++l)a+=fl;--l;const u=(o-r[l])/(r[l+1]-r[l]),d=a+u*fl,p=v0(d,t,n);return p>=v5?O5(o,d,t,n):p===0?d:m5(o,a,a+fl,t,n)}return o=>o===0||o===1?o:dl(s(o),e,i)}function b5(t){var e=t.onTap,n=t.onTapStart,i=t.onTapCancel,r=t.whileTap,s=t.visualElement,o=e||n||i||r,a=P.useRef(!1),l=P.useRef(null),c={passive:!(n||e||i||h)};function u(){var m;(m=l.current)===null||m===void 0||m.call(l),l.current=null}function d(){var m;return u(),a.current=!1,(m=s.animationState)===null||m===void 0||m.setActive($e.Tap,!1),!Nb()}function p(m,g){d()&&(Xb(s.getInstance(),m.target)?e==null||e(m,g):i==null||i(m,g))}function f(m,g){d()&&(i==null||i(m,g))}function h(m,g){var O;u(),!a.current&&(a.current=!0,l.current=rl(kr(window,"pointerup",p,c),kr(window,"pointercancel",f,c)),(O=s.animationState)===null||O===void 0||O.setActive($e.Tap,!0),n==null||n(m,g))}nl(s,"pointerdown",o?h:void 0,c),Vb(u)}var O0=new Set;function x0(t,e,n){t||O0.has(e)||(console.warn(e),n&&console.warn(n),O0.add(e))}var lp=new WeakMap,cp=new WeakMap,y5=function(t){var e;(e=lp.get(t.target))===null||e===void 0||e(t)},w5=function(t){t.forEach(y5)};function S5(t){var e=t.root,n=Zt(t,["root"]),i=e||document;cp.has(i)||cp.set(i,{});var r=cp.get(i),s=JSON.stringify(n);return r[s]||(r[s]=new IntersectionObserver(w5,L({root:e},n))),r[s]}function P5(t,e,n){var i=S5(e);return lp.set(t,n),i.observe(t),function(){lp.delete(t),i.unobserve(t)}}function k5(t){var e=t.visualElement,n=t.whileInView,i=t.onViewportEnter,r=t.onViewportLeave,s=t.viewport,o=s===void 0?{}:s,a=P.useRef({hasEnteredView:!1,isInView:!1}),l=!!(n||i||r);o.once&&a.current.hasEnteredView&&(l=!1);var c=typeof IntersectionObserver>"u"?Q5:T5;c(l,a.current,e,o)}var $5={some:0,all:1};function T5(t,e,n,i){var r=i.root,s=i.margin,o=i.amount,a=o===void 0?"some":o,l=i.once;P.useEffect(function(){if(t){var c={root:r==null?void 0:r.current,rootMargin:s,threshold:typeof a=="number"?a:$5[a]},u=function(d){var p,f=d.isIntersecting;if(e.isInView!==f&&(e.isInView=f,!(l&&!f&&e.hasEnteredView))){f&&(e.hasEnteredView=!0),(p=n.animationState)===null||p===void 0||p.setActive($e.InView,f);var h=n.getProps(),m=f?h.onViewportEnter:h.onViewportLeave;m==null||m(d)}};return P5(n.getInstance(),c,u)}},[t,r,s,a])}function Q5(t,e,n,i){var r=i.fallback,s=r===void 0?!0:r;P.useEffect(function(){!t||!s||(Fx!=="production"&&x0(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var o;e.hasEnteredView=!0;var a=n.getProps().onViewportEnter;a==null||a(null),(o=n.animationState)===null||o===void 0||o.setActive($e.InView,!0)}))},[t])}var pi=function(t){return function(e){return t(e),null}},C5={inView:pi(k5),tap:pi(b5),focus:pi(cM),hover:pi(xM)},E5=0,j5=function(){return E5++},A5=function(){return Ga(j5)};function b0(){var t=P.useContext(Ba);if(t===null)return[!0,null];var e=t.isPresent,n=t.onExitComplete,i=t.register,r=A5();P.useEffect(function(){return i(r)},[]);var s=function(){return n==null?void 0:n(r)};return!e&&n?[!1,s]:[!0]}function y0(t,e){if(!Array.isArray(e))return!1;var n=e.length;if(n!==t.length)return!1;for(var i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}var hl=function(t){return t*1e3},w0={linear:ep,easeIn:tp,easeInOut:i0,easeOut:WM,circIn:r0,circInOut:qM,circOut:np,backIn:ip,backInOut:YM,backOut:zM,anticipate:BM,bounceIn:HM,bounceInOut:JM,bounceOut:ol},S0=function(t){if(Array.isArray(t)){Nt(t.length===4,"Cubic bezier arrays must contain four numerical values.");var e=Be(t,4),n=e[0],i=e[1],r=e[2],s=e[3];return x5(n,i,r,s)}else if(typeof t=="string")return Nt(w0[t]!==void 0,"Invalid easing type '".concat(t,"'")),w0[t];return t},D5=function(t){return Array.isArray(t)&&typeof t[0]!="number"},P0=function(t,e){return t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&Ln.test(e)&&!e.startsWith("url("))},qi=function(){return{type:"spring",stiffness:500,damping:25,restSpeed:10}},ml=function(t){return{type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}},up=function(){return{type:"keyframes",ease:"linear",duration:.3}},M5=function(t){return{type:"keyframes",duration:.8,values:t}},k0={x:qi,y:qi,z:qi,rotate:qi,rotateX:qi,rotateY:qi,rotateZ:qi,scaleX:ml,scaleY:ml,scale:ml,opacity:up,backgroundColor:up,color:up,default:ml},R5=function(t,e){var n;return Ys(e)?n=M5:n=k0[t]||k0.default,L({to:e},n(e))},_5=L(L({},Ob),{color:ft,backgroundColor:ft,outlineColor:ft,fill:ft,stroke:ft,borderColor:ft,borderTopColor:ft,borderRightColor:ft,borderBottomColor:ft,borderLeftColor:ft,filter:Ld,WebkitFilter:Ld}),dp=function(t){return _5[t]};function pp(t,e){var n,i=dp(t);return i!==Ld&&(i=Ln),(n=i.getAnimatableNone)===null||n===void 0?void 0:n.call(i,e)}function I5(t){t.when,t.delay,t.delayChildren,t.staggerChildren,t.staggerDirection,t.repeat,t.repeatType,t.repeatDelay,t.from;var e=Zt(t,["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from"]);return!!Object.keys(e).length}var $0=!1;function Z5(t){var e=t.ease,n=t.times,i=t.yoyo,r=t.flip,s=t.loop,o=Zt(t,["ease","times","yoyo","flip","loop"]),a=L({},o);return n&&(a.offset=n),o.duration&&(a.duration=hl(o.duration)),o.repeatDelay&&(a.repeatDelay=hl(o.repeatDelay)),e&&(a.ease=D5(e)?e.map(S0):S0(e)),o.type==="tween"&&(a.type="keyframes"),(i||s||r)&&(Is(!$0,"yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options."),$0=!0,i?a.repeatType="reverse":s?a.repeatType="loop":r&&(a.repeatType="mirror"),a.repeat=s||i||r||o.repeat),o.type!=="spring"&&(a.type="keyframes"),a}function N5(t,e){var n,i,r=fp(t,e)||{};return(i=(n=r.delay)!==null&&n!==void 0?n:t.delay)!==null&&i!==void 0?i:0}function L5(t){return Array.isArray(t.to)&&t.to[0]===null&&(t.to=Pn([],Be(t.to),!1),t.to[0]=t.from),t}function X5(t,e,n){var i;return Array.isArray(e.to)&&((i=t.duration)!==null&&i!==void 0||(t.duration=.8)),L5(e),I5(t)||(t=L(L({},t),R5(n,e.to))),L(L({},e),Z5(t))}function V5(t,e,n,i,r){var s,o=fp(i,t),a=(s=o.from)!==null&&s!==void 0?s:e.get(),l=P0(t,n);a==="none"&&l&&typeof n=="string"?a=pp(t,n):T0(a)&&typeof n=="string"?a=Q0(n):!Array.isArray(n)&&T0(n)&&typeof a=="string"&&(n=Q0(a));var c=P0(t,a);Is(c===l,"You are trying to animate ".concat(t,' from "').concat(a,'" to "').concat(n,'". ').concat(a," is not an animatable value - to enable this animation set ").concat(a," to a value animatable to ").concat(n," via the `style` property."));function u(){var p={from:a,to:n,velocity:e.getVelocity(),onComplete:r,onUpdate:function(f){return e.set(f)}};return o.type==="inertia"||o.type==="decay"?p5(L(L({},p),o)):u0(L(L({},X5(o,p,t)),{onUpdate:function(f){var h;p.onUpdate(f),(h=o.onUpdate)===null||h===void 0||h.call(o,f)},onComplete:function(){var f;p.onComplete(),(f=o.onComplete)===null||f===void 0||f.call(o)}}))}function d(){var p,f,h=Qb(n);return e.set(h),r(),(p=o==null?void 0:o.onUpdate)===null||p===void 0||p.call(o,h),(f=o==null?void 0:o.onComplete)===null||f===void 0||f.call(o),{stop:function(){}}}return!c||!l||o.type===!1?d:u}function T0(t){return t===0||typeof t=="string"&&parseFloat(t)===0&&t.indexOf(" ")===-1}function Q0(t){return typeof t=="number"?0:pp("",t)}function fp(t,e){return t[e]||t.default||t}function hp(t,e,n,i){return i===void 0&&(i={}),e.start(function(r){var s,o,a=V5(t,e,n,i,r),l=N5(i,t),c=function(){return o=a()};return l?s=window.setTimeout(c,hl(l)):c(),function(){clearTimeout(s),o==null||o.stop()}})}var W5=function(t){return/^\-?\d*\.?\d+$/.test(t)},q5=function(t){return/^0[^.\s]+$/.test(t)};function mp(t,e){t.indexOf(e)===-1&&t.push(e)}function gp(t,e){var n=t.indexOf(e);n>-1&&t.splice(n,1)}var Gs=function(){function t(){this.subscriptions=[]}return t.prototype.add=function(e){var n=this;return mp(this.subscriptions,e),function(){return gp(n.subscriptions,e)}},t.prototype.notify=function(e,n,i){var r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,n,i);else for(var s=0;s<r;s++){var o=this.subscriptions[s];o&&o(e,n,i)}},t.prototype.getSize=function(){return this.subscriptions.length},t.prototype.clear=function(){this.subscriptions.length=0},t}(),z5=function(t){return!isNaN(parseFloat(t))},Y5=function(){function t(e){var n=this;this.version="6.5.1",this.timeDelta=0,this.lastUpdated=0,this.updateSubscribers=new Gs,this.velocityUpdateSubscribers=new Gs,this.renderSubscribers=new Gs,this.canTrackVelocity=!1,this.updateAndNotify=function(i,r){r===void 0&&(r=!0),n.prev=n.current,n.current=i;var s=cl(),o=s.delta,a=s.timestamp;n.lastUpdated!==a&&(n.timeDelta=o,n.lastUpdated=a,$n.postRender(n.scheduleVelocityCheck)),n.prev!==n.current&&n.updateSubscribers.notify(n.current),n.velocityUpdateSubscribers.getSize()&&n.velocityUpdateSubscribers.notify(n.getVelocity()),r&&n.renderSubscribers.notify(n.current)},this.scheduleVelocityCheck=function(){return $n.postRender(n.velocityCheck)},this.velocityCheck=function(i){var r=i.timestamp;r!==n.lastUpdated&&(n.prev=n.current,n.velocityUpdateSubscribers.notify(n.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=z5(this.current)}return t.prototype.onChange=function(e){return this.updateSubscribers.add(e)},t.prototype.clearListeners=function(){this.updateSubscribers.clear()},t.prototype.onRenderRequest=function(e){return e(this.get()),this.renderSubscribers.add(e)},t.prototype.attach=function(e){this.passiveEffect=e},t.prototype.set=function(e,n){n===void 0&&(n=!0),!n||!this.passiveEffect?this.updateAndNotify(e,n):this.passiveEffect(e,this.updateAndNotify)},t.prototype.get=function(){return this.current},t.prototype.getPrevious=function(){return this.prev},t.prototype.getVelocity=function(){return this.canTrackVelocity?d0(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0},t.prototype.start=function(e){var n=this;return this.stop(),new Promise(function(i){n.hasAnimated=!0,n.stopAnimation=e(i)}).then(function(){return n.clearAnimation()})},t.prototype.stop=function(){this.stopAnimation&&this.stopAnimation(),this.clearAnimation()},t.prototype.isAnimating=function(){return!!this.stopAnimation},t.prototype.clearAnimation=function(){this.stopAnimation=null},t.prototype.destroy=function(){this.updateSubscribers.clear(),this.renderSubscribers.clear(),this.stop()},t}();function Qr(t){return new Y5(t)}var C0=function(t){return function(e){return e.test(t)}},B5={test:function(t){return t==="auto"},parse:function(t){return t}},E0=[Vi,ie,kn,ui,RD,MD,B5],Hs=function(t){return E0.find(C0(t))},U5=Pn(Pn([],Be(E0),!1),[ft,Ln],!1),F5=function(t){return U5.find(C0(t))};function G5(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Qr(n))}function H5(t,e){var n=Ua(t,e),i=n?t.makeTargetAnimatable(n,!1):{},r=i.transitionEnd,s=r===void 0?{}:r;i.transition;var o=Zt(i,["transitionEnd","transition"]);o=L(L({},o),s);for(var a in o){var l=Qb(o[a]);G5(t,a,l)}}function J5(t,e,n){var i,r,s,o,a=Object.keys(e).filter(function(f){return!t.hasValue(f)}),l=a.length;if(l)for(var c=0;c<l;c++){var u=a[c],d=e[u],p=null;Array.isArray(d)&&(p=d[0]),p===null&&(p=(r=(i=n[u])!==null&&i!==void 0?i:t.readValue(u))!==null&&r!==void 0?r:e[u]),p!=null&&(typeof p=="string"&&(W5(p)||q5(p))?p=parseFloat(p):!F5(p)&&Ln.test(d)&&(p=pp(u,d)),t.addValue(u,Qr(p)),(s=(o=n)[u])!==null&&s!==void 0||(o[u]=p),t.setBaseTarget(u,p))}}function K5(t,e){if(e){var n=e[t]||e.default||e;return n.from}}function eR(t,e,n){var i,r,s={};for(var o in t)s[o]=(i=K5(o,e))!==null&&i!==void 0?i:(r=n.getValue(o))===null||r===void 0?void 0:r.get();return s}function tR(t,e,n){n===void 0&&(n={}),t.notifyAnimationStart(e);var i;if(Array.isArray(e)){var r=e.map(function(o){return vp(t,o,n)});i=Promise.all(r)}else if(typeof e=="string")i=vp(t,e,n);else{var s=typeof e=="function"?Ua(t,e,n.custom):e;i=j0(t,s,n)}return i.then(function(){return t.notifyAnimationComplete(e)})}function vp(t,e,n){var i;n===void 0&&(n={});var r=Ua(t,e,n.custom),s=(r||{}).transition,o=s===void 0?t.getDefaultTransition()||{}:s;n.transitionOverride&&(o=n.transitionOverride);var a=r?function(){return j0(t,r,n)}:function(){return Promise.resolve()},l=!((i=t.variantChildren)===null||i===void 0)&&i.size?function(f){f===void 0&&(f=0);var h=o.delayChildren,m=h===void 0?0:h,g=o.staggerChildren,O=o.staggerDirection;return nR(t,e,m+f,g,O,n)}:function(){return Promise.resolve()},c=o.when;if(c){var u=Be(c==="beforeChildren"?[a,l]:[l,a],2),d=u[0],p=u[1];return d().then(p)}else return Promise.all([a(),l(n.delay)])}function j0(t,e,n){var i,r=n===void 0?{}:n,s=r.delay,o=s===void 0?0:s,a=r.transitionOverride,l=r.type,c=t.makeTargetAnimatable(e),u=c.transition,d=u===void 0?t.getDefaultTransition():u,p=c.transitionEnd,f=Zt(c,["transition","transitionEnd"]);a&&(d=a);var h=[],m=l&&((i=t.animationState)===null||i===void 0?void 0:i.getState()[l]);for(var g in f){var O=t.getValue(g),v=f[g];if(!(!O||v===void 0||m&&rR(m,g))){var x=L({delay:o},d);t.shouldReduceMotion&&Ls(g)&&(x=L(L({},x),{type:!1,delay:0}));var b=hp(g,O,v,x);h.push(b)}}return Promise.all(h).then(function(){p&&H5(t,p)})}function nR(t,e,n,i,r,s){n===void 0&&(n=0),i===void 0&&(i=0),r===void 0&&(r=1);var o=[],a=(t.variantChildren.size-1)*i,l=r===1?function(c){return c===void 0&&(c=0),c*i}:function(c){return c===void 0&&(c=0),a-c*i};return Array.from(t.variantChildren).sort(iR).forEach(function(c,u){o.push(vp(c,e,L(L({},s),{delay:n+l(u)})).then(function(){return c.notifyAnimationComplete(e)}))}),Promise.all(o)}function iR(t,e){return t.sortNodePosition(e)}function rR(t,e){var n=t.protectedKeys,i=t.needsAnimating,r=n.hasOwnProperty(e)&&i[e]!==!0;return i[e]=!1,r}var Op=[$e.Animate,$e.InView,$e.Focus,$e.Hover,$e.Tap,$e.Drag,$e.Exit],sR=Pn([],Be(Op),!1).reverse(),oR=Op.length;function aR(t){return function(e){return Promise.all(e.map(function(n){var i=n.animation,r=n.options;return tR(t,i,r)}))}}function lR(t){var e=aR(t),n=uR(),i={},r=!0,s=function(u,d){var p=Ua(t,d);if(p){p.transition;var f=p.transitionEnd,h=Zt(p,["transition","transitionEnd"]);u=L(L(L({},u),h),f)}return u};function o(u){return i[u]!==void 0}function a(u){e=u(t)}function l(u,d){for(var p,f=t.getProps(),h=t.getVariantContext(!0)||{},m=[],g=new Set,O={},v=1/0,x=function(k){var T=sR[k],E=n[T],C=(p=f[T])!==null&&p!==void 0?p:h[T],M=nn(C),Z=T===d?E.isActive:null;Z===!1&&(v=k);var q=C===h[T]&&C!==f[T]&&M;if(q&&r&&t.manuallyAnimateOnMount&&(q=!1),E.protectedKeys=L({},O),!E.isActive&&Z===null||!C&&!E.prevProp||zd(C)||typeof C=="boolean")return"continue";var N=cR(E.prevProp,C),_=N||T===d&&E.isActive&&!q&&M||k>v&&M,G=Array.isArray(C)?C:[C],ee=G.reduce(s,{});Z===!1&&(ee={});var le=E.prevResolvedValues,he=le===void 0?{}:le,B=L(L({},he),ee),A=function(W){_=!0,g.delete(W),E.needsAnimating[W]=!0};for(var V in B){var X=ee[V],D=he[V];O.hasOwnProperty(V)||(X!==D?Ys(X)&&Ys(D)?!y0(X,D)||N?A(V):E.protectedKeys[V]=!0:X!==void 0?A(V):g.add(V):X!==void 0&&g.has(V)?A(V):E.protectedKeys[V]=!0)}E.prevProp=C,E.prevResolvedValues=ee,E.isActive&&(O=L(L({},O),ee)),r&&t.blockInitialAnimation&&(_=!1),_&&!q&&m.push.apply(m,Pn([],Be(G.map(function(W){return{animation:W,options:L({type:T},u)}})),!1))},b=0;b<oR;b++)x(b);if(i=L({},O),g.size){var w={};g.forEach(function(k){var T=t.getBaseTarget(k);T!==void 0&&(w[k]=T)}),m.push({animation:w})}var y=!!m.length;return r&&f.initial===!1&&!t.manuallyAnimateOnMount&&(y=!1),r=!1,y?e(m):Promise.resolve()}function c(u,d,p){var f;if(n[u].isActive===d)return Promise.resolve();(f=t.variantChildren)===null||f===void 0||f.forEach(function(g){var O;return(O=g.animationState)===null||O===void 0?void 0:O.setActive(u,d)}),n[u].isActive=d;var h=l(p,u);for(var m in n)n[m].protectedKeys={};return h}return{isAnimated:o,animateChanges:l,setActive:c,setAnimateFunction:a,getState:function(){return n}}}function cR(t,e){return typeof e=="string"?e!==t:eb(e)?!y0(e,t):!1}function zi(t){return t===void 0&&(t=!1),{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function uR(){var t;return t={},t[$e.Animate]=zi(!0),t[$e.InView]=zi(),t[$e.Hover]=zi(),t[$e.Tap]=zi(),t[$e.Drag]=zi(),t[$e.Focus]=zi(),t[$e.Exit]=zi(),t}var dR={animation:pi(function(t){var e=t.visualElement,n=t.animate;e.animationState||(e.animationState=lR(e)),zd(n)&&P.useEffect(function(){return n.subscribe(e)},[n])}),exit:pi(function(t){var e=t.custom,n=t.visualElement,i=Be(b0(),2),r=i[0],s=i[1],o=P.useContext(Ba);P.useEffect(function(){var a,l;n.isPresent=r;var c=(a=n.animationState)===null||a===void 0?void 0:a.setActive($e.Exit,!r,{custom:(l=o==null?void 0:o.custom)!==null&&l!==void 0?l:e});!r&&(c==null||c.then(s))},[r])})},A0=function(){function t(e,n,i){var r=this,s=i===void 0?{}:i,o=s.transformPagePoint;if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=function(){if(r.lastMoveEvent&&r.lastMoveEventInfo){var p=bp(r.lastMoveEventInfo,r.history),f=r.startEvent!==null,h=f0(p.offset,{x:0,y:0})>=3;if(!(!f&&!h)){var m=p.point,g=cl().timestamp;r.history.push(L(L({},m),{timestamp:g}));var O=r.handlers,v=O.onStart,x=O.onMove;f||(v&&v(r.lastMoveEvent,p),r.startEvent=r.lastMoveEvent),x&&x(r.lastMoveEvent,p)}}},this.handlePointerMove=function(p,f){if(r.lastMoveEvent=p,r.lastMoveEventInfo=xp(f,r.transformPagePoint),jb(p)&&p.buttons===0){r.handlePointerUp(p,f);return}$n.update(r.updatePoint,!0)},this.handlePointerUp=function(p,f){r.end();var h=r.handlers,m=h.onEnd,g=h.onSessionEnd,O=bp(xp(f,r.transformPagePoint),r.history);r.startEvent&&m&&m(p,O),g&&g(p,O)},!(Ab(e)&&e.touches.length>1)){this.handlers=n,this.transformPagePoint=o;var a=Bd(e),l=xp(a,this.transformPagePoint),c=l.point,u=cl().timestamp;this.history=[L(L({},c),{timestamp:u})];var d=n.onSessionStart;d&&d(e,bp(l,this.history)),this.removeListeners=rl(kr(window,"pointermove",this.handlePointerMove),kr(window,"pointerup",this.handlePointerUp),kr(window,"pointercancel",this.handlePointerUp))}}return t.prototype.updateHandlers=function(e){this.handlers=e},t.prototype.end=function(){this.removeListeners&&this.removeListeners(),Tr.update(this.updatePoint)},t}();function xp(t,e){return e?{point:e(t.point)}:t}function D0(t,e){return{x:t.x-e.x,y:t.y-e.y}}function bp(t,e){var n=t.point;return{point:n,delta:D0(n,M0(e)),offset:D0(n,pR(e)),velocity:fR(e,.1)}}function pR(t){return t[0]}function M0(t){return t[t.length-1]}function fR(t,e){if(t.length<2)return{x:0,y:0};for(var n=t.length-1,i=null,r=M0(t);n>=0&&(i=t[n],!(r.timestamp-i.timestamp>hl(e)));)n--;if(!i)return{x:0,y:0};var s=(r.timestamp-i.timestamp)/1e3;if(s===0)return{x:0,y:0};var o={x:(r.x-i.x)/s,y:(r.y-i.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Xn(t){return t.max-t.min}function R0(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=.01),f0(t,e)<n}function _0(t,e,n,i){i===void 0&&(i=.5),t.origin=i,t.originPoint=Ae(e.min,e.max,t.origin),t.scale=Xn(n)/Xn(e),(R0(t.scale,1,1e-4)||isNaN(t.scale))&&(t.scale=1),t.translate=Ae(n.min,n.max,t.origin)-t.originPoint,(R0(t.translate)||isNaN(t.translate))&&(t.translate=0)}function Js(t,e,n,i){_0(t.x,e.x,n.x,i==null?void 0:i.originX),_0(t.y,e.y,n.y,i==null?void 0:i.originY)}function I0(t,e,n){t.min=n.min+e.min,t.max=t.min+Xn(e)}function hR(t,e,n){I0(t.x,e.x,n.x),I0(t.y,e.y,n.y)}function Z0(t,e,n){t.min=e.min-n.min,t.max=t.min+Xn(e)}function Ks(t,e,n){Z0(t.x,e.x,n.x),Z0(t.y,e.y,n.y)}function mR(t,e,n){var i=e.min,r=e.max;return i!==void 0&&t<i?t=n?Ae(i,t,n.min):Math.max(t,i):r!==void 0&&t>r&&(t=n?Ae(r,t,n.max):Math.min(t,r)),t}function N0(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 gR(t,e){var n=e.top,i=e.left,r=e.bottom,s=e.right;return{x:N0(t.x,i,s),y:N0(t.y,n,r)}}function L0(t,e){var n,i=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&(n=Be([r,i],2),i=n[0],r=n[1]),{min:i,max:r}}function vR(t,e){return{x:L0(t.x,e.x),y:L0(t.y,e.y)}}function OR(t,e){var n=.5,i=Xn(t),r=Xn(e);return r>i?n=Bs(e.min,e.max-i,t.min):i>r&&(n=Bs(t.min,t.max-r,e.min)),il(0,1,n)}function xR(t,e){var n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}var yp=.35;function bR(t){return t===void 0&&(t=yp),t===!1?t=0:t===!0&&(t=yp),{x:X0(t,"left","right"),y:X0(t,"top","bottom")}}function X0(t,e,n){return{min:V0(t,e),max:V0(t,n)}}function V0(t,e){var n;return typeof t=="number"?t:(n=t[e])!==null&&n!==void 0?n:0}var W0=function(){return{translate:0,scale:1,origin:0,originPoint:0}},eo=function(){return{x:W0(),y:W0()}},q0=function(){return{min:0,max:0}},ot=function(){return{x:q0(),y:q0()}};function Tn(t){return[t("x"),t("y")]}function z0(t){var e=t.top,n=t.left,i=t.right,r=t.bottom;return{x:{min:n,max:i},y:{min:e,max:r}}}function yR(t){var e=t.x,n=t.y;return{top:n.min,right:e.max,bottom:n.max,left:e.min}}function wR(t,e){if(!e)return t;var n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function wp(t){return t===void 0||t===1}function Y0(t){var e=t.scale,n=t.scaleX,i=t.scaleY;return!wp(e)||!wp(n)||!wp(i)}function fi(t){return Y0(t)||B0(t.x)||B0(t.y)||t.z||t.rotate||t.rotateX||t.rotateY}function B0(t){return t&&t!=="0%"}function gl(t,e,n){var i=t-n,r=e*i;return n+r}function U0(t,e,n,i,r){return r!==void 0&&(t=gl(t,r,i)),gl(t,n,i)+e}function Sp(t,e,n,i,r){e===void 0&&(e=0),n===void 0&&(n=1),t.min=U0(t.min,e,n,i,r),t.max=U0(t.max,e,n,i,r)}function F0(t,e){var n=e.x,i=e.y;Sp(t.x,n.translate,n.scale,n.originPoint),Sp(t.y,i.translate,i.scale,i.originPoint)}function SR(t,e,n,i){var r,s;i===void 0&&(i=!1);var o=n.length;if(o){e.x=e.y=1;for(var a,l,c=0;c<o;c++)a=n[c],l=a.projectionDelta,((s=(r=a.instance)===null||r===void 0?void 0:r.style)===null||s===void 0?void 0:s.display)!=="contents"&&(i&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Cr(t,{x:-a.scroll.x,y:-a.scroll.y}),l&&(e.x*=l.x.scale,e.y*=l.y.scale,F0(t,l)),i&&fi(a.latestValues)&&Cr(t,a.latestValues))}}function hi(t,e){t.min=t.min+e,t.max=t.max+e}function G0(t,e,n){var i=Be(n,3),r=i[0],s=i[1],o=i[2],a=e[o]!==void 0?e[o]:.5,l=Ae(t.min,t.max,a);Sp(t,e[r],e[s],l,e.scale)}var PR=["x","scaleX","originX"],kR=["y","scaleY","originY"];function Cr(t,e){G0(t.x,e,PR),G0(t.y,e,kR)}function H0(t,e){return z0(wR(t.getBoundingClientRect(),e))}function $R(t,e,n){var i=H0(t,n),r=e.scroll;return r&&(hi(i.x,r.x),hi(i.y,r.y)),i}var TR=new WeakMap,QR=function(){function t(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ot(),this.visualElement=e}return t.prototype.start=function(e,n){var i=this,r=n===void 0?{}:n,s=r.snapToCursor,o=s===void 0?!1:s;if(this.visualElement.isPresent!==!1){var a=function(d){i.stopAnimation(),o&&i.snapToCursor(Bd(d,"page").point)},l=function(d,p){var f,h=i.getProps(),m=h.drag,g=h.dragPropagation,O=h.onDragStart;m&&!g&&(i.openGlobalLock&&i.openGlobalLock(),i.openGlobalLock=Zb(m),!i.openGlobalLock)||(i.isDragging=!0,i.currentDirection=null,i.resolveConstraints(),i.visualElement.projection&&(i.visualElement.projection.isAnimationBlocked=!0,i.visualElement.projection.target=void 0),Tn(function(v){var x,b,w=i.getAxisMotionValue(v).get()||0;if(kn.test(w)){var y=(b=(x=i.visualElement.projection)===null||x===void 0?void 0:x.layout)===null||b===void 0?void 0:b.actual[v];if(y){var k=Xn(y);w=k*(parseFloat(w)/100)}}i.originPoint[v]=w}),O==null||O(d,p),(f=i.visualElement.animationState)===null||f===void 0||f.setActive($e.Drag,!0))},c=function(d,p){var f=i.getProps(),h=f.dragPropagation,m=f.dragDirectionLock,g=f.onDirectionLock,O=f.onDrag;if(!(!h&&!i.openGlobalLock)){var v=p.offset;if(m&&i.currentDirection===null){i.currentDirection=CR(v),i.currentDirection!==null&&(g==null||g(i.currentDirection));return}i.updateAxis("x",p.point,v),i.updateAxis("y",p.point,v),i.visualElement.syncRender(),O==null||O(d,p)}},u=function(d,p){return i.stop(d,p)};this.panSession=new A0(e,{onSessionStart:a,onStart:l,onMove:c,onSessionEnd:u},{transformPagePoint:this.visualElement.getTransformPagePoint()})}},t.prototype.stop=function(e,n){var i=this.isDragging;if(this.cancel(),!!i){var r=n.velocity;this.startAnimation(r);var s=this.getProps().onDragEnd;s==null||s(e,n)}},t.prototype.cancel=function(){var e,n;this.isDragging=!1,this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!1),(e=this.panSession)===null||e===void 0||e.end(),this.panSession=void 0;var i=this.getProps().dragPropagation;!i&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),(n=this.visualElement.animationState)===null||n===void 0||n.setActive($e.Drag,!1)},t.prototype.updateAxis=function(e,n,i){var r=this.getProps().drag;if(!(!i||!vl(e,r,this.currentDirection))){var s=this.getAxisMotionValue(e),o=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(o=mR(o,this.constraints[e],this.elastic[e])),s.set(o)}},t.prototype.resolveConstraints=function(){var e=this,n=this.getProps(),i=n.dragConstraints,r=n.dragElastic,s=(this.visualElement.projection||{}).layout,o=this.constraints;i&&Pr(i)?this.constraints||(this.constraints=this.resolveRefConstraints()):i&&s?this.constraints=gR(s.actual,i):this.constraints=!1,this.elastic=bR(r),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Tn(function(a){e.getAxisMotionValue(a)&&(e.constraints[a]=xR(s.actual[a],e.constraints[a]))})},t.prototype.resolveRefConstraints=function(){var e=this.getProps(),n=e.dragConstraints,i=e.onMeasureDragConstraints;if(!n||!Pr(n))return!1;var r=n.current;Nt(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");var s=this.visualElement.projection;if(!s||!s.layout)return!1;var o=$R(r,s.root,this.visualElement.getTransformPagePoint()),a=vR(s.layout.actual,o);if(i){var l=i(yR(a));this.hasMutatedConstraints=!!l,l&&(a=z0(l))}return a},t.prototype.startAnimation=function(e){var n=this,i=this.getProps(),r=i.drag,s=i.dragMomentum,o=i.dragElastic,a=i.dragTransition,l=i.dragSnapToOrigin,c=i.onDragTransitionEnd,u=this.constraints||{},d=Tn(function(p){var f;if(vl(p,r,n.currentDirection)){var h=(f=u==null?void 0:u[p])!==null&&f!==void 0?f:{};l&&(h={min:0,max:0});var m=o?200:1e6,g=o?40:1e7,O=L(L({type:"inertia",velocity:s?e[p]:0,bounceStiffness:m,bounceDamping:g,timeConstant:750,restDelta:1,restSpeed:10},a),h);return n.startAxisValueAnimation(p,O)}});return Promise.all(d).then(c)},t.prototype.startAxisValueAnimation=function(e,n){var i=this.getAxisMotionValue(e);return hp(e,i,0,n)},t.prototype.stopAnimation=function(){var e=this;Tn(function(n){return e.getAxisMotionValue(n).stop()})},t.prototype.getAxisMotionValue=function(e){var n,i,r="_drag"+e.toUpperCase(),s=this.visualElement.getProps()[r];return s||this.visualElement.getValue(e,(i=(n=this.visualElement.getProps().initial)===null||n===void 0?void 0:n[e])!==null&&i!==void 0?i:0)},t.prototype.snapToCursor=function(e){var n=this;Tn(function(i){var r=n.getProps().drag;if(vl(i,r,n.currentDirection)){var s=n.visualElement.projection,o=n.getAxisMotionValue(i);if(s&&s.layout){var a=s.layout.actual[i],l=a.min,c=a.max;o.set(e[i]-Ae(l,c,.5))}}})},t.prototype.scalePositionWithinConstraints=function(){var e=this,n,i=this.getProps(),r=i.drag,s=i.dragConstraints,o=this.visualElement.projection;if(!(!Pr(s)||!o||!this.constraints)){this.stopAnimation();var a={x:0,y:0};Tn(function(c){var u=e.getAxisMotionValue(c);if(u){var d=u.get();a[c]=OR({min:d,max:d},e.constraints[c])}});var l=this.visualElement.getProps().transformTemplate;this.visualElement.getInstance().style.transform=l?l({},""):"none",(n=o.root)===null||n===void 0||n.updateScroll(),o.updateLayout(),this.resolveConstraints(),Tn(function(c){if(vl(c,r,null)){var u=e.getAxisMotionValue(c),d=e.constraints[c],p=d.min,f=d.max;u.set(Ae(p,f,a[c]))}})}},t.prototype.addListeners=function(){var e=this,n;TR.set(this.visualElement,this);var i=this.visualElement.getInstance(),r=kr(i,"pointerdown",function(c){var u=e.getProps(),d=u.drag,p=u.dragListener,f=p===void 0?!0:p;d&&f&&e.start(c)}),s=function(){var c=e.getProps().dragConstraints;Pr(c)&&(e.constraints=e.resolveRefConstraints())},o=this.visualElement.projection,a=o.addEventListener("measure",s);o&&!o.layout&&((n=o.root)===null||n===void 0||n.updateScroll(),o.updateLayout()),s();var l=tl(window,"resize",function(){return e.scalePositionWithinConstraints()});return o.addEventListener("didUpdate",function(c){var u=c.delta,d=c.hasLayoutChanged;e.isDragging&&d&&(Tn(function(p){var f=e.getAxisMotionValue(p);f&&(e.originPoint[p]+=u[p].translate,f.set(f.get()+u[p].translate))}),e.visualElement.syncRender())}),function(){l(),r(),a()}},t.prototype.getProps=function(){var e=this.visualElement.getProps(),n=e.drag,i=n===void 0?!1:n,r=e.dragDirectionLock,s=r===void 0?!1:r,o=e.dragPropagation,a=o===void 0?!1:o,l=e.dragConstraints,c=l===void 0?!1:l,u=e.dragElastic,d=u===void 0?yp:u,p=e.dragMomentum,f=p===void 0?!0:p;return L(L({},e),{drag:i,dragDirectionLock:s,dragPropagation:a,dragConstraints:c,dragElastic:d,dragMomentum:f})},t}();function vl(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function CR(t,e){e===void 0&&(e=10);var n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}function ER(t){var e=t.dragControls,n=t.visualElement,i=Ga(function(){return new QR(n)});P.useEffect(function(){return e&&e.subscribe(i)},[i,e]),P.useEffect(function(){return i.addListeners()},[i])}function jR(t){var e=t.onPan,n=t.onPanStart,i=t.onPanEnd,r=t.onPanSessionStart,s=t.visualElement,o=e||n||i||r,a=P.useRef(null),l=P.useContext(Ad).transformPagePoint,c={onSessionStart:r,onStart:n,onMove:e,onEnd:function(d,p){a.current=null,i&&i(d,p)}};P.useEffect(function(){a.current!==null&&a.current.updateHandlers(c)});function u(d){a.current=new A0(d,c,{transformPagePoint:l})}nl(s,"pointerdown",o&&u),Vb(function(){return a.current&&a.current.end()})}var AR={pan:pi(jR),drag:pi(ER)},Ol=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function DR(){var t=Ol.map(function(){return new Gs}),e={},n={clearAllListeners:function(){return t.forEach(function(i){return i.clear()})},updatePropListeners:function(i){Ol.forEach(function(r){var s,o="on"+r,a=i[o];(s=e[r])===null||s===void 0||s.call(e),a&&(e[r]=n[o](a))})}};return t.forEach(function(i,r){n["on"+Ol[r]]=function(s){return i.add(s)},n["notify"+Ol[r]]=function(){for(var s=[],o=0;o<arguments.length;o++)s[o]=arguments[o];return i.notify.apply(i,Pn([],Be(s),!1))}}),n}function MR(t,e,n){var i;for(var r in e){var s=e[r],o=n[r];if(Nn(s))t.addValue(r,s),process.env.NODE_ENV==="development"&&x0(s.version==="6.5.1","Attempting to mix Framer Motion versions ".concat(s.version," with 6.5.1 may not work as expected."));else if(Nn(o))t.addValue(r,Qr(s));else if(o!==s)if(t.hasValue(r)){var a=t.getValue(r);!a.hasAnimated&&a.set(s)}else t.addValue(r,Qr((i=t.getStaticValue(r))!==null&&i!==void 0?i:s))}for(var r in n)e[r]===void 0&&t.removeValue(r);return e}var J0=function(t){var e=t.treeType,n=e===void 0?"":e,i=t.build,r=t.getBaseTarget,s=t.makeTargetAnimatable,o=t.measureViewportBox,a=t.render,l=t.readValueFromInstance,c=t.removeValueFromRenderState,u=t.sortNodePosition,d=t.scrapeMotionValuesFromProps;return function(p,f){var h=p.parent,m=p.props,g=p.presenceId,O=p.blockInitialAnimation,v=p.visualState,x=p.shouldReduceMotion;f===void 0&&(f={});var b=!1,w=v.latestValues,y=v.renderState,k,T=DR(),E=new Map,C=new Map,M={},Z=L({},w),q;function N(){!k||!b||(_(),a(k,y,m.style,X.projection))}function _(){i(X,y,w,f,m)}function G(){T.notifyUpdate(w)}function ee(D,W){var se=W.onChange(function(me){w[D]=me,m.onUpdate&&$n.update(G,!1,!0)}),Ee=W.onRenderRequest(X.scheduleRender);C.set(D,function(){se(),Ee()})}var le=d(m);for(var he in le){var B=le[he];w[he]!==void 0&&Nn(B)&&B.set(w[he],!1)}var A=Fa(m),V=nb(m),X=L(L({treeType:n,current:null,depth:h?h.depth+1:0,parent:h,children:new Set,presenceId:g,shouldReduceMotion:x,variantChildren:V?new Set:void 0,isVisible:void 0,manuallyAnimateOnMount:!!(h!=null&&h.isMounted()),blockInitialAnimation:O,isMounted:function(){return!!k},mount:function(D){b=!0,k=X.current=D,X.projection&&X.projection.mount(D),V&&h&&!A&&(q=h==null?void 0:h.addVariantChild(X)),E.forEach(function(W,se){return ee(se,W)}),h==null||h.children.add(X),X.setProps(m)},unmount:function(){var D;(D=X.projection)===null||D===void 0||D.unmount(),Tr.update(G),Tr.render(N),C.forEach(function(W){return W()}),q==null||q(),h==null||h.children.delete(X),T.clearAllListeners(),k=void 0,b=!1},addVariantChild:function(D){var W,se=X.getClosestVariantNode();if(se)return(W=se.variantChildren)===null||W===void 0||W.add(D),function(){return se.variantChildren.delete(D)}},sortNodePosition:function(D){return!u||n!==D.treeType?0:u(X.getInstance(),D.getInstance())},getClosestVariantNode:function(){return V?X:h==null?void 0:h.getClosestVariantNode()},getLayoutId:function(){return m.layoutId},getInstance:function(){return k},getStaticValue:function(D){return w[D]},setStaticValue:function(D,W){return w[D]=W},getLatestValues:function(){return w},setVisibility:function(D){X.isVisible!==D&&(X.isVisible=D,X.scheduleRender())},makeTargetAnimatable:function(D,W){return W===void 0&&(W=!0),s(X,D,m,W)},measureViewportBox:function(){return o(k,m)},addValue:function(D,W){X.hasValue(D)&&X.removeValue(D),E.set(D,W),w[D]=W.get(),ee(D,W)},removeValue:function(D){var W;E.delete(D),(W=C.get(D))===null||W===void 0||W(),C.delete(D),delete w[D],c(D,y)},hasValue:function(D){return E.has(D)},getValue:function(D,W){var se=E.get(D);return se===void 0&&W!==void 0&&(se=Qr(W),X.addValue(D,se)),se},forEachValue:function(D){return E.forEach(D)},readValue:function(D){var W;return(W=w[D])!==null&&W!==void 0?W:l(k,D,f)},setBaseTarget:function(D,W){Z[D]=W},getBaseTarget:function(D){if(r){var W=r(m,D);if(W!==void 0&&!Nn(W))return W}return Z[D]}},T),{build:function(){return _(),y},scheduleRender:function(){$n.render(N,!1,!0)},syncRender:N,setProps:function(D){(D.transformTemplate||m.transformTemplate)&&X.scheduleRender(),m=D,T.updatePropListeners(D),M=MR(X,d(m),M)},getProps:function(){return m},getVariant:function(D){var W;return(W=m.variants)===null||W===void 0?void 0:W[D]},getDefaultTransition:function(){return m.transition},getTransformPagePoint:function(){return m.transformPagePoint},getVariantContext:function(D){if(D===void 0&&(D=!1),D)return h==null?void 0:h.getVariantContext();if(!A){var W=(h==null?void 0:h.getVariantContext())||{};return m.initial!==void 0&&(W.initial=m.initial),W}for(var se={},Ee=0;Ee<RR;Ee++){var me=K0[Ee],Ge=m[me];(nn(Ge)||Ge===!1)&&(se[me]=Ge)}return se}});return X}},K0=Pn(["initial"],Be(Op),!1),RR=K0.length;function Pp(t){return typeof t=="string"&&t.startsWith("var(--")}var ey=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function _R(t){var e=ey.exec(t);if(!e)return[,];var n=Be(e,3),i=n[1],r=n[2];return[i,r]}var IR=4;function kp(t,e,n){n===void 0&&(n=1),Nt(n<=IR,'Max CSS variable fallback depth detected in property "'.concat(t,'". This may indicate a circular fallback dependency.'));var i=Be(_R(t),2),r=i[0],s=i[1];if(r){var o=window.getComputedStyle(e).getPropertyValue(r);return o?o.trim():Pp(s)?kp(s,e,n+1):s}}function ZR(t,e,n){var i,r=Zt(e,[]),s=t.getInstance();if(!(s instanceof Element))return{target:r,transitionEnd:n};n&&(n=L({},n)),t.forEachValue(function(c){var u=c.get();if(Pp(u)){var d=kp(u,s);d&&c.set(d)}});for(var o in r){var a=r[o];if(Pp(a)){var l=kp(a,s);l&&(r[o]=l,n&&((i=n[o])!==null&&i!==void 0||(n[o]=a)))}}return{target:r,transitionEnd:n}}var NR=new Set(["width","height","top","left","right","bottom","x","y"]),ty=function(t){return NR.has(t)},LR=function(t){return Object.keys(t).some(ty)},ny=function(t,e){t.set(e,!1),t.set(e)},xl=function(t){return t===Vi||t===ie},iy;(function(t){t.width="width",t.height="height",t.left="left",t.right="right",t.top="top",t.bottom="bottom"})(iy||(iy={}));var ry=function(t,e){return parseFloat(t.split(", ")[e])},sy=function(t,e){return function(n,i){var r=i.transform;if(r==="none"||!r)return 0;var s=r.match(/^matrix3d\((.+)\)$/);if(s)return ry(s[1],e);var o=r.match(/^matrix\((.+)\)$/);return o?ry(o[1],t):0}},XR=new Set(["x","y","z"]),VR=Ns.filter(function(t){return!XR.has(t)});function WR(t){var e=[];return VR.forEach(function(n){var i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e.length&&t.syncRender(),e}var oy={width:function(t,e){var n=t.x,i=e.paddingLeft,r=i===void 0?"0":i,s=e.paddingRight,o=s===void 0?"0":s;return n.max-n.min-parseFloat(r)-parseFloat(o)},height:function(t,e){var n=t.y,i=e.paddingTop,r=i===void 0?"0":i,s=e.paddingBottom,o=s===void 0?"0":s;return n.max-n.min-parseFloat(r)-parseFloat(o)},top:function(t,e){var n=e.top;return parseFloat(n)},left:function(t,e){var n=e.left;return parseFloat(n)},bottom:function(t,e){var n=t.y,i=e.top;return parseFloat(i)+(n.max-n.min)},right:function(t,e){var n=t.x,i=e.left;return parseFloat(i)+(n.max-n.min)},x:sy(4,13),y:sy(5,14)},qR=function(t,e,n){var i=e.measureViewportBox(),r=e.getInstance(),s=getComputedStyle(r),o=s.display,a={};o==="none"&&e.setStaticValue("display",t.display||"block"),n.forEach(function(c){a[c]=oy[c](i,s)}),e.syncRender();var l=e.measureViewportBox();return n.forEach(function(c){var u=e.getValue(c);ny(u,a[c]),t[c]=oy[c](l,s)}),t},zR=function(t,e,n,i){n===void 0&&(n={}),i===void 0&&(i={}),e=L({},e),i=L({},i);var r=Object.keys(e).filter(ty),s=[],o=!1,a=[];if(r.forEach(function(u){var d=t.getValue(u);if(t.hasValue(u)){var p=n[u],f=Hs(p),h=e[u],m;if(Ys(h)){var g=h.length,O=h[0]===null?1:0;p=h[O],f=Hs(p);for(var v=O;v<g;v++)m?Nt(Hs(h[v])===m,"All keyframes must be of the same type"):(m=Hs(h[v]),Nt(m===f||xl(f)&&xl(m),"Keyframes must be of the same dimension as the current value"))}else m=Hs(h);if(f!==m)if(xl(f)&&xl(m)){var x=d.get();typeof x=="string"&&d.set(parseFloat(x)),typeof h=="string"?e[u]=parseFloat(h):Array.isArray(h)&&m===ie&&(e[u]=h.map(parseFloat))}else f!=null&&f.transform&&(m!=null&&m.transform)&&(p===0||h===0)?p===0?d.set(m.transform(p)):e[u]=f.transform(h):(o||(s=WR(t),o=!0),a.push(u),i[u]=i[u]!==void 0?i[u]:e[u],ny(d,h))}}),a.length){var l=a.indexOf("height")>=0?window.pageYOffset:null,c=qR(e,t,a);return s.length&&s.forEach(function(u){var d=Be(u,2),p=d[0],f=d[1];t.getValue(p).set(f)}),t.syncRender(),l!==null&&window.scrollTo({top:l}),{target:c,transitionEnd:i}}else return{target:e,transitionEnd:i}};function YR(t,e,n,i){return LR(e)?zR(t,e,n,i):{target:e,transitionEnd:i}}var BR=function(t,e,n,i){var r=ZR(t,e,i);return e=r.target,i=r.transitionEnd,YR(t,e,n,i)};function UR(t){return window.getComputedStyle(t)}var ay={treeType:"dom",readValueFromInstance:function(t,e){if(Ls(e)){var n=dp(e);return n&&n.default||0}else{var i=UR(t);return(lb(e)?i.getPropertyValue(e):i[e])||0}},sortNodePosition:function(t,e){return t.compareDocumentPosition(e)&2?1:-1},getBaseTarget:function(t,e){var n;return(n=t.style)===null||n===void 0?void 0:n[e]},measureViewportBox:function(t,e){var n=e.transformPagePoint;return H0(t,n)},resetTransform:function(t,e,n){var i=n.transformTemplate;e.style.transform=i?i({},""):"none",t.scheduleRender()},restoreTransform:function(t,e){t.style.transform=e.style.transform},removeValueFromRenderState:function(t,e){var n=e.vars,i=e.style;delete n[t],delete i[t]},makeTargetAnimatable:function(t,e,n,i){var r=n.transformValues;i===void 0&&(i=!0);var s=e.transition,o=e.transitionEnd,a=Zt(e,["transition","transitionEnd"]),l=eR(a,s||{},t);if(r&&(o&&(o=r(o)),a&&(a=r(a)),l&&(l=r(l))),i){J5(t,a,l);var c=BR(t,a,l,o);o=c.transitionEnd,a=c.target}return L({transition:s,transitionEnd:o},a)},scrapeMotionValuesFromProps:qd,build:function(t,e,n,i,r){t.isVisible!==void 0&&(e.style.visibility=t.isVisible?"visible":"hidden"),Xd(e,n,i,r.transformTemplate)},render:Pb},FR=J0(ay),GR=J0(L(L({},ay),{getBaseTarget:function(t,e){return t[e]},readValueFromInstance:function(t,e){var n;return Ls(e)?((n=dp(e))===null||n===void 0?void 0:n.default)||0:(e=kb.has(e)?e:Sb(e),t.getAttribute(e))},scrapeMotionValuesFromProps:Tb,build:function(t,e,n,i,r){Wd(e,n,i,r.transformTemplate)},render:$b})),HR=function(t,e){return Md(t)?GR(e,{enableHardwareAcceleration:!1}):FR(e,{enableHardwareAcceleration:!0})};function ly(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}var to={correct:function(t,e){if(!e.target)return t;if(typeof t=="string")if(ie.test(t))t=parseFloat(t);else return t;var n=ly(t,e.target.x),i=ly(t,e.target.y);return"".concat(n,"% ").concat(i,"%")}},cy="_$css",JR={correct:function(t,e){var n=e.treeScale,i=e.projectionDelta,r=t,s=t.includes("var("),o=[];s&&(t=t.replace(ey,function(m){return o.push(m),cy}));var a=Ln.parse(t);if(a.length>5)return r;var l=Ln.createTransformer(t),c=typeof a[0]!="number"?1:0,u=i.x.scale*n.x,d=i.y.scale*n.y;a[0+c]/=u,a[1+c]/=d;var p=Ae(u,d,.5);typeof a[2+c]=="number"&&(a[2+c]/=p),typeof a[3+c]=="number"&&(a[3+c]/=p);var f=l(a);if(s){var h=0;f=f.replace(cy,function(){var m=o[h];return h++,m})}return f}},KR=function(t){Bx(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.componentDidMount=function(){var n=this,i=this.props,r=i.visualElement,s=i.layoutGroup,o=i.switchLayoutGroup,a=i.layoutId,l=r.projection;PD(t_),l&&(s!=null&&s.group&&s.group.add(l),o!=null&&o.register&&a&&o.register(l),l.root.didUpdate(),l.addEventListener("animationComplete",function(){n.safeToRemove()}),l.setOptions(L(L({},l.options),{onExitComplete:function(){return n.safeToRemove()}}))),Zs.hasEverUpdated=!0},e.prototype.getSnapshotBeforeUpdate=function(n){var i=this,r=this.props,s=r.layoutDependency,o=r.visualElement,a=r.drag,l=r.isPresent,c=o.projection;return c&&(c.isPresent=l,a||n.layoutDependency!==s||s===void 0?c.willUpdate():this.safeToRemove(),n.isPresent!==l&&(l?c.promote():c.relegate()||$n.postRender(function(){var u;!((u=c.getStack())===null||u===void 0)&&u.members.length||i.safeToRemove()}))),null},e.prototype.componentDidUpdate=function(){var n=this.props.visualElement.projection;n&&(n.root.didUpdate(),!n.currentAnimation&&n.isLead()&&this.safeToRemove())},e.prototype.componentWillUnmount=function(){var n=this.props,i=n.visualElement,r=n.layoutGroup,s=n.switchLayoutGroup,o=i.projection;o&&(o.scheduleCheckAfterUnmount(),r!=null&&r.group&&r.group.remove(o),s!=null&&s.deregister&&s.deregister(o))},e.prototype.safeToRemove=function(){var n=this.props.safeToRemove;n==null||n()},e.prototype.render=function(){return null},e}(P.Component);function e_(t){var e=Be(b0(),2),n=e[0],i=e[1],r=P.useContext(rb);return P.createElement(KR,L({},t,{layoutGroup:r,switchLayoutGroup:P.useContext(sb),isPresent:n,safeToRemove:i}))}var t_={borderRadius:L(L({},to),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:to,borderTopRightRadius:to,borderBottomLeftRadius:to,borderBottomRightRadius:to,boxShadow:JR},n_={measureLayout:e_};function i_(t,e,n){n===void 0&&(n={});var i=Nn(t)?t:Qr(t);return hp("",i,e,n),{stop:function(){return i.stop()},isAnimating:function(){return i.isAnimating()}}}var uy=["TopLeft","TopRight","BottomLeft","BottomRight"],r_=uy.length,dy=function(t){return typeof t=="string"?parseFloat(t):t},py=function(t){return typeof t=="number"||ie.test(t)};function s_(t,e,n,i,r,s){var o,a,l,c;r?(t.opacity=Ae(0,(o=n.opacity)!==null&&o!==void 0?o:1,o_(i)),t.opacityExit=Ae((a=e.opacity)!==null&&a!==void 0?a:1,0,a_(i))):s&&(t.opacity=Ae((l=e.opacity)!==null&&l!==void 0?l:1,(c=n.opacity)!==null&&c!==void 0?c:1,i));for(var u=0;u<r_;u++){var d="border".concat(uy[u],"Radius"),p=fy(e,d),f=fy(n,d);if(!(p===void 0&&f===void 0)){p||(p=0),f||(f=0);var h=p===0||f===0||py(p)===py(f);h?(t[d]=Math.max(Ae(dy(p),dy(f),i),0),(kn.test(f)||kn.test(p))&&(t[d]+="%")):t[d]=f}}(e.rotate||n.rotate)&&(t.rotate=Ae(e.rotate||0,n.rotate||0,i))}function fy(t,e){var n;return(n=t[e])!==null&&n!==void 0?n:t.borderRadius}var o_=hy(0,.5,np),a_=hy(.5,.95,ep);function hy(t,e,n){return function(i){return i<t?0:i>e?1:n(Bs(t,e,i))}}function my(t,e){t.min=e.min,t.max=e.max}function rn(t,e){my(t.x,e.x),my(t.y,e.y)}function gy(t,e,n,i,r){return t-=e,t=gl(t,1/n,i),r!==void 0&&(t=gl(t,1/r,i)),t}function l_(t,e,n,i,r,s,o){if(e===void 0&&(e=0),n===void 0&&(n=1),i===void 0&&(i=.5),s===void 0&&(s=t),o===void 0&&(o=t),kn.test(e)){e=parseFloat(e);var a=Ae(o.min,o.max,e/100);e=a-o.min}if(typeof e=="number"){var l=Ae(s.min,s.max,i);t===s&&(l-=e),t.min=gy(t.min,e,n,l,r),t.max=gy(t.max,e,n,l,r)}}function vy(t,e,n,i,r){var s=Be(n,3),o=s[0],a=s[1],l=s[2];l_(t,e[o],e[a],e[l],e.scale,i,r)}var c_=["x","scaleX","originX"],u_=["y","scaleY","originY"];function Oy(t,e,n,i){vy(t.x,e,c_,n==null?void 0:n.x,i==null?void 0:i.x),vy(t.y,e,u_,n==null?void 0:n.y,i==null?void 0:i.y)}function xy(t){return t.translate===0&&t.scale===1}function by(t){return xy(t.x)&&xy(t.y)}function yy(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}var d_=function(){function t(){this.members=[]}return t.prototype.add=function(e){mp(this.members,e),e.scheduleRender()},t.prototype.remove=function(e){if(gp(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){var n=this.members[this.members.length-1];n&&this.promote(n)}},t.prototype.relegate=function(e){var n=this.members.findIndex(function(o){return e===o});if(n===0)return!1;for(var i,r=n;r>=0;r--){var s=this.members[r];if(s.isPresent!==!1){i=s;break}}return i?(this.promote(i),!0):!1},t.prototype.promote=function(e,n){var i,r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues,e.snapshot.isShared=!0),!((i=e.root)===null||i===void 0)&&i.isUpdating&&(e.isLayoutDirty=!0);var s=e.options.crossfade;s===!1&&r.hide()}},t.prototype.exitAnimationComplete=function(){this.members.forEach(function(e){var n,i,r,s,o;(i=(n=e.options).onExitComplete)===null||i===void 0||i.call(n),(o=(r=e.resumingFrom)===null||r===void 0?void 0:(s=r.options).onExitComplete)===null||o===void 0||o.call(s)})},t.prototype.scheduleRender=function(){this.members.forEach(function(e){e.instance&&e.scheduleRender(!1)})},t.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},t}(),p_="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function wy(t,e,n){var i=t.x.translate/e.x,r=t.y.translate/e.y,s="translate3d(".concat(i,"px, ").concat(r,"px, 0) ");if(s+="scale(".concat(1/e.x,", ").concat(1/e.y,") "),n){var o=n.rotate,a=n.rotateX,l=n.rotateY;o&&(s+="rotate(".concat(o,"deg) ")),a&&(s+="rotateX(".concat(a,"deg) ")),l&&(s+="rotateY(".concat(l,"deg) "))}var c=t.x.scale*e.x,u=t.y.scale*e.y;return s+="scale(".concat(c,", ").concat(u,")"),s===p_?"none":s}var f_=function(t,e){return t.depth-e.depth},h_=function(){function t(){this.children=[],this.isDirty=!1}return t.prototype.add=function(e){mp(this.children,e),this.isDirty=!0},t.prototype.remove=function(e){gp(this.children,e),this.isDirty=!0},t.prototype.forEach=function(e){this.isDirty&&this.children.sort(f_),this.isDirty=!1,this.children.forEach(e)},t}(),Sy=1e3;function Py(t){var e=t.attachResizeListener,n=t.defaultParent,i=t.measureScroll,r=t.checkIsScrollRoot,s=t.resetTransform;return function(){function o(a,l,c){var u=this;l===void 0&&(l={}),c===void 0&&(c=n==null?void 0:n()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!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=function(){u.isUpdating&&(u.isUpdating=!1,u.clearAllSnapshots())},this.updateProjection=function(){u.nodes.forEach(b_),u.nodes.forEach(y_)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=a,this.latestValues=l,this.root=c?c.root||c:this,this.path=c?Pn(Pn([],Be(c.path),!1),[c],!1):[],this.parent=c,this.depth=c?c.depth+1:0,a&&this.root.registerPotentialNode(a,this);for(var d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new h_)}return o.prototype.addEventListener=function(a,l){return this.eventHandlers.has(a)||this.eventHandlers.set(a,new Gs),this.eventHandlers.get(a).add(l)},o.prototype.notifyListeners=function(a){for(var l=[],c=1;c<arguments.length;c++)l[c-1]=arguments[c];var u=this.eventHandlers.get(a);u==null||u.notify.apply(u,Pn([],Be(l),!1))},o.prototype.hasListeners=function(a){return this.eventHandlers.has(a)},o.prototype.registerPotentialNode=function(a,l){this.potentialNodes.set(a,l)},o.prototype.mount=function(a,l){var c=this,u;if(l===void 0&&(l=!1),!this.instance){this.isSVG=a instanceof SVGElement&&a.tagName!=="svg",this.instance=a;var d=this.options,p=d.layoutId,f=d.layout,h=d.visualElement;if(h&&!h.getInstance()&&h.mount(a),this.root.nodes.add(this),(u=this.parent)===null||u===void 0||u.children.add(this),this.id&&this.root.potentialNodes.delete(this.id),l&&(f||p)&&(this.isLayoutDirty=!0),e){var m,g=function(){return c.root.updateBlockedByResize=!1};e(a,function(){c.root.updateBlockedByResize=!0,clearTimeout(m),m=window.setTimeout(g,250),Zs.hasAnimatedSinceResize&&(Zs.hasAnimatedSinceResize=!1,c.nodes.forEach(x_))})}p&&this.root.registerSharedNode(p,this),this.options.animate!==!1&&h&&(p||f)&&this.addEventListener("didUpdate",function(O){var v,x,b,w,y,k=O.delta,T=O.hasLayoutChanged,E=O.hasRelativeTargetChanged,C=O.layout;if(c.isTreeAnimationBlocked()){c.target=void 0,c.relativeTarget=void 0;return}var M=(x=(v=c.options.transition)!==null&&v!==void 0?v:h.getDefaultTransition())!==null&&x!==void 0?x:$_,Z=h.getProps(),q=Z.onLayoutAnimationStart,N=Z.onLayoutAnimationComplete,_=!c.targetLayout||!yy(c.targetLayout,C)||E,G=!T&&E;if(!((b=c.resumeFrom)===null||b===void 0)&&b.instance||G||T&&(_||!c.currentAnimation)){c.resumeFrom&&(c.resumingFrom=c.resumeFrom,c.resumingFrom.resumingFrom=void 0),c.setAnimationOrigin(k,G);var ee=L(L({},fp(M,"layout")),{onPlay:q,onComplete:N});h.shouldReduceMotion&&(ee.delay=0,ee.type=!1),c.startAnimation(ee)}else!T&&c.animationProgress===0&&c.finishAnimation(),c.isLead()&&((y=(w=c.options).onExitComplete)===null||y===void 0||y.call(w));c.targetLayout=C})}},o.prototype.unmount=function(){var a,l;this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this),(a=this.getStack())===null||a===void 0||a.remove(this),(l=this.parent)===null||l===void 0||l.children.delete(this),this.instance=void 0,Tr.preRender(this.updateProjection)},o.prototype.blockUpdate=function(){this.updateManuallyBlocked=!0},o.prototype.unblockUpdate=function(){this.updateManuallyBlocked=!1},o.prototype.isUpdateBlocked=function(){return this.updateManuallyBlocked||this.updateBlockedByResize},o.prototype.isTreeAnimationBlocked=function(){var a;return this.isAnimationBlocked||((a=this.parent)===null||a===void 0?void 0:a.isTreeAnimationBlocked())||!1},o.prototype.startUpdate=function(){var a;this.isUpdateBlocked()||(this.isUpdating=!0,(a=this.nodes)===null||a===void 0||a.forEach(w_))},o.prototype.willUpdate=function(a){var l,c,u;if(a===void 0&&(a=!0),this.root.isUpdateBlocked()){(c=(l=this.options).onExitComplete)===null||c===void 0||c.call(l);return}if(!this.root.isUpdating&&this.root.startUpdate(),!this.isLayoutDirty){this.isLayoutDirty=!0;for(var d=0;d<this.path.length;d++){var p=this.path[d];p.shouldResetTransform=!0,p.updateScroll()}var f=this.options,h=f.layoutId,m=f.layout;if(!(h===void 0&&!m)){var g=(u=this.options.visualElement)===null||u===void 0?void 0:u.getProps().transformTemplate;this.prevTransformTemplateValue=g==null?void 0:g(this.latestValues,""),this.updateSnapshot(),a&&this.notifyListeners("willUpdate")}}},o.prototype.didUpdate=function(){var a=this.isUpdateBlocked();if(a){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(ky);return}this.isUpdating&&(this.isUpdating=!1,this.potentialNodes.size&&(this.potentialNodes.forEach(T_),this.potentialNodes.clear()),this.nodes.forEach(O_),this.nodes.forEach(m_),this.nodes.forEach(g_),this.clearAllSnapshots(),op.update(),op.preRender(),op.render())},o.prototype.clearAllSnapshots=function(){this.nodes.forEach(v_),this.sharedNodes.forEach(S_)},o.prototype.scheduleUpdateProjection=function(){$n.preRender(this.updateProjection,!1,!0)},o.prototype.scheduleCheckAfterUnmount=function(){var a=this;$n.postRender(function(){a.isLayoutDirty?a.root.didUpdate():a.root.checkUpdateFailed()})},o.prototype.updateSnapshot=function(){if(!(this.snapshot||!this.instance)){var a=this.measure(),l=this.removeTransform(this.removeElementScroll(a));Cy(l),this.snapshot={measured:a,layout:l,latestValues:{}}}},o.prototype.updateLayout=function(){var a;if(this.instance&&(this.updateScroll(),!(!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))){if(this.resumeFrom&&!this.resumeFrom.instance)for(var l=0;l<this.path.length;l++){var c=this.path[l];c.updateScroll()}var u=this.measure();Cy(u);var d=this.layout;this.layout={measured:u,actual:this.removeElementScroll(u)},this.layoutCorrected=ot(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.actual),(a=this.options.visualElement)===null||a===void 0||a.notifyLayoutMeasure(this.layout.actual,d==null?void 0:d.actual)}},o.prototype.updateScroll=function(){this.options.layoutScroll&&this.instance&&(this.isScrollRoot=r(this.instance),this.scroll=i(this.instance))},o.prototype.resetTransform=function(){var a;if(s){var l=this.isLayoutDirty||this.shouldResetTransform,c=this.projectionDelta&&!by(this.projectionDelta),u=(a=this.options.visualElement)===null||a===void 0?void 0:a.getProps().transformTemplate,d=u==null?void 0:u(this.latestValues,""),p=d!==this.prevTransformTemplateValue;l&&(c||fi(this.latestValues)||p)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}},o.prototype.measure=function(){var a=this.options.visualElement;if(!a)return ot();var l=a.measureViewportBox(),c=this.root.scroll;return c&&(hi(l.x,c.x),hi(l.y,c.y)),l},o.prototype.removeElementScroll=function(a){var l=ot();rn(l,a);for(var c=0;c<this.path.length;c++){var u=this.path[c],d=u.scroll,p=u.options,f=u.isScrollRoot;if(u!==this.root&&d&&p.layoutScroll){if(f){rn(l,a);var h=this.root.scroll;h&&(hi(l.x,-h.x),hi(l.y,-h.y))}hi(l.x,d.x),hi(l.y,d.y)}}return l},o.prototype.applyTransform=function(a,l){l===void 0&&(l=!1);var c=ot();rn(c,a);for(var u=0;u<this.path.length;u++){var d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Cr(c,{x:-d.scroll.x,y:-d.scroll.y}),fi(d.latestValues)&&Cr(c,d.latestValues)}return fi(this.latestValues)&&Cr(c,this.latestValues),c},o.prototype.removeTransform=function(a){var l,c=ot();rn(c,a);for(var u=0;u<this.path.length;u++){var d=this.path[u];if(d.instance&&fi(d.latestValues)){Y0(d.latestValues)&&d.updateSnapshot();var p=ot(),f=d.measure();rn(p,f),Oy(c,d.latestValues,(l=d.snapshot)===null||l===void 0?void 0:l.layout,p)}}return fi(this.latestValues)&&Oy(c,this.latestValues),c},o.prototype.setTargetDelta=function(a){this.targetDelta=a,this.root.scheduleUpdateProjection()},o.prototype.setOptions=function(a){var l;this.options=L(L(L({},this.options),a),{crossfade:(l=a.crossfade)!==null&&l!==void 0?l:!0})},o.prototype.clearMeasurements=function(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1},o.prototype.resolveTargetDelta=function(){var a,l=this.options,c=l.layout,u=l.layoutId;!this.layout||!(c||u)||(!this.targetDelta&&!this.relativeTarget&&(this.relativeParent=this.getClosestProjectingParent(),this.relativeParent&&this.relativeParent.layout&&(this.relativeTarget=ot(),this.relativeTargetOrigin=ot(),Ks(this.relativeTargetOrigin,this.layout.actual,this.relativeParent.layout.actual),rn(this.relativeTarget,this.relativeTargetOrigin))),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ot(),this.targetWithTransforms=ot()),this.relativeTarget&&this.relativeTargetOrigin&&(!((a=this.relativeParent)===null||a===void 0)&&a.target)?hR(this.target,this.relativeTarget,this.relativeParent.target):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.actual):rn(this.target,this.layout.actual),F0(this.target,this.targetDelta)):rn(this.target,this.layout.actual),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.relativeParent=this.getClosestProjectingParent(),this.relativeParent&&!!this.relativeParent.resumingFrom==!!this.resumingFrom&&!this.relativeParent.options.layoutScroll&&this.relativeParent.target&&(this.relativeTarget=ot(),this.relativeTargetOrigin=ot(),Ks(this.relativeTargetOrigin,this.target,this.relativeParent.target),rn(this.relativeTarget,this.relativeTargetOrigin)))))},o.prototype.getClosestProjectingParent=function(){if(!(!this.parent||fi(this.parent.latestValues)))return(this.parent.relativeTarget||this.parent.targetDelta)&&this.parent.layout?this.parent:this.parent.getClosestProjectingParent()},o.prototype.calcProjection=function(){var a,l=this.options,c=l.layout,u=l.layoutId;if(this.isTreeAnimating=!!(!((a=this.parent)===null||a===void 0)&&a.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!(!this.layout||!(c||u))){var d=this.getLead();rn(this.layoutCorrected,this.layout.actual),SR(this.layoutCorrected,this.treeScale,this.path,!!this.resumingFrom||this!==d);var p=d.target;if(p){this.projectionDelta||(this.projectionDelta=eo(),this.projectionDeltaWithTransform=eo());var f=this.treeScale.x,h=this.treeScale.y,m=this.projectionTransform;Js(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=wy(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==f||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p))}}},o.prototype.hide=function(){this.isVisible=!1},o.prototype.show=function(){this.isVisible=!0},o.prototype.scheduleRender=function(a){var l,c,u;a===void 0&&(a=!0),(c=(l=this.options).scheduleRender)===null||c===void 0||c.call(l),a&&((u=this.getStack())===null||u===void 0||u.scheduleRender()),this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)},o.prototype.setAnimationOrigin=function(a,l){var c=this,u;l===void 0&&(l=!1);var d=this.snapshot,p=(d==null?void 0:d.latestValues)||{},f=L({},this.latestValues),h=eo();this.relativeTarget=this.relativeTargetOrigin=void 0,this.attemptToResolveRelativeTarget=!l;var m=ot(),g=d==null?void 0:d.isShared,O=(((u=this.getStack())===null||u===void 0?void 0:u.members.length)||0)<=1,v=!!(g&&!O&&this.options.crossfade===!0&&!this.path.some(k_));this.animationProgress=0,this.mixTargetDelta=function(x){var b,w=x/1e3;$y(h.x,a.x,w),$y(h.y,a.y,w),c.setTargetDelta(h),c.relativeTarget&&c.relativeTargetOrigin&&c.layout&&(!((b=c.relativeParent)===null||b===void 0)&&b.layout)&&(Ks(m,c.layout.actual,c.relativeParent.layout.actual),P_(c.relativeTarget,c.relativeTargetOrigin,m,w)),g&&(c.animationValues=f,s_(f,p,c.latestValues,w,v,O)),c.root.scheduleUpdateProjection(),c.scheduleRender(),c.animationProgress=w},this.mixTargetDelta(0)},o.prototype.startAnimation=function(a){var l=this,c,u;this.notifyListeners("animationStart"),(c=this.currentAnimation)===null||c===void 0||c.stop(),this.resumingFrom&&((u=this.resumingFrom.currentAnimation)===null||u===void 0||u.stop()),this.pendingAnimation&&(Tr.update(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=$n.update(function(){Zs.hasAnimatedSinceResize=!0,l.currentAnimation=i_(0,Sy,L(L({},a),{onUpdate:function(d){var p;l.mixTargetDelta(d),(p=a.onUpdate)===null||p===void 0||p.call(a,d)},onComplete:function(){var d;(d=a.onComplete)===null||d===void 0||d.call(a),l.completeAnimation()}})),l.resumingFrom&&(l.resumingFrom.currentAnimation=l.currentAnimation),l.pendingAnimation=void 0})},o.prototype.completeAnimation=function(){var a;this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0),(a=this.getStack())===null||a===void 0||a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")},o.prototype.finishAnimation=function(){var a;this.currentAnimation&&((a=this.mixTargetDelta)===null||a===void 0||a.call(this,Sy),this.currentAnimation.stop()),this.completeAnimation()},o.prototype.applyTransformsToTarget=function(){var a=this.getLead(),l=a.targetWithTransforms,c=a.target,u=a.layout,d=a.latestValues;!l||!c||!u||(rn(l,c),Cr(l,d),Js(this.projectionDeltaWithTransform,this.layoutCorrected,l,d))},o.prototype.registerSharedNode=function(a,l){var c,u,d;this.sharedNodes.has(a)||this.sharedNodes.set(a,new d_);var p=this.sharedNodes.get(a);p.add(l),l.promote({transition:(c=l.options.initialPromotionConfig)===null||c===void 0?void 0:c.transition,preserveFollowOpacity:(d=(u=l.options.initialPromotionConfig)===null||u===void 0?void 0:u.shouldPreserveFollowOpacity)===null||d===void 0?void 0:d.call(u,l)})},o.prototype.isLead=function(){var a=this.getStack();return a?a.lead===this:!0},o.prototype.getLead=function(){var a,l=this.options.layoutId;return l?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this},o.prototype.getPrevLead=function(){var a,l=this.options.layoutId;return l?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0},o.prototype.getStack=function(){var a=this.options.layoutId;if(a)return this.root.sharedNodes.get(a)},o.prototype.promote=function(a){var l=a===void 0?{}:a,c=l.needsReset,u=l.transition,d=l.preserveFollowOpacity,p=this.getStack();p&&p.promote(this,d),c&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})},o.prototype.relegate=function(){var a=this.getStack();return a?a.relegate(this):!1},o.prototype.resetRotation=function(){var a=this.options.visualElement;if(a){for(var l=!1,c={},u=0;u<Rd.length;u++){var d=Rd[u],p="rotate"+d;a.getStaticValue(p)&&(l=!0,c[p]=a.getStaticValue(p),a.setStaticValue(p,0))}if(l){a==null||a.syncRender();for(var p in c)a.setStaticValue(p,c[p]);a.scheduleRender()}}},o.prototype.getProjectionStyles=function(a){var l,c,u,d,p,f;a===void 0&&(a={});var h={};if(!this.instance||this.isSVG)return h;if(this.isVisible)h.visibility="";else return{visibility:"hidden"};var m=(l=this.options.visualElement)===null||l===void 0?void 0:l.getProps().transformTemplate;if(this.needsReset)return this.needsReset=!1,h.opacity="",h.pointerEvents=el(a.pointerEvents)||"",h.transform=m?m(this.latestValues,""):"none",h;var g=this.getLead();if(!this.projectionDelta||!this.layout||!g.target){var O={};return this.options.layoutId&&(O.opacity=(c=this.latestValues.opacity)!==null&&c!==void 0?c:1,O.pointerEvents=el(a.pointerEvents)||""),this.hasProjected&&!fi(this.latestValues)&&(O.transform=m?m({},""):"none",this.hasProjected=!1),O}var v=g.animationValues||g.latestValues;this.applyTransformsToTarget(),h.transform=wy(this.projectionDeltaWithTransform,this.treeScale,v),m&&(h.transform=m(v,h.transform));var x=this.projectionDelta,b=x.x,w=x.y;h.transformOrigin="".concat(b.origin*100,"% ").concat(w.origin*100,"% 0"),g.animationValues?h.opacity=g===this?(d=(u=v.opacity)!==null&&u!==void 0?u:this.latestValues.opacity)!==null&&d!==void 0?d:1:this.preserveOpacity?this.latestValues.opacity:v.opacityExit:h.opacity=g===this?(p=v.opacity)!==null&&p!==void 0?p:"":(f=v.opacityExit)!==null&&f!==void 0?f:0;for(var y in Ha)if(v[y]!==void 0){var k=Ha[y],T=k.correct,E=k.applyTo,C=T(v[y],g);if(E)for(var M=E.length,Z=0;Z<M;Z++)h[E[Z]]=C;else h[y]=C}return this.options.layoutId&&(h.pointerEvents=g===this?el(a.pointerEvents)||"":"none"),h},o.prototype.clearSnapshot=function(){this.resumeFrom=this.snapshot=void 0},o.prototype.resetTree=function(){this.root.nodes.forEach(function(a){var l;return(l=a.currentAnimation)===null||l===void 0?void 0:l.stop()}),this.root.nodes.forEach(ky),this.root.sharedNodes.clear()},o}()}function m_(t){t.updateLayout()}function g_(t){var e,n,i,r,s=(n=(e=t.resumeFrom)===null||e===void 0?void 0:e.snapshot)!==null&&n!==void 0?n:t.snapshot;if(t.isLead()&&t.layout&&s&&t.hasListeners("didUpdate")){var o=t.layout,a=o.actual,l=o.measured;t.options.animationType==="size"?Tn(function(v){var x=s.isShared?s.measured[v]:s.layout[v],b=Xn(x);x.min=a[v].min,x.max=x.min+b}):t.options.animationType==="position"&&Tn(function(v){var x=s.isShared?s.measured[v]:s.layout[v],b=Xn(a[v]);x.max=x.min+b});var c=eo();Js(c,a,s.layout);var u=eo();s.isShared?Js(u,t.applyTransform(l,!0),s.measured):Js(u,a,s.layout);var d=!by(c),p=!1;if(!t.resumeFrom&&(t.relativeParent=t.getClosestProjectingParent(),t.relativeParent&&!t.relativeParent.resumeFrom)){var f=t.relativeParent,h=f.snapshot,m=f.layout;if(h&&m){var g=ot();Ks(g,s.layout,h.layout);var O=ot();Ks(O,a,m.actual),yy(g,O)||(p=!0)}}t.notifyListeners("didUpdate",{layout:a,snapshot:s,delta:u,layoutDelta:c,hasLayoutChanged:d,hasRelativeTargetChanged:p})}else t.isLead()&&((r=(i=t.options).onExitComplete)===null||r===void 0||r.call(i));t.options.transition=void 0}function v_(t){t.clearSnapshot()}function ky(t){t.clearMeasurements()}function O_(t){var e=t.options.visualElement;e!=null&&e.getProps().onBeforeLayoutMeasure&&e.notifyBeforeLayoutMeasure(),t.resetTransform()}function x_(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0}function b_(t){t.resolveTargetDelta()}function y_(t){t.calcProjection()}function w_(t){t.resetRotation()}function S_(t){t.removeLeadSnapshot()}function $y(t,e,n){t.translate=Ae(e.translate,0,n),t.scale=Ae(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Ty(t,e,n,i){t.min=Ae(e.min,n.min,i),t.max=Ae(e.max,n.max,i)}function P_(t,e,n,i){Ty(t.x,e.x,n.x,i),Ty(t.y,e.y,n.y,i)}function k_(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}var $_={duration:.45,ease:[.4,0,.1,1]};function T_(t,e){for(var n=t.root,i=t.path.length-1;i>=0;i--)if(t.path[i].instance){n=t.path[i];break}var r=n&&n!==t.root?n.instance:document,s=r.querySelector('[data-projection-id="'.concat(e,'"]'));s&&t.mount(s,!0)}function Qy(t){t.min=Math.round(t.min),t.max=Math.round(t.max)}function Cy(t){Qy(t.x),Qy(t.y)}var Q_=Py({attachResizeListener:function(t,e){return tl(t,"resize",e)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),$p={current:void 0},C_=Py({measureScroll:function(t){return{x:t.scrollLeft,y:t.scrollTop}},defaultParent:function(){if(!$p.current){var t=new Q_(0,{});t.mount(window),t.setOptions({layoutScroll:!0}),$p.current=t}return $p.current},resetTransform:function(t,e){t.style.transform=e??"none"},checkIsScrollRoot:function(t){return window.getComputedStyle(t).position==="fixed"}}),E_=L(L(L(L({},dR),C5),AR),n_),j_=wD(function(t,e){return lM(t,e,E_,HR,C_)});function Tp(t,e,n){var i,r,s,o,a;e==null&&(e=100);function l(){var u=Date.now()-o;u<e&&u>=0?i=setTimeout(l,e-u):(i=null,n||(a=t.apply(s,r),s=r=null))}var c=function(){s=this,r=arguments,o=Date.now();var u=n&&!i;return i||(i=setTimeout(l,e)),u&&(a=t.apply(s,r),s=r=null),a};return c.clear=function(){i&&(clearTimeout(i),i=null)},c.flush=function(){i&&(a=t.apply(s,r),s=r=null,clearTimeout(i),i=null)},c}Tp.debounce=Tp;var A_=Tp;const Ey=uo(A_);function D_(t){let{debounce:e,scroll:n,polyfill:i,offsetSize:r}=t===void 0?{debounce:0,scroll:!1,offsetSize:!1}:t;const s=i||(typeof window>"u"?class{}:window.ResizeObserver);if(!s)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[o,a]=P.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),l=P.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:o}),c=e?typeof e=="number"?e:e.scroll:null,u=e?typeof e=="number"?e:e.resize:null,d=P.useRef(!1);P.useEffect(()=>(d.current=!0,()=>void(d.current=!1)));const[p,f,h]=P.useMemo(()=>{const v=()=>{if(!l.current.element)return;const{left:x,top:b,width:w,height:y,bottom:k,right:T,x:E,y:C}=l.current.element.getBoundingClientRect(),M={left:x,top:b,width:w,height:y,bottom:k,right:T,x:E,y:C};l.current.element instanceof HTMLElement&&r&&(M.height=l.current.element.offsetHeight,M.width=l.current.element.offsetWidth),Object.freeze(M),d.current&&!I_(l.current.lastBounds,M)&&a(l.current.lastBounds=M)};return[v,u?Ey(v,u):v,c?Ey(v,c):v]},[a,r,c,u]);function m(){l.current.scrollContainers&&(l.current.scrollContainers.forEach(v=>v.removeEventListener("scroll",h,!0)),l.current.scrollContainers=null),l.current.resizeObserver&&(l.current.resizeObserver.disconnect(),l.current.resizeObserver=null)}function g(){l.current.element&&(l.current.resizeObserver=new s(h),l.current.resizeObserver.observe(l.current.element),n&&l.current.scrollContainers&&l.current.scrollContainers.forEach(v=>v.addEventListener("scroll",h,{capture:!0,passive:!0})))}const O=v=>{!v||v===l.current.element||(m(),l.current.element=v,l.current.scrollContainers=jy(v),g())};return R_(h,!!n),M_(f),P.useEffect(()=>{m(),g()},[n,h,f]),P.useEffect(()=>m,[]),[O,o,p]}function M_(t){P.useEffect(()=>{const e=t;return window.addEventListener("resize",e),()=>void window.removeEventListener("resize",e)},[t])}function R_(t,e){P.useEffect(()=>{if(e){const n=t;return window.addEventListener("scroll",n,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",n,!0)}},[t,e])}function jy(t){const e=[];if(!t||t===document.body)return e;const{overflow:n,overflowX:i,overflowY:r}=window.getComputedStyle(t);return[n,i,r].some(s=>s==="auto"||s==="scroll")&&e.push(t),[...e,...jy(t.parentElement)]}const __=["x","y","top","bottom","left","right","width","height"],I_=(t,e)=>__.every(n=>t[n]===e[n]),Ay=P.createContext({dragDropManager:void 0});function Lt(t){return"Minified Redux error #"+t+"; visit https://redux.js.org/Errors?code="+t+" for the full message or use the non-minified dev environment for full errors. "}var Dy=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}(),Qp=function(){return Math.random().toString(36).substring(7).split("").join(".")},My={INIT:"@@redux/INIT"+Qp(),REPLACE:"@@redux/REPLACE"+Qp(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Qp()}};function Z_(t){if(typeof t!="object"||t===null)return!1;for(var e=t;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function N_(t){if(t===void 0)return"undefined";if(t===null)return"null";var e=typeof t;switch(e){case"boolean":case"string":case"number":case"symbol":case"function":return e}if(Array.isArray(t))return"array";if(V_(t))return"date";if(X_(t))return"error";var n=L_(t);switch(n){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return n}return e.slice(8,-1).toLowerCase().replace(/\s/g,"")}function L_(t){return typeof t.constructor=="function"?t.constructor.name:null}function X_(t){return t instanceof Error||typeof t.message=="string"&&t.constructor&&typeof t.constructor.stackTraceLimit=="number"}function V_(t){return t instanceof Date?!0:typeof t.toDateString=="function"&&typeof t.getDate=="function"&&typeof t.setDate=="function"}function Er(t){var e=typeof t;return process.env.NODE_ENV!=="production"&&(e=N_(t)),e}function Ry(t,e,n){var i;if(typeof e=="function"&&typeof n=="function"||typeof n=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?Lt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof e=="function"&&typeof n>"u"&&(n=e,e=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(1):"Expected the enhancer to be a function. Instead, received: '"+Er(n)+"'");return n(Ry)(t,e)}if(typeof t!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(2):"Expected the root reducer to be a function. Instead, received: '"+Er(t)+"'");var r=t,s=e,o=[],a=o,l=!1;function c(){a===o&&(a=o.slice())}function u(){if(l)throw new Error(process.env.NODE_ENV==="production"?Lt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return s}function d(m){if(typeof m!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(4):"Expected the listener to be a function. Instead, received: '"+Er(m)+"'");if(l)throw new Error(process.env.NODE_ENV==="production"?Lt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");var g=!0;return c(),a.push(m),function(){if(g){if(l)throw new Error(process.env.NODE_ENV==="production"?Lt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");g=!1,c();var v=a.indexOf(m);a.splice(v,1),o=null}}}function p(m){if(!Z_(m))throw new Error(process.env.NODE_ENV==="production"?Lt(7):"Actions must be plain objects. Instead, the actual type was: '"+Er(m)+"'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.");if(typeof m.type>"u")throw new Error(process.env.NODE_ENV==="production"?Lt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(l)throw new Error(process.env.NODE_ENV==="production"?Lt(9):"Reducers may not dispatch actions.");try{l=!0,s=r(s,m)}finally{l=!1}for(var g=o=a,O=0;O<g.length;O++){var v=g[O];v()}return m}function f(m){if(typeof m!="function")throw new Error(process.env.NODE_ENV==="production"?Lt(10):"Expected the nextReducer to be a function. Instead, received: '"+Er(m));r=m,p({type:My.REPLACE})}function h(){var m,g=d;return m={subscribe:function(v){if(typeof v!="object"||v===null)throw new Error(process.env.NODE_ENV==="production"?Lt(11):"Expected the observer to be an object. Instead, received: '"+Er(v)+"'");function x(){v.next&&v.next(u())}x();var b=g(x);return{unsubscribe:b}}},m[Dy]=function(){return this},m}return p({type:My.INIT}),i={dispatch:p,subscribe:d,getState:u,replaceReducer:f},i[Dy]=h,i}function oe(t,e,...n){if(W_()&&e===void 0)throw new Error("invariant requires an error message argument");if(!t){let i;if(e===void 0)i=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{let r=0;i=new Error(e.replace(/%s/g,function(){return n[r++]})),i.name="Invariant Violation"}throw i.framesToPop=1,i}}function W_(){return typeof process<"u"&&process.env.NODE_ENV==="production"}function q_(t,e,n){return e.split(".").reduce((i,r)=>i&&i[r]?i[r]:n||null,t)}function z_(t,e){return t.filter(n=>n!==e)}function _y(t){return typeof t=="object"}function Y_(t,e){const n=new Map,i=s=>{n.set(s,n.has(s)?n.get(s)+1:1)};t.forEach(i),e.forEach(i);const r=[];return n.forEach((s,o)=>{s===1&&r.push(o)}),r}function B_(t,e){return t.filter(n=>e.indexOf(n)>-1)}const Cp="dnd-core/INIT_COORDS",bl="dnd-core/BEGIN_DRAG",Ep="dnd-core/PUBLISH_DRAG_SOURCE",yl="dnd-core/HOVER",wl="dnd-core/DROP",Sl="dnd-core/END_DRAG";function Iy(t,e){return{type:Cp,payload:{sourceClientOffset:e||null,clientOffset:t||null}}}const U_={type:Cp,payload:{clientOffset:null,sourceClientOffset:null}};function F_(t){return function(n=[],i={publishSource:!0}){const{publishSource:r=!0,clientOffset:s,getSourceClientOffset:o}=i,a=t.getMonitor(),l=t.getRegistry();t.dispatch(Iy(s)),G_(n,a,l);const c=K_(n,a);if(c==null){t.dispatch(U_);return}let u=null;if(s){if(!o)throw new Error("getSourceClientOffset must be defined");H_(o),u=o(c)}t.dispatch(Iy(s,u));const p=l.getSource(c).beginDrag(a,c);if(p==null)return;J_(p),l.pinSource(c);const f=l.getSourceType(c);return{type:bl,payload:{itemType:f,item:p,sourceId:c,clientOffset:s||null,sourceClientOffset:u||null,isSourcePublic:!!r}}}}function G_(t,e,n){oe(!e.isDragging(),"Cannot call beginDrag while dragging."),t.forEach(function(i){oe(n.getSource(i),"Expected sourceIds to be registered.")})}function H_(t){oe(typeof t=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function J_(t){oe(_y(t),"Item must be an object.")}function K_(t,e){let n=null;for(let i=t.length-1;i>=0;i--)if(e.canDragSource(t[i])){n=t[i];break}return n}function e3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function t3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},i=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),i.forEach(function(r){e3(t,r,n[r])})}return t}function n3(t){return function(n={}){const i=t.getMonitor(),r=t.getRegistry();i3(i),o3(i).forEach((o,a)=>{const l=r3(o,a,r,i),c={type:wl,payload:{dropResult:t3({},n,l)}};t.dispatch(c)})}}function i3(t){oe(t.isDragging(),"Cannot call drop while not dragging."),oe(!t.didDrop(),"Cannot call drop twice during one drag operation.")}function r3(t,e,n,i){const r=n.getTarget(t);let s=r?r.drop(i,t):void 0;return s3(s),typeof s>"u"&&(s=e===0?{}:i.getDropResult()),s}function s3(t){oe(typeof t>"u"||_y(t),"Drop result must either be an object or undefined.")}function o3(t){const e=t.getTargetIds().filter(t.canDropOnTarget,t);return e.reverse(),e}function a3(t){return function(){const n=t.getMonitor(),i=t.getRegistry();l3(n);const r=n.getSourceId();return r!=null&&(i.getSource(r,!0).endDrag(n,r),i.unpinSource()),{type:Sl}}}function l3(t){oe(t.isDragging(),"Cannot call endDrag while not dragging.")}function jp(t,e){return e===null?t===null:Array.isArray(t)?t.some(n=>n===e):t===e}function c3(t){return function(n,{clientOffset:i}={}){u3(n);const r=n.slice(0),s=t.getMonitor(),o=t.getRegistry(),a=s.getItemType();return p3(r,o,a),d3(r,s,o),f3(r,s,o),{type:yl,payload:{targetIds:r,clientOffset:i||null}}}}function u3(t){oe(Array.isArray(t),"Expected targetIds to be an array.")}function d3(t,e,n){oe(e.isDragging(),"Cannot call hover while not dragging."),oe(!e.didDrop(),"Cannot call hover after drop.");for(let i=0;i<t.length;i++){const r=t[i];oe(t.lastIndexOf(r)===i,"Expected targetIds to be unique in the passed array.");const s=n.getTarget(r);oe(s,"Expected targetIds to be registered.")}}function p3(t,e,n){for(let i=t.length-1;i>=0;i--){const r=t[i],s=e.getTargetType(r);jp(s,n)||t.splice(i,1)}}function f3(t,e,n){t.forEach(function(i){n.getTarget(i).hover(e,i)})}function h3(t){return function(){if(t.getMonitor().isDragging())return{type:Ep}}}function m3(t){return{beginDrag:F_(t),publishDragSource:h3(t),hover:c3(t),drop:n3(t),endDrag:a3(t)}}class g3{receiveBackend(e){this.backend=e}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const e=this,{dispatch:n}=this.store;function i(s){return(...o)=>{const a=s.apply(e,o);typeof a<"u"&&n(a)}}const r=m3(this);return Object.keys(r).reduce((s,o)=>{const a=r[o];return s[o]=i(a),s},{})}dispatch(e){this.store.dispatch(e)}constructor(e,n){this.isSetUp=!1,this.handleRefCountChange=()=>{const i=this.store.getState().refCount>0;this.backend&&(i&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!i&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=e,this.monitor=n,e.subscribe(this.handleRefCountChange)}}function v3(t,e){return{x:t.x+e.x,y:t.y+e.y}}function Zy(t,e){return{x:t.x-e.x,y:t.y-e.y}}function O3(t){const{clientOffset:e,initialClientOffset:n,initialSourceClientOffset:i}=t;return!e||!n||!i?null:Zy(v3(e,i),n)}function x3(t){const{clientOffset:e,initialClientOffset:n}=t;return!e||!n?null:Zy(e,n)}const no=[],Ap=[];no.__IS_NONE__=!0,Ap.__IS_ALL__=!0;function b3(t,e){return t===no?!1:t===Ap||typeof e>"u"?!0:B_(e,t).length>0}class y3{subscribeToStateChange(e,n={}){const{handlerIds:i}=n;oe(typeof e=="function","listener must be a function."),oe(typeof i>"u"||Array.isArray(i),"handlerIds, when specified, must be an array of strings.");let r=this.store.getState().stateId;const s=()=>{const o=this.store.getState(),a=o.stateId;try{a===r||a===r+1&&!b3(o.dirtyHandlerIds,i)||e()}finally{r=a}};return this.store.subscribe(s)}subscribeToOffsetChange(e){oe(typeof e=="function","listener must be a function.");let n=this.store.getState().dragOffset;const i=()=>{const r=this.store.getState().dragOffset;r!==n&&(n=r,e())};return this.store.subscribe(i)}canDragSource(e){if(!e)return!1;const n=this.registry.getSource(e);return oe(n,`Expected to find a valid source. sourceId=${e}`),this.isDragging()?!1:n.canDrag(this,e)}canDropOnTarget(e){if(!e)return!1;const n=this.registry.getTarget(e);if(oe(n,`Expected to find a valid target. targetId=${e}`),!this.isDragging()||this.didDrop())return!1;const i=this.registry.getTargetType(e),r=this.getItemType();return jp(i,r)&&n.canDrop(this,e)}isDragging(){return!!this.getItemType()}isDraggingSource(e){if(!e)return!1;const n=this.registry.getSource(e,!0);if(oe(n,`Expected to find a valid source. sourceId=${e}`),!this.isDragging()||!this.isSourcePublic())return!1;const i=this.registry.getSourceType(e),r=this.getItemType();return i!==r?!1:n.isDragging(this,e)}isOverTarget(e,n={shallow:!1}){if(!e)return!1;const{shallow:i}=n;if(!this.isDragging())return!1;const r=this.registry.getTargetType(e),s=this.getItemType();if(s&&!jp(r,s))return!1;const o=this.getTargetIds();if(!o.length)return!1;const a=o.indexOf(e);return i?a===o.length-1:a>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return O3(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return x3(this.store.getState().dragOffset)}constructor(e,n){this.store=e,this.registry=n}}const Ny=typeof global<"u"?global:self,Ly=Ny.MutationObserver||Ny.WebKitMutationObserver;function Xy(t){return function(){const n=setTimeout(r,0),i=setInterval(r,50);function r(){clearTimeout(n),clearInterval(i),t()}}}function w3(t){let e=1;const n=new Ly(t),i=document.createTextNode("");return n.observe(i,{characterData:!0}),function(){e=-e,i.data=e}}const S3=typeof Ly=="function"?w3:Xy;class P3{enqueueTask(e){const{queue:n,requestFlush:i}=this;n.length||(i(),this.flushing=!0),n[n.length]=e}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:e}=this;for(;this.index<e.length;){const n=this.index;if(this.index++,e[n].call(),this.index>this.capacity){for(let i=0,r=e.length-this.index;i<r;i++)e[i]=e[i+this.index];e.length-=this.index,this.index=0}}e.length=0,this.index=0,this.flushing=!1},this.registerPendingError=e=>{this.pendingErrors.push(e),this.requestErrorThrow()},this.requestFlush=S3(this.flush),this.requestErrorThrow=Xy(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class k3{call(){try{this.task&&this.task()}catch(e){this.onError(e)}finally{this.task=null,this.release(this)}}constructor(e,n){this.onError=e,this.release=n,this.task=null}}class $3{create(e){const n=this.freeTasks,i=n.length?n.pop():new k3(this.onError,r=>n[n.length]=r);return i.task=e,i}constructor(e){this.onError=e,this.freeTasks=[]}}const Vy=new P3,T3=new $3(Vy.registerPendingError);function Q3(t){Vy.enqueueTask(T3.create(t))}const Dp="dnd-core/ADD_SOURCE",Mp="dnd-core/ADD_TARGET",Rp="dnd-core/REMOVE_SOURCE",Pl="dnd-core/REMOVE_TARGET";function C3(t){return{type:Dp,payload:{sourceId:t}}}function E3(t){return{type:Mp,payload:{targetId:t}}}function j3(t){return{type:Rp,payload:{sourceId:t}}}function A3(t){return{type:Pl,payload:{targetId:t}}}function D3(t){oe(typeof t.canDrag=="function","Expected canDrag to be a function."),oe(typeof t.beginDrag=="function","Expected beginDrag to be a function."),oe(typeof t.endDrag=="function","Expected endDrag to be a function.")}function M3(t){oe(typeof t.canDrop=="function","Expected canDrop to be a function."),oe(typeof t.hover=="function","Expected hover to be a function."),oe(typeof t.drop=="function","Expected beginDrag to be a function.")}function _p(t,e){if(e&&Array.isArray(t)){t.forEach(n=>_p(n,!1));return}oe(typeof t=="string"||typeof t=="symbol",e?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var Xt;(function(t){t.SOURCE="SOURCE",t.TARGET="TARGET"})(Xt||(Xt={}));let R3=0;function _3(){return R3++}function I3(t){const e=_3().toString();switch(t){case Xt.SOURCE:return`S${e}`;case Xt.TARGET:return`T${e}`;default:throw new Error(`Unknown Handler Role: ${t}`)}}function Wy(t){switch(t[0]){case"S":return Xt.SOURCE;case"T":return Xt.TARGET;default:throw new Error(`Cannot parse handler ID: ${t}`)}}function qy(t,e){const n=t.entries();let i=!1;do{const{done:r,value:[,s]}=n.next();if(s===e)return!0;i=!!r}while(!i);return!1}class Z3{addSource(e,n){_p(e),D3(n);const i=this.addHandler(Xt.SOURCE,e,n);return this.store.dispatch(C3(i)),i}addTarget(e,n){_p(e,!0),M3(n);const i=this.addHandler(Xt.TARGET,e,n);return this.store.dispatch(E3(i)),i}containsHandler(e){return qy(this.dragSources,e)||qy(this.dropTargets,e)}getSource(e,n=!1){return oe(this.isSourceId(e),"Expected a valid source ID."),n&&e===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(e)}getTarget(e){return oe(this.isTargetId(e),"Expected a valid target ID."),this.dropTargets.get(e)}getSourceType(e){return oe(this.isSourceId(e),"Expected a valid source ID."),this.types.get(e)}getTargetType(e){return oe(this.isTargetId(e),"Expected a valid target ID."),this.types.get(e)}isSourceId(e){return Wy(e)===Xt.SOURCE}isTargetId(e){return Wy(e)===Xt.TARGET}removeSource(e){oe(this.getSource(e),"Expected an existing source."),this.store.dispatch(j3(e)),Q3(()=>{this.dragSources.delete(e),this.types.delete(e)})}removeTarget(e){oe(this.getTarget(e),"Expected an existing target."),this.store.dispatch(A3(e)),this.dropTargets.delete(e),this.types.delete(e)}pinSource(e){const n=this.getSource(e);oe(n,"Expected an existing source."),this.pinnedSourceId=e,this.pinnedSource=n}unpinSource(){oe(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(e,n,i){const r=I3(e);return this.types.set(r,n),e===Xt.SOURCE?this.dragSources.set(r,i):e===Xt.TARGET&&this.dropTargets.set(r,i),r}constructor(e){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=e}}const N3=(t,e)=>t===e;function L3(t,e){return!t&&!e?!0:!t||!e?!1:t.x===e.x&&t.y===e.y}function X3(t,e,n=N3){if(t.length!==e.length)return!1;for(let i=0;i<t.length;++i)if(!n(t[i],e[i]))return!1;return!0}function V3(t=no,e){switch(e.type){case yl:break;case Dp:case Mp:case Pl:case Rp:return no;case bl:case Ep:case Sl:case wl:default:return Ap}const{targetIds:n=[],prevTargetIds:i=[]}=e.payload,r=Y_(n,i);if(!(r.length>0||!X3(n,i)))return no;const o=i[i.length-1],a=n[n.length-1];return o!==a&&(o&&r.push(o),a&&r.push(a)),r}function W3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function q3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},i=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),i.forEach(function(r){W3(t,r,n[r])})}return t}const zy={initialSourceClientOffset:null,initialClientOffset:null,clientOffset:null};function z3(t=zy,e){const{payload:n}=e;switch(e.type){case Cp:case bl:return{initialSourceClientOffset:n.sourceClientOffset,initialClientOffset:n.clientOffset,clientOffset:n.clientOffset};case yl:return L3(t.clientOffset,n.clientOffset)?t:q3({},t,{clientOffset:n.clientOffset});case Sl:case wl:return zy;default:return t}}function Y3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},i=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),i.forEach(function(r){Y3(t,r,n[r])})}return t}const B3={itemType:null,item:null,sourceId:null,targetIds:[],dropResult:null,didDrop:!1,isSourcePublic:null};function U3(t=B3,e){const{payload:n}=e;switch(e.type){case bl:return jr({},t,{itemType:n.itemType,item:n.item,sourceId:n.sourceId,isSourcePublic:n.isSourcePublic,dropResult:null,didDrop:!1});case Ep:return jr({},t,{isSourcePublic:!0});case yl:return jr({},t,{targetIds:n.targetIds});case Pl:return t.targetIds.indexOf(n.targetId)===-1?t:jr({},t,{targetIds:z_(t.targetIds,n.targetId)});case wl:return jr({},t,{dropResult:n.dropResult,didDrop:!0,targetIds:[]});case Sl:return jr({},t,{itemType:null,item:null,sourceId:null,dropResult:null,didDrop:!1,isSourcePublic:null,targetIds:[]});default:return t}}function F3(t=0,e){switch(e.type){case Dp:case Mp:return t+1;case Rp:case Pl:return t-1;default:return t}}function G3(t=0){return t+1}function H3(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function J3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{},i=Object.keys(n);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(r){return Object.getOwnPropertyDescriptor(n,r).enumerable}))),i.forEach(function(r){H3(t,r,n[r])})}return t}function K3(t={},e){return{dirtyHandlerIds:V3(t.dirtyHandlerIds,{type:e.type,payload:J3({},e.payload,{prevTargetIds:q_(t,"dragOperation.targetIds",[])})}),dragOffset:z3(t.dragOffset,e),refCount:F3(t.refCount,e),dragOperation:U3(t.dragOperation,e),stateId:G3(t.stateId)}}function eI(t,e=void 0,n={},i=!1){const r=tI(i),s=new y3(r,new Z3(r)),o=new g3(r,s),a=t(o,e,n);return o.receiveBackend(a),o}function tI(t){const e=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION__;return Ry(K3,t&&e&&e({name:"dnd-core",instanceId:"dnd-core"}))}function nI(t,e){if(t==null)return{};var n=iI(t,e),i,r;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)i=s[r],!(e.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(t,i)&&(n[i]=t[i])}return n}function iI(t,e){if(t==null)return{};var n={},i=Object.keys(t),r,s;for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&(n[r]=t[r]);return n}let Yy=0;const kl=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var rI=P.memo(function(e){var{children:n}=e,i=nI(e,["children"]);const[r,s]=sI(i);return P.useEffect(()=>{if(s){const o=By();return++Yy,()=>{--Yy===0&&(o[kl]=null)}}},[]),S.jsx(Ay.Provider,{value:r,children:n})});function sI(t){if("manager"in t)return[{dragDropManager:t.manager},!1];const e=oI(t.backend,t.context,t.options,t.debugMode),n=!t.context;return[e,n]}function oI(t,e=By(),n,i){const r=e;return r[kl]||(r[kl]={dragDropManager:eI(t,e,n,i)}),r[kl]}function By(){return typeof global<"u"?global:window}var aI=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var i,r,s;if(Array.isArray(e)){if(i=e.length,i!=n.length)return!1;for(r=i;r--!==0;)if(!t(e[r],n[r]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),i=s.length,i!==Object.keys(n).length)return!1;for(r=i;r--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[r]))return!1;for(r=i;r--!==0;){var o=s[r];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n};const lI=uo(aI),Yi=typeof window<"u"?P.useLayoutEffect:P.useEffect;function Uy(t,e,n){const[i,r]=P.useState(()=>e(t)),s=P.useCallback(()=>{const o=e(t);lI(i,o)||(r(o),n&&n())},[i,t,n]);return Yi(s),[i,s]}function cI(t,e,n){const[i,r]=Uy(t,e,n);return Yi(function(){const o=t.getHandlerId();if(o!=null)return t.subscribeToStateChange(r,{handlerIds:[o]})},[t,r]),i}function Fy(t,e,n){return cI(e,t||(()=>({})),()=>n.reconnect())}function Gy(t,e){const n=[...e||[]];return e==null&&typeof t!="function"&&n.push(t),P.useMemo(()=>typeof t=="function"?t():t,n)}function uI(t){return P.useMemo(()=>t.hooks.dragSource(),[t])}function dI(t){return P.useMemo(()=>t.hooks.dragPreview(),[t])}let Ip=!1,Zp=!1;class pI{receiveHandlerId(e){this.sourceId=e}getHandlerId(){return this.sourceId}canDrag(){oe(!Ip,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Ip=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{Ip=!1}}isDragging(){if(!this.sourceId)return!1;oe(!Zp,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return Zp=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{Zp=!1}}subscribeToStateChange(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}isDraggingSource(e){return this.internalMonitor.isDraggingSource(e)}isOverTarget(e,n){return this.internalMonitor.isOverTarget(e,n)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(e){return this.internalMonitor.subscribeToOffsetChange(e)}canDragSource(e){return this.internalMonitor.canDragSource(e)}canDropOnTarget(e){return this.internalMonitor.canDropOnTarget(e)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.sourceId=null,this.internalMonitor=e.getMonitor()}}let Np=!1;class fI{receiveHandlerId(e){this.targetId=e}getHandlerId(){return this.targetId}subscribeToStateChange(e,n){return this.internalMonitor.subscribeToStateChange(e,n)}canDrop(){if(!this.targetId)return!1;oe(!Np,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return Np=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{Np=!1}}isOver(e){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,e):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(e){this.targetId=null,this.internalMonitor=e.getMonitor()}}function hI(t,e,n){const i=n.getRegistry(),r=i.addTarget(t,e);return[r,()=>i.removeTarget(r)]}function mI(t,e,n){const i=n.getRegistry(),r=i.addSource(t,e);return[r,()=>i.removeSource(r)]}function Lp(t,e,n,i){let r=n?n.call(i,t,e):void 0;if(r!==void 0)return!!r;if(t===e)return!0;if(typeof t!="object"||!t||typeof e!="object"||!e)return!1;const s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return!1;const a=Object.prototype.hasOwnProperty.bind(e);for(let l=0;l<s.length;l++){const c=s[l];if(!a(c))return!1;const u=t[c],d=e[c];if(r=n?n.call(i,u,d,c):void 0,r===!1||r===void 0&&u!==d)return!1}return!0}function Xp(t){return t!==null&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function gI(t){if(typeof t.type=="string")return;const e=t.type.displayName||t.type.name||"the component";throw new Error(`Only native element nodes can now be passed to React DnD connectors.You can either wrap ${e} into a <div>, or turn it into a drag source or a drop target itself.`)}function vI(t){return(e=null,n=null)=>{if(!P.isValidElement(e)){const s=e;return t(s,n),s}const i=e;return gI(i),OI(i,n?s=>t(s,n):t)}}function Hy(t){const e={};return Object.keys(t).forEach(n=>{const i=t[n];if(n.endsWith("Ref"))e[n]=t[n];else{const r=vI(i);e[n]=()=>r}}),e}function Jy(t,e){typeof t=="function"?t(e):t.current=e}function OI(t,e){const n=t.ref;return oe(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a <span> or <div>. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?P.cloneElement(t,{ref:i=>{Jy(n,i),Jy(e,i)}}):P.cloneElement(t,{ref:e})}class xI{receiveHandlerId(e){this.handlerId!==e&&(this.handlerId=e,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(e){this.dragSourceOptionsInternal=e}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(e){this.dragPreviewOptionsInternal=e}reconnect(){const e=this.reconnectDragSource();this.reconnectDragPreview(e)}reconnectDragSource(){const e=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return n&&this.disconnectDragSource(),this.handlerId?e?(n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=e,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,e,this.dragSourceOptions)),n):(this.lastConnectedDragSource=e,n):n}reconnectDragPreview(e=!1){const n=this.dragPreview,i=e||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(i&&this.disconnectDragPreview(),!!this.handlerId){if(!n){this.lastConnectedDragPreview=n;return}i&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!Lp(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!Lp(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(e){this.hooks=Hy({dragSource:(n,i)=>{this.clearDragSource(),this.dragSourceOptions=i||null,Xp(n)?this.dragSourceRef=n:this.dragSourceNode=n,this.reconnectDragSource()},dragPreview:(n,i)=>{this.clearDragPreview(),this.dragPreviewOptions=i||null,Xp(n)?this.dragPreviewRef=n:this.dragPreviewNode=n,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=e}}class bI{get connectTarget(){return this.dropTarget}reconnect(){const e=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();e&&this.disconnectDropTarget();const n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}e&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}receiveHandlerId(e){e!==this.handlerId&&(this.handlerId=e,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(e){this.dropTargetOptionsInternal=e}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!Lp(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(e){this.hooks=Hy({dropTarget:(n,i)=>{this.clearDropTarget(),this.dropTargetOptions=i,Xp(n)?this.dropTargetRef=n:this.dropTargetNode=n,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=e}}function Vn(){const{dragDropManager:t}=P.useContext(Ay);return oe(t!=null,"Expected drag drop context"),t}function yI(t,e){const n=Vn(),i=P.useMemo(()=>new xI(n.getBackend()),[n]);return Yi(()=>(i.dragSourceOptions=t||null,i.reconnect(),()=>i.disconnectDragSource()),[i,t]),Yi(()=>(i.dragPreviewOptions=e||null,i.reconnect(),()=>i.disconnectDragPreview()),[i,e]),i}function wI(){const t=Vn();return P.useMemo(()=>new pI(t),[t])}class SI{beginDrag(){const e=this.spec,n=this.monitor;let i=null;return typeof e.item=="object"?i=e.item:typeof e.item=="function"?i=e.item(n):i={},i??null}canDrag(){const e=this.spec,n=this.monitor;return typeof e.canDrag=="boolean"?e.canDrag:typeof e.canDrag=="function"?e.canDrag(n):!0}isDragging(e,n){const i=this.spec,r=this.monitor,{isDragging:s}=i;return s?s(r):n===e.getSourceId()}endDrag(){const e=this.spec,n=this.monitor,i=this.connector,{end:r}=e;r&&r(n.getItem(),n),i.reconnect()}constructor(e,n,i){this.spec=e,this.monitor=n,this.connector=i}}function PI(t,e,n){const i=P.useMemo(()=>new SI(t,e,n),[e,n]);return P.useEffect(()=>{i.spec=t},[t]),i}function kI(t){return P.useMemo(()=>{const e=t.type;return oe(e!=null,"spec.type must be defined"),e},[t])}function $I(t,e,n){const i=Vn(),r=PI(t,e,n),s=kI(t);Yi(function(){if(s!=null){const[a,l]=mI(s,r,i);return e.receiveHandlerId(a),n.receiveHandlerId(a),l}},[i,e,n,r,s])}function TI(t,e){const n=Gy(t,e);oe(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const i=wI(),r=yI(n.options,n.previewOptions);return $I(n,i,r),[Fy(n.collect,i,r),uI(r),dI(r)]}function QI(t){const n=Vn().getMonitor(),[i,r]=Uy(n,t);return P.useEffect(()=>n.subscribeToOffsetChange(r)),P.useEffect(()=>n.subscribeToStateChange(r)),i}function CI(t){return P.useMemo(()=>t.hooks.dropTarget(),[t])}function EI(t){const e=Vn(),n=P.useMemo(()=>new bI(e.getBackend()),[e]);return Yi(()=>(n.dropTargetOptions=t||null,n.reconnect(),()=>n.disconnectDropTarget()),[t]),n}function jI(){const t=Vn();return P.useMemo(()=>new fI(t),[t])}function AI(t){const{accept:e}=t;return P.useMemo(()=>(oe(t.accept!=null,"accept must be defined"),Array.isArray(e)?e:[e]),[e])}class DI{canDrop(){const e=this.spec,n=this.monitor;return e.canDrop?e.canDrop(n.getItem(),n):!0}hover(){const e=this.spec,n=this.monitor;e.hover&&e.hover(n.getItem(),n)}drop(){const e=this.spec,n=this.monitor;if(e.drop)return e.drop(n.getItem(),n)}constructor(e,n){this.spec=e,this.monitor=n}}function MI(t,e){const n=P.useMemo(()=>new DI(t,e),[e]);return P.useEffect(()=>{n.spec=t},[t]),n}function RI(t,e,n){const i=Vn(),r=MI(t,e),s=AI(t);Yi(function(){const[a,l]=hI(s,r,i);return e.receiveHandlerId(a),n.receiveHandlerId(a),l},[i,e,r,n,s.map(o=>o.toString()).join("|")])}function Ky(t,e){const n=Gy(t,e),i=jI(),r=EI(n.options);return RI(n,i,r),[Fy(n.collect,i,r),CI(r)]}function Vp(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _I(t,e,n){II(t,e),e.set(t,n)}function II(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function $l(t,e){var n=ew(t,e,"get");return ZI(t,n)}function ZI(t,e){return e.get?e.get.call(t):e.value}function NI(t,e,n){var i=ew(t,e,"set");return LI(t,i,n),n}function ew(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function LI(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}var Ar=new WeakMap;class XI{constructor(){_I(this,Ar,{writable:!0,value:void 0}),Vp(this,"register",e=>{$l(this,Ar).push(e)}),Vp(this,"unregister",e=>{let n;for(;(n=$l(this,Ar).indexOf(e))!==-1;)$l(this,Ar).splice(n,1)}),Vp(this,"backendChanged",e=>{for(const n of $l(this,Ar))n.backendChanged(e)}),NI(this,Ar,[])}}function sn(t,e,n){VI(t,e),e.set(t,n)}function VI(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Qn(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ae(t,e){var n=tw(t,e,"get");return WI(t,n)}function WI(t,e){return e.get?e.get.call(t):e.value}function Dr(t,e,n){var i=tw(t,e,"set");return qI(t,i,n),n}function tw(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function qI(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}var Vt=new WeakMap,Tl=new WeakMap,Wt=new WeakMap,mi=new WeakMap,Bi=new WeakMap,nw=new WeakMap,iw=new WeakMap,rw=new WeakMap,Wp=new WeakMap,qp=new WeakMap,Ql=new WeakMap;class Mr{constructor(e,n,i){if(sn(this,Vt,{writable:!0,value:void 0}),sn(this,Tl,{writable:!0,value:void 0}),sn(this,Wt,{writable:!0,value:void 0}),sn(this,mi,{writable:!0,value:void 0}),sn(this,Bi,{writable:!0,value:void 0}),sn(this,nw,{writable:!0,value:(r,s,o)=>{var a,l;if(!o.backend)throw new Error("You must specify a 'backend' property in your Backend entry: ".concat(JSON.stringify(o)));const c=o.backend(r,s,o.options);let u=o.id;const d=!o.id&&c&&c.constructor;if(d&&(u=c.constructor.name),u)d&&console.warn(`Deprecation notice: You are using a pipeline which doesn't include backends' 'id'.
|
|
757
757
|
This might be unsupported in the future, please specify 'id' explicitely for every backend.`);else throw new Error("You must specify an 'id' property in your Backend entry: ".concat(JSON.stringify(o),`
|
|
758
758
|
see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-5xx`));if(ae(this,Wt)[u])throw new Error(`You must specify a unique 'id' property in your Backend entry:
|
|
759
759
|
`.concat(JSON.stringify(o)," (conflicts with: ").concat(JSON.stringify(ae(this,Wt)[u]),")"));return{id:u,instance:c,preview:(a=o.preview)!==null&&a!==void 0?a:!1,transition:o.transition,skipDispatchOnTransition:(l=o.skipDispatchOnTransition)!==null&&l!==void 0?l:!1}}}),Qn(this,"setup",()=>{if(!(typeof window>"u")){if(Mr.isSetUp)throw new Error("Cannot have two MultiBackends at the same time.");Mr.isSetUp=!0,ae(this,iw).call(this,window),ae(this,Wt)[ae(this,Vt)].instance.setup()}}),Qn(this,"teardown",()=>{typeof window>"u"||(Mr.isSetUp=!1,ae(this,rw).call(this,window),ae(this,Wt)[ae(this,Vt)].instance.teardown())}),Qn(this,"connectDragSource",(r,s,o)=>ae(this,Ql).call(this,"connectDragSource",r,s,o)),Qn(this,"connectDragPreview",(r,s,o)=>ae(this,Ql).call(this,"connectDragPreview",r,s,o)),Qn(this,"connectDropTarget",(r,s,o)=>ae(this,Ql).call(this,"connectDropTarget",r,s,o)),Qn(this,"profile",()=>ae(this,Wt)[ae(this,Vt)].instance.profile()),Qn(this,"previewEnabled",()=>ae(this,Wt)[ae(this,Vt)].preview),Qn(this,"previewsList",()=>ae(this,Tl)),Qn(this,"backendsList",()=>ae(this,mi)),sn(this,iw,{writable:!0,value:r=>{ae(this,mi).forEach(s=>{s.transition&&r.addEventListener(s.transition.event,ae(this,Wp))})}}),sn(this,rw,{writable:!0,value:r=>{ae(this,mi).forEach(s=>{s.transition&&r.removeEventListener(s.transition.event,ae(this,Wp))})}}),sn(this,Wp,{writable:!0,value:r=>{const s=ae(this,Vt);if(ae(this,mi).some(a=>a.id!==ae(this,Vt)&&a.transition&&a.transition.check(r)?(Dr(this,Vt,a.id),!0):!1),ae(this,Vt)!==s){var o;ae(this,Wt)[s].instance.teardown(),Object.keys(ae(this,Bi)).forEach(u=>{const d=ae(this,Bi)[u];d.unsubscribe(),d.unsubscribe=ae(this,qp).call(this,d.func,...d.args)}),ae(this,Tl).backendChanged(this);const a=ae(this,Wt)[ae(this,Vt)];if(a.instance.setup(),a.skipDispatchOnTransition)return;const l=r.constructor,c=new l(r.type,r);(o=r.target)===null||o===void 0||o.dispatchEvent(c)}}}),sn(this,qp,{writable:!0,value:(r,s,o,a)=>ae(this,Wt)[ae(this,Vt)].instance[r](s,o,a)}),sn(this,Ql,{writable:!0,value:(r,s,o,a)=>{const l="".concat(r,"_").concat(s),c=ae(this,qp).call(this,r,s,o,a);return ae(this,Bi)[l]={func:r,args:[s,o,a],unsubscribe:c},()=>{ae(this,Bi)[l].unsubscribe(),delete ae(this,Bi)[l]}}}),!i||!i.backends||i.backends.length<1)throw new Error(`You must specify at least one Backend, if you are coming from 2.x.x (or don't understand this error)
|
|
760
|
-
see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx`);Dr(this,Tl,new XI),Dr(this,Wt,{}),Dr(this,mi,[]),i.backends.forEach(r=>{const s=ae(this,nw).call(this,e,n,r);ae(this,Wt)[s.id]=s,ae(this,mi).push(s)}),Dr(this,Vt,ae(this,mi)[0].id),Dr(this,Bi,{})}}Qn(Mr,"isSetUp",!1);const zI=(t,e,n)=>new Mr(t,e,n),sw=(t,e)=>({event:t,check:e}),YI=sw("touchstart",t=>{const e=t;return e.touches!==null&&e.touches!==void 0}),BI=sw("pointerdown",t=>t.pointerType=="mouse");var gi;(function(t){t.mouse="mouse",t.touch="touch",t.keyboard="keyboard"})(gi||(gi={}));class UI{get delay(){var e;return(e=this.args.delay)!==null&&e!==void 0?e:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var e;return(e=this.args.ignoreContextMenu)!==null&&e!==void 0?e:!1}get enableHoverOutsideTarget(){var e;return(e=this.args.enableHoverOutsideTarget)!==null&&e!==void 0?e:!1}get enableKeyboardEvents(){var e;return(e=this.args.enableKeyboardEvents)!==null&&e!==void 0?e:!1}get enableMouseEvents(){var e;return(e=this.args.enableMouseEvents)!==null&&e!==void 0?e:!1}get enableTouchEvents(){var e;return(e=this.args.enableTouchEvents)!==null&&e!==void 0?e:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var e,n,i,r;return(r=(i=(e=this.args)===null||e===void 0?void 0:e.delayTouchStart)!==null&&i!==void 0?i:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&r!==void 0?r:0}get delayMouseStart(){var e,n,i,r;return(r=(i=(e=this.args)===null||e===void 0?void 0:e.delayMouseStart)!==null&&i!==void 0?i:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&r!==void 0?r:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var e;if(!((e=this.context)===null||e===void 0)&&e.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var e;return((e=this.args)===null||e===void 0?void 0:e.rootElement)||this.document}constructor(e,n){this.args=e,this.context=n}}function FI(t,e,n,i){return Math.sqrt(Math.pow(Math.abs(n-t),2)+Math.pow(Math.abs(i-e),2))}function GI(t,e,n,i,r){if(!r)return!1;const s=Math.atan2(i-e,n-t)*180/Math.PI+180;for(let o=0;o<r.length;++o){const a=r[o];if(a&&(a.start==null||s>=a.start)&&(a.end==null||s<=a.end))return!0}return!1}const HI={Left:1,Right:2,Center:4},JI={Left:0,Center:1,Right:2};function zp(t){return t.button===void 0||t.button===JI.Left}function KI(t){return t.buttons===void 0||(t.buttons&HI.Left)===0}function ow(t){return!!t.targetTouches}const eZ=1;function tZ(t){const e=t.nodeType===eZ?t:t.parentElement;if(!e)return;const{top:n,left:i}=e.getBoundingClientRect();return{x:i,y:n}}function nZ(t,e){if(t.targetTouches.length===1)return Cl(t.targetTouches[0]);if(e&&t.touches.length===1&&t.touches[0].target===e.target)return Cl(t.touches[0])}function Cl(t,e){return ow(t)?nZ(t,e):{x:t.clientX,y:t.clientY}}const aw=(()=>{let t=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return t=!0,!0}}))}catch{}return t})(),io={[gi.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[gi.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[gi.keyboard]:{keydown:"keydown"}};class ro{profile(){var e;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((e=this.dragOverTargetIds)===null||e===void 0?void 0:e.length)||0}}get document(){return this.options.document}setup(){const e=this.options.rootElement;e&&(oe(!ro.isSetUp,"Cannot have two Touch backends at the same time."),ro.isSetUp=!0,this.addEventListener(e,"start",this.getTopMoveStartHandler()),this.addEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(e,"move",this.handleTopMove),this.addEventListener(e,"move",this.handleTopMoveCapture,!0),this.addEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(e,"keydown",this.handleCancelOnEscape,!0))}teardown(){const e=this.options.rootElement;e&&(ro.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(e,"start",this.handleTopMoveStart),this.removeEventListener(e,"move",this.handleTopMoveCapture,!0),this.removeEventListener(e,"move",this.handleTopMove),this.removeEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(e,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(e,n,i,r=!1){const s=aw?{capture:r,passive:!1}:r;this.listenerTypes.forEach(function(o){const a=io[o][n];a&&e.addEventListener(a,i,s)})}removeEventListener(e,n,i,r=!1){const s=aw?{capture:r,passive:!1}:r;this.listenerTypes.forEach(function(o){const a=io[o][n];a&&e.removeEventListener(a,i,s)})}connectDragSource(e,n){const i=this.handleMoveStart.bind(this,e);return this.sourceNodes.set(e,n),this.addEventListener(n,"start",i),()=>{this.sourceNodes.delete(e),this.removeEventListener(n,"start",i)}}connectDragPreview(e,n,i){return this.sourcePreviewNodeOptions.set(e,i),this.sourcePreviewNodes.set(e,n),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDropTarget(e,n){const i=this.options.rootElement;if(!this.document||!i)return()=>{};const r=s=>{if(!this.document||!i||!this.monitor.isDragging())return;let o;switch(s.type){case io.mouse.move:o={x:s.clientX,y:s.clientY};break;case io.touch.move:var a,l;o={x:((a=s.touches[0])===null||a===void 0?void 0:a.clientX)||0,y:((l=s.touches[0])===null||l===void 0?void 0:l.clientY)||0};break}const c=o!=null?this.document.elementFromPoint(o.x,o.y):void 0,u=c&&n.contains(c);if(c===n||u)return this.handleMove(s,e)};return this.addEventListener(this.document.body,"move",r),this.targetNodes.set(e,n),()=>{this.document&&(this.targetNodes.delete(e),this.removeEventListener(this.document.body,"move",r))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(e){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=e,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{e&&!e.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!e||!e.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(e.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(e,n,i){this.getSourceClientOffset=r=>{const s=this.sourceNodes.get(r);return s&&tZ(s)},this.handleTopMoveStartCapture=r=>{zp(r)&&(this.moveStartSourceIds=[])},this.handleMoveStart=r=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(r)},this.handleTopMoveStart=r=>{if(!zp(r))return;const s=Cl(r);s&&(ow(r)&&(this.lastTargetTouchFallback=r.targetTouches[0]),this._mouseClientOffset=s),this.waitingForDelay=!1},this.handleTopMoveStartDelay=r=>{if(!zp(r))return;const s=r.type===io.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,r),s),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(r,s)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(s)},this.handleTopMove=r=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:s,dragOverTargetIds:o}=this,a=this.options.enableHoverOutsideTarget,l=Cl(r,this.lastTargetTouchFallback);if(!l)return;if(this._isScrolling||!this.monitor.isDragging()&&GI(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&s&&FI(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(s,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const c=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(c),this.actions.publishDragSource(),r.cancelable&&r.preventDefault();const u=(o||[]).map(h=>this.targetNodes.get(h)).filter(h=>!!h),d=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(l.x,l.y,u):this.document.elementsFromPoint(l.x,l.y),p=[];for(const h in d){if(!d.hasOwnProperty(h))continue;let m=d[h];for(m!=null&&p.push(m);m;)m=m.parentElement,m&&p.indexOf(m)===-1&&p.push(m)}const f=p.filter(h=>u.indexOf(h)>-1).map(h=>this._getDropTargetId(h)).filter(h=>!!h).filter((h,m,g)=>g.indexOf(h)===m);if(a)for(const h in this.targetNodes){const m=this.targetNodes.get(h);if(c&&m&&m.contains(c)&&f.indexOf(h)===-1){f.unshift(h);break}}f.reverse(),this.actions.hover(f,{clientOffset:l})},this._getDropTargetId=r=>{const s=this.targetNodes.keys();let o=s.next();for(;o.done===!1;){const a=o.value;if(r===this.targetNodes.get(a))return a;o=s.next()}},this.handleTopMoveEndCapture=r=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!KI(r)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}r.cancelable&&r.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=r=>{r.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new UI(i,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(gi.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(gi.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(gi.keyboard)}}const iZ=function(e,n={},i={}){return new ro(e,n,i)};var qt=function(){return qt=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qt.apply(this,arguments)};function ht(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function rZ(t){var e=t.isVisible,n=t.ease,i=n===void 0?"easeIn":n,r=t.duration,s=t.variants,o=s===void 0?{open:{opacity:1,height:"auto"},close:{opacity:0,height:0}}:s,a=t.children,l=D_({polyfill:nD}),c=l[0],u=l[1].height,d=P.useState(e),p=d[0],f=d[1],h=P.useState(e),m=h[0],g=h[1],O=P.useState(!1),v=O[0],x=O[1],b=function(){x(!1),e||f(!1)};return P.useEffect(function(){x(!0),e?f(!0):g(!1)},[e]),P.useEffect(function(){p&&g(!0)},[u]),P.createElement(j_.div,{style:v?{overflow:"hidden"}:void 0,onAnimationComplete:b,initial:m?"open":"close",animate:m?"open":"close",inherit:!1,variants:o,transition:{ease:i,duration:sZ(u,r)}},P.createElement("div",{ref:c},p&&a))}function sZ(t,e){if(e)return e;if(!t)return 0;var n=t/36;return Math.round((4+10*Math.pow(n,.25)+n/5)*10)/1500}var oZ=function(t,e){return t.text>e.text?1:t.text<e.text?-1:0},so=function(t,e){return t.find(function(n){return n.id===e})},lw=function(t,e,n){if(n===0)return!1;var i=t.find(function(r){return r.id===n});return i===void 0?!1:i.parent===e?!0:lw(t,e,i.parent)},Yp=function(t){return t.id!==void 0&&t.parent!==void 0&&t.text!==void 0},vi=function(t,e,n){var i=n.tree,r=n.rootId,s=n.canDrop;if(t===null){if(e===r)return!0;var o=i.find(function(u){return u.id===e});return!!(o&&o.droppable)}else{var a=Yp(t)?t.id:null;if(s){var l=s(a,e);if(l!==void 0)return l}if(a===e)return!1;var c=i.find(function(d){return d.id===a}),o=i.find(function(d){return d.id===e});return c===void 0||a===null?e===r||!!(o!=null&&o.droppable):o===void 0?c.parent!==0:c.parent===e||!o.droppable?!1:!lw(i,a,e)}},aZ=function(t,e,n){return t.map(function(i){return i.id===e?qt(qt({},i),{parent:n}):i})},cw=function(t,e,n){if(n===0)return 0;var i=t.filter(function(r){return r.parent===e});return i[n]?t.findIndex(function(r){return r.id===i[n].id}):t.findIndex(function(r){return r.id===i[n-1].id})+1},lZ=function(t,e){return t.findIndex(function(n){return n.id===e})},uw=function(t,e,n,i){var r=lZ(t,e),s=cw(t,n,i);return s=s>r?s-1:s,[r,s]},cZ=function(t,e,n){var i=e<0?t.length+e:e;if(i>=0&&i<t.length){var r=n<0?t.length+n:n,s=t.splice(e,1)[0];t.splice(r,0,s)}},uZ=function(t,e,n,i){var r=uw(t,e,n,i),s=r[0],o=r[1],a=ht([],t,!0);return cZ(a,s,o),a.map(function(l){return l.id===e?qt(qt({},l),{parent:n}):l})},dZ=function(t,e){var n=t.getBoundingClientRect(),i=n.top+n.height/2;return e>i?"down":"up"},Bp=function(t,e){var n="",i=0;return t.forEach(function(r,s){var o,a=dZ(r,((o=e.getClientOffset())===null||o===void 0?void 0:o.y)||0);n===""?n=a:n!==a&&(n=a,i=s),s===t.length-1&&a==="down"&&(i=s+1)}),i},dw=function(t,e,n){var i=e.closest('[role="list"]'),r=i==null?void 0:i.querySelectorAll(':scope > [role="listitem"]');return r?Bp(r,n):null},pZ=function(t,e,n){var i=t.getBoundingClientRect(),r=n.dropTargetOffset,s=i.top+r,o=i.bottom-r;return e>o?"lower":e<s?"upper":"middle"},Up=function(t,e,n,i){var r;if(!e)return null;if(t===null){var s=e.querySelectorAll(':scope > [role="listitem"]');return{id:i.rootId,index:Bp(s,n)}}var o=n.getItem(),a=e.querySelector('[role="list"]'),l=pZ(e,((r=n.getClientOffset())===null||r===void 0?void 0:r.y)||0,i);if(a){if(l==="upper")if(vi(o,t.parent,i)){var c=dw(t,e,n);return c===null?null:{id:t.parent,index:c}}else return{id:t.id,index:0};var s=a.querySelectorAll(':scope > [role="listitem"]');return{id:t.id,index:Bp(s,n)}}else{if(l==="middle")return{id:t.id,index:0};if(vi(o,t.parent,i)){var c=dw(t,e,n);return c===null?null:{id:t.parent,index:c}}return null}},fZ=function(t){return t===void 0&&(t={}),{backends:[{id:"html5",backend:RA,options:t.html5,transition:BI},{id:"touch",backend:iZ,options:t.touch||{enableMouseEvents:!0},preview:!0,transition:YI}]}},El=function(t,e){return t.some(function(n){return n.parent===e})},pw=P.createContext({}),hZ=function(t){var e=SZ(t.tree,t.initialOpen),n=e[0],i=e[1],r=i.handleToggle,s=i.handleCloseAll,o=i.handleOpenAll,a=i.handleOpen,l=i.handleClose;P.useImperativeHandle(t.treeRef,function(){return{open:function(f){return a(f,t.onChangeOpen)},close:function(f){return l(f,t.onChangeOpen)},openAll:function(){return o(t.onChangeOpen)},closeAll:function(){return s(t.onChangeOpen)}}});var c=Vn().getMonitor(),u=t.canDrop,d=t.canDrag,p=qt(qt({extraAcceptTypes:[],listComponent:"ul",listItemComponent:"li",placeholderComponent:"li",sort:!0,insertDroppableFirst:!0,enableAnimateExpand:!1,dropTargetOffset:0,initialOpen:!1},t),{openIds:n,onDrop:function(f,h,m){if(f){var g={dragSourceId:f.id,dropTargetId:h,dragSource:f,dropTarget:so(t.tree,h),monitor:c},O=t.tree;if(so(O,f.id)||(O=ht(ht([],O,!0),[f],!1)),t.sort===!1){var v=uw(O,f.id,h,m),x=v[1];g.destinationIndex=x,g.relativeIndex=m,t.onDrop(uZ(O,f.id,h,m),g);return}t.onDrop(aZ(O,f.id,h),g)}else{var g={dropTargetId:h,dropTarget:so(t.tree,h),monitor:c};t.sort===!1&&(g.destinationIndex=cw(t.tree,h,m),g.relativeIndex=m),t.onDrop(t.tree,g)}},canDrop:u?function(f,h){return u(t.tree,{dragSourceId:f??void 0,dropTargetId:h,dragSource:c.getItem(),dropTarget:so(t.tree,h),monitor:c})}:void 0,canDrag:d?function(f){return d(so(t.tree,f))}:void 0,onToggle:function(f){return r(f,t.onChangeOpen)}});return P.createElement(pw.Provider,{value:p},t.children)},fw=P.createContext({}),mZ={isLock:!1},gZ=function(t){var e=P.useState(mZ.isLock),n=e[0],i=e[1];return P.createElement(fw.Provider,{value:{isLock:n,lock:function(){return i(!0)},unlock:function(){return i(!1)}}},t.children)},oo=P.createContext({}),jl={dropTargetId:void 0,index:void 0},vZ=function(t){var e=P.useState(jl.dropTargetId),n=e[0],i=e[1],r=P.useState(jl.index),s=r[0],o=r[1],a=function(c,u){i(c),o(u)},l=function(){i(jl.dropTargetId),o(jl.index)};return P.createElement(oo.Provider,{value:{dropTargetId:n,index:s,showPlaceholder:a,hidePlaceholder:l}},t.children)},OZ=function(t){return P.createElement(hZ,qt({},t),P.createElement(gZ,null,P.createElement(vZ,null,t.children)))},xZ=function(t){var e=P.useContext(fw);P.useEffect(function(){if(t.current){var n=t.current,i=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.lock()},r=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.unlock()},s=function(u){return i(u)},o=function(u){return r(u)},a=function(u){return i(u)},l=function(u){return r(u)},c=new MutationObserver(function(){document.activeElement===document.body&&e.unlock()});return c.observe(n,{subtree:!0,childList:!0}),n.addEventListener("mouseover",s),n.addEventListener("mouseout",o),n.addEventListener("focusin",a),n.addEventListener("focusout",l),function(){c.disconnect(),n.removeEventListener("mouseover",s),n.removeEventListener("mouseout",o),n.removeEventListener("focusin",a),n.removeEventListener("focusout",l)}}},[t,e]),P.useEffect(function(){var n;(n=t.current)===null||n===void 0||n.setAttribute("draggable",e.isLock?"false":"true")},[t,e.isLock])},Al={TREE_ITEM:Symbol()},hw=null,mw=function(t){var e=t.target;if(e instanceof HTMLElement){var n=e.closest('[role="listitem"]');t.currentTarget===n&&(hw=n)}},gw=function(t){return mw(t)},vw=function(t){return mw(t)},bZ=function(t,e){var n=Oi();P.useEffect(function(){var a=e.current;return a==null||a.addEventListener("dragstart",gw),a==null||a.addEventListener("touchstart",vw,{passive:!0}),function(){a==null||a.removeEventListener("dragstart",gw),a==null||a.removeEventListener("touchstart",vw)}},[e]);var i=TI({type:Al.TREE_ITEM,item:function(a){var l=qt({ref:e},t);return n.onDragStart&&n.onDragStart(l,a),l},end:function(a,l){var c=a;n.onDragEnd&&n.onDragEnd(c,l)},canDrag:function(){var a=n.canDrag;return hw!==e.current?!1:a?a(t.id):!0},collect:function(a){return{isDragging:a.isDragging()}}}),r=i[0].isDragging,s=i[1],o=i[2];return[r,s,o]},yZ=function(t){var e=Oi(),n=P.useContext(oo),i=Ky({accept:ht([Al.TREE_ITEM],e.extraAcceptTypes,!0),drop:function(l,c){var u=e.rootId,d=e.onDrop,p=n.dropTargetId,f=n.index;c.isOver({shallow:!0})&&p!==void 0&&f!==void 0&&d(Yp(l)?l:null,u,f),n.hidePlaceholder()},canDrop:function(l,c){var u=e.rootId;return c.isOver({shallow:!0})?l===void 0?!1:vi(l,u,e):!1},hover:function(l,c){if(c.isOver({shallow:!0})){var u=e.rootId,d=n.dropTargetId,p=n.index,f=n.showPlaceholder,h=n.hidePlaceholder,m=Up(null,t.current,c,e);if(m===null||!vi(l,u,e)){h();return}(m.id!==d||m.index!==p)&&f(m.id,m.index)}},collect:function(l){var c=l.getItem();return{isOver:l.isOver({shallow:!0})&&l.canDrop(),dragSource:c}}}),r=i[0],s=r.isOver,o=r.dragSource,a=i[1];return[s,o,a]},wZ=function(t,e){var n=Oi(),i=P.useContext(oo),r=Ky({accept:ht([Al.TREE_ITEM],n.extraAcceptTypes,!0),drop:function(c,u){var d=i.dropTargetId,p=i.index;u.isOver({shallow:!0})&&d!==void 0&&p!==void 0&&n.onDrop(Yp(c)?c:null,d,p),i.hidePlaceholder()},canDrop:function(c,u){if(u.isOver({shallow:!0})){var d=Up(t,e.current,u,n);return d===null?!1:vi(c,d.id,n)}return!1},hover:function(c,u){if(u.isOver({shallow:!0})){var d=i.dropTargetId,p=i.index,f=i.showPlaceholder,h=i.hidePlaceholder,m=Up(t,e.current,u,n);if(m===null||!vi(c,m.id,n)){h();return}(m.id!==d||m.index!==p)&&f(m.id,m.index)}},collect:function(c){var u=c.getItem();return{isOver:c.isOver({shallow:!0})&&c.canDrop(),dragSource:u}}}),s=r[0],o=s.isOver,a=s.dragSource,l=r[1];return[o,a,l]},SZ=function(t,e){var n=P.useMemo(function(){return e===!0?t.filter(function(d){return El(t,d.id)}).map(function(d){return d.id}):Array.isArray(e)?e:[]},[e]),i=P.useState(n),r=i[0],s=i[1];P.useEffect(function(){return s(n)},[e]);var o=function(d,p){var f=r.includes(d)?r.filter(function(h){return h!==d}):ht(ht([],r,!0),[d],!1);s(f),p&&p(f)},a=function(d){s([]),d&&d([])},l=function(d){var p=t.filter(function(f){return El(t,f.id)}).map(function(f){return f.id});s(p),d&&d(p)},c=function(d,p){var f=[];if(Array.isArray(d)){var h=t.filter(function(m){return d.includes(m.id)&&El(t,m.id)});f=ht(ht([],r,!0),h.map(function(m){return m.id}),!0).filter(function(m,g,O){return O.indexOf(m)===g})}else f=r.includes(d)?r:ht(ht([],r,!0),[d],!1);s(f),p&&p(f)},u=function(d,p){var f=r.filter(function(h){return Array.isArray(d)?!d.includes(h):h!==d});s(f),p&&p(f)};return[r,{handleToggle:o,handleCloseAll:a,handleOpenAll:l,handleOpen:c,handleClose:u}]},PZ=function(){return QI(function(t){var e=t.getItemType();return{item:t.getItem(),clientOffset:t.getClientOffset(),isDragging:t.isDragging()&&e===Al.TREE_ITEM}})},Oi=function(){var t=P.useContext(pw);if(!t)throw new Error("useTreeContext must be used under TreeProvider");return t},kZ=function(t,e){var n=Oi(),i=n.rootId,r=n.rootProps,s=n.classes,o=(s==null?void 0:s.container)||"";return e&&(s!=null&&s.dropTarget)&&(o="".concat(o," ").concat(s.dropTarget)),t===i&&(s!=null&&s.root)&&(o="".concat(o," ").concat(s.root)),t===i&&(r!=null&&r.className)&&(o="".concat(o," ").concat(r.className)),o=o.trim(),o},$Z=function(t,e,n){e.current?n(e):n(t),P.useEffect(function(){e.current?n(e):n(t)},[e.current])},TZ=function(t){var e=Oi(),n=P.useContext(oo),i=P.useRef(null),r=P.useRef(null),s=e.tree.find(function(T){return T.id===t.id}),o=e.openIds,a=e.classes,l=e.enableAnimateExpand,c=o.includes(t.id),u=bZ(s,i),d=u[0],p=u[1],f=u[2],h=wZ(s,i),m=h[0],g=h[1],O=h[2];$Z(i,r,p),vi(g,t.id,e)&&O(i),P.useEffect(function(){e.dragPreviewRender?f(MA(),{captureDraggingState:!0}):r.current&&f(i)},[f,e.dragPreviewRender]),xZ(i);var v=function(){return e.onToggle(s.id)},x=e.listItemComponent,b=(a==null?void 0:a.listItem)||"";m&&(a!=null&&a.dropTarget)&&(b="".concat(b," ").concat(a.dropTarget)),d&&(a!=null&&a.draggingSource)&&(b="".concat(b," ").concat(a.draggingSource));var w=e.canDrag?e.canDrag(t.id):!0,y=n.dropTargetId===t.id,k={depth:t.depth,isOpen:c,isDragging:d,isDropTarget:y,draggable:w,hasChild:El(e.tree,t.id),containerRef:i,handleRef:r,onToggle:v};return P.createElement(x,{ref:i,className:b,role:"listitem"},e.render(s,k),l&&k.hasChild&&P.createElement(rZ,{isVisible:c},P.createElement(Fp,{parentId:t.id,depth:t.depth+1})),!l&&k.hasChild&&c&&P.createElement(Fp,{parentId:t.id,depth:t.depth+1}))},Ow=function(t){var e=Oi(),n=e.placeholderRender,i=e.placeholderComponent,r=e.classes,s=P.useContext(oo),o=Vn(),a=o.getMonitor(),l=a.getItem();if(!n||!l)return null;var c=t.dropTargetId===s.dropTargetId&&(t.index===s.index||t.index===void 0&&t.listCount===s.index);return c?P.createElement(i,{className:(r==null?void 0:r.placeholder)||""},n(l,{depth:t.depth})):null},Fp=function(t){var e=Oi(),n=P.useRef(null),i=e.tree.filter(function(m){return m.parent===t.parentId}),r=i,s=typeof e.sort=="function"?e.sort:oZ;if(e.insertDroppableFirst){var o=i.filter(function(m){return m.droppable}),a=i.filter(function(m){return!m.droppable});e.sort===!1?r=ht(ht([],o,!0),a,!0):(o=o.sort(s),a=a.sort(s),r=ht(ht([],o,!0),a,!0))}else e.sort!==!1&&(r=i.sort(s));var l=yZ(n),c=l[0],u=l[1],d=l[2];t.parentId===e.rootId&&vi(u,e.rootId,e)&&d(n);var p=kZ(t.parentId,c),f=e.rootProps||{},h=e.listComponent;return P.createElement(h,qt({ref:n,role:"list"},f,{className:p}),r.map(function(m,g){return P.createElement(P.Fragment,{key:m.id},P.createElement(Ow,{depth:t.depth,listCount:r.length,dropTargetId:t.parentId,index:g}),P.createElement(TZ,{id:m.id,depth:t.depth}))}),P.createElement(Ow,{depth:t.depth,listCount:r.length,dropTargetId:t.parentId}))},QZ={height:"100%",left:0,pointerEvents:"none",position:"fixed",top:0,width:"100%",zIndex:100},CZ=function(t){var e=t.clientOffset;if(!e)return{};var n=e.x,i=e.y,r="translate(".concat(n,"px, ").concat(i,"px)");return{pointerEvents:"none",transform:r}},EZ=function(){var t=Oi(),e=PZ(),n=e.isDragging,i=e.clientOffset;return!n||!i?null:P.createElement("div",{style:QZ},P.createElement("div",{style:CZ(e)},t.dragPreviewRender&&t.dragPreviewRender(e)))};function jZ(t,e){return P.createElement(OZ,qt({},t,{treeRef:e}),t.dragPreviewRender&&P.createElement(EZ,null),P.createElement(Fp,{parentId:t.rootId,depth:0}))}var AZ=P.forwardRef(jZ);const DZ=({onSubmit:t,onBlur:e,isDirectory:n,files:i,currentPath:r="/"})=>{const[s,o]=P.useState(""),a=P.useRef(null),[l,c]=P.useState(!1);P.useEffect(()=>{s&&(i[`${r}/${s}`]||i[`${r}/${s}/`])?c(!0):c(!1)},[s]);const u=f=>{f.preventDefault()},d=()=>{if(s){let f=s;n&&!s.endsWith("/")?f=`${s}/`:s.endsWith("/")&&(f=s.substring(0,-1)),t(f),o("")}else e()},p=f=>{if(l)return;let h=s;n&&!s.endsWith("/")?h=`${s}/`:s.endsWith("/")&&(h=s.substring(0,-1)),f.key==="Enter"&&(f.preventDefault(),t(h),o("")),f.key==="Escape"&&(f.preventDefault(),d())};return S.jsxs("form",{ref:a,onSubmit:u,children:[S.jsx("label",{children:S.jsx("input",{style:{maxWidth:"100%",border:`1px solid ${l?"red":"inherit"}`},onBlur:d,maxLength:35,autoFocus:!0,placeholder:`${n?"Directory name":"File name"}`,name:"name",type:"text",value:s,onChange:f=>o(f.target.value),onKeyDown:p})}),l?S.jsx("span",{style:{display:"block",maxWidth:"100%",background:"var(--sp-colors-errorSurface)",color:"var(--sp-colors-error)",borderRadius:"3px"},children:"File or Directory already exists"}):null]})},xw=({dir:t})=>{const{sandpack:e}=Ce(),{addFile:n}=yx();return S.jsx("span",{style:{cursor:"pointer"},onClick:()=>{const i=e.activeFile.split("/").slice(0,-1).join("/");n({[`${i}/${t?"addDir":"addFile"}`]:{code:".emptyDir",hidden:!0}})},children:t?S.jsx(ZO,{}):S.jsx(NO,{})})},MZ=()=>{const{treeData:t,addFile:e,deleteFile:n,onFileMoved:i,setTreeData:r,openDirs:s,setOpenDirs:o}=yx(),{sandpack:a}=Ce(),l=["/package.json"],c=async(d,p)=>{var m,g,O,v;const f=Ox(a.files),h=`/${Ni({parent:p.dropTargetId,text:((m=p==null?void 0:p.dragSource)==null?void 0:m.text)||p.dragSourceId},d)}`;a.files[h],!([...l,f].includes(((O=(g=p==null?void 0:p.dragSource)==null?void 0:g.data)==null?void 0:O.path)||"")||((v=p.dragSource)==null?void 0:v.parent)===p.dropTargetId||a.files[h])&&(await i({newTree:d,node:p}),r(d))},u=Ox(a.files);return S.jsx(S.Fragment,{children:S.jsx(rI,{backend:zI,options:fZ(),children:S.jsxs("div",{style:{minHeight:"100%",maxHeight:"100%",height:"var(--sp-layout-height)",minWidth:"200px",overflowY:"auto",overflowX:"hidden",position:"relative",display:"flex",flexDirection:"column",padding:"var(--sp-space-1) var(--sp-space-3)",backgroundColor:"var(--sp-colors-surface1, #011627)"},children:[S.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"40px"},children:[S.jsx("span",{children:"Files"}),S.jsxs("div",{style:{display:"flex"},children:[S.jsx(xw,{}),S.jsx(xw,{dir:!0})]})]}),S.jsx(AZ,{tree:t.filter(({text:d})=>!!d),rootId:"/",onDrop:c,rootProps:{style:{listStyle:"none",padding:"0",height:"100%"}},classes:{root:"test"},enableAnimateExpand:!0,insertDroppableFirst:!0,sort:!0,initialOpen:s,render:(d,{depth:p,isOpen:f})=>{var h,m,g,O;return d.text?S.jsxs("div",{style:{marginLeft:p*10,display:"flex",justifyContent:"space-between",maxWidth:"300px",overflow:"hidden",padding:"var(--sp-space-1) 0",transition:"color var(--sp-transitions-default), background var(--sp-transitions-default)"},children:[d.text.includes("addFile")||d.text.includes("addDir")?S.jsx(DZ,{files:a.files,onBlur:()=>{var v;return n(`${(v=d==null?void 0:d.data)==null?void 0:v.path}`)},isDirectory:d.text.includes("addDir"),currentPath:(h=d==null?void 0:d.data)==null?void 0:h.path.split("/").slice(0,-1).join("/"),onSubmit:async v=>{var w;const b=`${(w=d==null?void 0:d.data)==null?void 0:w.path.split("/").slice(0,-1).join("/")}/${v}`;await e({[b]:{code:d.text.includes("addDir")?".emptyDir":`// ${v}`,hidden:d.text.includes("addDir")}})}}):null,d.text&&!d.text.includes("addFile")&&!d.text.includes("addDir")?S.jsxs(S.Fragment,{children:[d.droppable?S.jsxs("span",{style:{color:"var(--sp-colors-clickable)",display:"flex",cursor:"pointer"},onClick:()=>{o(f?v=>v.filter(x=>x!==d.id):v=>[...v,d.id])},children:[f?S.jsx(ZO,{}):S.jsx(f2,{}),d.text,f?"[-] ":"[+] "]}):S.jsxs("span",{style:{display:"flex"},children:[S.jsx("span",{style:{minWidth:"16px",minHeight:"16px"},children:S.jsx(NO,{})}),S.jsx("span",{style:{textOverflow:"ellipsis",maxWidth:"200px",overflow:"hidden",cursor:"pointer",color:`${((m=d==null?void 0:d.data)==null?void 0:m.path)===a.activeFile?"var(--sp-colors-accent)":"var(--sp-colors-clickable)"}`,display:"flex"},onClick:()=>{var v;return a.openFile((v=d==null?void 0:d.data)==null?void 0:v.path)},children:d.text})]}),[u,"/package.json"].includes(((g=d==null?void 0:d.data)==null?void 0:g.path)??"")?S.jsx("span",{style:{color:"var(--sp-colors-warning)"},children:((O=d==null?void 0:d.data)==null?void 0:O.path)===u?"entry":""}):S.jsx("button",{style:{background:"none",border:"none",cursor:"pointer"},onClick:async()=>{var v;await n(`${(v=d==null?void 0:d.data)==null?void 0:v.path}${d.droppable?"/":""}`)},children:S.jsx(LO,{})})]}):null]},d.id):S.jsx(S.Fragment,{})}})]})})})},RZ=()=>S.jsx("div",{style:{minWidth:150,maxWidth:"300px",overflow:"hidden"},children:S.jsx(MZ,{})}),_Z=t=>S.jsx(bA,{...t,children:S.jsx(RZ,{})}),IZ=({type:t="react",children:e,showConsole:n=!0,files:i,className:r,style:s,...o})=>{const a=P.useRef(),l=e?P.cloneElement(e,{ref:a}):null;return S.jsxs("div",{className:r,style:s,...o,children:[l,S.jsx(ej,{template:t,theme:"dark",files:i,children:S.jsx(zO,{children:S.jsxs(xj,{children:[S.jsx(_Z,{}),S.jsx(vA,{editorFiles:a}),S.jsxs("div",{children:[S.jsx(eA,{style:{height:n?"60vh":"100vh"},showOpenInCodeSandbox:!1}),n?S.jsx(mA,{style:{height:"40vh",width:"40vw"}}):""]})]})})})]})};var ZZ=Object.create,Gp=Object.defineProperty,NZ=Object.getOwnPropertyDescriptor,bw=Object.getOwnPropertyNames,LZ=Object.getPrototypeOf,XZ=Object.prototype.hasOwnProperty,VZ=(t,e,n)=>e in t?Gp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Cn=(t,e)=>function(){return e||(0,t[bw(t)[0]])((e={exports:{}}).exports,e),e.exports},WZ=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of bw(e))!XZ.call(t,r)&&r!==n&&Gp(t,r,{get:()=>e[r],enumerable:!(i=NZ(e,r))||i.enumerable});return t},Rr=(t,e,n)=>(n=t!=null?ZZ(LZ(t)):{},WZ(e||!t||!t.__esModule?Gp(n,"default",{value:t,enumerable:!0}):n,t)),qZ=(t,e,n)=>(VZ(t,typeof e!="symbol"?e+"":e,n),n),Hp=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},zt=(t,e,n)=>(Hp(t,e,"read from private field"),n?n.call(t):e.get(t)),Ui=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ao=(t,e,n,i)=>(Hp(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),on=(t,e,n)=>(Hp(t,e,"access private method"),n),yw=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/pad.js"(t,e){e.exports=function(i,r){var s="000000000"+i;return s.substr(s.length-r)}}}),zZ=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/fingerprint.browser.js"(t,e){var n=yw(),i=typeof window=="object"?window:self,r=Object.keys(i).length,s=navigator.mimeTypes?navigator.mimeTypes.length:0,o=n((s+navigator.userAgent.length).toString(36)+r.toString(36),4);e.exports=function(){return o}}}),YZ=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/getRandomValue.browser.js"(t,e){var n,i=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof self<"u"&&self.crypto;i?(r=Math.pow(2,32)-1,n=function(){return Math.abs(i.getRandomValues(new Uint32Array(1))[0]/r)}):n=Math.random;var r;e.exports=n}}),ww=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/index.js"(t,e){var n=zZ(),i=yw(),r=YZ(),s=0,o=4,a=36,l=Math.pow(a,o);function c(){return i((r()*l<<0).toString(a),o)}function u(){return s=s<l?s:0,s++,s-1}function d(){var p="c",f=new Date().getTime().toString(a),h=i(u().toString(a),o),m=n(),g=c()+c();return p+f+h+m+g}d.slug=function(){var f=new Date().getTime().toString(36),h=u().toString(36).slice(-4),m=n().slice(0,1)+n().slice(-1),g=c().slice(-2);return f.slice(-2)+h+m+g},d.isCuid=function(f){return typeof f!="string"?!1:!!f.startsWith("c")},d.isSlug=function(f){if(typeof f!="string")return!1;var h=f.length;return h>=7&&h<=10},d.fingerprint=n,e.exports=d}}),Sw=Cn({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/createDeferredExecutor.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createDeferredExecutor=void 0;function e(){const n=(i,r)=>{n.state="pending",n.resolve=s=>{if(n.state!=="pending")return;n.result=s;const o=a=>(n.state="fulfilled",a);return i(s instanceof Promise?s:Promise.resolve(s).then(o))},n.reject=s=>{if(n.state==="pending")return queueMicrotask(()=>{n.state="rejected"}),r(n.rejectionReason=s)}};return n}t.createDeferredExecutor=e}}),BZ=Cn({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/DeferredPromise.js"(t){var i,r,Ll,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=void 0;var e=Sw(),n=(o=class extends Promise{constructor(l=null){const c=(0,e.createDeferredExecutor)();super((u,d)=>{c(u,d),l==null||l(c.resolve,c.reject)});uf(this,r);uf(this,i,void 0);Ze(this,"resolve");Ze(this,"reject");e1(this,i,c),this.resolve=co(this,i).resolve,this.reject=co(this,i).reject}get state(){return co(this,i).state}get rejectionReason(){return co(this,i).rejectionReason}then(l,c){return Nl(this,r,Ll).call(this,super.then(l,c))}catch(l){return Nl(this,r,Ll).call(this,super.catch(l))}finally(l){return Nl(this,r,Ll).call(this,super.finally(l))}},i=new WeakMap,r=new WeakSet,Ll=function(l){return Object.defineProperties(l,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},o);t.DeferredPromise=n}}),Jp=Cn({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(i,r,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(r,s);(!a||("get"in a?!r.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return r[s]}}),Object.defineProperty(i,o,a)}:function(i,r,s,o){o===void 0&&(o=s),i[o]=r[s]}),n=t&&t.__exportStar||function(i,r){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(r,s)&&e(r,i,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(Sw(),t),n(BZ(),t)}}),Pw=Cn({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/MemoryLeakError.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryLeakError=void 0;var e=class extends Error{constructor(i,r,s){super(`Possible EventEmitter memory leak detected. ${s} ${r.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`);Ze(this,"emitter");Ze(this,"type");Ze(this,"count");this.emitter=i,this.type=r,this.count=s,this.name="MaxListenersExceededWarning"}};t.MemoryLeakError=e}}),UZ=Cn({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/Emitter.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=void 0;var e=Pw(),n,i,r,s,o,a,l,c,u,d,p,f=class{constructor(){Ui(this,s),Ui(this,a),Ui(this,c),Ui(this,d),Ui(this,n,void 0),Ui(this,i,void 0),Ui(this,r,void 0),ao(this,n,new Map),ao(this,i,f.defaultMaxListeners),ao(this,r,!1)}static listenerCount(m,g){return m.listenerCount(g)}setMaxListeners(m){return ao(this,i,m),this}getMaxListeners(){return zt(this,i)}eventNames(){return Array.from(zt(this,n).keys())}emit(m,...g){const O=on(this,s,o).call(this,m);return O.forEach(v=>{v.apply(this,g)}),O.length>0}addListener(m,g){on(this,d,p).call(this,"newListener",m,g);const O=on(this,s,o).call(this,m).concat(g);if(zt(this,n).set(m,O),zt(this,i)>0&&this.listenerCount(m)>zt(this,i)&&!zt(this,r)){ao(this,r,!0);const v=new e.MemoryLeakError(this,m,this.listenerCount(m));console.warn(v)}return this}on(m,g){return this.addListener(m,g)}once(m,g){return this.addListener(m,on(this,c,u).call(this,m,g))}prependListener(m,g){const O=on(this,s,o).call(this,m);if(O.length>0){const v=[g].concat(O);zt(this,n).set(m,v)}else zt(this,n).set(m,O.concat(g));return this}prependOnceListener(m,g){return this.prependListener(m,on(this,c,u).call(this,m,g))}removeListener(m,g){const O=on(this,s,o).call(this,m);return O.length>0&&(on(this,a,l).call(this,O,g),zt(this,n).set(m,O),on(this,d,p).call(this,"removeListener",m,g)),this}off(m,g){return this.removeListener(m,g)}removeAllListeners(m){return m?zt(this,n).delete(m):zt(this,n).clear(),this}listeners(m){return Array.from(on(this,s,o).call(this,m))}listenerCount(m){return on(this,s,o).call(this,m).length}rawListeners(m){return this.listeners(m)}},h=f;n=new WeakMap,i=new WeakMap,r=new WeakMap,s=new WeakSet,o=function(m){return zt(this,n).get(m)||[]},a=new WeakSet,l=function(m,g){const O=m.indexOf(g);return O>-1&&m.splice(O,1),[]},c=new WeakSet,u=function(m,g){const O=(...v)=>{this.removeListener(m,O),g.apply(this,v)};return O},d=new WeakSet,p=function(m,g,O){this.emit(m,g,O)},qZ(h,"defaultMaxListeners",10),t.Emitter=h}}),FZ=Cn({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(i,r,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(r,s);(!a||("get"in a?!r.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return r[s]}}),Object.defineProperty(i,o,a)}:function(i,r,s,o){o===void 0&&(o=s),i[o]=r[s]}),n=t&&t.__exportStar||function(i,r){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(r,s)&&e(r,i,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(UZ(),t),n(Pw(),t)}}),GZ=Rr(ww()),HZ=/(%?)(%([sdjo]))/g;function JZ(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const n=JSON.stringify(t);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?t:n}}}function Ct(t,...e){if(e.length===0)return t;let n=0,i=t.replace(HZ,(r,s,o,a)=>{const l=e[n],c=JZ(l,a);return s?r:(n++,c)});return n<e.length&&(i+=` ${e.slice(n).join(" ")}`),i=i.replace(/%{2,2}/g,"%"),i}var KZ=2;function eN(t){if(!t.stack)return;const e=t.stack.split(`
|
|
760
|
+
see this guide: https://github.com/louisbrunner/dnd-multi-backend/tree/master/packages/react-dnd-multi-backend#migrating-from-2xx`);Dr(this,Tl,new XI),Dr(this,Wt,{}),Dr(this,mi,[]),i.backends.forEach(r=>{const s=ae(this,nw).call(this,e,n,r);ae(this,Wt)[s.id]=s,ae(this,mi).push(s)}),Dr(this,Vt,ae(this,mi)[0].id),Dr(this,Bi,{})}}Qn(Mr,"isSetUp",!1);const zI=(t,e,n)=>new Mr(t,e,n),sw=(t,e)=>({event:t,check:e}),YI=sw("touchstart",t=>{const e=t;return e.touches!==null&&e.touches!==void 0}),BI=sw("pointerdown",t=>t.pointerType=="mouse");var gi;(function(t){t.mouse="mouse",t.touch="touch",t.keyboard="keyboard"})(gi||(gi={}));class UI{get delay(){var e;return(e=this.args.delay)!==null&&e!==void 0?e:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var e;return(e=this.args.ignoreContextMenu)!==null&&e!==void 0?e:!1}get enableHoverOutsideTarget(){var e;return(e=this.args.enableHoverOutsideTarget)!==null&&e!==void 0?e:!1}get enableKeyboardEvents(){var e;return(e=this.args.enableKeyboardEvents)!==null&&e!==void 0?e:!1}get enableMouseEvents(){var e;return(e=this.args.enableMouseEvents)!==null&&e!==void 0?e:!1}get enableTouchEvents(){var e;return(e=this.args.enableTouchEvents)!==null&&e!==void 0?e:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var e,n,i,r;return(r=(i=(e=this.args)===null||e===void 0?void 0:e.delayTouchStart)!==null&&i!==void 0?i:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&r!==void 0?r:0}get delayMouseStart(){var e,n,i,r;return(r=(i=(e=this.args)===null||e===void 0?void 0:e.delayMouseStart)!==null&&i!==void 0?i:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&r!==void 0?r:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var e;if(!((e=this.context)===null||e===void 0)&&e.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var e;return((e=this.args)===null||e===void 0?void 0:e.rootElement)||this.document}constructor(e,n){this.args=e,this.context=n}}function FI(t,e,n,i){return Math.sqrt(Math.pow(Math.abs(n-t),2)+Math.pow(Math.abs(i-e),2))}function GI(t,e,n,i,r){if(!r)return!1;const s=Math.atan2(i-e,n-t)*180/Math.PI+180;for(let o=0;o<r.length;++o){const a=r[o];if(a&&(a.start==null||s>=a.start)&&(a.end==null||s<=a.end))return!0}return!1}const HI={Left:1,Right:2,Center:4},JI={Left:0,Center:1,Right:2};function zp(t){return t.button===void 0||t.button===JI.Left}function KI(t){return t.buttons===void 0||(t.buttons&HI.Left)===0}function ow(t){return!!t.targetTouches}const eZ=1;function tZ(t){const e=t.nodeType===eZ?t:t.parentElement;if(!e)return;const{top:n,left:i}=e.getBoundingClientRect();return{x:i,y:n}}function nZ(t,e){if(t.targetTouches.length===1)return Cl(t.targetTouches[0]);if(e&&t.touches.length===1&&t.touches[0].target===e.target)return Cl(t.touches[0])}function Cl(t,e){return ow(t)?nZ(t,e):{x:t.clientX,y:t.clientY}}const aw=(()=>{let t=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return t=!0,!0}}))}catch{}return t})(),io={[gi.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[gi.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[gi.keyboard]:{keydown:"keydown"}};class ro{profile(){var e;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((e=this.dragOverTargetIds)===null||e===void 0?void 0:e.length)||0}}get document(){return this.options.document}setup(){const e=this.options.rootElement;e&&(oe(!ro.isSetUp,"Cannot have two Touch backends at the same time."),ro.isSetUp=!0,this.addEventListener(e,"start",this.getTopMoveStartHandler()),this.addEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(e,"move",this.handleTopMove),this.addEventListener(e,"move",this.handleTopMoveCapture,!0),this.addEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(e,"keydown",this.handleCancelOnEscape,!0))}teardown(){const e=this.options.rootElement;e&&(ro.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(e,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(e,"start",this.handleTopMoveStart),this.removeEventListener(e,"move",this.handleTopMoveCapture,!0),this.removeEventListener(e,"move",this.handleTopMove),this.removeEventListener(e,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(e,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(e,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(e,n,i,r=!1){const s=aw?{capture:r,passive:!1}:r;this.listenerTypes.forEach(function(o){const a=io[o][n];a&&e.addEventListener(a,i,s)})}removeEventListener(e,n,i,r=!1){const s=aw?{capture:r,passive:!1}:r;this.listenerTypes.forEach(function(o){const a=io[o][n];a&&e.removeEventListener(a,i,s)})}connectDragSource(e,n){const i=this.handleMoveStart.bind(this,e);return this.sourceNodes.set(e,n),this.addEventListener(n,"start",i),()=>{this.sourceNodes.delete(e),this.removeEventListener(n,"start",i)}}connectDragPreview(e,n,i){return this.sourcePreviewNodeOptions.set(e,i),this.sourcePreviewNodes.set(e,n),()=>{this.sourcePreviewNodes.delete(e),this.sourcePreviewNodeOptions.delete(e)}}connectDropTarget(e,n){const i=this.options.rootElement;if(!this.document||!i)return()=>{};const r=s=>{if(!this.document||!i||!this.monitor.isDragging())return;let o;switch(s.type){case io.mouse.move:o={x:s.clientX,y:s.clientY};break;case io.touch.move:var a,l;o={x:((a=s.touches[0])===null||a===void 0?void 0:a.clientX)||0,y:((l=s.touches[0])===null||l===void 0?void 0:l.clientY)||0};break}const c=o!=null?this.document.elementFromPoint(o.x,o.y):void 0,u=c&&n.contains(c);if(c===n||u)return this.handleMove(s,e)};return this.addEventListener(this.document.body,"move",r),this.targetNodes.set(e,n),()=>{this.document&&(this.targetNodes.delete(e),this.removeEventListener(this.document.body,"move",r))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(e){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=e,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{e&&!e.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!e||!e.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(e.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(e,n,i){this.getSourceClientOffset=r=>{const s=this.sourceNodes.get(r);return s&&tZ(s)},this.handleTopMoveStartCapture=r=>{zp(r)&&(this.moveStartSourceIds=[])},this.handleMoveStart=r=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(r)},this.handleTopMoveStart=r=>{if(!zp(r))return;const s=Cl(r);s&&(ow(r)&&(this.lastTargetTouchFallback=r.targetTouches[0]),this._mouseClientOffset=s),this.waitingForDelay=!1},this.handleTopMoveStartDelay=r=>{if(!zp(r))return;const s=r.type===io.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,r),s),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(r,s)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(s)},this.handleTopMove=r=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:s,dragOverTargetIds:o}=this,a=this.options.enableHoverOutsideTarget,l=Cl(r,this.lastTargetTouchFallback);if(!l)return;if(this._isScrolling||!this.monitor.isDragging()&&GI(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&s&&FI(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,l.x,l.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(s,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const c=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(c),this.actions.publishDragSource(),r.cancelable&&r.preventDefault();const u=(o||[]).map(h=>this.targetNodes.get(h)).filter(h=>!!h),d=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(l.x,l.y,u):this.document.elementsFromPoint(l.x,l.y),p=[];for(const h in d){if(!d.hasOwnProperty(h))continue;let m=d[h];for(m!=null&&p.push(m);m;)m=m.parentElement,m&&p.indexOf(m)===-1&&p.push(m)}const f=p.filter(h=>u.indexOf(h)>-1).map(h=>this._getDropTargetId(h)).filter(h=>!!h).filter((h,m,g)=>g.indexOf(h)===m);if(a)for(const h in this.targetNodes){const m=this.targetNodes.get(h);if(c&&m&&m.contains(c)&&f.indexOf(h)===-1){f.unshift(h);break}}f.reverse(),this.actions.hover(f,{clientOffset:l})},this._getDropTargetId=r=>{const s=this.targetNodes.keys();let o=s.next();for(;o.done===!1;){const a=o.value;if(r===this.targetNodes.get(a))return a;o=s.next()}},this.handleTopMoveEndCapture=r=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!KI(r)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}r.cancelable&&r.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=r=>{r.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new UI(i,n),this.actions=e.getActions(),this.monitor=e.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(gi.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(gi.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(gi.keyboard)}}const iZ=function(e,n={},i={}){return new ro(e,n,i)};var qt=function(){return qt=Object.assign||function(e){for(var n,i=1,r=arguments.length;i<r;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},qt.apply(this,arguments)};function ht(t,e,n){if(n||arguments.length===2)for(var i=0,r=e.length,s;i<r;i++)(s||!(i in e))&&(s||(s=Array.prototype.slice.call(e,0,i)),s[i]=e[i]);return t.concat(s||Array.prototype.slice.call(e))}function rZ(t){var e=t.isVisible,n=t.ease,i=n===void 0?"easeIn":n,r=t.duration,s=t.variants,o=s===void 0?{open:{opacity:1,height:"auto"},close:{opacity:0,height:0}}:s,a=t.children,l=D_({polyfill:nD}),c=l[0],u=l[1].height,d=P.useState(e),p=d[0],f=d[1],h=P.useState(e),m=h[0],g=h[1],O=P.useState(!1),v=O[0],x=O[1],b=function(){x(!1),e||f(!1)};return P.useEffect(function(){x(!0),e?f(!0):g(!1)},[e]),P.useEffect(function(){p&&g(!0)},[u]),P.createElement(j_.div,{style:v?{overflow:"hidden"}:void 0,onAnimationComplete:b,initial:m?"open":"close",animate:m?"open":"close",inherit:!1,variants:o,transition:{ease:i,duration:sZ(u,r)}},P.createElement("div",{ref:c},p&&a))}function sZ(t,e){if(e)return e;if(!t)return 0;var n=t/36;return Math.round((4+10*Math.pow(n,.25)+n/5)*10)/1500}var oZ=function(t,e){return t.text>e.text?1:t.text<e.text?-1:0},so=function(t,e){return t.find(function(n){return n.id===e})},lw=function(t,e,n){if(n===0)return!1;var i=t.find(function(r){return r.id===n});return i===void 0?!1:i.parent===e?!0:lw(t,e,i.parent)},Yp=function(t){return t.id!==void 0&&t.parent!==void 0&&t.text!==void 0},vi=function(t,e,n){var i=n.tree,r=n.rootId,s=n.canDrop;if(t===null){if(e===r)return!0;var o=i.find(function(u){return u.id===e});return!!(o&&o.droppable)}else{var a=Yp(t)?t.id:null;if(s){var l=s(a,e);if(l!==void 0)return l}if(a===e)return!1;var c=i.find(function(d){return d.id===a}),o=i.find(function(d){return d.id===e});return c===void 0||a===null?e===r||!!(o!=null&&o.droppable):o===void 0?c.parent!==0:c.parent===e||!o.droppable?!1:!lw(i,a,e)}},aZ=function(t,e,n){return t.map(function(i){return i.id===e?qt(qt({},i),{parent:n}):i})},cw=function(t,e,n){if(n===0)return 0;var i=t.filter(function(r){return r.parent===e});return i[n]?t.findIndex(function(r){return r.id===i[n].id}):t.findIndex(function(r){return r.id===i[n-1].id})+1},lZ=function(t,e){return t.findIndex(function(n){return n.id===e})},uw=function(t,e,n,i){var r=lZ(t,e),s=cw(t,n,i);return s=s>r?s-1:s,[r,s]},cZ=function(t,e,n){var i=e<0?t.length+e:e;if(i>=0&&i<t.length){var r=n<0?t.length+n:n,s=t.splice(e,1)[0];t.splice(r,0,s)}},uZ=function(t,e,n,i){var r=uw(t,e,n,i),s=r[0],o=r[1],a=ht([],t,!0);return cZ(a,s,o),a.map(function(l){return l.id===e?qt(qt({},l),{parent:n}):l})},dZ=function(t,e){var n=t.getBoundingClientRect(),i=n.top+n.height/2;return e>i?"down":"up"},Bp=function(t,e){var n="",i=0;return t.forEach(function(r,s){var o,a=dZ(r,((o=e.getClientOffset())===null||o===void 0?void 0:o.y)||0);n===""?n=a:n!==a&&(n=a,i=s),s===t.length-1&&a==="down"&&(i=s+1)}),i},dw=function(t,e,n){var i=e.closest('[role="list"]'),r=i==null?void 0:i.querySelectorAll(':scope > [role="listitem"]');return r?Bp(r,n):null},pZ=function(t,e,n){var i=t.getBoundingClientRect(),r=n.dropTargetOffset,s=i.top+r,o=i.bottom-r;return e>o?"lower":e<s?"upper":"middle"},Up=function(t,e,n,i){var r;if(!e)return null;if(t===null){var s=e.querySelectorAll(':scope > [role="listitem"]');return{id:i.rootId,index:Bp(s,n)}}var o=n.getItem(),a=e.querySelector('[role="list"]'),l=pZ(e,((r=n.getClientOffset())===null||r===void 0?void 0:r.y)||0,i);if(a){if(l==="upper")if(vi(o,t.parent,i)){var c=dw(t,e,n);return c===null?null:{id:t.parent,index:c}}else return{id:t.id,index:0};var s=a.querySelectorAll(':scope > [role="listitem"]');return{id:t.id,index:Bp(s,n)}}else{if(l==="middle")return{id:t.id,index:0};if(vi(o,t.parent,i)){var c=dw(t,e,n);return c===null?null:{id:t.parent,index:c}}return null}},fZ=function(t){return t===void 0&&(t={}),{backends:[{id:"html5",backend:RA,options:t.html5,transition:BI},{id:"touch",backend:iZ,options:t.touch||{enableMouseEvents:!0},preview:!0,transition:YI}]}},El=function(t,e){return t.some(function(n){return n.parent===e})},pw=P.createContext({}),hZ=function(t){var e=SZ(t.tree,t.initialOpen),n=e[0],i=e[1],r=i.handleToggle,s=i.handleCloseAll,o=i.handleOpenAll,a=i.handleOpen,l=i.handleClose;P.useImperativeHandle(t.treeRef,function(){return{open:function(f){return a(f,t.onChangeOpen)},close:function(f){return l(f,t.onChangeOpen)},openAll:function(){return o(t.onChangeOpen)},closeAll:function(){return s(t.onChangeOpen)}}});var c=Vn().getMonitor(),u=t.canDrop,d=t.canDrag,p=qt(qt({extraAcceptTypes:[],listComponent:"ul",listItemComponent:"li",placeholderComponent:"li",sort:!0,insertDroppableFirst:!0,enableAnimateExpand:!1,dropTargetOffset:0,initialOpen:!1},t),{openIds:n,onDrop:function(f,h,m){if(f){var g={dragSourceId:f.id,dropTargetId:h,dragSource:f,dropTarget:so(t.tree,h),monitor:c},O=t.tree;if(so(O,f.id)||(O=ht(ht([],O,!0),[f],!1)),t.sort===!1){var v=uw(O,f.id,h,m),x=v[1];g.destinationIndex=x,g.relativeIndex=m,t.onDrop(uZ(O,f.id,h,m),g);return}t.onDrop(aZ(O,f.id,h),g)}else{var g={dropTargetId:h,dropTarget:so(t.tree,h),monitor:c};t.sort===!1&&(g.destinationIndex=cw(t.tree,h,m),g.relativeIndex=m),t.onDrop(t.tree,g)}},canDrop:u?function(f,h){return u(t.tree,{dragSourceId:f??void 0,dropTargetId:h,dragSource:c.getItem(),dropTarget:so(t.tree,h),monitor:c})}:void 0,canDrag:d?function(f){return d(so(t.tree,f))}:void 0,onToggle:function(f){return r(f,t.onChangeOpen)}});return P.createElement(pw.Provider,{value:p},t.children)},fw=P.createContext({}),mZ={isLock:!1},gZ=function(t){var e=P.useState(mZ.isLock),n=e[0],i=e[1];return P.createElement(fw.Provider,{value:{isLock:n,lock:function(){return i(!0)},unlock:function(){return i(!1)}}},t.children)},oo=P.createContext({}),jl={dropTargetId:void 0,index:void 0},vZ=function(t){var e=P.useState(jl.dropTargetId),n=e[0],i=e[1],r=P.useState(jl.index),s=r[0],o=r[1],a=function(c,u){i(c),o(u)},l=function(){i(jl.dropTargetId),o(jl.index)};return P.createElement(oo.Provider,{value:{dropTargetId:n,index:s,showPlaceholder:a,hidePlaceholder:l}},t.children)},OZ=function(t){return P.createElement(hZ,qt({},t),P.createElement(gZ,null,P.createElement(vZ,null,t.children)))},xZ=function(t){var e=P.useContext(fw);P.useEffect(function(){if(t.current){var n=t.current,i=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.lock()},r=function(u){var d=u.target;(d instanceof HTMLInputElement||d instanceof HTMLTextAreaElement)&&e.unlock()},s=function(u){return i(u)},o=function(u){return r(u)},a=function(u){return i(u)},l=function(u){return r(u)},c=new MutationObserver(function(){document.activeElement===document.body&&e.unlock()});return c.observe(n,{subtree:!0,childList:!0}),n.addEventListener("mouseover",s),n.addEventListener("mouseout",o),n.addEventListener("focusin",a),n.addEventListener("focusout",l),function(){c.disconnect(),n.removeEventListener("mouseover",s),n.removeEventListener("mouseout",o),n.removeEventListener("focusin",a),n.removeEventListener("focusout",l)}}},[t,e]),P.useEffect(function(){var n;(n=t.current)===null||n===void 0||n.setAttribute("draggable",e.isLock?"false":"true")},[t,e.isLock])},Al={TREE_ITEM:Symbol()},hw=null,mw=function(t){var e=t.target;if(e instanceof HTMLElement){var n=e.closest('[role="listitem"]');t.currentTarget===n&&(hw=n)}},gw=function(t){return mw(t)},vw=function(t){return mw(t)},bZ=function(t,e){var n=Oi();P.useEffect(function(){var a=e.current;return a==null||a.addEventListener("dragstart",gw),a==null||a.addEventListener("touchstart",vw,{passive:!0}),function(){a==null||a.removeEventListener("dragstart",gw),a==null||a.removeEventListener("touchstart",vw)}},[e]);var i=TI({type:Al.TREE_ITEM,item:function(a){var l=qt({ref:e},t);return n.onDragStart&&n.onDragStart(l,a),l},end:function(a,l){var c=a;n.onDragEnd&&n.onDragEnd(c,l)},canDrag:function(){var a=n.canDrag;return hw!==e.current?!1:a?a(t.id):!0},collect:function(a){return{isDragging:a.isDragging()}}}),r=i[0].isDragging,s=i[1],o=i[2];return[r,s,o]},yZ=function(t){var e=Oi(),n=P.useContext(oo),i=Ky({accept:ht([Al.TREE_ITEM],e.extraAcceptTypes,!0),drop:function(l,c){var u=e.rootId,d=e.onDrop,p=n.dropTargetId,f=n.index;c.isOver({shallow:!0})&&p!==void 0&&f!==void 0&&d(Yp(l)?l:null,u,f),n.hidePlaceholder()},canDrop:function(l,c){var u=e.rootId;return c.isOver({shallow:!0})?l===void 0?!1:vi(l,u,e):!1},hover:function(l,c){if(c.isOver({shallow:!0})){var u=e.rootId,d=n.dropTargetId,p=n.index,f=n.showPlaceholder,h=n.hidePlaceholder,m=Up(null,t.current,c,e);if(m===null||!vi(l,u,e)){h();return}(m.id!==d||m.index!==p)&&f(m.id,m.index)}},collect:function(l){var c=l.getItem();return{isOver:l.isOver({shallow:!0})&&l.canDrop(),dragSource:c}}}),r=i[0],s=r.isOver,o=r.dragSource,a=i[1];return[s,o,a]},wZ=function(t,e){var n=Oi(),i=P.useContext(oo),r=Ky({accept:ht([Al.TREE_ITEM],n.extraAcceptTypes,!0),drop:function(c,u){var d=i.dropTargetId,p=i.index;u.isOver({shallow:!0})&&d!==void 0&&p!==void 0&&n.onDrop(Yp(c)?c:null,d,p),i.hidePlaceholder()},canDrop:function(c,u){if(u.isOver({shallow:!0})){var d=Up(t,e.current,u,n);return d===null?!1:vi(c,d.id,n)}return!1},hover:function(c,u){if(u.isOver({shallow:!0})){var d=i.dropTargetId,p=i.index,f=i.showPlaceholder,h=i.hidePlaceholder,m=Up(t,e.current,u,n);if(m===null||!vi(c,m.id,n)){h();return}(m.id!==d||m.index!==p)&&f(m.id,m.index)}},collect:function(c){var u=c.getItem();return{isOver:c.isOver({shallow:!0})&&c.canDrop(),dragSource:u}}}),s=r[0],o=s.isOver,a=s.dragSource,l=r[1];return[o,a,l]},SZ=function(t,e){var n=P.useMemo(function(){return e===!0?t.filter(function(d){return El(t,d.id)}).map(function(d){return d.id}):Array.isArray(e)?e:[]},[e]),i=P.useState(n),r=i[0],s=i[1];P.useEffect(function(){return s(n)},[e]);var o=function(d,p){var f=r.includes(d)?r.filter(function(h){return h!==d}):ht(ht([],r,!0),[d],!1);s(f),p&&p(f)},a=function(d){s([]),d&&d([])},l=function(d){var p=t.filter(function(f){return El(t,f.id)}).map(function(f){return f.id});s(p),d&&d(p)},c=function(d,p){var f=[];if(Array.isArray(d)){var h=t.filter(function(m){return d.includes(m.id)&&El(t,m.id)});f=ht(ht([],r,!0),h.map(function(m){return m.id}),!0).filter(function(m,g,O){return O.indexOf(m)===g})}else f=r.includes(d)?r:ht(ht([],r,!0),[d],!1);s(f),p&&p(f)},u=function(d,p){var f=r.filter(function(h){return Array.isArray(d)?!d.includes(h):h!==d});s(f),p&&p(f)};return[r,{handleToggle:o,handleCloseAll:a,handleOpenAll:l,handleOpen:c,handleClose:u}]},PZ=function(){return QI(function(t){var e=t.getItemType();return{item:t.getItem(),clientOffset:t.getClientOffset(),isDragging:t.isDragging()&&e===Al.TREE_ITEM}})},Oi=function(){var t=P.useContext(pw);if(!t)throw new Error("useTreeContext must be used under TreeProvider");return t},kZ=function(t,e){var n=Oi(),i=n.rootId,r=n.rootProps,s=n.classes,o=(s==null?void 0:s.container)||"";return e&&(s!=null&&s.dropTarget)&&(o="".concat(o," ").concat(s.dropTarget)),t===i&&(s!=null&&s.root)&&(o="".concat(o," ").concat(s.root)),t===i&&(r!=null&&r.className)&&(o="".concat(o," ").concat(r.className)),o=o.trim(),o},$Z=function(t,e,n){e.current?n(e):n(t),P.useEffect(function(){e.current?n(e):n(t)},[e.current])},TZ=function(t){var e=Oi(),n=P.useContext(oo),i=P.useRef(null),r=P.useRef(null),s=e.tree.find(function(T){return T.id===t.id}),o=e.openIds,a=e.classes,l=e.enableAnimateExpand,c=o.includes(t.id),u=bZ(s,i),d=u[0],p=u[1],f=u[2],h=wZ(s,i),m=h[0],g=h[1],O=h[2];$Z(i,r,p),vi(g,t.id,e)&&O(i),P.useEffect(function(){e.dragPreviewRender?f(MA(),{captureDraggingState:!0}):r.current&&f(i)},[f,e.dragPreviewRender]),xZ(i);var v=function(){return e.onToggle(s.id)},x=e.listItemComponent,b=(a==null?void 0:a.listItem)||"";m&&(a!=null&&a.dropTarget)&&(b="".concat(b," ").concat(a.dropTarget)),d&&(a!=null&&a.draggingSource)&&(b="".concat(b," ").concat(a.draggingSource));var w=e.canDrag?e.canDrag(t.id):!0,y=n.dropTargetId===t.id,k={depth:t.depth,isOpen:c,isDragging:d,isDropTarget:y,draggable:w,hasChild:El(e.tree,t.id),containerRef:i,handleRef:r,onToggle:v};return P.createElement(x,{ref:i,className:b,role:"listitem"},e.render(s,k),l&&k.hasChild&&P.createElement(rZ,{isVisible:c},P.createElement(Fp,{parentId:t.id,depth:t.depth+1})),!l&&k.hasChild&&c&&P.createElement(Fp,{parentId:t.id,depth:t.depth+1}))},Ow=function(t){var e=Oi(),n=e.placeholderRender,i=e.placeholderComponent,r=e.classes,s=P.useContext(oo),o=Vn(),a=o.getMonitor(),l=a.getItem();if(!n||!l)return null;var c=t.dropTargetId===s.dropTargetId&&(t.index===s.index||t.index===void 0&&t.listCount===s.index);return c?P.createElement(i,{className:(r==null?void 0:r.placeholder)||""},n(l,{depth:t.depth})):null},Fp=function(t){var e=Oi(),n=P.useRef(null),i=e.tree.filter(function(m){return m.parent===t.parentId}),r=i,s=typeof e.sort=="function"?e.sort:oZ;if(e.insertDroppableFirst){var o=i.filter(function(m){return m.droppable}),a=i.filter(function(m){return!m.droppable});e.sort===!1?r=ht(ht([],o,!0),a,!0):(o=o.sort(s),a=a.sort(s),r=ht(ht([],o,!0),a,!0))}else e.sort!==!1&&(r=i.sort(s));var l=yZ(n),c=l[0],u=l[1],d=l[2];t.parentId===e.rootId&&vi(u,e.rootId,e)&&d(n);var p=kZ(t.parentId,c),f=e.rootProps||{},h=e.listComponent;return P.createElement(h,qt({ref:n,role:"list"},f,{className:p}),r.map(function(m,g){return P.createElement(P.Fragment,{key:m.id},P.createElement(Ow,{depth:t.depth,listCount:r.length,dropTargetId:t.parentId,index:g}),P.createElement(TZ,{id:m.id,depth:t.depth}))}),P.createElement(Ow,{depth:t.depth,listCount:r.length,dropTargetId:t.parentId}))},QZ={height:"100%",left:0,pointerEvents:"none",position:"fixed",top:0,width:"100%",zIndex:100},CZ=function(t){var e=t.clientOffset;if(!e)return{};var n=e.x,i=e.y,r="translate(".concat(n,"px, ").concat(i,"px)");return{pointerEvents:"none",transform:r}},EZ=function(){var t=Oi(),e=PZ(),n=e.isDragging,i=e.clientOffset;return!n||!i?null:P.createElement("div",{style:QZ},P.createElement("div",{style:CZ(e)},t.dragPreviewRender&&t.dragPreviewRender(e)))};function jZ(t,e){return P.createElement(OZ,qt({},t,{treeRef:e}),t.dragPreviewRender&&P.createElement(EZ,null),P.createElement(Fp,{parentId:t.rootId,depth:0}))}var AZ=P.forwardRef(jZ);const DZ=({onSubmit:t,onBlur:e,isDirectory:n,files:i,currentPath:r="/"})=>{const[s,o]=P.useState(""),a=P.useRef(null),[l,c]=P.useState(!1);P.useEffect(()=>{s&&(i[`${r}/${s}`]||i[`${r}/${s}/`])?c(!0):c(!1)},[s]);const u=f=>{f.preventDefault()},d=()=>{if(s){let f=s;n&&!s.endsWith("/")?f=`${s}/`:s.endsWith("/")&&(f=s.substring(0,-1)),t(f),o("")}else e()},p=f=>{if(l)return;let h=s;n&&!s.endsWith("/")?h=`${s}/`:s.endsWith("/")&&(h=s.substring(0,-1)),f.key==="Enter"&&(f.preventDefault(),t(h),o("")),f.key==="Escape"&&(f.preventDefault(),d())};return S.jsxs("form",{ref:a,onSubmit:u,children:[S.jsx("label",{children:S.jsx("input",{style:{maxWidth:"100%",border:`1px solid ${l?"red":"inherit"}`},onBlur:d,maxLength:35,autoFocus:!0,placeholder:`${n?"Directory name":"File name"}`,name:"name",type:"text",value:s,onChange:f=>o(f.target.value),onKeyDown:p})}),l?S.jsx("span",{style:{display:"block",maxWidth:"100%",background:"var(--sp-colors-errorSurface)",color:"var(--sp-colors-error)",borderRadius:"3px"},children:"File or Directory already exists"}):null]})},xw=({dir:t})=>{const{sandpack:e}=Ce(),{addFile:n}=yx();return S.jsx("span",{style:{cursor:"pointer"},onClick:()=>{const i=e.activeFile.split("/").slice(0,-1).join("/");n({[`${i}/${t?"addDir":"addFile"}`]:{code:".emptyDir",hidden:!0}})},children:t?S.jsx(ZO,{}):S.jsx(NO,{})})},MZ=()=>{const{treeData:t,addFile:e,deleteFile:n,onFileMoved:i,setTreeData:r,openDirs:s,setOpenDirs:o}=yx(),{sandpack:a}=Ce(),l=["/package.json"],c=async(d,p)=>{var m,g,O,v;const f=Ox(a.files),h=`/${Ni({parent:p.dropTargetId,text:((m=p==null?void 0:p.dragSource)==null?void 0:m.text)||p.dragSourceId},d)}`;a.files[h],!([...l,f].includes(((O=(g=p==null?void 0:p.dragSource)==null?void 0:g.data)==null?void 0:O.path)||"")||((v=p.dragSource)==null?void 0:v.parent)===p.dropTargetId||a.files[h])&&(await i({newTree:d,node:p}),r(d))},u=Ox(a.files);return S.jsx(S.Fragment,{children:S.jsx(rI,{backend:zI,options:fZ(),children:S.jsxs("div",{style:{minHeight:"100%",maxHeight:"100%",height:"var(--sp-layout-height)",minWidth:"200px",overflowY:"auto",overflowX:"hidden",position:"relative",display:"flex",flexDirection:"column",padding:"var(--sp-space-1) var(--sp-space-3)",backgroundColor:"var(--sp-colors-surface1, #011627)"},children:[S.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",alignItems:"center",minHeight:"40px"},children:[S.jsx("span",{children:"Files"}),S.jsxs("div",{style:{display:"flex"},children:[S.jsx(xw,{}),S.jsx(xw,{dir:!0})]})]}),S.jsx(AZ,{tree:t.filter(({text:d})=>!!d),rootId:"/",onDrop:c,rootProps:{style:{listStyle:"none",padding:"0",height:"100%"}},classes:{root:"test"},enableAnimateExpand:!0,insertDroppableFirst:!0,sort:!0,initialOpen:s,render:(d,{depth:p,isOpen:f})=>{var h,m,g,O;return d.text?S.jsxs("div",{style:{marginLeft:p*10,display:"flex",justifyContent:"space-between",maxWidth:"300px",overflow:"hidden",padding:"var(--sp-space-1) 0",transition:"color var(--sp-transitions-default), background var(--sp-transitions-default)"},children:[d.text.includes("addFile")||d.text.includes("addDir")?S.jsx(DZ,{files:a.files,onBlur:()=>{var v;return n(`${(v=d==null?void 0:d.data)==null?void 0:v.path}`)},isDirectory:d.text.includes("addDir"),currentPath:(h=d==null?void 0:d.data)==null?void 0:h.path.split("/").slice(0,-1).join("/"),onSubmit:async v=>{var w;const b=`${(w=d==null?void 0:d.data)==null?void 0:w.path.split("/").slice(0,-1).join("/")}/${v}`;await e({[b]:{code:d.text.includes("addDir")?".emptyDir":`// ${v}`,hidden:d.text.includes("addDir")}})}}):null,d.text&&!d.text.includes("addFile")&&!d.text.includes("addDir")?S.jsxs(S.Fragment,{children:[d.droppable?S.jsxs("span",{style:{color:"var(--sp-colors-clickable)",display:"flex",cursor:"pointer"},onClick:()=>{o(f?v=>v.filter(x=>x!==d.id):v=>[...v,d.id])},children:[f?S.jsx(ZO,{}):S.jsx(f2,{}),d.text,f?"[-] ":"[+] "]}):S.jsxs("span",{style:{display:"flex"},children:[S.jsx("span",{style:{minWidth:"16px",minHeight:"16px"},children:S.jsx(NO,{})}),S.jsx("span",{style:{textOverflow:"ellipsis",maxWidth:"200px",overflow:"hidden",cursor:"pointer",color:`${((m=d==null?void 0:d.data)==null?void 0:m.path)===a.activeFile?"var(--sp-colors-accent)":"var(--sp-colors-clickable)"}`,display:"flex"},onClick:()=>{var v;return a.openFile((v=d==null?void 0:d.data)==null?void 0:v.path)},children:d.text})]}),[u,"/package.json"].includes(((g=d==null?void 0:d.data)==null?void 0:g.path)??"")?S.jsx("span",{style:{color:"var(--sp-colors-warning)"},children:((O=d==null?void 0:d.data)==null?void 0:O.path)===u?"entry":""}):S.jsx("button",{style:{background:"none",border:"none",cursor:"pointer"},onClick:async()=>{var v;await n(`${(v=d==null?void 0:d.data)==null?void 0:v.path}${d.droppable?"/":""}`)},children:S.jsx(LO,{})})]}):null]},d.id):S.jsx(S.Fragment,{})}})]})})})},RZ=()=>S.jsx("div",{style:{minWidth:150,maxWidth:"300px",overflow:"hidden"},children:S.jsx(MZ,{})}),_Z=t=>S.jsx(bA,{...t,children:S.jsx(RZ,{})}),IZ=({type:t="react",children:e,showConsole:n=!0,files:i,className:r,style:s,editorRef:o,...a})=>{const l=P.useRef(),c=e?P.cloneElement(e,{ref:l}):null;return S.jsxs("div",{className:r,style:s,...a,children:[c,S.jsx(ej,{template:t,theme:"dark",files:i,children:S.jsx(zO,{children:S.jsxs(xj,{children:[S.jsx(_Z,{}),S.jsx(vA,{editorRef:o}),S.jsxs("div",{children:[S.jsx(eA,{style:{height:n?"60vh":"100vh"},showOpenInCodeSandbox:!1}),n?S.jsx(mA,{style:{height:"40vh",width:"40vw"}}):""]})]})})})]})};var ZZ=Object.create,Gp=Object.defineProperty,NZ=Object.getOwnPropertyDescriptor,bw=Object.getOwnPropertyNames,LZ=Object.getPrototypeOf,XZ=Object.prototype.hasOwnProperty,VZ=(t,e,n)=>e in t?Gp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Cn=(t,e)=>function(){return e||(0,t[bw(t)[0]])((e={exports:{}}).exports,e),e.exports},WZ=(t,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of bw(e))!XZ.call(t,r)&&r!==n&&Gp(t,r,{get:()=>e[r],enumerable:!(i=NZ(e,r))||i.enumerable});return t},Rr=(t,e,n)=>(n=t!=null?ZZ(LZ(t)):{},WZ(e||!t||!t.__esModule?Gp(n,"default",{value:t,enumerable:!0}):n,t)),qZ=(t,e,n)=>(VZ(t,typeof e!="symbol"?e+"":e,n),n),Hp=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},zt=(t,e,n)=>(Hp(t,e,"read from private field"),n?n.call(t):e.get(t)),Ui=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ao=(t,e,n,i)=>(Hp(t,e,"write to private field"),i?i.call(t,n):e.set(t,n),n),on=(t,e,n)=>(Hp(t,e,"access private method"),n),yw=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/pad.js"(t,e){e.exports=function(i,r){var s="000000000"+i;return s.substr(s.length-r)}}}),zZ=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/fingerprint.browser.js"(t,e){var n=yw(),i=typeof window=="object"?window:self,r=Object.keys(i).length,s=navigator.mimeTypes?navigator.mimeTypes.length:0,o=n((s+navigator.userAgent.length).toString(36)+r.toString(36),4);e.exports=function(){return o}}}),YZ=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/lib/getRandomValue.browser.js"(t,e){var n,i=typeof window<"u"&&(window.crypto||window.msCrypto)||typeof self<"u"&&self.crypto;i?(r=Math.pow(2,32)-1,n=function(){return Math.abs(i.getRandomValues(new Uint32Array(1))[0]/r)}):n=Math.random;var r;e.exports=n}}),ww=Cn({"../../node_modules/.pnpm/cuid@2.1.8/node_modules/cuid/index.js"(t,e){var n=zZ(),i=yw(),r=YZ(),s=0,o=4,a=36,l=Math.pow(a,o);function c(){return i((r()*l<<0).toString(a),o)}function u(){return s=s<l?s:0,s++,s-1}function d(){var p="c",f=new Date().getTime().toString(a),h=i(u().toString(a),o),m=n(),g=c()+c();return p+f+h+m+g}d.slug=function(){var f=new Date().getTime().toString(36),h=u().toString(36).slice(-4),m=n().slice(0,1)+n().slice(-1),g=c().slice(-2);return f.slice(-2)+h+m+g},d.isCuid=function(f){return typeof f!="string"?!1:!!f.startsWith("c")},d.isSlug=function(f){if(typeof f!="string")return!1;var h=f.length;return h>=7&&h<=10},d.fingerprint=n,e.exports=d}}),Sw=Cn({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/createDeferredExecutor.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createDeferredExecutor=void 0;function e(){const n=(i,r)=>{n.state="pending",n.resolve=s=>{if(n.state!=="pending")return;n.result=s;const o=a=>(n.state="fulfilled",a);return i(s instanceof Promise?s:Promise.resolve(s).then(o))},n.reject=s=>{if(n.state==="pending")return queueMicrotask(()=>{n.state="rejected"}),r(n.rejectionReason=s)}};return n}t.createDeferredExecutor=e}}),BZ=Cn({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/DeferredPromise.js"(t){var i,r,Ll,o;Object.defineProperty(t,"__esModule",{value:!0}),t.DeferredPromise=void 0;var e=Sw(),n=(o=class extends Promise{constructor(l=null){const c=(0,e.createDeferredExecutor)();super((u,d)=>{c(u,d),l==null||l(c.resolve,c.reject)});uf(this,r);uf(this,i,void 0);Ze(this,"resolve");Ze(this,"reject");e1(this,i,c),this.resolve=co(this,i).resolve,this.reject=co(this,i).reject}get state(){return co(this,i).state}get rejectionReason(){return co(this,i).rejectionReason}then(l,c){return Nl(this,r,Ll).call(this,super.then(l,c))}catch(l){return Nl(this,r,Ll).call(this,super.catch(l))}finally(l){return Nl(this,r,Ll).call(this,super.finally(l))}},i=new WeakMap,r=new WeakSet,Ll=function(l){return Object.defineProperties(l,{resolve:{configurable:!0,value:this.resolve},reject:{configurable:!0,value:this.reject}})},o);t.DeferredPromise=n}}),Jp=Cn({"../../node_modules/.pnpm/@open-draft+deferred-promise@2.1.0/node_modules/@open-draft/deferred-promise/build/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(i,r,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(r,s);(!a||("get"in a?!r.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return r[s]}}),Object.defineProperty(i,o,a)}:function(i,r,s,o){o===void 0&&(o=s),i[o]=r[s]}),n=t&&t.__exportStar||function(i,r){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(r,s)&&e(r,i,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(Sw(),t),n(BZ(),t)}}),Pw=Cn({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/MemoryLeakError.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryLeakError=void 0;var e=class extends Error{constructor(i,r,s){super(`Possible EventEmitter memory leak detected. ${s} ${r.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`);Ze(this,"emitter");Ze(this,"type");Ze(this,"count");this.emitter=i,this.type=r,this.count=s,this.name="MaxListenersExceededWarning"}};t.MemoryLeakError=e}}),UZ=Cn({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/Emitter.js"(t){Object.defineProperty(t,"__esModule",{value:!0}),t.Emitter=void 0;var e=Pw(),n,i,r,s,o,a,l,c,u,d,p,f=class{constructor(){Ui(this,s),Ui(this,a),Ui(this,c),Ui(this,d),Ui(this,n,void 0),Ui(this,i,void 0),Ui(this,r,void 0),ao(this,n,new Map),ao(this,i,f.defaultMaxListeners),ao(this,r,!1)}static listenerCount(m,g){return m.listenerCount(g)}setMaxListeners(m){return ao(this,i,m),this}getMaxListeners(){return zt(this,i)}eventNames(){return Array.from(zt(this,n).keys())}emit(m,...g){const O=on(this,s,o).call(this,m);return O.forEach(v=>{v.apply(this,g)}),O.length>0}addListener(m,g){on(this,d,p).call(this,"newListener",m,g);const O=on(this,s,o).call(this,m).concat(g);if(zt(this,n).set(m,O),zt(this,i)>0&&this.listenerCount(m)>zt(this,i)&&!zt(this,r)){ao(this,r,!0);const v=new e.MemoryLeakError(this,m,this.listenerCount(m));console.warn(v)}return this}on(m,g){return this.addListener(m,g)}once(m,g){return this.addListener(m,on(this,c,u).call(this,m,g))}prependListener(m,g){const O=on(this,s,o).call(this,m);if(O.length>0){const v=[g].concat(O);zt(this,n).set(m,v)}else zt(this,n).set(m,O.concat(g));return this}prependOnceListener(m,g){return this.prependListener(m,on(this,c,u).call(this,m,g))}removeListener(m,g){const O=on(this,s,o).call(this,m);return O.length>0&&(on(this,a,l).call(this,O,g),zt(this,n).set(m,O),on(this,d,p).call(this,"removeListener",m,g)),this}off(m,g){return this.removeListener(m,g)}removeAllListeners(m){return m?zt(this,n).delete(m):zt(this,n).clear(),this}listeners(m){return Array.from(on(this,s,o).call(this,m))}listenerCount(m){return on(this,s,o).call(this,m).length}rawListeners(m){return this.listeners(m)}},h=f;n=new WeakMap,i=new WeakMap,r=new WeakMap,s=new WeakSet,o=function(m){return zt(this,n).get(m)||[]},a=new WeakSet,l=function(m,g){const O=m.indexOf(g);return O>-1&&m.splice(O,1),[]},c=new WeakSet,u=function(m,g){const O=(...v)=>{this.removeListener(m,O),g.apply(this,v)};return O},d=new WeakSet,p=function(m,g,O){this.emit(m,g,O)},qZ(h,"defaultMaxListeners",10),t.Emitter=h}}),FZ=Cn({"../../node_modules/.pnpm/strict-event-emitter@0.4.3/node_modules/strict-event-emitter/lib/index.js"(t){var e=t&&t.__createBinding||(Object.create?function(i,r,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(r,s);(!a||("get"in a?!r.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return r[s]}}),Object.defineProperty(i,o,a)}:function(i,r,s,o){o===void 0&&(o=s),i[o]=r[s]}),n=t&&t.__exportStar||function(i,r){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(r,s)&&e(r,i,s)};Object.defineProperty(t,"__esModule",{value:!0}),n(UZ(),t),n(Pw(),t)}}),GZ=Rr(ww()),HZ=/(%?)(%([sdjo]))/g;function JZ(t,e){switch(e){case"s":return t;case"d":case"i":return Number(t);case"j":return JSON.stringify(t);case"o":{if(typeof t=="string")return t;const n=JSON.stringify(t);return n==="{}"||n==="[]"||/^\[object .+?\]$/.test(n)?t:n}}}function Ct(t,...e){if(e.length===0)return t;let n=0,i=t.replace(HZ,(r,s,o,a)=>{const l=e[n],c=JZ(l,a);return s?r:(n++,c)});return n<e.length&&(i+=` ${e.slice(n).join(" ")}`),i=i.replace(/%{2,2}/g,"%"),i}var KZ=2;function eN(t){if(!t.stack)return;const e=t.stack.split(`
|
|
761
761
|
`);e.splice(1,KZ),t.stack=e.join(`
|
|
762
762
|
`)}var tN=class extends Error{constructor(t,...e){super(t),this.message=t,this.name="Invariant Violation",this.message=Ct(t,...e),eN(this)}},Wn=(t,e,...n)=>{if(!t)throw new tN(e,...n)};Wn.as=(t,e,n,...i)=>{if(!e)throw t.prototype.name!=null?new t(Ct(n,i)):t(Ct(n,i))};var Kp=Rr(Jp()),nN=window.localStorage.CSB_EMULATOR_DEBUG,iN="\x1B[0m",rN="\x1B[32;1m",sN="\x1B[31m",oN="\x1B[34m",aN="\x1B[33;1m",lN="\x1B[35;1m",kw="\x1B[36;1m",cN={preview:aN,emulator:lN,runtime:kw,bridge:oN,"runtime:worker":kw};function $w(t){return function(n,...i){if(nN==="true"){const r=()=>n.includes("sender")?`${rN}sender`:n.includes("receiver")?`${sN}receiver`:"",s=n.replace(/\[.+\]:/,"");console.debug(`${cN[t]}${t}:${r()}${iN}:${s}`,...i)}}}var xi=$w("emulator"),uN=class{constructor(t){Ze(this,"emitter");Ze(this,"channel");Ze(this,"receiverPort");Ze(this,"receiverReadyPromise");this.target=t,this.emitter=new EventTarget,this.channel=new MessageChannel,this.receiverPort=this.channel.port1;const e=new Kp.DeferredPromise,n=i=>{i.data.type==="internal/ready"&&(xi("[message-sender]: runtime is ready"),e.resolve())};window.addEventListener("message",n),e.then(()=>{window.removeEventListener("message",n)}),this.receiverReadyPromise=e,this.receiverPort.onmessage=i=>{const r=i.data;r.type!=null&&(xi('[message-sender]: emitting "%s" event...',r.type,r.payload),this.emitter.dispatchEvent(new MessageEvent(r.type,{data:r.payload})))}}async handshake(){const t=new Kp.DeferredPromise;await this.receiverReadyPromise,xi("[message-sender]: sending handshake"),this.target.postMessage({type:"internal/handshake"},"*",[this.channel.port2]),this.on("internal/handshake/done",()=>{t.resolve(),clearTimeout(e)});const e=setTimeout(()=>{t.reject(new Error("MessageSender: Handshake timeout"))},5e3);return t}on(t,e,n){xi('[message-sender]: add listener "%s"',t),this.emitter.addEventListener(t,i=>{i instanceof MessageEvent&&e(i)},n)}off(t,e,n){this.emitter.removeEventListener(t,e,n)}async send(t,...e){const n=new Kp.DeferredPromise,i=(0,GZ.default)(),r=e[0]||{};xi('[message-sender]: send "%s" (%s)',t,i,r),this.receiverPort.postMessage({type:t,payload:{operationId:i,payload:r}}),xi('[message-sender]: adding done listener for "%s" (%s)',t,i);const s=a=>{const{data:l}=a;if(l.operationId===i){const c=l.listenerPayload||{};xi('[message-sender]: resolving "%s (%s) promise!',t,i),n.resolve({...c,operationId:l.operationId})}},o=a=>{const{data:l}=a;l.operationId===i&&(xi('[message-sender]: rejecting "%s (%s) promise!',t,i),n.reject(l.error))};return this.on("internal/operation/done",s),this.on("internal/operation/failed",o),n.finally(()=>{this.emitter.removeEventListener("internal/operation/done",s),this.emitter.removeEventListener("internal/operation/failed",o)})}},Tw=Rr(Jp()),dN=Rr(ww()),pN=class{constructor(t){this.channel=t}async init(t){await this.channel.send("fs/init",{files:t})}async readFile(t,e){const n=await this.channel.send("fs/readFile",{path:t,encoding:e}).catch(i=>{throw new Error(Ct('Failed to read file at path "%s"',t),{cause:i})});if(!n)throw new Error("File not found");return n.data}async writeFile(t,e,n){let i,r=!1;typeof n=="object"?(i=n.encoding,r=!!n.recursive):typeof n=="string"&&(i=n),await this.channel.send("fs/writeFile",{path:t,content:e,encoding:i,recursive:r}).catch(s=>{throw new Error(Ct('Failed to write file at path "%s"',t),{cause:s})})}async readdir(t){const e=await this.channel.send("fs/readdir",{path:t}).catch(n=>{throw new Error(Ct('Failed to read directory at path "%s"',t),{cause:n})});if(!e)throw new Error("Directory not found");return e.data}async mkdir(t,e){const n=!!(e!=null&&e.recursive);await this.channel.send("fs/mkdir",{path:t,recursive:n}).catch(i=>{throw new Error(Ct('Failed to make directory at path "%s"',t),{cause:i})})}async stat(t){const e=await this.channel.send("fs/stat",{path:t}).catch(n=>{throw new Error(Ct('Failed to stat file at path "%s"',t),{cause:n})});if(!e)throw new Error("File not found");return e.data}async rm(t,e){const{force:n,recursive:i}=e||{};await this.channel.send("fs/rm",{path:t,force:n,recursive:i}).catch(r=>{throw new Error(Ct('Failed to remove file at path "%s"',t),{cause:r})})}async watch(t,e,n){const i=(0,dN.default)();return await this.channel.send("fs/watch",{watcherId:i,includes:t,excludes:e}),this.channel.on("fs/watch-event",({data:r})=>{if(r.watcherId===i&&n){const s={...r};delete s.watcherId,n(s)}}),{dispose:()=>this.channel.send("fs/unwatch",{watcherId:i})}}},Qw=Rr(FZ()),fN=class{constructor(t){this.channel=t}create(){return new hN(this.channel)}},hN=class{constructor(t){Ze(this,"id");Ze(this,"state");Ze(this,"stdout");Ze(this,"stderr");Ze(this,"stdin");this.channel=t,this.state="running",this.stdout=new Qw.Emitter,this.stderr=new Qw.Emitter,this.stdin={write:e=>{if(!this.id)throw new Error("Failed to write to stdin, no process is currently running");return this.channel.send("shell/stdin",{data:e,workerId:this.id})}},this.forwardStdEvents()}forwardStdEvents(){this.channel.on("worker/tty",t=>{const{data:e}=t;if(e.workerId===this.id)switch(e.payload.type){case"out":{this.stdout.emit("data",e.payload.data);break}case"err":{this.stderr.emit("data",e.payload.data);break}}})}async runCommand(t,e,n={}){Wn(!this.id,'Failed to run "runCommand" on a ShellProcess: there is already a process running.');const i=await this.channel.send("shell/runCommand",{command:t,args:e,options:n});return Wn(i,'Failed to run "runCommand" on a ShellProcess: was not able to retrieve a running process.'),this.id=i.id,this.state="running",i}async on(t,e){switch(t){case"progress":{this.channel.on("worker/progress",({data:n})=>{e(n.status)});return}case"exit":{this.channel.on("worker/exit",({data:n})=>{n.workerId===this.id&&e(n.exitCode,n.error)});return}}}async kill(){Wn(this.id,'Failed to run "kill" on a ShellProcess: there is no process running. Did you forget to run it?'),this.state="idle",await this.channel.send("shell/exit",{id:this.id}).catch(t=>{throw new Error(Ct('Failed to kill shell with ID "%s"',this.id),{cause:t})}),this.id=void 0}},mN=Rr(Jp()),gN=2e4,vN=class{constructor(t){this.channel=t}async waitFor(t,e,n=gN){const i=new mN.DeferredPromise,r=setTimeout(()=>{i.reject()},n),s=await this.channel.send("preview/get/info",t).catch(a=>{i.reject(new Error(Ct('Failed to look up preview information for shell ID "%s" (port: %d)',t.sourceShellId,t.port)))}),o=s&&e(s);return o&&i.resolve({url:s.url,port:s.port,sourceShellId:s.sourceShellId}),this.channel.on("preview/port/ready",({data:a})=>{!o&&e(a)&&i.resolve({url:a.url,port:a.port,sourceShellId:a.sourceShellId})}),i.finally(()=>{clearTimeout(r)})}async getByShellId(t,e){return this.waitFor({sourceShellId:t},n=>n.sourceShellId===t,e).catch(n=>{throw new Error(Ct('Failed to get shell by ID "%s"',t),{cause:n})})}async waitForPort(t,e){return this.waitFor({port:t},n=>n.port===t,e).catch(n=>{throw new Error(Ct("Failed to await port %d",t),{cause:n})})}},ON="https://nodebox-runtime.codesandbox.io",Dl=$w("emulator"),xN=class{constructor(t){Ze(this,"channel",null);Ze(this,"isConnected");Ze(this,"url");Ze(this,"fileSystemApi",null);Ze(this,"shellApi",null);Ze(this,"previewApi",null);this.options=t,Wn(this.options.iframe,'Failed to create a Nodebox: expected "iframe" argument to be a reference to an <iframe> element but got %j',this.options.iframe),this.url=this.options.runtimeUrl||ON,this.isConnected=!1}async connect(){const{iframe:t,cdnUrl:e}=this.options;Dl("[message-sender]: Connecting to node emulator...");const n=new Tw.DeferredPromise;this.url||n.reject(new Error("Nodebox URL is missing. Did you forget to provide it when creating this Nodebox instance?")),Wn(t.contentWindow,"Failed to create a MessageChannel with the Nodebox iframe: no content window found"),this.channel=new uN(t.contentWindow);const i=new Tw.DeferredPromise;return t.setAttribute("src",this.url),t.addEventListener("load",()=>{i.resolve()},{once:!0}),t.addEventListener("error",r=>{i.reject(r.error)},{once:!0}),await i,Dl("[message-sender]: IFrame loaded..."),await this.channel.handshake(),Dl("[message-sender]: Handshake completed..."),this.channel.send("connect",{cdnUrl:e}),this.channel.on("runtime/ready",()=>{n.resolve()}),n.then(()=>{Dl("[message-sender]: Connected to runtime..."),this.isConnected=!0})}get fs(){return Wn(this.isConnected,'Failed to access the File System API: consumer is not connected. Did you forget to run "connect()"?'),this.fileSystemApi?this.fileSystemApi:(this.fileSystemApi=new pN(this.channel),this.fileSystemApi)}get shell(){return Wn(this.isConnected,'Failed to access the Shell API: consumer is not connected. Did you forget to run "connect()"?'),this.shellApi?this.shellApi:(this.shellApi=new fN(this.channel),this.shellApi)}get preview(){return Wn(this.isConnected,'Failed to access the Preview API: consumer is not connected. Did you forget to run "connect()"?'),this.previewApi?this.previewApi:(this.previewApi=new vN(this.channel),this.previewApi)}},bN="INJECT_AND_INVOKE",yN="PREVIEW_LOADED",ef=function(){function t(e,n,i){i===void 0&&(i={}),this.status="idle",this.options=i,this.sandboxSetup=n,this.iframeSelector=e}return t.prototype.updateOptions=function(e){Pi(this.options,e)||(this.options=e,this.updateSandbox())},t.prototype.updateSandbox=function(e,n){throw e===void 0&&(e=this.sandboxSetup),Error("Method not implemented")},t.prototype.destroy=function(){throw Error("Method not implemented")},t.prototype.dispatch=function(e){throw Error("Method not implemented")},t.prototype.listen=function(e){throw Error("Method not implemented")},t}(),Cw=function(){function t(){this.listeners={},this.listenersCount=0,this.channelId=Math.floor(Math.random()*1e6),this.listeners=[]}return t.prototype.cleanup=function(){this.listeners={},this.listenersCount=0},t.prototype.dispatch=function(e){Object.values(this.listeners).forEach(function(n){return n(e)})},t.prototype.listener=function(e){var n=this;if(typeof e!="function")return function(){};var i=this.listenersCount;return this.listeners[i]=e,this.listenersCount++,function(){delete n.listeners[i]}},t}();function Ew(t){return/[a-zA-Z.]/.test(t)}function jw(t){return/[a-zA-Z]/.test(t)}function wN(t){return/\s/.test(t)}function Aw(t){return/[&|]/.test(t)}function Dw(t){return/-/.test(t)}function SN(t){return/["']/.test(t)}function Mw(t){return jw(t)&&t===t.toUpperCase()}var yt;(function(t){t.OR="OR",t.AND="AND",t.PIPE="PIPE",t.Command="Command",t.Argument="Argument",t.String="String",t.EnvVar="EnvVar"})(yt||(yt={}));var PN=new Map([["&&",{type:yt.AND}],["||",{type:yt.OR}],["|",{type:yt.PIPE}],["-",{type:yt.Argument}]]);function kN(t){var e=0,n=[];function i(){for(var c="";Ew(t[e])&&e<t.length;)c+=t[e],e++;return{type:yt.Command,value:c}}function r(){for(var c="";Aw(t[e])&&e<t.length;)c+=t[e],e++;return PN.get(c)}function s(){for(var c="";(Dw(t[e])||jw(t[e]))&&e<t.length;)c+=t[e],e++;return{type:yt.Argument,value:c}}function o(){var c=t[e],u=t[e];for(e++;t[e]!==c&&e<t.length;)u+=t[e],e++;return u+=t[e],e++,{type:yt.String,value:u}}function a(){for(var c={},u=function(){for(var d="",p="";t[e]!=="="&&e<t.length;)d+=t[e],e++;for(t[e]==="="&&e++;t[e]!==" "&&e<t.length;)p+=t[e],e++;c[d]=p};Mw(t[e])&&e<t.length;)u(),e++;return{type:yt.EnvVar,value:c}}for(;e<t.length;){var l=t[e];if(wN(l)){e++;continue}switch(!0){case Mw(l):n.push(a());break;case Ew(l):n.push(i());break;case Aw(l):n.push(r());break;case Dw(l):n.push(s());break;case SN(l):n.push(o());break;default:throw new Error("Unknown character: ".concat(l))}}return n}var $N=0;function Rw(){var t=Date.now(),e=Math.round(Math.random()*1e4),n=$N+=1;return(+"".concat(t).concat(e).concat(n)).toString(16)}var Ml=function(t){return typeof t=="string"?new TextEncoder().encode(t):t},tf=function(t){return typeof t=="string"?t:new TextDecoder().decode(t)},_w=function(t){return Object.entries(t).reduce(function(e,n){var i=n[0],r=n[1];return e[i]=Ml(r.code),e},{})},TN=function(t){var e={},n=["dev","start"];try{e=JSON.parse(t).scripts}catch(o){throw ki("Could not parse package.json file: "+o.message)}Fl(e,"Failed to start. Please provide a `start` or `dev` script on the package.json");for(var i=function(o){if(n[o]in e){var a=n[o],l=e[a],c={},u="",d=[];return kN(l).forEach(function(p){var f=u==="";p.type===yt.EnvVar&&(c=p.value),p.type===yt.Command&&f&&(u=p.value),(p.type===yt.Argument||!f&&p.type===yt.Command)&&d.push(p.value)}),{value:[u,d,{env:c}]}}},r=0;r<n.length;r++){var s=i(r);if(typeof s=="object")return s.value}throw ki("Failed to start. Please provide a `start` or `dev` script on the package.json")},Iw=function(t){return typeof t=="string"?t:typeof t=="object"&&"message"in t?t.message:ki("The server could not be reached. Make sure that the node script is running and that a port has been started.")},Zw=`var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};function r(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var e={},n={};!function(t){t.__esModule=!0,t.default=["log","debug","info","warn","error","table","clear","time","timeEnd","count","assert","command","result"]}(n);var a,o={},i={};(a=i).__esModule=!0,a.default=function(){var t=function(){return(65536*(1+Math.random())|0).toString(16).substring(1)};return t()+t()+"-"+t()+"-"+t()+"-"+t()+"-"+t()+"-"+Date.now()};var u={},s={__esModule:!0};s.update=s.state=void 0,s.update=function(t){s.state=t};var f={},c={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.initialState=void 0,r.initialState={timings:{},count:{}};var n=function(){return"undefined"!=typeof performance&&performance.now?performance.now():Date.now()};r.default=function(t,a){var o,i,u;switch(void 0===t&&(t=r.initialState),a.type){case"COUNT":var s=t.count[a.name]||0;return e(e({},t),{count:e(e({},t.count),(o={},o[a.name]=s+1,o))});case"TIME_START":return e(e({},t),{timings:e(e({},t.timings),(i={},i[a.name]={start:n()},i))});case"TIME_END":var f=t.timings[a.name],c=n(),l=c-f.start;return e(e({},t),{timings:e(e({},t.timings),(u={},u[a.name]=e(e({},f),{end:c,time:l}),u))});default:return t}}}(c),function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var n=e(c),a=s;r.default=function(t){a.update(n.default(a.state,t))}}(f);var l={__esModule:!0};l.timeEnd=l.timeStart=l.count=void 0,l.count=function(t){return{type:"COUNT",name:t}},l.timeStart=function(t){return{type:"TIME_START",name:t}},l.timeEnd=function(t){return{type:"TIME_END",name:t}};var d=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};u.__esModule=!0,u.stop=u.start=void 0;var p=s,h=d(f),m=l;u.start=function(t){h.default(m.timeStart(t))},u.stop=function(t){var r=null===p.state||void 0===p.state?void 0:p.state.timings[t];return r&&!r.end?(h.default(m.timeEnd(t)),{method:"log",data:[t+": "+p.state.timings[t].time+"ms"]}):{method:"warn",data:["Timer '"+t+"' does not exist"]}};var y={},v=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};y.__esModule=!0,y.increment=void 0;var _=s,b=v(f),g=l;y.increment=function(t){return b.default(g.count(t)),{method:"log",data:[t+": "+_.state.count[t]]}};var M={},T=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n};M.__esModule=!0,M.test=void 0,M.test=function(t){for(var r=[],e=1;e<arguments.length;e++)r[e-1]=arguments[e];return!t&&(0===r.length&&r.push("console.assert"),{method:"error",data:T(["Assertion failed:"],r)})},function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)},n=t&&t.__createBinding||(Object.create?function(t,r,e,n){void 0===n&&(n=e),Object.defineProperty(t,n,{enumerable:!0,get:function(){return r[e]}})}:function(t,r,e,n){void 0===n&&(n=e),t[n]=r[e]}),a=t&&t.__setModuleDefault||(Object.create?function(t,r){Object.defineProperty(t,"default",{enumerable:!0,value:r})}:function(t,r){t.default=r}),o=t&&t.__importStar||function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var e in t)"default"!==e&&Object.prototype.hasOwnProperty.call(t,e)&&n(r,t,e);return a(r,t),r},s=t&&t.__spreadArrays||function(){for(var t=0,r=0,e=arguments.length;r<e;r++)t+=arguments[r].length;var n=Array(t),a=0;for(r=0;r<e;r++)for(var o=arguments[r],i=0,u=o.length;i<u;i++,a++)n[a]=o[i];return n},f=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var c=f(i),l=o(u),d=o(y),p=o(M);r.default=function(t,r,n){var a=n||c.default();switch(t){case"clear":return{method:t,id:a};case"count":return!!(o="string"==typeof r[0]?r[0]:"default")&&e(e({},d.increment(o)),{id:a});case"time":case"timeEnd":var o;return!!(o="string"==typeof r[0]?r[0]:"default")&&("time"===t?(l.start(o),!1):e(e({},l.stop(o)),{id:a}));case"assert":if(0!==r.length){var i=p.test.apply(p,s([r[0]],r.slice(1)));if(i)return e(e({},i),{id:a})}return!1;case"error":return{method:t,id:a,data:r.map((function(t){try{return t.stack||t}catch(r){return t}}))};default:return{method:t,id:a,data:r}}}}(o);var S={},O={};!function(t){var r;t.__esModule=!0,function(t){t[t.infinity=0]="infinity",t[t.minusInfinity=1]="minusInfinity",t[t.minusZero=2]="minusZero"}(r||(r={})),t.default={type:"Arithmetic",lookup:Number,shouldTransform:function(t,r){return"number"===t&&(r===1/0||r===-1/0||function(t){return 1/t==-1/0}(r))},toSerializable:function(t){return t===1/0?r.infinity:t===-1/0?r.minusInfinity:r.minusZero},fromSerializable:function(t){return t===r.infinity?1/0:t===r.minusInfinity?-1/0:t===r.minusZero?-0:t}}}(O);var w={};!function(t){t.__esModule=!0,t.default={type:"Function",lookup:Function,shouldTransform:function(t,r){return"function"==typeof r},toSerializable:function(t){var r="";try{r=t.toString().substring(r.indexOf("{")+1,r.lastIndexOf("}"))}catch(t){}return{name:t.name,body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){try{var r=function(){};return"string"==typeof t.name&&Object.defineProperty(r,"name",{value:t.name,writable:!1}),"string"==typeof t.body&&Object.defineProperty(r,"body",{value:t.body,writable:!1}),"string"==typeof t.proto&&(r.constructor={name:t.proto}),r}catch(r){return t}}}}(w);var A={};!function(t){var r;function e(t){for(var r={},e=0,n=t.attributes;e<n.length;e++){var a=n[e];r[a.name]=a.value}return r}t.__esModule=!0,t.default={type:"HTMLElement",shouldTransform:function(t,r){return r&&r.children&&"string"==typeof r.innerHTML&&"string"==typeof r.tagName},toSerializable:function(t){return{tagName:t.tagName.toLowerCase(),attributes:e(t),innerHTML:t.innerHTML}},fromSerializable:function(t){try{var e=(r||(r=document.implementation.createHTMLDocument("sandbox"))).createElement(t.tagName);e.innerHTML=t.innerHTML;for(var n=0,a=Object.keys(t.attributes);n<a.length;n++){var o=a[n];try{e.setAttribute(o,t.attributes[o])}catch(t){}}return e}catch(r){return t}}}}(A);var j={};!function(r){var e=t&&t.__assign||function(){return e=Object.assign||function(t){for(var r,e=1,n=arguments.length;e<n;e++)for(var a in r=arguments[e])Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a]);return t},e.apply(this,arguments)};r.__esModule=!0,r.default={type:"Map",shouldTransform:function(t,r){return r&&r.constructor&&"Map"===r.constructor.name},toSerializable:function(t){var r={};return t.forEach((function(t,e){var n="object"==typeof e?JSON.stringify(e):e;r[n]=t})),{name:"Map",body:r,proto:Object.getPrototypeOf(t).constructor.name}},fromSerializable:function(t){var r=t.body,n=e({},r);return"string"==typeof t.proto&&(n.constructor={name:t.proto}),n}}}(j);var z={};!function(t){t.__esModule=!0;var r="@t",e=/^#*@(t|r)$/,n=(0,eval)("this"),a="function"==typeof ArrayBuffer,o="function"==typeof Map,i="function"==typeof Set,u=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array"],s=Array.prototype.slice,f={serialize:function(t){return JSON.stringify(t)},deserialize:function(t){return JSON.parse(t)}},c=function(){function t(t,r){this.references=t,this.transforms=r,this.transformsMap=this._makeTransformsMap(),this.circularCandidates=[],this.circularCandidatesDescrs=[],this.circularRefCount=0}return t._createRefMark=function(t){var r=Object.create(null);return r["@r"]=t,r},t.prototype._createCircularCandidate=function(t,r,e){this.circularCandidates.push(t),this.circularCandidatesDescrs.push({parent:r,key:e,refIdx:-1})},t.prototype._applyTransform=function(t,e,n,a){var o=Object.create(null),i=a.toSerializable(t);return"object"==typeof i&&this._createCircularCandidate(t,e,n),o[r]=a.type,o.data=this._handleValue((function(){return i}),e,n),o},t.prototype._handleArray=function(t){for(var r=[],e=function(e){r[e]=n._handleValue((function(){return t[e]}),r,e)},n=this,a=0;a<t.length;a++)e(a);return r},t.prototype._handlePlainObject=function(t){var r,n,a=Object.create(null),o=function(r){if(Reflect.has(t,r)){var n=e.test(r)?"#"+r:r;a[n]=i._handleValue((function(){return t[r]}),a,n)}},i=this;for(var u in t)o(u);var s=null===(n=null===(r=null==t?void 0:t.__proto__)||void 0===r?void 0:r.constructor)||void 0===n?void 0:n.name;return s&&"Object"!==s&&(a.constructor={name:s}),a},t.prototype._handleObject=function(t,r,e){return this._createCircularCandidate(t,r,e),Array.isArray(t)?this._handleArray(t):this._handlePlainObject(t)},t.prototype._ensureCircularReference=function(r){var e=this.circularCandidates.indexOf(r);if(e>-1){var n=this.circularCandidatesDescrs[e];return-1===n.refIdx&&(n.refIdx=n.parent?++this.circularRefCount:0),t._createRefMark(n.refIdx)}return null},t.prototype._handleValue=function(t,r,e){try{var n=t(),a=typeof n,o="object"===a&&null!==n;if(o){var i=this._ensureCircularReference(n);if(i)return i}var u=this._findTransform(a,n);return u?this._applyTransform(n,r,e,u):o?this._handleObject(n,r,e):n}catch(t){try{return this._handleValue((function(){return t instanceof Error?t:new Error(t)}),r,e)}catch(t){return null}}},t.prototype._makeTransformsMap=function(){if(o){var t=new Map;return this.transforms.forEach((function(r){r.lookup&&t.set(r.lookup,r)})),t}},t.prototype._findTransform=function(t,r){if(o&&r&&r.constructor&&(null==(a=this.transformsMap.get(r.constructor))?void 0:a.shouldTransform(t,r)))return a;for(var e=0,n=this.transforms;e<n.length;e++){var a;if((a=n[e]).shouldTransform(t,r))return a}},t.prototype.transform=function(){for(var r=this,e=[this._handleValue((function(){return r.references}),null,null)],n=0,a=this.circularCandidatesDescrs;n<a.length;n++){var o=a[n];o.refIdx>0&&(e[o.refIdx]=o.parent[o.key],o.parent[o.key]=t._createRefMark(o.refIdx))}return e},t}(),l=function(){function t(t,r){this.activeTransformsStack=[],this.visitedRefs=Object.create(null),this.references=t,this.transformMap=r}return t.prototype._handlePlainObject=function(t){var r=Object.create(null);for(var n in"constructor"in t&&(t.constructor&&"string"==typeof t.constructor.name||(t.constructor={name:"Object"})),t)t.hasOwnProperty(n)&&(this._handleValue(t[n],t,n),e.test(n)&&(r[n.substring(1)]=t[n],delete t[n]));for(var a in r)t[a]=r[a]},t.prototype._handleTransformedObject=function(t,e,n){var a=t[r],o=this.transformMap[a];if(!o)throw new Error("Can't find transform for \\""+a+'" type.');this.activeTransformsStack.push(t),this._handleValue(t.data,t,"data"),this.activeTransformsStack.pop(),e[n]=o.fromSerializable(t.data)},t.prototype._handleCircularSelfRefDuringTransform=function(t,r,e){var n=this.references;Object.defineProperty(r,e,{val:void 0,configurable:!0,enumerable:!0,get:function(){return void 0===this.val&&(this.val=n[t]),this.val},set:function(t){this.val=t}})},t.prototype._handleCircularRef=function(t,r,e){this.activeTransformsStack.includes(this.references[t])?this._handleCircularSelfRefDuringTransform(t,r,e):(this.visitedRefs[t]||(this.visitedRefs[t]=!0,this._handleValue(this.references[t],this.references,t)),r[e]=this.references[t])},t.prototype._handleValue=function(t,e,n){if("object"==typeof t&&null!==t){var a=t["@r"];if(void 0!==a)this._handleCircularRef(a,e,n);else if(t[r])this._handleTransformedObject(t,e,n);else if(Array.isArray(t))for(var o=0;o<t.length;o++)this._handleValue(t[o],t,o);else this._handlePlainObject(t)}},t.prototype.transform=function(){return this.visitedRefs[0]=!0,this._handleValue(this.references[0],this.references,0),this.references[0]},t}(),d=[{type:"[[NaN]]",shouldTransform:function(t,r){return"number"===t&&isNaN(r)},toSerializable:function(){return""},fromSerializable:function(){return NaN}},{type:"[[undefined]]",shouldTransform:function(t){return"undefined"===t},toSerializable:function(){return""},fromSerializable:function(){}},{type:"[[Date]]",lookup:Date,shouldTransform:function(t,r){return r instanceof Date},toSerializable:function(t){return t.getTime()},fromSerializable:function(t){var r=new Date;return r.setTime(t),r}},{type:"[[RegExp]]",lookup:RegExp,shouldTransform:function(t,r){return r instanceof RegExp},toSerializable:function(t){var r={src:t.source,flags:""};return t.globalThis&&(r.flags+="g"),t.ignoreCase&&(r.flags+="i"),t.multiline&&(r.flags+="m"),r},fromSerializable:function(t){return new RegExp(t.src,t.flags)}},{type:"[[Error]]",lookup:Error,shouldTransform:function(t,r){return r instanceof Error},toSerializable:function(t){var r,e;return t.stack||null===(e=(r=Error).captureStackTrace)||void 0===e||e.call(r,t),{name:t.name,message:t.message,stack:t.stack}},fromSerializable:function(t){var r=new(n[t.name]||Error)(t.message);return r.stack=t.stack,r}},{type:"[[ArrayBuffer]]",lookup:a&&ArrayBuffer,shouldTransform:function(t,r){return a&&r instanceof ArrayBuffer},toSerializable:function(t){var r=new Int8Array(t);return s.call(r)},fromSerializable:function(t){if(a){var r=new ArrayBuffer(t.length);return new Int8Array(r).set(t),r}return t}},{type:"[[TypedArray]]",shouldTransform:function(t,r){if(a)return ArrayBuffer.isView(r)&&!(r instanceof DataView);for(var e=0,o=u;e<o.length;e++){var i=o[e];if("function"==typeof n[i]&&r instanceof n[i])return!0}return!1},toSerializable:function(t){return{ctorName:t.constructor.name,arr:s.call(t)}},fromSerializable:function(t){return"function"==typeof n[t.ctorName]?new n[t.ctorName](t.arr):t.arr}},{type:"[[Map]]",lookup:o&&Map,shouldTransform:function(t,r){return o&&r instanceof Map},toSerializable:function(t){var r=[];return t.forEach((function(t,e){r.push(e),r.push(t)})),r},fromSerializable:function(t){if(o){for(var r=new Map,e=0;e<t.length;e+=2)r.set(t[e],t[e+1]);return r}for(var n=[],a=0;a<t.length;a+=2)n.push([t[e],t[e+1]]);return n}},{type:"[[Set]]",lookup:i&&Set,shouldTransform:function(t,r){return i&&r instanceof Set},toSerializable:function(t){var r=[];return t.forEach((function(t){r.push(t)})),r},fromSerializable:function(t){if(i){for(var r=new Set,e=0;e<t.length;e++)r.add(t[e]);return r}return t}}],p=function(){function t(t){this.transforms=[],this.transformsMap=Object.create(null),this.serializer=t||f,this.addTransforms(d)}return t.prototype.addTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r];if(this.transformsMap[n.type])throw new Error('Transform with type "'+n.type+'" was already added.');this.transforms.push(n),this.transformsMap[n.type]=n}return this},t.prototype.removeTransforms=function(t){for(var r=0,e=t=Array.isArray(t)?t:[t];r<e.length;r++){var n=e[r],a=this.transforms.indexOf(n);a>-1&&this.transforms.splice(a,1),delete this.transformsMap[n.type]}return this},t.prototype.encode=function(t){var r=new c(t,this.transforms).transform();return this.serializer.serialize(r)},t.prototype.decode=function(t){var r=this.serializer.deserialize(t);return new l(r,this.transformsMap).transform()},t}();t.default=p}(z);var E=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};S.__esModule=!0,S.Decode=P=S.Encode=void 0;var k=E(O),C=E(w),D=E(A),I=E(j),N=E(z),R=[D.default,C.default,k.default,I.default],x=new N.default;x.addTransforms(R);var P=S.Encode=function(t){return JSON.parse(x.encode(t))};S.Decode=function(t){return x.decode(JSON.stringify(t))},function(r){var e=t&&t.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};r.__esModule=!0;var a=e(n),i=e(o),u=S;r.default=function(t,r,e){void 0===e&&(e=!0);for(var n=t,o={pointers:{},src:{npm:"https://npmjs.com/package/console-feed",github:"https://github.com/samdenty99/console-feed"}},s=function(t){var a=n[t];n[t]=function(){a.apply(this,arguments);var n=[].slice.call(arguments);setTimeout((function(){var a=i.default(t,n);if(a){var o=a;e&&(o=u.Encode(a)),r(o,a)}}))},o.pointers[t]=a},f=0,c=a.default;f<c.length;f++)s(c[f]);return n.feed=o,n}}(e),r(e)(window.console,(function(t){var r=P(t);parent.postMessage({type:"console",codesandbox:!0,log:Array.isArray(r)?r[0]:r,channelId:scope.channelId},"*")}));
|
|
763
763
|
`;function QN(t,e){return gt(this,void 0,void 0,function(){var n,i,r,s,o;return vt(this,function(a){return n=t.contentWindow,Fn(n,"Failed to await preview iframe: no content window found"),i=9e4,r=20,s=0,[2,new Promise(function(l,c){var u=function(){var d=function(){clearTimeout(o),s=r,l(),t.removeEventListener("load",d)};if(s>=r){c(ki("Could not able to connect to preview."));return}t.setAttribute("src",e),o=setTimeout(function(){u(),t.removeEventListener("load",d)},i),s=s+1,t.addEventListener("load",d)};t.addEventListener("error",function(){return c(new Error("Iframe error"))}),t.addEventListener("abort",function(){return c(new Error("Aborted"))}),u()})]})})}var CN=function(t,e){t.style.border="0",t.style.width=e.width||"100%",t.style.height=e.height||"100%",t.style.overflow="hidden",t.allow="cross-origin-isolated"};function EN(t){var e=t.scope,n=window.history.__proto__,i=[],r=0,s=function(l){parent.postMessage({type:"urlchange",url:l,back:r>0,forward:r<i.length-1,channelId:e.channelId},"*")};function o(l,c){i.splice(r+1),i.push({url:l,state:c}),r=i.length-1}Object.assign(window.history,{go:function(l){var c=r+l;if(c>=0&&c<=i.length-1){r=c;var u=i[r],d=u.url,p=u.state;n.replaceState.call(window.history,p,"",d);var f=document.location.href;s(f),window.dispatchEvent(new PopStateEvent("popstate",{state:p}))}},back:function(){window.history.go(-1)},forward:function(){window.history.go(1)},pushState:function(l,c,u){n.replaceState.call(window.history,l,c,u),o(u,l),s(document.location.href)},replaceState:function(l,c,u){n.replaceState.call(window.history,l,c,u),i[r]={state:l,url:u},s(document.location.href)}});function a(l){var c=l.data;c.type==="urlback"?history.back():c.type==="urlforward"?history.forward():c.type==="refresh"&&document.location.reload()}window.addEventListener("message",a)}function jN(t){var e=t.scope,n=0;function i(){if(typeof window>"u")return 0;var a=document.body,l=document.documentElement;return Math.max(a.scrollHeight,a.offsetHeight,l.offsetHeight)}function r(){var a=i();n!==a&&window.parent.postMessage({type:"resize",height:a,codesandbox:!0,channelId:e.channelId},"*"),n=a}r();var s,o=new MutationObserver(function(){s===void 0&&(r(),s=setTimeout(function(){s=void 0},300))});o.observe(document,{attributes:!0,childList:!0,subtree:!0}),setInterval(r,300)}var AN=[{code:EN.toString(),id:"historyListener"},{code:"function consoleHook({ scope }) {"+Zw+`
|