(function(b,C){typeof exports=="object"&&typeof module<"u"?module.exports=C(require("react")):typeof define=="function"&&define.amd?define(["react"],C):(b=typeof globalThis<"u"?globalThis:b||self,b.OrganizationChart=C(b.React))})(this,function(b){"use strict";var C={exports:{}},I={};/** * @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 re;function Pe(){if(re)return I;re=1;var k=b,j=Symbol.for("react.element"),A=Symbol.for("react.fragment"),R=Object.prototype.hasOwnProperty,l=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,S={key:!0,ref:!0,__self:!0,__source:!0};function _(x,c,O){var s,p={},T=null,M=null;O!==void 0&&(T=""+O),c.key!==void 0&&(T=""+c.key),c.ref!==void 0&&(M=c.ref);for(s in c)R.call(c,s)&&!S.hasOwnProperty(s)&&(p[s]=c[s]);if(x&&x.defaultProps)for(s in c=x.defaultProps,c)p[s]===void 0&&(p[s]=c[s]);return{$$typeof:j,type:x,key:T,ref:M,props:p,_owner:l.current}}return I.Fragment=A,I.jsx=_,I.jsxs=_,I}var W={};/** * @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 te;function we(){return te||(te=1,process.env.NODE_ENV!=="production"&&function(){var k=b,j=Symbol.for("react.element"),A=Symbol.for("react.portal"),R=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),_=Symbol.for("react.provider"),x=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),s=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),M=Symbol.for("react.offscreen"),ae=Symbol.iterator,ke="@@iterator";function Ae(e){if(e===null||typeof e!="object")return null;var r=ae&&e[ae]||e[ke];return typeof r=="function"?r:null}var F=k.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function h(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n=1&&d>=0&&a[f]!==g[d];)d--;for(;f>=1&&d>=0;f--,d--)if(a[f]!==g[d]){if(f!==1||d!==1)do if(f--,d--,d<0||a[f]!==g[d]){var m=` `+a[f].replace(" at new "," at ");return e.displayName&&m.includes("")&&(m=m.replace("",e.displayName)),typeof e=="function"&&U.set(e,m),m}while(f>=1&&d>=0);break}}}finally{G=!1,z.current=u,Ve(),Error.prepareStackTrace=o}var N=e?e.displayName||e.name:"",w=N?V(N):"";return typeof e=="function"&&U.set(e,w),w}function Be(e,r,t){return he(e,!1)}function Je(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function B(e,r,t){if(e==null)return"";if(typeof e=="function")return he(e,Je(e));if(typeof e=="string")return V(e);switch(e){case O:return V("Suspense");case s:return V("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case c:return Be(e.render);case p:return B(e.type,r,t);case T:{var n=e,o=n._payload,u=n._init;try{return B(u(o),r,t)}catch{}}}return""}var $=Object.prototype.hasOwnProperty,ge={},ye=F.ReactDebugCurrentFrame;function J(e){if(e){var r=e._owner,t=B(e.type,e._source,r?r.type:null);ye.setExtraStackFrame(t)}else ye.setExtraStackFrame(null)}function ze(e,r,t,n,o){{var u=Function.call.bind($);for(var i in e)if(u(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var g=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(f){a=f}a&&!(a instanceof Error)&&(J(o),h("%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).",n||"React class",t,i,typeof a),J(null)),a instanceof Error&&!(a.message in ge)&&(ge[a.message]=!0,J(o),h("Failed %s type: %s",t,a.message),J(null))}}}var Ke=Array.isArray;function X(e){return Ke(e)}function Ge(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Xe(e){try{return me(e),!1}catch{return!0}}function me(e){return""+e}function be(e){if(Xe(e))return h("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ge(e)),me(e)}var L=F.ReactCurrentOwner,qe={key:!0,ref:!0,__self:!0,__source:!0},Ee,Re,q;q={};function He(e){if($.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ze(e){if($.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Qe(e,r){if(typeof e.ref=="string"&&L.current&&r&&L.current.stateNode!==r){var t=E(L.current.type);q[t]||(h('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',E(L.current.type),e.ref),q[t]=!0)}}function er(e,r){{var t=function(){Ee||(Ee=!0,h("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function rr(e,r){{var t=function(){Re||(Re=!0,h("%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)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var tr=function(e,r,t,n,o,u,i){var a={$$typeof:j,type:e,key:r,ref:t,props:i,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function nr(e,r,t,n,o){{var u,i={},a=null,g=null;t!==void 0&&(be(t),a=""+t),Ze(r)&&(be(r.key),a=""+r.key),He(r)&&(g=r.ref,Qe(r,o));for(u in r)$.call(r,u)&&!qe.hasOwnProperty(u)&&(i[u]=r[u]);if(e&&e.defaultProps){var f=e.defaultProps;for(u in f)i[u]===void 0&&(i[u]=f[u])}if(a||g){var d=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&er(i,d),g&&rr(i,d)}return tr(e,a,g,o,n,L.current,i)}}var H=F.ReactCurrentOwner,_e=F.ReactDebugCurrentFrame;function D(e){if(e){var r=e._owner,t=B(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}var Z;Z=!1;function Q(e){return typeof e=="object"&&e!==null&&e.$$typeof===j}function xe(){{if(H.current){var e=E(H.current.type);if(e)return` Check the render method of \``+e+"`."}return""}}function ar(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return` Check your code at `+r+":"+t+"."}return""}}var Te={};function ir(e){{var r=xe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=` Check the top-level render call using <`+t+">.")}return r}}function je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=ir(r);if(Te[t])return;Te[t]=!0;var n="";e&&e._owner&&e._owner!==H.current&&(n=" It was passed a child from "+E(e._owner.type)+"."),D(e),h('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),D(null)}}function Oe(e,r){{if(typeof e!="object")return;if(X(e))for(var t=0;t",a=" Did you accidentally export a JSX literal instead of a component?"):f=typeof e,h("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",f,a)}var d=nr(e,r,t,o,u);if(d==null)return d;if(i){var m=r.children;if(m!==void 0)if(n)if(X(m)){for(var N=0;N0?"{key: someKey, "+y.join(": ..., ")+": ...}":"{key: someKey}";if(!Ce[w+ee]){var dr=y.length>0?"{"+y.join(": ..., ")+": ...}":"{}";h(`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} />`,ee,w,dr,w),Ce[w+ee]=!0}}return e===R?sr(d):or(d),d}}function ur(e,r,t){return Se(e,r,t,!0)}function lr(e,r,t){return Se(e,r,t,!1)}var cr=lr,fr=ur;W.Fragment=R,W.jsx=cr,W.jsxs=fr}()),W}process.env.NODE_ENV==="production"?C.exports=Pe():C.exports=we();var v=C.exports;const pr="";function ne({data:k,onClickNode:j,onClickContentDel:A,showDeleteTitle:R}){const[l,S]=b.useState({}),_=b.useCallback(s=>{s.extend=!0,Array.isArray(s.children)&&s.children.forEach(p=>{_(p)}),S(s)},[]),x=(s,p)=>{s.extend=p,S({...s})},c=()=>Array.isArray(l.children)&&!!l.children.length,O=()=>Array.isArray(l.member)&&!!l.member.length;return b.useEffect(()=>{_(k)},[k,_]),v.jsx("table",{className:"org-table",style:{display:l.title?"block":"none"},children:v.jsxs("tbody",{children:[v.jsx("tr",{children:v.jsxs("td",{colSpan:Array.isArray(l.children)?l.children.length*2:1,className:`${c()||"org-parent-level"} ${c()&&l.extend?"org-extend":""}`,children:[v.jsx("div",{className:"org-node",children:v.jsxs("div",{className:"org-container",onClick:()=>j(l),children:[v.jsx("div",{className:`org-title ${l.titleClass||""}`,children:l.title}),O()&&v.jsx("div",{className:`org-content ${l.contentClass||""}`,children:l.member.map((s,p)=>v.jsxs("div",{className:"org-content-item",children:[v.jsxs("div",{className:"item-box",children:[v.jsx("p",{className:"item-title",children:s.name}),v.jsx("p",{className:"item-add",children:s.add})]}),l.title==R&&v.jsx("div",{className:"avat",children:v.jsx("i",{className:"iconfont icon-shanchu",style:{color:"red",cursor:"pointer"},onClick:T=>{T.stopPropagation(),A(l,s,p)}})})]},p))})]})}),v.jsx("div",{className:"org-extend-arrow",style:{display:c()?"block":"none"},onClick:()=>x(l,!l.extend)})]})}),v.jsx("tr",{children:c()&&l.extend&&l.children.map((s,p)=>v.jsx("td",{colSpan:2,className:`org-child-level ${c()?"":"last-child"}`,children:v.jsx(ne,{data:s,onClickNode:j,onClickContentDel:A,showDeleteTitle:R})},p))})]})})}return ne});