@dormammuuuuu/nextjs-orgchart
Version:
A React component for rendering organization charts in Next.js applications.
44 lines (41 loc) • 47.6 kB
JavaScript
(function(_,ce){typeof exports=="object"&&typeof module<"u"?module.exports=ce(require("react")):typeof define=="function"&&define.amd?define(["react"],ce):(_=typeof globalThis<"u"?globalThis:_||self,_.NextjsOrgChart=ce(_.React))})(this,function(_){"use strict";var ce={exports:{}},ye={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var rt;function $t(){if(rt)return ye;rt=1;var e=_,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(c,h,O){var x,j={},D=null,W=null;O!==void 0&&(D=""+O),h.key!==void 0&&(D=""+h.key),h.ref!==void 0&&(W=h.ref);for(x in h)n.call(h,x)&&!s.hasOwnProperty(x)&&(j[x]=h[x]);if(c&&c.defaultProps)for(x in h=c.defaultProps,h)j[x]===void 0&&(j[x]=h[x]);return{$$typeof:t,type:c,key:D,ref:W,props:j,_owner:i.current}}return ye.Fragment=r,ye.jsx=a,ye.jsxs=a,ye}var be={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var nt;function Bt(){return nt||(nt=1,process.env.NODE_ENV!=="production"&&function(){var e=_,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),c=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),x=Symbol.for("react.suspense_list"),j=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),W=Symbol.for("react.offscreen"),L=Symbol.iterator,A="@@iterator";function z(o){if(o===null||typeof o!="object")return null;var l=L&&o[L]||o[A];return typeof l=="function"?l:null}var u=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function f(o){{for(var l=arguments.length,d=new Array(l>1?l-1:0),y=1;y<l;y++)d[y-1]=arguments[y];p("error",o,d)}}function p(o,l,d){{var y=u.ReactDebugCurrentFrame,T=y.getStackAddendum();T!==""&&(l+="%s",d=d.concat([T]));var P=d.map(function(C){return String(C)});P.unshift("Warning: "+l),Function.prototype.apply.call(console[o],console,P)}}var b=!1,g=!1,I=!1,q=!1,le=!1,se;se=Symbol.for("react.module.reference");function pe(o){return!!(typeof o=="string"||typeof o=="function"||o===n||o===s||le||o===i||o===O||o===x||q||o===W||b||g||I||typeof o=="object"&&o!==null&&(o.$$typeof===D||o.$$typeof===j||o.$$typeof===a||o.$$typeof===c||o.$$typeof===h||o.$$typeof===se||o.getModuleId!==void 0))}function Se(o,l,d){var y=o.displayName;if(y)return y;var T=l.displayName||l.name||"";return T!==""?d+"("+T+")":d}function ne(o){return o.displayName||"Context"}function V(o){if(o==null)return null;if(typeof o.tag=="number"&&f("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case n:return"Fragment";case r:return"Portal";case s:return"Profiler";case i:return"StrictMode";case O:return"Suspense";case x:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case c:var l=o;return ne(l)+".Consumer";case a:var d=o;return ne(d._context)+".Provider";case h:return Se(o,o.render,"ForwardRef");case j:var y=o.displayName||null;return y!==null?y:V(o.type)||"Memo";case D:{var T=o,P=T._payload,C=T._init;try{return V(C(P))}catch{return null}}}return null}var ee=Object.assign,oe=0,Ee,ue,ge,fe,m,R,U;function J(){}J.__reactDisabledLog=!0;function Y(){{if(oe===0){Ee=console.log,ue=console.info,ge=console.warn,fe=console.error,m=console.group,R=console.groupCollapsed,U=console.groupEnd;var o={configurable:!0,enumerable:!0,value:J,writable:!0};Object.defineProperties(console,{info:o,log:o,warn:o,error:o,group:o,groupCollapsed:o,groupEnd:o})}oe++}}function K(){{if(oe--,oe===0){var o={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:ee({},o,{value:Ee}),info:ee({},o,{value:ue}),warn:ee({},o,{value:ge}),error:ee({},o,{value:fe}),group:ee({},o,{value:m}),groupCollapsed:ee({},o,{value:R}),groupEnd:ee({},o,{value:U})})}oe<0&&f("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var N=u.ReactCurrentDispatcher,Q;function ie(o,l,d){{if(Q===void 0)try{throw Error()}catch(T){var y=T.stack.trim().match(/\n( *(at )?)/);Q=y&&y[1]||""}return`
`+Q+o}}var ae=!1,v;{var E=typeof WeakMap=="function"?WeakMap:Map;v=new E}function S(o,l){if(!o||ae)return"";{var d=v.get(o);if(d!==void 0)return d}var y;ae=!0;var T=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var P;P=N.current,N.current=null,Y();try{if(l){var C=function(){throw Error()};if(Object.defineProperty(C.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(C,[])}catch(X){y=X}Reflect.construct(o,[],C)}else{try{C.call()}catch(X){y=X}o.call(C.prototype)}}else{try{throw Error()}catch(X){y=X}o()}}catch(X){if(X&&y&&typeof X.stack=="string"){for(var w=X.stack.split(`
`),$=y.stack.split(`
`),F=w.length-1,M=$.length-1;F>=1&&M>=0&&w[F]!==$[M];)M--;for(;F>=1&&M>=0;F--,M--)if(w[F]!==$[M]){if(F!==1||M!==1)do if(F--,M--,M<0||w[F]!==$[M]){var Z=`
`+w[F].replace(" at new "," at ");return o.displayName&&Z.includes("<anonymous>")&&(Z=Z.replace("<anonymous>",o.displayName)),typeof o=="function"&&v.set(o,Z),Z}while(F>=1&&M>=0);break}}}finally{ae=!1,N.current=P,K(),Error.prepareStackTrace=T}var me=o?o.displayName||o.name:"",he=me?ie(me):"";return typeof o=="function"&&v.set(o,he),he}function H(o,l,d){return S(o,!1)}function Ot(o){var l=o.prototype;return!!(l&&l.isReactComponent)}function de(o,l,d){if(o==null)return"";if(typeof o=="function")return S(o,Ot(o));if(typeof o=="string")return ie(o);switch(o){case O:return ie("Suspense");case x:return ie("SuspenseList")}if(typeof o=="object")switch(o.$$typeof){case h:return H(o.render);case j:return de(o.type,l,d);case D:{var y=o,T=y._payload,P=y._init;try{return de(P(T),l,d)}catch{}}}return""}var we=Object.prototype.hasOwnProperty,jt={},At=u.ReactDebugCurrentFrame;function De(o){if(o){var l=o._owner,d=de(o.type,o._source,l?l.type:null);At.setExtraStackFrame(d)}else At.setExtraStackFrame(null)}function Kr(o,l,d,y,T){{var P=Function.call.bind(we);for(var C in o)if(P(o,C)){var w=void 0;try{if(typeof o[C]!="function"){var $=Error((y||"React class")+": "+d+" 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 $.name="Invariant Violation",$}w=o[C](l,C,y,d,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(F){w=F}w&&!(w instanceof Error)&&(De(T),f("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %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).",y||"React class",d,C,typeof w),De(null)),w instanceof Error&&!(w.message in jt)&&(jt[w.message]=!0,De(T),f("Failed %s type: %s",d,w.message),De(null))}}}var Qr=Array.isArray;function Ke(o){return Qr(o)}function Zr(o){{var l=typeof Symbol=="function"&&Symbol.toStringTag,d=l&&o[Symbol.toStringTag]||o.constructor.name||"Object";return d}}function qr(o){try{return kt(o),!1}catch{return!0}}function kt(o){return""+o}function Dt(o){if(qr(o))return f("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Zr(o)),kt(o)}var xe=u.ReactCurrentOwner,en={key:!0,ref:!0,__self:!0,__source:!0},It,Lt,Qe;Qe={};function tn(o){if(we.call(o,"ref")){var l=Object.getOwnPropertyDescriptor(o,"ref").get;if(l&&l.isReactWarning)return!1}return o.ref!==void 0}function rn(o){if(we.call(o,"key")){var l=Object.getOwnPropertyDescriptor(o,"key").get;if(l&&l.isReactWarning)return!1}return o.key!==void 0}function nn(o,l){if(typeof o.ref=="string"&&xe.current&&l&&xe.current.stateNode!==l){var d=V(xe.current.type);Qe[d]||(f('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',V(xe.current.type),o.ref),Qe[d]=!0)}}function on(o,l){{var d=function(){It||(It=!0,f("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};d.isReactWarning=!0,Object.defineProperty(o,"key",{get:d,configurable:!0})}}function sn(o,l){{var d=function(){Lt||(Lt=!0,f("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};d.isReactWarning=!0,Object.defineProperty(o,"ref",{get:d,configurable:!0})}}var an=function(o,l,d,y,T,P,C){var w={$$typeof:t,type:o,key:l,ref:d,props:C,_owner:P};return w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(w,"_self",{configurable:!1,enumerable:!1,writable:!1,value:y}),Object.defineProperty(w,"_source",{configurable:!1,enumerable:!1,writable:!1,value:T}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w};function cn(o,l,d,y,T){{var P,C={},w=null,$=null;d!==void 0&&(Dt(d),w=""+d),rn(l)&&(Dt(l.key),w=""+l.key),tn(l)&&($=l.ref,nn(l,T));for(P in l)we.call(l,P)&&!en.hasOwnProperty(P)&&(C[P]=l[P]);if(o&&o.defaultProps){var F=o.defaultProps;for(P in F)C[P]===void 0&&(C[P]=F[P])}if(w||$){var M=typeof o=="function"?o.displayName||o.name||"Unknown":o;w&&on(C,M),$&&sn(C,M)}return an(o,w,$,T,y,xe.current,C)}}var Ze=u.ReactCurrentOwner,Ft=u.ReactDebugCurrentFrame;function ve(o){if(o){var l=o._owner,d=de(o.type,o._source,l?l.type:null);Ft.setExtraStackFrame(d)}else Ft.setExtraStackFrame(null)}var qe;qe=!1;function et(o){return typeof o=="object"&&o!==null&&o.$$typeof===t}function Ut(){{if(Ze.current){var o=V(Ze.current.type);if(o)return`
Check the render method of \``+o+"`."}return""}}function ln(o){return""}var Mt={};function un(o){{var l=Ut();if(!l){var d=typeof o=="string"?o:o.displayName||o.name;d&&(l=`
Check the top-level render call using <`+d+">.")}return l}}function Wt(o,l){{if(!o._store||o._store.validated||o.key!=null)return;o._store.validated=!0;var d=un(l);if(Mt[d])return;Mt[d]=!0;var y="";o&&o._owner&&o._owner!==Ze.current&&(y=" It was passed a child from "+V(o._owner.type)+"."),ve(o),f('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',d,y),ve(null)}}function Ht(o,l){{if(typeof o!="object")return;if(Ke(o))for(var d=0;d<o.length;d++){var y=o[d];et(y)&&Wt(y,l)}else if(et(o))o._store&&(o._store.validated=!0);else if(o){var T=z(o);if(typeof T=="function"&&T!==o.entries)for(var P=T.call(o),C;!(C=P.next()).done;)et(C.value)&&Wt(C.value,l)}}}function fn(o){{var l=o.type;if(l==null||typeof l=="string")return;var d;if(typeof l=="function")d=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===h||l.$$typeof===j))d=l.propTypes;else return;if(d){var y=V(l);Kr(d,o.props,"prop",y,o)}else if(l.PropTypes!==void 0&&!qe){qe=!0;var T=V(l);f("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",T||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&f("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function dn(o){{for(var l=Object.keys(o.props),d=0;d<l.length;d++){var y=l[d];if(y!=="children"&&y!=="key"){ve(o),f("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",y),ve(null);break}}o.ref!==null&&(ve(o),f("Invalid attribute `ref` supplied to `React.Fragment`."),ve(null))}}var Vt={};function Yt(o,l,d,y,T,P){{var C=pe(o);if(!C){var w="";(o===void 0||typeof o=="object"&&o!==null&&Object.keys(o).length===0)&&(w+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var $=ln();$?w+=$:w+=Ut();var F;o===null?F="null":Ke(o)?F="array":o!==void 0&&o.$$typeof===t?(F="<"+(V(o.type)||"Unknown")+" />",w=" Did you accidentally export a JSX literal instead of a component?"):F=typeof o,f("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",F,w)}var M=cn(o,l,d,T,P);if(M==null)return M;if(C){var Z=l.children;if(Z!==void 0)if(y)if(Ke(Z)){for(var me=0;me<Z.length;me++)Ht(Z[me],o);Object.freeze&&Object.freeze(Z)}else f("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ht(Z,o)}if(we.call(l,"key")){var he=V(o),X=Object.keys(l).filter(function(yn){return yn!=="key"}),tt=X.length>0?"{key: someKey, "+X.join(": ..., ")+": ...}":"{key: someKey}";if(!Vt[he+tt]){var mn=X.length>0?"{"+X.join(": ..., ")+": ...}":"{}";f(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,tt,he,mn,he),Vt[he+tt]=!0}}return o===n?dn(M):fn(M),M}}function hn(o,l,d){return Yt(o,l,d,!0)}function pn(o,l,d){return Yt(o,l,d,!1)}var gn=pn,vn=hn;be.Fragment=n,be.jsx=gn,be.jsxs=vn}()),be}process.env.NODE_ENV==="production"?ce.exports=$t():ce.exports=Bt();var k=ce.exports,Ie=function(e,t){return Ie=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Ie(e,t)};function Re(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ie(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Le(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Fe(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,s=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)s.push(i.value)}catch(c){a={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return s}function Ue(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,s;n<i;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;function te(e){return typeof e=="function"}function ot(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Me=ot(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
`):"",this.name="UnsubscriptionError",this.errors=r}});function We(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ce=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,s;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var c=Le(a),h=c.next();!h.done;h=c.next()){var O=h.value;O.remove(this)}}catch(A){t={error:A}}finally{try{h&&!h.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}else a.remove(this);var x=this.initialTeardown;if(te(x))try{x()}catch(A){s=A instanceof Me?A.errors:[A]}var j=this._finalizers;if(j){this._finalizers=null;try{for(var D=Le(j),W=D.next();!W.done;W=D.next()){var L=W.value;try{at(L)}catch(A){s=s??[],A instanceof Me?s=Ue(Ue([],Fe(s)),Fe(A.errors)):s.push(A)}}}catch(A){n={error:A}}finally{try{W&&!W.done&&(i=D.return)&&i.call(D)}finally{if(n)throw n.error}}}if(s)throw new Me(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)at(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&We(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&We(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),it=Ce.EMPTY;function st(e){return e instanceof Ce||e&&"closed"in e&&te(e.remove)&&te(e.add)&&te(e.unsubscribe)}function at(e){te(e)?e():e.unsubscribe()}var ct={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Nt={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Ue([e,t],Fe(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function Xt(e){Nt.setTimeout(function(){throw e})}function lt(){}function _e(e){e()}var ut=function(e){Re(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,st(r)&&r.add(n)):n.destination=Kt,n}return t.create=function(r,n,i){return new Ve(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ce),Gt=Function.prototype.bind;function He(e,t){return Gt.call(e,t)}var Jt=function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Te(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Te(n)}else Te(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Te(r)}},e}(),Ve=function(e){Re(t,e);function t(r,n,i){var s=e.call(this)||this,a;if(te(r)||!r)a={next:r??void 0,error:n??void 0,complete:i??void 0};else{var c;s&&ct.useDeprecatedNextContext?(c=Object.create(r),c.unsubscribe=function(){return s.unsubscribe()},a={next:r.next&&He(r.next,c),error:r.error&&He(r.error,c),complete:r.complete&&He(r.complete,c)}):a=r}return s.destination=new Jt(a),s}return t}(ut);function Te(e){Xt(e)}function zt(e){throw e}var Kt={closed:!0,next:lt,error:zt,complete:lt},Qt=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Zt(e){return e}function qt(e){return e.length===0?Zt:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var ft=function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,s=tr(t)?t:new Ve(t,r,n);return _e(function(){var a=i,c=a.operator,h=a.source;s.add(c?c.call(s,h):h?i._subscribe(s):i._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=dt(r),new r(function(i,s){var a=new Ve({next:function(c){try{t(c)}catch(h){s(h),a.unsubscribe()}},error:s,complete:i});n.subscribe(a)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[Qt]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return qt(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=dt(t),new t(function(n,i){var s;r.subscribe(function(a){return s=a},function(a){return i(a)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function dt(e){var t;return(t=e??ct.Promise)!==null&&t!==void 0?t:Promise}function er(e){return e&&te(e.next)&&te(e.error)&&te(e.complete)}function tr(e){return e&&e instanceof ut||er(e)&&st(e)}var rr=ot(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Ye=function(e){Re(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new ht(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new rr},t.prototype.next=function(r){var n=this;_e(function(){var i,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var a=Le(n.currentObservers),c=a.next();!c.done;c=a.next()){var h=c.value;h.next(r)}}catch(O){i={error:O}}finally{try{c&&!c.done&&(s=a.return)&&s.call(a)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;_e(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;_e(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,s=i.hasError,a=i.isStopped,c=i.observers;return s||a?it:(this.currentObservers=null,c.push(r),new Ce(function(){n.currentObservers=null,We(c,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,s=n.thrownError,a=n.isStopped;i?r.error(s):a&&r.complete()},t.prototype.asObservable=function(){var r=new ft;return r.source=this,r},t.create=function(r,n){return new ht(r,n)},t}(ft),ht=function(e){Re(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:it},t}(Ye);const $e=new Ye,Be=new Ye,Pe={sendDragInfo:e=>$e.next({draggedNodeId:e}),clearDragInfo:()=>$e.next(null),getDragInfo:()=>$e.asObservable()},Ne={sendSelectedNodeInfo:e=>Be.next({selectedNodeId:e}),clearSelectedNodeInfo:()=>Be.next(null),getSelectedNodeInfo:()=>Be.asObservable()};function nr({datasource:e,idProp:t,childrenProp:r}){const n=(u,f)=>{let p=!0;return Object.keys(f).some(b=>{const g=f[b];if(typeof g=="string"||typeof g=="number"||typeof g=="boolean"){if(u[b]!==g)return p=!1,!0}else if(g instanceof RegExp){if(!g.test(u[b]))return p=!1,!0}else typeof g=="object"&&Object.keys(g).some(I=>{switch(I){case">":u[b]>g[I]||(p=!1);break;case"<":u[b]<g[I]||(p=!1);break;case">=":u[b]>=g[I]||(p=!1);break;case"<=":u[b]<=g[I]||(p=!1);break;case"!==":u[b]===g[I]&&(p=!1);break}return!p});return!p}),p},i=u=>{if(!u)return null;if(e[t]===u)return e;const f=p=>{for(const b of p){if(b[t]===u)return b;if(b[r]){const g=f(b[r]);if(g)return g}}return null};return f(e[r]||[])},s=u=>{if(!u||!Object.keys(u).length)return null;if(n(e,u))return e;const f=p=>{for(const b of p){if(n(b,u))return b;if(b[r]){const g=f(b[r]);if(g)return g}}return null};return f(e[r]||[])},a=u=>{const f=[],p=b=>{if(n(b,u)&&f.push(b),b[r])for(const g of b[r])p(g)};return p(e),f},c=u=>{var f;if(!u)return null;if((f=e[r])!=null&&f.some(b=>b[t]===u))return e;const p=b=>{var g;for(const I of b){if((g=I[r])!=null&&g.some(q=>q[t]===u))return I;if(I[r]){const q=p(I[r]);if(q)return q}}return null};return p(e[r]||[])},h=u=>{var f;if(!u||e[t]===u)return[];const p=c(u);return p?((f=p[r])==null?void 0:f.filter(b=>b[t]!==u))||[]:[]},O=u=>{if(!u||u===e[t])return[];const f=[],p=b=>{const g=c(b);return g?(f.push(g),p(g[t])):f};return p(u)},x=(u,f)=>!u||!f||typeof f!="object"||Array.isArray(f)&&!f.length?!1:Array.isArray(f)?f.every(p=>typeof p=="object"&&Object.keys(p).length):Object.keys(f).length>0,j=(u,f)=>{if(!x(u,f))return!1;const p=i(u);return p?(Array.isArray(f)?p[r]?p[r].push(...f):p[r]=f:p[r]?p[r].push(f):p[r]=[f],!0):!1},D=(u,f)=>{var p,b;if(!x(u,f))return!1;const g=c(u);return g?(Array.isArray(f)?(p=g[r])==null||p.push(...f):(b=g[r])==null||b.push(f),!0):!1},W=u=>!u||typeof u!="object"||!Object.keys(u).length?!1:(e[r]=[{...e}],delete u[r],Object.keys(e).filter(f=>f!==r).forEach(f=>{u[f]||delete e[f]}),Object.assign(e,u),!0),L=u=>{if(!u||typeof u!="object"||!Object.keys(u).length||!u[t])return!1;const f=i(u[t]);return f?(Object.assign(f,u),!0):!1},A=(u,f)=>!u.length||!x(u[0],f)?!1:u.every(p=>(f[t]=p,L(f))),z=u=>{var f,p;if(u===e[t])return!1;const b=c(u);if(!b)return!1;const g=(f=b[r])==null?void 0:f.findIndex(I=>I[t]===u);return g!==void 0&&g>-1?((p=b[r])==null||p.splice(g,1),!0):!1};return{findNodeById:i,findOneNode:s,findNodes:a,findParent:c,findSiblings:h,findAncestors:O,addChildren:j,addSiblings:D,addRoot:W,updateNode:L,updateNodes:A,removeNode:z,removeNodes:u=>!u||Array.isArray(u)&&!u.length?!1:typeof u=="string"||typeof u=="number"?z(u):Array.isArray(u)?u.every(f=>z(f)):a(u).every(f=>z(f[t]))}}function or(e,t){if(e.match(/^[a-z]+:\/\//i))return e;if(e.match(/^\/\//))return window.location.protocol+e;if(e.match(/^[a-z]+:/i))return e;const r=document.implementation.createHTMLDocument(),n=r.createElement("base"),i=r.createElement("a");return r.head.appendChild(n),r.body.appendChild(i),t&&(n.href=t),i.href=e,i.href}const ir=(()=>{let e=0;const t=()=>`0000${(Math.random()*36**4<<0).toString(36)}`.slice(-4);return()=>(e+=1,`u${t()}${e}`)})();function re(e){const t=[];for(let r=0,n=e.length;r<n;r++)t.push(e[r]);return t}function Oe(e,t){const n=(e.ownerDocument.defaultView||window).getComputedStyle(e).getPropertyValue(t);return n?parseFloat(n.replace("px","")):0}function sr(e){const t=Oe(e,"border-left-width"),r=Oe(e,"border-right-width");return e.clientWidth+t+r}function ar(e){const t=Oe(e,"border-top-width"),r=Oe(e,"border-bottom-width");return e.clientHeight+t+r}function pt(e,t={}){const r=t.width||sr(e),n=t.height||ar(e);return{width:r,height:n}}function cr(){let e,t;try{t=process}catch{}const r=t&&t.env?t.env.devicePixelRatio:null;return r&&(e=parseInt(r,10),Number.isNaN(e)&&(e=1)),e||window.devicePixelRatio||1}const G=16384;function lr(e){(e.width>G||e.height>G)&&(e.width>G&&e.height>G?e.width>e.height?(e.height*=G/e.width,e.width=G):(e.width*=G/e.height,e.height=G):e.width>G?(e.height*=G/e.width,e.width=G):(e.width*=G/e.height,e.height=G))}function je(e){return new Promise((t,r)=>{const n=new Image;n.decode=()=>t(n),n.onload=()=>t(n),n.onerror=r,n.crossOrigin="anonymous",n.decoding="async",n.src=e})}async function ur(e){return Promise.resolve().then(()=>new XMLSerializer().serializeToString(e)).then(encodeURIComponent).then(t=>`data:image/svg+xml;charset=utf-8,${t}`)}async function fr(e,t,r){const n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),s=document.createElementNS(n,"foreignObject");return i.setAttribute("width",`${t}`),i.setAttribute("height",`${r}`),i.setAttribute("viewBox",`0 0 ${t} ${r}`),s.setAttribute("width","100%"),s.setAttribute("height","100%"),s.setAttribute("x","0"),s.setAttribute("y","0"),s.setAttribute("externalResourcesRequired","true"),i.appendChild(s),s.appendChild(e),ur(i)}const B=(e,t)=>{if(e instanceof t)return!0;const r=Object.getPrototypeOf(e);return r===null?!1:r.constructor.name===t.name||B(r,t)};function dr(e){const t=e.getPropertyValue("content");return`${e.cssText} content: '${t.replace(/'|"/g,"")}';`}function hr(e){return re(e).map(t=>{const r=e.getPropertyValue(t),n=e.getPropertyPriority(t);return`${t}: ${r}${n?" !important":""};`}).join(" ")}function pr(e,t,r){const n=`.${e}:${t}`,i=r.cssText?dr(r):hr(r);return document.createTextNode(`${n}{${i}}`)}function gt(e,t,r){const n=window.getComputedStyle(e,r),i=n.getPropertyValue("content");if(i===""||i==="none")return;const s=ir();try{t.className=`${t.className} ${s}`}catch{return}const a=document.createElement("style");a.appendChild(pr(s,r,n)),t.appendChild(a)}function gr(e,t){gt(e,t,":before"),gt(e,t,":after")}const vt="application/font-woff",mt="image/jpeg",vr={woff:vt,woff2:vt,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:mt,jpeg:mt,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function mr(e){const t=/\.([^./]*?)$/g.exec(e);return t?t[1]:""}function Xe(e){const t=mr(e).toLowerCase();return vr[t]||""}function yr(e){return e.split(/,/)[1]}function Ge(e){return e.search(/^(data:)/)!==-1}function br(e,t){return`data:${t};base64,${e}`}async function yt(e,t,r){const n=await fetch(e,t);if(n.status===404)throw new Error(`Resource "${n.url}" not found`);const i=await n.blob();return new Promise((s,a)=>{const c=new FileReader;c.onerror=a,c.onloadend=()=>{try{s(r({res:n,result:c.result}))}catch(h){a(h)}},c.readAsDataURL(i)})}const Je={};function Sr(e,t,r){let n=e.replace(/\?.*/,"");return r&&(n=e),/ttf|otf|eot|woff2?/i.test(n)&&(n=n.replace(/.*\//,"")),t?`[${t}]${n}`:n}async function ze(e,t,r){const n=Sr(e,t,r.includeQueryParams);if(Je[n]!=null)return Je[n];r.cacheBust&&(e+=(/\?/.test(e)?"&":"?")+new Date().getTime());let i;try{const s=await yt(e,r.fetchRequestInit,({res:a,result:c})=>(t||(t=a.headers.get("Content-Type")||""),yr(c)));i=br(s,t)}catch(s){i=r.imagePlaceholder||"";let a=`Failed to fetch resource: ${e}`;s&&(a=typeof s=="string"?s:s.message),a&&console.warn(a)}return Je[n]=i,i}async function Er(e){const t=e.toDataURL();return t==="data:,"?e.cloneNode(!1):je(t)}async function wr(e,t){if(e.currentSrc){const s=document.createElement("canvas"),a=s.getContext("2d");s.width=e.clientWidth,s.height=e.clientHeight,a==null||a.drawImage(e,0,0,s.width,s.height);const c=s.toDataURL();return je(c)}const r=e.poster,n=Xe(r),i=await ze(r,n,t);return je(i)}async function xr(e){var t;try{if(!((t=e==null?void 0:e.contentDocument)===null||t===void 0)&&t.body)return await Ae(e.contentDocument.body,{},!0)}catch{}return e.cloneNode(!1)}async function Rr(e,t){return B(e,HTMLCanvasElement)?Er(e):B(e,HTMLVideoElement)?wr(e,t):B(e,HTMLIFrameElement)?xr(e):e.cloneNode(!1)}const Cr=e=>e.tagName!=null&&e.tagName.toUpperCase()==="SLOT";async function _r(e,t,r){var n,i;let s=[];return Cr(e)&&e.assignedNodes?s=re(e.assignedNodes()):B(e,HTMLIFrameElement)&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?s=re(e.contentDocument.body.childNodes):s=re(((i=e.shadowRoot)!==null&&i!==void 0?i:e).childNodes),s.length===0||B(e,HTMLVideoElement)||await s.reduce((a,c)=>a.then(()=>Ae(c,r)).then(h=>{h&&t.appendChild(h)}),Promise.resolve()),t}function Tr(e,t){const r=t.style;if(!r)return;const n=window.getComputedStyle(e);n.cssText?(r.cssText=n.cssText,r.transformOrigin=n.transformOrigin):re(n).forEach(i=>{let s=n.getPropertyValue(i);i==="font-size"&&s.endsWith("px")&&(s=`${Math.floor(parseFloat(s.substring(0,s.length-2)))-.1}px`),B(e,HTMLIFrameElement)&&i==="display"&&s==="inline"&&(s="block"),i==="d"&&t.getAttribute("d")&&(s=`path(${t.getAttribute("d")})`),r.setProperty(i,s,n.getPropertyPriority(i))})}function Pr(e,t){B(e,HTMLTextAreaElement)&&(t.innerHTML=e.value),B(e,HTMLInputElement)&&t.setAttribute("value",e.value)}function Or(e,t){if(B(e,HTMLSelectElement)){const r=t,n=Array.from(r.children).find(i=>e.value===i.getAttribute("value"));n&&n.setAttribute("selected","")}}function jr(e,t){return B(t,Element)&&(Tr(e,t),gr(e,t),Pr(e,t),Or(e,t)),t}async function Ar(e,t){const r=e.querySelectorAll?e.querySelectorAll("use"):[];if(r.length===0)return e;const n={};for(let s=0;s<r.length;s++){const c=r[s].getAttribute("xlink:href");if(c){const h=e.querySelector(c),O=document.querySelector(c);!h&&O&&!n[c]&&(n[c]=await Ae(O,t,!0))}}const i=Object.values(n);if(i.length){const s="http://www.w3.org/1999/xhtml",a=document.createElementNS(s,"svg");a.setAttribute("xmlns",s),a.style.position="absolute",a.style.width="0",a.style.height="0",a.style.overflow="hidden",a.style.display="none";const c=document.createElementNS(s,"defs");a.appendChild(c);for(let h=0;h<i.length;h++)c.appendChild(i[h]);e.appendChild(a)}return e}async function Ae(e,t,r){return!r&&t.filter&&!t.filter(e)?null:Promise.resolve(e).then(n=>Rr(n,t)).then(n=>_r(e,n,t)).then(n=>jr(e,n)).then(n=>Ar(n,t))}const bt=/url\((['"]?)([^'"]+?)\1\)/g,kr=/url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g,Dr=/src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;function Ir(e){const t=e.replace(/([.*+?^${}()|\[\]\/\\])/g,"\\$1");return new RegExp(`(url\\(['"]?)(${t})(['"]?\\))`,"g")}function Lr(e){const t=[];return e.replace(bt,(r,n,i)=>(t.push(i),r)),t.filter(r=>!Ge(r))}async function Fr(e,t,r,n,i){try{const s=r?or(t,r):t,a=Xe(t);let c;return i||(c=await ze(s,a,n)),e.replace(Ir(t),`$1${c}$3`)}catch{}return e}function Ur(e,{preferredFontFormat:t}){return t?e.replace(Dr,r=>{for(;;){const[n,,i]=kr.exec(r)||[];if(!i)return"";if(i===t)return`src: ${n};`}}):e}function St(e){return e.search(bt)!==-1}async function Et(e,t,r){if(!St(e))return e;const n=Ur(e,r);return Lr(n).reduce((s,a)=>s.then(c=>Fr(c,a,t,r)),Promise.resolve(n))}async function ke(e,t,r){var n;const i=(n=t.style)===null||n===void 0?void 0:n.getPropertyValue(e);if(i){const s=await Et(i,null,r);return t.style.setProperty(e,s,t.style.getPropertyPriority(e)),!0}return!1}async function Mr(e,t){await ke("background",e,t)||await ke("background-image",e,t),await ke("mask",e,t)||await ke("mask-image",e,t)}async function Wr(e,t){const r=B(e,HTMLImageElement);if(!(r&&!Ge(e.src))&&!(B(e,SVGImageElement)&&!Ge(e.href.baseVal)))return;const n=r?e.src:e.href.baseVal,i=await ze(n,Xe(n),t);await new Promise((s,a)=>{e.onload=s,e.onerror=a;const c=e;c.decode&&(c.decode=s),c.loading==="lazy"&&(c.loading="eager"),r?(e.srcset="",e.src=i):e.href.baseVal=i})}async function Hr(e,t){const n=re(e.childNodes).map(i=>wt(i,t));await Promise.all(n).then(()=>e)}async function wt(e,t){B(e,Element)&&(await Mr(e,t),await Wr(e,t),await Hr(e,t))}function Vr(e,t){const{style:r}=e;t.backgroundColor&&(r.backgroundColor=t.backgroundColor),t.width&&(r.width=`${t.width}px`),t.height&&(r.height=`${t.height}px`);const n=t.style;return n!=null&&Object.keys(n).forEach(i=>{r[i]=n[i]}),e}const xt={};async function Rt(e){let t=xt[e];if(t!=null)return t;const n=await(await fetch(e)).text();return t={url:e,cssText:n},xt[e]=t,t}async function Ct(e,t){let r=e.cssText;const n=/url\(["']?([^"')]+)["']?\)/g,s=(r.match(/url\([^)]+\)/g)||[]).map(async a=>{let c=a.replace(n,"$1");return c.startsWith("https://")||(c=new URL(c,e.url).href),yt(c,t.fetchRequestInit,({result:h})=>(r=r.replace(a,`url(${h})`),[a,h]))});return Promise.all(s).then(()=>r)}function _t(e){if(e==null)return[];const t=[],r=/(\/\*[\s\S]*?\*\/)/gi;let n=e.replace(r,"");const i=new RegExp("((@.*?keyframes [\\s\\S]*?){([\\s\\S]*?}\\s*?)})","gi");for(;;){const h=i.exec(n);if(h===null)break;t.push(h[0])}n=n.replace(i,"");const s=/@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi,a="((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})",c=new RegExp(a,"gi");for(;;){let h=s.exec(n);if(h===null){if(h=c.exec(n),h===null)break;s.lastIndex=c.lastIndex}else c.lastIndex=s.lastIndex;t.push(h[0])}return t}async function Yr(e,t){const r=[],n=[];return e.forEach(i=>{if("cssRules"in i)try{re(i.cssRules||[]).forEach((s,a)=>{if(s.type===CSSRule.IMPORT_RULE){let c=a+1;const h=s.href,O=Rt(h).then(x=>Ct(x,t)).then(x=>_t(x).forEach(j=>{try{i.insertRule(j,j.startsWith("@import")?c+=1:i.cssRules.length)}catch(D){console.error("Error inserting rule from remote css",{rule:j,error:D})}})).catch(x=>{console.error("Error loading remote css",x.toString())});n.push(O)}})}catch(s){const a=e.find(c=>c.href==null)||document.styleSheets[0];i.href!=null&&n.push(Rt(i.href).then(c=>Ct(c,t)).then(c=>_t(c).forEach(h=>{a.insertRule(h,i.cssRules.length)})).catch(c=>{console.error("Error loading remote stylesheet",c)})),console.error("Error inlining remote css file",s)}}),Promise.all(n).then(()=>(e.forEach(i=>{if("cssRules"in i)try{re(i.cssRules||[]).forEach(s=>{r.push(s)})}catch(s){console.error(`Error while reading CSS rules from ${i.href}`,s)}}),r))}function $r(e){return e.filter(t=>t.type===CSSRule.FONT_FACE_RULE).filter(t=>St(t.style.getPropertyValue("src")))}async function Br(e,t){if(e.ownerDocument==null)throw new Error("Provided element is not within a Document");const r=re(e.ownerDocument.styleSheets),n=await Yr(r,t);return $r(n)}async function Nr(e,t){const r=await Br(e,t);return(await Promise.all(r.map(i=>{const s=i.parentStyleSheet?i.parentStyleSheet.href:null;return Et(i.cssText,s,t)}))).join(`
`)}async function Xr(e,t){const r=t.fontEmbedCSS!=null?t.fontEmbedCSS:t.skipFonts?null:await Nr(e,t);if(r){const n=document.createElement("style"),i=document.createTextNode(r);n.appendChild(i),e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n)}}async function Gr(e,t={}){const{width:r,height:n}=pt(e,t),i=await Ae(e,t,!0);return await Xr(i,t),await wt(i,t),Vr(i,t),await fr(i,r,n)}async function Tt(e,t={}){const{width:r,height:n}=pt(e,t),i=await Gr(e,t),s=await je(i),a=document.createElement("canvas"),c=a.getContext("2d"),h=t.pixelRatio||cr(),O=t.canvasWidth||r,x=t.canvasHeight||n;return a.width=O*h,a.height=x*h,t.skipAutoScale||lr(a),a.style.width=`${O}`,a.style.height=`${x}`,t.backgroundColor&&(c.fillStyle=t.backgroundColor,c.fillRect(0,0,a.width,a.height)),c.drawImage(s,0,0,a.width,a.height),a}async function Jr(e,t={}){return(await Tt(e,t)).toDataURL()}async function zr(e,t={}){return(await Tt(e,t)).toDataURL("image/jpeg",t.quality||1)}const Pt=({datasource:e,NodeTemplate:t,draggable:r=!1,collapsible:n=!0,multipleSelect:i=!1,changeHierarchy:s,onClickNode:a})=>{const c=_.useRef(null),[h,O]=_.useState(!1),[x,j]=_.useState(),[D,W]=_.useState(),[L,A]=_.useState(),[z,u]=_.useState(),[f,p]=_.useState(!1),[b,g]=_.useState(!1),I=["oc-node",h?"isChildrenCollapsed":"",f?"allowedDrop":"",b?"selected":""].filter(m=>m).join(" ");_.useEffect(()=>{const m=Pe.getDragInfo().subscribe(U=>{var J,Y;U&&c.current?p(!((Y=(J=document.querySelector("#"+U.draggedNodeId))==null?void 0:J.closest("li"))!=null&&Y.querySelector("#"+c.current.id))):p(!1)}),R=Ne.getSelectedNodeInfo().subscribe(U=>{U?i?U.selectedNodeId===e.id&&g(!0):g(U.selectedNodeId===e.id):g(!1)});return()=>{m.unsubscribe(),R.unsubscribe()}},[i,e]);const q=m=>{var K,N;const R=m.currentTarget.closest("li"),U=(K=R==null?void 0:R.parentNode)==null?void 0:K.closest("li"),J=(N=U==null?void 0:U.firstChild)==null?void 0:N.classList.contains("hidden"),Y=R!=null&&R.parentNode?Array.from(R.parentNode.children).some(Q=>Q.classList.contains("hidden")):!1;j(!J),W(!Y),u(!Y),A(!h)},le=()=>{j(void 0),W(void 0),A(void 0),u(void 0)},se=m=>{var J,Y,K,N,Q,ie,ae;let R=(J=m.parentNode)==null?void 0:J.closest("li");if(!R)return;if((Y=R.firstChild)==null?void 0:Y.classList.contains("hidden"))m.classList.remove("isAncestorsCollapsed"),(K=R.firstChild)==null||K.classList.remove("hidden");else{const v=m.parentNode?Array.from((N=m.parentNode)==null?void 0:N.children).some(E=>E.classList.contains("hidden")):!1;v||ne(m),m.classList.add(...("isAncestorsCollapsed"+(v?"":" isSiblingsCollapsed")).split(" ")),(Q=R.firstChild)==null||Q.classList.add("hidden"),R.parentNode.closest("li")&&!((ae=(ie=R.parentNode.closest("li"))==null?void 0:ie.firstChild)!=null&&ae.classList.contains("hidden"))&&se(R)}},pe=m=>{m.stopPropagation(),j(!x),se(m.currentTarget.closest("li"))},Se=m=>{m.stopPropagation(),O(!h),A(!L)},ne=m=>{var Y,K,N;let R=m.previousSibling;const U=Array.from(((Y=m.parentNode)==null?void 0:Y.children)||[]).some(Q=>Q.classList.contains("hidden"));for(m.classList.toggle("isSiblingsCollapsed",!U);R;)R.classList.toggle("hidden",!U),R=R.previousSibling;for(R=m.nextSibling;R;)R.classList.toggle("hidden",!U),R=R.nextSibling;(m.parentNode?(N=(K=m.parentNode.closest("li"))==null?void 0:K.firstChild)==null?void 0:N.classList.contains("hidden"):!1)&&se(m)},V=m=>{m.stopPropagation(),u(!z),W(!D),ne(m.currentTarget.closest("li"))},ee=m=>{Pe.sendDragInfo(m)},oe=()=>{a&&a(e),Ne.sendSelectedNodeInfo(e.id)},Ee=m=>{const R={...e};delete R.relationship,m.dataTransfer.setData("text/plain",JSON.stringify(R)),ee(c.current.id)},ue=m=>{m.preventDefault()},ge=()=>{Pe.clearDragInfo()},fe=m=>{m.currentTarget.classList.contains("allowedDrop")&&(Pe.clearDragInfo(),s(JSON.parse(m.dataTransfer.getData("text/plain")),m.currentTarget.id))};return k.jsxs("li",{className:"oc-hierarchy",children:[k.jsxs("div",{ref:c,id:e.id,className:I,draggable:r?!0:void 0,onClick:oe,onDragStart:Ee,onDragOver:ue,onDragEnd:ge,onDrop:fe,onMouseEnter:q,onMouseLeave:le,children:[t?k.jsx(t,{nodeData:e}):k.jsxs(k.Fragment,{children:[k.jsxs("div",{className:"oc-heading",children:[e.relationship&&e.relationship.charAt(2)==="1"&&k.jsx("i",{className:"oci oci-leader oc-symbol"}),e.name]}),k.jsx("div",{className:"oc-content",children:e.title})]}),n&&e.relationship&&e.relationship.charAt(0)==="1"&&k.jsx("i",{className:`oc-edge verticalEdge topEdge oci ${x===void 0?"":x?"oci-chevron-down":"oci-chevron-up"}`,onClick:pe}),n&&e.relationship&&e.relationship.charAt(1)==="1"&&k.jsxs(k.Fragment,{children:[k.jsx("i",{className:`oc-edge horizontalEdge rightEdge oci ${D===void 0?"":D?"oci-chevron-left":"oci-chevron-right"}`,onClick:V}),k.jsx("i",{className:`oc-edge horizontalEdge leftEdge oci ${z===void 0?"":z?"oci-chevron-right":"oci-chevron-left"}`,onClick:V})]}),n&&e.relationship&&e.relationship.charAt(2)==="1"&&k.jsx("i",{className:`oc-edge verticalEdge bottomEdge oci ${L===void 0?"":L?"oci-chevron-up":"oci-chevron-down"}`,onClick:Se})]}),e.children&&e.children.length>0&&k.jsx("ul",{className:h?"hidden":"",children:e.children.map(m=>k.jsx(Pt,{datasource:m,NodeTemplate:t,draggable:r,collapsible:n,multipleSelect:i,changeHierarchy:s,onClickNode:a},m.id))})]})};return _.forwardRef(({datasource:e,pan:t=!1,zoom:r=!1,zoomoutLimit:n=.5,zoominLimit:i=7,containerClass:s="",chartClass:a="",NodeTemplate:c,draggable:h=!1,collapsible:O=!0,multipleSelect:x=!1,onClickNode:j,onClickChart:D},W)=>{const L=_.useRef(null),A=_.useRef(null),z=_.useRef(null),[u,f]=_.useState(0),[p,b]=_.useState(0),[g,I]=_.useState(""),[q,le]=_.useState(!1),[se,pe]=_.useState("default"),[Se,ne]=_.useState(!1),[V,ee]=_.useState(""),[oe,Ee]=_.useState(""),ue=(v,E)=>(v.relationship=E+(v.children&&v.children.length>0?"1":"0"),v.children&&v.children.forEach(function(S){ue(S,"1"+(v.children&&v.children.length>1?"1":"0"))}),v),[ge,fe]=_.useState(e);_.useEffect(()=>{fe(e)},[e]);const m=nr({datasource:e,idProp:"id",childrenProp:"children"}),R=v=>{v.target.closest(".oc-node")||(D&&D(),Ne.clearSelectedNodeInfo())},U=()=>{le(!1),pe("default")},J=v=>{let E=0,S=0;if(!v.targetTouches)E=v.pageX-u,S=v.pageY-p;else if(v.targetTouches.length===1)E=v.targetTouches[0].pageX-u,S=v.targetTouches[0].pageY-p;else if(v.targetTouches.length>1)return;if(g==="")I("matrix(1,0,0,1,"+E+","+S+")");else{let H=g.split(",");g.indexOf("3d")===-1?(H[4]=String(E),H[5]=S+")"):(H[12]=String(E),H[13]=String(S)),I(H.join(","))}},Y=v=>{if(v.target.closest(".oc-node")){le(!1);return}else le(!0),pe("move");let E=0,S=0;if(g!==""){const H=g.split(",");g.indexOf("3d")===-1?(E=parseInt(H[4]),S=parseInt(H[5])):(E=parseInt(H[12]),S=parseInt(H[13]))}v.targetTouches?v.targetTouches.length===1&&(f(v.targetTouches[0].pageX-E),b(v.targetTouches[0].pageY-S)):(f(v.pageX-E),b(v.pageY-S))},K=v=>{let E=[],S=1;g===""?I(`matrix(${v}, 0, 0, ${v}, 0, 0)`):(E=g.split(","),g.indexOf("3d")===-1?(S=Math.abs(parseFloat(E[3])*v),S>n&&S<i&&(E[0]=`matrix(${S}`,E[3]=String(S),I(E.join(",")))):(S=Math.abs(parseFloat(E[5])*v),S>n&&S<i&&(E[0]=`matrix3d(${S}`,E[5]=String(S),I(E.join(",")))))},N=v=>{const E=1+(v.deltaY>0?-.2:.2);K(E)},Q=(v,E)=>{const S=window.open("","_blank");if(S){S.document.write(`
<!DOCTYPE html>
<html>
<head>
<title>${E}</title>
</head>
<body>
<img src="${v}" id="chartImage" style="max-width: 100%;" />
</body>
</html>
`),S.document.close();const H=S.document.getElementById("chartImage");H.onload=()=>{S.print()}}},ie=(v,E)=>{const S=document.createElement("a");S.href=v,S.download=`${E}.png`,document.body.appendChild(S),S.click(),document.body.removeChild(S)},ae=(v,E)=>(m.removeNode(v.id)&&(m.addChildren(E,v),fe({...m.getAllNodes()})),Promise.resolve());return _.useImperativeHandle(W,()=>({exportTo:(v="OrgChart",E="png")=>{ne(!0);const S=L.current.scrollLeft;L.current.scrollLeft=0;const H=L.current.scrollTop;L.current.scrollTop=0,document.fonts.ready.then(()=>{(E.toLowerCase()==="pdf"?zr:Jr)(A.current,{cacheBust:!0,quality:1,includeQueryParams:!0,backgroundColor:"#fff"}).then(de=>{E.toLowerCase()==="pdf"?Q(de,v):ie(de,v),ne(!1),L.current.scrollLeft=S,L.current.scrollTop=H},()=>{ne(!1),L.current.scrollLeft=S,L.current.scrollTop=H})})},expandAllNodes:()=>{A.current&&A.current.querySelectorAll(".oc-hierarchy .hidden").forEach(v=>{v.classList.remove("hidden")})}})),k.jsxs("div",{ref:L,className:"orgchart-container "+s,onWheel:r?N:void 0,onMouseUp:t&&q?U:void 0,children:[k.jsx("div",{ref:A,className:"orgchart "+a,style:{transform:g,cursor:se},onClick:R,onMouseDown:t?Y:void 0,onMouseMove:t&&q?J:void 0,children:k.jsx("ul",{children:k.jsx(Pt,{datasource:ue(ge,"00"),NodeTemplate:c,draggable:h,collapsible:O,multipleSelect:x,changeHierarchy:ae,onClickNode:j})})}),k.jsx("a",{className:"oc-download-btn hidden",ref:z,href:V,download:oe,children:" "}),k.jsx("div",{className:`oc-mask ${Se?"":"hidden"}`,children:k.jsx("i",{className:"oci oci-spinner spinner"})})]})})});