ui-layout-manager-dev 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -11,5 +11,5 @@
11
11
  object-assign
12
12
  (c) Sindre Sorhus
13
13
  @license MIT
14
- */function C(){if(d)return f;d=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return f=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},r=0;r<10;r++)n["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var t={};return"abcdefghijklmnopqrst".split("").forEach(function(e){t[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},t)).join("")}catch(e){return!1}}()?Object.assign:function(t,o){for(var i,a,c=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(t),l=1;l<arguments.length;l++){for(var u in i=Object(arguments[l]))n.call(i,u)&&(c[u]=i[u]);if(e){a=e(i);for(var s=0;s<a.length;s++)r.call(i,a[s])&&(c[a[s]]=i[a[s]])}}return c},f}function R(){if(y)return p;y=1;return p="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function k(){return h?v:(h=1,v=Function.call.bind(Object.prototype.hasOwnProperty))}function T(){if(g)return m;g=1;var e=function(){};if("production"!==process.env.NODE_ENV){var n=R(),r={},t=k();e=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}}function o(o,i,a,c,l){if("production"!==process.env.NODE_ENV)for(var u in o)if(t(o,u)){var s;try{if("function"!=typeof o[u]){var f=Error((c||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}s=o[u](i,u,c,a,null,n)}catch(e){s=e}if(!s||s instanceof Error||e((c||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in r)){r[s.message]=!0;var d=l?l():"";e("Failed "+a+" type: "+s.message+(null!=d?d:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},m=o}function I(){if(w)return b;w=1;var e=E(),n=C(),r=R(),t=k(),o=T(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}),b=function(c,l){var u="function"==typeof Symbol&&Symbol.iterator;var s="<<anonymous>>",f={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:y(a),arrayOf:function(e){return y(function(n,t,o,i,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var c=n[t];if(!Array.isArray(c))return new p("Invalid "+i+" `"+a+"` of type `"+g(c)+"` supplied to `"+o+"`, expected an array.");for(var l=0;l<c.length;l++){var u=e(c,l,o,i,a+"["+l+"]",r);if(u instanceof Error)return u}return null})},element:y(function(e,n,r,t,o){var i=e[n];return c(i)?null:new p("Invalid "+t+" `"+o+"` of type `"+g(i)+"` supplied to `"+r+"`, expected a single ReactElement.")}),elementType:y(function(n,r,t,o,i){var a=n[r];return e.isValidElementType(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+g(a)+"` supplied to `"+t+"`, expected a single ReactElement type.")}),instanceOf:function(e){return y(function(n,r,t,o,i){if(!(n[r]instanceof e)){var a=e.name||s;return new p("Invalid "+o+" `"+i+"` of type `"+(((c=n[r]).constructor&&c.constructor.name?c.constructor.name:s)+"` supplied to `")+t+"`, expected instance of `"+a+"`.")}var c;return null})},node:y(function(e,n,r,t,o){return m(e[n])?null:new p("Invalid "+t+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return y(function(n,o,i,a,c){if("function"!=typeof e)return new p("Property `"+c+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=n[o],u=g(l);if("object"!==u)return new p("Invalid "+a+" `"+c+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var s in l)if(t(l,s)){var f=e(l,s,i,a,c+"."+s,r);if(f instanceof Error)return f}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a;return y(function(n,r,t,o,i){for(var a=n[r],c=0;c<e.length;c++)if(d(a,e[c]))return null;var l=JSON.stringify(e,function(e,n){return"symbol"===b(n)?String(n):n});return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+t+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(o)+" at index "+n+"."),a}return y(function(n,o,i,a,c){for(var l=[],u=0;u<e.length;u++){var s=(0,e[u])(n,o,i,a,c,r);if(null==s)return null;s.data&&t(s.data,"expectedType")&&l.push(s.data.expectedType)}return new p("Invalid "+a+" `"+c+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return y(function(n,t,o,i,a){var c=n[t],l=g(c);if("object"!==l)return new p("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var s=e[u];if("function"!=typeof s)return h(o,i,a,u,b(s));var f=s(c,u,o,i,a+"."+u,r);if(f)return f}return null})},exact:function(e){return y(function(o,i,a,c,l){var u=o[i],s=g(u);if("object"!==s)return new p("Invalid "+c+" `"+l+"` of type `"+s+"` supplied to `"+a+"`, expected `object`.");var f=n({},o[i],e);for(var d in f){var y=e[d];if(t(e,d)&&"function"!=typeof y)return h(a,c,l,d,b(y));if(!y)return new p("Invalid "+c+" `"+l+"` key `"+d+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var v=y(u,d,a,c,l+"."+d,r);if(v)return v}return null})}};function d(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}function p(e,n){this.message=e,this.data=n&&"object"==typeof n?n:{},this.stack=""}function y(e){if("production"!==process.env.NODE_ENV)var n={},t=0;function o(o,a,c,u,f,d,y){if(u=u||s,d=d||c,y!==r){if(l){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=u+":"+c;!n[h]&&t<3&&(i("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[h]=!0,t++)}}return null==a[c]?o?null===a[c]?new p("The "+f+" `"+d+"` is marked as required in `"+u+"`, but its value is `null`."):new p("The "+f+" `"+d+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(a,c,u,f,d)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function v(e){return y(function(n,r,t,o,i,a){var c=n[r];return g(c)!==e?new p("Invalid "+o+" `"+i+"` of type `"+b(c)+"` supplied to `"+t+"`, expected `"+e+"`.",{expectedType:e}):null})}function h(e,n,r,t,o){return new p((e||"React class")+": "+n+" type `"+r+"."+t+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function m(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(m);if(null===e||c(e))return!0;var n=function(e){var n=e&&(u&&e[u]||e["@@iterator"]);if("function"==typeof n)return n}(e);if(!n)return!1;var r,t=n.call(e);if(n!==e.entries){for(;!(r=t.next()).done;)if(!m(r.value))return!1}else for(;!(r=t.next()).done;){var o=r.value;if(o&&!m(o[1]))return!1}return!0;default:return!1}}function g(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,n){return"symbol"===e||!!n&&("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}(n,e)?"symbol":n}function b(e){if(null==e)return""+e;var n=g(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function w(e){var n=b(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}return p.prototype=Error.prototype,f.checkPropTypes=o,f.resetWarningCache=o.resetWarningCache,f.PropTypes=f,f},b}function P(){if(S)return x;S=1;var e=R();function n(){}function r(){}return r.resetWarningCache=n,x=function(){function t(n,r,t,o,i,a){if(a!==e){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function o(){return t}t.isRequired=t;var i={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:o,element:t,elementType:t,instanceOf:o,node:t,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:n};return i.PropTypes=i,i}}function D(){if(O)return a.exports;if(O=1,"production"!==process.env.NODE_ENV){var e=E();a.exports=I()(e.isElement,true)}else a.exports=P()();return a.exports}var L=o(D());function N(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=Array(n);r<n;r++)t[r]=e[r];return t}function z(e,n,r){return n&&function(e,n){for(var r=0;r<n.length;r++){var t=n[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,V(t.key),t)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=W(e))||n){r&&(e=r);var t=0,o=function(){};return{s:o,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function _(e,n,r){return(n=V(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function A(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,t)}return r}function M(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?A(Object(r),!0).forEach(function(n){_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function B(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,o,i,a,c=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===n);else for(;!(l=(t=i.call(r)).done)&&(c.push(t.value),c.length!==n);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,n)||W(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e){var n=function(e,n){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,n);if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function W(e,n){if(e){if("string"==typeof e)return N(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,n):void 0}}var F={INITIALIZE:1,INITIALIZE_FLEXBOX:2,APPLY_SIZES:3,ERROR:4,TRANSFORMATIONS:5,MOVE_HANDLE_BAR:6},H=F=Object.freeze(F),q={UPDATE_SIZE:1},U=q=Object.freeze(q),Y=function(){return z(function e(n){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.containers={},this.containerRefs={},this.ldf=n,this.numberOfContainers=0,this.registeredContainers=0,this.layoutLoaded=!1,this.numberOfContainers=this.ldf.containers?Object.keys(this.ldf.containers).length:0,this.worker=null},[{key:"startWorker",value:function(){try{this.worker=new Worker(new URL("./Worker/LayoutWorker.js","undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("index.js",document.baseURI).href),{type:"module"}),this.worker.onmessage=this.handleWorkerMessage.bind(this),this.worker.onerror=function(e){return console.error("Worker error:",e)},this.sendToWorker(H.INITIALIZE,{ldf:this.ldf})}catch(e){console.error("Failed to create worker:",e)}}},{key:"sendToWorker",value:function(e,n){this.worker||this.startWorker(),this.worker.postMessage({code:e,args:n})}},{key:"registerContainer",value:function(e,n,r){e in this.containers||(this.registeredContainers+=1),this.containers[e]=n,this.containerRefs[e]=r,console.log("Registered container with id: ".concat(e," ")),this.registeredContainers!==this.numberOfContainers||this.layoutLoaded||(console.log("All containers registered, layout is ready."),this.sendToWorker(H.INITIALIZE_FLEXBOX))}},{key:"unregisterContainer",value:function(e){delete this.containers[e]}},{key:"handleRootResize",value:function(){if(this.layoutLoaded){var e={};for(var n in this.containerRefs)if(this.containerRefs.hasOwnProperty(n)){var r=this.containerRefs[n].getBoundingClientRect();e[n]={width:r.width,height:r.height}}this.sendToWorker(H.APPLY_SIZES,{sizes:e})}}},{key:"moveHandleBar",value:function(e){for(var n={},r=0,t=[e.parent,e.sibling1,e.sibling2];r<t.length;r++){var o=t[r],i=this.containerRefs[o].getBoundingClientRect();n[o]={width:i.width,height:i.height}}e.sizes=n,this.sendToWorker(H.MOVE_HANDLE_BAR,{metadata:e}),this.handleRootResize()}},{key:"applyTransformations",value:function(e,n){var r=this;requestAnimationFrame(function(){var t,o=$(e);try{for(o.s();!(t=o.n()).done;){var i=t.value;switch(i.type){case U.UPDATE_SIZE:r.containers[i.id].current.updateStyles(i.args.style);break;case U.REMOVE_NODE:break;default:console.warn("Unknown transformation was requested.")}}}catch(e){o.e(e)}finally{o.f()}n&&(r.layoutLoaded=!0)})}},{key:"handleWorkerMessage",value:function(e){var n;switch(e.data.type){case H.INITIALIZE_FLEXBOX:n=e.data.data,this.applyTransformations(n,!0);break;case H.TRANSFORMATIONS:n=e.data.data,this.applyTransformations(n,!1);break;case H.ERROR:console.error("Error from worker:",e.data)}}},{key:"destroy",value:function(){this.worker&&(this.worker.terminate(),this.worker=null)}}])}(),X=e.createContext(null);function Z(r){var t=r.layout,o=r.children,i=e.useMemo(function(){return new Y(t)},[t]);return e.useEffect(function(){return function(){i.destroy()}},[i]),n.jsx(X.Provider,{value:i,children:o})}function K(){var n=e.useContext(X);if(!n)throw new Error("useLayoutController must be used within a LayoutControllerProvider");return n}function J(e,n){void 0===n&&(n={});var r=n.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}Z.propTypes={layout:L.object.isRequired,children:L.node.isRequired};J(".handleBarHorizontalContainer {\n position: relative;\n width: 100%;\n height: 1px;\n background-color: #414141;\n z-index: 1;\n}\n\n.handleBarHorizontal {\n position: absolute;\n top: 50%;\n height: 1px;\n left: 0;\n right: 0;\n transform: translateY(-50%);\n transition: all 0.2s ease;\n}\n\n.handleBarHorizontal:hover {\n background-color: #007acc;\n cursor: ns-resize;\n height: 5px;\n z-index: 10;\n}\n\n.handleBarHorizontalHover {\n background-color: #007acc;\n cursor: ns-resize;\n height: 5px;\n z-index: 10;\n}\n\n.handleBarVerticalContainer {\n position: relative;\n height: 100%;\n width: 1px;\n background-color: #414141;\n z-index: 1;\n}\n\n.handleBarVertical {\n position: absolute;\n top: 0;\n width: 1px;\n left: 50%;\n bottom: 0;\n transform: translateX(-50%);\n transition: all 0.3s ease;\n}\n\n.handleBarVertical:hover {\n background-color: #007acc;\n cursor: ew-resize;\n width: 5px;\n z-index: 10;\n}\n\n.handleBarVerticalHover {\n background-color: #007acc;\n cursor: ew-resize;\n width: 5px;\n z-index: 10;\n}");var G=function(r){var t=r.orientation,o=r.parent,i=r.sibling1,a=r.sibling2,c=K(),l=e.useRef(null),u=e.useRef(null),s=e.useRef(null),f=function(e){var n,r,s;e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",d),document.addEventListener("mouseup",p),"horizontal"===t?(n="clientY",r="height",s="handleBarHorizontalHover"):"vertical"===t&&(n="clientX",r="width",s="handleBarVerticalHover");for(var f,y,v=c.containerRefs[o],h=c.containerRefs[i],m=c.containerRefs[a],g=c.ldf.containers[o],b=0;b<g.children.length;b++)g.children[b].containerId===i?f=g.children[b].size:g.children[b].containerId===a&&(y=g.children[b].size);l.current={downValueY:e[n],hoverClass:s,downKey:n,propKey:r,parentSize:v.getBoundingClientRect()[r],parentRef:v,sibling1Ref:h,sibling2Ref:m,sibling1LayoutConfig:f,sibling2LayoutConfig:y,sibling1Size:h.getBoundingClientRect()[r],sibling2Size:m.getBoundingClientRect()[r]},u.current.classList.add(s)};var d=function(e){if(l.current){e.preventDefault(),e.stopPropagation();var n=l.current,r=e[n.downKey]-n.downValueY,t=n.sibling1Size+r,u=n.sibling2Size-r;clearTimeout(s.current),s.current=setTimeout(function(){var r,t,l;c.moveHandleBar({handle:(r=e,t=n.parentRef,l=t.getBoundingClientRect(),{x:r.clientX-l.left,y:r.clientY-l.top}),parent:o,sibling1:i,sibling2:a})},4);var f=Object.keys(n.sibling1LayoutConfig);if(!(f.includes("min")&&t<=n.sibling1LayoutConfig.min.value||f.includes("max")&&t>=n.sibling1LayoutConfig.max.value)){var d=Object.keys(n.sibling2LayoutConfig);if(!(d.includes("min")&&u<=n.sibling2LayoutConfig.min.value||d.includes("max")&&u>=n.sibling2LayoutConfig.max.value)){var p=n.sibling1LayoutConfig.initial.type,y=n.sibling2LayoutConfig.initial.type;if("fill"===p&&"fill"===y&&t>50&&u>50)return c.containerRefs[i].style[n.propKey]=t+"px",void(c.containerRefs[a].style[n.propKey]=u+"px");"fill"!==p&&(c.containerRefs[i].style[n.propKey]=t+"px"),"fill"!==y&&(c.containerRefs[a].style[n.propKey]=u+"px")}}}},p=function(e){e.preventDefault(),e.stopPropagation(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),clearTimeout(s.current),u.current&&l.current&&u.current.classList.remove(l.current.hoverClass),l.current=null};return e.useEffect(function(){return function(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),s.current&&(clearTimeout(s.current),s.current=null)}},[]),n.jsx(e.Fragment,{children:"horizontal"===t?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarHorizontalContainer",children:n.jsx("div",{ref:u,className:"handleBarHorizontal"})}):"vertical"===t?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarVerticalContainer",children:n.jsx("div",{ref:u,className:"handleBarVertical"})}):null})};G.propTypes={orientation:L.string,sibling1:L.string,sibling2:L.string,parent:L.string};J(".relative-container {\n position: relative;\n}\n\n.relative-container.hiding-horizontal {\n width: 0px !important;\n}\n\n.relative-container.hiding-vertical {\n height: 0px !important;\n}");var Q=e.createContext({});Q.displayName="ComponentRegistryContext";J(".lazyContainer {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n right: 0px;\n}");var ee=function(r){var t=r.content,o=e.useContext(Q),i=e.useMemo(function(){if(o&&t&&"component"in t&&t.component in o)return e.lazy(o[t.component])},[o,t]);return n.jsx("div",{className:"lazyContainer",children:n.jsx(e.Suspense,{fallback:n.jsx("div",{children:"Loading..."}),children:i&&n.jsx(i,{})})})};ee.propTypes={content:L.object};var ne=function(r){var t=r.node,o=K(),i=e.useRef(null),a=e.useRef(null),c=B(e.useState(null),2),l=c[0],u=c[1],s=e.useCallback(function(e){for(var r=[],t=0;t<e.children.length;t++){var i=e.children[t];if("container"===i.type){var a=o.ldf.containers[e.children[t].containerId];a.parent=e,r.push(n.jsx(ne,{meta:e.children[t],id:a.id,node:a},t))}else"handleBar"===i.type&&("horizontal"===e.orientation?r.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)):"vertical"===e.orientation&&r.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)))}return r},[o]),f=e.useRef({});return f.current={updateStyles:function(e){var n="hiding-"+a.current;for(var r in e)if("display"===r&&"none"===e[r]){if(i.current.classList.contains(n))return;i.current.classList.add(n)}else if("display"===r&&"flex"===e[r]){if(!i.current.classList.contains(n))return;i.current.classList.remove(n)}else i.current.style[r]=e[r]}},e.useLayoutEffect(function(){if(t&&o&&i.current){a.current=t.parent.orientation;var e=t.children&&t.children.length>0;return e?"horizontal"===t.orientation?(i.current.style.display="flex",i.current.style.flexDirection="row",i.current.style.width="100%"):"vertical"===t.orientation?(i.current.style.display="flex",i.current.style.flexDirection="column",i.current.style.height="100%"):console.warn("Unknown orientation:",t.orientation):t.background?i.current.style.background=t.background:i.current.style.background="transparent",u(e?s(t):n.jsx(ee,{content:t})),o.registerContainer(t.id,f,i.current),function(){o.unregisterContainer(t.id)}}},[t,o,s]),n.jsx("div",{ref:i,className:"relative-container",children:l})};ne.propTypes={node:L.object};var re=e.createContext(null),te=function(r){var t=r.children,o=B(e.useState({activeId:null,activeData:null,overId:null,overData:null,isDragging:!1}),2),i=o[0],a=o[1],c=B(e.useState(null),2),l=c[0],u=c[1],s=e.useCallback(function(e){var n,r,t,o;a({activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(t=null===(o=e.active)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.current)&&void 0!==t?t:null,overId:null,overData:null,isDragging:!0})},[]),f=e.useCallback(function(e){a(function(n){var r,t,o,i;return M(M({},n),{},{overId:null!==(r=null===(t=e.over)||void 0===t?void 0:t.id)&&void 0!==r?r:null,overData:null!==(o=null===(i=e.over)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.current)&&void 0!==o?o:null})})},[]),d=e.useCallback(function(e){var n,r,t,o,i,c,l,s;u({activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(t=null===(o=e.active)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.current)&&void 0!==t?t:null,overId:null!==(i=null===(c=e.over)||void 0===c?void 0:c.id)&&void 0!==i?i:null,overData:null!==(l=null===(s=e.over)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.current)&&void 0!==l?l:null}),a({activeId:null,activeData:null,overId:null,overData:null,isDragging:!1})},[]),p=e.useMemo(function(){return{dragState:i,drop:l,handleDragStart:s,handleDragOver:f,clearDrag:d}},[i,l,s,f,d]);return n.jsx(re.Provider,{value:p,children:t})};J(".root-container {\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.relative-container {\n position: relative;\n display: flex;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.drag-overlay {\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n}");var oe=function(){var t,o=K(),i=function(){var n=e.useContext(re);if(!n)throw new Error("useDragState must be used inside DragProvider");return n}(),a=i.dragState,c=i.handleDragStart,l=i.handleDragOver,u=i.clearDrag,s=e.useRef(null),f=e.useRef(null),d=e.useRef(!1),p=e.useRef({});p.current={};var y=B(e.useState(null),2),v=y[0],h=y[1],m=e.useCallback(function(e){for(var r=[],t=0;t<e.children.length;t++){var i=e.children[t];if("container"===i.type){var a=o.ldf.containers[e.children[t].containerId];a.parent=e,r.push(n.jsx(ne,{meta:e.children[t],id:a.id,node:a},t))}else"handleBar"===i.type&&("horizontal"===e.orientation?r.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)):"vertical"===e.orientation&&r.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)))}return r},[o]);e.useLayoutEffect(function(){if(o){var e=o.ldf.containers[o.ldf.layoutRoot],n=e.children&&e.children.length>0;o.registerContainer(e.id,p,s.current),n&&("horizontal"===e.orientation?s.current.style.flexDirection="row":"vertical"===e.orientation&&(s.current.style.flexDirection="column")),h(n?m(e):null);var r=new ResizeObserver(function(e){d.current||(d.current=!0);var n,r=$(e);try{var t=function(){var e=n.value.contentRect,r=e.width,t=e.height;clearTimeout(f.current),f.current=setTimeout(function(){d.current=!1,o.handleRootResize(r,t)},1)};for(r.s();!(n=r.n()).done;)t()}catch(e){r.e(e)}finally{r.f()}});return r.observe(s.current),function(){o.unregisterContainer(o.ldf.layoutRoot),r.disconnect()}}},[o]);var g=r.useSensors(r.useSensor(r.PointerSensor,{activationConstraint:{distance:8}})),b=B(e.useState({left:0,top:0}),2),w=b[0],x=b[1];return e.useEffect(function(){if(a.isDragging){var e=function(e){x({left:e.clientX,top:e.clientY})};return window.addEventListener("pointermove",e),function(){window.removeEventListener("pointermove",e)}}},[a.isDragging]),n.jsxs(r.DndContext,{sensors:g,onDragStart:c,onDragOver:l,onDragEnd:u,onDragCancel:u,children:[n.jsx("div",{className:"root-container",children:n.jsx("div",{ref:s,className:"relative-container",children:v})}),a.isDragging&&n.jsx("div",{className:"drag-overlay",style:w,children:null==a||null===(t=a.activeData)||void 0===t?void 0:t.preview})]})};J("");var ie=function(e){var r=e.ldf,t=e.registry;return n.jsx(te,{children:n.jsx(Z,{layout:r,children:n.jsx(Q.Provider,{value:t,children:n.jsx(oe,{})})})})};ie.propTypes={ldf:L.object,registry:L.object},exports.LayoutManager=ie;
14
+ */function C(){if(d)return f;d=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return f=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},r=0;r<10;r++)n["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var t={};return"abcdefghijklmnopqrst".split("").forEach(function(e){t[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},t)).join("")}catch(e){return!1}}()?Object.assign:function(t,o){for(var i,a,c=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(t),l=1;l<arguments.length;l++){for(var u in i=Object(arguments[l]))n.call(i,u)&&(c[u]=i[u]);if(e){a=e(i);for(var s=0;s<a.length;s++)r.call(i,a[s])&&(c[a[s]]=i[a[s]])}}return c},f}function R(){if(y)return p;y=1;return p="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function k(){return h?v:(h=1,v=Function.call.bind(Object.prototype.hasOwnProperty))}function T(){if(g)return m;g=1;var e=function(){};if("production"!==process.env.NODE_ENV){var n=R(),r={},t=k();e=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}}function o(o,i,a,c,l){if("production"!==process.env.NODE_ENV)for(var u in o)if(t(o,u)){var s;try{if("function"!=typeof o[u]){var f=Error((c||"React class")+": "+a+" type `"+u+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[u]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}s=o[u](i,u,c,a,null,n)}catch(e){s=e}if(!s||s instanceof Error||e((c||"React class")+": type specification of "+a+" `"+u+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof s+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),s instanceof Error&&!(s.message in r)){r[s.message]=!0;var d=l?l():"";e("Failed "+a+" type: "+s.message+(null!=d?d:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},m=o}function I(){if(w)return b;w=1;var e=E(),n=C(),r=R(),t=k(),o=T(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var n="Warning: "+e;"undefined"!=typeof console&&console.error(n);try{throw new Error(n)}catch(e){}}),b=function(c,l){var u="function"==typeof Symbol&&Symbol.iterator;var s="<<anonymous>>",f={array:v("array"),bigint:v("bigint"),bool:v("boolean"),func:v("function"),number:v("number"),object:v("object"),string:v("string"),symbol:v("symbol"),any:y(a),arrayOf:function(e){return y(function(n,t,o,i,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var c=n[t];if(!Array.isArray(c))return new p("Invalid "+i+" `"+a+"` of type `"+g(c)+"` supplied to `"+o+"`, expected an array.");for(var l=0;l<c.length;l++){var u=e(c,l,o,i,a+"["+l+"]",r);if(u instanceof Error)return u}return null})},element:y(function(e,n,r,t,o){var i=e[n];return c(i)?null:new p("Invalid "+t+" `"+o+"` of type `"+g(i)+"` supplied to `"+r+"`, expected a single ReactElement.")}),elementType:y(function(n,r,t,o,i){var a=n[r];return e.isValidElementType(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+g(a)+"` supplied to `"+t+"`, expected a single ReactElement type.")}),instanceOf:function(e){return y(function(n,r,t,o,i){if(!(n[r]instanceof e)){var a=e.name||s;return new p("Invalid "+o+" `"+i+"` of type `"+(((c=n[r]).constructor&&c.constructor.name?c.constructor.name:s)+"` supplied to `")+t+"`, expected instance of `"+a+"`.")}var c;return null})},node:y(function(e,n,r,t,o){return m(e[n])?null:new p("Invalid "+t+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")}),objectOf:function(e){return y(function(n,o,i,a,c){if("function"!=typeof e)return new p("Property `"+c+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=n[o],u=g(l);if("object"!==u)return new p("Invalid "+a+" `"+c+"` of type `"+u+"` supplied to `"+i+"`, expected an object.");for(var s in l)if(t(l,s)){var f=e(l,s,i,a,c+"."+s,r);if(f instanceof Error)return f}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a;return y(function(n,r,t,o,i){for(var a=n[r],c=0;c<e.length;c++)if(d(a,e[c]))return null;var l=JSON.stringify(e,function(e,n){return"symbol"===b(n)?String(n):n});return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+t+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var n=0;n<e.length;n++){var o=e[n];if("function"!=typeof o)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(o)+" at index "+n+"."),a}return y(function(n,o,i,a,c){for(var l=[],u=0;u<e.length;u++){var s=(0,e[u])(n,o,i,a,c,r);if(null==s)return null;s.data&&t(s.data,"expectedType")&&l.push(s.data.expectedType)}return new p("Invalid "+a+" `"+c+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return y(function(n,t,o,i,a){var c=n[t],l=g(c);if("object"!==l)return new p("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+o+"`, expected `object`.");for(var u in e){var s=e[u];if("function"!=typeof s)return h(o,i,a,u,b(s));var f=s(c,u,o,i,a+"."+u,r);if(f)return f}return null})},exact:function(e){return y(function(o,i,a,c,l){var u=o[i],s=g(u);if("object"!==s)return new p("Invalid "+c+" `"+l+"` of type `"+s+"` supplied to `"+a+"`, expected `object`.");var f=n({},o[i],e);for(var d in f){var y=e[d];if(t(e,d)&&"function"!=typeof y)return h(a,c,l,d,b(y));if(!y)return new p("Invalid "+c+" `"+l+"` key `"+d+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var v=y(u,d,a,c,l+"."+d,r);if(v)return v}return null})}};function d(e,n){return e===n?0!==e||1/e==1/n:e!=e&&n!=n}function p(e,n){this.message=e,this.data=n&&"object"==typeof n?n:{},this.stack=""}function y(e){if("production"!==process.env.NODE_ENV)var n={},t=0;function o(o,a,c,u,f,d,y){if(u=u||s,d=d||c,y!==r){if(l){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=u+":"+c;!n[h]&&t<3&&(i("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+u+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),n[h]=!0,t++)}}return null==a[c]?o?null===a[c]?new p("The "+f+" `"+d+"` is marked as required in `"+u+"`, but its value is `null`."):new p("The "+f+" `"+d+"` is marked as required in `"+u+"`, but its value is `undefined`."):null:e(a,c,u,f,d)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function v(e){return y(function(n,r,t,o,i,a){var c=n[r];return g(c)!==e?new p("Invalid "+o+" `"+i+"` of type `"+b(c)+"` supplied to `"+t+"`, expected `"+e+"`.",{expectedType:e}):null})}function h(e,n,r,t,o){return new p((e||"React class")+": "+n+" type `"+r+"."+t+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function m(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(m);if(null===e||c(e))return!0;var n=function(e){var n=e&&(u&&e[u]||e["@@iterator"]);if("function"==typeof n)return n}(e);if(!n)return!1;var r,t=n.call(e);if(n!==e.entries){for(;!(r=t.next()).done;)if(!m(r.value))return!1}else for(;!(r=t.next()).done;){var o=r.value;if(o&&!m(o[1]))return!1}return!0;default:return!1}}function g(e){var n=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,n){return"symbol"===e||!!n&&("Symbol"===n["@@toStringTag"]||"function"==typeof Symbol&&n instanceof Symbol)}(n,e)?"symbol":n}function b(e){if(null==e)return""+e;var n=g(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function w(e){var n=b(e);switch(n){case"array":case"object":return"an "+n;case"boolean":case"date":case"regexp":return"a "+n;default:return n}}return p.prototype=Error.prototype,f.checkPropTypes=o,f.resetWarningCache=o.resetWarningCache,f.PropTypes=f,f},b}function P(){if(S)return x;S=1;var e=R();function n(){}function r(){}return r.resetWarningCache=n,x=function(){function t(n,r,t,o,i,a){if(a!==e){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function o(){return t}t.isRequired=t;var i={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:o,element:t,elementType:t,instanceOf:o,node:t,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:r,resetWarningCache:n};return i.PropTypes=i,i}}function D(){if(O)return a.exports;if(O=1,"production"!==process.env.NODE_ENV){var e=E();a.exports=I()(e.isElement,true)}else a.exports=P()();return a.exports}var L=o(D());function N(e,n){(null==n||n>e.length)&&(n=e.length);for(var r=0,t=Array(n);r<n;r++)t[r]=e[r];return t}function z(e,n,r){return n&&function(e,n){for(var r=0;r<n.length;r++){var t=n[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,V(t.key),t)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function $(e,n){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=W(e))||n){r&&(e=r);var t=0,o=function(){};return{s:o,n:function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){c=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}function _(e,n,r){return(n=V(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function A(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),r.push.apply(r,t)}return r}function M(e){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?A(Object(r),!0).forEach(function(n){_(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):A(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function B(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var t,o,i,a,c=[],l=!0,u=!1;try{if(i=(r=r.call(e)).next,0===n);else for(;!(l=(t=i.call(r)).done)&&(c.push(t.value),c.length!==n);l=!0);}catch(e){u=!0,o=e}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(e,n)||W(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(e){var n=function(e,n){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var t=r.call(e,n);if("object"!=typeof t)return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function W(e,n){if(e){if("string"==typeof e)return N(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?N(e,n):void 0}}var F={INITIALIZE:1,INITIALIZE_FLEXBOX:2,APPLY_SIZES:3,ERROR:4,TRANSFORMATIONS:5,MOVE_HANDLE_BAR:6},H=F=Object.freeze(F),q={UPDATE_SIZE:1},U=q=Object.freeze(q),Y=function(){return z(function e(n){!function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),this.containers={},this.containerRefs={},this.ldf=n,this.numberOfContainers=0,this.registeredContainers=0,this.layoutLoaded=!1,this.numberOfContainers=this.ldf.containers?Object.keys(this.ldf.containers).length:0,this.worker=null},[{key:"startWorker",value:function(){try{this.worker=new Worker(new URL("./Worker/LayoutWorker.js","undefined"==typeof document?require("url").pathToFileURL(__filename).href:t&&"SCRIPT"===t.tagName.toUpperCase()&&t.src||new URL("index.js",document.baseURI).href),{type:"module"}),this.worker.onmessage=this.handleWorkerMessage.bind(this),this.worker.onerror=function(e){return console.error("Worker error:",e)},this.sendToWorker(H.INITIALIZE,{ldf:this.ldf})}catch(e){console.error("Failed to create worker:",e)}}},{key:"sendToWorker",value:function(e,n){this.worker||this.startWorker(),this.worker.postMessage({code:e,args:n})}},{key:"registerContainer",value:function(e,n,r){e in this.containers||(this.registeredContainers+=1),this.containers[e]=n,this.containerRefs[e]=r,console.log("Registered container with id: ".concat(e," ")),this.registeredContainers!==this.numberOfContainers||this.layoutLoaded||(console.log("All containers registered, layout is ready."),this.sendToWorker(H.INITIALIZE_FLEXBOX))}},{key:"unregisterContainer",value:function(e){delete this.containers[e]}},{key:"handleRootResize",value:function(){if(this.layoutLoaded){var e={};for(var n in this.containerRefs)if(this.containerRefs.hasOwnProperty(n)){var r=this.containerRefs[n].getBoundingClientRect();e[n]={width:r.width,height:r.height}}this.sendToWorker(H.APPLY_SIZES,{sizes:e})}}},{key:"moveHandleBar",value:function(e){for(var n={},r=0,t=[e.parent,e.sibling1,e.sibling2];r<t.length;r++){var o=t[r],i=this.containerRefs[o].getBoundingClientRect();n[o]={width:i.width,height:i.height}}e.sizes=n,this.sendToWorker(H.MOVE_HANDLE_BAR,{metadata:e}),this.handleRootResize()}},{key:"applyTransformations",value:function(e,n){var r=this;requestAnimationFrame(function(){var t,o=$(e);try{for(o.s();!(t=o.n()).done;){var i=t.value;switch(i.type){case U.UPDATE_SIZE:r.containers[i.id].current.updateStyles(i.args.style);break;case U.REMOVE_NODE:break;default:console.warn("Unknown transformation was requested.")}}}catch(e){o.e(e)}finally{o.f()}n&&(r.layoutLoaded=!0)})}},{key:"handleWorkerMessage",value:function(e){var n;switch(e.data.type){case H.INITIALIZE_FLEXBOX:n=e.data.data,this.applyTransformations(n,!0);break;case H.TRANSFORMATIONS:n=e.data.data,this.applyTransformations(n,!1);break;case H.ERROR:console.error("Error from worker:",e.data)}}},{key:"destroy",value:function(){this.worker&&(this.worker.terminate(),this.worker=null)}}])}(),X=e.createContext(null);function Z(r){var t=r.layout,o=r.children,i=e.useMemo(function(){return new Y(t)},[t]);return e.useEffect(function(){return function(){i.destroy()}},[i]),n.jsx(X.Provider,{value:i,children:o})}function K(){var n=e.useContext(X);if(!n)throw new Error("useLayoutController must be used within a LayoutControllerProvider");return n}function J(e,n){void 0===n&&(n={});var r=n.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===r&&t.firstChild?t.insertBefore(o,t.firstChild):t.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}Z.propTypes={layout:L.object.isRequired,children:L.node.isRequired};J(".handleBarHorizontalContainer {\n position: relative;\n width: 100%;\n height: 1px;\n background-color: #414141;\n z-index: 1;\n}\n\n.handleBarHorizontal {\n position: absolute;\n top: 50%;\n height: 1px;\n left: 0;\n right: 0;\n transform: translateY(-50%);\n transition: all 0.2s ease;\n}\n\n.handleBarHorizontal:hover {\n background-color: #007acc;\n cursor: ns-resize;\n height: 5px;\n z-index: 10;\n}\n\n.handleBarHorizontalHover {\n background-color: #007acc;\n cursor: ns-resize;\n height: 5px;\n z-index: 10;\n}\n\n.handleBarVerticalContainer {\n position: relative;\n height: 100%;\n width: 1px;\n background-color: #414141;\n z-index: 1;\n}\n\n.handleBarVertical {\n position: absolute;\n top: 0;\n width: 1px;\n left: 50%;\n bottom: 0;\n transform: translateX(-50%);\n transition: all 0.3s ease;\n}\n\n.handleBarVertical:hover {\n background-color: #007acc;\n cursor: ew-resize;\n width: 5px;\n z-index: 10;\n}\n\n.handleBarVerticalHover {\n background-color: #007acc;\n cursor: ew-resize;\n width: 5px;\n z-index: 10;\n}");var G=function(r){var t=r.orientation,o=r.parent,i=r.sibling1,a=r.sibling2,c=K(),l=e.useRef(null),u=e.useRef(null),s=e.useRef(null),f=function(e){var n,r,s;e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",d),document.addEventListener("mouseup",p),"horizontal"===t?(n="clientY",r="height",s="handleBarHorizontalHover"):"vertical"===t&&(n="clientX",r="width",s="handleBarVerticalHover");for(var f,y,v=c.containerRefs[o],h=c.containerRefs[i],m=c.containerRefs[a],g=c.ldf.containers[o],b=0;b<g.children.length;b++)g.children[b].containerId===i?f=g.children[b].size:g.children[b].containerId===a&&(y=g.children[b].size);l.current={downValueY:e[n],hoverClass:s,downKey:n,propKey:r,parentSize:v.getBoundingClientRect()[r],parentRef:v,sibling1Ref:h,sibling2Ref:m,sibling1LayoutConfig:f,sibling2LayoutConfig:y,sibling1Size:h.getBoundingClientRect()[r],sibling2Size:m.getBoundingClientRect()[r]},u.current.classList.add(s)};var d=function(e){if(l.current){e.preventDefault(),e.stopPropagation();var n=l.current,r=e[n.downKey]-n.downValueY,t=n.sibling1Size+r,u=n.sibling2Size-r;clearTimeout(s.current),s.current=setTimeout(function(){var r,t,l;c.moveHandleBar({handle:(r=e,t=n.parentRef,l=t.getBoundingClientRect(),{x:r.clientX-l.left,y:r.clientY-l.top}),parent:o,sibling1:i,sibling2:a})},4);var f=Object.keys(n.sibling1LayoutConfig);if(!(f.includes("min")&&t<=n.sibling1LayoutConfig.min.value||f.includes("max")&&t>=n.sibling1LayoutConfig.max.value)){var d=Object.keys(n.sibling2LayoutConfig);if(!(d.includes("min")&&u<=n.sibling2LayoutConfig.min.value||d.includes("max")&&u>=n.sibling2LayoutConfig.max.value)){var p=n.sibling1LayoutConfig.initial.type,y=n.sibling2LayoutConfig.initial.type;if("fill"===p&&"fill"===y&&t>50&&u>50)return c.containerRefs[i].style[n.propKey]=t+"px",void(c.containerRefs[a].style[n.propKey]=u+"px");"fill"!==p&&(c.containerRefs[i].style[n.propKey]=t+"px"),"fill"!==y&&(c.containerRefs[a].style[n.propKey]=u+"px")}}}},p=function(e){e.preventDefault(),e.stopPropagation(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),clearTimeout(s.current),u.current&&l.current&&u.current.classList.remove(l.current.hoverClass),l.current=null};return e.useEffect(function(){return function(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),s.current&&(clearTimeout(s.current),s.current=null)}},[]),n.jsx(e.Fragment,{children:"horizontal"===t?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarHorizontalContainer",children:n.jsx("div",{ref:u,className:"handleBarHorizontal"})}):"vertical"===t?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarVerticalContainer",children:n.jsx("div",{ref:u,className:"handleBarVertical"})}):null})};G.propTypes={orientation:L.string,sibling1:L.string,sibling2:L.string,parent:L.string};J(".relative-container {\n position: relative;\n}\n\n.relative-container.hiding-horizontal {\n width: 0px !important;\n}\n\n.relative-container.hiding-vertical {\n height: 0px !important;\n}");var Q=e.createContext({});Q.displayName="ComponentRegistryContext";J(".lazyContainer {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n right: 0px;\n}");var ee=function(r){var t=r.content,o=e.useContext(Q),i=e.useMemo(function(){if(o&&t&&"component"in t&&t.component in o)return e.lazy(o[t.component])},[o,t]);return n.jsx("div",{className:"lazyContainer",children:n.jsx(e.Suspense,{fallback:n.jsx("div",{children:"Loading..."}),children:i&&n.jsx(i,{})})})};ee.propTypes={content:L.object};var ne=function(r){var t=r.node,o=K(),i=e.useRef(null),a=e.useRef(null),c=B(e.useState(null),2),l=c[0],u=c[1],s=e.useCallback(function(e){for(var r=[],t=0;t<e.children.length;t++){var i=e.children[t];if("container"===i.type){var a=o.ldf.containers[e.children[t].containerId];a.parent=e,r.push(n.jsx(ne,{meta:e.children[t],id:a.id,node:a},t))}else"handleBar"===i.type&&("horizontal"===e.orientation?r.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)):"vertical"===e.orientation&&r.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)))}return r},[o]),f=e.useRef({});return f.current={updateStyles:function(e){var n="hiding-"+a.current;for(var r in e)if("display"===r&&"none"===e[r]){if(i.current.classList.contains(n))return;i.current.classList.add(n)}else if("display"===r&&"flex"===e[r]){if(!i.current.classList.contains(n))return;i.current.classList.remove(n)}else i.current.style[r]=e[r]}},e.useLayoutEffect(function(){if(t&&o&&i.current){a.current=t.parent.orientation;var e=t.children&&t.children.length>0;return e?"horizontal"===t.orientation?(i.current.style.display="flex",i.current.style.flexDirection="row",i.current.style.width="100%"):"vertical"===t.orientation?(i.current.style.display="flex",i.current.style.flexDirection="column",i.current.style.height="100%"):console.warn("Unknown orientation:",t.orientation):t.background?i.current.style.background=t.background:i.current.style.background="transparent",u(e?s(t):n.jsx(ee,{content:t})),o.registerContainer(t.id,f,i.current),function(){o.unregisterContainer(t.id)}}},[t,o,s]),n.jsx("div",{ref:i,className:"relative-container",children:l})};ne.propTypes={node:L.object};var re=e.createContext(null),te=function(r){var t=r.children,o=B(e.useState({activeId:null,activeData:null,overId:null,overData:null,isDragging:!1}),2),i=o[0],a=o[1],c=B(e.useState(null),2),l=c[0],u=c[1],s=e.useCallback(function(e){var n,r,t,o;a({activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(t=null===(o=e.active)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.current)&&void 0!==t?t:null,overId:null,overData:null,isDragging:!0})},[]),f=e.useCallback(function(e){a(function(n){var r,t,o,i;return M(M({},n),{},{overId:null!==(r=null===(t=e.over)||void 0===t?void 0:t.id)&&void 0!==r?r:null,overData:null!==(o=null===(i=e.over)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.current)&&void 0!==o?o:null})})},[]),d=e.useCallback(function(e){var n,r,t,o,i,c,l,s;u({activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(t=null===(o=e.active)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.current)&&void 0!==t?t:null,overId:null!==(i=null===(c=e.over)||void 0===c?void 0:c.id)&&void 0!==i?i:null,overData:null!==(l=null===(s=e.over)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.current)&&void 0!==l?l:null}),a({activeId:null,activeData:null,overId:null,overData:null,isDragging:!1})},[]),p=e.useMemo(function(){return{dragState:i,drop:l,handleDragStart:s,handleDragOver:f,clearDrag:d}},[i,l,s,f,d]);return n.jsx(re.Provider,{value:p,children:t})},oe=function(){var n=e.useContext(re);if(!n)throw new Error("useDragState must be used inside DragProvider");return n};J(".root-container {\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.relative-container {\n position: relative;\n display: flex;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.drag-overlay {\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n}");var ie=function(){var t,o=K(),i=oe(),a=i.dragState,c=i.handleDragStart,l=i.handleDragOver,u=i.clearDrag,s=e.useRef(null),f=e.useRef(null),d=e.useRef(!1),p=e.useRef({});p.current={};var y=B(e.useState(null),2),v=y[0],h=y[1],m=e.useCallback(function(e){for(var r=[],t=0;t<e.children.length;t++){var i=e.children[t];if("container"===i.type){var a=o.ldf.containers[e.children[t].containerId];a.parent=e,r.push(n.jsx(ne,{meta:e.children[t],id:a.id,node:a},t))}else"handleBar"===i.type&&("horizontal"===e.orientation?r.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)):"vertical"===e.orientation&&r.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},t)))}return r},[o]);e.useLayoutEffect(function(){if(o){var e=o.ldf.containers[o.ldf.layoutRoot],n=e.children&&e.children.length>0;o.registerContainer(e.id,p,s.current),n&&("horizontal"===e.orientation?s.current.style.flexDirection="row":"vertical"===e.orientation&&(s.current.style.flexDirection="column")),h(n?m(e):null);var r=new ResizeObserver(function(e){d.current||(d.current=!0);var n,r=$(e);try{var t=function(){var e=n.value.contentRect,r=e.width,t=e.height;clearTimeout(f.current),f.current=setTimeout(function(){d.current=!1,o.handleRootResize(r,t)},1)};for(r.s();!(n=r.n()).done;)t()}catch(e){r.e(e)}finally{r.f()}});return r.observe(s.current),function(){o.unregisterContainer(o.ldf.layoutRoot),r.disconnect()}}},[o]);var g=r.useSensors(r.useSensor(r.PointerSensor,{activationConstraint:{distance:8}})),b=B(e.useState({left:0,top:0}),2),w=b[0],x=b[1];return e.useEffect(function(){if(a.isDragging){var e=function(e){x({left:e.clientX,top:e.clientY})};return window.addEventListener("pointermove",e),function(){window.removeEventListener("pointermove",e)}}},[a.isDragging]),n.jsxs(r.DndContext,{sensors:g,onDragStart:c,onDragOver:l,onDragEnd:u,onDragCancel:u,children:[n.jsx("div",{className:"root-container",children:n.jsx("div",{ref:s,className:"relative-container",children:v})}),a.isDragging&&n.jsx("div",{className:"drag-overlay",style:w,children:null==a||null===(t=a.activeData)||void 0===t?void 0:t.preview})]})};J("");var ae=function(e){var r=e.ldf,t=e.registry;return n.jsx(te,{children:n.jsx(Z,{layout:r,children:n.jsx(Q.Provider,{value:t,children:n.jsx(ie,{})})})})};ae.propTypes={ldf:L.object,registry:L.object},exports.LayoutManager=ae,exports.useDragState=oe;
15
15
  //# sourceMappingURL=index.js.map