@squeed/flow-sdk 0.1.8 → 0.1.10
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +116 -102
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -354,5 +354,5 @@ __p += '`),vr&&(De+=`' +
|
|
|
354
354
|
function print() { __p += __j.call(arguments, '') }
|
|
355
355
|
`:`;
|
|
356
356
|
`)+De+`return __p
|
|
357
|
-
}`;var sr=M1(function(){return mr(F,Ue+"return "+De).apply(t,H)});if(sr.source=De,Xf(sr))throw sr;return sr}function nO(f){return wr(f).toLowerCase()}function aO(f){return wr(f).toUpperCase()}function iO(f,v,y){if(f=wr(f),f&&(y||v===t))return V0(f);if(!f||!(v=Ut(v)))return f;var R=hn(f),B=hn(v),F=G0(R,B),H=W0(R,B)+1;return ca(R,F,H).join("")}function oO(f,v,y){if(f=wr(f),f&&(y||v===t))return f.slice(0,H0(f)+1);if(!f||!(v=Ut(v)))return f;var R=hn(f),B=W0(R,hn(v))+1;return ca(R,0,B).join("")}function sO(f,v,y){if(f=wr(f),f&&(y||v===t))return f.replace(Nr,"");if(!f||!(v=Ut(v)))return f;var R=hn(f),B=G0(R,hn(v));return ca(R,B).join("")}function uO(f,v){var y=D,R=I;if(Fr(v)){var B="separator"in v?v.separator:B;y="length"in v?ir(v.length):y,R="omission"in v?Ut(v.omission):R}f=wr(f);var F=f.length;if(Ei(f)){var H=hn(f);F=H.length}if(y>=F)return f;var J=y-Ci(R);if(J<1)return R;var ie=H?ca(H,0,J).join(""):f.slice(0,J);if(B===t)return ie+R;if(H&&(J+=ie.length-J),Qf(B)){if(f.slice(J).search(B)){var Se,Te=ie;for(B.global||(B=hf(B.source,wr(ft.exec(B))+"g")),B.lastIndex=0;Se=B.exec(Te);)var De=Se.index;ie=ie.slice(0,De===t?J:De)}}else if(f.indexOf(Ut(B),J)!=J){var Le=ie.lastIndexOf(B);Le>-1&&(ie=ie.slice(0,Le))}return ie+R}function lO(f){return f=wr(f),f&&or.test(f)?f.replace(Fe,ND):f}var fO=Di(function(f,v,y){return f+(y?" ":"")+v.toUpperCase()}),rc=kb("toUpperCase");function B1(f,v,y){return f=wr(f),v=y?t:v,v===t?MD(f)?$D(f):_D(f):f.match(v)||[]}var M1=lr(function(f,v){try{return Gt(f,t,v)}catch(y){return Xf(y)?y:new rr(y)}}),cO=$n(function(f,v){return Qt(v,function(y){y=Tn(y),Fn(f,y,Yf(f[y],f))}),f});function dO(f){var v=f==null?0:f.length,y=Ze();return f=v?Lr(f,function(R){if(typeof R[1]!="function")throw new Jt(o);return[y(R[0]),R[1]]}):[],lr(function(R){for(var B=-1;++B<v;){var F=f[B];if(Gt(F[0],this,R))return Gt(F[1],this,R)}})}function vO(f){return NI(rn(f,d))}function tc(f){return function(){return f}}function hO(f,v){return f==null||f!==f?v:f}var gO=Ob(),pO=Ob(!0);function qt(f){return f}function nc(f){return db(typeof f=="function"?f:rn(f,d))}function yO(f){return hb(rn(f,d))}function mO(f,v){return gb(f,rn(v,d))}var bO=lr(function(f,v){return function(y){return Co(y,f,v)}}),wO=lr(function(f,v){return function(y){return Co(f,y,v)}});function ac(f,v,y){var R=it(v),B=Ys(v,R);y==null&&!(Fr(v)&&(B.length||!R.length))&&(y=v,v=f,f=this,B=Ys(v,it(v)));var F=!(Fr(y)&&"chain"in y)||!!y.chain,H=Gn(f);return Qt(B,function(J){var ie=v[J];f[J]=ie,H&&(f.prototype[J]=function(){var Se=this.__chain__;if(F||Se){var Te=f(this.__wrapped__),De=Te.__actions__=kt(this.__actions__);return De.push({func:ie,args:arguments,thisArg:f}),Te.__chain__=Se,Te}return ie.apply(f,ia([this.value()],arguments))})}),f}function xO(){return ct._===this&&(ct._=KD),this}function ic(){}function EO(f){return f=ir(f),lr(function(v){return pb(v,f)})}var CO=Of(Lr),_O=Of(q0),SO=Of(sf);function k1(f){return Gf(f)?uf(Tn(f)):rB(f)}function TO(f){return function(v){return f==null?t:Ua(f,v)}}var RO=Nb(),AO=Nb(!0);function oc(){return[]}function sc(){return!1}function PO(){return{}}function DO(){return""}function IO(){return!0}function BO(f,v){if(f=ir(f),f<1||f>$)return[];var y=K,R=wt(f,K);v=Ze(v),f-=K;for(var B=cf(R,v);++y<f;)v(y);return B}function MO(f){return tr(f)?Lr(f,Tn):Ht(f)?[f]:kt(e1(wr(f)))}function kO(f){var v=++UD;return wr(f)+v}var LO=ru(function(f,v){return f+v},0),OO=qf("ceil"),qO=ru(function(f,v){return f/v},1),NO=qf("floor");function FO(f){return f&&f.length?js(f,qt,Ef):t}function zO(f,v){return f&&f.length?js(f,Ze(v,2),Ef):t}function $O(f){return z0(f,qt)}function VO(f,v){return z0(f,Ze(v,2))}function GO(f){return f&&f.length?js(f,qt,Tf):t}function WO(f,v){return f&&f.length?js(f,Ze(v,2),Tf):t}var UO=ru(function(f,v){return f*v},1),HO=qf("round"),KO=ru(function(f,v){return f-v},0);function jO(f){return f&&f.length?ff(f,qt):0}function YO(f,v){return f&&f.length?ff(f,Ze(v,2)):0}return O.after=yk,O.ary=c1,O.assign=aL,O.assignIn=S1,O.assignInWith=hu,O.assignWith=iL,O.at=oL,O.before=d1,O.bind=Yf,O.bindAll=cO,O.bindKey=v1,O.castArray=Pk,O.chain=u1,O.chunk=NB,O.compact=FB,O.concat=zB,O.cond=dO,O.conforms=vO,O.constant=tc,O.countBy=jM,O.create=sL,O.curry=h1,O.curryRight=g1,O.debounce=p1,O.defaults=uL,O.defaultsDeep=lL,O.defer=mk,O.delay=bk,O.difference=$B,O.differenceBy=VB,O.differenceWith=GB,O.drop=WB,O.dropRight=UB,O.dropRightWhile=HB,O.dropWhile=KB,O.fill=jB,O.filter=ZM,O.flatMap=JM,O.flatMapDeep=ek,O.flatMapDepth=rk,O.flatten=a1,O.flattenDeep=YB,O.flattenDepth=ZB,O.flip=wk,O.flow=gO,O.flowRight=pO,O.fromPairs=XB,O.functions=pL,O.functionsIn=yL,O.groupBy=tk,O.initial=JB,O.intersection=eM,O.intersectionBy=rM,O.intersectionWith=tM,O.invert=bL,O.invertBy=wL,O.invokeMap=ak,O.iteratee=nc,O.keyBy=ik,O.keys=it,O.keysIn=Ot,O.map=uu,O.mapKeys=EL,O.mapValues=CL,O.matches=yO,O.matchesProperty=mO,O.memoize=fu,O.merge=_L,O.mergeWith=T1,O.method=bO,O.methodOf=wO,O.mixin=ac,O.negate=cu,O.nthArg=EO,O.omit=SL,O.omitBy=TL,O.once=xk,O.orderBy=ok,O.over=CO,O.overArgs=Ek,O.overEvery=_O,O.overSome=SO,O.partial=Zf,O.partialRight=y1,O.partition=sk,O.pick=RL,O.pickBy=R1,O.property=k1,O.propertyOf=TO,O.pull=oM,O.pullAll=o1,O.pullAllBy=sM,O.pullAllWith=uM,O.pullAt=lM,O.range=RO,O.rangeRight=AO,O.rearg=Ck,O.reject=fk,O.remove=fM,O.rest=_k,O.reverse=Kf,O.sampleSize=dk,O.set=PL,O.setWith=DL,O.shuffle=vk,O.slice=cM,O.sortBy=pk,O.sortedUniq=mM,O.sortedUniqBy=bM,O.split=JL,O.spread=Sk,O.tail=wM,O.take=xM,O.takeRight=EM,O.takeRightWhile=CM,O.takeWhile=_M,O.tap=FM,O.throttle=Tk,O.thru=su,O.toArray=E1,O.toPairs=A1,O.toPairsIn=P1,O.toPath=MO,O.toPlainObject=_1,O.transform=IL,O.unary=Rk,O.union=SM,O.unionBy=TM,O.unionWith=RM,O.uniq=AM,O.uniqBy=PM,O.uniqWith=DM,O.unset=BL,O.unzip=jf,O.unzipWith=s1,O.update=ML,O.updateWith=kL,O.values=Mi,O.valuesIn=LL,O.without=IM,O.words=B1,O.wrap=Ak,O.xor=BM,O.xorBy=MM,O.xorWith=kM,O.zip=LM,O.zipObject=OM,O.zipObjectDeep=qM,O.zipWith=NM,O.entries=A1,O.entriesIn=P1,O.extend=S1,O.extendWith=hu,ac(O,O),O.add=LO,O.attempt=M1,O.camelCase=FL,O.capitalize=D1,O.ceil=OO,O.clamp=OL,O.clone=Dk,O.cloneDeep=Bk,O.cloneDeepWith=Mk,O.cloneWith=Ik,O.conformsTo=kk,O.deburr=I1,O.defaultTo=hO,O.divide=qO,O.endsWith=zL,O.eq=pn,O.escape=$L,O.escapeRegExp=VL,O.every=YM,O.find=XM,O.findIndex=t1,O.findKey=fL,O.findLast=QM,O.findLastIndex=n1,O.findLastKey=cL,O.floor=NO,O.forEach=l1,O.forEachRight=f1,O.forIn=dL,O.forInRight=vL,O.forOwn=hL,O.forOwnRight=gL,O.get=Jf,O.gt=Lk,O.gte=Ok,O.has=mL,O.hasIn=ec,O.head=i1,O.identity=qt,O.includes=nk,O.indexOf=QB,O.inRange=qL,O.invoke=xL,O.isArguments=ja,O.isArray=tr,O.isArrayBuffer=qk,O.isArrayLike=Lt,O.isArrayLikeObject=Ur,O.isBoolean=Nk,O.isBuffer=da,O.isDate=Fk,O.isElement=zk,O.isEmpty=$k,O.isEqual=Vk,O.isEqualWith=Gk,O.isError=Xf,O.isFinite=Wk,O.isFunction=Gn,O.isInteger=m1,O.isLength=du,O.isMap=b1,O.isMatch=Uk,O.isMatchWith=Hk,O.isNaN=Kk,O.isNative=jk,O.isNil=Zk,O.isNull=Yk,O.isNumber=w1,O.isObject=Fr,O.isObjectLike=Vr,O.isPlainObject=Po,O.isRegExp=Qf,O.isSafeInteger=Xk,O.isSet=x1,O.isString=vu,O.isSymbol=Ht,O.isTypedArray=Bi,O.isUndefined=Qk,O.isWeakMap=Jk,O.isWeakSet=eL,O.join=nM,O.kebabCase=GL,O.last=nn,O.lastIndexOf=aM,O.lowerCase=WL,O.lowerFirst=UL,O.lt=rL,O.lte=tL,O.max=FO,O.maxBy=zO,O.mean=$O,O.meanBy=VO,O.min=GO,O.minBy=WO,O.stubArray=oc,O.stubFalse=sc,O.stubObject=PO,O.stubString=DO,O.stubTrue=IO,O.multiply=UO,O.nth=iM,O.noConflict=xO,O.noop=ic,O.now=lu,O.pad=HL,O.padEnd=KL,O.padStart=jL,O.parseInt=YL,O.random=NL,O.reduce=uk,O.reduceRight=lk,O.repeat=ZL,O.replace=XL,O.result=AL,O.round=HO,O.runInContext=ne,O.sample=ck,O.size=hk,O.snakeCase=QL,O.some=gk,O.sortedIndex=dM,O.sortedIndexBy=vM,O.sortedIndexOf=hM,O.sortedLastIndex=gM,O.sortedLastIndexBy=pM,O.sortedLastIndexOf=yM,O.startCase=eO,O.startsWith=rO,O.subtract=KO,O.sum=jO,O.sumBy=YO,O.template=tO,O.times=BO,O.toFinite=Wn,O.toInteger=ir,O.toLength=C1,O.toLower=nO,O.toNumber=an,O.toSafeInteger=nL,O.toString=wr,O.toUpper=aO,O.trim=iO,O.trimEnd=oO,O.trimStart=sO,O.truncate=uO,O.unescape=lO,O.uniqueId=kO,O.upperCase=fO,O.upperFirst=rc,O.each=l1,O.eachRight=f1,O.first=i1,ac(O,(function(){var f={};return _n(O,function(v,y){br.call(O.prototype,y)||(f[y]=v)}),f})(),{chain:!1}),O.VERSION=n,Qt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){O[f].placeholder=O}),Qt(["drop","take"],function(f,v){dr.prototype[f]=function(y){y=y===t?1:Jr(ir(y),0);var R=this.__filtered__&&!v?new dr(this):this.clone();return R.__filtered__?R.__takeCount__=wt(y,R.__takeCount__):R.__views__.push({size:wt(y,K),type:f+(R.__dir__<0?"Right":"")}),R},dr.prototype[f+"Right"]=function(y){return this.reverse()[f](y).reverse()}}),Qt(["filter","map","takeWhile"],function(f,v){var y=v+1,R=y==N||y==W;dr.prototype[f]=function(B){var F=this.clone();return F.__iteratees__.push({iteratee:Ze(B,3),type:y}),F.__filtered__=F.__filtered__||R,F}}),Qt(["head","last"],function(f,v){var y="take"+(v?"Right":"");dr.prototype[f]=function(){return this[y](1).value()[0]}}),Qt(["initial","tail"],function(f,v){var y="drop"+(v?"":"Right");dr.prototype[f]=function(){return this.__filtered__?new dr(this):this[y](1)}}),dr.prototype.compact=function(){return this.filter(qt)},dr.prototype.find=function(f){return this.filter(f).head()},dr.prototype.findLast=function(f){return this.reverse().find(f)},dr.prototype.invokeMap=lr(function(f,v){return typeof f=="function"?new dr(this):this.map(function(y){return Co(y,f,v)})}),dr.prototype.reject=function(f){return this.filter(cu(Ze(f)))},dr.prototype.slice=function(f,v){f=ir(f);var y=this;return y.__filtered__&&(f>0||v<0)?new dr(y):(f<0?y=y.takeRight(-f):f&&(y=y.drop(f)),v!==t&&(v=ir(v),y=v<0?y.dropRight(-v):y.take(v-f)),y)},dr.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},dr.prototype.toArray=function(){return this.take(K)},_n(dr.prototype,function(f,v){var y=/^(?:filter|find|map|reject)|While$/.test(v),R=/^(?:head|last)$/.test(v),B=O[R?"take"+(v=="last"?"Right":""):v],F=R||/^find/.test(v);B&&(O.prototype[v]=function(){var H=this.__wrapped__,J=R?[1]:arguments,ie=H instanceof dr,Se=J[0],Te=ie||tr(H),De=function(cr){var vr=B.apply(O,ia([cr],J));return R&&Le?vr[0]:vr};Te&&y&&typeof Se=="function"&&Se.length!=1&&(ie=Te=!1);var Le=this.__chain__,Ue=!!this.__actions__.length,Qe=F&&!Le,sr=ie&&!Ue;if(!F&&Te){H=sr?H:new dr(this);var Je=f.apply(H,J);return Je.__actions__.push({func:su,args:[De],thisArg:t}),new en(Je,Le)}return Qe&&sr?f.apply(this,J):(Je=this.thru(De),Qe?R?Je.value()[0]:Je.value():Je)})}),Qt(["pop","push","shift","sort","splice","unshift"],function(f){var v=Ms[f],y=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",R=/^(?:pop|shift)$/.test(f);O.prototype[f]=function(){var B=arguments;if(R&&!this.__chain__){var F=this.value();return v.apply(tr(F)?F:[],B)}return this[y](function(H){return v.apply(tr(H)?H:[],B)})}}),_n(dr.prototype,function(f,v){var y=O[v];if(y){var R=y.name+"";br.call(Ri,R)||(Ri[R]=[]),Ri[R].push({name:v,func:y})}}),Ri[eu(t,b).name]=[{name:"wrapper",func:t}],dr.prototype.clone=lI,dr.prototype.reverse=fI,dr.prototype.value=cI,O.prototype.at=zM,O.prototype.chain=$M,O.prototype.commit=VM,O.prototype.next=GM,O.prototype.plant=UM,O.prototype.reverse=HM,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=KM,O.prototype.first=O.prototype.head,po&&(O.prototype[po]=WM),O}),_i=VD();za?((za.exports=_i)._=_i,tf._=_i):ct._=_i}).call(wW)})(Go,Go.exports)),Go.exports}var hr=xW();const z2=Sl(hr);function EW({cyParams:r,cyInst:e,layoutParams:t,layoutDebounce:n=50,children:a,init:i=()=>{},onCyInit:o}){const[s,l]=Re.useState(!1),u=Re.useRef(null),c=Re.useRef(null),d=Re.useRef(null),h=Re.useRef(!0),g=Re.useCallback(()=>{var m;d.current!==null&&d.current.stop(),c.current&&(d.current=c.current.layout(t),(m=d.current)==null||m.run())},[t]),p=z2.debounce(g,n);Re.useEffect(()=>{if(!u.current)return;const m=un({container:u.current,...r}),b=u.current.querySelector(".cytoscape-react-nodes-and-edges");if(b&&m.domNode({dom_container:b}),c.current=e||m,u.current&&(u.current.cy=c.current),o==null||o(c.current),i(m),u.current&&c.current){const x=u.current.parentElement;let C=0,T=0;x&&(C=x.clientHeight,T=x.clientWidth,C===0&&(C=window.innerHeight-x.getBoundingClientRect().top-100),T===0&&(T=window.innerWidth)),C>0&&T>0&&(u.current.style.width=`${T}px`,u.current.style.height=`${C}px`),c.current.resize(),r.zoom&&r.pan&&c.current.viewport({zoom:r.zoom,pan:r.pan})}l(!0);const w=new ResizeObserver(z2.debounce(()=>{if(u.current&&c.current){const x=u.current.parentElement;let C=0,T=0;x&&(C=x.clientHeight,T=x.clientWidth,C===0&&(C=window.innerHeight-x.getBoundingClientRect().top-100),T===0&&(T=window.innerWidth),C>0&&T>0&&(u.current.style.width=`${T}px`,u.current.style.height=`${C}px`));const S=c.current.zoom()!==void 0?{zoom:c.current.zoom(),pan:c.current.pan()}:null;c.current.resize(),S&&c.current.viewport(S)}},50));return u.current&&w.observe(u.current),()=>{w.disconnect();try{m.destroy()}catch{}c.current=null,l(!1)}},[]),Re.useEffect(()=>{h.current?(h.current=!1,g()):p()},[s,t,p,g]);const E=Re.useMemo(()=>{var m;return c.current!==null?((m=Re.Children.map(a,b=>{var w;return b?Re.cloneElement(b,{key:(w=b==null?void 0:b.props)==null?void 0:w.id,cytoInstance:c.current,layout:p}):null}))==null?void 0:m.filter(Boolean))||[]:[]},[a,s,p]);return ue.jsx("div",{ref:u,className:"cytoscape-react-cy-container",style:{width:"100%",height:"100%",position:"relative",background:"transparent"},children:ue.jsx("div",{className:"cytoscape-react-nodes-and-edges",style:{pointerEvents:"none",position:"absolute",top:0,left:0,transformOrigin:"0 0",zIndex:10},children:E})})}function CW({cytoInstance:r,id:e,parent:t,label:n,children:a,layout:i,classes:o,styleCallback:s}){const l=Re.useRef(null);function u(h){if(s){const g=s(h);h.isParent()&&(h.style("shape","roundrectangle"),h.style(g))}}Re.useEffect(()=>{try{if(l.current){const h={id:e,dom:l.current};t&&(h.parent=t),n&&(h.label=n);const g=r.add({data:h,classes:o});u(g)}}catch{}return()=>{r.getElementById(e).remove()}},[l,t,n]),Re.useEffect(()=>{i();const h=r.getElementById(e);h&&h.isParent()&&u(h)},[e,a]),Re.useEffect(()=>{if(!s)return;const h=r.getElementById(e);h&&h.isParent()&&u(h)},[s]);function c(h){return Re.cloneElement(h,{cytoInstance:r,layout:i})}const d=Re.Children.map(a,c);return ue.jsx("div",{ref:l,className:"cytoscape-react-node",children:d})}const _W={name:"dagre",rankDir:"LR",fit:!1,padding:20,spacingFactor:1.3,animate:!1,nodeDimensionsIncludeLabels:!0,ranker:"network-simplex",rankSep:10,nodeSep:5,edgeSep:10,avoidOverlap:!0,edgeWeight:function(r){return 1},minLen:function(r){return 1},useSimpleEdgeFunction:!0,edgeRouting:!0,controlPoints:!0},UP={padding:20,motionBlur:!1,compound:!0,pixelRatio:"auto",zoomingEnabled:!0,userZoomingEnabled:!0,dragpan:!0,avoidOverlap:!0,panningEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,selectionType:"additive",minZoom:.01,maxZoom:1.5,autoungrabify:!0,styleEnabled:!0,hideEdgesOnViewport:!1,hideLabelsOnViewport:!0,headless:!1,touchTapThreshold:8,desktopTapThreshold:4,touchHoldDuration:500,desktopHoldDuration:1e3,autolock:!1,autounselectify:!1,wheelPanEnabled:!0,wheelPanThreshold:1,wheelPanDebounce:10,wheelAction:"pan"},HP={...UP,pixelRatio:1,motionBlur:!0,textureOnViewport:!0,wheelPanDebounce:20},SW={...HP,hideEdgesOnViewport:!0,hideLabelsOnViewport:!0},TW=({nodes:r,edges:e})=>{const{themeColor:t,edgeColor:n,direction:a,cyRef:i,callbacks:o,config:s,selectedNodeIds:l,setSelectedNodeIds:u,setSelectedEdgeId:c,setIsPerformanceMode:d,isZoomMode:h,setIsZoomMode:g,isMultiSelectMode:p,setIsMultiSelectMode:E,isDragMode:m,setIsDragMode:b,isEdgeHandlesEnabled:w,isArrayNodeMode:x}=Ia(),C=Re.useRef(null),T=Re.useRef(null),S=Re.useRef(x),_=r.length>200;Re.useEffect(()=>{d(_)},[_,d]);const{edgeSep:A,rankSep:P}=Re.useMemo(()=>hq(r.length),[r.length]),{bgColor:D}=us(t),{background:I,borderSecondary:k}=ls(),M=s.backgroundColor||I,N=Re.useCallback(U=>{if(U!=null&&U.includes("gray"))return"whitesmoke";if(!U)return ht(t);switch(U){case"dark":return ht(M);case"light":return ht(k);default:return ht(U)}},[t,M,k]),z=s.colorMode==="dark",W=Re.useMemo(()=>z?N(D):"dark",[z,D,N]),q=n?N(n):W,$=Re.useMemo(()=>vq(N),[N]),X=s.initialViewport||{pan:{x:0,y:0},zoom:.01},Y=Re.useMemo(()=>({..._?SW:r.length>100?HP:UP,style:$,zoom:X.zoom,pan:X.pan,minZoom:s.minZoom??.01,maxZoom:s.maxZoom??1.5}),[$,X,r.length,s.minZoom,s.maxZoom]),K=Re.useRef(!1),ee=Re.useRef();Re.useEffect(()=>()=>{clearTimeout(ee.current)},[]);const le=Re.useMemo(()=>({..._W,...a&&{rankDir:a},edgeSep:A,rankSep:P,get animate(){return K.current&&!_},animationDuration:300,animationEasing:"ease-in-out-cubic",stop:()=>{i.current&&(K.current||setTimeout(()=>{var U;(U=i.current)==null||U.fit(void 0,50)},100),clearTimeout(ee.current),ee.current=setTimeout(()=>{K.current=!0},500))}}),[a,A,P,i,_]),G=Re.useCallback(U=>{const fe=N(U||t);return{"corner-radius":50,"background-color":fe,color:fe,"border-color":fe}},[t,N]),V=Re.useCallback((U,fe,xe,ge)=>{let be={};return ge!=null&&ge.isInverted&&(ge==null?void 0:ge.source)===fe&&(be["target-arrow-shape"]="none",be["source-arrow-shape"]="triangle"),ge!=null&&ge.isEdgeAnimated?(be["line-style"]="dashed",be["line-dash-pattern"]=[32,18],be["line-dash-offset"]=0):ge!=null&&ge.isEdgeDashed?(be["line-style"]="dashed",be["line-dash-pattern"]=[],be["line-dash-offset"]=0):(be["line-style"]="solid",be["line-dash-pattern"]=[],be["line-dash-offset"]=0),a==="TB"&&(be["taxi-direction"]="downward"),a==="BT"&&(be["taxi-direction"]="upward"),a==="LR"&&(be["taxi-direction"]="rightward"),a==="RL"&&(be["taxi-direction"]="leftward"),be["line-color"]=q,be.color=q,be["target-arrow-color"]=q,be["source-arrow-color"]=q,be},[q,a]),j=Re.useRef(r);j.current=r;const re=Re.useRef(G);re.current=G;const de=Re.useRef(V);de.current=V,Re.useEffect(()=>{if(!i.current)return;const U=i.current,fe=()=>{U.nodes().forEach(xe=>{var ge,be;if(xe.isParent()){const Ae=j.current.find(Ie=>{var Be;return((Be=Ie.data)==null?void 0:Be.id)===xe.id()});xe.style(re.current((be=(ge=Ae==null?void 0:Ae.data)==null?void 0:ge.viewProps)==null?void 0:be.bgColor))}})};return U.on("add",fe),()=>{U.off("add",fe)}},[]),Re.useEffect(()=>{if(!i.current)return;const U=i.current;U.nodes().forEach(fe=>{var xe,ge;if(fe.isParent()){const be=r.find(Ae=>{var Ie;return((Ie=Ae.data)==null?void 0:Ie.id)===fe.id()});fe.style(G((ge=(xe=be==null?void 0:be.data)==null?void 0:xe.viewProps)==null?void 0:ge.bgColor))}}),e.forEach(({data:fe})=>{const xe=U.getElementById(fe.id);xe!=null&&xe.length&&(xe.data({isEdgeAnimated:fe.isEdgeAnimated,isEdgeDashed:fe.isEdgeDashed}),xe.style(V(xe,fe.source,fe.target,fe)))})},[r,e,q,G,V]);const se=Re.useRef(s);se.current=s;const Z=Re.useRef(h);Z.current=h;const Q=Re.useRef(w);Q.current=w,S.current=x,Re.useEffect(()=>{if(!i.current||!i.current.container)return;const U=i.current,fe=C.current;if(!fe)return;let xe=null,ge=null,be=0,Ae=0,Ie=0,Be=0,Oe=0;const He=Ve=>{Ve.preventDefault(),Ve.stopPropagation(),Z.current||Ve.metaKey||Ve.ctrlKey?(Ie+=Ve.deltaY,Be=Ve.clientX,Oe=Ve.clientY,ge===null&&(ge=requestAnimationFrame(()=>{ge=null;const er=se.current,$e=U.zoom(),ke=Ie;Ie=0;let pe=$e-ke*.05/100;pe=Math.max(er.minZoom??.01,Math.min(er.maxZoom??1.5,pe));const L=fe.getBoundingClientRect();U.zoom({level:pe,renderedPosition:{x:Be-L.left,y:Oe-L.top}})}))):(be+=Ve.deltaX,Ae+=Ve.deltaY,xe===null&&(xe=requestAnimationFrame(()=>{xe=null;const er=U.pan(),$e=U.zoom(),ke=.35,pe=be,L=Ae;be=0,Ae=0,U.pan({x:er.x+-pe*ke/$e,y:er.y+-L*ke/$e})})))};return fe.addEventListener("wheel",He,{passive:!1}),()=>{fe.removeEventListener("wheel",He),xe!==null&&cancelAnimationFrame(xe),ge!==null&&cancelAnimationFrame(ge)}},[i.current]),Re.useEffect(()=>{i.current&&i.current.userPanningEnabled(m)},[m]),Re.useEffect(()=>{if(!i.current)return;const U=i.current;U.boxSelectionEnabled(!!p),U.selectionType(p?"additive":"single"),U.userPanningEnabled(!p&&m)},[p,m]),Re.useEffect(()=>{T.current&&(w?T.current.enableDrawMode():T.current.disableDrawMode())},[w]);const ae=Re.useRef(l);ae.current=l,Re.useEffect(()=>{if(s.disableKeyboardShortcuts)return;const U=fe=>{var ge,be;const xe=fe.target;if(!(xe.tagName==="INPUT"||xe.tagName==="TEXTAREA"||xe.isContentEditable)&&((fe.key==="z"||fe.key==="Z")&&g(!Z.current),(fe.key==="m"||fe.key==="M")&&E(!p),(fe.key==="d"||fe.key==="D")&&b(!m),(fe.key==="Delete"||fe.key==="Backspace")&&ae.current.length>0)){fe.preventDefault();const Ae=ae.current.filter(Be=>Be!=="root");if(Ae.length===0)return;const Ie=i.current;for(const Be of Ae){const Oe=(ge=Ie==null?void 0:Ie.getElementById(Be))==null?void 0:ge.data();(be=o.onNodeDelete)==null||be.call(o,Be,Oe||{})}u([])}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[p,m,g,E,b,s.disableKeyboardShortcuts,o,u,i]),Re.useEffect(()=>()=>{if(i.current)try{i.current.removeAllListeners()}catch{}},[]);const te=Re.useMemo(()=>_?300:r.length>50?150:r.length>20?100:50,[r.length,_]),ce=Re.useMemo(()=>{var fe;const U=new Set;for(const xe of r)(fe=xe.data)!=null&&fe.parent&&U.add(xe.data.parent);return U},[r]),_e=Re.useMemo(()=>{var fe;const U=new Map;for(const xe of e)(fe=xe.data)!=null&&fe.source&&!U.has(xe.data.source)&&U.set(xe.data.source,xe.data);return U},[e]),ve=s.backgroundPattern||"dot";return ue.jsx(oq,{pattern:ve,backgroundColor:s.backgroundColor,children:ue.jsx(ye.Box,{ref:C,padding:0,width:"100%",height:"100%",flex:1,position:"relative",children:ue.jsxs(EW,{cyParams:Y,layoutParams:le,layoutDebounce:te,onCyInit:U=>{var xe;i.current=U,(xe=o.onCyInit)==null||xe.call(o,U);let fe=null;if(U.on("zoom pan",()=>{fe===null&&(fe=requestAnimationFrame(()=>{var ge;fe=null,(ge=o.onViewportChange)==null||ge.call(o,{zoom:U.zoom(),pan:U.pan()})}))}),U.on("select","edge",ge=>{var Ae;const be=ge.target;c(be.id()),(Ae=o.onEdgeSelect)==null||Ae.call(o,be.id(),be.data())}),U.on("unselect","edge",()=>{var ge;c(null),(ge=o.onEdgeDeselect)==null||ge.call(o)}),U.on("remove","edge",ge=>{var Ae;const be=ge.target;(Ae=o.onEdgeRemove)==null||Ae.call(o,be.id(),be.data())}),U.on("tap",":parent",ge=>{var Ae;const be=ge.target;u([be.id()]),(Ae=o.onNodeSelect)==null||Ae.call(o,be.id(),be.data())}),s.edgeHandles!==!1){const ge={canConnect:(Be,Oe)=>!Be.same(Oe),edgeParams:(Be,Oe)=>({data:{source:Be.id(),target:Oe.id(),label:""}}),loopAllowed:()=>!1,hoverDelay:500,snap:!1,snapThreshold:10,snapFrequency:5,noEdgeEventsInDraw:!0,disableBrowserGestures:!0,handlePosition:"left",handleNodes:"node",handleSize:20,handleColor:t||"#0ea5e9",handleOutlineColor:"#B92020FF",handleOutlineWidth:2,handleLineType:"ghost",handleLineWidth:2,preview:!0,ghostEdgeParams:()=>({}),edgeType:()=>"flat",nodeParams:()=>({})},be=U.edgehandles(ge);T.current=be,Q.current&&be.enableDrawMode();let Ae=null,Ie=null;U.on("ehstart",(Be,Oe)=>{Ie=Oe;const He=Be.originalEvent||window.event;if(He!=null&&He.clientX&&(He!=null&&He.clientY))Ae={x:He.clientX,y:He.clientY};else{const Ve=Oe.renderedPosition();Ae={x:Ve.x,y:Ve.y}}}),U.on("ehcancel",Be=>{if(!Ae||!Ie)return;const Oe=Be.originalEvent||window.event,He=Oe==null?void 0:Oe.clientX,Ve=Oe==null?void 0:Oe.clientY;if(He&&Ve&&o.onNodeCreate){const Xe=Math.abs(He-Ae.x),er=Math.abs(Ve-Ae.y);if(Math.max(Xe,er)>30){const $e=U.renderer().projectIntoViewport(He,Ve);o.onNodeCreate({type:"text",sourceNodeId:Ie.id(),position:{x:$e[0],y:$e[1]},isArrayMode:S.current})}}Ae=null,Ie=null}),U.on("ehcomplete",(Be,Oe,He)=>{var Ve;(Ve=o.onEdgeCreate)==null||Ve.call(o,Oe.id(),He.id())}),U.on("ehstop",()=>{Ae=null,Ie=null})}},children:[(r||[]).map(U=>{var Ie,Be,Oe,He,Ve,Xe,er,$e,ke;const fe=s.customViews||dq,xe=ce.has((Ie=U.data)==null?void 0:Ie.id)&&!((Be=U.data)!=null&&Be.parent),ge=xe?((Oe=U.data)==null?void 0:Oe.label)||((He=U.data)==null?void 0:He.headerTitle)||"Container":void 0,be=xe?fe.parentContainer:fe[U==null?void 0:U.data.type]||fe.text,Ae=_e.get((Ve=U.data)==null?void 0:Ve.id);return ue.jsx(CW,{id:(Xe=U.data)==null?void 0:Xe.id,parent:(er=U.data)==null?void 0:er.parent,label:ge,styleCallback:()=>{var pe,L;return G((L=(pe=U.data)==null?void 0:pe.viewProps)==null?void 0:L.bgColor)},children:Re.createElement(be,{...U,isInverted:Ae==null?void 0:Ae.isInverted,isParent:xe,key:`${($e=U.data)==null?void 0:$e.id}-${t}`})},(ke=U.data)==null?void 0:ke.id)}),(e||[]).map(({data:U})=>ue.jsx(gq,{id:U==null?void 0:U.id,source:U==null?void 0:U.source,target:U==null?void 0:U.target,label:U==null?void 0:U.label,isPerformanceMode:_,styleCallback:(fe,xe,ge)=>V(fe,xe,ge,U)},U==null?void 0:U.id))]})})})},RW=Re.memo(TW);var Wo=(r=>(r.TOP_DOWN="TB",r.BOTTOM_UP="BT",r.LEFT_RIGHT="LR",r.RIGHT_LEFT="RL",r.CENTER="C",r))(Wo||{});const AW=[{value:"BT",label:"Bottom to Up",icon:Ir.PiArrowUpLight,flowType:Wo.BOTTOM_UP},{value:"TB",label:"Top to Bottom",icon:Ir.PiArrowDownLight,flowType:Wo.TOP_DOWN},{value:"LR",label:"Left to Right",icon:Ir.PiArrowArcRightLight,flowType:Wo.LEFT_RIGHT},{value:"RL",label:"Right to Left",icon:Ir.PiArrowArcLeftLight,flowType:Wo.RIGHT_LEFT}],KP=()=>{const{cyRef:r,themeColor:e,direction:t,selectedNodeIds:n,setSelectedNodeIds:a,selectedEdgeId:i,setSelectedEdgeId:o,isZoomMode:s,setIsZoomMode:l,isMultiSelectMode:u,setIsMultiSelectMode:c,isDragMode:d,setIsDragMode:h,isEdgeHandlesEnabled:g,setIsEdgeHandlesEnabled:p,isArrayNodeMode:E,setIsArrayNodeMode:m,isPinned:b,setIsPinned:w,callbacks:x,config:C}=Ia(),T=C.colorMode==="dark",{background:S,border:_,colorInactive:A,colorText:P,colorActive:D,darkBackgroundSecondary:I}=ls(),[k,M]=Re.useState(!0),[N,z]=Re.useState(!1),[W,q]=Re.useState(!0),[$,X]=Re.useState(!1),[Y,K]=Re.useState(!1);Re.useEffect(()=>{const te=()=>q(window.innerWidth>=768);return te(),window.addEventListener("resize",te),()=>window.removeEventListener("resize",te)},[]),Re.useEffect(()=>{if(!W){M(!0);return}if(!b){M(!1);return}const te=_e=>{M(window.innerHeight-_e.clientY<=250)},ce=()=>M(!1);return window.addEventListener("mousemove",te),window.addEventListener("mouseleave",ce),()=>{window.removeEventListener("mousemove",te),window.removeEventListener("mouseleave",ce)}},[W,b]);const ee=Re.useCallback(te=>{const ce=r.current;if(!ce)return;const _e=C.minZoom??.01,ve=C.maxZoom??1.5,U=.02,fe=ce.zoomingEnabled(),xe=ce.userZoomingEnabled();ce.zoomingEnabled(!0),ce.userZoomingEnabled(!0);let ge=ce.zoom();switch(te){case"increase":ge=Math.min(ve,ge+U),ce.zoom(ge),ce.center();break;case"decrease":ge=Math.max(_e,ge-U),ce.zoom(ge),ce.center();break;case"reset":ce.fit(void 0,50);break}ce.zoomingEnabled(fe),ce.userZoomingEnabled(xe)},[r,C.minZoom,C.maxZoom]),le=k||N,G=C.renderSelectedNodeToolbar,V=n.length>0&&!!G,j=Re.useMemo(()=>{if(!V)return[];const te=r.current;return te?n.map(ce=>{const _e=te.getElementById(ce);return _e!=null&&_e.length?{..._e.data(),isParent:_e.isParent()}:{id:ce}}):[]},[V,n,r]),re=Re.useCallback(()=>{var te;a([]),(te=x.onNodeDeselect)==null||te.call(x)},[a,x]),de=C.renderSelectedEdgeToolbar,se=!!i&&!!de,Z=Re.useMemo(()=>{if(!se||!i)return null;const te=r.current;if(!te)return{id:i};const ce=te.getElementById(i);return ce!=null&&ce.length?ce.data():{id:i}},[se,i,r]),Q=Re.useCallback(()=>{var ce;o(null);const te=r.current;te&&te.edges().unselect(),(ce=x.onEdgeDeselect)==null||ce.call(x)},[o,r,x]),ae=C.renderBottomBar;return ae?ue.jsxs(ue.Fragment,{children:[V&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:G({selectedNodeIds:n,selectedNodeData:j,onDeselect:re})}),se&&Z&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:de({edgeId:i,edgeData:Z,onDeselect:Q})}),ue.jsx(ye.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",children:ae({zoomIn:()=>ee("increase"),zoomOut:()=>ee("decrease"),resetZoom:()=>ee("reset"),direction:t,isZoomMode:s,setIsZoomMode:l,isMultiSelectMode:u,setIsMultiSelectMode:c,isDragMode:d,setIsDragMode:h,isEdgeHandlesEnabled:g,setIsEdgeHandlesEnabled:p,isArrayNodeMode:E,setIsArrayNodeMode:m,selectedNodeIds:n,selectedNodeData:j,selectedEdgeId:i,selectedEdgeData:Z,onNodeDeselect:re,onEdgeDeselect:Q,callbacks:x})})]}):ue.jsxs(ue.Fragment,{children:[V&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:G({selectedNodeIds:n,selectedNodeData:j,onDeselect:re})}),se&&Z&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:de({edgeId:i,edgeData:Z,onDeselect:Q})}),!b&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:0,zIndex:101,w:3,children:ue.jsx(ye.Tooltip,{label:"Show Bottom Bar",placement:"top",fontSize:"xs",children:ue.jsx(ye.Flex,{align:"center",bg:S,borderColor:_,borderWidth:1,py:6,px:0,w:4,h:50,borderRadius:"15px",borderLeftRadius:0,onMouseEnter:()=>{z(!0),M(!0)},onMouseLeave:()=>z(!1),_hover:{bg:I},children:ue.jsx(ye.Icon,{ml:-1,as:Ir.PiLineVerticalBold,boxSize:5,color:_})})})}),ue.jsx(ye.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",transition:"opacity 0.3s ease-in, transform 0.3s ease",transform:le?"translateY(0)":"translateY(100%)",pointerEvents:le?"auto":"none",opacity:le?1:0,onMouseEnter:()=>{b||M(!0)},onMouseLeave:()=>{b||(M(!1),z(!1))},children:ue.jsxs(ye.Flex,{w:"100%",px:5,position:"absolute",bottom:5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[ue.jsx(ye.Box,{bg:S,alignContent:"center",h:50,borderColor:_,borderWidth:1,borderRadius:"15px",children:ue.jsxs(ye.HStack,{px:2,spacing:1,children:[ue.jsx(ye.Tooltip,{label:b?"Unpin":"Pin",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Pin",icon:ue.jsx(ye.Icon,{as:b?Ir.PiPushPinFill:Ir.PiPushPin,boxSize:5}),size:"sm",variant:"ghost",color:b?e:A,onClick:()=>{const te=!b;w(te),M(te)}})}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:"Zoom Out",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Zoom out",icon:ue.jsx(ye.Icon,{as:tq.HiMinus,boxSize:5}),size:"sm",variant:"ghost",color:P,onClick:()=>ee("decrease")})}),ue.jsx(ye.Tooltip,{label:"Zoom In",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Zoom in",icon:ue.jsx(ye.Icon,{as:gu.VscAdd,boxSize:5}),size:"sm",variant:"ghost",color:P,onClick:()=>ee("increase")})}),ue.jsx(ye.Tooltip,{label:"Reset Zoom",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Reset zoom",icon:ue.jsx(ye.Icon,{as:nq.GrPowerReset,boxSize:5}),size:"sm",variant:"ghost",color:P,onClick:()=>ee("reset")})}),!Y&&ue.jsxs(ue.Fragment,{children:[ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:s?"Zoom Mode (z)":"Pan Mode (z)",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle zoom mode",icon:ue.jsx(ye.Icon,{as:s?gu.VscZoomIn:gu.VscMove,boxSize:5}),size:"sm",variant:"ghost",color:s?e:A,onClick:()=>l(!s)})}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:u?"Multi-Select On (m)":"Multi-Select Off (m)",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle multi-select",icon:ue.jsx(ye.Icon,{as:gu.VscGroupByRefType,boxSize:5}),size:"sm",variant:"ghost",color:u?e:A,onClick:()=>c(!u)})}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:d?"Drag Mode On (d)":"Drag Mode Off (d)",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle drag mode",icon:ue.jsx(ye.Icon,{as:Ir.PiHandGrabbing,boxSize:5}),size:"sm",variant:"ghost",color:d?e:A,onClick:()=>h(!d)})}),C.edgeHandles!==!1&&ue.jsxs(ue.Fragment,{children:[ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:g?"Draw Mode On":"Draw Mode Off",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle draw mode",icon:ue.jsx(ye.Icon,{as:Ir.PiPencilSimpleLine,boxSize:5}),size:"sm",variant:"ghost",color:g?e:A,onClick:()=>p(!g)})})]}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:E?"List mode":"Set mode",placement:"top",fontSize:"xs",children:ue.jsx(ye.Flex,{cursor:"pointer",align:"center",onClick:()=>{var ce;const te=!E;m(te),(ce=x.onArrayModeChange)==null||ce.call(x,te)},_hover:{color:e},children:ue.jsx(ye.Text,{fontSize:"23px",color:E?e:A,children:E?"[]":"{}"})})})]}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:Y?"Expand toolbar":"Collapse toolbar",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle toolbar collapse",icon:ue.jsx(ye.Icon,{as:Y?Ir.PiCaretRight:Ir.PiCaretLeft,boxSize:5}),size:"sm",variant:"ghost",color:A,onClick:()=>K(!Y)})})]})}),ue.jsxs(ye.Box,{position:"relative",ml:"auto",children:[ue.jsx(ye.Box,{bg:S,borderWidth:1,borderColor:_,borderRadius:"15px",h:50,px:3,cursor:"pointer",onClick:()=>X(!$),children:ue.jsxs(ye.Flex,{align:"center",h:"100%",children:[ue.jsx(ye.Tooltip,{label:"Flow Direction",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Direction",icon:ue.jsx(ye.Icon,{as:Ir.PiCaretUp,boxSize:4}),size:"sm",variant:"ghost",color:A})}),ue.jsx(ye.Text,{fontSize:"xs",color:T?"whiteAlpha.600":"blackAlpha.500",ml:1,children:t})]})}),$&&ue.jsxs(ye.Box,{position:"absolute",bottom:"60px",right:0,bg:S,borderWidth:1,borderColor:_,borderRadius:"15px",p:2,zIndex:200,minW:"180px",shadow:"lg",onMouseLeave:()=>X(!1),children:[AW.map(te=>ue.jsxs(ye.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:T?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var ce;(ce=x.onDirectionChange)==null||ce.call(x,te.value),X(!1)},children:[ue.jsx(ye.Icon,{as:te.icon,boxSize:5,color:P}),ue.jsx(ye.Text,{fontSize:"sm",color:P,flex:1,whiteSpace:"nowrap",children:te.label}),t===te.value&&ue.jsx(ye.Icon,{as:q1.IoCheckmark,boxSize:4,color:D})]},te.value)),ue.jsxs(ye.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:T?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var te;(te=x.onDirectionChange)==null||te.call(x,"LR"),X(!1)},children:[ue.jsx(ye.Icon,{as:aq.TbAlignCenter,boxSize:5,color:P}),ue.jsx(ye.Text,{fontSize:"sm",color:P,flex:1,whiteSpace:"nowrap",children:"Center"}),t==="C"&&ue.jsx(ye.Icon,{as:q1.IoCheckmark,boxSize:4,color:D})]})]})]})]})})]})};KP.displayName="BottomBar";const PW=Re.memo(KP),DW=".cytoscape-react-nodes-and-edges{position:absolute!important;top:0!important;left:0!important;z-index:10!important;pointer-events:none!important;overflow:visible!important;transform-origin:0 0!important}.cytoscape-react-node{z-index:0!important;overflow:visible!important;pointer-events:auto!important;position:absolute!important;transform-origin:0 0!important}.cytoscape-react-node input,.cytoscape-react-node textarea{pointer-events:auto!important;user-select:text!important;cursor:text!important}.cytoscape-react-edge{overflow:visible!important;pointer-events:none!important}.cytoscape-react-cy-container{width:100%!important;height:100%!important;overflow:visible!important;position:relative!important;background:transparent!important}.cytoscape-react-cy-container canvas{display:inline!important;vertical-align:baseline!important;overflow:visible!important}.cytoscape-react-cy-container>div{overflow:visible!important}";let $2=!1;function IW(){if($2||typeof document>"u")return;const r=document.createElement("style");r.setAttribute("data-flow-sdk",""),r.textContent=DW,document.head.appendChild(r),$2=!0}function BW({title:r="untitled",nodes:e,edges:t,config:n={},callbacks:a={},className:i,style:o,showBottomBar:s=!0}){IW();const l=e||[],u=t||[];return ue.jsx(iq,{config:n,callbacks:a,children:ue.jsxs(ye.Box,{className:i,style:o,width:"100%",height:"100%",position:"relative",overflow:"hidden",children:[ue.jsx(RW,{nodes:l,edges:u}),s&&ue.jsx(PW,{})]})})}const Gl={label:"Untitled",description:"",isTask:!1,isLocked:!1},p0={id:null,type:"text",data:{...Gl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",borderColor:"transparent",borderRadius:25,borderWidth:0,boxShadow:"none",textOverflow:"ellipsis",fontWeight:"bold",textColor:"gray.800",textAlign:"center"}}},V2={id:null,type:"objectView",data:{...Gl,headerTitle:null,viewProps:{width:"100%",borderWidth:2,borderRadius:25,height:"100%",justifyContent:"space-between",flexDirection:"row",textColor:"gray.900"}}},MW={id:null,type:"arrayView",data:{...Gl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",textAlign:"center",borderRadius:25,fontSize:"5xl",borderWidth:2,textOverflow:"ellipsis",wordBreak:"keep-all",fontWeight:"bold",textColor:"gray.900",placeholder:"Start Typing"}}},G2={id:null,type:"workflowStep",data:{...Gl,viewProps:{width:"max-content !important",maxWidth:350,minWidth:280,height:"100%",borderRadius:15,borderWidth:3}}};let Pu;const kW=new Uint8Array(16);function LW(){if(!Pu&&(Pu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pu))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pu(kW)}const vt=[];for(let r=0;r<256;++r)vt.push((r+256).toString(16).slice(1));function OW(r,e=0){return vt[r[e+0]]+vt[r[e+1]]+vt[r[e+2]]+vt[r[e+3]]+"-"+vt[r[e+4]]+vt[r[e+5]]+"-"+vt[r[e+6]]+vt[r[e+7]]+"-"+vt[r[e+8]]+vt[r[e+9]]+"-"+vt[r[e+10]]+vt[r[e+11]]+vt[r[e+12]]+vt[r[e+13]]+vt[r[e+14]]+vt[r[e+15]]}const qW=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),W2={randomUUID:qW};function NW(r,e,t){if(W2.randomUUID&&!r)return W2.randomUUID();r=r||{};const n=r.random||(r.rng||LW)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,OW(n)}const Zt=r=>typeof r=="object",jP=r=>Array.isArray(r),FW=["order","position","selected","locked","grabbed","grabbable","scratch"],Aa=r=>Object.entries(r).reduce((e,[t,n])=>(!Zt(n)&&!t.startsWith("$")&&(e[t]=n),e),{}),y0=(r,e)=>typeof r=="string"&&r.startsWith("$")?im(r,e):Zt(r)&&!jP(r)?Object.entries(r).reduce((t,[n,a])=>(typeof a=="string"&&a.startsWith("$")&&n==="..."?(delete t["..."],t[n]={...im(a,e),...r}):typeof a=="string"&&a.startsWith("$")?t[n]=im(a,e):t[n]=a,t),{}):r,Pa=r=>Object.entries(r).reduce((e,[t,n])=>(Zt(n)&&t&&n&&!t.startsWith("$")&&(FW.includes(t)&&(t=t+"#"),e[t]=n),e),{}),ri=(r,e,{label:t,parent:n=void 0},a,i=null)=>(i!==null&&(Zt(i)||jP(i))&&(i=JSON.stringify(i,null,2)),{data:{parent:n,...r.data,id:e,text:t||"",label:t,code:i||null,type:r.type,description:a}}),ba=(r,e,t=null,n=null,a=null,i=!1,o=null)=>({data:{id:NW(),source:a?e:r,target:a?r:e,label:n||"",isInverted:a,isEdgeAnimated:i,parent:o}}),Da=(r,e=[])=>{const t={},n={};let a=[];if(r)for(const[i,o]of Object.entries(r))i.startsWith("$")&&i!=="$"?t[i.slice(1)]=o:i!=="$"?n[i]=o:i==="$"&&(a=o);return{newConfig:t,updatedObject:n,arrayObject:a}},Hi=(r,e)=>{let t=V2;const{view:n,borderColor:a,borderRadius:i,bgColor:o,textColor:s,fontSize:l,stepType:u}=e;r=n||r,u?t={...G2}:r==="object"?t=V2:r==="text"?t=p0:r==="array"?t=MW:r==="workflowStep"&&(t={...G2});const c=t.data.viewProps;return t.data.viewProps={...c,borderRadius:i||(u?15:50),bgColor:o,borderColor:a,textColor:s,fontSize:l},t.data.config=e,{config:t}},ss=(r,e)=>(r=e.find(n=>n.data.id===r)?`${r}.#`:r,r),im=(r,{ids:e,jsnObjct:t})=>{if(typeof r=="string"&&(r!=null&&r.startsWith("$"))){const n=r.replace("$","").replace("*","");r==null||r.endsWith("*");const a=e.find(s=>s.split(".").slice(-1)[0]===n||n===s);if(!a)return r;const i=zW(a,t);return JSON.stringify(i).includes(r)?r:i||r}return r},zW=(r,e)=>{let t=r.split(".").splice(1);return t=t[t.length-1]==="#"||t[t.length-1].includes("{")?t.slice(0,-2):t,(i=>t.reduce((o,s)=>{s=s.replace("[","").replace("]","");const{arrayObject:l}=Da(o);return o=l.length?l:o,o[s]},i))(e)};function Xi(r,e="root",t=[]){try{const{arrayObject:n}=Da(r);n.length&&(r=n);const a=Aa(r),i=Pa(r);return Zt(r)?(hr.isArray(r)||hr.isArray(r)&&e==="root"||!hr.isArray(r)&&Object.keys(a).length||e==="root")&&t.push(e):t.push(e),Object.keys(i).length&&!hr.isArray(r)?jo({chldPth:null,itrblObjct:i,nodes:t,path:e}):hr.isArray(r)&&r.forEach((o,s)=>{const l=Aa(o),u=Pa(o),{newConfig:c,arrayObject:d}=Da(o);let h=`${e}.${s}`;Zt(o)?Object.keys(l).length?(Xi(l,h,t),Object.keys(u).length&&!hr.isArray(o)&&jo({chldPth:h,itrblObjct:u,nodes:t,path:e})):Object.keys(u).length&&!hr.isArray(o)?jo({chldPth:h,itrblObjct:u,nodes:t,path:e}):hr.isArray(o)&&YP({chldPth:h,item:o,nodes:t,path:e}):t.push(h)}),{nodes:t}}catch{return{nodes:t}}}const jo=({chldPth:r,itrblObjct:e,nodes:t,path:n})=>Object.entries(e).forEach(([a,i],o)=>{const s=Aa(i),l=Pa(i),{newConfig:u,arrayObject:c}=Da(i);c.length&&(i=c),n.split(".").slice(0,2).join(".");let d=r?`${r}.${a}`:`${n}.${a}`;if(Zt(i)&&!hr.isArray(i)){const h=Object.keys(s).length===0;if(h&&(Hi("array",u),t.push(d)),Object.keys(s).length){const g=hr.isArray(i)?`${i.length||""}`:`{${Object.keys(i).length||""}}`;let p=d;h&&(p=`${d}.${g}`),Xi(i,p,t)}else Object.keys(l).length&&!hr.isArray(i)?jo({chldPth:d,itrblObjct:l,path:d,nodes:t}):Xi(i,d,t)}else hr.isArray(i)&&Xi(i,d,t)}),YP=({chldPth:r,item:e,nodes:t,path:n})=>e.forEach((a,i)=>{let o=`${r}.${i}`;const s=Pa(a),l=Aa(a);Zt(a)?!hr.isArray(a)&&Object.keys(l).length?Xi(a,o,t):Object.keys(s).length&&!hr.isArray(a)?jo({chldPth:o,itrblObjct:s,path:n,nodes:t}):hr.isArray(a)&&YP({chldPth:o,item:a,nodes:t,path:n}):t.push(o)}),il=[];let Yo;function Qi(r,e="root",t=[],n=[],a="untitled",i={hideDefaultObject:!1,sprtObjctKy:!1,isCntr:!1},o={}){if(!r||typeof r!="object")return console.error("Invalid object passed",r),{nodes:t,edges:n};const s=r;if(!Yo){const{nodes:c}=Xi(r);Yo={ids:c,jsnObjct:r}}let{hideDefaultObject:l,sprtObjctKy:u}=i;try{e=ss(e,t);const{newConfig:c,arrayObject:d}=Da(r),h=Object.keys(o).length>0?o:c;d.length&&(r=d);const g=Aa(r),p=Pa(r),{label:E,collapsed:m,parent:b}=h;if(!Zt(r))t.push(ri(p0,e,{label:E||e,parent:b},r,s));else if(hr.isArray(r)||hr.isArray(r)&&e==="root"){const{config:w}=Hi("array",h),x=hr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e==="root"?a:`${a} ${x}`;t.push(ri(w,e,{label:E||C,parent:b},r,hr.isArray(s)?{[a]:s}:s))}else if(!hr.isArray(r)&&Object.keys(g).length||e==="root"){const{config:w}=Hi(null,h),x=hr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e.split("."),T=C[C.length-1];let S=isNaN(Number(T))?null:Number(T)+1;const _=isNaN(Number(T))?T:C[C.length-2]+" "+S,A=e==="root"?a:_;let P=!1;Number.isNaN(Number(a))||(P=!0);const D=r;if(E){const{config:I}=Hi("object",h);t.push(ri(I,e,{label:E||`${E} ${x}`,parent:b},g,D))}else w.data.headerTitle=A,t.push(ri(w,e,{label:E,parent:b},g,D))}return m||(Object.keys(p).length&&!hr.isArray(r)?Zo({flowConfig:i,chldPth:null,edges:n,isInverted:null,itrblObjct:p,nodes:t,path:e,newConfig:h}):hr.isArray(r)&&r.forEach((w,x)=>{w=y0(w,Yo);const C=w,T=Aa(w),S=Pa(w),{newConfig:_,arrayObject:A}=Da(w);A.length&&(w=A);const{config:P}=Hi(typeof w=="string"?"text":"array",_),{hideConfig:D,sourceLabel:I,label:k,isEdgeAnimated:M,parent:N}=_;l=l||D;const z=e==="root"&&i.isCntr,W=e.split(".").slice(0,2).join("."),q=il.includes(W),$=i.isCntr&&q||x%2===0&&z;let X=`${e}.${x}`;X=ss(X,t),$&&il.push(X),Zt(w)?Object.keys(T).length&&!hr.isArray(w)?(n.push(ba(e,X,null,I,$,M)),Qi(w,X,t,n,k||x,i,_)):Object.keys(S).length&&!hr.isArray(w)?Zo({flowConfig:i,chldPth:X,isInverted:$,edges:n,itrblObjct:S,nodes:t,path:e,newConfig:_,forceIsInverted:!0}):hr.isArray(w)?ZP({flowConfig:i,chldPth:X,edges:n,isInverted:$,item:w,nodes:t,path:e}):Zt(w)&&Zo({flowConfig:i,chldPth:X,isInverted:$,edges:n,itrblObjct:[w],nodes:t,path:e,newConfig:_}):(n.push(ba(e,X,null,I,$,M)),t.push(ri(P,X,{label:k||String(w),parent:N},w,C)))})),{nodes:t,edges:n}}catch{return{nodes:t,edges:n}}}const Zo=({chldPth:r,flowConfig:e,edges:t,itrblObjct:n,nodes:a,isInverted:i,path:o,newConfig:s,forceIsInverted:l=!1})=>{let{hideDefaultObject:u,sprtObjctKy:c}=e;return Object.entries(n).forEach(([d,h],g)=>{h=y0(h,Yo);const p=h,E=Aa(h),m=Pa(h),{newConfig:b,arrayObject:w}=Da(h);w.length&&(h=w);const{hideConfig:x,sourceLabel:C,label:T,content:S,target:_,targetLabel:A,collapsed:P,isEdgeAnimated:D,parent:I}=b;u=u||x;const k=o==="root"&&e.isCntr,M=o.split(".").slice(0,2).join("."),N=il.includes(M);l||(i=e.isCntr&&N||g%2===0&&k);let z=r?`${r}.${d}`:`${o}.${d}`;if(z=ss(z,a),i&&il.push(z),_&&t.push(ba(z,_,null,A,i,D)),Zt(h)&&!hr.isArray(h)){t.push(ba(o,z,null,C,i,D));const W=c||Object.keys(E).length===0;if(W){const q=S?"object":"array",{config:$}=Hi(q,b);$.data.headerTitle=S?T:null,a.push(ri($,z,{label:T||d,parent:I},h,p))}if(Object.keys(E).length&&!u){const q=hr.isArray(h)?` ${h.length||""}`:`{${Object.keys(h).length||""}}`;let $=z;W&&($=`${z}.${q}`,$=ss($,a),t.push(ba(z,$,null,C,i,D))),Qi(h,$,a,t,T||d,e,b)}else Object.keys(m).length&&!hr.isArray(h)?Zo({chldPth:z,flowConfig:e,itrblObjct:m,path:z,edges:t,nodes:a,newConfig:b,isInverted:i}):Qi(h,z,a,t,d,e,b)}else hr.isArray(h)&&(t.push(ba(o,z,null,C,i,D)),Qi(h,z,a,t,d,e,b))})},ZP=({flowConfig:r,chldPth:e,edges:t,isInverted:n,item:a,nodes:i,path:o})=>a.forEach((s,l)=>{let u=`${e}.${l}`;u=ss(u,i);const c=s;s=y0(s,Yo);const d=Pa(s),h=Aa(s),{newConfig:g}=Da(s),{collapsed:p,label:E,parent:m,sourceLabel:b,isEdgeAnimated:w,content:x}=g;Zt(s)?!hr.isArray(s)&&Object.keys(h).length?(t.push(ba(o,u,null,b,n,w)),Qi(s,u,i,t,l,r,g)):Object.keys(d).length&&!hr.isArray(s)&&!p?Zo({chldPth:u,flowConfig:r,itrblObjct:d,path:o,edges:t,nodes:i,isInverted:n,newConfig:g}):hr.isArray(s)&&ZP({flowConfig:r,chldPth:u,edges:t,isInverted:n,item:s,nodes:i,path:o}):(t.push(ba(o,u,null,b,n,w)),i.push(ri(p0,u,{label:E||String(s),parent:m},s,c)))});exports.DynamicIcon=Tm;exports.FlowDiagram=BW;exports.contentObjTheme=Dn;exports.createFlowDiagram=Qi;exports.getChakraColorHex=ht;exports.getColorVariant=H2;exports.getDarkerHexColor=Gu;exports.useCustomColors=ls;exports.useStopPropagation=K2;exports.useThemeContentColors=us;
|
|
357
|
+
}`;var sr=M1(function(){return mr(F,Ue+"return "+De).apply(t,H)});if(sr.source=De,Xf(sr))throw sr;return sr}function nO(f){return wr(f).toLowerCase()}function aO(f){return wr(f).toUpperCase()}function iO(f,v,y){if(f=wr(f),f&&(y||v===t))return V0(f);if(!f||!(v=Ut(v)))return f;var R=hn(f),B=hn(v),F=G0(R,B),H=W0(R,B)+1;return ca(R,F,H).join("")}function oO(f,v,y){if(f=wr(f),f&&(y||v===t))return f.slice(0,H0(f)+1);if(!f||!(v=Ut(v)))return f;var R=hn(f),B=W0(R,hn(v))+1;return ca(R,0,B).join("")}function sO(f,v,y){if(f=wr(f),f&&(y||v===t))return f.replace(Nr,"");if(!f||!(v=Ut(v)))return f;var R=hn(f),B=G0(R,hn(v));return ca(R,B).join("")}function uO(f,v){var y=D,R=I;if(Fr(v)){var B="separator"in v?v.separator:B;y="length"in v?ir(v.length):y,R="omission"in v?Ut(v.omission):R}f=wr(f);var F=f.length;if(Ei(f)){var H=hn(f);F=H.length}if(y>=F)return f;var J=y-Ci(R);if(J<1)return R;var ie=H?ca(H,0,J).join(""):f.slice(0,J);if(B===t)return ie+R;if(H&&(J+=ie.length-J),Qf(B)){if(f.slice(J).search(B)){var Se,Te=ie;for(B.global||(B=hf(B.source,wr(ft.exec(B))+"g")),B.lastIndex=0;Se=B.exec(Te);)var De=Se.index;ie=ie.slice(0,De===t?J:De)}}else if(f.indexOf(Ut(B),J)!=J){var Le=ie.lastIndexOf(B);Le>-1&&(ie=ie.slice(0,Le))}return ie+R}function lO(f){return f=wr(f),f&&or.test(f)?f.replace(Fe,ND):f}var fO=Di(function(f,v,y){return f+(y?" ":"")+v.toUpperCase()}),rc=kb("toUpperCase");function B1(f,v,y){return f=wr(f),v=y?t:v,v===t?MD(f)?$D(f):_D(f):f.match(v)||[]}var M1=lr(function(f,v){try{return Gt(f,t,v)}catch(y){return Xf(y)?y:new rr(y)}}),cO=$n(function(f,v){return Qt(v,function(y){y=Tn(y),Fn(f,y,Yf(f[y],f))}),f});function dO(f){var v=f==null?0:f.length,y=Ze();return f=v?Lr(f,function(R){if(typeof R[1]!="function")throw new Jt(o);return[y(R[0]),R[1]]}):[],lr(function(R){for(var B=-1;++B<v;){var F=f[B];if(Gt(F[0],this,R))return Gt(F[1],this,R)}})}function vO(f){return NI(rn(f,d))}function tc(f){return function(){return f}}function hO(f,v){return f==null||f!==f?v:f}var gO=Ob(),pO=Ob(!0);function qt(f){return f}function nc(f){return db(typeof f=="function"?f:rn(f,d))}function yO(f){return hb(rn(f,d))}function mO(f,v){return gb(f,rn(v,d))}var bO=lr(function(f,v){return function(y){return Co(y,f,v)}}),wO=lr(function(f,v){return function(y){return Co(f,y,v)}});function ac(f,v,y){var R=it(v),B=Ys(v,R);y==null&&!(Fr(v)&&(B.length||!R.length))&&(y=v,v=f,f=this,B=Ys(v,it(v)));var F=!(Fr(y)&&"chain"in y)||!!y.chain,H=Gn(f);return Qt(B,function(J){var ie=v[J];f[J]=ie,H&&(f.prototype[J]=function(){var Se=this.__chain__;if(F||Se){var Te=f(this.__wrapped__),De=Te.__actions__=kt(this.__actions__);return De.push({func:ie,args:arguments,thisArg:f}),Te.__chain__=Se,Te}return ie.apply(f,ia([this.value()],arguments))})}),f}function xO(){return ct._===this&&(ct._=KD),this}function ic(){}function EO(f){return f=ir(f),lr(function(v){return pb(v,f)})}var CO=Of(Lr),_O=Of(q0),SO=Of(sf);function k1(f){return Gf(f)?uf(Tn(f)):rB(f)}function TO(f){return function(v){return f==null?t:Ua(f,v)}}var RO=Nb(),AO=Nb(!0);function oc(){return[]}function sc(){return!1}function PO(){return{}}function DO(){return""}function IO(){return!0}function BO(f,v){if(f=ir(f),f<1||f>$)return[];var y=K,R=wt(f,K);v=Ze(v),f-=K;for(var B=cf(R,v);++y<f;)v(y);return B}function MO(f){return tr(f)?Lr(f,Tn):Ht(f)?[f]:kt(e1(wr(f)))}function kO(f){var v=++UD;return wr(f)+v}var LO=ru(function(f,v){return f+v},0),OO=qf("ceil"),qO=ru(function(f,v){return f/v},1),NO=qf("floor");function FO(f){return f&&f.length?js(f,qt,Ef):t}function zO(f,v){return f&&f.length?js(f,Ze(v,2),Ef):t}function $O(f){return z0(f,qt)}function VO(f,v){return z0(f,Ze(v,2))}function GO(f){return f&&f.length?js(f,qt,Tf):t}function WO(f,v){return f&&f.length?js(f,Ze(v,2),Tf):t}var UO=ru(function(f,v){return f*v},1),HO=qf("round"),KO=ru(function(f,v){return f-v},0);function jO(f){return f&&f.length?ff(f,qt):0}function YO(f,v){return f&&f.length?ff(f,Ze(v,2)):0}return O.after=yk,O.ary=c1,O.assign=aL,O.assignIn=S1,O.assignInWith=hu,O.assignWith=iL,O.at=oL,O.before=d1,O.bind=Yf,O.bindAll=cO,O.bindKey=v1,O.castArray=Pk,O.chain=u1,O.chunk=NB,O.compact=FB,O.concat=zB,O.cond=dO,O.conforms=vO,O.constant=tc,O.countBy=jM,O.create=sL,O.curry=h1,O.curryRight=g1,O.debounce=p1,O.defaults=uL,O.defaultsDeep=lL,O.defer=mk,O.delay=bk,O.difference=$B,O.differenceBy=VB,O.differenceWith=GB,O.drop=WB,O.dropRight=UB,O.dropRightWhile=HB,O.dropWhile=KB,O.fill=jB,O.filter=ZM,O.flatMap=JM,O.flatMapDeep=ek,O.flatMapDepth=rk,O.flatten=a1,O.flattenDeep=YB,O.flattenDepth=ZB,O.flip=wk,O.flow=gO,O.flowRight=pO,O.fromPairs=XB,O.functions=pL,O.functionsIn=yL,O.groupBy=tk,O.initial=JB,O.intersection=eM,O.intersectionBy=rM,O.intersectionWith=tM,O.invert=bL,O.invertBy=wL,O.invokeMap=ak,O.iteratee=nc,O.keyBy=ik,O.keys=it,O.keysIn=Ot,O.map=uu,O.mapKeys=EL,O.mapValues=CL,O.matches=yO,O.matchesProperty=mO,O.memoize=fu,O.merge=_L,O.mergeWith=T1,O.method=bO,O.methodOf=wO,O.mixin=ac,O.negate=cu,O.nthArg=EO,O.omit=SL,O.omitBy=TL,O.once=xk,O.orderBy=ok,O.over=CO,O.overArgs=Ek,O.overEvery=_O,O.overSome=SO,O.partial=Zf,O.partialRight=y1,O.partition=sk,O.pick=RL,O.pickBy=R1,O.property=k1,O.propertyOf=TO,O.pull=oM,O.pullAll=o1,O.pullAllBy=sM,O.pullAllWith=uM,O.pullAt=lM,O.range=RO,O.rangeRight=AO,O.rearg=Ck,O.reject=fk,O.remove=fM,O.rest=_k,O.reverse=Kf,O.sampleSize=dk,O.set=PL,O.setWith=DL,O.shuffle=vk,O.slice=cM,O.sortBy=pk,O.sortedUniq=mM,O.sortedUniqBy=bM,O.split=JL,O.spread=Sk,O.tail=wM,O.take=xM,O.takeRight=EM,O.takeRightWhile=CM,O.takeWhile=_M,O.tap=FM,O.throttle=Tk,O.thru=su,O.toArray=E1,O.toPairs=A1,O.toPairsIn=P1,O.toPath=MO,O.toPlainObject=_1,O.transform=IL,O.unary=Rk,O.union=SM,O.unionBy=TM,O.unionWith=RM,O.uniq=AM,O.uniqBy=PM,O.uniqWith=DM,O.unset=BL,O.unzip=jf,O.unzipWith=s1,O.update=ML,O.updateWith=kL,O.values=Mi,O.valuesIn=LL,O.without=IM,O.words=B1,O.wrap=Ak,O.xor=BM,O.xorBy=MM,O.xorWith=kM,O.zip=LM,O.zipObject=OM,O.zipObjectDeep=qM,O.zipWith=NM,O.entries=A1,O.entriesIn=P1,O.extend=S1,O.extendWith=hu,ac(O,O),O.add=LO,O.attempt=M1,O.camelCase=FL,O.capitalize=D1,O.ceil=OO,O.clamp=OL,O.clone=Dk,O.cloneDeep=Bk,O.cloneDeepWith=Mk,O.cloneWith=Ik,O.conformsTo=kk,O.deburr=I1,O.defaultTo=hO,O.divide=qO,O.endsWith=zL,O.eq=pn,O.escape=$L,O.escapeRegExp=VL,O.every=YM,O.find=XM,O.findIndex=t1,O.findKey=fL,O.findLast=QM,O.findLastIndex=n1,O.findLastKey=cL,O.floor=NO,O.forEach=l1,O.forEachRight=f1,O.forIn=dL,O.forInRight=vL,O.forOwn=hL,O.forOwnRight=gL,O.get=Jf,O.gt=Lk,O.gte=Ok,O.has=mL,O.hasIn=ec,O.head=i1,O.identity=qt,O.includes=nk,O.indexOf=QB,O.inRange=qL,O.invoke=xL,O.isArguments=ja,O.isArray=tr,O.isArrayBuffer=qk,O.isArrayLike=Lt,O.isArrayLikeObject=Ur,O.isBoolean=Nk,O.isBuffer=da,O.isDate=Fk,O.isElement=zk,O.isEmpty=$k,O.isEqual=Vk,O.isEqualWith=Gk,O.isError=Xf,O.isFinite=Wk,O.isFunction=Gn,O.isInteger=m1,O.isLength=du,O.isMap=b1,O.isMatch=Uk,O.isMatchWith=Hk,O.isNaN=Kk,O.isNative=jk,O.isNil=Zk,O.isNull=Yk,O.isNumber=w1,O.isObject=Fr,O.isObjectLike=Vr,O.isPlainObject=Po,O.isRegExp=Qf,O.isSafeInteger=Xk,O.isSet=x1,O.isString=vu,O.isSymbol=Ht,O.isTypedArray=Bi,O.isUndefined=Qk,O.isWeakMap=Jk,O.isWeakSet=eL,O.join=nM,O.kebabCase=GL,O.last=nn,O.lastIndexOf=aM,O.lowerCase=WL,O.lowerFirst=UL,O.lt=rL,O.lte=tL,O.max=FO,O.maxBy=zO,O.mean=$O,O.meanBy=VO,O.min=GO,O.minBy=WO,O.stubArray=oc,O.stubFalse=sc,O.stubObject=PO,O.stubString=DO,O.stubTrue=IO,O.multiply=UO,O.nth=iM,O.noConflict=xO,O.noop=ic,O.now=lu,O.pad=HL,O.padEnd=KL,O.padStart=jL,O.parseInt=YL,O.random=NL,O.reduce=uk,O.reduceRight=lk,O.repeat=ZL,O.replace=XL,O.result=AL,O.round=HO,O.runInContext=ne,O.sample=ck,O.size=hk,O.snakeCase=QL,O.some=gk,O.sortedIndex=dM,O.sortedIndexBy=vM,O.sortedIndexOf=hM,O.sortedLastIndex=gM,O.sortedLastIndexBy=pM,O.sortedLastIndexOf=yM,O.startCase=eO,O.startsWith=rO,O.subtract=KO,O.sum=jO,O.sumBy=YO,O.template=tO,O.times=BO,O.toFinite=Wn,O.toInteger=ir,O.toLength=C1,O.toLower=nO,O.toNumber=an,O.toSafeInteger=nL,O.toString=wr,O.toUpper=aO,O.trim=iO,O.trimEnd=oO,O.trimStart=sO,O.truncate=uO,O.unescape=lO,O.uniqueId=kO,O.upperCase=fO,O.upperFirst=rc,O.each=l1,O.eachRight=f1,O.first=i1,ac(O,(function(){var f={};return _n(O,function(v,y){br.call(O.prototype,y)||(f[y]=v)}),f})(),{chain:!1}),O.VERSION=n,Qt(["bind","bindKey","curry","curryRight","partial","partialRight"],function(f){O[f].placeholder=O}),Qt(["drop","take"],function(f,v){dr.prototype[f]=function(y){y=y===t?1:Jr(ir(y),0);var R=this.__filtered__&&!v?new dr(this):this.clone();return R.__filtered__?R.__takeCount__=wt(y,R.__takeCount__):R.__views__.push({size:wt(y,K),type:f+(R.__dir__<0?"Right":"")}),R},dr.prototype[f+"Right"]=function(y){return this.reverse()[f](y).reverse()}}),Qt(["filter","map","takeWhile"],function(f,v){var y=v+1,R=y==N||y==W;dr.prototype[f]=function(B){var F=this.clone();return F.__iteratees__.push({iteratee:Ze(B,3),type:y}),F.__filtered__=F.__filtered__||R,F}}),Qt(["head","last"],function(f,v){var y="take"+(v?"Right":"");dr.prototype[f]=function(){return this[y](1).value()[0]}}),Qt(["initial","tail"],function(f,v){var y="drop"+(v?"":"Right");dr.prototype[f]=function(){return this.__filtered__?new dr(this):this[y](1)}}),dr.prototype.compact=function(){return this.filter(qt)},dr.prototype.find=function(f){return this.filter(f).head()},dr.prototype.findLast=function(f){return this.reverse().find(f)},dr.prototype.invokeMap=lr(function(f,v){return typeof f=="function"?new dr(this):this.map(function(y){return Co(y,f,v)})}),dr.prototype.reject=function(f){return this.filter(cu(Ze(f)))},dr.prototype.slice=function(f,v){f=ir(f);var y=this;return y.__filtered__&&(f>0||v<0)?new dr(y):(f<0?y=y.takeRight(-f):f&&(y=y.drop(f)),v!==t&&(v=ir(v),y=v<0?y.dropRight(-v):y.take(v-f)),y)},dr.prototype.takeRightWhile=function(f){return this.reverse().takeWhile(f).reverse()},dr.prototype.toArray=function(){return this.take(K)},_n(dr.prototype,function(f,v){var y=/^(?:filter|find|map|reject)|While$/.test(v),R=/^(?:head|last)$/.test(v),B=O[R?"take"+(v=="last"?"Right":""):v],F=R||/^find/.test(v);B&&(O.prototype[v]=function(){var H=this.__wrapped__,J=R?[1]:arguments,ie=H instanceof dr,Se=J[0],Te=ie||tr(H),De=function(cr){var vr=B.apply(O,ia([cr],J));return R&&Le?vr[0]:vr};Te&&y&&typeof Se=="function"&&Se.length!=1&&(ie=Te=!1);var Le=this.__chain__,Ue=!!this.__actions__.length,Qe=F&&!Le,sr=ie&&!Ue;if(!F&&Te){H=sr?H:new dr(this);var Je=f.apply(H,J);return Je.__actions__.push({func:su,args:[De],thisArg:t}),new en(Je,Le)}return Qe&&sr?f.apply(this,J):(Je=this.thru(De),Qe?R?Je.value()[0]:Je.value():Je)})}),Qt(["pop","push","shift","sort","splice","unshift"],function(f){var v=Ms[f],y=/^(?:push|sort|unshift)$/.test(f)?"tap":"thru",R=/^(?:pop|shift)$/.test(f);O.prototype[f]=function(){var B=arguments;if(R&&!this.__chain__){var F=this.value();return v.apply(tr(F)?F:[],B)}return this[y](function(H){return v.apply(tr(H)?H:[],B)})}}),_n(dr.prototype,function(f,v){var y=O[v];if(y){var R=y.name+"";br.call(Ri,R)||(Ri[R]=[]),Ri[R].push({name:v,func:y})}}),Ri[eu(t,b).name]=[{name:"wrapper",func:t}],dr.prototype.clone=lI,dr.prototype.reverse=fI,dr.prototype.value=cI,O.prototype.at=zM,O.prototype.chain=$M,O.prototype.commit=VM,O.prototype.next=GM,O.prototype.plant=UM,O.prototype.reverse=HM,O.prototype.toJSON=O.prototype.valueOf=O.prototype.value=KM,O.prototype.first=O.prototype.head,po&&(O.prototype[po]=WM),O}),_i=VD();za?((za.exports=_i)._=_i,tf._=_i):ct._=_i}).call(wW)})(Go,Go.exports)),Go.exports}var hr=xW();const z2=Sl(hr);function EW({cyParams:r,cyInst:e,layoutParams:t,layoutDebounce:n=50,children:a,init:i=()=>{},onCyInit:o}){const[s,l]=Re.useState(!1),u=Re.useRef(null),c=Re.useRef(null),d=Re.useRef(null),h=Re.useRef(!0),g=Re.useCallback(()=>{var m;d.current!==null&&d.current.stop(),c.current&&(d.current=c.current.layout(t),(m=d.current)==null||m.run())},[t]),p=z2.debounce(g,n);Re.useEffect(()=>{var x;if(!u.current)return;const m=un({container:u.current,...r}),b=(x=u.current.parentElement)==null?void 0:x.querySelector(".cytoscape-react-nodes-and-edges");if(b&&m.domNode({dom_container:b}),c.current=e||m,u.current&&(u.current.cy=c.current),o==null||o(c.current),i(m),u.current&&c.current){const C=u.current.parentElement;let T=0,S=0;C&&(T=C.clientHeight,S=C.clientWidth,T===0&&(T=window.innerHeight-C.getBoundingClientRect().top-100),S===0&&(S=window.innerWidth)),T>0&&S>0&&(u.current.style.width=`${S}px`,u.current.style.height=`${T}px`),c.current.resize(),r.zoom&&r.pan&&c.current.viewport({zoom:r.zoom,pan:r.pan})}l(!0);const w=new ResizeObserver(z2.debounce(()=>{if(u.current&&c.current){const C=u.current.parentElement;let T=0,S=0;C&&(T=C.clientHeight,S=C.clientWidth,T===0&&(T=window.innerHeight-C.getBoundingClientRect().top-100),S===0&&(S=window.innerWidth),T>0&&S>0&&(u.current.style.width=`${S}px`,u.current.style.height=`${T}px`));const _=c.current.zoom()!==void 0?{zoom:c.current.zoom(),pan:c.current.pan()}:null;c.current.resize(),_&&c.current.viewport(_)}},50));return u.current&&w.observe(u.current),()=>{w.disconnect();try{m.destroy()}catch{}c.current=null,l(!1)}},[]),Re.useEffect(()=>{h.current?(h.current=!1,g()):p()},[s,t,p,g]);const E=Re.useMemo(()=>{var m;return c.current!==null?((m=Re.Children.map(a,b=>{var w;return b?Re.cloneElement(b,{key:(w=b==null?void 0:b.props)==null?void 0:w.id,cytoInstance:c.current,layout:p}):null}))==null?void 0:m.filter(Boolean))||[]:[]},[a,s,p]);return ue.jsxs("div",{style:{width:"100%",height:"100%",position:"relative",background:"transparent"},children:[ue.jsx("div",{ref:u,className:"cytoscape-react-cy-container",style:{width:"100%",height:"100%",position:"relative",background:"transparent"}}),ue.jsx("div",{className:"cytoscape-react-nodes-and-edges",style:{pointerEvents:"none",position:"absolute",top:0,left:0,transformOrigin:"0 0",zIndex:10},children:E})]})}function CW({cytoInstance:r,id:e,parent:t,label:n,children:a,layout:i,classes:o,styleCallback:s}){const l=Re.useRef(null);function u(h){if(s){const g=s(h);h.isParent()&&(h.style("shape","roundrectangle"),h.style(g))}}Re.useEffect(()=>{try{if(l.current){const h={id:e,dom:l.current};t&&(h.parent=t),n&&(h.label=n);const g=r.add({data:h,classes:o});u(g)}}catch{}return()=>{r.getElementById(e).remove()}},[l,t,n]),Re.useEffect(()=>{i();const h=r.getElementById(e);h&&h.isParent()&&u(h)},[e,a]),Re.useEffect(()=>{if(!s)return;const h=r.getElementById(e);h&&h.isParent()&&u(h)},[s]);function c(h){return Re.cloneElement(h,{cytoInstance:r,layout:i})}const d=Re.Children.map(a,c);return ue.jsx("div",{ref:l,className:"cytoscape-react-node",children:d})}const _W={name:"dagre",rankDir:"LR",fit:!1,padding:20,spacingFactor:1.3,animate:!1,nodeDimensionsIncludeLabels:!0,ranker:"network-simplex",rankSep:10,nodeSep:5,edgeSep:10,avoidOverlap:!0,edgeWeight:function(r){return 1},minLen:function(r){return 1},useSimpleEdgeFunction:!0,edgeRouting:!0,controlPoints:!0},UP={padding:20,motionBlur:!1,compound:!0,pixelRatio:"auto",zoomingEnabled:!0,userZoomingEnabled:!0,dragpan:!0,avoidOverlap:!0,panningEnabled:!0,userPanningEnabled:!0,boxSelectionEnabled:!1,selectionType:"additive",minZoom:.01,maxZoom:1.5,autoungrabify:!0,styleEnabled:!0,hideEdgesOnViewport:!1,hideLabelsOnViewport:!0,headless:!1,touchTapThreshold:8,desktopTapThreshold:4,touchHoldDuration:500,desktopHoldDuration:1e3,autolock:!1,autounselectify:!1,wheelPanEnabled:!0,wheelPanThreshold:1,wheelPanDebounce:10,wheelAction:"pan"},HP={...UP,pixelRatio:1,motionBlur:!0,textureOnViewport:!0,wheelPanDebounce:20},SW={...HP,hideEdgesOnViewport:!0,hideLabelsOnViewport:!0},TW=({nodes:r,edges:e})=>{const{themeColor:t,edgeColor:n,direction:a,cyRef:i,callbacks:o,config:s,selectedNodeIds:l,setSelectedNodeIds:u,setSelectedEdgeId:c,setIsPerformanceMode:d,isZoomMode:h,setIsZoomMode:g,isMultiSelectMode:p,setIsMultiSelectMode:E,isDragMode:m,setIsDragMode:b,isEdgeHandlesEnabled:w,isArrayNodeMode:x}=Ia(),C=Re.useRef(null),T=Re.useRef(null),S=Re.useRef(x),_=r.length>200;Re.useEffect(()=>{d(_)},[_,d]);const{edgeSep:A,rankSep:P}=Re.useMemo(()=>hq(r.length),[r.length]),{bgColor:D}=us(t),{background:I,borderSecondary:k}=ls(),M=s.backgroundColor||I,N=Re.useCallback(U=>{if(U!=null&&U.includes("gray"))return"whitesmoke";if(!U)return ht(t);switch(U){case"dark":return ht(M);case"light":return ht(k);default:return ht(U)}},[t,M,k]),z=s.colorMode==="dark",W=Re.useMemo(()=>z?N(D):"dark",[z,D,N]),q=n?N(n):W,$=Re.useMemo(()=>vq(N),[N]),X=s.initialViewport||{pan:{x:0,y:0},zoom:.01},Y=Re.useMemo(()=>({..._?SW:r.length>100?HP:UP,style:$,zoom:X.zoom,pan:X.pan,minZoom:s.minZoom??.01,maxZoom:s.maxZoom??1.5}),[$,X,r.length,s.minZoom,s.maxZoom]),K=Re.useRef(!1),ee=Re.useRef();Re.useEffect(()=>()=>{clearTimeout(ee.current)},[]);const le=Re.useMemo(()=>({..._W,...a&&{rankDir:a},edgeSep:A,rankSep:P,get animate(){return K.current&&!_},animationDuration:300,animationEasing:"ease-in-out-cubic",stop:()=>{i.current&&(K.current||setTimeout(()=>{var U;(U=i.current)==null||U.fit(void 0,50)},100),clearTimeout(ee.current),ee.current=setTimeout(()=>{K.current=!0},500))}}),[a,A,P,i,_]),G=Re.useCallback(U=>{const fe=N(U||t);return{"corner-radius":50,"background-color":fe,color:fe,"border-color":fe}},[t,N]),V=Re.useCallback((U,fe,xe,ge)=>{let be={};return ge!=null&&ge.isInverted&&(ge==null?void 0:ge.source)===fe&&(be["target-arrow-shape"]="none",be["source-arrow-shape"]="triangle"),ge!=null&&ge.isEdgeAnimated?(be["line-style"]="dashed",be["line-dash-pattern"]=[32,18],be["line-dash-offset"]=0):ge!=null&&ge.isEdgeDashed?(be["line-style"]="dashed",be["line-dash-pattern"]=[],be["line-dash-offset"]=0):(be["line-style"]="solid",be["line-dash-pattern"]=[],be["line-dash-offset"]=0),a==="TB"&&(be["taxi-direction"]="downward"),a==="BT"&&(be["taxi-direction"]="upward"),a==="LR"&&(be["taxi-direction"]="rightward"),a==="RL"&&(be["taxi-direction"]="leftward"),be["line-color"]=q,be.color=q,be["target-arrow-color"]=q,be["source-arrow-color"]=q,be},[q,a]),j=Re.useRef(r);j.current=r;const re=Re.useRef(G);re.current=G;const de=Re.useRef(V);de.current=V,Re.useEffect(()=>{if(!i.current)return;const U=i.current,fe=()=>{U.nodes().forEach(xe=>{var ge,be;if(xe.isParent()){const Ae=j.current.find(Ie=>{var Be;return((Be=Ie.data)==null?void 0:Be.id)===xe.id()});xe.style(re.current((be=(ge=Ae==null?void 0:Ae.data)==null?void 0:ge.viewProps)==null?void 0:be.bgColor))}})};return U.on("add",fe),()=>{U.off("add",fe)}},[]),Re.useEffect(()=>{if(!i.current)return;const U=i.current;U.nodes().forEach(fe=>{var xe,ge;if(fe.isParent()){const be=r.find(Ae=>{var Ie;return((Ie=Ae.data)==null?void 0:Ie.id)===fe.id()});fe.style(G((ge=(xe=be==null?void 0:be.data)==null?void 0:xe.viewProps)==null?void 0:ge.bgColor))}}),e.forEach(({data:fe})=>{const xe=U.getElementById(fe.id);xe!=null&&xe.length&&(xe.data({isEdgeAnimated:fe.isEdgeAnimated,isEdgeDashed:fe.isEdgeDashed}),xe.style(V(xe,fe.source,fe.target,fe)))})},[r,e,q,G,V]);const se=Re.useRef(s);se.current=s;const Z=Re.useRef(h);Z.current=h;const Q=Re.useRef(w);Q.current=w,S.current=x,Re.useEffect(()=>{if(!i.current||!i.current.container)return;const U=i.current,fe=C.current;if(!fe)return;let xe=null,ge=null,be=0,Ae=0,Ie=0,Be=0,Oe=0;const He=Ve=>{Ve.preventDefault(),Ve.stopPropagation(),Z.current||Ve.metaKey||Ve.ctrlKey?(Ie+=Ve.deltaY,Be=Ve.clientX,Oe=Ve.clientY,ge===null&&(ge=requestAnimationFrame(()=>{ge=null;const er=se.current,$e=U.zoom(),ke=Ie;Ie=0;let pe=$e-ke*.05/100;pe=Math.max(er.minZoom??.01,Math.min(er.maxZoom??1.5,pe));const L=fe.getBoundingClientRect();U.zoom({level:pe,renderedPosition:{x:Be-L.left,y:Oe-L.top}})}))):(be+=Ve.deltaX,Ae+=Ve.deltaY,xe===null&&(xe=requestAnimationFrame(()=>{xe=null;const er=U.pan(),$e=U.zoom(),ke=.35,pe=be,L=Ae;be=0,Ae=0,U.pan({x:er.x+-pe*ke/$e,y:er.y+-L*ke/$e})})))};return fe.addEventListener("wheel",He,{passive:!1}),()=>{fe.removeEventListener("wheel",He),xe!==null&&cancelAnimationFrame(xe),ge!==null&&cancelAnimationFrame(ge)}},[i.current]),Re.useEffect(()=>{i.current&&i.current.userPanningEnabled(m)},[m]),Re.useEffect(()=>{if(!i.current)return;const U=i.current;U.boxSelectionEnabled(!!p),U.selectionType(p?"additive":"single"),U.userPanningEnabled(!p&&m)},[p,m]),Re.useEffect(()=>{T.current&&(w?T.current.enableDrawMode():T.current.disableDrawMode())},[w]);const ae=Re.useRef(l);ae.current=l,Re.useEffect(()=>{if(s.disableKeyboardShortcuts)return;const U=fe=>{var ge,be;const xe=fe.target;if(!(xe.tagName==="INPUT"||xe.tagName==="TEXTAREA"||xe.isContentEditable)&&((fe.key==="z"||fe.key==="Z")&&g(!Z.current),(fe.key==="m"||fe.key==="M")&&E(!p),(fe.key==="d"||fe.key==="D")&&b(!m),(fe.key==="Delete"||fe.key==="Backspace")&&ae.current.length>0)){fe.preventDefault();const Ae=ae.current.filter(Be=>Be!=="root");if(Ae.length===0)return;const Ie=i.current;for(const Be of Ae){const Oe=(ge=Ie==null?void 0:Ie.getElementById(Be))==null?void 0:ge.data();(be=o.onNodeDelete)==null||be.call(o,Be,Oe||{})}u([])}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[p,m,g,E,b,s.disableKeyboardShortcuts,o,u,i]),Re.useEffect(()=>()=>{if(i.current)try{i.current.removeAllListeners()}catch{}},[]);const te=Re.useMemo(()=>_?300:r.length>50?150:r.length>20?100:50,[r.length,_]),ce=Re.useMemo(()=>{var fe;const U=new Set;for(const xe of r)(fe=xe.data)!=null&&fe.parent&&U.add(xe.data.parent);return U},[r]),_e=Re.useMemo(()=>{var fe;const U=new Map;for(const xe of e)(fe=xe.data)!=null&&fe.source&&!U.has(xe.data.source)&&U.set(xe.data.source,xe.data);return U},[e]),ve=s.backgroundPattern||"dot";return ue.jsx(oq,{pattern:ve,backgroundColor:s.backgroundColor,children:ue.jsx(ye.Box,{ref:C,padding:0,width:"100%",height:"100%",flex:1,position:"relative",children:ue.jsxs(EW,{cyParams:Y,layoutParams:le,layoutDebounce:te,onCyInit:U=>{var xe;i.current=U,(xe=o.onCyInit)==null||xe.call(o,U);let fe=null;if(U.on("zoom pan",()=>{fe===null&&(fe=requestAnimationFrame(()=>{var ge;fe=null,(ge=o.onViewportChange)==null||ge.call(o,{zoom:U.zoom(),pan:U.pan()})}))}),U.on("select","edge",ge=>{var Ae;const be=ge.target;c(be.id()),(Ae=o.onEdgeSelect)==null||Ae.call(o,be.id(),be.data())}),U.on("unselect","edge",()=>{var ge;c(null),(ge=o.onEdgeDeselect)==null||ge.call(o)}),U.on("remove","edge",ge=>{var Ae;const be=ge.target;(Ae=o.onEdgeRemove)==null||Ae.call(o,be.id(),be.data())}),U.on("tap",":parent",ge=>{var Ae;const be=ge.target;u([be.id()]),(Ae=o.onNodeSelect)==null||Ae.call(o,be.id(),be.data())}),s.edgeHandles!==!1){const ge={canConnect:(Be,Oe)=>!Be.same(Oe),edgeParams:(Be,Oe)=>({data:{source:Be.id(),target:Oe.id(),label:""}}),loopAllowed:()=>!1,hoverDelay:500,snap:!1,snapThreshold:10,snapFrequency:5,noEdgeEventsInDraw:!0,disableBrowserGestures:!0,handlePosition:"left",handleNodes:"node",handleSize:20,handleColor:t||"#0ea5e9",handleOutlineColor:"#B92020FF",handleOutlineWidth:2,handleLineType:"ghost",handleLineWidth:2,preview:!0,ghostEdgeParams:()=>({}),edgeType:()=>"flat",nodeParams:()=>({})},be=U.edgehandles(ge);T.current=be,Q.current&&be.enableDrawMode();let Ae=null,Ie=null;U.on("ehstart",(Be,Oe)=>{Ie=Oe;const He=Be.originalEvent||window.event;if(He!=null&&He.clientX&&(He!=null&&He.clientY))Ae={x:He.clientX,y:He.clientY};else{const Ve=Oe.renderedPosition();Ae={x:Ve.x,y:Ve.y}}}),U.on("ehcancel",Be=>{if(!Ae||!Ie)return;const Oe=Be.originalEvent||window.event,He=Oe==null?void 0:Oe.clientX,Ve=Oe==null?void 0:Oe.clientY;if(He&&Ve&&o.onNodeCreate){const Xe=Math.abs(He-Ae.x),er=Math.abs(Ve-Ae.y);if(Math.max(Xe,er)>30){const $e=U.renderer().projectIntoViewport(He,Ve);o.onNodeCreate({type:"text",sourceNodeId:Ie.id(),position:{x:$e[0],y:$e[1]},isArrayMode:S.current})}}Ae=null,Ie=null}),U.on("ehcomplete",(Be,Oe,He)=>{var Ve;(Ve=o.onEdgeCreate)==null||Ve.call(o,Oe.id(),He.id())}),U.on("ehstop",()=>{Ae=null,Ie=null})}},children:[(r||[]).map(U=>{var Ie,Be,Oe,He,Ve,Xe,er,$e,ke;const fe=s.customViews||dq,xe=ce.has((Ie=U.data)==null?void 0:Ie.id)&&!((Be=U.data)!=null&&Be.parent),ge=xe?((Oe=U.data)==null?void 0:Oe.label)||((He=U.data)==null?void 0:He.headerTitle)||"Container":void 0,be=xe?fe.parentContainer:fe[U==null?void 0:U.data.type]||fe.text,Ae=_e.get((Ve=U.data)==null?void 0:Ve.id);return ue.jsx(CW,{id:(Xe=U.data)==null?void 0:Xe.id,parent:(er=U.data)==null?void 0:er.parent,label:ge,styleCallback:()=>{var pe,L;return G((L=(pe=U.data)==null?void 0:pe.viewProps)==null?void 0:L.bgColor)},children:Re.createElement(be,{...U,isInverted:Ae==null?void 0:Ae.isInverted,isParent:xe,key:`${($e=U.data)==null?void 0:$e.id}-${t}`})},(ke=U.data)==null?void 0:ke.id)}),(e||[]).map(({data:U})=>ue.jsx(gq,{id:U==null?void 0:U.id,source:U==null?void 0:U.source,target:U==null?void 0:U.target,label:U==null?void 0:U.label,isPerformanceMode:_,styleCallback:(fe,xe,ge)=>V(fe,xe,ge,U)},U==null?void 0:U.id))]})})})},RW=Re.memo(TW);var Wo=(r=>(r.TOP_DOWN="TB",r.BOTTOM_UP="BT",r.LEFT_RIGHT="LR",r.RIGHT_LEFT="RL",r.CENTER="C",r))(Wo||{});const AW=[{value:"BT",label:"Bottom to Up",icon:Ir.PiArrowUpLight,flowType:Wo.BOTTOM_UP},{value:"TB",label:"Top to Bottom",icon:Ir.PiArrowDownLight,flowType:Wo.TOP_DOWN},{value:"LR",label:"Left to Right",icon:Ir.PiArrowArcRightLight,flowType:Wo.LEFT_RIGHT},{value:"RL",label:"Right to Left",icon:Ir.PiArrowArcLeftLight,flowType:Wo.RIGHT_LEFT}],KP=()=>{const{cyRef:r,themeColor:e,direction:t,selectedNodeIds:n,setSelectedNodeIds:a,selectedEdgeId:i,setSelectedEdgeId:o,isZoomMode:s,setIsZoomMode:l,isMultiSelectMode:u,setIsMultiSelectMode:c,isDragMode:d,setIsDragMode:h,isEdgeHandlesEnabled:g,setIsEdgeHandlesEnabled:p,isArrayNodeMode:E,setIsArrayNodeMode:m,isPinned:b,setIsPinned:w,callbacks:x,config:C}=Ia(),T=C.colorMode==="dark",{background:S,border:_,colorInactive:A,colorText:P,colorActive:D,darkBackgroundSecondary:I}=ls(),[k,M]=Re.useState(!0),[N,z]=Re.useState(!1),[W,q]=Re.useState(!0),[$,X]=Re.useState(!1),[Y,K]=Re.useState(!1);Re.useEffect(()=>{const te=()=>q(window.innerWidth>=768);return te(),window.addEventListener("resize",te),()=>window.removeEventListener("resize",te)},[]),Re.useEffect(()=>{if(!W){M(!0);return}if(!b){M(!1);return}const te=_e=>{M(window.innerHeight-_e.clientY<=250)},ce=()=>M(!1);return window.addEventListener("mousemove",te),window.addEventListener("mouseleave",ce),()=>{window.removeEventListener("mousemove",te),window.removeEventListener("mouseleave",ce)}},[W,b]);const ee=Re.useCallback(te=>{const ce=r.current;if(!ce)return;const _e=C.minZoom??.01,ve=C.maxZoom??1.5,U=.02,fe=ce.zoomingEnabled(),xe=ce.userZoomingEnabled();ce.zoomingEnabled(!0),ce.userZoomingEnabled(!0);let ge=ce.zoom();switch(te){case"increase":ge=Math.min(ve,ge+U),ce.zoom(ge),ce.center();break;case"decrease":ge=Math.max(_e,ge-U),ce.zoom(ge),ce.center();break;case"reset":ce.fit(void 0,50);break}ce.zoomingEnabled(fe),ce.userZoomingEnabled(xe)},[r,C.minZoom,C.maxZoom]),le=k||N,G=C.renderSelectedNodeToolbar,V=n.length>0&&!!G,j=Re.useMemo(()=>{if(!V)return[];const te=r.current;return te?n.map(ce=>{const _e=te.getElementById(ce);return _e!=null&&_e.length?{..._e.data(),isParent:_e.isParent()}:{id:ce}}):[]},[V,n,r]),re=Re.useCallback(()=>{var te;a([]),(te=x.onNodeDeselect)==null||te.call(x)},[a,x]),de=C.renderSelectedEdgeToolbar,se=!!i&&!!de,Z=Re.useMemo(()=>{if(!se||!i)return null;const te=r.current;if(!te)return{id:i};const ce=te.getElementById(i);return ce!=null&&ce.length?ce.data():{id:i}},[se,i,r]),Q=Re.useCallback(()=>{var ce;o(null);const te=r.current;te&&te.edges().unselect(),(ce=x.onEdgeDeselect)==null||ce.call(x)},[o,r,x]),ae=C.renderBottomBar;return ae?ue.jsxs(ue.Fragment,{children:[V&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:G({selectedNodeIds:n,selectedNodeData:j,onDeselect:re})}),se&&Z&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:de({edgeId:i,edgeData:Z,onDeselect:Q})}),ue.jsx(ye.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",children:ae({zoomIn:()=>ee("increase"),zoomOut:()=>ee("decrease"),resetZoom:()=>ee("reset"),direction:t,isZoomMode:s,setIsZoomMode:l,isMultiSelectMode:u,setIsMultiSelectMode:c,isDragMode:d,setIsDragMode:h,isEdgeHandlesEnabled:g,setIsEdgeHandlesEnabled:p,isArrayNodeMode:E,setIsArrayNodeMode:m,selectedNodeIds:n,selectedNodeData:j,selectedEdgeId:i,selectedEdgeData:Z,onNodeDeselect:re,onEdgeDeselect:Q,callbacks:x})})]}):ue.jsxs(ue.Fragment,{children:[V&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:G({selectedNodeIds:n,selectedNodeData:j,onDeselect:re})}),se&&Z&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:"50%",transform:"translateX(-50%)",zIndex:101,children:de({edgeId:i,edgeData:Z,onDeselect:Q})}),!b&&ue.jsx(ye.Box,{position:"absolute",bottom:5,left:0,zIndex:101,w:3,children:ue.jsx(ye.Tooltip,{label:"Show Bottom Bar",placement:"top",fontSize:"xs",children:ue.jsx(ye.Flex,{align:"center",bg:S,borderColor:_,borderWidth:1,py:6,px:0,w:4,h:50,borderRadius:"15px",borderLeftRadius:0,onMouseEnter:()=>{z(!0),M(!0)},onMouseLeave:()=>z(!1),_hover:{bg:I},children:ue.jsx(ye.Icon,{ml:-1,as:Ir.PiLineVerticalBold,boxSize:5,color:_})})})}),ue.jsx(ye.Box,{position:"absolute",bottom:0,left:0,right:0,zIndex:100,w:"100%",transition:"opacity 0.3s ease-in, transform 0.3s ease",transform:le?"translateY(0)":"translateY(100%)",pointerEvents:le?"auto":"none",opacity:le?1:0,onMouseEnter:()=>{b||M(!0)},onMouseLeave:()=>{b||(M(!1),z(!1))},children:ue.jsxs(ye.Flex,{w:"100%",px:5,position:"absolute",bottom:5,flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[ue.jsx(ye.Box,{bg:S,alignContent:"center",h:50,borderColor:_,borderWidth:1,borderRadius:"15px",children:ue.jsxs(ye.HStack,{px:2,spacing:1,children:[ue.jsx(ye.Tooltip,{label:b?"Unpin":"Pin",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Pin",icon:ue.jsx(ye.Icon,{as:b?Ir.PiPushPinFill:Ir.PiPushPin,boxSize:5}),size:"sm",variant:"ghost",color:b?e:A,onClick:()=>{const te=!b;w(te),M(te)}})}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:"Zoom Out",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Zoom out",icon:ue.jsx(ye.Icon,{as:tq.HiMinus,boxSize:5}),size:"sm",variant:"ghost",color:P,onClick:()=>ee("decrease")})}),ue.jsx(ye.Tooltip,{label:"Zoom In",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Zoom in",icon:ue.jsx(ye.Icon,{as:gu.VscAdd,boxSize:5}),size:"sm",variant:"ghost",color:P,onClick:()=>ee("increase")})}),ue.jsx(ye.Tooltip,{label:"Reset Zoom",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Reset zoom",icon:ue.jsx(ye.Icon,{as:nq.GrPowerReset,boxSize:5}),size:"sm",variant:"ghost",color:P,onClick:()=>ee("reset")})}),!Y&&ue.jsxs(ue.Fragment,{children:[ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:s?"Zoom Mode (z)":"Pan Mode (z)",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle zoom mode",icon:ue.jsx(ye.Icon,{as:s?gu.VscZoomIn:gu.VscMove,boxSize:5}),size:"sm",variant:"ghost",color:s?e:A,onClick:()=>l(!s)})}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:u?"Multi-Select On (m)":"Multi-Select Off (m)",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle multi-select",icon:ue.jsx(ye.Icon,{as:gu.VscGroupByRefType,boxSize:5}),size:"sm",variant:"ghost",color:u?e:A,onClick:()=>c(!u)})}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:d?"Drag Mode On (d)":"Drag Mode Off (d)",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle drag mode",icon:ue.jsx(ye.Icon,{as:Ir.PiHandGrabbing,boxSize:5}),size:"sm",variant:"ghost",color:d?e:A,onClick:()=>h(!d)})}),C.edgeHandles!==!1&&ue.jsxs(ue.Fragment,{children:[ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:g?"Draw Mode On":"Draw Mode Off",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle draw mode",icon:ue.jsx(ye.Icon,{as:Ir.PiPencilSimpleLine,boxSize:5}),size:"sm",variant:"ghost",color:g?e:A,onClick:()=>p(!g)})})]}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:E?"List mode":"Set mode",placement:"top",fontSize:"xs",children:ue.jsx(ye.Flex,{cursor:"pointer",align:"center",onClick:()=>{var ce;const te=!E;m(te),(ce=x.onArrayModeChange)==null||ce.call(x,te)},_hover:{color:e},children:ue.jsx(ye.Text,{fontSize:"23px",color:E?e:A,children:E?"[]":"{}"})})})]}),ue.jsx(ye.Icon,{mx:-1,as:Ir.PiLineVerticalThin,boxSize:5,color:_}),ue.jsx(ye.Tooltip,{label:Y?"Expand toolbar":"Collapse toolbar",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Toggle toolbar collapse",icon:ue.jsx(ye.Icon,{as:Y?Ir.PiCaretRight:Ir.PiCaretLeft,boxSize:5}),size:"sm",variant:"ghost",color:A,onClick:()=>K(!Y)})})]})}),ue.jsxs(ye.Box,{position:"relative",ml:"auto",children:[ue.jsx(ye.Box,{bg:S,borderWidth:1,borderColor:_,borderRadius:"15px",h:50,px:3,cursor:"pointer",onClick:()=>X(!$),children:ue.jsxs(ye.Flex,{align:"center",h:"100%",children:[ue.jsx(ye.Tooltip,{label:"Flow Direction",placement:"top",fontSize:"xs",children:ue.jsx(ye.IconButton,{"aria-label":"Direction",icon:ue.jsx(ye.Icon,{as:Ir.PiCaretUp,boxSize:4}),size:"sm",variant:"ghost",color:A})}),ue.jsx(ye.Text,{fontSize:"xs",color:T?"whiteAlpha.600":"blackAlpha.500",ml:1,children:t})]})}),$&&ue.jsxs(ye.Box,{position:"absolute",bottom:"60px",right:0,bg:S,borderWidth:1,borderColor:_,borderRadius:"15px",p:2,zIndex:200,minW:"180px",shadow:"lg",onMouseLeave:()=>X(!1),children:[AW.map(te=>ue.jsxs(ye.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:T?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var ce;(ce=x.onDirectionChange)==null||ce.call(x,te.value),X(!1)},children:[ue.jsx(ye.Icon,{as:te.icon,boxSize:5,color:P}),ue.jsx(ye.Text,{fontSize:"sm",color:P,flex:1,whiteSpace:"nowrap",children:te.label}),t===te.value&&ue.jsx(ye.Icon,{as:q1.IoCheckmark,boxSize:4,color:D})]},te.value)),ue.jsxs(ye.Flex,{align:"center",gap:3,px:3,py:2,borderRadius:"10px",cursor:"pointer",_hover:{bg:T?"whiteAlpha.100":"blackAlpha.50"},onClick:()=>{var te;(te=x.onDirectionChange)==null||te.call(x,"LR"),X(!1)},children:[ue.jsx(ye.Icon,{as:aq.TbAlignCenter,boxSize:5,color:P}),ue.jsx(ye.Text,{fontSize:"sm",color:P,flex:1,whiteSpace:"nowrap",children:"Center"}),t==="C"&&ue.jsx(ye.Icon,{as:q1.IoCheckmark,boxSize:4,color:D})]})]})]})]})})]})};KP.displayName="BottomBar";const PW=Re.memo(KP),DW=".cytoscape-react-nodes-and-edges{position:absolute!important;top:0!important;left:0!important;z-index:10!important;pointer-events:none!important;overflow:visible!important;transform-origin:0 0!important}.cytoscape-react-node{z-index:0!important;overflow:visible!important;pointer-events:auto!important;position:absolute!important;transform-origin:0 0!important}.cytoscape-react-node input,.cytoscape-react-node textarea{pointer-events:auto!important;user-select:text!important;cursor:text!important}.cytoscape-react-edge{overflow:visible!important;pointer-events:none!important}.cytoscape-react-cy-container{width:100%!important;height:100%!important;overflow:visible!important;position:relative!important;background:transparent!important}.cytoscape-react-cy-container canvas{display:inline!important;vertical-align:baseline!important;overflow:visible!important}.cytoscape-react-cy-container>div{overflow:visible!important}";let $2=!1;function IW(){if($2||typeof document>"u")return;const r=document.createElement("style");r.setAttribute("data-flow-sdk",""),r.textContent=DW,document.head.appendChild(r),$2=!0}function BW({title:r="untitled",nodes:e,edges:t,config:n={},callbacks:a={},className:i,style:o,showBottomBar:s=!0}){IW();const l=e||[],u=t||[];return ue.jsx(iq,{config:n,callbacks:a,children:ue.jsxs(ye.Box,{className:i,style:o,width:"100%",height:"100%",position:"relative",overflow:"hidden",children:[ue.jsx(RW,{nodes:l,edges:u}),s&&ue.jsx(PW,{})]})})}const Gl={label:"Untitled",description:"",isTask:!1,isLocked:!1},p0={id:null,type:"text",data:{...Gl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",borderColor:"transparent",borderRadius:25,borderWidth:0,boxShadow:"none",textOverflow:"ellipsis",fontWeight:"bold",textColor:"gray.800",textAlign:"center"}}},V2={id:null,type:"objectView",data:{...Gl,headerTitle:null,viewProps:{width:"100%",borderWidth:2,borderRadius:25,height:"100%",justifyContent:"space-between",flexDirection:"row",textColor:"gray.900"}}},MW={id:null,type:"arrayView",data:{...Gl,viewProps:{width:"max-content !important",maxWidth:700,height:"100%",textAlign:"center",borderRadius:25,fontSize:"5xl",borderWidth:2,textOverflow:"ellipsis",wordBreak:"keep-all",fontWeight:"bold",textColor:"gray.900",placeholder:"Start Typing"}}},G2={id:null,type:"workflowStep",data:{...Gl,viewProps:{width:"max-content !important",maxWidth:350,minWidth:280,height:"100%",borderRadius:15,borderWidth:3}}};let Pu;const kW=new Uint8Array(16);function LW(){if(!Pu&&(Pu=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Pu))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pu(kW)}const vt=[];for(let r=0;r<256;++r)vt.push((r+256).toString(16).slice(1));function OW(r,e=0){return vt[r[e+0]]+vt[r[e+1]]+vt[r[e+2]]+vt[r[e+3]]+"-"+vt[r[e+4]]+vt[r[e+5]]+"-"+vt[r[e+6]]+vt[r[e+7]]+"-"+vt[r[e+8]]+vt[r[e+9]]+"-"+vt[r[e+10]]+vt[r[e+11]]+vt[r[e+12]]+vt[r[e+13]]+vt[r[e+14]]+vt[r[e+15]]}const qW=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),W2={randomUUID:qW};function NW(r,e,t){if(W2.randomUUID&&!r)return W2.randomUUID();r=r||{};const n=r.random||(r.rng||LW)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,OW(n)}const Zt=r=>typeof r=="object",jP=r=>Array.isArray(r),FW=["order","position","selected","locked","grabbed","grabbable","scratch"],Aa=r=>Object.entries(r).reduce((e,[t,n])=>(!Zt(n)&&!t.startsWith("$")&&(e[t]=n),e),{}),y0=(r,e)=>typeof r=="string"&&r.startsWith("$")?im(r,e):Zt(r)&&!jP(r)?Object.entries(r).reduce((t,[n,a])=>(typeof a=="string"&&a.startsWith("$")&&n==="..."?(delete t["..."],t[n]={...im(a,e),...r}):typeof a=="string"&&a.startsWith("$")?t[n]=im(a,e):t[n]=a,t),{}):r,Pa=r=>Object.entries(r).reduce((e,[t,n])=>(Zt(n)&&t&&n&&!t.startsWith("$")&&(FW.includes(t)&&(t=t+"#"),e[t]=n),e),{}),ri=(r,e,{label:t,parent:n=void 0},a,i=null)=>(i!==null&&(Zt(i)||jP(i))&&(i=JSON.stringify(i,null,2)),{data:{parent:n,...r.data,id:e,text:t||"",label:t,code:i||null,type:r.type,description:a}}),ba=(r,e,t=null,n=null,a=null,i=!1,o=null)=>({data:{id:NW(),source:a?e:r,target:a?r:e,label:n||"",isInverted:a,isEdgeAnimated:i,parent:o}}),Da=(r,e=[])=>{const t={},n={};let a=[];if(r)for(const[i,o]of Object.entries(r))i.startsWith("$")&&i!=="$"?t[i.slice(1)]=o:i!=="$"?n[i]=o:i==="$"&&(a=o);return{newConfig:t,updatedObject:n,arrayObject:a}},Hi=(r,e)=>{let t=V2;const{view:n,borderColor:a,borderRadius:i,bgColor:o,textColor:s,fontSize:l,stepType:u}=e;r=n||r,u?t={...G2}:r==="object"?t=V2:r==="text"?t=p0:r==="array"?t=MW:r==="workflowStep"&&(t={...G2});const c=t.data.viewProps;return t.data.viewProps={...c,borderRadius:i||(u?15:50),bgColor:o,borderColor:a,textColor:s,fontSize:l},t.data.config=e,{config:t}},ss=(r,e)=>(r=e.find(n=>n.data.id===r)?`${r}.#`:r,r),im=(r,{ids:e,jsnObjct:t})=>{if(typeof r=="string"&&(r!=null&&r.startsWith("$"))){const n=r.replace("$","").replace("*","");r==null||r.endsWith("*");const a=e.find(s=>s.split(".").slice(-1)[0]===n||n===s);if(!a)return r;const i=zW(a,t);return JSON.stringify(i).includes(r)?r:i||r}return r},zW=(r,e)=>{let t=r.split(".").splice(1);return t=t[t.length-1]==="#"||t[t.length-1].includes("{")?t.slice(0,-2):t,(i=>t.reduce((o,s)=>{s=s.replace("[","").replace("]","");const{arrayObject:l}=Da(o);return o=l.length?l:o,o[s]},i))(e)};function Xi(r,e="root",t=[]){try{const{arrayObject:n}=Da(r);n.length&&(r=n);const a=Aa(r),i=Pa(r);return Zt(r)?(hr.isArray(r)||hr.isArray(r)&&e==="root"||!hr.isArray(r)&&Object.keys(a).length||e==="root")&&t.push(e):t.push(e),Object.keys(i).length&&!hr.isArray(r)?jo({chldPth:null,itrblObjct:i,nodes:t,path:e}):hr.isArray(r)&&r.forEach((o,s)=>{const l=Aa(o),u=Pa(o),{newConfig:c,arrayObject:d}=Da(o);let h=`${e}.${s}`;Zt(o)?Object.keys(l).length?(Xi(l,h,t),Object.keys(u).length&&!hr.isArray(o)&&jo({chldPth:h,itrblObjct:u,nodes:t,path:e})):Object.keys(u).length&&!hr.isArray(o)?jo({chldPth:h,itrblObjct:u,nodes:t,path:e}):hr.isArray(o)&&YP({chldPth:h,item:o,nodes:t,path:e}):t.push(h)}),{nodes:t}}catch{return{nodes:t}}}const jo=({chldPth:r,itrblObjct:e,nodes:t,path:n})=>Object.entries(e).forEach(([a,i],o)=>{const s=Aa(i),l=Pa(i),{newConfig:u,arrayObject:c}=Da(i);c.length&&(i=c),n.split(".").slice(0,2).join(".");let d=r?`${r}.${a}`:`${n}.${a}`;if(Zt(i)&&!hr.isArray(i)){const h=Object.keys(s).length===0;if(h&&(Hi("array",u),t.push(d)),Object.keys(s).length){const g=hr.isArray(i)?`${i.length||""}`:`{${Object.keys(i).length||""}}`;let p=d;h&&(p=`${d}.${g}`),Xi(i,p,t)}else Object.keys(l).length&&!hr.isArray(i)?jo({chldPth:d,itrblObjct:l,path:d,nodes:t}):Xi(i,d,t)}else hr.isArray(i)&&Xi(i,d,t)}),YP=({chldPth:r,item:e,nodes:t,path:n})=>e.forEach((a,i)=>{let o=`${r}.${i}`;const s=Pa(a),l=Aa(a);Zt(a)?!hr.isArray(a)&&Object.keys(l).length?Xi(a,o,t):Object.keys(s).length&&!hr.isArray(a)?jo({chldPth:o,itrblObjct:s,path:n,nodes:t}):hr.isArray(a)&&YP({chldPth:o,item:a,nodes:t,path:n}):t.push(o)}),il=[];let Yo;function Qi(r,e="root",t=[],n=[],a="untitled",i={hideDefaultObject:!1,sprtObjctKy:!1,isCntr:!1},o={}){if(!r||typeof r!="object")return console.error("Invalid object passed",r),{nodes:t,edges:n};const s=r;if(!Yo){const{nodes:c}=Xi(r);Yo={ids:c,jsnObjct:r}}let{hideDefaultObject:l,sprtObjctKy:u}=i;try{e=ss(e,t);const{newConfig:c,arrayObject:d}=Da(r),h=Object.keys(o).length>0?o:c;d.length&&(r=d);const g=Aa(r),p=Pa(r),{label:E,collapsed:m,parent:b}=h;if(!Zt(r))t.push(ri(p0,e,{label:E||e,parent:b},r,s));else if(hr.isArray(r)||hr.isArray(r)&&e==="root"){const{config:w}=Hi("array",h),x=hr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e==="root"?a:`${a} ${x}`;t.push(ri(w,e,{label:E||C,parent:b},r,hr.isArray(s)?{[a]:s}:s))}else if(!hr.isArray(r)&&Object.keys(g).length||e==="root"){const{config:w}=Hi(null,h),x=hr.isArray(r)?`${r.length||""}`:`{${Object.keys(r).length||""}}`,C=e.split("."),T=C[C.length-1];let S=isNaN(Number(T))?null:Number(T)+1;const _=isNaN(Number(T))?T:C[C.length-2]+" "+S,A=e==="root"?a:_;let P=!1;Number.isNaN(Number(a))||(P=!0);const D=r;if(E){const{config:I}=Hi("object",h);t.push(ri(I,e,{label:E||`${E} ${x}`,parent:b},g,D))}else w.data.headerTitle=A,t.push(ri(w,e,{label:E,parent:b},g,D))}return m||(Object.keys(p).length&&!hr.isArray(r)?Zo({flowConfig:i,chldPth:null,edges:n,isInverted:null,itrblObjct:p,nodes:t,path:e,newConfig:h}):hr.isArray(r)&&r.forEach((w,x)=>{w=y0(w,Yo);const C=w,T=Aa(w),S=Pa(w),{newConfig:_,arrayObject:A}=Da(w);A.length&&(w=A);const{config:P}=Hi(typeof w=="string"?"text":"array",_),{hideConfig:D,sourceLabel:I,label:k,isEdgeAnimated:M,parent:N}=_;l=l||D;const z=e==="root"&&i.isCntr,W=e.split(".").slice(0,2).join("."),q=il.includes(W),$=i.isCntr&&q||x%2===0&&z;let X=`${e}.${x}`;X=ss(X,t),$&&il.push(X),Zt(w)?Object.keys(T).length&&!hr.isArray(w)?(n.push(ba(e,X,null,I,$,M)),Qi(w,X,t,n,k||x,i,_)):Object.keys(S).length&&!hr.isArray(w)?Zo({flowConfig:i,chldPth:X,isInverted:$,edges:n,itrblObjct:S,nodes:t,path:e,newConfig:_,forceIsInverted:!0}):hr.isArray(w)?ZP({flowConfig:i,chldPth:X,edges:n,isInverted:$,item:w,nodes:t,path:e}):Zt(w)&&Zo({flowConfig:i,chldPth:X,isInverted:$,edges:n,itrblObjct:[w],nodes:t,path:e,newConfig:_}):(n.push(ba(e,X,null,I,$,M)),t.push(ri(P,X,{label:k||String(w),parent:N},w,C)))})),{nodes:t,edges:n}}catch{return{nodes:t,edges:n}}}const Zo=({chldPth:r,flowConfig:e,edges:t,itrblObjct:n,nodes:a,isInverted:i,path:o,newConfig:s,forceIsInverted:l=!1})=>{let{hideDefaultObject:u,sprtObjctKy:c}=e;return Object.entries(n).forEach(([d,h],g)=>{h=y0(h,Yo);const p=h,E=Aa(h),m=Pa(h),{newConfig:b,arrayObject:w}=Da(h);w.length&&(h=w);const{hideConfig:x,sourceLabel:C,label:T,content:S,target:_,targetLabel:A,collapsed:P,isEdgeAnimated:D,parent:I}=b;u=u||x;const k=o==="root"&&e.isCntr,M=o.split(".").slice(0,2).join("."),N=il.includes(M);l||(i=e.isCntr&&N||g%2===0&&k);let z=r?`${r}.${d}`:`${o}.${d}`;if(z=ss(z,a),i&&il.push(z),_&&t.push(ba(z,_,null,A,i,D)),Zt(h)&&!hr.isArray(h)){t.push(ba(o,z,null,C,i,D));const W=c||Object.keys(E).length===0;if(W){const q=S?"object":"array",{config:$}=Hi(q,b);$.data.headerTitle=S?T:null,a.push(ri($,z,{label:T||d,parent:I},h,p))}if(Object.keys(E).length&&!u){const q=hr.isArray(h)?` ${h.length||""}`:`{${Object.keys(h).length||""}}`;let $=z;W&&($=`${z}.${q}`,$=ss($,a),t.push(ba(z,$,null,C,i,D))),Qi(h,$,a,t,T||d,e,b)}else Object.keys(m).length&&!hr.isArray(h)?Zo({chldPth:z,flowConfig:e,itrblObjct:m,path:z,edges:t,nodes:a,newConfig:b,isInverted:i}):Qi(h,z,a,t,d,e,b)}else hr.isArray(h)&&(t.push(ba(o,z,null,C,i,D)),Qi(h,z,a,t,d,e,b))})},ZP=({flowConfig:r,chldPth:e,edges:t,isInverted:n,item:a,nodes:i,path:o})=>a.forEach((s,l)=>{let u=`${e}.${l}`;u=ss(u,i);const c=s;s=y0(s,Yo);const d=Pa(s),h=Aa(s),{newConfig:g}=Da(s),{collapsed:p,label:E,parent:m,sourceLabel:b,isEdgeAnimated:w,content:x}=g;Zt(s)?!hr.isArray(s)&&Object.keys(h).length?(t.push(ba(o,u,null,b,n,w)),Qi(s,u,i,t,l,r,g)):Object.keys(d).length&&!hr.isArray(s)&&!p?Zo({chldPth:u,flowConfig:r,itrblObjct:d,path:o,edges:t,nodes:i,isInverted:n,newConfig:g}):hr.isArray(s)&&ZP({flowConfig:r,chldPth:u,edges:t,isInverted:n,item:s,nodes:i,path:o}):(t.push(ba(o,u,null,b,n,w)),i.push(ri(p0,u,{label:E||String(s),parent:m},s,c)))});exports.DynamicIcon=Tm;exports.FlowDiagram=BW;exports.contentObjTheme=Dn;exports.createFlowDiagram=Qi;exports.getChakraColorHex=ht;exports.getColorVariant=H2;exports.getDarkerHexColor=Gu;exports.useCustomColors=ls;exports.useStopPropagation=K2;exports.useThemeContentColors=us;
|
|
358
358
|
//# sourceMappingURL=index.cjs.map
|