@aiquants/resize-panels 1.8.1 → 2.0.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.
Files changed (81) hide show
  1. package/README.md +213 -108
  2. package/dist/GlobalDebugOverlay-Cf3GOn2A.cjs +1 -0
  3. package/dist/{GlobalDebugOverlay-DYCR0FIu.js → GlobalDebugOverlay-DQtUdNeF.js} +28 -28
  4. package/dist/debugOverlayStore-D7FT6zPE.js +135 -0
  5. package/dist/debugOverlayStore-DY09saU8.cjs +1 -0
  6. package/dist/index-DZ0itiBD.js +1299 -0
  7. package/dist/index-DqATP_BA.cjs +2 -0
  8. package/dist/index.cjs +1 -1
  9. package/dist/index.d.ts +2 -29
  10. package/dist/index.js +25 -13
  11. package/dist/src/GlobalDebugOverlay.d.ts.map +1 -0
  12. package/dist/src/Panel.d.ts +46 -0
  13. package/dist/src/Panel.d.ts.map +1 -0
  14. package/dist/src/PanelDebugInfo.d.ts +34 -0
  15. package/dist/src/PanelDebugInfo.d.ts.map +1 -0
  16. package/dist/src/PanelGroup.d.ts.map +1 -0
  17. package/dist/{PanelResizeHandle.d.ts → src/PanelResizeHandle.d.ts} +1 -1
  18. package/dist/src/PanelResizeHandle.d.ts.map +1 -0
  19. package/dist/src/allocateLayout.d.ts +60 -0
  20. package/dist/src/allocateLayout.d.ts.map +1 -0
  21. package/dist/src/context.d.ts.map +1 -0
  22. package/dist/{debugOverlayStore.d.ts → src/debugOverlayStore.d.ts} +10 -2
  23. package/dist/src/debugOverlayStore.d.ts.map +1 -0
  24. package/dist/src/hooks.d.ts +48 -0
  25. package/dist/src/hooks.d.ts.map +1 -0
  26. package/dist/src/index.d.ts +32 -0
  27. package/dist/src/index.d.ts.map +1 -0
  28. package/dist/src/reducer.d.ts +49 -0
  29. package/dist/src/reducer.d.ts.map +1 -0
  30. package/dist/src/roundHalfToEven.d.ts.map +1 -0
  31. package/dist/src/types.d.ts +481 -0
  32. package/dist/src/types.d.ts.map +1 -0
  33. package/dist/src/utils/simple-logger.d.ts.map +1 -0
  34. package/dist/src/utils.d.ts +164 -0
  35. package/dist/src/utils.d.ts.map +1 -0
  36. package/dist/styles/resize-panels.standalone.css +1 -1
  37. package/dist/tests/support/dom-harness.d.ts +89 -0
  38. package/dist/tests/support/dom-harness.d.ts.map +1 -0
  39. package/package.json +3 -3
  40. package/src/GlobalDebugOverlay.tsx +3 -3
  41. package/src/Panel.tsx +203 -541
  42. package/src/PanelDebugInfo.tsx +52 -106
  43. package/src/PanelGroup.tsx +27 -42
  44. package/src/PanelResizeHandle.tsx +544 -504
  45. package/src/allocateLayout.ts +412 -0
  46. package/src/debugOverlayStore.ts +19 -15
  47. package/src/hooks.ts +187 -779
  48. package/src/index.ts +37 -6
  49. package/src/reducer.ts +364 -1126
  50. package/src/types.ts +282 -65
  51. package/src/utils.ts +205 -164
  52. package/dist/GlobalDebugOverlay-afs0vF-Q.cjs +0 -1
  53. package/dist/GlobalDebugOverlay.d.ts.map +0 -1
  54. package/dist/Panel.d.ts +0 -7
  55. package/dist/Panel.d.ts.map +0 -1
  56. package/dist/PanelDebugInfo.d.ts +0 -26
  57. package/dist/PanelDebugInfo.d.ts.map +0 -1
  58. package/dist/PanelGroup.d.ts.map +0 -1
  59. package/dist/PanelResizeHandle.d.ts.map +0 -1
  60. package/dist/context.d.ts.map +0 -1
  61. package/dist/debugOverlayStore-Cntyxboe.js +0 -141
  62. package/dist/debugOverlayStore-Dkl-fHoa.cjs +0 -1
  63. package/dist/debugOverlayStore.d.ts.map +0 -1
  64. package/dist/hooks.d.ts +0 -45
  65. package/dist/hooks.d.ts.map +0 -1
  66. package/dist/index-BzgId8aQ.js +0 -1972
  67. package/dist/index-xTV-c0PN.cjs +0 -2
  68. package/dist/index.d.ts.map +0 -1
  69. package/dist/reducer.d.ts +0 -39
  70. package/dist/reducer.d.ts.map +0 -1
  71. package/dist/roundHalfToEven.d.ts.map +0 -1
  72. package/dist/types.d.ts +0 -253
  73. package/dist/types.d.ts.map +0 -1
  74. package/dist/utils/simple-logger.d.ts.map +0 -1
  75. package/dist/utils.d.ts +0 -61
  76. package/dist/utils.d.ts.map +0 -1
  77. /package/dist/{GlobalDebugOverlay.d.ts → src/GlobalDebugOverlay.d.ts} +0 -0
  78. /package/dist/{PanelGroup.d.ts → src/PanelGroup.d.ts} +0 -0
  79. /package/dist/{context.d.ts → src/context.d.ts} +0 -0
  80. /package/dist/{roundHalfToEven.d.ts → src/roundHalfToEven.d.ts} +0 -0
  81. /package/dist/{utils → src/utils}/simple-logger.d.ts +0 -0
@@ -1,2 +0,0 @@
1
- "use strict";const s=require("react"),X=require("react/jsx-runtime"),Ge=require("tailwind-merge"),et=s.createContext(null),Xe=()=>{const e=s.useContext(et);if(!e)throw new Error("usePanelGroup must be used within a PanelGroup");return e},pt=(e,t=0)=>{if(!Number.isFinite(e))return e;const n=10**t,f=e*n,r=Math.floor(f),a=f-r,i=Number.EPSILON*Math.max(1,Math.abs(f));return a<.5-i?r/n:a>.5+i?(r+1)/n:(r%2===0?r:r+1)/n},zt=12,ot=8,Rt=8,Bt=8,at=10,ht=.05,gt=10,Ft=.05,It=20,Nt=.05,lt=0,mt=6,Pe=(e,t)=>t<=0?0:pt(e/t*100,mt),je=(e,t)=>!e||t<=0?0:e/100*t,St=(e,t="percentage")=>{if(e!==void 0)return typeof e=="number"?{value:e,unit:t}:e},$=(e,t,n)=>e?typeof e=="number"?e/100*n:e.unit==="pixels"?e.value:e.value/100*n:t,de=(e,t,n)=>Math.min(Math.max(e,t),n),Qe=e=>{if(!Number.isFinite(e)||e<=0)return lt;const t=e*ht,n=Math.min(zt,gt,t);return Math.max(lt,n)},xt=(e,t,n,f={})=>{if(Math.abs(t)<=0)return t;const r=f.enforceAutoMinSize??!1,a=e.map((l,u)=>({panel:l,index:u})).filter(({panel:l})=>!l.collapsed&&(l.sizeUnit==="pixels"||l.originalPixelSize!==void 0));if(a.length===0)return t;const i=t>0,z=[...a].sort((l,u)=>{const o=l.panel.pixelAdjustPriority??l.index+1,S=u.panel.pixelAdjustPriority??u.index+1;return o===S?i?u.index-l.index:l.index-u.index:i?S-o:o-S});let g=t;const h=l=>{for(const{index:u}of z){if(Math.abs(g)<=0)break;const o=e[u];if(!o||o.collapsed)continue;const S=$(o.minSize,0,n),C=$(o.maxSize,n,n),M=r?$(o.autoMinSize,0,n):0,E=Math.max(S,M),R=o.preferredPixelSize!==void 0?de(o.preferredPixelSize,E,C):o.size,T=o.collapseFromStart||o.collapseFromEnd;if(g>0){if(Math.abs(o.size)<=0&&(o.percentageSize??0)<=0)continue;const O=Math.max(o.size,R),re=l?Math.min(C,O):C,Q=Math.max(0,re-o.size);if(Q<=0)continue;const fe=Math.min(Q,g);if(fe<=0)continue;const k=o.size+fe,H=Pe(k,n),w=T?k:o.sizeBeforeCollapse,V=T?o.measuredPixelSizeBeforeCollapse??o.measuredPixelSize??k:o.measuredPixelSizeBeforeCollapse;e[u]={...o,size:k,percentageSize:H,sizeBeforeCollapse:w,measuredPixelSizeBeforeCollapse:V,measuredPixelSize:void 0,measuredPercentageSize:void 0},g-=fe}else{const B=l?R:E,O=Math.max(0,o.size-B);if(O<=0)continue;const re=Math.min(O,Math.abs(g));if(re<=0)continue;const Q=o.size-re,fe=Pe(Q,n),k=T?Q:o.sizeBeforeCollapse,H=T?o.measuredPixelSizeBeforeCollapse??o.measuredPixelSize??Q:o.measuredPixelSizeBeforeCollapse;e[u]={...o,size:Q,percentageSize:fe,sizeBeforeCollapse:k,measuredPixelSizeBeforeCollapse:H,measuredPixelSize:void 0,measuredPercentageSize:void 0},g+=re}}};return h(!0),(i&&g>0||!i&&g<0)&&h(!1),g},$e=e=>{if(!e)return 0;const t=parseFloat(e);return Number.isFinite(t)?t:0},Ie=(e,t)=>{const n=e.getBoundingClientRect(),f=typeof window<"u"?window.getComputedStyle(e):null,r=f?$e(f.borderLeftWidth)+$e(f.borderRightWidth):0,a=f?$e(f.borderTopWidth)+$e(f.borderBottomWidth):0;if(t==="horizontal"){const h=n.width>0?n.width:e.offsetWidth,l=n.width>0?Math.max(0,n.width-r):e.clientWidth,u=e.offsetWidth>0?e.offsetWidth:e.clientWidth+r;return{inner:l>0?l:Math.max(0,e.clientWidth),outer:h>0?h:Math.max(0,u)}}const i=n.height>0?n.height:e.offsetHeight,z=n.height>0?Math.max(0,n.height-a):e.clientHeight,g=e.offsetHeight>0?e.offsetHeight:e.clientHeight+a;return{inner:z>0?z:Math.max(0,e.clientHeight),outer:i>0?i:Math.max(0,g)}},Pt=(e,t)=>{try{localStorage.setItem(`panel-layout-${e}`,JSON.stringify(t))}catch(n){console.warn("Failed to save panel layout:",n)}},bt=e=>{try{const t=localStorage.getItem(`panel-layout-${e}`);return t?JSON.parse(t):null}catch(t){return console.warn("Failed to load panel layout:",t),null}};var Le=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e[e.NONE=4]="NONE",e))(Le||{});const xe=class xe{constructor(t=2,n="[resize-panels]",f=console){this.level=t,this.prefix=n,this.impl=f,xe.instances.add(this)}static setLevel(t){for(const n of xe.instances)n.setLevel(t)}setLevel(t){this.level=t}static setImplementation(t){for(const n of xe.instances)n.setImplementation(t)}setImplementation(t){this.impl=t}static setPrefix(t){for(const n of xe.instances)n.setPrefix(t)}setPrefix(t){this.prefix=t}enabledFor(t){return this.level<=t}formatMessage(t){return typeof t=="string"?[`${this.prefix} ${t}`]:[this.prefix,t]}static debug(t,...n){xe.instance.debug(t,...n)}debug(t,...n){this.level<=0&&this.impl.debug(...this.formatMessage(t),...n)}static info(t,...n){xe.instance.info(t,...n)}info(t,...n){this.level<=1&&this.impl.info(...this.formatMessage(t),...n)}static warn(t,...n){xe.instance.warn(t,...n)}warn(t,...n){this.level<=2&&this.impl.warn(...this.formatMessage(t),...n)}static error(t,...n){xe.instance.error(t,...n)}error(t,...n){this.level<=3&&this.impl.error(...this.formatMessage(t),...n)}};xe.instances=new Set,xe.instance=new xe(2,"[resize-panels]");let He=xe;const ue=new He(Le.INFO,"[resize-panels]"),Be=1e-9,Me=e=>e.map(t=>({id:t.id,size:t.size,percentageSize:t.percentageSize,preferredPercentageSize:t.preferredPercentageSize,sizeBeforeCollapse:t.sizeBeforeCollapse,percentageSizeBeforeCollapse:t.percentageSizeBeforeCollapse,preferredPercentageSizeBeforeCollapse:t.preferredPercentageSizeBeforeCollapse,measuredPercentageSize:t.measuredPercentageSize,excludeFromAutoGrowth:t.excludeFromAutoGrowth??!1,collapsed:t.collapsed??!1,collapseFromStart:t.collapseFromStart,collapseFromEnd:t.collapseFromEnd,collapsedByDirection:t.collapsedByDirection??null})),We=e=>e?Me([e])[0]:null,De=e=>e?!!(e.collapseFromStart||e.collapseFromEnd):!1,Ve=(e,t)=>{if(!Number.isFinite(t)||t<=0)return e;const n=e.map(g=>({...g})),f=[];for(let g=0;g<n.length;g+=1){const h=n[g];if(h.collapsed){n[g]={...h,size:0,percentageSize:0};continue}const l=Math.max(0,$(h.minSize,0,t)),u=Math.max(0,$(h.autoMinSize,0,t)),o=Math.max(l,u),S=Math.max(.001,o),C=$(h.maxSize,t,t),M=Math.max(o,C),E=h.sizeUnit==="pixels"||h.originalPixelSize!==void 0,R=Math.max(0,h.size);let T=o;if(E){const O=h.preferredPixelSize??h.size??h.originalPixelSize??o;T=de(O,o,M)}else{const O=h.preferredPercentageSize??h.percentageSize??Pe(h.size,t),re=je(O,t);T=de(re,o,M)}const B=!E&&(h.excludeFromAutoGrowth??!1)&&R<=S;f.push({index:g,isPixelPanel:E,minSize:o,maxSize:M,preferredSize:T,priority:h.pixelAdjustPriority??g+1,flexPriority:E?void 0:h.flexAdjustPriority,excludeFromGrowth:B})}if(f.length===0)return n;const r=new Map;let a=0;for(const g of f)r.set(g.index,g.minSize),a+=g.minSize;let i=t-a;const z=(g,h)=>{if(h<=0)return 0;const l=r.get(g.index)??g.minSize,u=Math.max(0,g.maxSize-l);if(u<=0)return 0;const o=Math.min(h,u);return r.set(g.index,l+o),o};if(i>0){const g=l=>{for(;i>1e-6;){let o=0;const S=[];for(const E of l){if(!E.isPixelPanel&&E.excludeFromGrowth)continue;const R=r.get(E.index)??E.minSize,T=Math.min(E.preferredSize,E.maxSize),B=Math.max(0,T-R);B>1e-6&&(o+=B,S.push({descriptor:E,capacity:B}))}if(S.length===0||o<=1e-6)break;let C=0;const M=i;for(const E of S){if(i<=1e-6)break;if(!E.descriptor.isPixelPanel&&E.descriptor.excludeFromGrowth)continue;const R=M*E.capacity/o,T=Math.min(E.capacity,R);if(T<=0)continue;const B=z(E.descriptor,T);B>0&&(i-=B,C+=B)}if(C<=1e-6)break}},h=f.filter(l=>l.isPixelPanel);h.sort((l,u)=>u.priority-l.priority);for(const l of h){if(i<=0)break;const u=r.get(l.index)??l.minSize,o=Math.min(l.preferredSize,l.maxSize),S=Math.max(0,o-u);if(S<=0)continue;const C=z(l,Math.min(S,i));C>0&&(i-=C)}if(i>0){const l=f.filter(u=>!u.isPixelPanel);if(l.length>0){const u=l.filter(o=>o.flexPriority!==void 0&&!o.excludeFromGrowth);if(u.length>0){u.sort((o,S)=>(S.flexPriority??0)-(o.flexPriority??0));for(const o of u){if(i<=0)break;if(o.excludeFromGrowth)continue;const S=r.get(o.index)??o.minSize,C=Math.min(o.preferredSize,o.maxSize),M=Math.max(0,C-S);if(M<=0)continue;const E=z(o,Math.min(M,i));E>0&&(i-=E)}}if(i>0){const o=u.length>0?l.filter(S=>S.flexPriority===void 0&&!S.excludeFromGrowth):l.filter(S=>!S.excludeFromGrowth);o.length>0&&g(o)}}}}if(i>0){let g=i;for(;;){let h=0;const l=[];for(const o of f){if(!o.isPixelPanel&&o.excludeFromGrowth)continue;const S=r.get(o.index)??o.minSize,C=o.isPixelPanel?Math.min(o.maxSize,o.preferredSize):o.maxSize,M=Math.max(0,C-S);M>0&&(l.push(o),h+=M)}if(h<=0)break;const u=i;for(const o of l){if(i<=0)break;if(!o.isPixelPanel&&o.excludeFromGrowth)continue;const S=r.get(o.index)??o.minSize,C=o.isPixelPanel?Math.min(o.maxSize,o.preferredSize):o.maxSize,M=Math.max(0,C-S);if(M<=0)continue;const E=u*M/h,R=z(o,Math.min(M,E));R>0&&(i-=R)}if(i<=1e-6||Math.abs(g-i)<=1e-6)break;g=i}i=Math.max(0,i)}for(const g of f){const h=r.get(g.index)??g.minSize,l=n[g.index],u=De(l),o=u?h:l.sizeBeforeCollapse,S=u?l.measuredPixelSizeBeforeCollapse??l.measuredPixelSize??h:l.measuredPixelSizeBeforeCollapse,C=t>0?Pe(h,t):0;n[g.index]={...l,size:h,percentageSize:C,preferredPercentageSize:l.preferredPercentageSize,preferredPixelSize:g.isPixelPanel?l.preferredPixelSize??h:l.preferredPixelSize,sizeBeforeCollapse:o,measuredPixelSizeBeforeCollapse:S,measuredPixelSize:void 0,measuredPercentageSize:void 0}}return Ae(n)},Ae=e=>{let t=0;for(const r of e)r.collapsed||(t+=Math.max(r.size,0));if(t<=0){let r=!1;const a=e.map(i=>(i.percentageSize??0)!==0?(r=!0,{...i,percentageSize:0,measuredPercentageSize:i.measuredPercentageSize!==void 0?0:i.measuredPercentageSize}):!i.collapsed&&i.sizeBeforeCollapse!==i.size?(r=!0,{...i,sizeBeforeCollapse:i.size}):i);return r?a:e}let n=!1;const f=e.map(r=>{if(r.collapsed)return(r.percentageSize??0)!==0?(n=!0,{...r,percentageSize:0,measuredPercentageSize:r.measuredPercentageSize!==void 0?0:r.measuredPercentageSize}):r;const a=Pe(r.size,t),i=r.measuredPercentageSize,h=(i!==void 0?Math.abs(i-a):1/0)<1e-4&&i!==void 0?i:a,l=pt(h,mt),o=Math.abs((r.percentageSize??0)-l)>0||r.percentageSize===void 0,S=r.sizeBeforeCollapse===void 0||r.sizeBeforeCollapse!==r.size,C=De(r),M=C&&S,E=r.measuredPixelSize??r.size,R=C&&(r.measuredPixelSizeBeforeCollapse===void 0||r.measuredPixelSizeBeforeCollapse!==E);if(!(o||M||R))return r;n=!0;const T=M?r.size:r.sizeBeforeCollapse,B=R?E:r.measuredPixelSizeBeforeCollapse;return{...r,percentageSize:l,sizeBeforeCollapse:T,measuredPixelSizeBeforeCollapse:B,collapsedByDirection:r.collapsed?r.collapsedByDirection??null:null}});return n?f:e},qe=(e,t)=>{if(t<=0)return!1;const n=[];let f=0;for(let l=0;l<e.length;l+=1){const u=e[l];!u||u.collapsed||(n.push(l),f+=u.size)}if(n.length===0)return!1;let r=t-f;if(Math.abs(r)<=0)return!1;let a=!1;const i=l=>{const u=e[l],o=$(u.minSize,0,t),S=$(u.autoMinSize,0,t),C=Math.max(o,S),M=$(u.maxSize,t,t),E=u.sizeUnit==="percentage"&&u.originalPixelSize===void 0;return{index:l,minSize:C,maxSize:M,isFlexible:E}},z=(l,u)=>{if(!Number.isFinite(u)||Math.abs(u)<=0)return;const o=e[l];if(!o)return;const S=Math.max(0,o.size+u);if(Math.abs(S-o.size)<=0)return;const C=Pe(S,t),M=De(o),E=M?S:o.sizeBeforeCollapse,R=M?o.measuredPixelSizeBeforeCollapse??o.measuredPixelSize??S:o.measuredPixelSizeBeforeCollapse;e[l]={...o,size:S,percentageSize:C,sizeBeforeCollapse:E,measuredPixelSizeBeforeCollapse:R,measuredPixelSize:void 0,measuredPercentageSize:void 0},r-=u,a=!0},g=l=>{for(const u of l){if(Math.abs(r)<=0)break;const o=e[u.index];if(!o||o.collapsed)continue;const S=o.size;if(r>0){const C=Math.max(0,u.maxSize-S);if(C<=0)continue;const M=Math.min(C,r);if(M<=0)continue;z(u.index,M)}else{const C=Math.max(0,S-u.minSize);if(C<=0)continue;const M=Math.min(C,Math.abs(r));if(M<=0)continue;z(u.index,-M)}}},h=n.map(l=>i(l)).filter(l=>l.isFlexible);if(h.length>0&&g(h),Math.abs(r)>0){const l=r;r=xt(e,r,t,{enforceAutoMinSize:!0}),Math.abs(r-l)>0&&(a=!0)}return a},ct=(e,t,n)=>{if(!(e.sizeUnit==="pixels"||e.originalPixelSize!==void 0)||e.pixelAdjustPriority!==void 0)return e;const r=t.filter((i,z)=>z!==n&&(i.sizeUnit==="pixels"||i.originalPixelSize!==void 0)).map(i=>i.pixelAdjustPriority).filter(i=>i!==void 0),a=r.length>0?Math.max(...r)+1:1;return{...e,pixelAdjustPriority:a}},At=(e,t)=>{switch(t.type){case"REGISTER_PANEL":{ue.debug("REGISTER_PANEL",t.panel);const n=e.findIndex(a=>a.id===t.panel.id);if(n>=0){const a=[...e],i=e[n],z={...i,minSize:t.panel.minSize,maxSize:t.panel.maxSize,collapseFromStart:t.panel.collapseFromStart,collapseFromEnd:t.panel.collapseFromEnd,collapsedByDirection:t.panel.collapsedByDirection!==void 0?t.panel.collapsedByDirection:i.collapsedByDirection,sizeUnit:t.panel.sizeUnit,originalPixelSize:t.panel.originalPixelSize,preferredPercentageSize:t.panel.preferredPercentageSize!==void 0?t.panel.preferredPercentageSize:i.preferredPercentageSize,preferredPercentageSizeBeforeCollapse:t.panel.preferredPercentageSizeBeforeCollapse!==void 0?t.panel.preferredPercentageSizeBeforeCollapse:i.preferredPercentageSizeBeforeCollapse,percentageSizeBeforeCollapse:t.panel.percentageSizeBeforeCollapse!==void 0?t.panel.percentageSizeBeforeCollapse:i.percentageSizeBeforeCollapse,pixelAdjustPriority:t.panel.pixelAdjustPriority!==void 0?t.panel.pixelAdjustPriority:i.pixelAdjustPriority,flexAdjustPriority:t.panel.flexAdjustPriority!==void 0?t.panel.flexAdjustPriority:i.flexAdjustPriority,autoMinSize:t.panel.autoMinSize!==void 0?t.panel.autoMinSize:i.autoMinSize,excludeFromAutoGrowth:t.panel.excludeFromAutoGrowth!==void 0?t.panel.excludeFromAutoGrowth:i.excludeFromAutoGrowth},g=ct(z,e,n);if(ue.debug("register panel (update)",{panelId:g.id,incoming:We(t.panel),previous:We(i),next:We(g)}),a[n]=g,!g.collapsed){const h=a.reduce((l,u)=>u.collapsed?l:l+u.size,0);if(h>0){const l=$(g.minSize,0,h),u=Math.max(l,$(g.maxSize,h,h));if(g.size<l-Be||g.size>u+Be)return Ve(a,h)}}return a}const f={...t.panel},r=ct(f,e);return ue.debug("register panel (insert)",{panelId:r.id,incoming:We(r),previousLength:e.length}),[...e,r]}case"UNREGISTER_PANEL":{ue.debug("UNREGISTER_PANEL",t.id);const n=e.filter(r=>r.id!==t.id),f=Ae(n);return ue.enabledFor(Le.DEBUG)&&ue.debug("unregister panel",{panelId:t.id,previous:Me(e),filtered:Me(n),next:Me(f)}),f}case"RESIZE_PANELS":{ue.debug("RESIZE_PANELS",t.leftId,t.rightId,t.leftSize,t.rightSize);const n=e.findIndex(I=>I.id===t.leftId),f=e.findIndex(I=>I.id===t.rightId);if(n===-1||f===-1)return e;const r=[...e],a=r[n],i=r[f];if(a.collapsed||i.collapsed||t.leftSize===a.size&&t.rightSize===i.size)return e;const z=t.containerSize??e.reduce((I,W)=>I+W.size,0),g=$(a.minSize,0,z),h=$(a.maxSize,z,z),l=$(i.minSize,0,z),u=$(i.maxSize,z,z),o=a.size+i.size,S=e.reduce((I,W)=>W.collapsed?I:I+W.size,0),C=S-o,M=g+l,E=h+u,R=de(t.leftSize+t.rightSize,M,E);let T=z>0?z-C:R;Number.isFinite(T)||(T=R);const B=de(Math.max(R,T),M,E),O=I=>({min:Math.max(g,I-u),max:Math.min(h,I-l)}),re=I=>({min:Math.max(l,I-h),max:Math.min(u,I-g)}),Q=Math.abs(t.leftSize-a.size),fe=Math.abs(t.rightSize-i.size),k=Q>=fe;let H=a.size,w=i.size;if(k){const I=O(B);if(I.min>I.max+Be)return e;const W=de(t.leftSize,I.min,I.max),ae=B-W;if(ae<l-Be||ae>u+Be)return e;H=W,w=de(ae,l,u)}else{const I=re(B);if(I.min>I.max+Be)return e;const W=de(t.rightSize,I.min,I.max),ae=B-W;if(ae<g-Be||ae>h+Be)return e;w=W,H=de(ae,g,h)}const V=H+w;if(Math.abs(B-V)>Be)return e;const le=S-a.size-i.size+V,j=z>0?z:le,U=j>0?Pe(H,j):0,ee=j>0?Pe(w,j):0,G=a.sizeUnit==="pixels"||a.originalPixelSize!==void 0?H:a.preferredPixelSize,ne=i.sizeUnit==="pixels"||i.originalPixelSize!==void 0?w:i.preferredPixelSize,ye=$(a.autoMinSize,0,z),ze=$(i.autoMinSize,0,z),ce=Math.max(.001,ye),Ee=Math.max(.001,ze),ge=a.sizeUnit==="percentage"&&a.originalPixelSize===void 0,se=i.sizeUnit==="percentage"&&i.originalPixelSize===void 0;let oe=a.excludeFromAutoGrowth,he=i.excludeFromAutoGrowth;ge&&(H<=ce?oe=!0:H>ce&&(oe=!1)),se&&(w<=Ee?he=!0:w>Ee&&(he=!1));const me=De(a),be=De(i);return r[n]={...a,size:H,percentageSize:U,preferredPercentageSize:U>0?U:a.preferredPercentageSize,preferredPixelSize:G,sizeBeforeCollapse:me?H:a.sizeBeforeCollapse,measuredPixelSize:void 0,measuredPercentageSize:void 0,excludeFromAutoGrowth:oe},r[f]={...i,size:w,percentageSize:ee,preferredPercentageSize:ee>0?ee:i.preferredPercentageSize,preferredPixelSize:ne,sizeBeforeCollapse:be?w:i.sizeBeforeCollapse,measuredPixelSize:void 0,measuredPercentageSize:void 0,excludeFromAutoGrowth:he},z>0&&qe(r,z)?Ae(r):r}case"SET_PANELS":{ue.debug("SET_PANELS",t.panels);const n=ue.enabledFor(Le.DEBUG),f=t.panels.map(h=>{const l=h.sizeUnit==="pixels"||h.originalPixelSize!==void 0,u=h.preferredPercentageSize!==void 0?h.preferredPercentageSize:h.percentageSize,o=h.preferredPixelSize!==void 0?h.preferredPixelSize:l?h.size:h.preferredPixelSize;return{...h,preferredPercentageSize:u,preferredPixelSize:o}}),r=Me(e),a=n?Me(f):null,i=Ae(f),z=Me(i);let g=r.length===z.length;if(g)for(let h=0;h<z.length;h+=1){const l=z[h],u=r[h];if(!u){g=!1;break}if(!(u.id===l.id&&u.size===l.size&&u.percentageSize===l.percentageSize&&u.preferredPercentageSize===l.preferredPercentageSize&&u.sizeBeforeCollapse===l.sizeBeforeCollapse&&u.percentageSizeBeforeCollapse===l.percentageSizeBeforeCollapse&&u.preferredPercentageSizeBeforeCollapse===l.preferredPercentageSizeBeforeCollapse&&u.measuredPercentageSize===l.measuredPercentageSize&&u.excludeFromAutoGrowth===l.excludeFromAutoGrowth&&u.collapsed===l.collapsed&&u.collapseFromStart===l.collapseFromStart&&u.collapseFromEnd===l.collapseFromEnd&&u.collapsedByDirection===l.collapsedByDirection)){g=!1;break}}return g?(n&&ue.debug("set panels skipped (no diff)",{previous:r,incoming:a,next:z,previousLength:r.length,incomingLength:a?.length??f.length}),e):(n&&ue.debug("set panels",{previous:r,incoming:a,next:z,previousLength:r.length,incomingLength:a?.length??f.length}),i)}case"CONTAINER_RESIZED":{ue.debug("CONTAINER_RESIZED",t.containerSize);const n=ue.enabledFor(Le.DEBUG);if(t.containerSize<=0)return n&&ue.debug("container resized skipped (non-positive size)",{containerSize:t.containerSize,panels:Me(e)}),e;n&&ue.debug("container resized (before)",{containerSize:t.containerSize,panels:Me(e)});const f=Ve(e,t.containerSize);if(n&&ue.debug("container resized (after recalc)",{containerSize:t.containerSize,panels:Me(f)}),t.containerSize>0&&qe(f,t.containerSize)){const r=Ae(f);return n&&ue.debug("container resized (after reconcile)",{containerSize:t.containerSize,panels:Me(r)}),r}return n&&ue.debug("container resized (final)",{containerSize:t.containerSize,panels:Me(f)}),f}case"COLLAPSE_PANEL":{ue.debug("COLLAPSE_PANEL",t.id);const n=e.findIndex(o=>o.id===t.id);if(n===-1)return e;const f=e[n],r=t.from==="start"?f.collapseFromStart:f.collapseFromEnd;if(!(De(f)&&r)||f.collapsed)return e;const i=f.size,z=f.measuredPixelSize??i,g=f.percentageSize??f.preferredPercentageSize??0,h={...f,collapsed:!0,collapsedByDirection:t.from,sizeBeforeCollapse:i,percentageSizeBeforeCollapse:g,preferredPercentageSizeBeforeCollapse:f.preferredPercentageSize??g,preferredPixelSizeBeforeCollapse:f.preferredPixelSize??i,measuredPixelSizeBeforeCollapse:z,size:0,percentageSize:0,preferredPercentageSize:f.preferredPercentageSize,measuredPixelSize:f.measuredPixelSize!==void 0?0:f.measuredPixelSize,measuredPercentageSize:f.measuredPercentageSize!==void 0?0:f.measuredPercentageSize},l=[...e];l[n]=h;const u=Ve(l,t.containerSize);return t.containerSize>0&&qe(u,t.containerSize)?Ae(u):u}case"EXPAND_PANEL":{ue.debug("EXPAND_PANEL",t.id,t.targetSize);const n=e.findIndex(B=>B.id===t.id);if(n===-1)return e;const f=t.containerSize,r=e[n],a=t.from==="start"?r.collapseFromStart:r.collapseFromEnd;if(!(De(r)&&a&&r.collapsed)||r.collapsedByDirection&&r.collapsedByDirection!==t.from)return e;const z=[t.targetSize,r.sizeBeforeCollapse,r.measuredPixelSizeBeforeCollapse,r.preferredPixelSizeBeforeCollapse,r.originalPixelSize].find(B=>B!==void 0)??0,g=$(r.minSize,0,f),h=$(r.maxSize,f,f),l=de(z,g,h),u=Pe(l,f),o=r.measuredPixelSizeBeforeCollapse??l,S=Pe(o,f),C=r.preferredPercentageSizeBeforeCollapse??r.percentageSizeBeforeCollapse??u,M=r.preferredPixelSizeBeforeCollapse??r.preferredPixelSize??l,E={...r,collapsed:!1,collapsedByDirection:null,size:l,percentageSize:u,preferredPercentageSize:C,preferredPixelSize:M,sizeBeforeCollapse:l,percentageSizeBeforeCollapse:void 0,preferredPercentageSizeBeforeCollapse:void 0,preferredPixelSizeBeforeCollapse:void 0,measuredPixelSize:l,measuredPixelSizeBeforeCollapse:o,measuredPercentageSize:S},R=[...e];R[n]=E;const T=Ve(R,f);return f>0&&qe(T,f)?Ae(T):T}default:return e}},Oe=new He(Le.INFO,"[resize-panels]"),Ct=({direction:e,style:t,onLayout:n,autoSaveId:f,showDebugInfo:r=!1})=>{const[a,i]=s.useReducer(At,[]),[z,g]=s.useState({width:0,height:0}),[h,l]=s.useState(!1),[u,o]=s.useState(!1),[S,C]=s.useState(null),[M,E]=s.useState({}),[R,T]=s.useState({}),B=s.useRef(null),O=s.useRef(n),re=s.useRef(!1),Q=s.useRef(0),fe=s.useRef(z),k=s.useRef(z),H=s.useRef(h),w=s.useRef(S?.reason??null),V=s.useRef({}),le=s.useRef(null),j=s.useRef(null),U=s.useRef(null),ee=s.useRef({width:0,height:0}),G=s.useRef({width:0,height:0}),ne=s.useRef({}),ye=s.useRef({}),ze=s.useCallback(d=>d.map(P=>({...P})),[]);s.useEffect(()=>{k.current=z},[z]),s.useEffect(()=>{H.current=h},[h]),s.useEffect(()=>{w.current=S?.reason??null},[S?.reason]),s.useEffect(()=>{if(S)return;const d=e==="horizontal"?z.width:z.height;!Number.isFinite(d)||d<=4||a.length!==0&&(le.current=ze(a))},[S,a,e,z.width,z.height,ze]);const ce=s.useRef(a);s.useEffect(()=>{ce.current=a},[a]),s.useEffect(()=>{const d=j.current;if(S){j.current=S;return}if(d&&!S&&le.current){j.current=null;const P=new Set(ce.current.map(m=>m.id)),p=ze(le.current).filter(m=>P.has(m.id));p.length>0&&i({type:"SET_PANELS",panels:p});return}j.current=S},[S,ze]),s.useLayoutEffect(()=>{if(!B.current)return;const d=new ResizeObserver(P=>{for(const p of P){const m=p.target,y=m?Ie(m,"horizontal"):null,N=m?Ie(m,"vertical"):null,A=y?y.inner:0,v=N?N.inner:0,_=p.contentRect.width,D=p.contentRect.height,b=A>0?A:_,x=v>0?v:D;ee.current={width:b,height:x};const L=G.current,q=Math.abs(L.width-b)>=.5,K=Math.abs(L.height-x)>=.5;q||K?(U.current&&(clearTimeout(U.current),U.current=null),!h&&b>0&&x>0&&l(!0),g({width:b,height:x}),G.current={width:b,height:x}):(U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{const Z=ee.current;g(Z),G.current=Z,U.current=null},150))}});return d.observe(B.current),()=>{d.disconnect(),U.current&&clearTimeout(U.current)}},[h]),s.useEffect(()=>()=>{for(const d of Object.values(ne.current))clearTimeout(d)},[]),s.useLayoutEffect(()=>{const d=fe.current,P=z,p=e==="horizontal"?Math.abs(d.width-P.width)>=.5:Math.abs(d.height-P.height)>=.5;if(u&&p){const m=e==="horizontal"?P.width:P.height;i({type:"CONTAINER_RESIZED",containerSize:m,direction:e})}fe.current=P},[z,u,e]);const Ee=s.useCallback(()=>{Oe.debug("panels[0]?.id",a[0]?.id);const d=a.some(c=>{if(c.collapsed||c.sizeUnit!=="percentage")return!1;const te=c.collapseFromStart||c.collapseFromEnd?c.sizeBeforeCollapse??c.measuredPixelSizeBeforeCollapse??c.originalPixelSize??c.measuredPixelSize??0:c.measuredPixelSize??c.originalPixelSize??c.size,J=c.percentageSize!==void 0&&c.percentageSize>0;return c.size<=0&&(te>0||J)}),P=e==="horizontal"?z.width:z.height,p=P>0;if(S||!p||!(a.length>0&&(a.length!==Q.current||!u||d)))return;const N=a.filter(c=>!c.collapsed&&(c.originalPixelSize!==void 0||c.sizeUnit==="pixels")).reduce((c,F)=>{const te=F.preferredPixelSize??F.originalPixelSize??F.size;return c+Math.max(0,te??0)},0),A=a.filter(c=>c.sizeUnit==="percentage"&&!c.collapsed),v=A.map(c=>c.id),_=A.map(c=>{const F=c.preferredPercentageSize??c.percentageSize;return F!==void 0&&F>0?je(F,P):c.size>0?c.size:0}),D=_.reduce((c,F)=>c+F,0),b=P-N,x=Math.max(0,b),L=x>0,q=a.map(c=>{if(c.collapsed){const F=c.sizeBeforeCollapse??c.measuredPixelSizeBeforeCollapse??c.originalPixelSize??(c.sizeUnit==="pixels"?c.size:void 0),te=c.sizeUnit==="percentage"&&c.percentageSize!==void 0?je(c.percentageSize,P):void 0,J=F??te??0,ie=c.measuredPixelSizeBeforeCollapse??c.measuredPixelSize??J;return{...c,size:0,percentageSize:0,preferredPercentageSize:c.preferredPercentageSize,sizeBeforeCollapse:J,percentageSizeBeforeCollapse:c.percentageSizeBeforeCollapse??c.percentageSize??c.preferredPercentageSize??0,preferredPercentageSizeBeforeCollapse:c.preferredPercentageSizeBeforeCollapse??c.preferredPercentageSize??c.percentageSize??void 0,preferredPixelSizeBeforeCollapse:c.preferredPixelSizeBeforeCollapse??c.preferredPixelSize??J,measuredPixelSizeBeforeCollapse:ie}}if(c.sizeUnit==="pixels"||c.originalPixelSize!==void 0){const F=c.size,te=P>0?Pe(F,P):0,J={...c,size:F,percentageSize:te,preferredPixelSize:c.preferredPixelSize??c.originalPixelSize??F,preferredPercentageSize:c.preferredPercentageSize!==void 0?c.preferredPercentageSize:te>0?te:void 0};if(c.collapseFromStart||c.collapseFromEnd){const ie=c.sizeBeforeCollapse??F,Te=c.measuredPixelSizeBeforeCollapse??c.measuredPixelSize??ie;J.sizeBeforeCollapse=ie,J.measuredPixelSizeBeforeCollapse=Te,J.preferredPixelSizeBeforeCollapse=c.preferredPixelSizeBeforeCollapse??c.preferredPixelSize??ie}return J}if(c.sizeUnit==="percentage"){const F=v.indexOf(c.id),te=F!==-1?_[F]:0,J=$(c.minSize,0,P),ie=$(c.maxSize,P,P),Te=Math.max(J,c.sizeBeforeCollapse??0,c.measuredPixelSizeBeforeCollapse??0,c.measuredPixelSize??0,c.originalPixelSize??0,c.size>0?c.size:0,c.percentageSize!==void 0?je(c.percentageSize,P):0,1),ke=te>0?te:Te;let ve;if(!L)ve=J;else if(F!==-1&&D>0){const pe=ke/D,Se=x*pe;ve=de(Se,J,ie)}else{const pe=c.percentageSize!==void 0?je(c.percentageSize,P):c.size,Se=pe>0?pe:ke;ve=de(Se,J,ie)}const Re=P>0?Pe(ve,P):0,we={...c,size:ve,percentageSize:Re,preferredPercentageSize:c.preferredPercentageSize!==void 0?c.preferredPercentageSize:Re>0?Re:void 0};if(c.collapseFromStart||c.collapseFromEnd){const pe=c.sizeBeforeCollapse??ve,Se=c.measuredPixelSizeBeforeCollapse??c.measuredPixelSize??pe;we.sizeBeforeCollapse=pe,we.measuredPixelSizeBeforeCollapse=Se,we.preferredPixelSizeBeforeCollapse=c.preferredPixelSizeBeforeCollapse??c.preferredPixelSize??pe}return we}return c}),K=[];for(let c=0;c<q.length;c+=1){const F=q[c];F.sizeUnit==="percentage"&&!F.collapsed&&K.push(c)}const Z=K.reduce((c,F)=>c+q[F].size,0),Y=b-Z;Math.abs(Y)>0&&xt(q,Y,P,{enforceAutoMinSize:!0}),i({type:"SET_PANELS",panels:q}),Q.current=a.length,o(!0)},[a,e,z.width,z.height,u,S]);s.useEffect(()=>{const d=e==="horizontal"?z.width:z.height,P=d>0,p=P&&a.length>0;if(P&&a.length===0){S&&C(null);return}const m=p?a.reduce((D,b)=>{if(b.collapsed)return D;const x=$(b.minSize,0,d);return D+Math.max(0,x)},0):null,y=p?a.reduce((D,b)=>{if(b.collapsed)return D;const x=$(b.maxSize,d,d);return D+Math.max(0,x)},0):null,N=m??S?.totalMinimumSize??null,A=y??S?.totalMaximumSize??null;if(!P){S&&C(D=>!D||D.availableContainerSize===d?D:{reason:D.reason,totalMinimumSize:null,totalMaximumSize:null,availableContainerSize:d});return}const v=N!==null&&N-d>Number.EPSILON,_=A!==null&&d-A>Number.EPSILON;if(v||_){const b={reason:v?"minimum-exceeded":"maximum-insufficient",totalMinimumSize:N,totalMaximumSize:A,availableContainerSize:d};C(x=>x&&x.reason===b.reason&&Math.abs((x.totalMinimumSize??0)-(b.totalMinimumSize??0))<=Number.EPSILON&&Math.abs((x.totalMaximumSize??0)-(b.totalMaximumSize??0))<=Number.EPSILON&&Math.abs(x.availableContainerSize-b.availableContainerSize)<=Number.EPSILON?x:b);return}if(S){const D=S.reason==="minimum-exceeded",b=S.reason==="maximum-insufficient";(!D||N!==null)&&(!b||A!==null)&&!v&&!_&&C(Z=>Z&&null)}},[a,e,z.width,z.height,S]),s.useEffect(()=>{Ee()},[Ee]),s.useEffect(()=>{O.current=n},[n]);const ge=s.useMemo(()=>a.map(d=>d.size),[a]),se=s.useRef(!1);s.useLayoutEffect(()=>{if(a.length===0){se.current=!1;return}!se.current&&(u||a.every(d=>d.collapsed||d.size>0))&&(se.current=!0),se.current&&O.current&&O.current(ge)},[ge,a,u]),s.useEffect(()=>{if(f&&ge.length>0&&se.current){const d=setTimeout(()=>{Pt(f,ge)},200);return()=>clearTimeout(d)}},[f,ge]),s.useEffect(()=>{if(!f||a.length===0||re.current)return;const d=e==="horizontal"?z.width:z.height;if(d<=0)return;const P=bt(f);if(P&&P.length===a.length){const p=a.map((m,y)=>{const N=$(m.minSize,0,d),A=$(m.maxSize,d,d),v=de(P[y],N,A),_=Pe(v,d),D=m.sizeUnit==="pixels"||m.originalPixelSize!==void 0?v:m.preferredPixelSize;return{...m,size:v,percentageSize:_,preferredPercentageSize:_>0?_:m.preferredPercentageSize,preferredPixelSize:D}});i({type:"SET_PANELS",panels:p}),re.current=!0}},[f,a,z.width,z.height,e]);const oe=s.useCallback(d=>{const P=k.current,p=V.current,m=JSON.stringify({id:d.id,size:d.size??null,percentageSize:d.percentageSize??null,preferredPercentageSize:d.preferredPercentageSize??null,preferredPixelSize:d.preferredPixelSize??null,sizeUnit:d.sizeUnit,originalPixelSize:d.originalPixelSize??null,minSize:d.minSize??null,maxSize:d.maxSize??null,collapseFromStart:d.collapseFromStart,collapseFromEnd:d.collapseFromEnd,collapsed:d.collapsed??!1,collapsedByDirection:d.collapsedByDirection??null,sizeBeforeCollapse:d.sizeBeforeCollapse??null,percentageSizeBeforeCollapse:d.percentageSizeBeforeCollapse??null,preferredPercentageSizeBeforeCollapse:d.preferredPercentageSizeBeforeCollapse??null,preferredPixelSizeBeforeCollapse:d.preferredPixelSizeBeforeCollapse??null,pixelAdjustPriority:d.pixelAdjustPriority??null,flexAdjustPriority:d.flexAdjustPriority??null,autoMinSize:d.autoMinSize??null});if(p[d.id]===m){Oe.debug("useResizablePanels.registerPanel skipped",{panelId:d.id,reason:"duplicate-registration"});return}p[d.id]=m,Oe.debug("useResizablePanels.registerPanel",{panelId:d.id,containerReady:H.current,violationReason:w.current,containerSize:{width:P.width,height:P.height}}),i({type:"REGISTER_PANEL",panel:d})},[]),he=s.useCallback(d=>{const P=k.current;Oe.debug("useResizablePanels.unregisterPanel",{panelId:d,containerReady:H.current,violationReason:w.current,containerSize:{width:P.width,height:P.height}}),i({type:"UNREGISTER_PANEL",id:d}),delete V.current[d],ne.current[d]&&(clearTimeout(ne.current[d]),delete ne.current[d]),delete ye.current[d],E(p=>{if(!(d in p))return p;const m={...p};return delete m[d],m})},[]),me=s.useCallback((d,P,p,m)=>{const y=e==="horizontal"?z.width:z.height,N=a.find(Z=>Z.id===d),A=a.find(Z=>Z.id===P);if(!(N&&A)){i({type:"RESIZE_PANELS",leftId:d,rightId:P,leftSize:p,rightSize:m,containerSize:y});return}if(N.collapsed||A.collapsed)return;const v=$(N.minSize,0,y),_=$(N.maxSize,y,y),D=$(A.minSize,0,y),b=$(A.maxSize,y,y);let x=de(p,v,_),L=de(m,D,b);const q=x+L,K=p+m;if(Math.abs(q-K)>1e-9){const Z=K-q;if(Z>0){const Y=_-x,c=b-L,F=Y+c;if(F>0){const te=Math.min(Z*(Y/F),Y),J=Math.min(Z-te,c);x+=te,L+=J}}else if(Z<0){const Y=Math.abs(Z),c=x-v,F=L-D,te=c+F;if(te>0){const J=Math.min(Y*(c/te),c),ie=Math.min(Y-J,F);x-=J,L-=ie}}}x=de(x,v,_),L=de(L,D,b),Math.abs(x+L-K)>1e-9&&Oe.error("Total size after constraints should be close to the original total size.",{constrainedLeftSize:x,constrainedRightSize:L,originalTotalSize:K}),i({type:"RESIZE_PANELS",leftId:d,rightId:P,leftSize:x,rightSize:L,containerSize:y})},[e,z.width,z.height,a]),be=s.useCallback((d,P)=>{const p=e==="horizontal"?z.width:z.height;i({type:"COLLAPSE_PANEL",id:d,from:P,containerSize:p})},[e,z.width,z.height]),I=s.useCallback((d,P,p)=>{const m=e==="horizontal"?z.width:z.height;i({type:"EXPAND_PANEL",id:d,from:P,containerSize:m,targetSize:p})},[e,z.width,z.height]),W=s.useCallback(d=>a.find(P=>P.id===d),[a]),ae=s.useCallback((d,P)=>{if(P===null){ne.current[d]&&(clearTimeout(ne.current[d]),delete ne.current[d]),delete ye.current[d],E(p=>{if(!(d in p))return p;const m={...p};return delete m[d],m});return}E(p=>{const m=p[d],y=m&&Math.abs(m.pixelSize-P.pixelSize)<.1,N=m&&Math.abs(m.percentageSize-P.percentageSize)<.01;return y&&N?(ne.current[d]&&clearTimeout(ne.current[d]),ye.current[d]=P,ne.current[d]=setTimeout(()=>{const A=ye.current[d];A&&E(v=>({...v,[d]:A})),delete ne.current[d]},200),p):(ne.current[d]&&(clearTimeout(ne.current[d]),delete ne.current[d]),{...p,[d]:P})})},[]),Ce=s.useCallback((d,P)=>{T(p=>{if(P===null){if(!(d in p))return p;const y={...p};return delete y[d],y}const m=p[d];return m&&Math.abs(m.thickness-P.thickness)<=.25&&m.visible===P.visible&&m.direction===P.direction&&m.startPanelId===P.startPanelId&&m.endPanelId===P.endPanelId?p:{...p,[d]:P}})},[]),Fe=s.useMemo(()=>({direction:e,panels:a,containerSize:z,isContainerReady:h,showDebugInfo:r,registerPanel:oe,unregisterPanel:he,resizePanels:me,collapsePanel:be,expandPanel:I,getPanel:W,reportPanelMeasurement:ae,panelMeasurements:M,reportHandleMeasurement:Ce,handleMeasurements:R,layoutConstraintViolation:S}),[e,a,z,h,r,oe,he,me,be,I,W,ae,M,Ce,R,S]),Ne=s.useMemo(()=>({display:"flex",flexDirection:e==="horizontal"?"row":"column",alignItems:"stretch",width:"100%",height:"100%",minWidth:"0px",minHeight:"0px",position:"relative",overflow:"hidden",...t}),[e,t]);return{groupRef:B,contextValue:Fe,groupStyle:Ne}},Dt=e=>{const{getPanel:t,collapsePanel:n,expandPanel:f}=Xe(),r=t(e),a=s.useCallback(g=>{n(e,g)},[n,e]),i=s.useCallback((g,h)=>{f(e,g,h)},[f,e]),z=s.useCallback((g,h)=>{r?.collapsed?i(g,h):a(g)},[r?.collapsed,a,i]);return s.useMemo(()=>({panel:r,isCollapsed:r?.collapsed??!1,canCollapseFromStart:r?.collapseFromStart??!1,canCollapseFromEnd:r?.collapseFromEnd??!1,collapse:a,expand:i,toggle:z}),[r,a,i,z])},Lt=({panel:e,measuredPixelSize:t,measuredPercentageSize:n,containerAxisSize:f,containerLabel:r})=>{const a=e?.size,i=typeof a=="number"&&Number.isFinite(a)?`${a.toFixed(3)}px`:"-",z=e?.percentageSize!==void 0?`${e.percentageSize.toFixed(3)}%`:"-",g=Number.isFinite(t)?`${t.toFixed(3)}px`:"-",h=Number.isFinite(n)?`${n.toFixed(3)}%`:"-",l=Number.isFinite(f)?`${f.toFixed(3)}px`:"-",u=`${i} / ${z}`,o=`${g} / ${h}`,S=e?.sizeUnit==="pixels"?"Fixed":"Flexible",C=[S,`${r}: ${l}`,`size (state): ${u}`,`size (measured): ${o}`];return{stateValueDisplay:u,measuredValueDisplay:o,containerDisplay:l,headlineLabel:S,titleText:C.join(`
2
- `)}},Tt=s.memo(({panel:e,measuredPixelSize:t,measuredPercentageSize:n,containerAxisSize:f,direction:r})=>{const a=r==="horizontal"?"container width":"container height",{stateValueDisplay:i,measuredValueDisplay:z,containerDisplay:g,headlineLabel:h,titleText:l}=s.useMemo(()=>Lt({panel:e,measuredPixelSize:t,measuredPercentageSize:n,containerAxisSize:f,containerLabel:a}),[e,t,n,f,a]),u={position:"absolute",top:"2px",right:"4px",backgroundColor:"rgba(30, 41, 59, 0.6)",color:"#fff",padding:"4px 8px",borderRadius:"6px",fontSize:"11px",fontFamily:"monospace",pointerEvents:"auto",zIndex:10,boxShadow:"0 2px 4px rgba(0,0,0,0.3)",border:"1px solid rgba(255,255,255,0.1)",maxWidth:"calc(100% - 12px)",minWidth:"60px",width:"fit-content",overflow:"hidden"},o={display:"flex",flexDirection:"column",gap:"1px",minWidth:"0",width:"100%"},S={display:"flex",justifyContent:"flex-start",alignItems:"center",gap:"6px",fontSize:"10px",color:"#ccc",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:"0",width:"100%"},C={display:"flex",justifyContent:"space-between",alignItems:"center",gap:"6px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",minWidth:"0",width:"100%"},M={marginLeft:"auto",fontVariantNumeric:"tabular-nums",whiteSpace:"nowrap"};return X.jsx("div",{style:u,title:l,children:X.jsxs("div",{style:o,children:[X.jsx("div",{style:S,children:X.jsx("span",{children:h})}),X.jsxs("div",{style:C,children:[X.jsx("span",{children:a}),X.jsx("span",{style:M,children:g})]}),X.jsxs("div",{style:C,children:[X.jsx("span",{children:"size (state)"}),X.jsx("span",{style:M,children:i})]}),X.jsxs("div",{style:C,children:[X.jsx("span",{children:"size (measured)"}),X.jsx("span",{style:M,children:z})]})]})})}),Ze=new He(Le.INFO,"[resize-panels]"),kt={both:{collapseFromStart:!0,collapseFromEnd:!0},start:{collapseFromStart:!0,collapseFromEnd:!1},end:{collapseFromStart:!1,collapseFromEnd:!0}},_t=e=>{if(!e)return{collapseFromStart:!1,collapseFromEnd:!1};const t=kt[e.from];if(!t)throw new Error("Invalid collapsible configuration: unsupported 'from' value");return t},ut=({ref:e,setState:t,panelIdRef:n,label:f,timerRef:r})=>a=>{if(!Number.isFinite(a))return;const i=a<0?0:a,z=f==="pixel"?.1:.01;if(Math.abs(e.current-i)<z){r&&(r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{e.current=i,t(i),r.current=null},200));return}r?.current&&(clearTimeout(r.current),r.current=null),e.current=i,Ze.debug(`commit ${f}`,{panelId:n.current,[f]:i}),t(i)},Ot=s.memo(({id:e,defaultSize:t={value:50,unit:"percentage"},minSize:n,maxSize:f,autoMinSize:r,className:a,style:i,children:z,order:g=0,collapsible:h,defaultCollapsed:l=!1,pixelAdjustPriority:u,flexAdjustPriority:o,contentOverflow:S="auto"})=>{const{direction:C,registerPanel:M,unregisterPanel:E,getPanel:R,showDebugInfo:T,isContainerReady:B,reportPanelMeasurement:O,containerSize:re}=Xe(),Q=s.useRef(null),fe=s.useId(),k=s.useRef(e||`panel-${fe}`);s.useEffect(()=>{e&&e!==k.current&&Ze.warn("Panel id prop change after mount is ignored.",{currentId:k.current,attemptedId:e})},[e]);const H=s.useMemo(()=>_t(h),[h]),w=H.collapseFromStart||H.collapseFromEnd,V=s.useMemo(()=>w?H.collapseFromStart?"start":H.collapseFromEnd?"end":null:null,[w,H.collapseFromStart,H.collapseFromEnd]),le=w&&l,j=s.useMemo(()=>St(t),[t]),U=j?.unit==="pixels",ee=U?void 0:j?.value,G=R(k.current),ne=!!G?.collapsed,ye=(G?.size??0)<=0,ze=ne||ye,ce=s.useRef(G);ce.current=G;const Ee=s.useRef(ze);Ee.current=ze;const[ge,se]=s.useState(()=>U&&j?j.value:G?.size!==void 0?G.size:0),[oe,he]=s.useState(()=>!U&&j?j.value:G?.percentageSize!==void 0?G.percentageSize:0),me=s.useRef(ge),be=s.useRef(oe),I=s.useRef(null),W=s.useRef(null);s.useEffect(()=>()=>{I.current&&clearTimeout(I.current),W.current&&clearTimeout(W.current)},[]);const ae=s.useMemo(()=>ut({ref:me,setState:se,panelIdRef:k,label:"pixel",timerRef:I}),[]),Ce=s.useMemo(()=>ut({ref:be,setState:he,panelIdRef:k,label:"percentage",timerRef:W}),[]),Fe=s.useCallback(()=>{I.current&&(clearTimeout(I.current),I.current=null),W.current&&(clearTimeout(W.current),W.current=null),me.current!==0&&(me.current=0,se(0)),be.current!==0&&(be.current=0,he(0))},[]);s.useEffect(()=>{if(!B)return;let b=0;if(U&&j){let F=j.value;n&&typeof n=="object"&&n.unit==="pixels"&&(F=Math.max(F,n.value)),f&&typeof f=="object"&&f.unit==="pixels"&&(F=Math.min(F,f.value)),b=F}const x=le,L=x?V:null;l&&!w&&Ze.warn("Panel defaultCollapsed is ignored because collapsible configuration is not provided.");const q=w&&x&&U?b:void 0,K=w?ee:void 0,Z=U?b:void 0,Y={id:k.current,size:x?0:b,percentageSize:x?0:ee,preferredPercentageSize:ee,preferredPixelSize:Z,sizeUnit:j?.unit||"percentage",originalPixelSize:U?b:void 0,minSize:n,maxSize:f,collapseFromStart:H.collapseFromStart,collapseFromEnd:H.collapseFromEnd,collapsedByDirection:L,collapsed:x,sizeBeforeCollapse:q,percentageSizeBeforeCollapse:K,preferredPercentageSizeBeforeCollapse:w?ee:void 0,preferredPixelSizeBeforeCollapse:w?Z:void 0,pixelAdjustPriority:u,flexAdjustPriority:o,autoMinSize:r};M(Y)},[r,H.collapseFromEnd,H.collapseFromStart,l,j,o,w,B,U,f,n,u,V,ee,M,le]),s.useEffect(()=>()=>{E(k.current),O(k.current,null)},[E,O]);const Ne=G?.size??0,d=s.useCallback(()=>{const b=Q.current;if(!b)return;const x=ce.current;if(!x)return;const L=b.parentElement;if(!L)return;const q=b.getBoundingClientRect(),K=Ie(L,"horizontal"),Z=Ie(L,"vertical"),Y=C==="horizontal"?q.width:q.height,c=C==="horizontal"?K.inner:Z.inner,F=Qe(c);if(Ee.current){Fe();return}const te=x.size??0,J=Math.max(2,F*.5);if(te>F&&Y<J){Ze.debug("skip noisy measurement",{panelId:k.current,expectedPanelSize:te,measured:Y,noiseThreshold:J});return}if(Y>0){ae(Y),c>0&&Ce(Y/c*100);return}x.size!==void 0&&ae(x.size),x.percentageSize!==void 0?Ce(x.percentageSize):x.sizeUnit==="pixels"&&x.size!==void 0&&c>0&&Ce(x.size/c*100)},[Ce,ae,C,Fe]),P=s.useRef(!1);s.useEffect(()=>{!P.current&&G&&(P.current=!0,d())},[G,d]),s.useEffect(()=>{const b=Q.current;if(!b)return;const x=new ResizeObserver(()=>{d()});x.observe(b),d();const L=[],q=new MutationObserver(()=>{(()=>{if(!Q.current)return!1;const Y=Q.current.getBoundingClientRect();return(C==="horizontal"?Y.width:Y.height)!==me.current})()&&setTimeout(d,0)}),K=b.parentElement;return K&&q.observe(K,{childList:!0,attributes:!0,attributeFilter:["style","class"]}),()=>{x.disconnect(),q.disconnect();for(const Z of L)clearTimeout(Z)}},[C,d]);const p=G?.size,m=G?.percentageSize,y=G?.sizeUnit;s.useEffect(()=>{if(G){if(ze){Fe();return}if(p!==void 0&&ae(p),m!==void 0)Ce(m);else if(y==="pixels"&&p!==void 0){const b=Q.current,x=b?.parentElement;if(b&&x){const{width:L,height:q}=b.getBoundingClientRect(),K=x.clientWidth,Z=x.clientHeight,Y=C==="horizontal"?L:q,c=C==="horizontal"?K:Z;if(Y>0&&c>0){const F=Y/c*100;Ce(F)}}}}},[Ce,ae,G,m,p,y,C,ze,Fe]),s.useEffect(()=>{O(k.current,{pixelSize:ge,percentageSize:oe})},[O,ge,oe]);const N=()=>ze?"0px":G?.originalPixelSize!==void 0?`${Ne}px`:G?.percentageSize!==void 0?`${G.percentageSize}%`:`${Ne}px`,A=G?.sizeUnit==="percentage"&&!G?.collapsed?1:0,v={flexBasis:N(),flexGrow:0,flexShrink:A,overflow:"hidden",position:"relative",boxSizing:"border-box",minHeight:"0px",minWidth:"0px",...i};C==="horizontal"?(v.height="100%",v.minWidth=0):(v.width="100%",v.minHeight=0),ze&&(C==="horizontal"?(v.width="0px",v.minWidth="0px"):(v.height="0px",v.minHeight="0px"),v.flexGrow=0,v.flexShrink=0,v.pointerEvents="none",v.visibility="hidden",ne&&(v.display="none"));const _=C==="horizontal"?re.width:re.height,D=s.useMemo(()=>({position:"absolute",inset:"0px",overflow:S,display:"flex",flexDirection:"column",width:"100%",height:"100%",minWidth:"0px",minHeight:"0px"}),[S]);return X.jsxs("div",{ref:Q,className:Ge.twMerge("panel",a),style:v,"data-panel-id":k.current,"data-panel-size":Ne,"data-panel-size-unit":G?.sizeUnit||"percentage","data-panel-pixel-size":G?.sizeUnit==="pixels"?G?.originalPixelSize:null,"data-panel-order":g,"data-panel-collapsible":w,"data-panel-collapse-start":H.collapseFromStart,"data-panel-collapse-end":H.collapseFromEnd,"data-panel-collapsed":G?.collapsed,"aria-hidden":ze,children:[X.jsx("div",{style:D,children:z}),T&&X.jsx(Tt,{panel:G,measuredPixelSize:ge,measuredPercentageSize:oe,containerAxisSize:_,direction:C})]})}),jt=s.lazy(()=>Promise.resolve().then(()=>require("./GlobalDebugOverlay-afs0vF-Q.cjs")).then(e=>({default:e.GlobalDebugOverlayGate})));let dt=0;const Gt=()=>(dt+=1,`panel-group-${dt}`),Ht=e=>{const t=e.reason==="minimum-exceeded",n=t?"Layout unavailable: minimum panel sizes exceed the container.":"Layout unavailable: panels cannot fill the container with their maximum sizes.",f=t?`Min required: ${Math.ceil(e.totalMinimumSize??0)}px | Available: ${Math.floor(e.availableContainerSize)}px`:`Max total: ${Math.floor(e.totalMaximumSize??0)}px | Needed: ${Math.floor(e.availableContainerSize)}px`;return{summary:n,detail:f}},Ut=(e,t)=>{let n=!1;const f=e.map(r=>{const a=t[r.id];return!a||r.measuredPixelSize===a.pixelSize&&r.measuredPercentageSize===a.percentageSize?r:(n=!0,{...r,measuredPixelSize:a.pixelSize,measuredPercentageSize:a.percentageSize})});return n?f:e},ft=(e,t,n)=>{const f=Ie(e,"horizontal"),r=Ie(e,"vertical"),a=e.getBoundingClientRect(),i=f.inner>0?f.inner:t??a.width,z=r.inner>0?r.inner:n??a.height;return{width:i,height:z}},$t=e=>{const{id:t,className:n,style:f,children:r,direction:a}=e,{groupRef:i,contextValue:z,groupStyle:g}=Ct(e),[h,l]=s.useState({width:0,height:0}),u=z.layoutConstraintViolation,o=!!u,S=s.useMemo(()=>{if(!u)return null;const{summary:w,detail:V}=Ht(u);return X.jsxs("div",{className:"flex w-full flex-1 flex-col items-center justify-center gap-2 rounded-lg border border-slate-300 border-dashed bg-slate-100/70 px-6 py-8 text-center text-slate-600 text-sm dark:border-slate-600 dark:bg-slate-800/50 dark:text-slate-200","data-panel-group-placeholder":"constraint-violation",children:[X.jsx("span",{children:w}),X.jsx("span",{className:"text-slate-500 text-xs dark:text-slate-400",children:V})]})},[u]),M=s.useRef(t??Gt()).current,E=t??M,R=z.showDebugInfo&&z.panels.length>0,T=R?z.panels:[],B=R?z.panelMeasurements:{},O=s.useMemo(()=>{if(!R)return[];const w=Object.values(z.handleMeasurements);return w.length<=1?w:w.slice().sort((V,le)=>V.id.localeCompare(le.id))},[z.handleMeasurements,R]),re=z.containerSize,Q=h.width>0?h.width:re.width,fe=h.height>0?h.height:re.height;s.useLayoutEffect(()=>{if(!R){l({width:0,height:0});return}if(typeof window>"u"||typeof ResizeObserver>"u")return;const w=i.current;if(!w)return;const V=j=>{l(U=>U.width===j.width&&U.height===j.height?U:j)},le=new ResizeObserver(j=>{for(const U of j){if(U.target!==w)continue;const ee=ft(w,U.contentRect.width,U.contentRect.height);V(ee)}});return le.observe(w),V(ft(w)),()=>{le.disconnect()}},[i,R]);const k=s.useMemo(()=>Ut(T,B),[T,B]);s.useEffect(()=>{if(!R)return;let w=!1,V=null;return Promise.resolve().then(()=>require("./debugOverlayStore-Dkl-fHoa.cjs")).then(le=>{w||(V=le,le.enableDebugOverlayGroup(M))}),()=>{w=!0,V&&(V.disableDebugOverlayGroup(M),V.removeDebugOverlayGroup(M))}},[R,M]),s.useEffect(()=>{if(!R)return;let w=!1;return Promise.resolve().then(()=>require("./debugOverlayStore-Dkl-fHoa.cjs")).then(V=>{w||V.updateDebugOverlayGroup(M,{displayName:E,direction:a,containerSize:{width:Q,height:fe},panels:k,handles:O})}),()=>{w=!0}},[R,M,E,a,Q,fe,k,O]);const H=s.useMemo(()=>{const w={...g,...f};return w.position||(w.position="relative"),w},[g,f]);return X.jsxs(et.Provider,{value:z,children:[X.jsxs("div",{ref:i,className:Ge.twMerge("panel-group",a==="horizontal"?"flex-row":"flex-col",n),style:H,"data-panel-group-id":t,"data-panel-group-direction":a,children:[r,o&&S?X.jsx("div",{className:"pointer-events-auto",style:{position:"absolute",inset:0,zIndex:40,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(248, 250, 252, 0.82)",backdropFilter:"blur(2px)"},children:S}):null]}),R&&X.jsx(s.Suspense,{fallback:null,children:X.jsx(jt,{groupId:M})})]})},Wt=s.memo(({id:e,disabled:t=!1,className:n,style:f,children:r,onDragging:a})=>{const{direction:i,resizePanels:z,getPanel:g,collapsePanel:h,expandPanel:l,panels:u,reportHandleMeasurement:o,containerSize:S,layoutConstraintViolation:C}=Xe(),[M,E]=s.useState(!1),R=s.useRef(null),T=s.useRef(null),B=s.useRef(""),O=s.useRef(""),re=s.useRef(null),[Q,fe]=s.useState(!1),[k,H]=s.useState({left:null,right:null}),w=s.useId(),V=s.useRef(e??`resize-handle-${w}`),le=s.useRef(null),j=e??V.current,U=!!C,ee=t||U,G=s.useCallback(()=>{const p=R.current;if(!p)return;const m=p.parentElement;if(!m)return;T.current=m,typeof window<"u"&&fe(window.getComputedStyle(m).direction==="rtl");const y=Array.from(m.children),N=y.indexOf(p);let A=null,v=null;for(let b=N-1;b>=0;b-=1){const x=y[b];if(x.dataset.panelId){A=x;break}}for(let b=N+1;b<y.length;b+=1){const x=y[b];if(x.dataset.panelId){v=x;break}}const _=A?.dataset.panelId||"",D=v?.dataset.panelId||"";_===B.current&&D===O.current||(B.current=_,O.current=D,H({left:_||null,right:D||null}))},[]),ne=s.useMemo(()=>u.map(p=>p.id).join("|"),[u]);s.useEffect(()=>{G()},[G,ne]),s.useEffect(()=>{if(j===V.current)return;const p=V.current;V.current=j,le.current=null,p!==j&&o(p,null)},[o,j]),s.useEffect(()=>{const p=V.current;return()=>{o(p,null)}},[o]),s.useEffect(()=>()=>{re.current?.()},[]);const ye=s.useCallback(p=>{if(ee||!T.current||re.current)return;p.preventDefault(),p.stopPropagation();const m=T.current,{inner:y}=Ie(m,i),N={x:p.clientX,y:p.clientY},A=g(B.current),v=g(O.current);if(!(A&&v))return;const _=A.size,D=v.size;let b=0;const x=Bt;E(!0),a?.(!0);const L=p.pointerId,q=p.currentTarget,K=i==="horizontal"&&typeof window<"u"&&window.getComputedStyle(m).direction==="rtl";q.setPointerCapture(L);const Z=ie=>{if(ie.pointerId!==L||!R.current)return;ie.preventDefault(),ie.stopPropagation();const Te=performance.now();if(Te-b<x)return;b=Te;const ke=i==="horizontal"?ie.clientX-N.x:ie.clientY-N.y,ve=K?-ke:ke;if(ve===0)return;const Re=_+ve,we=D-ve,pe=g(B.current),Se=g(O.current);if(pe&&Se&&B.current&&O.current){const Ke=$(pe.minSize,0,y),Ye=$(Se.minSize,0,y),tt=Ke,rt=Ye,it=Math.min(y*ht,gt),nt=Math.min(y*Ft,It),Mt=Se.collapseFromStart,yt=Se.collapsedByDirection??"start";if(Mt&&!Se.collapsed&&we<=Math.max(Ye*.3,it)){h(O.current,"start");return}const Et=pe.collapseFromEnd,vt=pe.collapsedByDirection??"end";if(Et&&!pe.collapsed&&Re<=Math.max(Ke*.3,it)){h(B.current,"end");return}if(Se.collapsed&&we>Math.max(Ye*.3,nt)){l(O.current,yt,we);return}if(pe.collapsed&&Re>Math.max(Ke*.3,nt)){l(B.current,vt,Re);return}if(y>0){const st=pe.size+Se.size,Ue=Qe(y);let Je=!1;if(tt<=Ue&&Re<=Ue&&_!==0){const _e=Math.max(0,st-0);_e>=rt&&(z(B.current,O.current,0,_e),Je=!0)}else if(rt<=Ue&&we<=Ue&&D!==0){const _e=Math.max(0,st-0);_e>=tt&&(z(B.current,O.current,_e,0),Je=!0)}if(Je)return}if(pe.collapsed||Se.collapsed)return;z(B.current,O.current,Re,we)}};let Y=!0;const c=()=>{Y&&(Y=!1,re.current=null,E(!1),a?.(!1),document.removeEventListener("pointermove",Z),document.removeEventListener("pointerup",F),document.removeEventListener("pointercancel",te),q.removeEventListener("lostpointercapture",J),q.hasPointerCapture?.(L)&&q.releasePointerCapture(L))},F=ie=>{ie.pointerId===L&&c()},te=ie=>{ie.pointerId===L&&c()},J=ie=>{ie.pointerId===L&&c()};document.addEventListener("pointermove",Z),document.addEventListener("pointerup",F),document.addEventListener("pointercancel",te),q.addEventListener("lostpointercapture",J),re.current=c},[ee,i,z,g,h,l,a]),ze=s.useCallback(p=>{if(ee)return;const m=i==="horizontal",y=m?"ArrowLeft":"ArrowUp",N=m?"ArrowRight":"ArrowDown";if(p.key!==y&&p.key!==N)return;p.preventDefault(),p.stopPropagation();let A=(p.key===N?1:-1)*(p.shiftKey?at*5:at);m&&typeof window<"u"&&T.current!==null&&window.getComputedStyle(T.current).direction==="rtl"&&(A=-A);const _=g(B.current),D=g(O.current);!(_&&D)||_.collapsed||D.collapsed||z(B.current,O.current,_.size+A,D.size-A)},[ee,i,g,z]),ce=i==="horizontal",Ee=ce?"cursor-col-resize":"cursor-row-resize",ge=Ge.twMerge("group absolute z-20 flex select-none items-center justify-center border-none bg-transparent transition-colors duration-150 overflow-visible",Ee,ce?"h-full":"w-full",!ee&&"hover:bg-gray-200/70 dark:hover:bg-gray-700/70",!ee&&"active:bg-blue-300/60 dark:active:bg-blue-700/60",M&&"bg-blue-200/80 dark:bg-blue-800/60",ee&&"cursor-not-allowed opacity-50","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50",n),se=s.useMemo(()=>{const p=m=>{if(!m)return-1;for(let y=0;y<u.length;y+=1)if(u[y].id===m)return y;return-1};return{left:p(k.left),right:p(k.right)}},[k.left,k.right,u]),oe=ce?S.width:S.height,he=s.useMemo(()=>{const p=(m,y)=>{if(m>y)return 0;let N=0;for(let A=m;A<=y;A+=1){const v=u[A];if(!v)continue;const _=v.size??0,D=Math.max(0,_);N+=v.collapsed?0:D}return N};return se.left>=0?p(0,se.left):se.right>0?p(0,se.right-1):0},[se.left,se.right,u]),me=s.useMemo(()=>!Number.isFinite(he)||he<0?0:oe>0&&he>oe?oe:he,[he,oe]),be=s.useMemo(()=>{const p={position:"absolute",zIndex:20,touchAction:"none"};return ce?(p.top=0,p.left=Q&&oe>0?`${oe-me}px`:`${me}px`,p.transform="translateX(-50%)",p.width=`${ot}px`,p.height="100%"):(p.left=0,p.top=`${me}px`,p.transform="translateY(-50%)",p.height=`${ot}px`,p.width="100%"),p},[me,ce,Q,oe]),I=s.useMemo(()=>{const p=Qe(oe),m=x=>{if(x<0||x>=u.length)return!1;const L=u[x];return L?L.collapsed?!0:L.size<=p:!1},y=(x,L)=>{if(!m(x))return 0;let q=0;for(let K=x;K>=0&&K<u.length&&m(K);K+=L)q+=1;return q},N=se.left,A=se.right,v=N>=0?y(N,-1):0,_=A>=0?y(A,1):0;return{groupSize:v+_+1,overlapIndex:v}},[se.left,se.right,u,oe]),W=s.useMemo(()=>{if(U)return!0;if(I.groupSize<=1)return!1;const p=I.groupSize-1;return I.overlapIndex>0&&I.overlapIndex<p},[I,U]),ae=s.useMemo(()=>{if(I.groupSize<=1||W)return 0;const p=I.groupSize>1?2:1;if(p===1)return 0;const m=I.overlapIndex===0?0:p-1,y=(p-1)/2;return(m-y)*Rt},[I,W]),Ce=s.useMemo(()=>{if(W)return{display:"none"};if(ae!==0)return ce?{transform:`translateX(${ae}px)`}:{transform:`translateY(${ae}px)`}},[ae,ce,W]),Fe=Ge.twMerge("flex items-center justify-center rounded-full bg-white text-slate-700 ring-1 ring-inset ring-white/80 backdrop-blur-sm transition-colors duration-150 shadow-[0_0_0_1px_rgba(255,255,255,0.85),0_1px_3px_rgba(15,23,42,0.18)]","dark:bg-slate-800/95 dark:text-slate-200 dark:ring-slate-500/60 dark:shadow-[0_0_0_1px_rgba(148,163,184,0.45),0_1px_3px_rgba(2,6,23,0.55)]",ce?"h-12 w-[6px] px-[2px]":"h-[6px] w-20 py-[2px]",M&&"bg-blue-200/80 ring-blue-300 shadow-[0_0_0_1px_rgba(191,219,254,0.65),0_1px_4px_rgba(59,130,246,0.45)] dark:bg-blue-900/70 dark:ring-blue-400 dark:shadow-[0_0_0_1px_rgba(147,197,253,0.5),0_1px_4px_rgba(59,130,246,0.55)]"),Ne=Ge.twMerge("rounded-full bg-slate-600 transition-colors duration-150 shadow-[0_0_0_1px_rgba(255,255,255,0.9)] dark:bg-slate-200 dark:shadow-[0_0_0_1px_rgba(15,23,42,0.55)]",ce?"h-8 w-[2px]":"h-[2px] w-16",M&&"bg-blue-500 dark:bg-blue-300",!ee&&"group-hover:bg-slate-700 dark:group-hover:bg-slate-100"),d=s.useCallback(()=>{const p=R.current;if(!p)return;let m=0;if(!W){const A=i==="horizontal"?p.offsetWidth:p.offsetHeight;let v=0,_=0;if(typeof window<"u"){const b=window.getComputedStyle(p);i==="horizontal"?(v=Number.parseFloat(b.marginLeft||"0"),_=Number.parseFloat(b.marginRight||"0")):(v=Number.parseFloat(b.marginTop||"0"),_=Number.parseFloat(b.marginBottom||"0"))}m=[A,v,_].reduce((b,x)=>Number.isFinite(x)?b+x:b,0)}(!Number.isFinite(m)||m<0)&&(m=0);const y={id:j,thickness:m,direction:i,visible:!W&&m>Nt,startPanelId:k.left,endPanelId:k.right},N=le.current;N&&Math.abs(N.thickness-y.thickness)<=.25&&N.visible===y.visible&&N.direction===y.direction&&N.startPanelId===y.startPanelId&&N.endPanelId===y.endPanelId||(le.current=y,o(j,y))},[i,k.left,k.right,o,j,W]);s.useEffect(()=>{d()},[d]),s.useEffect(()=>{const p=R.current;if(!p)return;if(typeof ResizeObserver>"u"){d();return}const m=new ResizeObserver(()=>{d()});return m.observe(p),()=>{m.disconnect()}},[d]);const P=s.useMemo(()=>{const p=f?{...be,...f}:be;return W?{...p,display:"none",pointerEvents:"none",visibility:"hidden"}:p},[be,W,f]);return X.jsx("button",{type:"button",ref:R,className:ge,style:P,onPointerDown:ye,onKeyDown:ze,disabled:ee,"aria-hidden":W||void 0,"aria-label":`Resize ${ce?"columns":"rows"} - Drag or use arrow keys to resize, drag to the edge to collapse/expand panels`,"data-resize-handle-id":j,title:`ドラッグして${ce?"列":"行"}をリサイズ、端まで移動して折りたたみ/展開`,children:r||X.jsx("div",{className:Fe,style:Ce,children:X.jsx("span",{className:Ne})})})}),Vt=e=>document.querySelector(`[data-panel-id="${e}"]`),qt=e=>document.querySelector(`[data-panel-group-id="${e}"]`),Zt=e=>document.querySelector(`[data-resize-handle-id="${e}"]`);exports.PANEL_SNAP_THRESHOLD=zt;exports.Panel=Ot;exports.PanelGroup=$t;exports.PanelGroupContext=et;exports.PanelResizeHandle=Wt;exports.clamp=de;exports.getConstraintInPixels=$;exports.getContainerSize=Ie;exports.getPanelElement=Vt;exports.getPanelGroupElement=qt;exports.getResizeHandleElement=Zt;exports.loadLayout=bt;exports.normalizeSizeConfig=St;exports.saveLayout=Pt;exports.usePanelControls=Dt;exports.usePanelGroup=Xe;exports.useResizablePanels=Ct;
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC9D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAEvD,YAAY,EACR,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,UAAU,EACV,sBAAsB,EACtB,UAAU,EACV,QAAQ,GACX,MAAM,SAAS,CAAA;AAEhB,OAAO,EACH,KAAK,EACL,qBAAqB,EACrB,gBAAgB,EAChB,UAAU,EACV,mBAAmB,EACnB,UAAU,GACb,MAAM,SAAS,CAAA;AAEhB;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,WAAW,GAAG,IAE1D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,MAAM,KAAG,WAAW,GAAG,IAE/D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,IAAI,MAAM,KAAG,WAAW,GAAG,IAEjE,CAAA"}
package/dist/reducer.d.ts DELETED
@@ -1,39 +0,0 @@
1
- import { PanelCollapseDirection, PanelLayoutData } from './types';
2
- export type PanelAction = {
3
- type: "REGISTER_PANEL";
4
- panel: PanelLayoutData;
5
- } | {
6
- type: "UNREGISTER_PANEL";
7
- id: string;
8
- } | {
9
- type: "RESIZE_PANELS";
10
- leftId: string;
11
- rightId: string;
12
- leftSize: number;
13
- rightSize: number;
14
- containerSize?: number;
15
- } | {
16
- type: "SET_PANELS";
17
- panels: PanelLayoutData[];
18
- } | {
19
- type: "CONTAINER_RESIZED";
20
- containerSize: number;
21
- direction: "horizontal" | "vertical";
22
- } | {
23
- type: "COLLAPSE_PANEL";
24
- id: string;
25
- containerSize: number;
26
- from: PanelCollapseDirection;
27
- } | {
28
- type: "EXPAND_PANEL";
29
- id: string;
30
- containerSize: number;
31
- from: PanelCollapseDirection;
32
- targetSize?: number;
33
- };
34
- /**
35
- * Handle panel registration and size updates for the panel group.
36
- * パネルグループ内の登録・サイズ更新を処理するリデューサー。
37
- */
38
- export declare const panelReducer: (state: PanelLayoutData[], action: PanelAction) => PanelLayoutData[];
39
- //# sourceMappingURL=reducer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAgqBtE,MAAM,MAAM,WAAW,GACjB;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GACvH;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,YAAY,GAAG,UAAU,CAAA;CAAE,GAC1F;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,sBAAsB,CAAA;CAAE,GAC3F;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,sBAAsB,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAiCpH;;;GAGG;AAEH,eAAO,MAAM,YAAY,GAAI,OAAO,eAAe,EAAE,EAAE,QAAQ,WAAW,KAAG,eAAe,EA+f3F,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"roundHalfToEven.d.ts","sourceRoot":"","sources":["../src/roundHalfToEven.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,EAAE,SAAQ,MAAU,KAAG,MA+BnE,CAAA"}
package/dist/types.d.ts DELETED
@@ -1,253 +0,0 @@
1
- import { CSSProperties, ReactNode } from 'react';
2
- /**
3
- * Pixel threshold used to decide when panels snap closed or open.
4
- * パネルのスナップ判定に利用するピクセル閾値。
5
- */
6
- export declare const PANEL_SNAP_THRESHOLD = 12;
7
- /**
8
- * Default thickness in pixels for the resize handle interactive area.
9
- * リサイズハンドルのインタラクティブ領域のデフォルト厚み (px)。
10
- */
11
- export declare const PANEL_HANDLE_THICKNESS = 8;
12
- /**
13
- * Spacing in pixels between visual indicator dots in the handle.
14
- * ハンドル内の視覚インジケーター点同士のピクセル間隔。
15
- */
16
- export declare const PANEL_VISIBLE_INDICATOR_SPACING = 8;
17
- /**
18
- * Pointer move throttling interval in milliseconds during dragging.
19
- * ドラッグ中のポインタ移動を間引くミリ秒単位の間隔。
20
- */
21
- export declare const PANEL_HANDLE_DRAG_THROTTLE_MS = 8;
22
- /**
23
- * Pixel step applied per arrow-key press when resizing with the keyboard.
24
- * キーボード (矢印キー) リサイズで 1 押下ごとに適用するピクセル量。
25
- */
26
- export declare const PANEL_KEYBOARD_RESIZE_STEP = 10;
27
- /**
28
- * Ratio of container size used when determining collapse thresholds.
29
- * 折りたたみ閾値を決定する際に使用するコンテナサイズ比率。
30
- */
31
- export declare const PANEL_COLLAPSE_THRESHOLD_RATIO = 0.05;
32
- /**
33
- * Maximum pixel value considered when collapsing panels.
34
- * パネルを折りたたむ際に考慮するピクセル上限値。
35
- */
36
- export declare const PANEL_COLLAPSE_THRESHOLD_MAX = 10;
37
- /**
38
- * Ratio of container size required to expand a collapsed panel.
39
- * 折りたたまれたパネルを展開するために必要なコンテナサイズ比率。
40
- */
41
- export declare const PANEL_EXPAND_THRESHOLD_RATIO = 0.05;
42
- /**
43
- * Maximum pixel threshold used when expanding panels.
44
- * パネルを展開する際に用いるピクセル閾値の上限。
45
- */
46
- export declare const PANEL_EXPAND_THRESHOLD_MAX = 20;
47
- /**
48
- * Minimum thickness required for a handle to be treated as visible.
49
- * ハンドルが可視と判断されるために必要な最小厚み。
50
- */
51
- export declare const PANEL_HANDLE_VISIBILITY_THRESHOLD = 0.05;
52
- /**
53
- * Retry intervals in milliseconds when awaiting layout stabilization.
54
- * レイアウトの安定化を待機するときに使用するミリ秒単位の再試行間隔。
55
- */
56
- export declare const PANEL_RESIZE_RETRY_INTERVALS: readonly [10, 50, 100, 200, 300, 500, 800];
57
- /**
58
- * Tolerance used to decide whether pixel-based panel adjustments are significant.
59
- * ピクセル基準パネルの補正を有効とみなすための誤差許容値。
60
- */
61
- export declare const PANEL_PIXEL_MUTATION_TOLERANCE = 0;
62
- /**
63
- * Minimum pixel threshold used when clamping snap calculations.
64
- * スナップ計算を補正する際に用いる最小ピクセル閾値。
65
- */
66
- export declare const PANEL_MIN_SNAP_THRESHOLD = 0;
67
- /**
68
- * Layout direction of panels
69
- * パネルのレイアウト方向
70
- */
71
- export type PanelDirection = "horizontal" | "vertical";
72
- /**
73
- * Size unit types for panels
74
- * パネルのサイズ単位タイプ
75
- */
76
- export type SizeUnit = "percentage" | "pixels";
77
- /**
78
- * Size configuration with value and unit
79
- * 値と単位を持つサイズ設定
80
- */
81
- export type SizeConfig = {
82
- value: number;
83
- unit: SizeUnit;
84
- };
85
- /**
86
- * Flexible size that can be defined in pixels or as a percentage
87
- * ピクセルまたはパーセンテージで定義できる柔軟なサイズ
88
- */
89
- export type FlexibleSize = SizeConfig | number;
90
- /**
91
- * Container size dimensions
92
- * コンテナサイズの寸法
93
- */
94
- export type ContainerSize = {
95
- width: number;
96
- height: number;
97
- };
98
- /**
99
- * Direction from which collapsible panels may close.
100
- * パネルを折りたためる方向を表す列挙値。
101
- */
102
- export type PanelCollapseDirection = "start" | "end";
103
- /**
104
- * Directional options accepted by the collapsible configuration.
105
- * 折りたたみ設定が受け付ける方向指定値。
106
- */
107
- export type CollapsibleDirection = PanelCollapseDirection | "both";
108
- /**
109
- * Configuration object describing how a panel collapses.
110
- * パネルの折りたたみ方を表す設定オブジェクト。
111
- */
112
- export type CollapsibleConfig = {
113
- from: CollapsibleDirection;
114
- };
115
- /**
116
- * Axis-aligned container measurement including inner (borderless) and outer dimensions.
117
- * 枠線控除後と控除前の両方の寸法を含む軸方向コンテナ計測値。
118
- */
119
- export type ContainerAxisMeasurement = {
120
- inner: number;
121
- outer: number;
122
- };
123
- /**
124
- * Snapshot describing when panel constraints conflict with the container size.
125
- * パネル制約とコンテナサイズが矛盾する際のスナップショット。
126
- */
127
- export type LayoutConstraintViolationReason = "minimum-exceeded" | "maximum-insufficient";
128
- export type LayoutConstraintViolation = {
129
- reason: LayoutConstraintViolationReason;
130
- totalMinimumSize: number | null;
131
- totalMaximumSize: number | null;
132
- availableContainerSize: number;
133
- };
134
- /**
135
- * Layout data for a single panel
136
- * 単一パネルのレイアウトデータ
137
- */
138
- export interface PanelLayoutData {
139
- id: string;
140
- size: number;
141
- percentageSize?: number;
142
- preferredPercentageSize?: number;
143
- preferredPixelSize?: number;
144
- sizeUnit: SizeUnit;
145
- originalPixelSize?: number;
146
- minSize?: FlexibleSize;
147
- maxSize?: FlexibleSize;
148
- autoMinSize?: FlexibleSize;
149
- collapseFromStart: boolean;
150
- collapseFromEnd: boolean;
151
- collapsedByDirection?: PanelCollapseDirection | null;
152
- /**
153
- * Skip automatic growth for flexible panels that were manually reduced to a zero footprint.
154
- * 手動でゼロ相当まで縮めた柔軟パネルを自動拡張対象から外すフラグ。
155
- */
156
- excludeFromAutoGrowth?: boolean;
157
- collapsed?: boolean;
158
- sizeBeforeCollapse?: number;
159
- percentageSizeBeforeCollapse?: number;
160
- preferredPercentageSizeBeforeCollapse?: number;
161
- preferredPixelSizeBeforeCollapse?: number;
162
- pixelAdjustPriority?: number;
163
- flexAdjustPriority?: number;
164
- measuredPixelSize?: number;
165
- measuredPercentageSize?: number;
166
- measuredPixelSizeBeforeCollapse?: number;
167
- }
168
- /**
169
- * Props for the Panel component
170
- * Panel コンポーネントのプロパティ
171
- */
172
- export interface PanelProps {
173
- id?: string;
174
- defaultSize?: FlexibleSize;
175
- minSize?: FlexibleSize;
176
- maxSize?: FlexibleSize;
177
- autoMinSize?: FlexibleSize;
178
- className?: string;
179
- style?: CSSProperties;
180
- children?: ReactNode;
181
- order?: number;
182
- collapsible?: CollapsibleConfig;
183
- defaultCollapsed?: boolean;
184
- pixelAdjustPriority?: number;
185
- flexAdjustPriority?: number;
186
- contentOverflow?: CSSProperties["overflow"];
187
- }
188
- /**
189
- * Props for the PanelGroup component
190
- * PanelGroup コンポーネントのプロパティ
191
- */
192
- export interface PanelGroupProps {
193
- id?: string;
194
- direction: PanelDirection;
195
- storageKey?: string;
196
- className?: string;
197
- style?: React.CSSProperties;
198
- children?: ReactNode;
199
- showDebugInfo?: boolean;
200
- onLayout?: (panelSizes: number[]) => void;
201
- autoSaveId?: string;
202
- }
203
- /**
204
- * Value provided by the PanelGroupContext
205
- * PanelGroupContext によって提供される値
206
- */
207
- export interface PanelGroupContextValue {
208
- direction: PanelDirection;
209
- registerPanel: (panel: PanelLayoutData) => void;
210
- unregisterPanel: (id: string) => void;
211
- getPanel: (id: string) => PanelLayoutData | undefined;
212
- panels: PanelLayoutData[];
213
- isContainerReady: boolean;
214
- showDebugInfo: boolean;
215
- resizePanels: (leftId: string, rightId: string, leftSize: number, rightSize: number) => void;
216
- collapsePanel: (id: string, from: PanelCollapseDirection) => void;
217
- expandPanel: (id: string, from: PanelCollapseDirection, targetSize?: number) => void;
218
- containerSize: ContainerSize;
219
- reportPanelMeasurement: (id: string, measurement: PanelMeasurement | null) => void;
220
- panelMeasurements: Record<string, PanelMeasurement>;
221
- reportHandleMeasurement: (id: string, measurement: ResizeHandleLayoutData | null) => void;
222
- handleMeasurements: Record<string, ResizeHandleLayoutData>;
223
- layoutConstraintViolation: LayoutConstraintViolation | null;
224
- }
225
- /**
226
- * Props for the PanelResizeHandle component
227
- * PanelResizeHandle コンポーネントのプロパティ
228
- */
229
- export interface PanelResizeHandleProps {
230
- id?: string;
231
- disabled?: boolean;
232
- onDragging?: (isDragging: boolean) => void;
233
- className?: string;
234
- style?: React.CSSProperties;
235
- children?: ReactNode;
236
- }
237
- export interface PanelMeasurement {
238
- pixelSize: number;
239
- percentageSize: number;
240
- }
241
- /**
242
- * Layout data for a resize handle (divider) within a panel group.
243
- * パネルグループ内のリサイズハンドル(ディバイダー)に関するレイアウトデータ。
244
- */
245
- export interface ResizeHandleLayoutData {
246
- id: string;
247
- thickness: number;
248
- direction: PanelDirection;
249
- visible: boolean;
250
- startPanelId?: string | null;
251
- endPanelId?: string | null;
252
- }
253
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAErD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAA;AAEtC;;;GAGG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC;;;GAGG;AACH,eAAO,MAAM,+BAA+B,IAAI,CAAA;AAEhD;;;GAGG;AACH,eAAO,MAAM,6BAA6B,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O,EAAE,GAAG,IAAI;IAM3D,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;IAInE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,cAAc,EAAE,OAAO,EAAE,GAAG,IAAI;CAK/D"}
package/dist/utils.d.ts DELETED
@@ -1,61 +0,0 @@
1
- import { ContainerAxisMeasurement, FlexibleSize, PanelDirection, PanelLayoutData, SizeConfig, SizeUnit } from './types';
2
- /**
3
- * Number of significant fractional digits to preserve when rounding percentage-based sizes.
4
- * パーセンテージサイズの丸めで保持する有効小数桁数。
5
- */
6
- export declare const PERCENTAGE_DIGITS = 6;
7
- /**
8
- * Convert a pixel measurement to a percentage of the container using banker’s rounding.
9
- * ピクセル寸法をバンカーズラウンディングでコンテナ比率のパーセンテージへ変換する。
10
- */
11
- export declare const toRoundedPercentage: (size: number, base: number) => number;
12
- /**
13
- * Translate a percentage-based size back into pixels relative to the container.
14
- * パーセンテージ指定のサイズをコンテナ基準のピクセル値へ変換する。
15
- */
16
- export declare const percentageToPixels: (percentage: number | undefined, base: number) => number;
17
- /**
18
- * Normalize a flexible size into a size configuration object.
19
- * 柔軟なサイズ指定をサイズ設定オブジェクトへ正規化する。
20
- */
21
- export declare const normalizeSizeConfig: (size: FlexibleSize | undefined, defaultUnit?: SizeUnit) => SizeConfig | undefined;
22
- /**
23
- * Convert flexible size constraints into pixel values based on container size.
24
- * 柔軟サイズ制約をコンテナサイズ基準のピクセル値へ変換する。
25
- */
26
- export declare const getConstraintInPixels: (size: FlexibleSize | undefined, defaultValue: number, containerSize: number) => number;
27
- /**
28
- * Clamp a numeric value between the provided bounds.
29
- * 数値を指定した範囲に収めるためのクリッピング処理。
30
- */
31
- export declare const clamp: (value: number, min: number, max: number) => number;
32
- /**
33
- * Derive a snap-to-zero threshold from the container axis length using shared heuristics.
34
- * 共通ヒューリスティクスに基づきコンテナ軸長からゼロスナップ閾値を算出する。
35
- */
36
- export declare const calculateSnapThreshold: (axisSize: number) => number;
37
- /**
38
- * Adjust pixel-based panels in priority order to absorb remaining space.
39
- * 残余スペースを吸収するためにピクセル基準パネルを優先度順に調整する。
40
- */
41
- type AdjustPixelOptions = {
42
- enforceAutoMinSize?: boolean;
43
- };
44
- export declare const adjustPixelPanelsByPriority: (panels: PanelLayoutData[], sizeDiff: number, containerSize: number, options?: AdjustPixelOptions) => number;
45
- /**
46
- * Measure container size in a given direction, returning inner (borderless) and outer dimensions.
47
- * 指定方向で枠線控除後と控除前の両方の寸法を測定して返す。
48
- */
49
- export declare const getContainerSize: (element: HTMLElement, direction: PanelDirection) => ContainerAxisMeasurement;
50
- /**
51
- * Persist panel layout sizes to local storage.
52
- * パネルレイアウトのサイズをローカルストレージへ保存する。
53
- */
54
- export declare const saveLayout: (id: string, sizes: number[]) => void;
55
- /**
56
- * Restore panel layout sizes from local storage.
57
- * パネルレイアウトのサイズをローカルストレージから復元する。
58
- */
59
- export declare const loadLayout: (id: string) => number[] | null;
60
- export {};
61
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,wBAAwB,EAAE,KAAK,YAAY,EAAgH,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEnQ;;;GAGG;AACH,eAAO,MAAM,iBAAiB,IAAI,CAAA;AAElC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,MAMhE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,YAAY,MAAM,GAAG,SAAS,EAAE,MAAM,MAAM,KAAG,MAKjF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GA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