@hardikg/mdview 0.10.0 → 0.11.0
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/CHANGELOG.md +63 -0
- package/README.md +52 -10
- package/bin/chunk-RBYD2HWV.mjs +196 -0
- package/bin/chunk-WWM6JNAS.mjs +209 -0
- package/bin/chunk-XFRQFZZ4.mjs +20 -0
- package/bin/mdview.mjs +521 -1323
- package/bin/regex-worker.mjs +52 -0
- package/bin/server-KALIU7HM.mjs +1854 -0
- package/bin/shiki-5SFVA32N.mjs +13 -0
- package/dist/client/assets/23I4SOAX-BN9xvzna.js +2 -0
- package/dist/client/assets/26H2HVXD-Cu1OTMxT.js +2 -0
- package/dist/client/assets/2IZ5MNOH-DMjMO3_9.js +1 -0
- package/dist/client/assets/2P3CZEXH-D-4BP7dg.js +2 -0
- package/dist/client/assets/3E5HRNYT-DUYblpdl.js +5 -0
- package/dist/client/assets/3JIRLDUO-C1CwW1Ha.js +1 -0
- package/dist/client/assets/5MJ3UKSG-DtT76qKq.js +2 -0
- package/dist/client/assets/5THPTBWS-Ce_hS451.js +1 -0
- package/dist/client/assets/7WLXJQOR-D6QVYUu9.js +1 -0
- package/dist/client/assets/A255FCTW-woaH7Mj_.js +1 -0
- package/dist/client/assets/AM43MQ64-CsWC_OQH.js +2 -0
- package/dist/client/assets/AOZTNTMC-BIehUQHD.js +5 -0
- package/dist/client/assets/AQNLM6KG-DIUuJgPm.js +4 -0
- package/dist/client/assets/BNU2RHQB-DeXpwU5k.js +2 -0
- package/dist/client/assets/C5HTQT3I-7U13x70S.js +4 -0
- package/dist/client/assets/CPKRWH5G-CRxaqyOs.js +12 -0
- package/dist/client/assets/CUVCMPQX-JTGMOfG2.js +1 -0
- package/dist/client/assets/D4V2MWCI-CytzCr6g.js +1 -0
- package/dist/client/assets/DHKBVIA3-CVnlqiEq.js +1 -0
- package/dist/client/assets/DKTLEL5E-DciMwFJ1.js +1 -0
- package/dist/client/assets/DUZNPW7S-D3pifVNb.js +2 -0
- package/dist/client/assets/E3FWOBN4-D5m5o2g0.js +4 -0
- package/dist/client/assets/E65FQMJL-Bg5F0Zo8.js +1 -0
- package/dist/client/assets/FTXIJQGB-CggtIYAM.js +1 -0
- package/dist/client/assets/G3MDBVQH-BZmnMkFw.js +1 -0
- package/dist/client/assets/G3OATVW2-VpVvT5i2.js +8 -0
- package/dist/client/assets/IV52FOAS-DgPxxRI4.js +5 -0
- package/dist/client/assets/JTJEEBDN-Bl0iUT_r.js +2 -0
- package/dist/client/assets/K7FUICZ3-DgoihkiR.js +2 -0
- package/dist/client/assets/LHH2HHRB-BXHTnBD0.js +2 -0
- package/dist/client/assets/MSPQPZZY-DQg7F6a8.js +4 -0
- package/dist/client/assets/OB6ZFVKF-UHmC8m-y.js +2 -0
- package/dist/client/assets/PLTZDMI2-C1ZAoc-e.js +1 -0
- package/dist/client/assets/R7EPXMMD-ChI1SqjJ.js +5 -0
- package/dist/client/assets/RVARI57O-CgA1WoRv.js +1 -0
- package/dist/client/assets/SPBWZ4VS-EqfCsJ5V.js +1 -0
- package/dist/client/assets/SR7OOV3Q-CFnFs0kL.js +4 -0
- package/dist/client/assets/STAXBNH4-D4c13Xlj.js +2 -0
- package/dist/client/assets/SXFARSFO-CkFSkgdi.js +1 -0
- package/dist/client/assets/TC77ISAL--WP0GBo0.js +2 -0
- package/dist/client/assets/TYIQQHVC-B67pCpxM.js +13 -0
- package/dist/client/assets/TZUXETIT-BFD9W5hl.js +2 -0
- package/dist/client/assets/U7N72BGE-Do3829la.js +6 -0
- package/dist/client/assets/UFPIB6EZ-DTs_MyQv.js +3 -0
- package/dist/client/assets/UO52YEYL-DN1qbGwF.js +3 -0
- package/dist/client/assets/VIK3ONSK-DC8mR2sZ.js +2 -0
- package/dist/client/assets/VVVO4ZVP-DAtGLbxR.js +2 -0
- package/dist/client/assets/WRGXZO53-D30IuREw.js +3 -0
- package/dist/client/assets/X5SG7MGC-CdjdoL_s.js +2 -0
- package/dist/client/assets/XLHPVVFU-BFP9ID9p.js +2 -0
- package/dist/client/assets/XXYPNCD5-DqCewu_S.js +5 -0
- package/dist/client/assets/Z6WRYFJC-BEt1KCoU.js +7 -0
- package/dist/client/assets/ZI2QNEGF-VzC4uHcW.js +8 -0
- package/dist/client/assets/index-B96jWJTi.css +1 -0
- package/dist/client/assets/index-DCU09WmS.js +2 -0
- package/dist/client/assets/katex-C0xaXAD4.js +257 -0
- package/dist/client/assets/katex.min-3X1qOa03.js +1 -0
- package/dist/client/assets/katex.min-DMey5pMQ.css +1 -0
- package/dist/client/assets/lazy-DaMZI1F7.js +45 -0
- package/dist/client/index.html +2 -2
- package/package.json +32 -27
- package/dist/client/assets/2DXBBFLN-BxPqHNSN.js +0 -5
- package/dist/client/assets/46IJ22JX-u_jvQJNg.js +0 -2
- package/dist/client/assets/4TTDE5I4-BgbNAVNj.js +0 -3
- package/dist/client/assets/4UF3HTLV-DNbPxlOE.js +0 -2
- package/dist/client/assets/5THPTBWS-D57irc_4.js +0 -1
- package/dist/client/assets/7WLXJQOR-CHhKreq0.js +0 -1
- package/dist/client/assets/AAXQQPKT-CsAJqrOC.js +0 -5
- package/dist/client/assets/AKE5O7KZ-MSuBOjCG.js +0 -2
- package/dist/client/assets/BNMLP6AG-Ca3zyKQY.js +0 -3
- package/dist/client/assets/DKTLEL5E-B7ILCVTH.js +0 -1
- package/dist/client/assets/DR6PKOQU-Bw7cHvYp.js +0 -2
- package/dist/client/assets/E4RJ7UJB-CYB5C4K7.js +0 -2
- package/dist/client/assets/ELSXBIJH-DG0MW5dC.js +0 -1
- package/dist/client/assets/ERTIBQVS-BMWumWfk.js +0 -2
- package/dist/client/assets/F653G4FO-FI8M9Mc0.js +0 -12
- package/dist/client/assets/FKCDD66M-BPFkyrwI.js +0 -1
- package/dist/client/assets/FP7KDXVC-BLEBNkCO.js +0 -2
- package/dist/client/assets/FT5I3RHX-j5YoMicq.js +0 -6
- package/dist/client/assets/FTXIJQGB-nrHdCfp7.js +0 -1
- package/dist/client/assets/G3MDBVQH-EkdejvdW.js +0 -1
- package/dist/client/assets/GY35JXOZ-3ovTGxgz.js +0 -2
- package/dist/client/assets/H5EEJPP2-CNVQBEB3.js +0 -1
- package/dist/client/assets/HWDLEDTA-C_JcdBMO.js +0 -1
- package/dist/client/assets/JZWSX6AR-OwVPptYv.js +0 -1
- package/dist/client/assets/KQOEJWJY-DKTXya68.js +0 -2
- package/dist/client/assets/KS3BB3KE-QkpqVdmA.js +0 -1
- package/dist/client/assets/KXJRRZHI-BQRjeGWj.js +0 -2
- package/dist/client/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/client/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/client/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/client/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/client/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/client/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/client/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/client/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/client/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/client/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/client/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/client/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/client/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/client/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/client/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/client/assets/MFVI5XKI-DrRaRE9X.js +0 -1
- package/dist/client/assets/MWY2J62P-AbEgJnzK.js +0 -12
- package/dist/client/assets/MXGNCBL2-DG3CZR8g.js +0 -2
- package/dist/client/assets/N6DAJLIZ-BsZQKTyT.js +0 -3
- package/dist/client/assets/NU5M23IW-CvtpIovv.js +0 -2
- package/dist/client/assets/NV4XNBIS-nS8wAx3h.js +0 -8
- package/dist/client/assets/OGLU4SIR-DoTUWhkz.js +0 -2
- package/dist/client/assets/OUNS5N76-BwVLonT4.js +0 -8
- package/dist/client/assets/PU4ISKXV-BYX7eA_r.js +0 -2
- package/dist/client/assets/PUZGS23X-n6IKOr7S.js +0 -1
- package/dist/client/assets/Q3IYVLG5-hWt1rVyh.js +0 -4
- package/dist/client/assets/QYHQDLKZ-CjGeJM7R.js +0 -4
- package/dist/client/assets/RVARI57O-CXmrUIiS.js +0 -1
- package/dist/client/assets/RZSVICHU-BiwjruZZ.js +0 -4
- package/dist/client/assets/UEXXS2NB-Dkz_tz-N.js +0 -2
- package/dist/client/assets/UHTQJXKL-lvl-7QeT.js +0 -5
- package/dist/client/assets/URA2L2QI-B8pYKxOk.js +0 -1
- package/dist/client/assets/UXCHDUKG-BGy3ZRLM.js +0 -2
- package/dist/client/assets/VKNV3BUX-DZnoX4IV.js +0 -5
- package/dist/client/assets/VMV7XPHP-6QkisQwm.js +0 -4
- package/dist/client/assets/WEVWDWVA-nohBBhTA.js +0 -2
- package/dist/client/assets/XRRJ35LF-BE7gSN1k.js +0 -2
- package/dist/client/assets/YFKBLVVN-CVTPpei6.js +0 -6
- package/dist/client/assets/YHRE5QGZ-Bs7dUKjj.js +0 -4
- package/dist/client/assets/ZF3OVT4B-6LaC6iLs.js +0 -3
- package/dist/client/assets/index-392ivruk.js +0 -2
- package/dist/client/assets/index-CGQuEJ_w.css +0 -1
- package/dist/client/assets/jetbrains-mono-cyrillic-400-normal-ugxPyKxw.woff +0 -0
- package/dist/client/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-400-normal-B9oWc5Lo.woff +0 -0
- package/dist/client/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-400-normal-fXTG6kC5.woff +0 -0
- package/dist/client/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-400-normal-CqNFfHCs.woff +0 -0
- package/dist/client/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/client/assets/katex-C5jXJg4s.js +0 -257
- package/dist/client/assets/katex.min-BYZTj3zW.css +0 -1
- package/dist/client/assets/katex.min-DXaO1tdm.js +0 -1
- package/dist/client/assets/lazy-CKqR1774.js +0 -43
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var at=Object.defineProperty;var ot=(t,i,r)=>i in t?at(t,i,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[i]=r;var ee=(t,i,r)=>ot(t,typeof i!="symbol"?i+"":i,r);import{c as nt}from"./MFVI5XKI-DrRaRE9X.js";import{b as Be,d as Oe,m as ct}from"./FKCDD66M-BPFkyrwI.js";import{N as dt,A as ft}from"./JZWSX6AR-OwVPptYv.js";import{R as De}from"./URA2L2QI-B8pYKxOk.js";import{H as ht,$ as pt,x as rt,i as te,e as le,C as ut,L as Ue}from"./lazy-CKqR1774.js";import{m as gt,c as mt}from"./DKTLEL5E-B7ILCVTH.js";import{F as yt,D as bt,S as Ct,v as kt,w as Ie}from"./HWDLEDTA-C_JcdBMO.js";import{_ as Ke,g as wt,x as F,f as pe,b as St,h as vt,y as Xe,$ as At}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";function Tt(t){let i="TB";for(let r of t)typeof r!="string"&&r.stmt==="dir"&&(i=r.value);return i}function _t(t,i,r){let d=[],w=[],E=new Map,o=new Map,e=new Map,D=0,I=0,j=v=>{if(!v.id||v.id==="</join></fork>"||v.id==="</choice>")return;if(v.cssClasses){let g;for(let h of v.cssClasses.split(" ")){let P=r.get(h);if(P){g??(g=v.cssCompiledStyles.slice());for(let W of P.styles)g.push(W)}}g&&(v.cssCompiledStyles=g)}let b=E.get(v.id);if(b){let g=v.parentId??b.parentId;Object.assign(b,v),g!==void 0&&(b.parentId=g)}else E.set(v.id,v),d.push(v)},Z=(v,b,g)=>{var ie;let h=b.id;if(h==="root")return;let P=i.get(h),W=((ie=P==null?void 0:P.classes)==null?void 0:ie.join(" "))??"",K=(P==null?void 0:P.styles)??[],A=o.get(h);if(!A){let J="rect";b.start===!0?J="stateStart":b.start===!1&&(J="stateEnd"),b.type!=="default"&&(J=b.type),A={shape:J,description:h,cssClasses:`${W} statediagram-state`,cssStyles:K,type:void 0,dir:void 0,colorIndex:void 0},o.set(h,A)}if(b.description&&(Array.isArray(A.description)?(A.shape="rectWithTitle",A.description=A.description.concat(b.description)):A.description.length>0?(A.shape="rectWithTitle",A.description=A.description===h?[b.description].flat():[A.description,b.description].flat()):(A.shape="rect",A.description=Array.isArray(b.description)?b.description.slice():b.description)),A.description.length===1&&A.shape==="rectWithTitle"&&(A.shape=A.type==="group"?"roundedWithTitle":"rect"),!A.type&&b.doc){if(A.type="group",A.dir=Tt(b.doc),A.shape=b.type==="divider"?"divider":"roundedWithTitle",A.shape==="divider"&&(v==null?void 0:v.id)!==void 0&&e.has(v.id))A.colorIndex=e.get(v.id);else{let J=I++;A.colorIndex=W.trim()!==""||K.length>0?void 0:J}e.set(h,A.colorIndex),A.cssClasses=`${A.cssClasses} statediagram-cluster ${g?"statediagram-cluster-alt":""}`}let C=A.description,z={id:h,shape:A.shape,label:Array.isArray(C)?C[0]:C,description:Array.isArray(C)?C.slice(1):[],cssClasses:A.cssClasses,cssCompiledStyles:[],cssStyles:A.cssStyles,type:A.type,isGroup:A.type==="group",dir:A.dir,colorIndex:A.colorIndex};z.shape==="divider"&&(z.label=""),v&&v.id!=="root"&&(z.parentId=v.id);let O=b.note;if(!O){j(z);return}let H=(J,ae,se,V)=>({id:J,shape:ae,label:O.text,description:[],cssClasses:se,cssCompiledStyles:[],cssStyles:[],type:V?"group":"node",isGroup:V,dir:void 0,position:O.position}),T=H(`${h}----note-${D++}`,"note","statediagram-note",!1);T.parentId=`${h}----parent`,T.noteFor=h,j(H(T.parentId,"noteGroup",A.cssClasses,!0)),j(T),j(z);let G=O.position==="left of",re=G?T.id:h,U=G?h:T.id;w.push({id:`${re}-${U}`,start:re,end:U,label:"",classes:"transition note-edge",pattern:"dashed"})},R=[{item:void 0,doc:t,at:0,alt:!0}];for(;R.length>0;){let v=R[R.length-1];if(v.at>=v.doc.length){R.pop();continue}let b=v.doc[v.at++];typeof b!="string"&&(b.stmt==="state"?(Z(v.item,b,v.alt),b.doc&&R.push({item:b,doc:b.doc,at:0,alt:!v.alt})):b.stmt==="relation"&&(Z(v.item,b.state1,v.alt),Z(v.item,b.state2,v.alt),w.push({id:`edge${D++}`,start:b.state1.id,end:b.state2.id,label:b.description??"",classes:"transition"})))}for(let v of d)if(v.isGroup&&v.description.length>0)throw new rt(`Group nodes can only have label. Remove the additional description for node [${v.id}]`,"semantic",{type:"state"});return{nodes:d,edges:w}}var xt=class{constructor(){ee(this,"type","state");ee(this,"rootDoc",[]);ee(this,"states",new Map);ee(this,"relations",[]);ee(this,"classes",new Map);ee(this,"links",new Map);ee(this,"graph",{nodes:[],edges:[]});ee(this,"title");ee(this,"accTitle");ee(this,"accDescr");ee(this,"dividerCount",0)}get direction(){let t="TB";for(let i of this.rootDoc)typeof i!="string"&&i.stmt==="dir"&&(t=i.value);return t}setRootDoc(t){this.rootDoc=t,this.translate(),this.extract(t)}extract(t){this.states=new Map,this.relations=[],this.classes=new Map;let i=Array.isArray(t)?t:t.doc;for(let r of i)if(typeof r!="string")switch(r.stmt){case"state":this.addState(r.id.trim(),r.type,r.doc,r.description,r.note);break;case"relation":this.addRelation(r.state1,r.state2,r.description);break;case"classDef":this.addStyleClass(r.id.trim(),r.classes);break;case"style":{let d=r.styleClass.split(",").map(w=>w.replace(/;/g,"").trim());for(let w of this.named(r.id.trim()))w.styles=d.slice();break}case"applyClass":this.setCssClass(r.id.trim(),r.styleClass);break;case"click":this.addLink(typeof r.id=="string"?r.id:r.id.id,r.url,r.tooltip);break}this.graph=_t(i,this.states,this.classes)}translate(){let t=[["root",{stmt:"root",id:"root",doc:this.rootDoc},!0]];for(;t.length>0;){let[i,r,d]=t.pop();if(typeof r=="string")continue;if(r.stmt==="relation"){t.push([i,r.state2,!1],[i,r.state1,!0]);continue}if(r.stmt==="state")r.id==="[*]"?(r.id=i+(d?"_start":"_end"),r.start=d):r.id=r.id.trim();else if(r.stmt!=="root")continue;if(!r.doc)continue;let w=[],E=[];for(let o of r.doc)typeof o!="string"&&o.stmt==="state"&&o.type==="divider"&&!o.doc?(w.push({...o,doc:E}),E=[]):E.push(o);w.length>0&&(E.length>0&&w.push({stmt:"state",id:this.getDividerId(),type:"divider",doc:E}),r.doc=w);for(let o=r.doc.length-1;o>=0;o--)t.push([r.id,r.doc[o],!0])}}addState(t,i="default",r,d,w,E){let o=t.trim(),e=this.states.get(o);if(e?(e.doc||(e.doc=r),e.type||(e.type=i)):(e={stmt:"state",id:o,descriptions:[],type:i,doc:r,note:w,classes:[],styles:[],textStyles:[]},this.states.set(o,e)),d)for(let D of Array.isArray(d)?d:[d])this.addDescription(o,D.trim());if(w&&(e.note=w),E)for(let D of E)this.setCssClass(o,D.trim())}getState(t){return this.states.get(t)}addLink(t,i,r){this.links.set(t,{url:i,tooltip:r})}addRelation(t,i,r=""){for(let d of[t,i])this.addState(d.id,d.type,d.doc,d.description,d.note,d.classes);this.relations.push({id1:t.id.trim(),id2:i.id.trim(),relationTitle:r})}addDescription(t,i){var r,d;(d=(r=this.states.get(t))==null?void 0:r.descriptions)==null||d.push(i.startsWith(":")?i.replace(":","").trim():i)}getDividerId(){return`divider-id-${++this.dividerCount}`}addStyleClass(t,i=""){let r=this.classes.get(t);if(r||(r={id:t,styles:[],textStyles:[]},this.classes.set(t,r)),!!i)for(let d of i.split(",")){let w=d.replace(";","").trim();d.includes("color")&&r.textStyles.push(w.replace("fill","bgFill").replace("color","fill")),r.styles.push(w)}}setCssClass(t,i){var r;for(let d of this.named(t))(r=d.classes)==null||r.push(i)}getDirection(){for(let t of this.rootDoc)if(typeof t!="string"&&t.stmt==="dir")return t.value;return"TB"}setDirection(t){for(let i of this.rootDoc)if(typeof i!="string"&&i.stmt==="dir"){i.value=t;return}this.rootDoc.unshift({stmt:"dir",value:t})}trimColon(t){return t.startsWith(":")?t.slice(1).trim():t.trim()}setAccTitle(t){this.accTitle=t.replace(/^\s+/g,"")}setAccDescription(t){this.accDescr=t.replace(/\n\s+/g,`
|
|
2
|
-
`)}named(t){let i=[];for(let r of t.split(",")){let d=this.states.get(r);d||(this.addState(r),d=this.states.get(r.trim())),d&&i.push(d)}return i}},ze=["$end","INVALID","NL","SD","DESCR","-->","HIDE_EMPTY","scale","WIDTH","COMPOSIT_STATE","STRUCT_START","STRUCT_STOP","STATE_DESCR","AS","ID","FORK","JOIN","CHOICE","CONCURRENT","note","NOTE_TEXT","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","CLICK","STRING","HREF","classDef","CLASSDEF_ID","DEFAULT_CLASSDEF_ID","CLASSDEF_STYLEOPTS","DEFAULT","style","STYLE_IDS","STYLEDEF_STYLEOPTS","class","CLASSENTITY_IDS","STYLECLASS","direction_tb","direction_bt","direction_rl","direction_lr","EDGE_STATE","STYLE_SEPARATOR","left_of","right_of","INVALID"],$t=/direction/gi,Dt=/<<(?:fork|join|choice)>>|\[\[(?:fork|join|choice)\]\]/gi,It=/[\n\r\u2028\u2029]/g,Mt=/%%/g,Rt=/\{/g;function ue(t,i){let r=0,d=-2;return w=>{if(d===-2||w<r||d!==-1&&w>d){t.lastIndex=w;let E=t.exec(i);d=E?E.index:-1,r=w}return d}}function Et(t){let i=t.length,r=[],d=[],w=[],E=[],o=0,e=0,D,I=ue($t,t),j=ue(Dt,t),Z=ue(It,t),R=ue(Mt,t),v=ue(Rt,t),b=-1,g=-1,h=[-1,-1,-1,-1],P=[0,0,0,0],W=-1,K=-1,A=[-1,-1,-1,-1,-1,-1],C=(p,a,m)=>{r.push(p),d.push(t.slice(a,m)),w.push(a),e=m},z=(p,a,m,y)=>{r.push(p),d.push(a),w.push(m),e=y},O=p=>{E.push(o),o=p},H=()=>{E.length>0&&(o=E.pop())},T=(p,a)=>{for(let m=0;m<p.length;m++){let y=p.charCodeAt(m),n=t.charCodeAt(a+m);if(n!==y&&!(y>=97&&y<=122&&n===y-32))return!1}return!0},G=p=>{let a=p;for(;a<i&&le(t.charCodeAt(a));)a++;return a},re=p=>{let a=p;for(;a<i&&te(t.charCodeAt(a));)a++;return a},U=p=>{let a=t.indexOf(`
|
|
3
|
-
`,p);return a===-1?i:a},ie=p=>{let a=Z(p);return a===-1?i:a},J=p=>{if(p<b||p>g){let a=I(p),m=a===-1?i:ie(p);b=p,g=m,h[0]=h[1]=h[2]=h[3]=-1;for(let y=a;y!==-1&&y<m;y=I(y+1)){let n=G(y+9);if(n===y+9)continue;let $=T("tb",n)?0:T("bt",n)?1:T("rl",n)?2:T("lr",n)?3:-1;$!==-1&&(h[$]=y,P[$]=n+2)}}for(let a=0;a<4;a++)if(h[a]>=p)return a;return-1},ae=p=>{if(p<W||p>K){let a=j(p),m=a===-1?i:ie(p);W=p,K=m,A.fill(-1);for(let y=a;y!==-1&&y<m;y=j(y+1)){let n=t.charCodeAt(y+2)|32;A[(t.charCodeAt(y)===60?0:3)+(n===102?0:n===106?1:2)]=y}}for(let a=0;a<6;a++)if(A[a]>=p)return a;return-1},se=(p,a)=>{let m=R(p);return m===-1||m+2>a?(C(14,p,a),!0):m===p?(e=a,!1):(C(14,p,m),!0)},V=p=>(r.push(p),d.push(""),w.push(e),{types:r,texts:d,starts:w,error:D});for(;;){if(e>=i){switch(o){case 0:C(2,i,i);break;case 6:C(22,i,i);break;case 7:C(24,i,i);break;case 8:C(25,i,i);break;case 10:C(32,i,i);break;case 12:C(39,i,i);break;case 14:C(36,i,i);break;case 3:C(12,i,i);break;case 18:C(20,i,i);break;case 4:case 19:C(14,i,i);break}return V(0)}let p=t.charCodeAt(e);switch(o){case 0:case 1:{let a=o===0,m=p|32;if(a){if(m===99&&T("click",e)&&!te(t.charCodeAt(e+5))){C(26,e,e+5);continue}if(m===104&&T("href",e)&&!te(t.charCodeAt(e+4))){C(28,e,e+4);continue}if(p===34){let $=t.indexOf('"',e+1);if($!==-1){C(27,e,$+1);continue}}if(m===100&&T("default",e)&&!te(t.charCodeAt(e+7))){C(33,e,e+7);continue}let n=J(e);if(n!==-1){C(40+n,e,U(P[n]));continue}if(p===10){let $=e+1;for(;t.charCodeAt($)===10;)$++;C(2,e,$);continue}if(le(p)){e=G(e);continue}}else if(p!==10&&le(p)){let n=e+1;for(;n<i&&t.charCodeAt(n)!==10&&le(t.charCodeAt(n));)n++;e=n;continue}if(p===35||p===37&&t.charCodeAt(e+1)===37&&t.charCodeAt(e+2)!==123){e=U(e);continue}if(m===115){if(a&&T("scale",e)){let n=G(e+5);if(n>e+5){C(7,e,n),O(5);continue}}if(T("style",e)){let n=G(e+5);if(n>e+5){C(34,e,n),O(13);continue}}if(T("state",e)){let n=G(e+5);if(n>e+5){e=n,O(2);continue}if(a&&T("diagram",e+5)){let $=T("-v2",e+12)?e+15:e+12;if(n=G($),n>$){C(3,e,n);continue}}}}else if(m===99){if(T("class",e)){let n=T("def",e+5),$=n?e+8:e+5,q=G($);if(q>$){C(n?29:37,e,q),O(n?9:11);continue}}}else if(m===97&&a&&(T("acctitle",e)||T("accdescr",e))){let n=(t.charCodeAt(e+3)|32)===116,$=G(e+8),q=t.charCodeAt($);if(q===58){C(n?21:23,e,G($+1)),O(n?6:7);continue}if(q===123&&!n){e=G($+1),O(8);continue}}if(a){if(p===123){C(10,e,e+1),O(1);continue}}else{let n=J(e);if(n!==-1){C(40+n,e,U(P[n]));continue}if(p===125){C(11,e,e+1),H();continue}if(p===10){e++;continue}}if(m===110&&T("note",e)){let n=G(e+4);if(n>e+4){C(19,e,n),O(15);continue}}if(a&&m===104&&T("hide empty description",e)&&!te(t.charCodeAt(e+22))){C(6,e,e+22);continue}if(p===91&&t.charCodeAt(e+1)===42&&t.charCodeAt(e+2)===93){C(44,e,e+3);continue}let y=e;for(;y<i;){let n=t.charCodeAt(y);if(n===58||n===45||n===123||le(n))break;y++}if(y>e){se(e,y);continue}if(p===58){for(y=e+1;y<i;){let n=t.charCodeAt(y);if(n===10||n===59)break;if(n===58){let $=t.charCodeAt(y+1);if(y+1>=i||$===58||$===10||$===59)break;y++}y++}if(y>e+1){z(4,t.slice(e,y).trim(),e,y);continue}if(t.charCodeAt(e+1)===58&&t.charCodeAt(e+2)===58){C(45,e,e+3);continue}}else if(p===45&&t.charCodeAt(e+1)===45){if(t.charCodeAt(e+2)===62){C(5,e,e+3);continue}if(!a){C(18,e,e+2);continue}}if(!a)return V(1);C(48,e,e+1);continue}case 2:{if(p!==10&&le(p)){let n=e+1;for(;n<i&&t.charCodeAt(n)!==10&&le(t.charCodeAt(n));)n++;e=n;continue}if(p===35||p===37&&t.charCodeAt(e+1)===37&&t.charCodeAt(e+2)!==123){e=U(e);continue}let a=ae(e);if(a!==-1){let n=A[a],$=a===2||a===5;z($?17:a%3===0?15:16,t.slice(e,n).trim(),e,n+($?10:8)),H();continue}if(p===34){e++,O(3);continue}let m=p===10?G(e):e;if(T("as",m)){let n=G(m+2);if(n>m+2){C(13,e,n),O(4);continue}}if(p===10){e++,H();continue}if(p===123){C(10,e,e+1),H(),O(1);continue}if(te(p)){let n=re(e),$=G(n);if($>n&&te(t.charCodeAt($))){let q=v($+1);if(q!==-1&&q<ie($))return D=`Error: State name must be a single word. Found: "${t.slice(e,q+1).trim()}"`,V(1)}}let y=e+1;for(;y<i;){let n=t.charCodeAt(y);if(n===123||le(n))break;y++}C(9,e,y);continue}case 3:{if(p===34){e++,H();continue}let a=t.indexOf('"',e);C(12,e,a===-1?i:a);continue}case 4:{let a=e;for(;a<i;){let m=t.charCodeAt(a);if(m===10||m===123)break;a++}se(e,a)&&H();continue}case 5:{if(p>=48&&p<=57){let m=e+1;for(;m<i&&t.charCodeAt(m)>=48&&t.charCodeAt(m)<=57;)m++;C(8,e,m);continue}let a=G(e);if(a>e&&T("width",a)&&!te(t.charCodeAt(a+5))){e=a+5,H();continue}return V(1)}case 6:C(22,e,U(e)),H();continue;case 7:C(24,e,U(e)),H();continue;case 8:{if(p===125){e++,H();continue}let a=t.indexOf("}",e);C(25,e,a===-1?i:a);continue}case 9:{let a=T("default",e)&&G(e+7)>e+7,m=a?e+7:re(e),y=G(m);if(m===e||y===m)return V(1);C(a?31:30,e,y),H(),O(10);continue}case 10:C(32,e,U(e)),H();continue;case 11:{let a=re(e);if(a===e)return V(1);for(;t.charCodeAt(a)===44;){let m=G(a+1),y=re(m);if(y===m)break;a=y}C(38,e,a),H(),O(12);continue}case 12:C(39,e,U(e)),H();continue;case 13:{let a=e;for(;a<i&&(te(t.charCodeAt(a))||t.charCodeAt(a)===44);)a++;let m=G(a);if(a===e||m===a)return V(1);C(35,e,m),H(),O(14);continue}case 14:C(36,e,U(e)),H();continue;case 15:{if(T("left of",e)&&!te(t.charCodeAt(e+7))){C(46,e,e+7),H(),O(16);continue}if(T("right of",e)&&!te(t.charCodeAt(e+8))){C(47,e,e+8),H(),O(16);continue}if(p===34){e++,H(),O(18);continue}return V(1)}case 16:{let a=G(e),m=a;for(;m<i;){let y=t.charCodeAt(m);if(y===58||y===45||le(y))break;m++}if(m===a)return V(1);se(e,m)&&(H(),O(17));continue}case 17:{let a=G(e);if(t.charCodeAt(a)===58){let n=a+1;for(;n<i;){let $=t.charCodeAt(n);if($===58||$===10||$===59)break;n++}if(n>a+1){z(20,t.slice(e+2,n).trim(),e,n),H();continue}}let m=t.indexOf(`
|
|
4
|
-
`,e),y=-1;for(;m!==-1&&(y=G(m),!(T("end note",y)&&!te(t.charCodeAt(y+8))));)m=t.indexOf(`
|
|
5
|
-
`,y);if(m===-1)return V(1);z(20,t.slice(e,y).trim(),e,y+8),H();continue}case 18:{let a=G(e);if(T("as",a)){C(13,e,G(a+2)),H(),O(19);continue}if(p===34){e++;continue}let m=t.indexOf('"',e);C(20,e,m===-1?i:m);continue}case 19:se(e,U(e))&&H();continue}}}var Lt=["TB","BT","RL","LR"],ke="'NL', 'ID', 'HIDE_EMPTY', 'scale', 'COMPOSIT_STATE', 'STATE_DESCR', 'FORK', 'JOIN', 'CHOICE', 'CONCURRENT', 'note', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'CLICK', 'classDef', 'style', 'class', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'EDGE_STATE'";function Ot(t,i){let{types:r,texts:d,starts:w,error:E}=Et(t),o=0,e=b=>{let g=r[o];throw g===1?E!==void 0?new rt(E,"syntax",{type:"state",...ut(t,w[o])}):Ue("state",t,w[o],"",!0):Ue("state",t,w[o],`Expecting ${b}, got '${ze[g]}'`)},D=b=>(r[o]!==b&&e(`'${ze[b]}'`),d[o++]),I=()=>{let b=r[o];b!==14&&b!==44&&e("'ID', 'EDGE_STATE'");let g=d[o++].trim();return r[o]!==45?{stmt:"state",id:g,type:"default",description:""}:(o++,{stmt:"state",id:g,classes:[D(14).trim()],type:"default",description:""})};for(;r[o]===2;)o++;r[o]!==3&&e("'NL', 'SD'"),o++;let j=[],Z=[],R=b=>{b!=="nl"&&j.push(b)},v=(b,g)=>{o++;let h=[];j.push({stmt:"state",id:b,type:"default",description:g,doc:h}),Z.push(j),j=h};for(;;){let b=r[o];switch(b){case 2:o++;break;case 14:case 44:{let g=I();if(r[o]===4)g.description=i.trimColon(d[o++]),R(g);else if(r[o]===5){o++;let h=I();r[o]===4?R({stmt:"relation",state1:g,state2:h,description:i.trimColon(d[o++])}):R({stmt:"relation",state1:g,state2:h})}else R(g);break}case 6:R(d[o++]);break;case 7:o++,D(8),R(d[o-2]);break;case 9:r[o+1]===10?v(d[o++],""):R(d[o++]);break;case 12:{let g=d[o++];D(13);let h=D(14);if(r[o]===10)v(h,g);else if(h.includes(":")){let P=h.split(":");R({stmt:"state",id:P[0],type:"default",description:[g.trim(),P[1]]})}else R({stmt:"state",id:h,type:"default",description:g.trim()});break}case 15:R({stmt:"state",id:d[o++],type:"fork"});break;case 16:R({stmt:"state",id:d[o++],type:"join"});break;case 17:R({stmt:"state",id:d[o++],type:"choice"});break;case 18:o++,R({stmt:"state",id:i.getDividerId(),type:"divider"});break;case 19:{let g=d[o++];if(r[o]===46||r[o]===47){let h=d[o++].trim(),P=D(14).trim();R({stmt:"state",id:P,note:{position:h,text:D(20).trim()}})}else r[o]!==20&&e("'NOTE_TEXT', 'left_of', 'right_of'"),o++,D(13),D(14),R(g);break}case 40:case 41:case 42:case 43:{let g=Lt[b-40];o++,i.setDirection(g),R({stmt:"dir",value:g});break}case 21:{o++;let g=D(22).trim();i.setAccTitle(g),R(g);break}case 23:{o++;let g=D(24).trim();i.setAccDescription(g),R(g);break}case 25:{let g=d[o++].trim();i.setAccDescription(g),R(g);break}case 26:{o++;let g=I(),h,P="";r[o]===28?(o++,h=D(27)):(r[o]!==27&&e("'STRING', 'HREF'"),h=d[o++],P=D(27)),D(2),R({stmt:"click",id:g,url:h,tooltip:P});break}case 29:{o++;let g=D(30).trim();R({stmt:"classDef",id:g,classes:D(32).trim()});break}case 34:{o++;let g=D(35).trim();R({stmt:"style",id:g,styleClass:D(36).trim()});break}case 37:{o++;let g=D(38).trim();R({stmt:"applyClass",id:g,styleClass:D(39).trim()});break}case 11:Z.length===0&&e(`'$end', ${ke}`),o++,j=Z.pop();break;case 0:return Z.length>0&&e(`'STRUCT_STOP', ${ke}`),i.setRootDoc(j),j;default:e(Z.length>0?`'STRUCT_STOP', ${ke}`:`'$end', ${ke}`)}}}var Ht=40,Gt=16,Nt=44,de=16,Me=10,Ft=16,Ve=10,Re=26,Je=8,Wt=320,Ee=10,Ze=8,qe=' fill="var(--_s)" stroke="var(--_b)"',we=' fill="none" stroke="var(--_b)"',Yt=/(?:^| )statediagram-(?:state|cluster-alt|cluster|note)(?= |$)/g,jt=new Map([["rectWithTitle",1],["stateStart",2],["stateEnd",3],["choice",4],["fork",5],["join",6],["note",7],["divider",10]]),Pt=["pele-node pele-state","pele-node pele-state","pele-node pele-state-start","pele-node pele-state-end","pele-node pele-state-choice","pele-node pele-state-fork","pele-node pele-state-join","pele-note","pele-cluster pele-state-composite"];function Qe(t){return t==="TB"||t==="BT"}function Le(t,i,r){var w;let d=(w=t.state)==null?void 0:w[i];return typeof d=="number"&&d>0?Math.min(d,2e3):r}function et(t){let i=0,r=t.length;for(;i<r&&t.charCodeAt(i)===34;)i++;for(;r>i&&t.charCodeAt(r-1)===34;)r--;return t.slice(i,r)}function tt(t,i,r){return t<i?i:t>r?r:t}function Se(t,i,r,d,w){return`<rect x="${F(t)}" y="${F(i)}" width="${F(r)}" height="${F(d)}"${w}/>`}function ve(t,i,r,d){let w=Oe(0,0);return w.isGroup=!0,w.dir=t,w.padX=i,w.padTop=r,w.padBottom=d,w}function Bt(t,i,r){return gt(t.direction)?mt(r,d=>st(t,i,r,d)):st(t,i,r,!1)}function st(t,i,r,d){let w=t.graph,E=r.fontSize??16,o=Math.round(E*.875),e=r.measurer??ht(r.fontFamily),D=Le(i,"wrappingWidth",200),I=r.padding??8,j=r.icons,Z=d?"TB":Be(t.direction),R=Ke(void 0,!1,e,E,0),v=(l,s,c,k=0)=>Ke(l,!0,e,s,c,k),b=new Map,g=[],h=[],P=(l,s,c)=>(g.push({node:l,kind:s,style:void 0,label:R,lines:[],w:0,h:0,titleH:0}),c&&h.push(c),g.length-1);for(let l of w.nodes){if(l.shape==="noteGroup")continue;let s=l.isGroup?l.shape==="divider"?9:8:jt.get(l.shape)??0;b.set(l.id,P(l,s,void 0))}let W=g.length,K=[];for(let l=0;l<W;l++){let s=g[l].node.parentId,c=s===void 0?void 0:b.get(s);K.push(c!==void 0&&c!==l&&g[c].node.isGroup?c:-1)}{let l=[];for(let u=0;u<W;u++)l.push([]);let s=[],c=new Uint8Array(W);for(let u=0;u<W;u++)K[u]===-1?(c[u]=1,s.push(u)):l[K[u]].push(u);let k=0,x=()=>{for(;k<s.length;k++)for(let u of l[s[k]])c[u]||(c[u]=1,s.push(u))};x();let B=new Int32Array(W).fill(-1);for(let u=0;u<W;u++){if(c[u])continue;let f=u;for(;B[f]!==u;)B[f]=u,f=K[f];K[f]=-1,c[f]=1,s.push(f),x()}}let A=new Int32Array(W).fill(-1);for(let l=0;l<W;l++){let s=g[l].node.noteFor,c=s===void 0?void 0:b.get(s);c!==void 0&&(A[l]=c,K[l]=K[c])}let C=l=>Be(g[l].node.dir),z=l=>Qe(K[l]===-1?Z:C(K[l])),O=new Int32Array(W),H=new Uint8Array(W),T=new Array(W).fill(1/0),G=0,re=new Int32Array(2*W);for(let l of w.edges){let s=b.get(l.start),c=b.get(l.end);if(!(s===void 0||c===void 0)){if(l.pattern==="dashed"){H[g[s].kind===7?c:s]=1;continue}O[s]=Math.max(O[s],++re[2*s]),O[c]=Math.max(O[c],++re[2*c+1]),T[s]===1/0&&(T[s]=G++),T[c]===1/0&&(T[c]=G++)}}for(let l=0;l<W;l++){let s=g[l],c=s.node,k=wt(c.cssStyles.length>0?c.cssCompiledStyles.concat(c.cssStyles):c.cssCompiledStyles),x=(k.bold?1:0)|(k.italic?2:0),B=k.fontSize??E;s.style=k;let u;switch(s.kind){case 8:s.label=v(c.label,B,4e3,x),s.titleH=s.label.height>0?s.label.height+12:0,u=ve(C(l),de,s.titleH+de,de),u.minW=s.label.width+2*de;break;case 9:u=ve(C(l),Me,Me,Me);break;case 2:s.w=s.h=14;break;case 3:s.w=s.h=18;break;case 4:s.w=s.h=30;break;case 5:case 6:{let f=tt(40*O[l]+16,72,320);s.w=z(l)?f:Ze,s.h=z(l)?Ze:f;break}case 10:break;case 7:s.label=v(c.label,o,Math.max(D,Wt)),s.w=s.label.width+24,s.h=s.label.height+16;break;default:{s.label=v(c.label,B,D,x);let f=s.label.width,S=s.label.height+2*Ve;if(s.kind===1){S+=14;for(let L of c.description){let _=v(L===""?" ":L,o,D,x);s.lines.push(_),_.width>f&&(f=_.width),S+=_.height}}s.w=Math.max(f+2*Ft,56),s.h=S}}u??(u=Oe(s.w,s.h)),(s.kind===0||s.kind===1)&&(u.span=(z(l)?s.w:s.h)-24),h.push(u)}let U=[],ie=[],J=[],ae=new Int32Array(W),se=new Float64Array(W),V=new Float64Array(W),p=new Map,a=(l,s)=>{if(!h[l].isGroup)return!1;for(let c=K[s];c!==-1;c=K[c])if(c===l)return!0;return!1},m=(l,s)=>(p.set(U.length,l),T.push(s?-1:1/0),P(void 0,10,Oe(0,0,l)));for(let l of w.edges){let s=b.get(l.start),c=b.get(l.end);if(s===void 0||c===void 0)continue;let k=v(l.label,o,D),x=k.width>0?k.width+12:0;s===c?(ae[s]++,se[s]=Math.max(se[s],x),V[s]+=k.height):a(s,c)?s=m(s,!0):a(c,s)&&(c=m(c,!1)),J.push(l),ie.push(k),U.push({src:s,dst:c,minlen:1,labelW:x,labelH:k.height>0?k.height+4:0,route:[],labelX:0,labelY:0})}for(let l=0;l<W;l++){if(A[l]!==-1)continue;let s=h[l],c=0;if(ae[l]>0){let x=Re+(ae[l]-1)*8;c=z(l)?x+se[l]:x*.75+4+V[l],s.isGroup||(z(l)?(s.w+=2*c,s.h=Math.max(s.h,V[l])):(s.h+=2*c,s.w=Math.max(s.w,se[l])),c=0)}if(!H[l]&&c===0){s.parent=K[l];continue}let k=z(l)?ve("LR",c,0,0):ve("TB",0,c,c);k.parent=K[l],T.push(T[l]),h[l].parent=P(void 0,10,k)}for(let l=0;l<W;l++)A[l]!==-1&&(h[l].parent=h[A[l]].parent);{let l=[];for(let u=0;u<h.length;u++)l.push([]);let s=[];for(let u=0;u<h.length;u++){let f=h[u].parent;f>=0?l[f].push(u):s.push(u)}let c=u=>g[u].kind===2?0:1,k=(u,f)=>c(u)-c(f)||(T[u]===T[f]?0:T[u]<T[f]?-1:1)||u-f,x=0,B=s.sort(k).reverse();for(;B.length>0;){let u=B.pop();h[u].seq=x++;let f=l[u].sort(k);for(let S=f.length-1;S>=0;S--)B.push(f[S])}}let y=ct(h,U,Z,{nodeSep:Le(i,"nodeSpacing",Ht),edgeSep:Gt,rankSep:Le(i,"rankSpacing",Nt),portSep:20,headRoom:Ie("arrow_point")}),n=Math.ceil(y.width+2*I),$=Math.ceil(y.height+2*I),q=[],Ae=new Map;for(let l of U){let s=l.route;for(let c=3;c<s.length-3;c+=3){let k=Math.round(s[c+1]),x=Ae.get(k);x?x.push(s[c]):Ae.set(k,[s[c]])}}let ge=[];for(let l=0;l<h.length;l++)ge.push([]);let oe=[];for(let l=0;l<h.length;l++){let s=h[l].parent;s>=0?ge[s].push(l):oe.push(l)}let it=oe.slice();for(let l=0;l<oe.length;l++)for(let s of ge[oe[l]])oe.push(s);let Te="",me="",He="",Ge="",Ne=(l,s,c,k,x)=>{let B=l.filter(S=>g[S].kind===9);if(B.length<2)return;let u=(S,L)=>L?h[S].x-h[S].w/2:h[S].y-h[S].h/2,f=(S,L)=>L?h[S].x+h[S].w/2:h[S].y+h[S].h/2;for(let S of[!0,!1]){let L=B.slice().sort((M,X)=>u(M,S)-u(X,S)||M-X),_=!0;for(let M=1;M<L.length;M++)f(L[M-1],S)>u(L[M],S)+.5&&(_=!1);if(_){for(let M=1;M<L.length;M++){let X=F((f(L[M-1],S)+u(L[M],S))/2+I);me+=`<path class="pele-divider" d="M${S?`${X},${F(c)}V${F(x)}`:`${F(s)},${X}H${F(k)}`}"/>`}return}}for(let S of B){let L=h[S];me+=Se(L.x-L.w/2+I,L.y-L.h/2+I,L.w,L.h,` class="pele-divider" rx="${Ee}"`)}};Ne(it,I/2,I/2,n-I/2,$-I/2);for(let l of oe){let s=g[l],c=s.node,k=s.style;if(c===void 0||k===void 0||s.kind>=9)continue;let x=h[l],B=x.x+I,u=x.y+I,f=s.w,S=s.h,L=` class="pele-label"${k.text}`,_;switch(s.kind){case 8:{let N=B-x.w/2,Y=u-x.h/2;_=Se(N,Y,x.w,x.h,` rx="${Ee}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${k.shape}`),s.titleH>0&&(_+=`<path d="M${F(N)},${F(Y+s.titleH)}H${F(N+x.w)}"${we}${k.line}/>`+pe(s.label,Ut(x,s.label.width,Ae)+I,Y+s.titleH/2,` class="pele-cluster-label"${k.text}`,j)),Ne(ge[l],N,Y+s.titleH,N+x.w,Y+x.h);break}case 2:_=`<circle r="7" fill="var(--_l)"${k.shape}/>`;break;case 3:_=`<circle r="8.5" fill="var(--_bg)" stroke="var(--_l)"${k.line}/><circle r="5" fill="var(--_l)"${k.shape}/>`;break;case 4:_=`<polygon points="0,${F(-S/2)} ${F(f/2)},0 0,${F(S/2)} ${F(-f/2)},0"${qe}${k.shape}/>`;break;case 5:case 6:_=Se(-f/2,-S/2,f,S,` rx="2" fill="var(--_l)"${k.shape}`);break;case 7:{let N=F(f/2),Y=F(S/2),Q=F(f/2-Je),he=F(Je-S/2);_=`<path d="M-${N},-${Y}H${Q}L${N},${he}V${Y}H-${N}Z" fill="var(--_bg)" stroke="var(--_b)"/><path d="M${Q},-${Y}V${he}H${N}"${we}/>`+pe(s.label,0,0,` class="pele-label" font-size="${o}" fill="var(--_m)"`,j);break}default:{if(_=Se(-f/2,-S/2,f,S,` rx="${F(Math.min(Ee,S/2))}"${qe}${k.shape}`),s.kind===0){_+=pe(s.label,0,0,L,j);break}let N=Ve-S/2+s.label.height;_+=`<path d="M${F(-f/2)},${F(N+6)}H${F(f/2)}"${we}${k.line}/>`+pe(s.label,0,N-s.label.height/2,L,j),N+=14;for(let Y of s.lines)_+=pe(Y,0,N+Y.height/2,` class="pele-state-description" font-size="${o}"${k.text}`,j),N+=Y.height}}let M=t.links.get(c.id);if(M){let N=pt(et(M.tooltip));N&&(_=`<title>${St(N)}</title>`+_),_=dt(_,ft(et(M.url)),c.id,q,r,' target="_blank"')}let X=`<g class="${Pt[s.kind]}${vt(c.cssClasses.replace(Yt,""))}" data-id="${Xe(c.id)}"`;s.kind===8?Te+=`${X}>${_}</g>`:s.kind===7?Ge+=`${X} transform="translate(${F(B)},${F(u)})">${_}</g>`:He+=`${X} transform="translate(${F(B)},${F(u)})">${_}</g>`}let Fe=(l,s,c)=>{let k=h[c];if(k.isGroup)return;let x=g[c],B=x.kind===5||x.kind===6,u=s===0?3:s-3;for(let f of[1,0]){let S=f?k.h:k.w,L=f?x.h:x.w,_=f?x.w:x.h,M=(f?k.y:k.x)+I,X=(f?k.x:k.y)+I,N=l[s+f]-M;if(!(Math.abs(Math.abs(N)-S/2)>=.5)){l[s+f]-=Math.sign(N)*(S-L)/2,B&&_>L&&(l[s+1-f]=tt(l[u+1-f],X-_/2+6,X+_/2-6));return}}},_e=kt();for(let l=0;l<U.length;l++){let s=U[l];s.src===s.dst||s.route.length<6||J[l].pattern==="dashed"||_e.add(s.dst,De(s.route,s.route.length-3,h[s.dst]),"arrow_point")}let xe="",$e="",lt=new Int32Array(W),We=new Float64Array(W);for(let l=0;l<U.length;l++){let s=U[l],c=J[l],k=ie[l],x=c.pattern==="dashed",B=x?"none":"arrow_point",u;if(s.src===s.dst){let f=h[s.src],S=g[s.src],L=lt[s.src]++,_=z(s.src),M=f.isGroup?f.w:S.w,X=f.isGroup?f.h:S.h,N=(_?M:X)/2,Y=Math.max(Math.min((_?X:M)/2-4,8+L*6),2),Q=Re+L*8,he=Ie(B)/(Math.hypot(Q,Y)||1),ye=(ne,ce)=>f.x+I+(_?N+ne:-ce),be=(ne,ce)=>f.y+I+(_?ce:N+ne),Ce=(ne,ce)=>`${F(ye(ne,ce))},${F(be(ne,ce))}`;u={d:`M${Ce(0,-Y)}C${Ce(Q,-2*Y)} ${Ce(Q,2*Y)} ${Ce(Q*he,Y+Y*he)}`,sx:0,sy:0,sdx:0,sdy:0,ex:ye(0,Y),ey:be(0,Y),edx:ye(-Q,-Y)-ye(0,0),edy:be(-Q,-Y)-be(0,0)};let Ye=Math.hypot(u.edx,u.edy)||1;u.edx/=Ye,u.edy/=Ye;let je=Re+(ae[s.src]-1)*8,Pe=We[s.src]+k.height/2;We[s.src]+=k.height,s.labelX=_?f.x+N+je+4+s.labelW/2:f.x,s.labelY=_?f.y-V[s.src]/2+Pe:f.y+N+je*.75+4+Pe}else{let f=s.route.slice(),S=_e.of(s.src,De(f,0,h[s.src])),L=_e.of(s.dst,De(f,f.length-3,h[s.dst]));for(let M=0;M<f.length;M+=3)f[M]+=I,f[M+1]+=I;Fe(f,0,s.src),Fe(f,f.length-3,s.dst);let _=p.get(l);if(_!==void 0&&f.length>=6){let M=h[_],X=g[s.src].kind===10,N=X?0:f.length-3,Y=(M.dir==="TB"||M.dir==="LR")===X,Q=Qe(M.dir)?[f[N],M.y+I+(Y?g[_].titleH-M.h/2:M.h/2),0]:[M.x+I+(Y?-M.w/2:M.w/2),f[N+1],1];f=X?Q.concat(f):f.concat(Q)}u=yt(f,void 0,0,Ie(B),S,L)}if(xe+=`<g class="pele-edge ${x?'pele-note-edge" stroke="var(--_b)" stroke-dasharray="3 4':"pele-transition"}" data-id="${Xe(c.id)}"><path d="${u.d}"/>`+bt(B,u.ex,u.ey,u.edx,u.edy,"var(--_l)")+"</g>",k.width>0){let f=s.labelX+I,S=s.labelY+I;$e+=Ct(c.id,k,f,S,"",j)}}let fe=nt(t.title,e,E,I,n,$,(Te?`<g class="pele-clusters">${Te}</g>`:"")+(me?`<g class="pele-dividers" stroke-dasharray="4 4"${we}>${me}</g>`:"")+(xe?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${xe}</g>`:"")+($e?`<g class="pele-edge-labels" font-size="${o}">${$e}</g>`:"")+`<g class="pele-nodes">${He}${Ge}</g>`);return{svg:At("state",fe.width,fe.height,E,r,t,fe.content),width:fe.width,height:fe.height,links:q}}function Ut(t,i,r){let d=r.get(Math.round(t.y-t.h/2));if(d===void 0||i===0)return t.x;let w=t.x-t.w/2,E=i/2,o=t.x,e=-1;for(let D of[t.x,w+de+E,w+t.w-de-E]){let I=1/0;for(let j of d)j>w&&j<w+t.w&&(I=Math.min(I,Math.abs(j-D)-E));if(I>=6)return D;I>e+.5&&(e=I,o=D)}return o}var ss={type:"state",parse(t,i,r){let d=new xt;return r&&(d.title=r),Ot(t,d),d},render:Bt};export{ss as state};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var lt=Object.defineProperty;var rt=(t,e,a)=>e in t?lt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a;var be=(t,e,a)=>rt(t,typeof e!="symbol"?e+"":e,a);import{x as st,D as ot,M as ct,$ as ft,v as ht,w as pt,V as $t,W as mt,G as dt,O as ut,P as gt,j as We,Y as yt,z as bt,U as wt,H as xt}from"./VMV7XPHP-6QkisQwm.js";import{D as Mt,w as je}from"./HWDLEDTA-C_JcdBMO.js";import{_ as q,x as i,m as Ge,f as J,$ as kt,a as vt,y as _t}from"./RZSVICHU-BiwjruZZ.js";import{H as St}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var Dt=class{constructor(){be(this,"domains",new Map);be(this,"transitions",[])}setDomains(t){if(t)for(let e of t){let a=e.domain;this.domains.set(a,{name:a,items:(e.items??[]).map(o=>({label:o.label}))})}}setTransitions(t){t&&(this.transitions=t.filter(e=>e.from!==e.to).map(e=>({from:e.from,to:e.to,label:e.label||void 0})))}};function Ct(t,e){let a=new Dt;return a.setDomains(t.domains),a.setTransitions(t.transitions),{type:"cynefin",title:t.title||e,accTitle:t.accTitle?t.accTitle.replace(/^\s+/g,""):void 0,accDescr:t.accDescr?t.accDescr.replace(/\n\s+/g,`
|
|
2
|
-
`):void 0,domains:a.domains,transitions:a.transitions}}var Ie=[{name:"cynefin-beta:",pattern:"cynefin-beta:"},xt("cynefin-beta"),{name:"-->",pattern:"-->"},{name:":",pattern:":"},{name:"DOMAIN_NAME",pattern:/complex|complicated|clear|chaotic|confusion/y},ct,ft,ht,pt,$t,mt,dt,ut,gt];function At(t){let e=new st(ot(t,Ie,"cynefin"),Ie,"cynefin"),a={$type:"Cynefin",domains:[],transitions:[]},o=()=>{for(;e.kinds[e.i]===9;)e.i++},f=()=>{e.kind!==-1&&(e.kind!==9&&e.fail("a line break or the end of input"),o())};for(o(),e.kind!==1&&e.kind!==0&&e.fail("'cynefin-beta'"),e.i++;e.kind!==-1;)switch(e.kind){case 9:e.i++;break;case 5:a.accDescr=wt(e.take()),f();break;case 6:a.accTitle=bt(e.take()),f();break;case 7:a.title=yt(e.take()),f();break;case 4:{let h=e.take();if(e.accept(2)){let p={$type:"Transition",from:h,to:e.expect(4)};e.accept(3)&&(p.label=We(e.expect(8))),f(),a.transitions.push(p);break}let g={$type:"DomainBlock",domain:h,items:[]};for(o();e.kinds[e.i]===8;)g.items.push({$type:"DomainItem",label:We(e.take())}),o();a.domains.push(g);break}default:e.fail("a domain, a transition, a title, or a line break")}return a}function Qe(t){let e=t+1831565813|0;return e=Math.imul(e^e>>>15,e|1),e^=e+Math.imul(e^e>>>7,e|61),((e^e>>>14)>>>0)/4294967296}function Tt(t){let e=0;for(let a=0;a<t.length;a++)e=(e<<5)-e+t.charCodeAt(a),e|=0;return e}function Et(t,e){return typeof t=="number"&&Number.isFinite(t)&&t!==0?t:Tt(e)}var Lt={segments:7,vertical:!0,pointStep:17,controlStep:31,controlShift:7},Ue={segments:7,vertical:!1,pointStep:23,controlStep:37,controlShift:11};function we(t,e,a,o,f,h){let g=(e-t)/h.segments,p=[],y=[];for(let c=0;c<=h.segments;c++){let w=c===0&&h.pinStart||c===h.segments&&h.pinEnd;p.push(t+c*g),y.push(w?a:a+Qe(o+c*h.pointStep)*f*2-f)}let F=h.vertical?[y[0],p[0]]:[p[0],y[0]];for(let c=0;c<h.segments;c++){let w=(p[c]+p[c+1])/2,P=f*1.5*(c%2===0?1:-1)*Qe(o+c*h.controlStep+h.controlShift);h.vertical?F.push(y[c]+P,w,y[c+1]-P,w,y[c+1],p[c+1]):F.push(w,y[c]+P,w,y[c+1]-P,p[c+1],y[c+1])}return F}function Pt(t,e,a,o){let f=a-e;return[t,e,t+o,e+f*.2,t-o*1.5,e+f*.55,t+o*.5,e+f*.75,t-o,e+f*.85,t+o*.3,e+f*.95,t,a]}function K(t){let e="";for(let a=2;a<t.length;a+=6)e+=`C${i(t[a])},${i(t[a+1])} ${i(t[a+2])},${i(t[a+3])} ${i(t[a+4])},${i(t[a+5])}`;return e}function se(t){let e="";for(let a=t.length-6;a>=2;a-=6)e+=`C${i(t[a+2])},${i(t[a+3])} ${i(t[a])},${i(t[a+1])} ${i(t[a-2])},${i(t[a-1])}`;return e}function oe(t){return`M${i(t[0])},${i(t[1])}${K(t)}`}function Zt(t,e,a,o){let f=`${i(a)},${i(o)}`;return`M${i(t-a)},${i(e)}A${f} 0 1,1 ${i(t+a)},${i(e)}A${f} 0 1,1 ${i(t-a)},${i(e)}Z`}var xe=[["complex",0,0,0],["complicated",1,0,1],["chaotic",0,1,3],["clear",1,1,2]],Nt=4,zt=new Map([["complex",["Complex","Probe → Sense → Respond","Emergent Practices"]],["complicated",["Complicated","Sense → Analyse → Respond","Good Practices"]],["clear",["Clear","Sense → Categorise → Respond","Best Practices"]],["chaotic",["Chaotic","Act → Sense → Respond","Novel Practices"]],["confusion",["Confusion","","Disorder"]]]),Ve=3,Ye=200,Rt=10,Bt=4,ce=6,qe=10,Je=20,fe=10;function he(t,e,a,o,f){var g;let h=(g=t.cynefin)==null?void 0:g[e];return typeof h=="number"&&h>=o&&h<=f?h:a}function Ot(t,e,a){var Le;let o=a.fontSize??16,f=Math.round(o*.8125),h=Math.round(o*.875),g=a.measurer??St(a.fontFamily),p=a.padding??8,y=a.icons,F=((Le=e.cynefin)==null?void 0:Le.showDomainDescriptions)!==!1,c=he(e,"boundaryAmplitude",8,0,50),w=Et(he(e,"seed",0,-1e15,1e15),a.idPrefix??"pele"),P=Math.round(h*1.5),Me=(n,l)=>{let r=q(n,!1,g,h,Ye);return{text:n,label:r,w:r.width+2*Rt,h:Math.max(r.height,P)+2*Bt,overflow:l}},ke=n=>{var Q;let l=zt.get(n),r=q(l[0],!1,g,o,4e3,1),s=[];if(F)for(let d of[l[1],l[2]])d&&s.push(q(d,!1,g,f,4e3,2));let $=((Q=t.domains.get(n))==null?void 0:Q.items)??[],T=n==="confusion"&&$.length>Ve?Ve:$.length,x=[];for(let d=0;d<T;d++)x.push(Me($[d].label,!1));T<$.length&&x.push(Me(`+${$.length-T} more`,!0));let D=r.width,E=r.height;for(let d of s)D=Math.max(D,d.width),E+=d.height;x.length>0&&(E+=qe-ce);for(let d of x)D=Math.max(D,d.w),E+=ce+d.h;return{name:n,title:r,subtitles:s,badges:x,w:D,h:E,cx:0,cy:0}},pe=xe.map(([n])=>ke(n)),k=ke("confusion"),H=Math.max(88,k.w*.71+8),W=Math.max(64,k.h*.71+6),v=he(e,"width",640,100,1e4)/2,_=he(e,"height",440,100,1e4)/2;for(let n of pe)v=Math.max(v,n.w+2*Je),_=Math.max(_,n.h+2*Je);for(let n of pe){let l=(v-n.w)/2,r=(_-n.h)/2;if((l/(H+fe))**2+(r/(W+fe))**2>=1)continue;let s=n.w+2*(H+fe),$=n.h+2*(W+fe);s*_<=v*$?v=Math.max(v,s):_=Math.max(_,$)}let j=q(t.title,!1,g,o,4e3,1),ve=j.height>0?j.height+12:0,X=2*v,_e=2*_,S=p,Z=p+ve,C=S+v,A=Z+_,ee=S+X,$e=Z+_e,G=we(Z,A,C,w,c,{...Lt,segments:4,pinEnd:!0}),te=we(S,C,A,w+100,c,{...Ue,segments:4,pinEnd:!0}),I=we(C,ee,A,w+200,c,{...Ue,segments:4,pinStart:!0}),ae=Pt(C,A,$e,X*.03),N=(n,l)=>l?`${i(n[n.length-2])},${i(n[n.length-1])}`:`${i(n[0])},${i(n[1])}`,Ke=new Map([["complex",`M${i(S)},${i(Z)}L${N(G,!1)}${K(G)}${se(te)}Z`],["complicated",`M${N(G,!1)}L${i(ee)},${i(Z)}L${N(I,!0)}${se(I)}${se(G)}Z`],["chaotic",`M${N(te,!1)}${K(te)}${K(ae)}L${i(S)},${i($e)}Z`],["clear",`M${N(I,!1)}${K(I)}L${i(ee)},${i($e)}L${N(ae,!0)}${se(ae)}Z`]]),Se="";for(let[n,,,l]of xe)Se+=`<path class="pele-cynefin-region" data-id="${n}" d="${Ke.get(n)}" fill="${Ge(l)}" fill-opacity="0.14"/>`;let Xe=`<g class="pele-cynefin-boundaries" fill="none" stroke="var(--_b)" stroke-dasharray="6 3"><path d="${oe(G)}"/><path d="${oe(te)}"/><path d="${oe(I)}"/><path class="pele-cynefin-cliff" d="${oe(ae)}" stroke="var(--_l)" stroke-width="2" stroke-dasharray="none" stroke-linecap="round"/></g>`,De=Zt(C,A,H,W),et=`<path d="${De}" fill="var(--_bg)"/><path class="pele-cynefin-region" data-id="confusion" d="${De}" fill="${Ge(Nt)}" fill-opacity="0.18" stroke="var(--_b)" stroke-dasharray="4 2"/>`,Ce=n=>{let l=n.cy-n.h/2,r=J(n.title,n.cx,l+n.title.height/2,' class="pele-label" font-weight="var(--_hw)"');l+=n.title.height;for(let s of n.subtitles)r+=J(s,n.cx,l+s.height/2,` class="pele-cynefin-subtitle" font-size="${f}" font-style="italic" fill="var(--_m)"`),l+=s.height;l+=qe-ce;for(let s of n.badges)l+=ce,r+=`<g class="pele-node${s.overflow?" pele-cynefin-overflow":""}"${s.overflow?"":` data-id="${_t(s.text)}"`}><rect x="${i(n.cx-s.w/2)}" y="${i(l)}" width="${i(s.w)}" height="${i(s.h)}" rx="${vt}" fill="var(--_bg)" stroke="var(--_b)"${s.overflow?' stroke-dasharray="3 2"':""}/>`+J(s.label,n.cx,l+s.h/2,` class="pele-label" font-size="${h}"${s.overflow?' fill="var(--_m)"':""}`,y)+"</g>",l+=s.h;return`<g class="pele-cynefin-domain" data-id="${n.name}">${r}</g>`},ne=new Map,me="";xe.forEach(([n,l,r],s)=>{let $=pe[s];$.cx=S+v*(l+.5),$.cy=Z+_*(r+.5),ne.set(n,$),me+=Ce($)}),k.cx=C,k.cy=A,ne.set("confusion",k),me+=Ce(k);let de=(n,l,r)=>n===k?((l-C)/(H+4))**2+((r-A)/(W+4))**2<=1:Math.abs(l-n.cx)<=n.w/2+8&&Math.abs(r-n.cy)<=n.h/2+8,ue="",Ae=new Map;for(let n of t.transitions){let l=ne.get(n.from),r=ne.get(n.to);if(!l||!r||l===r)continue;let s=n.from<n.to?`${n.from} ${n.to}`:`${n.to} ${n.from}`,$=Ae.get(s)??0;Ae.set(s,$+1);let T=r.cx-l.cx,x=r.cy-l.cy,D=Math.hypot(T,x)||1,E=(l.cx+r.cx)/2,Q=(l.cy+r.cy)/2,d=-x*(E-C)+T*(Q-A)>=0?1:-1,ie=-x/D*d,le=T/D*d,Pe=(l!==k&&r!==k&&Math.abs(T)>1&&Math.abs(x)>1?2*(Math.hypot(H*ie,W*le)+16):D*.15)+$*56,Ze=E+ie*Pe,Ne=Q+le*Pe,z=m=>{let u=1-m;return[u*u*l.cx+2*u*m*Ze+m*m*r.cx,u*u*l.cy+2*u*m*Ne+m*m*r.cy]},ze=(m,u,L,re)=>{for(let O=0;O<16;O++){let Y=(u+L)/2;de(m,...z(Y))===re?u=Y:L=Y}return(u+L)/2},M=48,b=1;for(;b<=M&&de(l,...z(b/M));)b++;if(b>M)continue;let R=ze(l,(b-1)/M,b/M,!0);for(;b<=M&&!de(r,...z(b/M));)b++;let B=b>M?1:ze(r,(b-1)/M,b/M,!1),[at,nt]=z(R),[U,V]=z(B),Re=(m,u,L)=>(1-R)*(1-B)*m+((1-R)*B+R*(1-B))*u+R*B*L,ge=Re(l.cx,Ze,r.cx),ye=Re(l.cy,Ne,r.cy),Be=Math.hypot(U-ge,V-ye)||1,Oe=(U-ge)/Be,Fe=(V-ye)/Be,it=Mt("arrow_point",U,V,Oe,Fe,"var(--_l)");U-=Oe*je("arrow_point"),V-=Fe*je("arrow_point");let He="";if(n.label){let m=q(n.label,!1,g,f,Ye),[u,L]=z((R+B)/2),re=Math.abs(ie)*m.width/2+Math.abs(le)*m.height/2+6,O=m.width/2+4,Y=Math.min(Math.max(u+ie*re,S+O),Math.max(ee-O,S+O));He=J(m,Y,L+le*re,` class="pele-edge-label" font-size="${f}"`,y)}ue+=`<g class="pele-edge" data-id="${n.from}-${n.to}"><path d="M${i(at)},${i(nt)}Q${i(ge)},${i(ye)} ${i(U)},${i(V)}" fill="none" stroke="var(--_l)"/>`+it+He+"</g>"}let Te=Math.ceil(Math.max(X,j.width)+2*p),Ee=Math.ceil(_e+ve+2*p),tt=J(j,S+X/2,p+j.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g class="pele-cynefin-regions">${Se}</g>`+Xe+et+me+(ue?`<g class="pele-edges">${ue}</g>`:"");return{svg:kt("cynefin",Te,Ee,o,a,t,tt),width:Te,height:Ee,links:[]}}var Qt={type:"cynefin",parse:(t,e,a)=>Ct(At(t),a),render:Ot};export{Qt as cynefin};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
var et=Object.defineProperty;var tt=(t,s,l)=>s in t?et(t,s,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[s]=l;var K=(t,s,l)=>tt(t,typeof s!="symbol"?s+"":s,l);import{c as rt}from"./G3MDBVQH-EkdejvdW.js";import{x as lt,h as st}from"./ELSXBIJH-DG0MW5dC.js";import{b as Be,d as xe,m as at,p as it}from"./FKCDD66M-BPFkyrwI.js";import{M as ot,L as nt,O as ht}from"./JZWSX6AR-OwVPptYv.js";import{H as ct,$ as dt,e as ee,L as ze,i as fe,t as Ce}from"./lazy-CKqR1774.js";import{m as ft,c as ut}from"./DKTLEL5E-B7ILCVTH.js";import{F as pt,S as $t}from"./HWDLEDTA-C_JcdBMO.js";import{_ as le,g as gt,h as yt,a as Se,y as we,x as $,f as Oe,b as Ee,$ as bt,Y as mt,T as _t,q as wt}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";function Et(t){return t==="markdown"||t==="string"||t==="text"?t:"markdown"}var Tt=class{constructor(){K(this,"type","er");K(this,"direction","TB");K(this,"entities",new Map);K(this,"relationships",[]);K(this,"classes",new Map);K(this,"subgraphs",[]);K(this,"title");K(this,"accTitle");K(this,"accDescr");K(this,"subgraphLookup",new Map);K(this,"claimed",new Set)}addEntity(t,s=""){let l=this.entities.get(t);return l===void 0?(l={id:`entity-${t}-${this.entities.size}`,label:t,alias:s,attributes:[],cssClasses:"default",cssStyles:[]},this.entities.set(t,l)):!l.alias&&s&&(l.alias=s),l}addAttributes(t,s){let l=this.addEntity(t);for(let i=s.length-1;i>=0;i--){let c=s[i];c.keys??(c.keys=[]),c.comment??(c.comment=""),l.attributes.push(c)}}addRelationship(t,s,l,i){let c=this.subgraphLookup.has(t)?t:this.addEntity(t).id,r=this.subgraphLookup.has(l)?l:this.addEntity(l).id;this.relationships.push({entityA:c,roleA:s,entityB:r,relSpec:i})}setDirection(t){this.direction=t}addCssStyles(t,s){if(s)for(let l of t){let i=this.entities.get(l);if(i)for(let r of s)i.cssStyles.push(r);let c=this.subgraphLookup.get(l);if(c)for(let r of s)c.cssStyles.push(r)}}addClass(t,s){for(let l of t){let i=this.classes.get(l);if(i===void 0&&(i={id:l,styles:[],textStyles:[]},this.classes.set(l,i)),!!s)for(let c of s)c.includes("color")&&i.textStyles.push(c.replace("fill","bgFill")),i.styles.push(c)}}setClass(t,s){for(let l of t){let i=this.entities.get(l);if(i)for(let r of s)i.cssClasses+=" "+r;let c=this.subgraphLookup.get(l);if(c)for(let r of s)c.classes.push(r)}}addSubGraph(t,s,l){let i=t.text.trim(),c=new Set,r=[],e;for(let u of s.flat()){if(typeof u!="string"){(u==null?void 0:u.stmt)==="dir"&&(e=u.value);continue}let d=u.trim();d===""||c.has(d)||(c.add(d),this.claimed.has(u)||r.push(u))}for(let u of r)this.claimed.add(u);let g={id:i,nodes:r,title:(l.text||"").trim(),classes:[],cssStyles:[],dir:e,labelType:Et(l.type)};return this.subgraphs.push(g),this.subgraphLookup.set(i,g),i}setAccTitle(t){this.accTitle=t.replace(/^\s+/g,"")}setAccDescription(t){this.accDescr=t.replace(/\n\s+/g,`
|
|
2
|
-
`)}},Fe=["$end","INVALID","ER_DIAGRAM","EOF","NEWLINE","COLON","STYLE_SEPARATOR","BLOCK_START","BLOCK_STOP","SQS","SQE","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","END","SUBGRAPH","direction_tb","direction_bt","direction_rl","direction_lr","CLASSDEF","UNICODE_TEXT","STYLE_TEXT","COMMA","CLASS","STYLE","SEMI","NUM","BRKT","ENTITY_NAME","DECIMAL_NUM","ENTITY_ONE","ATTRIBUTE_WORD","ATTRIBUTE_KEY","COMMENT","ZERO_OR_ONE","ZERO_OR_MORE","ONE_OR_MORE","ONLY_ONE","MD_PARENT","NON_IDENTIFYING","IDENTIFYING","WORD","CHAR"],ge=1,Te=2,Ge=4,ye=8,j=new Uint8Array(128);for(let t=0;t<128;t++){let s=t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122||t===95,l=s&&(t<48||t>57);s&&(j[t]|=ge|Te|ye),l&&(j[t]|=Ge)}for(let t of"-*")j[t.charCodeAt(0)]|=ge|Te|ye;j[46]|=ge|ye;j[42]|=Ge;for(let t of"[](),")j[t.charCodeAt(0)]|=ye;var Mt=/accTitle\s*:\s*/iy,At=/accDescr\s*:\s*/iy,xt=/accDescr\s*\{\s*/iy,Ct=[/.*direction\s+TB[^\n]*/iy,/.*direction\s+BT[^\n]*/iy,/.*direction\s+RL[^\n]*/iy,/.*direction\s+LR[^\n]*/iy],Ne=/direction/gi,Ie=/[\n\r\u2028\u2029]/g;function Ue(t,s){return t<128?(j[t]&s)!==0:t>=192||t===181}function St(t){let s=t.length,l=[],i=[],c=[],r=0,e=0,g=-2,u=0,d=-1,m=-2,_=-1,A=-1,M=-1,h=(o,a,y)=>{l.push(o),i.push(t.slice(a,y)),c.push(a),e=y},P=(o,a)=>(o.lastIndex=a,o.test(t)?o.lastIndex:-1),X=o=>{for(let a=0;a<o.length;a++){let y=o.charCodeAt(a),Y=t.charCodeAt(e+a);if(Y!==y&&(y<97||y>122||(Y|32)!==y))return!1}return!0},L=o=>X(o)&&!fe(t.charCodeAt(e+o.length)),se=o=>{let a=t.charCodeAt(o);return a>=65&&a<=90?a+32:a},ae=o=>(Ie.lastIndex=o,Ie.test(t)?Ie.lastIndex-1:s),F=o=>{for(;Ce(t.charCodeAt(o));)o++;return o},k=()=>{if(g===-1||g<e&&(Ne.lastIndex=e,g=Ne.test(t)?Ne.lastIndex-9:-1,g===-1)||e<u||(d<e&&(d=ae(e)),g>=d))return!1;for(let o=0;o<4;o++){let a=P(Ct[o],e);if(a>=0)return h(18+o,e,a),!0}return u=d,!1},D=()=>{let o=t.indexOf('"',e+1);if(o===-1){h(45,e,e+1);return}let a=o>e+1;for(let y=e+1;a&&y<o;y++){let Y=t.charCodeAt(y);(Y===37||Y===92||Y===13||Y===10||Y===11||Y===8)&&(a=!1)}h(a?31:44,e,o+1)},f=o=>{let a=t.charCodeAt(e+1);if(a===43&&(o===49||o===48)){h(o===49?39:38,e,e+2);return}let y=F(e+1);if(t.charCodeAt(y)===46&&Ce(t.charCodeAt(y+1))){h(32,e,F(y+2));return}if(o===49){if(ee(a)){let Y=e+2;for(;ee(t.charCodeAt(Y));)Y++;let ie=t.charCodeAt(Y);if(fe(ie)||ie===34||ie===39){h(40,e,e+1);return}}else if(a===45||a===46){let Y=t.charCodeAt(e+2);if(Y===45||Y===46){h(40,e,e+1);return}}if(!fe(a)){h(33,e,e+1);return}}h(29,e,y)},p=o=>{let a=t.charCodeAt(e+1);switch(o){case 101:if(L("erdiagram"))h(2,e,e+9);else if(L("end")){let y=e+3;for(;ee(t.charCodeAt(y));)y++;h(16,e,y)}else return!1;return!0;case 115:if(L("style"))r=6,h(27,e,e+5);else if(L("subgraph"))h(17,e,e+8);else return!1;return!0;case 99:if(L("classdef"))r=6,h(22,e,e+8);else if(L("class"))h(26,e,e+5);else return!1;return!0;case 111:if(L("one or zero"))h(37,e,e+11);else if(L("one or more")||L("one or many"))h(39,e,e+11);else if(L("one"))h(40,e,e+3);else if(L("only one"))h(40,e,e+8);else if(a===124)h(37,e,e+2);else if(a===123)h(38,e,e+2);else if(L("optionally to"))h(42,e,e+13);else return!1;return!0;case 122:if(L("zero or one"))h(37,e,e+11);else if(L("zero or more")||L("zero or many"))h(38,e,e+12);else return!1;return!0;case 109:if(X("many(0)"))h(38,e,e+7);else if(X("many(1)"))h(39,e,e+7);else if(L("many"))h(38,e,e+4);else return!1;return!0;case 116:return L("to")?(h(43,e,e+2),!0):!1;case 117:return a!==46&&a!==45&&a!==124?!1:(h(41,e,e+1),!0);case 124:if(se(e+1)===111&&!fe(t.charCodeAt(e+2)))h(37,e,e+2);else if(a===124)h(40,e,e+2);else if(a===123)h(39,e,e+2);else return!1;return!0;case 125:if(se(e+1)===111&&!fe(t.charCodeAt(e+2)))h(38,e,e+2);else if(a===124)h(39,e,e+2);else return!1;return!0;case 46:return a!==46&&a!==45?!1:(h(42,e,e+2),!0);case 45:if(a===45)h(43,e,e+2);else if(a===46)h(42,e,e+2);else return!1;return!0}return!1},O=o=>{let a;if((o===97||o===65)&&X("acc")){if((a=P(Mt,e))>=0){r=3,h(11,e,a);return}if((a=P(At,e))>=0){r=4,h(13,e,a);return}if((a=P(xt,e))>=0){r=5,e=a;return}}if(!k()){switch(o){case 32:case 9:case 13:a=e+1;for(let y=t.charCodeAt(a);y===32||y===9||y===13;y=t.charCodeAt(a))a++;e=a;return;case 10:for(a=e+1;t.charCodeAt(a)===10;)a++;h(4,e,a);return;case 34:D();return;case 123:r=1,h(7,e,e+1);return;case 35:h(30,e,e+1);return;case 44:h(25,e,e+1);return;case 58:t.charCodeAt(e+1)===58&&t.charCodeAt(e+2)===58?h(6,e,e+3):h(5,e,e+1);return;case 91:h(9,e,e+1);return;case 93:h(10,e,e+1);return}if(Ce(o)){f(o);return}if(!p(o>=65&&o<=90?o+32:o)){if(o>=128||(j[o]&ge)!==0){a=e+1;for(let y=t.charCodeAt(a);y>=128||(j[y]&ge)!==0;y=t.charCodeAt(a))a++;h(23,e,a);return}h(45,e,e+1)}}},G=()=>{if(m===-1||m<e&&(m=t.indexOf("~",e),m===-1))return!1;if(M<e){let a=e;for(;a<s&&!ee(t.charCodeAt(a));)a++;M=a}if(m>=M||(_<e&&(_=ae(e),A=t.lastIndexOf("~",_-1)),A<=m))return!1;let o=A+1;for(;o<s&&!ee(t.charCodeAt(o));)o++;return h(34,e,o),!0},re=o=>{if(ee(o)){for(e++;ee(t.charCodeAt(e));)e++;return}let a=o|32;if((a===112||a===102||a===117)&&(t.charCodeAt(e+1)|32)===107&&!fe(t.charCodeAt(e+2))){h(35,e,e+2);return}if(!G()){if(Ue(o,Ge)){let y=e+1;for(;y<s&&Ue(t.charCodeAt(y),ye);)y++;h(34,e,y);return}if(o===96){r=2,e++;return}if(o===34){let y=t.indexOf('"',e+1);if(y!==-1){h(36,e,y+1);return}}else if(o===125){r=0,h(8,e,e+1);return}h(45,e,e+1)}};for(;e<s;){let o=t.charCodeAt(e),a;switch(r){case 0:O(o);break;case 1:re(o);break;case 2:o===96?(r=1,e++):(a=t.indexOf("`",e),h(34,e,a===-1?s:a));break;case 3:case 4:a=t.indexOf(`
|
|
3
|
-
`,e),h(r===3?12:14,e,a===-1?s:a),r=0;break;case 5:o===125?(r=0,e++):(a=t.indexOf("}",e),h(15,e,a===-1?s:a));break;case 6:if(o===10){for(a=e+1;t.charCodeAt(a)===10;)a++;r=0,h(4,e,a)}else if(ee(o))for(e++;ee(t.charCodeAt(e));)e++;else if(o===58)h(5,e,e+1);else if(o===44)h(25,e,e+1);else if(o===35)h(30,e,e+1);else if(o===59)h(28,e,e+1);else if(o>=128||(j[o]&Te)!==0){a=e+1;for(let y=t.charCodeAt(a);y>=128||(j[y]&Te)!==0;y=t.charCodeAt(a))a++;h(24,e,a)}else return l.push(1),i.push(""),c.push(e),{types:l,texts:i,starts:c};break}}let U=r===0?3:r===3?12:r===4?14:r===5?15:-1;return U!==-1&&(l.push(U),i.push(""),c.push(s)),l.push(0),i.push(""),c.push(s),{types:l,texts:i,starts:c}}var Re=new Map([[37,"ZERO_OR_ONE"],[38,"ZERO_OR_MORE"],[39,"ONE_OR_MORE"],[40,"ONLY_ONE"],[41,"MD_PARENT"]]),Ot=["TB","BT","RL","LR"],Je="'UNICODE_TEXT', 'NUM', 'ENTITY_NAME', 'DECIMAL_NUM', 'ENTITY_ONE'",Nt="'ZERO_OR_ONE', 'ZERO_OR_MORE', 'ONE_OR_MORE', 'ONLY_ONE', 'MD_PARENT'",me="'EOF', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'SUBGRAPH', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'CLASSDEF', 'CLASS', 'STYLE', "+Je;function It(t,s){let{types:l,texts:i,starts:c}=St(t),r=0,e=f=>{let p=l[r];throw p===1?ze("er",t,c[r],"",!0):ze("er",t,c[r],`Expecting ${f}, got '${p===45?i[r]:Fe[p]}'`)},g=f=>(l[r]!==f&&e(`'${Fe[f]}'`),i[r++]),u=()=>{let f=l[r];f!==4&&f!==28&&f!==3&&e("'EOF', 'NEWLINE', 'SEMI'"),r++},d=f=>f===23||f===31||f===29||f===32||f===33,m=()=>{let f=l[r];d(f)||e(Je);let p=i[r++];return f===31?p.slice(1,-1):p},_=()=>{let f=[];for(;;){let p=l[r];if(p!==23&&p!==24&&e("'UNICODE_TEXT', 'STYLE_TEXT'"),f.push(i[r++]),l[r]!==25)return f;r++}},A=f=>f===24||f===29||f===5||f===30,M=()=>{let f=[];for(;;){A(l[r])||e("'STYLE_TEXT', 'COLON', 'NUM', 'BRKT'");let p=i[r++];for(;A(l[r]);)p+=i[r++];if(f.push(p),l[r]!==25)return f;r++}},h=()=>{let f=Re.get(l[r++]),p=l[r];p!==43&&p!==42&&e("'NON_IDENTIFYING', 'IDENTIFYING'");let O=p===43?"IDENTIFYING":"NON_IDENTIFYING";r++;let G=Re.get(l[r]);return G===void 0?e(Nt):(r++,{cardA:G,relType:O,cardB:f})},P=()=>{let f=l[r];f!==44&&f!==31&&f!==23&&e("'UNICODE_TEXT', 'ENTITY_NAME', 'WORD'");let p=i[r++];return f===23?p:p.slice(1,-1)},X=f=>l[r]===45&&i[r]===f,L=()=>{let f=[];do{let p=g(34);X("?")&&(p+=i[r++]),l[r]!==34&&e(p.endsWith("?")?"'ATTRIBUTE_WORD'":"'ATTRIBUTE_WORD', '?'");let O={type:p,name:i[r++]};if(l[r]===35){let G=[i[r++]];for(;X(",");)r++,G.push(g(35));O.keys=G}l[r]===36&&(O.comment=i[r++].slice(1,-1)),f.push(O)}while(l[r]!==8);return f.reverse()},se=()=>{if(l[r]!==7)return;if(r++,l[r]===8){r++;return}let f=L();return r++,f},ae=()=>{let f=m(),p=l[r];if(p===9){r++;let re=m();g(10);let U;l[r]===6&&(r++,U=_());let o=se();return s.addEntity(f,re),o&&s.addAttributes(f,o),U&&s.setClass([f],U),[f]}let O;if(p===6&&(r++,O=_(),p=l[r]),Re.has(p)){let re=h(),U=m(),o;l[r]===6&&(r++,o=_()),g(5);let a=P();return s.addEntity(f),s.addEntity(U),s.addRelationship(f,a,U,re),O&&s.setClass([f],O),o&&s.setClass([U],o),[f,U]}let G=se();return s.addEntity(f),G&&s.addAttributes(f,G),O&&s.setClass([f],O),[f]};g(2);let F=[{id:"",title:"",list:[]}],k=F[0],D=!1;for(;;){let f=l[r];switch(f){case 4:r++;break;case 3:r++,D&&e(`'END', ${me}`);return;case 16:{D||e(me),r++;let p=s.addSubGraph({text:k.id},k.list,{text:k.title});F.pop(),k=F[F.length-1],D=F.length>1,D&&k.list.push(p);break}case 17:{r++;let p=m(),O=p;if(l[r]===9){for(r++,O=m();d(l[r]);)O+=" "+m();g(10)}u(),k={id:p,title:O,list:[]},F.push(k),D=!0;break}case 11:{r++;let p=g(12).trim();s.setAccTitle(p),D&&k.list.push(p);break}case 13:{r++;let p=g(14).trim();s.setAccDescription(p),D&&k.list.push(p);break}case 15:{let p=i[r++].trim();s.setAccDescription(p),D&&k.list.push(p);break}case 18:case 19:case 20:case 21:{r++;let p=Ot[f-18];D?k.list.push({stmt:"dir",value:p}):s.setDirection(p);break}case 22:{let p=i[r++],O=_(),G=M();u(),s.addClass(O,G),D&&k.list.push(p);break}case 26:{let p=i[r++],O=_();s.setClass(O,_()),D&&k.list.push(p);break}case 27:{let p=i[r++],O=_(),G=M();u(),s.addCssStyles(O,G),D&&k.list.push(p);break}default:{d(f)||e(D?`'END', ${me}`:me);let p=ae();if(D)for(let O of p)k.list.push(O)}}}}var Rt=[];function kt(t){let s=[],l=[],i=t.subgraphs,c=u=>{let d=[];for(let m of u){let _=t.classes.get(m);if(_!==void 0){for(let A of _.styles)d.push(A.trim());for(let A of _.textStyles)d.push(A.trim())}}return d},r=new Map,e=new Set;for(let u=i.length-1;u>=0;u--){let d=i[u];e.add(d.id);for(let m of d.nodes)r.set(m,d.id)}for(let u=i.length-1;u>=0;u--){let d=i[u];s.push({id:d.id,label:d.title,alias:"",attributes:Rt,isGroup:!0,parentId:r.get(d.id),cssStyles:d.cssStyles,cssCompiledStyles:c(d.classes),cssClasses:d.classes.join(" "),dir:d.dir,labelType:d.labelType})}let g=new Map;for(let[u,d]of t.entities){if(e.has(u)){g.set(d.id,u);continue}s.push({id:d.id,label:d.label,alias:d.alias,attributes:d.attributes,isGroup:!1,parentId:r.get(u),cssStyles:d.cssStyles,cssCompiledStyles:c(d.cssClasses.split(" ")),cssClasses:d.cssClasses,dir:void 0,labelType:"markdown"})}return t.relationships.forEach((u,d)=>{l.push({id:`id_${u.entityA}_${u.entityB}_${d}`,start:g.get(u.entityA)??u.entityA,end:g.get(u.entityB)??u.entityB,label:u.roleA,arrowTypeStart:u.relSpec.cardB.toLowerCase(),arrowTypeEnd:u.relSpec.cardA.toLowerCase(),pattern:u.relSpec.relType==="IDENTIFYING"?"solid":"dashed"})}),{nodes:s,edges:l}}var te=18,He=5,We=6,ke=10,Xe=3.5;function ue(t,s,l,i,c){let r=(m,_)=>$(s-i*m-c*_)+","+$(l-c*m+i*_),e=m=>`M${r(m,-He)}L${r(m,He)}`,g=`M${r(0,-We)}L${r(ke,0)}L${r(0,We)}`,u=m=>`<circle class="pele-marker" cx="${$(s-i*m)}" cy="${$(l-c*m)}" r="${Xe}" fill="var(--_bg)"/>`,d=m=>`<path class="pele-marker" d="${m}"/>`;switch(t){case"only_one":return d(e(6)+e(10));case"zero_or_one":return d(e(6))+u(13.5);case"one_or_more":return d(g+e(ke+3.5));case"zero_or_more":return d(g)+u(ke+Xe+.5);case"md_parent":return`<path class="pele-marker" d="M${r(0,0)}L${r(6,4)}L${r(12,0)}L${r(6,-4)}Z" fill="var(--_bg)"/>`}return""}var vt=48,Lt=20,Dt=64,pe=20,$e=28,Yt=38,Pe=96,Ze=18,Gt=12,Bt=9,ve=12,Ke=16,Le=9,zt=260,De=1e6,Ft=[],Ut=18,Ht=14,Ve=' fill="var(--_s)" stroke="var(--_b)"';function je(t,s,l){var c;let i=(c=t.er)==null?void 0:c[s];return typeof i=="number"&&i>0?Math.min(i,2e3):l}function _e(t,s,l,i,c){let r=t.lines;if(r.length===0)return"";if(r.length===1&&r[0].length===1&&r[0][0].icon===void 0&&r[0][0].style===0)return`<text${i} x="${$(s)}" y="${$(l)}">${Ee(r[0][0].text)}</text>`;let e=mt(t),g="",u="";for(let d of r){let m=!1;for(let M of d)M.icon!==void 0&&(m=!0);let _=s,A=!1;for(let M of d){if(M.icon!==void 0){let h=t.size*1.1;u+=`<svg class="pele-icon" data-icon="${we(M.icon)}" x="${$(_)}" y="${$(l-t.size*.35-h/2)}" width="${$(h)}" height="${$(h)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${(c==null?void 0:c(M.icon))??""}</svg>`}else if(M.text!==""){let h=m||!A?` x="${$(_)}" y="${$(l)}"`:"";g+=`<tspan${h}${_t(M.style&~e)}>${Ee(M.text)}</tspan>`,A=!0}_+=M.width}l+=t.lineHeight}return`<text${wt(i,e)} xml:space="preserve">${g}</text>${u}`}function Ye(t){let s=rt(t);return s===t?t:s.replace(/</g,"<").replace(/>/g,">")}function Wt(t,s,l){return ft(t.direction)?ut(l,i=>Qe(t,s,l,i)):Qe(t,s,l,!1)}function Qe(t,s,l,i){let c=kt(t),r=l.fontSize??16,e=Math.round(r*.875),g=l.measurer??ct(l.fontFamily),u=l.padding??8,d=l.icons,m=new Map,_=[],A=[];c.nodes.forEach((w,n)=>m.set(w.id,n));let M=[],h=[],P=[],X=new Map,L=[];for(let w of c.edges){let n=m.get(w.start),b=m.get(w.end);if(n===void 0||b===void 0)continue;let T=le(w.label,!0,g,e,200),N;if(n===b){N={label:T,band:0,at:0};let I=X.get(n);I?I.push(N):X.set(n,[N])}L.push(N),P.push(w),h.push(T),M.push({src:n,dst:b,minlen:1,labelW:T.width>0?T.width+12:0,labelH:T.height>0?T.height+4:0,route:[],labelX:0,labelY:0})}let se=w=>{let n=w;for(let b=0;b<c.nodes.length;b++){let T=c.nodes[n].parentId,N=T===void 0?void 0:m.get(T);if(N===void 0)break;let I=c.nodes[N].dir;if(I)return I==="LR"||I==="RL";n=N}return t.direction==="LR"||t.direction==="RL"};for(let w=0;w<c.nodes.length;w++){let n=c.nodes[w],b=gt(n.cssStyles.length>0?n.cssCompiledStyles.concat(n.cssStyles):n.cssCompiledStyles),T=(b.bold?1:0)|(b.italic?2:0),N=b.fontSize??r,I=b.fontSize??e,z=b.fontSize??Math.round(r*.75),B=n.isGroup?le(n.label,!0,g,N,4e3,T):le(n.alias||n.label,!0,g,N,240,T),V=X.get(w)??Ft,x=V.length>0&&!n.isGroup&&se(w),S={node:n,style:b,label:B,w:0,h:0,headH:0,rows:[],cols:[],rowSize:I,keySize:z,below:x},R=0,H=0;for(let v of V)v.band=Math.max(Yt,x?v.label.width+12:v.label.height+6),H+=v.band,R=Math.max(R,x?v.label.height:v.label.width);let E=Math.max(Pe,x?H+8:0),C;if(n.isGroup)C=xe(0,0),C.isGroup=!0,C.dir=n.dir?Be(n.dir):void 0,C.padX=pe,C.padTop=S.label.height>0?S.label.height+16:pe,C.padBottom=pe,C.minW=Math.max(S.label.width+2*pe-12,Pe);else{let v=Math.max(B.height,Math.round(N*1.5));if(n.attributes.length===0)S.w=Math.max(B.width+2*Ze,E),S.h=Math.max(v+2*Gt,x?0:H+8);else{let be=Math.round(I*1.5),Q=[0,0,0,0];for(let Z of n.attributes){let he=[le(Ye(Z.type),!0,g,I,De,T),le(Ye(Z.name),!0,g,I,De,T),le(Z.keys.join(", "),!1,g,z,De,T),le(Ye(Z.comment),!0,g,I,zt,T)],de=be;for(let q=0;q<4;q++)he[q].width>Q[q]&&(Q[q]=he[q].width),he[q].height>de&&(de=he[q].height);S.rows.push({cells:he,h:de+Le}),S.h+=de+Le}let ce=0,J=0;for(let Z of Q)Z!==0&&(J+=Z+(ce>0?Ke:0),ce++);S.w=Math.max(J+2*ve,B.width+2*Ze,E);let oe=ce>0?(S.w-J-2*ve)/ce:0,ne=ve;for(let Z of Q)S.cols.push(ne),Z>0&&(ne+=Z+oe+Ke);S.headH=v+2*Bt,S.h+=S.headH}let W=V.length>0?2*(te+$e*.75+10+R):0;C=x?xe(S.w,S.h+W):xe(S.w+W,S.h)}C.seq=_.length,_.push(S),A.push(C)}c.nodes.forEach((w,n)=>{A[n].parent=w.parentId!==void 0?m.get(w.parentId)??-1:-1});let ae=at(A,M,i?"TB":Be(t.direction),{nodeSep:je(s,"nodeSpacing",vt),edgeSep:Lt,rankSep:je(s,"rankSpacing",Dt),portSep:24});Pt(M,A,_);let F=ae.width;for(let[w,n]of X){let b=A[w];if(!b.isGroup)continue;let T=0;for(let N of n)T=Math.max(T,N.label.width);F=Math.max(F,b.x+b.w/2+te+$e*.75+10+T)}let k=le(t.title,!1,g,r,4e3,1),D=k.height>0?k.height+12:0,f=Math.max(F,k.width),p=u+(f-F)/2,O=u+D;it(A,M,p,O);let G=Math.ceil(f+2*u),re=Math.ceil(ae.height+D+2*u),U=[],o=new Map,a=!1;for(let w of A)w.isGroup&&(a=!0);if(a)for(let w of M)lt(o,w.route);let y="",Y="";for(let w=0;w<_.length;w++){let n=_[w],b=A[w],T=n.node,N=yt(T.cssClasses.replace(/^default\s?/,""));if(b.isGroup){n.w=b.w,n.h=b.h;let C=b.x-b.w/2,v=b.y-b.h/2,W=st(b,n.label.width,o,pe);y+=`<g class="pele-cluster${N}" data-id="${we(T.id)}"><rect x="${$(C)}" y="${$(v)}" width="${$(b.w)}" height="${$(b.h)}" rx="${Se}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${n.style.shape}/>`+Oe(n.label,W,v+8+n.label.height/2,` class="pele-cluster-label" fill="var(--_m)"${n.style.text}`,d)+"</g>";continue}let I=n.w,z=n.h,B=-I/2,V=-z/2,x=n.style.text,S=`x="${$(B)}" y="${$(V)}" width="${$(I)}" height="${$(z)}" rx="${Se}"`,R=Oe(n.label,0,n.rows.length>0?V+n.headH/2:0,` class="pele-label"${x}`,d),H=dt(T.alias||T.label);if(/ internal-link(?: |$)/.test(N+" ")&&R!==""&&l.links!==!1){let C=ot(nt(H),l)!==void 0,v=Ee(H);R=`<a class="internal-link"${C?` href="${v}"${ht(l)}`:""} data-href="${v}">${R}</a>`,U.push({id:T.label,href:H,internal:!0})}let E;if(n.rows.length===0)E=`<rect ${S}${Ve}${n.style.shape}/>`+R;else{let C=Math.round(n.rowSize*1.5),v=n.style.stroke?Ee(n.style.stroke):"var(--_b)",W="",be="",Q=V+n.headH;for(let J=0;J<n.rows.length;J++){let oe=n.rows[J];if(J%2===0){let Ae=`x="${$(B)}" width="${$(I)}"`;J===n.rows.length-1?W+=`<rect ${Ae} y="${$(Q)}" height="${$(oe.h)}" rx="${Se}"/><rect ${Ae} y="${$(Q)}" height="${$(oe.h/2)}"/>`:W+=`<rect ${Ae} y="${$(Q)}" height="${$(oe.h)}"/>`}let ne=Q+Le/2+C/2+n.rowSize*.35,[Z,he,de,q]=oe.cells;be+=_e(Z,B+n.cols[0],ne,` class="pele-er-type" fill="var(--_m)"${x}`,d)+_e(he,B+n.cols[1],ne,` class="pele-er-name"${x}`,d)+_e(de,B+n.cols[2],ne,` class="pele-er-keys" font-size="${n.keySize}" fill="var(--_m)"${x}`,d)+_e(q,B+n.cols[3],ne,` class="pele-er-comment" fill="var(--_m)"${x}`,d),Q+=oe.h}let ce=$(V+n.headH);E=`<rect ${S}${Ve}${n.style.shape}/><g class="pele-er-stripes" fill="var(--_bg)"${n.style.shape.includes("fill:")?' opacity="0.6"':""}>${W}</g><path class="pele-er-divider" d="M${$(B)},${ce}H${$(B+I)}" stroke="${v}"/><rect ${S} fill="none" stroke="var(--_b)"${n.style.line}/>`+R+`<g class="pele-er-attributes" font-size="${n.rowSize}">${be}</g>`}Y+=`<g class="pele-node pele-entity${N}" data-id="${we(T.label)}" transform="translate(${$(b.x)},${$(b.y)})">${E}</g>`}for(let[w,n]of X){let b=_[w],T=0;for(let z of n)T+=z.band;let N=Math.min(1,Math.max((b.below?b.w:b.h)-8,0)/T),I=-T*N/2;for(let z of n)z.band*=N,z.at=I+z.band/2,I+=z.band}let ie="",Me="";for(let w=0;w<M.length;w++){let n=M[w],b=P[w],T=h[w],N,I,z,B=L[w];if(B){let x=A[n.src],S=_[n.src],R=Math.max(Math.min(B.band/2-6,13),1),H=te+$e*.75+6;if(S.below){let E=x.x+B.at,C=x.y+S.h/2,v=$(C+te),W=$(C+te+$e);N=`M${$(E-R)},${$(C)}V${v}C${$(E-R)},${W} ${$(E+R)},${W} ${$(E+R)},${v}V${$(C)}`,I=ue(b.arrowTypeStart,E-R,C,0,-1),z=ue(b.arrowTypeEnd,E+R,C,0,-1),n.labelX=E,n.labelY=C+H+T.height/2}else{let E=x.x+S.w/2,C=x.y+B.at,v=$(E+te),W=$(E+te+$e);N=`M${$(E)},${$(C-R)}H${v}C${W},${$(C-R)} ${W},${$(C+R)} ${v},${$(C+R)}H${$(E)}`,I=ue(b.arrowTypeStart,E,C-R,-1,0),z=ue(b.arrowTypeEnd,E,C+R,-1,0),n.labelX=E+H+T.width/2,n.labelY=C}}else{let x=Xt(n.route);if(x.length<6)continue;qe(x,0,_[n.src],A[n.src]),qe(x,x.length-3,_[n.dst],A[n.dst]);let S=Math.abs(x[x.length-3]-x[0]),R=Math.abs(x[x.length-2]-x[1]),H=x.length===6&&(S<.01||R<.01||Math.hypot(S,R)<=3*te)?0:te,E=pt(x,void 0,H,H);N=H>0?`M${$(E.sx)},${$(E.sy)}L${E.d.slice(1)}L${$(E.ex)},${$(E.ey)}`:E.d,I=ue(b.arrowTypeStart,E.sx,E.sy,E.sdx,E.sdy),z=ue(b.arrowTypeEnd,E.ex,E.ey,E.edx,E.edy)}let V=b.pattern==="dashed";if(ie+=`<g class="pele-edge pele-er-${V?"non-identifying":"identifying"}" data-id="${we(b.id)}"><path d="${N}"${V?' stroke-dasharray="4 3"':""}/>`+I+z+"</g>",T.width>0){let x=n.labelX,S=n.labelY;Me+=$t(b.id,T,x,S,"",d)}}return{svg:bt("er",G,re,r,l,t,Oe(k,G/2,u+k.height/2,' class="pele-title" font-weight="var(--_tw)"')+(y?`<g class="pele-clusters">${y}</g>`:"")+(ie?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${ie}</g>`:"")+(Me?`<g class="pele-edge-labels" font-size="${e}">${Me}</g>`:"")+`<g class="pele-nodes">${Y}</g>`),width:G,height:re,links:U}}function Xt(t){let s=t.slice(0,3);for(let l=3;l<t.length;l+=3){let i=s.length-3,c=r=>Math.abs(s[i+r]-t[l+r])<.01&&Math.abs(t[l+r]-t[l+3+r])<.01;l+3<t.length&&(c(0)||c(1))||s.push(t[l],t[l+1],t[l+2])}return s}function Pt(t,s,l){let i=new Map,c=(r,e,g,u)=>{let d=s[r],m=e[g]-d.x,_=e[g+1]-d.y,A;if(Math.abs(Math.abs(_)-d.h/2)<.5)A=_<0?0:2;else if(Math.abs(Math.abs(m)-d.w/2)<.5)A=m<0?3:1;else return;let M=r*4+A,h={route:e,at:g,toward:e[u+(A&1?1:0)]},P=i.get(M);P?P.push(h):i.set(M,[h])};for(let r of t){let e=r.route.length-3;r.src===r.dst||e<3||(c(r.src,r.route,0,3),c(r.dst,r.route,e,e-3))}for(let[r,e]of i){if(e.length<2)continue;let g=r>>2,u=(r&1)===1,d=s[g].isGroup?s[g]:l[g],m=u?d.h:d.w,_=Math.max(Math.min(Ut,(m-2*Ht)/(e.length-1)),0),A=u?s[g].y:s[g].x;e.sort((M,h)=>M.toward-h.toward);for(let M=0;M<e.length;M++)e[M].route[e[M].at+(u?1:0)]=A+(M-(e.length-1)/2)*_}}function qe(t,s,l,i){if(i.isGroup)return;let c=t[s]-i.x,r=t[s+1]-i.y;i.w!==l.w&&Math.abs(Math.abs(c)-i.w/2)<.5&&(t[s]-=Math.sign(c)*(i.w-l.w)/2),i.h!==l.h&&Math.abs(Math.abs(r)-i.h/2)<.5&&(t[s+1]-=Math.sign(r)*(i.h-l.h)/2)}var lr={type:"er",parse(t,s,l){let i=new Tt;return l&&(i.title=l),It(t,i),i},render:Wt};export{lr as er};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function f(e,i,r,d){let t=d(i,!1),n=e.maxWidth;if(n===void 0||!(n>0)||t.width<=n)return t;let u=Math.min(r,i),a=i;t=d(a,!0);for(let h=0;h<3&&t.width>n&&a>u;h++)a=Math.max(u,a-(t.width-n)),t=d(a,!0);return t}function l(e){let i=e.maxWidth;return i!==void 0&&i>0?Math.max(80,i-2*(e.padding??8)):4e3}function m(e,i,r,d=0){let t=e.maxWidth;return t===void 0||!(t>0)?i:Math.max(Math.min(r,i),Math.min(i,t-d))}var o=640;function c(e,i){let r=i(!1),d=e.maxWidth;if(e.autoDirection===!1||d===void 0||!(d>0)||r.width<=d)return r;let t=e.directionBreakpoint;if(d>=(t!==void 0&&t>0?t:o))return r;let n=i(!0);return n.width<r.width?n:r}function w(e){return e==="LR"||e==="RL"}function x(e,i){let r=i(!1),d=e.maxWidth;if(d===void 0||!(d>0)||r.width<=d)return r;let t=i(!0);return t.width<r.width?t:r}export{c,f,l as h,m as l,w as m,x as p};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var he=Object.defineProperty;var fe=(t,l,n)=>l in t?he(t,l,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[l]=n;var D=(t,l,n)=>fe(t,typeof l!="symbol"?l+"":l,n);import{L as ge,i as ue,H as ce,x as de}from"./lazy-CKqR1774.js";import{f as ye,h as $e}from"./DKTLEL5E-B7ILCVTH.js";import{y as X,x as k,m as ee,b as G,_ as pe,$ as me,f as ke,g as xe}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";var Ee=class{constructor(){D(this,"type","sankey");D(this,"nodes",[]);D(this,"links",[]);D(this,"title");D(this,"accTitle");D(this,"accDescr");D(this,"lookup",new Map)}findOrCreateNode(t){let l=this.lookup.get(t);return l===void 0&&(l={id:t,index:this.nodes.length},this.lookup.set(t,l),this.nodes.push(l)),l}addLink(t,l,n){this.links.push({source:t,target:l,value:n})}},q=["$end","STUCK","SANKEY","NEWLINE","COMMA","DQUOTE","NON_ESCAPED_TEXT","ESCAPED_TEXT","EOF"];function te(t){return t>=32&&t<=126&&t!==34&&t!==44}function ve(t){let l=t.length,n=[],a=[],g=[],h=[],y=0,s=0,m=(u,E,$)=>{n.push(u),a.push(t.slice(E,$)),g.push(E),s=$},x=u=>t.slice(s,s+u.length).toLowerCase()===u&&!ue(t.charCodeAt(s+u.length));for(;s<l;){let u=t.charCodeAt(s),E=s,$=s;if(y===2){if(u===34&&t.charCodeAt(s+1)!==34){h.length>0&&(y=h.pop()),m(5,s,s+1);continue}for(;$<l;){let f=t.charCodeAt($);if(te(f)||f===44||f===13||f===10)$++;else if(f===34&&t.charCodeAt($+1)===34)$+=2;else break}m(7,s,$)}else{if(y===0&&(u|32)===115){let f=x("sankey-beta")?11:x("sankey")?6:0;if(f>0){h.push(y),y=1,m(2,s,s+f);continue}}if(u===10||u===13&&t.charCodeAt(s+1)===10){m(3,s,u===10?s+1:s+2);continue}if(u===44){m(4,s,s+1);continue}if(u===34){h.push(y),y=2,m(5,s,s+1);continue}for(;$<l&&te(t.charCodeAt($));)$++;m(6,s,$)}if($===E)return m(1,s,s),{types:n,texts:a,starts:g}}return m(y===2?7:8,l,l),m(0,l,l),{types:n,texts:a,starts:g}}var Ae=/[\n\r]+/g;function le(t){return t===10||t===13?!1:t<128?t===32||t===9||t===11||t===12:t===160||t===5760||t>=8192&&t<=8202||t===8232||t===8233||t===8239||t===8287||t===12288||t===65279}function Me(t){let l=0,n=t.length;for(;l<n&&le(t.charCodeAt(l));)l++;for(;n>l&&le(t.charCodeAt(n-1));)n--;return t.slice(l,n).replace(Ae,`
|
|
2
|
-
`).trim()}function we(t,l){let{types:n,texts:a,starts:g}=ve(t),h=0,y=u=>{let E=n[h],$=E===1?q[n[h-1]]:q[E];throw ge("sankey",t,g[h],`Expecting ${u}, got '${$}'`)},s=(u,E="")=>{n[h]!==u&&y(`'${q[u]}'${E}`),h++},m=()=>{if(n[h]===6)return a[h++];n[h]!==5&&y("'DQUOTE', 'NON_ESCAPED_TEXT'"),h++,n[h]!==7&&y("'ESCAPED_TEXT'");let u=a[h++];return s(5),u},x=()=>m().trim().replaceAll('""','"');for(s(2),s(3);;){let u=x();s(4,", 'NEWLINE', 'EOF'");let E=x();s(4,", 'NEWLINE', 'EOF'");let $=m(),f=l.findOrCreateNode(u),F=l.findOrCreateNode(E);if(l.addLink(f,F,parseFloat($.trim())),n[h]!==3)break;h++}n[h]===8&&h++,n[h]!==0&&y("'NEWLINE', 'EOF'")}var Ce=6;function B(t,l){if(t.length>8){t.sort(l);return}for(let n=1;n<t.length;n++){let a=t[n],g=n-1;for(;g>=0&&l(t[g],a)>0;)t[g+1]=t[g],g--;t[g+1]=a}}function be(t,l){let n=t.nodes.length,a=t.links.map(e=>({source:e.source.index,target:e.target.index,value:Number.isFinite(e.value)&&e.value>0?e.value:0,thickness:0,sourceY:0,targetY:0})),g=[],h=[];for(let e=0;e<n;e++)g.push([]),h.push([]);a.forEach((e,r)=>{g[e.source].push(r),h[e.target].push(r)});let y=new Int32Array(n),s=new Int32Array(n),m=[];for(let e=0;e<n;e++)s[e]=h[e].length,s[e]===0&&m.push(e);for(let e=0;e<m.length;e++){let r=m[e];for(let i of g[r]){let c=a[i].target;y[c]<y[r]+1&&(y[c]=y[r]+1),--s[c]===0&&m.push(c)}}if(m.length<n){let e=0;for(;s[e]===0;)e++;let r=new Uint8Array(n);for(;r[e]===0;){r[e]=1;for(let i of h[e])if(s[a[i].source]>0){e=a[i].source;break}}throw new de(`Sankey diagrams cannot have circular links, and "${t.nodes[e].id}" is part of one.`,"semantic",{type:"sankey"})}let x=1;for(let e=0;e<n;e++)y[e]+1>x&&(x=y[e]+1);let u=new Int32Array(n);for(let e=n-1;e>=0;e--){let r=m[e];for(let i of g[r])u[r]<u[a[i].target]+1&&(u[r]=u[a[i].target]+1)}let E=0;for(let e of a)e.value>E&&(E=e.value);let $=E>0?1/E:0,f=[],F=new Float64Array(n),M=[];for(let e=0;e<x;e++)M.push([]);let I=x>1?(l.width-l.nodeWidth)/(x-1):0;for(let e=0;e<n;e++){let r;if(l.alignment==="left")r=y[e];else if(l.alignment==="right")r=x-1-u[e];else if(l.alignment==="center"){if(r=y[e],h[e].length===0&&g[e].length>0){r=x;for(let d of g[e])y[a[d].target]-1<r&&(r=y[a[d].target]-1)}}else r=g[e].length>0?y[e]:x-1;let i=0,c=0,o=0,p=0;for(let d of h[e])i+=a[d].value*$,o+=a[d].value;for(let d of g[e])c+=a[d].value*$,p+=a[d].value;F[e]=Math.max(i,c),f.push({layer:r,value:Math.max(o,p),x:r*I,y:0,height:0}),M[r].push(e)}let W=1;for(let e of M)e.length>W&&(W=e.length);let Y=W>1?Math.min(l.nodePadding,l.height/(W-1)):l.nodePadding,w=1/0;for(let e of M){let r=0;for(let i of e)r+=F[i];r>0&&(w=Math.min(w,(l.height-(e.length-1)*Y)/r))}(!Number.isFinite(w)||w<0)&&(w=0);let P=Math.max(0,l.labelHeight-Y),j=e=>{for(let r of M){let i=(r.length-1)*Y;for(let c of r)i+=Math.max(F[c]*e,P);if(i>l.height+1e-6)return!1}return!0};if(P>0&&!j(w))if(j(0)){let e=0;for(let r=0;r<40;r++){let i=(e+w)/2;j(i)?e=i:w=i}w=e}else P=0;let A=new Float64Array(n);for(let e of a)e.thickness=e.value*$*w;for(let e of M){let r=0;for(let c of e)f[c].height=F[c]*w,A[c]=Math.max(0,P-f[c].height)/2,f[c].y=r+A[c],r+=f[c].height+2*A[c]+Y;let i=(l.height-r+Y)/(e.length+1);e.forEach((c,o)=>f[c].y+=i*(o+1))}let b=e=>f[e].y+f[e].height/2,S=new Float64Array(a.length),_=new Float64Array(a.length),K=(e,r)=>b(a[e].target)-b(a[r].target)||e-r,V=(e,r)=>b(a[e].source)-b(a[r].source)||e-r,R=(e,r)=>b(e)-b(r)||e-r,H=e=>{let r=0;B(g[e],K);for(let i of g[e])S[i]=r+a[i].thickness/2,r+=a[i].thickness},L=e=>{let r=0;B(h[e],V);for(let i of h[e])_[i]=r+a[i].thickness/2,r+=a[i].thickness},U=()=>{for(let e=0;e<n;e++)H(e),L(e)},z=(e,r,i)=>{for(let o of e){let p=i?h[o]:g[o];if(p.length===0)continue;i?L(o):H(o);let d=0,O=0,C=0;for(let v of p){let T=i?f[a[v].source].y+S[v]-_[v]:f[a[v].target].y+_[v]-S[v];d+=T*a[v].thickness,O+=a[v].thickness,C+=b(i?a[v].source:a[v].target)-f[o].height/2}let N=O>0?d/O:C/p.length;f[o].y+=(N-f[o].y)*r}B(e,R);let c=0;for(let o of e)f[o].y-A[o]<c&&(f[o].y=c+A[o]),c=f[o].y+f[o].height+A[o]+Y;c=l.height;for(let o=e.length-1;o>=0;o--){let p=e[o];f[p].y+f[p].height+A[p]>c&&(f[p].y=c-f[p].height-A[p]),c=f[p].y-A[p]-Y}};U();for(let e=0;e<Ce;e++){let r=Math.pow(.99,e);for(let i=x-2;i>=0;i--)z(M[i],r,!1);U();for(let i=1;i<x;i++)z(M[i],r,!0);U()}for(let e=0;e<a.length;e++)a[e].sourceY=f[a[e].source].y+S[e],a[e].targetY=f[a[e].target].y+_[e];return{nodes:f,links:a}}var ne=6,Ne=15;function ie(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function Q(t,l,n,a,g){let h=t[l];return typeof h=="number"&&h>=a?Math.min(h,g):n}function ae(t,l){let n=t[l];return typeof n=="string"||typeof n=="number"&&Number.isFinite(n)?String(n):""}function re(t){return Math.abs(t)<1e15?Math.round(t*100)/100:t}function oe(t){return typeof t=="string"?xe([`fill:${t}`]).shape:""}function Ye(t,l,n){let a=ie(l.sankey)?l.sankey:{};return ye(n,Q(a,"width",600,1,1e4),160,g=>Oe(t,a,n,g))}function Oe(t,l,n,a){let g=n.fontSize??16,h=Math.round(g*.875),y=n.measurer??ce(n.fontFamily),s=n.padding??8,m=Q(l,"height",400,1,1e4),x=Math.min(Q(l,"nodeWidth",10,1,200),a),u=l.showValues!==!1,E=ae(l,"prefix"),$=ae(l,"suffix"),f=l.labelStyle==="outlined",F=l.nodeAlignment==="left"||l.nodeAlignment==="right"||l.nodeAlignment==="center"?l.nodeAlignment:"justify",M=typeof l.linkColor=="string"?l.linkColor:"gradient",{nodes:I,links:W}=be(t,{width:a,height:m,nodeWidth:x,nodePadding:Q(l,"nodePadding",12,0,200)+(u?Ne:0),labelHeight:h*1.15,alignment:F}),Y=new Map;if(ie(l.nodeColors))for(let[o,p]of Object.entries(l.nodeColors)){let d=oe(p);d&&Y.set(o,d)}let w=o=>Y.get(t.nodes[o].id)??"",P=0,j=0;I.forEach(o=>{o.value>j&&(j=o.value,P=o.layer)});let A=0,b=a,S=0,_=m,K="",V="";I.forEach((o,p)=>{let d=t.nodes[p].id,O=Math.max(o.height,1);V+=`<rect class="pele-sankey-node" data-id="${X(d)}" x="${k(o.x)}" y="${k(o.y)}" width="${k(x)}" height="${k(O)}" rx="${k(Math.min(2,O/2))}" fill="${ee(p)}"${w(p)}/>`;let C=u?`${E}${re(o.value)}${$}`:"",N=f?o.layer>=P:o.x<a/2,v=y.width(C?`${d} ${C}`:d,h,0),T=N?o.x+x+ne:o.x-ne,Z=o.y+o.height/2;A=Math.min(A,N?T:T-v),b=Math.max(b,N?T+v:T),S=Math.min(S,Z-h*.75),_=Math.max(_,Z+h*.75);let J=` x="${k(T)}" y="${k(Z+h*.35)}" text-anchor="${N?"start":"end"}"`,se=G(d)+(C?` <tspan class="pele-sankey-value" fill="var(--_m)">${G(C)}</tspan>`:"");K+=`<g class="pele-label" data-id="${X(d)}">`+(f?`<text${J} fill="none" stroke="var(--_bg)" stroke-width="3" stroke-linejoin="round">${G(d)}${C?" "+G(C):""}</text>`:"")+`<text${J}>${se}</text></g>`});let R=M==="gradient"||M==="source"||M==="target"?"":oe(M),H="";for(let o of W){let p=M==="target"?o.target:o.source,d=Math.max(o.thickness,1)/2,O=I[o.source].x+x,C=I[o.target].x,N=k((O+C)/2),v=X(t.nodes[o.source].id),T=X(t.nodes[o.target].id);H+=`<path class="pele-sankey-link" data-id="${v}->${T}" d="M${k(O)},${k(o.sourceY-d)}C${N},${k(o.sourceY-d)} ${N},${k(o.targetY-d)} ${k(C)},${k(o.targetY-d)}L${k(C)},${k(o.targetY+d)}C${N},${k(o.targetY+d)} ${N},${k(o.sourceY+d)} ${k(O)},${k(o.sourceY+d)}Z" fill="${ee(p)}"${R||w(p)}><title>${v} → ${T}: ${X(E)}${re(o.value)}${X($)}</title></path>`}let L=pe(t.title,!1,y,g,$e(n),1),U=L.height>0?L.height+12:0,z=Math.max(b-A,L.width),e=s-A+(z-(b-A))/2,r=s+U-S,i=Math.ceil(z+2*s),c=Math.ceil(_-S+U+2*s);return{svg:me("sankey",i,c,g,n,t,ke(L,i/2,s+L.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="translate(${k(e)},${k(r)})"><g class="pele-sankey-links" fill-opacity="0.4">${H}</g><g class="pele-sankey-nodes">${V}</g><g class="pele-labels" font-size="${h}">${K}</g></g>`),width:i,height:c,links:[]}}var De={type:"sankey",parse(t,l,n){let a=new Ee;return n&&(a.title=n),we(Me(t),a),a},render:Ye};export{De as sankey};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var nt=Object.defineProperty;var st=(t,e,l)=>e in t?nt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:l}):t[e]=l;var z=(t,e,l)=>st(t,typeof e!="symbol"?e+"":e,l);import{i as ct}from"./PUZGS23X-n6IKOr7S.js";import{f as dt}from"./DKTLEL5E-B7ILCVTH.js";import{x as pt,D as ft,G as Xe,$ as ht,v as $t,w as mt,V as yt,W as ut,O as bt,P as gt,j as $e,Y as xt,z as wt,U as vt}from"./VMV7XPHP-6QkisQwm.js";import{w as Z,D as me}from"./HWDLEDTA-C_JcdBMO.js";import{f as ae,x as n,a as He,y as R,_ as Ve,$ as kt,Y as _t,T as Mt,b as Nt,q as At}from"./RZSVICHU-BiwjruZZ.js";import{x as ue,H as Pt}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var It=class{constructor(){z(this,"nodes",new Map);z(this,"labels");z(this,"links",[]);z(this,"trends",new Map);z(this,"pipelines",new Map);z(this,"annotations",[]);z(this,"notes",[]);z(this,"accelerators",[]);z(this,"deaccelerators",[]);z(this,"annotationsBox");z(this,"axes",{});z(this,"size")}addNode(t){let e=this.nodes.get(t.id)??{id:t.id,label:t.label};this.nodes.set(t.id,{...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY}),this.labels=void 0}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});let e=this.nodes.get(t);e&&(e.isPipelineParent=!0)}addPipelineComponent(t,e){var a;(a=this.pipelines.get(t))==null||a.componentIds.push(e);let l=this.nodes.get(e);l&&(l.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;if(!this.labels){this.labels=new Map;for(let[e,l]of this.nodes)this.labels.has(l.label)||this.labels.set(l.label,e)}return this.labels.get(t)??t}build(){let t=[];for(let e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new ue(`Node "${e.label}" is missing coordinates`,"semantic",{type:"wardley"});t.push(e)}return{nodes:t,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}};function oe(t,e){let l=t<=1?t*100:t;if(l<0||l>100)throw new ue(`${e} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${t}`,"semantic",{type:"wardley"});return l}function D(t,e,l){return{x:oe(e,`${l} evolution`),y:oe(t,`${l} visibility`)}}function Ze(t){return t==="+<>"?"bidirectional":t==="+<"?"backward":t==="+>"?"forward":void 0}function Ot(t){if(!(t!=null&&t.startsWith("+")))return{};let e=t.indexOf("'",2),l=t[1]==="'"&&e!==-1?t.slice(2,e):void 0;return t.includes("<>")?{flow:"bidirectional",label:l}:t.includes("<")?{flow:"backward",label:l}:t.includes(">")?{flow:"forward",label:l}:{label:l}}function Ge(t){return t?[(t.negX?-1:1)*t.offsetX,(t.negY?-1:1)*t.offsetY]:[void 0,void 0]}function zt(t,e){var l;t.size&&e.setSize(t.size.width,t.size.height),t.evolution&&e.setAxes({stages:t.evolution.stages.map(a=>a.secondName?`${a.name.trim()} / ${a.secondName.trim()}`:a.name.trim()),stageBoundaries:t.evolution.stages.filter(a=>a.boundary!==void 0).map(a=>a.boundary)});for(let a of t.anchors){let p=D(a.visibility,a.evolution,`Anchor "${a.name}"`);e.addNode({id:a.name,label:a.name,x:p.x,y:p.y,className:"anchor"})}for(let a of t.components){let p=D(a.visibility,a.evolution,`Component "${a.name}"`),[$,m]=Ge(a.label);e.addNode({id:a.name,label:a.name,x:p.x,y:p.y,className:"component",labelOffsetX:$,labelOffsetY:m,inertia:a.inertia,sourceStrategy:(l=a.decorator)==null?void 0:l.strategy})}for(let a of t.notes){let p=D(a.visibility,a.evolution,`Note "${a.text}"`);e.addNote({text:a.text,x:p.x,y:p.y})}for(let a of t.pipelines){let p=e.getNode(a.parent);if(!p||typeof p.y!="number")throw new ue(`Pipeline "${a.parent}" must reference an existing component with coordinates.`,"semantic",{type:"wardley"});let $=p.y;e.startPipeline(a.parent);for(let m of a.components){let u=`${a.parent}_${m.name}`,[P,v]=Ge(m.label),_=oe(m.evolution,`Pipeline component "${m.name}" evolution`);e.addNode({id:u,label:m.name,x:_,y:$,className:"pipeline-component",labelOffsetX:P,labelOffsetY:v,inertia:void 0,sourceStrategy:void 0}),e.addPipelineComponent(a.parent,u)}}for(let a of t.links){let p=!!a.arrow&&(a.arrow.includes("-.->")||a.arrow.includes(".-.")),$=Ot(a.arrow),m=Ze(a.fromPort)??Ze(a.toPort)??$.flow;e.addLink({source:e.resolveNodeId(a.from),target:e.resolveNodeId(a.to),dashed:p,label:$.label??a.linkLabel,flow:m})}for(let a of t.evolves){let p=e.getNode(a.component);(p==null?void 0:p.y)!==void 0&&e.addTrend({nodeId:a.component,targetX:oe(a.target,`Evolve target for "${a.component}"`),targetY:p.y})}if(t.annotations.length>0){let a=D(t.annotations[0].x,t.annotations[0].y,"Annotations box");e.setAnnotationsBox(a.x,a.y)}for(let a of t.annotation){let p=D(a.x,a.y,`Annotation ${a.number}`);e.addAnnotation({number:a.number,coordinates:[{x:p.x,y:p.y}],text:a.text})}for(let a of t.accelerators){let p=D(a.x,a.y,`Accelerator "${a.name}"`);e.addAccelerator({name:a.name,x:p.x,y:p.y})}for(let a of t.deaccelerators){let p=D(a.x,a.y,`Deaccelerator "${a.name}"`);e.addDeaccelerator({name:a.name,x:p.x,y:p.y})}}function Lt(t,e){let l=new It;return zt(t,l),{type:"wardley",title:t.title||e,accTitle:t.accTitle?t.accTitle.replace(/^\s+/g,""):void 0,accDescr:t.accDescr?t.accDescr.replace(/\n\s+/g,`
|
|
2
|
-
`):void 0,...l.build()}}function Fe(t,e){let l=e;for(let a=t.charCodeAt(l);a>=48&&a<=57;a=t.charCodeAt(l))l++;return l}function Et(){let t=0,e=0;return(l,a)=>{if((a<t||a>=e)&&(t=a,e=Fe(l,a)),e===a||l.charCodeAt(e)!==46)return-1;let p=Fe(l,e+1);return p>e+1?p:-1}}var je={name:"ARROW",pattern:/->/y,first:"-"},Ue={name:"LINK_ARROW",pattern:/-->|-\.->|>|\+'[^']*'<>|\+'[^']*'<|\+'[^']*'>/y,first:"->+"},O=(t,e)=>({name:t,pattern:new RegExp(e,"y"),first:e[0]}),qe=[{name:"[",pattern:"["},{name:",",pattern:","},{name:"]",pattern:"]"},{name:"@",pattern:"@"},{name:"/",pattern:"/"},{name:"(",pattern:"("},{name:")",pattern:")"},{name:"-",pattern:"-",longer:[je,Ue,Xe]},{name:"{",pattern:"{"},{name:"}",pattern:"}"},{name:"WARDLEY_NUMBER",pattern:/[0-9]+\.[0-9]+/y,first:"0123456789",scanner:Et},je,{name:"LINK_PORT",pattern:/\+<>|\+>|\+</y,first:"+"},Ue,{name:"LINK_LABEL",pattern:/;[^\n\r]+/y,first:";"},{name:"STRATEGY",pattern:/build|buy|outsource|market/y,first:"bom"},O("KW_WARDLEY","wardley-beta"),O("KW_SIZE","size"),O("KW_EVOLUTION","evolution"),O("KW_ANCHOR","anchor"),O("KW_COMPONENT","component"),O("KW_LABEL","label"),O("KW_INERTIA","inertia"),O("KW_EVOLVE","evolve"),O("KW_PIPELINE","pipeline"),O("KW_NOTE","note"),O("KW_ANNOTATIONS","annotations"),O("KW_ANNOTATION","annotation"),O("KW_ACCELERATOR","accelerator"),O("KW_DEACCELERATOR","deaccelerator"),{name:"NAME_WITH_SPACES",pattern:/(?!title\s|accTitle|accDescr)[A-Za-z](?:[A-Za-z0-9_()&]|-(?!>))*(?:[ \t]+[A-Za-z(](?:[A-Za-z0-9_()&]|-(?!>))*)*/y,first:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},{name:"WS",pattern:/[ \t]+/y,hidden:!0,first:" "},ct(),ht,$t,{name:"INT",pattern:/0|[1-9][0-9]*(?!\.)/y,first:"0123456789"},mt,{name:"ID",pattern:/[\w]([-\w]*\w)?/y,first:"_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},yt,ut,Xe,bt,gt];function Tt(t){let e=new pt(ft(t,qe,"wardley"),qe,"wardley"),l={$type:"Wardley",anchors:[],components:[],links:[],evolves:[],pipelines:[],notes:[],annotations:[],annotation:[],accelerators:[],deaccelerators:[]},a=c=>e.kinds[e.i]===c,p=()=>a(36)||a(37)||a(30),$=()=>a(36)?$e(e.take()):a(37)||a(30)?e.take():e.fail("a name"),m=()=>Number(e.expect(10)),u=()=>parseInt(e.expect(35)),P=()=>a(10)?Number(e.take()):parseInt(e.expect(35)),v=()=>{if(!a(-1))for(a(38)||e.fail("a line break or the end of input");a(38);)e.i++},_=c=>{e.expect(0);let x=c();e.expect(1);let k=c();return e.expect(2),[x,k]},N=()=>{e.expect(21),e.expect(0);let c=e.accept(7),x=u();e.expect(1);let k=e.accept(7),T=u();return e.expect(2),{$type:"Label",negX:c,offsetX:x,negY:k,offsetY:T}},F=()=>{let c={$type:"EvolutionStage",name:$()};return e.accept(3)&&(c.boundary=m()),e.accept(4)&&(c.secondName=$()),c};for(;a(38);)e.i++;for(e.expect(16);!a(-1);)switch(e.kind){case 38:e.i++;break;case 32:l.accDescr=vt(e.take()),v();break;case 33:l.accTitle=wt(e.take()),v();break;case 34:l.title=xt(e.take()),v();break;case 17:{e.i++;let[c,x]=_(u);v(),l.size={$type:"Size",width:c,height:x};break}case 18:{e.i++;let c=[F()];for(e.expect(11),c.push(F());e.accept(11);)c.push(F());v(),l.evolution={$type:"Evolution",stages:c};break}case 19:{e.i++;let c=$(),[x,k]=_(m);v(),l.anchors.push({$type:"Anchor",name:c,visibility:x,evolution:k});break}case 20:{e.i++;let c={$type:"Component",name:$(),visibility:0,evolution:0,inertia:!1};[c.visibility,c.evolution]=_(m),a(21)&&(c.label=N()),a(5)&&e.kinds[e.i+1]===15&&(e.i++,c.decorator={$type:"Decorator",strategy:e.take()},e.expect(6)),e.accept(22)?c.inertia=!0:e.accept(5)&&(e.expect(22),e.expect(6),c.inertia=!0),v(),l.components.push(c);break}case 23:{e.i++;let c=$(),x=m();v(),l.evolves.push({$type:"Evolve",component:c,target:x});break}case 24:{e.i++;let c=$();for(e.expect(8),e.expect(38);a(38);)e.i++;let x=[];do{e.expect(20);let k={$type:"PipelineComponent",name:$(),evolution:0};e.expect(0),k.evolution=m(),e.expect(2),a(21)&&(k.label=N()),v(),x.push(k)}while(a(20));e.expect(9),v(),l.pipelines.push({$type:"Pipeline",parent:c,components:x});break}case 25:{e.i++;let c=$e(e.expect(36)),[x,k]=_(m);v(),l.notes.push({$type:"Note",text:c,visibility:x,evolution:k});break}case 26:{e.i++;let[c,x]=_(P);v(),l.annotations.push({$type:"Annotations",x:c,y:x});break}case 27:{e.i++;let c=u();e.expect(1);let[x,k]=_(P),T=$e(e.expect(36));v(),l.annotation.push({$type:"Annotation",number:c,x,y:k,text:T});break}case 28:case 29:{let c=e.kind===29;e.i++;let x=$(),[k,T]=_(m);v(),c?l.deaccelerators.push({$type:"Deaccelerator",name:x,x:k,y:T}):l.accelerators.push({$type:"Accelerator",name:x,x:k,y:T});break}default:{p()||e.fail("a statement");let c={$type:"Link",from:$(),to:""};a(12)&&(c.fromPort=e.take()),(a(13)||a(11))&&(c.arrow=e.take()),c.to=$(),a(12)&&(c.toPort=e.take()),a(14)&&(c.linkLabel=e.take().substring(1).trim()),v(),l.links.push(c)}}return l}var Wt=["Genesis","Custom Built","Product","Commodity"],Ct=48,w=6,K=10,St=8,ie=15,U=60,Yt=30,Qe=20,ye="var(--_c)",L="var(--_l)";function Rt(t,e,l,a,p){var m;let $=(m=t["wardley-beta"])==null?void 0:m[e];return typeof $=="number"&&$>=a&&$<=p?$:l}function G(t,e,l){return t<e?e:t>l?l:t}function Je(t,e,l,a){let p=_t(t),$="",m=l;for(let u of t.lines){let P=!0;for(let v of u){if(v.icon!==void 0)continue;let _=Mt(v.style&~p);$+=`<tspan${P?` x="${n(e)}" y="${n(m)}"`:""}${_}>${Nt(v.text)}</tspan>`,P=!1}m+=t.lineHeight}return $===""?"":`<text${At(a,p)} xml:space="preserve">${$}</text>`}function et(t,e,l,a){let p=typeof e=="number"&&Number.isFinite(e)?e:Rt(t,l,a,1,1e6);return G(p,200,1e4)-2*Ct}function Dt(t,e,l){var p;let a=et(e,(p=t.size)==null?void 0:p.width,"width",900);return dt(l,a,160,($,m)=>Kt(t,e,l,$,a,m))}function Kt(t,e,l,a,p,$){var Ce,Se,Ye;let m=l.fontSize??16,u=Math.round(m*.8125),P=Math.round(m*.6875),v=l.measurer??Pt(l.fontFamily),_=l.padding??8,N=et(e,(Ce=t.size)==null?void 0:Ce.height,"height",600)*Math.max(.75,a/p),F=((Se=e["wardley-beta"])==null?void 0:Se.showGrid)===!0,c=0,x=0,k=a,T=N,C=(i,o,r,s)=>{i<c&&(c=i),o<x&&(x=o),r>k&&(k=r),s>T&&(T=s)},B=(i,o,r,s)=>(C(o-i.width/2,r-i.height/2,o+i.width/2,r+i.height/2),ae(i,o,r,s,l.icons)),le=(i,o,r,s)=>(C(o,r-i.size,o+i.width,r-i.size+i.height+4),Je(i,o,r,s)),E=(i,o,r=$?Math.max(64,Math.min(120,a/2)):4e3,s=0)=>Ve(i,!1,v,o,r,s),X=i=>i/100*a,H=i=>N-i/100*N,q=t.axes.stages&&t.axes.stages.length>0?t.axes.stages:Wt,re=t.axes.stageBoundaries,be=re!==void 0&&re.length===q.length,Q="",ge="",J=N,xe=0;if(q.forEach((i,o)=>{let r=be?xe:o/q.length,s=be?G(re[o],0,1):(o+1)/q.length;xe=s,o>0&&(Q+=`<path class="pele-wardley-stage" d="M${n(r*a)},0V${n(N)}" stroke="var(--_b)" stroke-dasharray="4 4"/>`);let f=E(i,u,Math.max(48,Math.abs(s-r)*a-12));ge+=B(f,(r+s)/2*a,N+8+f.height/2,` class="pele-wardley-stage-label" font-size="${u}" fill="var(--_m)"`),J=Math.max(J,N+8+f.height)}),F)for(let i=1;i<4;i++)Q+=`<path class="pele-wardley-grid" d="M${n(a*i/4)},0V${n(N)}M0,${n(N*i/4)}H${n(a)}" stroke="var(--_b)" stroke-dasharray="2 6"/>`;Q+=`<path class="pele-wardley-axis" d="M0,0V${n(N)}H${n(a)}" stroke="${L}"/>`;let ne=E(t.axes.xLabel??"Evolution",u),we=E(t.axes.yLabel??"Visibility",u),ve=` class="pele-wardley-axis-label" font-size="${u}" font-weight="var(--_hw)"`,tt=B(ne,a/2,J+6+ne.height/2,ve)+ae(we,-16,N/2,`${ve} transform="rotate(-90 -16 ${n(N/2)})"`);C(-16-we.height/2,0,0,0);let at=J+6+ne.height+10,Y=new Map;for(let i of t.nodes)Y.set(i.id,{x:X(i.x),y:H(i.y),node:i});let ke="",_e=new Map;for(let i of t.pipelines){_e.set(i.nodeId,new Set(i.componentIds));let o=[];for(let b of i.componentIds){let y=Y.get(b);y&&o.push(y)}if(o.length===0)continue;o.sort((b,y)=>b.x-y.x);let r=o[0].x,s=o[o.length-1].x,f=o[0].y,h=f-2*w,d=Y.get(i.nodeId);d&&(d.x=(r+s)/2,d.y=h-K/6),C(r-ie,h,s+ie,h+4*w),ke+=`<g class="pele-wardley-pipeline" data-id="${R(i.nodeId)}"><rect x="${n(r-ie)}" y="${n(h)}" width="${n(s-r+2*ie)}" height="${n(4*w)}" rx="${He}" fill="var(--_s)" stroke="var(--_b)"/>`+(o.length>1?`<path d="M${n(r)},${n(f)}H${n(s)}" stroke="${L}" stroke-dasharray="4 4"/>`:"")+"</g>"}let se=new Map,ce=(i,o,r)=>{let s=i.node;if(s.className==="anchor"){let f=se.get(s);return f||se.set(s,f=E(s.label,u,$?Math.max(64,a/2):4e3,1)),1/Math.hypot(o/(f.width/2+5),r/(u*.8))}return s.isPipelineParent?K/Math.SQRT2:s.sourceStrategy?2*w:w},de=new Map,Me=(i,o,r)=>{Math.abs(o)<.25||Math.abs(r)<.25||de.set(i,(de.get(i)??0)|(o>0?r<0?1:2:r<0?4:8))},pe="";for(let i of t.links){let o=Y.get(i.source),r=Y.get(i.target);if(!o||!r||o===r||(Ye=_e.get(i.target))!=null&&Ye.has(i.source))continue;let s=r.x-o.x,f=r.y-o.y,h=Math.hypot(s,f);if(h<.01)continue;let d=s/h,b=f/h,y=ce(o,d,b),M=ce(r,d,b);if(y+M>=h)continue;Me(o,d,b),Me(r,-d,-b);let g=o.x+d*y,I=o.y+b*y,A=r.x-d*M,W=r.y-b*M,S="";(i.flow==="forward"||i.flow==="bidirectional")&&(S+=me("arrow_point",A,W,d,b,L),A-=d*Z("arrow_point"),W-=b*Z("arrow_point")),(i.flow==="backward"||i.flow==="bidirectional")&&(S+=me("arrow_point",g,I,-d,-b,L),g+=d*Z("arrow_point"),I+=b*Z("arrow_point"));let te="";if(i.label){let j=E(i.label,P+1,200),Re=d>=0?1:-1,De=b*Re,Ke=-d*Re,Be=5+Math.abs(De)*j.width/2+Math.abs(Ke)*j.height/2;te=B(j,(o.x+r.x)/2+De*Be,(o.y+r.y)/2+Ke*Be,` class="pele-edge-label" font-size="${P+1}" fill="var(--_m)"`)}pe+=`<g class="pele-edge${i.dashed?" pele-wardley-dashed":""}" data-id="${R(i.source)}-${R(i.target)}"><path d="M${n(g)},${n(I)}L${n(A)},${n(W)}" stroke="${L}"${i.dashed?' stroke-dasharray="6 6"':""}/>`+S+te+"</g>"}let fe="";for(let i of t.trends){let o=Y.get(i.nodeId);if(!o)continue;let r=X(i.targetX),s=H(i.targetY),f=r-o.x,h=s-o.y,d=Math.hypot(f,h),b="",y=d>0?ce(o,f/d,h/d):0;if(d>y+w+4){let M=f/d,g=h/d,I=r-M*(w+2),A=s-g*(w+2);b=`<path d="M${n(o.x+M*y)},${n(o.y+g*y)}L${n(I-M*Z("arrow_point"))},${n(A-g*Z("arrow_point"))}" stroke="${ye}" stroke-dasharray="4 4"/>`+me("arrow_point",I,A,M,g,ye)}C(r-w,s-w,r+w,s+w),fe+=`<g class="pele-wardley-trend" data-id="${R(i.nodeId)}">${b}<circle cx="${n(r)}" cy="${n(s)}" r="${w}" fill="var(--_bg)" stroke="${ye}"/></g>`}let Ne="",ee=1.2*w,it=.7*w;for(let i of Y.values()){let o=i.node,{x:r,y:s}=i,f=o.className==="anchor",h=o.sourceStrategy,d="";if(h){let g=h==="outsource"?"var(--_m)":h==="buy"?"var(--_a)":h==="build"?"var(--_s)":"var(--_bg)";d+=`<circle class="pele-wardley-${h}" cx="${n(r)}" cy="${n(s)}" r="${2*w}" fill="${g}" stroke="${L}"/>`}if(h==="market"){let g=ee*Math.cos(Math.PI/6),I=s+ee*Math.sin(Math.PI/6);d+=`<path d="M${n(r)},${n(s-ee)}L${n(r-g)},${n(I)}H${n(r+g)}Z" fill="none" stroke="${L}"/>`;for(let[A,W]of[[r,s-ee],[r-g,I],[r+g,I]])d+=`<circle cx="${n(A)}" cy="${n(W)}" r="${n(it)}" fill="var(--_bg)" stroke="${L}"/>`}else o.isPipelineParent?d+=`<rect x="${n(r-K/2)}" y="${n(s-K/2)}" width="${K}" height="${K}" fill="var(--_bg)" stroke="${L}"/>`:f||(d+=`<circle cx="${n(r)}" cy="${n(s)}" r="${w}" fill="var(--_bg)" stroke="${L}"/>`);if(o.inertia===!0){let g=(o.isPipelineParent?K/2:w)+10+(h?w+4:0);d+=`<rect class="pele-wardley-inertia" x="${n(r+g)}" y="${n(s-w)}" width="4" height="${2*w}" fill="${L}"/>`}let b=o.labelOffsetX===void 0?void 0:G(o.labelOffsetX,-5e3,5e3),y=o.labelOffsetY===void 0?void 0:G(o.labelOffsetY,-5e3,5e3),M;if(f){let g=se.get(o)??E(o.label,u,$?Math.max(64,a/2):4e3,1);M=B(g,r+(b??0),s+(y??-3),` class="pele-label" font-size="${u}" font-weight="var(--_hw)"`)}else{let g=E(o.label,u),I=` class="pele-label" font-size="${u}"`,A=St+(h?10:0);if(b!==void 0||y!==void 0)M=le(g,r+(b??A),s+(y??-A),I);else if(o.inPipeline)M=B(g,r,s+2*w+4+g.height/2,I);else{let W=de.get(i)??0,S=(W&1)===0?1:(W&2)===0?2:(W&4)===0?4:(W&8)===0?8:1,te=S===1||S===2,j=S===1||S===4;M=le(g,te?r+A:r-A-g.width,j?s-A:s+A+u*.75,I)}}C(r-2*w,s-2*w,r+2*w+20,s+2*w),Ne+=`<g class="pele-node pele-wardley-${f?"anchor":o.isPipelineParent?"pipeline-parent":o.inPipeline?"pipeline-component":"component"}" data-id="${R(o.id)}">${d}${M}</g>`}let he="";for(let i of t.annotations){let o=E(String(i.number),P,4e3,1),r="";for(let s of i.coordinates){let f=X(s.x),h=H(s.y),d=Math.max(10,o.width/2+4);C(f-d,h-d,f+d,h+d),r+=`<circle cx="${n(f)}" cy="${n(h)}" r="${n(d)}" fill="var(--_bg)" stroke="${L}"/>`+ae(o,f,h,` font-size="${P}" font-weight="var(--_hw)"`)}he+=`<g class="pele-wardley-annotation" data-id="${R(String(i.number))}">${r}</g>`}let Ae=t.annotations.filter(i=>i.text).sort((i,o)=>i.number-o.number);if(Ae.length>0){let i=Ae.map(y=>E(`${y.number}. ${y.text}`,u,$?Math.max(80,a-20):320)),o=0,r=0;for(let y of i)o=Math.max(o,y.width),r+=y.height;o+=20,r+=14;let s=t.annotationsBox,f=s?G(X(s.x),0,Math.max(0,a-o)):0,h=s?G(H(s.y),0,Math.max(0,N-r)):at;C(f,h,f+o,h+r);let d="",b=h+7;for(let y of i)d+=Je(y,f+10,b+y.lineHeight/2+u*.35,` font-size="${u}"`),b+=y.height;he+=`<g class="pele-wardley-annotations"><rect x="${n(f)}" y="${n(h)}" width="${n(o)}" height="${n(r)}" rx="${He}" fill="var(--_bg)" stroke="var(--_b)"/>${d}</g>`}let Pe="";for(let i of t.notes)Pe+=le(E(i.text,u,Math.min(360,a*.6),1),X(i.x),H(i.y),` class="pele-wardley-note" font-size="${u}" font-weight="var(--_hw)"`);let Ie="",Oe=(i,o,r,s)=>{let f=X(o),h=H(r),d=Yt/2,b=s?f+U:f,y=s?f:f+U,M=s?f+U-Qe:f+Qe,g=`M${n(y)},${n(h-d)}H${n(M)}V${n(h-d-8)}L${n(b)},${n(h)}L${n(M)},${n(h+d+8)}V${n(h+d)}H${n(y)}Z`;C(f,h-d-8,f+U,h+d+8),Ie+=`<g class="pele-wardley-${s?"accelerator":"deaccelerator"}" data-id="${R(i)}"><path d="${g}" fill="var(--_s)" stroke="${L}"/>`+B(E(i,P+1,160,1),f+U/2,h+d+8+12,` font-size="${P+1}" font-weight="var(--_hw)"`)+"</g>"};for(let i of t.accelerators)Oe(i.name,i.x,i.y,!0);for(let i of t.deaccelerators)Oe(i.name,i.x,i.y,!1);let V=Ve(t.title,!1,v,m,$?Math.max(80,a):4e3,1),ze=V.height>0?V.height+12:0,Le=Math.min(c,a/2-V.width/2),ot=Math.max(k,a/2+V.width/2),Ee=_-Le,lt=_+ze-x,Te=Math.ceil(ot-Le+2*_),We=Math.ceil(T-x+ze+2*_),rt=ae(V,Ee+a/2,_+V.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="translate(${n(Ee)},${n(lt)})"><g class="pele-wardley-frame" fill="none">${Q}</g>`+ge+tt+ke+(pe?`<g class="pele-edges" fill="none">${pe}</g>`:"")+(fe?`<g class="pele-wardley-trends" fill="none">${fe}</g>`:"")+Ne+he+Pe+Ie+"</g>";return{svg:kt("wardley",Te,We,m,l,t,rt),width:Te,height:We,links:[]}}var Ut={type:"wardley",section:"wardley-beta",parse:(t,e,l)=>Lt(Tt(t),l),render:Dt};export{Ut as wardley};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as g,x as c}from"./RZSVICHU-BiwjruZZ.js";function m(t,r){for(let n=0;n<r.length;n+=3){let e=Math.round(r[n+1]),f=t.get(e);f?f.push(r[n]):t.set(e,[r[n]])}}function w(t,r,n,e){if(r===0)return t.x;let f=t.y-t.h/2,o=t.x-t.w/2,i=r/2,l=[o+e-6+i,t.x,o+t.w-e+6-i],a=n.get(Math.round(f));if(a===void 0)return l[0];let h=l[0],u=-1;for(let d of l){let s=1/0;for(let x of a)x>o&&x<o+t.w&&(s=Math.min(s,Math.abs(x-d)-i));if(s>=6)return d;s>u+.5&&(u=s,h=d)}return h}function M(t,r,n,e){let f=r>0?e.get(Math.round(t.y-t.h/2)):void 0;if(f===void 0)return!1;let o=t.x-t.w/2;for(let i of f)if(i>o&&i<o+t.w&&Math.abs(i-n)<r/2+4)return!0;return!1}function b(t,r,n,e,f,o,i,l){let a=1;for(let u=o[i].parent;u>=0&&a<8;u=o[u].parent)a++;let h=`color-mix(in srgb,var(--_a) ${c(100*(1-.5**a))}%,var(--_bg))`;return`<g class="pele-cluster-title" data-id="${f}">`+g(t,r,n,` fill="none" stroke="${h}" stroke-width="5" stroke-linejoin="round"`,l)+g(t,r,n,e,l)+"</g>"}export{b as C,w as h,m as x,M as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{f as ve,h as be}from"./DKTLEL5E-B7ILCVTH.js";import{x as we,M as xe,$ as Me,v as Ie,w as Le,V as Te,W as Ae,G as Ce,O as De,P as Ee,Y as Ne,z as ze,U as _e,D as He,H as Oe,j as Be}from"./VMV7XPHP-6QkisQwm.js";import{x as p,_ as K,y as V,f as X,m as pe,$ as Fe}from"./RZSVICHU-BiwjruZZ.js";import{x as Pe,H as Re}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var he=32;function ue(t){return new Pe(t,"semantic",{type:"radar"})}function Ue(t,e){let a=t.axes.map(r=>({name:r.name,label:r.label??r.name})),i=t.curves.map(r=>{let c;if(r.entries[0].axis===void 0)c=r.entries.map(s=>s.value);else{if(a.length===0)throw ue("Axes must be populated before curves for reference entries");let s=new Map;for(let h of r.entries)h.axis!==void 0&&!s.has(h.axis.$refText)&&s.set(h.axis.$refText,h.value);c=a.map(h=>{let x=s.get(h.name);if(x===void 0)throw ue("Missing entry for axis "+h.label);return x})}return{name:r.name,label:r.label??r.name,entries:c}}),n={showLegend:!0,ticks:5,max:null,min:0,graticule:"circle"};for(let r of t.options)r.name==="showLegend"?n.showLegend=r.value:r.name==="graticule"?n.graticule=r.value:n[r.name]=r.value;return n.ticks>he&&(n.ticks=he),{type:"radar",title:t.title||e,accTitle:t.accTitle?t.accTitle.replace(/^\s+/g,""):void 0,accDescr:t.accDescr?t.accDescr.replace(/\n\s+/g,`
|
|
2
|
-
`):void 0,axes:a,curves:i,options:n}}var q=0,R=0;function fe(t,e){let a=e;for(let i=t.charCodeAt(a);i>=48&&i<=57;i=t.charCodeAt(a))a++;return a}function Ge(t,e){(e<q||e>=R)&&(q=e,R=fe(t,e));let a=R;if(a===e)return-1;let i=t.charCodeAt(a)===46;if(i){let n=fe(t,a+1),r=n-a-1;if(r>0&&t.charCodeAt(n)!==46)return n;if(r>1)return n-1}return t.charCodeAt(e)===48?e+1:i?a-1>e?a-1:-1:a}var J=xe.pattern,Q=/[\t ]*accDescr\s*{/y,U=-2;function Se(t,e){return Q.lastIndex=e,Q.test(t)&&(U===-2&&(U=t.lastIndexOf("}")),Q.lastIndex>U)?-1:(J.lastIndex=e,J.test(t)?J.lastIndex:-1)}var ee={name:"ID",pattern:/[\w]([-\w]*\w)?/y},w=t=>({name:t,pattern:t,longer:[ee]}),M=t=>({name:t,pattern:t}),ge=[M("radar-beta:"),{...Oe("radar-beta"),longer:[ee]},w("showLegend"),w("graticule"),w("curve"),w("ticks"),w("axis"),w("max"),w("min"),M(":"),M(","),M("["),M("]"),M("{"),M("}"),{name:"GRATICULE",pattern:/circle|polygon/y},{name:"BOOLEAN",pattern:/true|false/y},{...xe,match:Se},Me,Ie,{name:"NUMBER",pattern:/(?:[0-9]+\.[0-9]+(?!\.))|(?:0|[1-9][0-9]*(?!\.))/y,match:Ge},Le,ee,Te,Ae,Ce,De,Ee];function je(t){return q=R=0,U=-2,He(t,ge,"radar")}function We(t){let e=new we(je(t),ge,"radar"),a={$type:"Radar",axes:[],curves:[],options:[]},i=()=>{for(;e.kind===23;)e.i++},n=()=>{e.kind!==-1&&(e.kind!==23&&e.fail("a line break or the end of input"),i())},r=()=>{if(!e.accept(11))return;let d=Be(e.expect(21));return e.expect(12),d},c=d=>{if(!d)return{$type:"Entry",value:Number(e.expect(20))};let g={$refText:e.expect(22)};return e.accept(9),{$type:"Entry",axis:g,value:Number(e.expect(20))}},s=()=>{let d=e.expect(22),g=r(),u={$type:"Curve",name:d,entries:[]};g!==void 0&&(u.label=g),e.expect(13),i(),e.kind!==20&&e.kind!==22&&e.fail("a number or an axis name");let k=e.kind===22;for(u.entries.push(c(k));e.accept(10);)i(),u.entries.push(c(k));return i(),e.expect(14),u},h=()=>{let d={$type:"Axis",name:e.expect(22)},g=r();return g!==void 0&&(d.label=g),d},x=()=>{let d=e.kind,g=e.take(),u;return d===2?u=e.expect(16)==="true":d===3?u=e.expect(15):u=Number(e.expect(20)),{$type:"Option",name:g,value:u}},_=()=>e.kind===2||e.kind===5||e.kind===7||e.kind===8||e.kind===3;for(i(),e.accept(0)||(e.expect(1),e.accept(9)),i();e.kind!==-1;)switch(e.kind){case 23:e.i++;break;case 17:a.accDescr=_e(e.take()),n();break;case 18:a.accTitle=ze(e.take()),n();break;case 19:a.title=Ne(e.take()),n();break;case 6:e.i++;do a.axes.push(h());while(e.accept(10));break;case 4:e.i++;do a.curves.push(s());while(e.accept(10));break;default:for(_()||e.fail("an axis, a curve, an option, a title, or a line break"),a.options.push(x());e.accept(10);)_()||e.fail("an option"),a.options.push(x())}return a}var T=12,Z=26,me=24;function $(t,e,a,i,n){var c;let r=(c=t.radar)==null?void 0:c[e];return typeof r=="number"&&r>=i?Math.min(r,n):a}function Ye(t,e,a,i){let n=Math.min(Math.max(t,e),a);return i*(n-e)/(a-e)}function Ke(t,e){let a=t.length,i=`M${p(t[0].x)},${p(t[0].y)}`;for(let n=0;n<a;n++){let r=t[(n-1+a)%a],c=t[n],s=t[(n+1)%a],h=t[(n+2)%a];i+=` C${p(c.x+(s.x-r.x)*e)},${p(c.y+(s.y-r.y)*e)} ${p(s.x-(h.x-c.x)*e)},${p(s.y-(h.y-c.y)*e)} ${p(s.x)},${p(s.y)}`}return i+" Z"}function de(t){let e="";for(let a of t)e+=(e?" ":"")+p(a.x)+","+p(a.y);return e}function Ve(t,e,a){let i=$(e,"width",320,1,4e3);return ve(a,i,160,(n,r)=>Xe(t,e,a,n,$(e,"height",320,1,4e3)*n/i,r))}function Xe(t,e,a,i,n,r){let c=a.fontSize??16,s=Math.round(c*.875),h=a.measurer??Re(a.fontFamily),x=a.padding??8,_=$(e,"axisScaleFactor",1,0,10),d=$(e,"axisLabelFactor",1.05,0,10),g=$(e,"curveTension",.17,0,1),u=Math.min(i,n)/2,{axes:k,curves:H}=t,{ticks:te,graticule:ae,min:$e}=t.options,re=k.length,O=k.map((l,o)=>{let m=2*Math.PI*o/re-Math.PI/2;return{x:Math.cos(m),y:Math.sin(m)}}),A=t.options.max;if(A===null){A=-1/0;for(let l of H)for(let o of l.entries)o>A&&(A=o)}let v=-i/2-$(e,"marginLeft",16,0,2e3),y=i/2+$(e,"marginRight",16,0,2e3),I=-n/2-$(e,"marginTop",16,0,2e3),b=n/2+$(e,"marginBottom",16,0,2e3),B="";for(let l=0;l<te;l++){let o=Math.min(u,u*(l+1)/te);ae==="circle"?B+=`<circle r="${p(o)}"/>`:B+=`<polygon points="${de(O.map(m=>({x:m.x*o,y:m.y*o})))}"/>`}let G="",S="";O.forEach((l,o)=>{let m=u*_;G+=`M0,0L${p(l.x*m)},${p(l.y*m)}`;let f=K(k[o].label,!1,h,s,4e3),N=u*d+6,z=l.x*N+(l.x>.01?f.width/2:l.x<-.01?-f.width/2:0),L=l.y*N+(l.y>.01?f.height/2:l.y<-.01?-f.height/2:0);S+=`<g class="pele-axis-label" data-id="${V(k[o].name)}">${X(f,z,L,"")}</g>`,v=Math.min(v,z-f.width/2),y=Math.max(y,z+f.width/2),I=Math.min(I,L-f.height/2),b=Math.max(b,L+f.height/2)});let j="";H.forEach((l,o)=>{if(l.entries.length!==re)return;let m=l.entries.map((z,L)=>{let ce=Ye(z,$e,A,u),oe=Number.isFinite(ce)?ce:0;return{x:O[L].x*oe,y:O[L].y*oe}}),f=pe(o),N=` class="pele-curve" data-id="${V(l.name)}" fill="${f}" stroke="${f}"`;j+=ae==="circle"?`<path${N} d="${Ke(m,g)}"/>`:`<polygon${N} points="${de(m)}"/>`});let C=t.options.showLegend?H.map(l=>K(l.label,!1,h,s,4e3)):[],F=0;for(let l of C)F=Math.max(F,l.width);let P=C.length*Z,D=r?-(T+8+F)/2:y+me,ne=r?b+me/2:-P/2;C.length>0&&r?(v=Math.min(v,D),y=Math.max(y,-D),b=ne+P):C.length>0&&(y=D+T+8+F,I=Math.min(I,-P/2),b=Math.max(b,P/2));let W="";C.forEach((l,o)=>{let m=ne+o*Z+Z/2,f=pe(o);W+=`<g class="pele-legend-item" data-id="${V(H[o].name)}"><rect x="${p(D)}" y="${p(m-T/2)}" width="${T}" height="${T}" rx="2" fill="${f}" fill-opacity="0.4" stroke="${f}"/>`+X(l,D+T+8+l.width/2,m,"")+"</g>"});let E=K(t.title,!1,h,c,be(a),1),ie=E.height>0?E.height+8:0,le=Math.max(y-v,E.width),Y=Math.ceil(le+2*x),se=Math.ceil(b-I+ie+2*x),ye=`translate(${p(x+(le-(y-v))/2-v)},${p(x+ie-I)})`,ke=X(E,Y/2,x+E.height/2,' class="pele-title" font-weight="var(--_tw)"')+`<g transform="${ye}">`+(B?`<g class="pele-graticule" fill="none" stroke="var(--_a)">${B}</g>`:"")+(G?`<path class="pele-axes" d="${G}" fill="none" stroke="var(--_b)"/>`:"")+(j?`<g class="pele-curves" fill-opacity="0.2" stroke-width="1.5" stroke-linejoin="round">${j}</g>`:"")+(S?`<g class="pele-axis-labels" font-size="${s}">${S}</g>`:"")+(W?`<g class="pele-legend" font-size="${s}">${W}</g>`:"")+"</g>";return{svg:Fe("radar",Y,se,c,a,t,ke),width:Y,height:se,links:[]}}var tt={type:"radar",parse:(t,e,a)=>Ue(We(t),a),render:Ve};export{tt as radar};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
var ft=Object.defineProperty;var ut=(t,r,a)=>r in t?ft(t,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[r]=a;var P=(t,r,a)=>ut(t,typeof r!="symbol"?r+"":r,a);import{i as ht,a as pt}from"./FTXIJQGB-nrHdCfp7.js";import{q as je,x as me,H as gt,$ as bt,e as le,L as Xe,i as We}from"./lazy-CKqR1774.js";import{h as mt}from"./7WLXJQOR-CHhKreq0.js";import{x as He,h as yt}from"./ELSXBIJH-DG0MW5dC.js";import{b as qe,d as Ce,m as kt,p as wt}from"./FKCDD66M-BPFkyrwI.js";import{A as At,M as vt,L as Tt,O as Ct,N as St}from"./JZWSX6AR-OwVPptYv.js";import{o as xt,i as Et,P as $t,B as Se,E as Lt}from"./URA2L2QI-B8pYKxOk.js";import{m as _t,c as It}from"./DKTLEL5E-B7ILCVTH.js";import{F as Ye,w as xe,L as Mt,D as Nt,S as Rt}from"./HWDLEDTA-C_JcdBMO.js";import{g as Je,_ as ue,h as Ze,y as Ee,a as Qe,x as Z,f as $e,m as Oe,b as Le,$ as Dt}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";var Ot=new Map([["task","roundedRect"],["tool","subroutine"],["input","lean-right"],["decision","diamond"],["refdoc","lin-doc"],["action","hexagon"],["round","rect"]]),Gt=new Set(["doc","stadium","terminal","circle","trapezoid","inv_trapezoid","inv-trapezoid","doublecircle","double-circle","typeDeclaration","procs","lean_left","lean-left","in-out","cylinder","ellipse","odd","tag-rect","tagged-rectangle","delay","half-rounded-rectangle","lin-rect","lined-rectangle","win-pane","window-pane","curv-trap","curved-trapezoid"]),Ut=new Set(["roundedRect","subroutine","subprocess","subproc","framed-rectangle","lean-right","diamond","lin-doc","lined-document","hexagon","hex","connector","collapsedGroup"]),he="roundedRect";function Ae(t){return t&&(Ot.get(t)??t)}function Bt(t){return pt(t)||t==="constructor"}function Pt(t,r){for(let a of t)a.isGroup||((!a.shape||a.shape==="squareRect"||a.shape==="rect")&&(a.shape=he),Gt.has(a.shape)?(r.emitError("SHAPE_REMOVED",`shape "${a.shape}" was removed in v0.8.1, using "${he}"`,{nodeId:a.id}),a.shape=he):Ut.has(a.shape)||(r.emitWarning("SHAPE_UNSUPPORTED",`shape "${a.shape}" is not supported, using "${he}"`,{nodeId:a.id}),a.shape=he))}var Vt=new Set(["shape","view","icon","img","form","pos","w","h","class","style","labelType"]),Kt=new Set(["subroutine","subprocess","subproc","framed-rectangle","tool"]);function Ft(t){return Kt.has(t.type)}function _e(t){return t==="markdown"||t==="string"||t==="text"?t:"markdown"}function et(t){return t.startsWith('"')&&t.endsWith('"')?t.substring(1,t.length-1):t}function Ge(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zt(t){let r=i=>Array.isArray(i)?[]:Ge(i)?{}:i,a=r(t),d=[[t,a]];for(;d.length>0;){let[i,l]=d.pop();if(Array.isArray(i))for(let h of i){let y=r(h);l.push(y),typeof h=="object"&&h!==null&&d.push([h,y])}else if(Ge(i))for(let h of Object.keys(i)){if(h==="__proto__"||h==="constructor"||h==="prototype")continue;let y=i[h],e=r(y);l[h]=e,typeof y=="object"&&y!==null&&d.push([y,e])}}return a}function ye(t,r){return Object.assign(t??{},r)}var jt=/:\s*[>|][\d+-]*\s*$/,Xt=/,([\t ]*)$/;function Wt(t){let r=!1,a=!1,d=0,i,l=[];for(let h of t.split(`
|
|
2
|
-
`)){if(i!==void 0){let m=h.length-h.trimStart().length;if(h.trim()===""||m>i){l.push(h);continue}i=void 0}let y=-1;for(let m=0;m<h.length;m++){let I=h[m];if(a)I==="\\"?m++:I==='"'&&(a=!1);else if(r)I==="'"&&(r=!1);else if(I==='"')a=!0;else if(I==="'")r=!0;else if(I==="#"&&(m===0||h[m-1]===" "||h[m-1]===" ")){y=m;break}else I==="["||I==="{"?d++:(I==="]"||I==="}")&&(d=Math.max(0,d-1))}if(r||a||d>0){l.push(h);continue}let e=y>=0?h.slice(0,y):h,C=y>=0?h.slice(y):"";if(jt.test(e)){i=h.length-h.trimStart().length,l.push(h);continue}l.push(e.replace(Xt,"$1")+C)}return l.join(`
|
|
3
|
-
`)}function Ht(t,r){if(t==="arrow_point"&&r==="normal")return"sequence";if(t==="arrow_cross"&&r==="normal")return"failure";if(t==="arrow_open"&&r==="dotted")return"reference"}function qt(t){let r=t.trim(),a=r.slice(0,-1),d="arrow_open";switch(r.slice(-1)){case"x":d="arrow_cross";break;case">":d="arrow_point";break;case"-":case".":a=r;break}let i="normal",l=a.length-1,h=0;for(let y=0;y<a.length;y++)a[y]==="."&&h++;return h>0&&(i="dotted",l=h),{type:d,stroke:i,length:l}}function tt(t){if(!t)return;let r={},a=!1;for(let d of Object.keys(t))Vt.has(d)||(r[d]=t[d],a=!0);return a?r:void 0}var Yt=class{constructor(t={}){P(this,"type","agentflow");P(this,"direction");P(this,"nodes",new Map);P(this,"edges",[]);P(this,"subgraphs",[]);P(this,"connectors",new Map);P(this,"classes",new Map);P(this,"tooltips",new Map);P(this,"defaultEdgeStyle");P(this,"defaultInterpolate");P(this,"mappings",[]);P(this,"diagnostics",[]);P(this,"title");P(this,"accTitle");P(this,"accDescr");P(this,"lineOffset");P(this,"subgraphLookup",new Map);P(this,"globalNodes",new Set);P(this,"members",new Set);P(this,"edgeById",new Map);P(this,"pairCount",new Map);P(this,"subCount",0);P(this,"bareMappings",new Set);P(this,"firstMapping",new Map);P(this,"reported",new Map);P(this,"options");this.options=t,this.lineOffset=t.lineOffset??0}metadata(t,r,a){let d=r.includes(`
|
|
4
|
-
`),i;try{i=je(d?r+`
|
|
5
|
-
`:`{
|
|
6
|
-
`+r+`
|
|
7
|
-
}`)}catch(l){let h=d?Wt(r):r,y;if(h!==r)try{y=je(h+`
|
|
8
|
-
`)}catch{y=void 0}if(y===void 0){let e=a?` (${a.first_line+this.lineOffset}:${a.first_column+1})`:"";throw new me(`Metadata of "${t}" is not valid YAML. ${l.message}${e}`,"syntax",{type:"agentflow",line:a?a.first_line+this.lineOffset:0,column:a?a.first_column+1:0})}i=y}return zt(i??{})}shapeError(t,r){return new me(t,"semantic",{type:"agentflow",line:r?r.first_line+this.lineOffset:0,column:r?r.first_column+1:0})}addVertex(t,r,a,d,i,l,h={},y,e){if(!t||t.trim().length===0)return;let C,m,I;y!==void 0&&(C=this.metadata(t,y,e),Ge(C)&&(m=C,typeof C.shape=="string"&&(I=C.shape,C.shape=Ae(C.shape))));let L=this.subgraphLookup.get(t);if(L&&C){L.metadata=ye(L.metadata,C);return}let N=this.connectors.get(t);if(N&&C){N.metadata=ye(N.metadata,C);return}if(t==="connectors")return;let b=this.edgeById.get(t);if(b){(m==null?void 0:m.animate)!==void 0&&(b.animate=m.animate),(m==null?void 0:m.animation)!==void 0&&(b.animation=m.animation),(m==null?void 0:m.curve)!==void 0&&(b.interpolate=m.curve),C&&(b.metadata=ye(b.metadata,C));return}let _=this.nodes.get(t);if(_===void 0&&(_={id:t,labelType:"text",styles:[],classes:[]},this.nodes.set(t,_)),r!==void 0?(_.labelType=r.type,_.text=et(r.text.trim())):_.text===void 0&&(_.text=t),a!==void 0&&(_.type=a),d!=null)for(let G of d)_.styles.push(G);if(i!=null)for(let G of i)_.classes.push(G);if(l!==void 0&&(_.dir=l),_.props===void 0?_.props=h:h!==void 0&&Object.assign(_.props,h),!!C&&(_.metadata=ye(_.metadata,C),m!==void 0)){if(m.shape){let G=I??m.shape;if(typeof G!="string")throw this.shapeError(`No such shape: ${JSON.stringify(G)}.`,e);if(G!==G.toLowerCase()||G.includes("_"))throw this.shapeError(`No such shape: ${G}. Shape names should be lowercase.`,e);let J=m.shape;if(!Bt(J))throw this.shapeError(`No such shape: ${J}.`,e);_.type=J}m.label&&(_.text=String(m.label),_.labelType=_e(m.labelType))}}addSingleLink(t,r,a,d){let i={start:t,end:r,type:void 0,text:"",labelType:"text",classes:[],isUserDefinedId:!1,interpolate:this.defaultInterpolate},l=a==null?void 0:a.text;l!==void 0&&(i.text=et(l.text.trim()),i.labelType=_e(l.type)),a!==void 0&&(i.type=a.type,i.stroke=a.stroke,i.length=a.length>10?10:a.length,a.edgeSemantic&&(i.edgeSemantic=a.edgeSemantic));let h=t+"\0"+r,y=this.pairCount.get(h)??0;d&&!this.edgeById.has(d)?(i.id=d,i.isUserDefinedId=!0):i.id=`L_${t}_${r}_${y===0?0:y+1}`;let e=this.options.maxEdges;if(e!==void 0&&this.edges.length>=e)throw new me(`Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${e}.`,"limit",{type:"agentflow"});this.edges.push(i),this.pairCount.set(h,y+1),this.edgeById.has(i.id)||this.edgeById.set(i.id,i)}addLink(t,r,a){let d=typeof(a==null?void 0:a.id)=="string"?a.id.replace("@",""):void 0,i=t[t.length-1],l=r[0];for(let h of t)for(let y of r)this.addSingleLink(h,y,a,h===i&&y===l?d:void 0)}updateLinkInterpolate(t,r){for(let a of t)a==="default"?this.defaultInterpolate=r:this.edgeAt(a).interpolate=r}updateLink(t,r){for(let a of t){if(a==="default"){this.defaultEdgeStyle=r;continue}let d=this.edgeAt(a);d.style=r,r.length>0&&!r.some(i=>i==null?void 0:i.startsWith("fill"))&&r.push("fill:none")}}edgeAt(t){let r=this.edges[Number(t)];if(r===void 0)throw new me(`The index ${t} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length-1}. (Help: Ensure that the index is within the range of existing edges.)`,"semantic",{type:"agentflow"});return r}addClass(t,r){let a=r.join().replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",").split(";");for(let d of t.split(",")){let i=this.classes.get(d);i===void 0&&(i={id:d,styles:[],textStyles:[]},this.classes.set(d,i));for(let l of a)l.includes("color")&&i.textStyles.push(l.replace("fill","bgFill")),i.styles.push(l)}}setDirection(t){let r=t.trim();r.includes("<")&&(r="RL"),r.includes("^")&&(r="BT"),r.includes(">")&&(r="LR"),r.includes("v")&&(r="TB"),r==="TD"&&(r="TB"),this.direction=r}setClass(t,r){var a,d,i;for(let l of t.split(","))(a=this.nodes.get(l))==null||a.classes.push(r),(d=this.edgeById.get(l))==null||d.classes.push(r),(i=this.subgraphLookup.get(l))==null||i.classes.push(r)}setTooltip(t,r){if(r!==void 0)for(let a of t.split(","))this.tooltips.set(a,r)}setLink(t,r,a){let d=r.trim();for(let i of t.split(",")){let l=this.nodes.get(i);l!==void 0&&(l.link=d?At(d):void 0,l.linkTarget=a)}this.setClass(t,"clickable")}setClickEvent(t,r,a){this.setClass(t,"clickable")}setAccTitle(t){this.accTitle=t.replace(/^\s+/g,"")}setAccDescription(t){this.accDescr=t.replace(/\n\s+/g,`
|
|
9
|
-
`)}addSubGraph(t,r,a,d){var N;let i=(N=t==null?void 0:t.text)==null?void 0:N.trim(),l=(a==null?void 0:a.text)||"";t!==void 0&&t===a&&/\s/.test(l)&&(i=void 0);let h=new Set,y=[],e;for(let b of r)if(typeof b=="string")b.trim()!==""&&!h.has(b)&&(h.add(b),y.push(b));else if(Array.isArray(b))for(let _ of b)_.trim()!==""&&!h.has(_)&&(h.add(_),y.push(_));else e=b.value;e??(e=this.options.inheritDir?this.direction??this.options.direction:void 0),i??(i="subGraph"+this.subCount),this.subCount++;let C=this.members,m=y.filter(b=>b!==i&&!this.globalNodes.has(b)&&!C.has(b));for(let b of m)C.add(b);let I=this.subgraphLookup.get(i);if(I){for(let b of m)I.nodes.push(b);return l.trim()&&(I.title=l.trim()),e&&(I.dir=e),i}let L={id:i,nodes:m,title:l.trim(),classes:[],dir:e,labelType:_e(a==null?void 0:a.type),type:"flow"};return this.subgraphs.push(L),this.subgraphLookup.set(i,L),i}addGlobal(t){let r=!1,a=d=>{let i=d.trim();i!==""&&(this.globalNodes.add(i),this.members.delete(i)&&(r=!0))};for(let d of t)if(typeof d=="string")a(d);else if(Array.isArray(d))for(let i of d)a(i);if(r)for(let d of this.subgraphs)d.nodes=d.nodes.filter(i=>!this.globalNodes.has(i))}addConnector(t,r){var l,h;let a=(l=t==null?void 0:t.text)==null?void 0:l.trim();if(!a)return"";let d=((h=r==null?void 0:r.text)==null?void 0:h.trim())??"",i=this.connectors.get(a);if(i)d.length>0&&(i.text=d);else{let y={id:a,labelType:"text",styles:[],classes:[],isConnector:!0,text:d.length>0?d:a};this.connectors.set(a,y),this.nodes.set(a,y)}return a}destructLink(t,r){let a=qt(t);return r&&(r.includes(".")?"dotted":"normal")!==a.stroke?{type:"INVALID",stroke:"INVALID"}:{...a,edgeSemantic:Ht(a.type,a.stroke)}}subgraph(t){return this.subgraphLookup.get(t)}vertexKind(t){if(Ft(t))return"tool";let r=Ae(t.type);return r==="hexagon"||r==="hex"?"action":r==="lean-right"||r==="lean_right"?"input":r==="lin-doc"||r==="lined-document"?"refdoc":r==="diamond"?"decision":"task"}semanticModel(){let t=[],r=[];for(let[l,h]of this.nodes){if(this.subgraphLookup.has(l))continue;let y=tt(h.metadata);if(h.isConnector){let m={id:l};h.text!==void 0&&h.text!==l&&(m.title=h.text),y&&(m.metadata=y),r.push(m);continue}let e={id:l};h.text!==void 0&&(e.label=h.text);let C=Ae(h.type);C!==void 0&&(e.shape=C),e.vertexKind=this.vertexKind(h),y&&(e.metadata=y),t.push(e)}let a=this.edges.map(l=>{let h={start:l.start,end:l.end};return l.id!==void 0&&(h.id=l.id),l.text.length>0&&(h.label=l.text),l.type!==void 0&&(h.type=l.type),l.stroke!==void 0&&(h.stroke=l.stroke),l.edgeSemantic!==void 0&&(h.edgeSemantic=l.edgeSemantic),l.length!==void 0&&(h.length=l.length),l.metadata&&Object.keys(l.metadata).length>0&&(h.metadata={...l.metadata}),h}),d=this.subgraphs.map(l=>{let h={id:l.id,nodes:[...l.nodes],type:l.type,title:l.title};l.dir!==void 0&&(h.direction=l.dir);let y=tt(l.metadata);return y&&(h.metadata=y),h}),i={vertices:t,edges:a,subGraphs:d,connectors:r,diagnostics:this.diagnostics};return this.direction!==void 0&&(i.direction=this.direction),i}position(t){let r=(t==null?void 0:t.first_line)??0,a=(t==null?void 0:t.first_column)??0;return{startLine:r+this.lineOffset,startColumn:a,endLine:((t==null?void 0:t.last_line)??r)+this.lineOffset,endColumn:(t==null?void 0:t.last_column)??a,startIndex:0,endIndex:0}}pushMapping(t,r,a){let d={id:t,type:r,position:a};return this.mappings.push(d),this.firstMapping.has(t)||this.firstMapping.set(t,d),d}addVertexMapping(t,r,a,d){if(!t)return;let i=this.pushMapping(t,"vertex",this.position(d));a==null&&this.bareMappings.add(i)}extendVertexMapping(t,r){if(!t||!r)return;let a=this.position(r);for(let d=this.mappings.length-1;d>=0;d--){let i=this.mappings[d];if(i.type!=="vertex"||i.id!==t)continue;this.bareMappings.delete(i)&&(i.type="attachment");let l=i.position;(a.endLine>l.endLine||a.endLine===l.endLine&&a.endColumn>l.endColumn)&&(l.endLine=a.endLine,l.endColumn=a.endColumn);return}this.pushMapping(t,"attachment",a)}addEdgeMapping(t,r,a,d){let i=Array.isArray(r)?r.filter(l=>typeof l=="string"&&l!==""):[];this.pushMapping(i.length>0?i.join(">"):"edge","edge",this.position(d))}blockMapping(t,r,a,d){if(!t)return;let i=this.position(a),l=d?this.position(d):i;this.pushMapping(t,r,{startLine:i.startLine,startColumn:i.startColumn,endLine:l.endLine,endColumn:l.endColumn,startIndex:0,endIndex:0})}addSubgraphMapping(t,r,a,d){let i=typeof t=="string"?t:t==null?void 0:t.text;this.blockMapping(i??"","subgraph",a,d)}addConnectorMapping(t,r,a,d){var i;this.blockMapping(((i=t==null?void 0:t.text)==null?void 0:i.trim())??"","connector",a,d)}emit(t,r,a,d){var C,m;let i=(d==null?void 0:d.nodeId)??(d==null?void 0:d.edgeId),l={id:t,severity:r,message:a};d!=null&&d.nodeId?l.nodeId=d.nodeId:d!=null&&d.edgeId&&(l.edgeId=d.edgeId);let h=i?this.firstMapping.get(i):void 0;h&&(l.position=h.position);let y=i??"",e=this.reported.get(y);if(e===void 0)this.reported.set(y,[l]);else{for(let I of e)if(I.id===t&&I.severity===r&&I.message===a&&I.nodeId===l.nodeId&&I.edgeId===l.edgeId)return;e.push(l)}this.diagnostics.push(l),(m=(C=this.options).log)==null||m.call(C,r,`agentflow[${t}]: ${a}`)}emitWarning(t,r,a){this.emit(t,"warning",r,a)}emitError(t,r,a){this.emit(t,"error",r,a)}},rt=["$end","INVALID","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","SHAPE_DATA","CALLBACKNAME","CALLBACKARGS","MD_STR","STR","STYLE","DEFAULT","LINKSTYLE","INTERPOLATE","CLASSDEF","CLASS","HREF","CLICK","GRAPH","flow","connector","global","end","LINK_TARGET","NODIR","DIR","direction_tb","direction_bt","direction_rl","direction_lr","direction_td","LINK_ID","NUM","BRKT","STYLE_SEPARATOR","COLON","AMP","SEMI","COMMA","MULT","LINK","START_LINK","EDGE_TEXT","-)","TEXT","(-","STADIUMEND","STADIUMSTART","SUBROUTINEEND","SUBROUTINESTART","VERTEX_WITH_PROPS_START","TAGEND","CYLINDEREND","CYLINDERSTART","DOUBLECIRCLEEND","DOUBLECIRCLESTART","TRAPEND","INVTRAPEND","TRAPSTART","INVTRAPSTART","TAGSTART","UP","SEP","DOWN","COMMENT","NODE_STRING","MINUS","UNICODE_TEXT","PIPE","PE","PS","SQE","SQS","DIAMOND_STOP","DIAMOND_START","NEWLINE","SPACE","EOF"],nt=new Uint8Array(128);for(let t of"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!\"#$%&'*+.`?\\_/")nt[t.charCodeAt(0)]=1;var Jt=/accTitle\s*:\s*/y,Zt=/accDescr\s*:\s*/y,Qt=/accDescr\s*\{\s*/y,er=/call\s+/y,tr=/click\s+/y,rr=/(?:\r?\n)*\s*\n/y,sr=/\s*(?:LR|RL|TB|BT|TD|BR)\b/y,ir=/\s*[<>^]/y,ar=/\s*v\b/y,lr=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y,/.*direction\s+TD[^\n]*/y],Ie=/[\n\r\u2028\u2029]/g,or=/\(\s*\)/y,nr=/\n\s*/g;function dr(t){let r=t.length,a=[],d=[],i=[],l=[],h=[],y=0,e=0,C=1,m=0,I=!0,L=t.indexOf("direction"),N=t.indexOf("@"),b=-1,_=0,G=0,J=-1,U=-1,B=-1,p=-1,A=-1,x=-1,S=-1,$=n=>{let u=-1;for(let s=e;s<n;s++){let o=t.charCodeAt(s);o===10?(C++,u=s):o===13&&(s+1<n&&t.charCodeAt(s+1)===10&&s++,C++,u=s)}if(u<0)m+=n-e;else{let s=u+1;for(;s<n;){let o=t.charCodeAt(s);if(o===8232||o===8233)break;s++}m=s-u-1}e=n},M=(n,u)=>{a.push(n),d.push(t.slice(e,u)),i.push(e),l.push(C,m),$(u),l.push(C,m)},k=(n,u)=>{a.push(n),d.push(t.slice(e,u)),i.push(e),l.push(C,m),m+=u-e,e=u,l.push(C,m)},se=(n,u)=>{a.push(n),d.push(t.slice(e,u)),i.push(e),l.push(C,m);for(let s=e;s<u;s++){let o=t.charCodeAt(s);o===10||o===13?(C++,m=0):m++}e=u,l.push(C,m)},ne=(n,u,s)=>{a.push(n),d.push(u),i.push(e),l.push(C,m),$(s),l.push(C,m)},R=n=>{h.push(y),y=n},D=()=>{h.length>0&&(y=h.pop())},W=(n,u)=>(n.lastIndex=u,n.test(t)?n.lastIndex:-1),j=n=>t.startsWith(n,e)&&!We(t.charCodeAt(e+n.length)),ee=n=>{if(n>=U&&n<=B)return B;let u=n;for(;u<r&&le(t.charCodeAt(u));)u++;return U=n,B=u,u},oe=n=>{if(n>=p&&n<=A)return A;let u=n;for(;u<r;){let s=t.charCodeAt(u);if(s!==32&&s!==9)break;u++}return p=n,A=u,u},ie=n=>{let u=ee(n);if(u===S||t.charCodeAt(u)!==45||t.charCodeAt(u+1)!==45)return-1;let s=u+2;for(;t.charCodeAt(s)===45;)s++;let o=t.charCodeAt(s);return o===120||o===62?ee(s+1):(S=u,-1)},de=()=>{let n=ee(e);if(n===x||t.charCodeAt(n)!==45)return!1;let u=t.charCodeAt(n+1),s=n+2;if(u===45){for(;t.charCodeAt(s)===45;)s++;let o=t.charCodeAt(s);return o===120||o===62?M(42,ee(s+1)):(R(10),M(43,ee(n+2))),!0}if(u===46){for(;t.charCodeAt(s)===46;)s++;if(t.charCodeAt(s)===45)return M(42,ee(s+1)),!0}return x=n,!1},re=n=>{if(t.charCodeAt(n)!==37||t.charCodeAt(n+1)!==37||t.charCodeAt(n+2)===123)return-1;let u=t.indexOf(`
|
|
10
|
-
`,n+2);return u===-1?r:u},f=()=>{t.charCodeAt(e+1)===96?(R(2),$(e+2)):(R(1),$(e+1))},c=n=>{let u=t.charCodeAt(e+1);return n===40?(u===45?(R(8),k(47,e+2)):u===91?(R(7),k(49,e+2)):u===40&&t.charCodeAt(e+2)===40?(R(7),k(57,e+3)):(R(7),k(72,e+1)),!0):n===91?(u===91?(R(7),k(51,e+2)):u===40?(R(7),k(55,e+2)):u===47?(R(9),k(60,e+2)):u===92?(R(9),k(61,e+2)):(R(7),k(74,e+1)),!0):n===124?(R(7),k(70,e+1),!0):n===123?(R(7),k(76,e+1),!0):!1},w=()=>{let n=e;for(;n<r;){let u=t.charCodeAt(n);if(u<128&&nt[u]===1)n++;else if(u===45&&n+1<r){let s=t.charCodeAt(n+1);if(s===62||s===45||s===46)break;n++}else break}return n===e?!1:(k(67,n),!0)},v=n=>{let u=n;for(;u<r;){let s=t.charCodeAt(u);if(s!==32&&s!==9)break;u++}return u},E=n=>{let u;switch(n){case 97:if(t.startsWith("acc",e)){if((u=W(Jt,e))>=0)return R(3),M(2,u),!0;if((u=W(Zt,e))>=0)return R(4),M(4,u),!0;if((u=W(Qt,e))>=0)return R(5),$(u),!0}if(j("agentflow-beta"))return I&&(I=!1,R(6)),k(20,e+14),!0;break;case 64:if(t.charCodeAt(e+1)===123)return R(14),ne(7,"",e+2),!0;break;case 99:if((u=W(er,e))>=0)return R(12),$(u),!0;if(j("classDef"))return k(16,e+8),!0;if(j("class"))return k(17,e+5),!0;if((u=W(tr,e))>=0)return R(11),$(u),!0;if(j("connector"))return k(22,e+9),!0;break;case 34:return f(),!0;case 115:if(j("style"))return k(12,e+5),!0;break;case 100:if(j("default"))return k(13,e+7),!0;break;case 108:if(j("linkStyle"))return k(14,e+9),!0;break;case 105:if(j("interpolate"))return k(15,e+11),!0;break;case 104:if(t.startsWith("href",e)&&le(t.charCodeAt(e+4)))return M(18,e+5),!0;break;case 102:if(j("flow"))return k(21,e+4),!0;break;case 103:if(j("global"))return k(23,v(e+6)),!0;break;case 101:if(j("end"))return k(24,v(e+3)),!0;break;case 95:if(j("_self"))return k(25,e+5),!0;if(j("_blank"))return k(25,e+6),!0;if(j("_parent"))return k(25,e+7),!0;if(j("_top"))return k(25,e+4),!0;break}if(L!==-1&&e>=_&&(L<e&&(L=t.indexOf("direction",e)),L!==-1&&(b<e&&(Ie.lastIndex=e,b=Ie.test(t)?Ie.lastIndex-1:r),L<b))){for(let s=0;s<5;s++)if((u=W(lr[s],e))>=0)return M(28+s,u),!0;_=b}if(N!==-1&&n!==34&&!le(n)){if(e>=G){N<e&&(N=t.indexOf("@",e));let s=e;for(;s<r;){let o=t.charCodeAt(s);if(o===34||le(o))break;s++}if(G=s,J=-1,N!==-1&&N<s)for(let o=Math.min(s,r-1)-1;o>=N;o--){if(t.charCodeAt(o)!==64)continue;let g=t.charCodeAt(o+1);if(g!==123&&g!==34){J=o;break}}}if(J>e)return k(33,J+1),!0}if(n>=48&&n<=57){let s=e+1;for(;s<r;){let o=t.charCodeAt(s);if(o<48||o>57)break;s++}return k(34,s),!0}switch(n){case 35:return k(35,e+1),!0;case 58:return t.charCodeAt(e+1)===58&&t.charCodeAt(e+2)===58?k(36,e+3):k(37,e+1),!0;case 38:return k(38,e+1),!0;case 59:return k(39,e+1),!0;case 44:return k(40,e+1),!0;case 42:return k(41,e+1),!0;case 60:return k(62,e+1),!0;case 45:return de()||w()||k(68,e+1),!0;case 40:return c(n);case 91:return t.charCodeAt(e+1)===124?(k(52,e+2),!0):c(n);case 124:case 123:return c(n);case 62:return R(7),k(53,e+1),!0;case 94:return k(63,e+1),!0;case 92:return t.charCodeAt(e+1)===124?(k(64,e+2),!0):w();case 118:return We(t.charCodeAt(e+1))?w():(k(65,e+1),!0);case 37:return(u=re(e))>=0?(M(66,u),!0):w()}if(le(n)){if(de())return!0;if((n===32||n===9)&&(u=re(oe(e)))>=0)return M(66,u),!0;for(u=e;;){let s=t.charCodeAt(u);if(s===10)u++;else if(s===13&&t.charCodeAt(u+1)===10)u+=2;else break}return u>e?M(77,u):M(78,e+1),!0}return n<128?w():mt(n)?(k(69,e+1),!0):!1};e:for(;;){if(e>=r){let s=-1;switch(y){case 0:s=79;break;case 3:s=3;break;case 4:s=5;break;case 5:s=6;break;case 11:s=19;break;case 12:s=8;break;case 13:s=9;break}s!==-1&&k(s,r);break}let n=t.charCodeAt(e),u=!0;switch(y){case 0:u=E(n);break;case 1:if(n===34)t.charCodeAt(e+1)===96?(R(2),$(e+2)):(D(),$(e+1));else{let s=t.indexOf('"',e);M(11,s===-1?r:s)}break;case 2:if(n===96)t.charCodeAt(e+1)===34?(D(),$(e+2)):u=!1;else if(n===34)f();else{let s=e+1;for(;s<r;){let o=t.charCodeAt(s);if(o===96||o===34)break;s++}M(10,s)}break;case 3:case 4:{let s=t.indexOf(`
|
|
11
|
-
`,e);s===-1&&(s=r);let o=y===3?3:5;D(),M(o,s);break}case 5:if(n===125)D(),$(e+1);else{let s=t.indexOf("}",e);s===-1&&(s=r),M(6,s)}break;case 6:{let s;n===34?f():(s=W(rr,e))>=0?(D(),M(26,s)):(s=W(sr,e))>=0||(s=W(ir,e))>=0||(s=W(ar,e))>=0?(D(),M(27,s)):u=c(n);break}case 7:{let s=t.charCodeAt(e+1);switch(n){case 34:f();break;case 40:case 91:case 123:c(n);break;case 93:D(),s===41?k(48,e+2):s===93?k(50,e+2):k(73,e+1);break;case 41:D(),s===93?k(54,e+2):s===41&&t.charCodeAt(e+2)===41?k(56,e+3):k(71,e+1);break;case 124:D(),k(70,e+1);break;case 125:D(),k(75,e+1);break;case 37:{let o=re(e);o>=0?$(o):u=!1;break}default:{let o=e+1;for(;o<r;){let g=t.charCodeAt(o);if(g===91||g===93||g===40||g===41||g===123||g===125||g===124||g===34||g===37)break;o++}M(46,o)}}break}case 8:{let s=t.charCodeAt(e+1),o;if(n===34)f();else if(n===37&&(o=re(e))>=0)$(o);else if((n===45||n===47||n===41)&&s===41)D(),k(45,e+2);else if(n===40||n===91||n===123)c(n);else if(n===41||n===93||n===125)u=!1;else{let g=e+1;for(;g<r;){let T=t.charCodeAt(g);if(T===34||T===40||T===41||T===91||T===93||T===123||T===125||(T===45||T===47)&&t.charCodeAt(g+1)===41||T===37&&t.charCodeAt(g+1)===37&&t.charCodeAt(g+2)!==123)break;g++}se(46,g)}break}case 9:{let s=t.charCodeAt(e+1);if(n===34){f();break}switch(n){case 40:s===45||s===91||s===40&&t.charCodeAt(e+2)===40?c(n):s===93?(D(),k(58,e+2)):c(n);break;case 91:case 123:c(n);break;case 92:s===93?(D(),k(58,e+2)):k(46,e+1);break;case 47:s===93?(D(),k(59,e+2)):k(46,e+1);break;case 93:case 41:s===93?(D(),k(58,e+2)):u=!1;break;case 125:u=!1;break;case 37:{let o=re(e);o>=0?$(o):u=!1;break}default:{if((n===63||n===61)&&s===93){D(),k(58,e+2);break}let o=e+1;for(;o<r;){let g=t.charCodeAt(o);if(g===92||g===91||g===93||g===40||g===41||g===123||g===125||g===47||g===37)break;o++}M(46,o)}}break}case 10:{if(n===34){f();break}let s=ie(e);if(s>=0){D(),M(42,s);break}if(n===45&&t.charCodeAt(e+1)===45){u=!1;break}let o=e+1;for(;o<r;){let g=t.charCodeAt(o);if(g===34)break;if(g===45){if(t.charCodeAt(o+1)===45)break}else if(le(g)&&ie(o)>=0)break;o++}se(44,o);break}case 11:if(n===34)f();else if(le(n))D(),$(e+1);else{let s=e+1;for(;s<r&&!le(t.charCodeAt(s));)s++;k(19,s)}break;case 12:if(n===40){let s=W(or,e);D(),s>=0?$(s):(R(13),$(e+1))}else{let s=t.indexOf("(",e);s===-1&&(s=r),M(8,s)}break;case 13:if(n===41)D(),$(e+1);else{let s=t.indexOf(")",e);s===-1&&(s=r),M(9,s)}break;case 14:if(n===34)R(15),k(7,e+1);else if(n===125)D(),$(e+1);else if(n===94)u=!1;else{let s=e+1;for(;s<r;){let o=t.charCodeAt(s);if(o===125||o===94||o===34)break;s++}M(7,s)}break;case 15:if(n===34)D(),k(7,e+1);else{let s=t.indexOf('"',e);s===-1&&(s=r),ne(7,t.slice(e,s).replace(nr,"<br/>"),s)}break}if(!u)return a.push(1),d.push(""),i.push(e),l.push(C,m,C,m),{types:a,texts:d,starts:i,locs:l};continue e}return a.push(0),d.push(""),i.push(r),l.push(C,m,C,m),{types:a,texts:d,starts:i,locs:l}}var ve=new Uint8Array(80);for(let t of[34,67,65,68,13,40,37,38,35,41,69])ve[t]=1;var Ue=new Uint8Array(80);for(let t of[34,69,67,27,65,68,40,37,38,35,41])Ue[t]=1;var Be=new Uint8Array(80);for(let t of[34,67,78,68,38,69,37,41,35,12,14,16,17,19,20,27,21,22,23,24,65,63,43])Be[t]=1;var Pe=new Uint8Array(80);for(let t of[34,67,37,78,35,12])Pe[t]=1;var Te=new Uint8Array(80);for(let t of[77,39,79,66])Te[t]=1;var st="'UNICODE_TEXT', 'TEXT', 'TAGSTART'",Me="'COMMENT', 'SEMI', 'NEWLINE', 'EOF'",pe=[],cr=/}[^\S\n]*\n/g;function fr(t,r,a=!1){let d=!a&&t.includes("}")?t.replace(cr,`}
|
|
12
|
-
`):t,{types:i,texts:l,starts:h,locs:y}=dr(d),e=0,C,m=0,I=0,L=f=>{let c=i[e];throw c===1?Xe("agentflow",d,h[e],"",!0):Xe("agentflow",d,h[e],`Expecting ${f}, got '${rt[c]}'`)},N=(f,c)=>({first_line:y[4*f],first_column:y[4*f+1],last_line:y[4*c+2],last_column:y[4*c+3]}),b=(f,c="")=>(i[e]!==f&&L(`'${rt[f]}'${c?", "+c:""}`),l[e++]),_=()=>{Te[i[e]]===0&&L(Me),e++},G=()=>{ve[i[e]]===0&&L("'NODE_STRING'");let f=l[e++];for(;ve[i[e]]===1;)f+=l[e++];return f},J=()=>{Ue[i[e]]===0&&L("'NODE_STRING'");let f=l[e++];for(;Ue[i[e]]===1;)f+=l[e++];return f},U=()=>{let f=i[e],c;if(f===11)c="string";else if(f===10)c="markdown";else if(f===46||f===62||f===53||f===69)c="text";else return L(`${st}, 'TAGEND', 'STR', 'MD_STR'`);let w=l[e++];for(;;){let v=i[e];if(v!==46&&v!==62&&v!==53&&v!==69)break;w+=l[e++]}return{text:w,type:c}},B=f=>{b(f,st)},p=()=>{let f=i[e],c;if(f===11)c="string";else if(f===10)c="markdown";else if(f===44||f===69)c="text";else return L("'EDGE_TEXT', 'STR', 'MD_STR'");let w=l[e++];for(;i[e]===44||i[e]===69;)w+=l[e++];return{text:w,type:c}},A=()=>{let f=i[e],c;if(f===11)c="text";else if(f===10)c="markdown";else if(Be[f]===1)c="text";else return L("'NODE_STRING', 'STR', 'MD_STR'");let w=l[e++];for(;Be[i[e]]===1;)w+=l[e++];return{text:w,type:c}},x=()=>{m=e;let f=l[e++];for(;i[e]===7;)f+=l[e++];return I=e-1,f},S=(f,c,w,v)=>{let E=N(w,v);r.addVertex(f,void 0,void 0,void 0,void 0,void 0,void 0,c,E),r.extendVertexMapping(f,E)},$=(f,c)=>{c.data!==void 0&&r.addVertex(f,void 0,void 0,void 0,void 0,void 0,void 0,c.data,N(c.dataFrom,c.dataTo))},M=()=>{let f=e,c=G(),w,v,E;switch(i[e]){case 74:e++,w=U(),B(73),v="square";break;case 57:e++,w=U(),B(56),v="doublecircle";break;case 72:e++,i[e]===72?(e++,w=U(),B(71),b(71),v="circle"):(w=U(),B(71),v="round");break;case 47:e++,w=U(),B(45),v="ellipse";break;case 49:e++,w=U(),B(48),v="stadium";break;case 51:e++,w=U(),B(50),v="subroutine";break;case 52:{e++;let n=b(67);b(37);let u=b(67);b(70),w=U(),B(73),v="rect",E={[n]:u};break}case 55:e++,w=U(),B(54),v="cylinder";break;case 76:e++,i[e]===76?(e++,w=U(),B(75),b(75),v="hexagon"):(w=U(),B(75),v="diamond");break;case 53:e++,w=U(),B(73),v="odd";break;case 60:e++,w=U(),i[e]===59?(e++,v="lean_right"):(B(58),v="trapezoid");break;case 61:e++,w=U(),i[e]===58?(e++,v="lean_left"):(B(59),v="inv_trapezoid");break}return E!==void 0?r.addVertex(c,w,v,void 0,void 0,void 0,E):v!==void 0?r.addVertex(c,w,v):r.addVertex(c),r.addVertexMapping(c,w,v,N(f,e-1)),c},k=()=>{let f=M();return i[e]===36&&(e++,r.setClass(f,G())),f},se=()=>{let f=[k()];for(C=void 0;;){let c=i[e]===7?x():void 0,w=m,v=I;if(i[e]!==78)return C=c,f;do e++;while(i[e]===78);if(i[e]!==38)return c!==void 0&&L("'AMP'"),f;e++,i[e]!==78&&L("'SPACE'");do e++;while(i[e]===78);let E=k();c!==void 0&&S(f[f.length-1],c,w,v),f.push(E)}},ne=()=>{let f;if(i[e]===33&&(f=l[e++]),i[e]===42){let c=r.destructLink(l[e++]);return f!==void 0&&(c.id=f),i[e]===70&&(e++,c.text=U(),B(70),i[e]===78&&e++),c}if(i[e]===43){let c=l[e++],w=p(),v=b(42,"'EDGE_TEXT'"),E=r.destructLink(v,c);return E.text=w,f!==void 0&&(E.id=f),E}return L("'LINK', 'START_LINK'")},R=()=>{let f=e,c=se();C!==void 0&&S(c[c.length-1],C,m,I);let w=c;for(;;){let v=i[e];if(v!==42&&v!==43&&v!==33)return w;let E=ne(),n=se();C!==void 0&&S(n[n.length-1],C,m,I),r.addLink(c,n,E),r.addEdgeMapping(c,n,E,N(f,e-1)),w=n.concat(w),c=n}},D=()=>{Pe[i[e]]===0&&L("'NODE_STRING', 'NUM', 'COLON', 'BRKT'");let f=l[e++];for(;Pe[i[e]]===1;)f+=l[e++];return f},W=()=>{let f=[D()];for(;i[e]===40;)e++,f.push(D());return f},j=()=>{e++,b(78);let f;if(i[e]===13)f=[l[e++]];else for(f=[b(34,"'DEFAULT'")];i[e]===40;)e++,f.push(b(34));if(b(78),i[e]!==15){r.updateLink(f,W());return}e++,b(78);let c=J();if(i[e]===78){e++;let w=W();r.updateLinkInterpolate(f,c),r.updateLink(f,w)}else r.updateLinkInterpolate(f,c)},ee=(f,c)=>{if(i[e]!==78){r.setLink(f,c);return}if(e++,i[e]===25){r.setLink(f,c,l[e++]);return}let w=b(11,"'LINK_TARGET'");i[e]===78?(e++,r.setLink(f,c,b(25))):r.setLink(f,c),r.setTooltip(f,w)},oe=()=>{let f=l[e++];switch(i[e]){case 8:{let c=l[e++],w=i[e]===9,v=w?l[e++]:void 0,E;i[e]===78&&(e++,E=b(11)),w?r.setClickEvent(f,c,v):r.setClickEvent(f,c),E!==void 0&&r.setTooltip(f,E);return}case 18:e++,ee(f,b(11));return;case 11:ee(f,l[e++]);return;default:{let c=J();if(i[e]===78){e++;let w=b(11);r.setClickEvent(f,c),r.setTooltip(f,w)}else r.setClickEvent(f,c)}}},ie=f=>{b(78,Me);let c=A(),w={text:"",type:"text"};i[e]===74&&(e++,w=U(),B(73));let v=i[e]===7?x():void 0;return Te[i[e]]===0&&L(`${Me}, 'SHAPE_DATA'`),{global:!1,at:f,id:c,title:w,data:v,dataFrom:m,dataTo:I,list:[],collect:!1}},de=()=>{let f=i[e];switch(f){case 12:{e++,b(78);let c=G();return b(78),r.addVertex(c,void 0,void 0,W()),_(),pe}case 14:return j(),_(),pe;case 16:{e++,b(78);let c=G();return b(78),r.addClass(c,W()),_(),pe}case 17:{e++,b(78);let c=G();return b(78),r.setClass(c,G()),_(),pe}case 19:return oe(),_(),pe;case 22:{let c=ie(e++),w=e++,v=r.addConnector(c.id,c.title);return $(v,c),r.addConnectorMapping(c.id,c.title,N(c.at,c.at),N(w,w)),v}case 28:case 29:case 30:case 31:case 32:return e++,{stmt:"dir",value:ur[f-28]};case 2:{e++;let c=b(3).trim();return r.setAccTitle(c),c}case 4:{e++;let c=b(5).trim();return r.setAccDescription(c),c}case 6:{let c=l[e++].trim();return r.setAccDescription(c),c}default:{ve[f]===0&&L(it);let c=R();return _(),c}}},re=()=>{let f=[],c=[],w=!1;for(;;){let v=i[e];if(v===0)break;if(v===24){let E=f.pop();if(E===void 0)break;let n=e++;if(E.global){r.addGlobal(c),c=E.list,w=E.collect;continue}let u=r.addSubGraph(E.id,c,E.title,"flow");$(u,E),r.addSubgraphMapping(E.id,E.title,N(E.at,E.at),N(n,n)),c=E.list,w=E.collect,w&&c.push(u)}else if(v===39||v===77||v===78||v===79)w&&c.push(l[e]),e++;else if(v===66)e++;else if(v===21||v===23){let E=e++,n;v===23||Te[i[e]]===1?(n={global:v===23,at:E,id:void 0,title:void 0,data:void 0,dataFrom:0,dataTo:0,list:c,collect:w},_()):(n=ie(E),n.list=c,n.collect=w,e++),f.push(n),c=[],w=!0}else{let E=de();w&&(!Array.isArray(E)||E.length>0)&&c.push(E)}}f.length>0&&L("'end'")};for(;i[e]===78||i[e]===77||i[e]===66;)e++;if(b(20,"'SPACE', 'NEWLINE', 'COMMENT'"),i[e]===26)e++,r.setDirection("TB");else{let f=b(27,"'NODIR'"),c=i[e];if(c===78){do e++;while(i[e]===78);c=i[e],c!==77&&L("'NEWLINE', 'SPACE'")}else c!==39&&c!==77&&c!==66&&L("'COMMENT', 'SEMI', 'NEWLINE', 'SPACE'");e++,r.setDirection(f)}re(),i[e]!==0&&L(it)}var ur=["TB","BT","RL","LR","TD"],it="'COMMENT', 'SEMI', 'NEWLINE', 'SPACE', 'EOF', 'flow', 'global', 'connector', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'STYLE', 'LINKSTYLE', 'CLASSDEF', 'CLASS', 'CLICK', 'NODE_STRING'",fe=new Map([["tool",0],["task",1],["decision",2],["input",3],["refdoc",4],["connector",5],["action",6]]),dt=fe.size,hr=t=>Math.max(1,t-dt),pr=(t,r)=>{let a=dt+t%hr(r);return r>0?a%r:a};function gr(t,r,a,d){let i=a.size;for(let l of t){if(l.isGroup||l.shape==="collapsedGroup"){l.colorIndex=pr(a.get(l.id)??i++,d);continue}let h=r(l.id);h&&fe.has(h)&&(l.kind=h)}}function br(t,r,a){var J,U,B;let d=[],i=[],l=t.subgraphs,h=p=>{let A=[];for(let x of p){let S=t.classes.get(x);S!=null&&S.styles&&(A=[...A,...S.styles].map($=>$.trim())),S!=null&&S.textStyles&&(A=[...A,...S.textStyles].map($=>$.trim()))}return A},y=new Set,e=new Map,C=new Set;for(let p of l){if(((J=p.metadata)==null?void 0:J.view)!=="collapsed"||y.has(p.id))continue;let A=[p.id];for(;A.length>0;){let x=(U=t.subgraph(A.pop()))==null?void 0:U.nodes;if(x!==void 0)for(let S of x)S===p.id||y.has(S)||(y.add(S),e.set(S,p.id),C.has(S)||A.push(S))}C.add(p.id)}let m=new Map;for(let p of y){let A=[p],x=e.get(p);for(;;){let S=m.get(x),$=S??e.get(x);if($===void 0||(S===void 0&&A.push(x),x=$,S!==void 0))break}for(let S of A)m.set(S,x)}let I=new Map;l.forEach((p,A)=>I.set(p.id,A));let L=new Map,N=(p,A,x)=>{let S=I.get(p);if(S===void 0||S<x)return!1;let $=A;for(let M=0;$!==void 0&&M<=l.length;M++){if($===p)return!0;$=L.get($)}return!1};for(let p=l.length-1;p>=0;p--){let A=l[p];if(!y.has(A.id))for(let x of A.nodes){if(N(x,A.id,p)){t.emitWarning("CONTAINMENT_VIOLATION",`Container "${A.id}" cannot contain "${x}" because "${x}" already contains it. The nesting that would close the loop is dropped.`,{nodeId:x});continue}L.set(x,A.id)}}let b=new Map;for(let p=l.length-1;p>=0;p--){let A=l[p];if(y.has(A.id))continue;let x=((B=A.metadata)==null?void 0:B.view)==="collapsed",S={id:A.id,label:A.title,labelType:A.labelType,parentId:L.get(A.id),cssStyles:[],cssCompiledStyles:h(A.classes),cssClasses:A.classes.join(" "),shape:x?"collapsedGroup":"flowGroup",dir:A.dir,isGroup:!x,metadata:x?{...A.metadata,containerType:A.type}:A.metadata};d.push(S),b.set(A.id,S)}for(let p of t.nodes.values()){if(y.has(p.id))continue;let A=b.get(p.id);if(A){A.cssStyles=p.styles,A.cssCompiledStyles=h(p.classes),A.cssClasses=p.classes.join(" ");continue}let x=Ae(p.type),S={id:p.id,label:p.text,labelType:p.labelType,parentId:L.get(p.id),cssStyles:p.styles,cssCompiledStyles:h(["default","node",...p.classes]),cssClasses:"default "+p.classes.join(" "),dir:p.dir,link:p.link,linkTarget:p.linkTarget,tooltip:t.tooltips.get(p.id),metadata:p.metadata,isGroup:!1,shape:x==="square"||x===void 0?"squareRect":x};d.push(S),b.set(p.id,S)}t.edges.forEach((p,A)=>{let x=m.get(p.start)??p.start,S=m.get(p.end)??p.end;if(x===S&&p.start!==p.end)return;let $=[...t.defaultEdgeStyle??[]];p.style&&$.push(...p.style);let M=p.type==="arrow_open"?"none":p.type==="arrow_cross"||p.type==="arrow_point"?p.type:"arrow_point";i.push({id:p.id||`L_${x}_${S}_${A}`,isUserDefinedId:p.isUserDefinedId,start:x,end:S,type:p.type??"normal",label:p.text,labelType:p.labelType,thickness:p.stroke,pattern:p.stroke,minlen:p.length,classes:"edge-thickness-normal edge-pattern-solid flowchart-link",arrowTypeStart:"none",arrowTypeEnd:M,cssCompiledStyles:h(p.classes),style:$,animate:p.animate,animation:p.animation,curve:p.interpolate||t.defaultInterpolate||a,metadata:p.metadata})}),Pt(d,t);let _=new Map;for(let p of l){let A=L.get(p.id);if(A===void 0)continue;let x=_.get(A);x?x.push(p.id):_.set(A,[p.id])}let G=new Map;for(let p of l){if(L.get(p.id)!==void 0)continue;let A=[p.id];for(;A.length>0;){let x=A.pop();if(G.has(x))continue;G.set(x,G.size);let S=_.get(x);if(S)for(let $=S.length-1;$>=0;$--)A.push(S[$])}}return gr(d,p=>{if(t.connectors.has(p))return"connector";let A=t.nodes.get(p);return A?t.vertexKind(A):void 0},G,r),{nodes:d,edges:i}}var mr=8,yr=40,kr=16,wr=48,ge=20,Ne=26,ke=14,at="collapsed",Ar={TB:2,RL:3,BT:0,LR:1},lt=new WeakMap;function ct(t,r){var d;let a=lt.get(t);if(a===void 0){let i=(d=r.flowchart)==null?void 0:d.curve;a=br(t,mr,typeof i=="string"?i:void 0),lt.set(t,a)}return a}function we(t,r,a){var i;let d=(i=t.agentflow)==null?void 0:i[r];return typeof d=="number"&&d>0?Math.min(d,2e3):a}var vr=/[";]fill:/;function Re(t,r,a){let d=Oe(t);return` fill="${d}"${vr.test(a.shape)?"":` fill-opacity="${r}"`} stroke="${d}"`}function Tr(t,r,a){return _t(t.direction)?It(a,d=>ot(t,r,a,d)):ot(t,r,a,!1)}function ot(t,r,a,d){let i=ct(t,r),l=a.fontSize??16,h=Math.round(l*.875),y=a.measurer??gt(a.fontFamily),e=we(r,"wrappingWidth",120),C=we(r,"minNodeWidth",120),m=a.padding??8,I=a.icons,L=new Map,N=[],b=[];i.nodes.forEach((s,o)=>L.set(s.id,o));for(let s of i.nodes){let o=s.cssStyles.length>0?s.cssCompiledStyles.concat(s.cssStyles):s.cssCompiledStyles,g=Je(o),T=(g.bold?1:0)|(g.italic?2:0),q=s.labelType==="markdown",V=g.fontSize??l,F,O;if(s.isGroup){let z=ue(s.label,q,y,V,4e3,T);F={node:s,style:g,label:z,shape:"group",w:0,h:0,dy:0,loops:0},O=Ce(0,0),O.isGroup=!0,O.dir=s.dir?qe(s.dir):void 0,O.padX=ge,O.padTop=z.height>0?z.height+16:ge,O.padBottom=ge,O.minW=z.width+2*ge-12}else if(s.shape==="collapsedGroup"){let z=ue(s.label,q,y,V,e,T),H=Math.max(z.width,C)+2*xt,Q=z.height+2*Et+ke;F={node:s,style:g,label:z,shape:at,w:H,h:Q,dy:-ke/2,loops:0},O=Ce(H,Q)}else{let z=ht(s.shape),H=ue(s.label,q,y,V,e,T),Q=$t(z,z==="diam"?H.width:Math.max(H.width,C),H.height);F={node:s,style:g,label:H,shape:z,w:Q.w,h:Q.h,dy:Q.dy,loops:0},O=Ce(Q.w,Q.h)}O.seq=N.length,N.push(F),b.push(O)}i.nodes.forEach((s,o)=>{b[o].parent=s.parentId!==void 0?L.get(s.parentId)??-1:-1});let _=d?"TB":qe(t.direction),G=s=>{let o;for(let g=b[s].parent,T=0;g>=0&&o===void 0&&T<1e4;g=b[g].parent,T++)o=b[g].dir;return o??_},J=s=>{let o=G(s);return o==="LR"||o==="RL"},U=new Int32Array(b.length).fill(-1);for(let s=0;s<b.length;s++){let o=[],g=s;for(;g>=0&&U[g]<0&&o.length<=b.length;)o.push(g),g=b[g].parent;let T=g>=0?U[g]+1:0;for(let q=o.length-1;q>=0;q--)U[o[q]]=T++}let B=(s,o)=>{let g=o;for(let T=U[o];T>U[s];T--)g=b[g].parent;return g===s&&o!==s},p=[],A=[],x=[],S=[];for(let s of i.edges){let o=L.get(s.start),g=L.get(s.end);if(o===void 0||g===void 0)continue;let T=ue(s.label,s.labelType==="markdown",y,h,e);if(B(o,g)||B(g,o)){S.push({edge:s,label:T,src:o,dst:g});continue}o===g&&(N[o].loops++,J(o)?b[o].h+=2*(Ne+(T.height>0?T.height+8:0)):b[o].w+=2*(Ne+(T.width>0?T.width+12:0))),x.push(s),A.push(T),p.push({src:o,dst:g,minlen:s.minlen??1,labelW:T.width>0?T.width+12:0,labelH:T.height>0?T.height+4:0,route:[],labelX:0,labelY:0})}let $=kt(b,p,_,{nodeSep:we(r,"nodeSpacing",yr),edgeSep:kr,rankSep:we(r,"rankSpacing",wr),portSep:20}),M=ue(t.title,!1,y,l,4e3,1),k=M.height>0?M.height+12:0,se=Math.max($.width,M.width),ne=m+(se-$.width)/2,R=m+k;wt(b,p,ne,R);let D=Math.ceil(se+2*m),W=Math.ceil($.height+k+2*m),j=[],ee=[],oe=[],ie=[],de=S.length*b.length<2e6;for(let{edge:s,src:o,dst:g}of S){let T=B(g,o),q=T?g:o,V=T?o:g,F=b[q],O=b[V],z=Ar[F.dir??G(q)],H=T?z:z+2&3,Q=K=>{let Y=(K&1)===0,X=K===0||K===3?-1:1,Ve=Y?O.x:O.x+X*O.w/2,Ke=Y?O.y+X*O.h/2:O.y,Fe=Y?O.x:F.x+X*F.w/2,ze=Y?F.y+X*F.h/2:O.y,be=Y?0:1;return T?[Ve,Ke,be,Fe,ze,be]:[Fe,ze,be,Ve,Ke,be]},ce=K=>{for(let Y=0;Y<b.length;Y++){let X=b[Y];if(Y!==V&&!X.isGroup&&X.x+X.w/2>Math.min(K[0],K[3])-1&&X.x-X.w/2<Math.max(K[0],K[3])+1&&X.y+X.h/2>Math.min(K[1],K[4])-1&&X.y-X.h/2<Math.max(K[1],K[4])+1)return!0}return!1},te=Q(H);if(de&&ce(te))for(let K of[H+1&3,H+3&3,H+2&3]){let Y=Q(K);if(!ce(Y)){te=Y;break}}ie.push(te),oe.push((te[0]+te[3])/2,(te[1]+te[4])/2);let ae=te.slice();Se(ae,T?0:3,N[V],O),ee.push(Ye(ae,"linear",0,xe(s.arrowTypeEnd)))}let re=new Map,f=!1;for(let s of b)s.isGroup&&(f=!0);if(f){for(let s of p)He(re,s.route);for(let s of ie)He(re,s)}let c="",w="";for(let s=0;s<N.length;s++){let o=N[s],g=b[s],T=o.node,q=g.x,V=g.y,F=Ze(T.cssClasses.replace(/^default\s?/,"")),O=Ee(T.id);if(g.isGroup){let K=yt(g,o.label.width,re,ge);c+=`<g class="pele-cluster pele-flow${F}" data-id="${O}"><rect x="${Z(q-g.w/2)}" y="${Z(V-g.h/2)}" width="${Z(g.w)}" height="${Z(g.h)}" rx="${Qe}"${Re(T.colorIndex??fe.size,"0.06",o.style)}${o.style.shape}/>`+$e(o.label,K,V-g.h/2+8+o.label.height/2,` class="pele-cluster-label" fill="var(--_m)"${o.style.text}`,I)+"</g>";continue}let z=o.w,H=o.h,Q="",ce;if(o.shape===at){let K=Oe(T.colorIndex??fe.size),Y=H/2-ke-2,X=Y+(ke+2)/2;ce=`<rect x="${Z(-z/2)}" y="${Z(-H/2)}" width="${Z(z)}" height="${Z(H)}" rx="${Qe}"${Re(T.colorIndex??fe.size,"0.06",o.style)}${o.style.shape}/><path d="M${Z(-z/2+10)},${Z(Y)}H${Z(z/2-10)}" fill="none" stroke="${K}" stroke-dasharray="3 3"${o.style.line}/><path class="pele-collapsed-mark" d="${De(-9,X)}${De(0,X)}${De(9,X)}" fill="${K}" stroke="none"/>`}else{let K=fe.get(T.kind??"task")??1;Q=` pele-kind-${T.kind??"task"}`,ce=Lt(o.shape,z,H,Re(K,"0.14",o.style)+o.style.shape,` stroke="${Oe(K)}"`+o.style.line)}let te=$e(o.label,0,o.dy,` class="pele-label"${o.style.text}`,I);if(/ internal-link(?: |$)/.test(F+" ")&&T.label&&a.links!==!1){let K=bt(T.label),Y=vt(Tt(K),a)!==void 0,X=Le(K);te=`<a class="internal-link"${Y?` href="${X}"${Ct(a)}`:""} data-href="${X}">${te}</a>`,j.push({id:T.id,href:K,internal:!0})}let ae=ce+te;T.tooltip&&(ae=`<title>${Ee(T.tooltip)}</title>`+ae),T.link&&(ae=St(ae,T.link,T.id,j,a,T.linkTarget?` target="${Le(T.linkTarget)}"`:"")),w+=`<g class="pele-node pele-shape-${o.shape}${Q}${F}" data-id="${O}" transform="translate(${Z(q)},${Z(V)})">${ae}</g>`}let v="",E="",n=(s,o,g,T,q)=>{let V=s.style.length>0||s.cssCompiledStyles.length>0?Je(s.cssCompiledStyles.concat(s.style)):void 0,F=s.arrowTypeEnd,O=V!=null&&V.stroke?Le(V.stroke):"var(--_l)",z=s.thickness==="dotted"?"reference":F==="arrow_cross"?"failure":"sequence",H=Ze(s.classes.replace(/edge-thickness-normal|edge-pattern-solid|flowchart-link/g,""));v+=`<g class="pele-edge pele-edge-${z}${H}" data-id="${Ee(s.id)}"${(V==null?void 0:V.line)??""}><path d="${g.d}"${s.thickness==="dotted"?' stroke-dasharray="3 4"':""}/>`+Nt(F,g.ex,g.ey,g.edx,g.edy,O)+"</g>",o.width>0&&(E+=Rt(s.id,o,T,q,(V==null?void 0:V.text)??"",I))},u=new Map;for(let s=0;s<p.length;s++){let o=p[s],g=x[s],T=A[s],q=g.arrowTypeEnd,V;if(o.src===o.dst){let F=N[o.src],O=u.get(o.src)??0;u.set(o.src,O+1),V=Mt(b[o.src],F.w,F.h,O,J(o.src),Ne,xe(q),o)}else{let F=o.route.slice();Se(F,0,N[o.src],b[o.src]),Se(F,F.length-3,N[o.dst],b[o.dst]),V=Ye(F,g.curve,0,xe(q))}n(g,T,V,o.labelX,o.labelY)}return S.forEach((s,o)=>n(s.edge,s.label,ee[o],oe[2*o],oe[2*o+1])),{svg:Dt("agentflow",D,W,l,a,t,$e(M,D/2,m+M.height/2,' class="pele-title" font-weight="var(--_tw)"')+(c?`<g class="pele-clusters">${c}</g>`:"")+(v?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${v}</g>`:"")+(E?`<g class="pele-edge-labels" font-size="${h}">${E}</g>`:"")+`<g class="pele-nodes">${w}</g>`),width:D,height:W,links:j}}function De(t,r){return`M${Z(t-1.75)},${Z(r)}a1.75,1.75 0 1 0 3.5,0a1.75,1.75 0 1 0 -3.5,0Z`}var Or={type:"agentflow",keepComments:!0,parse(t,r,a,d,i){let l=r.flowchart??{},h=new Yt({inheritDir:l.inheritDir===!0,direction:typeof r.direction=="string"?r.direction:void 0,lineOffset:d,maxEdges:i.maxEdges});return a&&(h.title=a),fr(t,h),ct(h,r),h},render:Tr};export{Or as agentflow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as re,s as ie,I as ae,g as J,E as K}from"./HWDLEDTA-C_JcdBMO.js";function de(o){return o==="BT"||o==="LR"||o==="RL"?o:"TB"}var fe=4e4;function he(o,u,E,X){for(let x of o)x.x+=E,x.y+=X;for(let x of u){for(let b=0;b<x.route.length;b+=3)x.route[b]+=E,x.route[b+1]+=X;x.labelX+=E,x.labelY+=X}}function ue(o,u,E=-1){return{w:o,h:u,parent:E,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function le(o){return o==="TB"?0:o==="BT"?2:o==="LR"?3:1}function N(o){return o+2&3}function ge(o,u,E,X){let x=o.length,b=new Map,w=[],A=(e,l)=>{let t={id:e,dir:l,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return b.set(e,t),t},H=A(-1,E),W=[];for(let e=0;e<x;e++)W.push([]);let P=[];for(let e=0;e<x;e++){let l=o[e].parent;l>=0&&l<x&&l!==e&&o[l].isGroup?W[l].push(e):(o[e].parent=-1,P.push(e))}H.items=P,w.push(H);let G=new Int32Array(x),U=new Uint8Array(x),Q=e=>{for(let l=e;l<w.length;l++){let t=w[l];for(let s of t.items)if(U[s]=1,G[s]=t.id<0?0:G[t.id]+1,o[s].isGroup){let f=A(s,o[s].dir??t.dir);f.items=W[s],w.push(f)}}};Q(0);for(let e=0;e<x;e++){if(U[e])continue;let l=o[e].parent;if(W[l]=W[l].filter(t=>t!==e),o[e].parent=-1,H.items.push(e),U[e]=1,G[e]=0,o[e].isGroup){let t=w.length,s=A(e,o[e].dir??E);s.items=W[e],w.push(s),Q(t)}}for(let e=w.length-1;e>0;e--){let l=w[e],t=1/0;for(let s of l.items)o[s].seq<t&&(t=o[s].seq);t!==1/0&&(o[l.id].seq=t)}for(let e of w)e.items.sort((l,t)=>o[l].seq-o[t].seq||l-t);let S=0;for(let e of u){let l=e.src,t=e.dst,s=0;for(;G[l]>G[t];s++)l=o[l].parent;for(;G[t]>G[l];s++)t=o[t].parent;for(;l!==t&&o[l].parent!==o[t].parent;s+=2)l=o[l].parent,t=o[t].parent;l!==t&&(S+s>fe?(e.src=l,e.dst=t):S+=s)}let V=[],Z=[];for(let e=0;e<u.length;e++){let l=u[e];if(l.route=[],l.src===l.dst){V.push(e);continue}let t=l.src,s=l.dst,f=[],n=[];for(;G[t]>G[s];)f.push(t),t=o[t].parent;for(;G[s]>G[t];)n.push(s),s=o[s].parent;if(t===s){Z.push(e);continue}for(;o[t].parent!==o[s].parent;)f.push(t),n.push(s),t=o[t].parent,s=o[s].parent;b.get(o[t].parent).edges.push({e,a:t,b:s});for(let[a,c]of[[f,!0],[n,!1]])for(let y of a){let r=b.get(o[y].parent),h={e,inner:y,out:c,side:0,px:0,py:0,route:[]};r.ports.push(h),r.portOf.set(e*2+(c?0:1),h)}}let B=new Int32Array(x),F=(e,l,t)=>(t?l.src:l.dst)!==e,_=(e,l)=>{let t=e.dir==="TB"||e.dir==="BT",s=le(e.dir),f=[],n=[];e.items.forEach((r,h)=>{B[r]=h;let p=o[r],m=l?J(t?p.w:p.h,t?p.h:p.w):J(0,0);m.span=p.isGroup?Math.min(p.span,m.w-2*p.padX):p.span,f.push(m)});let a=(r,h,p)=>o[r].isGroup&&F(r,u[h],p),c=(r,h,p)=>{if(!l||!o[r].isGroup||!F(r,u[h],p))return 0;let m=b.get(r).portOf.get(h*2+(p?0:1));return t?m.px-o[r].w/2:m.py-o[r].h/2};for(let r of e.edges){let h=u[r.e],p=K(B[r.a],B[r.b],h.minlen);l&&(p.labelW=t?h.labelW:h.labelH,p.labelH=t?h.labelH:h.labelW,p.tailDx=c(r.a,r.e,!0),p.headDx=c(r.b,r.e,!1),p.tailFixed=a(r.a,r.e,!0),p.headFixed=a(r.b,r.e,!1)),n.push(p)}let y=new Int32Array(e.ports.length).fill(-1);return e.ports.forEach((r,h)=>{if(r.side===s||r.side===N(s)){let p=f.length;f.push(J(0,0,r.side===s?3:4)),y[h]=p;let m=r.out?K(B[r.inner],p):K(p,B[r.inner]);r.out?(m.tailDx=c(r.inner,r.e,!0),m.tailFixed=a(r.inner,r.e,!0)):(m.headDx=c(r.inner,r.e,!1),m.headFixed=a(r.inner,r.e,!1)),n.push(m)}else f[B[r.inner]].pin=r.side===0||r.side===3?-1:1}),{lnodes:f,ledges:n,dummies:y}};for(let e of w){for(let n of e.ports)o[n.inner].isGroup&&F(n.inner,u[n.e],n.out)&&(b.get(n.inner).portOf.get(n.e*2+(n.out?0:1)).side=n.side);if(e.edges.length===0)continue;let l=!1;for(let n of e.edges){let a=u[n.e];(o[n.a].isGroup&&a.src!==n.a||o[n.b].isGroup&&a.dst!==n.b)&&(l=!0)}if(!l)continue;let{lnodes:t,ledges:s}=_(e,!1);re(t,s),ie(t,s,1);let f=le(e.dir);e.edges.forEach((n,a)=>{let c=u[n.e],y=!s[a].reversed;o[n.a].isGroup&&c.src!==n.a&&(b.get(n.a).portOf.get(n.e*2).side=y?N(f):f),o[n.b].isGroup&&c.dst!==n.b&&(b.get(n.b).portOf.get(n.e*2+1).side=y?f:N(f))})}let $={width:0,height:0};for(let e=w.length-1;e>=0;e--){let l=w[e],t=l.id>=0?o[l.id]:void 0,s=l.dir==="TB"||l.dir==="BT",f=l.dir==="BT"||l.dir==="RL",{lnodes:n,ledges:a,dummies:c}=_(l,!0),y=ae(n,a,X),r=s?y.width:y.height,h=s?y.height:y.width,p=t?t.padX:0,m=t?t.padTop:0,q=Math.max(r+2*p,t?t.minW:0),L=h+m+(t?t.padBottom:0),oe=(q-r)/2,se=m,k=(i,g)=>oe+(s?i:f?y.height-g:g),z=(i,g)=>se+(s?f?y.height-g:g:i),C=s?0:1,ee=i=>{let g=[];for(let d=0;d<i.length;d+=2)g.push(k(i[d],i[d+1]),z(i[d],i[d+1]),C);return g};l.items.forEach((i,g)=>{o[i].x=k(n[g].x,n[g].y),o[i].y=z(n[g].x,n[g].y)}),l.edges.forEach((i,g)=>{let d=a[g];l.routes.set(i.e,ee(d.points));let T=u[i.e];T.labelW>0&&(T.labelX=k(d.labelX,d.labelY),T.labelY=z(d.labelX,d.labelY))});let ne=l.edges.length;l.ports.forEach((i,g)=>{let d=o[i.inner];if(c[g]>=0){let O=ee(a[ne++].points),te=i.out?O.length-3:0,I=O[te],D=O[te+1];i.side===0?D=0:i.side===2?D=L:i.side===3?I=0:I=q,i.out?O.push(I,D,C):O.unshift(I,D,C),i.px=I,i.py=D,i.route=O;return}let T=d.x,M=d.y;if(d.isGroup&&F(i.inner,u[i.e],i.out)){let O=b.get(i.inner).portOf.get(i.e*2+(i.out?0:1));T+=O.px-d.w/2,M+=O.py-d.h/2}else i.side===0?M-=d.h/2:i.side===2?M+=d.h/2:i.side===3?T-=d.w/2:T+=d.w/2;let Y=T,v=M;i.side===0?v=0:i.side===2?v=L:i.side===3?Y=0:Y=q;let R=i.side===0||i.side===2?0:1;i.px=Y,i.py=v,i.route=i.out?[T,M,R,Y,v,R]:[Y,v,R,T,M,R]}),t?(t.w=q,t.h=L):$={width:q,height:L}}for(let e of w){let l=e.x,t=e.y;for(let s of e.items){let f=o[s];if(f.x+=l,f.y+=t,f.isGroup){let n=b.get(s);n.x=f.x-f.w/2,n.y=f.y-f.h/2}}}let j=(e,l,t,s)=>{for(let f=0;f<l.length;f+=3){let n=l[f]+t,a=l[f+1]+s,c=e.length;c>=3&&Math.abs(e[c-3]-n)<.01&&Math.abs(e[c-2]-a)<.01||e.push(n,a,l[f+2])}};for(let e of w)for(let l of e.edges){let t=u[l.e],s=[],f=[];for(let a=t.src;o[a].parent!==e.id;a=o[a].parent)f.push(b.get(o[a].parent));for(let a of f)j(s,a.portOf.get(l.e*2).route,a.x,a.y);j(s,e.routes.get(l.e),e.x,e.y);let n=[];for(let a=t.dst;o[a].parent!==e.id;a=o[a].parent)n.push(b.get(o[a].parent));for(let a=n.length-1;a>=0;a--)j(s,n[a].portOf.get(l.e*2+1).route,n[a].x,n[a].y);t.route=s,t.labelW>0&&(t.labelX+=e.x,t.labelY+=e.y)}for(let e of Z){let l=u[e],t=o[l.src],s=o[l.dst];l.route=[t.x,t.y,0,s.x,s.y,0],l.labelX=(t.x+s.x)/2,l.labelY=(t.y+s.y)/2}for(let e of V){let l=u[e],t=o[l.src];l.labelX=t.x+t.w/2+28+l.labelW/2,l.labelY=t.y}return $}export{de as b,ue as d,ge as m,he as p};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var Qe=Object.defineProperty;var Ue=(e,a,s)=>a in e?Qe(e,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[a]=s;var $=(e,a,s)=>Ue(e,typeof a!="symbol"?a+"":a,s);import{g as Ze,s as P,a as Be,A as Ge}from"./WEVWDWVA-nohBBhTA.js";import{s as Ne,T as B}from"./UEXXS2NB-Dkz_tz-N.js";import{x as Je,H as Xe,i as He,e as G,L as Ye}from"./lazy-CKqR1774.js";import{c as je}from"./DKTLEL5E-B7ILCVTH.js";import{D as Ve,a as J}from"./HWDLEDTA-C_JcdBMO.js";import{x as c,f as X,$ as et,y as We,m as de,a as tt}from"./RZSVICHU-BiwjruZZ.js";import"./index-392ivruk.js";var it=class{constructor(){$(this,"type","timeline");$(this,"title");$(this,"accTitle");$(this,"accDescr");$(this,"direction","LR");$(this,"sections",[]);$(this,"periods",[]);$(this,"currentSection","")}getCommonDb(){return this}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,"")}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
|
-
`)}setDirection(e){this.direction=e}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,a,s){this.periods.push({text:e,events:s?[s]:[],section:this.currentSection,sectionIndex:this.sections.length-1})}addEvent(e){let a=this.periods[this.periods.length-1];if(!a)throw new Je("An event needs a time period before it.","semantic",{type:"timeline"});a.events.push(e)}},rt=["$end","EOF","INVALID","NEWLINE","timeline","timeline_lr","timeline_td","title","acc_title","acc_title_value","acc_descr","acc_descr_value","acc_descr_multiline_value","section","period","event"];function at(e){let a=e.length,s=[],d=[],p=[],v={types:s,texts:d,starts:p},r=0,o=(u,i)=>{s.push(u),d.push(e.slice(r,i)),p.push(r),r=i};for(;r=Ze(e,r),!(r>=a);){let u=e.charCodeAt(r),i=r+1;if(u===10){for(;e.charCodeAt(i)===10;)i++;o(3,i);continue}if(P(e,r,"timeline")){for(i=r+8;e.charCodeAt(i)===32||e.charCodeAt(i)===9;)i++;let x=P(e,i,"lr");if(i>r+8&&(x||P(e,i,"td"))&&!He(e.charCodeAt(i+2))){o(x?5:6,i+2);continue}if(!He(e.charCodeAt(r+8))){o(4,r+8);continue}}if(P(e,r,"title")&&G(e.charCodeAt(r+5))&&r+6<a&&e.charCodeAt(r+6)!==10){o(7,Be(e,r+6));continue}if(i=Ge(e,r,v,8),i!==r){r=i;continue}if(P(e,r,"section")&&G(e.charCodeAt(r+7))){for(i=r+8;i<a&&e.charCodeAt(i)!==58&&e.charCodeAt(i)!==10;)i++;if(i>r+8){o(13,i);continue}}if(u!==58){i=r+1;for(let x=e.charCodeAt(i);i<a&&x!==35&&x!==58&&x!==10;x=e.charCodeAt(++i));o(14,i);continue}if(G(e.charCodeAt(r+1))){for(i=r+2;i<a;i++){let x=e.charCodeAt(i);if(x===10||x===58&&G(e.charCodeAt(i+1)))break}if(i>r+2){o(15,i);continue}}o(2,r+1)}return(p.length===0||p[p.length-1]<a)&&o(1,a),o(0,a),v}var st="'EOF', 'SPACE', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'section', 'period', 'event'";function ot(e,a){let{types:s,texts:d,starts:p}=at(e),v=(o,u)=>{let i=s[o]===0?"1":rt[s[o]];throw Ye("timeline",e,p[o],`Expecting ${u}, got '${i}'`)},r=s[0];r!==4&&r!==5&&r!==6&&v(0,"'timeline', 'timeline_lr', 'timeline_td'"),r!==4&&a.setDirection(r===5?"LR":"TD");for(let o=1;;o++){let u=d[o];switch(s[o]){case 3:break;case 7:a.getCommonDb().setDiagramTitle(u.substring(6));break;case 8:a.getCommonDb().setAccTitle(d[++o].trim());break;case 10:a.getCommonDb().setAccDescription(d[++o].trim());break;case 12:a.getCommonDb().setAccDescription(u.trim());break;case 13:a.addSection(u.substring(8));break;case 14:a.addTask(u,0,"");break;case 15:a.addEvent(u.substring(2));break;case 1:return;default:v(o,st)}}}var Y=12,Fe=8,nt=152,lt=216,ct=264,T=20,W=20,j=14,Q=8,me=8,ee=12,Oe=' fill="var(--_bg)"',Re=' fill="none" stroke="var(--_b)"';function fe(e,a,s,d,p){return`<rect x="${c(e)}" y="${c(a)}" width="${c(s)}" height="${c(d)}" rx="${tt}"${p}/>`}function ht(e,a,s){return e.direction==="TD"?qe(e,a,s,!0):je(s,d=>qe(e,a,s,d))}function qe(e,a,s,d){var Te;let p=s.fontSize??16,v=Math.round(p*.875),r=s.measurer??Xe(s.fontFamily),o=s.padding??8,u=((Te=a.timeline)==null?void 0:Te.disableMulticolor)!==!0,i=e.periods,x=e.sections.length>0,C=e.sections.map((t,n)=>({section:n,periods:[]})),te={section:-1,periods:[]};i.forEach((t,n)=>(C[t.sectionIndex]??te).periods.push(n)),te.periods.length>0&&C.unshift(te);let ie=d&&s.maxWidth!==void 0&&s.maxWidth>0?s.maxWidth-2*o:1/0,pe=W+j*2+4*Y,U=Math.min(nt,Math.max(80,Math.round((ie-pe)*.38))),ge=Math.min(ct,Math.max(110,ie-pe-U)),E=U,re=()=>d?ge:E,F=i.map(t=>Ne(t.text,r,p,E)),w=i.map(t=>t.events.map(n=>Ne(n,r,v,re()))),S=0;for(let t of F)S=Math.max(S,t.width);if(!d)for(let t of w)for(let n of t)S=Math.max(S,n.width);let ue=S>E;if(d)for(let t of w)for(let n of t)ue||(ue=n.width>ge);ue&&(E=Math.min(Math.max(Math.ceil(S),U),ie===1/0?lt:U),F=i.map(t=>B(t.text,r,p,E)),w=i.map(t=>t.events.map(n=>B(n,r,v,re()))));let ze=Math.round(p*1.5),D=E+2*Y,ae=re()+2*Y,Z=t=>Math.max(t.height,ze)+2*Fe,xe=t=>Math.max(t.height,Math.round(v*1.5))+2*Fe,Me=(t,n)=>t.section>=0?de(t.section):x?"var(--_m)":de(u?n:0),ve=!1;for(let t of w)t.length>0&&(ve=!0);let se=0;for(let t of C)se+=Math.max(t.periods.length,1);let O=D+T,R=i.length>0,I=d?D+(ve?W+j*2+ae:R?W+ee:0):se>0?se*O-T+(R?ee+J:0):0,q=B(e.title,r,p,Math.max(I,320),1),Ke=q.height>0?q.height+16:0,_e=Math.max(I,q.width),k=o+(_e-I)/2,z=o+Ke,$e=(t,n)=>B(e.sections[t.section],r,p,n-2*Y,1),be=(t,n,m,h,l,g)=>fe(m,h,l,g,` fill="${de(t.section)}"`)+X(n,m+l/2,h+g/2,' font-weight="var(--_hw)"'+Oe),Ae=(t,n,m,h,l)=>fe(m,h,D,l,` fill="${n}"`)+X(F[t],m+D/2,h+l/2,Oe),Ce=(t,n,m,h,l)=>'<g class="pele-node pele-event">'+fe(m,h,ae,l,` fill="${n}" fill-opacity="0.16"`)+X(t,m+ae/2,h+l/2,` font-size="${v}"`)+"</g>",we=(t,n,m)=>`<circle class="pele-dot" cx="${c(t)}" cy="${c(n)}" r="4" fill="${m}" stroke="var(--_bg)" stroke-width="2"/>`,De=t=>t.section>=0?`<g class="pele-cluster pele-section" data-id="${We(e.sections[t.section].trim())}">`:"",ke=t=>`<g class="pele-node pele-period" data-id="${We(i[t].text.trim())}">`,M="",oe;if(d){let t=k+D+W,n=t+j,m=n+j,h=z;for(let l of C){if(M+=De(l),l.section>=0){let g=$e(l,I),_=Z(g);M+=be(l,g,k,h,I,_),h+=_+me+4}for(let g of l.periods){let _=Me(l,g),L=Z(F[g]),f=h+L/2,b=`M${c(k+D)},${c(f)}H${c(t)}`,N="",y=h,H=f;for(let A of w[g]){let K=xe(A);H=y+K/2,b+=`M${c(n)},${c(H)}H${c(m)}`,N+=Ce(A,_,m,y,K),y+=K+Q}N&&(b+=`M${c(t)},${c(f)}H${c(n)}V${c(H)}`),M+=ke(g)+Ae(g,_,k,h,L)+`<path class="pele-edge" d="${b}"${Re}/>`+we(t,f,_)+N+"</g>",h=Math.max(h+L,y-Q)+T}l.periods.length===0&&(h+=T-me-4),l.section>=0&&(M+="</g>")}if(C.length>0&&(h-=T),R){let l=h+ee+J;M=`<path class="pele-axis" d="M${c(t)},${c(z)}V${c(l-J+1)}" fill="none" stroke="var(--_l)"/>`+Ve("arrow_point",t,l,0,1,"var(--_l)")+M,h=l}oe=h+o}else{let t=0,n=C.map(f=>{if(f.section<0)return;let b=$e(f,Math.max(f.periods.length,1)*O-T);return t=Math.max(t,Z(b)),b}),m=0;for(let f of F)m=Math.max(m,Z(f));let h=z+(x?t+me:0),l=h+m+(m>0?W:0),g=l+W,_=R?l+ee:z+t,L=0;if(C.forEach((f,b)=>{let N=Math.max(f.periods.length,1),y=k+L*O;M+=De(f);let H=n[b];H&&(M+=be(f,H,y,z,N*O-T,t)),f.periods.forEach((A,K)=>{let le=Me(f,A),ce=y+K*O,he=ce+D/2,Ee=`M${c(he)},${c(h+m)}V${c(w[A].length>0?g:l)}`,Se="",V=g;for(let Ie of w[A]){let Le=xe(Ie);V>g&&(Ee+=`M${c(he)},${c(V-Q)}V${c(V)}`),Se+=Ce(Ie,le,ce,V,Le),V+=Le+Q}_=Math.max(_,V-Q),M+=ke(A)+Ae(A,le,ce,h,m)+`<path class="pele-edge" d="${Ee}"${Re}/>`+we(he,l,le)+Se+"</g>"}),f.section>=0&&(M+="</g>"),L+=N}),R){let f=k+I;M=`<path class="pele-axis" d="M${c(k)},${c(l)}H${c(f-J+1)}" fill="none" stroke="var(--_l)"/>`+Ve("arrow_point",f,l,1,0,"var(--_l)")+M}oe=_+o}let ne=Math.ceil(_e+2*o),ye=Math.ceil(Math.max(oe,o*2)),Pe=X(q,ne/2,o+q.height/2,' class="pele-title" font-weight="var(--_tw)"')+M;return{svg:et("timeline",ne,ye,p,s,e,Pe),width:ne,height:ye,links:[]}}var vt={type:"timeline",parse(e,a,s){let d=new it;return d.title=s,ot(e,d),d},render:ht};export{vt as timeline};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{i as Le}from"./PUZGS23X-n6IKOr7S.js";import{k as Ne,A as je,H as He}from"./KQOEJWJY-DKTXya68.js";import{c as Ve}from"./DKTLEL5E-B7ILCVTH.js";import{U as Ge,z as Be,Y as Oe,x as Re,D as We,$ as Ke,v as Ye,G as Ue,O as Ze,P as qe,H as Je}from"./VMV7XPHP-6QkisQwm.js";import{w as $e,D as oe}from"./HWDLEDTA-C_JcdBMO.js";import{_ as U,a as ie,y as B,x as o,f as q,m as se,$ as ke,b as Ie,p as Se}from"./RZSVICHU-BiwjruZZ.js";import{C as Xe,x as Pe,H as De,$ as Ce}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";var Qe=new Map([["ui","ui"],["pcr","processor"],["processor","processor"],["rmo","readmodel"],["readmodel","readmodel"],["cmd","command"],["command","command"],["evt","event"],["event","event"]]),et=new Map([["trigger",[0,"UI/Automation","UI/A: "]],["state",[100,"Command/Read Model","C/RM: "]],["stream",[200,"Events","Stream: "]]]);function tt(a){return a==="ui"||a==="processor"?"trigger":a==="event"?"stream":"state"}function pe(a){let t=a.indexOf("{"),s=a.lastIndexOf("}"),h=(t!==-1&&s>t?a.slice(t+1,s):t===-1&&a.length>=2?a.slice(1,-1):"").replace(/\r/g,"").split(`
|
|
2
|
-
`);for(;h.length>0&&h[0].trim()==="";)h.shift();for(;h.length>0&&h[h.length-1].trim()==="";)h.pop();let $=1/0;for(let m of h)m.trim()!==""&&($=Math.min($,m.length-m.trimStart().length));return h.map(m=>m.slice(Math.min($,m.length)).trimEnd()).join(`
|
|
3
|
-
`)}function at(a,t){let s=new Set;for(let l of a.frames){if(s.has(l.name)){let v=Xe(a.$source,l.$offset).line;throw new Pe(`Duplicate event modeling frame ID "${l.name}" on line ${v}`,"semantic",{type:"eventmodeling",line:v})}s.add(l.name)}let h=new Map;for(let l of a.dataEntities)h.has(l.name)||h.set(l.name,l.dataBlockValue);let $=new Map,m=new Map,x=(l,v)=>{let M=tt(l),A=v===void 0?M:`${M} ${v}`,z=$.get(A);if(!z){let[F,y,T]=et.get(M),S=F;v!==void 0&&(S=m.get(M)??F+1,m.set(M,S+1)),z={index:S,label:v===void 0?y:T+v,group:M,namespace:v},$.set(A,z)}return z},C=[],c=new Map,p=[];a.frames.forEach((l,v)=>{let M=l.entityIdentifier.split("."),A=M.length===2?M[0]:void 0,z=Qe.get(l.modelEntityType)??"event",F=l.dataInlineValue===void 0?void 0:pe(l.dataInlineValue);if(l.dataReference){let T=h.get(l.dataReference.$refText);T!==void 0&&(F=pe(T))}let y={id:l.name,kind:z,entity:l.entityIdentifier,name:M.length===2?M[1]:l.entityIdentifier,namespace:A,reset:l.$type==="EmResetFrame",lane:x(z,A),data:F,dataType:l.dataType};if(C.push(y),c.set(y.id,y),l.sourceFrames.length>0){let T=new Set(l.sourceFrames.map(S=>S.$refText));for(let S of C)T.has(S.id)&&p.push({source:S,target:y})}else if(v>0&&!y.reset){for(let T=v-1;T>=0;T--)if(C[T].lane!==y.lane){p.push({source:C[T],target:y});break}}});let E=l=>l.map(v=>v.entityIdentifier.$refText);return{type:"eventmodeling",title:a.title&&Oe(a.title)||t,accTitle:a.accTitle?Be(a.accTitle).replace(/^\s+/g,""):void 0,accDescr:a.accDescr?Ge(a.accDescr).replace(/\n\s+/g,`
|
|
4
|
-
`):void 0,boxes:C,lanes:[...$.values()].sort((l,v)=>l.index-v.index),relations:p,notes:a.noteEntities.map(l=>({frame:l.sourceFrame.$refText,text:pe(l.dataBlockValue),dataType:l.dataType})),specifications:a.gwtEntities.map(l=>({frame:l.sourceFrame.$refText,given:E(l.givenStatements),when:E(l.whenStatements),then:E(l.thenStatements)})),entities:a.modelEntities.map(l=>l.name)}}var xe={name:"EM_ID",pattern:/[_a-zA-Z][\w_]*/y},Q=a=>({name:a,pattern:a,longer:[xe]}),ae=a=>({name:a,pattern:a}),it=["resetframe","readmodel","processor","timeframe","command","entity","event","jsobj","figma","given","json","salt","html","text","data","note","when","then","rmo","cmd","evt","pcr","uri"],we=[{...Je("eventmodeling"),longer:[xe]},...it.map(Q),ae("->>"),Q("gwt"),Q("ui"),Q("md"),Q("tf"),ae("[["),ae("]]"),Q("rf"),ae("`"),ae("."),xe,{name:"EM_FID",pattern:/\d{1,3}/y},{name:"EM_DATA_INLINE",pattern:/\{(.*)\}|"(.*)"|'(.*)'/y},{name:"EM_DATA_BLOCK",pattern:/\{[\t ]*\r?\n(?:[\S\s]*?\r?\n)?\}(?:\r?\n|(?!\S))/y},Le("EM_ACC_DESCR"),{...Ke,name:"EM_ACC_TITLE"},{...Ye,name:"EM_TITLE"},{name:"EM_WS",pattern:/\s+/y,hidden:!0},{...Ue,name:"EM_YAML"},{...Ze,name:"EM_DIRECTIVE"},{...qe,name:"EM_SINGLE_LINE_COMMENT"},{name:"EM_ML_COMMENT",pattern:/\/\*[\s\S]*?\*\//y,hidden:!0},{name:"EM_SL_COMMENT",pattern:/\/\/[^\n\r]*/y,hidden:!0}],k=a=>we.findIndex(t=>t.name===a),me=a=>new Set(a.map(k)),g={keyword:0,arrow:k("->>"),open:k("[["),close:k("]]"),tick:k("`"),dot:k("."),id:k("EM_ID"),frameId:k("EM_FID"),inline:k("EM_DATA_INLINE"),block:k("EM_DATA_BLOCK"),accDescr:k("EM_ACC_DESCR"),accTitle:k("EM_ACC_TITLE"),title:k("EM_TITLE"),entity:k("entity"),data:k("data"),note:k("note"),gwt:k("gwt"),given:k("given"),when:k("when"),then:k("then")},Me=me(["tf","timeframe"]),nt=me(["rf","resetframe"]),ce=me(["rmo","readmodel","ui","cmd","command","evt","event","pcr","processor"]),lt=me(["json","jsobj","figma","salt","uri","md","html","text"]);function rt(a){let t=new Re(We(a,we,"eventmodeling"),we,"eventmodeling"),s={$type:"EventModel",modelEntities:[],frames:[],dataEntities:[],noteEntities:[],gwtEntities:[],$source:a},h=c=>t.kinds[t.i]===c,$=(c,p)=>c.has(t.kinds[t.i])?t.take():t.fail(p),m=()=>{let c=t.expect(g.id);for(;t.accept(g.dot);)c+="."+t.expect(g.id);return c},x=()=>{if(!t.accept(g.tick))return;let c=$(lt,"a data type");return t.expect(g.tick),c},C=()=>{let c=[];do $(ce,"an entity type"),c.push({$type:"EmGwtStatement",entityIdentifier:{$refText:t.expect(g.id)}});while(ce.has(t.kinds[t.i]));return c};for(t.expect(g.keyword);!h(-1);){let c=t.kinds[t.i];if(c===g.accDescr)s.accDescr=t.take();else if(c===g.accTitle)s.accTitle=t.take();else if(c===g.title)s.title=t.take();else if(c===g.entity)t.i++,s.modelEntities.push({$type:"EmModelEntity",name:m()});else if(Me.has(c)||nt.has(c)){let p={$type:Me.has(c)?"EmTimeFrame":"EmResetFrame",name:"",modelEntityType:"",entityIdentifier:"",sourceFrames:[],$offset:t.tokens.starts[t.i]};for(t.i++,p.name=t.expect(g.frameId),p.modelEntityType=$(ce,"an entity type"),p.entityIdentifier=m();t.accept(g.arrow);)p.sourceFrames.push({$refText:t.expect(g.frameId)});if(t.accept(g.open)&&(p.dataReference={$refText:t.expect(g.id)},t.expect(g.close)),h(g.tick)||h(g.inline)){let E=x();E!==void 0&&(p.dataType=E),p.dataInlineValue=t.expect(g.inline)}s.frames.push(p)}else if(c===g.data){t.i++;let p={$type:"EmDataEntity",name:t.expect(g.id),dataBlockValue:""},E=x();E!==void 0&&(p.dataType=E),p.dataBlockValue=t.expect(g.block),s.dataEntities.push(p)}else if(c===g.note){t.i++;let p={$type:"EmNoteEntity",sourceFrame:{$refText:t.expect(g.frameId)},dataBlockValue:""},E=x();E!==void 0&&(p.dataType=E),p.dataBlockValue=t.expect(g.block),s.noteEntities.push(p)}else if(c===g.gwt){t.i++;let p={$type:"EmGwt",sourceFrame:{$refText:t.expect(g.frameId)},givenStatements:[],whenStatements:[],thenStatements:[]};t.expect(g.given),p.givenStatements=C(),t.accept(g.when)&&(p.whenStatements=C()),t.expect(g.then),p.thenStatements=C(),s.gwtEntities.push(p)}else t.fail("a frame, an entity, a data block, a note, or a specification")}return s}var ze=new Map([["command",0],["event",1],["readmodel",2],["processor",6]]),D=12,V=10,ot=96,_e=16,st=80,re=12,Ee=8,ht=48,Te=80,Ae=8;function ge(a,t){let s=[];for(let h of Ce(a).split(`
|
|
5
|
-
`)){if(h.length<=t){s.push(h);continue}for(let $=0;$<h.length;$+=t)s.push(h.slice($,$+t))}return s}function he(a,t,s,h,$){let m="";for(let x=0;x<a.length;x++)a[x]!==""&&(m+=`<tspan x="${o(t)}" y="${o(s+x*h)}">${Ie(a[x])}</tspan>`);return m===""?"":`<text${$} xml:space="preserve">${m}</text>`}function mt(a,t,s){return Ve(s,h=>dt(a,t,s,h))}function dt(a,t,s,h){if(h)return ct(a,s);let $=s.fontSize??16,m=Math.round($*.875),x=Math.round($*.8125),C=Math.round($*.75),c=Math.round(C*1.4),p=Math.round(x*1.5),E=s.measurer??De(s.fontFamily,s.fontFamilyMono),l=s.padding??8,v=(e,i,n)=>{let u=0;for(let I of e)u=Math.max(u,E.width(I,i,n));return u},M=new Map,A=0;for(let e of a.lanes){let i=U(e.label,!1,E,x,4e3,1);A=Math.max(A,i.width),M.set(e,{lane:e,label:i,right:-1/0,y:0,h:0})}A+=2*re;let z=[],F=new Map,y;for(let e of a.boxes){let i=M.get(e.lane),n=U(e.name,!1,E,m,4e3,1),u=e.data?ge(e.data,ht):[],I=Math.max(ot,Math.max(n.width,v(u,C,4))+2*D),L=2*V+n.height+(u.length>0?6+u.length*c:0),j=0;if(y){let K=y.x+Math.max(y.w/2,y.w-st);j=y.box.lane===e.lane?i.right+_e:Math.max(K,i.right+_e)}let N={box:e,name:n,data:u,x:j,y:0,w:I,h:L};i.right=j+I,i.h=Math.max(i.h,L),z.push(N),F.set(e,N),y=N}let T=0;for(let e of z)T=Math.max(T,e.x+e.w);let S=A+T+re,R=U(a.title,!1,E,$,4e3,1),ne=R.height>0?R.height+12:0,O=l,J=l+ne,W=J,ee="";for(let e of M.values())e.y=W,e.h+=2*re,ee+=`<g class="pele-cluster pele-em-lane" data-id="${B(e.lane.label)}"><rect x="${o(O)}" y="${o(W)}" width="${o(S)}" height="${o(e.h)}" rx="${ie}" fill="var(--_s)"/>`+q(e.label,O+re+e.label.width/2,W+e.h/2,` class="pele-cluster-label" font-size="${x}" font-weight="var(--_hw)" fill="var(--_m)"`)+"</g>",W+=e.h+Ee;let X=M.size>0?W-Ee:J,P="";for(let e of z){let i=M.get(e.box.lane);e.x+=O+A,e.y=i.y+(i.h-e.h)/2;let n=ze.get(e.box.kind),u=`x="${o(e.x)}" y="${o(e.y)}" width="${o(e.w)}" height="${o(e.h)}" rx="${ie}"`,I=n===void 0?`<rect ${u} fill="var(--_bg)" stroke="var(--_b)"/>`:`<rect ${u} fill="var(--_bg)"/><rect ${u} fill="${se(n)}" fill-opacity="0.22" stroke="${se(n)}"/>`,L=e.y+V+e.name.height/2,j=q(e.name,e.x+e.w/2,L,` class="pele-label" font-size="${m}" font-weight="var(--_hw)"`)+he(e.data,e.x+D,e.y+V+e.name.height+6+c/2+C*.35,c,` class="pele-em-data" font-family="${Se}" font-size="${C}"`);P+=`<g class="pele-node pele-em-${e.box.kind}${e.box.reset?" pele-em-reset":""}" data-id="${B(e.box.id)}">${I}${j}</g>`}let te="",le=$e("arrow_point");for(let e of a.relations){let i=F.get(e.source),n=F.get(e.target);if(!i||!n||i===n)continue;let u,I;if(i.box.lane===n.box.lane){let L=n.x>=i.x,j=L?i.x+i.w:i.x,N=L?n.x:n.x+n.w,K=i.y+i.h/2,Y=n.y+n.h/2,Z=N>=j?1:-1;u=`M${o(j)},${o(K)}L${o(N-Z*le)},${o(Y)}`,I=oe("arrow_point",N,Y,Z,0,"var(--_l)")}else{let L=n.y>i.y,j=Math.max(i.x,n.x),N=Math.min(i.x+i.w,n.x+n.w),K=Fe=>Math.min(24,Fe/4),Y=N-j>=16?(j+N)/2:n.x>i.x?i.x+i.w-K(i.w):i.x+K(i.w),Z=N-j>=16?Y:n.x>i.x?n.x+K(n.w):n.x+n.w-K(n.w),de=L?i.y+i.h:i.y,ue=L?n.y:n.y+n.h,ye=L?1:-1,fe=ue-ye*le,ve=(de+fe)/2;u=Y===Z?`M${o(Y)},${o(de)}V${o(fe)}`:`M${o(Y)},${o(de)}C${o(Y)},${o(ve)} ${o(Z)},${o(ve)} ${o(Z)},${o(fe)}`,I=oe("arrow_point",Z,ue,0,ye,"var(--_l)")}te+=`<g class="pele-edge" data-id="${B(e.source.id)}-${B(e.target.id)}"><path d="${u}" fill="none" stroke="var(--_l)"/>${I}</g>`}let r=new Map;for(let e of a.boxes)r.set(e.id,e.name);let d="",f=0,w=(e,i,n,u)=>{let I=U(`${i} · ${n}${r.has(n)?" "+r.get(n):""}`,!1,E,x,4e3,1),L=Math.max(I.width,v(u,x,0))+2*D,j=2*V+I.height+u.length*p,N=X+(d===""&&M.size===0?0:Ae);d+=`<g class="pele-em-${e}" data-id="${B(n)}"><rect x="${o(O)}" y="${o(N)}" width="${o(L)}" height="${o(j)}" rx="${ie}" fill="var(--_bg)" stroke="var(--_b)"/>`+q(I,O+D+I.width/2,N+V+I.height/2,` font-size="${x}" font-weight="var(--_hw)"`)+he(u,O+D,N+V+I.height+p/2+x*.35,p,` font-size="${x}"`)+"</g>",X=N+j,f=Math.max(f,L)};for(let e of a.notes)w("note","Note",e.frame,ge(e.text,Te));for(let e of a.specifications){let i=[`Given ${e.given.join(", ")}`];e.when.length>0&&i.push(`When ${e.when.join(", ")}`),i.push(`Then ${e.then.join(", ")}`),w("specification","Given / When / Then",e.frame,i.flatMap(n=>ge(n,Te)))}let _=Math.max(M.size>0?S:0,f,R.width),b=Math.ceil(_+2*l),H=Math.ceil(X+l),G=q(R,b/2,l+R.height/2,' class="pele-title" font-weight="var(--_tw)"')+ee+te+P+d;return{svg:ke("eventmodeling",b,H,$,s,a,G),width:b,height:H,links:[]}}var be=8,ft=120,pt=20;function ct(a,t){let s=t.fontSize??16,h=Math.round(s*.875),$=Math.round(s*.75),m=t.padding??8,x=t.measurer??De(t.fontFamily,t.fontFamilyMono),C=Math.max(160,(t.maxWidth??320)-2*m),c=new Map(a.boxes.map((r,d)=>[r,d])),p=new Map,E=new Set;for(let r of a.relations){let d=c.get(r.source),f=c.get(r.target);if(d===void 0||f===void 0||d===f)continue;if(Math.abs(d-f)<2){E.add(a.boxes[Math.max(d,f)]);continue}let w=p.get(r.target);w?(w[0]=Math.min(w[0],d),w[1]=Math.max(w[1],d)):p.set(r.target,[Math.min(d,f),Math.max(d,f)])}let l=new Map,v=[];for(let[r,[d,f]]of[...p].sort((w,_)=>w[1][0]-_[1][0])){let w=v.findIndex(_=>_<d);w<0&&(w=v.length),v[w]=f,l.set(r,w)}let M=24+be*Math.max(0,v.length-1),A=Math.max(ft,C-M),z=A-2*D,F=U(a.title,!1,x,s,C,1),y=m+(F.height?F.height+12:0),T=m+F.height,S=Math.max(F.width,A+M),R="",ne="",O="",J=new Map,W=(r,d,f=0)=>He(Ce(r),x,d,z,f);a.boxes.forEach((r,d)=>{let f=E.has(r)?z-pt:z,w=Ne(U(r.lane.label,!1,x,h,f,1),x,f),_=U(r.name,!1,x,h,z-36,1),b=r.data?W(r.data,$,4):void 0,H=Math.max(A,w.width+2*D,_.width+2*D+36,((b==null?void 0:b.width)??0)+2*D),G=w.height+12,e=2*V+_.height+(b?b.height+6:0),i=ze.get(r.kind),n=y+G,u=`x="${o(m)}" y="${o(n)}" width="${o(H)}" height="${o(e)}" rx="${ie}"`;R+=`<g class="pele-cluster pele-em-lane" data-id="${B(r.lane.label)}">`+je(w,m+D,y,` class="pele-cluster-label" font-size="${h}" font-weight="var(--_hw)" fill="var(--_m)"`)+`<g class="pele-node pele-em-${r.kind}${r.reset?" pele-em-reset":""}" data-id="${B(r.id)}"><rect ${u} fill="var(--_bg)" stroke="var(--_b)"/>`+(i===void 0?"":`<rect ${u} fill="${se(i)}" fill-opacity="0.22" stroke="${se(i)}"/>`)+q(_,m+D+_.width/2,n+V+_.height/2,` class="pele-label" font-size="${h}" font-weight="var(--_hw)"`)+`<text class="pele-em-frame" x="${o(m+H-D)}" y="${o(n+V+h)}" text-anchor="end" font-size="${$}" fill="var(--_m)">${Ie(r.id)}</text>`+(b?he(b.lines.map(I=>I.map(L=>L.text).join("")),m+D,n+V+_.height+6+b.lineHeight/2+$*.35,b.lineHeight,` class="pele-em-data" font-family="${Se}" font-size="${$}"`):"")+"</g></g>",J.set(r,{y:n,h:e,w:H,index:d,lane:w.width}),S=Math.max(S,H+M),T=n+e,y=T+28});for(let r of a.relations){let d=J.get(r.source),f=J.get(r.target);if(!d||!f||d===f)continue;let w=f.y>d.y,_=w?1:-1,b=w?d.y+d.h:d.y,H=w?f.y:f.y+f.h,G,e;if(Math.abs(d.index-f.index)===1){let i=m+Math.max(Math.min(d.w,f.w)/2,D+(w?f:d).lane+16);G=`M${o(i)},${o(b)}V${o(H-_*$e("arrow_point"))}`,e=oe("arrow_point",i,H,0,_,"var(--_l)")}else{let i=m+S-M+12+be*(l.get(r.target)??0),n=d.y+d.h/2-5,u=f.y+f.h/2+5;G=`M${o(m+d.w)},${o(n)}H${o(i)}V${o(u)}H${o(m+f.w+$e("arrow_point"))}`,e=oe("arrow_point",m+f.w,u,-1,0,"var(--_l)")}ne+=`<g class="pele-edge" data-id="${B(r.source.id)}-${B(r.target.id)}"><path d="${G}" fill="none" stroke="var(--_l)"/>${e}</g>`}let ee=new Map(a.boxes.map(r=>[r.id,r.name])),X=(r,d,f,w)=>{let _=U(`${d} · ${f}${ee.has(f)?" "+ee.get(f):""}`,!1,x,h,z,1),b=W(w,h),H=Math.max(A,_.width+2*D,b.width+2*D),G=2*V+_.height+b.height;O+=`<g class="pele-em-${r}" data-id="${B(f)}"><rect x="${o(m)}" y="${o(y)}" width="${o(H)}" height="${o(G)}" rx="${ie}" fill="var(--_bg)" stroke="var(--_b)"/>`+q(_,m+D+_.width/2,y+V+_.height/2,` font-size="${h}" font-weight="var(--_hw)"`)+he(b.lines.map(e=>e.map(i=>i.text).join("")),m+D,y+V+_.height+b.lineHeight/2+h*.35,b.lineHeight,` font-size="${h}"`)+"</g>",T=y+G,y=T+Ae,S=Math.max(S,H)};for(let r of a.notes)X("note","Note",r.frame,r.text);for(let r of a.specifications){let d=[`Given ${r.given.join(", ")}`];r.when.length&&d.push(`When ${r.when.join(", ")}`),d.push(`Then ${r.then.join(", ")}`),X("specification","Given / When / Then",r.frame,d.join(`
|
|
6
|
-
`))}let P=Math.ceil(S+2*m),te=Math.ceil(T+m),le=q(F,P/2,m+F.height/2,' class="pele-title" font-weight="var(--_tw)"')+ne+R+O;return{svg:ke("eventmodeling",P,te,s,t,a,le),width:P,height:te,links:[]}}var _t={type:"eventmodeling",keepComments:!0,parse:(a,t,s)=>at(rt(a),s),render:mt};export{_t as eventmodeling};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var c=[["rect","proc","process","rectangle","squareRect"],["rounded","event","roundedRect"],["stadium","terminal","pill"],["fr-rect","subprocess","subproc","framed-rectangle","subroutine"],["cyl","db","database","cylinder"],["datastore","data-store"],["folder","directory"],["bucket"],["console"],["browser"],["person"],["circle","circ"],["bang"],["cloud"],["diam","decision","diamond","question"],["hex","hexagon","prepare"],["lean-r","lean-right","in-out","lean_right"],["lean-l","lean-left","out-in","lean_left"],["trap-b","priority","trapezoid-bottom","trapezoid"],["trap-t","manual","trapezoid-top","inv-trapezoid","inv_trapezoid"],["dbl-circ","double-circle","doublecircle"],["text"],["notch-rect","card","notched-rectangle"],["lin-rect","lined-rectangle","lined-process","lin-proc","shaded-process"],["sm-circ","start","small-circle","stateStart"],["fr-circ","stop","framed-circle","stateEnd"],["fork","join","forkJoin"],["hourglass","collate"],["brace","comment","brace-l"],["brace-r"],["braces"],["bolt","com-link","lightning-bolt"],["doc","document"],["delay","half-rounded-rectangle"],["h-cyl","das","horizontal-cylinder"],["lin-cyl","disk","lined-cylinder"],["curv-trap","curved-trapezoid","display"],["div-rect","div-proc","divided-rectangle","divided-process"],["tri","extract","triangle"],["win-pane","internal-storage","window-pane"],["f-circ","junction","filled-circle"],["notch-pent","loop-limit","notched-pentagon"],["flip-tri","manual-file","flipped-triangle"],["sl-rect","manual-input","sloped-rectangle"],["docs","documents","st-doc","stacked-document"],["st-rect","procs","processes","stacked-rectangle"],["bow-rect","stored-data","bow-tie-rectangle"],["cross-circ","summary","crossed-circle"],["tag-doc","tagged-document"],["tag-rect","tagged-rectangle","tag-proc","tagged-process"],["flag","paper-tape"],["odd","rect_left_inv_arrow"],["lin-doc","lined-document"]],o=["state","choice","note","composite","rectWithTitle","labelRect","block_arrow","collapsedGroup","iconSquare","iconCircle","icon","iconRounded","imageSquare","anchor","kanbanItem","mindmapCircle","defaultMindmapNode","classBox","erBox","requirementBox","usecaseActor","usecaseActorHollow","usecaseActorAwesome","usecaseActorIcon","usecaseBusiness","usecaseEllipse","usecaseJsonTable"],a=new Map([["square","rect"],["round","rounded"],["ellipse","ellipse"],["hexagon","hex"],["diamond","diam"]]),r=new Map;for(let e of c)for(let t of e)r.set(t,e[0]);for(let e of o)r.set(e,e);function n(e){return r.has(e)}function i(e){return e===void 0?"rect":a.get(e)??r.get(e)??"rect"}export{n as a,i};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function f(n){let e=0;for(let l=n.indexOf("~");l!==-1;l=n.indexOf("~",l+1))e++;return e}function r(n){let e=f(n);if(e<=1)return n;let l=e%2!==0&&n.startsWith("~"),t=n.split(""),i=[];for(let o=l?1:0;o<t.length;o++)t[o]==="~"&&i.push(o);for(let o=0,u=i.length-1;o<u;o++,u--)t[i[o]]="<",t[i[u]]=">";return t.join("")}function s(n){if(!n.includes("~"))return n;let e=n.split(/(,)/),l=[];for(let t=0;t<e.length;t++){let i=e[t];i===","&&t>0&&t+1<e.length&&f(e[t-1])===1&&f(e[t+1])===1&&(i=e[t-1]+","+e[t+1],t++,l.pop()),l.push(r(i))}return l.join("")}export{s as c};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{s as J}from"./5THPTBWS-D57irc_4.js";import{l as le,h as ie}from"./DKTLEL5E-B7ILCVTH.js";import{x as ne,D as re,M as oe,$ as se,v as ce,U as pe,z as de,Y as he}from"./VMV7XPHP-6QkisQwm.js";import{_ as fe,g as me,m as ue,y as $e,a as ve,x as $,b as C,h as Q,f as xe,$ as ge}from"./RZSVICHU-BiwjruZZ.js";import{H as ye,$ as Me}from"./lazy-CKqR1774.js";import"./index-392ivruk.js";function we(l){let t=[],a=[];for(let n of l){let i=n.type==="Leaf",e={name:n.name,children:i?void 0:[]};for(e.classSelector=n.classSelector,n.cssCompiledStyles&&(e.cssCompiledStyles=n.cssCompiledStyles),i&&n.value!==void 0&&(e.value=n.value);a.length>0&&a[a.length-1].level>=n.level;)a.pop();a.length===0?t.push(e):a[a.length-1].node.children.push(e),i||a.push({node:e,level:n.level})}return t}function Se(l,t){let a=new Map;for(let i of l.TreemapRows){if(i.$type!=="ClassDefStatement")continue;let e=a.get(i.className);e||a.set(i.className,e=[]);let o=(i.styleText??"").replace(/\\,/g,"§§§").replace(/,/g,";").replace(/§§§/g,",");for(let f of o.split(";"))e.push(f)}let n=[];for(let i of l.TreemapRows){if(i.$type!=="TreemapRow")continue;let e=i.item,o=e.classSelector?a.get(e.classSelector):void 0;n.push({level:i.indent??0,name:e.name,type:e.$type,value:e.$type==="Leaf"?e.value:void 0,classSelector:e.classSelector,cssCompiledStyles:o&&o.length>0?o:void 0})}return{type:"treemap",title:l.title||t,accTitle:l.accTitle?l.accTitle.replace(/^\s+/g,""):void 0,accDescr:l.accDescr?l.accDescr.replace(/\n\s+/g,`
|
|
2
|
-
`):void 0,roots:we(n),classes:a}}var X=[oe,se,ce,{name:"TREEMAP_KEYWORD",pattern:/treemap-beta|treemap/y},{name:"CLASS_DEF",pattern:/classDef\s+([a-zA-Z_][a-zA-Z0-9_]+)(?:\s+([^;\r\n]*))?(?:;)?/y},{name:"STYLE_SEPARATOR",pattern:/:::/y},{name:"SEPARATOR",pattern:/:/y},{name:"COMMA",pattern:/,/y},{name:"INDENTATION",pattern:/[ \t]{1,}/y},{name:"WS",pattern:/[ \t]+/y,hidden:!0},{name:"ML_COMMENT",pattern:/\%\%[^\n]*/y,hidden:!0},{name:"NL",pattern:/\r?\n/y,hidden:!0},{name:"ID2",pattern:/[a-zA-Z_][a-zA-Z0-9_]*/y},{name:"NUMBER2",pattern:/[0-9_\.\,]+/y},{name:"STRING2",pattern:/"[^"]*"|'[^']*'/y}],Te=/classDef\s+([A-Z_a-z]\w+)(?:\s+([^\n\r;]*))?;?/;function ze(l){let t=new ne(re(l,X,"treemap"),X,"treemap"),a=t.kinds,n={$type:"Treemap",TreemapRows:[]},i=()=>t.accept(5)?t.expect(12):void 0;for(t.expect(3);t.kind!==-1;){let e=t.kind;if(e===0){n.accDescr=pe(t.take());continue}if(e===1){n.accTitle=de(t.take());continue}if(e===2){n.title=he(t.take());continue}e!==8&&e!==14&&e!==4&&t.fail("a node, a class definition, or a title");let o=e===8?t.take().length:void 0;if(t.kind===4){let c=Te.exec(t.take()),g={$type:"ClassDefStatement",className:c[1]};c[2]&&(g.styleText=c[2]),o!==void 0&&(g.indent=o),n.TreemapRows.push(g);continue}let f=t.expect(14).slice(1,-1),r=a[t.i]===8?t.i+1:t.i,h;a[r]===6||a[r]===7?(t.i=r+1,t.accept(8),h={$type:"Leaf",name:f,value:parseFloat(t.expect(13).replace(/,/g,""))}):h={$type:"Section",name:f};let p=i();p!==void 0&&(h.classSelector=p);let s={$type:"TreemapRow",item:h};o!==void 0&&(s.indent=o),n.TreemapRows.push(s)}return n}var ee=/^(?:.?[<>=^])?([-+( ])?(\$)?0?\d*(,)?(?:\.(\d+))?(~)?([a-zA-Z%])?$/;function te(l){let t="";for(let a=l.length;a>0;a-=3)t=l.slice(Math.max(0,a-3),a)+(t?","+t:"");return t}function _e(l){let t=ee.exec(l==="$0,0"?"$,":l)??ee.exec(","),a=t[1]==="+",n=t[3]!==void 0,i=t[4]===void 0?void 0:Math.min(Number(t[4]),20),e=t[6]??"";return o=>{let f=Math.abs(o),r,h="";if(e==="f"?r=f.toFixed(i??6):e==="%"?(r=(f*100).toFixed(i??6),h="%"):e==="d"?r=Math.round(f).toFixed(0):e==="e"?r=f.toExponential(i??6):r=String(Number(f.toPrecision(Math.max(1,i??12)))),t[5]&&r.includes(".")&&!r.includes("e")&&(r=r.replace(/\.?0+$/,"")),n&&!r.includes("e")){let p=r.indexOf(".");r=p===-1?te(r):te(r.slice(0,p))+r.slice(p)}return(o<0?"-":a?"+":"")+(t[2]??"")+r+h}}function ae(l,t,a){let n=l.children===void 0&&Number.isFinite(l.value)&&l.value>0?l.value:0;return{node:l,parent:t,series:a,value:n,children:[],x:0,y:0,w:0,h:0}}function Re(l,t,a,n,i,e,o){let f=t,r=0;for(;r<l.length;){let h=i*e/f,p=Math.min(i,e),s=l[r].value*h,c=s,g=Math.max(p*p*c/(s*s),s*s/(p*p*c)),v=r+1;for(;v<l.length;){let x=l[v].value*h,d=s+x,M=Math.max(p*p*c/(d*d),d*d/(p*p*x));if(M>g)break;g=M,s=d,v++}let m=s/p,y=0;for(let x=r;x<v;x++){let d=l[x],M=x===v-1?p-y:d.value*h/m,R=i>=e?a:a+y,A=i>=e?n+y:n,b=Math.round(R+o/2),E=Math.round(A+o/2);d.x=b,d.y=E,d.w=Math.round(R+(i>=e?m:M)-o/2)-b,d.h=Math.round(A+(i>=e?M:m)-o/2)-E,y+=M,f-=d.value}i>=e?(a+=m,i-=m):(n+=m,e-=m),r=v}}function Ae(l,t,a,n){let i=l.map((s,c)=>ae(s,void 0,c)),e=i.slice();for(let s=0;s<e.length;s++){let c=e[s];for(let g of c.node.children??[]){let v=ae(g,c,c.series);c.children.push(v),e.push(v)}}for(let s=e.length-1;s>=0;s--){let c=e[s];c.parent&&(c.parent.value+=c.value)}let{gap:o,header:f,side:r}=n,h=[],p=(s,c,g,v,m)=>{if(v<=0||m<=0)return;let y=s.filter(d=>d.value>0).sort((d,M)=>M.value-d.value),x=0;for(let d of y)x+=d.value;if(!(y.length===0||!Number.isFinite(x))){Re(y,x,c-o/2,g-o/2,v+o,m+o,o);for(let d of y)d.w>0&&d.h>0&&h.push(d)}};p(i,0,0,t,a);for(let s=0;s<h.length;s++){let c=h[s];c.children.length>0&&p(c.children,c.x+r,c.y+f,c.w-2*r,c.h-f-r)}return h}var B=28,I=6,P=1.25;function Z(l,t,a,n,i){var o;let e=(o=l.treemap)==null?void 0:o[t];return typeof e=="number"&&e>=n?Math.min(e,i):a}function De(l,t,a){let n=a.fontSize??16,i=Math.round(n*.875),e=Math.round(n*.75),o=Math.round(n*.5625),f=a.measurer??ye(a.fontFamily),r=t.treemap??{},h=a.padding??Z(t,"diagramPadding",8,0,2e3),p=Math.round(le(a,Z(t,"nodeWidth",64,1,400)*10,200,2*h)),s=Math.round(Z(t,"nodeHeight",40,1,400)*10),c=r.showValues!==!1,g=_e(typeof r.valueFormat=="string"?r.valueFormat:","),v=Ae(l.roots,p,s,{gap:Z(t,"padding",4,0,200),header:B,side:I}),m=fe(l.title,!1,f,n,ie(a),1),y=m.height>0?m.height+8:0,x=h+Math.max(0,(m.width-p)/2),d=h+y,M="",R="";for(let u of v){let D=u.node,T=me(D.cssCompiledStyles??[]),G=ue(u.series),F=x+u.x,H=d+u.y,U=Me(D.name).trim(),N=c?g(u.value):"",W=`data-id="${$e(D.name)}">`,K=`<rect x="${$(F)}" y="${$(H)}" width="${$(u.w)}" height="${$(u.h)}" rx="${ve}" fill="${G}"`;if(D.children!==void 0){let z="";if(u.h>=B){let S=u.w-2*I-4,_=N?f.width(N,e,0):0,L=_>0&&S-_-12>=3*i,O=J(U,L?S-_-12:S,i,i,f,1),q=H+B/2+1;O&&(z+=`<text x="${$(F+I+2)}" y="${$(q+i*.35)}" font-weight="var(--_hw)"${T.text}>${C(O.text)}</text>`),L&&(z+=`<text class="pele-value" x="${$(F+u.w-I-2)}" y="${$(q+e*.35)}" font-size="${e}" text-anchor="end" fill="var(--_m)"${T.text}>${C(N)}</text>`)}let k=/[";]fill:/.test(T.shape)?"":' fill-opacity="0.12"';M+=`<g class="pele-node pele-section${Q(D.classSelector??"")}" ${W}${K}${k} stroke="${G}"${T.shape}/>${z}</g>`;continue}let Y="",V=u.w-8,j=Math.min(n,Math.floor((u.h-4)/P)),w=j>=o?J(U,V,j,o,f):void 0;if(w){let z=$(F+u.w/2),k=H+u.h/2,S=Math.max(o,Math.round(w.size*.8)),_=(w.size+S)*P;if(N&&_<=u.h-4&&f.width(N,S,0)<=V){let L=k-_/2+w.size*P/2,O=k+_/2-S*P/2;Y=`<text x="${z}" y="${$(L+w.size*.35)}" font-size="${$(w.size)}"${T.text}>${C(w.text)}</text><text class="pele-value" x="${z}" y="${$(O+S*.35)}" font-size="${$(S)}"${T.text}>${C(N)}</text>`}else Y=`<text x="${z}" y="${$(k+w.size*.35)}" font-size="${$(w.size)}"${T.text}>${C(w.text)}</text>`}R+=`<g class="pele-node pele-leaf${Q(D.classSelector??"")}" ${W}${K}${T.shape}/>${Y}</g>`}let A=Math.ceil(Math.max(p,m.width)+2*h),b=Math.ceil(s+y+2*h),E=xe(m,A/2,h+m.height/2,' class="pele-title" font-weight="var(--_tw)"')+(M?`<g class="pele-sections" font-size="${i}">${M}</g>`:"")+(R?`<g class="pele-leaves" text-anchor="middle" fill="var(--_bg)">${R}</g>`:"");return{svg:ge("treemap",A,b,n,a,l,E),width:A,height:b,links:[]}}var Le={type:"treemap",parse:(l,t,a)=>Se(ze(l),a),render:De};export{Le as treemap};
|