@harperfast/harper 5.1.0-beta.3 → 5.1.0
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/bin/copyDb.ts +16 -3
- package/dist/bin/copyDb.js +16 -3
- package/dist/bin/copyDb.js.map +1 -1
- package/dist/resources/Table.js +43 -4
- package/dist/resources/Table.js.map +1 -1
- package/dist/resources/databases.js +135 -41
- package/dist/resources/databases.js.map +1 -1
- package/dist/resources/graphql.js +3 -0
- package/dist/resources/graphql.js.map +1 -1
- package/dist/resources/replayLogs.d.ts +1 -0
- package/dist/resources/replayLogs.js +100 -40
- package/dist/resources/replayLogs.js.map +1 -1
- package/dist/resources/replayLogsGuards.d.ts +25 -8
- package/dist/resources/replayLogsGuards.js +50 -10
- package/dist/resources/replayLogsGuards.js.map +1 -1
- package/dist/server/nodeName.js +9 -3
- package/dist/server/nodeName.js.map +1 -1
- package/dist/server/operationsServer.js +20 -0
- package/dist/server/operationsServer.js.map +1 -1
- package/dist/utility/install/installer.js +12 -6
- package/dist/utility/install/installer.js.map +1 -1
- package/package.json +3 -3
- package/resources/Table.ts +41 -4
- package/resources/databases.ts +134 -42
- package/resources/graphql.ts +3 -0
- package/resources/replayLogs.ts +114 -42
- package/resources/replayLogsGuards.ts +58 -9
- package/server/nodeName.ts +9 -3
- package/server/operationsServer.ts +17 -0
- package/studio/web/assets/{Chat-BdFickL8.js → Chat-DMBW4pI2.js} +2 -2
- package/studio/web/assets/{Chat-BdFickL8.js.map → Chat-DMBW4pI2.js.map} +1 -1
- package/studio/web/assets/{FloatingChat-CaAoco8I.js → FloatingChat-DTmhPsrm.js} +4 -4
- package/studio/web/assets/{FloatingChat-CaAoco8I.js.map → FloatingChat-DTmhPsrm.js.map} +1 -1
- package/studio/web/assets/{applications-C3y3xwyG.js → applications-CigxJarn.js} +2 -2
- package/studio/web/assets/{applications-C3y3xwyG.js.map → applications-CigxJarn.js.map} +1 -1
- package/studio/web/assets/{index-Cd3Zh3nK.js → index-oRZw5GW3.js} +6 -6
- package/studio/web/assets/index-oRZw5GW3.js.map +1 -0
- package/studio/web/assets/{index.lazy-0hLbh5Fo.js → index.lazy-DY3VcR86.js} +4 -4
- package/studio/web/assets/{index.lazy-0hLbh5Fo.js.map → index.lazy-DY3VcR86.js.map} +1 -1
- package/studio/web/assets/{profile-CwBWGuVt.js → profile-DiV60L50.js} +2 -2
- package/studio/web/assets/{profile-CwBWGuVt.js.map → profile-DiV60L50.js.map} +1 -1
- package/studio/web/assets/{setComponentFile-Dhrmd8eR.js → setComponentFile-Bz6WI4jy.js} +2 -2
- package/studio/web/assets/{setComponentFile-Dhrmd8eR.js.map → setComponentFile-Bz6WI4jy.js.map} +1 -1
- package/studio/web/assets/{status-Bykq6QcD.js → status-fW6PBpPM.js} +2 -2
- package/studio/web/assets/{status-Bykq6QcD.js.map → status-fW6PBpPM.js.map} +1 -1
- package/studio/web/assets/{swagger-ui-react-CF94s29D.js → swagger-ui-react-DRYf7G3J.js} +2 -2
- package/studio/web/assets/{swagger-ui-react-CF94s29D.js.map → swagger-ui-react-DRYf7G3J.js.map} +1 -1
- package/studio/web/assets/{useEntityRestURL-D7vuaG2W.js → useEntityRestURL-14jWKu9J.js} +2 -2
- package/studio/web/assets/{useEntityRestURL-D7vuaG2W.js.map → useEntityRestURL-14jWKu9J.js.map} +1 -1
- package/studio/web/index.html +1 -1
- package/utility/install/installer.ts +12 -5
- package/studio/web/assets/index-Cd3Zh3nK.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-
|
|
2
|
-
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,i as n}from"./vendor-datadog-Bq_0f1ke.js";import{r}from"./vendor-react-BqTNj-ZI.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./proxy-BJ77EweZ.js";import{$ as p,A as m,It as h,Rt as g}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Chat-DMBW4pI2.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/index-oRZw5GW3.js","assets/vendor-datadog-Bq_0f1ke.js","assets/vendor-ui-to0aD0Fq.js","assets/vendor-core-BIhSIGPv.js","assets/vendor-react-BqTNj-ZI.js","assets/vendor-tanstack-DmFvmRiZ.js","assets/createLucideIcon-D6HmSa4x.js","assets/button-kCMf1ZBL.js","assets/index-C_rO7c5w.css","assets/proxy-BJ77EweZ.js","assets/setComponentFile-Bz6WI4jy.js","assets/useEntityRestURL-14jWKu9J.js","assets/getAnalytics-HqW0hniG.js","assets/Chat-CwMJCYnY.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,i as n}from"./vendor-datadog-Bq_0f1ke.js";import{r}from"./vendor-react-BqTNj-ZI.js";import{a as i,c as a,i as o,l as s,n as c,o as l,r as u,s as d,t as f}from"./proxy-BJ77EweZ.js";import{$ as p,A as m,It as h,Rt as g}from"./index-oRZw5GW3.js";var _=e(t(),1);function v(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function y(...e){return t=>{let n=!1,r=e.map(e=>{let r=v(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():v(e[t],null)}}}}function b(...e){return _.useCallback(y(...e),e)}var x=r(),S=class extends _.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(o(t)&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){let e=t.offsetParent,n=o(e)&&e.offsetWidth||0,r=o(e)&&e.offsetHeight||0,i=getComputedStyle(t),a=this.props.sizeRef.current;a.height=parseFloat(i.height),a.width=parseFloat(i.width),a.top=t.offsetTop,a.left=t.offsetLeft,a.right=n-a.width-a.left,a.bottom=r-a.height-a.top,a.direction=i.direction}return null}componentDidUpdate(){}render(){return this.props.children}};function C({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:a}){let o=(0,_.useId)(),s=(0,_.useRef)(null),c=(0,_.useRef)({width:0,height:0,top:0,left:0,right:0,bottom:0,direction:`ltr`}),{nonce:l}=(0,_.useContext)(u),d=b(s,e.props?.ref??e?.ref);return(0,_.useInsertionEffect)(()=>{let{width:e,height:u,top:d,left:f,right:p,bottom:m,direction:h}=c.current;if(t||a===!1||!s.current||!e||!u)return;let g=h===`rtl`,_=n===`left`?g?`right: ${p}`:`left: ${f}`:g?`left: ${f}`:`right: ${p}`,v=r===`bottom`?`bottom: ${m}`:`top: ${d}`;s.current.dataset.motionPopId=o;let y=document.createElement(`style`);l&&(y.nonce=l);let b=i??document.head;return b.appendChild(y),y.sheet&&y.sheet.insertRule(`
|
|
3
3
|
[data-motion-pop-id="${o}"] {
|
|
4
4
|
position: absolute !important;
|
|
5
5
|
width: ${e}px !important;
|
|
@@ -7,7 +7,7 @@ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,i as n}from"./v
|
|
|
7
7
|
${_}px !important;
|
|
8
8
|
${v}px !important;
|
|
9
9
|
}
|
|
10
|
-
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,x.jsx)(S,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:d})})}var w=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:l,root:u})=>{let f=d(T),p=(0,_.useId)(),m=!0,h=(0,_.useMemo)(()=>(m=!1,{id:p,initial:t,isPresent:n,custom:a,onExitComplete:e=>{f.set(e,!0);for(let e of f.values())if(!e)return;r&&r()},register:e=>(f.set(e,!1),()=>f.delete(e))}),[n,f,r]);return o&&m&&(h={...h}),(0,_.useMemo)(()=>{f.forEach((e,t)=>f.set(t,!1))},[n]),_.useEffect(()=>{!n&&!f.size&&r&&r()},[n]),e=(0,x.jsx)(C,{pop:s===`popLayout`,isPresent:n,anchorX:c,anchorY:l,root:u,children:e}),(0,x.jsx)(i.Provider,{value:h,children:e})};function T(){return new Map}var E=e=>e.key||``;function D(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var O=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:u=`left`,anchorY:f=`top`,root:p})=>{let[m,h]=c(s),g=(0,_.useMemo)(()=>D(e),[e]),v=s&&!m?[]:g.map(E),y=(0,_.useRef)(!0),b=(0,_.useRef)(g),S=d(()=>new Map),C=(0,_.useRef)(new Set),[T,O]=(0,_.useState)(g),[k,A]=(0,_.useState)(g);l(()=>{y.current=!1,b.current=g;for(let e=0;e<k.length;e++){let t=E(k[e]);v.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[k,v.length,v.join(`-`)]);let j=[];if(g!==T){let e=[...g];for(let t=0;t<k.length;t++){let n=k[t],r=E(n);v.includes(r)||(e.splice(t,0,n),j.push(n))}return o===`wait`&&j.length&&(e=j),A(D(e)),O(g),null}let{forceRender:M}=(0,_.useContext)(a);return(0,x.jsx)(x.Fragment,{children:k.map(e=>{let a=E(e),c=s&&!m?!1:g===k||v.includes(a);return(0,x.jsx)(w,{isPresent:c,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:p,onExitComplete:c?void 0:()=>{if(C.current.has(a))return;if(S.has(a))C.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(b.current),s&&h?.(),r&&r())},anchorX:u,anchorY:f,children:e},a)})})},k=(0,_.lazy)(()=>n(()=>import(`./Chat-
|
|
10
|
+
`),()=>{s.current?.removeAttribute(`data-motion-pop-id`),b.contains(y)&&b.removeChild(y)}},[t]),(0,x.jsx)(S,{isPresent:t,childRef:s,sizeRef:c,pop:a,children:a===!1?e:_.cloneElement(e,{ref:d})})}var w=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:a,presenceAffectsLayout:o,mode:s,anchorX:c,anchorY:l,root:u})=>{let f=d(T),p=(0,_.useId)(),m=!0,h=(0,_.useMemo)(()=>(m=!1,{id:p,initial:t,isPresent:n,custom:a,onExitComplete:e=>{f.set(e,!0);for(let e of f.values())if(!e)return;r&&r()},register:e=>(f.set(e,!1),()=>f.delete(e))}),[n,f,r]);return o&&m&&(h={...h}),(0,_.useMemo)(()=>{f.forEach((e,t)=>f.set(t,!1))},[n]),_.useEffect(()=>{!n&&!f.size&&r&&r()},[n]),e=(0,x.jsx)(C,{pop:s===`popLayout`,isPresent:n,anchorX:c,anchorY:l,root:u,children:e}),(0,x.jsx)(i.Provider,{value:h,children:e})};function T(){return new Map}var E=e=>e.key||``;function D(e){let t=[];return _.Children.forEach(e,e=>{(0,_.isValidElement)(e)&&t.push(e)}),t}var O=({children:e,custom:t,initial:n=!0,onExitComplete:r,presenceAffectsLayout:i=!0,mode:o=`sync`,propagate:s=!1,anchorX:u=`left`,anchorY:f=`top`,root:p})=>{let[m,h]=c(s),g=(0,_.useMemo)(()=>D(e),[e]),v=s&&!m?[]:g.map(E),y=(0,_.useRef)(!0),b=(0,_.useRef)(g),S=d(()=>new Map),C=(0,_.useRef)(new Set),[T,O]=(0,_.useState)(g),[k,A]=(0,_.useState)(g);l(()=>{y.current=!1,b.current=g;for(let e=0;e<k.length;e++){let t=E(k[e]);v.includes(t)?(S.delete(t),C.current.delete(t)):S.get(t)!==!0&&S.set(t,!1)}},[k,v.length,v.join(`-`)]);let j=[];if(g!==T){let e=[...g];for(let t=0;t<k.length;t++){let n=k[t],r=E(n);v.includes(r)||(e.splice(t,0,n),j.push(n))}return o===`wait`&&j.length&&(e=j),A(D(e)),O(g),null}let{forceRender:M}=(0,_.useContext)(a);return(0,x.jsx)(x.Fragment,{children:k.map(e=>{let a=E(e),c=s&&!m?!1:g===k||v.includes(a);return(0,x.jsx)(w,{isPresent:c,initial:!y.current||n?void 0:!1,custom:t,presenceAffectsLayout:i,mode:o,root:p,onExitComplete:c?void 0:()=>{if(C.current.has(a))return;if(S.has(a))C.current.add(a),S.set(a,!0);else return;let e=!0;S.forEach(t=>{t||(e=!1)}),e&&(M?.(),A(b.current),s&&h?.(),r&&r())},anchorX:u,anchorY:f,children:e},a)})})},k=(0,_.lazy)(()=>n(()=>import(`./Chat-DMBW4pI2.js`).then(e=>({default:e.Chat})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]))),A=56,j=24;function M(){let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(!1),[i,a]=(0,_.useState)(!1),[o,c]=m(`ApplicationChatOpen`,!1),[l,u]=g(h.ApplicationChatPosition,{x:-40,y:-40}),[d,v]=g(h.ApplicationChatWidth,600),y=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=()=>{let e=window.innerWidth<768;t(e),!e&&d>window.innerWidth&&v(window.innerWidth)};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[d,v]);let b=(0,_.useCallback)(e=>{e.preventDefault(),a(!0)},[]);(0,_.useEffect)(()=>{if(!i)return;let e=e=>{let t=window.innerWidth-e.clientX;v(Math.min(Math.max(t,300),window.innerWidth))},t=()=>{a(!1)};return window.addEventListener(`mousemove`,e),window.addEventListener(`mouseup`,t),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[i,v]);let S=(0,_.useCallback)(()=>{n||c(e=>!e)},[n]),C=(0,_.useCallback)(()=>{c(!1)},[]);return(0,_.useEffect)(()=>{if(o){let e=e=>{e.key===`Escape`&&C()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[o,C]),(0,x.jsxs)(`div`,{className:`fixed inset-0 pointer-events-none z-50`,ref:y,children:[(0,x.jsx)(O,{children:o&&(0,x.jsxs)(f.div,{initial:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},animate:e?{opacity:1,y:0}:{opacity:1,x:0},exit:e?{opacity:0,y:`100%`}:{opacity:0,x:`100%`},transition:{type:`spring`,damping:25,stiffness:200},style:e?{}:{top:0,bottom:0,right:0,width:d,maxWidth:`100vw`},className:`
|
|
11
11
|
pointer-events-auto
|
|
12
12
|
fixed bg-background shadow-2xl border-l border-border overflow-visible
|
|
13
13
|
${e?`inset-0 w-full h-full rounded-none`:`h-full`}
|
|
@@ -21,4 +21,4 @@ import{a as e}from"./rolldown-runtime-Cyuzqnbw.js";import{a as t,i as n}from"./v
|
|
|
21
21
|
text-primary-foreground shadow-lg flex items-center justify-center cursor-pointer
|
|
22
22
|
hover:bg-primary/90 transition-colors
|
|
23
23
|
`,children:(0,x.jsx)(s,{size:28})})]})}export{M as FloatingChat};
|
|
24
|
-
//# sourceMappingURL=FloatingChat-
|
|
24
|
+
//# sourceMappingURL=FloatingChat-DTmhPsrm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"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","names":["Fragment"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../src/features/instance/applications/components/Chat/FloatingChat.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n size.direction = computedStyle.direction;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const isRTL = direction === \"rtl\";\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`);\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => presenceChildren.delete(childId);\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","import { Loading } from '@/components/Loading';\nimport { useLocalStorage } from '@/hooks/useLocalStorage';\nimport { useSessionStorage } from '@/hooks/useSessionStorage';\nimport { LocalStorageKeys } from '@/lib/storage/localStorageKeys';\nimport { Bot } from 'lucide-react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';\n\n// Second-tier lazy load: this file (the floating bubble) loads when you land on\n// an instance, but the chat pane — and its heavy dependencies (the AI SDK, the\n// chat tools, the markdown message renderer) — only loads the first time the\n// bubble is opened.\nconst Chat = lazy(() => import('./index').then((m) => ({ default: m.Chat })));\n\nconst BUBBLE_SIZE = 56;\nconst PADDING = 24;\n\nexport function FloatingChat() {\n\tconst [isMobile, setIsMobile] = useState(false);\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [isOpen, setIsOpen] = useSessionStorage('ApplicationChatOpen', false);\n\tconst [position, setPosition] = useLocalStorage(LocalStorageKeys.ApplicationChatPosition, { x: -40, y: -40 });\n\tconst [width, setWidth] = useLocalStorage(LocalStorageKeys.ApplicationChatWidth, 600);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tconst checkMobile = () => {\n\t\t\tconst mobile = window.innerWidth < 768;\n\t\t\tsetIsMobile(mobile);\n\t\t\tif (!mobile && width > window.innerWidth) {\n\t\t\t\tsetWidth(window.innerWidth);\n\t\t\t}\n\t\t};\n\t\tcheckMobile();\n\t\twindow.addEventListener('resize', checkMobile);\n\t\treturn () => window.removeEventListener('resize', checkMobile);\n\t}, [width, setWidth]);\n\n\tconst handleResizeStart = useCallback((e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\tsetIsResizing(true);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isResizing) { return; }\n\n\t\tconst handleMouseMove = (e: MouseEvent) => {\n\t\t\tconst newWidth = window.innerWidth - e.clientX;\n\t\t\tconst clampedWidth = Math.min(Math.max(newWidth, 300), window.innerWidth);\n\t\t\tsetWidth(clampedWidth);\n\t\t};\n\n\t\tconst handleMouseUp = () => {\n\t\t\tsetIsResizing(false);\n\t\t};\n\n\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isResizing, setWidth]);\n\n\tconst toggleChat = useCallback(() => {\n\t\tif (isDragging) { return; }\n\t\tsetIsOpen(prev => !prev);\n\t}, [isDragging]);\n\n\tconst closeChat = useCallback(() => {\n\t\tsetIsOpen(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key === 'Escape') {\n\t\t\t\t\tcloseChat();\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('keydown', handleEscape);\n\t\t\treturn () => window.removeEventListener('keydown', handleEscape);\n\t\t}\n\t}, [isOpen, closeChat]);\n\n\tconst handleDragStart = () => {\n\t\tsetIsDragging(false);\n\t};\n\n\tconst handleDrag = (_event: any, info: any) => {\n\t\t// If the user has moved the pointer more than 5px, consider it a drag\n\t\tif (Math.abs(info.offset.x) > 5 || Math.abs(info.offset.y) > 5) {\n\t\t\tsetIsDragging(true);\n\t\t}\n\t};\n\n\tconst handleDragEnd = (_event: any, info: any) => {\n\t\t// Small delay to ensure the click handler (which fires after dragEnd)\n\t\t// can still see the isDragging = true state.\n\t\tsetTimeout(() => {\n\t\t\tsetIsDragging(false);\n\t\t}, 100);\n\n\t\tif (isMobile) { return; }\n\n\t\tconst { innerWidth, innerHeight } = window;\n\n\t\t// Calculate new offsets based on where we started and how far we dragged.\n\t\t// x and y in position are offsets from the initial bottom-right (PADDING, PADDING)\n\t\tconst newX = position.x + info.offset.x;\n\t\tconst newY = position.y + info.offset.y;\n\n\t\t// We still want snapping if it's close to the screen edge.\n\t\t// info.point is absolute screen coordinates of the pointer.\n\t\tconst distLeft = info.point.x;\n\t\tconst distRight = innerWidth - info.point.x;\n\t\tconst distTop = info.point.y;\n\t\tconst distBottom = innerHeight - info.point.y;\n\n\t\tlet snapX = newX;\n\t\tlet snapY = newY;\n\n\t\tconst threshold = 100;\n\t\tif (distLeft < threshold) {\n\t\t\t// Snap to left: x offset should be -(innerWidth - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapX = -(innerWidth - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distRight < threshold) {\n\t\t\t// Snap to right: x offset should be 0\n\t\t\tsnapX = 0;\n\t\t}\n\n\t\tif (distTop < threshold) {\n\t\t\t// Snap to top: y offset should be -(innerHeight - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapY = -(innerHeight - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distBottom < threshold) {\n\t\t\t// Snap to bottom: y offset should be 0\n\t\t\tsnapY = 0;\n\t\t}\n\n\t\tsetPosition({\n\t\t\tx: snapX,\n\t\t\ty: snapY,\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"fixed inset-0 pointer-events-none z-50\" ref={containerRef}>\n\t\t\t<AnimatePresence>\n\t\t\t\t{isOpen && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\tanimate={isMobile ? { opacity: 1, y: 0 } : { opacity: 1, x: 0 }}\n\t\t\t\t\t\texit={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\ttransition={{ type: 'spring', damping: 25, stiffness: 200 }}\n\t\t\t\t\t\tstyle={!isMobile\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tmaxWidth: '100vw',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}}\n\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\t\tfixed bg-background shadow-2xl border-l border-border overflow-visible\n\t\t\t\t\t\t\t${isMobile ? 'inset-0 w-full h-full rounded-none' : 'h-full'}\n\t\t\t\t\t\t`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!isMobile && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\t\t\tabsolute left-0 top-0 bottom-0 w-1 cursor-ew-resize\n\t\t\t\t\t\t\t\t\thover:bg-primary transition-colors z-50\n\t\t\t\t\t\t\t\t\t${isResizing ? 'bg-primary' : ''}\n\t\t\t\t\t\t\t\t`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Suspense fallback={<Loading centered text=\"Loading chat…\" />}>\n\t\t\t\t\t\t\t<Chat autoFocus closeChat={closeChat} />\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{!isOpen && (\n\t\t\t\t<motion.button\n\t\t\t\t\tdrag\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tinitial={{ x: position.x, y: position.y }}\n\t\t\t\t\twhileHover={{ scale: 1.1 }}\n\t\t\t\t\twhileTap={{ scale: 0.9 }}\n\t\t\t\t\tonClick={toggleChat}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbottom: PADDING,\n\t\t\t\t\t\tright: PADDING,\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"\n\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\tfixed w-14 h-14 rounded-full bg-primary\n\t\t\t\t\t\ttext-primary-foreground shadow-lg flex items-center justify-center cursor-pointer\n\t\t\t\t\t\thover:bg-primary/90 transition-colors\n\t\t\t\t\t\"\n\t\t\t\t>\n\t\t\t\t\t<Bot size={28} />\n\t\t\t\t</motion.button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"file":"FloatingChat-CaAoco8I.js"}
|
|
1
|
+
{"version":3,"mappings":"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","names":["Fragment"],"ignoreList":[0,1,2,3,4],"sources":["../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/utils/use-composed-ref.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/utils.mjs","../../node_modules/.pnpm/framer-motion@12.40.0_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/framer-motion/dist/es/components/AnimatePresence/index.mjs","../../src/features/instance/applications/components/Chat/FloatingChat.tsx"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Taken from https://github.com/radix-ui/primitives/blob/main/packages/react/compose-refs/src/compose-refs.tsx\n */\n/**\n * Set a given ref to a given value\n * This utility takes care of different types of refs: callback refs and RefObject(s)\n */\nfunction setRef(ref, value) {\n if (typeof ref === \"function\") {\n return ref(value);\n }\n else if (ref !== null && ref !== undefined) {\n ref.current = value;\n }\n}\n/**\n * A utility to compose multiple refs together\n * Accepts callback refs and RefObject(s)\n */\nfunction composeRefs(...refs) {\n return (node) => {\n let hasCleanup = false;\n const cleanups = refs.map((ref) => {\n const cleanup = setRef(ref, node);\n if (!hasCleanup && typeof cleanup === \"function\") {\n hasCleanup = true;\n }\n return cleanup;\n });\n // React <19 will log an error to the console if a callback ref returns a\n // value. We don't use ref cleanups internally so this will only happen if a\n // user's ref callback returns a value, which we only expect if they are\n // using the cleanup functionality added in React 19.\n if (hasCleanup) {\n return () => {\n for (let i = 0; i < cleanups.length; i++) {\n const cleanup = cleanups[i];\n if (typeof cleanup === \"function\") {\n cleanup();\n }\n else {\n setRef(refs[i], null);\n }\n }\n };\n }\n };\n}\n/**\n * A custom hook that composes multiple refs\n * Accepts callback refs and RefObject(s)\n */\nfunction useComposedRefs(...refs) {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return React.useCallback(composeRefs(...refs), refs);\n}\n\nexport { useComposedRefs };\n//# sourceMappingURL=use-composed-ref.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport { isHTMLElement } from 'motion-dom';\nimport * as React from 'react';\nimport { useId, useRef, useContext, useInsertionEffect } from 'react';\nimport { MotionConfigContext } from '../../context/MotionConfigContext.mjs';\nimport { useComposedRefs } from '../../utils/use-composed-ref.mjs';\n\n/**\n * Measurement functionality has to be within a separate component\n * to leverage snapshot lifecycle.\n */\nclass PopChildMeasure extends React.Component {\n getSnapshotBeforeUpdate(prevProps) {\n const element = this.props.childRef.current;\n if (isHTMLElement(element) && prevProps.isPresent && !this.props.isPresent && this.props.pop !== false) {\n const parent = element.offsetParent;\n const parentWidth = isHTMLElement(parent)\n ? parent.offsetWidth || 0\n : 0;\n const parentHeight = isHTMLElement(parent)\n ? parent.offsetHeight || 0\n : 0;\n const computedStyle = getComputedStyle(element);\n const size = this.props.sizeRef.current;\n size.height = parseFloat(computedStyle.height);\n size.width = parseFloat(computedStyle.width);\n size.top = element.offsetTop;\n size.left = element.offsetLeft;\n size.right = parentWidth - size.width - size.left;\n size.bottom = parentHeight - size.height - size.top;\n size.direction = computedStyle.direction;\n }\n return null;\n }\n /**\n * Required with getSnapshotBeforeUpdate to stop React complaining.\n */\n componentDidUpdate() { }\n render() {\n return this.props.children;\n }\n}\nfunction PopChild({ children, isPresent, anchorX, anchorY, root, pop }) {\n const id = useId();\n const ref = useRef(null);\n const size = useRef({\n width: 0,\n height: 0,\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n direction: \"ltr\",\n });\n const { nonce } = useContext(MotionConfigContext);\n /**\n * In React 19, refs are passed via props.ref instead of element.ref.\n * We check props.ref first (React 19) and fall back to element.ref (React 18).\n */\n const childRef = children.props?.ref ??\n children?.ref;\n const composedRef = useComposedRefs(ref, childRef);\n /**\n * We create and inject a style block so we can apply this explicit\n * sizing in a non-destructive manner by just deleting the style block.\n *\n * We can't apply size via render as the measurement happens\n * in getSnapshotBeforeUpdate (post-render), likewise if we apply the\n * styles directly on the DOM node, we might be overwriting\n * styles set via the style prop.\n */\n useInsertionEffect(() => {\n const { width, height, top, left, right, bottom, direction } = size.current;\n if (isPresent || pop === false || !ref.current || !width || !height)\n return;\n const isRTL = direction === \"rtl\";\n const x = anchorX === \"left\"\n ? (isRTL ? `right: ${right}` : `left: ${left}`)\n : (isRTL ? `left: ${left}` : `right: ${right}`);\n const y = anchorY === \"bottom\" ? `bottom: ${bottom}` : `top: ${top}`;\n ref.current.dataset.motionPopId = id;\n const style = document.createElement(\"style\");\n if (nonce)\n style.nonce = nonce;\n const parent = root ?? document.head;\n parent.appendChild(style);\n if (style.sheet) {\n style.sheet.insertRule(`\n [data-motion-pop-id=\"${id}\"] {\n position: absolute !important;\n width: ${width}px !important;\n height: ${height}px !important;\n ${x}px !important;\n ${y}px !important;\n }\n `);\n }\n return () => {\n ref.current?.removeAttribute(\"data-motion-pop-id\");\n if (parent.contains(style)) {\n parent.removeChild(style);\n }\n };\n }, [isPresent]);\n return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, pop: pop, children: pop === false\n ? children\n : React.cloneElement(children, { ref: composedRef }) }));\n}\n\nexport { PopChild };\n//# sourceMappingURL=PopChild.mjs.map\n","\"use client\";\nimport { jsx } from 'react/jsx-runtime';\nimport * as React from 'react';\nimport { useId, useMemo } from 'react';\nimport { PresenceContext } from '../../context/PresenceContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { PopChild } from './PopChild.mjs';\n\nconst PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, anchorY, root }) => {\n const presenceChildren = useConstant(newChildrenMap);\n const id = useId();\n let isReusedContext = true;\n let context = useMemo(() => {\n isReusedContext = false;\n return {\n id,\n initial,\n isPresent,\n custom,\n onExitComplete: (childId) => {\n presenceChildren.set(childId, true);\n for (const isComplete of presenceChildren.values()) {\n if (!isComplete)\n return; // can stop searching when any is incomplete\n }\n onExitComplete && onExitComplete();\n },\n register: (childId) => {\n presenceChildren.set(childId, false);\n return () => presenceChildren.delete(childId);\n },\n };\n }, [isPresent, presenceChildren, onExitComplete]);\n /**\n * If the presence of a child affects the layout of the components around it,\n * we want to make a new context value to ensure they get re-rendered\n * so they can detect that layout change.\n */\n if (presenceAffectsLayout && isReusedContext) {\n context = { ...context };\n }\n useMemo(() => {\n presenceChildren.forEach((_, key) => presenceChildren.set(key, false));\n }, [isPresent]);\n /**\n * If there's no `motion` components to fire exit animations, we want to remove this\n * component immediately.\n */\n React.useEffect(() => {\n !isPresent &&\n !presenceChildren.size &&\n onExitComplete &&\n onExitComplete();\n }, [isPresent]);\n children = (jsx(PopChild, { pop: mode === \"popLayout\", isPresent: isPresent, anchorX: anchorX, anchorY: anchorY, root: root, children: children }));\n return (jsx(PresenceContext.Provider, { value: context, children: children }));\n};\nfunction newChildrenMap() {\n return new Map();\n}\n\nexport { PresenceChild };\n//# sourceMappingURL=PresenceChild.mjs.map\n","import { Children, isValidElement } from 'react';\n\nconst getChildKey = (child) => child.key || \"\";\nfunction onlyElements(children) {\n const filtered = [];\n // We use forEach here instead of map as map mutates the component key by preprending `.$`\n Children.forEach(children, (child) => {\n if (isValidElement(child))\n filtered.push(child);\n });\n return filtered;\n}\n\nexport { getChildKey, onlyElements };\n//# sourceMappingURL=utils.mjs.map\n","\"use client\";\nimport { jsx, Fragment } from 'react/jsx-runtime';\nimport { useMemo, useRef, useState, useContext } from 'react';\nimport { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';\nimport { useConstant } from '../../utils/use-constant.mjs';\nimport { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';\nimport { PresenceChild } from './PresenceChild.mjs';\nimport { usePresence } from './use-presence.mjs';\nimport { onlyElements, getChildKey } from './utils.mjs';\n\n/**\n * `AnimatePresence` enables the animation of components that have been removed from the tree.\n *\n * When adding/removing more than a single child, every child **must** be given a unique `key` prop.\n *\n * Any `motion` components that have an `exit` property defined will animate out when removed from\n * the tree.\n *\n * ```jsx\n * import { motion, AnimatePresence } from 'framer-motion'\n *\n * export const Items = ({ items }) => (\n * <AnimatePresence>\n * {items.map(item => (\n * <motion.div\n * key={item.id}\n * initial={{ opacity: 0 }}\n * animate={{ opacity: 1 }}\n * exit={{ opacity: 0 }}\n * />\n * ))}\n * </AnimatePresence>\n * )\n * ```\n *\n * You can sequence exit animations throughout a tree using variants.\n *\n * If a child contains multiple `motion` components with `exit` props, it will only unmount the child\n * once all `motion` components have finished animating out. Likewise, any components using\n * `usePresence` all need to call `safeToRemove`.\n *\n * @public\n */\nconst AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = \"sync\", propagate = false, anchorX = \"left\", anchorY = \"top\", root }) => {\n const [isParentPresent, safeToRemove] = usePresence(propagate);\n /**\n * Filter any children that aren't ReactElements. We can only track components\n * between renders with a props.key.\n */\n const presentChildren = useMemo(() => onlyElements(children), [children]);\n /**\n * Track the keys of the currently rendered children. This is used to\n * determine which children are exiting.\n */\n const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);\n /**\n * If `initial={false}` we only want to pass this to components in the first render.\n */\n const isInitialRender = useRef(true);\n /**\n * A ref containing the currently present children. When all exit animations\n * are complete, we use this to re-render the component with the latest children\n * *committed* rather than the latest children *rendered*.\n */\n const pendingPresentChildren = useRef(presentChildren);\n /**\n * Track which exiting children have finished animating out.\n */\n const exitComplete = useConstant(() => new Map());\n /**\n * Track which components are currently processing exit to prevent duplicate processing.\n */\n const exitingComponents = useRef(new Set());\n /**\n * Save children to render as React state. To ensure this component is concurrent-safe,\n * we check for exiting children via an effect.\n */\n const [diffedChildren, setDiffedChildren] = useState(presentChildren);\n const [renderedChildren, setRenderedChildren] = useState(presentChildren);\n useIsomorphicLayoutEffect(() => {\n isInitialRender.current = false;\n pendingPresentChildren.current = presentChildren;\n /**\n * Update complete status of exiting children.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const key = getChildKey(renderedChildren[i]);\n if (!presentKeys.includes(key)) {\n if (exitComplete.get(key) !== true) {\n exitComplete.set(key, false);\n }\n }\n else {\n exitComplete.delete(key);\n exitingComponents.current.delete(key);\n }\n }\n }, [renderedChildren, presentKeys.length, presentKeys.join(\"-\")]);\n const exitingChildren = [];\n if (presentChildren !== diffedChildren) {\n let nextChildren = [...presentChildren];\n /**\n * Loop through all the currently rendered components and decide which\n * are exiting.\n */\n for (let i = 0; i < renderedChildren.length; i++) {\n const child = renderedChildren[i];\n const key = getChildKey(child);\n if (!presentKeys.includes(key)) {\n nextChildren.splice(i, 0, child);\n exitingChildren.push(child);\n }\n }\n /**\n * If we're in \"wait\" mode, and we have exiting children, we want to\n * only render these until they've all exited.\n */\n if (mode === \"wait\" && exitingChildren.length) {\n nextChildren = exitingChildren;\n }\n setRenderedChildren(onlyElements(nextChildren));\n setDiffedChildren(presentChildren);\n /**\n * Early return to ensure once we've set state with the latest diffed\n * children, we can immediately re-render.\n */\n return null;\n }\n if (process.env.NODE_ENV !== \"production\" &&\n mode === \"wait\" &&\n renderedChildren.length > 1) {\n console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to \"wait\". This will lead to odd visual behaviour.`);\n }\n /**\n * If we've been provided a forceRender function by the LayoutGroupContext,\n * we can use it to force a re-render amongst all surrounding components once\n * all components have finished animating out.\n */\n const { forceRender } = useContext(LayoutGroupContext);\n return (jsx(Fragment, { children: renderedChildren.map((child) => {\n const key = getChildKey(child);\n const isPresent = propagate && !isParentPresent\n ? false\n : presentChildren === renderedChildren ||\n presentKeys.includes(key);\n const onExit = () => {\n if (exitingComponents.current.has(key)) {\n return;\n }\n if (exitComplete.has(key)) {\n exitingComponents.current.add(key);\n exitComplete.set(key, true);\n }\n else {\n return;\n }\n let isEveryExitComplete = true;\n exitComplete.forEach((isExitComplete) => {\n if (!isExitComplete)\n isEveryExitComplete = false;\n });\n if (isEveryExitComplete) {\n forceRender?.();\n setRenderedChildren(pendingPresentChildren.current);\n propagate && safeToRemove?.();\n onExitComplete && onExitComplete();\n }\n };\n return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial\n ? undefined\n : false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, root: root, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, anchorY: anchorY, children: child }, key));\n }) }));\n};\n\nexport { AnimatePresence };\n//# sourceMappingURL=index.mjs.map\n","import { Loading } from '@/components/Loading';\nimport { useLocalStorage } from '@/hooks/useLocalStorage';\nimport { useSessionStorage } from '@/hooks/useSessionStorage';\nimport { LocalStorageKeys } from '@/lib/storage/localStorageKeys';\nimport { Bot } from 'lucide-react';\nimport { AnimatePresence, motion } from 'motion/react';\nimport { lazy, Suspense, useCallback, useEffect, useRef, useState } from 'react';\n\n// Second-tier lazy load: this file (the floating bubble) loads when you land on\n// an instance, but the chat pane — and its heavy dependencies (the AI SDK, the\n// chat tools, the markdown message renderer) — only loads the first time the\n// bubble is opened.\nconst Chat = lazy(() => import('./index').then((m) => ({ default: m.Chat })));\n\nconst BUBBLE_SIZE = 56;\nconst PADDING = 24;\n\nexport function FloatingChat() {\n\tconst [isMobile, setIsMobile] = useState(false);\n\tconst [isDragging, setIsDragging] = useState(false);\n\tconst [isResizing, setIsResizing] = useState(false);\n\tconst [isOpen, setIsOpen] = useSessionStorage('ApplicationChatOpen', false);\n\tconst [position, setPosition] = useLocalStorage(LocalStorageKeys.ApplicationChatPosition, { x: -40, y: -40 });\n\tconst [width, setWidth] = useLocalStorage(LocalStorageKeys.ApplicationChatWidth, 600);\n\tconst containerRef = useRef<HTMLDivElement>(null);\n\n\tuseEffect(() => {\n\t\tconst checkMobile = () => {\n\t\t\tconst mobile = window.innerWidth < 768;\n\t\t\tsetIsMobile(mobile);\n\t\t\tif (!mobile && width > window.innerWidth) {\n\t\t\t\tsetWidth(window.innerWidth);\n\t\t\t}\n\t\t};\n\t\tcheckMobile();\n\t\twindow.addEventListener('resize', checkMobile);\n\t\treturn () => window.removeEventListener('resize', checkMobile);\n\t}, [width, setWidth]);\n\n\tconst handleResizeStart = useCallback((e: React.MouseEvent) => {\n\t\te.preventDefault();\n\t\tsetIsResizing(true);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (!isResizing) { return; }\n\n\t\tconst handleMouseMove = (e: MouseEvent) => {\n\t\t\tconst newWidth = window.innerWidth - e.clientX;\n\t\t\tconst clampedWidth = Math.min(Math.max(newWidth, 300), window.innerWidth);\n\t\t\tsetWidth(clampedWidth);\n\t\t};\n\n\t\tconst handleMouseUp = () => {\n\t\t\tsetIsResizing(false);\n\t\t};\n\n\t\twindow.addEventListener('mousemove', handleMouseMove);\n\t\twindow.addEventListener('mouseup', handleMouseUp);\n\t\treturn () => {\n\t\t\twindow.removeEventListener('mousemove', handleMouseMove);\n\t\t\twindow.removeEventListener('mouseup', handleMouseUp);\n\t\t};\n\t}, [isResizing, setWidth]);\n\n\tconst toggleChat = useCallback(() => {\n\t\tif (isDragging) { return; }\n\t\tsetIsOpen(prev => !prev);\n\t}, [isDragging]);\n\n\tconst closeChat = useCallback(() => {\n\t\tsetIsOpen(false);\n\t}, []);\n\n\tuseEffect(() => {\n\t\tif (isOpen) {\n\t\t\tconst handleEscape = (e: KeyboardEvent) => {\n\t\t\t\tif (e.key === 'Escape') {\n\t\t\t\t\tcloseChat();\n\t\t\t\t}\n\t\t\t};\n\t\t\twindow.addEventListener('keydown', handleEscape);\n\t\t\treturn () => window.removeEventListener('keydown', handleEscape);\n\t\t}\n\t}, [isOpen, closeChat]);\n\n\tconst handleDragStart = () => {\n\t\tsetIsDragging(false);\n\t};\n\n\tconst handleDrag = (_event: any, info: any) => {\n\t\t// If the user has moved the pointer more than 5px, consider it a drag\n\t\tif (Math.abs(info.offset.x) > 5 || Math.abs(info.offset.y) > 5) {\n\t\t\tsetIsDragging(true);\n\t\t}\n\t};\n\n\tconst handleDragEnd = (_event: any, info: any) => {\n\t\t// Small delay to ensure the click handler (which fires after dragEnd)\n\t\t// can still see the isDragging = true state.\n\t\tsetTimeout(() => {\n\t\t\tsetIsDragging(false);\n\t\t}, 100);\n\n\t\tif (isMobile) { return; }\n\n\t\tconst { innerWidth, innerHeight } = window;\n\n\t\t// Calculate new offsets based on where we started and how far we dragged.\n\t\t// x and y in position are offsets from the initial bottom-right (PADDING, PADDING)\n\t\tconst newX = position.x + info.offset.x;\n\t\tconst newY = position.y + info.offset.y;\n\n\t\t// We still want snapping if it's close to the screen edge.\n\t\t// info.point is absolute screen coordinates of the pointer.\n\t\tconst distLeft = info.point.x;\n\t\tconst distRight = innerWidth - info.point.x;\n\t\tconst distTop = info.point.y;\n\t\tconst distBottom = innerHeight - info.point.y;\n\n\t\tlet snapX = newX;\n\t\tlet snapY = newY;\n\n\t\tconst threshold = 100;\n\t\tif (distLeft < threshold) {\n\t\t\t// Snap to left: x offset should be -(innerWidth - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapX = -(innerWidth - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distRight < threshold) {\n\t\t\t// Snap to right: x offset should be 0\n\t\t\tsnapX = 0;\n\t\t}\n\n\t\tif (distTop < threshold) {\n\t\t\t// Snap to top: y offset should be -(innerHeight - BUBBLE_SIZE - PADDING * 2)\n\t\t\tsnapY = -(innerHeight - BUBBLE_SIZE - PADDING * 2);\n\t\t} else if (distBottom < threshold) {\n\t\t\t// Snap to bottom: y offset should be 0\n\t\t\tsnapY = 0;\n\t\t}\n\n\t\tsetPosition({\n\t\t\tx: snapX,\n\t\t\ty: snapY,\n\t\t});\n\t};\n\n\treturn (\n\t\t<div className=\"fixed inset-0 pointer-events-none z-50\" ref={containerRef}>\n\t\t\t<AnimatePresence>\n\t\t\t\t{isOpen && (\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tinitial={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\tanimate={isMobile ? { opacity: 1, y: 0 } : { opacity: 1, x: 0 }}\n\t\t\t\t\t\texit={isMobile ? { opacity: 0, y: '100%' } : { opacity: 0, x: '100%' }}\n\t\t\t\t\t\ttransition={{ type: 'spring', damping: 25, stiffness: 200 }}\n\t\t\t\t\t\tstyle={!isMobile\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\t\t\twidth,\n\t\t\t\t\t\t\t\tmaxWidth: '100vw',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {}}\n\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\t\tfixed bg-background shadow-2xl border-l border-border overflow-visible\n\t\t\t\t\t\t\t${isMobile ? 'inset-0 w-full h-full rounded-none' : 'h-full'}\n\t\t\t\t\t\t`}\n\t\t\t\t\t>\n\t\t\t\t\t\t{!isMobile && (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tonMouseDown={handleResizeStart}\n\t\t\t\t\t\t\t\tclassName={`\n\t\t\t\t\t\t\t\t\tabsolute left-0 top-0 bottom-0 w-1 cursor-ew-resize\n\t\t\t\t\t\t\t\t\thover:bg-primary transition-colors z-50\n\t\t\t\t\t\t\t\t\t${isResizing ? 'bg-primary' : ''}\n\t\t\t\t\t\t\t\t`}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<Suspense fallback={<Loading centered text=\"Loading chat…\" />}>\n\t\t\t\t\t\t\t<Chat autoFocus closeChat={closeChat} />\n\t\t\t\t\t\t</Suspense>\n\t\t\t\t\t</motion.div>\n\t\t\t\t)}\n\t\t\t</AnimatePresence>\n\n\t\t\t{!isOpen && (\n\t\t\t\t<motion.button\n\t\t\t\t\tdrag\n\t\t\t\t\tdragMomentum={false}\n\t\t\t\t\tdragConstraints={containerRef}\n\t\t\t\t\tonDragStart={handleDragStart}\n\t\t\t\t\tonDrag={handleDrag}\n\t\t\t\t\tonDragEnd={handleDragEnd}\n\t\t\t\t\tinitial={{ x: position.x, y: position.y }}\n\t\t\t\t\twhileHover={{ scale: 1.1 }}\n\t\t\t\t\twhileTap={{ scale: 0.9 }}\n\t\t\t\t\tonClick={toggleChat}\n\t\t\t\t\tstyle={{\n\t\t\t\t\t\tbottom: PADDING,\n\t\t\t\t\t\tright: PADDING,\n\t\t\t\t\t}}\n\t\t\t\t\tclassName=\"\n\t\t\t\t\t\tpointer-events-auto\n\t\t\t\t\t\tfixed w-14 h-14 rounded-full bg-primary\n\t\t\t\t\t\ttext-primary-foreground shadow-lg flex items-center justify-center cursor-pointer\n\t\t\t\t\t\thover:bg-primary/90 transition-colors\n\t\t\t\t\t\"\n\t\t\t\t>\n\t\t\t\t\t<Bot size={28} />\n\t\t\t\t</motion.button>\n\t\t\t)}\n\t\t</div>\n\t);\n}\n"],"file":"FloatingChat-DTmhPsrm.js"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/mermaid.core-B3uGOQZ5.js","assets/vendor-datadog-Bq_0f1ke.js","assets/rolldown-runtime-Cyuzqnbw.js","assets/chunk-O5CBEL6O-BR7lAzXB.js","assets/src-B_Sx0CuL.js","assets/step-BudVE2GU.js","assets/chunk-5ZQYHXKU-BuGGbiNy.js","assets/dist-BnFaJxVk.js","assets/chunk-CSCIHK7Q-BZyFk-9I.js","assets/chunk-3OPIFGDE-DCbpIM16.js","assets/chunk-L5ZTLDWV-CGwEr_XB.js","assets/chunk-NZK2D7GU-B_SUV1Ae.js","assets/rough.esm-CSKSodPl.js","assets/chunk-BSJP7CBP-cDBLgFaV.js","assets/chunk-KSCS5N6A-BPFlpA21.js","assets/chunk-LZXEDZCA-DMP-k_iJ.js","assets/chunk-WU5MYG2G-D_lK_PGm.js","assets/chunk-XPW4576I-D-NYOX2e.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,r as t,t as n}from"./rolldown-runtime-Cyuzqnbw.js";import{i as r,m as i,n as a,r as o,t as s,v as c,y as l}from"./button-kCMf1ZBL.js";import{c as u,d,h as f,j as p,l as m,n as h,p as g,r as _,v,x as y}from"./vendor-core-BIhSIGPv.js";import{C as b,M as x,P as S,S as C,b as w,k as T,v as E,x as ee,y as D}from"./vendor-tanstack-DmFvmRiZ.js";import{a as O,i as k}from"./vendor-datadog-Bq_0f1ke.js";import{r as A}from"./vendor-react-BqTNj-ZI.js";import{Tt as j,at as M,c as N,lt as te,o as ne,p as re,rt as ie,s as ae,ut as oe}from"./vendor-ui-to0aD0Fq.js";import{t as P}from"./createLucideIcon-D6HmSa4x.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./tabs-BwkcW6ok.js";import{_ as fe,b as pe,c as me,d as he,f as ge,g as _e,i as ve,l as ye,m as be,n as xe,o as Se,p as Ce,r as we,s as Te,t as Ee,u as De,v as Oe,y as ke}from"./setComponentFile-Dhrmd8eR.js";import{$t as Ae,A as je,At as Me,B as Ne,Bt as Pe,C as Fe,Ct as F,Dt as Ie,Et as Le,F as Re,Ft as ze,G as Be,Gt as Ve,H as He,I as Ue,J as We,K as Ge,L as Ke,M as qe,N as Je,Ot as Ye,P as Xe,Pt as Ze,Qt as Qe,St as I,T as $e,Tt as et,U as tt,W as nt,X as rt,Xt as it,Y as at,Yt as ot,Z as st,Zt as ct,_n as lt,an as ut,at as dt,bn as ft,bt as L,c as pt,ct as mt,d as ht,dn as gt,dt as _t,en as vt,et as yt,f as bt,fn as xt,ft as St,g as Ct,gn as wt,gt as Tt,h as Et,hn as Dt,ht as Ot,it as kt,jt as At,kt as jt,l as Mt,ln as Nt,lt as Pt,m as Ft,mn as It,mt as Lt,n as Rt,nt as zt,on as Bt,ot as Vt,pn as Ht,pt as Ut,q as Wt,qt as Gt,rt as Kt,s as qt,sn as Jt,st as Yt,tn as Xt,tt as Zt,u as Qt,un as $t,ut as en,vn as tn,vt as R,w as nn,wt as z,x as rn,xt as an,yt as B,z as on,zt as sn}from"./index-Cd3Zh3nK.js";import{i as cn,n as ln,o as un,r as dn,t as fn}from"./editor.api-B3GrPa_a.js";import{t as pn}from"./useEntityRestURL-D7vuaG2W.js";var mn=P(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),hn=P(`arrow-up-a-z`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),gn=P(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),_n=P(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),vn=P(`case-lower`,[[`path`,{d:`M10 9v7`,key:`ylp826`}],[`path`,{d:`M14 6v10`,key:`1jy4vg`}],[`circle`,{cx:`17.5`,cy:`12.5`,r:`3.5`,key:`1a9481`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`3.5`,key:`2jlv1r`}]]),yn=P(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),bn=P(`case-upper`,[[`path`,{d:`M15 11h4.5a1 1 0 0 1 0 5h-4a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h3a1 1 0 0 1 0 5`,key:`nxs35`}],[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}]]),xn=P(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Sn=P(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Cn=P(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),wn=P(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Tn=P(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),En=P(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Dn=P(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),On=P(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),kn=P(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),An=P(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),jn=P(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Mn=P(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Nn=P(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Pn=P(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Fn=P(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),In=P(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Ln=P(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Rn=P(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),zn=P(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Bn=P(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Vn=P(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Hn=P(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Un=P(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Wn=P(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Gn=P(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Kn=P(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),qn=P(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),Jn=P(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Yn=P(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),V=e(O(),1);function Xn(e,t=!1){let[n,r]=je(e,t),i=(0,V.useCallback)(e=>{e?.preventDefault?.(),r(e=>!e)},[r]),a=(0,V.useCallback)(e=>{e?.preventDefault?.(),r(!0)},[r]),o=(0,V.useCallback)(e=>{e?.preventDefault?.(),r(!1)},[r]);return(0,V.useMemo)(()=>({toggled:n,setToggled:r,toggle:i,toggleOn:a,toggleOff:o}),[i,r,o,a,n])}var Zn=(0,V.createContext)(null);function Qn(){return(0,V.useContext)(Zn)}var H=A();function $n(){let{reloadRootEntries:e,setFocusedItem:t,setSelectedItems:n}=Qn(),r=Ze();return(0,V.useCallback)(async a=>{let o=!1,s=a.filter(e=>e.from!==e.to);if(s.length===0)return;let c=`Renaming ${i(s.length,`File`,`Files`)}`,l={duration:6e4,action:{label:`Cancel`,onClick:()=>{o=!0}}};l.id=j.loading(c,{...l,description:(0,H.jsx)(st,{animated:!0,width:`0%`})});let u=s.length*3,d=0;function f(){d+=1,j.loading(c,{...l,description:(0,H.jsx)(st,{animated:!0,width:(d===0?0:d/u*100)+`%`})})}for(let e of s){let t=e.from.split(`/`),n=t.shift(),i=t.join(`/`),a=e.to.split(`/`),s=a.shift(),c=a.join(`/`),l=await me({...r,file:i,project:n,encoding:`base64`});if(o||(f(),await Ee({...r,file:c,project:s,encoding:`base64`,payload:l.message}),o)||(f(),await Ce({...r,file:i,project:n}),o))break;f()}d>=u?j.success(`Renamed ${i(s.length,`File`,`Files`)}`,{id:l.id,description:`All done!`,duration:3e3,action:{label:`OK`,onClick:()=>{}}}):j.warning(`Rename Cancelled`,{id:l.id,description:`${d} of ${u} steps completed.`,duration:1e4,action:{label:`OK`,onClick:()=>{}}}),e(),n(e=>{let t=e.slice();for(let e of s){let n=t.indexOf(e.from);n>=0?t.splice(n,1,e.to):t.push(e.to)}return t}),t(e=>{for(let t of s)if(e===t.from)return t.to;return e})},[r,e,t,n])}function er(e,t){return e[t]!==void 0}function tr(e){return t=>er(t,e)}var nr=[{handleGlobal(e,t){if((t.cmd||t.ctrl)&&e===`Delete`)return Mt(`ShowDeleteDirectoryOrFileModal`,!0),!0},addEditorAction(e){return{id:`delete-file`,label:`Delete File`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Delete],run:pt(`ShowDeleteDirectoryOrFileModal`,!0)}}},{handleGlobal(e,t){if(t.ctrl&&t.alt&&t.shift&&e===`˜`)return Mt(`ShowAddDirectoryOrFileModalType`,`directory`),!0},addEditorAction(e){return{id:`new-directory`,label:`New Directory`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyMod.Shift|e.KeyCode.KeyN],run:pt(`ShowAddDirectoryOrFileModalType`,`directory`)}}},{handleGlobal(e,t){if(t.ctrl&&e===`n`)return Mt(`ShowAddDirectoryOrFileModalType`,`file`),!0},addEditorAction(e){return{id:`new-file`,label:`New File`,keybindings:[e.KeyMod.WinCtrl|e.KeyCode.KeyN],run:pt(`ShowAddDirectoryOrFileModalType`,`file`)}}},{handleGlobal(e){if(e===`F2`)return Mt(`ShowRenameFileModal`,`file`),!0},addEditorAction(e){return{id:`rename-file`,label:`Rename File`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyCode.KeyR,e.KeyCode.F2],run:pt(`ShowRenameFileModal`,!0)}}},{addEditorAction(){return{id:`revert-file`,label:`Revert File`,run:qe(`RevertChanges`,!0)}}},{handleGlobal(e,t){if(t.cmd&&e===`s`)return Je(`SaveFile`,!0),!0},addEditorAction(e){return{id:`save-file`,label:`Save Changes`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],run:qe(`SaveFile`,!0)}}}],rr=nr.filter(tr(`addEditorAction`)),ir=nr.filter(tr(`handleGlobal`));function ar(e){let[t,n]=e,r=rr.map(e=>t.addAction(e.addEditorAction(n)));return()=>{for(let e of r)e?.dispose()}}function or(){(0,V.useEffect)(()=>(document.addEventListener(`keydown`,sr),()=>{document.removeEventListener(`keydown`,sr)}),[])}function sr(e){let t={cmd:e.getModifierState(`Meta`),alt:e.getModifierState(`Alt`),shift:e.getModifierState(`Shift`),ctrl:e.getModifierState(`Control`)};for(let n of ir)if(n.handleGlobal(e.key,t)){e.preventDefault();return}}function cr(e){return e.split(`/`).pop()}var lr;(function(e){e.DoubleClickItemToExpand=`double-click-item-to-expand`,e.ClickItemToExpand=`click-item-to-expand`,e.ClickArrowToExpand=`click-arrow-to-expand`})(lr||={});var ur=function(){return ur=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ur.apply(this,arguments)},dr=function(e,t){return{mode:e.mode,createInteractiveElementProps:function(n,r,i,a){return ur(ur({},t.createInteractiveElementProps(n,r,i,a)),e.createInteractiveElementProps(n,r,i,a))}}},fr=function(e){return e.ctrlKey||navigator.platform.toUpperCase().indexOf(`MAC`)>=0&&e.metaKey},pr=function(){function e(e){this.mode=lr.DoubleClickItemToExpand,this.environment=e}return e.prototype.createInteractiveElementProps=function(e,t,n,r){var i=this;return{onClick:function(e){var t=e.detail===0;n.focusItem(),e.shiftKey&&!t?n.selectUpTo(!fr(e)):fr(e)&&!t?r.isSelected?n.unselectItem():n.addToSelectedItems():n.selectItem()},onDoubleClick:function(){n.focusItem(),n.selectItem(),e.isFolder&&n.toggleExpandedState(),(!e.isFolder||i.environment.canInvokePrimaryActionOnItemContainer)&&n.primaryAction()},onFocus:function(){n.focusItem()},onDragStart:function(e){e.dataTransfer.dropEffect=`move`,n.startDragging()},onDragOver:function(e){e.preventDefault()},draggable:r.canDrag&&!r.isRenaming,tabIndex:r.isRenaming?void 0:r.isFocused?0:-1}},e}(),mr=function(){function e(e){this.mode=lr.ClickItemToExpand,this.environment=e}return e.prototype.createInteractiveElementProps=function(e,t,n,r){var i=this;return{onClick:function(t){var a=t.detail===0;n.focusItem(),t.shiftKey&&!a?n.selectUpTo(!fr(t)):fr(t)&&!a?r.isSelected?n.unselectItem():n.addToSelectedItems():(e.isFolder&&n.toggleExpandedState(),n.selectItem(),(!e.isFolder||i.environment.canInvokePrimaryActionOnItemContainer)&&n.primaryAction())},onFocus:function(){n.focusItem()},onDragStart:function(e){e.dataTransfer.dropEffect=`move`,n.startDragging()},onDragOver:function(e){e.preventDefault()},draggable:r.canDrag&&!r.isRenaming,tabIndex:r.isRenaming?void 0:r.isFocused?0:-1}},e}(),hr=function(){function e(e){this.mode=lr.ClickItemToExpand,this.environment=e}return e.prototype.createInteractiveElementProps=function(e,t,n,r){var i=this;return{onClick:function(t){var a=t.detail===0;n.focusItem(),t.shiftKey&&!a?n.selectUpTo(!fr(t)):fr(t)&&!a?r.isSelected?n.unselectItem():n.addToSelectedItems():(n.selectItem(),(!e.isFolder||i.environment.canInvokePrimaryActionOnItemContainer)&&n.primaryAction())},onFocus:function(){n.focusItem()},onDragStart:function(e){e.dataTransfer.dropEffect=`move`,n.startDragging()},onDragOver:function(e){e.preventDefault()},draggable:r.canDrag&&!r.isRenaming,tabIndex:r.isRenaming?void 0:r.isFocused?0:-1}},e}(),gr=function(e,t){switch(e){case lr.DoubleClickItemToExpand:return new pr(t);case lr.ClickItemToExpand:return new mr(t);case lr.ClickArrowToExpand:return new hr(t);default:throw Error(`Unknown interaction mode ${e}`)}},_r=V.createContext(null),vr=function(){return V.useContext(_r)},yr=function(e){var t=e.children,n=U(),r=n.defaultInteractionMode,i=(0,V.useMemo)(function(){return r&&typeof r!=`string`?r.extends?dr(r,gr(r.extends,n)):r:gr(r??lr.ClickItemToExpand,n)},[]);return V.createElement(_r.Provider,{value:i},t)},br=function(){var e=U();return(0,V.useCallback)(function(t,n){if(t.targetType===`between-items`){if(!e.canReorderItems)return!1}else if(t.targetType===`root`){if(!e.canDropOnFolder)return!1}else{var r=e.items[t.targetItem];if(!r||!e.canDropOnFolder&&r.isFolder||!e.canDropOnNonFolder&&!r.isFolder||n.some(function(e){return e.index===t.targetItem}))return!1}return!(e.canDropAt&&(!n||!e.canDropAt(n,t)))},[e])},xr=function(){var e=U();return(0,V.useCallback)(function(t,n){for(var r=e.linearItems[n],i=r[t].depth,a=t;r[a]&&r[a].depth!==i-1;--a);var o=r[a];return o||(o={item:e.trees[n].rootItem,depth:0},a=0),{parent:o,parentLinearIndex:a}},[e.linearItems,e.trees])},Sr=function(){var e=U(),t=xr(),n=br(),r=(0,V.useCallback)(function(e,n,i){var a=t(n,e),o=a.parent,s=a.parentLinearIndex;return i.some(function(e){return e.index===o.item})?!0:o.depth===0?!1:r(e,s,i)},[t]);return(0,V.useCallback)(function(i,a){for(var o=e.linearItems[i],s=[],c=-1,l=0;l<o.length;l++){var u=o[l],d=u.item,f=u.depth;if(!(c!==-1&&f>c)){c=-1;var p=t(l,i).parent,m=e.items[p.item].children.indexOf(d);if(r(i,l,a)){c=f+1;continue}var h={targetType:`item`,parentItem:p.item,targetItem:d,linearIndex:l,depth:f,treeId:i},g={targetType:`between-items`,parentItem:p.item,linePosition:`top`,childIndex:m,depth:f,treeId:i,linearIndex:l},_={targetType:`between-items`,parentItem:p.item,linePosition:`bottom`,linearIndex:l+1,childIndex:m+1,depth:f,treeId:i},v=o[l-1]?.depth??-1,y=o[l+1]?.depth??-1,b=f===v,x=f===y-1;!b&&n(g,a)&&s.push(g),n(h,a)&&s.push(h),!x&&n(_,a)&&s.push(_)}}return s},[n,e.items,e.linearItems,t,r])},Cr=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},wr=function(e,t,n){var r=(0,V.useRef)();(0,V.useEffect)(function(){r.current?r.current.some(function(e,t){return e!==n[t]})&&(r.current=Cr([],n,!0),e()):(r.current=Cr([],n,!0),e())},Cr(Cr([],t,!0),n,!0))},Tr=function(){return Tr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Tr.apply(this,arguments)},Er=function(e,t){return e.map(function(e){return[e,t(e)]}).reduce(function(e,t){var n,r=t[0],i=t[1];return Tr(Tr({},e),(n={},n[r]=i,n))},{})},Dr=function(){return typeof document<`u`?document:void 0};function Or(e){e===void 0&&(e=!1);var t=(0,V.useRef)([]);return(0,V.useEffect)(function(){if(e)return function(){};var n=t.current;return function(){return n.forEach(function(e){return cancelAnimationFrame(e)})}},[e,t]),(0,V.useCallback)(function(e){var n=requestAnimationFrame(function(){t.current.splice(t.current.indexOf(n),1),e()});t.current.push(n)},[t])}var kr=function(e){var t=(0,V.useRef)(e);return t.current=e,t},Ar=function(e){var t=kr(e);return(0,V.useCallback)((function(){var e=[...arguments];return t.current.apply(t,e)}),[t])},jr=function(){var e=U();return Ar(function(t,n){return n.map(function(n){return[n,e.linearItems[t].findIndex(function(e){return e.item===n.index})]}).sort(function(e,t){e[0];var n=e[1];return t[0],n-t[1]}).map(function(e){return e[0]})})},Mr=function(e){var t=Dr()?.querySelector(`[data-rct-tree="${e}"] [data-rct-item-container="true"]`);if(t){var n=getComputedStyle(t);return t.offsetHeight+Math.max(parseFloat(n.marginTop),parseFloat(n.marginBottom))}return 5},Nr=function(e,t){return e.clientX<=t.left||e.clientX>=t.right||e.clientY<=t.top||e.clientY>=t.bottom},Pr=function(){function e(e,t,n,r,i,a){this.env=e,this.e=t,this.treeId=n,this.linearIndex=r.linearIndex,this.offset=r.offset,this.indentation=r.indentation,this.targetItem=this.env.linearItems[this.treeId][this.linearIndex],this.getParentOfLinearItem=a,this.draggingItems=i}return e.prototype.getEmptyTreeDragPosition=function(){return{targetType:`root`,treeId:this.treeId,depth:0,linearIndex:0,targetItem:this.env.trees[this.treeId].rootItem}},e.prototype.maybeRedirectToParent=function(){if(!this.env.canReorderItems&&!this.env.canDropOnNonFolder&&!this.env.items[this.targetItem.item].isFolder){var e=this.getParentOfLinearItem(this.linearIndex,this.treeId),t=e.parentLinearIndex,n=e.parent;this.targetItem=n,this.linearIndex=t}},e.prototype.maybeReparentUpwards=function(){if(this.indentation!==void 0){var e=this.env.linearItems[this.treeId],t=e[this.linearIndex].depth,n=t-(e[this.linearIndex+1]?.depth??0);if(this.offset===`bottom`&&n>0){for(var r=Math.max(t-n,this.indentation),i={parentLinearIndex:this.linearIndex,parent:this.targetItem},a,o=t;o>=r;--o)a=i,i=this.getParentOfLinearItem(i.parentLinearIndex,this.treeId);if(this.indentation!==e[this.linearIndex].depth&&a){var s=this.env.items[i.parent.item].children.indexOf(a.parent.item)+1;if(!(this.draggingItems&&this.isDescendant(this.treeId,i.parentLinearIndex+1,this.draggingItems)))return{targetType:`between-items`,treeId:this.treeId,parentItem:i.parent.item,depth:r,linearIndex:this.linearIndex+1,childIndex:s,linePosition:`bottom`}}}}},e.prototype.maybeRedirectInsideOpenFolder=function(){var e=this.env.linearItems[this.treeId][this.linearIndex+1];!this.env.canDropBelowOpenFolders&&e&&this.targetItem.depth===e.depth-1&&this.offset===`bottom`&&(this.targetItem=e,this.linearIndex+=1,this.offset=`top`)},e.prototype.maybeMapToBottomOffset=function(){var e=this.env.linearItems[this.treeId][this.linearIndex-1];if(!(!e||e?.depth===void 0)){var t=e.depth-this.targetItem.depth;this.offset===`top`&&(t===0||t>0&&this.indentation!==void 0)&&(this.offset=`bottom`,--this.linearIndex,this.targetItem=this.env.linearItems[this.treeId][this.linearIndex])}},e.prototype.canDropAtCurrentTarget=function(){var e=this,t=this.env.items[this.targetItem.item];return!(!this.offset&&!this.env.canDropOnNonFolder&&!t.isFolder||!this.offset&&!this.env.canDropOnFolder&&t.isFolder||this.offset&&!this.env.canReorderItems||this.draggingItems?.some(function(t){return t.index===e.targetItem.item}))},e.prototype.getDraggingPosition=function(){if(this.env.linearItems[this.treeId].length===0)return this.getEmptyTreeDragPosition();if(!(!this.draggingItems||this.linearIndex<0||this.linearIndex>=this.env.linearItems[this.treeId].length)){this.maybeRedirectToParent(),this.maybeRedirectInsideOpenFolder(),this.maybeMapToBottomOffset();var e=this.maybeReparentUpwards();if(e)return e;if(this.areDraggingItemsDescendantOfTarget()||!this.canDropAtCurrentTarget())return`invalid`;var t=this.getParentOfLinearItem(this.linearIndex,this.treeId).parent,n=this.env.items[t.item].children.indexOf(this.targetItem.item)+(this.offset===`top`?0:1);return this.offset?{targetType:`between-items`,treeId:this.treeId,parentItem:t.item,depth:this.targetItem.depth,linearIndex:this.linearIndex+(this.offset===`top`?0:1),childIndex:n,linePosition:this.offset}:{targetType:`item`,treeId:this.treeId,parentItem:t.item,targetItem:this.targetItem.item,depth:this.targetItem.depth,linearIndex:this.linearIndex}}},e.prototype.isDescendant=function(e,t,n){var r=this.getParentOfLinearItem(t,e),i=r.parentLinearIndex,a=r.parent;return n.some(function(e){return e.index===a.item})?!0:a.depth===0?!1:this.isDescendant(e,i,n)},e.prototype.areDraggingItemsDescendantOfTarget=function(){return this.draggingItems&&this.isDescendant(this.treeId,this.linearIndex,this.draggingItems)},e}(),Fr=function(){var e=(0,V.useRef)(`initial`),t=(0,V.useState)(void 0),n=t[0],r=t[1],i=(0,V.useRef)(0),a=U(),o=xr(),s=Ar(function(t,n,r){if(!r)return!1;var i=r.offset,a=`${n}__${r.linearIndex}__${i??``}__${r.indentation}`;return a===e.current?!1:(e.current=a,!0)}),c=Ar(function(e,t,n){if(n.current){var r=n.current.getBoundingClientRect();if(!Nr(e,r)){var o=(e.clientY-r.top)/i.current,s=a.linearItems[t],c=Math.min(Math.max(0,Math.floor(o)),s.length-1);if(s.length===0)return{linearIndex:0,offset:`bottom`,indentation:0};var l=s[c],u=a.items[l.item],d=a.renderDepthOffset?Math.max(Math.floor((e.clientX-r.left)/a.renderDepthOffset),0):void 0,f,p=a.canReorderItems?u?.isFolder&&a.canDropOnFolder||a.canDropOnNonFolder?.2:.5:0;return o-.5>=s.length-1?f=`bottom`:o%1<p?f=`top`:o%1>1-p&&(f=`bottom`),{linearIndex:c,offset:f,indentation:d}}}}),l=Ar(function(e,t,r){var i=c(e,t,r);if(s(e,t,i))return!n||!a.canDragAndDrop||!i||e.clientX<0||e.clientY<0?`invalid`:new Pr(a,e,t,i,n,o).getDraggingPosition()});return{initiateDraggingPosition:Ar(function(t,n){r(n),e.current=`initial`,i.current=Mr(t)}),resetDraggingPosition:Ar(function(){r(void 0),e.current=`initial`,i.current=0}),draggingItems:n,getDraggingPosition:l,itemHeight:i}},Ir=V.createContext(null),Lr=function(){return V.useContext(Ir)},Rr=function(e){var t=e.children,n=U(),r=(0,V.useState)(!1),i=r[0],a=r[1],o=(0,V.useState)({}),s=o[0],c=o[1],l=(0,V.useState)(0),u=l[0],d=l[1],f=(0,V.useState)(),p=f[0],m=f[1],h=Sr(),g=Or(),_=jr(),v=Fr(),y=v.initiateDraggingPosition,b=v.resetDraggingPosition,x=v.draggingItems,S=v.getDraggingPosition,C=v.itemHeight,w=(0,V.useCallback)(function(e,t){if(n.activeTreeId&&n.viewState[n.activeTreeId]?.focusedItem&&n.linearItems&&t){var r=n.viewState[n.activeTreeId].focusedItem,i=h(n.activeTreeId,t),a=i.findIndex(function(e){return e.targetType===`item`?e.targetItem===r:e.targetType===`between-items`?n.items[e.parentItem].children[e.childIndex]===r:!1});d(a?Math.min(a+1,i.length-1):0)}else d(0)},[n.activeTreeId,n.items,n.linearItems,n.viewState,h]),T=Ar(function(){a(!1),c({}),d(0),m(void 0),b()});wr(function(){n.activeTreeId&&n.linearItems[n.activeTreeId]&&s[n.activeTreeId]&&w(s[n.activeTreeId],x)},[x,n.activeTreeId,n.linearItems,w,s],[n.activeTreeId]),wr(function(){i&&n.activeTreeId&&m(s[n.activeTreeId][u])},[u,n.activeTreeId,i,s],[u,n.activeTreeId]);var E=br(),ee=function(e){var t;x&&!E(e,x)||(m(e),n.setActiveTree(e.treeId),x&&n.activeTreeId!==e.treeId&&((t=n.onSelectItems)==null||t.call(n,x.map(function(e){return e.index}),e.treeId)))},D=Ar(function(e,t,n){if(x){var r=S(e,t,n);if(r){if(r===`invalid`){m(void 0);return}ee(r)}}}),O=Ar(function(e,t){t.current&&Nr(e,t.current.getBoundingClientRect())&&m(void 0)}),k=Ar(function(){!x||!p||!n.onDrop||(n.onDrop(x,p),g(function(){var e;(e=n.onFocusItem)==null||e.call(n,x[0],p.treeId),T()}))}),A=(0,V.useCallback)(function(e,t){var r=Er(n.treeIds,function(t){return h(t,e)});y(t,e),c(r),n.activeTreeId&&w(r[n.activeTreeId],e)},[n.activeTreeId,n.treeIds,h,y,w]),j=(0,V.useCallback)(function(){if(n.canDragAndDrop&&n.activeTreeId){var e=n.viewState[n.activeTreeId]?.selectedItems??[n.viewState[n.activeTreeId]?.focusedItem];if(e.length===0||e[0]===void 0)return;var t=_(n.activeTreeId,e.map(function(e){return n.items[e]}));if(n.canDrag&&!n.canDrag(t))return;A(t,n.activeTreeId),setTimeout(function(){a(!0)})}},[n,_,A]),M=(0,V.useCallback)(function(){T()},[T]),N=(0,V.useCallback)(function(){k(),T()},[k,T]),te=(0,V.useCallback)(function(){d(function(e){return Math.max(0,e-1)})},[]),ne=(0,V.useCallback)(function(){n.activeTreeId&&d(function(e){return Math.min(s[n.activeTreeId].length-1,e+1)})},[n.activeTreeId,s]),re=(0,V.useMemo)(function(){return{onStartDraggingItems:A,startProgrammaticDrag:j,abortProgrammaticDrag:M,completeProgrammaticDrag:N,programmaticDragUp:te,programmaticDragDown:ne,draggingItems:x,draggingPosition:p,itemHeight:C.current,isProgrammaticallyDragging:i,onDragOverTreeHandler:D,onDragLeaveContainerHandler:O,viableDragPositions:s}},[M,N,x,p,i,C,D,O,A,ne,te,j,s]);return(0,V.useEffect)(function(){return window.addEventListener(`dragend`,T),window.addEventListener(`drop`,k),function(){window.removeEventListener(`dragend`,T),window.removeEventListener(`drop`,k)}},[k,T]),V.createElement(Ir.Provider,{value:re},t)},zr=function(){return zr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zr.apply(this,arguments)},Br=function(e,t){var n=U(),r=Lr();(0,V.useImperativeHandle)(e,function(){return zr(zr(zr({},t),n),{treeEnvironmentContext:n,dragAndDropContext:r})})},Vr=function(e,t,n){return t===void 0&&(t=50),n===void 0&&(n=1e4),new Promise(function(r){e()&&r();var i,a=setInterval(function(){e()&&i()},t),o=setTimeout(function(){i()},n);i=function(){clearInterval(a),clearTimeout(o),r()}})},Hr=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ur=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}},Wr=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Gr=V.createContext(null),Kr=function(){return V.useContext(Gr)},qr=function(e,t,n){return Hr(void 0,void 0,void 0,function(){var r,i,a,o;return Ur(this,function(s){for(r=function(e){Vr(function(){return!!t.current?.[e]}).then(function(){var r=t.current?.[e];r?.isFolder&&(n(r),qr(e,t,n))})},i=0,a=t.current?.[e]?.children??[];i<a.length;i++)o=a[i],r(o);return[2]})})},Jr=V.forwardRef(function(e,t){var n=U(),r=n.onCollapseItem,i=n.items,a=n.trees,o=n.viewState,s=n.onExpandItem,c=n.onFocusItem,l=n.setActiveTree,u=n.onRenameItem,d=n.onSelectItems,f=n.onPrimaryAction,p=n.linearItems,m=Lr(),h=m.abortProgrammaticDrag,g=m.completeProgrammaticDrag,_=m.programmaticDragDown,v=m.programmaticDragUp,y=m.startProgrammaticDrag,b=kr(i),x=(0,V.useCallback)(function(e,t){r?.(i[e],t)},[i,r]),S=(0,V.useCallback)(function(e,t){s?.(i[e],t)},[i,s]),C=(0,V.useCallback)(function(e,t,n){n===void 0&&(n=!0),c?.(i[e],t,n)},[i,c]),w=(0,V.useCallback)(function(e,t){t===void 0&&(t=!0),l(e,t)},[l]),T=(0,V.useCallback)(function(e){var t=p[e],n=t.findIndex(function(t){return t.item===o[e]?.focusedItem}),r=i[t[n===void 0?0:Math.min(t.length-1,n+1)].item];c?.(r,e)},[i,p,c,o]),E=(0,V.useCallback)(function(e){var t=p[e],n=t.findIndex(function(t){return t.item===o[e]?.focusedItem}),r=i[t[n===void 0?0:Math.max(0,n-1)].item];c?.(r,e)},[i,p,c,o]),ee=(0,V.useCallback)(function(e,t,n){u?.(i[e],t,n)},[i,u]),D=(0,V.useCallback)(function(e,t){d?.(e,t)},[d]),O=(0,V.useCallback)(function(e,t){(o[t]?.expandedItems)?.includes(e)?r?.(i[e],t):s?.(i[e],t)},[i,r,s,o]),k=(0,V.useCallback)(function(e,t){(o[t]?.selectedItems)?.includes(e)?d?.(o[t].selectedItems?.filter(function(t){return t!==e})??[],t):d?.(Wr(Wr([],o[t].selectedItems??[],!0),[e],!1),t)},[d,o]),A=(0,V.useCallback)(function(e,t){f?.(i[e],t)},[i,f]),j=(0,V.useCallback)(function(e,t){return Hr(void 0,void 0,void 0,function(){var n,r;return Ur(this,function(i){switch(i.label){case 0:return n=t[0],r=t.slice(1),[4,Vr(function(){return!!b.current?.[n]}).then(function(){var t=b.current[n];return t?(s?.(t,e),r.length>0?j(e,r):Promise.resolve()):Promise.resolve()})];case 1:return i.sent(),[2]}})})},[b,s]),M=(0,V.useCallback)(function(e){return Hr(void 0,void 0,void 0,function(){return Ur(this,function(t){switch(t.label){case 0:return[4,qr(a[e].rootItem,b,function(t){return s?.(t,e)})];case 1:return t.sent(),[2]}})})},[b,s,a]),N=(0,V.useCallback)(function(e){for(var t=0,n=o[e]?.expandedItems??[];t<n.length;t++){var a=n[t];r?.(i[a],e)}},[i,r,o]),te=(0,V.useMemo)(function(){return{collapseItem:x,expandItem:S,focusItem:C,focusTree:w,moveFocusDown:T,moveFocusUp:E,renameItem:ee,selectItems:D,toggleItemExpandedState:O,toggleItemSelectStatus:k,invokePrimaryAction:A,expandAll:M,expandSubsequently:j,collapseAll:N,abortProgrammaticDrag:h,completeProgrammaticDrag:g,moveProgrammaticDragPositionDown:_,moveProgrammaticDragPositionUp:v,startProgrammaticDrag:y}},[x,S,C,w,T,E,ee,D,O,k,A,M,j,N,h,g,_,v,y]);return Br(t,te),V.createElement(Gr.Provider,{value:te},e.children)}),Yr=function(e){if(e)if(e.scrollIntoViewIfNeeded)e.scrollIntoViewIfNeeded();else{var t=e.getBoundingClientRect();t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||!!Dr()?.documentElement?.clientHeight)&&t.right<=(window.innerWidth||!!Dr()?.documentElement?.clientWidth)||e.scrollIntoView()}},Xr=function(){return Xr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Xr.apply(this,arguments)},Zr=function(){return[...arguments].filter(function(e){return!!e}).join(` `)},Qr=function(e,t){return{renderItemTitle:function(e){var t=e.title,n=e.context,r=e.info;if(!r.isSearching||!n.isSearchMatching)return t;var i=t.toLowerCase().indexOf(r.search.toLowerCase());return V.createElement(V.Fragment,null,i>0&&V.createElement(`span`,null,t.slice(0,i)),V.createElement(`span`,{className:`rct-tree-item-search-highlight`},t.slice(i,i+r.search.length)),i+r.search.length<t.length&&V.createElement(`span`,null,t.slice(i+r.search.length,t.length)))},renderItemArrow:function(e){var t=e.item,n=e.context;return V.createElement(`div`,Xr({className:Zr(t.isFolder&&`rct-tree-item-arrow-isFolder`,n.isExpanded&&`rct-tree-item-arrow-expanded`,`rct-tree-item-arrow`)},n.arrowProps),t.isFolder&&(n.isExpanded?V.createElement(`svg`,{version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,x:`0px`,y:`0px`,viewBox:`0 0 16 16`,enableBackground:`new 0 0 16 16`,xmlSpace:`preserve`},V.createElement(`g`,null,V.createElement(`g`,null,V.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z`,className:`rct-tree-item-arrow-path`})))):V.createElement(`svg`,{version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,x:`0px`,y:`0px`,viewBox:`0 0 16 16`,enableBackground:`new 0 0 16 16`,xmlSpace:`preserve`},V.createElement(`g`,null,V.createElement(`g`,null,V.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z`,className:`rct-tree-item-arrow-path`}))))))},renderItem:function(t){var n=t.item,r=t.depth,i=t.children,a=t.title,o=t.context,s=t.arrow,c=o.isRenaming?`div`:`button`,l=o.isRenaming?void 0:`button`;return V.createElement(`li`,Xr({},o.itemContainerWithChildrenProps,{className:Zr(`rct-tree-item-li`,n.isFolder&&`rct-tree-item-li-isFolder`,o.isSelected&&`rct-tree-item-li-selected`,o.isExpanded&&`rct-tree-item-li-expanded`,o.isFocused&&`rct-tree-item-li-focused`,o.isDraggingOver&&`rct-tree-item-li-dragging-over`,o.isSearchMatching&&`rct-tree-item-li-search-match`)}),V.createElement(`div`,Xr({},o.itemContainerWithoutChildrenProps,{style:{"--depthOffset":`${(r+1)*e}px`},className:Zr(`rct-tree-item-title-container`,n.isFolder&&`rct-tree-item-title-container-isFolder`,o.isSelected&&`rct-tree-item-title-container-selected`,o.isExpanded&&`rct-tree-item-title-container-expanded`,o.isFocused&&`rct-tree-item-title-container-focused`,o.isDraggingOver&&`rct-tree-item-title-container-dragging-over`,o.isSearchMatching&&`rct-tree-item-title-container-search-match`)}),s,V.createElement(c,Xr({type:l},o.interactiveElementProps,{className:Zr(`rct-tree-item-button`,n.isFolder&&`rct-tree-item-button-isFolder`,o.isSelected&&`rct-tree-item-button-selected`,o.isExpanded&&`rct-tree-item-button-expanded`,o.isFocused&&`rct-tree-item-button-focused`,o.isDraggingOver&&`rct-tree-item-button-dragging-over`,o.isSearchMatching&&`rct-tree-item-button-search-match`)}),a)),i)},renderRenameInput:function(e){var t=e.inputProps,n=e.inputRef,r=e.submitButtonProps,i=e.submitButtonRef,a=e.formProps;return V.createElement(`form`,Xr({},a,{className:`rct-tree-item-renaming-form`}),V.createElement(`input`,Xr({},t,{ref:n,className:`rct-tree-item-renaming-input`})),V.createElement(`input`,Xr({},r,{ref:i,type:`submit`,className:`rct-tree-item-renaming-submit-button`,value:`🗸`})))},renderTreeContainer:function(e){var n=e.children,r=e.containerProps,i=e.info;return V.createElement(`div`,{className:Zr(`rct-tree-root`,i.isFocused&&`rct-tree-root-focus`,i.isRenaming&&`rct-tree-root-renaming`,i.areItemsSelected&&`rct-tree-root-itemsselected`,t&&`rct-rtl`)},V.createElement(`div`,Xr({},r,{style:Xr({minHeight:`30px`},r.style)}),n))},renderItemsContainer:function(e){var t=e.children,n=e.containerProps;return V.createElement(`ul`,Xr({},n,{className:`rct-tree-items-container`}),t)},renderDragBetweenLine:function(t){var n=t.draggingPosition,r=t.lineProps;return V.createElement(`div`,Xr({},r,{style:{left:`${n.depth*e}px`},className:Zr(`rct-tree-drag-between-line`,n.targetType===`between-items`&&n.linePosition===`top`&&`rct-tree-drag-between-line-top`,n.targetType===`between-items`&&n.linePosition===`bottom`&&`rct-tree-drag-between-line-bottom`)}))},renderSearchInput:function(e){var t=e.inputProps;return V.createElement(`div`,{className:Zr(`rct-tree-search-input-container`)},V.createElement(`span`,{className:`rct-tree-input-icon`}),V.createElement(`input`,Xr({},t,{className:Zr(`rct-tree-search-input`)})))},renderLiveDescriptorContainer:function(e){var t=e.tree,n=e.children;return V.createElement(`div`,{id:`rct-livedescription-${t.treeId}`,style:{clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,overflow:`hidden`,position:`absolute`,whiteSpace:`nowrap`,width:`1px`}},n)},renderDepthOffset:e}},$r=function(e){var t=e.renderItem,n=e.renderItemTitle,r=e.renderItemArrow,i=e.renderRenameInput,a=e.renderItemsContainer,o=e.renderTreeContainer,s=e.renderDragBetweenLine,c=e.renderSearchInput,l=e.renderLiveDescriptorContainer,u=e.renderDepthOffset,d=(0,V.useMemo)(function(){return Qr(u??10)},[u]),f={renderItem:t,renderItemTitle:n,renderItemArrow:r,renderRenameInput:i,renderItemsContainer:a,renderTreeContainer:o,renderDragBetweenLine:s,renderSearchInput:c,renderLiveDescriptorContainer:l,renderDepthOffset:u},p=Object.entries(d).reduce(function(e,t){var n=t[0],r=t[1],i=n;return f[i]?e[i]=f[i]:e[i]=r,e},{});return p.renderItem.displayName=`RenderItem`,p.renderItemTitle.displayName=`RenderItemTitle`,p.renderItemArrow.displayName=`RenderItemArrow`,p.renderRenameInput.displayName=`RenderRenameInput`,p.renderItemsContainer.displayName=`RenderItemsContainer`,p.renderTreeContainer.displayName=`RenderTreeContainer`,p.renderDragBetweenLine.displayName=`RenderDragBetweenLine`,p.renderSearchInput.displayName=`RenderSearchInput`,p},ei=function(e,t,n,r){r===void 0&&(r=0);for(var i=[],a=0,o=n[e]?.children??[];a<o.length;a++){var s=o[a],c=n[s];i.push({item:s,depth:r}),c&&c.isFolder&&c.children&&t.expandedItems?.includes(s)&&i.push.apply(i,ei(s,t,n,r+1))}return i},ti=function(){return ti=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ti.apply(this,arguments)},ni=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ri=function(e){var t=e.onExpandItem,n=e.onCollapseItem,r=e.onDrop,i=ni(e,[`onExpandItem`,`onCollapseItem`,`onDrop`]),a=(0,V.useState)({}),o=a[0],s=a[1],c=(0,V.useState)(),l=c[0],u=c[1],d=(0,V.useMemo)(function(){return Object.keys(o)},[o]),f=i.onFocusItem,p=i.autoFocus,m=i.onRegisterTree,h=i.onUnregisterTree,g=i.items,_=i.viewState,v=kr(f),y=kr(_),b=(0,V.useMemo)(function(){return Er(d,function(e){return ei(o[e].rootItem,_[e]??{},g)})},[o,g,d,_]),x=(0,V.useCallback)(function(e,t,n){var r,i;if(n===void 0&&(n=!0),(p??!0)&&n){var a=Dr()?.querySelector(`[data-rct-tree="${t}"] [data-rct-item-id="${e.index}"]`)??Dr()?.querySelector(`[data-rct-tree="${t}"] [data-rct-item-id]`);(Dr()?.activeElement)?.attributes.getNamedItem(`data-rct-search-input`)?.value===`true`?Yr(a):(r=a?.focus)==null||r.call(a)}y.current[t]?.focusedItem!==e.index&&((i=v.current)==null||i.call(v,e,t))},[p,v,y]),S=(0,V.useCallback)(function(e){s(function(t){var n;return ti(ti({},t),(n={},n[e.treeId]=e,n))}),m?.(e)},[m]),C=(0,V.useCallback)(function(e){h?.(o[e]),delete o[e],s(o)},[h,o]),w=(0,V.useCallback)(function(e,t){n?.(e,t),s(function(e){return e})},[n]),T=(0,V.useCallback)(function(e,n){t?.(e,n),s(function(e){return e})},[t]),E=(0,V.useCallback)(function(e,t){r?.(e,t),s(function(e){return e})},[r]),ee=(0,V.useCallback)(function(e){var t,n=Dr()?.querySelector(`[data-rct-tree="${e}"] [data-rct-item-focus="true"]`);(t=n?.focus)==null||t.call(n)},[]),D=(0,V.useCallback)(function(e,t){t===void 0&&(t=!0);var n=function(e){t&&(p??!0)&&e&&!(Dr()?.querySelector(`[data-rct-tree="${e}"]`))?.contains(document.activeElement)&&ee(e)};if(typeof e==`function`)u(function(t){var r=e(t);return r!==t&&n(r),r});else{var r=e;u(r),n(r)}},[p,ee]),O=$r(i);return ti(ti(ti({},O),i),{onFocusItem:x,registerTree:S,unregisterTree:C,onExpandItem:T,onCollapseItem:w,onDrop:E,setActiveTree:D,treeIds:d,trees:o,activeTreeId:l,linearItems:b})},ii=V.createContext(null),U=function(){return(0,V.useContext)(ii)},ai=V.forwardRef(function(e,t){var n=ri(e),r=e.viewState,i=e.onFocusItem;return(0,V.useEffect)(function(){for(var t=0,a=Object.keys(n.trees);t<a.length;t++){var o=a[t],s=e.items[n.trees[o].rootItem]?.children?.[0],c=s&&e.items[s];!r[o]?.focusedItem&&n.trees[o]&&c&&i?.(c,o,!1)}},[n.trees,i,e.items,r]),V.createElement(ii.Provider,{value:n},V.createElement(yr,null,V.createElement(Rr,null,V.createElement(Jr,{ref:t},e.children))))}),oi=function(e){var t=e.treeId,n=Lr(),r=n.draggingPosition,i=n.itemHeight,a=Vi().renderers;return r&&r.targetType===`between-items`&&r.treeId===t?V.createElement(`div`,{style:{position:`absolute`,left:`0`,right:`0`,top:`${(r?.linearIndex??0)*i}px`}},a.renderDragBetweenLine({draggingPosition:r,lineProps:{onDragOver:function(e){return e.preventDefault()}}})):null},si=function(e,t,n){var r=Ar(n);(0,V.useEffect)(function(){return e?(e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}):function(){}},[e,r,t])},ci=function(e,t,n){var r=(0,V.useState)(!1),i=r[0],a=r[1],o=(0,V.useRef)(!1),s=Or();return si(e,`focusin`,function(){i||(a(!0),t?.()),o.current&&=!1}),si(e,`focusout`,function(){o.current=!0,s(function(){o.current&&!e?.contains(document.activeElement)&&(n?.(),o.current=!1,a(!1))})}),i},li=function(e,t,n){si(Dr(),`keydown`,function(r){n&&n&&e.toLowerCase()===r.key.toLowerCase()&&t(r)})},ui={expandSiblings:[`control+*`],moveFocusToFirstItem:[`home`],moveFocusToLastItem:[`end`],primaryAction:[`enter`],renameItem:[`f2`],abortRenameItem:[`escape`],toggleSelectItem:[`control+ `],abortSearch:[`escape`,`enter`],startSearch:[],selectAll:[`control+a`],startProgrammaticDnd:[`control+shift+d`],completeProgrammaticDnd:[`enter`],abortProgrammaticDnd:[`escape`]},di=function(){return di=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},di.apply(this,arguments)},fi=function(){var e=U();return(0,V.useMemo)(function(){return e.keyboardBindings?di(di({},ui),e.keyboardBindings):ui},[e.keyboardBindings])},pi=[`input`,`textarea`],mi=function(e,t,n,r){r===void 0&&(r=!1);var i=(0,V.useRef)([]),a=fi(),o=Or(),s=(0,V.useMemo)(function(){return a[e].map(function(e){return e.split(`+`)})},[e,a]);si(Dr(),`keydown`,function(e){if(n!==!1&&!((pi.includes(e.target.tagName?.toLowerCase())||e.target.isContentEditable)&&!r)&&!i.current.includes(e.key)){i.current.push(e.key);var t=i.current.map(function(e){return e.toLowerCase()});s.map(function(e){return t.map(function(t){return e.includes(t.toLowerCase())}).reduce(function(e,t){return e&&t},!0)}).reduce(function(e,t){return e||t},!1)&&(i.current.length>1||!/^[a-zA-Z\s]$/.test(e.key))&&e.preventDefault()}}),si(Dr(),`keyup`,function(e){if(n!==!1){var r=i.current.map(function(e){return e.toLowerCase()});s.map(function(e){return e.map(function(e){return r.includes(e.toLowerCase())}).reduce(function(e,t){return e&&t},!0)}).reduce(function(e,t){return e||t},!1)&&o(function(){return t(e)}),i.current=i.current.filter(function(t){return t!==e.key})}})},hi=function(){var e=Vi().treeId;return U().viewState[e]??{}},gi=function(e){return U().linearItems[e]},_i=function(){var e=Vi().treeId,t=U(),n=t.onFocusItem,r=t.items,i=gi(e),a=hi();return Ar(function(t){var o=t(i.findIndex(function(e){return e.item===a.focusedItem})??0,i),s=r[i[Math.max(0,Math.min(i.length-1,o))].item];return n?.(s,e),s})},vi=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},yi=function(e){var t=(0,V.useRef)({target:e,previous:void 0});return t.current.target!==e&&(t.current.previous=t.current.target,t.current.target=e),t.current.previous},bi=function(e){var t=hi(),n=Vi().treeId,r=gi(n),i=U().onSelectItems,a=yi(t.focusedItem);return(0,V.useCallback)(function(o,s){s===void 0&&(s=!1);var c=o.index,l=function(e,t){var r=vi(vi([],s?[]:e,!0),t.filter(function(t){return s||!e.includes(t)}),!0);i?.(r,n)};if(t&&t.selectedItems&&t.selectedItems.length>0){var u=t.focusedItem===c?a:t.focusedItem,d=e===`last-focus`?r.findIndex(function(e){return u===e.item}):r.findIndex(function(e){return t.selectedItems?.includes(e.item)}),f=r.findIndex(function(e){return e.item===c});if(d<f){var p=r.slice(d,f+1).map(function(e){return e.item});l(t.selectedItems??[],p)}else{var p=r.slice(f,d+1).map(function(e){return e.item});l(t.selectedItems??[],p)}}else i?.([c],n)},[t,i,n,e,r,a])},xi=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Si=function(){var e=U(),t=Vi(),n=t.treeId,r=t.setRenamingItem,i=t.setSearch,a=t.renamingItem,o=gi(n),s=Lr(),c=hi(),l=_i(),u=bi(`first-selected`),d=e.activeTreeId===n,f=!!a,p=!e.disableArrowKeys&&d&&!f;li(`arrowdown`,function(e){if(e.preventDefault(),s.isProgrammaticallyDragging)s.programmaticDragDown();else{var t=l(function(e){return e+1});e.shiftKey&&u(t)}},p),li(`arrowup`,function(e){if(e.preventDefault(),s.isProgrammaticallyDragging)s.programmaticDragUp();else{var t=l(function(e){return e-1});e.shiftKey&&u(t)}},p),mi(`moveFocusToFirstItem`,function(e){e.preventDefault(),l(function(){return 0})},d&&!s.isProgrammaticallyDragging&&!f),mi(`moveFocusToLastItem`,function(e){e.preventDefault(),l(function(e,t){return t.length-1})},d&&!s.isProgrammaticallyDragging&&!f),li(`arrowright`,function(t){t.preventDefault(),l(function(t,r){var i,a=e.items[r[t].item];if(a.isFolder){if(c.expandedItems?.includes(a.index))return t+1;(i=e.onExpandItem)==null||i.call(e,a,n)}return t})},p&&!s.isProgrammaticallyDragging),li(`arrowleft`,function(t){t.preventDefault(),l(function(t,r){var i,a=e.items[r[t].item],o=r[t].depth;if(a.isFolder&&c.expandedItems?.includes(a.index))(i=e.onCollapseItem)==null||i.call(e,a,n);else if(o>0){for(var s=t;r[s].depth!==o-1;--s);return s}return t})},p&&!s.isProgrammaticallyDragging),mi(`primaryAction`,function(t){var r,i;t.preventDefault(),c.focusedItem!==void 0&&((r=e.onSelectItems)==null||r.call(e,[c.focusedItem],n),(i=e.onPrimaryAction)==null||i.call(e,e.items[c.focusedItem],n))},d&&!s.isProgrammaticallyDragging&&!f),mi(`toggleSelectItem`,function(t){var r,i;t.preventDefault(),t.stopPropagation(),c.focusedItem!==void 0&&(c.selectedItems&&c.selectedItems.includes(c.focusedItem)?(r=e.onSelectItems)==null||r.call(e,c.selectedItems.filter(function(e){return e!==c.focusedItem}),n):(i=e.onSelectItems)==null||i.call(e,xi(xi([],c.selectedItems??[],!0),[c.focusedItem],!1),n))},d&&!s.isProgrammaticallyDragging&&!f),mi(`selectAll`,function(t){var r;t.preventDefault(),(r=e.onSelectItems)==null||r.call(e,o.map(function(e){return e.item}),n)},d&&!s.isProgrammaticallyDragging&&!f),mi(`renameItem`,function(t){var i;if(c.focusedItem!==void 0){t.preventDefault();var a=e.items[c.focusedItem];a.canRename!==!1&&((i=e.onStartRenamingItem)==null||i.call(e,a,n),r(a.index))}},d&&(e.canRename??!0)&&!f),mi(`startSearch`,function(e){var t,n;e.preventDefault(),i(``),(n=(t=document.querySelector(`[data-rct-search-input="true"]`))?.focus)==null||n.call(t)},d&&!s.isProgrammaticallyDragging&&!f),mi(`startProgrammaticDnd`,function(e){e.preventDefault(),s.startProgrammaticDrag()},d&&!f),mi(`completeProgrammaticDnd`,function(e){e.preventDefault(),s.completeProgrammaticDrag()},d&&s.isProgrammaticallyDragging&&!f),mi(`abortProgrammaticDnd`,function(e){e.preventDefault(),s.abortProgrammaticDrag()},d&&s.isProgrammaticallyDragging&&!f)},Ci=function(e,t,n){return n.toLowerCase().includes(e.toLowerCase())},wi=function(){var e=U(),t=e.doesSearchMatchItem,n=e.items,r=e.getItemTitle,i=e.onFocusItem,a=Vi(),o=a.search,s=a.treeId,c=gi(s),l=Or();wr(function(){o&&o.length>0&&l(function(){var e=c.find(function(e){var i=e.item;return(t??Ci)(o,n[i],r(n[i]))});e&&i?.(n[e.item],s)})},[t,r,c,n,i,o,s,l],[o])},Ti=function(){return Ti=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ti.apply(this,arguments)},Ei=function(e){var t=e.containerRef,n=Vi(),r=n.search,i=n.setSearch,a=n.treeId,o=n.renderers,s=n.renamingItem,c=U();hi();var l=c.activeTreeId===a,u=Or();wi();var d=function(){var e;if(i(null),c.autoFocus??!0){var t=Dr()?.querySelector(`[data-rct-tree="${a}"] [data-rct-item-focus="true"]`);(e=t?.focus)==null||e.call(t)}};return mi(`abortSearch`,function(){u(function(){d()})},l&&r!==null,!0),si(t,`keydown`,function(e){var t=e.key.charCodeAt(0);(c.canSearch??!0)&&(c.canSearchByStartingTyping??!0)&&l&&r===null&&!s&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(t>=48&&t<=57||t>=97&&t<=122)&&i(``)}),!(c.canSearch??!0)||r===null?null:o.renderSearchInput({inputProps:Ti({value:r,onChange:function(e){return i(e.target.value)},onBlur:function(){d()},ref:function(e){var t;(t=e?.focus)==null||t.call(e)},"aria-label":`Search for items`},{"data-rct-search-input":`true`})})},Di={introduction:`
|
|
2
|
+
import{a as e,r as t,t as n}from"./rolldown-runtime-Cyuzqnbw.js";import{i as r,m as i,n as a,r as o,t as s,v as c,y as l}from"./button-kCMf1ZBL.js";import{c as u,d,h as f,j as p,l as m,n as h,p as g,r as _,v,x as y}from"./vendor-core-BIhSIGPv.js";import{C as b,M as x,P as S,S as C,b as w,k as T,v as E,x as ee,y as D}from"./vendor-tanstack-DmFvmRiZ.js";import{a as O,i as k}from"./vendor-datadog-Bq_0f1ke.js";import{r as A}from"./vendor-react-BqTNj-ZI.js";import{Tt as j,at as M,c as N,lt as te,o as ne,p as re,rt as ie,s as ae,ut as oe}from"./vendor-ui-to0aD0Fq.js";import{t as P}from"./createLucideIcon-D6HmSa4x.js";import{a as se,i as ce,n as le,r as ue,t as de}from"./tabs-BwkcW6ok.js";import{_ as fe,b as pe,c as me,d as he,f as ge,g as _e,i as ve,l as ye,m as be,n as xe,o as Se,p as Ce,r as we,s as Te,t as Ee,u as De,v as Oe,y as ke}from"./setComponentFile-Bz6WI4jy.js";import{$t as Ae,A as je,At as Me,B as Ne,Bt as Pe,C as Fe,Ct as F,Dt as Ie,Et as Le,F as Re,Ft as ze,G as Be,Gt as Ve,H as He,I as Ue,J as We,K as Ge,L as Ke,M as qe,N as Je,Ot as Ye,P as Xe,Pt as Ze,Qt as Qe,St as I,T as $e,Tt as et,U as tt,W as nt,X as rt,Xt as it,Y as at,Yt as ot,Z as st,Zt as ct,_n as lt,an as ut,at as dt,bn as ft,bt as L,c as pt,ct as mt,d as ht,dn as gt,dt as _t,en as vt,et as yt,f as bt,fn as xt,ft as St,g as Ct,gn as wt,gt as Tt,h as Et,hn as Dt,ht as Ot,it as kt,jt as At,kt as jt,l as Mt,ln as Nt,lt as Pt,m as Ft,mn as It,mt as Lt,n as Rt,nt as zt,on as Bt,ot as Vt,pn as Ht,pt as Ut,q as Wt,qt as Gt,rt as Kt,s as qt,sn as Jt,st as Yt,tn as Xt,tt as Zt,u as Qt,un as $t,ut as en,vn as tn,vt as R,w as nn,wt as z,x as rn,xt as an,yt as B,z as on,zt as sn}from"./index-oRZw5GW3.js";import{i as cn,n as ln,o as un,r as dn,t as fn}from"./editor.api-B3GrPa_a.js";import{t as pn}from"./useEntityRestURL-14jWKu9J.js";var mn=P(`arrow-down-a-z`,[[`path`,{d:`m3 16 4 4 4-4`,key:`1co6wj`}],[`path`,{d:`M7 20V4`,key:`1yoxec`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),hn=P(`arrow-up-a-z`,[[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}],[`path`,{d:`M20 8h-5`,key:`1vsyxs`}],[`path`,{d:`M15 10V6.5a2.5 2.5 0 0 1 5 0V10`,key:`ag13bf`}],[`path`,{d:`M15 14h5l-5 6h5`,key:`ur5jdg`}]]),gn=P(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),_n=P(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),vn=P(`case-lower`,[[`path`,{d:`M10 9v7`,key:`ylp826`}],[`path`,{d:`M14 6v10`,key:`1jy4vg`}],[`circle`,{cx:`17.5`,cy:`12.5`,r:`3.5`,key:`1a9481`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`3.5`,key:`2jlv1r`}]]),yn=P(`case-sensitive`,[[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M22 9v7`,key:`pvm9v3`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}],[`circle`,{cx:`18.5`,cy:`12.5`,r:`3.5`,key:`z97x68`}]]),bn=P(`case-upper`,[[`path`,{d:`M15 11h4.5a1 1 0 0 1 0 5h-4a.5.5 0 0 1-.5-.5v-9a.5.5 0 0 1 .5-.5h3a1 1 0 0 1 0 5`,key:`nxs35`}],[`path`,{d:`m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16`,key:`d5nyq2`}],[`path`,{d:`M3.304 13h6.392`,key:`1q3zxz`}]]),xn=P(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Sn=P(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),Cn=P(`eraser`,[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]),wn=P(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Tn=P(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),En=P(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),Dn=P(`file-plus`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M9 15h6`,key:`cctwl0`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}]]),On=P(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),kn=P(`fold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3-3-3 3`,key:`e37ymu`}],[`path`,{d:`m15 5-3 3-3-3`,key:`19d6lf`}]]),An=P(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),jn=P(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),Mn=P(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Nn=P(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Pn=P(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Fn=P(`link`,[[`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`,key:`1cjeqo`}],[`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`,key:`19qd67`}]]),In=P(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Ln=P(`list-tree`,[[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`M3 10a2 2 0 0 0 2 2h3`,key:`1npucw`}],[`path`,{d:`M3 5v12a2 2 0 0 0 2 2h3`,key:`x1gjn2`}]]),Rn=P(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),zn=P(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),Bn=P(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Vn=P(`package-open`,[[`path`,{d:`M12 22v-9`,key:`x3hkom`}],[`path`,{d:`M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z`,key:`2ntwy6`}],[`path`,{d:`M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13`,key:`1pmm1c`}],[`path`,{d:`M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z`,key:`12ttoo`}]]),Hn=P(`panel-right-close`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m8 9 3 3-3 3`,key:`12hl5m`}]]),Un=P(`panel-right-open`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Wn=P(`replace`,[[`path`,{d:`M14 4a1 1 0 0 1 1-1`,key:`dhj8ez`}],[`path`,{d:`M15 10a1 1 0 0 1-1-1`,key:`1mnyi5`}],[`path`,{d:`M21 4a1 1 0 0 0-1-1`,key:`sfs9ap`}],[`path`,{d:`M21 9a1 1 0 0 1-1 1`,key:`mp6qeo`}],[`path`,{d:`m3 7 3 3 3-3`,key:`x25e72`}],[`path`,{d:`M6 10V5a2 2 0 0 1 2-2h2`,key:`15xut4`}],[`rect`,{x:`3`,y:`14`,width:`7`,height:`7`,rx:`1`,key:`1bkyp8`}]]),Gn=P(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Kn=P(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),qn=P(`text-cursor-input`,[[`path`,{d:`M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6`,key:`1528k5`}],[`path`,{d:`M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7`,key:`13ksps`}],[`path`,{d:`M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1`,key:`1n9rhb`}],[`path`,{d:`M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1`,key:`1mj8rg`}],[`path`,{d:`M9 6v12`,key:`velyjx`}]]),Jn=P(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),Yn=P(`unfold-vertical`,[[`path`,{d:`M12 22v-6`,key:`6o8u61`}],[`path`,{d:`M12 8V2`,key:`1wkif3`}],[`path`,{d:`M4 12H2`,key:`rhcxmi`}],[`path`,{d:`M10 12H8`,key:`s88cx1`}],[`path`,{d:`M16 12h-2`,key:`10asgb`}],[`path`,{d:`M22 12h-2`,key:`14jgyd`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m15 5-3-3-3 3`,key:`itvq4r`}]]),V=e(O(),1);function Xn(e,t=!1){let[n,r]=je(e,t),i=(0,V.useCallback)(e=>{e?.preventDefault?.(),r(e=>!e)},[r]),a=(0,V.useCallback)(e=>{e?.preventDefault?.(),r(!0)},[r]),o=(0,V.useCallback)(e=>{e?.preventDefault?.(),r(!1)},[r]);return(0,V.useMemo)(()=>({toggled:n,setToggled:r,toggle:i,toggleOn:a,toggleOff:o}),[i,r,o,a,n])}var Zn=(0,V.createContext)(null);function Qn(){return(0,V.useContext)(Zn)}var H=A();function $n(){let{reloadRootEntries:e,setFocusedItem:t,setSelectedItems:n}=Qn(),r=Ze();return(0,V.useCallback)(async a=>{let o=!1,s=a.filter(e=>e.from!==e.to);if(s.length===0)return;let c=`Renaming ${i(s.length,`File`,`Files`)}`,l={duration:6e4,action:{label:`Cancel`,onClick:()=>{o=!0}}};l.id=j.loading(c,{...l,description:(0,H.jsx)(st,{animated:!0,width:`0%`})});let u=s.length*3,d=0;function f(){d+=1,j.loading(c,{...l,description:(0,H.jsx)(st,{animated:!0,width:(d===0?0:d/u*100)+`%`})})}for(let e of s){let t=e.from.split(`/`),n=t.shift(),i=t.join(`/`),a=e.to.split(`/`),s=a.shift(),c=a.join(`/`),l=await me({...r,file:i,project:n,encoding:`base64`});if(o||(f(),await Ee({...r,file:c,project:s,encoding:`base64`,payload:l.message}),o)||(f(),await Ce({...r,file:i,project:n}),o))break;f()}d>=u?j.success(`Renamed ${i(s.length,`File`,`Files`)}`,{id:l.id,description:`All done!`,duration:3e3,action:{label:`OK`,onClick:()=>{}}}):j.warning(`Rename Cancelled`,{id:l.id,description:`${d} of ${u} steps completed.`,duration:1e4,action:{label:`OK`,onClick:()=>{}}}),e(),n(e=>{let t=e.slice();for(let e of s){let n=t.indexOf(e.from);n>=0?t.splice(n,1,e.to):t.push(e.to)}return t}),t(e=>{for(let t of s)if(e===t.from)return t.to;return e})},[r,e,t,n])}function er(e,t){return e[t]!==void 0}function tr(e){return t=>er(t,e)}var nr=[{handleGlobal(e,t){if((t.cmd||t.ctrl)&&e===`Delete`)return Mt(`ShowDeleteDirectoryOrFileModal`,!0),!0},addEditorAction(e){return{id:`delete-file`,label:`Delete File`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Delete],run:pt(`ShowDeleteDirectoryOrFileModal`,!0)}}},{handleGlobal(e,t){if(t.ctrl&&t.alt&&t.shift&&e===`˜`)return Mt(`ShowAddDirectoryOrFileModalType`,`directory`),!0},addEditorAction(e){return{id:`new-directory`,label:`New Directory`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyMod.Shift|e.KeyCode.KeyN],run:pt(`ShowAddDirectoryOrFileModalType`,`directory`)}}},{handleGlobal(e,t){if(t.ctrl&&e===`n`)return Mt(`ShowAddDirectoryOrFileModalType`,`file`),!0},addEditorAction(e){return{id:`new-file`,label:`New File`,keybindings:[e.KeyMod.WinCtrl|e.KeyCode.KeyN],run:pt(`ShowAddDirectoryOrFileModalType`,`file`)}}},{handleGlobal(e){if(e===`F2`)return Mt(`ShowRenameFileModal`,`file`),!0},addEditorAction(e){return{id:`rename-file`,label:`Rename File`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyCode.KeyR,e.KeyCode.F2],run:pt(`ShowRenameFileModal`,!0)}}},{addEditorAction(){return{id:`revert-file`,label:`Revert File`,run:qe(`RevertChanges`,!0)}}},{handleGlobal(e,t){if(t.cmd&&e===`s`)return Je(`SaveFile`,!0),!0},addEditorAction(e){return{id:`save-file`,label:`Save Changes`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],run:qe(`SaveFile`,!0)}}}],rr=nr.filter(tr(`addEditorAction`)),ir=nr.filter(tr(`handleGlobal`));function ar(e){let[t,n]=e,r=rr.map(e=>t.addAction(e.addEditorAction(n)));return()=>{for(let e of r)e?.dispose()}}function or(){(0,V.useEffect)(()=>(document.addEventListener(`keydown`,sr),()=>{document.removeEventListener(`keydown`,sr)}),[])}function sr(e){let t={cmd:e.getModifierState(`Meta`),alt:e.getModifierState(`Alt`),shift:e.getModifierState(`Shift`),ctrl:e.getModifierState(`Control`)};for(let n of ir)if(n.handleGlobal(e.key,t)){e.preventDefault();return}}function cr(e){return e.split(`/`).pop()}var lr;(function(e){e.DoubleClickItemToExpand=`double-click-item-to-expand`,e.ClickItemToExpand=`click-item-to-expand`,e.ClickArrowToExpand=`click-arrow-to-expand`})(lr||={});var ur=function(){return ur=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ur.apply(this,arguments)},dr=function(e,t){return{mode:e.mode,createInteractiveElementProps:function(n,r,i,a){return ur(ur({},t.createInteractiveElementProps(n,r,i,a)),e.createInteractiveElementProps(n,r,i,a))}}},fr=function(e){return e.ctrlKey||navigator.platform.toUpperCase().indexOf(`MAC`)>=0&&e.metaKey},pr=function(){function e(e){this.mode=lr.DoubleClickItemToExpand,this.environment=e}return e.prototype.createInteractiveElementProps=function(e,t,n,r){var i=this;return{onClick:function(e){var t=e.detail===0;n.focusItem(),e.shiftKey&&!t?n.selectUpTo(!fr(e)):fr(e)&&!t?r.isSelected?n.unselectItem():n.addToSelectedItems():n.selectItem()},onDoubleClick:function(){n.focusItem(),n.selectItem(),e.isFolder&&n.toggleExpandedState(),(!e.isFolder||i.environment.canInvokePrimaryActionOnItemContainer)&&n.primaryAction()},onFocus:function(){n.focusItem()},onDragStart:function(e){e.dataTransfer.dropEffect=`move`,n.startDragging()},onDragOver:function(e){e.preventDefault()},draggable:r.canDrag&&!r.isRenaming,tabIndex:r.isRenaming?void 0:r.isFocused?0:-1}},e}(),mr=function(){function e(e){this.mode=lr.ClickItemToExpand,this.environment=e}return e.prototype.createInteractiveElementProps=function(e,t,n,r){var i=this;return{onClick:function(t){var a=t.detail===0;n.focusItem(),t.shiftKey&&!a?n.selectUpTo(!fr(t)):fr(t)&&!a?r.isSelected?n.unselectItem():n.addToSelectedItems():(e.isFolder&&n.toggleExpandedState(),n.selectItem(),(!e.isFolder||i.environment.canInvokePrimaryActionOnItemContainer)&&n.primaryAction())},onFocus:function(){n.focusItem()},onDragStart:function(e){e.dataTransfer.dropEffect=`move`,n.startDragging()},onDragOver:function(e){e.preventDefault()},draggable:r.canDrag&&!r.isRenaming,tabIndex:r.isRenaming?void 0:r.isFocused?0:-1}},e}(),hr=function(){function e(e){this.mode=lr.ClickItemToExpand,this.environment=e}return e.prototype.createInteractiveElementProps=function(e,t,n,r){var i=this;return{onClick:function(t){var a=t.detail===0;n.focusItem(),t.shiftKey&&!a?n.selectUpTo(!fr(t)):fr(t)&&!a?r.isSelected?n.unselectItem():n.addToSelectedItems():(n.selectItem(),(!e.isFolder||i.environment.canInvokePrimaryActionOnItemContainer)&&n.primaryAction())},onFocus:function(){n.focusItem()},onDragStart:function(e){e.dataTransfer.dropEffect=`move`,n.startDragging()},onDragOver:function(e){e.preventDefault()},draggable:r.canDrag&&!r.isRenaming,tabIndex:r.isRenaming?void 0:r.isFocused?0:-1}},e}(),gr=function(e,t){switch(e){case lr.DoubleClickItemToExpand:return new pr(t);case lr.ClickItemToExpand:return new mr(t);case lr.ClickArrowToExpand:return new hr(t);default:throw Error(`Unknown interaction mode ${e}`)}},_r=V.createContext(null),vr=function(){return V.useContext(_r)},yr=function(e){var t=e.children,n=U(),r=n.defaultInteractionMode,i=(0,V.useMemo)(function(){return r&&typeof r!=`string`?r.extends?dr(r,gr(r.extends,n)):r:gr(r??lr.ClickItemToExpand,n)},[]);return V.createElement(_r.Provider,{value:i},t)},br=function(){var e=U();return(0,V.useCallback)(function(t,n){if(t.targetType===`between-items`){if(!e.canReorderItems)return!1}else if(t.targetType===`root`){if(!e.canDropOnFolder)return!1}else{var r=e.items[t.targetItem];if(!r||!e.canDropOnFolder&&r.isFolder||!e.canDropOnNonFolder&&!r.isFolder||n.some(function(e){return e.index===t.targetItem}))return!1}return!(e.canDropAt&&(!n||!e.canDropAt(n,t)))},[e])},xr=function(){var e=U();return(0,V.useCallback)(function(t,n){for(var r=e.linearItems[n],i=r[t].depth,a=t;r[a]&&r[a].depth!==i-1;--a);var o=r[a];return o||(o={item:e.trees[n].rootItem,depth:0},a=0),{parent:o,parentLinearIndex:a}},[e.linearItems,e.trees])},Sr=function(){var e=U(),t=xr(),n=br(),r=(0,V.useCallback)(function(e,n,i){var a=t(n,e),o=a.parent,s=a.parentLinearIndex;return i.some(function(e){return e.index===o.item})?!0:o.depth===0?!1:r(e,s,i)},[t]);return(0,V.useCallback)(function(i,a){for(var o=e.linearItems[i],s=[],c=-1,l=0;l<o.length;l++){var u=o[l],d=u.item,f=u.depth;if(!(c!==-1&&f>c)){c=-1;var p=t(l,i).parent,m=e.items[p.item].children.indexOf(d);if(r(i,l,a)){c=f+1;continue}var h={targetType:`item`,parentItem:p.item,targetItem:d,linearIndex:l,depth:f,treeId:i},g={targetType:`between-items`,parentItem:p.item,linePosition:`top`,childIndex:m,depth:f,treeId:i,linearIndex:l},_={targetType:`between-items`,parentItem:p.item,linePosition:`bottom`,linearIndex:l+1,childIndex:m+1,depth:f,treeId:i},v=o[l-1]?.depth??-1,y=o[l+1]?.depth??-1,b=f===v,x=f===y-1;!b&&n(g,a)&&s.push(g),n(h,a)&&s.push(h),!x&&n(_,a)&&s.push(_)}}return s},[n,e.items,e.linearItems,t,r])},Cr=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},wr=function(e,t,n){var r=(0,V.useRef)();(0,V.useEffect)(function(){r.current?r.current.some(function(e,t){return e!==n[t]})&&(r.current=Cr([],n,!0),e()):(r.current=Cr([],n,!0),e())},Cr(Cr([],t,!0),n,!0))},Tr=function(){return Tr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Tr.apply(this,arguments)},Er=function(e,t){return e.map(function(e){return[e,t(e)]}).reduce(function(e,t){var n,r=t[0],i=t[1];return Tr(Tr({},e),(n={},n[r]=i,n))},{})},Dr=function(){return typeof document<`u`?document:void 0};function Or(e){e===void 0&&(e=!1);var t=(0,V.useRef)([]);return(0,V.useEffect)(function(){if(e)return function(){};var n=t.current;return function(){return n.forEach(function(e){return cancelAnimationFrame(e)})}},[e,t]),(0,V.useCallback)(function(e){var n=requestAnimationFrame(function(){t.current.splice(t.current.indexOf(n),1),e()});t.current.push(n)},[t])}var kr=function(e){var t=(0,V.useRef)(e);return t.current=e,t},Ar=function(e){var t=kr(e);return(0,V.useCallback)((function(){var e=[...arguments];return t.current.apply(t,e)}),[t])},jr=function(){var e=U();return Ar(function(t,n){return n.map(function(n){return[n,e.linearItems[t].findIndex(function(e){return e.item===n.index})]}).sort(function(e,t){e[0];var n=e[1];return t[0],n-t[1]}).map(function(e){return e[0]})})},Mr=function(e){var t=Dr()?.querySelector(`[data-rct-tree="${e}"] [data-rct-item-container="true"]`);if(t){var n=getComputedStyle(t);return t.offsetHeight+Math.max(parseFloat(n.marginTop),parseFloat(n.marginBottom))}return 5},Nr=function(e,t){return e.clientX<=t.left||e.clientX>=t.right||e.clientY<=t.top||e.clientY>=t.bottom},Pr=function(){function e(e,t,n,r,i,a){this.env=e,this.e=t,this.treeId=n,this.linearIndex=r.linearIndex,this.offset=r.offset,this.indentation=r.indentation,this.targetItem=this.env.linearItems[this.treeId][this.linearIndex],this.getParentOfLinearItem=a,this.draggingItems=i}return e.prototype.getEmptyTreeDragPosition=function(){return{targetType:`root`,treeId:this.treeId,depth:0,linearIndex:0,targetItem:this.env.trees[this.treeId].rootItem}},e.prototype.maybeRedirectToParent=function(){if(!this.env.canReorderItems&&!this.env.canDropOnNonFolder&&!this.env.items[this.targetItem.item].isFolder){var e=this.getParentOfLinearItem(this.linearIndex,this.treeId),t=e.parentLinearIndex,n=e.parent;this.targetItem=n,this.linearIndex=t}},e.prototype.maybeReparentUpwards=function(){if(this.indentation!==void 0){var e=this.env.linearItems[this.treeId],t=e[this.linearIndex].depth,n=t-(e[this.linearIndex+1]?.depth??0);if(this.offset===`bottom`&&n>0){for(var r=Math.max(t-n,this.indentation),i={parentLinearIndex:this.linearIndex,parent:this.targetItem},a,o=t;o>=r;--o)a=i,i=this.getParentOfLinearItem(i.parentLinearIndex,this.treeId);if(this.indentation!==e[this.linearIndex].depth&&a){var s=this.env.items[i.parent.item].children.indexOf(a.parent.item)+1;if(!(this.draggingItems&&this.isDescendant(this.treeId,i.parentLinearIndex+1,this.draggingItems)))return{targetType:`between-items`,treeId:this.treeId,parentItem:i.parent.item,depth:r,linearIndex:this.linearIndex+1,childIndex:s,linePosition:`bottom`}}}}},e.prototype.maybeRedirectInsideOpenFolder=function(){var e=this.env.linearItems[this.treeId][this.linearIndex+1];!this.env.canDropBelowOpenFolders&&e&&this.targetItem.depth===e.depth-1&&this.offset===`bottom`&&(this.targetItem=e,this.linearIndex+=1,this.offset=`top`)},e.prototype.maybeMapToBottomOffset=function(){var e=this.env.linearItems[this.treeId][this.linearIndex-1];if(!(!e||e?.depth===void 0)){var t=e.depth-this.targetItem.depth;this.offset===`top`&&(t===0||t>0&&this.indentation!==void 0)&&(this.offset=`bottom`,--this.linearIndex,this.targetItem=this.env.linearItems[this.treeId][this.linearIndex])}},e.prototype.canDropAtCurrentTarget=function(){var e=this,t=this.env.items[this.targetItem.item];return!(!this.offset&&!this.env.canDropOnNonFolder&&!t.isFolder||!this.offset&&!this.env.canDropOnFolder&&t.isFolder||this.offset&&!this.env.canReorderItems||this.draggingItems?.some(function(t){return t.index===e.targetItem.item}))},e.prototype.getDraggingPosition=function(){if(this.env.linearItems[this.treeId].length===0)return this.getEmptyTreeDragPosition();if(!(!this.draggingItems||this.linearIndex<0||this.linearIndex>=this.env.linearItems[this.treeId].length)){this.maybeRedirectToParent(),this.maybeRedirectInsideOpenFolder(),this.maybeMapToBottomOffset();var e=this.maybeReparentUpwards();if(e)return e;if(this.areDraggingItemsDescendantOfTarget()||!this.canDropAtCurrentTarget())return`invalid`;var t=this.getParentOfLinearItem(this.linearIndex,this.treeId).parent,n=this.env.items[t.item].children.indexOf(this.targetItem.item)+(this.offset===`top`?0:1);return this.offset?{targetType:`between-items`,treeId:this.treeId,parentItem:t.item,depth:this.targetItem.depth,linearIndex:this.linearIndex+(this.offset===`top`?0:1),childIndex:n,linePosition:this.offset}:{targetType:`item`,treeId:this.treeId,parentItem:t.item,targetItem:this.targetItem.item,depth:this.targetItem.depth,linearIndex:this.linearIndex}}},e.prototype.isDescendant=function(e,t,n){var r=this.getParentOfLinearItem(t,e),i=r.parentLinearIndex,a=r.parent;return n.some(function(e){return e.index===a.item})?!0:a.depth===0?!1:this.isDescendant(e,i,n)},e.prototype.areDraggingItemsDescendantOfTarget=function(){return this.draggingItems&&this.isDescendant(this.treeId,this.linearIndex,this.draggingItems)},e}(),Fr=function(){var e=(0,V.useRef)(`initial`),t=(0,V.useState)(void 0),n=t[0],r=t[1],i=(0,V.useRef)(0),a=U(),o=xr(),s=Ar(function(t,n,r){if(!r)return!1;var i=r.offset,a=`${n}__${r.linearIndex}__${i??``}__${r.indentation}`;return a===e.current?!1:(e.current=a,!0)}),c=Ar(function(e,t,n){if(n.current){var r=n.current.getBoundingClientRect();if(!Nr(e,r)){var o=(e.clientY-r.top)/i.current,s=a.linearItems[t],c=Math.min(Math.max(0,Math.floor(o)),s.length-1);if(s.length===0)return{linearIndex:0,offset:`bottom`,indentation:0};var l=s[c],u=a.items[l.item],d=a.renderDepthOffset?Math.max(Math.floor((e.clientX-r.left)/a.renderDepthOffset),0):void 0,f,p=a.canReorderItems?u?.isFolder&&a.canDropOnFolder||a.canDropOnNonFolder?.2:.5:0;return o-.5>=s.length-1?f=`bottom`:o%1<p?f=`top`:o%1>1-p&&(f=`bottom`),{linearIndex:c,offset:f,indentation:d}}}}),l=Ar(function(e,t,r){var i=c(e,t,r);if(s(e,t,i))return!n||!a.canDragAndDrop||!i||e.clientX<0||e.clientY<0?`invalid`:new Pr(a,e,t,i,n,o).getDraggingPosition()});return{initiateDraggingPosition:Ar(function(t,n){r(n),e.current=`initial`,i.current=Mr(t)}),resetDraggingPosition:Ar(function(){r(void 0),e.current=`initial`,i.current=0}),draggingItems:n,getDraggingPosition:l,itemHeight:i}},Ir=V.createContext(null),Lr=function(){return V.useContext(Ir)},Rr=function(e){var t=e.children,n=U(),r=(0,V.useState)(!1),i=r[0],a=r[1],o=(0,V.useState)({}),s=o[0],c=o[1],l=(0,V.useState)(0),u=l[0],d=l[1],f=(0,V.useState)(),p=f[0],m=f[1],h=Sr(),g=Or(),_=jr(),v=Fr(),y=v.initiateDraggingPosition,b=v.resetDraggingPosition,x=v.draggingItems,S=v.getDraggingPosition,C=v.itemHeight,w=(0,V.useCallback)(function(e,t){if(n.activeTreeId&&n.viewState[n.activeTreeId]?.focusedItem&&n.linearItems&&t){var r=n.viewState[n.activeTreeId].focusedItem,i=h(n.activeTreeId,t),a=i.findIndex(function(e){return e.targetType===`item`?e.targetItem===r:e.targetType===`between-items`?n.items[e.parentItem].children[e.childIndex]===r:!1});d(a?Math.min(a+1,i.length-1):0)}else d(0)},[n.activeTreeId,n.items,n.linearItems,n.viewState,h]),T=Ar(function(){a(!1),c({}),d(0),m(void 0),b()});wr(function(){n.activeTreeId&&n.linearItems[n.activeTreeId]&&s[n.activeTreeId]&&w(s[n.activeTreeId],x)},[x,n.activeTreeId,n.linearItems,w,s],[n.activeTreeId]),wr(function(){i&&n.activeTreeId&&m(s[n.activeTreeId][u])},[u,n.activeTreeId,i,s],[u,n.activeTreeId]);var E=br(),ee=function(e){var t;x&&!E(e,x)||(m(e),n.setActiveTree(e.treeId),x&&n.activeTreeId!==e.treeId&&((t=n.onSelectItems)==null||t.call(n,x.map(function(e){return e.index}),e.treeId)))},D=Ar(function(e,t,n){if(x){var r=S(e,t,n);if(r){if(r===`invalid`){m(void 0);return}ee(r)}}}),O=Ar(function(e,t){t.current&&Nr(e,t.current.getBoundingClientRect())&&m(void 0)}),k=Ar(function(){!x||!p||!n.onDrop||(n.onDrop(x,p),g(function(){var e;(e=n.onFocusItem)==null||e.call(n,x[0],p.treeId),T()}))}),A=(0,V.useCallback)(function(e,t){var r=Er(n.treeIds,function(t){return h(t,e)});y(t,e),c(r),n.activeTreeId&&w(r[n.activeTreeId],e)},[n.activeTreeId,n.treeIds,h,y,w]),j=(0,V.useCallback)(function(){if(n.canDragAndDrop&&n.activeTreeId){var e=n.viewState[n.activeTreeId]?.selectedItems??[n.viewState[n.activeTreeId]?.focusedItem];if(e.length===0||e[0]===void 0)return;var t=_(n.activeTreeId,e.map(function(e){return n.items[e]}));if(n.canDrag&&!n.canDrag(t))return;A(t,n.activeTreeId),setTimeout(function(){a(!0)})}},[n,_,A]),M=(0,V.useCallback)(function(){T()},[T]),N=(0,V.useCallback)(function(){k(),T()},[k,T]),te=(0,V.useCallback)(function(){d(function(e){return Math.max(0,e-1)})},[]),ne=(0,V.useCallback)(function(){n.activeTreeId&&d(function(e){return Math.min(s[n.activeTreeId].length-1,e+1)})},[n.activeTreeId,s]),re=(0,V.useMemo)(function(){return{onStartDraggingItems:A,startProgrammaticDrag:j,abortProgrammaticDrag:M,completeProgrammaticDrag:N,programmaticDragUp:te,programmaticDragDown:ne,draggingItems:x,draggingPosition:p,itemHeight:C.current,isProgrammaticallyDragging:i,onDragOverTreeHandler:D,onDragLeaveContainerHandler:O,viableDragPositions:s}},[M,N,x,p,i,C,D,O,A,ne,te,j,s]);return(0,V.useEffect)(function(){return window.addEventListener(`dragend`,T),window.addEventListener(`drop`,k),function(){window.removeEventListener(`dragend`,T),window.removeEventListener(`drop`,k)}},[k,T]),V.createElement(Ir.Provider,{value:re},t)},zr=function(){return zr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},zr.apply(this,arguments)},Br=function(e,t){var n=U(),r=Lr();(0,V.useImperativeHandle)(e,function(){return zr(zr(zr({},t),n),{treeEnvironmentContext:n,dragAndDropContext:r})})},Vr=function(e,t,n){return t===void 0&&(t=50),n===void 0&&(n=1e4),new Promise(function(r){e()&&r();var i,a=setInterval(function(){e()&&i()},t),o=setTimeout(function(){i()},n);i=function(){clearInterval(a),clearTimeout(o),r()}})},Hr=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},Ur=function(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(s){if(r)throw TypeError(`Generator is already executing.`);for(;o&&(o=0,s[0]&&(n=0)),n;)try{if(r=1,i&&(a=s[0]&2?i.return:s[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,s[1])).done)return a;switch(i=0,a&&(s=[s[0]&2,a.value]),s[0]){case 0:case 1:a=s;break;case 4:return n.label++,{value:s[1],done:!1};case 5:n.label++,i=s[1],s=[0];continue;case 7:s=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){n.label=s[1];break}if(s[0]===6&&n.label<a[1]){n.label=a[1],a=s;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(s);break}a[2]&&n.ops.pop(),n.trys.pop();continue}s=t.call(e,n)}catch(e){s=[6,e],i=0}finally{r=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}},Wr=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Gr=V.createContext(null),Kr=function(){return V.useContext(Gr)},qr=function(e,t,n){return Hr(void 0,void 0,void 0,function(){var r,i,a,o;return Ur(this,function(s){for(r=function(e){Vr(function(){return!!t.current?.[e]}).then(function(){var r=t.current?.[e];r?.isFolder&&(n(r),qr(e,t,n))})},i=0,a=t.current?.[e]?.children??[];i<a.length;i++)o=a[i],r(o);return[2]})})},Jr=V.forwardRef(function(e,t){var n=U(),r=n.onCollapseItem,i=n.items,a=n.trees,o=n.viewState,s=n.onExpandItem,c=n.onFocusItem,l=n.setActiveTree,u=n.onRenameItem,d=n.onSelectItems,f=n.onPrimaryAction,p=n.linearItems,m=Lr(),h=m.abortProgrammaticDrag,g=m.completeProgrammaticDrag,_=m.programmaticDragDown,v=m.programmaticDragUp,y=m.startProgrammaticDrag,b=kr(i),x=(0,V.useCallback)(function(e,t){r?.(i[e],t)},[i,r]),S=(0,V.useCallback)(function(e,t){s?.(i[e],t)},[i,s]),C=(0,V.useCallback)(function(e,t,n){n===void 0&&(n=!0),c?.(i[e],t,n)},[i,c]),w=(0,V.useCallback)(function(e,t){t===void 0&&(t=!0),l(e,t)},[l]),T=(0,V.useCallback)(function(e){var t=p[e],n=t.findIndex(function(t){return t.item===o[e]?.focusedItem}),r=i[t[n===void 0?0:Math.min(t.length-1,n+1)].item];c?.(r,e)},[i,p,c,o]),E=(0,V.useCallback)(function(e){var t=p[e],n=t.findIndex(function(t){return t.item===o[e]?.focusedItem}),r=i[t[n===void 0?0:Math.max(0,n-1)].item];c?.(r,e)},[i,p,c,o]),ee=(0,V.useCallback)(function(e,t,n){u?.(i[e],t,n)},[i,u]),D=(0,V.useCallback)(function(e,t){d?.(e,t)},[d]),O=(0,V.useCallback)(function(e,t){(o[t]?.expandedItems)?.includes(e)?r?.(i[e],t):s?.(i[e],t)},[i,r,s,o]),k=(0,V.useCallback)(function(e,t){(o[t]?.selectedItems)?.includes(e)?d?.(o[t].selectedItems?.filter(function(t){return t!==e})??[],t):d?.(Wr(Wr([],o[t].selectedItems??[],!0),[e],!1),t)},[d,o]),A=(0,V.useCallback)(function(e,t){f?.(i[e],t)},[i,f]),j=(0,V.useCallback)(function(e,t){return Hr(void 0,void 0,void 0,function(){var n,r;return Ur(this,function(i){switch(i.label){case 0:return n=t[0],r=t.slice(1),[4,Vr(function(){return!!b.current?.[n]}).then(function(){var t=b.current[n];return t?(s?.(t,e),r.length>0?j(e,r):Promise.resolve()):Promise.resolve()})];case 1:return i.sent(),[2]}})})},[b,s]),M=(0,V.useCallback)(function(e){return Hr(void 0,void 0,void 0,function(){return Ur(this,function(t){switch(t.label){case 0:return[4,qr(a[e].rootItem,b,function(t){return s?.(t,e)})];case 1:return t.sent(),[2]}})})},[b,s,a]),N=(0,V.useCallback)(function(e){for(var t=0,n=o[e]?.expandedItems??[];t<n.length;t++){var a=n[t];r?.(i[a],e)}},[i,r,o]),te=(0,V.useMemo)(function(){return{collapseItem:x,expandItem:S,focusItem:C,focusTree:w,moveFocusDown:T,moveFocusUp:E,renameItem:ee,selectItems:D,toggleItemExpandedState:O,toggleItemSelectStatus:k,invokePrimaryAction:A,expandAll:M,expandSubsequently:j,collapseAll:N,abortProgrammaticDrag:h,completeProgrammaticDrag:g,moveProgrammaticDragPositionDown:_,moveProgrammaticDragPositionUp:v,startProgrammaticDrag:y}},[x,S,C,w,T,E,ee,D,O,k,A,M,j,N,h,g,_,v,y]);return Br(t,te),V.createElement(Gr.Provider,{value:te},e.children)}),Yr=function(e){if(e)if(e.scrollIntoViewIfNeeded)e.scrollIntoViewIfNeeded();else{var t=e.getBoundingClientRect();t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||!!Dr()?.documentElement?.clientHeight)&&t.right<=(window.innerWidth||!!Dr()?.documentElement?.clientWidth)||e.scrollIntoView()}},Xr=function(){return Xr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Xr.apply(this,arguments)},Zr=function(){return[...arguments].filter(function(e){return!!e}).join(` `)},Qr=function(e,t){return{renderItemTitle:function(e){var t=e.title,n=e.context,r=e.info;if(!r.isSearching||!n.isSearchMatching)return t;var i=t.toLowerCase().indexOf(r.search.toLowerCase());return V.createElement(V.Fragment,null,i>0&&V.createElement(`span`,null,t.slice(0,i)),V.createElement(`span`,{className:`rct-tree-item-search-highlight`},t.slice(i,i+r.search.length)),i+r.search.length<t.length&&V.createElement(`span`,null,t.slice(i+r.search.length,t.length)))},renderItemArrow:function(e){var t=e.item,n=e.context;return V.createElement(`div`,Xr({className:Zr(t.isFolder&&`rct-tree-item-arrow-isFolder`,n.isExpanded&&`rct-tree-item-arrow-expanded`,`rct-tree-item-arrow`)},n.arrowProps),t.isFolder&&(n.isExpanded?V.createElement(`svg`,{version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,x:`0px`,y:`0px`,viewBox:`0 0 16 16`,enableBackground:`new 0 0 16 16`,xmlSpace:`preserve`},V.createElement(`g`,null,V.createElement(`g`,null,V.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z`,className:`rct-tree-item-arrow-path`})))):V.createElement(`svg`,{version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,xmlnsXlink:`http://www.w3.org/1999/xlink`,x:`0px`,y:`0px`,viewBox:`0 0 16 16`,enableBackground:`new 0 0 16 16`,xmlSpace:`preserve`},V.createElement(`g`,null,V.createElement(`g`,null,V.createElement(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708z`,className:`rct-tree-item-arrow-path`}))))))},renderItem:function(t){var n=t.item,r=t.depth,i=t.children,a=t.title,o=t.context,s=t.arrow,c=o.isRenaming?`div`:`button`,l=o.isRenaming?void 0:`button`;return V.createElement(`li`,Xr({},o.itemContainerWithChildrenProps,{className:Zr(`rct-tree-item-li`,n.isFolder&&`rct-tree-item-li-isFolder`,o.isSelected&&`rct-tree-item-li-selected`,o.isExpanded&&`rct-tree-item-li-expanded`,o.isFocused&&`rct-tree-item-li-focused`,o.isDraggingOver&&`rct-tree-item-li-dragging-over`,o.isSearchMatching&&`rct-tree-item-li-search-match`)}),V.createElement(`div`,Xr({},o.itemContainerWithoutChildrenProps,{style:{"--depthOffset":`${(r+1)*e}px`},className:Zr(`rct-tree-item-title-container`,n.isFolder&&`rct-tree-item-title-container-isFolder`,o.isSelected&&`rct-tree-item-title-container-selected`,o.isExpanded&&`rct-tree-item-title-container-expanded`,o.isFocused&&`rct-tree-item-title-container-focused`,o.isDraggingOver&&`rct-tree-item-title-container-dragging-over`,o.isSearchMatching&&`rct-tree-item-title-container-search-match`)}),s,V.createElement(c,Xr({type:l},o.interactiveElementProps,{className:Zr(`rct-tree-item-button`,n.isFolder&&`rct-tree-item-button-isFolder`,o.isSelected&&`rct-tree-item-button-selected`,o.isExpanded&&`rct-tree-item-button-expanded`,o.isFocused&&`rct-tree-item-button-focused`,o.isDraggingOver&&`rct-tree-item-button-dragging-over`,o.isSearchMatching&&`rct-tree-item-button-search-match`)}),a)),i)},renderRenameInput:function(e){var t=e.inputProps,n=e.inputRef,r=e.submitButtonProps,i=e.submitButtonRef,a=e.formProps;return V.createElement(`form`,Xr({},a,{className:`rct-tree-item-renaming-form`}),V.createElement(`input`,Xr({},t,{ref:n,className:`rct-tree-item-renaming-input`})),V.createElement(`input`,Xr({},r,{ref:i,type:`submit`,className:`rct-tree-item-renaming-submit-button`,value:`🗸`})))},renderTreeContainer:function(e){var n=e.children,r=e.containerProps,i=e.info;return V.createElement(`div`,{className:Zr(`rct-tree-root`,i.isFocused&&`rct-tree-root-focus`,i.isRenaming&&`rct-tree-root-renaming`,i.areItemsSelected&&`rct-tree-root-itemsselected`,t&&`rct-rtl`)},V.createElement(`div`,Xr({},r,{style:Xr({minHeight:`30px`},r.style)}),n))},renderItemsContainer:function(e){var t=e.children,n=e.containerProps;return V.createElement(`ul`,Xr({},n,{className:`rct-tree-items-container`}),t)},renderDragBetweenLine:function(t){var n=t.draggingPosition,r=t.lineProps;return V.createElement(`div`,Xr({},r,{style:{left:`${n.depth*e}px`},className:Zr(`rct-tree-drag-between-line`,n.targetType===`between-items`&&n.linePosition===`top`&&`rct-tree-drag-between-line-top`,n.targetType===`between-items`&&n.linePosition===`bottom`&&`rct-tree-drag-between-line-bottom`)}))},renderSearchInput:function(e){var t=e.inputProps;return V.createElement(`div`,{className:Zr(`rct-tree-search-input-container`)},V.createElement(`span`,{className:`rct-tree-input-icon`}),V.createElement(`input`,Xr({},t,{className:Zr(`rct-tree-search-input`)})))},renderLiveDescriptorContainer:function(e){var t=e.tree,n=e.children;return V.createElement(`div`,{id:`rct-livedescription-${t.treeId}`,style:{clip:`rect(0 0 0 0)`,clipPath:`inset(50%)`,height:`1px`,overflow:`hidden`,position:`absolute`,whiteSpace:`nowrap`,width:`1px`}},n)},renderDepthOffset:e}},$r=function(e){var t=e.renderItem,n=e.renderItemTitle,r=e.renderItemArrow,i=e.renderRenameInput,a=e.renderItemsContainer,o=e.renderTreeContainer,s=e.renderDragBetweenLine,c=e.renderSearchInput,l=e.renderLiveDescriptorContainer,u=e.renderDepthOffset,d=(0,V.useMemo)(function(){return Qr(u??10)},[u]),f={renderItem:t,renderItemTitle:n,renderItemArrow:r,renderRenameInput:i,renderItemsContainer:a,renderTreeContainer:o,renderDragBetweenLine:s,renderSearchInput:c,renderLiveDescriptorContainer:l,renderDepthOffset:u},p=Object.entries(d).reduce(function(e,t){var n=t[0],r=t[1],i=n;return f[i]?e[i]=f[i]:e[i]=r,e},{});return p.renderItem.displayName=`RenderItem`,p.renderItemTitle.displayName=`RenderItemTitle`,p.renderItemArrow.displayName=`RenderItemArrow`,p.renderRenameInput.displayName=`RenderRenameInput`,p.renderItemsContainer.displayName=`RenderItemsContainer`,p.renderTreeContainer.displayName=`RenderTreeContainer`,p.renderDragBetweenLine.displayName=`RenderDragBetweenLine`,p.renderSearchInput.displayName=`RenderSearchInput`,p},ei=function(e,t,n,r){r===void 0&&(r=0);for(var i=[],a=0,o=n[e]?.children??[];a<o.length;a++){var s=o[a],c=n[s];i.push({item:s,depth:r}),c&&c.isFolder&&c.children&&t.expandedItems?.includes(s)&&i.push.apply(i,ei(s,t,n,r+1))}return i},ti=function(){return ti=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ti.apply(this,arguments)},ni=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n},ri=function(e){var t=e.onExpandItem,n=e.onCollapseItem,r=e.onDrop,i=ni(e,[`onExpandItem`,`onCollapseItem`,`onDrop`]),a=(0,V.useState)({}),o=a[0],s=a[1],c=(0,V.useState)(),l=c[0],u=c[1],d=(0,V.useMemo)(function(){return Object.keys(o)},[o]),f=i.onFocusItem,p=i.autoFocus,m=i.onRegisterTree,h=i.onUnregisterTree,g=i.items,_=i.viewState,v=kr(f),y=kr(_),b=(0,V.useMemo)(function(){return Er(d,function(e){return ei(o[e].rootItem,_[e]??{},g)})},[o,g,d,_]),x=(0,V.useCallback)(function(e,t,n){var r,i;if(n===void 0&&(n=!0),(p??!0)&&n){var a=Dr()?.querySelector(`[data-rct-tree="${t}"] [data-rct-item-id="${e.index}"]`)??Dr()?.querySelector(`[data-rct-tree="${t}"] [data-rct-item-id]`);(Dr()?.activeElement)?.attributes.getNamedItem(`data-rct-search-input`)?.value===`true`?Yr(a):(r=a?.focus)==null||r.call(a)}y.current[t]?.focusedItem!==e.index&&((i=v.current)==null||i.call(v,e,t))},[p,v,y]),S=(0,V.useCallback)(function(e){s(function(t){var n;return ti(ti({},t),(n={},n[e.treeId]=e,n))}),m?.(e)},[m]),C=(0,V.useCallback)(function(e){h?.(o[e]),delete o[e],s(o)},[h,o]),w=(0,V.useCallback)(function(e,t){n?.(e,t),s(function(e){return e})},[n]),T=(0,V.useCallback)(function(e,n){t?.(e,n),s(function(e){return e})},[t]),E=(0,V.useCallback)(function(e,t){r?.(e,t),s(function(e){return e})},[r]),ee=(0,V.useCallback)(function(e){var t,n=Dr()?.querySelector(`[data-rct-tree="${e}"] [data-rct-item-focus="true"]`);(t=n?.focus)==null||t.call(n)},[]),D=(0,V.useCallback)(function(e,t){t===void 0&&(t=!0);var n=function(e){t&&(p??!0)&&e&&!(Dr()?.querySelector(`[data-rct-tree="${e}"]`))?.contains(document.activeElement)&&ee(e)};if(typeof e==`function`)u(function(t){var r=e(t);return r!==t&&n(r),r});else{var r=e;u(r),n(r)}},[p,ee]),O=$r(i);return ti(ti(ti({},O),i),{onFocusItem:x,registerTree:S,unregisterTree:C,onExpandItem:T,onCollapseItem:w,onDrop:E,setActiveTree:D,treeIds:d,trees:o,activeTreeId:l,linearItems:b})},ii=V.createContext(null),U=function(){return(0,V.useContext)(ii)},ai=V.forwardRef(function(e,t){var n=ri(e),r=e.viewState,i=e.onFocusItem;return(0,V.useEffect)(function(){for(var t=0,a=Object.keys(n.trees);t<a.length;t++){var o=a[t],s=e.items[n.trees[o].rootItem]?.children?.[0],c=s&&e.items[s];!r[o]?.focusedItem&&n.trees[o]&&c&&i?.(c,o,!1)}},[n.trees,i,e.items,r]),V.createElement(ii.Provider,{value:n},V.createElement(yr,null,V.createElement(Rr,null,V.createElement(Jr,{ref:t},e.children))))}),oi=function(e){var t=e.treeId,n=Lr(),r=n.draggingPosition,i=n.itemHeight,a=Vi().renderers;return r&&r.targetType===`between-items`&&r.treeId===t?V.createElement(`div`,{style:{position:`absolute`,left:`0`,right:`0`,top:`${(r?.linearIndex??0)*i}px`}},a.renderDragBetweenLine({draggingPosition:r,lineProps:{onDragOver:function(e){return e.preventDefault()}}})):null},si=function(e,t,n){var r=Ar(n);(0,V.useEffect)(function(){return e?(e.addEventListener(t,r),function(){return e.removeEventListener(t,r)}):function(){}},[e,r,t])},ci=function(e,t,n){var r=(0,V.useState)(!1),i=r[0],a=r[1],o=(0,V.useRef)(!1),s=Or();return si(e,`focusin`,function(){i||(a(!0),t?.()),o.current&&=!1}),si(e,`focusout`,function(){o.current=!0,s(function(){o.current&&!e?.contains(document.activeElement)&&(n?.(),o.current=!1,a(!1))})}),i},li=function(e,t,n){si(Dr(),`keydown`,function(r){n&&n&&e.toLowerCase()===r.key.toLowerCase()&&t(r)})},ui={expandSiblings:[`control+*`],moveFocusToFirstItem:[`home`],moveFocusToLastItem:[`end`],primaryAction:[`enter`],renameItem:[`f2`],abortRenameItem:[`escape`],toggleSelectItem:[`control+ `],abortSearch:[`escape`,`enter`],startSearch:[],selectAll:[`control+a`],startProgrammaticDnd:[`control+shift+d`],completeProgrammaticDnd:[`enter`],abortProgrammaticDnd:[`escape`]},di=function(){return di=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},di.apply(this,arguments)},fi=function(){var e=U();return(0,V.useMemo)(function(){return e.keyboardBindings?di(di({},ui),e.keyboardBindings):ui},[e.keyboardBindings])},pi=[`input`,`textarea`],mi=function(e,t,n,r){r===void 0&&(r=!1);var i=(0,V.useRef)([]),a=fi(),o=Or(),s=(0,V.useMemo)(function(){return a[e].map(function(e){return e.split(`+`)})},[e,a]);si(Dr(),`keydown`,function(e){if(n!==!1&&!((pi.includes(e.target.tagName?.toLowerCase())||e.target.isContentEditable)&&!r)&&!i.current.includes(e.key)){i.current.push(e.key);var t=i.current.map(function(e){return e.toLowerCase()});s.map(function(e){return t.map(function(t){return e.includes(t.toLowerCase())}).reduce(function(e,t){return e&&t},!0)}).reduce(function(e,t){return e||t},!1)&&(i.current.length>1||!/^[a-zA-Z\s]$/.test(e.key))&&e.preventDefault()}}),si(Dr(),`keyup`,function(e){if(n!==!1){var r=i.current.map(function(e){return e.toLowerCase()});s.map(function(e){return e.map(function(e){return r.includes(e.toLowerCase())}).reduce(function(e,t){return e&&t},!0)}).reduce(function(e,t){return e||t},!1)&&o(function(){return t(e)}),i.current=i.current.filter(function(t){return t!==e.key})}})},hi=function(){var e=Vi().treeId;return U().viewState[e]??{}},gi=function(e){return U().linearItems[e]},_i=function(){var e=Vi().treeId,t=U(),n=t.onFocusItem,r=t.items,i=gi(e),a=hi();return Ar(function(t){var o=t(i.findIndex(function(e){return e.item===a.focusedItem})??0,i),s=r[i[Math.max(0,Math.min(i.length-1,o))].item];return n?.(s,e),s})},vi=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},yi=function(e){var t=(0,V.useRef)({target:e,previous:void 0});return t.current.target!==e&&(t.current.previous=t.current.target,t.current.target=e),t.current.previous},bi=function(e){var t=hi(),n=Vi().treeId,r=gi(n),i=U().onSelectItems,a=yi(t.focusedItem);return(0,V.useCallback)(function(o,s){s===void 0&&(s=!1);var c=o.index,l=function(e,t){var r=vi(vi([],s?[]:e,!0),t.filter(function(t){return s||!e.includes(t)}),!0);i?.(r,n)};if(t&&t.selectedItems&&t.selectedItems.length>0){var u=t.focusedItem===c?a:t.focusedItem,d=e===`last-focus`?r.findIndex(function(e){return u===e.item}):r.findIndex(function(e){return t.selectedItems?.includes(e.item)}),f=r.findIndex(function(e){return e.item===c});if(d<f){var p=r.slice(d,f+1).map(function(e){return e.item});l(t.selectedItems??[],p)}else{var p=r.slice(f,d+1).map(function(e){return e.item});l(t.selectedItems??[],p)}}else i?.([c],n)},[t,i,n,e,r,a])},xi=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Si=function(){var e=U(),t=Vi(),n=t.treeId,r=t.setRenamingItem,i=t.setSearch,a=t.renamingItem,o=gi(n),s=Lr(),c=hi(),l=_i(),u=bi(`first-selected`),d=e.activeTreeId===n,f=!!a,p=!e.disableArrowKeys&&d&&!f;li(`arrowdown`,function(e){if(e.preventDefault(),s.isProgrammaticallyDragging)s.programmaticDragDown();else{var t=l(function(e){return e+1});e.shiftKey&&u(t)}},p),li(`arrowup`,function(e){if(e.preventDefault(),s.isProgrammaticallyDragging)s.programmaticDragUp();else{var t=l(function(e){return e-1});e.shiftKey&&u(t)}},p),mi(`moveFocusToFirstItem`,function(e){e.preventDefault(),l(function(){return 0})},d&&!s.isProgrammaticallyDragging&&!f),mi(`moveFocusToLastItem`,function(e){e.preventDefault(),l(function(e,t){return t.length-1})},d&&!s.isProgrammaticallyDragging&&!f),li(`arrowright`,function(t){t.preventDefault(),l(function(t,r){var i,a=e.items[r[t].item];if(a.isFolder){if(c.expandedItems?.includes(a.index))return t+1;(i=e.onExpandItem)==null||i.call(e,a,n)}return t})},p&&!s.isProgrammaticallyDragging),li(`arrowleft`,function(t){t.preventDefault(),l(function(t,r){var i,a=e.items[r[t].item],o=r[t].depth;if(a.isFolder&&c.expandedItems?.includes(a.index))(i=e.onCollapseItem)==null||i.call(e,a,n);else if(o>0){for(var s=t;r[s].depth!==o-1;--s);return s}return t})},p&&!s.isProgrammaticallyDragging),mi(`primaryAction`,function(t){var r,i;t.preventDefault(),c.focusedItem!==void 0&&((r=e.onSelectItems)==null||r.call(e,[c.focusedItem],n),(i=e.onPrimaryAction)==null||i.call(e,e.items[c.focusedItem],n))},d&&!s.isProgrammaticallyDragging&&!f),mi(`toggleSelectItem`,function(t){var r,i;t.preventDefault(),t.stopPropagation(),c.focusedItem!==void 0&&(c.selectedItems&&c.selectedItems.includes(c.focusedItem)?(r=e.onSelectItems)==null||r.call(e,c.selectedItems.filter(function(e){return e!==c.focusedItem}),n):(i=e.onSelectItems)==null||i.call(e,xi(xi([],c.selectedItems??[],!0),[c.focusedItem],!1),n))},d&&!s.isProgrammaticallyDragging&&!f),mi(`selectAll`,function(t){var r;t.preventDefault(),(r=e.onSelectItems)==null||r.call(e,o.map(function(e){return e.item}),n)},d&&!s.isProgrammaticallyDragging&&!f),mi(`renameItem`,function(t){var i;if(c.focusedItem!==void 0){t.preventDefault();var a=e.items[c.focusedItem];a.canRename!==!1&&((i=e.onStartRenamingItem)==null||i.call(e,a,n),r(a.index))}},d&&(e.canRename??!0)&&!f),mi(`startSearch`,function(e){var t,n;e.preventDefault(),i(``),(n=(t=document.querySelector(`[data-rct-search-input="true"]`))?.focus)==null||n.call(t)},d&&!s.isProgrammaticallyDragging&&!f),mi(`startProgrammaticDnd`,function(e){e.preventDefault(),s.startProgrammaticDrag()},d&&!f),mi(`completeProgrammaticDnd`,function(e){e.preventDefault(),s.completeProgrammaticDrag()},d&&s.isProgrammaticallyDragging&&!f),mi(`abortProgrammaticDnd`,function(e){e.preventDefault(),s.abortProgrammaticDrag()},d&&s.isProgrammaticallyDragging&&!f)},Ci=function(e,t,n){return n.toLowerCase().includes(e.toLowerCase())},wi=function(){var e=U(),t=e.doesSearchMatchItem,n=e.items,r=e.getItemTitle,i=e.onFocusItem,a=Vi(),o=a.search,s=a.treeId,c=gi(s),l=Or();wr(function(){o&&o.length>0&&l(function(){var e=c.find(function(e){var i=e.item;return(t??Ci)(o,n[i],r(n[i]))});e&&i?.(n[e.item],s)})},[t,r,c,n,i,o,s,l],[o])},Ti=function(){return Ti=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Ti.apply(this,arguments)},Ei=function(e){var t=e.containerRef,n=Vi(),r=n.search,i=n.setSearch,a=n.treeId,o=n.renderers,s=n.renamingItem,c=U();hi();var l=c.activeTreeId===a,u=Or();wi();var d=function(){var e;if(i(null),c.autoFocus??!0){var t=Dr()?.querySelector(`[data-rct-tree="${a}"] [data-rct-item-focus="true"]`);(e=t?.focus)==null||e.call(t)}};return mi(`abortSearch`,function(){u(function(){d()})},l&&r!==null,!0),si(t,`keydown`,function(e){var t=e.key.charCodeAt(0);(c.canSearch??!0)&&(c.canSearchByStartingTyping??!0)&&l&&r===null&&!s&&!e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey&&(t>=48&&t<=57||t>=97&&t<=122)&&i(``)}),!(c.canSearch??!0)||r===null?null:o.renderSearchInput({inputProps:Ti({value:r,onChange:function(e){return i(e.target.value)},onBlur:function(){d()},ref:function(e){var t;(t=e?.focus)==null||t.call(e)},"aria-label":`Search for items`},{"data-rct-search-input":`true`})})},Di={introduction:`
|
|
3
3
|
<p>Accessibility guide for tree {treeLabel}.</p>
|
|
4
4
|
<p>
|
|
5
5
|
Navigate the tree with the arrow keys. Common tree hotkeys apply. Further keybindings are available:
|
|
@@ -316,4 +316,4 @@ declare module '*?url' { const url: string; export default url; }
|
|
|
316
316
|
`),Rv=`harper://schemas/config-app.json`;function zv(e){Iv(e,{enableSchemaRequest:!1,validate:!0,hover:!0,completion:!0,schemas:[{uri:Rv,fileMatch:[`**/config.yaml`,`*config.yaml`,`config.yaml`],schema:Lv}]})}var Bv=`__harperLanguageSupportConfigured`;function Vv(e){let t=globalThis;t[Bv]||(t[Bv]=!0,H_(e),q_(e),zv(e))}var Hv={js:`javascript`,cjs:`javascript`,jsx:`javascript`,yaml:`yaml`,yml:`yaml`,ts:`typescript`,tsx:`typescript`,json:`json`,md:`markdown`,html:`html`,css:`css`,graphql:`graphql`,mjs:`javascript`};function Uv(e,t){let n=Object.values(e).find(e=>!!e&&typeof e.lookupKeybinding==`function`),r={};if(!n)return r;for(let e of t){let t=n.lookupKeybinding(e)?.getLabel();t&&(r[e]=t)}return r}function Wv(){let e=Ze(),{openedEntryContents:t,openedEntry:n,restrictPackageModification:r,isSavingFile:i,saveFile:a,rootEntries:o}=Qn();S_(n,o);let{content:s,setContent:c}=Po(!!n&&!n.package&&n.path),l=(0,V.useCallback)(e=>{c(e===t?void 0:e)},[t,c]),u=Ke(),d=Me(),[f,p]=(0,V.useState)(null);E_(f?.[0]);let m=ge(n?.path),h=s??t,g=(h?.length??0)>524288?`plaintext`:Hv[m]||`plaintext`,_=(0,V.useCallback)(e=>{Vv(e)},[]),v=(0,V.useCallback)((e,t)=>{p([e,t])},[]);if((0,V.useEffect)(()=>{if(f&&d&&!n?.package&&!r)return ar(f)},[f,d,n,r]),Re(`SaveFile`,()=>{n&&!i&&s!==void 0&&a({...e,file:n.path.split(`/`).slice(1).join(`/`),payload:s,project:n.project},n.path)},[n,e,s]),Re(`RevertChanges`,()=>{if(t!==void 0&&f){let[e]=f;l(void 0),e.setValue(t)}},[t,f]),Re(`RunEditorAction`,e=>{f?.[0]?.getAction(e)?.run()},[f]),(0,V.useEffect)(()=>{f&&Jo(Uv(f[0],Go))},[f]),!n)return null;let y=i||!!n.package||!d;return(0,H.jsx)(Ue,{className:`w-full min-h-full h-80`,path:n.path,language:g,theme:u,value:h,keepCurrentModel:!0,beforeMount:_,onMount:v,onChange:y?void 0:l,options:{automaticLayout:!0,minimap:{enabled:!1},readOnly:y,padding:{top:48}}})}function Gv(){let{openedEntry:e,openedEntryContents:t}=Qn(),n=es(e?.project);if(e?.path===`newApplication`)return(0,H.jsx)(e_,{});if(Te(e))return(0,H.jsx)(`div`,{className:`directoryReadMe max-w-3xl`,children:(0,H.jsx)(kp,{urlTransform:n,remarkPlugins:[Ng],components:{code:Jv},children:t})});let r=he(e?.name);return r?(0,H.jsx)(Kv,{name:e?.name,base64:t,media:r}):(0,H.jsx)(Wv,{})}function Kv({name:e,base64:t,media:n}){if(!t)return null;let r=`data:${n.mime};base64,${t}`;return(0,H.jsx)(`div`,{className:`mt-9 absolute top-0 right-0 bottom-0 left-0`,children:n.kind===`video`?(0,H.jsx)(`video`,{className:`w-full h-full object-contain p-20`,src:r,controls:!0}):(0,H.jsx)(`img`,{className:`w-full h-full object-contain p-20`,alt:e,src:r})})}function qv({chart:e}){let t=(0,V.useRef)(null),[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let t=`mermaid-${Math.random().toString(36).slice(2,9)}`,n=!1;return k(async()=>{let{default:e}=await import(`./mermaid.core-B3uGOQZ5.js`);return{default:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])).then(({default:i})=>{n||(i.initialize({startOnLoad:!1,theme:`default`}),i.render(t,e).then(({svg:e})=>{n||(r(e),a(null))}).catch(e=>{n||(console.error(`Mermaid render error:`,e),a(String(e)))}))}),()=>{n=!0}},[e]),i?(0,H.jsx)(`pre`,{className:`text-red-500 bg-red-50 p-3 rounded text-sm overflow-auto`,children:(0,H.jsx)(`code`,{children:e})}):(0,H.jsx)(`div`,{ref:t,className:`my-4 flex justify-center overflow-auto`,dangerouslySetInnerHTML:{__html:n}})}function Jv({inline:e,className:t,children:n}){let r=String(n??``).replace(/\n$/,``),[i]=yt(r),a=t?.replace(`language-`,``);return e||!r.includes(`
|
|
317
317
|
`)?(0,H.jsx)(`code`,{className:t,children:n}):a===`mermaid`?(0,H.jsx)(qv,{chart:r}):(0,H.jsxs)(`code`,{className:`relative`,children:[(0,H.jsx)(s,{className:`absolute top-2 right-2`,type:`button`,variant:`default`,size:`sm`,onClick:i,children:(0,H.jsx)(ut,{className:`w-4 h-4`})}),r]})}function Yv(e,t,n){let r=t,i=t.replace(/:9925/,``).replace(/\/?$/,``);return r&&(e=e.replaceAll(/https?:\/\/localhost:9926/g,i)),n.project&&(e=e.replaceAll(`Your New Harper Fabric App`,n.project).replaceAll(`your-project-name-here`,n.project)),e}function Xv({children:e}){let t=ee(),[n,r]=(0,V.useState)(void 0),[i,a]=(0,V.useState)(void 0),{setContent:o}=Po(n?.path),s=Ze(),c=pn(),l=S(),{open:u}=C({strict:!1}),{data:d}=x(rn(s)),f=(0,V.useMemo)(()=>d?we(d.entries):{rootEntries:[],pathsRegistry:new Map,allEntries:new Map},[d]),p=(0,V.useCallback)(async()=>l.fetchQuery({queryKey:[s.entityId,`get_components`],networkMode:`online`}),[l,s]);Re(`ReloadApplicationRootEntries`,p,[p]);let m=(0,V.useCallback)(e=>f.pathsRegistry.has(e),[f.pathsRegistry]),h=f.rootEntries.filter(e=>!e.package&&e.path!==`newApplication`).map(e=>e.name),g=h[0],_=h.slice(0,1);!g&&d&&(g=Se,_=[Se]);let[v,y]=je(`FileFocused/${s.entityId}`,g),[b,w]=je(`FolderOpened/${s.entityId}`,h),[T,E]=je(`FileSelected/${s.entityId}`,_);(0,V.useEffect)(()=>{if(u?.length){let e=u.split(`?`),n=e[0],r=e[1],i=n.split(`/`);if(r){let e=r.split(`=`);Mt(e[0],e[1]===`true`?!0:e[1]===`false`?!1:e[1])}w(e=>{let t=new Set(e);for(let e=1;e<i.length;e++)t.add(i.slice(0,e).join(`/`));return[...t]}),E([n]),y(n),t({search:void 0})}},[t,u,w,y,E]);let D=n&&(Te(n)?n.overviewEntry?.path:n.path)||``,O=n&&(Te(n)?n.overviewEntry?.project:n.project)||``,k=n&&(Te(n)?!!n.overviewEntry?.path:!1)||!1,A=ye({file:D?.split(`/`).slice(1).join(`/`),project:O,...s}),{data:j}=x(De({file:D?.split(`/`).slice(1).join(`/`),project:O,...s}));(0,V.useEffect)(function(){let e=j?.project+`/`+j?.file,t=j?.message;e===D&&t!==void 0?(k&&c&&j&&(t=Yv(t,c,j)),a(t)):a(void 0)},[j,D,k,s]);let{mutate:M,isPending:N}=xe(),te=(0,V.useCallback)((e,t)=>{M(e,{onSuccess:()=>{n?.path===t&&e.payload!==void 0&&(o(void 0),a(e.payload||void 0),l.setQueryData(A,{...j,message:e.payload}))},onError:e=>{console.error(`Error saving file:`,e)}})},[A,j,n?.path,l,M,o]),ne=(0,V.useMemo)(()=>n?n.package?.includes(`github.com/HarperDB/status-check-fabric`)||n.package?.includes(`github.com/HarperFast/status-check-fabric`)||n.path===`importedApplications`||n.path===`newApplication`:!1,[n]),re=(0,V.useMemo)(()=>({rootEntries:f.rootEntries,reloadRootEntries:p,entryExists:m,focusedItem:v,setFocusedItem:y,expandedItems:b,setExpandedItems:w,selectedItems:T,setSelectedItems:E,restrictPackageModification:ne,openedEntry:n,setOpenedEntry:r,openedEntryContents:i,setOpenedEntryContents:a,saveFile:te,isSavingFile:N}),[f.rootEntries,p,m,v,y,b,w,T,E,ne,n,r,i,a,te,N]);return(0,H.jsx)(Zn.Provider,{value:re,children:e})}function Zv(){let{value:e,trigger:t}=ht(`ShowAddDirectoryOrFileModalType`,!1),n=(0,V.useCallback)(()=>{Mt(`ShowAddDirectoryOrFileModalType`,!1),bt(t)},[t]),{openedEntry:r,entryExists:i,reloadRootEntries:a,setFocusedItem:o,setSelectedItems:c,setExpandedItems:l}=Qn(),u=Ze(),{mutate:d,isPending:f}=xe(),p=oe({resolver:M(h.object({name:h.string().nonempty({error:`Please enter a valid name.`}).regex(/^[a-zA-Z0-9_\- .]*$/,{error:`Names can only contain letters, numbers, underscores, hyphens, periods, and spaces.`}).max(50,{error:`Names cannot be longer than 50 characters.`}).trim()})),defaultValues:{name:``}}),m=(0,V.useCallback)(t=>{if(!r||!e)return;let s=r.path.split(`/`),f=(Te(r)?s.slice(1):s.slice(1,-1)).join(`/`),m=f?`${f}/${t.name}`:t.name;if(i(r.project+`/`+m)){j.error(`${Le(e)} already exists!`,{description:m});return}d({file:m,project:r.project,payload:e===`directory`?void 0:``,...u},{onSuccess:()=>{a(),n(),p.reset();let i=[r.project,f,t.name].filter(sn).join(`/`);o(i),c([i]),e===`directory`&&l(e=>[...e,i])}})},[d,p,n,u,r,i,a,l,o,c,e]),g=(0,V.useCallback)(()=>{n(),p.reset()},[n,p]);return(0,H.jsx)(_t,{onOpenChange:n,open:!!e,children:(0,H.jsx)(St,{"aria-describedby":void 0,className:`text-popover-foreground`,children:(0,H.jsx)(et,{...p,children:(0,H.jsxs)(`form`,{id:`instance-add-app-${e}-form`,name:`instance-add-app-${e}-form`,onSubmit:p.handleSubmit(m),children:[(0,H.jsxs)(Ot,{children:[(0,H.jsxs)(Tt,{children:[`Add `,e]}),(0,H.jsxs)(Ut,{children:[`Enter the name of the `,e,` you want to add`,e===`file`?`, don't forget the extension`:``,`!`]})]}),(0,H.jsx)(F,{control:p.control,name:`name`,render:({field:e})=>(0,H.jsxs)(I,{className:`my-2`,children:[(0,H.jsx)(L,{children:`Name`}),(0,H.jsx)(z,{children:(0,H.jsx)(R,{disabled:f,type:`text`,autoComplete:`off`,autoCapitalize:`off`,...e})}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(Lt,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,H.jsx)(s,{type:`button`,variant:`ghostOutline`,className:`rounded-full`,onClick:g,children:`Cancel`}),(0,H.jsxs)(s,{variant:`positiveOutline`,type:`submit`,className:`rounded-full`,disabled:f,children:[(0,H.jsx)(Ae,{}),` Add `,e]})]})})]})})})})}function Qv(){let{value:e,trigger:t}=ht(`ShowDeleteDirectoryOrFileModal`,!1),n=Ze(),{openedEntry:r,reloadRootEntries:a,setFocusedItem:o,setSelectedItems:c,selectedItems:l}=Qn(),u=l.length>1,d=Te(r),f=d&&r.path===r.project,p=!!r?.package,m=p?`Remove`:`Delete`,h=p?`Imported Application`:f?`Application`:d?`Directory`:`File`,g=(0,V.useCallback)(()=>{Mt(`ShowDeleteDirectoryOrFileModal`,!1),bt(t)},[t]),_=(0,V.useCallback)(async()=>{g();let e=[],t=0,r=!1,s={label:`Cancel`,onClick:()=>{r=!0}},u={label:`OK`,onClick:()=>void 0},d=`deleting-files`;for(let a of l.reverse()){e=a.split(`/`);let o=e[0],c=e.length>1?e.slice(1).join(`/`):void 0;if(j.loading(`${m} in progress...`,{id:d,description:`${t} of ${i(l.length,`item`,`items`)}`,action:s}),await Ce({file:c,project:o,...n}),r)break;t+=1}if(r?j.warning(`${m} canceled!`,{id:d,description:``,action:u}):j.success(`${m} completed!`,{id:d,description:``,action:u}),e.length){let t=e.slice(0,-1).join(`/`);o(t||void 0),c(t?[t]:[]),a()}},[m,g,n,a,l,o,c]),v=(0,V.useCallback)(e=>{e.preventDefault(),_()},[_]);return(0,H.jsx)(_t,{onOpenChange:g,open:e,children:(0,H.jsxs)(St,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(Ot,{children:[(0,H.jsxs)(Tt,{children:[m,` `,h]}),(0,H.jsxs)(Ut,{children:[`Are you sure you want to `,m.toLowerCase(),` `,u?`these ${l.length} items`:`this ${h.toLowerCase()}`,`?`]}),!p&&(0,H.jsx)(Ut,{className:`whitespace-pre`,children:u?l.join(`
|
|
318
318
|
`):r?.path})]}),(0,H.jsxs)(`div`,{className:`flex w-full gap-4`,children:[(0,H.jsx)(s,{type:`button`,variant:`ghostOutline`,className:`w-full rounded-full`,onClick:g,children:`Cancel`}),(0,H.jsxs)(s,{variant:`destructiveOutline`,type:`button`,className:`w-full rounded-full`,autoFocus:!0,onClick:v,children:[(0,H.jsx)(Ve,{}),` `,m,` `,u?`items`:h]})]})]})})}async function $v({packageName:e,project:t,skipNodeModules:n,skipSymlinks:r,instanceClient:i}){let{data:a}=await i.post(`/`,{operation:`package_component`,package:e,project:t,skip_node_modules:n,skip_symlinks:r},{timeout:3e5});return a}function ey(){return T({mutationFn:$v})}function ty(){let{value:e,trigger:t}=ht(`ShowDownloadApplicationModal`,!1),n=Ze(),{openedEntry:r}=Qn(),{mutate:i,isPending:a,isSuccess:o}=ey(),c=o?`Downloaded`:a?`Downloading`:`Download`,[l,u]=(0,V.useState)(!1),d=(0,V.useCallback)(e=>{u(e.target.checked)},[]),f=(0,V.useCallback)(()=>{Mt(`ShowDownloadApplicationModal`,!1),bt(t)},[t]),p=(0,V.useCallback)(e=>{if(e.preventDefault(),!r)return;f();let t=j.loading(`Packaging...`);i({packageName:r.package,project:r.project,skipNodeModules:!l,...n},{onSuccess:e=>{j.success(`Download ready!`,{id:t});let n=document.createElement(`a`);n.setAttribute(`class`,`invisible absolute top-0`);let i=Uint8Array.from(atob(e.payload),e=>e.charCodeAt(0)),a=new Blob([i],{type:`application/gzip`});n.href=URL.createObjectURL(a),n.download=`${r.project}.gz`,document.body.appendChild(n),n.click(),document.body.removeChild(n)}})},[r,i,l,n,f]);return(0,H.jsx)(_t,{onOpenChange:f,open:e,children:(0,H.jsxs)(St,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(Ot,{children:[(0,H.jsx)(Tt,{children:`Download Application`}),(0,H.jsxs)(Ut,{children:[`This will package up the contents of `,(0,H.jsx)(`strong`,{children:r?.project}),` into a gzipped file.`]})]}),(0,H.jsxs)(an,{className:`flex`,children:[(0,H.jsx)(R,{type:`checkbox`,className:`w-6`,disabled:a,checked:l,onChange:d}),(0,H.jsx)(`span`,{className:`pl-4 pr-8 flex-1 py-2.5`,children:`Include Node Modules`})]}),(0,H.jsxs)(`div`,{className:`flex w-full gap-4`,children:[(0,H.jsx)(s,{type:`button`,variant:`ghostOutline`,className:`w-full rounded-full`,onClick:f,children:`Cancel`}),(0,H.jsxs)(s,{variant:`positive`,type:`button`,className:`w-full rounded-full`,disabled:a,autoFocus:!0,onClick:p,children:[(0,H.jsx)(se,{}),` `,c,a?`...`:``]})]})]})})}function ny({field:e}){let{toggled:t,toggle:n}=qt(!1);return(0,H.jsxs)(I,{className:`my-4`,children:[(0,H.jsxs)(L,{onClick:n,className:p(`flex items-center gap-2`,t?``:`text-muted-foreground italic`),children:[t?(0,H.jsx)(Ht,{}):(0,H.jsx)(gt,{}),` Optional Database Name`]}),(0,H.jsx)(tt,{className:t?``:`hidden`,children:`"data" is the default recommended name`}),(0,H.jsx)(z,{className:t?``:`hidden`,children:(0,H.jsx)(R,{type:`text`,className:`my-1`,...e})}),(0,H.jsx)(B,{})]})}var ry=function(e){return e.Any=`Any`,e.BigInt=`BigInt`,e.Blob=`Blob`,e.Boolean=`Boolean`,e.Bytes=`Bytes`,e.Date=`Date`,e.Float=`Float`,e.ID=`ID`,e.Int=`Int`,e.Long=`Long`,e.String=`String`,e}({}),iy=y().nonempty({error:`Field name is required.`}).regex(Ct,{error:`Field name cannot include backticks or forward slashes.`}).max(250,{error:`Field name cannot be longer than 250 characters.`}),ay=v({tableName:Ft,databaseName:Et,expiration:g().or(f(``)),enableRest:m(),sealed:m(),tableFields:u(v({fieldName:iy,fieldType:_(ry),primaryKey:m(),nullable:m(),indexed:m(),array:m()})).min(1,{error:`Please add at least one field.`})});function oy({field:e}){let{toggled:t,toggle:n}=qt(!1),r=(0,V.useCallback)(t=>e.onChange(t.target.value?parseInt(t.target.value,10):t.target.value),[]);return(0,H.jsxs)(I,{className:`my-4`,children:[(0,H.jsxs)(L,{onClick:n,className:p(`flex items-center gap-2`,t?``:`text-muted-foreground italic`),children:[t?(0,H.jsx)(Ht,{}):(0,H.jsx)(gt,{}),` Optional Expiration`]}),(0,H.jsx)(tt,{className:t?``:`hidden`,children:`After how many seconds should records be automatically evicted? Leave blank or set to 0 to skip this feature. (It can be useful for cache records.)`}),(0,H.jsx)(z,{className:t?``:`hidden`,children:(0,H.jsx)(R,{...e,type:`number`,min:0,step:1,className:`my-1`,onChange:r})}),(0,H.jsx)(B,{})]})}function sy(){let e=Qt(`ShowNewTableModal`,!1),{openedEntry:t,openedEntryContents:n}=Qn(),{setContent:r}=Po(!!t&&!t.package&&t.path),i=oe({resolver:M(ay),defaultValues:{tableName:``,databaseName:`data`,expiration:``,enableRest:!0,sealed:!0,tableFields:[{fieldName:`id`,fieldType:ry.ID,primaryKey:!0,nullable:!0,indexed:!1,array:!1}]}}),{control:a,handleSubmit:o,formState:c}=i,{fields:l,append:u,remove:d}=te({name:`tableFields`,control:a}),f=(0,V.useCallback)(()=>{u({fieldName:``,fieldType:ry.String,primaryKey:!1,nullable:!1,indexed:!1,array:!1})},[u]),p=(0,V.useCallback)(async t=>{r(e=>{let r=e||n||``,i=[!!t.databaseName&&t.databaseName!==`data`&&`database: "${t.databaseName}"`,!!t.expiration&&t.expiration>0&&`expiration: ${t.expiration}`].filter(sn),a=i.length?`(${i.join(`, `)})`:``,o=t.enableRest?` @export`:``,s=t.sealed?` @sealed`:``,c=t.tableFields.map(e=>{let t=e.array?`[${e.fieldType}]`:e.fieldType,n=e.nullable?``:`!`,r=e.primaryKey?` @primaryKey`:``,i=e.indexed?` @indexed`:``;return`\n\t${e.fieldName}: ${t}${n}${r}${i}`}).join(``);return`${r}\ntype ${t.tableName} @table${a}${o}${s} {${c}\n}\n`}),e()},[r,e,n]);return(0,H.jsx)(et,{...i,children:(0,H.jsxs)(`form`,{id:`instance-new-app-table-form`,name:`instance-new-app-table-form`,onSubmit:o(p),children:[(0,H.jsx)(F,{control:a,name:`tableName`,render:({field:e})=>(0,H.jsxs)(I,{className:`my-4`,children:[(0,H.jsx)(L,{children:`Table Name`}),(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`text`,className:`my-1`,...e})}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(`h3`,{className:`text-lg`,children:`Table Fields`}),l.map((e,t)=>(0,H.jsxs)(`div`,{className:`p-4 my-2 border rounded-lg`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,H.jsx)(F,{control:a,name:`tableFields.${t}.fieldName`,render:({field:e})=>(0,H.jsxs)(I,{children:[(0,H.jsx)(L,{children:`Field Name`}),(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`text`,...e})}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(F,{control:a,name:`tableFields.${t}.fieldType`,render:({field:e})=>(0,H.jsxs)(I,{children:[(0,H.jsx)(L,{children:`Type`}),(0,H.jsx)(z,{children:(0,H.jsxs)(nt,{...e,onValueChange:e.onChange,defaultValue:e.value,children:[(0,H.jsx)(Wt,{className:`w-full`,children:(0,H.jsx)(We,{})}),(0,H.jsxs)(Be,{children:[(0,H.jsx)(Ge,{value:`Any`,children:`Any`}),(0,H.jsx)(Ge,{value:`BigInt`,children:`BigInt`}),(0,H.jsx)(Ge,{value:`Blob`,children:`Blob`}),(0,H.jsx)(Ge,{value:`Boolean`,children:`Boolean`}),(0,H.jsx)(Ge,{value:`Bytes`,children:`Bytes`}),(0,H.jsx)(Ge,{value:`Date`,children:`Date`}),(0,H.jsx)(Ge,{value:`Float`,children:`Float`}),(0,H.jsx)(Ge,{value:`ID`,children:`ID`}),(0,H.jsx)(Ge,{value:`Int`,children:`Int`}),(0,H.jsx)(Ge,{value:`Long`,children:`Long`}),(0,H.jsx)(Ge,{value:`String`,children:`String`})]})]})}),(0,H.jsx)(B,{})]})})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center mt-2 gap-x-2 md:gap-x-4`,children:[(0,H.jsx)(F,{control:a,name:`tableFields.${t}.indexed`,render:({field:e})=>(0,H.jsxs)(I,{className:`inline-flex`,children:[(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`checkbox`,className:`w-5`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(L,{className:`flex-1 py-2.5`,children:`Indexed`}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(F,{control:a,name:`tableFields.${t}.primaryKey`,render:({field:e})=>(0,H.jsxs)(I,{className:`inline-flex`,children:[(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`checkbox`,className:`w-5`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(L,{className:`flex-1 py-2.5`,children:`Primary Key`}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(F,{control:a,name:`tableFields.${t}.nullable`,render:({field:e})=>(0,H.jsxs)(I,{className:`inline-flex`,children:[(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`checkbox`,className:`w-5`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(L,{className:`flex-1 py-2.5`,children:`Nullable`}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(F,{control:a,name:`tableFields.${t}.array`,render:({field:e})=>(0,H.jsxs)(I,{className:`inline-flex`,children:[(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`checkbox`,className:`w-5`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(L,{className:`flex-1 py-2.5`,children:`Array`}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(`div`,{className:`grow`}),(0,H.jsxs)(s,{type:`button`,variant:`destructiveGhost`,className:`rounded-full`,onClick:()=>d(t),children:[(0,H.jsx)(Ve,{}),` Remove Field`]})]})]},e.id)),(0,H.jsxs)(s,{variant:`ghost`,type:`button`,className:`w-full`,onClick:f,children:[(0,H.jsx)(Ae,{}),` Add Another Field`]}),(0,H.jsx)(`hr`,{className:`my-6 border-gray-600`}),(0,H.jsx)(F,{control:a,name:`databaseName`,render:({field:e})=>(0,H.jsx)(ny,{field:e})}),(0,H.jsx)(F,{control:a,name:`expiration`,render:({field:e})=>(0,H.jsx)(oy,{field:e})}),(0,H.jsx)(F,{control:a,name:`enableRest`,render:({field:e})=>(0,H.jsxs)(I,{className:`flex`,children:[(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`checkbox`,className:`w-5`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsxs)(L,{className:`flex-1 py-2.5`,children:[`Make available as a REST endpoint (add`,` `,(0,H.jsx)(`code`,{className:`text-muted-foreground italic ml-1`,children:`@export`}),`)`]}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(F,{control:a,name:`sealed`,render:({field:e})=>(0,H.jsxs)(I,{className:`flex`,children:[(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`checkbox`,className:`w-5`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsxs)(L,{className:`flex-1 py-2.5`,children:[`Sealed (add`,(0,H.jsx)(`code`,{className:`text-muted-foreground italic ml-1`,children:`@sealed`}),` to ignore unspecified properties)`]}),(0,H.jsx)(B,{})]})}),(0,H.jsxs)(`div`,{className:`text-muted-foreground italic text-sm pb-2`,children:[`There are even more directives available to you when editing your schema.graphql by hand! You can read more about them`,` `,(0,H.jsx)(`a`,{className:`underline`,target:`_blank`,rel:`noreferrer`,href:`https://docs.harperdb.io/docs/developers/applications/defining-schemas`,children:`in our documentation`}),`.`]}),(0,H.jsxs)(`div`,{className:`flex w-full gap-4 sticky -bottom-6 pb-6 pt-4 bg-background dark:bg-black`,children:[(0,H.jsxs)(s,{type:`button`,variant:`ghost`,className:`w-full rounded-full`,onClick:e,children:[(0,H.jsx)(gn,{}),` Cancel`]}),(0,H.jsxs)(s,{variant:`positive`,type:`submit`,className:`w-full rounded-full`,disabled:!c.isValid,children:[(0,H.jsx)(Ae,{}),` New Table`]})]})]})})}function cy(){let{value:e,trigger:t}=ht(`ShowNewTableModal`,!1);return(0,H.jsx)(_t,{onOpenChange:(0,V.useCallback)(()=>{Mt(`ShowNewTableModal`,!1),bt(t)},[t]),open:e,children:(0,H.jsxs)(St,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(Ot,{children:[(0,H.jsx)(Tt,{children:`New Table`}),(0,H.jsx)(Ut,{children:`Creating a table is the basis of a data-driven application and can immediately be used as RESTful endpoints. This can also be configured as a caching table and extended and customized for specific endpoint behavior.`})]}),(0,H.jsx)(sy,{})]})})}function ly(){let{value:e,trigger:t}=ht(`ShowRedeployApplicationModal`,!1),n=S(),r=Ze(),{openedEntry:i}=Qn(),a=i?.package,{mutate:o,isPending:c}=Qg(),l=oe({defaultValues:{applicationUrl:a,installCommand:``}}),{control:u,handleSubmit:d,reset:f}=l;(0,V.useEffect)(()=>{f({applicationUrl:a})},[f,a]);let p=(0,V.useCallback)(()=>{Mt(`ShowRedeployApplicationModal`,!1),bt(t),f({applicationUrl:a})},[f,a,t]),m=(0,V.useCallback)((e,t)=>{if(!i)return;p();let a=j.loading(`Redeploying...`);o({applicationName:i.project,applicationUrl:e,installCommand:t,...r},{onSuccess:()=>{j.success(`Application ${i.project} redeployed successfully`,{id:a}),n.invalidateQueries({queryKey:[r.entityId,`get_components`],refetchType:`active`})},onError:()=>{j.dismiss(a)}})},[o,i,r,n,p]),h=({applicationUrl:e,installCommand:t})=>{e&&m(e,t)};return(0,H.jsx)(_t,{onOpenChange:p,open:e,children:(0,H.jsxs)(St,{"aria-describedby":void 0,className:`text-popover-foreground`,children:[(0,H.jsxs)(Ot,{children:[(0,H.jsx)(Tt,{children:`Redeploy Package`}),(0,H.jsx)(Ut,{children:`Redeploy this package?`})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(et,{...l,children:(0,H.jsxs)(`form`,{id:`instance-redeploy-app-form`,name:`instance-redeploy-app-form`,className:`flex flex-col w-full gap-4`,onSubmit:d(h),children:[(0,H.jsx)(F,{control:u,name:`applicationUrl`,render:({field:e})=>(0,H.jsxs)(I,{children:[(0,H.jsx)(L,{className:`pb-1`,children:`Package Reference`}),(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`text`,autoFocus:!0,...e})}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(F,{control:u,name:`installCommand`,render:({field:e})=>(0,H.jsxs)(I,{children:[(0,H.jsx)(L,{className:`pb-1`,children:`Install Command`}),(0,H.jsx)(z,{children:(0,H.jsx)(R,{type:`text`,placeholder:`npm install`,...e})}),(0,H.jsx)(B,{})]})}),(0,H.jsxs)(s,{variant:`positiveOutline`,type:`submit`,className:`w-full rounded-full`,disabled:c,children:[(0,H.jsx)(Qe,{}),` Redeploy Application`]}),(0,H.jsx)(s,{type:`button`,variant:`ghostOutline`,className:`w-full rounded-full`,onClick:p,disabled:c,children:`Cancel`})]})})})]})})}function uy(e){return Oe(e.split(`/`).slice(0,-1))}function dy(e,t){return Oe(uy(e),t)}function fy(){let{value:e,trigger:t}=ht(`ShowRenameFileModal`,!1),n=(0,V.useCallback)(()=>{Mt(`ShowRenameFileModal`,!1),bt(t)},[t]),{openedEntry:r,entryExists:i}=Qn(),a=h.object({name:h.string().nonempty({error:`Please enter a valid name.`}).regex(/^[a-zA-Z0-9_\- .]*$/,{error:`Names can only contain letters, numbers, underscores, hyphens, periods, and spaces.`}).max(50,{error:`Names cannot be longer than 50 characters.`}).trim().refine(e=>e!==r?.name,{error:`Please enter a new name.`})}),[o,c]=(0,V.useState)(!1),l=$n(),u=oe({resolver:M(a)});(0,V.useEffect)(()=>{r?.name&&u.reset({name:r?.name})},[u,r?.name]);let d=(0,V.useCallback)(async e=>{if(!r)return;let t=dy(r.path,e.name);if(i(t)){j.error(`${Te(r)?`Directory`:`File`} already exists!`,{description:t});return}c(!0),await l([{from:r.path,to:t}]),n(),u.reset(),c(!1)},[n,i,u,r,l,c]),f=(0,V.useCallback)(()=>{n(),u.reset()},[n,u]);return(0,H.jsx)(_t,{onOpenChange:n,open:e,children:(0,H.jsx)(St,{"aria-describedby":void 0,className:`text-popover-foreground`,children:(0,H.jsx)(et,{...u,children:(0,H.jsxs)(`form`,{id:`instance-rename-app-file-form`,name:`instance-rename-app-file-form`,onSubmit:u.handleSubmit(d),children:[(0,H.jsxs)(Ot,{children:[(0,H.jsx)(Tt,{children:`Rename File`}),(0,H.jsx)(Ut,{children:r?.path})]}),(0,H.jsx)(F,{control:u.control,name:`name`,render:({field:e})=>(0,H.jsxs)(I,{className:`my-2`,children:[(0,H.jsx)(L,{children:`Name`}),(0,H.jsx)(z,{children:(0,H.jsx)(R,{disabled:o,type:`text`,autoComplete:`off`,autoCapitalize:`off`,...e})}),(0,H.jsx)(B,{})]})}),(0,H.jsx)(Lt,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,H.jsx)(s,{type:`button`,variant:`ghostOutline`,className:`rounded-full`,onClick:f,children:`Cancel`}),(0,H.jsxs)(s,{variant:`positiveOutline`,type:`submit`,className:`rounded-full`,disabled:o||!u.formState.isDirty||!u.formState.isValid,children:[(0,H.jsx)(vt,{}),` Rename`]})]})})]})})})})}function py(){let e=At(),t=b({strict:!1}),{toggle:n,toggled:r}=Xn(`ApplicationsSidebarOpened`,!0);return e?(0,H.jsxs)(Xv,{children:[(0,H.jsx)(`aside`,{id:`file-explorer-sidebar`,className:p(`pt-[calc(--spacing(32))] w-56 fixed top-0 left-0 bottom-0 z-30`,`bg-violet-50 border-r border-violet-200 shadow shadow-black/10`,`dark:bg-grey-700 dark:border-grey-600 dark:shadow-black`,`transition-transform -translate-x-full`,r?`translate-x-0`:`md:translate-x-0`),"aria-label":`Sidebar`,children:(0,H.jsx)(Vo,{})}),(0,H.jsxs)(`div`,{className:p(`applications-content`,`overflow-y-auto overflow-x-hidden`,`fixed top-32 right-0 bottom-0 left-0`,`transition-[left]`,`md:left-56`,r&&`sm:left-56`),children:[(0,H.jsx)(Gv,{}),(0,H.jsx)($o,{toggledSidebar:r,toggleSidebar:n})]}),(0,H.jsx)(Zv,{}),(0,H.jsx)(cy,{}),(0,H.jsx)(Qv,{}),(0,H.jsx)(ty,{}),(0,H.jsx)(ly,{}),(0,H.jsx)(fy,{})]}):(0,H.jsx)(w,{to:on(t,`databases`)})}export{py as ApplicationsEditor};
|
|
319
|
-
//# sourceMappingURL=applications-
|
|
319
|
+
//# sourceMappingURL=applications-CigxJarn.js.map
|