react-resizable-panels 4.12.4 → 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.
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
77
77
|
<tr>
|
|
78
78
|
<td>style</td>
|
|
79
79
|
<td><p>CSS properties.</p>
|
|
80
|
-
<p>⚠️ The
|
|
80
|
+
<p>⚠️ The default inline styles cannot be overridden, except for <a href="https://react-resizable-panels.vercel.app/examples/overflow"><code>overflow</code></a>.</p>
|
|
81
81
|
</td>
|
|
82
82
|
</tr>
|
|
83
83
|
<tr>
|
|
@@ -135,6 +135,14 @@ This method is recommended when saving layouts to some storage api.</p>
|
|
|
135
135
|
The <code>isUserInteraction</code> attribute signals whether the resize was caused by direct user input.
|
|
136
136
|
It is true for resizes caused by pointer or keyboard input
|
|
137
137
|
and false for other triggers (e.g. imperative API calls, initial mount, etc.)</p>
|
|
138
|
+
</td>
|
|
139
|
+
</tr>
|
|
140
|
+
<tr>
|
|
141
|
+
<td>resizePreviewMode</td>
|
|
142
|
+
<td><p>Controls whether pointer dragging updates <code>Panel</code>s sizes immediately,
|
|
143
|
+
or renders overlay separator previews until the pointer is released.</p>
|
|
144
|
+
<p>Defaults to <code>"panel"</code> (immediate resizing); <code>"separator"</code> defers resizing until release.</p>
|
|
145
|
+
<p>Customize previews using the <code>SeparatorOverlay</code> component.</p>
|
|
138
146
|
</td>
|
|
139
147
|
</tr>
|
|
140
148
|
<tr>
|
|
@@ -223,12 +231,27 @@ Falls back to <code>useId</code> when not provided.</p>
|
|
|
223
231
|
<tr>
|
|
224
232
|
<td>style</td>
|
|
225
233
|
<td><p>CSS properties.</p>
|
|
226
|
-
<p>⚠️
|
|
234
|
+
<p>⚠️ The default inline styles cannot be overridden, except for <a href="https://react-resizable-panels.vercel.app/examples/overflow"><code>overflow</code></a>.</p>
|
|
227
235
|
</td>
|
|
228
236
|
</tr>
|
|
229
237
|
<tr>
|
|
230
238
|
<td>collapsedSize</td>
|
|
231
239
|
<td><p>Panel size when collapsed; defaults to 0%.</p>
|
|
240
|
+
</td>
|
|
241
|
+
</tr>
|
|
242
|
+
<tr>
|
|
243
|
+
<td>collapsedThreshold</td>
|
|
244
|
+
<td><p>Distance a collapsible panel must be resized past its <code>minSize</code> to collapse,
|
|
245
|
+
or past its <code>collapsedSize</code> to expand.
|
|
246
|
+
Defaults to half the distance between <code>collapsedSize</code> and <code>minSize</code>.</p>
|
|
247
|
+
<p>For example if a panel declares <code>collapsedSize="5%"</code>, <code>collapsedThreshold="5%"</code>, and <code>minSize="25%"</code>,
|
|
248
|
+
it will collapse when resized below 20% and expands when resized above 10%.</p>
|
|
249
|
+
<p>ℹ️ Interpretation rules:</p>
|
|
250
|
+
<ul>
|
|
251
|
+
<li>Numbers are interpreted as pixels (e.g. <code>minSize={200}</code> is 200 pixels)</li>
|
|
252
|
+
<li>Strings without explicit units are interpreted as percentage (e.g. <code>minSize="50"</code> is 50 percent)</li>
|
|
253
|
+
<li>Use explicit units (e.g. "px", "%", "em", "rem", "vh", or "vw") to change interpretation</li>
|
|
254
|
+
</ul>
|
|
232
255
|
</td>
|
|
233
256
|
</tr>
|
|
234
257
|
<tr>
|
|
@@ -392,6 +415,11 @@ To prevent a panel from being resized at all, it needs to also be disabled.</p>
|
|
|
392
415
|
<tr>
|
|
393
416
|
<td>elementRef</td>
|
|
394
417
|
<td><p>Ref attached to the root <code>HTMLDivElement</code>.</p>
|
|
418
|
+
</td>
|
|
419
|
+
</tr>
|
|
420
|
+
<tr>
|
|
421
|
+
<td>preview</td>
|
|
422
|
+
<td><p>Overrides the <code>Group</code> default preview for this <code>Separator</code> when <code>resizePreviewMode</code> is "separator".</p>
|
|
395
423
|
</td>
|
|
396
424
|
</tr>
|
|
397
425
|
</tbody>
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ie=require("react/jsx-runtime"),z=require("react");function dt(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function pt(e,t){const n=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(n.fontSize);return t*o}function ht(e){return e/100*window.innerHeight}function mt(e){return e/100*window.innerWidth}function gt(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 ne({groupSize:e,panelElement:t,styleProp:n}){let o;const[i,s]=gt(n);switch(s){case"%":{o=i/100*e;break}case"px":{o=i;break}case"rem":{o=pt(t,i);break}case"em":{o=dt(t,i);break}case"vh":{o=ht(i);break}case"vw":{o=mt(i);break}}return o}function O(e){return parseFloat(e.toFixed(3))}function te({group:e}){const{orientation:t,panels:n}=e;return n.reduce((o,i)=>(o+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,o),0)}function ge(e){const{panels:t}=e,n=te({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:i,panelConstraints:s}=o;let u=0;if(s.collapsedSize!==void 0){const c=ne({groupSize:n,panelElement:i,styleProp:s.collapsedSize});u=O(c/n*100)}let a;if(s.defaultSize!==void 0){const c=ne({groupSize:n,panelElement:i,styleProp:s.defaultSize});a=O(c/n*100)}let r=0;if(s.minSize!==void 0){const c=ne({groupSize:n,panelElement:i,styleProp:s.minSize});r=O(c/n*100)}let l=100;if(s.maxSize!==void 0){const c=ne({groupSize:n,panelElement:i,styleProp:s.maxSize});l=O(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:u,collapsible:s.collapsible===!0,defaultSize:a,disabled:s.disabled,minSize:r,maxSize:l,panelId:o.id}})}function R(e,t="Assertion error"){if(!e)throw Error(t)}function ye(e,t){return Array.from(t).sort(e==="horizontal"?yt:St)}function yt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function St(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function Ve(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function Ue(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 vt({orientation:e,rects:t,targetRect:n}){const o={x:n.x+n.width/2,y:n.y+n.height/2};let i,s=Number.MAX_VALUE;for(const u of t){const{x:a,y:r}=Ue(o,u),l=e==="horizontal"?a:r;l<s&&(s=l,i=u)}return R(i,"No rect found"),i}let ce;function Be(){return ce===void 0&&(typeof matchMedia=="function"?ce=!!matchMedia("(pointer:coarse)").matches:ce=!1),ce}function We(e){const{element:t,orientation:n,panels:o,separators:i}=e,s=ye(n,Array.from(t.children).filter(Ve).map(x=>({element:x}))).map(({element:x})=>x),u=[];let a=!1,r=!1,l=-1,c=-1,m=0,p,S=[];{let x=-1;for(const f of s)f.hasAttribute("data-panel")&&(x++,f.hasAttribute("data-disabled")||(m++,l===-1&&(l=x),c=x))}if(m>1){let x=-1;for(const f of s)if(f.hasAttribute("data-panel")){x++;const d=o.find(h=>h.element===f);if(d){if(p){const h=p.element.getBoundingClientRect(),y=f.getBoundingClientRect();let b;if(r){const v=n==="horizontal"?new DOMRect(h.right,h.top,0,h.height):new DOMRect(h.left,h.bottom,h.width,0),g=n==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(S.length){case 0:{b=[v,g];break}case 1:{const L=S[0],M=vt({orientation:n,rects:[h,y],targetRect:L.element.getBoundingClientRect()});b=[L,M===h?g:v];break}default:{b=S;break}}}else S.length?b=S:b=[n==="horizontal"?new DOMRect(h.right,y.top,y.left-h.right,y.height):new DOMRect(y.left,h.bottom,y.width,y.top-h.bottom)];for(const v of b){let g="width"in v?v:v.element.getBoundingClientRect();const L=Be()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(g.width<L){const C=L-g.width;g=new DOMRect(g.x-C/2,g.y,g.width+C,g.height)}if(g.height<L){const C=L-g.height;g=new DOMRect(g.x,g.y-C/2,g.width,g.height+C)}const M=x<=l||x>c;!a&&!M&&u.push({group:e,groupSize:te({group:e}),panels:[p,d],separator:"width"in v?void 0:v,rect:g}),a=!1}}r=!1,p=d,S=[]}}else if(f.hasAttribute("data-separator")){f.ariaDisabled!==null&&(a=!0);const d=i.find(h=>h.element===f);d?S.push(d):(p=void 0,S=[])}else r=!0}return u}class Ke{#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 i=!1,s=null;const u=Array.from(o);for(let a=0;a<u.length;a++){const r=u[a];try{r.call(null,n)}catch(l){s===null&&(i=!0,s=l)}}if(i)throw s}}removeAllListeners(){this.#e={}}removeListener(t,n){const o=this.#e[t];if(o!==void 0){const i=o.indexOf(n);i>=0&&o.splice(i,1)}}}let Q={cursorFlags:0,state:"inactive"};const Se=new Ke;function W(){return Q}function bt(e){return Se.addListener("change",e)}function xt(e){const t=Q,n={...Q};n.cursorFlags=e,Q=n,Se.emit("change",{prev:t,next:n})}function ee(e){const t=Q;Q=e,Se.emit("change",{prev:t,next:e})}const zt=e=>e,me=()=>{},qe=1,Xe=2,Ye=4,Je=8,Ce=3,Re=12;let fe;function Ee(){return fe===void 0&&(fe=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(fe=!0)),fe}function Pt({cursorFlags:e,groups:t,state:n}){let o=0,i=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{o++;break}case"vertical":{i++;break}}})}if(!(o===0&&i===0)){switch(n){case"active":{if(e&&Ee()){const s=(e&qe)!==0,u=(e&Xe)!==0,a=(e&Ye)!==0,r=(e&Je)!==0;if(s)return a?"se-resize":r?"ne-resize":"e-resize";if(u)return a?"sw-resize":r?"nw-resize":"w-resize";if(a)return"s-resize";if(r)return"n-resize"}break}}return Ee()?o>0&&i>0?"move":o>0?"ew-resize":"ns-resize":o>0&&i>0?"grab":o>0?"col-resize":"row-resize"}}const Me=new WeakMap;function ve(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:n}=Me.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=W();switch(o.state){case"active":case"hover":{const i=Pt({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),s=`*, *:hover {cursor: ${i} !important; }`;if(t===s)return;t=s,i?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}}Me.set(e,{prevStyle:t,styleSheet:n})}let F=new Map;const Ze=new Ke;function wt(e){F=new Map(F),F.delete(e)}function ke(e,t){for(const[n]of F)if(n.id===e)return n}function H(e,t){for(const[n,o]of F)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function V(){return F}function be(e,t){return Ze.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function $(e,t,n){const o=F.get(e);F=new Map(F),F.set(e,t),Ze.emit("groupChange",{group:e,isUserInteraction:n?.isUserInteraction===!0,prev:o,next:t})}function Qe(e){const t=W(),n=V();let o=!1;switch(t.state){case"active":ee({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(ve(e),o=!0,t.hitRegions.forEach(i=>{if(!n.has(i.group))return;const s=H(i.group.id,!0);$(i.group,s,{isUserInteraction:!0})}))}return o}function Ie(e){e.defaultPrevented||Qe(e.currentTarget)}function Lt(e,t,n){let o,i={x:1/0,y:1/0};for(const s of t){const u=Ue(n,s.rect);switch(e){case"horizontal":{u.x<=i.x&&(o=s,i=u);break}case"vertical":{u.y<=i.y&&(o=s,i=u);break}}}return o?{distance:i,hitRegion:o}:void 0}function Ct(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Rt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Oe(e),b:Oe(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 i={a:Te(De(n.a)),b:Te(De(n.b))};if(i.a===i.b){const s=o.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let a=s.length;for(;a--;){const r=s[a];if(r===u.a)return 1;if(r===u.b)return-1}}return Math.sign(i.a-i.b)}const Et=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Mt(e){const t=getComputedStyle(et(e)??e).display;return t==="flex"||t==="inline-flex"}function kt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||Mt(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"||Et.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function De(e){let t=e.length;for(;t--;){const n=e[t];if(R(n,"Missing node"),kt(n))return n}return null}function Te(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Oe(e){const t=[];for(;e;)t.push(e),e=et(e);return t}function et(e){const{parentNode:t}=e;return Ct(t)?t.host:t}function It(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 Dt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!Ve(n)||n.contains(e)||e.contains(n))return!0;if(Rt(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(It(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function xe(e,t){const n=[];return t.forEach((o,i)=>{if(i.disabled)return;const s=We(i),u=Lt(i.orientation,s,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&Dt({groupElement:i.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function Tt(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 T(e,t,n=0){return Math.abs(O(e)-O(t))<=n}function A(e,t){return T(e,t)?0:e>t?1:-1}function Z({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:i=0,collapsible:s,disabled:u,maxSize:a=100,minSize:r=0}=t;if(u&&!e)return n;if(A(o,r)<0)if(s){const l=(i+r)/2;A(o,l)<0?o=i:o=r}else o=r;return o=Math.min(a,o),o=O(o),o}function re({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:i,trigger:s}){if(T(e,0))return t;const u=s==="imperative-api",a=Object.values(t),r=Object.values(i),l=[...a],[c,m]=o;R(c!=null,"Invalid first pivot index"),R(m!=null,"Invalid second pivot index");let p=0;switch(s){case"keyboard":{{const f=e<0?m:c,d=n[f];R(d,`Panel constraints not found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(R(v!=null,`Previous layout not found for panel index ${f}`),T(v,h)){const g=b-v;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}{const f=e<0?c:m,d=n[f];R(d,`No panel constraints found for index ${f}`);const{collapsedSize:h=0,collapsible:y,minSize:b=0}=d;if(y){const v=a[f];if(R(v!=null,`Previous layout not found for panel index ${f}`),T(v,b)){const g=v-h;A(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}break}default:{const f=e<0?m:c,d=n[f];R(d,`Panel constraints not found for index ${f}`);const h=a[f],{collapsible:y,collapsedSize:b,minSize:v}=d;if(y&&A(h,v)<0)if(e>0){const g=v-b,L=g/2,M=h+e;A(M,v)<0&&(e=A(e,L)<=0?0:g)}else{const g=v-b,L=100-g/2,M=h-e;A(M,v)<0&&(e=A(100+e,L)>0?0:-g)}break}}{const f=e<0?1:-1;let d=e<0?m:c,h=0;for(;;){const b=a[d];R(b!=null,`Previous layout not found for panel index ${d}`);const g=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:b,size:100})-b;if(h+=g,d+=f,d<0||d>=n.length)break}const y=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-y:y}{let d=e<0?c:m;for(;d>=0&&d<n.length;){const h=Math.abs(e)-Math.abs(p),y=a[d];R(y!=null,`Previous layout not found for panel index ${d}`);const b=y-h,v=Z({overrideDisabledPanels:u,panelConstraints:n[d],prevSize:y,size:b});if(!T(y,v)&&(p+=y-v,l[d]=v,p.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?d--:d++}}if(Tt(r,l))return i;{const f=e<0?m:c,d=a[f];R(d!=null,`Previous layout not found for panel index ${f}`);const h=d+p,y=Z({overrideDisabledPanels:u,panelConstraints:n[f],prevSize:d,size:h});if(l[f]=y,!T(y,h)){let b=h-y,g=e<0?m:c;for(;g>=0&&g<n.length;){const L=l[g];R(L!=null,`Previous layout not found for panel index ${g}`);const M=L+b,C=Z({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:L,size:M});if(T(L,C)||(b-=C-L,l[g]=C),T(b,0))break;e>0?g--:g++}}}const S=Object.values(l).reduce((f,d)=>d+f,0);if(!T(S,100,.1))return i;const x=Object.keys(i);return l.reduce((f,d,h)=>(f[x[h]]=d,f),{})}function K(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||A(e[n],t[n])!==0)return!1;return!0}function q({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],i=o.reduce((a,r)=>a+r,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(a=>`${a}%`).join(", ")}`);if(!T(i,100)&&o.length>0)for(let a=0;a<t.length;a++){const r=o[a];R(r!=null,`No layout data found for index ${a}`);const l=100/i*r;o[a]=l}let s=0;for(let a=0;a<t.length;a++){const r=n[a];R(r!=null,`No layout data found for index ${a}`);const l=o[a];R(l!=null,`No layout data found for index ${a}`);const c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});l!=c&&(s+=l-c,o[a]=c)}if(!T(s,0))for(let a=0;a<t.length;a++){const r=o[a];R(r!=null,`No layout data found for index ${a}`);const l=r+s,c=Z({overrideDisabledPanels:!0,panelConstraints:t[a],prevSize:r,size:l});if(r!==c&&(s-=c-r,o[a]=c,T(s,0)))break}const u=Object.keys(e);return o.reduce((a,r,l)=>(a[u[l]]=r,a),{})}function tt({groupId:e,panelId:t}){const n=()=>{const r=V();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:m,layout:p,groupSize:S,separatorToPanels:x}]of r)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:l,groupSize:S,layout:p,separatorToPanels:x};throw Error(`Group ${e} not found`)},o=()=>{const r=n().derivedPanelConstraints.find(l=>l.panelId===t);if(r!==void 0)return r;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const r=n().group.panels.find(l=>l.id===t);if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const r=n().layout[t];if(r!==void 0)return r;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:r,panels:l,prevLayout:c,derivedPanelConstraints:m})=>{const p=s(),S=l.findIndex(h=>h.id===t),x=S===0,f=S===l.length-1;if(f&&r<p&&(x||l.slice(0,S).every((h,y)=>{const b=m[y];return b?.collapsible&&T(b.collapsedSize,c[b.panelId])}))){const h=l.slice(0,S).reduce((y,b)=>y+c[b.id],0);return{...c,[t]:O(100-h)}}return re({delta:f?p-r:r-p,initialLayout:c,panelConstraints:m,pivotIndices:f?[S-1,S]:[S,S+1],prevLayout:c,trigger:"imperative-api"})},a=r=>{const l=s();if(r===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:m,group:p,groupSize:S,layout:x,separatorToPanels:f}=n(),d=u({nextSize:r,panels:p.panels,prevLayout:x,derivedPanelConstraints:m}),h=q({layout:d,panelConstraints:m});K(x,h)||$(p,{defaultLayoutDeferred:c,derivedPanelConstraints:m,groupSize:S,layout:h,separatorToPanels:f})};return{collapse:()=>{const{collapsible:r,collapsedSize:l}=o(),{mutableValues:c}=i(),m=s();r&&m!==l&&(c.expandToSize=m,a(l))},expand:()=>{const{collapsible:r,collapsedSize:l,minSize:c}=o(),{mutableValues:m}=i(),p=s();if(r&&p===l){let S=m.expandToSize??c;S===0&&(S=1),a(S)}},getSize:()=>{const{group:r}=n(),l=s(),{element:c}=i(),m=r.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:m}},isCollapsed:()=>{const{collapsible:r,collapsedSize:l}=o(),c=s();return r&&T(l,c)},resize:r=>{const{group:l}=n(),{element:c}=i(),m=te({group:l}),p=ne({groupSize:m,panelElement:c,styleProp:r}),S=O(p/m*100);a(S)}}}function Ge(e){if(e.defaultPrevented)return;const t=V();xe(e,t).forEach(o=>{if(o.separator&&!o.separator.disableDoubleClick){const i=o.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(i){const s=i.panelConstraints.defaultSize,u=tt({groupId:o.group.id,panelId:i.id});u&&s!==void 0&&(u.resize(s),e.preventDefault())}}})}function de(e){const t=V();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 nt({groupId:e}){const t=()=>{const n=V();for(const[o,i]of n)if(o.id===e)return{group:o,...i};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:i,group:s,groupSize:u,layout:a,separatorToPanels:r}=t(),l=q({layout:n,panelConstraints:i});return o?a:(K(a,l)||$(s,{defaultLayoutDeferred:o,derivedPanelConstraints:i,groupSize:u,layout:l,separatorToPanels:r}),l)}}}function B(e,t){const n=de(e),o=H(n.id,!0),i=n.separators.find(m=>m.element===e);R(i,"Matching separator not found");const s=o.separatorToPanels.get(i);R(s,"Matching panels not found");const u=s.map(m=>n.panels.indexOf(m)),r=nt({groupId:n.id}).getLayout(),l=re({delta:t,initialLayout:r,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:r,trigger:"keyboard"}),c=q({layout:l,panelConstraints:o.derivedPanelConstraints});K(r,c)||$(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:c,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function Ae(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=de(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&B(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&B(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&B(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&B(t,-5);break}case"End":{e.preventDefault(),B(t,100);break}case"Enter":{e.preventDefault();const o=de(t),i=H(o.id,!0),{derivedPanelConstraints:s,layout:u,separatorToPanels:a}=i,r=o.separators.find(p=>p.element===t);R(r,"Matching separator not found");const l=a.get(r);R(l,"Matching panels not found");const c=l[0],m=s.find(p=>p.panelId===c.id);if(R(m,"Panel metadata not found"),m.collapsible){const p=u[c.id],S=m.collapsedSize===p?o.mutableState.expandedPanelSizes[c.id]??m.minSize:m.collapsedSize;B(t,S-p)}break}case"F6":{e.preventDefault();const i=de(t).separators.map(r=>r.element),s=Array.from(i).findIndex(r=>r===e.currentTarget);R(s!==null,"Index not found");const u=e.shiftKey?s>0?s-1:i.length-1:s+1<i.length?s+1:0;i[u].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),B(t,-100);break}}}function Fe(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=V(),n=xe(e,t),o=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(s.group);u&&o.set(s.group,u.layout)}),ee({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}function ot({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:u}){let a=0;n.forEach(l=>{const{group:c,groupSize:m}=l,{orientation:p,panels:S}=c,{disableCursor:x}=c.mutableState;let f=0;s?p==="horizontal"?f=(t.clientX-s.x)/m*100:f=(t.clientY-s.y)/m*100:p==="horizontal"?f=t.clientX<0?-100:100:f=t.clientY<0?-100:100;const d=o.get(c),h=i.get(c);if(!d||!h)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:g,separatorToPanels:L}=h;if(b&&g&&L){const M=re({delta:f,initialLayout:d,panelConstraints:b,pivotIndices:l.panels.map(C=>S.indexOf(C)),prevLayout:g,trigger:"mouse-or-touch"});if(K(M,g)){if(f!==0&&!x)switch(p){case"horizontal":{a|=f<0?qe:Xe;break}case"vertical":{a|=f<0?Ye:Je;break}}}else $(l.group,{defaultLayoutDeferred:y,derivedPanelConstraints:b,groupSize:v,layout:M,separatorToPanels:L})}});let r=0;t.movementX===0?r|=u&Ce:r|=a&Ce,t.movementY===0?r|=u&Re:r|=a&Re,xt(r),ve(e)}function Ne(e){const t=V(),n=W();switch(n.state){case"active":ot({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function _e(e){if(e.defaultPrevented)return;const t=W(),n=V();switch(t.state){case"active":{if(e.buttons===0){ee({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{if(!n.has(o.group))return;const i=H(o.group.id,!0);$(o.group,i,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:i}=o.separator;i.isConnected&&!i.hasPointerCapture?.(e.pointerId)&&i.setPointerCapture?.(e.pointerId)}ot({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=xe(e,n);o.length===0?t.state!=="inactive"&&ee({cursorFlags:0,state:"inactive"}):ee({cursorFlags:0,hitRegions:o,state:"hover"}),ve(e.currentTarget);break}}}function je(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(W().state){case"hover":ee({cursorFlags:0,state:"inactive"})}}function $e(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;Qe(e.currentTarget)&&e.preventDefault()}function He(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const u=O(s.defaultSize);n+=u,o[s.panelId]=u}else o[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=O((100-n)/i);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=s)}return o}function Ot(e,t,n){if(!n[0])return;const i=e.panels.find(l=>l.element===t);if(!i||!i.onResize)return;const s=te({group:e}),u=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,a=i.mutableValues.prevSize,r={asPercentage:O(u/s*100),inPixels:u};i.mutableValues.prevSize=r,i.onResize(r,i.id,a)}function Gt(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 At(e,t){return e.length!==t.length?!1:e.every((n,o)=>Gt(n,t[o]))}function Ft({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let i=0,s=0,u=!1;const a=new Map,r=[];for(const m of e.panels){const p=o[m.id]??0;switch(m.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const S=p/100*n,x=O(S/t*100);a.set(m.id,x),i+=x;break}case"preserve-relative-size":default:{r.push(m.id),s+=p;break}}}if(!u||r.length===0)return o;const l=100-i,c={...o};if(a.forEach((m,p)=>{c[p]=m}),s>0)for(const m of r){const p=o[m]??0;c[m]=O(p/s*l)}else{const m=O(l/r.length);for(const p of r)c[p]=m}return c}function Nt(e,t){const n=e.map(i=>i.id),o=Object.keys(t);if(n.length!==o.length)return!1;for(const i of n)if(!o.includes(i))return!1;return!0}const J=new Map;function _t(e){let t=!0;R(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,i=new Set,s=new n(f=>{for(const d of f){const{borderBoxSize:h,target:y}=d;if(y===e.element){if(t){const b=te({group:e});if(b===0)return;const v=H(e.id);if(!v)return;const g=ge(e),L=v.defaultLayoutDeferred?He(g):v.layout,M=Ft({group:e,nextGroupSize:b,prevGroupSize:v.groupSize,prevLayout:L}),C=q({layout:M,panelConstraints:g});if(!v.defaultLayoutDeferred&&K(v.layout,C)&&At(v.derivedPanelConstraints,g)&&v.groupSize===b)continue;$(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:g,groupSize:b,layout:C,separatorToPanels:v.separatorToPanels})}}else Ot(e,y,h)}});s.observe(e.element),e.panels.forEach(f=>{R(!o.has(f.id),`Panel ids must be unique; id "${f.id}" was used more than once`),o.add(f.id),f.onResize&&s.observe(f.element)});const u=te({group:e}),a=ge(e),r=e.panels.map(({id:f})=>f).join(",");let l=e.mutableState.defaultLayout;l&&(Nt(e.panels,l)||(l=void 0));const c=e.mutableState.layouts[r]??l??He(a),m=q({layout:c,panelConstraints:a}),p=e.element.ownerDocument;J.set(p,(J.get(p)??0)+1);const S=new Map;return We(e).forEach(f=>{f.separator&&S.set(f.separator,f.panels)}),$(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:a,groupSize:u,layout:m,separatorToPanels:S}),e.separators.forEach(f=>{R(!i.has(f.id),`Separator ids must be unique; id "${f.id}" was used more than once`),i.add(f.id),f.element.addEventListener("keydown",Ae)}),J.get(p)===1&&(p.addEventListener("contextmenu",Ie,!0),p.addEventListener("dblclick",Ge,!0),p.addEventListener("pointerdown",Fe,!0),p.addEventListener("pointerleave",Ne),p.addEventListener("pointermove",_e),p.addEventListener("pointerout",je),p.addEventListener("pointerup",$e,!0)),function(){t=!1,J.set(p,Math.max(0,(J.get(p)??0)-1)),wt(e),e.separators.forEach(d=>{d.element.removeEventListener("keydown",Ae)}),J.get(p)||(p.removeEventListener("contextmenu",Ie,!0),p.removeEventListener("dblclick",Ge,!0),p.removeEventListener("pointerdown",Fe,!0),p.removeEventListener("pointerleave",Ne),p.removeEventListener("pointermove",_e),p.removeEventListener("pointerout",je),p.removeEventListener("pointerup",$e,!0)),s.disconnect()}}function jt(){const[e,t]=z.useState({}),n=z.useCallback(()=>t({}),[]);return[e,n]}function ze(e){const t=z.useId();return`${e??t}`}const X=typeof window<"u"?z.useLayoutEffect:z.useEffect;function oe(e){const t=z.useRef(e);return X(()=>{t.current=e},[e]),z.useCallback((...n)=>t.current?.(...n),[t])}function Pe(...e){return oe(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function we(e){const t=z.useRef({...e});return X(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const it=z.createContext(null);function $t(e,t){const n=z.useRef({getLayout:()=>({}),setLayout:zt});z.useImperativeHandle(t,()=>n.current,[]),X(()=>{Object.assign(n.current,nt({groupId:e}))})}function rt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:i,elementRef:s,groupRef:u,id:a,onLayoutChange:r,onLayoutChanged:l,orientation:c="horizontal",resizeTargetMinimumSize:m={coarse:20,fine:10},style:p,...S}){const x=z.useRef({onLayoutChange:{},onLayoutChanged:{}}),f=oe(P=>{K(x.current.onLayoutChange,P)||(x.current.onLayoutChange=P,r?.(P))}),d=oe((P,w)=>{K(x.current.onLayoutChanged,P)||(x.current.onLayoutChanged=P,l?.(P,{isUserInteraction:w}))}),h=ze(a),y=z.useRef(null),[b,v]=jt(),g=z.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:m,separators:[]}),L=Pe(y,s);$t(h,u);const M=oe((P,w)=>{const I=W(),E=ke(P),k=H(P);if(k){let D=!1;switch(I.state){case"active":{D=I.hitRegions.some(U=>U.group===E);break}}return{flexGrow:k.layout[w]??1,pointerEvents:D?"none":void 0}}if(n?.[w])return{flexGrow:n?.[w]}}),C=we({defaultLayout:n,disableCursor:o}),G=z.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:M,id:h,orientation:c,registerPanel:P=>{const w=g.current;return w.panels=ye(c,[...w.panels,P]),v(),()=>{w.panels=w.panels.filter(I=>I!==P),v()}},registerSeparator:P=>{const w=g.current;return w.separators=ye(c,[...w.separators,P]),v(),()=>{w.separators=w.separators.filter(I=>I!==P),v()}},updatePanelProps:(P,{disabled:w})=>{const E=g.current.panels.find(U=>U.id===P);E&&(E.panelConstraints.disabled=w);const k=ke(h),D=H(h);k&&D&&$(k,{...D,derivedPanelConstraints:ge(k)})},updateSeparatorProps:(P,{disabled:w,disableDoubleClick:I})=>{const k=g.current.separators.find(D=>D.id===P);k&&(k.disabled=w,k.disableDoubleClick=I)}}),[M,h,v,c,C]),N=z.useRef(null);return X(()=>{const P=y.current;if(P===null)return;const w=g.current;let I;if(C.defaultLayout!==void 0&&Object.keys(C.defaultLayout).length===w.panels.length){I={};for(const _ of w.panels){const Y=C.defaultLayout[_.id];Y!==void 0&&(I[_.id]=Y)}}const E={disabled:!!i,element:P,id:h,mutableState:{defaultLayout:I,disableCursor:!!C.disableCursor,expandedPanelSizes:g.current.lastExpandedPanelSizes,layouts:g.current.layouts},orientation:c,panels:w.panels,resizeTargetMinimumSize:w.resizeTargetMinimumSize,separators:w.separators};N.current=E;const k=_t(E),{defaultLayoutDeferred:D,derivedPanelConstraints:U,layout:se}=H(E.id,!0);!D&&U.length>0&&(f(se),d(se,!1));const ae=be(h,_=>{const{defaultLayoutDeferred:Y,derivedPanelConstraints:le,layout:ue}=_.next;if(Y||le.length===0)return;const lt=E.panels.map(({id:j})=>j).join(",");E.mutableState.layouts[lt]=ue,le.forEach(j=>{if(j.collapsible){const{layout:he}=_.prev??{};if(he){const ct=T(j.collapsedSize,ue[j.panelId]),ft=T(j.collapsedSize,he[j.panelId]);ct&&!ft&&(E.mutableState.expandedPanelSizes[j.panelId]=he[j.panelId])}}});const ut=W().state!=="active";f(ue),ut&&d(ue,_.isUserInteraction)});return()=>{N.current=null,k(),ae()}},[i,h,d,f,c,b,C]),z.useEffect(()=>{const P=N.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!o)}),ie.jsx(it.Provider,{value:G,children:ie.jsx("div",{...S,className:t,"data-group":!0,"data-testid":h,id:h,ref:L,style:{height:"100%",width:"100%",overflow:"hidden",...p,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}rt.displayName="Group";function pe(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function Ht({id:e,panelIds:t,storage:n}){const o=pe(e,[]),i=n.getItem(o);if(i)try{const s=JSON.parse(i);if(t){const u=t.join(","),a=s[u];if(a&&Array.isArray(a.layout)&&t.length===a.layout.length){const r={};for(let l=0;l<t.length;l++)r[t[l]]=a.layout[l];return r}}else{const u=Object.keys(s);if(u.length===1){const a=s[u[0]];if(a&&Array.isArray(a.layout)){const r=u[0].split(",");if(r.length===a.layout.length){const l={};for(let c=0;c<r.length;c++)l[r[c]]=a.layout[c];return l}}}}}catch{}}function Vt({debounceSaveMs:e=100,onlySaveAfterUserInteractions:t,panelIds:n,storage:o=localStorage,...i}){const s=n!==void 0,u="id"in i?i.id:i.groupId,a=pe(u,n??[]),r=z.useSyncExternalStore(Ut,()=>o.getItem(a),()=>o.getItem(a)),l=z.useMemo(()=>{if(r){const d=JSON.parse(r),h=Object.values(d);if(Array.from(h).every(y=>typeof y=="number"))return d}},[r]),c=z.useMemo(()=>{if(!l)return Ht({id:u,panelIds:n,storage:o})},[l,u,n,o]),m=l??c,p=z.useRef(null),S=z.useCallback(()=>{const d=p.current;d&&(p.current=null,clearTimeout(d))},[]);z.useLayoutEffect(()=>()=>{S()},[S]);const x=z.useCallback((d,h)=>{if(t&&!h.isUserInteraction)return;S();let y;s?y=pe(u,Object.keys(d)):y=pe(u,[]);try{o.setItem(y,JSON.stringify(d))}catch(b){console.error(b)}},[S,s,u,t,o]),f=z.useCallback(d=>{S(),e===0?x(d,{isUserInteraction:!1}):p.current=setTimeout(()=>{x(d,{isUserInteraction:!1})},e)},[S,e,x]);return{defaultLayout:m,onLayoutChange:f,onLayoutChanged:x}}function Ut(){return function(){}}function Bt(){return z.useState(null)}function Wt(){return z.useRef(null)}function Le(){const e=z.useContext(it);return R(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Kt(e,t){const{id:n}=Le(),o=z.useRef({collapse:me,expand:me,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:me});z.useImperativeHandle(t,()=>o.current,[]),X(()=>{Object.assign(o.current,tt({groupId:n,panelId:e}))})}function st({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:i,disabled:s,elementRef:u,groupResizeBehavior:a="preserve-relative-size",id:r,maxSize:l="100%",minSize:c="0%",onResize:m,panelRef:p,style:S,...x}){const f=!!r,d=ze(r),h=we({disabled:s}),y=z.useRef(null),b=Pe(y,u),{getPanelStyles:v,id:g,orientation:L,registerPanel:M,updatePanelProps:C}=Le(),G=m!==null,N=oe((E,k,D)=>{m?.(E,r,D)});X(()=>{const E=y.current;if(E!==null){const k={element:E,id:d,idIsStable:f,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:G?N:void 0,panelConstraints:{groupResizeBehavior:a,collapsedSize:n,collapsible:o,defaultSize:i,disabled:h.disabled,maxSize:l,minSize:c}};return M(k)}},[a,n,o,i,G,d,f,l,c,N,M,h]),z.useEffect(()=>{C(d,{disabled:s})},[s,d,C]),Kt(d,p);const P=()=>{const E=v(g,d);if(E)return JSON.stringify(E)},w=z.useSyncExternalStore(E=>be(g,E),P,P);let I;return w?I=JSON.parse(w):i!==void 0?I={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:I={flexGrow:1},ie.jsx("div",{...x,"data-disabled":s||void 0,"data-panel":!0,"data-testid":d,id:d,ref:b,style:{...qt,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...I},children:ie.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...S,touchAction:L==="horizontal"?"pan-y":"pan-x"},children:e})})}st.displayName="Panel";const qt={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Xt(){return z.useState(null)}function Yt(){return z.useRef(null)}function Jt({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let i,s;const u=e[n],a=t.find(r=>r.panelId===n);if(a){const r=a.maxSize,l=a.collapsible?a.collapsedSize:a.minSize,c=[o,o+1];s=q({layout:re({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],i=q({layout:re({delta:r-u,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:u}}function at({children:e,className:t,disabled:n,disableDoubleClick:o,elementRef:i,id:s,style:u,...a}){const r=ze(s),l=we({disabled:n,disableDoubleClick:o}),[c,m]=z.useState({}),[p,S]=z.useState("inactive"),[x,f]=z.useState(!1),d=z.useRef(null),h=Pe(d,i),{disableCursor:y,id:b,orientation:v,registerSeparator:g,updateSeparatorProps:L}=Le(),M=v==="horizontal"?"vertical":"horizontal";X(()=>{const N=d.current;if(N!==null){const P={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:N,id:r},w=g(P),I=bt(k=>{S(k.next.state!=="inactive"&&k.next.hitRegions.some(D=>D.separator===P)?k.next.state:"inactive")}),E=be(b,k=>{const{derivedPanelConstraints:D,layout:U,separatorToPanels:se}=k.next,ae=se.get(P);if(ae){const _=ae[0],Y=D.findIndex(le=>le.panelId===_.id);m(Jt({layout:U,panelConstraints:D,panelId:_.id,panelIndex:Y}))}});return()=>{I(),E(),w()}}},[b,r,g,l]),z.useEffect(()=>{L(r,{disabled:n,disableDoubleClick:o})},[n,o,r,L]);let C;n&&!y&&(C="not-allowed");let G;if(n)G="disabled";else switch(p){case"active":{G="active";break}default:x?G="focus":G=p}return ie.jsx("div",{...a,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":M,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":G,"data-testid":r,id:r,onBlur:()=>f(!1),onFocus:()=>f(!0),ref:h,role:"separator",style:{flexBasis:"auto",cursor:C,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}at.displayName="Separator";exports.Group=rt;exports.Panel=st;exports.Separator=at;exports.isCoarsePointer=Be;exports.useDefaultLayout=Vt;exports.useGroupCallbackRef=Bt;exports.useGroupRef=Wt;exports.usePanelCallbackRef=Xt;exports.usePanelRef=Yt;
|
|
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
|