@sheetxl/utils-react 0.4.10 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,13 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button{background:transparent}._fullscreen-portal-root_1mjsr_4{pointer-events:none;position:absolute;inset:0;width:100%;height:100%;z-index:1200}._fullscreen-portal-root_1mjsr_4>*{pointer-events:auto}")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- "use strict";/**
3
- * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.4.10
1
+ (function () {
2
+ 'use strict';
3
+
4
+ try{if(typeof document != 'undefined'){var elementStyle = document.createElement('style');elementStyle.appendChild(document.createTextNode("/**\n * CSS files with the .module.css suffix will be treated as CSS modules\n * and scoped locally.\n Note - this isn't working but was meant to enabled default scroll buttons to play nicely with rounded corners\n */\n/* & ::-webkit-scrollbar {\n background: gre;\n } */\n._sheetxl-scrollbar_eblx4_6 ::-webkit-scrollbar-button {\n background: transparent;\n }/**\n * Used for fullscreen portals.\n */\n._fullscreen-portal-root_1mjsr_4 {\n pointer-events: none;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n z-index: 1200;\n}\n\n._fullscreen-portal-root_1mjsr_4 > * {\n pointer-events: auto;\n}"));document.head.appendChild(elementStyle);}}catch(e){console.error('vite-plugin-css-injected-by-js', e);}
5
+
6
+ })();
7
+ /**
8
+ * @license @sheetxl/utils-react - Utils React - Utilities for React capabilities needed for all SheetXL components. - v0.4.12
4
9
  *
5
10
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
6
11
  * License: The license can be found at https://www.sheetxl.com/license.
7
- */Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("react/jsx-runtime"),l=require("react"),K=require("@sheetxl/utils"),Zt=require("react-dom/client"),Gt=require("react-dom"),W={Shift:"shift",Alt:"alt",Ctrl:"ctrl",Meta:"meta"},ee={Horizontal:"horizontal",Vertical:"vertical"};function gt(i){var e,t,o="";if(typeof i=="string"||typeof i=="number")o+=i;else if(typeof i=="object")if(Array.isArray(i)){var n=i.length;for(e=0;e<n;e++)i[e]&&(t=gt(i[e]))&&(o&&(o+=" "),o+=t)}else for(t in i)i[t]&&(o&&(o+=" "),o+=t);return o}function fe(){for(var i,e,t=0,o="",n=arguments.length;t<n;t++)(i=arguments[t])&&(e=gt(i))&&(o&&(o+=" "),o+=e);return o}var Jt=function(){},yt=typeof window<"u",Qt=yt?l.useLayoutEffect:l.useEffect,nt={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const he=yt&&window.ResizeObserver!==void 0?function(){var i=l.useState(null),e=i[0],t=i[1],o=l.useState(nt),n=o[0],r=o[1],s=l.useMemo(function(){return new window.ResizeObserver(function(a){if(a[0]){var c=a[0].contentRect,u=c.x,h=c.y,d=c.width,p=c.height,w=c.top,C=c.left,S=c.bottom,E=c.right;r({x:u,y:h,width:d,height:p,top:w,left:C,bottom:S,right:E})}})},[]);return Qt(function(){if(e)return s.observe(e),function(){s.disconnect()}},[e]),[t,n]}:function(){return[Jt,nt]},L=(i,e)=>{const t=l.useCallback((...r)=>i?.(...r),e),o=l.useRef(null);o.current=t;const n=l.useCallback((...r)=>o.current?.(...r),[]);if(o.current)return n},vt=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z":"m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z";return v.jsx("div",{style:{paddingBottom:"0px",paddingRight:"0px",paddingLeft:n?"0px":"3px",paddingTop:n?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...e},...o,children:v.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${n?"vertical":"horizontal"} single-button start`,children:v.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:v.jsx("path",{d:r})})})})},xt=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z":"m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z";return v.jsx("div",{style:{paddingLeft:"0px",paddingTop:"0px",paddingRight:n?"0px":"3px",paddingBottom:n?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...e},...o,children:v.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${n?"vertical":"horizontal"} single-button end`,children:v.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:v.jsx("path",{d:r})})})})},Oe=(i,e,t,o,n=0)=>{for(let r=0;r<t.length;r++){const s=t[r].getBoundingClientRect();let a=s.left-e,c=a+s.width;if(o){if(a<i&&c>=i)return a}else if(Math.ceil(c)>Math.ceil(i)+2)return c}return n},eo=Object.freeze(Object.defineProperty({__proto__:null,getScrollTo:Oe},Symbol.toStringTag,{value:"Module"})),to="_sheetxl-scrollbar_eblx4_6",ze=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,totalSize:o=0,viewportSize:n=0,style:r,className:s,orientation:a=ee.Vertical,onScrollOffset:c,onScroll:u,showCustomScrollButtons:h=!1,scrollButtonIncrement:d=200,scrollButtonInitialRepeatDelay:p=260,scrollButtonAdditionalRepeatDelay:w=120,createScrollStartButton:C=vt,createScrollEndButton:S=xt,...E}=i,k=L(u,[u]),f=l.useRef(null),[x,{width:g,height:R}]=he(),[z,{width:j,height:H}]=he(),y=a===ee.Vertical,b=y?"top":"left",A=y?"scrollTop":"scrollLeft",_=y?R:g,M=y?H:j,[m,T]=l.useState(null);l.useEffect(()=>{m!==null&&f.current&&f.current.scrollTo({behavior:"smooth",[b]:m})},[m,y]);const P=l.useCallback(($,oe=!1)=>{if(!f.current)return 0;const te=f.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=oe?0:Oe($,ce[b],ne,!0,Math.max(0,$-d));return T(re),Math.max(0,re)},[]),X=l.useCallback(($,oe=!1)=>{if(!f.current)return 0;const te=f.current.querySelector(".scrollbar-viewport"),ce=te.getBoundingClientRect(),ne=te.children,re=Math.ceil(M-_),ye=oe?re:Oe($,ce[b],ne,!1,Math.max(0,$+d));return T(ye),Math.min(re,ye)},[M,_]),F=l.useRef(null),I=l.useCallback($=>{F.current=t;const oe=$.target[A];c(oe,n,o),k?.($)},[c,n,o,t]);l.useEffect(()=>{const $=F.current;F.current=null,t!==$&&(f.current[A]=t)},[t,A]);const N=l.useRef(null),B=l.useRef(null),V=l.useCallback(()=>{N.current&&(clearTimeout(N.current),N.current=null,B.current=null)},[]),U=l.useCallback(($,oe,te,ce=p)=>{B.current=$,N.current=setTimeout(()=>{const ne=te?P(B.current||$):X(B.current||$);ne!==B.current?U(ne,!1,te,w):V()},oe?0:ce)},[P,X,V]);l.useEffect(()=>()=>V(),[V]);const J=t,de=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(J)<=0||Math.floor(M-_)===0,onMouseUp:V,onMouseLeave:V,onMouseDown:()=>U(J,!0,!0)};return C?.($)},[h,a,J,m,M,_]),pe=l.useMemo(()=>{if(!h)return null;const $={orientation:a,disabled:Math.floor(M-_)<=Math.ceil(J),onMouseUp:V,onMouseLeave:V,onMouseDown:()=>U(J,!0,!1)};return S?.($)},[h,a,J,m,M,_]);return v.jsxs("div",{ref:e,style:{display:"flex",flex:"1",flexDirection:y?"column":"row",padding:"0",...r},className:fe(to,s),...E,children:[de,v.jsx("div",{className:"pseudo-scrollbar",style:{flex:"1 1 100%",display:"flex",boxSizing:"content-box",flexDirection:y?"column":"row",justifyContent:"center",alignItems:"center"},ref:x,children:v.jsx("div",{tabIndex:-1,style:{flex:"1 1 100%",overflowY:y?"scroll":"hidden",overflowX:y?"hidden":"scroll",position:"relative",willChange:"transform"},onScroll:I,ref:f,children:v.jsx("div",{ref:z,style:{position:"absolute",height:y?o-n+(R??0):1,width:y?1:o-n+(g??0)},className:"scrollbar-viewport"})})}),pe]})}));ze.displayName="Scrollbar";let it=Date.now,rt=1e3,ae={},oo=1;const ve=i=>{let e=ae[i]!==null;return e&&(ae[i]=null),e},st=(i,e,t,o=0,n)=>{let r=it(),s=r,a=0,c=0,u=0,h=oo++;if(h%20==0){const p={};for(let w in ae)p[w]=!0;ae=p}const d=function(p){let w=p!==!0,C=it(),S=!0;try{S=(!e||e(h))??!0}catch{S=!1}if(!ae[h]||!S)return ae[h]=null,void t?.(60-c/((C-r)/rt),h,!1);if(w){u=Math.round((C-s)/16.666666666666668)-1;for(let f=0;f<Math.min(u,4);f++)d(!0),c++}o&&(a=(C-r)/o,a>1&&(a=1));let E=n?n(a):a,k=!1;try{k=i(E,C,w)}catch{k=!1}k!==!1&&a!==1||!w?w&&(s=C,requestAnimationFrame(d)):(ae[h]=null,t?.(60-c/((C-r)/rt),h,a===1||o==null))};return ae[h]=!0,requestAnimationFrame(d),h},no=function(i){return Math.pow(i-1,3)+1},io=function(i){return(i/=.5)<1?.5*Math.pow(i,3):.5*(Math.pow(i-2,3)+2)};class ro{constructor(e,t){this.__isSingleTouch=!1,this.__isTracking=!1,this.__didDecelerationComplete=!1,this.__isGesturing=!1,this.__isDragging=!1,this.__isDecelerating=0,this.__isAnimating=0,this.__interruptedAnimation=!1,this.__lastScale=1,this.__enableScrollX=!0,this.__enableScrollY=!0,this.__clientLeft=0,this.__clientTop=0,this.__clientWidth=0,this.__clientHeight=0,this.__contentWidth=0,this.__contentHeight=0,this.__snapWidth=100,this.__snapHeight=100,this.__zoomLevel=1,this.__scrollLeft=0,this.__scrollTop=0,this.__maxScrollLeft=0,this.__maxScrollTop=0,this.__scheduledLeft=0,this.__scheduledTop=0,this.__scheduledZoom=0,this.__lastTouchLeft=0,this.__lastTouchTop=0,this.__lastTouchMove=0,this.__positions=[],this.__initialTouchLeft=0,this.__initialTouchTop=0,this.__zoomLevelStart=1,this.__minDecelerationScrollLeft=null,this.__minDecelerationScrollTop=null,this.__maxDecelerationScrollLeft=null,this.__maxDecelerationScrollTop=null,this.__decelerationVelocityX=null,this.__decelerationVelocityY=0,this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:void 0,penetrationDeceleration:.03,penetrationAcceleration:.08,...t}}setDimensions(e,t,o,n){e!==null&&(this.__clientWidth=e),t!==null&&(this.__clientHeight=t),o!==null&&(this.__contentWidth=o),n!==null&&(this.__contentHeight=n),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)}setPosition(e,t){this.__clientLeft=e||0,this.__clientTop=t||0}setSnapSize(e,t){this.__snapWidth=e,this.__snapHeight=t}getValues(){return{left:this.__scrollLeft,top:this.__scrollTop,right:this.__scrollLeft+this.__clientWidth/this.__zoomLevel,bottom:this.__scrollTop+this.__clientHeight/this.__zoomLevel,zoom:this.__zoomLevel}}getPoint(e,t){const o=this.getValues();return{left:e/o.zoom,top:t/o.zoom}}getScrollMax(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}}zoomTo(e,t=!1,o,n,r){if(!this.options.zooming)throw new Error("Zooming is not enabled!");r&&(this.__zoomComplete=r),this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0);const s=this.__zoomLevel;o===void 0&&(o=this.__clientWidth/2),n===void 0&&(n=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);const a=e/s;let c=a*(this.__scrollLeft+o)-o,u=a*(this.__scrollTop+n)-n;c>this.__maxScrollLeft?c=this.__maxScrollLeft:c<0&&(c=0),u>this.__maxScrollTop?u=this.__maxScrollTop:u<0&&(u=0),this.__publish(c,u,e,t)}zoomBy(e,t=!1,o=0,n=0,r){this.zoomTo(this.__zoomLevel*e,t,o,n,r)}scrollTo(e,t,o=!1,n=1){if(this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0),n!==void 0&&n!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=n,t*=n,this.__computeScrollMax(n)}else n=this.__zoomLevel;this.options.scrollingX?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(o=!1),this.__publish(e,t,n,o)}scrollBy(e=0,t=0,o=!1){const n=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,r=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(n+(e||0),r+(t||0),o)}doMouseZoom(e,t,o,n){const r=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*r,!1,o-this.__clientLeft,n-this.__clientTop)}doTouchStart(e,t){if(e.length===void 0)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),typeof t!="number")throw new Error("Invalid timestamp value: "+t);let o,n;this.__interruptedAnimation=!0,this.__isDecelerating&&(ve(this.__isDecelerating),this.__isDecelerating=0,this.__interruptedAnimation=!0),this.__isAnimating&&(ve(this.__isAnimating),this.__isAnimating=0,this.__interruptedAnimation=!0);let r=e.length===1;r?(o=e[0].pageX,n=e[0].pageY):(o=Math.abs(e[0].pageX+e[1].pageX)/2,n=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=o,this.__initialTouchTop=n,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=o,this.__lastTouchTop=n,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!r&&this.options.scrollingX,this.__enableScrollY=!r&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!r,this.__isSingleTouch=r,this.__positions=[]}doTouchMove(e,t,o=1){if(e.length===void 0)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),typeof t!="number")throw new Error("Invalid timestamp value: "+t);if(!this.__isTracking)return;let n,r;e.length===2?(n=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(n=e[0].pageX,r=e[0].pageY);let s=this.__positions;if(this.__isDragging){let a=n-this.__lastTouchLeft,c=r-this.__lastTouchTop,u=this.__scrollLeft,h=this.__scrollTop,d=this.__zoomLevel;if(o!==void 0&&this.options.zooming){let p=d;if(d=d/this.__lastScale*o,d=Math.max(Math.min(d,this.options.maxZoom),this.options.minZoom),p!==d){let w=n-this.__clientLeft,C=r-this.__clientTop;u=(w+u)*d/p-w,h=(C+h)*d/p-C,this.__computeScrollMax(d)}}if(this.__enableScrollX){u-=a*this.options.speedMultiplier;let p=this.__maxScrollLeft;(u>p||u<0)&&(this.options.bouncing?u+=a/2*this.options.speedMultiplier:u=u>p?p:0)}if(this.__enableScrollY){h-=c*this.options.speedMultiplier;const p=this.__maxScrollTop;(h>p||h<0)&&(this.options.bouncing?h+=c/2*this.options.speedMultiplier:h=h>p?p:0)}s.length>60&&s.splice(0,30),s.push(u,h,t),this.__publish(u,h,d)}else{let a=this.options.locking?3:0,c=5,u=Math.abs(n-this.__initialTouchLeft),h=Math.abs(r-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&u>=a,this.__enableScrollY=this.options.scrollingY&&h>=a,s.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(u>=c||h>=c),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=n,this.__lastTouchTop=r,this.__lastTouchMove=t,this.__lastScale=o}doTouchEnd(e){if(e instanceof Date&&(e=e.valueOf()),typeof e!="number")throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){let t=this.__positions,o=t.length-1,n=o;for(let r=o;r>0&&t[r]>this.__lastTouchMove-100;r-=3)n=r;if(n!==o){const r=t[o]-t[n],s=this.__scrollLeft-t[n-2],a=this.__scrollTop-t[n-1];this.__decelerationVelocityX=s/r*(1e3/60),this.__decelerationVelocityY=a/r*(1e3/60);const c=this.options.paging||this.options.snapping?4:1;(Math.abs(this.__decelerationVelocityX)>c||Math.abs(this.__decelerationVelocityY)>c)&&this.__startDeceleration(e)}else this.options.scrollingComplete?.()}else e-this.__lastTouchMove>100&&this.options.scrollingComplete?.();this.__isDecelerating||((this.__interruptedAnimation||this.__isDragging)&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel)),this.__positions.length=0}}__publish(e,t,o,n=!1){const r=this.__isAnimating;if(r&&(ve(r),this.__isAnimating=0),n&&this.options.animating){this.__scheduledLeft=e,this.__scheduledTop=t,this.__scheduledZoom=o;const s=this.__scrollLeft,a=this.__scrollTop,c=this.__zoomLevel,u=e-s,h=t-a,d=o-c,p=function(S,E,k){k&&(this.__scrollLeft=s+u*S,this.__scrollTop=a+h*S,this.__zoomLevel=c+d*S,this.__callback&&this.__callback(this.__scrollLeft,this.__scrollTop,this.__zoomLevel))}.bind(this),w=function(S){return this.__isAnimating===S}.bind(this),C=function(S,E,k){E===this.__isAnimating&&(this.__isAnimating=!1),(this.__didDecelerationComplete||k)&&this.options.scrollingComplete?.(),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}.bind(this);this.__isAnimating=st(p,w,C,this.options.animationDuration,r?no:io)}else this.__scheduledLeft=this.__scrollLeft=e,this.__scheduledTop=this.__scrollTop=t,this.__scheduledZoom=this.__zoomLevel=o,this.__callback&&this.__callback(e,t,o),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}__computeScrollMax(e=this.__zoomLevel){this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)}__startDeceleration(e){if(this.options.paging){const s=Math.max(Math.min(this.__scrollLeft,this.__maxScrollLeft),0),a=Math.max(Math.min(this.__scrollTop,this.__maxScrollTop),0),c=this.__clientWidth,u=this.__clientHeight;this.__minDecelerationScrollLeft=Math.floor(s/c)*c,this.__minDecelerationScrollTop=Math.floor(a/u)*u,this.__maxDecelerationScrollLeft=Math.ceil(s/c)*c,this.__maxDecelerationScrollTop=Math.ceil(a/u)*u}else this.__minDecelerationScrollLeft=0,this.__minDecelerationScrollTop=0,this.__maxDecelerationScrollLeft=this.__maxScrollLeft,this.__maxDecelerationScrollTop=this.__maxScrollTop;const t=function(s,a,c){this.__stepThroughDeceleration(c)}.bind(this),o=this.options.snapping?4:.1,n=function(){const s=Math.abs(this.__decelerationVelocityX)>=o||Math.abs(this.__decelerationVelocityY)>=o;return s||(this.__didDecelerationComplete=!0),s}.bind(this),r=function(s,a,c){this.__isDecelerating=0,this.__didDecelerationComplete&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,this.options.snapping)}.bind(this);this.__isDecelerating=st(t,n,r)}__stepThroughDeceleration(e){let t=this.__scrollLeft+this.__decelerationVelocityX,o=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){const n=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);n!==t&&(t=n,this.__decelerationVelocityX=0);const r=Math.max(Math.min(this.__maxDecelerationScrollTop,o),this.__minDecelerationScrollTop);r!==o&&(o=r,this.__decelerationVelocityY=0)}if(e?this.__publish(t,o,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=o),!this.options.paging&&(this.__decelerationVelocityX*=.95,this.__decelerationVelocityY*=.95),this.options.bouncing){let n=0,r=0,s=this.options.penetrationDeceleration,a=this.options.penetrationAcceleration;t<this.__minDecelerationScrollLeft?n=this.__minDecelerationScrollLeft-t:t>this.__maxDecelerationScrollLeft&&(n=this.__maxDecelerationScrollLeft-t),o<this.__minDecelerationScrollTop?r=this.__minDecelerationScrollTop-o:o>this.__maxDecelerationScrollTop&&(r=this.__maxDecelerationScrollTop-o),n!==0&&(n*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=n*s:this.__decelerationVelocityX=n*a),r!==0&&(r*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=r*s:this.__decelerationVelocityY=r*a)}}}var Z=typeof window<"u"?window:{screen:{},navigator:{}},ge=(Z.matchMedia||function(){return{matches:!1}}).bind(Z),bt=!1,so={get passive(){return bt=!0}},lt=function(){};Z.addEventListener&&Z.addEventListener("p",lt,so),Z.removeEventListener&&Z.removeEventListener("p",lt,!1);var lo=bt,ao="PointerEvent"in Z,We="ontouchstart"in Z,wt=We||"TouchEvent"in Z&&ge("(any-pointer: coarse)").matches,at=(Z.navigator.maxTouchPoints||0)>0||wt,St=Z.navigator.userAgent||"",co=ge("(pointer: coarse)").matches&&/iPad|Macintosh/.test(St)&&Math.min(Z.screen.width||0,Z.screen.height||0)>=768,Ct=(ge("(pointer: coarse)").matches||!ge("(pointer: fine)").matches&&We)&&!/Windows.*Firefox/.test(St),uo=ge("(any-pointer: fine)").matches||ge("(any-hover: hover)").matches||co||!We,Ke=!at||!uo&&Ct?at?"touchOnly":"mouseOnly":"hybrid",ho=Ke==="mouseOnly"?"mouse":Ke==="touchOnly"||Ct?"touch":"mouse";const po=Object.freeze(Object.defineProperty({__proto__:null,deviceType:Ke,primaryInput:ho,supportsPassiveEvents:lo,supportsPointerEvents:ao,supportsTouchEvents:wt},Symbol.toStringTag,{value:"Module"})),_o=new Set(["INPUT","TEXTAREA","SELECT"]),Et={};function He(){return po}const Lt=i=>i==="BracketLeft"?"[":i==="BracketRight"?"]":K.CommonUtils.camelToPrettyCase(i),fo=Object.freeze(Object.defineProperty({__proto__:null,EmptyCssProperties:Et,boundPixel:function(i,e=!1,t=0){return i},createSyntheticEvent:i=>{let e=!1,t=!1;return{nativeEvent:i,currentTarget:i.currentTarget,target:i.target,bubbles:i.bubbles,cancelable:i.cancelable,defaultPrevented:i.defaultPrevented,eventPhase:i.eventPhase,isTrusted:i.isTrusted,preventDefault:()=>{e=!0,i.preventDefault()},isDefaultPrevented:()=>e,stopPropagation:()=>{t=!0,i.stopPropagation()},isPropagationStopped:()=>t,persist:()=>{},timeStamp:i.timeStamp,type:i.type}},detectIt:He,focusableNodeNames:_o,toPrettyKeyCode:Lt},Symbol.toStringTag,{value:"Module"})),mo=[];function Ue(i,e,t=mo){const o=l.useRef(null);return l.useImperativeHandle(i,()=>{if(!o.current)return;const n=o.current,r=e?.();if(!r||typeof r!="object")throw new Error("attributes must return a plain object of values");const s=Object.keys(r),a=s.length;for(let c=0;c<a;c++){const u=s[c],h=r[u];Object.defineProperty(n,u,{value:h,writable:!0,configurable:!0,enumerable:!0})}return n},t),o}const Ve=i=>v.jsx(ze,{...i}),Mt=({width:i,height:e})=>v.jsx("div",{className:"corner",style:{minWidth:`${i}px`,width:`${i}px`,minHeight:`${e}px`,height:`${e}px`}}),Tt=l.memo(l.forwardRef((i,e)=>{const{children:t,viewport:o,onScrollViewport:n,showHorizontalScrollbar:r=!0,showVerticalScrollbar:s=!0,createScrollCorner:a=Mt,createHorizontalScrollbar:c=Ve,createVerticalScrollbar:u=Ve,style:h,touchElement:d,disableTouch:p,...w}=i,C=L(n,[n]),S=Ue(e,()=>({isScrollPane:()=>!0}),[]),E=l.useRef(null);l.useEffect(()=>{E.current&&(E.current.__scrollTop===o?.top&&E.current.__scrollLeft===o?.left||E.current.__isDecelerating||E.current?.scrollTo(o?.left,o?.top,!1))},[o?.left,o?.top,d]);const k=l.useCallback((_,M)=>{C?.({left:_,top:M})},[]),f=l.useCallback(_=>{E.current?.doTouchStart(_.touches,_.timeStamp)},[]),x=l.useCallback(_=>{_.preventDefault(),E.current?.doTouchMove(_.touches,_.timeStamp)},[]),g=l.useCallback(_=>{E.current?.doTouchEnd(_.timeStamp)},[]),R=l.useCallback(({containerWidth:_,containerHeight:M,totalWidth:m,totalHeight:T})=>{E.current.setDimensions(_,M,m,T)},[]);l.useEffect(()=>{const _=d??S.current;if(!p&&He().supportsTouchEvents&&_&&o){if(!E.current){const M={scrollingX:!0,scrollingY:!0,decelerationRate:.95,penetrationAcceleration:.08};E.current=new ro(k,M)}He().supportsTouchEvents&&(_.addEventListener("touchstart",f),_.addEventListener("touchend",g),_.addEventListener("touchmove",x)),R({containerWidth:o?.width,containerHeight:o?.height,totalWidth:o?.totalWidth,totalHeight:o?.totalHeight})}return()=>{_?.removeEventListener("touchstart",f),_?.removeEventListener("touchend",g),_?.removeEventListener("touchmove",x)}},[o?.width,o?.height,o?.totalWidth,o?.totalHeight,p,d]);const[z,{width:j}]=he(),[H,{height:y}]=he(),b=l.useMemo(()=>{const _=u({orientation:ee.Vertical,offset:o?.top,viewportSize:o?.height,totalSize:o?.totalHeight,onScrollOffset:M=>{C?.({top:M})}});return v.jsx("div",{style:{display:"flex",flex:"0"},ref:z,children:_})},[u,o?.top,o?.height,o?.totalHeight]),A=l.useMemo(()=>{const _=c({orientation:ee.Horizontal,offset:o?.left,viewportSize:o?.width,totalSize:o?.totalWidth,onScrollOffset:M=>C?.({left:M})});return v.jsxs("div",{style:{display:"flex",flex:"none",flexDirection:"row",alignItems:"stretch",justifyContent:"center"},children:[v.jsx("div",{style:{display:"flex",flex:"1 1 100%",flexDirection:"column",width:`calc(100% - ${j}px)`},children:v.jsx("div",{ref:H,className:"sizer",children:_})}),s?a({width:j,height:y}):v.jsx(v.Fragment,{})]})},[c,o?.left,o?.width,o?.totalWidth,s,a,j,y]);return v.jsx("div",{style:{position:"relative",display:"flex",minWidth:s?`${j}px`:void 0,minHeight:r?`${y}px`:void 0,...h},...w,ref:S,children:v.jsxs("div",{style:{position:"relative",width:"100%",flex:"1 1 100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:[v.jsxs("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:[v.jsx("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:t}),s?b:v.jsx(v.Fragment,{})]}),r?A:v.jsx(v.Fragment,{})]})})}));Tt.displayName="ScrollPane";const Fe={Default:"default",Error:"error",Success:"success",Warning:"warning",Info:"info"},ct=new Set,Ae={showMessage:(i,e)=>{if(e?.onceKey){if(ct.has(e.onceKey))return;ct.add(e.onceKey)}let t=console.log;e?.type!==Fe.Warning&&e?.type!==Fe.Error||(t=console.warn),t(i)},showBusy:(i,e)=>new Promise(t=>{t(()=>{})}),showError:i=>{console.error(i)}},ut=()=>{const i=document.fullscreenElement;return i?i.querySelector(".fullscreen-portal-root")||i:document.body};let Se=0;const go=100,yo=100,vo=1e6,xo=100,bo=50,Dt=l.memo(l.forwardRef((i,e)=>{const{offset:t=0,viewportSize:o=0,totalSize:n=0,minSize:r=0,endGap:s=go,endScrollIncrement:a=yo,style:c=Et,onMouseDown:u,onScrollOffset:h,onScroll:d,scaleLimit:p=vo,scaleFactor:w=xo,precisionFactor:C=bo,...S}=i;d&&console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");const E=L(u,[u]),k=()=>({offset:t,totalSize:p===0?n:Math.min(n??0,Math.max(r??0,(t??0)+(o??0))+(s??0))}),[f,x]=l.useState(k),g=p!==0&&f.totalSize>p?w:1,R=g/C,z=Math.ceil(f.totalSize/g),j=Math.ceil(f.offset/g),H=Math.ceil(o/g),y=l.useCallback(P=>{},[]),[b,A]=l.useState(!1),_=l.useRef(null);l.useLayoutEffect(()=>{if(!b){_.current={propTotalSize:n,propViewportSize:o,propOffset:t};const P=k();x(P)}},[n,o,t,b,r,s,a]);const M=L((P,X,F)=>{const I=_.current;_.current=null,I&&I.propTotalSize===n&&I.propViewportSize===o&&I.propOffset===t||(Math.abs(P-j)<R&&(P=j),h?.(P*g,j,H))},[h,g,R,j,H]),m=l.useCallback(P=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",m),A(!1)},[]),T=l.useCallback(P=>{E?.(P),A(!0),document.addEventListener("mousemove",y,{passive:!0}),document.addEventListener("mouseup",m,{passive:!0})},[y,m]);return v.jsx(ze,{ref:e,style:{...c},...S,offset:j,totalSize:z,viewportSize:H,onMouseDown:T,onScrollOffset:M})}));Dt.displayName="VirtualScrollbar";function Be(i,e){if(typeof i=="function")return i(e);i&&(i.current=e)}var Pe=parseInt(l.version.split(".")[0],10)>=19?function(i){return e=>{const t=[];for(const o of i){const n=Be(o,e),r=typeof n=="function";t.push(r?n:()=>Be(o,null))}return()=>{for(const o of t)o()}}}:function(i){return e=>{for(const t of i)Be(t,e)}};const wo=l.memo(l.forwardRef((i,e)=>{const{refFocusStart:t,...o}=i,n=l.useRef(null),r=l.useCallback(()=>{if(t)return void t?.current?.focus();const s=n.current.parentElement.children;let a=[];for(let c=0;c<s.length&&s[c]!==n.current;c++){const u=s[c].getAttribute("tabindex");if(u==null||u==="-1"||s[c].getAttribute("disabled")==="true")continue;const h=s[c];h.focus&&a.push({tabindex:parseInt(u),child:h})}a.length!==0&&(a.sort(function(c,u){return c.tabindex-u.tabindex}),a[0].child.focus())},[t]);return v.jsx("div",{tabIndex:0,ref:Pe([n,e]),onFocus:r,...o})})),So=l.memo(l.forwardRef((i,e)=>{const{className:t,style:o,children:n,radius:r=4,strokeWidth:s=1,strokeColor:a="grey",...c}=i,[u,{width:h,height:d}]=he(),p=l.useRef(null),w=(k,f=0)=>{const x=k/2,g=d-x+f;return function(R,z,j=!1){if(z===0)return R;function H(m,T,P){let X=T.x-m.x,F=T.y-m.y,I=Math.sqrt(X*X+F*F);return y(m,T,Math.min(1,P/I))}function y(m,T,P){return{x:m.x+(T.x-m.x)*P,y:m.y+(T.y-m.y)*P}}function b(m,T){m.length>2&&(m[m.length-2]=T.x,m[m.length-1]=T.y)}function A(m){return{x:parseFloat(m[m.length-2]),y:parseFloat(m[m.length-1])}}let _=R.split(/[,\s]/).reduce(function(m,T){let P=T.match("([a-zA-Z])(.+)");return P?(m.push(P[1]),m.push(P[2])):m.push(T),m},[]).reduce(function(m,T){return parseFloat(T)==T&&m.length?m[m.length-1].push(T):m.push([T]),m},[]),M=[];if(_.length>1){let m=A(_[0]),T=null;_[_.length-1][0]==="Z"&&_[0].length>2&&(T=["L",m.x,m.y],_[_.length-1]=T),M.push(_[0]);for(let P=1;P<_.length;P++){let X=M[M.length-1],F=_[P],I=F===T?_[1]:_[P+1];if(I&&X&&X.length>2&&F[0]==="L"&&I.length>2&&I[0]==="L"){let N,B,V=A(X),U=A(F),J=A(I);j?(N=y(U,X.origPoint||V,z),B=y(U,I.origPoint||J,z)):(N=H(U,V,z),B=H(U,J,z)),b(F,N),F.origPoint=U,M.push(F);let de=y(N,U,.5),pe=y(U,B,.5),$=["C",de.x,de.y,pe.x,pe.y,B.x,B.y];$.origPoint=U,M.push($)}else M.push(F)}if(T){let P=A(M[M.length-1]);M.push(["Z"]),b(M[0],P)}}else M=_;return M.reduce(function(m,T){return m+T.join(" ")+" "},"")}(`${`M 0 ${x} L ${r-.5} ${x} L ${r-.5} ${g} L ${2*r} ${g}`} ${`L ${h-2*r} ${g}`} ${`M ${h-2*r} ${g} L ${h-r} ${g} L ${h-r} ${x} L ${h} ${x}`}`,r)},C=l.useMemo(()=>w(s),[h,d,r,s]),S=l.useMemo(()=>{if(r===0)return;const k=r/2;return w(r)+`L ${h} 0 L 0 0 L 0 ${k}`},[C,r,s]),E=l.useMemo(()=>({style:{clipPath:`path('${S}')`}}),[S]);return v.jsxs("div",{className:t,style:{display:"flex",flexDirection:"row",...o},...c,ref:Pe([p,u,e]),children:[l.isValidElement(n)?l.cloneElement(n,E):v.jsx(v.Fragment,{}),v.jsx("svg",{style:{position:"absolute",top:0,left:0,pointerEvents:"none"},width:h,height:d,viewBox:`0 0 ${h} ${d}`,children:v.jsx("path",{d:C,stroke:a,fill:"none",vectorEffect:"non-scaling-stroke",strokeWidth:s})})]})})),Co={},Pt=i=>{const{onPointerDown:e,style:t,splitDirection:o,paddingBefore:n=0,paddingAfter:r=0,disabled:s,key:a,hitAreaProps:c=Co,...u}=i,h=o==="row",{style:d,className:p,...w}=c;return v.jsx("div",{style:{...t,position:"relative"},...u,children:v.jsx("div",{className:fe("hit-box",p),style:{left:(h?-n:0)+"px",width:`calc(100% + ${h?n+r:0}px)`,top:(h?0:-n)+"px",height:`calc(100% + ${h?0:n+r}px)`,position:"absolute",...d},onPointerDown:s?void 0:e,...w})},a)},Ce={},ue=(i,e,t=!0)=>i===null?null:i.pixels!==null?t?i.pixels:e-i.pixels:(t?i.percent:100-i.percent)/100*e,Ee=(i,e=!0)=>i?.percent?`${e?i.percent:100-i.percent}%`:i?.pixels?`${i.pixels}px`:void 0,le=(i,e)=>{if(i==null)return null;const t={percent:null,pixels:null};let o=e;return typeof i=="string"&&((i=i.trim().toLowerCase()).endsWith("px")?(i=i.substring(0,i.length-2),o=!1):i.endsWith("%")&&(i=i.substring(0,i.length-1),o=!0),i=parseFloat(i)),o?t.percent=i:t.pixels=i,Object.freeze(t)},Eo=l.memo(l.forwardRef((i,e)=>{const{elementBefore:t,elementAfter:o,splitDirection:n="row",fixedPane:r=null,position:s,onPositionChange:a,minBefore:c,maxBefore:u,minAfter:h,maxAfter:d,children:p,className:w,style:C,disabled:S=!1,onDragStart:E,onDragResize:k,onDragFinish:f,resizerProps:x=Ce,paneProps:g=Ce,paneBeforeProps:R=Ce,paneAfterProps:z=Ce,createResizer:j=Pt}=i;if(p)throw new Error("Use elementBefore and elementAfter instead of children.");const H=l.useMemo(()=>l.isValidElement(o)&&l.isValidElement(t),[o,t]),y=l.useMemo(()=>{let D=null;r&&(r==="before"?D=0:r==="after"&&(D=1));const O=D===null;return{fixedPaneOffset:D,isPercent:O,minBefore:le(c,O),maxBefore:le(u,O),minAfter:le(h,O),maxAfter:le(d,O)}},[c,u,h,d]),b=L(a,[a]),[A,_]=l.useState(()=>le(s,r===null));l.useEffect(()=>{_(le(s,r===null))},[s,r]);const[M,{width:m,height:T}]=he(),[P,{width:X,height:F}]=he(),I=n==="row"?X:F,N=n==="row"?m:T,B=l.useMemo(()=>((D,O,q,Y)=>{const ie=[null,null],Q=[null,null];if(D||(D={percent:Y.fixedPaneOffset===null?50:null,pixels:Y.fixedPaneOffset===null?null:0}),O===0)return D?.pixels!=null?Y.fixedPaneOffset!==1?(ie[0]=D?.pixels,Q[1]=100):(ie[1]=D?.pixels-q,Q[0]=100):D?.percent!=null&&(Y.fixedPaneOffset!==1?(Q[0]=D?.percent,Q[1]=100-D?.percent):(Q[1]=D?.percent,Q[0]=100-D?.percent)),{percents:Q,pixels:ie,minBefore:Ee(Y.minBefore,!0),maxBefore:Ee(Y.maxBefore,!0),minAfter:Ee(Y.minAfter),maxAfter:Ee(Y.maxAfter)};let se=ue(D,O,Y.fixedPaneOffset!==1),G=O-q,et=ue(Y.minBefore,G,!0)??0,Xt=ue(Y.maxBefore,G,!0)??G,we=0,Re=0,tt=0,ot=G;we=(ue(Y.maxAfter,O,!1)??q)-q,Re=ue(Y.minAfter,O,!1)??O,tt=Math.max(et,we),ot=Math.min(Xt,Re),se=Math.max(tt,Math.min(se,ot)),Re=Math.min(G-se,ue(Y.maxAfter,G-se,!0)??G),we=Math.min(G-se,ue(Y.minAfter,G-se,!0)??G),ie[0]=se,ie[1]=G-ie[0];const qt=Math.max(0,Math.min(100,se/G*100));return Q[0]=qt,Q[1]=100-Q[0],{percents:Q,pixels:ie,minBefore:`${et}px`,minAfter:`${we}px`,maxBefore:`${ie[0]}px`,maxAfter:`${ie[1]}px`}})(A,N,I,y),[y,A,N,I,n]),[V,U]=l.useState(!1),J=L(E,[E]),de=L(k,[k]),pe=L(f,[f]),$=l.useRef(null),oe=l.useRef(null),te=l.useRef(null),{style:ce,className:ne,...re}=g,ye={minWidth:0,minHeight:0,maxWidth:"100%",maxHeight:"100%",display:"flex",overflow:"hidden",...ce},{className:At,style:Bt,...jt}=R,{className:$t,style:Ot,...Kt}=z,Ht={flex:"1 1 100%",width:"100%",...C,flexDirection:n,display:"flex"},{className:Xe,style:qe,onPointerDown:Ze,...Ge}=x,Vt=L(D=>{const O=le(D,r===null);_(O)},[r]),xe=L(D=>{if(S||!V)return;const O=Qe.current?.getBoundingClientRect();let q=0;q=n==="row"?(D.clientX??D.touches?.[0]?.clientX)-O.x:(D.clientY??D.touches?.[0]?.clientY)-O.y,q=Math.max(0,Math.min(N,q)),y.fixedPaneOffset===1&&(q=N-q),s&&A.pixels===q||_({pixels:q,percent:null}),de?.(q),D.stopPropagation(),D.preventDefault()},[y,n,S,V,A,N]),Je=L(D=>{if(document.removeEventListener("pointermove",xe),document.removeEventListener("touchmove",xe),document.removeEventListener("pointerup",Je),!!V&&(U(!1),!!A)){if(pe(A.pixels),!le(s,r===null)||A.pixels!==s){const O={...A};O.percent===null&&(O.percent=O.pixels/N*100),b(O)}D.stopPropagation(),D.preventDefault()}},[A,V,s,r,N]),Ft=L(D=>{Ze?.(D),D.defaultPrevented||S||V||(U(!0),J(),document.addEventListener("pointermove",xe,{passive:!1}),document.addEventListener("touchmove",xe,{passive:!1}),document.addEventListener("pointerup",Je,{passive:!1}))},[Ze]),Qe=Ue(e,()=>({setPosition:Vt,isSplitPane:()=>!0}),[]),It=l.useMemo(()=>H?j?.({key:"resizer",ref:Pe([P,oe]),className:fe("resizer",Xe),onPointerDownCapture:Ft,style:{cursor:S?void 0:n==="row"?"ew-resize":"ns-resize",minWidth:n==="row"?"2px":void 0,minHeight:n!=="row"?"2px":void 0,boxSizing:"border-box",pointerEvents:"all",zIndex:1,...qe},splitDirection:n,disabled:S,...Ge}):null,[H,Xe,Ge,n,qe,S]),be=n==="row"?"Width":"Height",Nt={...ye,...Bt,flex:y.fixedPaneOffset===0&&B?.pixels[0]!==null?`0 0 ${Math.round(B?.pixels[0])}px`:`1 1 ${Math.round(B?.percents[0]??100)}%`,[`min${be}`]:B?.minBefore,[`max${be}`]:o?B?.maxBefore:"100%"},Wt={...ye,...Ot,flex:y.fixedPaneOffset===1&&B?.pixels[1]!==null?`0 0 ${Math.round(B?.pixels[1])}px`:`1 1 ${Math.round(B?.percents[1]??100)}%`,[`min${be}`]:B?.minAfter,[`max${be}`]:t?B?.maxAfter:"100%"},Ut=l.useMemo(()=>t?v.jsx("div",{ref:$,className:fe("before",ne,At),style:Nt,...re,...jt,children:t},"before"):null,[t,g,R,y,B]),Yt=l.useMemo(()=>o?v.jsx("div",{ref:te,className:fe("after",ne,$t),style:Wt,...re,...Kt,children:o},"after"):null,[o,g,z,y,B]);return v.jsxs("div",{ref:Pe([M,Qe]),className:fe("splitPane",n==="row"?"vertical":"horizontal",{dragging:V},w),style:Ht,children:[Ut,It,Yt]})}));function ht(i){if(!i)throw new Error("must have a PointerHandlerOptions");const{onPointerDown:e,onPointerUp:t,onPointerMoveOrWait:o,processTouch:n=!1,consumeTouch:r=!0}=i,s=L(e,[e]),a=L(t,[t]),c=L(o,[o]),u=l.useRef(!1),h=i?.timerInitial??230,d=i?.timerContinuous??h/2,p=l.useRef(null),w=l.useRef(null),C=l.useRef(null),S=l.useRef(null),E=l.useCallback(()=>{S.current&&(clearTimeout(S.current),S.current=null)},[]),k=l.useCallback(b=>{S.current=setTimeout(()=>{window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)}),k(d)},b??h)},[]);l.useEffect(()=>()=>E(),[]);const f=n?"pointer":"mouse",x=l.useCallback(b=>{b.stopPropagation(),b.stopImmediatePropagation(),b.preventDefault()},[]),g=L(b=>{document.removeEventListener(`${f}move`,j),document.removeEventListener(`${f}up`,g),document.removeEventListener("keydown",H),document.removeEventListener("keyup",y),document.removeEventListener("touchstart",x,{capture:!0}),document.removeEventListener("touchmove",x,{capture:!0}),window.removeEventListener("blur",R),E(),window.requestAnimationFrame(()=>{u.current!==!1&&(u.current=!1,a?.(b,C.current,p.current),C.current=null)})},[]),R=l.useCallback(()=>{u.current!==!1&&(u.current=!1,g(w.current))},[]),z=L(()=>{E(),k(d),window.requestAnimationFrame(()=>{u.current!==!1&&c?.(w.current,C.current,p.current)})},[d]),j=L(b=>{w.current=b,z()},[]),H=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},z()},[]),y=L(b=>{C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},z()},[d]);return L(b=>{b.isDefaultPrevented()||(C.current={ctrlKey:b.ctrlKey,shiftKey:b.shiftKey,altKey:b.altKey,metaKey:b.metaKey},s(b,C.current)!==!1&&(p.current=b,w.current=b.nativeEvent,document.addEventListener(`${f}up`,g,{passive:!1}),document.addEventListener(`${f}move`,j,{passive:!1}),document.addEventListener("keydown",H,{passive:!1}),document.addEventListener("keyup",y,{passive:!1}),window.addEventListener("blur",R,{passive:!0}),n&&r&&(document.addEventListener("touchstart",x,{passive:!1,capture:!0}),document.addEventListener("touchmove",x,{passive:!1,capture:!0})),u.current=!0,k(h)))},[h,n])}const Lo=({initValue:i,useHookBody:e,applyStateChange:t})=>{const o=l.useRef(i);if(typeof e!="function")throw new Error("function expected as hook body parameter. got "+typeof e);const n=e();return l.useLayoutEffect(()=>{o.current!==n&&(o.current=n,t(n))},[t,n]),null},Ie=i=>{console&&console.warn&&console.warn(i)},je=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global||void 0;let Mo=1,Ne=!1,kt=!1;const Te=[],me=[],ke=()=>{me.forEach(i=>i())},To=({automaticContainerInternalUseOnly:i})=>{const[e,t]=l.useState([]),o=l.useRef([]);return o.current=e,i||Ne!==!1||(kt=!0),l.useEffect(()=>{let n=!0;function r(){if(n)return me[0]!==r?(i||Ne!==!0||Ie("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."),void t(s=>[])):void t([...Te])}return me.push(r),ke(),()=>{n=!1,o.current?.length>0&&Ie("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"),me.splice(me.indexOf(r),1),ke()}},[i]),v.jsx(v.Fragment,{children:e.map(({hook:n,key:r})=>l.createElement(Lo,{...n,key:r}))})},Do=i=>{const e=Mo++;return Te.push({hook:i,key:e}),me.length===0&&kt===!1&&(Ne=!0,(t=>{if(je.document&&je.document.createElement){const o=je.document.createElement("div");Zt.createRoot(o).render(v.jsx(t,{automaticContainerInternalUseOnly:!0}))}else Ie("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")})(To)),ke(),()=>{Te.splice(Te.findIndex(t=>t.key===e),1),ke()}},zt=(i,e,t={})=>{let o,n,r=!1,s=!1,a=[],{unmountIfNoConsumers:c=!1}=t;const u=d=>{var p;n=d,p=()=>a.forEach(w=>w(d)),Gt.unstable_batchedUpdates(p)},h=()=>(s||(n=typeof i=="function"?i():i,s=!0),n);return()=>{const[d,p]=l.useState(h);return l.useEffect(()=>(r||(r=!0,o=Do({initValue:i,useHookBody:e,applyStateChange:u})),a.push(p),n!==d&&p(n),()=>{a.splice(a.indexOf(p),1),a.length===0&&c&&(o(),r=!1)}),[]),d}};let Rt=()=>{console.warn("You must call useEditMode before setting its state.")};const Po=zt(null,()=>{const[i,e]=l.useState(null);return Rt=e,i});class De{constructor(e,t,o,n){this._listenersProperties=new Set,this._listenersExecute=new Set,this._key=e,this._target=t,this._applyProps(o||{}),this._callback=n,n===void 0&&(this._callback=()=>{console.log(`implement: ${this.label()} : ${this.description()}`)})}key(){return this._key}_resolve(e,t){if(typeof e=="function"){const o=t??this._context;return e(typeof o=="function"?o():o)}return e}target(){return typeof this._target=="function"?this._target():this._target}label(e,t){const o=this._scopedLabels?.[e]||this._label;let n=null;if(typeof o=="function"){const r=t??this._context;n=o(typeof r=="function"?r():r)}else n=o;return n}description(e){return this._resolve(this._description,e)}tags(e){return this._resolve(this._tags,e)}icon(e){return this._resolve(this._icon,e)}shortcut(){return this._resolve(this._shortcut)}disabled(){return this._resolve(this._disabled)||!this._callback}state(){return this._resolve(this._state)}context(){return typeof this._context=="function"?this._context():this._context}async execute(e,t){if(!this.disabled()&&this._callback){try{let o=!0;if(t?.beforeExecute&&(o=t?.beforeExecute(this,e)),await Promise.resolve(o)===!1)return!1;const n=this._callback.bind(this)(e,this);if(await Promise.resolve(n)===!1)return!1;t?.onExecute?.(this,e),this._notifyExecute(e)}catch(o){return console.warn(o),t?.onError(this,o,e),this._notifyError(e,o),!1}return!0}}addPropertyListener(e,t=!1){if(!e)throw new Error("listener must be specified");const o=this._listenersProperties;return o.add(e),t&&e({},this),()=>{o.delete(e)}}addExecuteListener(e){if(!e)throw new Error("listener must be specified");const t=this._listenersExecute;return t.add(e),function(){t.delete(e)}}_notifyExecute(e){const t=this;this._listenersExecute.forEach(o=>{o.onExecute(t,e)})}_notifyError(e,t){const o=this;this._listenersExecute.forEach(n=>{n.onError?.(o,e,t)})}updateCallback(e){return this._callback=e||null,this}update(e){if(!e)return;const t=this._applyProps(e);return Object.keys(t).length>0&&this._notifyPropertyChange(t),this}_notifyPropertyChange(e){const t=this;this._listenersProperties.forEach(o=>{o(e,t)})}_applyProps(e){let t={},o=this;return Object.keys(e).forEach(n=>{let r=e[n];o["_"+n]!==r&&(o["_"+n]=t[n]=r)}),t}}class Le extends De{}class Ye{constructor(e,t){this._target=null,this._groupKey=null,this._root=null,this._parent=null,this._uuid=K.CommonUtils.uuidV4(),this._target=e,this._groupKey=t??null,this._root=this,this._nodes=new Map,this._nodes.set(t,this),this._children=new Map,this._listeners=new Set,this._commandsByKey=new Map,this._commandsByShortcut=new Map;const o=this;this._unListenersByCommand=new Map,this._listenersByKey=new Map,this._commandsPropertyListener=(n,r)=>{const s=o._root._listenersByKey,a=r.key(),c=s.get(a);c&&o._notifyCommands(c,"onCommandChange",r)}}_getCommand(e){return this._commandsByKey.get(e)||(this._parent?._getCommand(e)??null)}getCommand(e,t=!1){const o=this._root._focused;let n=o,r=o===this;for(;!r&&n;)n===this&&(r=!0),n=n._parent;return(r?o:this)._getCommand(e)}createChildGroup(e,t,o){let n;if(!o){let a=this;for(;a&&!n;){let c=a._nodes.get(t);c&&(n=c),a=a._parent}}n||(n=new Ye(e,t),n._parent=this,n._root=this._root,n._unListenersByCommand=null,n._listenersByKey=null,n._commandsPropertyListener=null);const r=(a,c)=>{!a.has(t)||o?a.set(t,c):o===void 0&&console.warn("commandGroup already registered",t)};r(this._root._nodes,n);let s=this._parent;for(;s;)r(this._nodes,n),s=s._parent;return this._children.set(t,n),this._notify("onGroupChange"),n}getKey(){return this._groupKey}getGroup(e){return this._nodes.get(e)}_addCommands(e,t=void 0){const o=this._commandsByKey,n=this._commandsByShortcut,r=this._root._commandsPropertyListener,s=this._root._unListenersByCommand;for(let a=0;a<e.length;a++){const c=e[a],u=c.key();if(o.has(u)&&!t){t===void 0&&console.warn("command already registered",u);continue}o.set(u,c);let h=s.get(c);h&&(h(),s.delete(c));const d=c.addPropertyListener(r);s.set(c,d);const p=c.shortcut();if(!p)continue;const w=Array.isArray(p)?p:[p];for(let C=0;C<w.length;C++){const S=_e(w[C]),E=n.get(S);E&&!t&&t===void 0&&console.warn(`Shortcut already registered: ${S}, ${u}, ${E}.`),n.set(S,u)}}}removeFromParent(){if(!this._parent)return;let e=this._parent,t=[];const o=this._groupKey;for(;e;)t.push(e._nodes),e._nodes.delete(o),e=e._parent;e=this._parent;const n=r=>{r._children.forEach(s=>{for(let a=0;a<t.length;a++)s._nodes.delete(t[a]);n(s)})};n(this),this._parent=null,this._notify("onGroupChange")}addCommands(e,t){this._addCommands(e,t),this._notify("onGroupChange")}getActive(){return this._root._focused??this._root}activate(e){let t=this;if(e&&(t=this._nodes.get(e),!t))return void console.warn("group not found",e);let o=this._root._focused??this._root;for(;o;)o=o._parent;this._root._focused!==t&&(this._root._focused=t,this._notify("onGroupChange"),this._notify("onActiveChange"))}findCommandByEvent(e){const t=[];e.altKey&&t.push(W.Alt),e.shiftKey&&t.push(W.Shift),e.ctrlKey&&t.push(W.Ctrl),e.metaKey&&t.push(W.Meta);let o=_e({key:e.code,modifiers:t});const n=this._commandsByShortcut;let r=n.get(o);r||(o=_e({key:e.key,modifiers:t}),r=n.get(o)),!r&&e.code.startsWith("Digit")&&(o=_e({key:e.code.substring(5,e.code.length),modifiers:t}),r=this._commandsByShortcut.get(o)),!r&&e.code.startsWith("Key")&&(r=_e({key:e.code.substring(3,e.code.length),modifiers:t}),r=n.get(o));let s=null;return r&&(s=this._commandsByKey.get(r),s&&s.disabled()&&(s=null),!s||s.target()&&s.target().contains(e.target)||(s=null)),s||(this._parent?.findCommandByEvent(e)??null)}dispatchToFocusedCommand(e){const t=this.getActive();if(!t||e.isDefaultPrevented())return!1;const o=t.findCommandByEvent?.(e);return!!o&&(o.execute(),e.preventDefault(),!0)}getRoot(){return this._parent?this._parent.getRoot():this}getParent(){return this._parent}addListener(e,t){const o=this._listeners,n=t?.keys,r=this._root._listenersByKey;if(n&&!e.onCommandChange)throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");let s=null;if(n)for(let a=0;a<n.length;a++){const c=n[a];if(!c)continue;let u=r.get(c);u||(u=new Set,r.set(c,u)),s||(s=[]),s.push(u),u.add(e)}return o.add(e),()=>{if(s)for(let a=0;a<s.length;a++)s[a].delete(e);o.delete(e)}}_notifyCommands(e,t,o){const n=this;setTimeout(()=>{e.forEach(r=>{r[t]?.(n,o)})},0)}_notify(e,t){const o=this;setTimeout(()=>{o._listeners.forEach(n=>{n[e]?.(o,t)}),o._parent&&o._parent._notify(e,t)},0)}getAllCommands(){const e=[],t=this._groupKey;return this._commandsByKey.forEach(o=>{e.push({command:o,groupKey:t})}),this._children.forEach(o=>{e.push(...o.getAllCommands())}),e}}const ko=K.CommonUtils.getOS()===K.CommonUtils.OSType.MacOS||K.CommonUtils.getOS()===K.CommonUtils.OSType.IOS?"Cmd":"Ctrl",zo=K.CommonUtils.getOS()===K.CommonUtils.OSType.MacOS||K.CommonUtils.getOS()===K.CommonUtils.OSType.IOS?"⌘":"^",_e=(i,e=!1)=>{const t={};for(let n=0;i.modifiers&&n<i.modifiers.length;n++)t[i.modifiers[n]]=!0;let o="";return(t?.[W.Ctrl]||t?.[W.Meta])&&(o+=(o.length>0?"+":"")+(e?zo:ko)),t?.[W.Alt]&&(o+=e?"⌥":"Alt"),t?.[W.Shift]&&(o+=(o.length>0?"+":"")+(e?"⇧":"Shift")),o+=(o.length>0?"+":"")+Lt(i.key),o},Me=(i,e)=>{const t=[];if(e)for(let o=0;o<e.length;o++){const n=e[o],r=n?i?.getCommand(n):null;t.push(r)}return t},dt=zt({setClipboard:i=>{throw new Error("This is only available via the useClipboard.")},getClipboard:()=>K.InternalClipboard.Global,refNativeCopy:{current:null},refNativeLastKey:{current:null}},()=>{const[i,e]=l.useState(K.InternalClipboard.Global);return{setClipboard:t=>e(t),getClipboard:()=>i,refNativeCopy:l.useRef(null),refNativeLastKey:l.useRef(null)}});let $e=!1,Ro=0;var Ao=typeof document<"u"?l.useLayoutEffect:l.useEffect;const pt=()=>"sheetxl-ui-"+Ro++,_t=l.useId,Bo=_t??function(){const[i,e]=l.useState(()=>$e?pt():void 0);return Ao(()=>{i==null&&e(pt())},[]),l.useEffect(()=>{$e||($e=!0)},[]),i},ft="Undo the last action.",mt="Repeat the last action or undo the redo.",jo=i=>`Redo ${i}`;exports.Command=De,exports.CommandButtonType={Toolbar:"toolbar",Menuitem:"menuitem"},exports.CommandGroup=Ye,exports.DefaultNotifier=Ae,exports.FocusKeyNavigation=wo,exports.HorizontalAlignment={General:"general",Left:"left",Right:"right",Center:"center",Justify:"justify",Fill:"fill",Distributed:"distributed",CenterContinuous:"centerContinuous"},exports.KeyCodes={BackSpace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Delete:46,Digit_8:56,Y:89,Z:90,Meta:91,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NumLock:144,ScrollLock:145,BackSlash:220,Slash:191,BracketRight:221,BracketLeft:219},exports.KeyModifiers=W,exports.MouseButtonCodes={Left:1,Middle:2,Right:3},exports.NotificationType=Fe,exports.ReactUtils=fo,exports.RoundedTab=So,exports.ScrollPane=Tt,exports.ScrollUtils=eo,exports.Scrollbar=ze,exports.ScrollbarOrientation=ee,exports.SimpleCommand=Le,exports.SplitPane=Eo,exports.SplitPaneResizer=Pt,exports.ToolTipPlacement={BottomEnd:"bottom-end",BottomStart:"bottom-start",Bottom:"bottom",LeftEnd:"left-end",LeftStart:"left-start",Left:"left",RightEnd:"right-end",RightStart:"right-start",Right:"right",TopEnd:"top-end",TopStart:"top-start",Top:"top"},exports.VirtualScrollbar=Dt,exports.defaultCreateScrollCorner=Mt,exports.defaultCreateScrollEdgeButton=i=>{const{style:e,orientation:t=ee.Vertical,...o}=i,n=t===ee.Vertical,r=n?"rotate(90) ":"";return v.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"end",transition:"fill-opacity 1s",zIndex:1,width:"24px",height:"24px",...e},className:`scrollbar-button ${n?"vertical":"horizontal"} edge`,...o,children:v.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",transform:r,children:v.jsx("path",{style:{transition:"opacity 240ms ease 0s",opacity:i.disabled?0:1},d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})})})},exports.defaultCreateScrollEndButton=xt,exports.defaultCreateScrollStartButton=vt,exports.defaultCreateScrollbar=Ve,exports.getDevicePixelRatio=function(i){if(typeof window>"u")return 1;const{defaultDpr:e=1,maxDpr:t=3,round:o=!0}=i||{},n=typeof window<"u"&&typeof window.devicePixelRatio=="number"?window.devicePixelRatio:e;return Math.min(Math.max(1,o?Math.floor(n):n),t)},exports.getPortalContainer=ut,exports.toShortcutString=_e,exports.useCallbackRef=L,exports.useCommand=function(i,e=null){const t=l.useRef(e);t.current=e;const[o,n]=l.useReducer(s=>s+1,0),r=l.useMemo(()=>Array.isArray(i)?i:[i],[i]);return l.useEffect(()=>{if(!r||r.length===0)return;const s=(u,h)=>{t.current?.onChange?.(h),n()};let a=null;e&&(a={onExecute(u,h){t.current?.onExecute?.(u,h)},onError(u,h,d){t.current?.onError?.(u,h,d)}});const c=new Set;for(let u=0;u<r.length;u++)c.add(r[u]?.addPropertyListener(K.CommonUtils.debounce(s,0),!0)),e&&c.add(r[u]?.addExecuteListener(a));return()=>{c.forEach(u=>{u?.()})}},[i]),o},exports.useCommands=function(i,e=null,t=null,o){const n=l.useRef(t);n.current=t,e&&!Array.isArray(e)&&(e=[e]);const[r,s]=l.useState(Me(i,e)),a=o?[...o,i]:[i];return l.useEffect(()=>{const c={onGroupChange:()=>{const p=Me(i,e);s(p),n.current?.onChange?.(this)}};let u;e&&e.length>0&&(u={keys:e},c.onCommandChange=(p,w)=>{n.current?.onChange?.(i),s(Me(i,e))});const h=i?.addListener(c,u),d=Me(i,e);return s(d),n.current?.onChange&&n.current?.onChange(i),()=>{h?.()}},a),r},exports.useCopyPaste=i=>{const{source:e,target:t,onPaste:o,onClipboardUpdate:n,notifier:r=Ae,commands:s}=i,a=L(n,[n]),c=L(o,[o]),{getClipboard:u,refNativeCopy:h}=dt(),d=u();l.useMemo(()=>{const f=e?.element,x=t?.element??e?.element;if(!s)return;const g=[new Le("cut",f,{label:"Cut",description:"Remove the selection and put it on the clipboard so you can paste it somewhere else.",shortcut:{key:"X",modifiers:[W.Ctrl]}}),new Le("copy",f,{label:"Copy",description:"Put a copy of the selection on the clipboard so you can paste it somewhere else.",shortcut:{key:"C",modifiers:[W.Ctrl]}}),new Le("paste",x,{label:"Paste",description:"Add content on the clipboard to your document.",shortcut:[{key:"V",modifiers:[W.Ctrl]},{key:"F8",modifiers:[W.Ctrl]}]})];s?.addCommands(g,!0)},[s]);const p=L(async f=>{if(!e?.element)return;let x=null;try{x=e.doCopy?.(f),typeof x=="string"?await d.writeText(x):await d.writeReference(x)}catch(g){throw g}},[e,r]),w=L(async f=>{const x=e?.element?.();if(x){h.current={sourceElement:x,args:f};try{await p(f)}catch(g){r?.showError?.(g)}}},[e?.element,r]),C=l.useCallback(()=>{w({isCut:!0})},[]),S=L(async(f,x,g)=>{try{if(await f.doPaste(x,g)===!1)return;c?.(x,g)}catch(R){r?.showError?.(R)}},[c]),E=L(async(f,x,g)=>{const R=t?.element?.();if(R&&await K.CommonUtils.whenFocus(R),!f&&!x)return;const z=await r?.showBusy?.("Pasting...");if(x)try{return await S(t,x,g),void z?.()}catch(y){z?.(),r?.showError?.(y)}let j,H=t.importFromExternal;H||(H=(y,b)=>({getItemType:()=>"text",toText:()=>f.text,isClipboardItem:!0}));try{j=await H(f,{isCut:!1})}catch(y){z?.(),r?.showError?.(y)}if(j)try{const y=await Promise.resolve(j);await S(t,y,g),z?.()}catch(y){z?.(),r?.showError?.(y)}else z?.()},[S,t,r]),k=L(async f=>{if(t?.element)try{const x=await d.readReference();if(x)return void await E(null,x,f);const g=[];g[0]=await K.ClipboardUtils.readStringFromClipboard(d,K.MimeType.plain),g[1]=await K.ClipboardUtils.readHTMLFromClipboard(d,K.MimeType.html),g[2]=await K.ClipboardUtils.readBlobFromClipboard(d,K.MimeType.png);const R={text:g[0]??null,html:g[1]??null,image:g[2]??null};await E(R,null,f)}catch(x){if(x?.message==="Document is not focused.")return;r?.showError?.(x)}},[E,t?.element,r]);return L(async f=>{},[e?.element]),L(async f=>{},[t?.element,E,r]),l.useEffect(()=>{if(!d)return;const f=async R=>{const z=await d.readReference();a?.(z)},x=R=>{r?.showMessage?.(K.InternalClipboard.ErrorMessages.PermsRead,{onceKey:"clipboard.features"})},g=R=>{r?.showMessage?.(K.InternalClipboard.ErrorMessages.PermsWrite,{onceKey:"clipboard.features"})};return d.addEventListener("clipboardchange",f),d.addEventListener("clipboarderrorread",x),d.addEventListener("clipboarderrorwrite",g),()=>{d.removeEventListener("clipboardchange",f),d.removeEventListener("clipboarderrorread",x),d.removeEventListener("clipboarderrorwrite",g)}},[d,r]),l.useEffect(()=>{},[p,E,e,t]),l.useEffect(()=>{s?.getCommand("cut")?.updateCallback(C).update({disabled:!e||!t}),s?.getCommand("copy")?.updateCallback(w).update({disabled:!e}),s?.getCommand("paste")?.updateCallback(k).update({disabled:!t})},[e,t,s]),{paste:k,copy:w,clipboard:d}},exports.useDevicePixelRatio=function(i){const[e,t]=l.useState(typeof window<"u"?window.devicePixelRatio:1),o=l.useRef(null);return l.useEffect(()=>{if(!(typeof window<"u"&&"matchMedia"in window))return;const n=()=>{const r=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);r.addEventListener("change",n,{once:!0,passive:!0}),t(window.devicePixelRatio),o.current={mediaMatcher:r,listener:n}};return n(),()=>{o.current&&o.current.mediaMatcher.removeEventListener("change",o.current.listener)}},[i]),e},exports.useEditMode=()=>{const i=Po();return l.useMemo(()=>({setMode:e=>{Rt(t=>(typeof e=="function"&&(e=e(t)),e?.onModeChange?.(e??null),e))},getMode:()=>i}),[i])},exports.useFullscreenPortal=function(){return l.useEffect(()=>{function i(){const e=document.fullscreenElement;if(!e)return;let t=e.querySelector(".fullscreen-portal-root");t||(t=document.createElement("div"),t.className="fullscreen-portal-root _fullscreen-portal-root_1mjsr_4",e.appendChild(t))}return Se++,i(),document.addEventListener("fullscreenchange",i),()=>{document.removeEventListener("fullscreenchange",i),Se--,Se<=0&&(document.querySelectorAll(".fullscreen-portal-root").forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),Se=0)}},[]),{getPortalContainer:ut}},exports.useGlobalClipboard=dt,exports.useId=Bo,exports.useImperativeElement=Ue,exports.useMouseDownAndHoldListener=function(i,e){return ht({onPointerDown:i,onPointerMoveOrWait:(t,o,n)=>{i?.(n)},...e})},exports.useOnClickOrFocusAway=function(i,e,t){const o=L(e,[e]);l.useEffect(()=>{const n=r=>{i.current&&!i.current.contains(r.target)&&o(r)};return t&&t.mouseEvents===!1||(document.addEventListener("mousedown",n),document.addEventListener("touchstart",n)),t&&t.focusEvents===!1||document.addEventListener("focus",n),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n),document.removeEventListener("focus",n)}},[i])},exports.useSynchronizedPointerHandler=ht,exports.useTraceUpdate=function(i,e=!0){const t=l.useRef(i);l.useEffect(()=>{if(e){const o=Object.entries(i).reduce((n,[r,s])=>(t.current[r]!==s&&(n[r]=[t.current[r],s]),n),{});Object.keys(o).length>0&&console.log("Changed props:",o)}t.current=i})},exports.useUndoManager=({manager:i,commands:e,disabled:t,notifier:o=Ae})=>{const n=L(s=>{try{i?.undo(s)}catch(a){o.showError?.(a)}},[i]),r=L(s=>{try{i?.redo(s)}catch(a){o.showError?.(a)}},[i]);return l.useMemo(()=>{if(!e)return;const s={contains:c=>!0,focus(){}},a=[new De("undo",s,{label:"Undo",description:ft,shortcut:{key:"z",modifiers:[W.Ctrl]},disabled:!0},n),new De("redo",s,{label:"Redo",description:mt,shortcut:[{key:"y",modifiers:[W.Ctrl]},{key:"F4"},{key:"Enter",modifiers:[W.Alt]}],disabled:!0},r)];e?.addCommands(a,!0)},[e]),l.useEffect(()=>{if(!e)return;const s=()=>{const c=i?.getTopUndoDescription(),u={};var h;e.getCommand("undo").update({disabled:t||!i||!i.hasUndo(),description:c?(h=c,`Undo ${h}`):ft,state:u,context:{undoManager:i}});const d=i?.getTopRedoDescription();e.getCommand("redo").update({disabled:t||!i||!i.hasRedo(),description:d?jo(d):mt,state:u,context:{undoManager:i}})};if(s(),!i)return;const a=i.addListener({onStackChange(){s()}});return()=>a?.()},[i,e,t]),{undo:n,redo:r}};
12
+ */
13
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("react"),o=require("@sheetxl/utils"),n=require("react-dom/client"),i=require("react-dom"),r={Shift:"shift",Alt:"alt",Ctrl:"ctrl",Meta:"meta"},s={Horizontal:"horizontal",Vertical:"vertical"};function l(e){var t,o,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(o=l(e[t]))&&(n&&(n+=" "),n+=o)}else for(o in e)e[o]&&(n&&(n+=" "),n+=o);return n}function a(){for(var e,t,o=0,n="",i=arguments.length;o<i;o++)(e=arguments[o])&&(t=l(e))&&(n&&(n+=" "),n+=t);return n}var c=function(){},u="undefined"!=typeof window,h=u?t.useLayoutEffect:t.useEffect,d={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};const p=u&&void 0!==window.ResizeObserver?function(){var e=t.useState(null),o=e[0],n=e[1],i=t.useState(d),r=i[0],s=i[1],l=t.useMemo(function(){return new window.ResizeObserver(function(e){if(e[0]){var t=e[0].contentRect,o=t.x,n=t.y,i=t.width,r=t.height,l=t.top,a=t.left,c=t.bottom,u=t.right;s({x:o,y:n,width:i,height:r,top:l,left:a,bottom:c,right:u})}})},[]);return h(function(){if(o)return l.observe(o),function(){l.disconnect()}},[o]),[n,r]}:function(){return[c,d]},f=(e,o)=>{const n=t.useCallback((...t)=>e?.(...t),o),i=t.useRef(null);i.current=n;const r=t.useCallback((...e)=>i.current?.(...e),[]);if(i.current)return r},_=t=>{const{style:o,orientation:n=s.Vertical,...i}=t,r=n===s.Vertical,l=r?"m 3.7274761,0.68060577 1.11969,1.93863003 1.12075,1.93912 c 0.0895,0.155 0.12152,0.33658 0.0904,0.51283 -0.0311,0.17625 -0.12336,0.33591 -0.26054,0.45091 -0.13715,0.11495 -0.31044,0.17793 -0.4894,0.17781 H 0.83095614 c -0.20186,0 -0.39542,-0.0802 -0.53814,-0.2229 -0.14272,-0.14272 -0.22291,-0.33629 -0.22291,-0.53814 -3e-4,-0.13308 0.0347,-0.26385 0.10147,-0.379 l 1.11872996,-1.94066 1.11921,-1.93864003 c 0.13594,-0.23541 0.38717,-0.38047 0.65905,-0.38047 0.27188,0 0.52311,0.14506 0.65905,0.38047 z":"m 0.75051,2.3424298 1.93863,-1.11969 1.93912,-1.12075 c 0.155,-0.0895 0.33658,-0.12152 0.51283,-0.0904 0.17625,0.0311 0.33591,0.12336 0.45091,0.26054 0.11495,0.13715 0.17793,0.31044 0.17781,0.4894 v 4.47742 c 0,0.20186 -0.0802,0.39542 -0.2229,0.53814 -0.14272,0.14272 -0.33629,0.22291 -0.53814,0.22291 -0.13308,3e-4 -0.26385,-0.0347 -0.379,-0.10147 L 2.68911,4.7797998 0.75047,3.6605898 C 0.51506,3.5246498 0.37,3.2734198 0.37,3.0015398 c 0,-0.27188 0.14506,-0.52311 0.38047,-0.65905 z";return e.jsx("div",{style:{paddingBottom:"0px",paddingRight:"0px",paddingLeft:r?"0px":"3px",paddingTop:r?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...o},...i,children:e.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${r?"vertical":"horizontal"} single-button start`,children:e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:e.jsx("path",{d:l})})})})},m=t=>{const{style:o,orientation:n=s.Vertical,...i}=t,r=n===s.Vertical,l=r?"M 2.412334,5.319396 1.292644,3.3807659 0.17189405,1.4416459 c -0.0895,-0.155 -0.12152,-0.33658 -0.0904,-0.51282998 0.0311,-0.17625 0.12336,-0.33591 0.26054,-0.45091 0.13715,-0.11495 0.31044,-0.17793 0.4894,-0.17781 H 5.308854 c 0.20186,0 0.39542,0.0802 0.53814,0.2229 0.14272,0.14272 0.22291,0.33629 0.22291,0.53813998 3e-4,0.13308 -0.0347,0.26385 -0.10147,0.379 l -1.11873,1.94066 -1.11921,1.9386401 c -0.13594,0.23541 -0.38717,0.38047 -0.65905,0.38047 -0.27188,0 -0.52311,-0.14506 -0.65905,-0.38047 z":"m 5.3893002,3.6575719 -1.9386301,1.11969 -1.93912,1.12075 c -0.155,0.0895 -0.33658,0.12152 -0.51282997,0.0904 -0.17625,-0.0311 -0.33591,-0.12336 -0.45091,-0.26054 -0.11495,-0.13715 -0.17793,-0.31044 -0.17781,-0.4894 V 0.76105195 c 0,-0.20186 0.0802,-0.39542 0.2229,-0.53814 C 0.73562013,0.08019195 0.92919013,1.9467784e-6 1.1310401,1.9467784e-6 1.2641201,-2.9805322e-4 1.3948901,0.03470195 1.5100401,0.10147195 l 1.94066,1.11872995 1.9386401,1.11921 c 0.23541,0.13594 0.38047,0.38717 0.38047,0.65905 0,0.27188 -0.14506,0.52311 -0.38047,0.65905 z";return e.jsx("div",{style:{paddingLeft:"0px",paddingTop:"0px",paddingRight:r?"0px":"3px",paddingBottom:r?"3px":"0px",display:"flex",alignItems:"center",justifyContent:"center",...o},...i,children:e.jsx("button",{style:{padding:"0",display:"flex",alignItems:"center",justifyContent:"center",border:"none"},className:`scrollbar-button ${r?"vertical":"horizontal"} single-button end`,children:e.jsx("svg",{width:"9",height:"9",viewBox:"0 0 6 6",style:{opacity:"inherit"},children:e.jsx("path",{d:l})})})})},g=(e,t,o,n,i=0)=>{for(let i=0;i<o.length;i++){const r=o[i].getBoundingClientRect();let s=r.left-t,l=s+r.width;if(n){if(s<e&&l>=e)return s}else if(Math.ceil(l)>Math.ceil(e)+2)return l}return i},y=Object.freeze(Object.defineProperty({__proto__:null,getScrollTo:g},Symbol.toStringTag,{value:"Module"})),x="_sheetxl-scrollbar_eblx4_6",v=t.memo(t.forwardRef((o,n)=>{const{offset:i=0,totalSize:r=0,viewportSize:l=0,style:c,className:u,orientation:h=s.Vertical,onScrollOffset:d,onScroll:y,showCustomScrollButtons:v=!1,scrollButtonIncrement:b=200,scrollButtonInitialRepeatDelay:w=260,scrollButtonAdditionalRepeatDelay:S=120,createScrollStartButton:C=_,createScrollEndButton:E=m,...L}=o,M=f(y,[y]),T=t.useRef(null),[D,{width:P,height:k}]=p(),[z,{width:R,height:A}]=p(),B=h===s.Vertical,j=B?"top":"left",$=B?"scrollTop":"scrollLeft",O=B?k:P,K=B?A:R,[H,V]=t.useState(null);t.useEffect(()=>{null!==H&&T.current&&T.current.scrollTo({behavior:"smooth",[j]:H})},[H,B]);const F=t.useCallback((e,t=!1)=>{if(!T.current)return 0;const o=T.current.querySelector(".scrollbar-viewport"),n=o.getBoundingClientRect(),i=o.children,r=t?0:g(e,n[j],i,!0,Math.max(0,e-b));return V(r),Math.max(0,r)},[]),I=t.useCallback((e,t=!1)=>{if(!T.current)return 0;const o=T.current.querySelector(".scrollbar-viewport"),n=o.getBoundingClientRect(),i=o.children,r=Math.ceil(K-O),s=t?r:g(e,n[j],i,!1,Math.max(0,e+b));return V(s),Math.min(r,s)},[K,O]),N=t.useRef(null),W=t.useCallback(e=>{N.current=i;const t=e.target[$];d(t,l,r),M?.(e)},[d,l,r,i]);t.useEffect(()=>{const e=N.current;N.current=null,i!==e&&(T.current[$]=i)},[i,$]);const U=t.useRef(null),Y=t.useRef(null),X=t.useCallback(()=>{U.current&&(clearTimeout(U.current),U.current=null,Y.current=null)},[]),q=t.useCallback((e,t,o,n=w)=>{Y.current=e,U.current=setTimeout(()=>{const t=o?F(Y.current||e):I(Y.current||e);t!==Y.current?q(t,!1,o,S):X()},t?0:n)},[F,I,X]);t.useEffect(()=>()=>X(),[X]);const Z=i,G=t.useMemo(()=>{if(!v)return null;const e={orientation:h,disabled:Math.floor(Z)<=0||0===Math.floor(K-O),onMouseUp:X,onMouseLeave:X,onMouseDown:()=>q(Z,!0,!0)};return C?.(e)},[v,h,Z,H,K,O]),J=t.useMemo(()=>{if(!v)return null;const e={orientation:h,disabled:Math.floor(K-O)<=Math.ceil(Z),onMouseUp:X,onMouseLeave:X,onMouseDown:()=>q(Z,!0,!1)};return E?.(e)},[v,h,Z,H,K,O]);return e.jsxs("div",{ref:n,style:{display:"flex",flex:"1",flexDirection:B?"column":"row",padding:"0",...c},className:a(x,u),...L,children:[G,e.jsx("div",{className:"pseudo-scrollbar",style:{flex:"1 1 100%",display:"flex",boxSizing:"content-box",flexDirection:B?"column":"row",justifyContent:"center",alignItems:"center"},ref:D,children:e.jsx("div",{tabIndex:-1,style:{flex:"1 1 100%",overflowY:B?"scroll":"hidden",overflowX:B?"hidden":"scroll",position:"relative",willChange:"transform"},onScroll:W,ref:T,children:e.jsx("div",{ref:z,style:{position:"absolute",height:B?r-l+(k??0):1,width:B?1:r-l+(P??0)},className:"scrollbar-viewport"})})}),J]})}));v.displayName="Scrollbar";let b=Date.now,w=1e3,S={},C=1;const E=e=>{let t=null!==S[e];return t&&(S[e]=null),t},L=(e,t,o,n=0,i)=>{let r=b(),s=r,l=0,a=0,c=0,u=C++;if(u%20==0){const e={};for(let t in S)e[t]=!0;S=e}const h=function(d){let p=!0!==d,f=b(),_=!0;try{_=(!t||t(u))??!0}catch(e){_=!1}if(!S[u]||!_)return S[u]=null,void o?.(60-a/((f-r)/w),u,!1);if(p){c=Math.round((f-s)/16.666666666666668)-1;for(let e=0;e<Math.min(c,4);e++)h(!0),a++}n&&(l=(f-r)/n,l>1&&(l=1));let m=i?i(l):l,g=!1;try{g=e(m,f,p)}catch(e){g=!1}!1!==g&&1!==l||!p?p&&(s=f,requestAnimationFrame(h)):(S[u]=null,o?.(60-a/((f-r)/w),u,1===l||null==n))};return S[u]=!0,requestAnimationFrame(h),u},M=function(e){return Math.pow(e-1,3)+1},T=function(e){return(e/=.5)<1?.5*Math.pow(e,3):.5*(Math.pow(e-2,3)+2)};class D{constructor(e,t){this.__isSingleTouch=!1,this.__isTracking=!1,this.__didDecelerationComplete=!1,this.__isGesturing=!1,this.__isDragging=!1,this.__isDecelerating=0,this.__isAnimating=0,this.__interruptedAnimation=!1,this.__lastScale=1,this.__enableScrollX=!0,this.__enableScrollY=!0,this.__clientLeft=0,this.__clientTop=0,this.__clientWidth=0,this.__clientHeight=0,this.__contentWidth=0,this.__contentHeight=0,this.__snapWidth=100,this.__snapHeight=100,this.__zoomLevel=1,this.__scrollLeft=0,this.__scrollTop=0,this.__maxScrollLeft=0,this.__maxScrollTop=0,this.__scheduledLeft=0,this.__scheduledTop=0,this.__scheduledZoom=0,this.__lastTouchLeft=0,this.__lastTouchTop=0,this.__lastTouchMove=0,this.__positions=[],this.__initialTouchLeft=0,this.__initialTouchTop=0,this.__zoomLevelStart=1,this.__minDecelerationScrollLeft=null,this.__minDecelerationScrollTop=null,this.__maxDecelerationScrollLeft=null,this.__maxDecelerationScrollTop=null,this.__decelerationVelocityX=null,this.__decelerationVelocityY=0,this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:void 0,penetrationDeceleration:.03,penetrationAcceleration:.08,...t}}setDimensions(e,t,o,n){null!==e&&(this.__clientWidth=e),null!==t&&(this.__clientHeight=t),null!==o&&(this.__contentWidth=o),null!==n&&(this.__contentHeight=n),this.__computeScrollMax(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0)}setPosition(e,t){this.__clientLeft=e||0,this.__clientTop=t||0}setSnapSize(e,t){this.__snapWidth=e,this.__snapHeight=t}getValues(){return{left:this.__scrollLeft,top:this.__scrollTop,right:this.__scrollLeft+this.__clientWidth/this.__zoomLevel,bottom:this.__scrollTop+this.__clientHeight/this.__zoomLevel,zoom:this.__zoomLevel}}getPoint(e,t){const o=this.getValues();return{left:e/o.zoom,top:t/o.zoom}}getScrollMax(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}}zoomTo(e,t=!1,o,n,i){if(!this.options.zooming)throw new Error("Zooming is not enabled!");i&&(this.__zoomComplete=i),this.__isDecelerating&&(E(this.__isDecelerating),this.__isDecelerating=0);const r=this.__zoomLevel;void 0===o&&(o=this.__clientWidth/2),void 0===n&&(n=this.__clientHeight/2),e=Math.max(Math.min(e,this.options.maxZoom),this.options.minZoom),this.__computeScrollMax(e);const s=e/r;let l=s*(this.__scrollLeft+o)-o,a=s*(this.__scrollTop+n)-n;l>this.__maxScrollLeft?l=this.__maxScrollLeft:l<0&&(l=0),a>this.__maxScrollTop?a=this.__maxScrollTop:a<0&&(a=0),this.__publish(l,a,e,t)}zoomBy(e,t=!1,o=0,n=0,i){this.zoomTo(this.__zoomLevel*e,t,o,n,i)}scrollTo(e,t,o=!1,n=1){if(this.__isDecelerating&&(E(this.__isDecelerating),this.__isDecelerating=0),void 0!==n&&n!==this.__zoomLevel){if(!this.options.zooming)throw new Error("Zooming is not enabled!");e*=n,t*=n,this.__computeScrollMax(n)}else n=this.__zoomLevel;this.options.scrollingX?this.options.paging?e=Math.round(e/this.__clientWidth)*this.__clientWidth:this.options.snapping&&(e=Math.round(e/this.__snapWidth)*this.__snapWidth):e=this.__scrollLeft,this.options.scrollingY?this.options.paging?t=Math.round(t/this.__clientHeight)*this.__clientHeight:this.options.snapping&&(t=Math.round(t/this.__snapHeight)*this.__snapHeight):t=this.__scrollTop,e=Math.max(Math.min(this.__maxScrollLeft,e),0),t=Math.max(Math.min(this.__maxScrollTop,t),0),e===this.__scrollLeft&&t===this.__scrollTop&&(o=!1),this.__publish(e,t,n,o)}scrollBy(e=0,t=0,o=!1){const n=this.__isAnimating?this.__scheduledLeft:this.__scrollLeft,i=this.__isAnimating?this.__scheduledTop:this.__scrollTop;this.scrollTo(n+(e||0),i+(t||0),o)}doMouseZoom(e,t,o,n){const i=e>0?.97:1.03;return this.zoomTo(this.__zoomLevel*i,!1,o-this.__clientLeft,n-this.__clientTop)}doTouchStart(e,t){if(void 0===e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);let o,n;this.__interruptedAnimation=!0,this.__isDecelerating&&(E(this.__isDecelerating),this.__isDecelerating=0,this.__interruptedAnimation=!0),this.__isAnimating&&(E(this.__isAnimating),this.__isAnimating=0,this.__interruptedAnimation=!0);let i=1===e.length;i?(o=e[0].pageX,n=e[0].pageY):(o=Math.abs(e[0].pageX+e[1].pageX)/2,n=Math.abs(e[0].pageY+e[1].pageY)/2),this.__initialTouchLeft=o,this.__initialTouchTop=n,this.__zoomLevelStart=this.__zoomLevel,this.__lastTouchLeft=o,this.__lastTouchTop=n,this.__lastTouchMove=t,this.__lastScale=1,this.__enableScrollX=!i&&this.options.scrollingX,this.__enableScrollY=!i&&this.options.scrollingY,this.__isTracking=!0,this.__didDecelerationComplete=!1,this.__isDragging=!i,this.__isSingleTouch=i,this.__positions=[]}doTouchMove(e,t,o=1){if(void 0===e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);if(!this.__isTracking)return;let n,i;2===e.length?(n=Math.abs(e[0].pageX+e[1].pageX)/2,i=Math.abs(e[0].pageY+e[1].pageY)/2):(n=e[0].pageX,i=e[0].pageY);let r=this.__positions;if(this.__isDragging){let e=n-this.__lastTouchLeft,s=i-this.__lastTouchTop,l=this.__scrollLeft,a=this.__scrollTop,c=this.__zoomLevel;if(void 0!==o&&this.options.zooming){let e=c;if(c=c/this.__lastScale*o,c=Math.max(Math.min(c,this.options.maxZoom),this.options.minZoom),e!==c){let t=n-this.__clientLeft,o=i-this.__clientTop;l=(t+l)*c/e-t,a=(o+a)*c/e-o,this.__computeScrollMax(c)}}if(this.__enableScrollX){l-=e*this.options.speedMultiplier;let t=this.__maxScrollLeft;(l>t||l<0)&&(this.options.bouncing?l+=e/2*this.options.speedMultiplier:l=l>t?t:0)}if(this.__enableScrollY){a-=s*this.options.speedMultiplier;const e=this.__maxScrollTop;(a>e||a<0)&&(this.options.bouncing?a+=s/2*this.options.speedMultiplier:a=a>e?e:0)}r.length>60&&r.splice(0,30),r.push(l,a,t),this.__publish(l,a,c)}else{let e=this.options.locking?3:0,o=5,s=Math.abs(n-this.__initialTouchLeft),l=Math.abs(i-this.__initialTouchTop);this.__enableScrollX=this.options.scrollingX&&s>=e,this.__enableScrollY=this.options.scrollingY&&l>=e,r.push(this.__scrollLeft,this.__scrollTop,t),this.__isDragging=(this.__enableScrollX||this.__enableScrollY)&&(s>=o||l>=o),this.__isDragging&&(this.__interruptedAnimation=!1)}this.__lastTouchLeft=n,this.__lastTouchTop=i,this.__lastTouchMove=t,this.__lastScale=o}doTouchEnd(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);if(this.__isTracking){if(this.__isTracking=!1,this.__isDragging)if(this.__isDragging=!1,this.__isSingleTouch&&this.options.animating&&e-this.__lastTouchMove<=100){let t=this.__positions,o=t.length-1,n=o;for(let e=o;e>0&&t[e]>this.__lastTouchMove-100;e-=3)n=e;if(n!==o){const i=t[o]-t[n],r=this.__scrollLeft-t[n-2],s=this.__scrollTop-t[n-1];this.__decelerationVelocityX=r/i*(1e3/60),this.__decelerationVelocityY=s/i*(1e3/60);const l=this.options.paging||this.options.snapping?4:1;(Math.abs(this.__decelerationVelocityX)>l||Math.abs(this.__decelerationVelocityY)>l)&&this.__startDeceleration(e)}else this.options.scrollingComplete?.()}else e-this.__lastTouchMove>100&&this.options.scrollingComplete?.();this.__isDecelerating||((this.__interruptedAnimation||this.__isDragging)&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,!0,this.__zoomLevel)),this.__positions.length=0}}__publish(e,t,o,n=!1){const i=this.__isAnimating;if(i&&(E(i),this.__isAnimating=0),n&&this.options.animating){this.__scheduledLeft=e,this.__scheduledTop=t,this.__scheduledZoom=o;const n=this.__scrollLeft,r=this.__scrollTop,s=this.__zoomLevel,l=e-n,a=t-r,c=o-s,u=function(e,t,o){o&&(this.__scrollLeft=n+l*e,this.__scrollTop=r+a*e,this.__zoomLevel=s+c*e,this.__callback&&this.__callback(this.__scrollLeft,this.__scrollTop,this.__zoomLevel))}.bind(this),h=function(e){return this.__isAnimating===e}.bind(this),d=function(e,t,o){t===this.__isAnimating&&(this.__isAnimating=!1),(this.__didDecelerationComplete||o)&&this.options.scrollingComplete?.(),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}.bind(this);this.__isAnimating=L(u,h,d,this.options.animationDuration,i?M:T)}else this.__scheduledLeft=this.__scrollLeft=e,this.__scheduledTop=this.__scrollTop=t,this.__scheduledZoom=this.__zoomLevel=o,this.__callback&&this.__callback(e,t,o),this.options.zooming&&(this.__computeScrollMax(),this.__zoomComplete&&(this.__zoomComplete(),this.__zoomComplete=null))}__computeScrollMax(e=this.__zoomLevel){this.__maxScrollLeft=Math.max(this.__contentWidth*e-this.__clientWidth,0),this.__maxScrollTop=Math.max(this.__contentHeight*e-this.__clientHeight,0)}__startDeceleration(e){if(this.options.paging){const e=Math.max(Math.min(this.__scrollLeft,this.__maxScrollLeft),0),t=Math.max(Math.min(this.__scrollTop,this.__maxScrollTop),0),o=this.__clientWidth,n=this.__clientHeight;this.__minDecelerationScrollLeft=Math.floor(e/o)*o,this.__minDecelerationScrollTop=Math.floor(t/n)*n,this.__maxDecelerationScrollLeft=Math.ceil(e/o)*o,this.__maxDecelerationScrollTop=Math.ceil(t/n)*n}else this.__minDecelerationScrollLeft=0,this.__minDecelerationScrollTop=0,this.__maxDecelerationScrollLeft=this.__maxScrollLeft,this.__maxDecelerationScrollTop=this.__maxScrollTop;const t=function(e,t,o){this.__stepThroughDeceleration(o)}.bind(this),o=this.options.snapping?4:.1,n=function(){const e=Math.abs(this.__decelerationVelocityX)>=o||Math.abs(this.__decelerationVelocityY)>=o;return e||(this.__didDecelerationComplete=!0),e}.bind(this),i=function(e,t,o){this.__isDecelerating=0,this.__didDecelerationComplete&&this.options.scrollingComplete?.(),this.scrollTo(this.__scrollLeft,this.__scrollTop,this.options.snapping)}.bind(this);this.__isDecelerating=L(t,n,i)}__stepThroughDeceleration(e){let t=this.__scrollLeft+this.__decelerationVelocityX,o=this.__scrollTop+this.__decelerationVelocityY;if(!this.options.bouncing){const e=Math.max(Math.min(this.__maxDecelerationScrollLeft,t),this.__minDecelerationScrollLeft);e!==t&&(t=e,this.__decelerationVelocityX=0);const n=Math.max(Math.min(this.__maxDecelerationScrollTop,o),this.__minDecelerationScrollTop);n!==o&&(o=n,this.__decelerationVelocityY=0)}if(e?this.__publish(t,o,this.__zoomLevel):(this.__scrollLeft=t,this.__scrollTop=o),!this.options.paging){const e=.95;this.__decelerationVelocityX*=e,this.__decelerationVelocityY*=e}if(this.options.bouncing){let e=0,n=0,i=this.options.penetrationDeceleration,r=this.options.penetrationAcceleration;t<this.__minDecelerationScrollLeft?e=this.__minDecelerationScrollLeft-t:t>this.__maxDecelerationScrollLeft&&(e=this.__maxDecelerationScrollLeft-t),o<this.__minDecelerationScrollTop?n=this.__minDecelerationScrollTop-o:o>this.__maxDecelerationScrollTop&&(n=this.__maxDecelerationScrollTop-o),0!==e&&(e*this.__decelerationVelocityX<=0?this.__decelerationVelocityX+=e*i:this.__decelerationVelocityX=e*r),0!==n&&(n*this.__decelerationVelocityY<=0?this.__decelerationVelocityY+=n*i:this.__decelerationVelocityY=n*r)}}}var P="undefined"!=typeof window?window:{screen:{},navigator:{}},k=(P.matchMedia||function(){return{matches:!1}}).bind(P),z=!1,R={get passive(){return z=!0}},A=function(){};P.addEventListener&&P.addEventListener("p",A,R),P.removeEventListener&&P.removeEventListener("p",A,!1);var B=z,j="PointerEvent"in P,$="ontouchstart"in P,O=$||"TouchEvent"in P&&k("(any-pointer: coarse)").matches,K=(P.navigator.maxTouchPoints||0)>0||O,H=P.navigator.userAgent||"",V=k("(pointer: coarse)").matches&&/iPad|Macintosh/.test(H)&&Math.min(P.screen.width||0,P.screen.height||0)>=768,F=(k("(pointer: coarse)").matches||!k("(pointer: fine)").matches&&$)&&!/Windows.*Firefox/.test(H),I=k("(any-pointer: fine)").matches||k("(any-hover: hover)").matches||V||!$,N=!K||!I&&F?K?"touchOnly":"mouseOnly":"hybrid",W="mouseOnly"===N?"mouse":"touchOnly"===N||F?"touch":"mouse";const U=Object.freeze(Object.defineProperty({__proto__:null,deviceType:N,primaryInput:W,supportsPassiveEvents:B,supportsPointerEvents:j,supportsTouchEvents:O},Symbol.toStringTag,{value:"Module"})),Y=new Set(["INPUT","TEXTAREA","SELECT"]),X={};function q(){return U}const Z=e=>"BracketLeft"===e?"[":"BracketRight"===e?"]":o.CommonUtils.camelToPrettyCase(e),G=Object.freeze(Object.defineProperty({__proto__:null,EmptyCssProperties:X,boundPixel:function(e,t=!1,o=0){return e},createSyntheticEvent:e=>{let t=!1,o=!1;return{nativeEvent:e,currentTarget:e.currentTarget,target:e.target,bubbles:e.bubbles,cancelable:e.cancelable,defaultPrevented:e.defaultPrevented,eventPhase:e.eventPhase,isTrusted:e.isTrusted,preventDefault:()=>{t=!0,e.preventDefault()},isDefaultPrevented:()=>t,stopPropagation:()=>{o=!0,e.stopPropagation()},isPropagationStopped:()=>o,persist:()=>{},timeStamp:e.timeStamp,type:e.type}},detectIt:q,focusableNodeNames:Y,toPrettyKeyCode:Z},Symbol.toStringTag,{value:"Module"})),J=[];function Q(e,o,n=J){const i=t.useRef(null);return t.useImperativeHandle(e,()=>{if(!i.current)return;const e=i.current,t=o?.();if(!t||"object"!=typeof t)throw new Error("attributes must return a plain object of values");const n=Object.keys(t),r=n.length;for(let o=0;o<r;o++){const i=n[o],r=t[i];Object.defineProperty(e,i,{value:r,writable:!0,configurable:!0,enumerable:!0})}return e},n),i}const ee=t=>e.jsx(v,{...t}),te=({width:t,height:o})=>e.jsx("div",{className:"corner",style:{minWidth:`${t}px`,width:`${t}px`,minHeight:`${o}px`,height:`${o}px`}}),oe=t.memo(t.forwardRef((o,n)=>{const{children:i,viewport:r,onScrollViewport:l,showHorizontalScrollbar:a=!0,showVerticalScrollbar:c=!0,createScrollCorner:u=te,createHorizontalScrollbar:h=ee,createVerticalScrollbar:d=ee,style:_,touchElement:m,disableTouch:g,...y}=o,x=f(l,[l]),v=Q(n,()=>({isScrollPane:()=>!0}),[]),b=t.useRef(null);t.useEffect(()=>{b.current&&(b.current.__scrollTop===r?.top&&b.current.__scrollLeft===r?.left||b.current.__isDecelerating||b.current?.scrollTo(r?.left,r?.top,!1))},[r?.left,r?.top,m]);const w=t.useCallback((e,t)=>{x?.({left:e,top:t})},[]),S=t.useCallback(e=>{b.current?.doTouchStart(e.touches,e.timeStamp)},[]),C=t.useCallback(e=>{e.preventDefault(),b.current?.doTouchMove(e.touches,e.timeStamp)},[]),E=t.useCallback(e=>{b.current?.doTouchEnd(e.timeStamp)},[]),L=t.useCallback(({containerWidth:e,containerHeight:t,totalWidth:o,totalHeight:n})=>{b.current.setDimensions(e,t,o,n)},[]);t.useEffect(()=>{const e=m??v.current;if(!g&&q().supportsTouchEvents&&e&&r){if(!b.current){const e={scrollingX:!0,scrollingY:!0,decelerationRate:.95,penetrationAcceleration:.08};b.current=new D(w,e)}q().supportsTouchEvents&&(e.addEventListener("touchstart",S),e.addEventListener("touchend",E),e.addEventListener("touchmove",C)),L({containerWidth:r?.width,containerHeight:r?.height,totalWidth:r?.totalWidth,totalHeight:r?.totalHeight})}return()=>{e?.removeEventListener("touchstart",S),e?.removeEventListener("touchend",E),e?.removeEventListener("touchmove",C)}},[r?.width,r?.height,r?.totalWidth,r?.totalHeight,g,m]);const[M,{width:T}]=p(),[P,{height:k}]=p(),z=t.useMemo(()=>{const t=d({orientation:s.Vertical,offset:r?.top,viewportSize:r?.height,totalSize:r?.totalHeight,onScrollOffset:e=>{x?.({top:e})}});return e.jsx("div",{style:{display:"flex",flex:"0"},ref:M,children:t})},[d,r?.top,r?.height,r?.totalHeight]),R=t.useMemo(()=>{const t=h({orientation:s.Horizontal,offset:r?.left,viewportSize:r?.width,totalSize:r?.totalWidth,onScrollOffset:e=>x?.({left:e})});return e.jsxs("div",{style:{display:"flex",flex:"none",flexDirection:"row",alignItems:"stretch",justifyContent:"center"},children:[e.jsx("div",{style:{display:"flex",flex:"1 1 100%",flexDirection:"column",width:`calc(100% - ${T}px)`},children:e.jsx("div",{ref:P,className:"sizer",children:t})}),c?u({width:T,height:k}):e.jsx(e.Fragment,{})]})},[h,r?.left,r?.width,r?.totalWidth,c,u,T,k]);return e.jsx("div",{style:{position:"relative",display:"flex",minWidth:c?`${T}px`:void 0,minHeight:a?`${k}px`:void 0,..._},...y,ref:v,children:e.jsxs("div",{style:{position:"relative",width:"100%",flex:"1 1 100%",display:"flex",flexDirection:"column",boxSizing:"border-box"},children:[e.jsxs("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:[e.jsx("div",{style:{display:"flex",flex:"1 1 100%",overflow:"hidden"},children:i}),c?z:e.jsx(e.Fragment,{})]}),a?R:e.jsx(e.Fragment,{})]})})}));oe.displayName="ScrollPane";const ne={Default:"default",Error:"error",Success:"success",Warning:"warning",Info:"info"},ie=new Set,re={showMessage:(e,t)=>{if(t?.onceKey){if(ie.has(t.onceKey))return;ie.add(t.onceKey)}let o=console.log;t?.type!==ne.Warning&&t?.type!==ne.Error||(o=console.warn),o(e)},showBusy:(e,t)=>new Promise(e=>{e(()=>{})}),showError:e=>{console.error(e)}},se=()=>{const e=document.fullscreenElement;return e?e.querySelector(".fullscreen-portal-root")||e:document.body};let le=0;const ae=100,ce=100,ue=1e6,he=100,de=50,pe=t.memo(t.forwardRef((o,n)=>{const{offset:i=0,viewportSize:r=0,totalSize:s=0,minSize:l=0,endGap:a=ae,endScrollIncrement:c=ce,style:u=X,onMouseDown:h,onScrollOffset:d,onScroll:p,scaleLimit:_=ue,scaleFactor:m=he,precisionFactor:g=de,...y}=o;p&&console.warn("onScroll not supported for VirtualScrollbar. Use onScrollOffset instead");const x=f(h,[h]),b=()=>({offset:i,totalSize:0===_?s:Math.min(s??0,Math.max(l??0,(i??0)+(r??0))+(a??0))}),[w,S]=t.useState(b),C=0!==_&&w.totalSize>_?m:1,E=C/g,L=Math.ceil(w.totalSize/C),M=Math.ceil(w.offset/C),T=Math.ceil(r/C),D=t.useCallback(e=>{},[]),[P,k]=t.useState(!1),z=t.useRef(null);t.useLayoutEffect(()=>{if(!P){z.current={propTotalSize:s,propViewportSize:r,propOffset:i};const e=b();S(e)}},[s,r,i,P,l,a,c]);const R=f((e,t,o)=>{const n=z.current;z.current=null,n&&n.propTotalSize===s&&n.propViewportSize===r&&n.propOffset===i||(Math.abs(e-M)<E&&(e=M),d?.(e*C,M,T))},[d,C,E,M,T]),A=t.useCallback(e=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",A),k(!1)},[]),B=t.useCallback(e=>{x?.(e),k(!0),document.addEventListener("mousemove",D,{passive:!0}),document.addEventListener("mouseup",A,{passive:!0})},[D,A]);return e.jsx(v,{ref:n,style:{...u},...y,offset:M,totalSize:L,viewportSize:T,onMouseDown:B,onScrollOffset:R})}));pe.displayName="VirtualScrollbar";function fe(e,t){if("function"==typeof e)return e(t);e&&(e.current=t)}var _e=parseInt(t.version.split(".")[0],10)>=19?function(e){return t=>{const o=[];for(const n of e){const e=fe(n,t),i="function"==typeof e;o.push(i?e:()=>fe(n,null))}return()=>{for(const e of o)e()}}}:function(e){return t=>{for(const o of e)fe(o,t)}};const me=t.memo(t.forwardRef((o,n)=>{const{refFocusStart:i,...r}=o,s=t.useRef(null),l=t.useCallback(()=>{if(i)return void i?.current?.focus();const e=s.current.parentElement.children;let t=[];for(let o=0;o<e.length&&e[o]!==s.current;o++){const n=e[o].getAttribute("tabindex");if(null==n||"-1"===n)continue;if("true"===e[o].getAttribute("disabled"))continue;const i=e[o];i.focus&&t.push({tabindex:parseInt(n),child:i})}0!==t.length&&(t.sort(function(e,t){return e.tabindex-t.tabindex}),t[0].child.focus())},[i]);return e.jsx("div",{tabIndex:0,ref:_e([s,n]),onFocus:l,...r})}));const ge=t.memo(t.forwardRef((o,n)=>{const{className:i,style:r,children:s,radius:l=4,strokeWidth:a=1,strokeColor:c="grey",...u}=o,[h,{width:d,height:f}]=p(),_=t.useRef(null),m=(e,t=0)=>{const o=e/2,n=f-o+t;return function(e,t,o=!1){if(0===t)return e;function n(e,t,o){let n=t.x-e.x,r=t.y-e.y,s=Math.sqrt(n*n+r*r);return i(e,t,Math.min(1,o/s))}function i(e,t,o){return{x:e.x+(t.x-e.x)*o,y:e.y+(t.y-e.y)*o}}function r(e,t){e.length>2&&(e[e.length-2]=t.x,e[e.length-1]=t.y)}function s(e){return{x:parseFloat(e[e.length-2]),y:parseFloat(e[e.length-1])}}let l=e.split(/[,\s]/).reduce(function(e,t){let o=t.match("([a-zA-Z])(.+)");return o?(e.push(o[1]),e.push(o[2])):e.push(t),e},[]).reduce(function(e,t){return parseFloat(t)==t&&e.length?e[e.length-1].push(t):e.push([t]),e},[]),a=[];if(l.length>1){let e=s(l[0]),c=null;"Z"===l[l.length-1][0]&&l[0].length>2&&(c=["L",e.x,e.y],l[l.length-1]=c),a.push(l[0]);for(let e=1;e<l.length;e++){let u=a[a.length-1],h=l[e],d=h===c?l[1]:l[e+1];if(d&&u&&u.length>2&&"L"===h[0]&&d.length>2&&"L"===d[0]){let e,l,c=s(u),p=s(h),f=s(d);o?(e=i(p,u.origPoint||c,t),l=i(p,d.origPoint||f,t)):(e=n(p,c,t),l=n(p,f,t)),r(h,e),h.origPoint=p,a.push(h);let _=i(e,p,.5),m=i(p,l,.5),g=["C",_.x,_.y,m.x,m.y,l.x,l.y];g.origPoint=p,a.push(g)}else a.push(h)}if(c){let e=s(a[a.length-1]);a.push(["Z"]),r(a[0],e)}}else a=l;return a.reduce(function(e,t){return e+t.join(" ")+" "},"")}(`${`M 0 ${o} L ${l-.5} ${o} L ${l-.5} ${n} L ${2*l} ${n}`} ${`L ${d-2*l} ${n}`} ${`M ${d-2*l} ${n} L ${d-l} ${n} L ${d-l} ${o} L ${d} ${o}`}`,l)},g=t.useMemo(()=>m(a),[d,f,l,a]),y=t.useMemo(()=>{if(0===l)return;const e=l/2;return m(l)+`L ${d} 0 L 0 0 L 0 ${e}`},[g,l,a]),x=t.useMemo(()=>({style:{clipPath:`path('${y}')`}}),[y]);return e.jsxs("div",{className:i,style:{display:"flex",flexDirection:"row",...r},...u,ref:_e([_,h,n]),children:[t.isValidElement(s)?t.cloneElement(s,x):e.jsx(e.Fragment,{}),e.jsx("svg",{style:{position:"absolute",top:0,left:0,pointerEvents:"none"},width:d,height:f,viewBox:`0 0 ${d} ${f}`,children:e.jsx("path",{d:g,stroke:c,fill:"none",vectorEffect:"non-scaling-stroke",strokeWidth:a})})]})})),ye={},xe=t=>{const{onPointerDown:o,style:n,splitDirection:i,paddingBefore:r=0,paddingAfter:s=0,disabled:l,key:c,hitAreaProps:u=ye,...h}=t,d="row"===i,{style:p,className:f,..._}=u;return e.jsx("div",{style:{...n,position:"relative"},...h,children:e.jsx("div",{className:a("hit-box",f),style:{left:(d?-r:0)+"px",width:`calc(100% + ${d?r+s:0}px)`,top:(d?0:-r)+"px",height:`calc(100% + ${d?0:r+s}px)`,position:"absolute",...p},onPointerDown:l?void 0:o,..._})},c)},ve={},be=(e,t,o=!0)=>null===e?null:null!==e.pixels?o?e.pixels:t-e.pixels:(o?e.percent:100-e.percent)/100*t,we=(e,t=!0)=>e?.percent?`${t?e.percent:100-e.percent}%`:e?.pixels?`${e.pixels}px`:void 0,Se=(e,t)=>{if(null==e)return null;const o={percent:null,pixels:null};let n=t;return"string"==typeof e&&((e=e.trim().toLowerCase()).endsWith("px")?(e=e.substring(0,e.length-2),n=!1):e.endsWith("%")&&(e=e.substring(0,e.length-1),n=!0),e=parseFloat(e)),n?o.percent=e:o.pixels=e,Object.freeze(o)},Ce=t.memo(t.forwardRef((o,n)=>{const{elementBefore:i,elementAfter:r,splitDirection:s="row",fixedPane:l=null,position:c,onPositionChange:u,minBefore:h,maxBefore:d,minAfter:_,maxAfter:m,children:g,className:y,style:x,disabled:v=!1,onDragStart:b,onDragResize:w,onDragFinish:S,resizerProps:C=ve,paneProps:E=ve,paneBeforeProps:L=ve,paneAfterProps:M=ve,createResizer:T=xe}=o;if(g)throw new Error("Use elementBefore and elementAfter instead of children.");const D=t.useMemo(()=>t.isValidElement(r)&&t.isValidElement(i),[r,i]),P=t.useMemo(()=>{let e=null;l&&("before"===l?e=0:"after"===l&&(e=1));const t=null===e;return{fixedPaneOffset:e,isPercent:t,minBefore:Se(h,t),maxBefore:Se(d,t),minAfter:Se(_,t),maxAfter:Se(m,t)}},[h,d,_,m]),k=f(u,[u]),[z,R]=t.useState(()=>Se(c,null===l));t.useEffect(()=>{R(Se(c,null===l))},[c,l]);const[A,{width:B,height:j}]=p(),[$,{width:O,height:K}]=p(),H="row"===s?O:K,V="row"===s?B:j,F=t.useMemo(()=>((e,t,o,n)=>{const i=[null,null],r=[null,null];if(e||(e={percent:null===n.fixedPaneOffset?50:null,pixels:null===n.fixedPaneOffset?null:0}),0===t)return null!=e?.pixels?1!==n.fixedPaneOffset?(i[0]=e?.pixels,r[1]=100):(i[1]=e?.pixels-o,r[0]=100):null!=e?.percent&&(1!==n.fixedPaneOffset?(r[0]=e?.percent,r[1]=100-e?.percent):(r[1]=e?.percent,r[0]=100-e?.percent)),{percents:r,pixels:i,minBefore:we(n.minBefore,!0),maxBefore:we(n.maxBefore,!0),minAfter:we(n.minAfter),maxAfter:we(n.maxAfter)};let s=be(e,t,1!==n.fixedPaneOffset),l=t-o,a=be(n.minBefore,l,!0)??0,c=be(n.maxBefore,l,!0)??l,u=0,h=0,d=0,p=l;u=(be(n.maxAfter,t,!1)??o)-o,h=be(n.minAfter,t,!1)??t,d=Math.max(a,u),p=Math.min(c,h),s=Math.max(d,Math.min(s,p)),h=Math.min(l-s,be(n.maxAfter,l-s,!0)??l),u=Math.min(l-s,be(n.minAfter,l-s,!0)??l),i[0]=s,i[1]=l-i[0];const f=Math.max(0,Math.min(100,s/l*100));return r[0]=f,r[1]=100-r[0],{percents:r,pixels:i,minBefore:`${a}px`,minAfter:`${u}px`,maxBefore:`${i[0]}px`,maxAfter:`${i[1]}px`}})(z,V,H,P),[P,z,V,H,s]),[I,N]=t.useState(!1),W=f(b,[b]),U=f(w,[w]),Y=f(S,[S]),X=t.useRef(null),q=t.useRef(null),Z=t.useRef(null),{style:G,className:J,...ee}=E,te={minWidth:0,minHeight:0,maxWidth:"100%",maxHeight:"100%",display:"flex",overflow:"hidden",...G},{className:oe,style:ne,...ie}=L,{className:re,style:se,...le}=M,ae={flex:"1 1 100%",width:"100%",...x,flexDirection:s,display:"flex"},{className:ce,style:ue,onPointerDown:he,...de}=C,pe=f(e=>{const t=Se(e,null===l);R(t)},[l]),fe=f(e=>{if(v||!I)return;const t=ye.current?.getBoundingClientRect();let o=0;o="row"===s?(e.clientX??e.touches?.[0]?.clientX)-t.x:(e.clientY??e.touches?.[0]?.clientY)-t.y,o=Math.max(0,Math.min(V,o)),1===P.fixedPaneOffset&&(o=V-o),c&&z.pixels===o||R({pixels:o,percent:null}),U?.(o),e.stopPropagation(),e.preventDefault()},[P,s,v,I,z,V]),me=f(e=>{if(document.removeEventListener("pointermove",fe),document.removeEventListener("touchmove",fe),document.removeEventListener("pointerup",me),!I)return;if(N(!1),!z)return;Y(z.pixels);if(!Se(c,null===l)||z.pixels!==c){const e={...z};null===e.percent&&(e.percent=e.pixels/V*100),k(e)}e.stopPropagation(),e.preventDefault()},[z,I,c,l,V]),ge=f(e=>{he?.(e),e.defaultPrevented||v||I||(N(!0),W(),document.addEventListener("pointermove",fe,{passive:!1}),document.addEventListener("touchmove",fe,{passive:!1}),document.addEventListener("pointerup",me,{passive:!1}))},[he]),ye=Q(n,()=>({setPosition:pe,isSplitPane:()=>!0}),[]),Ce=t.useMemo(()=>D?T?.({key:"resizer",ref:_e([$,q]),className:a("resizer",ce),onPointerDownCapture:ge,style:{cursor:v?void 0:"row"===s?"ew-resize":"ns-resize",minWidth:"row"===s?"2px":void 0,minHeight:"row"!==s?"2px":void 0,boxSizing:"border-box",pointerEvents:"all",zIndex:1,...ue},splitDirection:s,disabled:v,...de}):null,[D,ce,de,s,ue,v]),Ee="row"===s?"Width":"Height",Le={...te,...ne,flex:0===P.fixedPaneOffset&&null!==F?.pixels[0]?`0 0 ${Math.round(F?.pixels[0])}px`:`1 1 ${Math.round(F?.percents[0]??100)}%`,[`min${Ee}`]:F?.minBefore,[`max${Ee}`]:r?F?.maxBefore:"100%"},Me={...te,...se,flex:1===P.fixedPaneOffset&&null!==F?.pixels[1]?`0 0 ${Math.round(F?.pixels[1])}px`:`1 1 ${Math.round(F?.percents[1]??100)}%`,[`min${Ee}`]:F?.minAfter,[`max${Ee}`]:i?F?.maxAfter:"100%"},Te=t.useMemo(()=>i?e.jsx("div",{ref:X,className:a("before",J,oe),style:Le,...ee,...ie,children:i},"before"):null,[i,E,L,P,F]),De=t.useMemo(()=>r?e.jsx("div",{ref:Z,className:a("after",J,re),style:Me,...ee,...le,children:r},"after"):null,[r,E,M,P,F]);return e.jsxs("div",{ref:_e([A,ye]),className:a("splitPane","row"===s?"vertical":"horizontal",{dragging:I},y),style:ae,children:[Te,Ce,De]})}));function Ee(e){if(!e)throw new Error("must have a PointerHandlerOptions");const{onPointerDown:o,onPointerUp:n,onPointerMoveOrWait:i,processTouch:r=!1,consumeTouch:s=!0}=e,l=f(o,[o]),a=f(n,[n]),c=f(i,[i]),u=t.useRef(!1),h=e?.timerInitial??230,d=e?.timerContinuous??h/2,p=t.useRef(null),_=t.useRef(null),m=t.useRef(null),g=t.useRef(null),y=t.useCallback(()=>{g.current&&(clearTimeout(g.current),g.current=null)},[]),x=t.useCallback(e=>{g.current=setTimeout(()=>{window.requestAnimationFrame(()=>{!1!==u.current&&c?.(_.current,m.current,p.current)}),x(d)},e??h)},[]);t.useEffect(()=>()=>y(),[]);const v=r?"pointer":"mouse",b=t.useCallback(e=>{e.stopPropagation(),e.stopImmediatePropagation(),e.preventDefault()},[]),w=f(e=>{document.removeEventListener(`${v}move`,E),document.removeEventListener(`${v}up`,w),document.removeEventListener("keydown",L),document.removeEventListener("keyup",M),document.removeEventListener("touchstart",b,{capture:!0}),document.removeEventListener("touchmove",b,{capture:!0}),window.removeEventListener("blur",S),y(),window.requestAnimationFrame(()=>{!1!==u.current&&(u.current=!1,a?.(e,m.current,p.current),m.current=null)})},[]),S=t.useCallback(()=>{!1!==u.current&&(u.current=!1,w(_.current))},[]),C=f(()=>{y(),x(d),window.requestAnimationFrame(()=>{!1!==u.current&&c?.(_.current,m.current,p.current)})},[d]),E=f(e=>{_.current=e,C()},[]),L=f(e=>{m.current={ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey},C()},[]),M=f(e=>{m.current={ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey},C()},[d]);return f(e=>{if(e.isDefaultPrevented())return;m.current={ctrlKey:e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey,metaKey:e.metaKey};!1!==l(e,m.current)&&(p.current=e,_.current=e.nativeEvent,document.addEventListener(`${v}up`,w,{passive:!1}),document.addEventListener(`${v}move`,E,{passive:!1}),document.addEventListener("keydown",L,{passive:!1}),document.addEventListener("keyup",M,{passive:!1}),window.addEventListener("blur",S,{passive:!0}),r&&s&&(document.addEventListener("touchstart",b,{passive:!1,capture:!0}),document.addEventListener("touchmove",b,{passive:!1,capture:!0})),u.current=!0,x(h))},[h,r])}const Le=({initValue:e,useHookBody:o,applyStateChange:n})=>{const i=t.useRef(e);if("function"!=typeof o)throw new Error("function expected as hook body parameter. got "+typeof o);const r=o();return t.useLayoutEffect(()=>{i.current!==r&&(i.current=r,n(r))},[n,r]),null},Me=e=>{console&&console.warn&&console.warn(e)},Te="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0;let De=1,Pe=!1,ke=!1;const ze=[],Re=[],Ae=()=>{Re.forEach(e=>e())},Be=({automaticContainerInternalUseOnly:o})=>{const[n,i]=t.useState([]),r=t.useRef([]);return r.current=n,o||!1!==Pe||(ke=!0),t.useEffect(()=>{let e=!0;function t(){if(e)return Re[0]!==t?(o||!0!==Pe||Me("SingletonHooksContainer is mounted after some singleton hook has been used.Your SingletonHooksContainer will not be used in favor of internal one."),void i(e=>[])):void i([...ze])}return Re.push(t),Ae(),()=>{e=!1,r.current?.length>0&&Me("SingletonHooksContainer is unmounted, but it has active singleton hooks. They will be reevaluated once SingletonHooksContainer is mounted again"),Re.splice(Re.indexOf(t),1),Ae()}},[o]),e.jsx(e.Fragment,{children:n.map(({hook:e,key:o})=>t.createElement(Le,{...e,key:o}))})},je=t=>{const o=De++;return ze.push({hook:t,key:o}),0===Re.length&&!1===ke&&(Pe=!0,(t=>{if(Te.document&&Te.document.createElement){const o=Te.document.createElement("div");n.createRoot(o).render(e.jsx(t,{automaticContainerInternalUseOnly:!0}))}else Me("Can not mount SingletonHooksContainer on server side. Did you manage to run useEffect on server? Please mount SingletonHooksContainer into your components tree manually.")})(Be)),Ae(),()=>{ze.splice(ze.findIndex(e=>e.key===o),1),Ae()}},$e=(e,o,n={})=>{let r,s,l=!1,a=!1,c=[],{unmountIfNoConsumers:u=!1}=n;const h=e=>{var t;s=e,t=()=>c.forEach(t=>t(e)),i.unstable_batchedUpdates(t)},d=()=>(a||(s="function"==typeof e?e():e,a=!0),s);return()=>{const[n,i]=t.useState(d);return t.useEffect(()=>(l||(l=!0,r=je({initValue:e,useHookBody:o,applyStateChange:h})),c.push(i),s!==n&&i(s),()=>{c.splice(c.indexOf(i),1),0===c.length&&u&&(r(),l=!1)}),[]),n}};let Oe=()=>{console.warn("You must call useEditMode before setting its state.")};const Ke=$e(null,()=>{const[e,o]=t.useState(null);return Oe=o,e});class He{constructor(e,t,o,n){this._listenersProperties=new Set,this._listenersExecute=new Set,this._key=e,this._target=t,this._applyProps(o||{}),this._callback=n,void 0===n&&(this._callback=()=>{console.log(`implement: ${this.label()} : ${this.description()}`)})}key(){return this._key}_resolve(e,t){if("function"==typeof e){const o=t??this._context;return e("function"==typeof o?o():o)}return e}target(){return"function"==typeof this._target?this._target():this._target}label(e,t){const o=this._scopedLabels?.[e]||this._label;let n=null;if("function"==typeof o){const e=t??this._context;n=o("function"==typeof e?e():e)}else n=o;return n}description(e){return this._resolve(this._description,e)}tags(e){return this._resolve(this._tags,e)}icon(e){return this._resolve(this._icon,e)}shortcut(){return this._resolve(this._shortcut)}disabled(){return this._resolve(this._disabled)||!this._callback}state(){return this._resolve(this._state)}context(){return"function"==typeof this._context?this._context():this._context}async execute(e,t){if(!this.disabled()&&this._callback){try{let o=!0;t?.beforeExecute&&(o=t?.beforeExecute(this,e));if(!1===await Promise.resolve(o))return!1;const n=this._callback.bind(this)(e,this);if(!1===await Promise.resolve(n))return!1;t?.onExecute?.(this,e),this._notifyExecute(e)}catch(o){return console.warn(o),t?.onError(this,o,e),this._notifyError(e,o),!1}return!0}}addPropertyListener(e,t=!1){if(!e)throw new Error("listener must be specified");const o=this._listenersProperties;return o.add(e),t&&e({},this),()=>{o.delete(e)}}addExecuteListener(e){if(!e)throw new Error("listener must be specified");const t=this._listenersExecute;return t.add(e),function(){t.delete(e)}}_notifyExecute(e){const t=this;this._listenersExecute.forEach(o=>{o.onExecute(t,e)})}_notifyError(e,t){const o=this;this._listenersExecute.forEach(n=>{n.onError?.(o,e,t)})}updateCallback(e){return this._callback=e||null,this}update(e){if(!e)return;const t=this._applyProps(e);return Object.keys(t).length>0&&this._notifyPropertyChange(t),this}_notifyPropertyChange(e){const t=this;this._listenersProperties.forEach(o=>{o(e,t)})}_applyProps(e){let t={},o=this;return Object.keys(e).forEach(n=>{let i=e[n];o["_"+n]!==i&&(o["_"+n]=t[n]=i)}),t}}class Ve extends He{}class Fe{constructor(e,t){this._target=null,this._groupKey=null,this._root=null,this._parent=null,this._uuid=o.CommonUtils.uuidV4(),this._target=e,this._groupKey=t??null,this._root=this,this._nodes=new Map,this._nodes.set(t,this),this._children=new Map,this._listeners=new Set,this._commandsByKey=new Map,this._commandsByShortcut=new Map;const n=this;this._unListenersByCommand=new Map,this._listenersByKey=new Map,this._commandsPropertyListener=(e,t)=>{const o=n._root._listenersByKey,i=t.key(),r=o.get(i);r&&n._notifyCommands(r,"onCommandChange",t)}}_getCommand(e){const t=this._commandsByKey.get(e);return t||(this._parent?._getCommand(e)??null)}getCommand(e,t=!1){const o=this._root._focused;let n=o,i=o===this;for(;!i&&n;)n===this&&(i=!0),n=n._parent;return(i?o:this)._getCommand(e)}createChildGroup(e,t,o){let n;if(!o){let e=this;for(;e&&!n;){let o=e._nodes.get(t);o&&(n=o),e=e._parent}}n||(n=new Fe(e,t),n._parent=this,n._root=this._root,n._unListenersByCommand=null,n._listenersByKey=null,n._commandsPropertyListener=null);const i=(e,n)=>{!e.has(t)||o?e.set(t,n):void 0===o&&console.warn("commandGroup already registered",t)};i(this._root._nodes,n);let r=this._parent;for(;r;)i(this._nodes,n),r=r._parent;return this._children.set(t,n),this._notify("onGroupChange"),n}getKey(){return this._groupKey}getGroup(e){return this._nodes.get(e)}_addCommands(e,t=void 0){const o=this._commandsByKey,n=this._commandsByShortcut,i=this._root._commandsPropertyListener,r=this._root._unListenersByCommand;for(let s=0;s<e.length;s++){const l=e[s],a=l.key();if(o.has(a)&&!t){void 0===t&&console.warn("command already registered",a);continue}o.set(a,l);let c=r.get(l);c&&(c(),r.delete(l));const u=l.addPropertyListener(i);r.set(l,u);const h=l.shortcut();if(!h)continue;const d=Array.isArray(h)?h:[h];for(let e=0;e<d.length;e++){const o=We(d[e]),i=n.get(o);i&&!t&&void 0===t&&console.warn(`Shortcut already registered: ${o}, ${a}, ${i}.`),n.set(o,a)}}}removeFromParent(){if(!this._parent)return;let e=this._parent,t=[];const o=this._groupKey;for(;e;)t.push(e._nodes),e._nodes.delete(o),e=e._parent;e=this._parent;const n=e=>{e._children.forEach(e=>{for(let o=0;o<t.length;o++)e._nodes.delete(t[o]);n(e)})};n(this),this._parent=null,this._notify("onGroupChange")}addCommands(e,t){this._addCommands(e,t),this._notify("onGroupChange")}getActive(){return this._root._focused??this._root}activate(e){let t=this;if(e&&(t=this._nodes.get(e),!t))return void console.warn("group not found",e);let o=this._root._focused??this._root;for(;o;)o=o._parent;this._root._focused!==t&&(this._root._focused=t,this._notify("onGroupChange"),this._notify("onActiveChange"))}findCommandByEvent(e){const t=[];e.altKey&&t.push(r.Alt),e.shiftKey&&t.push(r.Shift),e.ctrlKey&&t.push(r.Ctrl),e.metaKey&&t.push(r.Meta);let o=We({key:e.code,modifiers:t});const n=this._commandsByShortcut;let i=n.get(o);i||(o=We({key:e.key,modifiers:t}),i=n.get(o)),!i&&e.code.startsWith("Digit")&&(o=We({key:e.code.substring(5,e.code.length),modifiers:t}),i=this._commandsByShortcut.get(o)),!i&&e.code.startsWith("Key")&&(i=We({key:e.code.substring(3,e.code.length),modifiers:t}),i=n.get(o));let s=null;return i&&(s=this._commandsByKey.get(i),s&&s.disabled()&&(s=null),!s||s.target()&&s.target().contains(e.target)||(s=null)),s||(this._parent?.findCommandByEvent(e)??null)}dispatchToFocusedCommand(e){const t=this.getActive();if(!t)return!1;if(e.isDefaultPrevented())return!1;const o=t.findCommandByEvent?.(e);return!!o&&(o.execute(),e.preventDefault(),!0)}getRoot(){return this._parent?this._parent.getRoot():this}getParent(){return this._parent}addListener(e,t){const o=this._listeners,n=t?.keys,i=this._root._listenersByKey;if(n&&!e.onCommandChange)throw new Error("keys were provided but the listener does not contain 'onCommandChange'.");let r=null;if(n)for(let t=0;t<n.length;t++){const o=n[t];if(!o)continue;let s=i.get(o);s||(s=new Set,i.set(o,s)),r||(r=[]),r.push(s),s.add(e)}return o.add(e),()=>{if(r)for(let t=0;t<r.length;t++){r[t].delete(e)}o.delete(e)}}_notifyCommands(e,t,o){const n=this;setTimeout(()=>{e.forEach(e=>{e[t]?.(n,o)})},0)}_notify(e,t){const o=this;setTimeout(()=>{o._listeners.forEach(n=>{n[e]?.(o,t)}),o._parent&&o._parent._notify(e,t)},0)}getAllCommands(){const e=[],t=this._groupKey;return this._commandsByKey.forEach(o=>{e.push({command:o,groupKey:t})}),this._children.forEach(t=>{e.push(...t.getAllCommands())}),e}}const Ie=o.CommonUtils.getOS()===o.CommonUtils.OSType.MacOS||o.CommonUtils.getOS()===o.CommonUtils.OSType.IOS?"Cmd":"Ctrl",Ne=o.CommonUtils.getOS()===o.CommonUtils.OSType.MacOS||o.CommonUtils.getOS()===o.CommonUtils.OSType.IOS?"⌘":"^",We=(e,t=!1)=>{const o={};for(let t=0;e.modifiers&&t<e.modifiers.length;t++)o[e.modifiers[t]]=!0;let n="";return(o?.[r.Ctrl]||o?.[r.Meta])&&(n+=(n.length>0?"+":"")+(t?Ne:Ie)),o?.[r.Alt]&&(n+=t?"⌥":"Alt"),o?.[r.Shift]&&(n+=(n.length>0?"+":"")+(t?"⇧":"Shift")),n+=(n.length>0?"+":"")+Z(e.key),n};const Ue=(e,t)=>{const o=[];if(t)for(let n=0;n<t.length;n++){const i=t[n],r=i?e?.getCommand(i):null;o.push(r)}return o};const Ye=$e({setClipboard:e=>{throw new Error("This is only available via the useClipboard.")},getClipboard:()=>o.InternalClipboard.Global,refNativeCopy:{current:null},refNativeLastKey:{current:null}},()=>{const[e,n]=t.useState(o.InternalClipboard.Global);return{setClipboard:e=>n(e),getClipboard:()=>e,refNativeCopy:t.useRef(null),refNativeLastKey:t.useRef(null)}});let Xe=!1,qe=0;var Ze="undefined"!=typeof document?t.useLayoutEffect:t.useEffect;const Ge=()=>"sheetxl-ui-"+qe++;const Je=t["useId".toString()],Qe=null!=Je?Je:function(){const[e,o]=t.useState(()=>Xe?Ge():void 0);return Ze(()=>{null==e&&o(Ge())},[]),t.useEffect(()=>{Xe||(Xe=!0)},[]),e},et="Undo the last action.",tt="Repeat the last action or undo the redo.",ot=e=>`Redo ${e}`;exports.Command=He,exports.CommandButtonType={Toolbar:"toolbar",Menuitem:"menuitem"},exports.CommandGroup=Fe,exports.DefaultNotifier=re,exports.FocusKeyNavigation=me,exports.HorizontalAlignment={General:"general",Left:"left",Right:"right",Center:"center",Justify:"justify",Fill:"fill",Distributed:"distributed",CenterContinuous:"centerContinuous"},exports.KeyCodes={BackSpace:8,Tab:9,Clear:12,Enter:13,Shift:16,Control:17,Alt:18,Pause:19,CapsLock:20,Escape:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Left:37,Up:38,Right:39,Down:40,Insert:45,Delete:46,Digit_8:56,Y:89,Z:90,Meta:91,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,NumLock:144,ScrollLock:145,BackSlash:220,Slash:191,BracketRight:221,BracketLeft:219},exports.KeyModifiers=r,exports.MouseButtonCodes={Left:1,Middle:2,Right:3},exports.NotificationType=ne,exports.ReactUtils=G,exports.RoundedTab=ge,exports.ScrollPane=oe,exports.ScrollUtils=y,exports.Scrollbar=v,exports.ScrollbarOrientation=s,exports.SimpleCommand=Ve,exports.SplitPane=Ce,exports.SplitPaneResizer=xe,exports.ToolTipPlacement={BottomEnd:"bottom-end",BottomStart:"bottom-start",Bottom:"bottom",LeftEnd:"left-end",LeftStart:"left-start",Left:"left",RightEnd:"right-end",RightStart:"right-start",Right:"right",TopEnd:"top-end",TopStart:"top-start",Top:"top"},exports.VirtualScrollbar=pe,exports.defaultCreateScrollCorner=te,exports.defaultCreateScrollEdgeButton=t=>{const{style:o,orientation:n=s.Vertical,...i}=t,r=n===s.Vertical,l=""+(r?"rotate(90) ":"");return e.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"end",transition:"fill-opacity 1s",zIndex:1,width:"24px",height:"24px",...o},className:`scrollbar-button ${r?"vertical":"horizontal"} edge`,...i,children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",transform:l,children:e.jsx("path",{style:{transition:"opacity 240ms ease 0s",opacity:t.disabled?0:1},d:"M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"})})})},exports.defaultCreateScrollEndButton=m,exports.defaultCreateScrollStartButton=_,exports.defaultCreateScrollbar=ee,exports.getDevicePixelRatio=function(e){if("undefined"==typeof window)return 1;const{defaultDpr:t=1,maxDpr:o=3,round:n=!0}=e||{},i="undefined"!=typeof window&&"number"==typeof window.devicePixelRatio?window.devicePixelRatio:t;return Math.min(Math.max(1,n?Math.floor(i):i),o)},exports.getPortalContainer=se,exports.toShortcutString=We,exports.useCallbackRef=f,exports.useCommand=function(e,n=null){const i=t.useRef(n);i.current=n;const[r,s]=t.useReducer(e=>e+1,0),l=t.useMemo(()=>Array.isArray(e)?e:[e],[e]);return t.useEffect(()=>{if(!l||0===l.length)return;const e=(e,t)=>{i.current?.onChange?.(t),s()};let t=null;n&&(t={onExecute(e,t){i.current?.onExecute?.(e,t)},onError(e,t,o){i.current?.onError?.(e,t,o)}});const r=new Set;for(let i=0;i<l.length;i++)r.add(l[i]?.addPropertyListener(o.CommonUtils.debounce(e,0),!0)),n&&r.add(l[i]?.addExecuteListener(t));return()=>{r.forEach(e=>{e?.()})}},[e]),r},exports.useCommands=function(e,o=null,n=null,i){const r=t.useRef(n);r.current=n,o&&!Array.isArray(o)&&(o=[o]);const[s,l]=t.useState(Ue(e,o)),a=i?[...i,e]:[e];return t.useEffect(()=>{const t={onGroupChange:()=>{const t=Ue(e,o);l(t),r.current?.onChange?.(this)}};let n;o&&o.length>0&&(n={keys:o},t.onCommandChange=(t,n)=>{r.current?.onChange?.(e),l(Ue(e,o))});const i=e?.addListener(t,n),s=Ue(e,o);return l(s),r.current?.onChange&&r.current?.onChange(e),()=>{i?.()}},a),s},exports.useCopyPaste=e=>{const{source:n,target:i,onPaste:s,onClipboardUpdate:l,notifier:a=re,commands:c}=e,u=f(l,[l]),h=f(s,[s]),{getClipboard:d,refNativeCopy:p}=Ye(),_=d();t.useMemo(()=>{const e=n?.element,t=i?.element??n?.element;if(!c)return;const o=[new Ve("cut",e,{label:"Cut",description:"Remove the selection and put it on the clipboard so you can paste it somewhere else.",shortcut:{key:"X",modifiers:[r.Ctrl]}}),new Ve("copy",e,{label:"Copy",description:"Put a copy of the selection on the clipboard so you can paste it somewhere else.",shortcut:{key:"C",modifiers:[r.Ctrl]}}),new Ve("paste",t,{label:"Paste",description:"Add content on the clipboard to your document.",shortcut:[{key:"V",modifiers:[r.Ctrl]},{key:"F8",modifiers:[r.Ctrl]}]})];c?.addCommands(o,!0)},[c]);const m=f(async e=>{if(!n?.element)return;let t=null;try{t=n.doCopy?.(e),"string"==typeof t?await _.writeText(t):await _.writeReference(t)}catch(e){throw e}},[n,a]),g=f(async e=>{const t=n?.element?.();if(t){p.current={sourceElement:t,args:e};try{await m(e)}catch(e){a?.showError?.(e)}}},[n?.element,a]),y=t.useCallback(()=>{g({isCut:!0})},[]),x=f(async(e,t,o)=>{try{if(!1===await e.doPaste(t,o))return;h?.(t,o)}catch(e){a?.showError?.(e)}},[h]),v=f(async(e,t,n)=>{const r=i?.element?.();if(r&&await o.CommonUtils.whenFocus(r),!e&&!t)return;const s=await(a?.showBusy?.("Pasting..."));if(t)try{return await x(i,t,n),void s?.()}catch(e){s?.(),a?.showError?.(e)}let l,c=i.importFromExternal;c||(c=(t,o)=>({getItemType:()=>"text",toText:()=>e.text,isClipboardItem:!0}));try{l=await c(e,{isCut:!1})}catch(e){s?.(),a?.showError?.(e)}if(l)try{const e=await Promise.resolve(l);await x(i,e,n),s?.()}catch(e){s?.(),a?.showError?.(e)}else s?.()},[x,i,a]),b=f(async e=>{if(i?.element)try{const t=await _.readReference();if(t)return void await v(null,t,e);const n=[];n[0]=await o.ClipboardUtils.readStringFromClipboard(_,o.MimeType.plain),n[1]=await o.ClipboardUtils.readHTMLFromClipboard(_,o.MimeType.html),n[2]=await o.ClipboardUtils.readBlobFromClipboard(_,o.MimeType.png);const i={text:n[0]??null,html:n[1]??null,image:n[2]??null};await v(i,null,e)}catch(e){if("Document is not focused."===e?.message)return;a?.showError?.(e)}},[v,i?.element,a]);return f(async e=>{},[n?.element]),f(async e=>{},[i?.element,v,a]),t.useEffect(()=>{if(!_)return;const e=async e=>{const t=await _.readReference();u?.(t)},t=e=>{a?.showMessage?.(o.InternalClipboard.ErrorMessages.PermsRead,{onceKey:"clipboard.features"})},n=e=>{a?.showMessage?.(o.InternalClipboard.ErrorMessages.PermsWrite,{onceKey:"clipboard.features"})};return _.addEventListener("clipboardchange",e),_.addEventListener("clipboarderrorread",t),_.addEventListener("clipboarderrorwrite",n),()=>{_.removeEventListener("clipboardchange",e),_.removeEventListener("clipboarderrorread",t),_.removeEventListener("clipboarderrorwrite",n)}},[_,a]),t.useEffect(()=>{},[m,v,n,i]),t.useEffect(()=>{c?.getCommand("cut")?.updateCallback(y).update({disabled:!n||!i}),c?.getCommand("copy")?.updateCallback(g).update({disabled:!n}),c?.getCommand("paste")?.updateCallback(b).update({disabled:!i})},[n,i,c]),{paste:b,copy:g,clipboard:_}},exports.useDevicePixelRatio=function(e){const[o,n]=t.useState("undefined"!=typeof window?window.devicePixelRatio:1),i=t.useRef(null);return t.useEffect(()=>{if(!("undefined"!=typeof window&&"matchMedia"in window))return;const e=()=>{const t=window.matchMedia(`screen and (resolution: ${window.devicePixelRatio}dppx)`);t.addEventListener("change",e,{once:!0,passive:!0}),n(window.devicePixelRatio),i.current={mediaMatcher:t,listener:e}};return e(),()=>{i.current&&i.current.mediaMatcher.removeEventListener("change",i.current.listener)}},[e]),o},exports.useEditMode=()=>{const e=Ke();return t.useMemo(()=>({setMode:e=>{Oe(t=>("function"==typeof e&&(e=e(t)),e?.onModeChange?.(e??null),e))},getMode:()=>e}),[e])},exports.useFullscreenPortal=function(){return t.useEffect(()=>{function e(){const e=document.fullscreenElement;if(!e)return;let t=e.querySelector(".fullscreen-portal-root");t||(t=document.createElement("div"),t.className="fullscreen-portal-root _fullscreen-portal-root_1mjsr_4",e.appendChild(t))}return le++,e(),document.addEventListener("fullscreenchange",e),()=>{document.removeEventListener("fullscreenchange",e),le--,le<=0&&(document.querySelectorAll(".fullscreen-portal-root").forEach(e=>{e.parentNode&&e.parentNode.removeChild(e)}),le=0)}},[]),{getPortalContainer:se}},exports.useGlobalClipboard=Ye,exports.useId=Qe,exports.useImperativeElement=Q,exports.useMouseDownAndHoldListener=function(e,t){return Ee({onPointerDown:e,onPointerMoveOrWait:(t,o,n)=>{e?.(n)},...t})},exports.useOnClickOrFocusAway=function(e,o,n){const i=f(o,[o]);t.useEffect(()=>{const t=t=>{e.current&&!e.current.contains(t.target)&&i(t)};return n&&!1===n.mouseEvents||(document.addEventListener("mousedown",t),document.addEventListener("touchstart",t)),n&&!1===n.focusEvents||document.addEventListener("focus",t),()=>{document.removeEventListener("mousedown",t),document.removeEventListener("touchstart",t),document.removeEventListener("focus",t)}},[e])},exports.useSynchronizedPointerHandler=Ee,exports.useTraceUpdate=function(e,o=!0){const n=t.useRef(e);t.useEffect(()=>{if(o){const t=Object.entries(e).reduce((e,[t,o])=>(n.current[t]!==o&&(e[t]=[n.current[t],o]),e),{});Object.keys(t).length>0&&console.log("Changed props:",t)}n.current=e})},exports.useUndoManager=({manager:e,commands:o,disabled:n,notifier:i=re})=>{const s=f(t=>{try{e?.undo(t)}catch(e){i.showError?.(e)}},[e]),l=f(t=>{try{e?.redo(t)}catch(e){i.showError?.(e)}},[e]);return t.useMemo(()=>{if(!o)return;const e={contains:e=>!0,focus(){}},t=[new He("undo",e,{label:"Undo",description:et,shortcut:{key:"z",modifiers:[r.Ctrl]},disabled:!0},s),new He("redo",e,{label:"Redo",description:tt,shortcut:[{key:"y",modifiers:[r.Ctrl]},{key:"F4"},{key:"Enter",modifiers:[r.Alt]}],disabled:!0},l)];o?.addCommands(t,!0)},[o]),t.useEffect(()=>{if(!o)return;const t=()=>{const t=e?.getTopUndoDescription(),i={};var r;o.getCommand("undo").update({disabled:n||!e||!e.hasUndo(),description:t?(r=t,`Undo ${r}`):et,state:i,context:{undoManager:e}});const s=e?.getTopRedoDescription();o.getCommand("redo").update({disabled:n||!e||!e.hasRedo(),description:s?ot(s):tt,state:i,context:{undoManager:e}})};if(t(),!e)return;const i=e.addListener({onStackChange(){t()}});return()=>i?.()},[e,o,n]),{undo:s,redo:l}};