@principal-ade/panels 1.0.39
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/README.md +360 -0
- package/dist/components/AnimatedResizableLayout.d.ts +42 -0
- package/dist/components/AnimatedResizableLayout.d.ts.map +1 -0
- package/dist/components/AnimatedVerticalLayout.d.ts +59 -0
- package/dist/components/AnimatedVerticalLayout.d.ts.map +1 -0
- package/dist/components/ConfigurablePanelLayout.d.ts +87 -0
- package/dist/components/ConfigurablePanelLayout.d.ts.map +1 -0
- package/dist/components/EditableConfigurablePanelLayout.d.ts +17 -0
- package/dist/components/EditableConfigurablePanelLayout.d.ts.map +1 -0
- package/dist/components/PanelConfigurator.d.ts +55 -0
- package/dist/components/PanelConfigurator.d.ts.map +1 -0
- package/dist/components/ResponsiveConfigurablePanelLayout.d.ts +21 -0
- package/dist/components/ResponsiveConfigurablePanelLayout.d.ts.map +1 -0
- package/dist/components/SnapCarousel.d.ts +38 -0
- package/dist/components/SnapCarousel.d.ts.map +1 -0
- package/dist/components/TabGroup.d.ts +21 -0
- package/dist/components/TabGroup.d.ts.map +1 -0
- package/dist/components/ThreePanelLayout.d.ts +63 -0
- package/dist/components/ThreePanelLayout.d.ts.map +1 -0
- package/dist/hooks/useLocalStorage.d.ts +2 -0
- package/dist/hooks/useLocalStorage.d.ts.map +1 -0
- package/dist/hooks/useMediaQuery.d.ts +2 -0
- package/dist/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +58 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +2 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/panels.css +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/types/index.d.ts +24 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/theme.d.ts +23 -0
- package/dist/types/theme.d.ts.map +1 -0
- package/dist/utils/themeMapping.d.ts +10 -0
- package/dist/utils/themeMapping.d.ts.map +1 -0
- package/package.json +94 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react/jsx-runtime"),require("react"),require("react-resizable-panels"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react/jsx-runtime","react","react-resizable-panels","react-dom"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).A24ZPanels={},e["react/jsx-runtime"],e.React,e.ReactResizablePanels,e.ReactDOM)}(this,function(e,t,n,r,a){"use strict";function o(e){return{"--panel-background":e.colors.background,"--panel-border":e.colors.border,"--panel-handle":e.colors.backgroundSecondary,"--panel-handle-hover":e.colors.backgroundHover,"--panel-handle-active":e.colors.primary,"--panel-button-bg":e.colors.surface,"--panel-button-hover":e.colors.backgroundHover,"--panel-button-border":e.colors.border,"--panel-button-icon":e.colors.textSecondary,"--panel-accent-bg":e.colors.primary+"15"}}function l(e){return{"--tab-list-bg":e.colors.backgroundSecondary,"--tab-border":e.colors.border,"--tab-bg":e.colors.surface,"--tab-bg-hover":e.colors.backgroundHover,"--tab-bg-active":e.colors.primary,"--tab-text":e.colors.text,"--tab-text-active":e.colors.background,"--tab-border-hover":e.colors.textSecondary,"--tab-border-active":e.colors.primary,"--tab-focus":e.colors.primary,"--tab-content-bg":e.colors.background,"--tab-empty-text":e.colors.textMuted}}const i=({panelIds:e,panels:r,config:a={},className:o="",theme:i})=>{const{defaultActiveTab:s=0,tabPosition:c="top",centered:d=!0,hideTabList:u=!1,activeTabIndex:p,onTabChange:f}=a,[h,m]=n.useState(s),g=void 0!==p,v=g?p:h;n.useEffect(()=>{g||m(s)},[s,g]);const b=l(i),y=e.map(e=>r.find(t=>t.id===e)).filter(e=>void 0!==e),x=Math.min(v,y.length-1),w=y[x];if(0===y.length)return t.jsx("div",{className:"tab-group-empty",children:"No panels available"});const C="top"===c||"bottom"===c||d,S=t.jsx("div",{className:"tab-list "+(C?"centered":""),role:"tablist",children:y.map((e,n)=>t.jsx("button",{role:"tab","aria-selected":n===x,"aria-controls":`tabpanel-${e.id}`,id:`tab-${e.id}`,className:"tab-button "+(n===x?"active":""),onClick:()=>(e=>{g||m(e),f?.(e)})(n),title:e.icon?e.label:void 0,children:e.icon?t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"tab-icon",children:e.icon}),t.jsx("span",{className:"tab-label",children:e.label})]}):e.label},e.id))}),R=w?t.jsx("div",{className:"tab-content",role:"tabpanel",id:`tabpanel-${w.id}`,"aria-labelledby":`tab-${w.id}`,children:w.content}):null;return t.jsxs("div",{className:`tab-group tab-position-${c} ${o}`,style:b,children:[!u&&("top"===c||"left"===c)&&S,R,!u&&("bottom"===c||"right"===c)&&S]})},s=({panels:e,layout:l,slotDataAttributes:s={},collapsiblePanels:c={left:!0,middle:!1,right:!0},defaultSizes:d={left:20,middle:60,right:20},minSizes:u={left:5,middle:10,right:5},className:p="",collapsed:f={left:!1,middle:!1,right:!1},style:h,showCollapseButtons:m=!1,animationDuration:g=300,animationEasing:v="cubic-bezier(0.4, 0, 0.2, 1)",theme:b,onLeftCollapseStart:y,onLeftCollapseComplete:x,onLeftExpandStart:w,onLeftExpandComplete:C,onMiddleCollapseStart:S,onMiddleCollapseComplete:R,onMiddleExpandStart:E,onMiddleExpandComplete:k,onRightCollapseStart:N,onRightCollapseComplete:z,onRightExpandStart:D,onRightExpandComplete:j,onPanelResize:M})=>{const A=null!==l.left&&void 0!==l.left,T=null!==l.middle&&void 0!==l.middle,P=null!==l.right&&void 0!==l.right,L=[A,T,P].filter(Boolean).length,F={left:A?d?.left??(2===L?50:3===L?20:100):0,middle:T?d?.middle??(2===L?50:3===L?60:100):0,right:P?d?.right??(2===L?50:3===L?20:100):0},$={left:u?.left??5,middle:u?.middle??10,right:u?.right??5},[B,O]=n.useState(f.left||!A),[I,q]=n.useState(f.middle||!T),[H,_]=n.useState(f.right||!P),[U,W]=n.useState(!1),[K,V]=n.useState(!1),[X,Y]=n.useState(!1),[J,G]=n.useState(!1),Q=B&&!U,Z=I&&!K,ee=H&&!X,te=n.useCallback(t=>{if(!t)return null;const n=e.find(e=>e.id===t);return n?.content||null},[e]),ne=n.useCallback(n=>{if(null===n)return null;if("object"==typeof n&&"type"in n){const r=n;return"tabs"===r.type?t.jsx(i,{panelIds:r.panels,panels:e,config:r.config,theme:b}):null}return te(n)},[e,te,b]),re=ne(l.left??null),ae=ne(l.middle??null),oe=ne(l.right??null),[le,ie]=n.useState(f.left||!A?0:F.left),[se,ce]=n.useState(f.middle||!T?0:F.middle),[de,ue]=n.useState(f.right||!P?0:F.right),[pe,fe]=n.useState(F.left),[he,me]=n.useState(F.middle),[ge,ve]=n.useState(F.right),be=n.useRef(null),ye=n.useRef(null),xe=n.useRef(null),we=n.useRef(null),Ce=n.useRef(void 0),Se=n.useRef(void 0),Re=n.useRef(void 0),Ee=n.useRef(void 0),ke=n.useRef(void 0),Ne=n.useRef(void 0),ze=n.useCallback((e,t)=>{const n=e.filter(e=>e.panelRef.current);if(0===n.length)return;n.forEach(e=>{e.animationFrameRef.current&&cancelAnimationFrame(e.animationFrameRef.current)});let r=0;const a=()=>{r++;const e=r/10;if(e>=1)return n.forEach(e=>{e.panelRef.current&&(0===e.toSize?e.panelRef.current.collapse():e.panelRef.current.resize(e.toSize))}),void(t&&t());const o=e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;n.forEach(e=>{if(e.panelRef.current){const t=e.fromSize+(e.toSize-e.fromSize)*o;e.panelRef.current.resize(t)}}),n[0].animationFrameRef.current=requestAnimationFrame(()=>{setTimeout(a,g/10)})};a()},[g]),De=n.useCallback(()=>{U||J||!c.left||(a.flushSync(()=>{W(!0),V(!0),Y(!0),O(!0)}),y&&y(),Ce.current&&cancelAnimationFrame(Ce.current),Ce.current=requestAnimationFrame(()=>{const e=be.current?.getLayout(),t=Math.round(1e3*(e?.[0]??le))/1e3,n=Math.round(1e3*(e?.[1]??se))/1e3,r=Math.round(1e3*(e?.[2]??de))/1e3,a=n+r,o=a>0?n/a*100:T?50:0,l=a>0?r/a*100:P?50:0;o>0&&me(o),l>0&&ve(l),ze([{panelRef:ye,fromSize:t,toSize:0,animationFrameRef:Ce,startTimeRef:Ee},{panelRef:xe,fromSize:n,toSize:o,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:r,toSize:l,animationFrameRef:Re,startTimeRef:Ne}],()=>{ie(0),ce(o),ue(l),W(!1),V(!1),Y(!1),x&&x()})}))},[U,J,le,se,de,T,P,c.left,ze,y,x]),je=n.useCallback(()=>{U||J||!c.left||(a.flushSync(()=>{W(!0),V(!0),Y(!0),O(!1)}),w&&w(),Ce.current&&cancelAnimationFrame(Ce.current),Ce.current=requestAnimationFrame(()=>{const e=be.current?.getLayout(),t=Math.round(1e3*(e?.[0]??0))/1e3,n=Math.round(1e3*(e?.[1]??se))/1e3,r=Math.round(1e3*(e?.[2]??de))/1e3,a=pe||F.left,o=100-a,l=n+r,i=l>0?n/l*o:T?o/2:0,s=l>0?r/l*o:P?o/2:0;i>0&&me(i),s>0&&ve(s),ze([{panelRef:ye,fromSize:t,toSize:a,animationFrameRef:Ce,startTimeRef:Ee},{panelRef:xe,fromSize:n,toSize:i,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:r,toSize:s,animationFrameRef:Re,startTimeRef:Ne}],()=>{ie(a),ce(i),ue(s),W(!1),V(!1),Y(!1),C&&C()})}))},[U,J,se,de,F.left,pe,T,P,c.left,ze,w,C]),Me=n.useCallback(()=>{X||J||!c.right||(a.flushSync(()=>{W(!0),V(!0),Y(!0),_(!0)}),N&&N(),Re.current&&cancelAnimationFrame(Re.current),Re.current=requestAnimationFrame(()=>{const e=be.current?.getLayout(),t=Math.round(1e3*(e?.[0]??le))/1e3,n=Math.round(1e3*(e?.[1]??se))/1e3,r=Math.round(1e3*(e?.[2]??de))/1e3,a=t+n,o=a>0?t/a*100:A?50:0,l=a>0?n/a*100:T?50:0;o>0&&fe(o),l>0&&me(l),ze([{panelRef:ye,fromSize:t,toSize:o,animationFrameRef:Ce,startTimeRef:Ee},{panelRef:xe,fromSize:n,toSize:l,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:r,toSize:0,animationFrameRef:Re,startTimeRef:Ne}],()=>{ie(o),ce(l),ue(0),W(!1),V(!1),Y(!1),z&&z()})}))},[X,J,le,se,de,A,T,c.right,ze,N,z]),Ae=n.useCallback(()=>{X||J||!c.right||(a.flushSync(()=>{W(!0),V(!0),Y(!0),_(!1)}),D&&D(),Re.current&&cancelAnimationFrame(Re.current),Re.current=requestAnimationFrame(()=>{const e=be.current?.getLayout(),t=Math.round(1e3*(e?.[0]??le))/1e3,n=Math.round(1e3*(e?.[1]??se))/1e3,r=Math.round(1e3*(e?.[2]??0))/1e3,a=ge||F.right,o=100-a,l=t+n,i=l>0?t/l*o:A?o/2:0,s=l>0?n/l*o:T?o/2:0;i>0&&fe(i),s>0&&me(s),ze([{panelRef:ye,fromSize:t,toSize:i,animationFrameRef:Ce,startTimeRef:Ee},{panelRef:xe,fromSize:n,toSize:s,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:r,toSize:a,animationFrameRef:Re,startTimeRef:Ne}],()=>{ie(i),ce(s),ue(a),W(!1),V(!1),Y(!1),j&&j()})}))},[X,J,le,se,F.right,ge,A,T,c.right,ze,D,j]),Te=n.useCallback(()=>{B?je():De()},[B,De,je]),Pe=n.useCallback(()=>{K||J||!c.middle||(a.flushSync(()=>{W(!0),V(!0),Y(!0),q(!0)}),S&&S(),Se.current&&cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{const e=be.current?.getLayout(),t=Math.round(1e3*(e?.[0]??le))/1e3,n=Math.round(1e3*(e?.[1]??se))/1e3,r=Math.round(1e3*(e?.[2]??de))/1e3,a=t+r,o=a>0?t/a*100:A?50:0,l=a>0?r/a*100:P?50:0;o>0&&fe(o),l>0&&ve(l),ze([{panelRef:ye,fromSize:t,toSize:o,animationFrameRef:Ce,startTimeRef:Ee},{panelRef:xe,fromSize:n,toSize:0,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:r,toSize:l,animationFrameRef:Re,startTimeRef:Ne}],()=>{ie(o),ce(0),ue(l),W(!1),V(!1),Y(!1),R&&R()})}))},[K,J,le,se,de,A,P,c.middle,ze,S,R]),Le=n.useCallback(()=>{K||J||!c.middle||(a.flushSync(()=>{W(!0),V(!0),Y(!0),q(!1)}),E&&E(),Se.current&&cancelAnimationFrame(Se.current),Se.current=requestAnimationFrame(()=>{const e=be.current?.getLayout(),t=Math.round(1e3*(e?.[0]??le))/1e3,n=Math.round(1e3*(e?.[1]??0))/1e3,r=Math.round(1e3*(e?.[2]??de))/1e3,a=he||F.middle,o=100-a,l=t+r,i=l>0?t/l*o:A?o/2:0,s=l>0?r/l*o:P?o/2:0;i>0&&fe(i),s>0&&ve(s),ze([{panelRef:ye,fromSize:t,toSize:i,animationFrameRef:Ce,startTimeRef:Ee},{panelRef:xe,fromSize:n,toSize:a,animationFrameRef:Se,startTimeRef:ke},{panelRef:we,fromSize:r,toSize:s,animationFrameRef:Re,startTimeRef:Ne}],()=>{ie(i),ce(a),ue(s),W(!1),V(!1),Y(!1),k&&k()})}))},[K,J,le,de,F.middle,he,A,P,c.middle,ze,E,k]),Fe=n.useCallback(()=>{H?Ae():Me()},[H,Me,Ae]),$e=n.useCallback(e=>{U||K||X||(ie(e),e>0&&(fe(e),O(!1)))},[U,K,X]),Be=n.useCallback(e=>{U||K||X||(ce(e),e>0&&(me(e),q(!1)))},[U,K,X]),Oe=n.useCallback(e=>{U||K||X||(ue(e),e>0&&(ve(e),_(!1)))},[U,K,X]),Ie=n.useCallback(()=>{if(M){M({left:B?pe:le,middle:I?he:se,right:H?ge:de})}},[le,se,de,B,I,H,pe,he,ge,M]),qe=n.useCallback(e=>{G(e),e||Ie()},[Ie]);n.useEffect(()=>{void 0!==f.left&&f.left!==B&&queueMicrotask(()=>{f.left?De():je()})},[f.left,B,De,je]),n.useEffect(()=>{void 0!==f.middle&&f.middle!==I&&queueMicrotask(()=>{f.middle?Pe():Le()})},[f.middle,I,Pe,Le]),n.useEffect(()=>{void 0!==f.right&&f.right!==H&&queueMicrotask(()=>{f.right?Me():Ae()})},[f.right,H,Me,Ae]),n.useEffect(()=>()=>{Ce.current&&cancelAnimationFrame(Ce.current),Se.current&&cancelAnimationFrame(Se.current),Re.current&&cancelAnimationFrame(Re.current)},[]);const He=e=>{let t="three-panel-item";return"left"===e?!c.left&&A||(t+=" collapsible-panel",U&&!J&&(t+=" animating"),Q&&(t+=" collapsed")):"middle"===e?(t+=" middle-panel",!c.middle&&T||(t+=" collapsible-panel",K&&!J&&(t+=" animating"),Z&&(t+=" collapsed"))):"right"===e&&(!c.right&&P||(t+=" collapsible-panel",X&&!J&&(t+=" animating"),ee&&(t+=" collapsed"))),t},_e=U&&!J?{transition:`width ${g}ms ${v}`,width:B?"0%":`${F.left}%`}:void 0,Ue=K&&!J?{transition:`width ${g}ms ${v}`,width:I?"0%":`${F.middle}%`}:void 0,We=X&&!J?{transition:`width ${g}ms ${v}`,width:H?"0%":`${F.right}%`}:void 0,Ke=o(b),Ve=U||K||X?0:$.left,Xe=U||K||X?0:$.middle,Ye=U||K||X?0:$.right;return t.jsx("div",{className:`three-panel-layout ${p}`,style:{...Ke,...h},children:t.jsxs(r.PanelGroup,{ref:be,direction:"horizontal",onLayout:Ie,children:[t.jsx(r.Panel,{ref:ye,collapsible:c.left||!A,defaultSize:f.left||!A?0:F.left,minSize:Ve,collapsedSize:0,onResize:$e,onCollapse:()=>O(!0),onExpand:()=>O(!1),className:He("left"),style:_e,...s.left||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:B?0:1,transition:U?`opacity ${.5*g}ms ${v}`:"none"},children:re})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle left-handle "+(!Q&&A&&T?"":"collapsed"),onDragging:qe,disabled:Q||!A||!T,children:m&&c.left&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:Te,className:"collapse-toggle",disabled:U,"aria-label":B?"Expand left panel":"Collapse left panel",children:B?"▸":"◂"})})}),t.jsx(r.Panel,{ref:xe,collapsible:c.middle||!T,defaultSize:f.middle||!T?0:F.middle,minSize:Xe,collapsedSize:0,onResize:Be,onCollapse:()=>q(!0),onExpand:()=>q(!1),className:He("middle"),style:Ue,...s.middle||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:I?0:1,transition:K?`opacity ${.5*g}ms ${v}`:"none"},children:ae})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle right-handle "+(ee||!P||!T&&!A?"collapsed":""),onDragging:qe,disabled:ee||!P||!T&&!A,children:m&&c.right&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:Fe,className:"collapse-toggle",disabled:X,"aria-label":H?"Expand right panel":"Collapse right panel",children:H?"◂":"▸"})})}),t.jsx(r.Panel,{ref:we,collapsible:c.right||!P,defaultSize:f.right||!P?0:F.right,minSize:Ye,collapsedSize:0,onResize:Oe,onCollapse:()=>_(!0),onExpand:()=>_(!1),className:He("right"),style:We,...s.right||{},children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:H?0:1,transition:X?`opacity ${.5*g}ms ${v}`:"none"},children:oe})})]})})},c=n.forwardRef(({panels:e,className:r="",style:a,theme:l,minPanelWidth:i=350,idealPanelWidth:s=.333,showSeparator:c=!1,onPanelChange:d,preventKeyboardScroll:u=!0},p)=>{const f=n.useRef(null),h=o(l);n.useImperativeHandle(p,()=>({scrollToPanel:e=>{if(!f.current)return;const t=f.current,n=t.children[e];if(n){const e=n.offsetLeft;t.scrollTo({left:e,behavior:"smooth"})}},getCurrentPanel:()=>{if(!f.current||0===f.current.children.length)return 0;const e=f.current,t=e.getBoundingClientRect().left;let n=0,r=1/0;for(let a=0;a<e.children.length;a++){const o=e.children[a].getBoundingClientRect(),l=Math.abs(o.left-t);l<r&&(r=l,n=a)}return n}}));n.useEffect(()=>{if(!u||!f.current)return;const e=f.current,t=e=>{const t=e.target;if("INPUT"===t.tagName||"TEXTAREA"===t.tagName||"SELECT"===t.tagName||t.isContentEditable||null!==t.closest(".xterm")||null!==t.closest('[contenteditable="true"]'))return;[" ","Space","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown"].includes(e.key)&&e.preventDefault()};return e.addEventListener("keydown",t),()=>{e.removeEventListener("keydown",t)}},[u]);const m=e.length,g=2*i;let v;v=1===m||2===m?"100%":`max(${i}px, ${100*s}%)`;const b=n.useId().replace(/:/g,"_");return t.jsxs(t.Fragment,{children:[2===m&&t.jsx("style",{children:`\n .snap-carousel-container[data-carousel-id="${b}"][data-panel-count="2"] .snap-carousel-panel {\n width: 100%;\n }\n @container (min-width: ${g}px) {\n .snap-carousel-container[data-carousel-id="${b}"][data-panel-count="2"] .snap-carousel-panel {\n width: 50%;\n }\n }\n `}),t.jsx("div",{ref:f,className:`snap-carousel-container ${r}`,style:{...h,...a,"--snap-carousel-min-width":`${i}px`,"--snap-carousel-ideal-width":100*s+"%","--snap-carousel-gap":c?"1px":"0px","--snap-carousel-panel-width":v,"--snap-carousel-panel-count":m,"--snap-carousel-two-panel-threshold":`${g}px`},onScroll:e=>{if(!d||!f.current||0===f.current.children.length)return;const t=f.current,n=t.getBoundingClientRect().left;let r=0,a=1/0;for(let o=0;o<t.children.length;o++){const e=t.children[o].getBoundingClientRect(),l=Math.abs(e.left-n);l<a&&(a=l,r=o)}d(r)},"data-panel-count":m,"data-carousel-id":b,children:e.map((e,n)=>t.jsx("div",{className:"snap-carousel-panel",children:e},n))})]})});function d(e){const[t,r]=n.useState(()=>"undefined"!=typeof window&&window.matchMedia(e).matches);return n.useEffect(()=>{if("undefined"==typeof window)return;const t=window.matchMedia(e),n=e=>{r(e.matches)};return r(t.matches),t.addEventListener?(t.addEventListener("change",n),()=>t.removeEventListener("change",n)):(t.addListener(n),()=>t.removeListener(n))},[e]),t}c.displayName="SnapCarousel";const u="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement;function p(e){const t=Object.prototype.toString.call(e);return"[object Window]"===t||"[object global]"===t}function f(e){return"nodeType"in e}function h(e){var t,n;return e?p(e)?e:f(e)&&null!=(t=null==(n=e.ownerDocument)?void 0:n.defaultView)?t:window:window}function m(e){const{Document:t}=h(e);return e instanceof t}function g(e){return!p(e)&&e instanceof h(e).HTMLElement}function v(e){return e instanceof h(e).SVGElement}function b(e){return e?p(e)?e.document:f(e)?m(e)?e:g(e)||v(e)?e.ownerDocument:document:document:document}const y=u?n.useLayoutEffect:n.useEffect;function x(e){const t=n.useRef(e);return y(()=>{t.current=e}),n.useCallback(function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return null==t.current?void 0:t.current(...n)},[])}function w(e,t){void 0===t&&(t=[e]);const r=n.useRef(e);return y(()=>{r.current!==e&&(r.current=e)},t),r}function C(e,t){const r=n.useRef();return n.useMemo(()=>{const t=e(r.current);return r.current=t,t},[...t])}function S(e){const t=x(e),r=n.useRef(null),a=n.useCallback(e=>{e!==r.current&&(null==t||t(e,r.current)),r.current=e},[]);return[r,a]}function R(e){const t=n.useRef();return n.useEffect(()=>{t.current=e},[e]),t.current}let E={};function k(e,t){return n.useMemo(()=>{if(t)return t;const n=null==E[e]?0:E[e]+1;return E[e]=n,e+"-"+n},[e,t])}function N(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>{const r=Object.entries(n);for(const[a,o]of r){const n=t[a];null!=n&&(t[a]=n+e*o)}return t},{...t})}}const z=N(1),D=N(-1);function j(e){if(!e)return!1;const{KeyboardEvent:t}=h(e.target);return t&&e instanceof t}function M(e){if(function(e){if(!e)return!1;const{TouchEvent:t}=h(e.target);return t&&e instanceof t}(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return function(e){return"clientX"in e&&"clientY"in e}(e)?{x:e.clientX,y:e.clientY}:null}const A="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function T(e){return e.matches(A)?e:e.querySelector(A)}const P={display:"none"};function L(e){let{id:t,value:r}=e;return n.createElement("div",{id:t,style:P},r)}function F(e){let{id:t,announcement:r,ariaLiveType:a="assertive"}=e;return n.createElement("div",{id:t,style:{position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"},role:"status","aria-live":a,"aria-atomic":!0},r)}const $=n.createContext(null);const B={draggable:"\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n "},O={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function I(e){let{announcements:t=O,container:r,hiddenTextDescribedById:o,screenReaderInstructions:l=B}=e;const{announce:i,announcement:s}=function(){const[e,t]=n.useState("");return{announce:n.useCallback(e=>{null!=e&&t(e)},[]),announcement:e}}(),c=k("DndLiveRegion"),[d,u]=n.useState(!1);if(n.useEffect(()=>{u(!0)},[]),function(e){const t=n.useContext($);n.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}(n.useMemo(()=>({onDragStart(e){let{active:n}=e;i(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&i(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;i(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;i(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;i(t.onDragCancel({active:n,over:r}))}}),[i,t])),!d)return null;const p=n.createElement(n.Fragment,null,n.createElement(L,{id:o,value:l.draggable}),n.createElement(F,{id:c,announcement:s}));return r?a.createPortal(p,r):p}var q,H;function _(){}(H=q||(q={})).DragStart="dragStart",H.DragMove="dragMove",H.DragEnd="dragEnd",H.DragCancel="dragCancel",H.DragOver="dragOver",H.RegisterDroppable="registerDroppable",H.SetDroppableDisabled="setDroppableDisabled",H.UnregisterDroppable="unregisterDroppable";const U=Object.freeze({x:0,y:0});function W(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function K(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function V(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function X(e,t,n){return void 0===t&&(t=e.left),void 0===n&&(n=e.top),{x:t+.5*e.width,y:n+.5*e.height}}const Y=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=X(t,t.left,t.top),o=[];for(const l of r){const{id:e}=l,t=n.get(e);if(t){const n=W(X(t),a);o.push({id:e,data:{droppableContainer:l,value:n}})}}return o.sort(K)};function J(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=a-r,i=o-n;if(r<a&&n<o){const n=t.width*t.height,r=e.width*e.height,a=l*i;return Number((a/(n+r-a)).toFixed(4))}return 0}const G=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const a=[];for(const o of r){const{id:e}=o,r=n.get(e);if(r){const n=J(r,t);n>0&&a.push({id:e,data:{droppableContainer:o,value:n}})}}return a.sort(V)};function Q(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:U}function Z(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}const ee=Z(1);const te={ignoreTransform:!1};function ne(e,t){void 0===t&&(t=te);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:t,transformOrigin:r}=h(e).getComputedStyle(e);t&&(n=function(e,t,n){const r=function(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}(t);if(!r)return e;const{scaleX:a,scaleY:o,x:l,y:i}=r,s=e.left-l-(1-a)*parseFloat(n),c=e.top-i-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),d=a?e.width/a:e.width,u=o?e.height/o:e.height;return{width:d,height:u,top:c,right:s+d,bottom:c+u,left:s}}(n,t,r))}const{top:r,left:a,width:o,height:l,bottom:i,right:s}=n;return{top:r,left:a,width:o,height:l,bottom:i,right:s}}function re(e){return ne(e,{ignoreTransform:!0})}function ae(e,t){const n=[];return e?function r(a){if(null!=t&&n.length>=t)return n;if(!a)return n;if(m(a)&&null!=a.scrollingElement&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!g(a)||v(a))return n;if(n.includes(a))return n;const o=h(e).getComputedStyle(a);return a!==e&&function(e,t){void 0===t&&(t=h(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(e=>{const r=t[e];return"string"==typeof r&&n.test(r)})}(a,o)&&n.push(a),function(e,t){return void 0===t&&(t=h(e).getComputedStyle(e)),"fixed"===t.position}(a,o)?n:r(a.parentNode)}(e):n}function oe(e){const[t]=ae(e,1);return null!=t?t:null}function le(e){return u&&e?p(e)?e:f(e)?m(e)||e===b(e).scrollingElement?window:g(e)?e:null:null:null}function ie(e){return p(e)?e.scrollX:e.scrollLeft}function se(e){return p(e)?e.scrollY:e.scrollTop}function ce(e){return{x:ie(e),y:se(e)}}var de,ue;function pe(e){return!(!u||!e)&&e===document.scrollingElement}function fe(e){const t={x:0,y:0},n=pe(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}(ue=de||(de={}))[ue.Forward=1]="Forward",ue[ue.Backward=-1]="Backward";const he={x:.2,y:.2};function me(e,t,n,r,a){let{top:o,left:l,right:i,bottom:s}=n;void 0===r&&(r=10),void 0===a&&(a=he);const{isTop:c,isBottom:d,isLeft:u,isRight:p}=fe(e),f={x:0,y:0},h={x:0,y:0},m=t.height*a.y,g=t.width*a.x;return!c&&o<=t.top+m?(f.y=de.Backward,h.y=r*Math.abs((t.top+m-o)/m)):!d&&s>=t.bottom-m&&(f.y=de.Forward,h.y=r*Math.abs((t.bottom-m-s)/m)),!p&&i>=t.right-g?(f.x=de.Forward,h.x=r*Math.abs((t.right-g-i)/g)):!u&&l<=t.left+g&&(f.x=de.Backward,h.x=r*Math.abs((t.left+g-l)/g)),{direction:f,speed:h}}function ge(e){if(e===document.scrollingElement){const{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}const{top:t,left:n,right:r,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:a,width:e.clientWidth,height:e.clientHeight}}function ve(e){return e.reduce((e,t)=>z(e,ce(t)),U)}const be=[["x",["left","right"],function(e){return e.reduce((e,t)=>e+ie(t),0)}],["y",["top","bottom"],function(e){return e.reduce((e,t)=>e+se(t),0)}]];class ye{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const n=ae(t),r=ve(n);this.rect={...e},this.width=e.width,this.height=e.height;for(const[a,o,l]of be)for(const e of o)Object.defineProperty(this,e,{get:()=>{const t=l(n),o=r[a]-t;return this.rect[e]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class xe{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>{var t;return null==(t=this.target)?void 0:t.removeEventListener(...e)})},this.target=e}add(e,t,n){var r;null==(r=this.target)||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}}function we(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return"number"==typeof t?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t&&r>t.y}var Ce,Se,Re,Ee;function ke(e){e.preventDefault()}function Ne(e){e.stopPropagation()}(Se=Ce||(Ce={})).Click="click",Se.DragStart="dragstart",Se.Keydown="keydown",Se.ContextMenu="contextmenu",Se.Resize="resize",Se.SelectionChange="selectionchange",Se.VisibilityChange="visibilitychange",(Ee=Re||(Re={})).Space="Space",Ee.Down="ArrowDown",Ee.Right="ArrowRight",Ee.Left="ArrowLeft",Ee.Up="ArrowUp",Ee.Esc="Escape",Ee.Enter="Enter",Ee.Tab="Tab";const ze={start:[Re.Space,Re.Enter],cancel:[Re.Esc],end:[Re.Space,Re.Enter,Re.Tab]},De=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Re.Right:return{...n,x:n.x+25};case Re.Left:return{...n,x:n.x-25};case Re.Down:return{...n,y:n.y+25};case Re.Up:return{...n,y:n.y-25}}};class je{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:t}}=e;this.props=e,this.listeners=new xe(b(t)),this.windowListeners=new xe(h(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ce.Resize,this.handleCancel),this.windowListeners.add(Ce.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ce.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&function(e,t){if(void 0===t&&(t=ne),!e)return;const{top:n,left:r,bottom:a,right:o}=t(e);oe(e)&&(a<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}(n),t(U)}handleKeyDown(e){if(j(e)){const{active:t,context:n,options:r}=this.props,{keyboardCodes:a=ze,coordinateGetter:o=De,scrollBehavior:l="smooth"}=r,{code:i}=e;if(a.end.includes(i))return void this.handleEnd(e);if(a.cancel.includes(i))return void this.handleCancel(e);const{collisionRect:s}=n.current,c=s?{x:s.left,y:s.top}:U;this.referenceCoordinates||(this.referenceCoordinates=c);const d=o(e,{active:t,context:n.current,currentCoordinates:c});if(d){const t=D(d,c),r={x:0,y:0},{scrollableAncestors:a}=n.current;for(const n of a){const a=e.code,{isTop:o,isRight:i,isLeft:s,isBottom:c,maxScroll:u,minScroll:p}=fe(n),f=ge(n),h={x:Math.min(a===Re.Right?f.right-f.width/2:f.right,Math.max(a===Re.Right?f.left:f.left+f.width/2,d.x)),y:Math.min(a===Re.Down?f.bottom-f.height/2:f.bottom,Math.max(a===Re.Down?f.top:f.top+f.height/2,d.y))},m=a===Re.Right&&!i||a===Re.Left&&!s,g=a===Re.Down&&!c||a===Re.Up&&!o;if(m&&h.x!==d.x){const e=n.scrollLeft+t.x,o=a===Re.Right&&e<=u.x||a===Re.Left&&e>=p.x;if(o&&!t.y)return void n.scrollTo({left:e,behavior:l});r.x=o?n.scrollLeft-e:a===Re.Right?n.scrollLeft-u.x:n.scrollLeft-p.x,r.x&&n.scrollBy({left:-r.x,behavior:l});break}if(g&&h.y!==d.y){const e=n.scrollTop+t.y,o=a===Re.Down&&e<=u.y||a===Re.Up&&e>=p.y;if(o&&!t.x)return void n.scrollTo({top:e,behavior:l});r.y=o?n.scrollTop-e:a===Re.Down?n.scrollTop-u.y:n.scrollTop-p.y,r.y&&n.scrollBy({top:-r.y,behavior:l});break}}this.handleMove(e,z(D(d,this.referenceCoordinates),r))}}}handleMove(e,t){const{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){const{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){const{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}function Me(e){return Boolean(e&&"distance"in e)}function Ae(e){return Boolean(e&&"delay"in e)}je.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=ze,onActivation:a}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(r.start.includes(l)){const t=o.activatorNode.current;return(!t||e.target===t)&&(e.preventDefault(),null==a||a({event:e.nativeEvent}),!0)}return!1}}];class Te{constructor(e,t,n){var r;void 0===n&&(n=function(e){const{EventTarget:t}=h(e);return e instanceof t?e:b(e)}(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;const{event:a}=e,{target:o}=a;this.props=e,this.events=t,this.document=b(o),this.documentListeners=new xe(this.document),this.listeners=new xe(n),this.windowListeners=new xe(h(o)),this.initialCoordinates=null!=(r=M(a))?r:U,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Ce.Resize,this.handleCancel),this.windowListeners.add(Ce.DragStart,ke),this.windowListeners.add(Ce.VisibilityChange,this.handleCancel),this.windowListeners.add(Ce.ContextMenu,ke),this.documentListeners.add(Ce.Keydown,this.handleKeydown),t){if(null!=n&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ae(t))return this.timeoutId=setTimeout(this.handleStart,t.delay),void this.handlePending(t);if(Me(t))return void this.handlePending(t)}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){const{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){const{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Ce.Click,Ne,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ce.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){var t;const{activated:n,initialCoordinates:r,props:a}=this,{onMove:o,options:{activationConstraint:l}}=a;if(!r)return;const i=null!=(t=M(e))?t:U,s=D(r,i);if(!n&&l){if(Me(l)){if(null!=l.tolerance&&we(s,l.tolerance))return this.handleCancel();if(we(s,l.distance))return this.handleStart()}return Ae(l)&&we(s,l.tolerance)?this.handleCancel():void this.handlePending(l,s)}e.cancelable&&e.preventDefault(),o(i)}handleEnd(){const{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){const{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Re.Esc&&this.handleCancel()}removeTextSelection(){var e;null==(e=this.document.getSelection())||e.removeAllRanges()}}const Pe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Le extends Te{constructor(e){const{event:t}=e,n=b(t.target);super(e,Pe,n)}}Le.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!(!n.isPrimary||0!==n.button)&&(null==r||r({event:n}),!0)}}];const Fe={move:{name:"mousemove"},end:{name:"mouseup"}};var $e,Be;(Be=$e||($e={}))[Be.RightClick=2]="RightClick";(class extends Te{constructor(e){super(e,Fe,b(e.event.target))}}).activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==$e.RightClick&&(null==r||r({event:n}),!0)}}];const Oe={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};var Ie,qe,He,_e;function Ue(e){let{acceleration:t,activator:r=Ie.Pointer,canScroll:a,draggingRect:o,enabled:l,interval:i=5,order:s=He.TreeOrder,pointerCoordinates:c,scrollableAncestors:d,scrollableAncestorRects:u,delta:p,threshold:f}=e;const h=function(e){let{delta:t,disabled:n}=e;const r=R(t);return C(e=>{if(n||!r||!e)return We;const a={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[de.Backward]:e.x[de.Backward]||-1===a.x,[de.Forward]:e.x[de.Forward]||1===a.x},y:{[de.Backward]:e.y[de.Backward]||-1===a.y,[de.Forward]:e.y[de.Forward]||1===a.y}}},[n,t,r])}({delta:p,disabled:!l}),[m,g]=function(){const e=n.useRef(null);return[n.useCallback((t,n)=>{e.current=setInterval(t,n)},[]),n.useCallback(()=>{null!==e.current&&(clearInterval(e.current),e.current=null)},[])]}(),v=n.useRef({x:0,y:0}),b=n.useRef({x:0,y:0}),y=n.useMemo(()=>{switch(r){case Ie.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Ie.DraggableRect:return o}},[r,o,c]),x=n.useRef(null),w=n.useCallback(()=>{const e=x.current;if(!e)return;const t=v.current.x*b.current.x,n=v.current.y*b.current.y;e.scrollBy(t,n)},[]),S=n.useMemo(()=>s===He.TreeOrder?[...d].reverse():d,[s,d]);n.useEffect(()=>{if(l&&d.length&&y){for(const e of S){if(!1===(null==a?void 0:a(e)))continue;const n=d.indexOf(e),r=u[n];if(!r)continue;const{direction:o,speed:l}=me(e,r,y,t,f);for(const e of["x","y"])h[e][o[e]]||(l[e]=0,o[e]=0);if(l.x>0||l.y>0)return g(),x.current=e,m(w,i),v.current=l,void(b.current=o)}v.current={x:0,y:0},b.current={x:0,y:0},g()}else g()},[t,w,a,g,l,i,JSON.stringify(y),JSON.stringify(h),m,d,S,u,JSON.stringify(f)])}(class extends Te{constructor(e){super(e,Oe)}static setup(){return window.addEventListener(Oe.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Oe.move.name,e)};function e(){}}}).activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:a}=n;return!(a.length>1)&&(null==r||r({event:n}),!0)}}],(qe=Ie||(Ie={}))[qe.Pointer=0]="Pointer",qe[qe.DraggableRect=1]="DraggableRect",(_e=He||(He={}))[_e.TreeOrder=0]="TreeOrder",_e[_e.ReversedTreeOrder=1]="ReversedTreeOrder";const We={x:{[de.Backward]:!1,[de.Forward]:!1},y:{[de.Backward]:!1,[de.Forward]:!1}};var Ke,Ve,Xe;(Ve=Ke||(Ke={}))[Ve.Always=0]="Always",Ve[Ve.BeforeDragging=1]="BeforeDragging",Ve[Ve.WhileDragging=2]="WhileDragging",(Xe||(Xe={})).Optimized="optimized";const Ye=new Map;function Je(e,t){return C(n=>e?n||("function"==typeof t?t(e):e):null,[t,e])}function Ge(e){let{callback:t,disabled:r}=e;const a=x(t),o=n.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.ResizeObserver)return;const{ResizeObserver:e}=window;return new e(a)},[r]);return n.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}function Qe(e){return new ye(ne(e),e)}function Ze(e,t,r){void 0===t&&(t=Qe);const[a,o]=n.useState(null);function l(){o(n=>{if(!e)return null;var a;if(!1===e.isConnected)return null!=(a=null!=n?n:r)?a:null;const o=t(e);return JSON.stringify(n)===JSON.stringify(o)?n:o})}const i=function(e){let{callback:t,disabled:r}=e;const a=x(t),o=n.useMemo(()=>{if(r||"undefined"==typeof window||void 0===window.MutationObserver)return;const{MutationObserver:e}=window;return new e(a)},[a,r]);return n.useEffect(()=>()=>null==o?void 0:o.disconnect(),[o]),o}({callback(t){if(e)for(const n of t){const{type:t,target:r}=n;if("childList"===t&&r instanceof HTMLElement&&r.contains(e)){l();break}}}}),s=Ge({callback:l});return y(()=>{l(),e?(null==s||s.observe(e),null==i||i.observe(document.body,{childList:!0,subtree:!0})):(null==s||s.disconnect(),null==i||i.disconnect())},[e]),a}const et=[];function tt(e,t){void 0===t&&(t=[]);const r=n.useRef(null);return n.useEffect(()=>{r.current=null},t),n.useEffect(()=>{const t=e!==U;t&&!r.current&&(r.current=e),!t&&r.current&&(r.current=null)},[e]),r.current?D(e,r.current):U}function nt(e){return n.useMemo(()=>e?function(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}(e):null,[e])}const rt=[];function at(e){let{measure:t}=e;const[r,a]=n.useState(null),o=Ge({callback:n.useCallback(e=>{for(const{target:n}of e)if(g(n)){a(e=>{const r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),l=n.useCallback(e=>{const n=function(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return g(t)?t:e}(e);null==o||o.disconnect(),n&&(null==o||o.observe(n)),a(n?t(n):null)},[t,o]),[i,s]=S(l);return n.useMemo(()=>({nodeRef:i,rect:r,setRef:s}),[r,i,s])}const ot=[{sensor:Le,options:{}},{sensor:je,options:{}}],lt={current:{}},it={draggable:{measure:re},droppable:{measure:re,strategy:Ke.WhileDragging,frequency:Xe.Optimized},dragOverlay:{measure:ne}};class st extends Map{get(e){var t;return null!=e&&null!=(t=super.get(e))?t:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){var t,n;return null!=(t=null==(n=this.get(e))?void 0:n.node.current)?t:void 0}}const ct={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new st,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:it,measureDroppableContainers:_,windowRect:null,measuringScheduled:!1},dt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_,draggableNodes:new Map,over:null,measureDroppableContainers:_},ut=n.createContext(dt),pt=n.createContext(ct);function ft(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new st}}}function ht(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.DragMove:return null==e.draggable.active?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{const{element:n}=t,{id:r}=n,a=new st(e.droppable.containers);return a.set(r,n),{...e,droppable:{...e.droppable,containers:a}}}case q.SetDroppableDisabled:{const{id:n,key:r,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const l=new st(e.droppable.containers);return l.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case q.UnregisterDroppable:{const{id:n,key:r}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;const o=new st(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function mt(e){let{disabled:t}=e;const{active:r,activatorEvent:a,draggableNodes:o}=n.useContext(ut),l=R(a),i=R(null==r?void 0:r.id);return n.useEffect(()=>{if(!t&&!a&&l&&null!=i){if(!j(l))return;if(document.activeElement===l.target)return;const e=o.get(i);if(!e)return;const{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(const e of[t.current,n.current]){if(!e)continue;const t=T(e);if(t){t.focus();break}}})}},[a,t,o,i,l]),null}const gt=n.createContext({...U,scaleX:1,scaleY:1});var vt,bt;(bt=vt||(vt={}))[bt.Uninitialized=0]="Uninitialized",bt[bt.Initializing=1]="Initializing",bt[bt.Initialized=2]="Initialized";const yt=n.memo(function(e){var t,r,o,l;let{id:i,accessibility:s,autoScroll:c=!0,children:d,sensors:p=ot,collisionDetection:f=G,measuring:m,modifiers:g,...v}=e;const b=n.useReducer(ht,void 0,ft),[x,S]=b,[R,E]=function(){const[e]=n.useState(()=>new Set),t=n.useCallback(t=>(e.add(t),()=>e.delete(t)),[e]);return[n.useCallback(t=>{let{type:n,event:r}=t;e.forEach(e=>{var t;return null==(t=e[n])?void 0:t.call(e,r)})},[e]),t]}(),[N,D]=n.useState(vt.Uninitialized),j=N===vt.Initialized,{draggable:{active:A,nodes:T,translate:P},droppable:{containers:L}}=x,F=null!=A?T.get(A):null,B=n.useRef({initial:null,translated:null}),O=n.useMemo(()=>{var e;return null!=A?{id:A,data:null!=(e=null==F?void 0:F.data)?e:lt,rect:B}:null},[A,F]),H=n.useRef(null),[_,W]=n.useState(null),[K,V]=n.useState(null),X=w(v,Object.values(v)),Y=k("DndDescribedBy",i),J=n.useMemo(()=>L.getEnabled(),[L]),Z=(te=m,n.useMemo(()=>({draggable:{...it.draggable,...null==te?void 0:te.draggable},droppable:{...it.droppable,...null==te?void 0:te.droppable},dragOverlay:{...it.dragOverlay,...null==te?void 0:te.dragOverlay}}),[null==te?void 0:te.draggable,null==te?void 0:te.droppable,null==te?void 0:te.dragOverlay]));var te;const{droppableRects:re,measureDroppableContainers:ie,measuringScheduled:se}=function(e,t){let{dragging:r,dependencies:a,config:o}=t;const[l,i]=n.useState(null),{frequency:s,measure:c,strategy:d}=o,u=n.useRef(e),p=function(){switch(d){case Ke.Always:return!1;case Ke.BeforeDragging:return r;default:return!r}}(),f=w(p),h=n.useCallback(function(e){void 0===e&&(e=[]),f.current||i(t=>null===t?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=n.useRef(null),g=C(t=>{if(p&&!r)return Ye;if(!t||t===Ye||u.current!==e||null!=l){const t=new Map;for(let n of e){if(!n)continue;if(l&&l.length>0&&!l.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}const e=n.node.current,r=e?new ye(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,l,r,p,c]);return n.useEffect(()=>{u.current=e},[e]),n.useEffect(()=>{p||h()},[r,p]),n.useEffect(()=>{l&&l.length>0&&i(null)},[JSON.stringify(l)]),n.useEffect(()=>{p||"number"!=typeof s||null!==m.current||(m.current=setTimeout(()=>{h(),m.current=null},s))},[s,p,h,...a]),{droppableRects:g,measureDroppableContainers:h,measuringScheduled:null!=l}}(J,{dragging:j,dependencies:[P.x,P.y],config:Z.droppable}),de=function(e,t){const n=null!=t?e.get(t):void 0,r=n?n.node.current:null;return C(e=>{var n;return null==t?null:null!=(n=null!=r?r:e)?n:null},[r,t])}(T,A),ue=n.useMemo(()=>K?M(K):null,[K]),fe=function(){const e=!1===(null==_?void 0:_.autoScrollEnabled),t="object"==typeof c?!1===c.enabled:!1===c,n=j&&!e&&!t;if("object"==typeof c)return{...c,enabled:n};return{enabled:n}}(),he=function(e,t){return Je(e,t)}(de,Z.draggable.measure);!function(e){let{activeNode:t,measure:r,initialRect:a,config:o=!0}=e;const l=n.useRef(!1),{x:i,y:s}="boolean"==typeof o?{x:o,y:o}:o;y(()=>{if(!i&&!s||!t)return void(l.current=!1);if(l.current||!a)return;const e=null==t?void 0:t.node.current;if(!e||!1===e.isConnected)return;const n=Q(r(e),a);if(i||(n.x=0),s||(n.y=0),l.current=!0,Math.abs(n.x)>0||Math.abs(n.y)>0){const t=oe(e);t&&t.scrollBy({top:n.y,left:n.x})}},[t,i,s,a,r])}({activeNode:null!=A?T.get(A):null,config:fe.layoutShiftCompensation,initialRect:he,measure:Z.draggable.measure});const me=Ze(de,Z.draggable.measure,he),ge=Ze(de?de.parentElement:null),be=n.useRef({activatorEvent:null,active:null,activeNode:de,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:L,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),xe=L.getNodeFor(null==(t=be.current.over)?void 0:t.id),we=at({measure:Z.dragOverlay.measure}),Ce=null!=(r=we.nodeRef.current)?r:de,Se=j?null!=(o=we.rect)?o:me:null,Re=Boolean(we.nodeRef.current&&we.rect),Ee=Q(ke=Re?null:me,Je(ke));var ke;const Ne=nt(Ce?h(Ce):null),ze=function(e){const t=n.useRef(e),r=C(n=>e?n&&n!==et&&e&&t.current&&e.parentNode===t.current.parentNode?n:ae(e):et,[e]);return n.useEffect(()=>{t.current=e},[e]),r}(j?null!=xe?xe:de:null),De=function(e,t){void 0===t&&(t=ne);const[r]=e,a=nt(r?h(r):null),[o,l]=n.useState(rt);function i(){l(()=>e.length?e.map(e=>pe(e)?a:new ye(t(e),e)):rt)}const s=Ge({callback:i});return y(()=>{null==s||s.disconnect(),i(),e.forEach(e=>null==s?void 0:s.observe(e))},[e]),o}(ze),je=function(e,t){let{transform:n,...r}=t;return null!=e&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}(g,{transform:{x:P.x-Ee.x,y:P.y-Ee.y,scaleX:1,scaleY:1},activatorEvent:K,active:O,activeNodeRect:me,containerNodeRect:ge,draggingNodeRect:Se,over:be.current.over,overlayNodeRect:we.rect,scrollableAncestors:ze,scrollableAncestorRects:De,windowRect:Ne}),Me=ue?z(ue,P):null,Ae=function(e){const[t,r]=n.useState(null),a=n.useRef(e),o=n.useCallback(e=>{const t=le(e.target);t&&r(e=>e?(e.set(t,ce(t)),new Map(e)):null)},[]);return n.useEffect(()=>{const t=a.current;if(e!==t){n(t);const l=e.map(e=>{const t=le(e);return t?(t.addEventListener("scroll",o,{passive:!0}),[t,ce(t)]):null}).filter(e=>null!=e);r(l.length?new Map(l):null),a.current=e}return()=>{n(e),n(t)};function n(e){e.forEach(e=>{const t=le(e);null==t||t.removeEventListener("scroll",o)})}},[o,e]),n.useMemo(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>z(e,t),U):ve(e):U,[e,t])}(ze),Te=tt(Ae),Pe=tt(Ae,[me]),Le=z(je,Te),Fe=Se?ee(Se,je):null,$e=O&&Fe?f({active:O,collisionRect:Fe,droppableRects:re,droppableContainers:J,pointerCoordinates:Me}):null,Be=function(e,t){if(!e||0===e.length)return null;const[n]=e;return n[t]}($e,"id"),[Oe,Ie]=n.useState(null),qe=function(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}(Re?je:z(je,Pe),null!=(l=null==Oe?void 0:Oe.rect)?l:null,me),He=n.useRef(null),_e=n.useCallback((e,t)=>{let{sensor:n,options:r}=t;if(null==H.current)return;const o=T.get(H.current);if(!o)return;const l=e.nativeEvent,i=new n({active:H.current,activeNode:o,event:l,options:r,context:be,onAbort(e){if(!T.get(e))return;const{onDragAbort:t}=X.current,n={id:e};null==t||t(n),R({type:"onDragAbort",event:n})},onPending(e,t,n,r){if(!T.get(e))return;const{onDragPending:a}=X.current,o={id:e,constraint:t,initialCoordinates:n,offset:r};null==a||a(o),R({type:"onDragPending",event:o})},onStart(e){const t=H.current;if(null==t)return;const n=T.get(t);if(!n)return;const{onDragStart:r}=X.current,o={activatorEvent:l,active:{id:t,data:n.data,rect:B}};a.unstable_batchedUpdates(()=>{null==r||r(o),D(vt.Initializing),S({type:q.DragStart,initialCoordinates:e,active:t}),R({type:"onDragStart",event:o}),W(He.current),V(l)})},onMove(e){S({type:q.DragMove,coordinates:e})},onEnd:s(q.DragEnd),onCancel:s(q.DragCancel)});function s(e){return async function(){const{active:t,collisions:n,over:r,scrollAdjustedTranslate:o}=be.current;let i=null;if(t&&o){const{cancelDrop:a}=X.current;if(i={activatorEvent:l,active:t,collisions:n,delta:o,over:r},e===q.DragEnd&&"function"==typeof a){await Promise.resolve(a(i))&&(e=q.DragCancel)}}H.current=null,a.unstable_batchedUpdates(()=>{S({type:e}),D(vt.Uninitialized),Ie(null),W(null),V(null),He.current=null;const t=e===q.DragEnd?"onDragEnd":"onDragCancel";if(i){const e=X.current[t];null==e||e(i),R({type:t,event:i})}})}}He.current=i},[T]),We=function(e,t){return n.useMemo(()=>e.reduce((e,n)=>{const{sensor:r}=n;return[...e,...r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}))]},[]),[e,t])}(p,n.useCallback((e,t)=>(n,r)=>{const a=n.nativeEvent,o=T.get(r);if(null!==H.current||!o||a.dndKit||a.defaultPrevented)return;const l={active:o};!0===e(n,t.options,l)&&(a.dndKit={capturedBy:t.sensor},H.current=r,_e(n,t))},[T,_e]));!function(e){n.useEffect(()=>{if(!u)return;const t=e.map(e=>{let{sensor:t}=e;return null==t.setup?void 0:t.setup()});return()=>{for(const e of t)null==e||e()}},e.map(e=>{let{sensor:t}=e;return t}))}(p),y(()=>{me&&N===vt.Initializing&&D(vt.Initialized)},[me,N]),n.useEffect(()=>{const{onDragMove:e}=X.current,{active:t,activatorEvent:n,collisions:r,over:o}=be.current;if(!t||!n)return;const l={active:t,activatorEvent:n,collisions:r,delta:{x:Le.x,y:Le.y},over:o};a.unstable_batchedUpdates(()=>{null==e||e(l),R({type:"onDragMove",event:l})})},[Le.x,Le.y]),n.useEffect(()=>{const{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:o}=be.current;if(!e||null==H.current||!t||!o)return;const{onDragOver:l}=X.current,i=r.get(Be),s=i&&i.rect.current?{id:i.id,rect:i.rect.current,data:i.data,disabled:i.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:o.x,y:o.y},over:s};a.unstable_batchedUpdates(()=>{Ie(s),null==l||l(c),R({type:"onDragOver",event:c})})},[Be]),y(()=>{be.current={activatorEvent:K,active:O,activeNode:de,collisionRect:Fe,collisions:$e,droppableRects:re,draggableNodes:T,draggingNode:Ce,draggingNodeRect:Se,droppableContainers:L,over:Oe,scrollableAncestors:ze,scrollAdjustedTranslate:Le},B.current={initial:Se,translated:Fe}},[O,de,$e,Fe,T,Ce,Se,re,L,Oe,ze,Le]),Ue({...fe,delta:P,draggingRect:Fe,pointerCoordinates:Me,scrollableAncestors:ze,scrollableAncestorRects:De});const Ve=n.useMemo(()=>({active:O,activeNode:de,activeNodeRect:me,activatorEvent:K,collisions:$e,containerNodeRect:ge,dragOverlay:we,draggableNodes:T,droppableContainers:L,droppableRects:re,over:Oe,measureDroppableContainers:ie,scrollableAncestors:ze,scrollableAncestorRects:De,measuringConfiguration:Z,measuringScheduled:se,windowRect:Ne}),[O,de,me,K,$e,ge,we,T,L,re,Oe,ie,ze,De,Z,se,Ne]),Xe=n.useMemo(()=>({activatorEvent:K,activators:We,active:O,activeNodeRect:me,ariaDescribedById:{draggable:Y},dispatch:S,draggableNodes:T,over:Oe,measureDroppableContainers:ie}),[K,We,O,me,S,Y,T,Oe,ie]);return n.createElement($.Provider,{value:E},n.createElement(ut.Provider,{value:Xe},n.createElement(pt.Provider,{value:Ve},n.createElement(gt.Provider,{value:qe},d)),n.createElement(mt,{disabled:!1===(null==s?void 0:s.restoreFocus)})),n.createElement(I,{...s,hiddenTextDescribedById:Y}))}),xt=n.createContext(null),wt="button";function Ct(e){let{id:t,data:r,disabled:a=!1,attributes:o}=e;const l=k("Draggable"),{activators:i,activatorEvent:s,active:c,activeNodeRect:d,ariaDescribedById:u,draggableNodes:p,over:f}=n.useContext(ut),{role:h=wt,roleDescription:m="draggable",tabIndex:g=0}=null!=o?o:{},v=(null==c?void 0:c.id)===t,b=n.useContext(v?gt:xt),[x,C]=S(),[R,E]=S(),N=function(e,t){return n.useMemo(()=>e.reduce((e,n)=>{let{eventName:r,handler:a}=n;return e[r]=e=>{a(e,t)},e},{}),[e,t])}(i,t),z=w(r);y(()=>(p.set(t,{id:t,key:l,node:x,activatorNode:R,data:z}),()=>{const e=p.get(t);e&&e.key===l&&p.delete(t)}),[p,t]);return{active:c,activatorEvent:s,activeNodeRect:d,attributes:n.useMemo(()=>({role:h,tabIndex:g,"aria-disabled":a,"aria-pressed":!(!v||h!==wt)||void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[a,h,g,v,m,u.draggable]),isDragging:v,listeners:a?void 0:N,node:x,over:f,setNodeRef:C,setActivatorNodeRef:E,transform:b}}const St={timeout:25};const Rt=({slotPosition:e,isEditing:r,isDragging:a,children:o})=>{const{attributes:l,listeners:i,setNodeRef:s,transform:c}=Ct({id:`slot-${e}`,data:{slotPosition:e},disabled:!r}),{setNodeRef:d,isOver:u}=function(e){let{data:t,disabled:r=!1,id:a,resizeObserverConfig:o}=e;const l=k("Droppable"),{active:i,dispatch:s,over:c,measureDroppableContainers:d}=n.useContext(ut),u=n.useRef({disabled:r}),p=n.useRef(!1),f=n.useRef(null),h=n.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:v}={...St,...o},b=w(null!=g?g:a),y=Ge({callback:n.useCallback(()=>{p.current?(null!=h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{d(Array.isArray(b.current)?b.current:[b.current]),h.current=null},v)):p.current=!0},[v]),disabled:m||!i}),x=n.useCallback((e,t)=>{y&&(t&&(y.unobserve(t),p.current=!1),e&&y.observe(e))},[y]),[C,R]=S(x),E=w(t);return n.useEffect(()=>{y&&C.current&&(y.disconnect(),p.current=!1,y.observe(C.current))},[C,y]),n.useEffect(()=>(s({type:q.RegisterDroppable,element:{id:a,key:l,disabled:r,node:C,rect:f,data:E}}),()=>s({type:q.UnregisterDroppable,key:l,id:a})),[a]),n.useEffect(()=>{r!==u.current.disabled&&(s({type:q.SetDroppableDisabled,id:a,key:l,disabled:r}),u.current.disabled=r)},[a,l,r,s]),{active:i,rect:f,isOver:(null==c?void 0:c.id)===a,node:C,over:c,setNodeRef:R}}({id:`drop-${e}`,data:{slotPosition:e}}),p={position:"relative",height:"100%",width:"100%",transform:c?`translate3d(${c.x}px, ${c.y}px, 0)`:void 0},f=n.useCallback(e=>{s(e),d(e)},[s,d]);return t.jsxs("div",{ref:f,style:p,className:`slot-with-overlay ${r?"edit-mode":""} ${a?"dragging":""} ${u?"drag-over":""}`,children:[o,r&&t.jsxs("div",{className:"slot-edit-overlay",...l,...i,children:[t.jsx("div",{className:"drag-indicator",children:"⋮⋮"}),t.jsx("div",{className:"slot-position-label",children:e.toUpperCase()})]})]})},Et=({layout:e,activeSlot:r})=>{const[a,o]=n.useState(new Map);return n.useEffect(()=>{const e=()=>{const e=new Map;["left","middle","right"].forEach(t=>{const n=document.querySelector(`[data-slot="${t}"]`);if(n){const r=n.getBoundingClientRect();e.set(t,r)}}),o(e)};e(),window.addEventListener("resize",e);const t=setInterval(e,100);return()=>{window.removeEventListener("resize",e),clearInterval(t)}},[e]),t.jsx("div",{style:{pointerEvents:"none",position:"absolute",top:0,left:0,right:0,bottom:0,zIndex:999},children:["left","middle","right"].map(n=>{if(!e[n])return null;const o=a.get(n);if(!o)return null;const l=r===n;return t.jsx("div",{style:{position:"fixed",top:o.top,left:o.left,width:o.width,height:o.height,pointerEvents:"auto"},children:t.jsx(Rt,{slotPosition:n,isEditing:!0,isDragging:l,children:t.jsx("div",{style:{height:"100%"}})})},n)})})};var kt,Nt=(()=>{if("undefined"!=typeof window){const e=window;return e.__principlemd_theme_context__||(e.__principlemd_theme_context__=n.createContext(void 0)),e.__principlemd_theme_context__}return kt||(kt=n.createContext(void 0)),kt})();const zt=e=>null!=e&&"object"==typeof e&&"type"in e,Dt=e=>null==e?[]:"string"==typeof e?[e]:zt(e)?e.panels:[];e.AnimatedResizableLayout=({leftPanel:e,rightPanel:a,collapsibleSide:l="left",defaultSize:i=25,minSize:s=5,className:c="",collapsed:d=!1,style:u,showCollapseButton:p=!1,animationDuration:f=300,animationEasing:h="cubic-bezier(0.4, 0, 0.2, 1)",onCollapseStart:m,onCollapseComplete:g,onExpandStart:v,onExpandComplete:b,theme:y})=>{const[x,w]=n.useState(d),[C,S]=n.useState(!1),[R,E]=n.useState(!1),[k,N]=n.useState(d),[z,D]=n.useState(d?0:i),j=n.useRef(null),M=n.useRef(void 0),A=n.useRef(void 0),T=n.useRef(void 0),P=n.useCallback((e,t,n)=>{if(!j.current)return;M.current&&cancelAnimationFrame(M.current),A.current=performance.now();const r=a=>{if(!A.current||!j.current)return;const o=a-A.current,l=Math.min(o/f,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;j.current.resize(s),l<1?M.current=requestAnimationFrame(r):(0===t?j.current.collapse():j.current.resize(t),S(!1),n&&n())};M.current=requestAnimationFrame(r)},[f]),L=n.useCallback(()=>{C||R||(S(!0),w(!0),m&&m(),P(z,0,()=>{D(0),N(!0),g&&g()}))},[C,R,z,P,m,g]),F=n.useCallback(()=>{C||R||(S(!0),w(!1),N(!1),v&&v(),P(0,i,()=>{D(i),b&&b()}))},[C,R,i,P,v,b]),$=n.useCallback(()=>{x?F():L()},[x,L,F]),B=n.useCallback(e=>{C||(D(e),e>0&&w(!1))},[C]),O=n.useCallback(()=>{E(!0)},[]),I=n.useCallback(()=>{E(!1)},[]);n.useEffect(()=>{d!==x&&(d?L():F())},[d]),n.useEffect(()=>{d&&!C?N(!0):d||C||N(!1)},[d,C]),n.useEffect(()=>{const e=M.current,t=T.current;return()=>{e&&cancelAnimationFrame(e),t&&clearTimeout(t)}},[]);const q="left"===l,H=x?q?"▸":"◂":q?"◂":"▸",_=o(y),U=C&&!R?{transition:`flex ${f}ms ${h}`}:void 0,W=e=>{let t="hybrid-panel";return e&&(t+=" collapsible-panel",C&&!R&&(t+=" animating"),x&&(t+=" collapsed")),t};return t.jsx("div",{className:`animated-resizable-layout ${c}`,style:{..._,...u},children:t.jsxs(r.PanelGroup,{direction:"horizontal",onLayout:I,children:[t.jsx(r.Panel,{ref:q?j:void 0,collapsible:q,defaultSize:q?d?0:i:void 0,minSize:q?s:30,collapsedSize:0,onResize:q?B:void 0,onCollapse:q?()=>w(!0):void 0,onExpand:q?()=>w(!1):void 0,className:W(q),style:q?U:void 0,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:q&&x?0:1,transition:C?`opacity ${.5*f}ms ${h}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle "+(k?"collapsed":""),onDragging:O,style:k?{visibility:"hidden",width:0}:void 0,children:p&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:$,className:"collapse-toggle",disabled:C,"aria-label":x?"Expand panel":"Collapse panel",children:H})})}),t.jsx(r.Panel,{ref:q?void 0:j,collapsible:!q,defaultSize:q?void 0:d?0:i,minSize:q?30:s,collapsedSize:0,onResize:q?void 0:B,onCollapse:q?void 0:()=>w(!0),onExpand:q?void 0:()=>w(!1),className:W(!q),style:q?void 0:U,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:!q&&x?0:1,transition:C?`opacity ${.5*f}ms ${h}`:"none"},children:a})})]})})},e.AnimatedVerticalLayout=({topPanel:e,bottomPanel:a,collapsiblePanels:l={top:!0,bottom:!0},defaultSizes:i={top:30,bottom:30},minSizes:s={top:5,bottom:5},className:c="",collapsed:d={top:!1,bottom:!1},style:u,showCollapseButtons:p=!1,animationDuration:f=300,animationEasing:h="cubic-bezier(0.4, 0, 0.2, 1)",theme:m,onTopCollapseStart:g,onTopCollapseComplete:v,onTopExpandStart:b,onTopExpandComplete:y,onBottomCollapseStart:x,onBottomCollapseComplete:w,onBottomExpandStart:C,onBottomExpandComplete:S,onPanelResize:R})=>{const[E,k]=n.useState(d.top||!1),[N,z]=n.useState(!1),[D,j]=n.useState(d.top?0:i.top),M=n.useRef(null),A=n.useRef(void 0),T=n.useRef(void 0),[P,L]=n.useState(d.bottom||!1),[F,$]=n.useState(!1),[B,O]=n.useState(d.bottom?0:i.bottom),I=n.useRef(null),q=n.useRef(void 0),H=n.useRef(void 0),[_,U]=n.useState(!1),W=n.useCallback((e,t,n)=>{if(!M.current)return;A.current&&cancelAnimationFrame(A.current),T.current=performance.now();const r=a=>{if(!T.current||!M.current)return;const o=a-T.current,l=Math.min(o/f,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;M.current.resize(s),l<1?A.current=requestAnimationFrame(r):(0===t?M.current.collapse():M.current.resize(t),z(!1),n&&n())};A.current=requestAnimationFrame(r)},[f]),K=n.useCallback((e,t,n)=>{if(!I.current)return;q.current&&cancelAnimationFrame(q.current),H.current=performance.now();const r=a=>{if(!H.current||!I.current)return;const o=a-H.current,l=Math.min(o/f,1),i=l<.5?4*l*l*l:1-Math.pow(-2*l+2,3)/2,s=e+(t-e)*i;I.current.resize(s),l<1?q.current=requestAnimationFrame(r):(0===t?I.current.collapse():I.current.resize(t),$(!1),n&&n())};q.current=requestAnimationFrame(r)},[f]),V=n.useCallback(()=>{N||_||!l.top||(z(!0),k(!0),g&&g(),W(D,0,()=>{j(0),v&&v()}))},[N,_,D,l.top,W,g,v]),X=n.useCallback(()=>{N||_||!l.top||(z(!0),k(!1),b&&b(),W(0,i.top,()=>{j(i.top),y&&y()}))},[N,_,i.top,l.top,W,b,y]),Y=n.useCallback(()=>{E?X():V()},[E,V,X]),J=n.useCallback(()=>{F||_||!l.bottom||($(!0),L(!0),x&&x(),K(B,0,()=>{O(0),w&&w()}))},[F,_,B,l.bottom,K,x,w]),G=n.useCallback(()=>{F||_||!l.bottom||($(!0),L(!1),C&&C(),K(0,i.bottom,()=>{O(i.bottom),S&&S()}))},[F,_,i.bottom,l.bottom,K,C,S]),Q=n.useCallback(()=>{P?G():J()},[P,J,G]),Z=n.useCallback(e=>{N||(j(e),e>0&&k(!1))},[N]),ee=n.useCallback(e=>{F||(O(e),e>0&&L(!1))},[F]),te=n.useCallback(()=>{U(!0)},[]),ne=n.useCallback(()=>{U(!1),R&&R({top:D,bottom:B})},[D,B,R]);n.useEffect(()=>{void 0!==d.top&&d.top!==E&&(d.top?V():X())},[d.top]),n.useEffect(()=>{void 0!==d.bottom&&d.bottom!==P&&(d.bottom?J():G())},[d.bottom]),n.useEffect(()=>()=>{A.current&&cancelAnimationFrame(A.current),q.current&&cancelAnimationFrame(q.current)},[]);const re=o(m),ae=N&&!_?{transition:`flex ${f}ms ${h}`}:void 0,oe=F&&!_?{transition:`flex ${f}ms ${h}`}:void 0;return t.jsx("div",{className:`animated-vertical-layout ${c}`,style:{...re,...u},children:t.jsxs(r.PanelGroup,{direction:"vertical",onLayout:ne,children:[t.jsx(r.Panel,{ref:M,collapsible:l.top,defaultSize:d.top?0:i.top,minSize:s.top,collapsedSize:0,onResize:Z,onCollapse:()=>k(!0),onExpand:()=>k(!1),className:(()=>{let e="vertical-panel collapsible-panel";return N&&!_&&(e+=" animating"),E&&(e+=" collapsed"),e})(),style:ae,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:E?0:1,transition:N?`opacity ${.5*f}ms ${h}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"vertical-resize-handle",onDragging:te,children:p&&t.jsxs("div",{className:"handle-bar",children:[l.top&&t.jsx("button",{onClick:Y,className:"collapse-toggle collapse-toggle-top",disabled:N,"aria-label":E?"Expand top panel":"Collapse top panel",children:E?"▾":"▴"}),l.bottom&&t.jsx("button",{onClick:Q,className:"collapse-toggle collapse-toggle-bottom",disabled:F,"aria-label":P?"Expand bottom panel":"Collapse bottom panel",children:P?"▴":"▾"})]})}),t.jsx(r.Panel,{ref:I,collapsible:l.bottom,defaultSize:d.bottom?0:i.bottom,minSize:s.bottom,collapsedSize:0,onResize:ee,onCollapse:()=>L(!0),onExpand:()=>L(!1),className:(()=>{let e="vertical-panel collapsible-panel";return F&&!_&&(e+=" animating"),P&&(e+=" collapsed"),e})(),style:oe,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:P?0:1,transition:F?`opacity ${.5*f}ms ${h}`:"none"},children:a})})]})})},e.ConfigurablePanelLayout=s,e.EditableConfigurablePanelLayout=({isEditMode:e,onLayoutChange:r,panels:a,layout:o,...l})=>{const[i,c]=n.useState(null),[d,u]=n.useState({x:0,y:0}),p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return n.useMemo(()=>[...t].filter(e=>null!=e),[...t])}((f=Le,h={activationConstraint:{distance:8}},n.useMemo(()=>({sensor:f,options:null!=h?h:{}}),[f,h])));var f,h;const m=n.useCallback(e=>{const t=e.active.id;if(t.startsWith("slot-")){const e=t.replace("slot-","");c(e),u({x:0,y:0})}},[]),g=n.useCallback(e=>{const{delta:t}=e;u({x:t.x,y:t.y})},[]),v=n.useCallback(e=>{const{active:t,over:n}=e;if(c(null),u({x:0,y:0}),!n)return;const a=t.id,l=n.id,i=a.replace("slot-",""),s=l.replace("drop-","");if(i===s)return;const d={...o},p=d[i];d[i]=d[s],d[s]=p,r&&r(d)},[o,r]);n.useEffect(()=>{if(!i||!e)return;const t=document.querySelector(`[data-slot="${i}"]`);return t&&(t.setAttribute("data-dragging","true"),t.style.setProperty("transform",`scale(0.95) translate(${d.x}px, ${d.y}px)`,"important"),t.style.setProperty("z-index","1000","important"),t.style.setProperty("transition","none","important"),t.style.setProperty("opacity","0.95","important"),t.style.setProperty("box-shadow","0 12px 24px rgba(0, 0, 0, 0.25)","important")),()=>{t&&(t.removeAttribute("data-dragging"),t.style.removeProperty("transform"),t.style.removeProperty("z-index"),t.style.removeProperty("transition"),t.style.removeProperty("opacity"),t.style.removeProperty("box-shadow"))}},[i,d,e]);const b={left:{"data-slot":"left","data-edit-mode":e?"true":"false"},middle:{"data-slot":"middle","data-edit-mode":e?"true":"false"},right:{"data-slot":"right","data-edit-mode":e?"true":"false"}};return t.jsx(yt,{sensors:p,collisionDetection:Y,onDragStart:m,onDragMove:g,onDragEnd:v,children:t.jsxs("div",{className:"editable-panel-layout "+(e?"edit-mode-active":""),children:[t.jsx(s,{...l,panels:a,layout:o,slotDataAttributes:b}),e&&t.jsx(Et,{layout:o,activeSlot:i,onDragStart:()=>{},onDragEnd:()=>{}})]})})},e.PanelConfigurator=({availablePanels:e,currentLayout:r,onChange:a,className:o="",theme:l})=>{const i=(()=>{const e=n.useContext(Nt);if(!e)throw new Error("useTheme must be used within a ThemeProvider");return e})(),s=l||i.theme,[c,d]=n.useState(null),u=n.useCallback(t=>t&&e.find(e=>e.id===t)||null,[e]),p=n.useCallback(()=>[...e].sort((e,t)=>e.label.localeCompare(t.label)),[e]),f=n.useCallback(e=>{const t=Dt(r.left),n=Dt(r.middle),a=Dt(r.right);return t.includes(e)||n.includes(e)||a.includes(e)},[r]),h=n.useCallback((e,t)=>{const n={...e};return["left","middle","right"].forEach(e=>{const r=n[e];if(r===t)n[e]=null;else if(null!=r&&zt(r)){const a=r.panels.filter(e=>e!==t);0===a.length?n[e]=null:1===a.length?n[e]=a[0]:n[e]={...r,panels:a}}}),n},[]),m=n.useCallback((e,t)=>{const n=r[e];if(!zt(n)||"tabs"!==n.type)return;const o=n.panels.filter(e=>e!==t),l={...r};l[e]={...n,panels:o},a(l)},[r,a]),g=n.useCallback((e,t)=>{t.stopPropagation();const n=r[e];if(zt(n)&&"tabs"===n.type){const t={...r};t[e]=n.panels.length>0?n.panels[0]:null,a(t),d(null)}else{const t=n&&"string"==typeof n?[n]:[],o={...r};o[e]={type:"tabs",panels:t,config:{defaultActiveTab:0,tabPosition:"top"}},a(o),d({type:"slot",position:e})}},[r,a]),v=n.useCallback(e=>{if(c)if("slot"===c.type){if(c.position===e)return;const t={...r},n=t[c.position];t[c.position]=t[e],t[e]=n,a(t),d(null)}else{const t=r[e];if(zt(t)&&"tabs"===t.type){if(t.panels.includes(c.id))return void m(e,c.id);const n=t,o=h(r,c.id);return o[e]={...n,panels:[...n.panels,c.id]},void a(o)}{const t=h(r,c.id);t[e]=c.id,a(t),d(null)}}else d({type:"slot",position:e})},[c,r,a,h,m]),b=n.useCallback(e=>{if(c)if("slot"===c.type){const t=r[c.position];if(zt(t)&&"tabs"===t.type){if(t.panels.includes(e))return void m(c.position,e);const n=t,o=h(r,e);return o[c.position]={...n,panels:[...n.panels,e]},void a(o)}{const t=h(r,e);t[c.position]=e,a(t),d(null)}}else d({type:"panel",id:e});else d({type:"panel",id:e})},[c,r,a,h,m]),y=n.useCallback((e,t)=>{t.stopPropagation();const n={...r};n[e]=null,a(n),d(null)},[r,a]),x=n.useCallback((e,t,n)=>{n.stopPropagation();const o=r[e];if(!zt(o)||"tabs"!==o.type)return;const l=o.panels.filter(e=>e!==t),i={...r};i[e]={...o,panels:l},a(i)},[r,a]),w=n.useCallback((e,t)=>{const n=r[e];if(!zt(n)||"tabs"!==n.type)return;const o={...r};o[e]={...n,config:{...n.config,...t}},a(o)},[r,a]),C=p(),S=e=>{const t=r[e];return zt(t)&&"tabs"===t.type},R={"--configurator-bg":s.colors.background,"--configurator-title":s.colors.textSecondary,"--slot-bg":s.colors.backgroundSecondary,"--slot-border":s.colors.border,"--slot-border-hover":s.colors.textTertiary,"--slot-border-selected":s.colors.primary,"--slot-bg-selected":s.colors.backgroundLight,"--slot-label":s.colors.textTertiary,"--slot-content-text":s.colors.text,"--slot-preview-bg":s.colors.backgroundTertiary,"--slot-preview-border":s.colors.border,"--slot-preview-text":s.colors.textMuted,"--slot-empty-text":s.colors.textMuted,"--panel-bg":s.colors.backgroundSecondary,"--panel-border":s.colors.border,"--panel-border-hover":s.colors.textSecondary,"--panel-border-selected":s.colors.primary,"--panel-bg-selected":s.colors.backgroundLight,"--panel-label-text":s.colors.text,"--panel-preview-bg":s.colors.backgroundTertiary,"--panel-preview-text":s.colors.textMuted,"--clear-btn-bg":s.colors.error,"--clear-btn-text":s.colors.background,"--clear-btn-hover":s.colors.error,"--hint-bg":s.colors.backgroundLight,"--hint-border":s.colors.primary,"--hint-text":s.colors.text};return t.jsxs("div",{className:`panel-configurator ${o}`,style:R,children:[t.jsxs("div",{className:"configurator-section",children:[t.jsx("h3",{className:"section-title",children:"Panel Layout (3 Slots)"}),t.jsx("div",{className:"slots-container",children:["left","middle","right"].map(e=>{const n=r[e],a=(e=>"slot"===c?.type&&c.position===e)(e),o=zt(n)&&"tabs"===n.type,l=null!==n;return t.jsxs("div",{"data-position":e,className:`slot ${a?"selected":""} ${l?"filled":"empty"} ${o?"tab-group":""}`,onClick:()=>v(e),children:[t.jsx("button",{className:"tab-mode-toggle "+(o?"active":""),onClick:t=>g(e,t),title:o?"Disable tab mode":"Enable tab mode",children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",children:t.jsx("path",{d:"M2 2h4v2H2V2zm5 0h4v2H7V2zm5 0h2v2h-2V2zM2 5h12v9H2V5zm1 1v7h10V6H3z"})})}),null===n?t.jsx("div",{className:"slot-empty-state",children:o?"Click panels to add tabs":"Empty"}):zt(n)?t.jsxs("div",{className:"slot-content group-content",children:["tabs"===n.type&&n.panels.length>0&&t.jsx("div",{className:"tab-config-controls",children:t.jsxs("label",{className:"tab-config-label",children:["Tabs:",t.jsxs("select",{value:n.config?.tabPosition||"top",onChange:t=>w(e,{tabPosition:t.target.value}),onClick:e=>e.stopPropagation(),children:[t.jsx("option",{value:"top",children:"Top (centered)"}),t.jsx("option",{value:"bottom",children:"Bottom (centered)"}),t.jsx("option",{value:"left",children:"Left"}),t.jsx("option",{value:"right",children:"Right"})]})]})}),t.jsx("div",{className:"group-panels",children:0===n.panels.length?t.jsx("div",{className:"slot-empty-state",children:"Click panels to add tabs"}):n.panels.map((r,a)=>{const o=u(r),l="tabs"===n.type&&(n.config?.defaultActiveTab??0)===a;return o?t.jsxs("div",{className:"group-panel-item",children:[t.jsxs("span",{className:"group-panel-label",children:[o.label,l&&t.jsx("span",{className:"default-badge",children:"★"})]}),t.jsx("button",{className:"remove-from-group-btn",onClick:t=>x(e,r,t),title:`Remove ${o.label}`,children:"×"})]},r):null})})]}):t.jsxs("div",{className:"slot-content",children:["string"==typeof n&&u(n)?.preview&&t.jsx("div",{className:"slot-preview",children:u(n)?.preview}),t.jsx("div",{className:"slot-panel-label",children:"string"==typeof n?u(n)?.label:""}),t.jsx("button",{className:"slot-clear-btn",onClick:t=>y(e,t),"aria-label":`Remove ${"string"==typeof n?u(n)?.label:"panel"} from ${e} slot`,children:"×"})]})]},e)})})]}),t.jsxs("div",{className:"configurator-section",children:[t.jsx("h3",{className:"section-title",children:"Available Panels"}),t.jsx("div",{className:"available-panels",children:C.map(e=>{const n=(r=e.id,"panel"===c?.type&&c.id===r);var r;const a=f(e.id);return t.jsxs("div",{className:`available-panel ${n?"selected":""} ${a?"in-use":""}`,onClick:()=>b(e.id),children:[t.jsx("div",{className:"panel-label",children:e.label}),e.preview&&t.jsx("div",{className:"panel-preview",children:e.preview})]},e.id)})})]}),c&&t.jsx("div",{className:"selection-hint",children:"slot"===c.type?S(c.position)?t.jsxs(t.Fragment,{children:["Selected: ",c.position," slot (Tab Mode). Click panels to add them to the tab group."]}):t.jsxs(t.Fragment,{children:["Selected: ",c.position," slot. Click another slot to swap, or click a panel to assign."]}):t.jsxs(t.Fragment,{children:["Selected: ",u(c.id)?.label,". Click a slot to assign",S("left")||S("middle")||S("right")?" (or add to tab group)":"","."]})}),t.jsxs("div",{className:"usage-hint",children:[t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",style:{verticalAlign:"text-bottom",marginRight:"4px"},children:t.jsx("path",{d:"M8 1a7 7 0 100 14A7 7 0 008 1zm0 1a6 6 0 110 12A6 6 0 018 2zm.5 3.5v3h-1v-3h1zm0 4v1h-1v-1h1z"})}),t.jsx("strong",{children:"Tip:"})," Toggle the tab icon on a slot to enable tab mode, then click panels to add multiple tabs."]})]})},e.ResponsiveConfigurablePanelLayout=({mobileBreakpoint:e="(max-width: 768px)",mobileCarouselProps:r,theme:a,layout:o,panels:l,...u})=>{const p=d(e),f=n.useMemo(()=>[o?.left,o?.middle,o?.right],[o]),h=n.useMemo(()=>f.map(e=>{if(null==e)return null;if("object"==typeof e&&"type"in e){const n=e;return"tabs"===n.type?t.jsx(i,{panelIds:n.panels,panels:l,config:n.config,theme:a}):null}return(e=>{if(!e)return null;const t=l.find(t=>t.id===e);return t?.content??null})(e)}).filter(e=>null!==e),[f,l,a]);return p?0===h.length?null:t.jsx(c,{theme:a,panels:h,minPanelWidth:0,idealPanelWidth:1,...r}):t.jsx(s,{theme:a,layout:o,panels:l,...u})},e.SnapCarousel=c,e.TabGroup=i,e.ThreePanelLayout=({leftPanel:e,middlePanel:l,rightPanel:i,collapsiblePanels:s={left:!0,right:!0},defaultSizes:c={left:20,middle:60,right:20},minSizes:d={left:5,middle:10,right:5},className:u="",collapsed:p={left:!1,right:!1},style:f,showCollapseButtons:h=!1,animationDuration:m=300,animationEasing:g="cubic-bezier(0.4, 0, 0.2, 1)",theme:v,onLeftCollapseStart:b,onLeftCollapseComplete:y,onLeftExpandStart:x,onLeftExpandComplete:w,onRightCollapseStart:C,onRightCollapseComplete:S,onRightExpandStart:R,onRightExpandComplete:E,onPanelResize:k})=>{const[N,z]=n.useState(p.left||!1),[D,j]=n.useState(p.right||!1),[M,A]=n.useState(!1),[T,P]=n.useState(!1),[L,F]=n.useState(!1),$=N&&!M,B=D&&!T,[O,I]=n.useState(p.left?0:c.left),[q,H]=n.useState(p.right?0:c.right),_=n.useRef(null),U=n.useRef(null),W=n.useRef(null),K=n.useRef(void 0),V=n.useRef(void 0),X=n.useRef(void 0),Y=n.useRef(void 0),J=n.useCallback((e,t,n,r,a,o)=>{if(!e.current)return;r.current&&cancelAnimationFrame(r.current),a.current=performance.now();let l=0;const i=()=>{if(!e.current||!a.current)return;l++;const s=l/10;if(s>=1)return 0===n?e.current.collapse():e.current.resize(n),void(o&&o());const c=s<.5?4*s*s*s:1-Math.pow(-2*s+2,3)/2,d=t+(n-t)*c;e.current.resize(d),r.current=requestAnimationFrame(()=>{setTimeout(i,m/10)})};i()},[m]),G=n.useCallback(()=>{M||L||!s.left||(a.flushSync(()=>{A(!0),z(!0)}),b&&b(),K.current&&cancelAnimationFrame(K.current),K.current=requestAnimationFrame(()=>{const e=_.current?.getLayout(),t=Math.round(1e3*(e?.[0]??O))/1e3;J(U,t,0,K,X,()=>{I(0),A(!1),y&&y()})}))},[M,L,O,s.left,J,b,y]),Q=n.useCallback(()=>{M||L||!s.left||(a.flushSync(()=>{A(!0),z(!1)}),x&&x(),K.current&&cancelAnimationFrame(K.current),K.current=requestAnimationFrame(()=>{J(U,0,c.left,K,X,()=>{I(c.left),A(!1),w&&w()})}))},[M,L,c.left,s.left,J,x,w]),Z=n.useCallback(()=>{T||L||!s.right||(a.flushSync(()=>{P(!0),j(!0)}),C&&C(),V.current&&cancelAnimationFrame(V.current),V.current=requestAnimationFrame(()=>{const e=_.current?.getLayout(),t=Math.round(1e3*(e?.[2]??q))/1e3;J(W,t,0,V,Y,()=>{H(0),P(!1),S&&S()})}))},[T,L,q,s.right,J,C,S]),ee=n.useCallback(()=>{T||L||!s.right||(a.flushSync(()=>{P(!0),j(!1)}),R&&R(),V.current&&cancelAnimationFrame(V.current),V.current=requestAnimationFrame(()=>{J(W,0,c.right,V,Y,()=>{H(c.right),P(!1),E&&E()})}))},[T,L,c.right,s.right,J,R,E]),te=n.useCallback(()=>{N?Q():G()},[N,G,Q]),ne=n.useCallback(()=>{D?ee():Z()},[D,Z,ee]),re=n.useCallback(e=>{M||T||(I(e),e>0&&z(!1))},[M,T]),ae=n.useCallback(e=>{M||T||(H(e),e>0&&j(!1))},[M,T]),oe=n.useCallback(()=>{k&&k({left:O,middle:100-O-q,right:q})},[O,q,k]),le=n.useCallback(e=>{F(e),e||oe()},[oe]);n.useEffect(()=>{void 0!==p.left&&p.left!==N&&queueMicrotask(()=>{p.left?G():Q()})},[p.left,N,G,Q]),n.useEffect(()=>{void 0!==p.right&&p.right!==D&&queueMicrotask(()=>{p.right?Z():ee()})},[p.right,D,Z,ee]),n.useEffect(()=>()=>{K.current&&cancelAnimationFrame(K.current),V.current&&cancelAnimationFrame(V.current)},[]);const ie=e=>{let t="three-panel-item";return"left"===e&&s.left?(t+=" collapsible-panel",M&&!L&&(t+=" animating"),$&&(t+=" collapsed")):"right"===e&&s.right?(t+=" collapsible-panel",T&&!L&&(t+=" animating"),B&&(t+=" collapsed")):"middle"===e&&(t+=" middle-panel"),t},se=M&&!L?{transition:`width ${m}ms ${g}`,width:N?"0%":`${c.left}%`}:void 0,ce=T&&!L?{transition:`width ${m}ms ${g}`,width:D?"0%":`${c.right}%`}:void 0,de=o(v),ue=M||T?0:d.left,pe=M||T?0:d.right;return t.jsx("div",{className:`three-panel-layout ${u}`,style:{...de,...f},children:t.jsxs(r.PanelGroup,{ref:_,direction:"horizontal",onLayout:oe,children:[t.jsx(r.Panel,{ref:U,collapsible:s.left,defaultSize:p.left?0:c.left,minSize:ue,collapsedSize:0,onResize:re,onCollapse:()=>z(!0),onExpand:()=>z(!1),className:ie("left"),style:se,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:N?0:1,transition:M?`opacity ${.5*m}ms ${g}`:"none"},children:e})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle left-handle "+($?"collapsed":""),onDragging:le,disabled:$,children:h&&s.left&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:te,className:"collapse-toggle",disabled:M,"aria-label":N?"Expand left panel":"Collapse left panel",children:N?"▸":"◂"})})}),t.jsx(r.Panel,{defaultSize:c.middle,minSize:d.middle,className:ie("middle"),children:t.jsx("div",{className:"panel-content-wrapper",children:l})}),t.jsx(r.PanelResizeHandle,{className:"resize-handle right-handle "+(B?"collapsed":""),onDragging:le,disabled:B,children:h&&s.right&&t.jsx("div",{className:"handle-bar",children:t.jsx("button",{onClick:ne,className:"collapse-toggle",disabled:T,"aria-label":D?"Expand right panel":"Collapse right panel",children:D?"◂":"▸"})})}),t.jsx(r.Panel,{ref:W,collapsible:s.right,defaultSize:p.right?0:c.right,minSize:pe,collapsedSize:0,onResize:ae,onCollapse:()=>j(!0),onExpand:()=>j(!1),className:ie("right"),style:ce,children:t.jsx("div",{className:"panel-content-wrapper",style:{opacity:D?0:1,transition:T?`opacity ${.5*m}ms ${g}`:"none"},children:i})})]})})},e.mapThemeToPanelVars=o,e.mapThemeToTabVars=l,e.useLocalStorage=function(e,t){const[r,a]=n.useState(()=>{if("undefined"==typeof window)return t;try{const n=window.localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return console.error(`Error reading localStorage key "${e}":`,n),t}}),o=n.useCallback(t=>{try{const n=t instanceof Function?t(r):t;a(n),"undefined"!=typeof window&&window.localStorage.setItem(e,JSON.stringify(n))}catch(n){console.error(`Error setting localStorage key "${e}":`,n)}},[e,r]);return n.useEffect(()=>{const t=t=>{if(t.key===e&&null!==t.newValue)try{a(JSON.parse(t.newValue))}catch(n){console.error(`Error parsing localStorage value for "${e}":`,n)}};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[e]),[r,o]},e.useMediaQuery=d,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
//# sourceMappingURL=index.umd.js.map
|