@depup/react-resizable-panels 4.7.3-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Brian Vaughn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @depup/react-resizable-panels
2
+
3
+ > Dependency-bumped version of [react-resizable-panels](https://www.npmjs.com/package/react-resizable-panels)
4
+
5
+ Generated by [DepUp](https://github.com/depup/npm) -- all production
6
+ dependencies bumped to latest versions.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @depup/react-resizable-panels
12
+ ```
13
+
14
+ | Field | Value |
15
+ |-------|-------|
16
+ | Original | [react-resizable-panels](https://www.npmjs.com/package/react-resizable-panels) @ 4.7.3 |
17
+ | Processed | 2026-03-17 |
18
+ | Smoke test | failed |
19
+ | Deps updated | 0 |
20
+
21
+ ---
22
+
23
+ Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/react-resizable-panels
24
+
25
+ License inherited from the original package.
package/changes.json ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "bumped": {},
3
+ "timestamp": "2026-03-17T16:38:26.810Z",
4
+ "totalUpdated": 0
5
+ }
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const oe=require("react/jsx-runtime"),b=require("react");function ct(e,t){const n=getComputedStyle(e),o=parseFloat(n.fontSize);return t*o}function ft(e,t){const n=getComputedStyle(e.ownerDocument.body),o=parseFloat(n.fontSize);return t*o}function dt(e){return e/100*window.innerHeight}function pt(e){return e/100*window.innerWidth}function ht(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 te({groupSize:e,panelElement:t,styleProp:n}){let o;const[i,s]=ht(n);switch(s){case"%":{o=i/100*e;break}case"px":{o=i;break}case"rem":{o=ft(t,i);break}case"em":{o=ct(t,i);break}case"vh":{o=dt(i);break}case"vw":{o=pt(i);break}}return o}function T(e){return parseFloat(e.toFixed(3))}function Q({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 pe(e){const{panels:t}=e,n=Q({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 l=0;if(s.collapsedSize!==void 0){const c=te({groupSize:n,panelElement:i,styleProp:s.collapsedSize});l=T(c/n*100)}let r;if(s.defaultSize!==void 0){const c=te({groupSize:n,panelElement:i,styleProp:s.defaultSize});r=T(c/n*100)}let a=0;if(s.minSize!==void 0){const c=te({groupSize:n,panelElement:i,styleProp:s.minSize});a=T(c/n*100)}let u=100;if(s.maxSize!==void 0){const c=te({groupSize:n,panelElement:i,styleProp:s.maxSize});u=T(c/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:l,collapsible:s.collapsible===!0,defaultSize:r,disabled:s.disabled,minSize:a,maxSize:u,panelId:o.id}})}function R(e,t="Assertion error"){if(!e)throw Error(t)}function he(e,t){return Array.from(t).sort(e==="horizontal"?mt:gt)}function mt(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function gt(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function $e(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function He(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 St({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 l of t){const{x:r,y:a}=He(o,l),u=e==="horizontal"?r:a;u<s&&(s=u,i=l)}return R(i,"No rect found"),i}let ae;function Ve(){return ae===void 0&&(typeof matchMedia=="function"?ae=!!matchMedia("(pointer:coarse)").matches:ae=!1),ae}function Be(e){const{element:t,orientation:n,panels:o,separators:i}=e,s=he(n,Array.from(t.children).filter($e).map(w=>({element:w}))).map(({element:w})=>w),l=[];let r=!1,a=!1,u=-1,c=-1,m=0,d,v=[];{let w=-1;for(const f of s)f.hasAttribute("data-panel")&&(w++,f.ariaDisabled===null&&(m++,u===-1&&(u=w),c=w))}if(m>1){let w=-1;for(const f of s)if(f.hasAttribute("data-panel")){w++;const h=o.find(g=>g.element===f);if(h){if(d){const g=d.element.getBoundingClientRect(),y=f.getBoundingClientRect();let z;if(a){const S=n==="horizontal"?new DOMRect(g.right,g.top,0,g.height):new DOMRect(g.left,g.bottom,g.width,0),p=n==="horizontal"?new DOMRect(y.left,y.top,0,y.height):new DOMRect(y.left,y.top,y.width,0);switch(v.length){case 0:{z=[S,p];break}case 1:{const L=v[0],E=St({orientation:n,rects:[g,y],targetRect:L.element.getBoundingClientRect()});z=[L,E===g?p:S];break}default:{z=v;break}}}else v.length?z=v:z=[n==="horizontal"?new DOMRect(g.right,y.top,y.left-g.right,y.height):new DOMRect(y.left,g.bottom,y.width,y.top-g.bottom)];for(const S of z){let p="width"in S?S:S.element.getBoundingClientRect();const L=Ve()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(p.width<L){const C=L-p.width;p=new DOMRect(p.x-C/2,p.y,p.width+C,p.height)}if(p.height<L){const C=L-p.height;p=new DOMRect(p.x,p.y-C/2,p.width,p.height+C)}const E=w<=u||w>c;!r&&!E&&l.push({group:e,groupSize:Q({group:e}),panels:[d,h],separator:"width"in S?void 0:S,rect:p}),r=!1}}a=!1,d=h,v=[]}}else if(f.hasAttribute("data-separator")){f.ariaDisabled!==null&&(r=!0);const h=i.find(g=>g.element===f);h?v.push(h):(d=void 0,v=[])}else a=!0}return l}class We{#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 l=Array.from(o);for(let r=0;r<l.length;r++){const a=l[r];try{a.call(null,n)}catch(u){s===null&&(i=!0,s=u)}}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 A=new Map;const Ue=new We;function yt(e){A=new Map(A),A.delete(e)}function Le(e,t){for(const[n]of A)if(n.id===e)return n}function j(e,t){for(const[n,o]of A)if(n.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function U(){return A}function me(e,t){return Ue.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function _(e,t){const n=A.get(e);A=new Map(A),A.set(e,t),Ue.emit("groupChange",{group:e,prev:n,next:t})}function vt(e,t,n){let o,i={x:1/0,y:1/0};for(const s of t){const l=He(n,s.rect);switch(e){case"horizontal":{l.x<=i.x&&(o=s,i=l);break}case"vertical":{l.y<=i.y&&(o=s,i=l);break}}}return o?{distance:i,hitRegion:o}:void 0}function zt(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function bt(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ee(e),b:Ee(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:Ce(Re(n.a)),b:Ce(Re(n.b))};if(i.a===i.b){const s=o.childNodes,l={a:n.a.at(-1),b:n.b.at(-1)};let r=s.length;for(;r--;){const a=s[r];if(a===l.a)return 1;if(a===l.b)return-1}}return Math.sign(i.a-i.b)}const xt=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function wt(e){const t=getComputedStyle(Ke(e)??e).display;return t==="flex"||t==="inline-flex"}function Pt(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||wt(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"||xt.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Re(e){let t=e.length;for(;t--;){const n=e[t];if(R(n,"Missing node"),Pt(n))return n}return null}function Ce(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ee(e){const t=[];for(;e;)t.push(e),e=Ke(e);return t}function Ke(e){const{parentNode:t}=e;return zt(t)?t.host:t}function Lt(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 Rt({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!$e(n)||n.contains(e)||e.contains(n))return!0;if(bt(n,e)>0){let o=n;for(;o;){if(o.contains(e))return!0;if(Lt(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function ge(e,t){const n=[];return t.forEach((o,i)=>{if(i.disabled)return;const s=Be(i),l=vt(i.orientation,s,{x:e.clientX,y:e.clientY});l&&l.distance.x<=0&&l.distance.y<=0&&Rt({groupElement:i.element,hitRegion:l.hitRegion.rect,pointerEventTarget:e.target})&&n.push(l.hitRegion)}),n}function Ct(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 I(e,t,n=0){return Math.abs(T(e)-T(t))<=n}function G(e,t){return I(e,t)?0:e>t?1:-1}function Y({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:o}){const{collapsedSize:i=0,collapsible:s,disabled:l,maxSize:r=100,minSize:a=0}=t;if(l&&!e)return n;if(G(o,a)<0)if(s){const u=(i+a)/2;G(o,u)<0?o=i:o=a}else o=a;return o=Math.min(r,o),o=T(o),o}function ie({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:o,prevLayout:i,trigger:s}){if(I(e,0))return t;const l=s==="imperative-api",r=Object.values(t),a=Object.values(i),u=[...r],[c,m]=o;R(c!=null,"Invalid first pivot index"),R(m!=null,"Invalid second pivot index");let d=0;switch(s){case"keyboard":{{const f=e<0?m:c,h=n[f];R(h,`Panel constraints not found for index ${f}`);const{collapsedSize:g=0,collapsible:y,minSize:z=0}=h;if(y){const S=r[f];if(R(S!=null,`Previous layout not found for panel index ${f}`),I(S,g)){const p=z-S;G(p,Math.abs(e))>0&&(e=e<0?0-p:p)}}}{const f=e<0?c:m,h=n[f];R(h,`No panel constraints found for index ${f}`);const{collapsedSize:g=0,collapsible:y,minSize:z=0}=h;if(y){const S=r[f];if(R(S!=null,`Previous layout not found for panel index ${f}`),I(S,z)){const p=S-g;G(p,Math.abs(e))>0&&(e=e<0?0-p:p)}}}break}default:{const f=e<0?m:c,h=n[f];R(h,`Panel constraints not found for index ${f}`);const g=r[f],{collapsible:y,collapsedSize:z,minSize:S}=h;if(y&&G(g,S)<0)if(e>0){const p=S-z,L=p/2,E=g+e;G(E,S)<0&&(e=G(e,L)<=0?0:p)}else{const p=S-z,L=100-p/2,E=g-e;G(E,S)<0&&(e=G(100+e,L)>0?0:-p)}break}}{const f=e<0?1:-1;let h=e<0?m:c,g=0;for(;;){const z=r[h];R(z!=null,`Previous layout not found for panel index ${h}`);const p=Y({overrideDisabledPanels:l,panelConstraints:n[h],prevSize:z,size:100})-z;if(g+=p,h+=f,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:m;for(;h>=0&&h<n.length;){const g=Math.abs(e)-Math.abs(d),y=r[h];R(y!=null,`Previous layout not found for panel index ${h}`);const z=y-g,S=Y({overrideDisabledPanels:l,panelConstraints:n[h],prevSize:y,size:z});if(!I(y,S)&&(d+=y-S,u[h]=S,d.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?h--:h++}}if(Ct(a,u))return i;{const f=e<0?m:c,h=r[f];R(h!=null,`Previous layout not found for panel index ${f}`);const g=h+d,y=Y({overrideDisabledPanels:l,panelConstraints:n[f],prevSize:h,size:g});if(u[f]=y,!I(y,g)){let z=g-y,p=e<0?m:c;for(;p>=0&&p<n.length;){const L=u[p];R(L!=null,`Previous layout not found for panel index ${p}`);const E=L+z,C=Y({overrideDisabledPanels:l,panelConstraints:n[p],prevSize:L,size:E});if(I(L,C)||(z-=C-L,u[p]=C),I(z,0))break;e>0?p--:p++}}}const v=Object.values(u).reduce((f,h)=>h+f,0);if(!I(v,100,.1))return i;const w=Object.keys(i);return u.reduce((f,h,g)=>(f[w[g]]=h,f),{})}function V(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||G(e[n],t[n])!==0)return!1;return!0}function B({layout:e,panelConstraints:t}){const n=Object.values(e),o=[...n],i=o.reduce((r,a)=>r+a,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(r=>`${r}%`).join(", ")}`);if(!I(i,100)&&o.length>0)for(let r=0;r<t.length;r++){const a=o[r];R(a!=null,`No layout data found for index ${r}`);const u=100/i*a;o[r]=u}let s=0;for(let r=0;r<t.length;r++){const a=n[r];R(a!=null,`No layout data found for index ${r}`);const u=o[r];R(u!=null,`No layout data found for index ${r}`);const c=Y({overrideDisabledPanels:!0,panelConstraints:t[r],prevSize:a,size:u});u!=c&&(s+=u-c,o[r]=c)}if(!I(s,0))for(let r=0;r<t.length;r++){const a=o[r];R(a!=null,`No layout data found for index ${r}`);const u=a+s,c=Y({overrideDisabledPanels:!0,panelConstraints:t[r],prevSize:a,size:u});if(a!==c&&(s-=c-a,o[r]=c,I(s,0)))break}const l=Object.keys(e);return o.reduce((r,a,u)=>(r[l[u]]=a,r),{})}function qe({groupId:e,panelId:t}){const n=()=>{const r=U();for(const[a,{defaultLayoutDeferred:u,derivedPanelConstraints:c,layout:m,groupSize:d,separatorToPanels:v}]of r)if(a.id===e)return{defaultLayoutDeferred:u,derivedPanelConstraints:c,group:a,groupSize:d,layout:m,separatorToPanels:v};throw Error(`Group ${e} not found`)},o=()=>{const r=n().derivedPanelConstraints.find(a=>a.panelId===t);if(r!==void 0)return r;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const r=n().group.panels.find(a=>a.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}`)},l=r=>{const a=s();if(r===a)return;const{defaultLayoutDeferred:u,derivedPanelConstraints:c,group:m,groupSize:d,layout:v,separatorToPanels:w}=n(),f=m.panels.findIndex(z=>z.id===t),h=f===m.panels.length-1,g=ie({delta:h?a-r:r-a,initialLayout:v,panelConstraints:c,pivotIndices:h?[f-1,f]:[f,f+1],prevLayout:v,trigger:"imperative-api"}),y=B({layout:g,panelConstraints:c});V(v,y)||_(m,{defaultLayoutDeferred:u,derivedPanelConstraints:c,groupSize:d,layout:y,separatorToPanels:w})};return{collapse:()=>{const{collapsible:r,collapsedSize:a}=o(),{mutableValues:u}=i(),c=s();r&&c!==a&&(u.expandToSize=c,l(a))},expand:()=>{const{collapsible:r,collapsedSize:a,minSize:u}=o(),{mutableValues:c}=i(),m=s();if(r&&m===a){let d=c.expandToSize??u;d===0&&(d=1),l(d)}},getSize:()=>{const{group:r}=n(),a=s(),{element:u}=i(),c=r.orientation==="horizontal"?u.offsetWidth:u.offsetHeight;return{asPercentage:a,inPixels:c}},isCollapsed:()=>{const{collapsible:r,collapsedSize:a}=o(),u=s();return r&&I(a,u)},resize:r=>{const{group:a}=n(),{element:u}=i(),c=Q({group:a}),m=te({groupSize:c,panelElement:u,styleProp:r}),d=T(m/c*100);l(d)}}}function Me(e){if(e.defaultPrevented)return;const t=U();ge(e,t).forEach(o=>{if(o.separator){const i=o.panels.find(s=>s.panelConstraints.defaultSize!==void 0);if(i){const s=i.panelConstraints.defaultSize,l=qe({groupId:o.group.id,panelId:i.id});l&&s!==void 0&&(l.resize(s),e.preventDefault())}}})}function ue(e){const t=U();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 Xe({groupId:e}){const t=()=>{const n=U();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:l,layout:r,separatorToPanels:a}=t(),u=B({layout:n,panelConstraints:i});return o?r:(V(r,u)||_(s,{defaultLayoutDeferred:o,derivedPanelConstraints:i,groupSize:l,layout:u,separatorToPanels:a}),u)}}}function H(e,t){const n=ue(e),o=j(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 l=s.map(m=>n.panels.indexOf(m)),a=Xe({groupId:n.id}).getLayout(),u=ie({delta:t,initialLayout:a,panelConstraints:o.derivedPanelConstraints,pivotIndices:l,prevLayout:a,trigger:"keyboard"}),c=B({layout:u,panelConstraints:o.derivedPanelConstraints});V(a,c)||_(n,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:c,separatorToPanels:o.separatorToPanels})}function ke(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=ue(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&H(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&H(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&H(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&H(t,-5);break}case"End":{e.preventDefault(),H(t,100);break}case"Enter":{e.preventDefault();const o=ue(t),i=j(o.id,!0),{derivedPanelConstraints:s,layout:l,separatorToPanels:r}=i,a=o.separators.find(d=>d.element===t);R(a,"Matching separator not found");const u=r.get(a);R(u,"Matching panels not found");const c=u[0],m=s.find(d=>d.panelId===c.id);if(R(m,"Panel metadata not found"),m.collapsible){const d=l[c.id],v=m.collapsedSize===d?o.mutableState.expandedPanelSizes[c.id]??m.minSize:m.collapsedSize;H(t,v-d)}break}case"F6":{e.preventDefault();const i=ue(t).separators.map(a=>a.element),s=Array.from(i).findIndex(a=>a===e.currentTarget);R(s!==null,"Index not found");const l=e.shiftKey?s>0?s-1:i.length-1:s+1<i.length?s+1:0;i[l].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),H(t,-100);break}}}let J={cursorFlags:0,state:"inactive"};const Se=new We;function W(){return J}function Et(e){return Se.addListener("change",e)}function Mt(e){const t=J,n={...J};n.cursorFlags=e,J=n,Se.emit("change",{prev:t,next:n})}function Z(e){const t=J;J=e,Se.emit("change",{prev:t,next:e})}function Ie(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=U(),n=ge(e,t),o=new Map;let i=!1;n.forEach(s=>{s.separator&&(i||(i=!0,s.separator.element.focus({preventScroll:!0})));const l=t.get(s.group);l&&o.set(s.group,l.layout)}),Z({cursorFlags:0,hitRegions:n,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const kt=e=>e,fe=()=>{},Ye=1,Je=2,Ze=4,Qe=8,De=3,Te=12;let le;function Oe(){return le===void 0&&(le=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(le=!0)),le}function It({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&&Oe()){const s=(e&Ye)!==0,l=(e&Je)!==0,r=(e&Ze)!==0,a=(e&Qe)!==0;if(s)return r?"se-resize":a?"ne-resize":"e-resize";if(l)return r?"sw-resize":a?"nw-resize":"w-resize";if(r)return"s-resize";if(a)return"n-resize"}break}}return Oe()?o>0&&i>0?"move":o>0?"ew-resize":"ns-resize":o>0&&i>0?"grab":o>0?"col-resize":"row-resize"}}const Ge=new WeakMap;function ye(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Ge.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const o=W();switch(o.state){case"active":case"hover":{const i=It({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(l=>l.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}}Ge.set(e,{prevStyle:t,styleSheet:n})}function et({document:e,event:t,hitRegions:n,initialLayoutMap:o,mountedGroups:i,pointerDownAtPoint:s,prevCursorFlags:l}){let r=0;n.forEach(u=>{const{group:c,groupSize:m}=u,{orientation:d,panels:v}=c,{disableCursor:w}=c.mutableState;let f=0;s?d==="horizontal"?f=(t.clientX-s.x)/m*100:f=(t.clientY-s.y)/m*100:d==="horizontal"?f=t.clientX<0?-100:100:f=t.clientY<0?-100:100;const h=o.get(c),g=i.get(c);if(!h||!g)return;const{defaultLayoutDeferred:y,derivedPanelConstraints:z,groupSize:S,layout:p,separatorToPanels:L}=g;if(z&&p&&L){const E=ie({delta:f,initialLayout:h,panelConstraints:z,pivotIndices:u.panels.map(C=>v.indexOf(C)),prevLayout:p,trigger:"mouse-or-touch"});if(V(E,p)){if(f!==0&&!w)switch(d){case"horizontal":{r|=f<0?Ye:Je;break}case"vertical":{r|=f<0?Ze:Qe;break}}}else _(u.group,{defaultLayoutDeferred:y,derivedPanelConstraints:z,groupSize:S,layout:E,separatorToPanels:L})}});let a=0;t.movementX===0?a|=l&De:a|=r&De,t.movementY===0?a|=l&Te:a|=r&Te,Mt(a),ye(e)}function Ae(e){const t=U(),n=W();switch(n.state){case"active":et({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Ne(e){if(e.defaultPrevented)return;const t=W(),n=U();switch(t.state){case"active":{if(e.buttons===0){Z({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const i=j(o.group.id,!0);_(o.group,i)});return}et({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=ge(e,n);o.length===0?t.state!=="inactive"&&Z({cursorFlags:0,state:"inactive"}):Z({cursorFlags:0,hitRegions:o,state:"hover"}),ye(e.currentTarget);break}}}function _e(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(W().state){case"hover":Z({cursorFlags:0,state:"inactive"})}}function Fe(e){if(e.defaultPrevented)return;if(e.pointerType==="mouse"&&e.button>0)return;const t=W();switch(t.state){case"active":Z({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(ye(e.currentTarget),t.hitRegions.forEach(n=>{const o=j(n.group.id,!0);_(n.group,o)}),e.preventDefault())}}function je(e){let t=0,n=0;const o={};for(const s of e)if(s.defaultSize!==void 0){t++;const l=T(s.defaultSize);n+=l,o[s.panelId]=l}else o[s.panelId]=void 0;const i=e.length-t;if(i!==0){const s=T((100-n)/i);for(const l of e)l.defaultSize===void 0&&(o[l.panelId]=s)}return o}function Dt(e,t,n){if(!n[0])return;const i=e.panels.find(u=>u.element===t);if(!i||!i.onResize)return;const s=Q({group:e}),l=e.orientation==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,r=i.mutableValues.prevSize,a={asPercentage:T(l/s*100),inPixels:l};i.mutableValues.prevSize=a,i.onResize(a,i.id,r)}function Tt(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 Ot({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:o}){if(n<=0||t<=0||n===t)return o;let i=0,s=0,l=!1;const r=new Map,a=[];for(const m of e.panels){const d=o[m.id]??0;switch(m.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{l=!0;const v=d/100*n,w=T(v/t*100);r.set(m.id,w),i+=w;break}case"preserve-relative-size":default:{a.push(m.id),s+=d;break}}}if(!l||a.length===0)return o;const u=100-i,c={...o};if(r.forEach((m,d)=>{c[d]=m}),s>0)for(const m of a){const d=o[m]??0;c[m]=T(d/s*u)}else{const m=T(u/a.length);for(const d of a)c[d]=m}return c}function Gt(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 X=new Map;function At(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 h of f){const{borderBoxSize:g,target:y}=h;if(y===e.element){if(t){const z=Q({group:e});if(z===0)return;const S=j(e.id);if(!S)return;const p=pe(e),L=S.defaultLayoutDeferred?je(p):S.layout,E=Ot({group:e,nextGroupSize:z,prevGroupSize:S.groupSize,prevLayout:L}),C=B({layout:E,panelConstraints:p});if(!S.defaultLayoutDeferred&&V(S.layout,C)&&Tt(S.derivedPanelConstraints,p)&&S.groupSize===z)return;_(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:p,groupSize:z,layout:C,separatorToPanels:S.separatorToPanels})}}else Dt(e,y,g)}});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 l=Q({group:e}),r=pe(e),a=e.panels.map(({id:f})=>f).join(",");let u=e.mutableState.defaultLayout;u&&(Gt(e.panels,u)||(u=void 0));const c=e.mutableState.layouts[a]??u??je(r),m=B({layout:c,panelConstraints:r}),d=e.element.ownerDocument;X.set(d,(X.get(d)??0)+1);const v=new Map;return Be(e).forEach(f=>{f.separator&&v.set(f.separator,f.panels)}),_(e,{defaultLayoutDeferred:l===0,derivedPanelConstraints:r,groupSize:l,layout:m,separatorToPanels:v}),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",ke)}),X.get(d)===1&&(d.addEventListener("dblclick",Me,!0),d.addEventListener("pointerdown",Ie,!0),d.addEventListener("pointerleave",Ae),d.addEventListener("pointermove",Ne),d.addEventListener("pointerout",_e),d.addEventListener("pointerup",Fe,!0)),function(){t=!1,X.set(d,Math.max(0,(X.get(d)??0)-1)),yt(e),e.separators.forEach(h=>{h.element.removeEventListener("keydown",ke)}),X.get(d)||(d.removeEventListener("dblclick",Me,!0),d.removeEventListener("pointerdown",Ie,!0),d.removeEventListener("pointerleave",Ae),d.removeEventListener("pointermove",Ne),d.removeEventListener("pointerout",_e),d.removeEventListener("pointerup",Fe,!0)),s.disconnect()}}function Nt(){const[e,t]=b.useState({}),n=b.useCallback(()=>t({}),[]);return[e,n]}function ve(e){const t=b.useId();return`${e??t}`}const K=typeof window<"u"?b.useLayoutEffect:b.useEffect;function ne(e){const t=b.useRef(e);return K(()=>{t.current=e},[e]),b.useCallback((...n)=>t.current?.(...n),[t])}function ze(...e){return ne(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function be(e){const t=b.useRef({...e});return K(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const tt=b.createContext(null);function _t(e,t){const n=b.useRef({getLayout:()=>({}),setLayout:kt});b.useImperativeHandle(t,()=>n.current,[]),K(()=>{Object.assign(n.current,Xe({groupId:e}))})}function nt({children:e,className:t,defaultLayout:n,disableCursor:o,disabled:i,elementRef:s,groupRef:l,id:r,onLayoutChange:a,onLayoutChanged:u,orientation:c="horizontal",resizeTargetMinimumSize:m={coarse:20,fine:10},style:d,...v}){const w=b.useRef({onLayoutChange:{},onLayoutChanged:{}}),f=ne(x=>{V(w.current.onLayoutChange,x)||(w.current.onLayoutChange=x,a?.(x))}),h=ne(x=>{V(w.current.onLayoutChanged,x)||(w.current.onLayoutChanged=x,u?.(x))}),g=ve(r),y=b.useRef(null),[z,S]=Nt(),p=b.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:m,separators:[]}),L=ze(y,s);_t(g,l);const E=ne((x,P)=>{const k=W(),M=Le(x),D=j(x);if(D){let O=!1;switch(k.state){case"active":{O=k.hitRegions.some($=>$.group===M);break}}return{flexGrow:D.layout[P]??1,pointerEvents:O?"none":void 0}}return{flexGrow:n?.[P]??1}}),C=be({defaultLayout:n,disableCursor:o}),q=b.useMemo(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:E,id:g,orientation:c,registerPanel:x=>{const P=p.current;return P.panels=he(c,[...P.panels,x]),S(),()=>{P.panels=P.panels.filter(k=>k!==x),S()}},registerSeparator:x=>{const P=p.current;return P.separators=he(c,[...P.separators,x]),S(),()=>{P.separators=P.separators.filter(k=>k!==x),S()}},togglePanelDisabled:(x,P)=>{const M=p.current.panels.find($=>$.id===x);M&&(M.panelConstraints.disabled=P);const D=Le(g),O=j(g);D&&O&&_(D,{...O,derivedPanelConstraints:pe(D)})},toggleSeparatorDisabled:(x,P)=>{const M=p.current.separators.find(D=>D.id===x);M&&(M.disabled=P)}}),[E,g,S,c,C]),F=b.useRef(null);return K(()=>{const x=y.current;if(x===null)return;const P=p.current;let k;if(C.defaultLayout!==void 0&&Object.keys(C.defaultLayout).length===P.panels.length){k={};for(const ee of P.panels){const re=C.defaultLayout[ee.id];re!==void 0&&(k[ee.id]=re)}}const M={disabled:!!i,element:x,id:g,mutableState:{defaultLayout:k,disableCursor:!!C.disableCursor,expandedPanelSizes:p.current.lastExpandedPanelSizes,layouts:p.current.layouts},orientation:c,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};F.current=M;const D=At(M),{defaultLayoutDeferred:O,derivedPanelConstraints:$,layout:we}=j(M.id,!0);!O&&$.length>0&&(f(we),h(we));const rt=me(g,ee=>{const{defaultLayoutDeferred:re,derivedPanelConstraints:Pe,layout:se}=ee.next;if(re||Pe.length===0)return;const st=M.panels.map(({id:N})=>N).join(",");M.mutableState.layouts[st]=se,Pe.forEach(N=>{if(N.collapsible){const{layout:ce}=ee.prev??{};if(ce){const lt=I(N.collapsedSize,se[N.panelId]),ut=I(N.collapsedSize,ce[N.panelId]);lt&&!ut&&(M.mutableState.expandedPanelSizes[N.panelId]=ce[N.panelId])}}});const at=W().state!=="active";f(se),at&&h(se)});return()=>{F.current=null,D(),rt()}},[i,g,h,f,c,z,C]),b.useEffect(()=>{const x=F.current;x&&(x.mutableState.defaultLayout=n,x.mutableState.disableCursor=!!o)}),oe.jsx(tt.Provider,{value:q,children:oe.jsx("div",{...v,className:t,"data-group":!0,"data-testid":g,id:g,ref:L,style:{height:"100%",width:"100%",overflow:"hidden",...d,display:"flex",flexDirection:c==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:c==="horizontal"?"pan-y":"pan-x"},children:e})})}nt.displayName="Group";function de(e,t){return`react-resizable-panels:${[e,...t].join(":")}`}function Ft({debounceSaveMs:e=100,panelIds:t,storage:n=localStorage,...o}){const i=t!==void 0,s="id"in o?o.id:o.groupId,l=de(s,t??[]),r=b.useSyncExternalStore(jt,()=>n.getItem(l),()=>n.getItem(l)),a=b.useMemo(()=>r?JSON.parse(r):void 0,[r]),u=b.useRef(null),c=b.useCallback(()=>{const v=u.current;v&&(u.current=null,clearTimeout(v))},[]);b.useLayoutEffect(()=>()=>{c()},[c]);const m=b.useCallback(v=>{c();let w;i?w=de(s,Object.keys(v)):w=de(s,[]);try{n.setItem(w,JSON.stringify(v))}catch(f){console.error(f)}},[c,i,s,n]),d=b.useCallback(v=>{c(),e===0?m(v):u.current=setTimeout(()=>{m(v)},e)},[c,e,m]);return{defaultLayout:a,onLayoutChange:d,onLayoutChanged:m}}function jt(){return function(){}}function $t(){return b.useState(null)}function Ht(){return b.useRef(null)}function xe(){const e=b.useContext(tt);return R(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Vt(e,t){const{id:n}=xe(),o=b.useRef({collapse:fe,expand:fe,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:fe});b.useImperativeHandle(t,()=>o.current,[]),K(()=>{Object.assign(o.current,qe({groupId:n,panelId:e}))})}function ot({children:e,className:t,collapsedSize:n="0%",collapsible:o=!1,defaultSize:i,disabled:s,elementRef:l,groupResizeBehavior:r="preserve-relative-size",id:a,maxSize:u="100%",minSize:c="0%",onResize:m,panelRef:d,style:v,...w}){const f=!!a,h=ve(a),g=be({disabled:s}),y=b.useRef(null),z=ze(y,l),{getPanelStyles:S,id:p,orientation:L,registerPanel:E,togglePanelDisabled:C}=xe(),q=m!==null,F=ne((P,k,M)=>{m?.(P,a,M)});K(()=>{const P=y.current;if(P!==null){const k={element:P,id:h,idIsStable:f,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:q?F:void 0,panelConstraints:{groupResizeBehavior:r,collapsedSize:n,collapsible:o,defaultSize:i,disabled:g.disabled,maxSize:u,minSize:c}};return E(k)}},[r,n,o,i,q,h,f,u,c,F,E,g]),b.useEffect(()=>{C(h,!!s)},[s,h,C]),Vt(h,d);const x=b.useSyncExternalStore(P=>me(p,P),()=>JSON.stringify(S(p,h)),()=>JSON.stringify(S(p,h)));return oe.jsx("div",{...w,"aria-disabled":s||void 0,"data-panel":!0,"data-testid":h,id:h,ref:z,style:{...Bt,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(x)},children:oe.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...v,touchAction:L==="horizontal"?"pan-y":"pan-x"},children:e})})}ot.displayName="Panel";const Bt={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function Wt(){return b.useState(null)}function Ut(){return b.useRef(null)}function Kt({layout:e,panelConstraints:t,panelId:n,panelIndex:o}){let i,s;const l=e[n],r=t.find(a=>a.panelId===n);if(r){const a=r.maxSize,u=r.collapsible?r.collapsedSize:r.minSize,c=[o,o+1];s=B({layout:ie({delta:u-l,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n],i=B({layout:ie({delta:a-l,initialLayout:e,panelConstraints:t,pivotIndices:c,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:s,valueNow:l}}function it({children:e,className:t,disabled:n,elementRef:o,id:i,style:s,...l}){const r=ve(i),a=be({disabled:n}),[u,c]=b.useState({}),[m,d]=b.useState("inactive"),v=b.useRef(null),w=ze(v,o),{disableCursor:f,id:h,orientation:g,registerSeparator:y,toggleSeparatorDisabled:z}=xe(),S=g==="horizontal"?"vertical":"horizontal";K(()=>{const L=v.current;if(L!==null){const E={disabled:a.disabled,element:L,id:r},C=y(E),q=Et(x=>{d(x.next.state!=="inactive"&&x.next.hitRegions.some(P=>P.separator===E)?x.next.state:"inactive")}),F=me(h,x=>{const{derivedPanelConstraints:P,layout:k,separatorToPanels:M}=x.next,D=M.get(E);if(D){const O=D[0],$=D.indexOf(O);c(Kt({layout:k,panelConstraints:P,panelId:O.id,panelIndex:$}))}});return()=>{q(),F(),C()}}},[h,r,y,a]),b.useEffect(()=>{z(r,!!n)},[n,r,z]);let p;return n&&!f&&(p="not-allowed"),oe.jsx("div",{...l,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":S,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":n?"disabled":m,"data-testid":r,id:r,ref:w,role:"separator",style:{flexBasis:"auto",cursor:p,...s,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}it.displayName="Separator";exports.Group=nt;exports.Panel=ot;exports.Separator=it;exports.isCoarsePointer=Ve;exports.useDefaultLayout=Ft;exports.useGroupCallbackRef=$t;exports.useGroupRef=Ht;exports.usePanelCallbackRef=Wt;exports.usePanelRef=Ut;
2
+ //# sourceMappingURL=react-resizable-panels.cjs.map