ui-layout-manager-dev 0.0.25-dev → 0.0.27-dev

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 k(){if(p)return d;p=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;return d=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={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))n.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var u=0;u<a.length;u++)t.call(i,a[u])&&(s[a[u]]=i[a[u]])}}return s},d}function R(){if(y)return v;y=1;return v="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function T(){return b?h:(b=1,h=Function.call.bind(Object.prototype.hasOwnProperty))}function I(){if(g)return m;g=1;var e=function(){};if("production"!==process.env.NODE_ENV){var n=R(),t={},r=T();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,s,l){if("production"!==process.env.NODE_ENV)for(var c in o)if(r(o,c)){var u;try{if("function"!=typeof o[c]){var f=Error((s||"React class")+": "+a+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}u=o[c](i,c,s,a,null,n)}catch(e){u=e}if(!u||u instanceof Error||e((s||"React class")+": type specification of "+a+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in t)){t[u.message]=!0;var d=l?l():"";e("Failed "+a+" type: "+u.message+(null!=d?d:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(t={})},m=o}function N(){if(w)return x;w=1;var e=O(),n=k(),t=R(),r=T(),o=I(),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){}}),x=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",f={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:v(a),arrayOf:function(e){return v(function(n,r,o,i,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=n[r];if(!Array.isArray(s))return new p("Invalid "+i+" `"+a+"` of type `"+m(s)+"` supplied to `"+o+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,o,i,a+"["+l+"]",t);if(c instanceof Error)return c}return null})},element:v(function(e,n,t,r,o){var i=e[n];return s(i)?null:new p("Invalid "+r+" `"+o+"` of type `"+m(i)+"` supplied to `"+t+"`, expected a single ReactElement.")}),elementType:v(function(n,t,r,o,i){var a=n[t];return e.isValidElementType(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+m(a)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return v(function(n,t,r,o,i){if(!(n[t]instanceof e)){var a=e.name||u;return new p("Invalid "+o+" `"+i+"` of type `"+(((s=n[t]).constructor&&s.constructor.name?s.constructor.name:u)+"` supplied to `")+r+"`, expected instance of `"+a+"`.")}var s;return null})},node:v(function(e,n,t,r,o){return b(e[n])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}),objectOf:function(e){return v(function(n,o,i,a,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=n[o],c=m(l);if("object"!==c)return new p("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+i+"`, expected an object.");for(var u in l)if(r(l,u)){var f=e(l,u,i,a,s+"."+u,t);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 v(function(n,t,r,o,i){for(var a=n[t],s=0;s<e.length;s++)if(d(a,e[s]))return null;var l=JSON.stringify(e,function(e,n){return"symbol"===g(n)?String(n):n});return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+r+"`, 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 "+x(o)+" at index "+n+"."),a}return v(function(n,o,i,a,s){for(var l=[],c=0;c<e.length;c++){var u=(0,e[c])(n,o,i,a,s,t);if(null==u)return null;u.data&&r(u.data,"expectedType")&&l.push(u.data.expectedType)}return new p("Invalid "+a+" `"+s+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return v(function(n,r,o,i,a){var s=n[r],l=m(s);if("object"!==l)return new p("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+o+"`, expected `object`.");for(var c in e){var u=e[c];if("function"!=typeof u)return h(o,i,a,c,g(u));var f=u(s,c,o,i,a+"."+c,t);if(f)return f}return null})},exact:function(e){return v(function(o,i,a,s,l){var c=o[i],u=m(c);if("object"!==u)return new p("Invalid "+s+" `"+l+"` of type `"+u+"` supplied to `"+a+"`, expected `object`.");var f=n({},o[i],e);for(var d in f){var v=e[d];if(r(e,d)&&"function"!=typeof v)return h(a,s,l,d,g(v));if(!v)return new p("Invalid "+s+" `"+l+"` key `"+d+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=v(c,d,a,s,l+"."+d,t);if(y)return y}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 v(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function o(o,a,s,c,f,d,v){if(c=c||u,d=d||s,v!==t){if(l){var y=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 y.name="Invariant Violation",y}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=c+":"+s;!n[h]&&r<3&&(i("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. 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,r++)}}return null==a[s]?o?null===a[s]?new p("The "+f+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new p("The "+f+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,s,c,f,d)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function y(e){return v(function(n,t,r,o,i,a){var s=n[t];return m(s)!==e?new p("Invalid "+o+" `"+i+"` of type `"+g(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null})}function h(e,n,t,r,o){return new p((e||"React class")+": "+n+" type `"+t+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function b(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(b);if(null===e||s(e))return!0;var n=function(e){var n=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof n)return n}(e);if(!n)return!1;var t,r=n.call(e);if(n!==e.entries){for(;!(t=r.next()).done;)if(!b(t.value))return!1}else for(;!(t=r.next()).done;){var o=t.value;if(o&&!b(o[1]))return!1}return!0;default:return!1}}function m(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 g(e){if(null==e)return""+e;var n=m(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function x(e){var n=g(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},x}function P(){if(j)return S;j=1;var e=R();function n(){}function t(){}return t.resetWarningCache=n,S=function(){function r(n,t,r,o,i,a){if(a!==e){var s=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 s.name="Invariant Violation",s}}function o(){return r}r.isRequired=r;var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:t,resetWarningCache:n};return i.PropTypes=i,i}}function L(){if(C)return s.exports;if(C=1,"production"!==process.env.NODE_ENV){var e=O();s.exports=N()(e.isElement,true)}else s.exports=P()();return s.exports}var z=i(L());function D(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function A(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function $(e,n,t){return n&&function(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,V(r.key),r)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=F(e))||n){t&&(e=t);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(s)throw i}}}}function B(e,n,t){return(n=V(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function M(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(t=t.call(e)).next,0===n);else for(;!(l=(r=i.call(t)).done)&&(s.push(r.value),s.length!==n);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,n)||F(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 t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function F(e,n){if(e){if("string"==typeof e)return D(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?D(e,n):void 0}}var W={INITIALIZE:1,INITIALIZE_FLEXBOX:2,APPLY_SIZES:3,ERROR:4,TRANSFORMATIONS:5,MOVE_HANDLE_BAR:6,INVOKE_ACTION:7},H=W=Object.freeze(W),U={UPDATE_SIZE:1},q=U=Object.freeze(U),Y=function(){return $(function e(n){A(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:o&&"SCRIPT"===o.tagName.toUpperCase()&&o.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,t){e in this.containers||(this.registeredContainers+=1),this.containers[e]=n,this.containerRefs[e]=t,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 t=this.containerRefs[n].getBoundingClientRect();e[n]={width:t.width,height:t.height}}this.sendToWorker(H.APPLY_SIZES,{sizes:e})}}},{key:"moveHandleBar",value:function(e){for(var n={},t=0,r=[e.parent,e.sibling1,e.sibling2];t<r.length;t++){var o=r[t],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 t=this;requestAnimationFrame(function(){var r,o=_(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;switch(i.type){case q.UPDATE_SIZE:t.containers[i.id].current.updateStyles(i.args.style);break;case q.REMOVE_NODE:break;default:console.warn("Unknown transformation was requested.")}}}catch(e){o.e(e)}finally{o.f()}n&&(t.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:"invokeAction",value:function(e){var n=e.id,t=e.action,r=e.args;this.sendToWorker(H.INVOKE_ACTION,{id:n,action:t,args:r})}},{key:"destroy",value:function(){this.worker&&(this.worker.terminate(),this.worker=null)}}])}(),X=e.createContext(null);function K(t){var r=t.layout,o=t.children,i=e.useMemo(function(){return new Y(r)},[r]);return e.useEffect(function(){return function(){i.destroy()}},[i]),n.jsx(X.Provider,{value:i,children:o})}function Z(){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 t=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}K.propTypes={layout:z.object.isRequired,children:z.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(t){var r=t.orientation,o=t.parent,i=t.sibling1,a=t.sibling2,s=Z(),l=e.useRef(null),c=e.useRef(null),u=e.useRef(null),f=function(e){var n,t,u;e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",d),document.addEventListener("mouseup",p),"horizontal"===r?(n="clientY",t="height",u="handleBarHorizontalHover"):"vertical"===r&&(n="clientX",t="width",u="handleBarVerticalHover");for(var f,v,y=s.containerRefs[o],h=s.containerRefs[i],b=s.containerRefs[a],m=s.ldf.containers[o],g=0;g<m.children.length;g++)m.children[g].containerId===i?f=m.children[g].size:m.children[g].containerId===a&&(v=m.children[g].size);l.current={downValueY:e[n],hoverClass:u,downKey:n,propKey:t,parentSize:y.getBoundingClientRect()[t],parentRef:y,sibling1Ref:h,sibling2Ref:b,sibling1LayoutConfig:f,sibling2LayoutConfig:v,sibling1Size:h.getBoundingClientRect()[t],sibling2Size:b.getBoundingClientRect()[t]},c.current.classList.add(u)};var d=function(e){if(l.current){e.preventDefault(),e.stopPropagation();var n=l.current,t=e[n.downKey]-n.downValueY,r=n.sibling1Size+t,c=n.sibling2Size-t;clearTimeout(u.current),u.current=setTimeout(function(){var t,r,l;s.moveHandleBar({handle:(t=e,r=n.parentRef,l=r.getBoundingClientRect(),{x:t.clientX-l.left,y:t.clientY-l.top}),parent:o,sibling1:i,sibling2:a})},4);var f=Object.keys(n.sibling1LayoutConfig);if(!(f.includes("min")&&r<=n.sibling1LayoutConfig.min.value||f.includes("max")&&r>=n.sibling1LayoutConfig.max.value)){var d=Object.keys(n.sibling2LayoutConfig);if(!(d.includes("min")&&c<=n.sibling2LayoutConfig.min.value||d.includes("max")&&c>=n.sibling2LayoutConfig.max.value||r<50||c<50)){var p=n.sibling1LayoutConfig.initial.type,v=n.sibling2LayoutConfig.initial.type;if("fill"===p&&"fill"===v)return s.containerRefs[i].style[n.propKey]=r+"px",void(s.containerRefs[a].style[n.propKey]=c+"px");"fill"!==p&&(s.containerRefs[i].style[n.propKey]=r+"px"),"fill"!==v&&(s.containerRefs[a].style[n.propKey]=c+"px")}}}},p=function(e){e.preventDefault(),e.stopPropagation(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),clearTimeout(u.current),c.current&&l.current&&c.current.classList.remove(l.current.hoverClass),l.current=null};return e.useEffect(function(){return function(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),u.current&&(clearTimeout(u.current),u.current=null)}},[]),n.jsx(e.Fragment,{children:"horizontal"===r?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarHorizontalContainer",children:n.jsx("div",{ref:c,className:"handleBarHorizontal"})}):"vertical"===r?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarVerticalContainer",children:n.jsx("div",{ref:c,className:"handleBarVertical"})}):null})};G.propTypes={orientation:z.string,sibling1:z.string,sibling2:z.string,parent:z.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(".titleContainer {\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 1px;\n display: flex;\n align-items: center;\n color: #bbbbbb;\n justify-content: space-between;\n background: #222425;\n}\n\n.titleContainer > .title {\n padding-left: 30px;\n font-size: 11px;\n}\n\n.titleContainer > .close {\n padding-right: 15px;\n font-size: 11px;\n cursor: pointer;\n}");var ee=["color","size","title","className"];function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ne.apply(null,arguments)}var te=e.forwardRef(function(n,t){var r=n.color,o=void 0===r?"currentColor":r,i=n.size,a=void 0===i?"1em":i,s=n.title,l=void 0===s?null:s,c=n.className,u=void 0===c?"":c,f=function(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==n.indexOf(r))continue;t[r]=e[r]}return t}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],-1===n.indexOf(t)&&{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(n,ee);return e.createElement("svg",ne({ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:o,className:["bi","bi-x-lg",u].filter(Boolean).join(" ")},f),l?e.createElement("title",null,l):null,e.createElement("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"}))});te.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var re=function(e){var t,r,o=e.node,i=Z();return n.jsxs("div",{className:"titleContainer",children:[n.jsx("div",{className:"title",children:null==o||null===(t=o.menuBar)||void 0===t?void 0:t.title}),(null==o||null===(r=o.menuBar)||void 0===r?void 0:r.showClose)&&n.jsx("div",{onClick:function(){var e;i.invokeAction({id:null==o||null===(e=o.menuBar)||void 0===e?void 0:e.closeContainerId,action:"close",args:{}})},className:"close",children:n.jsx(te,{})})]})};re.propTypes={node:z.object};J(".container-tabs-row {\n position: relative;\n width: 100%;\n height: 100%;\n background: #222425;\n display: flex;\n justify-content: space-between;\n}\n\n.container-tabs-row > .container-tabs {\n display: flex;\n flex-direction: row;\n gap: 5px;\n margin-left: 20px;\n}\n\n.container-tabs-row > .container-tabs > .container-tab {\n display: flex;\n align-items: center;\n cursor: pointer;\n padding: 0 10px;\n height: 28px;\n font-size: 13px;\n color: #bbbbbb;\n}\n\n.container-tabs-row > .container-close {\n display: flex;\n align-items: center;\n cursor: pointer;\n color: white;\n font-size: 11px;\n margin-right: 10px;\n}");var oe=function(e){var t,r,o=e.node,i=e.onTabClick,a=Z();return n.jsxs("div",{className:"container-tabs-row",children:[n.jsx("div",{className:"container-tabs",children:null==o||null===(t=o.tabsBar)||void 0===t||null===(t=t.tabs)||void 0===t?void 0:t.map(function(e,t){return n.jsx("div",{style:{borderBottom:e.selected?"solid 1px white":"none"},onClick:function(n){return i(e)},className:"container-tab",children:e.name},e.name+String(t))})}),(null==o||null===(r=o.tabsBar)||void 0===r?void 0:r.showClose)&&n.jsx("div",{className:"container-close",children:n.jsx(te,{onClick:function(){var e;a.invokeAction({id:null==o||null===(e=o.tabsBar)||void 0===e?void 0:e.closeContainerId,action:"close",args:{}})}})})]})};oe.propTypes={node:z.object,onTabClick:z.func};J("/** \nTODO: I agree that it is convoluted to use absolute, then relative and then absolute.\nHowever, the reason I am doing it is, it makes the layout of the monaco editor trivial\nand avoids resize observer loops when the container sizes change. I haven't thought\nabout this enough and I will revisit it later.\n*/\n.absoluteContainer {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n right: 0px;\n}\n\n.contentContainer {\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.menuContainer {\n position: absolute;\n top: 0px;\n height: 35px;\n left: 0px;\n right: 0px;\n}\n\n.tabsContainer {\n position: absolute;\n top: 0px;\n height: 35px;\n left: 0px;\n right: 0px;\n}\n\n.lazycontainer {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n right: 0px;\n}");var ie=function(t){var r=t.node,o=e.useContext(Q),i=M(e.useState(!1),2),a=i[0],s=i[1],l=M(e.useState(!1),2),c=l[0],u=l[1],f=M(e.useState(0),2),d=f[0],p=f[1],v=M(e.useState(0),2),y=v[0],h=v[1],b=M(e.useState(""),2),m=b[0],g=b[1],x=e.useMemo(function(){if(o&&m in o)return e.lazy(o[m])},[o,m]);e.useEffect(function(){var e=0,n=0;"menuBar"in r&&(s(!0),n+=35,e+=35),"tabsBar"in r?(u(!0),e+=35,w(r.tabsBar.tabs[0])):g(r.component),p(e),h(n)},[r]);var w=function(e){r.tabsBar.tabs.forEach(function(n){n===e?(n.selected=!0,g(n.component)):n.selected=!1})};return n.jsx("div",{className:"absoluteContainer",children:n.jsxs("div",{className:"contentContainer",children:[a&&n.jsx("div",{className:"menuContainer",children:n.jsx(re,{node:r})}),c&&n.jsx("div",{className:"tabsContainer",style:{top:"".concat(y,"px")},children:n.jsx(oe,{node:r,onTabClick:w})}),n.jsx("div",{className:"lazycontainer",style:{top:"".concat(d,"px")},children:n.jsx(e.Suspense,{fallback:n.jsx("div",{children:"Loading..."}),children:x&&n.jsx(x,{})})})]})})};ie.propTypes={content:z.object};var ae=function(t){var r=t.node,o=Z(),i=e.useRef(null),a=e.useRef(null),s=M(e.useState(null),2),l=s[0],c=s[1],u=e.useCallback(function(e){for(var t=[],r=0;r<e.children.length;r++){var i=e.children[r];if("container"===i.type){var a=o.ldf.containers[e.children[r].containerId];a.parent=e,t.push(n.jsx(ae,{meta:e.children[r],id:a.id,node:a},r))}else"handleBar"===i.type&&("horizontal"===e.orientation?t.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)):"vertical"===e.orientation&&t.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)))}return t},[o]),f=e.useRef({});return f.current={updateStyles:function(e){var n="hiding-"+a.current;for(var t in e)if("display"===t&&"none"===e[t]){if(i.current.classList.contains(n))return;i.current.classList.add(n)}else if("display"===t&&"flex"===e[t]){if(!i.current.classList.contains(n))return;i.current.classList.remove(n)}else i.current.style[t]=e[t]}},e.useLayoutEffect(function(){if(r&&o&&i.current){a.current=r.parent.orientation;var e=r.children&&r.children.length>0;return e?"horizontal"===r.orientation?(i.current.style.display="flex",i.current.style.flexDirection="row",i.current.style.width="100%"):"vertical"===r.orientation?(i.current.style.display="flex",i.current.style.flexDirection="column",i.current.style.height="100%"):console.warn("Unknown orientation:",r.orientation):r.background?i.current.style.background=r.background:i.current.style.background="transparent",c(e?u(r):n.jsx(ie,{node:r})),o.registerContainer(r.id,f,i.current),function(){o.unregisterContainer(r.id)}}},[r,o,u]),n.jsx("div",{ref:i,className:"relative-container",children:l})};ae.propTypes={node:z.object};var se=function(){return $(function e(){A(this,e),this.subscribers=new Map},[{key:"subscribe",value:function(e,n){var t=this;this.subscribers.has(e)||this.subscribers.set(e,new Set);var r=this.subscribers.get(e);r.add(n);return function(){r.delete(n),0===r.size&&t.subscribers.delete(e)}}},{key:"publish",value:function(e){var n=this.subscribers.get(e.type);if(n){var t,r=_(n);try{for(r.s();!(t=r.n()).done;){(0,t.value)(e)}}catch(e){r.e(e)}finally{r.f()}}}}])}(),le=e.createContext(null);function ce(){var n=e.useContext(le);if(!n)throw new Error("useLayoutPublisher must be used within LayoutEventProvider");return n.publish.bind(n)}var ue=$(function e(n){var t=this,r=n.publish;A(this,e),B(this,"resetDragState",function(){t.dragState={activeId:null,activeData:null,overId:null,overData:null,isDragging:!1}}),B(this,"onDragStart",function(e){var n,r,o,i;t.dragState={activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(o=null===(i=e.active)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.current)&&void 0!==o?o:null,overId:null,overData:null,isDragging:!0}}),B(this,"onDragOver",function(e){var n,r,o,i;t.dragState.overId=null!==(n=null===(r=e.over)||void 0===r?void 0:r.id)&&void 0!==n?n:null,t.dragState.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}),B(this,"onDragEnd",function(e){var n,r,o,i,a,s,l,c;t.publish({type:"drag:drop",payload:{activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(o=null===(i=e.active)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.current)&&void 0!==o?o:null,overId:null!==(a=null===(s=e.over)||void 0===s?void 0:s.id)&&void 0!==a?a:null,overData:null!==(l=null===(c=e.over)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.current)&&void 0!==l?l:null},source:"drag-provider"}),t.resetDragState()}),B(this,"onDragCancel",function(e){t.resetDragState()}),B(this,"isDragging",function(){return t.dragState.isDragging}),B(this,"getDragPreview",function(){var e;return null===(e=t.dragState)||void 0===e||null===(e=e.activeData)||void 0===e?void 0:e.preview}),this.publish=r,this.resetDragState()});J('.root-container {\n width: 100%;\n height: 100%;\n overflow: hidden;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\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 fe=function(){var r,o=Z(),i=(r=ce(),e.useMemo(function(){return new ue({publish:r})},[r])),a=e.useRef(null),s=e.useRef(null),l=e.useRef(!1),c=e.useRef({});c.current={};var u=M(e.useState(null),2),f=u[0],d=u[1],p=e.useCallback(function(e){for(var t=[],r=0;r<e.children.length;r++){var i=e.children[r];if("container"===i.type){var a=o.ldf.containers[e.children[r].containerId];a.parent=e,t.push(n.jsx(ae,{meta:e.children[r],id:a.id,node:a},r))}else"handleBar"===i.type&&("horizontal"===e.orientation?t.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)):"vertical"===e.orientation&&t.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)))}return t},[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,c,a.current),n&&("horizontal"===e.orientation?a.current.style.flexDirection="row":"vertical"===e.orientation&&(a.current.style.flexDirection="column")),d(n?p(e):null);var t=new ResizeObserver(function(e){l.current||(l.current=!0);var n,t=_(e);try{var r=function(){var e=n.value.contentRect,t=e.width,r=e.height;clearTimeout(s.current),s.current=setTimeout(function(){l.current=!1,o.handleRootResize(t,r)},1)};for(t.s();!(n=t.n()).done;)r()}catch(e){t.e(e)}finally{t.f()}});return t.observe(a.current),function(){o.unregisterContainer(o.ldf.layoutRoot),t.disconnect()}}},[o]);var v=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:8}})),y=M(e.useState({left:0,top:0}),2),h=y[0],b=y[1];return e.useEffect(function(){if(i.isDragging()){var e=function(e){b({left:e.clientX,top:e.clientY})};return window.addEventListener("pointermove",e),function(){window.removeEventListener("pointermove",e)}}},[i.isDragging()]),n.jsxs(t.DndContext,{sensors:v,collisionDetection:t.closestCenter,onDragStart:i.onDragStart,onDragOver:i.onDragOver,onDragEnd:i.onDragEnd,onDragCancel:i.onDragCancel,children:[n.jsx("div",{className:"root-container",children:n.jsx("div",{ref:a,className:"relative-container",children:f})}),i.isDragging()&&n.jsx("div",{className:"drag-overlay",style:h,children:i.getDragPreview()})]})},de=e.createContext(null);function pe(t){var o=t.children,i=M(e.useState(null),2),a=i[0],s=i[1],l=e.useCallback(function(e){var n=function(){s(null)},t="modal-".concat(Date.now());return s({id:t,title:e.title,render:e.render,close:n}),{id:t,close:n}},[]),c=e.useCallback(function(){s(null)},[]),u=e.useMemo(function(){return{openModal:l,closeModal:c}},[l,c]);return n.jsxs(de.Provider,{value:u,children:[o,r.createPortal(n.jsx(n.Fragment,{children:a&&n.jsx(e.Fragment,{children:n.jsx("div",{className:"modal-backdrop",onClick:a.close,children:n.jsxs("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[n.jsxs("div",{className:"modal-header",children:[n.jsx("span",{className:"title",children:a.title}),n.jsx(te,{className:"close-button",onClick:a.close})]}),n.jsx("div",{className:"modal-body",children:a.render({close:a.close})})]})})},a.id)}),document.body)]})}J('.modal-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n}\n\n.modal-content {\n background-color: #333333;\n border-radius: 5px;\n display: flex;\n flex-direction: column;\n max-width: 500px;\n max-height: 500px;\n scrollbar-gutter: stable;\n scrollbar-color: rgba(71, 71, 71, 0.4) #252526;\n scrollbar-width: thin;\n}\n\n.modal-header {\n display: flex;\n justify-content: space-between;\n height: 25px;\n border-bottom: solid 1px rgb(85, 85, 85);\n padding: 10px 20px;\n align-items: center;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n}\n\n.modal-header > .title {\n color: rgb(180, 180, 180);\n}\n\n.modal-header > .close-button {\n cursor: pointer;\n color: rgb(180, 180, 180);\n}\n\n.modal-header > .close-button:hover {\n color: white;\n}\n\n.modal-body {\n flex: 1;\n overflow: auto;\n padding: 10px;\n}');var ve=function(e){var t=e.ldf,r=e.registry;return n.jsx(K,{layout:t,children:n.jsx(Q.Provider,{value:r,children:n.jsx(pe,{children:n.jsx(fe,{})})})})};ve.propTypes={ldf:z.object,registry:z.object},exports.LayoutEventProvider=function(t){var r=t.children,o=e.useMemo(function(){return new se},[]);return n.jsx(le.Provider,{value:o,children:r})},exports.LayoutManager=ve,exports.useLayoutEventPublisher=ce,exports.useLayoutEventSubscription=function(n,t){var r=e.useContext(le),o=e.useRef(t);o.current=t,e.useEffect(function(){if(!r)throw new Error("useLayoutSubscription must be used within LayoutEventProvider");return r.subscribe(n,function(e){o.current(e)})},[r,n])},exports.useModalManager=function(){var n=e.useContext(de);if(!n)throw new Error("useModalManager must be used inside ModalProvider");return n};
14
+ */function k(){if(p)return d;p=1;var e=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,t=Object.prototype.propertyIsEnumerable;return d=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={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map(function(e){return n[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(r,o){for(var i,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(r),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))n.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var u=0;u<a.length;u++)t.call(i,a[u])&&(s[a[u]]=i[a[u]])}}return s},d}function R(){if(y)return v;y=1;return v="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function T(){return b?h:(b=1,h=Function.call.bind(Object.prototype.hasOwnProperty))}function I(){if(g)return m;g=1;var e=function(){};if("production"!==process.env.NODE_ENV){var n=R(),t={},r=T();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,s,l){if("production"!==process.env.NODE_ENV)for(var c in o)if(r(o,c)){var u;try{if("function"!=typeof o[c]){var f=Error((s||"React class")+": "+a+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}u=o[c](i,c,s,a,null,n)}catch(e){u=e}if(!u||u instanceof Error||e((s||"React class")+": type specification of "+a+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in t)){t[u.message]=!0;var d=l?l():"";e("Failed "+a+" type: "+u.message+(null!=d?d:""))}}}return o.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(t={})},m=o}function N(){if(w)return x;w=1;var e=O(),n=k(),t=R(),r=T(),o=I(),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){}}),x=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",f={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:v(a),arrayOf:function(e){return v(function(n,r,o,i,a){if("function"!=typeof e)return new p("Property `"+a+"` of component `"+o+"` has invalid PropType notation inside arrayOf.");var s=n[r];if(!Array.isArray(s))return new p("Invalid "+i+" `"+a+"` of type `"+m(s)+"` supplied to `"+o+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,o,i,a+"["+l+"]",t);if(c instanceof Error)return c}return null})},element:v(function(e,n,t,r,o){var i=e[n];return s(i)?null:new p("Invalid "+r+" `"+o+"` of type `"+m(i)+"` supplied to `"+t+"`, expected a single ReactElement.")}),elementType:v(function(n,t,r,o,i){var a=n[t];return e.isValidElementType(a)?null:new p("Invalid "+o+" `"+i+"` of type `"+m(a)+"` supplied to `"+r+"`, expected a single ReactElement type.")}),instanceOf:function(e){return v(function(n,t,r,o,i){if(!(n[t]instanceof e)){var a=e.name||u;return new p("Invalid "+o+" `"+i+"` of type `"+(((s=n[t]).constructor&&s.constructor.name?s.constructor.name:u)+"` supplied to `")+r+"`, expected instance of `"+a+"`.")}var s;return null})},node:v(function(e,n,t,r,o){return b(e[n])?null:new p("Invalid "+r+" `"+o+"` supplied to `"+t+"`, expected a ReactNode.")}),objectOf:function(e){return v(function(n,o,i,a,s){if("function"!=typeof e)return new p("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=n[o],c=m(l);if("object"!==c)return new p("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+i+"`, expected an object.");for(var u in l)if(r(l,u)){var f=e(l,u,i,a,s+"."+u,t);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 v(function(n,t,r,o,i){for(var a=n[t],s=0;s<e.length;s++)if(d(a,e[s]))return null;var l=JSON.stringify(e,function(e,n){return"symbol"===g(n)?String(n):n});return new p("Invalid "+o+" `"+i+"` of value `"+String(a)+"` supplied to `"+r+"`, 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 "+x(o)+" at index "+n+"."),a}return v(function(n,o,i,a,s){for(var l=[],c=0;c<e.length;c++){var u=(0,e[c])(n,o,i,a,s,t);if(null==u)return null;u.data&&r(u.data,"expectedType")&&l.push(u.data.expectedType)}return new p("Invalid "+a+" `"+s+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return v(function(n,r,o,i,a){var s=n[r],l=m(s);if("object"!==l)return new p("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+o+"`, expected `object`.");for(var c in e){var u=e[c];if("function"!=typeof u)return h(o,i,a,c,g(u));var f=u(s,c,o,i,a+"."+c,t);if(f)return f}return null})},exact:function(e){return v(function(o,i,a,s,l){var c=o[i],u=m(c);if("object"!==u)return new p("Invalid "+s+" `"+l+"` of type `"+u+"` supplied to `"+a+"`, expected `object`.");var f=n({},o[i],e);for(var d in f){var v=e[d];if(r(e,d)&&"function"!=typeof v)return h(a,s,l,d,g(v));if(!v)return new p("Invalid "+s+" `"+l+"` key `"+d+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(o[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=v(c,d,a,s,l+"."+d,t);if(y)return y}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 v(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function o(o,a,s,c,f,d,v){if(c=c||u,d=d||s,v!==t){if(l){var y=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 y.name="Invariant Violation",y}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var h=c+":"+s;!n[h]&&r<3&&(i("You are manually calling a React.PropTypes validation function for the `"+d+"` prop on `"+c+"`. 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,r++)}}return null==a[s]?o?null===a[s]?new p("The "+f+" `"+d+"` is marked as required in `"+c+"`, but its value is `null`."):new p("The "+f+" `"+d+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,s,c,f,d)}var a=o.bind(null,!1);return a.isRequired=o.bind(null,!0),a}function y(e){return v(function(n,t,r,o,i,a){var s=n[t];return m(s)!==e?new p("Invalid "+o+" `"+i+"` of type `"+g(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null})}function h(e,n,t,r,o){return new p((e||"React class")+": "+n+" type `"+t+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function b(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(b);if(null===e||s(e))return!0;var n=function(e){var n=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof n)return n}(e);if(!n)return!1;var t,r=n.call(e);if(n!==e.entries){for(;!(t=r.next()).done;)if(!b(t.value))return!1}else for(;!(t=r.next()).done;){var o=t.value;if(o&&!b(o[1]))return!1}return!0;default:return!1}}function m(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 g(e){if(null==e)return""+e;var n=m(e);if("object"===n){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return n}function x(e){var n=g(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},x}function P(){if(j)return S;j=1;var e=R();function n(){}function t(){}return t.resetWarningCache=n,S=function(){function r(n,t,r,o,i,a){if(a!==e){var s=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 s.name="Invariant Violation",s}}function o(){return r}r.isRequired=r;var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:t,resetWarningCache:n};return i.PropTypes=i,i}}function L(){if(C)return s.exports;if(C=1,"production"!==process.env.NODE_ENV){var e=O();s.exports=N()(e.isElement,true)}else s.exports=P()();return s.exports}var z=i(L());function D(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function A(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function $(e,n,t){return n&&function(e,n){for(var t=0;t<n.length;t++){var r=n[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,V(r.key),r)}}(e.prototype,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function _(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=F(e))||n){t&&(e=t);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},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,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(s)throw i}}}}function B(e,n,t){return(n=V(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function M(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(t=t.call(e)).next,0===n);else for(;!(l=(r=i.call(t)).done)&&(s.push(r.value),s.length!==n);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}(e,n)||F(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 t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n);if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==typeof n?n:n+""}function F(e,n){if(e){if("string"==typeof e)return D(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?D(e,n):void 0}}var W={INITIALIZE:1,INITIALIZE_FLEXBOX:2,APPLY_SIZES:3,ERROR:4,TRANSFORMATIONS:5,MOVE_HANDLE_BAR:6,INVOKE_ACTION:7},H=W=Object.freeze(W),U={UPDATE_SIZE:1},q=U=Object.freeze(U),Y=function(){return $(function e(n){A(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:o&&"SCRIPT"===o.tagName.toUpperCase()&&o.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,t){e in this.containers||(this.registeredContainers+=1),this.containers[e]=n,this.containerRefs[e]=t,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 t=this.containerRefs[n].getBoundingClientRect();e[n]={width:t.width,height:t.height}}this.sendToWorker(H.APPLY_SIZES,{sizes:e})}}},{key:"moveHandleBar",value:function(e){for(var n={},t=0,r=[e.parent,e.sibling1,e.sibling2];t<r.length;t++){var o=r[t],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 t=this;requestAnimationFrame(function(){var r,o=_(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;switch(i.type){case q.UPDATE_SIZE:t.containers[i.id].current.updateStyles(i.args.style);break;case q.REMOVE_NODE:break;default:console.warn("Unknown transformation was requested.")}}}catch(e){o.e(e)}finally{o.f()}n&&(t.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:"invokeAction",value:function(e){var n=e.id,t=e.action,r=e.args;this.sendToWorker(H.INVOKE_ACTION,{id:n,action:t,args:r})}},{key:"destroy",value:function(){this.worker&&(this.worker.terminate(),this.worker=null)}}])}(),X=e.createContext(null);function K(t){var r=t.layout,o=t.children,i=e.useMemo(function(){return new Y(r)},[r]);return e.useEffect(function(){return function(){i.destroy()}},[i]),n.jsx(X.Provider,{value:i,children:o})}function Z(){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 t=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}K.propTypes={layout:z.object.isRequired,children:z.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(t){var r=t.orientation,o=t.parent,i=t.sibling1,a=t.sibling2,s=Z(),l=e.useRef(null),c=e.useRef(null),u=e.useRef(null),f=function(e){var n,t,u;e.preventDefault(),e.stopPropagation(),document.addEventListener("mousemove",d),document.addEventListener("mouseup",p),"horizontal"===r?(n="clientY",t="height",u="handleBarHorizontalHover"):"vertical"===r&&(n="clientX",t="width",u="handleBarVerticalHover");for(var f,v,y=s.containerRefs[o],h=s.containerRefs[i],b=s.containerRefs[a],m=s.ldf.containers[o],g=0;g<m.children.length;g++)m.children[g].containerId===i?f=m.children[g].size:m.children[g].containerId===a&&(v=m.children[g].size);l.current={downValueY:e[n],hoverClass:u,downKey:n,propKey:t,parentSize:y.getBoundingClientRect()[t],parentRef:y,sibling1Ref:h,sibling2Ref:b,sibling1LayoutConfig:f,sibling2LayoutConfig:v,sibling1Size:h.getBoundingClientRect()[t],sibling2Size:b.getBoundingClientRect()[t]},c.current.classList.add(u)};var d=function(e){if(l.current){e.preventDefault(),e.stopPropagation();var n=l.current,t=e[n.downKey]-n.downValueY,r=n.sibling1Size+t,c=n.sibling2Size-t;clearTimeout(u.current),u.current=setTimeout(function(){var t,r,l;s.moveHandleBar({handle:(t=e,r=n.parentRef,l=r.getBoundingClientRect(),{x:t.clientX-l.left,y:t.clientY-l.top}),parent:o,sibling1:i,sibling2:a})},4);var f=Object.keys(n.sibling1LayoutConfig);if(!(f.includes("min")&&r<=n.sibling1LayoutConfig.min.value||f.includes("max")&&r>=n.sibling1LayoutConfig.max.value)){var d=Object.keys(n.sibling2LayoutConfig);if(!(d.includes("min")&&c<=n.sibling2LayoutConfig.min.value||d.includes("max")&&c>=n.sibling2LayoutConfig.max.value||r<50||c<50)){var p=n.sibling1LayoutConfig.initial.type,v=n.sibling2LayoutConfig.initial.type;if("fill"===p&&"fill"===v)return s.containerRefs[i].style[n.propKey]=r+"px",void(s.containerRefs[a].style[n.propKey]=c+"px");"fill"!==p&&(s.containerRefs[i].style[n.propKey]=r+"px"),"fill"!==v&&(s.containerRefs[a].style[n.propKey]=c+"px")}}}},p=function(e){e.preventDefault(),e.stopPropagation(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),clearTimeout(u.current),c.current&&l.current&&c.current.classList.remove(l.current.hoverClass),l.current=null};return e.useEffect(function(){return function(){document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",p),u.current&&(clearTimeout(u.current),u.current=null)}},[]),n.jsx(e.Fragment,{children:"horizontal"===r?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarHorizontalContainer",children:n.jsx("div",{ref:c,className:"handleBarHorizontal"})}):"vertical"===r?n.jsx("div",{onMouseDown:function(e){return f(e)},className:"handleBarVerticalContainer",children:n.jsx("div",{ref:c,className:"handleBarVertical"})}):null})};G.propTypes={orientation:z.string,sibling1:z.string,sibling2:z.string,parent:z.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(".titleContainer {\n position: absolute;\n width: 100%;\n top: 0;\n bottom: 1px;\n display: flex;\n align-items: center;\n color: #bbbbbb;\n justify-content: space-between;\n background: #222425;\n}\n\n.titleContainer > .title {\n padding-left: 30px;\n font-size: 11px;\n}\n\n.titleContainer > .close {\n padding-right: 15px;\n font-size: 11px;\n cursor: pointer;\n}");var ee=["color","size","title","className"];function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)({}).hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},ne.apply(null,arguments)}var te=e.forwardRef(function(n,t){var r=n.color,o=void 0===r?"currentColor":r,i=n.size,a=void 0===i?"1em":i,s=n.title,l=void 0===s?null:s,c=n.className,u=void 0===c?"":c,f=function(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==n.indexOf(r))continue;t[r]=e[r]}return t}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],-1===n.indexOf(t)&&{}.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(n,ee);return e.createElement("svg",ne({ref:t,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:o,className:["bi","bi-x-lg",u].filter(Boolean).join(" ")},f),l?e.createElement("title",null,l):null,e.createElement("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"}))});te.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var re=function(e){var t,r,o=e.node,i=Z();return n.jsxs("div",{className:"titleContainer",children:[n.jsx("div",{className:"title",children:null==o||null===(t=o.menuBar)||void 0===t?void 0:t.title}),(null==o||null===(r=o.menuBar)||void 0===r?void 0:r.showClose)&&n.jsx("div",{onClick:function(){var e;i.invokeAction({id:null==o||null===(e=o.menuBar)||void 0===e?void 0:e.closeContainerId,action:"close",args:{}})},className:"close",children:n.jsx(te,{})})]})};re.propTypes={node:z.object};J(".container-tabs-row {\n position: relative;\n width: 100%;\n height: 100%;\n background: #222425;\n display: flex;\n justify-content: space-between;\n}\n\n.container-tabs-row > .container-tabs {\n display: flex;\n flex-direction: row;\n gap: 5px;\n margin-left: 20px;\n}\n\n.container-tabs-row > .container-tabs > .container-tab {\n display: flex;\n align-items: center;\n cursor: pointer;\n padding: 0 10px;\n height: 28px;\n font-size: 13px;\n color: #bbbbbb;\n}\n\n.container-tabs-row > .container-close {\n display: flex;\n align-items: center;\n cursor: pointer;\n color: white;\n font-size: 11px;\n margin-right: 10px;\n}");var oe=function(e){var t,r,o=e.node,i=e.onTabClick,a=Z();return n.jsxs("div",{className:"container-tabs-row",children:[n.jsx("div",{className:"container-tabs",children:null==o||null===(t=o.tabsBar)||void 0===t||null===(t=t.tabs)||void 0===t?void 0:t.map(function(e,t){return n.jsx("div",{style:{borderBottom:e.selected?"solid 1px white":"none"},onClick:function(n){return i(e)},className:"container-tab",children:e.name},e.name+String(t))})}),(null==o||null===(r=o.tabsBar)||void 0===r?void 0:r.showClose)&&n.jsx("div",{className:"container-close",children:n.jsx(te,{onClick:function(){var e;a.invokeAction({id:null==o||null===(e=o.tabsBar)||void 0===e?void 0:e.closeContainerId,action:"close",args:{}})}})})]})};oe.propTypes={node:z.object,onTabClick:z.func};J("/** \nTODO: I agree that it is convoluted to use absolute, then relative and then absolute.\nHowever, the reason I am doing it is, it makes the layout of the monaco editor trivial\nand avoids resize observer loops when the container sizes change. I haven't thought\nabout this enough and I will revisit it later.\n*/\n.absoluteContainer {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n right: 0px;\n}\n\n.contentContainer {\n position: relative;\n width: 100%;\n height: 100%;\n}\n\n.menuContainer {\n position: absolute;\n top: 0px;\n height: 35px;\n left: 0px;\n right: 0px;\n}\n\n.tabsContainer {\n position: absolute;\n top: 0px;\n height: 35px;\n left: 0px;\n right: 0px;\n}\n\n.lazycontainer {\n position: absolute;\n top: 0px;\n bottom: 0px;\n left: 0px;\n right: 0px;\n}");var ie=function(t){var r=t.node,o=e.useContext(Q),i=M(e.useState(!1),2),a=i[0],s=i[1],l=M(e.useState(!1),2),c=l[0],u=l[1],f=M(e.useState(0),2),d=f[0],p=f[1],v=M(e.useState(0),2),y=v[0],h=v[1],b=M(e.useState(""),2),m=b[0],g=b[1],x=e.useMemo(function(){if(o&&m in o)return e.lazy(o[m])},[o,m]);e.useEffect(function(){var e=0,n=0;"menuBar"in r&&(s(!0),n+=35,e+=35),"tabsBar"in r?(u(!0),e+=35,w(r.tabsBar.tabs[0])):g(r.component),p(e),h(n)},[r]);var w=function(e){r.tabsBar.tabs.forEach(function(n){n===e?(n.selected=!0,g(n.component)):n.selected=!1})};return n.jsx("div",{className:"absoluteContainer",children:n.jsxs("div",{className:"contentContainer",children:[a&&n.jsx("div",{className:"menuContainer",children:n.jsx(re,{node:r})}),c&&n.jsx("div",{className:"tabsContainer",style:{top:"".concat(y,"px")},children:n.jsx(oe,{node:r,onTabClick:w})}),n.jsx("div",{className:"lazycontainer",style:{top:"".concat(d,"px")},children:n.jsx(e.Suspense,{fallback:n.jsx("div",{children:"Loading..."}),children:x&&n.jsx(x,{})})})]})})};ie.propTypes={content:z.object};var ae=function(t){var r=t.node,o=Z(),i=e.useRef(null),a=e.useRef(null),s=M(e.useState(null),2),l=s[0],c=s[1],u=e.useCallback(function(e){for(var t=[],r=0;r<e.children.length;r++){var i=e.children[r];if("container"===i.type){var a=o.ldf.containers[e.children[r].containerId];a.parent=e,t.push(n.jsx(ae,{meta:e.children[r],id:a.id,node:a},r))}else"handleBar"===i.type&&("horizontal"===e.orientation?t.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)):"vertical"===e.orientation&&t.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)))}return t},[o]),f=e.useRef({});return f.current={updateStyles:function(e){var n="hiding-"+a.current;for(var t in e)if("display"===t&&"none"===e[t]){if(i.current.classList.contains(n))return;i.current.classList.add(n)}else if("display"===t&&"flex"===e[t]){if(!i.current.classList.contains(n))return;i.current.classList.remove(n)}else i.current.style[t]=e[t]}},e.useLayoutEffect(function(){if(r&&o&&i.current){a.current=r.parent.orientation;var e=r.children&&r.children.length>0;return e?"horizontal"===r.orientation?(i.current.style.display="flex",i.current.style.flexDirection="row",i.current.style.width="100%"):"vertical"===r.orientation?(i.current.style.display="flex",i.current.style.flexDirection="column",i.current.style.height="100%"):console.warn("Unknown orientation:",r.orientation):r.background?i.current.style.background=r.background:i.current.style.background="transparent",c(e?u(r):n.jsx(ie,{node:r})),o.registerContainer(r.id,f,i.current),function(){o.unregisterContainer(r.id)}}},[r,o,u]),n.jsx("div",{ref:i,className:"relative-container",children:l})};ae.propTypes={node:z.object};var se=function(){return $(function e(){A(this,e),this.subscribers=new Map},[{key:"subscribe",value:function(e,n){var t=this;this.subscribers.has(e)||this.subscribers.set(e,new Set);var r=this.subscribers.get(e);r.add(n);return function(){r.delete(n),0===r.size&&t.subscribers.delete(e)}}},{key:"publish",value:function(e){var n=this.subscribers.get(e.type);if(n){var t,r=_(n);try{for(r.s();!(t=r.n()).done;){(0,t.value)(e)}}catch(e){r.e(e)}finally{r.f()}}}}])}(),le=e.createContext(null);function ce(){var n=e.useContext(le);if(!n)throw new Error("useLayoutPublisher must be used within LayoutEventProvider");return n.publish.bind(n)}var ue=$(function e(n){var t=this,r=n.publish;A(this,e),B(this,"resetDragState",function(){t.dragState={activeId:null,activeData:null,overId:null,overData:null,isDragging:!1}}),B(this,"onDragStart",function(e){var n,r,o,i;t.dragState={activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(o=null===(i=e.active)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.current)&&void 0!==o?o:null,overId:null,overData:null,isDragging:!0}}),B(this,"onDragOver",function(e){var n,r,o,i;t.dragState.overId=null!==(n=null===(r=e.over)||void 0===r?void 0:r.id)&&void 0!==n?n:null,t.dragState.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}),B(this,"onDragEnd",function(e){var n,r,o,i,a,s,l,c;t.publish({type:"drag:drop",payload:{activeId:null!==(n=null===(r=e.active)||void 0===r?void 0:r.id)&&void 0!==n?n:null,activeData:null!==(o=null===(i=e.active)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.current)&&void 0!==o?o:null,overId:null!==(a=null===(s=e.over)||void 0===s?void 0:s.id)&&void 0!==a?a:null,overData:null!==(l=null===(c=e.over)||void 0===c||null===(c=c.data)||void 0===c?void 0:c.current)&&void 0!==l?l:null},source:"drag-provider"}),t.resetDragState()}),B(this,"onDragCancel",function(e){t.resetDragState()}),B(this,"isDragging",function(){return t.dragState.isDragging}),B(this,"getDragPreview",function(){var e;return null===(e=t.dragState)||void 0===e||null===(e=e.activeData)||void 0===e?void 0:e.preview}),this.publish=r,this.resetDragState()});J('.root-container {\n width: 100%;\n height: 100%;\n overflow: hidden;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\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 fe=function(){var r,o=Z(),i=(r=ce(),e.useMemo(function(){return new ue({publish:r})},[r])),a=e.useRef(null),s=e.useRef(null),l=e.useRef(!1),c=e.useRef({});c.current={};var u=M(e.useState(null),2),f=u[0],d=u[1],p=e.useCallback(function(e){for(var t=[],r=0;r<e.children.length;r++){var i=e.children[r];if("container"===i.type){var a=o.ldf.containers[e.children[r].containerId];a.parent=e,t.push(n.jsx(ae,{meta:e.children[r],id:a.id,node:a},r))}else"handleBar"===i.type&&("horizontal"===e.orientation?t.push(n.jsx(G,{orientation:"vertical",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)):"vertical"===e.orientation&&t.push(n.jsx(G,{orientation:"horizontal",parent:e.id,sibling1:i.sibling1,sibling2:i.sibling2},r)))}return t},[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,c,a.current),n&&("horizontal"===e.orientation?a.current.style.flexDirection="row":"vertical"===e.orientation&&(a.current.style.flexDirection="column")),d(n?p(e):null);var t=new ResizeObserver(function(e){l.current||(l.current=!0);var n,t=_(e);try{var r=function(){var e=n.value.contentRect,t=e.width,r=e.height;clearTimeout(s.current),s.current=setTimeout(function(){l.current=!1,o.handleRootResize(t,r)},1)};for(t.s();!(n=t.n()).done;)r()}catch(e){t.e(e)}finally{t.f()}});return t.observe(a.current),function(){o.unregisterContainer(o.ldf.layoutRoot),t.disconnect()}}},[o]);var v=t.useSensors(t.useSensor(t.PointerSensor,{activationConstraint:{distance:8}})),y=M(e.useState({left:0,top:0}),2),h=y[0],b=y[1];return e.useEffect(function(){if(i.isDragging()){var e=function(e){b({left:e.clientX,top:e.clientY})};return window.addEventListener("pointermove",e),function(){window.removeEventListener("pointermove",e)}}},[i.isDragging()]),n.jsxs(t.DndContext,{sensors:v,collisionDetection:t.closestCenter,onDragStart:i.onDragStart,onDragOver:i.onDragOver,onDragEnd:i.onDragEnd,onDragCancel:i.onDragCancel,children:[n.jsx("div",{className:"root-container",children:n.jsx("div",{ref:a,className:"relative-container",children:f})}),i.isDragging()&&n.jsx("div",{className:"drag-overlay",style:h,children:i.getDragPreview()})]})},de=e.createContext(null);function pe(t){var o=t.children,i=M(e.useState(null),2),a=i[0],s=i[1],l=e.useCallback(function(e){var n=function(){s(null)},t="modal-".concat(Date.now());return s({id:t,title:e.title,args:e.args,render:e.render,close:n}),{id:t,close:n}},[]),c=e.useCallback(function(){s(null)},[]),u=e.useMemo(function(){return{openModal:l,closeModal:c}},[l,c]);return n.jsxs(de.Provider,{value:u,children:[o,r.createPortal(n.jsx(n.Fragment,{children:a&&n.jsx(e.Fragment,{children:n.jsx("div",{className:"modal-backdrop",onClick:a.close,children:n.jsxs("div",{className:"modal-content",onClick:function(e){return e.stopPropagation()},children:[n.jsxs("div",{className:"modal-header",children:[n.jsx("span",{className:"title",children:a.title}),n.jsx(te,{className:"close-button",onClick:a.close})]}),n.jsx("div",{className:"modal-body",children:a.render({close:a.close,args:a.args})})]})})},a.id)}),document.body)]})}J('.modal-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.5);\n display: flex;\n justify-content: center;\n align-items: center;\n z-index: 1000;\n}\n\n.modal-content {\n background-color: #333333;\n border-radius: 5px;\n display: flex;\n flex-direction: column;\n scrollbar-gutter: stable;\n scrollbar-color: rgba(71, 71, 71, 0.4) #252526;\n scrollbar-width: thin;\n}\n\n.modal-header {\n display: flex;\n justify-content: space-between;\n height: 25px;\n border-bottom: solid 1px rgb(85, 85, 85);\n padding: 10px 20px;\n align-items: center;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n}\n\n.modal-header > .title {\n color: rgb(180, 180, 180);\n}\n\n.modal-header > .close-button {\n cursor: pointer;\n color: rgb(180, 180, 180);\n}\n\n.modal-header > .close-button:hover {\n color: white;\n}\n\n.modal-body {\n flex: 1;\n}');var ve=function(e){var t=e.ldf,r=e.registry;return n.jsx(K,{layout:t,children:n.jsx(Q.Provider,{value:r,children:n.jsx(pe,{children:n.jsx(fe,{})})})})};ve.propTypes={ldf:z.object,registry:z.object},exports.LayoutEventProvider=function(t){var r=t.children,o=e.useMemo(function(){return new se},[]);return n.jsx(le.Provider,{value:o,children:r})},exports.LayoutManager=ve,exports.useLayoutEventPublisher=ce,exports.useLayoutEventSubscription=function(n,t){var r=e.useContext(le),o=e.useRef(t);o.current=t,e.useEffect(function(){if(!r)throw new Error("useLayoutSubscription must be used within LayoutEventProvider");return r.subscribe(n,function(e){o.current(e)})},[r,n])},exports.useModalManager=function(){var n=e.useContext(de);if(!n)throw new Error("useModalManager must be used inside ModalProvider");return n};
15
15
  //# sourceMappingURL=index.js.map