react-resizable-panels 4.13.0 → 4.13.1

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.
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $=require("react/jsx-runtime"),x=require("react");function St(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function bt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function xt(e){return e/100*window.innerHeight}function zt(e){return e/100*window.innerWidth}function wt(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function re({groupSize:e,panelElement:t,styleProp:n}){let o;const[r,i]=wt(n);switch(i){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=bt(t,r);break}case"em":{o=St(t,r);break}case"vh":{o=xt(r);break}case"vw":{o=zt(r);break}}return o}function G(e){return parseFloat(e.toFixed(3))}function se({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,r)=>(o+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o),0)}function xe(e){const{panels:t}=e,n=se({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:r,panelConstraints:i}=o;let u=0;if(i.collapsedSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:i.collapsedSize});u=G(f/n*100)}let l;if(i.collapsedThreshold!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:i.collapsedThreshold});l=G(f/n*100)}let a;if(i.defaultSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:i.defaultSize});a=G(f/n*100)}let s=0;if(i.minSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:i.minSize});s=G(f/n*100)}let c=100;if(i.maxSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:i.maxSize});c=G(f/n*100)}return{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:u,collapsedThreshold:l,collapsible:i.collapsible===!0,defaultSize:a,disabled:i.disabled,minSize:s,maxSize:c,panelId:o.id}})}class Xe{#e={};addListener(t,n){const o=this.#e[t];return o===void 0?this.#e[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let r=!1,i=null;const u=Array.from(o);for(let l=0;l<u.length;l++){const a=u[l];try{a.call(null,n)}catch(s){i===null&&(r=!0,i=s)}}if(r)throw i}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}let T={cursorFlags:0,state:"inactive"};const we=new Xe;function X(){return T}function Ye(e){return we.addListener("change",e)}function Pt(e,t=[],n){const o=T,r={...T};r.cursorFlags=e,r.state==="active"&&(r.previews=t,n&&(r.previewLayoutMap=n)),T=r,we.emit("change",{prev:o,next:r})}function U(e){const t=T;T=e,we.emit("change",{prev:t,next:e})}function Lt(e){T.state!=="active"||!T.previews.some(t=>t.separator===e)||U({...T,previews:T.previews.map(t=>t.separator===e?{...t}:t)})}function Rt(e){if(T.state==="inactive")return!1;const t=T.hitRegions.filter(o=>o.group!==e),n=T.state==="active"&&T.previews.some(o=>o.group===e);if(t.length===T.hitRegions.length&&!n)return!1;if(t.length===0)U({cursorFlags:0,state:"inactive"});else if(T.state==="active"){const o=new Map(T.initialLayoutMap),r=new Map(T.previewLayoutMap);o.delete(e),r.delete(e),U({...T,cursorFlags:0,hitRegions:t,initialLayoutMap:o,previewLayoutMap:r,previews:T.previews.filter(i=>i.group!==e)})}else U({...T,hitRegions:t});return!0}const Ct=e=>e,be=()=>{},Je=1,Ze=2,Qe=4,et=8,Oe=3,De=12;let pe;function Ge(){return pe===void 0&&(pe=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(pe=!0)),pe}function Mt({cursorFlags:e,groups:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(i=>{if(!i.mutableState.disableCursor)switch(i.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&Ge()){const i=(e&Je)!==0,u=(e&Ze)!==0,l=(e&Qe)!==0,a=(e&et)!==0;if(i)return l?"se-resize":a?"ne-resize":"e-resize";if(u)return l?"sw-resize":a?"nw-resize":"w-resize";if(l)return"s-resize";if(a)return"n-resize"}break}}return Ge()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Ae=new WeakMap;function ue(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Ae.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=X();switch(o.state){case"active":case"hover":{const r=Mt({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),i=`*, *:hover {cursor: ${r} !important; }`;if(t===i)return;t=i,r?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Ae.set(e,{prevStyle:t,styleSheet:n})}function M(e,t="Assertion error"){if(!e)throw Error(t)}function ze(e,t){return Array.from(t).sort(e==="horizontal"?Et:kt)}function Et(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function kt(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function tt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function nt(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function It({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,i=Number.MAX_VALUE;for(const u of t){const{x:l,y:a}=nt(o,u),s=e==="horizontal"?l:a;s<i&&(i=s,r=u)}return M(r,"No rect found"),r}let he;function ot(){return he===void 0&&(typeof matchMedia=="function"?he=!!matchMedia("(pointer:coarse)").matches:he=!1),he}function Pe({expandHitTargets:e=!0,group:t,includeDisabled:n=!1}){const{element:o,orientation:r,panels:i,separators:u}=t,l=ze(r,Array.from(o.children).filter(tt).filter(h=>!h.hasAttribute("data-resize-preview")).map(h=>({element:h}))).map(({element:h})=>h),a=[];let s=!1,c=!1,f=-1,d=-1,v=0,w,p=[];{let h=-1;for(const g of l)g.hasAttribute("data-panel")&&(h++,g.hasAttribute("data-disabled")||(v++,f===-1&&(f=h),d=h))}if(n||v>1){let h=-1;for(const g of l)if(g.hasAttribute("data-panel")){h++;const y=i.find(m=>m.element===g);if(y){if(w){const m=w.element.getBoundingClientRect(),b=g.getBoundingClientRect();let z;if(c){const R=r==="horizontal"?new DOMRect(m.right,m.top,0,m.height):new DOMRect(m.left,m.bottom,m.width,0),P=r==="horizontal"?new DOMRect(b.left,b.top,0,b.height):new DOMRect(b.left,b.top,b.width,0);switch(p.length){case 0:{z=[R,P];break}case 1:{const C=p[0],E=It({orientation:r,rects:[m,b],targetRect:C.element.getBoundingClientRect()});z=[C,E===m?P:R];break}default:{z=p;break}}}else p.length?z=p:z=[r==="horizontal"?new DOMRect(m.right,b.top,b.left-m.right,b.height):new DOMRect(b.left,m.bottom,b.width,b.top-m.bottom)];for(const R of z){let P="width"in R?R:R.element.getBoundingClientRect();const C=e?ot()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(P.width<C){const O=C-P.width;P=new DOMRect(P.x-O/2,P.y,P.width+O,P.height)}if(P.height<C){const O=C-P.height;P=new DOMRect(P.x,P.y-O/2,P.width,P.height+O)}const E=h<=f||h>d;(n||!s&&!E)&&a.push({group:t,groupSize:se({group:t}),panels:[w,y],separator:"width"in R?void 0:R,rect:P}),s=!1}}c=!1,w=y,p=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(s=!0);const y=u.find(m=>m.element===g);y?p.push(y):(w=void 0,p=[])}else c=!0}return a}let B=new Map;const rt=new Xe;function Tt(e){B=new Map(B),B.delete(e)}function it(e,t){for(const[n]of B)if(n.id===e)return n}function Z(e,t){for(const[n,o]of B)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Q(){return B}function Le(e,t){return rt.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function K(e,t,n){const o=B.get(e);B=new Map(B),B.set(e,t),rt.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t})}function Ot(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function D(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function V(e,t){return D(e,t)?0:e>t?1:-1}function ie({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsedThreshold:i,collapsible:u,disabled:l,maxSize:a=100,minSize:s=0}=t;if(l&&!e)return n;if(V(o,s)<0)if(u){const c=i??(s-r)/2,f=V(n,r)<=0,d=f?r+c:s-c,v=V(o,d);V(o,r)<=0||v<0||i!==void 0&&f&&v===0?o=r:o=s}else o=s;return o=Math.min(a,o),o=G(o),o}function ce({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:i}){if(D(e,0))return t;const u=i==="imperative-api",l=Object.values(t),a=Object.values(r),s=[...l],[c,f]=o;M(c!=null,"Invalid first pivot index"),M(f!=null,"Invalid second pivot index");let d=0;switch(i){case"keyboard":{{const p=e<0?f:c,h=n[p];M(h,`Panel constraints not found for index ${p}`);const{collapsedSize:g=0,collapsible:y,minSize:m=0}=h;if(y){const b=l[p];if(M(b!=null,`Previous layout not found for panel index ${p}`),D(b,g)){const z=m-b;V(z,Math.abs(e))>0&&(e=e<0?0-z:z)}}}{const p=e<0?c:f,h=n[p];M(h,`No panel constraints found for index ${p}`);const{collapsedSize:g=0,collapsible:y,minSize:m=0}=h;if(y){const b=l[p];if(M(b!=null,`Previous layout not found for panel index ${p}`),D(b,m)){const z=b-g;V(z,Math.abs(e))>0&&(e=e<0?0-z:z)}}}break}default:{const p=e<0?f:c,h=n[p];M(h,`Panel constraints not found for index ${p}`);const g=l[p],{collapsedSize:y,collapsedThreshold:m,collapsible:b,minSize:z}=h;if(b&&V(g,z)<0){const R=z-y,P=m??R/2,C=g+Math.abs(e);if(V(C,z)<0){const E=V(Math.abs(e),P),O=m===void 0&&e<0;E>0||E===0&&O?e=e<0?-R:R:e=0}}break}}{const p=e<0?1:-1;let h=e<0?f:c,g=0;for(;;){const m=l[h];M(m!=null,`Previous layout not found for panel index ${h}`);const z=ie({overrideDisabledPanels:u,panelConstraints:n[h],prevSize:m,size:100})-m;if(g+=z,h+=p,h<0||h>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(g));e=e<0?0-y:y}{let h=e<0?c:f;for(;h>=0&&h<n.length;){const g=Math.abs(e)-Math.abs(d),y=l[h];M(y!=null,`Previous layout not found for panel index ${h}`);const m=y-g,b=ie({overrideDisabledPanels:u,panelConstraints:n[h],prevSize:y,size:m});if(!D(y,b)&&(d+=y-b,s[h]=b,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(Ot(a,s))return r;{const p=e<0?f:c,h=l[p];M(h!=null,`Previous layout not found for panel index ${p}`);const g=h+d,y=ie({overrideDisabledPanels:u,panelConstraints:n[p],prevSize:h,size:g});if(s[p]=y,!D(y,g)){let m=g-y,z=e<0?f:c;for(;z>=0&&z<n.length;){const R=s[z];M(R!=null,`Previous layout not found for panel index ${z}`);const P=R+m,C=ie({overrideDisabledPanels:u,panelConstraints:n[z],prevSize:R,size:P});if(D(R,C)||(m-=C-R,s[z]=C),D(m,0))break;e>0?z--:z++}}}const v=Object.values(s).reduce((p,h)=>h+p,0);if(!D(v,100,.1))return r;const w=Object.keys(r);return s.reduce((p,h,g)=>(p[w[g]]=h,p),{})}function W(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||V(e[n],t[n])!==0)return!1;return!0}function Re({commit:e,document:t,event:n,hitRegions:o,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:u,prevCursorFlags:l}){let a=0;const s=X();let c=s.state==="active"?s.previews:[];const f=new Map(s.state==="active"?s.previewLayoutMap:void 0);o.forEach(v=>{const{group:w,groupSize:p}=v,{orientation:h,panels:g}=w;if(e&&w.resizePreviewMode!=="separator")return;const{disableCursor:y}=w.mutableState;let m=0;u?h==="horizontal"?m=(n.clientX-u.x)/p*100:m=(n.clientY-u.y)/p*100:h==="horizontal"?m=n.clientX<0?-100:100:m=n.clientY<0?-100:100;const b=r.get(w),z=i.get(w);if(!b||!z)return;const{defaultLayoutDeferred:R,derivedPanelConstraints:P,groupSize:C,layout:E,separatorToPanels:O}=z;if(P&&E&&O){const A=w.resizePreviewMode==="separator"?f.get(w)??E:E,k=ce({delta:m,initialLayout:b,panelConstraints:P,pivotIndices:v.panels.map(N=>g.indexOf(N)),prevLayout:A,trigger:"mouse-or-touch"});if(w.resizePreviewMode==="separator"&&!e&&!W(k,A)){f.set(w,k);let N=0;const j=g.map(S=>(N+=k[S.id]-b[S.id],N*(p/100)));c=c.map(S=>{if(S.group!==w)return S;const L=j[S.panelIndex];return L===S.offset?S:{...S,offset:L}})}if(W(k,A)&&m!==0&&!y)switch(h){case"horizontal":{a|=m<0?Je:Ze;break}case"vertical":{a|=m<0?Qe:et;break}}(w.resizePreviewMode!=="separator"||e)&&!W(k,E)&&K(v.group,{defaultLayoutDeferred:R,derivedPanelConstraints:P,groupSize:C,layout:k,separatorToPanels:O})}});let d=0;n.movementX===0?d|=l&Oe:d|=a&Oe,n.movementY===0?d|=l&De:d|=a&De,Pt(d,c,f),ue(t)}function st(e,t){const n=X(),o=Q();let r=!1;switch(n.state){case"active":Re({commit:!0,document:e,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),U({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(ue(e),r=!0,n.hitRegions.forEach(i=>{if(!o.has(i.group))return;const u=Z(i.group.id,!0);K(i.group,u,{isUserInteraction:!0})}))}return r}function Fe(e){e.defaultPrevented||st(e.currentTarget,e)}function Dt(e,t,n){let o,r={x:1/0,y:1/0};for(const i of t){const u=nt(n,i.rect);switch(e){case"horizontal":{u.x<=r.x&&(o=i,r=u);break}case"vertical":{u.y<=r.y&&(o=i,r=u);break}}}return o?{distance:r,hitRegion:o}:void 0}function Gt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function At(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:_e(e),b:_e(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();M(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:je(Ne(n.a)),b:je(Ne(n.b))};if(r.a===r.b){const i=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let l=i.length;for(;l--;){const a=i[l];if(a===u.a)return 1;if(a===u.b)return-1}}return Math.sign(r.a-r.b)}const Ft=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Nt(e){const t=getComputedStyle(at(e)??e).display;return t==="flex"||t==="inline-flex"}function jt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Nt(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Ft.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Ne(e){let t=e.length;for(;t--;){const n=e[t];if(M(n,"Missing node"),jt(n))return n}return null}function je(e){return e&&Number(getComputedStyle(e).zIndex)||0}function _e(e){const t=[];for(;e;)t.push(e),e=at(e);return t}function at(e){const{parentNode:t}=e;return Gt(t)?t.host:t}function _t(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function $t({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!tt(n)||n.contains(e)||e.contains(n))return!0;if(At(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(_t(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function Ce(e,t){const n=[];return t.forEach((o,r)=>{if(r.disabled)return;const i=Pe({group:r}),u=Dt(r.orientation,i,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&$t({groupElement:r.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function te({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],r=o.reduce((l,a)=>l+a,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(l=>`${l}%`).join(", ")}`);if(!D(r,100)&&o.length>0)for(let l=0;l<t.length;l++){const a=o[l];M(a!=null,`No layout data found for index ${l}`);const s=100/r*a;o[l]=s}let i=0;for(let l=0;l<t.length;l++){const a=n[l];M(a!=null,`No layout data found for index ${l}`);const s=o[l];M(s!=null,`No layout data found for index ${l}`);const c=ie({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:a,size:s});s!=c&&(i+=s-c,o[l]=c)}if(!D(i,0))for(let l=0;l<t.length;l++){const a=o[l];M(a!=null,`No layout data found for index ${l}`);const s=a+i,c=ie({overrideDisabledPanels:!0,panelConstraints:t[l],prevSize:a,size:s});if(a!==c&&(i-=c-a,o[l]=c,D(i,0)))break}const u=Object.keys(e);return o.reduce((l,a,s)=>(l[u[s]]=a,l),{})}function lt({groupId:e,panelId:t}){const n=()=>{const a=Q();for(const[s,{defaultLayoutDeferred:c,derivedPanelConstraints:f,layout:d,groupSize:v,separatorToPanels:w}]of a)if(s.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:s,groupSize:v,layout:d,separatorToPanels:w};throw Error(`Group ${e} not found`)},o=()=>{const a=n().derivedPanelConstraints.find(s=>s.panelId===t);if(a!==void 0)return a;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const a=n().group.panels.find(s=>s.id===t);if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},i=()=>{const a=n().layout[t];if(a!==void 0)return a;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:a,panels:s,prevLayout:c,derivedPanelConstraints:f})=>{const d=i(),v=s.findIndex(g=>g.id===t),w=v===0,p=v===s.length-1;if(p&&a<d&&(w||s.slice(0,v).every((g,y)=>{const m=f[y];return m?.collapsible&&D(m.collapsedSize,c[m.panelId])}))){const g=s.slice(0,v).reduce((y,m)=>y+c[m.id],0);return{...c,[t]:G(100-g)}}return ce({delta:p?d-a:a-d,initialLayout:c,panelConstraints:f,pivotIndices:p?[v-1,v]:[v,v+1],prevLayout:c,trigger:"imperative-api"})},l=a=>{const s=i();if(a===s)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:d,groupSize:v,layout:w,separatorToPanels:p}=n(),h=u({nextSize:a,panels:d.panels,prevLayout:w,derivedPanelConstraints:f}),g=te({layout:h,panelConstraints:f});W(w,g)||K(d,{defaultLayoutDeferred:c,derivedPanelConstraints:f,groupSize:v,layout:g,separatorToPanels:p})};return{collapse:()=>{const{collapsible:a,collapsedSize:s}=o(),{mutableValues:c}=r(),f=i();a&&f!==s&&(c.expandToSize=f,l(s))},expand:()=>{const{collapsible:a,collapsedSize:s,minSize:c}=o(),{mutableValues:f}=r(),d=i();if(a&&d===s){let v=f.expandToSize??c;v===0&&(v=1),l(v)}},getSize:()=>{const{group:a}=n(),s=i(),{element:c}=r(),f=a.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:s,inPixels:f}},isCollapsed:()=>{const{collapsible:a,collapsedSize:s}=o(),c=i();return a&&D(s,c)},resize:a=>{const{group:s}=n(),{element:c}=r(),f=se({group:s}),d=re({groupSize:f,panelElement:c,styleProp:a}),v=G(d/f*100);l(v)}}}function $e(e){if(e.defaultPrevented)return;const t=Q();Ce(e,t).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const r=o.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(r){const i=r.panelConstraints.defaultSize,u=lt({groupId:o.group.id,panelId:r.id});u&&i!==void 0&&(u.resize(i),e.preventDefault())}}})}function me(e){const t=Q();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function ut({groupId:e}){const t=()=>{const n=Q();for(const[o,r]of n)if(o.id===e)return{group:o,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:r,group:i,groupSize:u,layout:l,separatorToPanels:a}=t(),s=te({layout:n,panelConstraints:r});return o?l:(W(l,s)||K(i,{defaultLayoutDeferred:o,derivedPanelConstraints:r,groupSize:u,layout:s,separatorToPanels:a}),s)}}}function ee(e,t){const n=me(e),o=Z(n.id,!0),r=n.separators.find(f=>f.element===e);M(r,"Matching separator not found");const i=o.separatorToPanels.get(r);M(i,"Matching panels not found");const u=i.map(f=>n.panels.indexOf(f)),a=ut({groupId:n.id}).getLayout(),s=ce({delta:t,initialLayout:a,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:a,trigger:"keyboard"}),c=te({layout:s,panelConstraints:o.derivedPanelConstraints});W(a,c)||K(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:c,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function He(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=me(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&ee(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&ee(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&ee(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&ee(t,-5);break}case"End":{e.preventDefault(),ee(t,100);break}case"Enter":{e.preventDefault();const o=me(t),r=Z(o.id,!0),{derivedPanelConstraints:i,layout:u,separatorToPanels:l}=r,a=o.separators.find(d=>d.element===t);M(a,"Matching separator not found");const s=l.get(a);M(s,"Matching panels not found");const c=s[0],f=i.find(d=>d.panelId===c.id);if(M(f,"Panel metadata not found"),f.collapsible){const d=u[c.id],v=f.collapsedSize===d?o.mutableState.expandedPanelSizes[c.id]??f.minSize:f.collapsedSize;ee(t,v-d)}break}case"F6":{e.preventDefault();const r=me(t).separators.map(a=>a.element),i=Array.from(r).findIndex(a=>a===e.currentTarget);M(i!==null,"Index not found");const u=e.shiftKey?i>0?i-1:r.length-1:i+1<r.length?i+1:0;r[u].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),ee(t,-100);break}}}function Ht(e,t){const{element:n,orientation:o,panels:r}=e,i=n.getBoundingClientRect(),u=o==="horizontal";return Pe({expandHitTargets:!1,group:e,includeDisabled:!0}).map(({panels:a,rect:s,separator:c},f)=>{const d=r.indexOf(a[0]),v=u?s.left+s.width/2:s.top+s.height/2;return{active:t.some(p=>{if(p.group!==e||p.panels[0]!==a[0])return!1;if(c||p.separator)return p.separator===c;const h=u?p.rect.left+p.rect.width/2:p.rect.top+p.rect.height/2;return D(v,h)}),group:e,key:c?`separator-${c.id}`:`panel-${a[0].id}-${f}`,offset:0,panelIndex:d,rect:new DOMRect((u&&!c?v:s.left)-i.left-n.clientLeft+n.scrollLeft,(!u&&!c?v:s.top)-i.top-n.clientTop+n.scrollTop,u&&!c?0:s.width,!u&&!c?0:s.height),separator:c}})}function Ve(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=Q(),n=Ce(e,t),o=new Map;let r=!1;n.forEach(u=>{u.separator&&(r||(r=!0,u.separator.element.focus({focusVisible:!1,preventScroll:!0})));const l=t.get(u.group);l&&o.set(u.group,l.layout)});const i=Array.from(o.keys()).flatMap(u=>u.resizePreviewMode==="separator"?Ht(u,n):[]);U({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(o),previews:i,state:"active"}),n.length&&e.preventDefault()}function Be(e){const t=Q(),n=X();switch(n.state){case"active":Re({commit:!1,document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ue(e){if(e.defaultPrevented)return;const t=X(),n=Q();switch(t.state){case"active":{if(e.buttons===0){t.previewLayoutMap.forEach((o,r)=>{const i=n.get(r);r.resizePreviewMode==="separator"&&i&&!W(o,i.layout)&&K(r,{...i,layout:o})}),U({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{if(!n.has(o.group))return;const r=Z(o.group.id,!0);K(o.group,r,{isUserInteraction:!0})}),ue(e.currentTarget);return}for(const o of t.hitRegions)if(o.separator){const{element:r}=o.separator;r.isConnected&&!r.hasPointerCapture?.(e.pointerId)&&r.setPointerCapture?.(e.pointerId)}Re({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=Ce(e,n);o.length===0?t.state!=="inactive"&&U({cursorFlags:0,state:"inactive"}):U({cursorFlags:0,hitRegions:o,state:"hover"}),ue(e.currentTarget);break}}}function We(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(X().state){case"hover":U({cursorFlags:0,state:"inactive"})}}function Ke(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;st(e.currentTarget,e)&&e.preventDefault()}function qe(e){let t=0,n=0;const o={};for(const i of e)if(i.defaultSize!==void 0){t++;const u=G(i.defaultSize);n+=u,o[i.panelId]=u}else o[i.panelId]=void 0;const r=e.length-t;if(r!==0){const i=G((100-n)/r);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=i)}return o}function Vt(e,t,n){if(!n[0])return;const r=e.panels.find(s=>s.element===t);if(!r||!r.onResize)return;const i=se({group:e}),u=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,l=r.mutableValues.prevSize,a={asPercentage:G(u/i*100),inPixels:u};r.mutableValues.prevSize=a,r.onResize(a,r.id,l)}function ct(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e)if(e[o]!==t[o])return!1;return!0}function Bt(e,t){return e.length!==t.length?!1:e.every((n,o)=>ct(n,t[o]))}function Ut({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,i=0,u=!1;const l=new Map,a=[];for(const f of e.panels){const d=o[f.id]??0;switch(f.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const v=d/100*n,w=G(v/t*100);l.set(f.id,w),r+=w;break}case"preserve-relative-size":default:{a.push(f.id),i+=d;break}}}if(!u||a.length===0)return o;const s=100-r,c={...o};if(l.forEach((f,d)=>{c[d]=f}),i>0)for(const f of a){const d=o[f]??0;c[f]=G(d/i*s)}else{const f=G(s/a.length);for(const d of a)c[d]=f}return c}function Wt(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}const oe=new Map;function Kt(e){let t=!0;M(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,i=new n(p=>{for(const h of p){const{borderBoxSize:g,target:y}=h;if(y===e.element){if(t){const m=se({group:e});if(m===0)return;const b=Z(e.id);if(!b)return;const z=xe(e),R=b.defaultLayoutDeferred?qe(z):b.layout,P=Ut({group:e,nextGroupSize:m,prevGroupSize:b.groupSize,prevLayout:R}),C=te({layout:P,panelConstraints:z});if(!b.defaultLayoutDeferred&&W(b.layout,C)&&Bt(b.derivedPanelConstraints,z)&&b.groupSize===m)continue;K(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:z,groupSize:m,layout:C,separatorToPanels:b.separatorToPanels})}}else Vt(e,y,g)}});i.observe(e.element),e.panels.forEach(p=>{M(!o.has(p.id),`Panel ids must be unique; id "${p.id}" was used more than once`),o.add(p.id),p.onResize&&i.observe(p.element)});const u=se({group:e}),l=xe(e),a=e.panels.map(({id:p})=>p).join(",");let s=e.mutableState.defaultLayout;s&&(Wt(e.panels,s)||(s=void 0));const c=e.mutableState.layouts[a]??s??qe(l),f=te({layout:c,panelConstraints:l}),d=e.element.ownerDocument;oe.set(d,(oe.get(d)??0)+1);const v=new Map;return Pe({group:e}).forEach(p=>{p.separator&&v.set(p.separator,p.panels)}),K(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:l,groupSize:u,layout:f,separatorToPanels:v}),e.separators.forEach(p=>{M(!r.has(p.id),`Separator ids must be unique; id "${p.id}" was used more than once`),r.add(p.id),p.element.addEventListener("keydown",He)}),oe.get(d)===1&&(d.addEventListener("contextmenu",Fe,!0),d.addEventListener("dblclick",$e,!0),d.addEventListener("pointerdown",Ve,!0),d.addEventListener("pointerleave",Be),d.addEventListener("pointermove",Ue),d.addEventListener("pointerout",We),d.addEventListener("pointerup",Ke,!0)),function(){t=!1,oe.set(d,Math.max(0,(oe.get(d)??0)-1)),Tt(e),Rt(e)&&ue(d),e.separators.forEach(h=>{h.element.removeEventListener("keydown",He)}),oe.get(d)||(d.removeEventListener("contextmenu",Fe,!0),d.removeEventListener("dblclick",$e,!0),d.removeEventListener("pointerdown",Ve,!0),d.removeEventListener("pointerleave",Be),d.removeEventListener("pointermove",Ue),d.removeEventListener("pointerout",We),d.removeEventListener("pointerup",Ke,!0)),i.disconnect()}}function qt(){const[e,t]=x.useState({}),n=x.useCallback(()=>t({}),[]);return[e,n]}function Me(e){const t=x.useId();return`${e??t}`}const H=typeof window<"u"?x.useLayoutEffect:x.useEffect;function le(e){const t=x.useRef(e);return H(()=>{t.current=e},[e]),x.useCallback((...n)=>t.current?.(...n),[t])}function Ee(...e){return le(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function ke(e){const t=x.useRef({...e});return H(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const ft=x.createContext(null);function Xt({separator:e}){const{element:t}=e,n=x.useRef(null);return H(()=>{const o=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],i=[o,...o.querySelectorAll("*")],u=t.ownerDocument.defaultView;return r.forEach((l,a)=>{const s=i[a];if(s instanceof u.HTMLElement||s instanceof u.SVGElement){const c=u.getComputedStyle(l);for(let f=0;f<c.length;f++){const d=c.item(f);s.style.setProperty(d,c.getPropertyValue(d))}}s.removeAttribute("data-testid"),s.removeAttribute("id")}),Object.assign(o.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(o),()=>o.remove()},[t]),$.jsx("div",{ref:n,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function ye(){const e=x.useContext(ft);return M(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Ie(e){const{registerOverlay:t}=ye(),n=x.useRef(e);ct(n.current,e)||(n.current=e);const o=n.current;return H(()=>t(o),[t,o]),null}Ie.displayName="SeparatorOverlay";function Yt({active:e,orientation:t,style:n,...o}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return $.jsx("div",{...o,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function Jt({overlay:e,preview:t}){const{group:n,offset:o,rect:r,separator:i}=t,u=n.orientation==="horizontal";let l=i?.preview,a=e;return x.isValidElement(l)&&l.type===Ie&&(a=l.props,l=void 0),l==null&&(a?l=$.jsx(Yt,{...a,active:t.active,orientation:n.orientation}):i&&(l=$.jsx(Xt,{separator:i}))),$.jsx("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:u?`translateX(${o}px)`:`translateY(${o}px)`,width:r.width},children:l})}function Zt(e,t){const n=x.useRef({getLayout:()=>({}),setLayout:Ct});x.useImperativeHandle(t,()=>n.current,[]),H(()=>{Object.assign(n.current,ut({groupId:e}))})}function Qt({groupId:e,resizePreviewMode:t}){const[n,o]=x.useState([]),r=x.useRef(n);return H(()=>{const i=l=>{const a=it(e),s=t==="separator"&&l.state==="active"?l.previews.filter(f=>f.group===a&&(f.active||!D(f.offset,0))):[],c=r.current;c.length===s.length&&s.every((f,d)=>f===c[d])||(r.current=s,o(s))};if(t!=="separator"){i(X());return}const u=Ye(({next:l})=>i(l));return i(X()),u},[e,t]),n}function dt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:i,groupRef:u,id:l,onLayoutChange:a,onLayoutChanged:s,orientation:c="horizontal",resizePreviewMode:f="panel",resizeTargetMinimumSize:d={coarse:20,fine:10},style:v,...w}){const p=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),h=le(S=>{W(p.current.onLayoutChange,S)||(p.current.onLayoutChange=S,a?.(S))}),g=le((S,L)=>{W(p.current.onLayoutChanged,S)||(p.current.onLayoutChanged=S,s?.(S,{isUserInteraction:L}))}),y=Me(l),[m,b]=x.useState(),z=Qt({groupId:y,resizePreviewMode:f}),R=x.useRef(null),[P,C]=qt(),E=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),O=Ee(R,i);Zt(y,u);const A=le((S,L)=>{const I=Z(S);if(I)return{flexGrow:I.layout[L]??1};if(n?.[L])return{flexGrow:n?.[L]}}),k=ke({defaultLayout:n,disableCursor:o}),N=x.useMemo(()=>({get disableCursor(){return!!k.disableCursor},getPanelStyles:A,id:y,orientation:c,registerPanel:S=>{const L=E.current;return L.panels=ze(c,[...L.panels,S]),C(),()=>{L.panels=L.panels.filter(I=>I!==S),C()}},registerOverlay:S=>(b(S),()=>{b(void 0)}),registerSeparator:S=>{const L=E.current;return L.separators=ze(c,[...L.separators,S]),C(),()=>{L.separators=L.separators.filter(I=>I!==S),C()}},updatePanelProps:(S,{disabled:L})=>{const F=E.current.panels.find(ne=>ne.id===S);F&&(F.panelConstraints.disabled=L);const _=it(y),Y=Z(y);_&&Y&&K(_,{...Y,derivedPanelConstraints:xe(_)})},updateSeparatorProps:(S,{disabled:L,disableDoubleClick:I})=>{const _=E.current.separators.find(Y=>Y.id===S);_&&(_.disabled=L,_.disableDoubleClick=I)}}),[A,y,C,c,k]),j=x.useRef(null);return H(()=>{const S=R.current;if(S===null)return;const L=E.current;let I;if(k.defaultLayout!==void 0&&Object.keys(k.defaultLayout).length===L.panels.length){I={};for(const J of L.panels){const fe=k.defaultLayout[J.id];fe!==void 0&&(I[J.id]=fe)}}const F={disabled:!!r,element:S,id:y,mutableState:{defaultLayout:I,disableCursor:!!k.disableCursor,expandedPanelSizes:E.current.lastExpandedPanelSizes,layouts:E.current.layouts},orientation:c,panels:L.panels,resizePreviewMode:f,resizeTargetMinimumSize:L.resizeTargetMinimumSize,separators:L.separators};j.current=F;const _=Kt(F),{defaultLayoutDeferred:Y,derivedPanelConstraints:ne,layout:ae}=Z(F.id,!0);!Y&&ne.length>0&&(h(ae),g(ae,!1));const ve=Le(y,J=>{const{defaultLayoutDeferred:fe,derivedPanelConstraints:Te,layout:de}=J.next;if(fe||Te.length===0)return;const mt=F.panels.map(({id:q})=>q).join(",");F.mutableState.layouts[mt]=de,Te.forEach(q=>{if(q.collapsible){const{layout:Se}=J.prev??{};if(Se){const yt=D(q.collapsedSize,de[q.panelId]),vt=D(q.collapsedSize,Se[q.panelId]);yt&&!vt&&(F.mutableState.expandedPanelSizes[q.panelId]=Se[q.panelId])}}});const gt=X().state!=="active";h(de),gt&&g(de,J.isUserInteraction)});return()=>{j.current=null,_(),ve()}},[r,y,g,h,c,P,f,k]),x.useEffect(()=>{const S=j.current;S&&(S.mutableState.defaultLayout=n,S.mutableState.disableCursor=!!o)}),$.jsx(ft.Provider,{value:N,children:$.jsxs("div",{...w,className:t,"data-group":!0,"data-testid":y,id:y,ref:O,style:{height:"100%",width:"100%",overflow:"hidden",position:f==="separator"?"relative":void 0,...v,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:[e,z.map(S=>$.jsx(Jt,{overlay:m,preview:S},S.key))]})})}dt.displayName="Group";function ge(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function en({id:e,panelIds:t,storage:n}){const o=ge(e,[]),r=n.getItem(o);if(r)try{const i=JSON.parse(r);if(t){const u=t.join(","),l=i[u];if(l&&Array.isArray(l.layout)&&t.length===l.layout.length){const a={};for(let s=0;s<t.length;s++)a[t[s]]=l.layout[s];return a}}else{const u=Object.keys(i);if(u.length===1){const l=i[u[0]];if(l&&Array.isArray(l.layout)){const a=u[0].split(",");if(a.length===l.layout.length){const s={};for(let c=0;c<a.length;c++)s[a[c]]=l.layout[c];return s}}}}}catch{}}function tn({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...r}){const i=n!==void 0,u="id"in r?r.id:r.groupId,l=ge(u,n??[]),a=x.useSyncExternalStore(nn,()=>o.getItem(l),()=>o.getItem(l)),s=x.useMemo(()=>{if(a){const h=JSON.parse(a),g=Object.values(h);if(Array.from(g).every(y=>typeof y=="number"))return h}},[a]),c=x.useMemo(()=>{if(!s)return en({id:u,panelIds:n,storage:o})},[s,u,n,o]),f=s??c,d=x.useRef(null),v=x.useCallback(()=>{const h=d.current;h&&(d.current=null,clearTimeout(h))},[]);x.useLayoutEffect(()=>()=>{v()},[v]);const w=x.useCallback((h,g)=>{if(t&&!g.isUserInteraction)return;v();let y;i?y=ge(u,Object.keys(h)):y=ge(u,[]);try{o.setItem(y,JSON.stringify(h))}catch(m){console.error(m)}},[v,i,u,t,o]),p=x.useCallback(h=>{v(),e===0?w(h,{isUserInteraction:!1}):d.current=setTimeout(()=>{w(h,{isUserInteraction:!1})},e)},[v,e,w]);return{defaultLayout:f,onLayoutChange:p,onLayoutChanged:w}}function nn(){return function(){}}function on(){return x.useState(null)}function rn(){return x.useRef(null)}function sn(e,t){const{id:n}=ye(),o=x.useRef({collapse:be,expand:be,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:be});x.useImperativeHandle(t,()=>o.current,[]),H(()=>{Object.assign(o.current,lt({groupId:n,panelId:e}))})}function pt({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:r=!1,defaultSize:i,disabled:u,elementRef:l,groupResizeBehavior:a="preserve-relative-size",id:s,maxSize:c="100%",minSize:f="0%",onResize:d,panelRef:v,style:w,...p}){const h=!!s,g=Me(s),y=ke({disabled:u}),m=x.useRef(null),b=Ee(m,l),{getPanelStyles:z,id:R,orientation:P,registerPanel:C,updatePanelProps:E}=ye(),O=d!==null,A=le((S,L,I)=>{d?.(S,s,I)});H(()=>{const S=m.current;if(S!==null){const L={element:S,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:O?A:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsedThreshold:o,collapsible:r,defaultSize:i,disabled:y.disabled,maxSize:c,minSize:f}};return C(L)}},[a,n,o,r,i,O,g,h,c,f,A,C,y]),x.useEffect(()=>{E(g,{disabled:u})},[u,g,E]),sn(g,v);const k=()=>{const S=z(R,g);if(S)return JSON.stringify(S)},N=x.useSyncExternalStore(S=>Le(R,S),k,k);let j;return N?j=JSON.parse(N):i!==void 0?j={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:j={flexGrow:1},$.jsx("div",{...p,"data-disabled":u||void 0,"data-panel":!0,"data-testid":g,id:g,ref:b,style:{...an,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...j},children:$.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...w,touchAction:P==="horizontal"?"pan-y":"pan-x"},children:e})})}pt.displayName="Panel";const an={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function ln(){return x.useState(null)}function un(){return x.useRef(null)}function cn({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let r,i;const u=e[n],l=t.find(a=>a.panelId===n);if(l){const a=l.maxSize,s=l.collapsible?l.collapsedSize:l.minSize,c=[o,o+1];i=te({layout:ce({delta:s-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],r=te({layout:ce({delta:a-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:i,valueNow:u}}function ht({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:i,preview:u,style:l,...a}){const s=Me(i),c=ke({disabled:n,disableDoubleClick:o,children:e,className:t,preview:u,style:l}),[f,d]=x.useState({}),[v,w]=x.useState("inactive"),[p,h]=x.useState(!1),g=x.useRef(null),y=x.useRef(null),m=Ee(g,r),{disableCursor:b,id:z,orientation:R,registerSeparator:P,updateSeparatorProps:C}=ye(),E=R==="horizontal"?"vertical":"horizontal";H(()=>{const k=g.current;if(k!==null){const N={disabled:c.disabled,disableDoubleClick:c.disableDoubleClick,element:k,id:s,get children(){return c.children},get className(){return c.className},get preview(){return c.preview},get style(){return c.style}};y.current=N;const j=P(N),S=Ye(I=>{w(I.next.state!=="inactive"&&I.next.hitRegions.some(F=>F.separator===N)?I.next.state:"inactive")}),L=Le(z,I=>{const{derivedPanelConstraints:F,layout:_,separatorToPanels:Y}=I.next,ne=Y.get(N);if(ne){const ae=ne[0],ve=F.findIndex(J=>J.panelId===ae.id);d(cn({layout:_,panelConstraints:F,panelId:ae.id,panelIndex:ve}))}});return()=>{y.current=null,S(),L(),j()}}},[z,s,P,c]),H(()=>{const k=y.current;k&&Lt(k)},[u]),x.useEffect(()=>{C(s,{disabled:n,disableDoubleClick:o})},[n,o,s,C]);let O;n&&!b&&(O="not-allowed");let A;if(n)A="disabled";else switch(v){case"active":{A="active";break}default:p?A="focus":A=v}return $.jsx("div",{...a,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":E,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":A,"data-testid":s,id:s,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:m,role:"separator",style:{flexBasis:"auto",cursor:O,...l,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}ht.displayName="Separator";exports.Group=dt;exports.Panel=pt;exports.Separator=ht;exports.SeparatorOverlay=Ie;exports.isCoarsePointer=ot;exports.useDefaultLayout=tn;exports.useGroupCallbackRef=on;exports.useGroupRef=rn;exports.usePanelCallbackRef=ln;exports.usePanelRef=un;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("react/jsx-runtime"),z=require("react");function bt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function xt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function zt(e){return e/100*window.innerHeight}function wt(e){return e/100*window.innerWidth}function Pt(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function re({groupSize:e,panelElement:t,styleProp:n}){let o;const[r,s]=Pt(n);switch(s){case"%":{o=r/100*e;break}case"px":{o=r;break}case"rem":{o=xt(t,r);break}case"em":{o=bt(t,r);break}case"vh":{o=zt(r);break}case"vw":{o=wt(r);break}}return o}function A(e){return parseFloat(e.toFixed(3))}function se({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,r)=>(o+=t==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,o),0)}function xe(e){const{panels:t}=e,n=se({group:e});return n===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:r,panelConstraints:s}=o;let i=0;if(s.collapsedSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:s.collapsedSize});i=A(f/n*100)}let c;if(s.collapsedThreshold!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:s.collapsedThreshold});c=A(f/n*100)}let u;if(s.defaultSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:s.defaultSize});u=A(f/n*100)}let a=0;if(s.minSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:s.minSize});a=A(f/n*100)}let l=100;if(s.maxSize!==void 0){const f=re({groupSize:n,panelElement:r,styleProp:s.maxSize});l=A(f/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:i,collapsedThreshold:c,collapsible:s.collapsible===!0,defaultSize:u,disabled:s.disabled,minSize:a,maxSize:l,panelId:o.id}})}class Ye{#e={};addListener(t,n){const o=this.#e[t];return o===void 0?this.#e[t]=[n]:o.includes(n)||o.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,n);else{let r=!1,s=null;const i=Array.from(o);for(let c=0;c<i.length;c++){const u=i[c];try{u.call(null,n)}catch(a){s===null&&(r=!0,s=a)}}if(r)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const r=o.indexOf(n);r>=0&&o.splice(r,1)}}}let D={cursorFlags:0,state:"inactive"};const we=new Ye;function X(){return D}function Je(e){return we.addListener("change",e)}function Lt(e,t=[],n){const o=D,r={...D};r.cursorFlags=e,r.state==="active"&&(r.previews=t,n&&(r.previewLayoutMap=n)),D=r,we.emit("change",{prev:o,next:r})}function W(e){const t=D;D=e,we.emit("change",{prev:t,next:e})}function Rt(e){D.state!=="active"||!D.previews.some(t=>t.separator===e)||W({...D,previews:D.previews.map(t=>t.separator===e?{...t}:t)})}function Ct(e){if(D.state==="inactive")return!1;const t=D.hitRegions.filter(o=>o.group!==e),n=D.state==="active"&&D.previews.some(o=>o.group===e);if(t.length===D.hitRegions.length&&!n)return!1;if(t.length===0)W({cursorFlags:0,state:"inactive"});else if(D.state==="active"){const o=new Map(D.initialLayoutMap),r=new Map(D.previewLayoutMap);o.delete(e),r.delete(e),W({...D,cursorFlags:0,hitRegions:t,initialLayoutMap:o,previewLayoutMap:r,previews:D.previews.filter(s=>s.group!==e)})}else W({...D,hitRegions:t});return!0}const Mt=e=>e,be=()=>{},Ze=1,Qe=2,et=4,tt=8,Oe=3,Ge=12;let pe;function Ae(){return pe===void 0&&(pe=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(pe=!0)),pe}function Et({cursorFlags:e,groups:t,state:n}){let o=0,r=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{r++;break}}})}if(!(o===0&&r===0)){switch(n){case"active":{if(e&&Ae()){const s=(e&Ze)!==0,i=(e&Qe)!==0,c=(e&et)!==0,u=(e&tt)!==0;if(s)return c?"se-resize":u?"ne-resize":"e-resize";if(i)return c?"sw-resize":u?"nw-resize":"w-resize";if(c)return"s-resize";if(u)return"n-resize"}break}}return Ae()?o>0&&r>0?"move":o>0?"ew-resize":"ns-resize":o>0&&r>0?"grab":o>0?"col-resize":"row-resize"}}const Fe=new WeakMap;function ue(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Fe.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));const o=X();switch(o.state){case"active":case"hover":{const r=Et({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(i=>i.group),state:o.state}),s=`*, *:hover {cursor: ${r} !important; }`;if(t===s)return;t=s,r?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Fe.set(e,{prevStyle:t,styleSheet:n})}function R(e,t="Assertion error"){if(!e)throw Error(t)}function ze(e,t){return Array.from(t).sort(e==="horizontal"?kt:It)}function kt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function It(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function nt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function ot(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function Tt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let r,s=Number.MAX_VALUE;for(const i of t){const{x:c,y:u}=ot(o,i),a=e==="horizontal"?c:u;a<s&&(s=a,r=i)}return R(r,"No rect found"),r}let he;function rt(){return he===void 0&&(typeof matchMedia=="function"?he=!!matchMedia("(pointer:coarse)").matches:he=!1),he}function Pe({expandHitTargets:e=!0,group:t,includeDisabled:n=!1}){const{element:o,orientation:r,panels:s,separators:i}=t,c=ze(r,Array.from(o.children).filter(nt).filter(m=>!m.hasAttribute("data-resize-preview")).map(m=>({element:m}))).map(({element:m})=>m),u=[];let a=!1,l=!1,f=-1,y,d=-1,p=0,h,v=[];{let m=-1;for(const g of c)g.hasAttribute("data-panel")&&(m++,g.hasAttribute("data-disabled")||(p++,f===-1&&(f=m),d=m))}if(n||p>1){let m=-1;for(const g of c)if(g.hasAttribute("data-panel")){m++;const x=s.find(b=>b.element===g);if(x){if(h){const b=h.element.getBoundingClientRect(),w=g.getBoundingClientRect();let k;if(l){const M=r==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),P=r==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(v.length){case 0:{k=[M,P];break}case 1:{const C=v[0],F=Tt({orientation:r,rects:[b,w],targetRect:C.element.getBoundingClientRect()});k=[C,F===b?P:M];break}default:{k=v;break}}}else v.length?k=v:k=[r==="horizontal"?new DOMRect(b.right,w.top,w.left-b.right,w.height):new DOMRect(w.left,b.bottom,w.width,w.top-b.bottom)];for(const M of k){let P="width"in M?M:M.element.getBoundingClientRect();const C=e?rt()?t.resizeTargetMinimumSize.coarse:t.resizeTargetMinimumSize.fine:0;if(P.width<C){const I=C-P.width;P=new DOMRect(P.x-I/2,P.y,P.width+I,P.height)}if(P.height<C){const I=C-P.height;P=new DOMRect(P.x,P.y-I/2,P.width,P.height+I)}const F=m<=f||m>d;(n||!a&&!F)&&(y??=se({group:t}),u.push({group:t,groupSize:y,panels:[h,x],separator:"width"in M?void 0:M,rect:P})),a=!1}}l=!1,h=x,v=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(a=!0);const x=i.find(b=>b.element===g);x?v.push(x):(h=void 0,v=[])}else l=!0}return u}let U=new Map;const it=new Ye;function Dt(e){U=new Map(U),U.delete(e)}function st(e,t){for(const[n]of U)if(n.id===e)return n}function Z(e,t){for(const[n,o]of U)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Q(){return U}function Le(e,t){return it.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function K(e,t,n){const o=U.get(e);U=new Map(U),U.set(e,t),it.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t})}function Ot(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function O(e,t,n=0){return Math.abs(A(e)-A(t))<=n}function B(e,t){return O(e,t)?0:e>t?1:-1}function ie({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:r=0,collapsedThreshold:s,collapsible:i,disabled:c,maxSize:u=100,minSize:a=0}=t;if(c&&!e)return n;if(B(o,a)<0)if(i){const l=s??(a-r)/2,f=B(n,r)<=0,y=f?r+l:a-l,d=B(o,y);B(o,r)<=0||d<0||s!==void 0&&f&&d===0?o=r:o=a}else o=a;return o=Math.min(u,o),o=A(o),o}function ce({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:r,trigger:s}){if(O(e,0))return t;const i=s==="imperative-api",c=n.map(({panelId:p})=>t[p]),u=n.map(({panelId:p})=>r[p]),a=[...c],[l,f]=o;R(l!=null,"Invalid first pivot index"),R(f!=null,"Invalid second pivot index");let y=0;switch(s){case"keyboard":{{const p=e<0?f:l,h=n[p];R(h,`Panel constraints not found for index ${p}`);const{collapsedSize:v=0,collapsible:m,minSize:g=0}=h;if(m){const x=c[p];if(R(x!=null,`Previous layout not found for panel index ${p}`),O(x,v)){const b=g-x;B(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}{const p=e<0?l:f,h=n[p];R(h,`No panel constraints found for index ${p}`);const{collapsedSize:v=0,collapsible:m,minSize:g=0}=h;if(m){const x=c[p];if(R(x!=null,`Previous layout not found for panel index ${p}`),O(x,g)){const b=x-v;B(b,Math.abs(e))>0&&(e=e<0?0-b:b)}}}break}default:{const p=e<0?f:l,h=n[p];R(h,`Panel constraints not found for index ${p}`);const v=c[p],{collapsedSize:m,collapsedThreshold:g,collapsible:x,minSize:b}=h;if(x&&B(v,b)<0){const w=b-m,k=g??w/2,M=v+Math.abs(e);if(B(M,b)<0){const P=B(Math.abs(e),k),C=g===void 0&&e<0;P>0||P===0&&C?e=e<0?-w:w:e=0}}break}}{const p=e<0?1:-1;let h=e<0?f:l,v=0;for(;;){const g=c[h];R(g!=null,`Previous layout not found for panel index ${h}`);const b=ie({overrideDisabledPanels:i,panelConstraints:n[h],prevSize:g,size:100})-g;if(v+=b,h+=p,h<0||h>=n.length)break}const m=Math.min(Math.abs(e),Math.abs(v));e=e<0?0-m:m}{let h=e<0?l:f;for(;h>=0&&h<n.length;){const v=Math.abs(e)-Math.abs(y),m=c[h];R(m!=null,`Previous layout not found for panel index ${h}`);const g=m-v,x=ie({overrideDisabledPanels:i,panelConstraints:n[h],prevSize:m,size:g});if(!O(m,x)&&(y+=m-x,a[h]=x,y.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(Ot(u,a))return r;{const p=e<0?f:l,h=c[p];R(h!=null,`Previous layout not found for panel index ${p}`);const v=h+y,m=ie({overrideDisabledPanels:i,panelConstraints:n[p],prevSize:h,size:v});if(a[p]=m,!O(m,v)){let g=v-m,b=e<0?f:l;for(;b>=0&&b<n.length;){const w=a[b];R(w!=null,`Previous layout not found for panel index ${b}`);const k=w+g,M=ie({overrideDisabledPanels:i,panelConstraints:n[b],prevSize:w,size:k});if(O(w,M)||(g-=M-w,a[b]=M),O(g,0))break;e>0?b--:b++}}}const d=Object.values(a).reduce((p,h)=>h+p,0);return O(d,100,.1)?a.reduce((p,h,v)=>(p[n[v].panelId]=h,p),{}):r}function q(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||B(e[n],t[n])!==0)return!1;return!0}function Re({commit:e,document:t,event:n,hitRegions:o,initialLayoutMap:r,mountedGroups:s,pointerDownAtPoint:i,prevCursorFlags:c}){let u=0;const a=X();let l=a.state==="active"?a.previews:[];const f=new Map(a.state==="active"?a.previewLayoutMap:void 0);o.forEach(d=>{const{group:p,groupSize:h}=d,{orientation:v,panels:m}=p;if(e&&p.resizePreviewMode!=="separator")return;const{disableCursor:g}=p.mutableState;let x=0;i?v==="horizontal"?x=(n.clientX-i.x)/h*100:x=(n.clientY-i.y)/h*100:v==="horizontal"?x=n.clientX<0?-100:100:x=n.clientY<0?-100:100;const b=r.get(p),w=s.get(p);if(!b||!w)return;const{defaultLayoutDeferred:k,derivedPanelConstraints:M,groupSize:P,layout:C,separatorToPanels:F}=w;if(M&&C&&F){const I=p.resizePreviewMode==="separator"?f.get(p)??C:C,E=ce({delta:x,initialLayout:b,panelConstraints:M,pivotIndices:d.panels.map(N=>m.indexOf(N)),prevLayout:I,trigger:"mouse-or-touch"});if(p.resizePreviewMode==="separator"&&!e&&!q(E,I)){f.set(p,E);let N=0;const _=m.map(S=>(N+=E[S.id]-b[S.id],N*(h/100)));l=l.map(S=>{if(S.group!==p)return S;const L=_[S.panelIndex];return L===S.offset?S:{...S,offset:L}})}if(q(E,I)&&x!==0&&!g)switch(v){case"horizontal":{u|=x<0?Ze:Qe;break}case"vertical":{u|=x<0?et:tt;break}}(p.resizePreviewMode!=="separator"||e)&&!q(E,C)&&K(d.group,{defaultLayoutDeferred:k,derivedPanelConstraints:M,groupSize:P,layout:E,separatorToPanels:F})}});let y=0;n.movementX===0?y|=c&Oe:y|=u&Oe,n.movementY===0?y|=c&Ge:y|=u&Ge,Lt(y,l,f),ue(t)}function at(e,t){const n=X(),o=Q();let r=!1;switch(n.state){case"active":Re({commit:!0,document:e,event:t,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:o,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags}),W({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(ue(e),r=!0,n.hitRegions.forEach(s=>{if(!o.has(s.group))return;const i=Z(s.group.id,!0);K(s.group,i,{isUserInteraction:!0})}))}return r}function Ne(e){e.defaultPrevented||at(e.currentTarget,e)}function Gt(e,t,n){let o,r={x:1/0,y:1/0};for(const s of t){const i=ot(n,s.rect);switch(e){case"horizontal":{i.x<=r.x&&(o=s,r=i);break}case"vertical":{i.y<=r.y&&(o=s,r=i);break}}}return o?{distance:r,hitRegion:o}:void 0}function At(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Ft(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:$e(e),b:$e(t)};let o;for(;n.a.at(-1)===n.b.at(-1);)o=n.a.pop(),n.b.pop();R(o,"Stacking order can only be calculated for elements with a common ancestor");const r={a:je(_e(n.a)),b:je(_e(n.b))};if(r.a===r.b){const s=o.childNodes,i={a:n.a.at(-1),b:n.b.at(-1)};let c=s.length;for(;c--;){const u=s[c];if(u===i.a)return 1;if(u===i.b)return-1}}return Math.sign(r.a-r.b)}const Nt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function _t(e){const t=getComputedStyle(lt(e)??e).display;return t==="flex"||t==="inline-flex"}function jt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||_t(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||Nt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _e(e){let t=e.length;for(;t--;){const n=e[t];if(R(n,"Missing node"),jt(n))return n}return null}function je(e){return e&&Number(getComputedStyle(e).zIndex)||0}function $e(e){const t=[];for(;e;)t.push(e),e=lt(e);return t}function lt(e){const{parentNode:t}=e;return At(t)?t.host:t}function $t(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ht({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!nt(n)||n.contains(e)||e.contains(n))return!0;if(Ft(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if($t(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function Ce(e,t){const n=[];return t.forEach((o,r)=>{if(r.disabled)return;const s=Pe({group:r}),i=Gt(r.orientation,s,{x:e.clientX,y:e.clientY});i&&i.distance.x<=0&&i.distance.y<=0&&Ht({groupElement:r.element,hitRegion:i.hitRegion.rect,pointerEventTarget:e.target})&&n.push(i.hitRegion)}),n}function te({layout:e,panelConstraints:t}){const n=t.map(({panelId:i})=>e[i]),o=[...n],r=o.reduce((i,c)=>i+c,0);if(Object.keys(e).length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${Object.values(e).map(i=>`${i}%`).join(", ")}`);if(!O(r,100)&&o.length>0)for(let i=0;i<t.length;i++){const c=o[i];R(c!=null,`No layout data found for index ${i}`);const u=100/r*c;o[i]=u}let s=0;for(let i=0;i<t.length;i++){const c=n[i];R(c!=null,`No layout data found for index ${i}`);const u=o[i];R(u!=null,`No layout data found for index ${i}`);const a=ie({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:c,size:u});u!=a&&(s+=u-a,o[i]=a)}if(!O(s,0))for(let i=0;i<t.length;i++){const c=o[i];R(c!=null,`No layout data found for index ${i}`);const u=c+s,a=ie({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:c,size:u});if(c!==a&&(s-=a-c,o[i]=a,O(s,0)))break}return o.reduce((i,c,u)=>(i[t[u].panelId]=c,i),{})}function ut({groupId:e,panelId:t}){const n=()=>{const u=Q();for(const[a,{defaultLayoutDeferred:l,derivedPanelConstraints:f,layout:y,groupSize:d,separatorToPanels:p}]of u)if(a.id===e)return{defaultLayoutDeferred:l,derivedPanelConstraints:f,group:a,groupSize:d,layout:y,separatorToPanels:p};throw Error(`Group ${e} not found`)},o=()=>{const u=n().derivedPanelConstraints.find(a=>a.panelId===t);if(u!==void 0)return u;throw Error(`Panel constraints not found for Panel ${t}`)},r=()=>{const u=n().group.panels.find(a=>a.id===t);if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const u=n().layout[t];if(u!==void 0)return u;throw Error(`Layout not found for Panel ${t}`)},i=({nextSize:u,panels:a,prevLayout:l,derivedPanelConstraints:f})=>{const y=s(),d=a.findIndex(m=>m.id===t),p=d===0,h=d===a.length-1;if(h&&u<y&&(p||a.slice(0,d).every((m,g)=>{const x=f[g];return x?.collapsible&&O(x.collapsedSize,l[x.panelId])}))){const m=a.slice(0,d).reduce((g,x)=>g+l[x.id],0);return{...l,[t]:A(100-m)}}return ce({delta:h?y-u:u-y,initialLayout:l,panelConstraints:f,pivotIndices:h?[d-1,d]:[d,d+1],prevLayout:l,trigger:"imperative-api"})},c=u=>{const a=s();if(u===a)return;const{defaultLayoutDeferred:l,derivedPanelConstraints:f,group:y,groupSize:d,layout:p,separatorToPanels:h}=n(),v=i({nextSize:u,panels:y.panels,prevLayout:p,derivedPanelConstraints:f}),m=te({layout:v,panelConstraints:f});q(p,m)||K(y,{defaultLayoutDeferred:l,derivedPanelConstraints:f,groupSize:d,layout:m,separatorToPanels:h})};return{collapse:()=>{const{collapsible:u,collapsedSize:a}=o(),{mutableValues:l}=r(),f=s();u&&f!==a&&(l.expandToSize=f,c(a))},expand:()=>{const{collapsible:u,collapsedSize:a,minSize:l}=o(),{mutableValues:f}=r(),y=s();if(u&&y===a){let d=f.expandToSize??l;d===0&&(d=1),c(d)}},getSize:()=>{const{group:u}=n(),a=s(),{element:l}=r(),f=u.orientation==="horizontal"?l.offsetWidth:l.offsetHeight;return{asPercentage:a,inPixels:f}},isCollapsed:()=>{const{collapsible:u,collapsedSize:a}=o(),l=s();return u&&O(a,l)},resize:u=>{const{group:a}=n(),{element:l}=r(),f=se({group:a}),y=re({groupSize:f,panelElement:l,styleProp:u}),d=A(y/f*100);c(d)}}}function He(e){if(e.defaultPrevented)return;const t=Q();Ce(e,t).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const r=o.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(r){const s=r.panelConstraints.defaultSize,i=ut({groupId:o.group.id,panelId:r.id});i&&s!==void 0&&(i.resize(s),e.preventDefault())}}})}function me(e){const t=Q();for(const[n]of t)if(n.separators.some(o=>o.element===e))return n;throw Error("Could not find parent Group for separator element")}function ct({groupId:e}){const t=()=>{const n=Q();for(const[o,r]of n)if(o.id===e)return{group:o,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:o}=t();return n?{}:o},setLayout(n){const{defaultLayoutDeferred:o,derivedPanelConstraints:r,group:s,groupSize:i,layout:c,separatorToPanels:u}=t(),a=te({layout:n,panelConstraints:r});return o?c:(q(c,a)||K(s,{defaultLayoutDeferred:o,derivedPanelConstraints:r,groupSize:i,layout:a,separatorToPanels:u}),a)}}}function ee(e,t){const n=me(e),o=Z(n.id,!0),r=n.separators.find(f=>f.element===e);R(r,"Matching separator not found");const s=o.separatorToPanels.get(r);R(s,"Matching panels not found");const i=s.map(f=>n.panels.indexOf(f)),u=ct({groupId:n.id}).getLayout(),a=ce({delta:t,initialLayout:u,panelConstraints:o.derivedPanelConstraints,pivotIndices:i,prevLayout:u,trigger:"keyboard"}),l=te({layout:a,panelConstraints:o.derivedPanelConstraints});q(u,l)||K(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:l,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ve(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=me(t);if(!(n.disabled||n.separators.find(r=>r.element===t)?.disabled))switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&ee(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&ee(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&ee(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&ee(t,-5);break}case"End":{e.preventDefault(),ee(t,100);break}case"Enter":{e.preventDefault();const r=me(t),s=Z(r.id,!0),{derivedPanelConstraints:i,layout:c,separatorToPanels:u}=s,a=r.separators.find(d=>d.element===t);R(a,"Matching separator not found");const l=u.get(a);R(l,"Matching panels not found");const f=l[0],y=i.find(d=>d.panelId===f.id);if(R(y,"Panel metadata not found"),y.collapsible){const d=c[f.id],p=y.collapsedSize===d?r.mutableState.expandedPanelSizes[f.id]??y.minSize:y.collapsedSize;ee(t,p-d)}break}case"F6":{e.preventDefault();const s=me(t).separators.map(a=>a.element),i=Array.from(s).findIndex(a=>a===e.currentTarget);R(i!==null,"Index not found");const c=e.shiftKey?i>0?i-1:s.length-1:i+1<s.length?i+1:0;s[c].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),ee(t,-100);break}}}function Vt(e,t){const{element:n,orientation:o,panels:r}=e,s=n.getBoundingClientRect(),i=o==="horizontal";return Pe({expandHitTargets:!1,group:e,includeDisabled:!0}).map(({panels:u,rect:a,separator:l},f)=>{const y=r.indexOf(u[0]),d=i?a.left+a.width/2:a.top+a.height/2;return{active:t.some(h=>{if(h.group!==e||h.panels[0]!==u[0])return!1;if(l||h.separator)return h.separator===l;const v=i?h.rect.left+h.rect.width/2:h.rect.top+h.rect.height/2;return O(d,v)}),group:e,key:l?`separator-${l.id}`:`panel-${u[0].id}-${f}`,offset:0,panelIndex:y,rect:new DOMRect((i&&!l?d:a.left)-s.left-n.clientLeft+n.scrollLeft,(!i&&!l?d:a.top)-s.top-n.clientTop+n.scrollTop,i&&!l?0:a.width,!i&&!l?0:a.height),separator:l}})}function Be(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=Q(),n=Ce(e,t);if(n.length===0)return;const o=new Map;let r=!1;n.forEach(i=>{i.separator&&(r||(r=!0,i.separator.element.focus({focusVisible:!1,preventScroll:!0})));const c=t.get(i.group);c&&o.set(i.group,c.layout)});const s=Array.from(o.keys()).flatMap(i=>i.resizePreviewMode==="separator"?Vt(i,n):[]);W({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},previewLayoutMap:new Map(o),previews:s,state:"active"}),e.preventDefault()}function Ue(e){const t=Q(),n=X();switch(n.state){case"active":Re({commit:!1,document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function We(e){if(e.defaultPrevented)return;const t=X(),n=Q();switch(t.state){case"active":{if(e.buttons===0){t.previewLayoutMap.forEach((o,r)=>{const s=n.get(r);r.resizePreviewMode==="separator"&&s&&!q(o,s.layout)&&K(r,{...s,layout:o})}),W({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{if(!n.has(o.group))return;const r=Z(o.group.id,!0);K(o.group,r,{isUserInteraction:!0})}),ue(e.currentTarget);return}for(const o of t.hitRegions)if(o.separator){const{element:r}=o.separator;r.isConnected&&!r.hasPointerCapture?.(e.pointerId)&&r.setPointerCapture?.(e.pointerId)}Re({commit:!1,document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=Ce(e,n);o.length===0?t.state!=="inactive"&&W({cursorFlags:0,state:"inactive"}):W({cursorFlags:0,hitRegions:o,state:"hover"}),ue(e.currentTarget);break}}}function qe(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(X().state){case"hover":W({cursorFlags:0,state:"inactive"})}}function Ke(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;at(e.currentTarget,e)&&e.preventDefault()}function Bt(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const i=A(s.defaultSize);n+=i,o[s.panelId]=i}else o[s.panelId]=void 0;const r=e.length-t;if(r!==0){const s=A((100-n)/r);for(const i of e)i.defaultSize===void 0&&(o[i.panelId]=s)}return o}function Ut(e,t){const n=e.map(r=>r.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const r of n)if(!o.includes(r))return!1;return!0}function Xe({group:e,panelConstraints:t}){const n=e.panels.map(({id:r})=>r).join(","),o=e.mutableState.defaultLayout;return e.mutableState.layouts[n]??(o&&Ut(e.panels,o)?o:Bt(t))}function Wt(e,t,n){if(!n[0])return;const r=e.panels.find(a=>a.element===t);if(!r||!r.onResize)return;const s=se({group:e}),i=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,c=r.mutableValues.prevSize,u={asPercentage:A(i/s*100),inPixels:i};r.mutableValues.prevSize=u,r.onResize(u,r.id,c)}function ft(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const o in e)if(e[o]!==t[o])return!1;return!0}function qt(e,t){return e.length!==t.length?!1:e.every((n,o)=>ft(n,t[o]))}function Kt({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let r=0,s=0,i=!1;const c=new Map,u=[];for(const f of e.panels){const y=o[f.id]??0;switch(f.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{i=!0;const d=y/100*n,p=A(d/t*100);c.set(f.id,p),r+=p;break}case"preserve-relative-size":default:{u.push(f.id),s+=y;break}}}if(!i||u.length===0)return o;const a=100-r,l={...o};if(c.forEach((f,y)=>{l[y]=f}),s>0)for(const f of u){const y=o[f]??0;l[f]=A(y/s*a)}else{const f=A(a/u.length);for(const y of u)l[y]=f}return l}const oe=new Map;function Xt(e){let t=!0;R(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,r=new Set,s=new n(d=>{for(const p of d){const{borderBoxSize:h,target:v}=p;if(v===e.element){if(t){const m=se({group:e});if(m===0)return;const g=Z(e.id);if(!g)return;const x=xe(e),b=g.defaultLayoutDeferred?Xe({group:e,panelConstraints:x}):g.layout,w=Kt({group:e,nextGroupSize:m,prevGroupSize:g.groupSize,prevLayout:b}),k=te({layout:w,panelConstraints:x});if(!g.defaultLayoutDeferred&&q(g.layout,k)&&qt(g.derivedPanelConstraints,x)&&g.groupSize===m)continue;K(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:x,groupSize:m,layout:k,separatorToPanels:g.separatorToPanels})}}else Wt(e,v,h)}});s.observe(e.element),e.panels.forEach(d=>{R(!o.has(d.id),`Panel ids must be unique; id "${d.id}" was used more than once`),o.add(d.id),d.onResize&&s.observe(d.element)});const i=se({group:e}),c=xe(e),u=Xe({group:e,panelConstraints:c}),a=te({layout:u,panelConstraints:c}),l=e.element.ownerDocument;oe.set(l,(oe.get(l)??0)+1);const f=new Map;return Pe({group:e,includeDisabled:!0}).forEach(d=>{d.separator&&f.set(d.separator,d.panels)}),K(e,{defaultLayoutDeferred:i===0,derivedPanelConstraints:c,groupSize:i,layout:a,separatorToPanels:f}),e.separators.forEach(d=>{R(!r.has(d.id),`Separator ids must be unique; id "${d.id}" was used more than once`),r.add(d.id),d.element.addEventListener("keydown",Ve)}),oe.get(l)===1&&(l.addEventListener("contextmenu",Ne,!0),l.addEventListener("dblclick",He,!0),l.addEventListener("pointerdown",Be,!0),l.addEventListener("pointerleave",Ue),l.addEventListener("pointermove",We),l.addEventListener("pointerout",qe),l.addEventListener("pointerup",Ke,!0)),function(){t=!1,oe.set(l,Math.max(0,(oe.get(l)??0)-1)),Dt(e),Ct(e)&&ue(l),e.separators.forEach(p=>{p.element.removeEventListener("keydown",Ve)}),oe.get(l)||(l.removeEventListener("contextmenu",Ne,!0),l.removeEventListener("dblclick",He,!0),l.removeEventListener("pointerdown",Be,!0),l.removeEventListener("pointerleave",Ue),l.removeEventListener("pointermove",We),l.removeEventListener("pointerout",qe),l.removeEventListener("pointerup",Ke,!0)),s.disconnect()}}function Yt(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function Me(e){const t=z.useId();return`${e??t}`}const V=typeof window<"u"?z.useLayoutEffect:z.useEffect;function le(e){const t=z.useRef(e);return V(()=>{t.current=e},[e]),z.useCallback((...n)=>t.current?.(...n),[t])}function Ee(...e){return le(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function ke(e){const t=z.useRef({...e});return V(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const dt=z.createContext(null);function Jt({separator:e}){const{element:t}=e,n=z.useRef(null);return V(()=>{const o=t.cloneNode(!0),r=[t,...t.querySelectorAll("*")],s=[o,...o.querySelectorAll("*")],i=t.ownerDocument.defaultView;return r.forEach((c,u)=>{const a=s[u];if(a instanceof i.HTMLElement||a instanceof i.SVGElement){const l=i.getComputedStyle(c);for(let f=0;f<l.length;f++){const y=l.item(f);a.style.setProperty(y,l.getPropertyValue(y))}}a.removeAttribute("data-testid"),a.removeAttribute("id")}),Object.assign(o.style,{boxSizing:"border-box",height:"100%",margin:"0",position:"static",transform:"none",width:"100%"}),n.current.appendChild(o),()=>o.remove()},[t]),H.jsx("div",{ref:n,style:{height:"100%",opacity:.65,pointerEvents:"none",width:"100%"}})}function ye(){const e=z.useContext(dt);return R(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Ie(e){const{registerOverlay:t}=ye(),n=z.useRef(e);ft(n.current,e)||(n.current=e);const o=n.current;return V(()=>t(o),[t,o]),null}Ie.displayName="SeparatorOverlay";function Zt({active:e,orientation:t,style:n,...o}){let r;switch(t){case"horizontal":{r={height:"100%",minWidth:"1px"};break}case"vertical":{r={minHeight:"1px",width:"100%"};break}}return H.jsx("div",{...o,"data-separator-overlay":e?"active":"inactive",style:{...r,...n,flexShrink:0,pointerEvents:"none"}})}function Qt({overlay:e,preview:t}){const{group:n,offset:o,rect:r,separator:s}=t,i=n.orientation==="horizontal";let c=s?.preview,u=e;return z.isValidElement(c)&&c.type===Ie&&(u=c.props,c=void 0),c==null&&(u?c=H.jsx(Zt,{...u,active:t.active,orientation:n.orientation}):s&&(c=H.jsx(Jt,{separator:s}))),H.jsx("div",{"aria-hidden":"true","data-resize-preview":!0,inert:!0,style:{height:r.height,left:r.left,pointerEvents:"none",position:"absolute",top:r.top,transform:i?`translateX(${o}px)`:`translateY(${o}px)`,width:r.width},children:c})}function en(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:Mt});z.useImperativeHandle(t,()=>n.current,[]),V(()=>{Object.assign(n.current,ct({groupId:e}))})}function tn({groupId:e,resizePreviewMode:t}){const[n,o]=z.useState([]),r=z.useRef(n);return V(()=>{const s=c=>{const u=st(e),a=t==="separator"&&c.state==="active"?c.previews.filter(f=>f.group===u&&(f.active||!O(f.offset,0))):[],l=r.current;l.length===a.length&&a.every((f,y)=>f===l[y])||(r.current=a,o(a))};if(t!=="separator"){s(X());return}const i=Je(({next:c})=>s(c));return s(X()),i},[e,t]),n}function pt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:r,elementRef:s,groupRef:i,id:c,onLayoutChange:u,onLayoutChanged:a,orientation:l="horizontal",resizePreviewMode:f="panel",resizeTargetMinimumSize:y={coarse:20,fine:10},style:d,...p}){const h=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),v=le(S=>{q(h.current.onLayoutChange,S)||(h.current.onLayoutChange=S,u?.(S))}),m=le((S,L)=>{q(h.current.onLayoutChanged,S)||(h.current.onLayoutChanged=S,a?.(S,{isUserInteraction:L}))}),g=Me(c),[x,b]=z.useState(),w=tn({groupId:g,resizePreviewMode:f}),k=z.useRef(null),[M,P]=Yt(),C=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],separators:[]}),F=Ee(k,s);en(g,i);const I=le((S,L)=>{const T=Z(S);if(T)return{flexGrow:T.layout[L]??1};if(n?.[L])return{flexGrow:n?.[L]}}),E=ke({defaultLayout:n,disableCursor:o,resizeTargetMinimumSize:y}),N=z.useMemo(()=>({get disableCursor(){return!!E.disableCursor},getPanelStyles:I,id:g,orientation:l,registerPanel:S=>{const L=C.current;return L.panels=ze(l,[...L.panels,S]),P(),()=>{L.panels=L.panels.filter(T=>T!==S),P()}},registerOverlay:S=>(b(S),()=>{b(void 0)}),registerSeparator:S=>{const L=C.current;return L.separators=ze(l,[...L.separators,S]),P(),()=>{L.separators=L.separators.filter(T=>T!==S),P()}},updatePanelProps:(S,{disabled:L})=>{const G=C.current.panels.find(ne=>ne.id===S);G&&(G.panelConstraints.disabled=L);const j=st(g),Y=Z(g);j&&Y&&K(j,{...Y,derivedPanelConstraints:xe(j)})},updateSeparatorProps:(S,{disabled:L,disableDoubleClick:T})=>{const j=C.current.separators.find(Y=>Y.id===S);j&&(j.disabled=L,j.disableDoubleClick=T)}}),[I,g,P,l,E]),_=z.useRef(null);return V(()=>{const S=k.current;if(S===null)return;const L=C.current;let T;if(E.defaultLayout!==void 0&&Object.keys(E.defaultLayout).length===L.panels.length){T={};for(const J of L.panels){const fe=E.defaultLayout[J.id];fe!==void 0&&(T[J.id]=fe)}}const G={disabled:!!r,element:S,id:g,mutableState:{defaultLayout:T,disableCursor:!!E.disableCursor,expandedPanelSizes:C.current.lastExpandedPanelSizes,layouts:C.current.layouts},orientation:l,panels:L.panels,resizePreviewMode:f,get resizeTargetMinimumSize(){return E.resizeTargetMinimumSize},separators:L.separators};_.current=G;const j=Xt(G),{defaultLayoutDeferred:Y,derivedPanelConstraints:ne,layout:ae}=Z(G.id,!0);!Y&&ne.length>0&&(v(ae),m(ae,!1));const ve=Le(g,J=>{const{defaultLayoutDeferred:fe,derivedPanelConstraints:Te,layout:de}=J.next;if(fe||Te.length===0)return;const gt=G.panels.map(({id:$})=>$).join(",");G.mutableState.layouts[gt]=de,Te.forEach($=>{if($.collapsible){const{layout:Se}=J.prev??{};if(Se){const vt=O($.collapsedSize,de[$.panelId]),St=O($.collapsedSize,Se[$.panelId]);vt&&!St&&(G.mutableState.expandedPanelSizes[$.panelId]=Se[$.panelId])}}});const De=X(),yt=De.state!=="active"||!De.hitRegions.some($=>$.group===G);v(de),yt&&m(de,J.isUserInteraction)});return()=>{_.current=null,j(),ve()}},[r,g,m,v,l,M,f,E]),z.useEffect(()=>{const S=_.current;S&&(S.mutableState.defaultLayout=n,S.mutableState.disableCursor=!!o)}),H.jsx(dt.Provider,{value:N,children:H.jsxs("div",{...p,className:t,"data-group":!0,"data-testid":g,id:g,ref:F,style:{height:"100%",width:"100%",overflow:"hidden",position:f==="separator"?"relative":void 0,...d,display:"flex",flexDirection:l==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:l==="horizontal"?"pan-y":"pan-x"},children:[e,w.map(S=>H.jsx(Qt,{overlay:x,preview:S},S.key))]})})}pt.displayName="Group";function ge(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function nn({id:e,panelIds:t,storage:n}){const o=ge(e,[]),r=n.getItem(o);if(r)try{const s=JSON.parse(r);if(t){const i=t.join(","),c=s[i];if(c&&Array.isArray(c.layout)&&t.length===c.layout.length){const u={};for(let a=0;a<t.length;a++)u[t[a]]=c.layout[a];return u}}else{const i=Object.keys(s);if(i.length===1){const c=s[i[0]];if(c&&Array.isArray(c.layout)){const u=i[0].split(",");if(u.length===c.layout.length){const a={};for(let l=0;l<u.length;l++)a[u[l]]=c.layout[l];return a}}}}}catch{}}function on({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...r}){const s=n!==void 0,i="id"in r?r.id:r.groupId,c=ge(i,n??[]),u=z.useSyncExternalStore(rn,()=>o.getItem(c),()=>o.getItem(c)),a=z.useMemo(()=>{if(u){const v=JSON.parse(u),m=Object.values(v);if(Array.from(m).every(g=>typeof g=="number"))return v}},[u]),l=z.useMemo(()=>{if(!a)return nn({id:i,panelIds:n,storage:o})},[a,i,n,o]),f=a??l,y=z.useRef(null),d=z.useCallback(()=>{const v=y.current;v&&(y.current=null,clearTimeout(v))},[]);z.useLayoutEffect(()=>()=>{d()},[d]);const p=z.useCallback((v,m)=>{if(t&&!m.isUserInteraction)return;d();let g;s?g=ge(i,Object.keys(v)):g=ge(i,[]);try{o.setItem(g,JSON.stringify(v))}catch(x){console.error(x)}},[d,s,i,t,o]),h=z.useCallback(v=>{d(),e===0?p(v,{isUserInteraction:!1}):y.current=setTimeout(()=>{p(v,{isUserInteraction:!1})},e)},[d,e,p]);return{defaultLayout:f,onLayoutChange:h,onLayoutChanged:p}}function rn(){return function(){}}function sn(){return z.useState(null)}function an(){return z.useRef(null)}function ln(e,t){const{id:n}=ye(),o=z.useRef({collapse:be,expand:be,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:be});z.useImperativeHandle(t,()=>o.current,[]),V(()=>{Object.assign(o.current,ut({groupId:n,panelId:e}))})}function ht({children:e,className:t,collapsedSize:n="0%",collapsedThreshold:o,collapsible:r=!1,defaultSize:s,disabled:i,elementRef:c,groupResizeBehavior:u="preserve-relative-size",id:a,maxSize:l="100%",minSize:f="0%",onResize:y,panelRef:d,style:p,...h}){const v=!!a,m=Me(a),g=ke({disabled:i}),x=z.useRef(null),b=Ee(x,c),{getPanelStyles:w,id:k,orientation:M,registerPanel:P,updatePanelProps:C}=ye(),F=y!==null,I=le((S,L,T)=>{y?.(S,a,T)});V(()=>{const S=x.current;if(S!==null){const L={element:S,id:m,idIsStable:v,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:F?I:void 0,panelConstraints:{groupResizeBehavior:u,collapsedSize:n,collapsedThreshold:o,collapsible:r,defaultSize:s,disabled:g.disabled,maxSize:l,minSize:f}};return P(L)}},[u,n,o,r,s,F,m,v,l,f,I,P,g]),z.useEffect(()=>{C(m,{disabled:i})},[i,m,C]),ln(m,d);const E=()=>{const S=w(k,m);if(S)return JSON.stringify(S)},N=z.useSyncExternalStore(S=>Le(k,S),E,E);let _;return N?_=JSON.parse(N):s!==void 0?_={flexGrow:void 0,flexShrink:void 0,flexBasis:s}:_={flexGrow:1},H.jsx("div",{...h,"data-disabled":i||void 0,"data-panel":!0,"data-testid":m,id:m,ref:b,style:{...un,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",..._},children:H.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...p,touchAction:M==="horizontal"?"pan-y":"pan-x"},children:e})})}ht.displayName="Panel";const un={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function cn(){return z.useState(null)}function fn(){return z.useRef(null)}function dn({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let r,s;const i=e[n],c=t.find(u=>u.panelId===n);if(c){const u=c.maxSize,a=c.collapsible?c.collapsedSize:c.minSize,l=[o,o+1];s=te({layout:ce({delta:a-i,initialLayout:e,panelConstraints:t,pivotIndices:l,prevLayout:e}),panelConstraints:t})[n],r=te({layout:ce({delta:u-i,initialLayout:e,panelConstraints:t,pivotIndices:l,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:r,valueMin:s,valueNow:i}}function mt({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:r,id:s,preview:i,style:c,...u}){const a=Me(s),l=ke({disabled:n,disableDoubleClick:o,children:e,className:t,preview:i,style:c}),[f,y]=z.useState({}),[d,p]=z.useState("inactive"),[h,v]=z.useState(!1),m=z.useRef(null),g=z.useRef(null),x=Ee(m,r),{disableCursor:b,id:w,orientation:k,registerSeparator:M,updateSeparatorProps:P}=ye(),C=k==="horizontal"?"vertical":"horizontal";V(()=>{const E=m.current;if(E!==null){const N={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:E,id:a,get children(){return l.children},get className(){return l.className},get preview(){return l.preview},get style(){return l.style}};g.current=N;const _=M(N),S=Je(T=>{p(T.next.state!=="inactive"&&T.next.hitRegions.some(G=>G.separator===N)?T.next.state:"inactive")}),L=Le(w,T=>{const{derivedPanelConstraints:G,layout:j,separatorToPanels:Y}=T.next,ne=Y.get(N);if(ne){const ae=ne[0],ve=G.findIndex(J=>J.panelId===ae.id);y(dn({layout:j,panelConstraints:G,panelId:ae.id,panelIndex:ve}))}});return()=>{g.current=null,S(),L(),_()}}},[w,a,M,l]),V(()=>{const E=g.current;E&&Rt(E)},[i]),z.useEffect(()=>{P(a,{disabled:n,disableDoubleClick:o})},[n,o,a,P]);let F;n&&!b&&(F="not-allowed");let I;if(n)I="disabled";else switch(d){case"active":{I="active";break}default:h?I="focus":I=d}return H.jsx("div",{...u,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":I,"data-testid":a,id:a,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:x,role:"separator",style:{flexBasis:"auto",cursor:F,...c,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}mt.displayName="Separator";exports.Group=pt;exports.Panel=ht;exports.Separator=mt;exports.SeparatorOverlay=Ie;exports.isCoarsePointer=rt;exports.useDefaultLayout=on;exports.useGroupCallbackRef=sn;exports.useGroupRef=an;exports.usePanelCallbackRef=cn;exports.usePanelRef=fn;
2
2
  //# sourceMappingURL=react-resizable-panels.cjs.map