isorite 0.12.1 → 0.14.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/README.md +6 -5
- package/dist/main.js +6018 -8942
- package/docs/setup-for-agents.md +44 -102
- package/docs/setup.md +27 -90
- package/docs/terminal.md +54 -55
- package/guide/AGENTS.md +4 -0
- package/guide/atlas/find-what-it-rests-on.md +9 -0
- package/guide/atlas/the-atlas.md +21 -0
- package/guide/atlas/the-switches/satellites.svg +17 -0
- package/guide/atlas/the-switches.md +27 -0
- package/guide/iso/agents-md.md +13 -0
- package/guide/iso/artifacts/the-guide.csv +8 -0
- package/guide/iso/artifacts/the-guide.html +35 -0
- package/guide/iso/artifacts.md +15 -0
- package/guide/iso/ask-iso.md +7 -0
- package/guide/iso/give-it-notes.md +9 -0
- package/guide/iso/in-hand.md +18 -0
- package/guide/iso/iso-writes-marked.md +15 -0
- package/guide/iso/iso.md +17 -0
- package/guide/iso/let-it-write.md +11 -0
- package/guide/iso/write-agents-md.md +11 -0
- package/guide/notes/a-note-is-markdown.md +17 -0
- package/guide/notes/a-notes-details.md +23 -0
- package/guide/notes/diagrams-and-code.md +43 -0
- package/guide/notes/every-change-is-kept.md +14 -0
- package/guide/notes/folders.md +11 -0
- package/guide/notes/go-back-a-version.md +9 -0
- package/guide/notes/link-your-notes.md +9 -0
- package/guide/notes/links-and-their-kinds.md +23 -0
- package/guide/notes/make-move-delete.md +9 -0
- package/guide/notes/write-in-your-notes.md +9 -0
- package/guide/out-of-the-base/web-and-code-links.md +13 -0
- package/guide/questions-and-problems/ask-a-question.md +9 -0
- package/guide/questions-and-problems/how-iso-reads-you.md +9 -0
- package/guide/questions-and-problems/problems.md +15 -0
- package/guide/questions-and-problems/questions.md +27 -0
- package/guide/questions-and-problems/resolve-a-question.md +9 -0
- package/guide/questions-and-problems/why-markdown-links.md +7 -0
- package/guide/solve-this-one.md +11 -0
- package/guide/start-here.md +39 -0
- package/guide/terminal/let-the-agent-remember.md +9 -0
- package/guide/terminal/memory.md +13 -0
- package/guide/terminal/your-own-agent.md +24 -0
- package/guide/your-notes.md +6 -0
- package/guide/your-own-base/keeping-a-base-well.md +16 -0
- package/guide/your-own-base/starting-a-base.md +21 -0
- package/package.json +4 -7
- package/web/_app/immutable/assets/0.BPP604gH.css +1 -0
- package/web/_app/immutable/assets/4.fOHsAKBF.css +1 -0
- package/web/_app/immutable/assets/drawn.D6lJzDcc.css +1 -0
- package/web/_app/immutable/chunks/{D5XlJBy8.js → B-DzK7Gb.js} +1 -1
- package/web/_app/immutable/chunks/{BuUzVkG2.js → B35sQTcK.js} +1 -1
- package/web/_app/immutable/chunks/{Dh1lBxfx.js → BA78_vo5.js} +1 -1
- package/web/_app/immutable/chunks/{tUSDgbpy.js → BCGaqnao.js} +1 -1
- package/web/_app/immutable/chunks/{DT2w6KyY.js → BGW1TKtR.js} +1 -1
- package/web/_app/immutable/chunks/{EMo1IeTW.js → BK31dpt6.js} +1 -1
- package/web/_app/immutable/chunks/BPrp4s2r.js +1 -0
- package/web/_app/immutable/chunks/{DlXrOzlh.js → BT_btfh0.js} +1 -1
- package/web/_app/immutable/chunks/{Xm0YTnxV.js → BWE_HS0c.js} +1 -1
- package/web/_app/immutable/chunks/{BLmF1B2i.js → BXBhaEho.js} +1 -1
- package/web/_app/immutable/chunks/{BAclEN0O.js → Bb_N98K9.js} +1 -1
- package/web/_app/immutable/chunks/{gPtCGHiy.js → Bd-WxALw.js} +1 -1
- package/web/_app/immutable/chunks/{BA8Hpxhg.js → BhEqJU15.js} +1 -1
- package/web/_app/immutable/chunks/{DkxkvOjx.js → BiATTH-R.js} +1 -1
- package/web/_app/immutable/chunks/{D5vocsTl.js → Bj-5n5Pb.js} +1 -1
- package/web/_app/immutable/chunks/{DRX-TQzj.js → BqipEJXw.js} +1 -1
- package/web/_app/immutable/chunks/{DXTK-eyo.js → BvPxdlBc.js} +1 -1
- package/web/_app/immutable/chunks/{DfCZPwp1.js → C2npZzkn.js} +1 -1
- package/web/_app/immutable/chunks/{DF89zyH-.js → C5Z-Y7Lu.js} +1 -1
- package/web/_app/immutable/chunks/{CD6xPodA.js → C8h1oeAZ.js} +1 -1
- package/web/_app/immutable/chunks/{CFEI5lV9.js → CAlIuau0.js} +1 -1
- package/web/_app/immutable/chunks/{9z49435t.js → CFf_dAzX.js} +1 -1
- package/web/_app/immutable/chunks/{rq7JUohF.js → CIYFNih-.js} +1 -1
- package/web/_app/immutable/chunks/{D3-rqfsM.js → CMIt1Ma8.js} +1 -1
- package/web/_app/immutable/chunks/{-2Meesge.js → CMikI1NP.js} +3 -3
- package/web/_app/immutable/chunks/{CxAq1aod.js → CPSlCQsu.js} +74 -74
- package/web/_app/immutable/chunks/{Czz9qOh8.js → CT4_O9X_.js} +1 -1
- package/web/_app/immutable/chunks/{DX4bJJO0.js → CTDYUZPz.js} +1 -1
- package/web/_app/immutable/chunks/{By4S_gy5.js → CdY1G_wk.js} +1 -1
- package/web/_app/immutable/chunks/{DBC2xjOo.js → CdmC_l9F.js} +1 -1
- package/web/_app/immutable/chunks/{DbNETcPs.js → Cf-5I5_6.js} +1 -1
- package/web/_app/immutable/chunks/Cl5gQm2e.js +1 -0
- package/web/_app/immutable/chunks/{BWVMfAMh.js → CryuQgNh.js} +1 -1
- package/web/_app/immutable/chunks/{CT_Ry4q8.js → Ct_EK1xu.js} +1 -1
- package/web/_app/immutable/chunks/{BymwHy7o.js → CtkUy_15.js} +1 -1
- package/web/_app/immutable/chunks/{Dpa4Syyy.js → CzYPMYd4.js} +1 -1
- package/web/_app/immutable/chunks/{RlApGeew.js → D1LK3xRu.js} +1 -1
- package/web/_app/immutable/chunks/{DXK7PB4g.js → D6sVhEz3.js} +1 -1
- package/web/_app/immutable/chunks/{94XMxKlw.js → DBLoWLMb.js} +1 -1
- package/web/_app/immutable/chunks/{rghE0CVz.js → DCZYeMlH.js} +1 -1
- package/web/_app/immutable/chunks/{RFxekmX-.js → DDAG55ce.js} +1 -1
- package/web/_app/immutable/chunks/DFKYo3Wx.js +1 -0
- package/web/_app/immutable/chunks/{CyFLqlvP.js → DFuPQaNa.js} +1 -1
- package/web/_app/immutable/chunks/{BXAOBcPb.js → DHJ8FcFD.js} +1 -1
- package/web/_app/immutable/chunks/{Bt7VOT5H.js → DKqMzyyE.js} +1 -1
- package/web/_app/immutable/chunks/{Bq2GBAJ0.js → DRcTlHZP.js} +1 -1
- package/web/_app/immutable/chunks/{C_amgxV1.js → DjUnonHY.js} +1 -1
- package/web/_app/immutable/chunks/{whhiiiga.js → Djr0h_v1.js} +1 -1
- package/web/_app/immutable/chunks/{vfDvz3qP.js → DrVtdHUW.js} +1 -1
- package/web/_app/immutable/chunks/DxVFSMVD.js +523 -0
- package/web/_app/immutable/chunks/{BBHd0LvJ.js → DymLl-qY.js} +1 -1
- package/web/_app/immutable/chunks/{DSYLdqdc.js → Dzi94aDH.js} +1 -1
- package/web/_app/immutable/chunks/{CmExTt6_.js → NyWzYSz1.js} +1 -1
- package/web/_app/immutable/chunks/{oWM_kgYq.js → PsfIQCJ1.js} +1 -1
- package/web/_app/immutable/chunks/{Cl5zRP_n.js → TanDZqdf.js} +1 -1
- package/web/_app/immutable/chunks/{D95RKsvN.js → UDPiRmKc.js} +1 -1
- package/web/_app/immutable/chunks/X3aTZRe_.js +1 -0
- package/web/_app/immutable/chunks/{BTclWEfx.js → ZwM5k8r0.js} +1 -1
- package/web/_app/immutable/chunks/e2LGvGEb.js +3 -0
- package/web/_app/immutable/chunks/ej_0XxR7.js +1 -0
- package/web/_app/immutable/chunks/{CjtKPNlv.js → kG4HctVa.js} +1 -1
- package/web/_app/immutable/chunks/{CQd9D8Nc.js → l1LsK1sB.js} +1 -1
- package/web/_app/immutable/entry/app.BzA5QYtw.js +2 -0
- package/web/_app/immutable/entry/start.BOh0Gj31.js +1 -0
- package/web/_app/immutable/nodes/0.BmaxMLzC.js +2 -0
- package/web/_app/immutable/nodes/1.IQDu8pD1.js +1 -0
- package/web/_app/immutable/nodes/2.D2Oi-ADx.js +1 -0
- package/web/_app/immutable/nodes/3.CF1W85jb.js +1 -0
- package/web/_app/immutable/nodes/4.BMYBn904.js +15 -0
- package/web/_app/immutable/nodes/5.1vm6WZdM.js +1 -0
- package/web/_app/immutable/nodes/6.C9ia8cDm.js +1 -0
- package/web/_app/version.json +1 -1
- package/web/index.html +16 -19
- package/dist/core.js +0 -2464
- package/plugin/assets/mark-lapis.png +0 -0
- package/plugin/assets/mark-quartz.png +0 -0
- package/plugin/assets/wordmark-lapis.png +0 -0
- package/plugin/assets/wordmark-quartz.png +0 -0
- package/plugin/isorite.ts +0 -65
- package/plugin/logo.ts +0 -99
- package/plugin/notepage.tsx +0 -165
- package/plugin/notes.ts +0 -10
- package/plugin/noteview.ts +0 -60
- package/plugin/oneatlas.ts +0 -83
- package/plugin/palette.ts +0 -21
- package/plugin/play.ts +0 -104
- package/plugin/server.ts +0 -76
- package/plugin/sources.ts +0 -18
- package/plugin/tui.tsx +0 -556
- package/plugin/wordmark.ts +0 -180
- package/web/_app/immutable/assets/0.DqoJ_jEe.css +0 -1
- package/web/_app/immutable/assets/4.CUdclsPi.css +0 -1
- package/web/_app/immutable/assets/5.rBvyRuST.css +0 -1
- package/web/_app/immutable/assets/Drawing.Q7J9MyIo.css +0 -1
- package/web/_app/immutable/assets/NoteEditor.S3q5lmKq.css +0 -1
- package/web/_app/immutable/assets/Timeline.LsRXYIBv.css +0 -1
- package/web/_app/immutable/chunks/9TpKhtgt.js +0 -1
- package/web/_app/immutable/chunks/BMcDEv5V.js +0 -1
- package/web/_app/immutable/chunks/BqrMZ9MX.js +0 -1
- package/web/_app/immutable/chunks/ChbZenhA.js +0 -7
- package/web/_app/immutable/chunks/CnR51TY0.js +0 -1
- package/web/_app/immutable/chunks/DMzXaGgk.js +0 -523
- package/web/_app/immutable/chunks/DshHzxgH.js +0 -1
- package/web/_app/immutable/chunks/Iqr2CudW.js +0 -3
- package/web/_app/immutable/chunks/wQPxmN7w.js +0 -1
- package/web/_app/immutable/entry/app.Z7pwf_yI.js +0 -2
- package/web/_app/immutable/entry/start.B_WWh0TE.js +0 -1
- package/web/_app/immutable/nodes/0.zgVqViQf.js +0 -26
- package/web/_app/immutable/nodes/1.D06ogNcd.js +0 -1
- package/web/_app/immutable/nodes/2.Xq8_UpCY.js +0 -1
- package/web/_app/immutable/nodes/3.CgpZ3cDm.js +0 -1
- package/web/_app/immutable/nodes/4.DQfZbhoQ.js +0 -2
- package/web/_app/immutable/nodes/5.BqLxxB44.js +0 -9
- package/web/_app/immutable/nodes/6.Dg2_pK7R.js +0 -1
- package/web/_app/immutable/nodes/7.BpxHVHoY.js +0 -1
- /package/web/_app/immutable/assets/{7.C00vyVPo.css → 6.C00vyVPo.css} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{h as e}from"
|
|
1
|
+
import{h as e}from"./CMikI1NP.js";function t(e,t){let n=e.indexOf(`
|
|
2
2
|
`,t);return n===-1?e.length:n}function n(e,t,n){for(let r=0;r<n.length;r++)if((e.charCodeAt(t+r)|32)!==n.charCodeAt(r))return!1;return!0}function r(n,r){let i=n.length,a=r;for(;a<i;){let r=n.charCodeAt(a);if(r===37&&n.charCodeAt(a+1)!==123)a=t(n,a);else{if(r===10)return a;if(e(r))do a++;while(a<i&&e(n.charCodeAt(a)));else if(r===35)a=t(n,a);else return a}}return a}function i(t,n){let r=n;for(;e(t.charCodeAt(r));)r++;return r}function a(e,r,a,o){let s=n(e,r,`accdescr`);if(!s&&!n(e,r,`acctitle`))return r;let c=e.length,l=i(e,r+8),u=e.charCodeAt(l),d=(t,n,r)=>{a.types.push(t),a.texts.push(e.slice(n,r)),a.starts.push(n)};if(u===58){l=i(e,l+1);let n=t(e,l);return d(s?o+2:o,r,l),d(s?o+3:o+1,l,n),n}if(!s||u!==123)return r;for(l=i(e,l+1);e.charCodeAt(l)!==125;){let t=e.indexOf(`}`,l);if(t===-1&&(t=c),d(o+4,l,t),l===c)return c;l=t}return l+1}export{a as i,r as n,t as r,n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as e}from"
|
|
1
|
+
import{s as e}from"./CMikI1NP.js";var t=new WeakMap;function n(e){let n=e.map((e,t)=>t),r=[];for(let t=0;t<128;t++){let i=String.fromCharCode(t);r.push(n.filter(t=>{let{pattern:n,first:r}=e[t];return typeof n==`string`?n[0]===i:r===void 0||r.includes(i)}))}let i={starting:r,every:n,longer:e.map(t=>t.longer?.map(t=>e.indexOf(t)))};return t.set(e,i),i}function r(r,i,a){let o=[],s=[],c=[],l=new Uint8Array(i.length),{starting:u,every:d,longer:f}=t.get(i)??n(i),p=[],m=r.length,h=(e,t)=>{if(l[e])return-1;let n=i[e];if(n.match!==void 0)return n.match(r,t);if(n.scanner!==void 0)return(p[e]??=n.scanner())(r,t);let a=n.pattern;return typeof a==`string`?r.startsWith(a,t)?t+a.length:-1:(a.lastIndex=t,a.test(r)?a.lastIndex:(n.opener!==void 0&&(n.opener.lastIndex=t,n.opener.test(r)&&(l[e]=1)),-1))},g=0;n:for(;g<m;){let t=r.charCodeAt(g);for(let e of t<128?u[t]:d){let t=h(e,g);if(t<=g)continue;let n=e,r=f[e];if(r!==void 0)for(let e of r){let r=h(e,g);if(r>t){n=e,t=r;break}}i[n].hidden||(o.push(n),s.push(g),c.push(t)),g=t;continue n}throw e(a,r,g,``,!0)}return o.push(-1),s.push(m),c.push(m),{kinds:o,starts:s,ends:c,src:r}}var i={name:`ACC_DESCR`,pattern:/[\t ]*accDescr(?:[\t ]*:([^\n\r]*?(?=%%)|[^\n\r]*)|\s*{([^}]*)})/y,first:` a`},a={name:`ACC_TITLE`,pattern:/[\t ]*accTitle[\t ]*:(?:[^\n\r]*?(?=%%)|[^\n\r]*)/y,first:` a`},o={name:`TITLE`,pattern:/[\t ]*title(?:[\t ][^\n\r]*?(?=%%)|[\t ][^\n\r]*|)/y,first:` t`},s={name:`STRING`,pattern:/"([^"\\]|\\.)*"|'([^'\\]|\\.)*'/y,first:`"'`},c={name:`NEWLINE`,pattern:/\r?\n/y,first:`\r
|
|
2
2
|
`},l={name:`WHITESPACE`,pattern:/[\t ]+/y,hidden:!0,first:` `},u={name:`YAML`,pattern:/---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/y,hidden:!0,opener:/---[\t ]*\r?\n/y,first:`-`},d={name:`DIRECTIVE`,pattern:/[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/y,hidden:!0,opener:/[\t ]*%%{/y,first:` %`},f={name:`SINGLE_LINE_COMMENT`,pattern:/[\t ]*%%[^\n\r]*/y,first:` %`,hidden:!0};function p(e){return{name:e,pattern:RegExp(e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)+`(?:(?=%%)|(?!\\S))`,`y`),first:e[0]}}var m=/accDescr(?:[\t ]*:([^\n\r]*)|\s*{([^}]*)})/,h=/accTitle[\t ]*:([^\n\r]*)/,g=/title([\t ][^\n\r]*|)/;function _(e){return e.trim().replace(/[\t ]{2,}/gm,` `)}function v(e){return _(g.exec(e)[1])}function y(e){return _(h.exec(e)[1])}function b(e){let t=m.exec(e);return t[1]===void 0?t[2].replace(/^\s*/gm,``).replace(/\s+$/gm,``).replace(/[\t ]{2,}/gm,` `).replace(/[\n\r]{2,}/gm,`
|
|
3
3
|
`):_(t[1])}var x=new Map([[`b`,`\b`],[`f`,`\f`],[`n`,`
|
|
4
4
|
`],[`r`,`\r`],[`t`,` `],[`v`,`\v`],[`0`,`\0`]]);function S(e){if(!e.includes(`\\`))return e.slice(1,-1);let t=``;for(let n=1;n<e.length-1;n++){let r=e[n];if(r===`\\`){let r=e[++n];t+=x.get(r)??r}else t+=r}return t}var C=class{constructor(e,t,n){this.tokens=e,this.types=t,this.diagram=n,this.kinds=e.kinds}tokens;types;diagram;i=0;kinds;get kind(){return this.kinds[this.i]}text(e=this.i){return this.tokens.src.slice(this.tokens.starts[e],this.tokens.ends[e])}take(){return this.text(this.i++)}accept(e){return this.kinds[this.i]===e&&(this.i++,!0)}expect(e){return this.kinds[this.i]!==e&&this.fail(`token of type '${this.types[e].name}'`),this.take()}fail(t){let n=this.kind===-1?`end of input`:`\`${this.text()}\``;throw e(this.diagram,this.tokens.src,this.tokens.starts[this.i],`Expecting ${t} but found ${n}.`)}};export{i as a,b as c,v as d,S as f,y as g,C as h,p as i,c as l,s as m,r as n,d as o,o as p,u as r,f as s,a as t,l as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,d as r,i,o as a,r as o,s,u as c,v as l,x as u}from"./
|
|
1
|
+
import{_ as e,a as t,b as n,d as r,i,o as a,r as o,s,u as c,v as l,x as u}from"./C2npZzkn.js";import{a as d,o as f,t as p}from"./DciMwFJ1.js";import{a as m,i as h,l as g,s as _}from"./BXBhaEho.js";import{n as v}from"./DDAG55ce.js";import{n as y}from"./BA78_vo5.js";import{o as b,t as ee}from"./DKqMzyyE.js";import{t as x}from"./BZmnMkFw.js";import{t as S}from"./D6QVYUu9.js";import{i as te,n as ne,r as re,t as ie}from"./BCGaqnao.js";import{i as ae,n as oe,r as se,t as C}from"./D1LK3xRu.js";import{_ as w,d as T,g as E,h as D,s as O,u as ce}from"./CMikI1NP.js";function k(e){return e===`#`||e===`+`||e===`~`||e===`-`}var A=class{id=``;memberType;visibility=``;classifier=``;parameters=``;returnType=``;constructor(e,t){this.memberType=t,(t!==`method`||!this.parseMethod(e))&&this.parseAttribute(e),this.id=this.id.startsWith(` `)?` `+this.id.trim():this.id.trim()}parseMethod(e){let t=e.length;for(let n=0;n<t;){let r=n;for(;r<t&&!w(e.charCodeAt(r));)r++;let i=r-1;for(;i>n&&e.charCodeAt(i)!==41;)i--;let a=i-1;for(;a>n&&e.charCodeAt(a)!==40;)a--;if(a>n){let r=e[n],o=k(r)&&a>n+1;o&&(this.visibility=r),this.id=e.slice(o?n+1:n,a),this.parameters=e.slice(a+1,i).trim();let s=i+1,c=``;if(s<t){let t=e[s];(t===`$`||t===`*`||t.trim()===``)&&(c=t.trim(),s++)}let l=s;for(;l<t&&!w(e.charCodeAt(l));)l++;if(this.returnType=e.slice(s,l).trim(),c===``){let e=this.returnType.slice(-1);(e===`$`||e===`*`)&&(c=e,this.returnType=this.returnType.slice(0,-1))}return this.classifier=c,!0}n=r+1}return this.memberType=`attribute`,!1}parseAttribute(e){let t=e.slice(0,1),n=e.slice(-1);k(t)&&(this.visibility=t),(n===`$`||n===`*`)&&(this.classifier=n),this.id=e.substring(this.visibility===``?0:1,this.classifier===``?e.length:e.length-1)}getDisplayDetails(){let e=this.visibility+x(this.id);return this.memberType===`method`&&(e+=`(${x(this.parameters.trim())})`,this.returnType&&(e+=` : `+x(this.returnType))),{displayText:e.trim(),cssStyle:this.parseClassifier()}}parseClassifier(){return this.classifier===`*`?`font-style:italic;`:this.classifier===`$`?`text-decoration:underline;`:``}},j={LINE:0,DOTTED_LINE:1},M={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},N=`classId-`;function P(e){let t=e.indexOf(`~`);if(t<=0)return{className:e,type:``};let n=e.indexOf(`~`,t+1);return{className:e.slice(0,t),type:e.slice(t+1,n===-1?e.length:n)}}function le(e){let t=e.charCodeAt(0);return P(t>=48&&t<=57?N+e:e).className}var F=class{type=`class`;lineType=j;relationType=M;direction=`TB`;classes=new Map;relations=[];notes=new Map;namespaces=new Map;interfaces=[];styleClasses=new Map;title;accTitle;accDescr;namespaceStack=[];withCssClass=new Map;addClass(e){let{className:t,type:n}=P(e);if(this.classes.has(t))return;let r={id:t,type:n,label:t,cssClasses:`default`,methods:[],members:[],annotations:[],styles:[]};this.classes.set(t,r),this.tag(r,`default`)}tag(e,t){let n=this.withCssClass.get(t);n?n.add(e):this.withCssClass.set(t,new Set([e]))}ensure(e){return this.addClass(e),this.classes.get(P(e).className)}setClassLabel(e,t){this.ensure(e).label=t}addRelation(e){let{type1:t,type2:n}=e.relation;t===M.LOLLIPOP&&n===`none`?(this.addClass(e.id2),e.id1=this.addInterface(e.id1,e.id2)):n===M.LOLLIPOP&&t===`none`?(this.addClass(e.id1),e.id2=this.addInterface(e.id2,e.id1)):(this.addClass(e.id1),this.addClass(e.id2)),e.id1=P(e.id1).className,e.id2=P(e.id2).className,e.relationTitle1=e.relationTitle1.trim(),e.relationTitle2=e.relationTitle2.trim(),this.relations.push(e)}addInterface(e,t){let n=`interface${this.interfaces.length}`;return this.interfaces.push({id:n,label:e,classId:t}),n}addAnnotation(e,t){this.ensure(e).annotations.push(t)}addMember(e,t){let n=this.ensure(e);if(typeof t!=`string`)return;let r=t.trim();if(r.startsWith(`<<`)&&r.endsWith(`>>`))n.annotations.push(r.substring(2,r.length-2));else if(r.indexOf(`)`)>0){let e=new A(r,`method`);(e.memberType===`method`?n.methods:n.members).push(e)}else r&&n.members.push(new A(r,`attribute`))}addMembers(e,t){if(Array.isArray(t)){t.reverse();for(let n of t)this.addMember(e,n)}}addNote(e,t){let n=this.notes.size,r=`note${n}`;return this.notes.set(r,{id:r,class:t,text:e,index:n}),r}cleanupLabel(e){return(e.startsWith(`:`)?e.substring(1):e).trim()}setCssClass(e,t){for(let n of e.split(`,`)){let e=this.classes.get(le(n));if(e!==void 0){e.cssClasses+=` `+t;for(let n of t.split(` `))this.tag(e,n)}}}defineClass(e,t){for(let n of e){let e=this.styleClasses.get(n);if(e===void 0&&(e={id:n,styles:[],textStyles:[]},this.styleClasses.set(n,e)),!t)continue;for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n);let r=this.withCssClass.get(n);if(r===void 0)continue;let i=t.flatMap(e=>e.split(`,`));for(let e of r)for(let t of i)e.styles.push(t)}}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`)){let e=this.classes.get(P(n).className);e&&(e.tooltip=t)}}setLink(e,t,n){let r=T(t).trim();for(let t of e.split(`,`)){let e=this.classes.get(le(t));e&&(e.link=r?b(r):void 0,e.linkTarget=typeof n==`string`?n:`_blank`)}this.setCssClass(e,`clickable`)}setClickEvent(e,t,n){for(let t of e.split(`,`)){let e=this.classes.get(P(t).className);e&&(e.haveCallback=!0)}this.setCssClass(e,`clickable`)}setDirection(e){this.direction=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
2
|
`)}addNamespace(e,t){let n=this.namespaceStack[this.namespaceStack.length-1],r=n?`${n}.${e}`:e;this.namespaceStack.push(r);let i=this.namespaces.get(r);if(i)return i.explicit=!0,t&&(i.label=t),r;let a=n||void 0,o=n?n.length+1:0;for(;;){let e=r.indexOf(`.`,o),n=e===-1,i=n?r:r.slice(0,e),s=this.namespaces.get(i);if(s===void 0){let c=r.slice(o,n?r.length:e);s={id:i,label:n&&t?t:c,classes:new Map,notes:new Map,children:new Map,parent:a,explicit:n},this.namespaces.set(i,s)}else n&&(s.explicit=!0);let c=a?this.namespaces.get(a):void 0;if(c&&(c.children.has(i)||c.children.set(i,s),s.parent??=a),n)return r;a=i,o=e+1}}popNamespace(){this.namespaceStack.pop()}addClassesToNamespace(e,t,n){let r=this.namespaces.get(e);if(r!==void 0){for(let n of t){let{className:t}=P(n),i=this.classes.get(t);i!==void 0&&(i.parent=e,r.classes.set(t,i))}for(let t of n){let n=this.notes.get(t);n!==void 0&&(n.parent=e,r.notes.set(t,n))}}}setCssStyle(e,t){let n=this.classes.get(e);if(t&&n)for(let e of t)for(let t of e.split(`,`))n.styles.push(t)}},ue=`$end.INVALID.CLASS_DIAGRAM.NEWLINE.EOF.SQS.STR.SQE.DOT.GENERICTYPE.LABEL.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.STRUCT_START.STRUCT_STOP.NAMESPACE.STYLE_SEPARATOR.ANNOTATION_START.ANNOTATION_END.CLASS.MEMBER.NOTE_FOR.NOTE.CLASSDEF.ALPHA.COMMA.direction_tb.direction_bt.direction_rl.direction_lr.AGGREGATION.EXTENSION.COMPOSITION.DEPENDENCY.LOLLIPOP.LINE.DOTTED_LINE.CALLBACK.LINK.LINK_TARGET.CLICK.CALLBACK_NAME.CALLBACK_ARGS.HREF.STYLE.CSSCLASS.COLON.BRKT.PCT.MINUS.UNICODE_TEXT.BQUOTE_STR.EDGE_STATE.EOF_IN_STRUCT.OPEN_IN_STRUCT.PLUS.EQUALS.PUNCTUATION`.split(`.`),de=[4,6,4,9,44,45,12,14,15,4,56,4,56],fe=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y],I=/[\n\r\u2028\u2029]/g;function L(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=e.indexOf(`direction`),l=-1,u=0,d=(t,a,o)=>(n.push(t),r.push(e.slice(a,o)),i.push(a),s=o,!0),f=e=>{a.push(o),o=e},p=()=>{a.length>0&&(o=a.pop())},m=t=>e.startsWith(t,s)&&!E(e.charCodeAt(s+t.length)),h=n=>{for(;n<t&&D(e.charCodeAt(n));)n++;return n},g=n=>{let r=e.indexOf(n,s);return r===-1?t:r},_=n=>{let r=s,i=-1;for(let n=e.charCodeAt(r);r<t&&D(n);n=e.charCodeAt(++r))n===10&&(i=r);i<0?s=r:(n&&p(),d(3,s,i+1))},v=t=>{switch(t){case 99:if(m(`cssClass`))return d(48,s,s+8);if(m(`callback`))return d(40,s,s+8);if(m(`click`))return d(43,s,s+5);break;case 108:if(m(`link`))return d(41,s,s+4);break;case 110:if(m(`note for`))return d(24,s,s+8);if(m(`note`))return d(25,s,s+4);break;case 60:if(e.charCodeAt(s+1)===60)return d(20,s,s+2);break;case 62:if(e.charCodeAt(s+1)===62)return d(21,s,s+2);break;case 104:if(m(`href`))return d(46,s,s+4)}return!1},y=n=>{if(v(n))return!0;let r=e.charCodeAt(s+1);switch(n){case 34:return f(1),s++,!0;case 126:return f(3),s++,!0;case 96:return f(2),s++,!0;case 95:if(m(`_self`))return d(42,s,s+5);if(m(`_blank`))return d(42,s,s+6);if(m(`_parent`))return d(42,s,s+7);if(m(`_top`))return d(42,s,s+4);break;case 60:return r===124?d(34,s,s+2):d(36,s,s+1);case 124:return r===62&&d(34,s,s+2);case 62:return d(36,s,s+1);case 42:return d(35,s,s+1);case 111:if(!E(r))return d(33,s,s+1);break;case 40:return r===41&&d(37,s,s+2);case 45:return r===45?d(38,s,s+2):d(52,s,s+1);case 46:return r===46?d(39,s,s+2):d(8,s,s+1);case 58:{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===58||t===10||t===59)break;n++}return n>s+1?d(10,s,n):r===58&&e.charCodeAt(s+2)===58&&d(19,s,s+3)}case 43:return d(58,s,s+1);case 37:return d(51,s,s+1);case 61:return d(59,s,s+1);case 91:return d(5,s,s+1);case 93:return d(7,s,s+1);case 33:case 35:case 36:case 38:case 39:case 44:case 63:case 92:case 47:return d(60,s,s+1)}if(E(n)){let t=s+1;for(;E(e.charCodeAt(t));)t++;return d(27,s,t)}return S(n)&&d(53,s,s+1)},b=()=>{if(c===-1||s<u||(c<s&&(c=e.indexOf(`direction`,s)),c===-1)||(l<s&&(I.lastIndex=s,l=I.test(e)?I.lastIndex-1:t),c>=l))return!1;for(let t=0;t<4;t++){let n=fe[t];if(n.lastIndex=s,n.test(e))return d(29+t,s,n.lastIndex)}return u=l,!1},ee=n=>{if(b())return!0;if(D(n))return _(!1),!0;switch(n){case 37:if(e.charCodeAt(s+1)===37){let n=g(`
|
|
3
3
|
`);for(;n<t&&(e.charCodeAt(n)===10||e.charCodeAt(n)===13);)n++;return s=n,!0}break;case 97:{let t=e.startsWith(`accTitle`,s);if(!t&&!e.startsWith(`accDescr`,s))break;let n=h(s+8),r=e.charCodeAt(n);if(r===58)return d(t?11:13,s,h(n+1)),f(t?6:7),!0;if(r===123&&!t)return s=h(n+1),f(8),!0;break}case 99:if(m(`classDiagram-v2`))return d(2,s,s+15);if(m(`classDiagram`))return d(2,s,s+12);if(e.startsWith(`call`,s)&&D(e.charCodeAt(s+4)))return s=h(s+4),f(4),!0;if(m(`classDef`))return d(26,s,s+8);if(m(`class`))return f(9),d(22,s,s+5);break;case 91:if(e.startsWith(`*]`,s+1))return d(55,s,s+3);break;case 115:if(m(`style`))return d(47,s,s+5);break;case 110:if(m(`namespace`))return f(11),d(18,s,s+9);break;case 44:return d(28,s,s+1);case 35:return d(50,s,s+1)}return y(n)||n===58&&d(49,s,s+1)};for(;;){if(s>=t){n.push(de[o]),r.push(``),i.push(t);break}let a=e.charCodeAt(s),c=!0;switch(o){case 0:c=ee(a);break;case 9:D(a)?_(!0):a===125?(p(),p(),d(17,s,s+1)):a===123?(f(10),d(16,s,s+1)):c=y(a);break;case 10:if(a===34)f(1),s++;else if(a===125)p(),d(17,s,s+1);else if(a===91&&e.startsWith(`*]`,s+1))d(55,s,s+3);else if(a===123)d(57,s,s+1);else if(a===10)s++;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===123||t===125||t===10)break;n++}d(23,s,n)}break;case 11:D(a)?_(!0):a===123?(f(12),d(16,s,s+1)):a===125?p():a===110&&m(`namespace`)?(f(11),d(18,s,s+9)):c=y(a);break;case 12:D(a)?_(!1):a===125?(p(),d(17,s,s+1)):a===110&&m(`namespace`)?(f(11),d(18,s,s+9)):a===91&&e.startsWith(`*]`,s+1)?d(55,s,s+3):a===99&&m(`class`)?(f(9),d(22,s,s+5)):c=y(a);break;case 1:a===34?(p(),s++):d(6,s,g(`"`));break;case 3:if(a===34)f(1),s++;else{if(v(a))break;a===126?(p(),s++):d(9,s,g(`~`))}break;case 2:if(a===34)f(1),s++;else{if(v(a))break;a===126?(f(3),s++):a===96?(p(),s++):d(54,s,g("`"))}break;case 4:if(a===40){let t=h(s+1);p(),e.charCodeAt(t)===41?s=t+1:(f(5),s++)}else d(44,s,g(`(`));break;case 5:a===41?(p(),s++):d(45,s,g(`)`));break;case 6:case 7:d(o===6?12:14,s,g(`
|
|
4
4
|
`)),p();break;case 8:a===125?(p(),s++):d(15,s,g(`}`))}if(!c)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var R=61,z=new Uint8Array(R);for(let e of[53,27,52])z[e]=1;var pe=new Uint8Array(R);for(let e of[27,49,50,47,51,10])pe[e]=1;var B=new Uint8Array(R);B[33]=1,B[34]=2,B[35]=3,B[36]=4,B[37]=5;var V=`'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS', 'BQUOTE_STR'`;function me(e,t){let{types:n,texts:r,starts:i}=L(e),a=0,o=t=>{let r=n[a];throw r===1?O(`class`,e,i[a],``,!0):O(`class`,e,i[a],`Expecting ${t}, got '${ue[r]}'`)},s=e=>(n[a]!==e&&o(`'${ue[e]}'`),r[a++]),c=()=>(z[n[a]]===0&&o(`'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS'`),r[a++]),l=e=>{let t=``;for(;;){if(n[a]===54){t+=r[a++];break}z[n[a]]===0&&o(V),t+=r[a++];let e=n[a];if(e===8)t+=`.`,a++;else if(z[e]===0&&e!==54)break}return e&&n[a]===9&&(t+=`~`+r[a++]+`~`),t},u=()=>{a++;let e=s(6);return s(7),e},d=()=>{n[a]!==23&&o(`'STRUCT_STOP', 'MEMBER'`);let e=[];for(;n[a]===23;)e.push(r[a++]);return s(17),e.reverse()},f=()=>{a++;let e=l(!0);switch(t.addClass(e),n[a]===5&&t.setClassLabel(e,u()),n[a]){case 19:{a++;let r=c();t.setCssClass(e,r),n[a]===16&&(a++,t.addMembers(e,d()));break}case 16:a++,n[a]===17?a++:t.addMembers(e,d());break;case 20:{a++;let r=c();s(21),t.addAnnotation(e,r),n[a]===16&&(a++,n[a]===17?a++:t.addMembers(e,d()));break}}return e},p=()=>{if(n[a++]===25)return t.addNote(s(6));let e=l(!0);return t.addNote(s(6),e)},m=()=>{let e=[];for(;;){a++;let r=l(!1),i=n[a]===5?t.addNamespace(r,u()):t.addNamespace(r);s(16),n[a]===3&&a++,e.push({id:i,classes:[],notes:[]});let c=!0;for(;c;){let r=e[e.length-1],i=n[a];if(i===18)break;for(i===22?r.classes.push(f()):i===25||i===24?r.notes.push(p()):o(`'NAMESPACE', 'CLASS', 'NOTE_FOR', 'NOTE'`);;){if(n[a]===3){let e=n[a+1];if(e===18||e===22||e===25||e===24){a++;break}a++}s(17);let r=e.pop();if(t.addClassesToNamespace(r.id,r.classes,r.notes),t.popNamespace(),e.length===0){c=!1;break}}}if(e.length===0)return}},h=()=>{let e=B[n[a]];return e===0?`none`:(a++,e-1)},g=()=>{let e=l(!0),i=n[a];if(i===10){t.addMember(e,t.cleanupLabel(r[a++]));return}let s=`none`;if(i===6)s=r[a++],i=n[a];else if(B[i]===0&&i!==38&&i!==39)return;let c=h();i=n[a],i!==38&&i!==39&&o(`'AGGREGATION', 'EXTENSION', 'COMPOSITION', 'DEPENDENCY', 'LOLLIPOP', 'LINE', 'DOTTED_LINE'`),a++;let u=h(),d=n[a]===6?r[a++]:`none`,f={id1:e,id2:l(!0),relation:{type1:c,type2:u,lineType:i===38?0:1},relationTitle1:s,relationTitle2:d};n[a]===10&&(f.title=t.cleanupLabel(r[a++])),t.addRelation(f)},_=()=>{let e=[];for(;;){pe[n[a]]===0&&o(`'ALPHA', 'NUM', 'COLON', 'UNIT', 'SPACE', 'BRKT', 'STYLE', 'PCT', 'LABEL'`);let t=r[a++];for(;pe[n[a]]===1;)t+=r[a++];if(e.push(t),n[a]!==28)return e;a++}},v=e=>{n[a]===6&&t.setTooltip(e,r[a++])},y=e=>{let i=s(6),o=n[a]===6?r[a++]:void 0;n[a]===42?t.setLink(e,i,r[a++]):t.setLink(e,i),o!==void 0&&t.setTooltip(e,o)},b=()=>{let e=n[a];switch(e){case 53:case 27:case 52:case 54:g();return;case 18:m();return;case 22:f();return;case 23:a++;return;case 20:{a++;let e=c();s(21),t.addAnnotation(l(!0),e);return}case 40:{a++;let e=l(!0);t.setClickEvent(e,s(6)),v(e);return}case 41:a++,y(l(!0));return;case 43:{a++;let e=l(!0);if(n[a]===46){a++,y(e);return}let i=s(44);n[a]===45?t.setClickEvent(e,i,r[a++]):t.setClickEvent(e,i),v(e);return}case 47:{a++;let e=s(27);t.setCssStyle(e,_());return}case 48:{a++;let e=s(6);t.setCssClass(e,s(27));return}case 25:case 24:p();return;case 26:{a++;let e=[s(27)];for(;n[a]===28;)a++,e.push(s(27));t.defineClass(e,_());return}case 29:case 30:case 31:case 32:a++,t.setDirection(e===29?`TB`:e===30?`BT`:e===31?`RL`:`LR`);return;case 11:a++,t.setAccTitle(s(12).trim());return;case 13:a++,t.setAccDescription(s(14).trim());return;case 15:t.setAccDescription(r[a++].trim());return}o(`'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'NAMESPACE', 'ANNOTATION_START', 'CLASS', 'MEMBER', 'NOTE_FOR', 'NOTE', 'CLASSDEF', 'direction_tb', 'CALLBACK', 'LINK', 'CLICK', 'STYLE', 'CSSCLASS', 'ALPHA', 'MINUS', 'BQUOTE_STR'`)},ee=n[a]===2;for(ee&&(a++,s(3));b(),!(n[a]!==3||(a++,n[a]===4||n[a]===0)););ee&&s(4),s(0)}function he(e,t,n,r){let i=Int32Array.from(e,(e,t)=>t),a=e=>{for(;i[e]!==e;)i[e]=i[i[e]],e=i[e];return e},o=(e,t)=>{i[a(e)]=a(t)};for(let t=0;t<e.length;t++)e[t].parent>=0&&o(t,e[t].parent);for(let e of t)o(e.src,e.dst);let s=new Map,c=(e,t,n,r=0,i=0)=>{e.left=Math.min(e.left,t-r/2),e.top=Math.min(e.top,n-i/2),e.right=Math.max(e.right,t+r/2),e.bottom=Math.max(e.bottom,n+i/2)};for(let t=0;t<e.length;t++){let n=a(t),r=s.get(n);r||(r={nodes:[],edges:[],left:1/0,top:1/0,right:-1/0,bottom:-1/0},s.set(n,r));let i=e[t];r.nodes.push(i),c(r,i.x,i.y,i.w,i.h)}if(s.size<2)return;for(let e of t){let t=s.get(a(e.src));t.edges.push(e);for(let n=0;n<e.route.length;n+=3)c(t,e.route[n],e.route[n+1]);e.labelW>0&&c(t,e.labelX,e.labelY,e.labelW,e.labelH)}let l=0,u=0,d=0,f=0,p=1/0,m=-1/0,h=[];for(let e of s.values()){let t=e.right-e.left,i=e.bottom-e.top;l>0&&l+t>n&&(u+=d+r,l=0,d=0),h.push(l-e.left,u-e.top),p=Math.min(p,e.left),m=Math.max(m,e.right),f=Math.max(f,l+t),d=Math.max(d,i),l+=t+r}if(f>=m-p)return;let g=0;for(let e of s.values())oe(e.nodes,e.edges,h[g++],h[g++]);return{width:f,height:u+d}}var H=[`aggregation`,`extension`,`composition`,`dependency`,`lollipop`];function U(e){return typeof e==`number`&&H[e]||`none`}function ge(e,t=!0){let n=[],r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=n=>{if(t||n===void 0)return n;let r=[],i=n,a;for(;i;){if(s.has(i)){a=s.get(i);break}let t=e.namespaces.get(i);if(t===void 0)break;if(t.explicit){a=i;break}r.push(i),i=t.parent}for(let e of r)s.set(e,a);return a},l=e=>e===void 0?-1:i.get(e)??-1;for(let r of e.namespaces.values())!t&&!r.explicit||(i.set(r.id,n.length),n.push({id:r.id,label:t?r.label:r.id,isGroup:!0,shape:`rect`,parentId:t?r.parent:void 0,parent:-1}));for(let e of n)e.parent=l(e.parentId);let u=0;for(let t of e.classes.values()){let e=c(t.parent);a.set(t.id,n.length),n.push({id:t.id,label:t.label,isGroup:!1,shape:`classBox`,parentId:e,parent:l(e),classNode:t,colorIndex:u++})}for(let t of e.notes.values()){let e=c(t.parent),i=t.class===void 0?void 0:a.get(t.class);i!==void 0&&r.push({id:`edgeNote${t.index}`,start:t.id,end:n[i].id,source:n.length,target:i,label:void 0,arrowTypeStart:`none`,arrowTypeEnd:`none`,startLabelRight:``,endLabelLeft:``,pattern:`dotted`,classes:`relation`}),n.push({id:t.id,label:t.text,isGroup:!1,shape:`note`,parentId:e,parent:l(e)})}for(let t of e.interfaces){let e=a.get(t.classId);o.set(t.id,n.length),n.push({id:t.id,label:t.label,isGroup:!1,shape:`interface`,parentId:void 0,parent:e===void 0?-1:n[e].parent})}let d=0;for(let t of e.relations){d++;let{type1:e,type2:n}=t.relation,i=e===M.LOLLIPOP&&n===`none`?o:a,s=i===a&&n===M.LOLLIPOP&&e===`none`?o:a;r.push({id:`id_${t.id1}_${t.id2}_${d}`,start:t.id1,end:t.id2,source:i.get(t.id1)??-1,target:s.get(t.id2)??-1,label:t.title,arrowTypeStart:U(e),arrowTypeEnd:U(n),startLabelRight:t.relationTitle1===`none`?``:t.relationTitle1,endLabelLeft:t.relationTitle2===`none`?``:t.relationTitle2,pattern:t.relation.lineType===1?`dashed`:`solid`,classes:`relation`})}return{nodes:n,edges:r}}var W=12,G=16,K=6,q=5;function _e(e){switch(e){case`extension`:return W;case`composition`:case`aggregation`:return G;case`lollipop`:return 2*q;case`dependency`:return m(`arrow_point`)}return 0}function ve(e,t,n,r,i,a){let o=-i,s=r;switch(e){case`extension`:{let e=t-r*W,a=n-i*W;return`<path class="pele-marker" d="M${u(t)},${u(n)}L${u(e+o*K)},${u(a+s*K)}L${u(e-o*K)},${u(a-s*K)}Z" stroke-linejoin="round"/>`}case`composition`:case`aggregation`:{let c=t-r*G/2,l=n-i*G/2,d=K-1;return`<path class="pele-marker" d="M${u(t)},${u(n)}L${u(c+o*d)},${u(l+s*d)}L${u(t-r*G)},${u(n-i*G)}L${u(c-o*d)},${u(l-s*d)}Z" stroke-linejoin="round"${e===`composition`?` fill="${a}"`:``}/>`}case`lollipop`:return`<circle class="pele-marker" cx="${u(t-r*q)}" cy="${u(n-i*q)}" r="${q}"/>`;case`dependency`:return _(`arrow_point`,t,n,r,i,a)}return``}var ye=40,be=16,xe=56,J=20,Se=26,Ce=12,we=8,Te=6,Ee=10,De=64,Oe=8,ke=`var(--_l)`,Ae=new Set([`_self`,`_blank`,`_parent`,`_top`]);function je(e,t,n){let r=e[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}var Me=[],Ne=[];function Pe(e,t,n){let r=T(e.getDisplayDetails().displayText).trim();return{text:r,width:t.width(r,n,e.classifier===`*`?2:0),classifier:e.classifier}}function Fe(e,t,n){let r=r=>f(n,i=>Ie(e,t,n,r,i));return d(e.direction)?p(n,r):r(!1)}function Ie(d,f,p,m,_){let b=f.class??{},S=ge(d,b.hierarchicalNamespaces!==!1),oe=b.hideEmptyMembersBox===!0,w=p.fontSize??16,E=Math.round(w*.875),D=Math.round(w*.8),O=Math.round(D*1.4),k=p.measurer??ce(p.fontFamily,p.fontFamilyMono),A=p.padding??8,j=(e,t)=>{if(!e.includes(`$$`))return;let n=c(e,!1,k,t,4e3);return n.lines.some(l)?n:void 0},M=e=>e?j(e,D)?.width??k.width(T(e),D,0):0,N=m?`TB`:se(d.direction),P=new Map,le=new Map,F=new Map,ue=e=>{let t=P.get(e);if(t===void 0){let n=s([e]);t=n.shape===``&&n.text===``?``:e.slice(0,e.indexOf(`:`)).trim().toLowerCase(),P.set(e,t)}t!==``&&F.set(t,e)},de=e=>{F.clear();let t=le.get(e.cssClasses);if(t===void 0){for(let t of e.cssClasses.split(` `)){let e=d.styleClasses.get(t);if(e)for(let t of e.styles)for(let e of t.split(`,`))ue(e)}t=[...F],le.set(e.cssClasses,t)}else for(let[e,n]of t)F.set(e,n);for(let t of e.styles)ue(t);return s(F.size===0?Ne:[...F.values()])},fe=new Int32Array(S.nodes.length);for(let e of S.nodes)e.parent>=0&&fe[e.parent]++;let I=new Uint8Array(S.nodes.length);for(let e of S.edges){if(e.source<0||e.target<0)continue;let t=S.nodes[e.source].parent,n=S.nodes[e.target].parent;if(t!==n){for(let e=t;e>=0&&I[e]===0;e=S.nodes[e].parent)I[e]=1;for(let e=n;e>=0&&I[e]===0;e=S.nodes[e].parent)I[e]=1}}let L=[],R=[];S.nodes.forEach((e,t)=>{let n,r;if(e.isGroup){let i=c(e.label,!1,k,w,4e3);n=z(e,i,0,0,w),fe[t]>0?(r=C(0,0),r.isGroup=!0,r.padX=J,r.padTop=i.height>0?i.height+16:J,r.padBottom=J,r.minW=i.width+2*J-12+(I[t]===1&&!_?Math.min(i.width+24,240):0)):(n.w=Math.max(i.width+2*J,80),n.h=i.height+2*J,r=C(n.w,n.h))}else if(e.classNode)n=pe(e,e.classNode),r=C(n.w,n.h);else if(e.shape===`note`){let t=c(e.label,!0,k,E,260);n=z(e,t,Math.max(t.width+2*Ce,40),t.height+2*we,E),r=C(n.w,n.h)}else{let t=c(e.label,!1,k,E,200);n=z(e,t,Math.max(t.width,12)+4,Math.max(t.height,12),E),r=C(n.w,n.h)}r.parent=e.parent,r.seq=t,L.push(n),R.push(r)});function z(e,t,n,r,i){return{node:e,style:s(Ne),label:t,w:n,h:r,loops:0,annotations:Ne,attributes:Me,methods:Me,titleH:0,attributesH:0,fontSize:i}}function pe(e,t){let n=de(t),r=n.fontSize??w,i=Math.round(r*.875),a=Math.round(i*1.5),o=t.type?`<`+x(t.type).replace(/</g,`<`).replace(/>/g,`>`)+`>`:``,s=c(t.label+o,!1,k,r,4e3,1|(n.italic?2:0)),l=t.annotations.length>0?t.annotations.map(e=>j(`«${e.trim()}»`,D)??`«${T(e).trim()}»`):Ne,u=t.members.length>0?t.members.map(e=>Pe(e,k,i)):Me,d=t.methods.length>0?t.methods.map(e=>Pe(e,k,i)):Me,f=s.width,p=0;for(let e of l)f=Math.max(f,typeof e==`string`?k.width(e,D,0):e.width),p+=typeof e==`string`?O:Math.max(O,e.height);for(let e of u)f=Math.max(f,e.width);for(let e of d)f=Math.max(f,e.width);let m=!(oe&&u.length===0&&d.length===0),h=e=>m?e>0?2*Te+e*a:Ee:0,g=2*we+p+Math.max(s.height,Math.round(r*1.5)),_=h(u.length);return{node:e,style:n,label:s,w:Math.max(f+2*Ce,De),h:g+_+h(d.length),loops:0,annotations:l,attributes:u,methods:d,titleH:g,attributesH:_,fontSize:r}}let B=[],V=[],me=[],H=[],U=[],W=new Float64Array(L.length*4),G=(e,t,n)=>{W[e*4+t]++,n>W[e*4+t+1]&&(W[e*4+t+1]=n)};for(let e of S.edges){if(e.source<0||e.target<0)continue;let t=c(e.label,!0,k,E,200),n=M(e.startLabelRight),r=M(e.endLabelLeft);e.source===e.target?(L[e.source].loops++,R[e.source].w+=2*(Se+(t.width>0?t.width+12:0))):(G(e.source,0,n),G(e.target,2,r)),H.push(n),U.push(r),V.push(e),me.push(t),B.push({src:e.source,dst:e.target,minlen:1,labelW:t.width>0?t.width+12:0,labelH:t.height>0?t.height+4:0,route:[],labelX:0,labelY:0})}if(N===`TB`||N===`BT`)for(let e=0;e<L.length;e++){if(!L[e].node.classNode)continue;let t=0;for(let n=0;n<4;n+=2){let r=W[e*4+n],i=W[e*4+n+1];r>1&&(t=Math.max(t,(r-1)*(i>0?i+24:14)+24))}t=Math.min(t,480),t>L[e].w&&(R[e].w+=t-L[e].w,L[e].w=t)}let K=!1;for(let e=0;e<V.length&&!K;e++)K=H[e]>0||U[e]>0;let q=0;if(N===`TB`||N===`BT`){let e=e=>e?Math.max(O,j(e,D)?.height??0):0;for(let t of V)q=Math.max(q,e(t.startLabelRight)+e(t.endLabelLeft)-2*O)}let Fe=ae(R,B,N,{nodeSep:je(b,`nodeSpacing`,ye),edgeSep:be,rankSep:je(b,`rankSpacing`,K?xe+16:xe)+q,portSep:20,apart:!0}),Ie=new Map,Y=[],Le=(e,t,n,r,i)=>{let a=e.route,o=R[n],s=y(a,t,o);if(s<0)return;let c=(o.w-L[n].w)/2;s===1?a[t]-=c:s===3&&(a[t]+=c);let l=s&1,u=a[(t===0?3:t-3)+l],d=u-a[t+l],f={route:a,at:t,toward:u,order:i,room:r,side:s,after:l?d>0:d>=0},p=n*4+s,m=Ie.get(p);return m?m.push(f):Ie.set(p,[f]),f},Re=[],ze=[];for(let e=0;e<B.length;e++){let t=B[e],n=t.src!==t.dst&&t.route.length>=6;Re.push(n?Le(t,0,t.src,H[e],e):void 0),ze.push(n?Le(t,t.route.length-3,t.dst,U[e],e):void 0)}let Be=(e,t,n)=>{for(let r=R[e].parent,i=0;r>=0&&i<1e4;r=R[r].parent,i++){let e=R[r],i=Math.abs(t-e.x),a=Math.abs(n-e.y);if(Math.abs(a-e.h/2)<.5&&i<=e.w/2+.5||Math.abs(i-e.w/2)<.5&&a<=e.h/2+.5)return!0}return!1},Ve=[];for(let[e,t]of Ie){if(t.length<2)continue;let n=e>>2,r=e&1,i=r?L[n].h:L[n].w;t.sort((e,t)=>e.toward-t.toward||e.order-t.order);let a=0;for(let e=0;e+1<t.length;e++){let n=t[e],i=t[e+1],o=r?20:24;n.room>0&&n.after&&(o+=r?O+6:n.room),i.room>0&&!i.after&&(o+=r?O+6:i.room),Ve[e]=o,a+=o}let o=Math.min(1,(i-24)/a);if(o<=0)continue;let s=(r?R[n].y:R[n].x)-a*o/2;for(let e=0;e<t.length;e++){let{route:i,at:a}=t[e],c=a===0?3:-3,l=a+c,u=-1;for(let e=l;e>=0&&e<i.length&&Math.abs(i[e+r]-i[l+r])<.5;e+=c)if(Be(n,i[e],i[e+1])){u=e;break}if(u>=0&&Math.abs(i[l+r]-s)<=24)for(let e=l;e!==u+c;e+=c)i[e+r]=s;i[a+r]=s,s+=Ve[e]*o}}let He=(e,t,n,r)=>{if(t===void 0||n<=0)return;let i=t.side&1,a=r?0:e.length-3,o=a+1-i,s=Math.abs(e[(r?3:a-3)+1-i]-e[o]),c=Math.min(i?n+10:O+6,s*.35);if(c<4)return;let l=[e[a],e[a+1],e[a+2]];l[1-i]+=(t.side===0||t.side===3?-1:1)*c,e.splice(r?3:a,0,l[0],l[1],l[2])};for(let e=0;e<B.length;e++)He(B[e].route,Re[e],H[e],!0),He(B[e].route,ze[e],U[e],!1);let X=0,Z=0,Ue=Fe.width,We=Fe.height,Ge=(e,t,n,r,i,a,o)=>{if(!t)return;let s=j(t,D),c=s?Math.max(O,s.height):O,l=r,u=i;a&1?(l+=(a===3?-1:1)*(5+n/2),u+=(o?1:-1)*(7+c/2)):(l+=(o?1:-1)*(9+n/2),u+=(a===0?-1:1)*(3+c/2)),Y.push({text:T(t),math:s,x:l,y:u,w:n,h:c,parent:e}),X=Math.min(X,l-n/2),Ue=Math.max(Ue,l+n/2),Z=Math.min(Z,u-c/2),We=Math.max(We,u+c/2)},Ke=new Map,qe=new Int32Array(B.length);for(let e=0;e<B.length;e++){let t=B[e],n=V[e],r=t.route;if(t.src===t.dst){let r=Ke.get(t.src)??0;Ke.set(t.src,r+1),qe[e]=r;let i=R[t.src],a=L[t.src],o=i.x+a.w/2,s=Math.min(a.h/2-4,8+r*6);Ge(t.src,n.startLabelRight,H[e],o,i.y-s,1,!1),Ge(t.dst,n.endLabelLeft,U[e],o,i.y+s,1,!0),t.labelX=i.x+a.w/2+Se+r*8+4+t.labelW/2,t.labelY=i.y}else if(r.length>=6){let i=r.length-3,a=Re[e],o=ze[e];Ge(t.src,n.startLabelRight,H[e],r[0],r[1],a?a.side:2,!a||a.after),Ge(t.dst,n.endLabelLeft,U[e],r[i],r[i+1],o?o.side:0,!o||o.after)}}let Je=p.maxWidth;if(Je!==void 0&&Je>0&&Ue-X+2*A>Je){let e=Y.map(e=>({...C(e.w,e.h,e.parent),x:e.x,y:e.y})),t=he(R.concat(e),B,Math.max(1,Je-2*A),je(b,`nodeSpacing`,ye));t&&(Y.forEach((t,n)=>{t.x=e[n].x,t.y=e[n].y}),X=Z=0,Ue=t.width,We=t.height)}let Q=A-X,$=A-Z,Ye=Math.ceil(Ue-X+2*A),Xe=Math.ceil(We-Z+2*A),Ze=[],Qe=new Map;if(S.nodes.length>0&&S.nodes[0].isGroup)for(let e of B)re(Qe,e.route);let $e=``,et=``,tt=``;for(let e=0;e<L.length;e++){let t=L[e],n=R[e],r=t.node,s=n.x+Q,c=n.y+$,l=i(r.id),d=n.isGroup?n.w:t.w,f=n.isGroup?n.h:t.h;if(r.isGroup){let r=n.isGroup?ne(n,t.label.width,Qe,J):n.x,i=c-f/2+8+t.label.height/2,p=` class="pele-cluster-label" fill="var(--_m)"`,m=n.isGroup&&te(n,t.label.width,r,Qe);m&&(et+=ie(t.label,r+Q,i,p,l,S.nodes,e)),$e+=`<g class="pele-cluster pele-namespace" data-id="${l}"><rect x="${u(s-d/2)}" y="${u(c-f/2)}" width="${u(d)}" height="${u(f)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${o}/>`+(m?``:a(t.label,r+Q,i,p))+`</g>`;continue}let m=` transform="translate(${u(s)},${u(c)})"`;if(r.classNode)tt+=nt(t,r.classNode,l,m);else if(r.shape===`note`){let e=d/2,n=-f/2;tt+=`<g class="pele-node pele-note" data-id="${l}"${m}><path d="M${u(-e)},${u(n)}H${u(e-Oe)}L${u(e)},${u(n+Oe)}V${u(-n)}H${u(-e)}Z" fill="var(--_a)" stroke="var(--_b)" stroke-linejoin="round"/><path d="M${u(e-Oe)},${u(n)}V${u(n+Oe)}H${u(e)}" fill="none" stroke="var(--_b)" stroke-linejoin="round"/>`+a(t.label,0,0,` class="pele-label" font-size="${E}"`,p.icons)+`</g>`}else tt+=`<g class="pele-node pele-interface" data-id="${l}"${m}>`+a(t.label,0,0,` class="pele-label" font-size="${E}"`,p.icons)+`</g>`}function nt(e,o,s,c){let{w:l,h:d,style:f}=e,m=-l/2,h=-d/2,g=Math.round(e.fontSize*.875),_=Math.round(g*1.5),v=`<rect x="${u(m)}" y="${u(h)}" width="${u(l)}" height="${u(d)}" fill="var(--_s)" stroke="var(--_b)"${r(f.shape)}/>`,y=h+e.titleH,b=y+e.attributesH;if(d>e.titleH){let e=f.stroke?` style="stroke:${t(f.stroke)}"`:``;v+=`<path class="pele-divider" d="M${u(m)},${u(y)}H${u(-m)}M${u(m)},${u(b)}H${u(-m)}" fill="none" stroke="var(--_b)"${e}/>`}let x=h+we;for(let n of e.annotations)if(typeof n==`string`)v+=`<text class="pele-annotation" x="0" y="${u(x+O/2+D*.35)}" text-anchor="middle" font-size="${D}" fill="var(--_m)">${t(n)}</text>`,x+=O;else{let e=Math.max(O,n.height);v+=a(n,0,x+e/2,` class="pele-annotation" font-size="${D}" fill="var(--_m)"`,p.icons),x+=e}let S=e.fontSize===w?``:` font-size="${u(e.fontSize)}"`;v+=a(e.label,0,(x+y-we)/2,` class="pele-label"${S} font-weight="var(--_hw)"${f.text}`,p.icons);let te=(e,n,r)=>{let i=``,a=r+Te+_/2+g*.35;for(let r of e){let e=r.classifier===`$`?` pele-static"${f.text?f.text.slice(0,-1)+`text-decoration:underline"`:` style="text-decoration:underline"`}`:r.classifier===`*`?` pele-abstract" font-style="italic"${f.text}`:`"${f.text}`;i+=`<text class="pele-member pele-${n}${e} x="${u(m+Ce)}" y="${u(a)}">${t(r.text)}</text>`,a+=_}return i};return(e.attributes.length>0||e.methods.length>0)&&(v+=`<g class="pele-members" font-size="${g}">${te(e.attributes,`attribute`,y)}${te(e.methods,`method`,b)}</g>`),o.tooltip&&(v=`<title>${i(o.tooltip)}</title>`+v),o.link&&(v=ee(v,o.link,o.id,Ze,p,o.linkTarget&&Ae.has(o.linkTarget)?` target="${o.linkTarget}"`:``)),`<g class="pele-node pele-class${n(o.cssClasses.replace(/^default\s?/,``))}" data-id="${s}"${c}>${v}</g>`}let rt=``,it=``;for(let e=0;e<B.length;e++){let t=B[e],n=V[e],r=me[e],a=n.arrowTypeStart,o=n.arrowTypeEnd,s=_e(a),c=_e(o),l;if(t.src===t.dst){let n=R[t.src],r=L[t.src],i=qe[e],a=n.x+Q+r.w/2,o=n.y+$,d=Math.min(r.h/2-4,8+i*6),f=Se+i*8;l={d:`M${u(a+s)},${u(o-d)}C${u(a+f+s)},${u(o-d)} ${u(a+f+c)},${u(o+d)} ${u(a+c)},${u(o+d)}`,sx:a,sy:o-d,sdx:-1,sdy:0,ex:a,ey:o+d,edx:-1,edy:0}}else{let e=t.route;for(let t=0;t<e.length;t+=3)e[t]+=Q,e[t+1]+=$;l=g(e,void 0,s,c)}let d=n.pattern===`dashed`?` stroke-dasharray="6 4"`:n.pattern===`dotted`?` stroke-dasharray="2 4"`:``;if(rt+=`<g class="pele-edge${n.pattern===`dotted`?` pele-note-edge`:` pele-relation`}" data-id="${i(n.id)}"><path d="${l.d}"${d}/>`+ve(a,l.sx,l.sy,l.sdx,l.sdy,ke)+ve(o,l.ex,l.ey,l.edx,l.edy,ke)+`</g>`,r.width>0){let e=t.labelX+Q,i=t.labelY+$;it+=h(n.id,r,e,i,``,p.icons)}}let at=``;for(let e of Y)at+=e.math?a(e.math,e.x+Q,e.y+$,` class="pele-cardinality"`,p.icons):`<text class="pele-cardinality" x="${u(e.x+Q)}" y="${u(e.y+$+D*.35)}" text-anchor="middle">${t(e.text)}</text>`;let ot=v(d.title,k,w,A,Ye,Xe,($e?`<g class="pele-clusters">${$e}</g>`:``)+(rt?`<g class="pele-edges" fill="none" stroke="${ke}" stroke-linecap="round">${rt}</g>`:``)+(et?`<g class="pele-cluster-titles">${et}</g>`:``)+(it?`<g class="pele-edge-labels" font-size="${E}">${it}</g>`:``)+(at?`<g class="pele-cardinalities" font-size="${D}" fill="var(--_m)">${at}</g>`:``)+`<g class="pele-nodes">${tt}</g>`);return{svg:e(`class`,ot.width,ot.height,w,p,d,ot.content),width:ot.width,height:ot.height,links:Ze}}var Y={type:`class`,math:!0,parse(e,t,n){let r=new F;return n&&(r.title=n),me(e,r),r},render:Fe};export{Y as classDiagram};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,a as t,b as n,c as r,d as i,i as a,m as o,o as s,p as c,r as l,s as u,t as d,u as f,v as p,x as m,y as h}from"./
|
|
1
|
+
import{_ as e,a as t,b as n,c as r,d as i,i as a,m as o,o as s,p as c,r as l,s as u,t as d,u as f,v as p,x as m,y as h}from"./C2npZzkn.js";import{a as g,t as _}from"./DciMwFJ1.js";import{i as v,l as y}from"./BXBhaEho.js";import{t as b}from"./DDAG55ce.js";import{a as x,r as S}from"./DKqMzyyE.js";import{t as C}from"./BZmnMkFw.js";import{n as w,r as ee}from"./BCGaqnao.js";import{i as te,n as ne,r as T,t as re}from"./D1LK3xRu.js";import{d as ie,g as E,h as D,s as O,u as ae,y as k}from"./CMikI1NP.js";function A(e){return e===`markdown`||e===`string`||e===`text`?e:`markdown`}var oe=class{type=`er`;direction=`TB`;entities=new Map;relationships=[];classes=new Map;subgraphs=[];title;accTitle;accDescr;subgraphLookup=new Map;claimed=new Set;addEntity(e,t=``){let n=this.entities.get(e);return n===void 0?(n={id:`entity-${e}-${this.entities.size}`,label:e,alias:t,attributes:[],cssClasses:`default`,cssStyles:[]},this.entities.set(e,n)):!n.alias&&t&&(n.alias=t),n}addAttributes(e,t){let n=this.addEntity(e);for(let e=t.length-1;e>=0;e--){let r=t[e];r.keys??=[],r.comment??=``,n.attributes.push(r)}}addRelationship(e,t,n,r){let i=this.subgraphLookup.has(e)?e:this.addEntity(e).id,a=this.subgraphLookup.has(n)?n:this.addEntity(n).id;this.relationships.push({entityA:i,roleA:t,entityB:a,relSpec:r})}setDirection(e){this.direction=e}addCssStyles(e,t){if(t)for(let n of e){let e=this.entities.get(n);if(e)for(let n of t)e.cssStyles.push(n);let r=this.subgraphLookup.get(n);if(r)for(let e of t)r.cssStyles.push(e)}}addClass(e,t){for(let n of e){let e=this.classes.get(n);if(e===void 0&&(e={id:n,styles:[],textStyles:[]},this.classes.set(n,e)),t)for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n)}}setClass(e,t){for(let n of e){let e=this.entities.get(n);if(e)for(let n of t)e.cssClasses+=` `+n;let r=this.subgraphLookup.get(n);if(r)for(let e of t)r.classes.push(e)}}addSubGraph(e,t,n){let r=e.text.trim(),i=new Set,a=[],o;for(let e of t.flat()){if(typeof e!=`string`){e?.stmt===`dir`&&(o=e.value);continue}let t=e.trim();t===``||i.has(t)||(i.add(t),this.claimed.has(e)||a.push(e))}for(let e of a)this.claimed.add(e);let s={id:r,nodes:a,title:(n.text||``).trim(),classes:[],cssStyles:[],dir:o,labelType:A(n.type)};return this.subgraphs.push(s),this.subgraphLookup.set(r,s),r}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
2
|
`)}},j=`$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`.split(`.`),M=1,N=2,P=4,F=8,I=new Uint8Array(128);for(let e=0;e<128;e++){let t=e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95,n=t&&(e<48||e>57);t&&(I[e]|=M|N|F),n&&(I[e]|=P)}for(let e of`-*`)I[e.charCodeAt(0)]|=M|N|F;I[46]|=M|F,I[42]|=P;for(let e of`[](),`)I[e.charCodeAt(0)]|=F;var L=/accTitle\s*:\s*/iy,R=/accDescr\s*:\s*/iy,z=/accDescr\s*\{\s*/iy,se=[/.*direction\s+TB[^\n]*/iy,/.*direction\s+BT[^\n]*/iy,/.*direction\s+RL[^\n]*/iy,/.*direction\s+LR[^\n]*/iy],B=/direction/gi,V=/[\n\r\u2028\u2029]/g;function H(e,t){return e<128?(I[e]&t)!==0:e>=192||e===181}function U(e){let t=e.length,n=[],r=[],i=[],a=0,o=0,s=-2,c=0,l=-1,u=-2,d=-1,f=-1,p=-1,m=(t,a,s)=>{n.push(t),r.push(e.slice(a,s)),i.push(a),o=s},h=(t,n)=>(t.lastIndex=n,t.test(e)?t.lastIndex:-1),g=t=>{for(let n=0;n<t.length;n++){let r=t.charCodeAt(n),i=e.charCodeAt(o+n);if(i!==r&&(r<97||r>122||(i|32)!==r))return!1}return!0},_=t=>g(t)&&!E(e.charCodeAt(o+t.length)),v=t=>{let n=e.charCodeAt(t);return n>=65&&n<=90?n+32:n},y=n=>(V.lastIndex=n,V.test(e)?V.lastIndex-1:t),b=t=>{for(;k(e.charCodeAt(t));)t++;return t},x=()=>{if(s===-1||s<o&&(B.lastIndex=o,s=B.test(e)?B.lastIndex-9:-1,s===-1)||o<c||(l<o&&(l=y(o)),s>=l))return!1;for(let e=0;e<4;e++){let t=h(se[e],o);if(t>=0)return m(18+e,o,t),!0}return c=l,!1},S=()=>{let t=e.indexOf(`"`,o+1);if(t===-1){m(45,o,o+1);return}let n=t>o+1;for(let r=o+1;n&&r<t;r++){let t=e.charCodeAt(r);(t===37||t===92||t===13||t===10||t===11||t===8)&&(n=!1)}m(n?31:44,o,t+1)},C=t=>{let n=e.charCodeAt(o+1);if(n===43&&(t===49||t===48)){m(t===49?39:38,o,o+2);return}let r=b(o+1);if(e.charCodeAt(r)===46&&k(e.charCodeAt(r+1)))m(32,o,b(r+2));else{if(t===49){if(D(n)){let t=o+2;for(;D(e.charCodeAt(t));)t++;let n=e.charCodeAt(t);if(E(n)||n===34||n===39){m(40,o,o+1);return}}else if(n===45||n===46){let t=e.charCodeAt(o+2);if(t===45||t===46){m(40,o,o+1);return}}if(!E(n)){m(33,o,o+1);return}}m(29,o,r)}},w=t=>{let n=e.charCodeAt(o+1);switch(t){case 101:if(_(`erdiagram`))m(2,o,o+9);else if(_(`end`)){let t=o+3;for(;D(e.charCodeAt(t));)t++;m(16,o,t)}else return!1;return!0;case 115:if(_(`style`))a=6,m(27,o,o+5);else if(_(`subgraph`))m(17,o,o+8);else return!1;return!0;case 99:if(_(`classdef`))a=6,m(22,o,o+8);else if(_(`class`))m(26,o,o+5);else return!1;return!0;case 111:if(_(`one or zero`))m(37,o,o+11);else if(_(`one or more`)||_(`one or many`))m(39,o,o+11);else if(_(`one`))m(40,o,o+3);else if(_(`only one`))m(40,o,o+8);else if(n===124)m(37,o,o+2);else if(n===123)m(38,o,o+2);else if(_(`optionally to`))m(42,o,o+13);else return!1;return!0;case 122:if(_(`zero or one`))m(37,o,o+11);else if(_(`zero or more`)||_(`zero or many`))m(38,o,o+12);else return!1;return!0;case 109:if(g(`many(0)`))m(38,o,o+7);else if(g(`many(1)`))m(39,o,o+7);else if(_(`many`))m(38,o,o+4);else return!1;return!0;case 116:return _(`to`)?(m(43,o,o+2),!0):!1;case 117:return n!==46&&n!==45&&n!==124?!1:(m(41,o,o+1),!0);case 124:if(v(o+1)===111&&!E(e.charCodeAt(o+2)))m(37,o,o+2);else if(n===124)m(40,o,o+2);else if(n===123)m(39,o,o+2);else return!1;return!0;case 125:if(v(o+1)===111&&!E(e.charCodeAt(o+2)))m(38,o,o+2);else if(n===124)m(39,o,o+2);else return!1;return!0;case 46:return n!==46&&n!==45?!1:(m(42,o,o+2),!0);case 45:if(n===45)m(43,o,o+2);else if(n===46)m(42,o,o+2);else return!1;return!0}return!1},ee=t=>{let n;if((t===97||t===65)&&g(`acc`)){if((n=h(L,o))>=0){a=3,m(11,o,n);return}if((n=h(R,o))>=0){a=4,m(13,o,n);return}if((n=h(z,o))>=0){a=5,o=n;return}}if(!x()){switch(t){case 32:case 9:case 13:n=o+1;for(let t=e.charCodeAt(n);t===32||t===9||t===13;t=e.charCodeAt(n))n++;o=n;return;case 10:for(n=o+1;e.charCodeAt(n)===10;)n++;m(4,o,n);return;case 34:S();return;case 123:a=1,m(7,o,o+1);return;case 35:m(30,o,o+1);return;case 44:m(25,o,o+1);return;case 58:e.charCodeAt(o+1)===58&&e.charCodeAt(o+2)===58?m(6,o,o+3):m(5,o,o+1);return;case 91:m(9,o,o+1);return;case 93:m(10,o,o+1);return}if(k(t)){C(t);return}if(!w(t>=65&&t<=90?t+32:t)){if(t>=128||(I[t]&M)!==0){n=o+1;for(let t=e.charCodeAt(n);t>=128||(I[t]&M)!==0;t=e.charCodeAt(n))n++;m(23,o,n);return}m(45,o,o+1)}}},te=()=>{if(u===-1||u<o&&(u=e.indexOf(`~`,o),u===-1))return!1;if(p<o){let n=o;for(;n<t&&!D(e.charCodeAt(n));)n++;p=n}if(u>=p||(d<o&&(d=y(o),f=e.lastIndexOf(`~`,d-1)),f<=u))return!1;let n=f+1;for(;n<t&&!D(e.charCodeAt(n));)n++;return m(34,o,n),!0},ne=n=>{if(D(n)){for(o++;D(e.charCodeAt(o));)o++;return}let r=n|32;if((r===112||r===102||r===117)&&(e.charCodeAt(o+1)|32)==107&&!E(e.charCodeAt(o+2)))m(35,o,o+2);else if(!te()){if(H(n,P)){let n=o+1;for(;n<t&&H(e.charCodeAt(n),F);)n++;m(34,o,n);return}if(n===96){a=2,o++;return}if(n===34){let t=e.indexOf(`"`,o+1);if(t!==-1){m(36,o,t+1);return}}else if(n===125){a=0,m(8,o,o+1);return}m(45,o,o+1)}};for(;o<t;){let s=e.charCodeAt(o),c;switch(a){case 0:ee(s);break;case 1:ne(s);break;case 2:s===96?(a=1,o++):(c=e.indexOf("`",o),m(34,o,c===-1?t:c));break;case 3:case 4:c=e.indexOf(`
|
|
3
3
|
`,o),m(a===3?12:14,o,c===-1?t:c),a=0;break;case 5:s===125?(a=0,o++):(c=e.indexOf(`}`,o),m(15,o,c===-1?t:c));break;case 6:if(s===10){for(c=o+1;e.charCodeAt(c)===10;)c++;a=0,m(4,o,c)}else if(D(s))for(o++;D(e.charCodeAt(o));)o++;else if(s===58)m(5,o,o+1);else if(s===44)m(25,o,o+1);else if(s===35)m(30,o,o+1);else if(s===59)m(28,o,o+1);else if(s>=128||(I[s]&N)!==0){c=o+1;for(let t=e.charCodeAt(c);t>=128||(I[t]&N)!==0;t=e.charCodeAt(c))c++;m(24,o,c)}else return n.push(1),r.push(``),i.push(o),{types:n,texts:r,starts:i}}}let T=a===0?3:a===3?12:a===4?14:a===5?15:-1;return T!==-1&&(n.push(T),r.push(``),i.push(t)),n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var W=new Map([[37,`ZERO_OR_ONE`],[38,`ZERO_OR_MORE`],[39,`ONE_OR_MORE`],[40,`ONLY_ONE`],[41,`MD_PARENT`]]),ce=[`TB`,`BT`,`RL`,`LR`],G=`'UNICODE_TEXT', 'NUM', 'ENTITY_NAME', 'DECIMAL_NUM', 'ENTITY_ONE'`,le=`'ZERO_OR_ONE', 'ZERO_OR_MORE', 'ONE_OR_MORE', 'ONLY_ONE', 'MD_PARENT'`,K=`'EOF', 'NEWLINE', 'title', 'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'SUBGRAPH', 'direction_tb', 'direction_bt', 'direction_rl', 'direction_lr', 'CLASSDEF', 'CLASS', 'STYLE', `+G;function q(e,t){let{types:n,texts:r,starts:i}=U(e),a=0,o=t=>{let o=n[a];throw o===1?O(`er`,e,i[a],``,!0):O(`er`,e,i[a],`Expecting ${t}, got '${o===45?r[a]:j[o]}'`)},s=e=>(n[a]!==e&&o(`'${j[e]}'`),r[a++]),c=()=>{let e=n[a];e!==4&&e!==28&&e!==3&&o(`'EOF', 'NEWLINE', 'SEMI'`),a++},l=e=>e===23||e===31||e===29||e===32||e===33,u=()=>{let e=n[a];l(e)||o(G);let t=r[a++];return e===31?t.slice(1,-1):t},d=()=>{let e=[];for(;;){let t=n[a];if(t!==23&&t!==24&&o(`'UNICODE_TEXT', 'STYLE_TEXT'`),e.push(r[a++]),n[a]!==25)return e;a++}},f=e=>e===24||e===29||e===5||e===30,p=()=>{let e=[];for(;;){f(n[a])||o(`'STYLE_TEXT', 'COLON', 'NUM', 'BRKT'`);let t=r[a++];for(;f(n[a]);)t+=r[a++];if(e.push(t),n[a]!==25)return e;a++}},m=()=>{let e=W.get(n[a++]),t=n[a];t!==43&&t!==42&&o(`'NON_IDENTIFYING', 'IDENTIFYING'`);let r=t===43?`IDENTIFYING`:`NON_IDENTIFYING`;a++;let i=W.get(n[a]);return i===void 0?o(le):(a++,{cardA:i,relType:r,cardB:e})},h=()=>{let e=n[a];e!==44&&e!==31&&e!==23&&o(`'UNICODE_TEXT', 'ENTITY_NAME', 'WORD'`);let t=r[a++];return e===23?t:t.slice(1,-1)},g=e=>n[a]===45&&r[a]===e,_=()=>{let e=[];do{let t=s(34);g(`?`)&&(t+=r[a++]),n[a]!==34&&o(t.endsWith(`?`)?`'ATTRIBUTE_WORD'`:`'ATTRIBUTE_WORD', '?'`);let i={type:t,name:r[a++]};if(n[a]===35){let e=[r[a++]];for(;g(`,`);)a++,e.push(s(35));i.keys=e}n[a]===36&&(i.comment=r[a++].slice(1,-1)),e.push(i)}while(n[a]!==8);return e.reverse()},v=()=>{if(n[a]!==7)return;if(a++,n[a]===8){a++;return}let e=_();return a++,e},y=()=>{let e=u(),r=n[a];if(r===9){a++;let r=u();s(10);let i;n[a]===6&&(a++,i=d());let o=v();return t.addEntity(e,r),o&&t.addAttributes(e,o),i&&t.setClass([e],i),[e]}let i;if(r===6&&(a++,i=d(),r=n[a]),W.has(r)){let r=m(),o=u(),c;n[a]===6&&(a++,c=d()),s(5);let l=h();return t.addEntity(e),t.addEntity(o),t.addRelationship(e,l,o,r),i&&t.setClass([e],i),c&&t.setClass([o],c),[e,o]}let o=v();return t.addEntity(e),o&&t.addAttributes(e,o),i&&t.setClass([e],i),[e]};s(2);let b=[{id:``,title:``,list:[]}],x=b[0],S=!1;for(;;){let e=n[a];switch(e){case 4:a++;break;case 3:a++,S&&o(`'END', ${K}`);return;case 16:{S||o(K),a++;let e=t.addSubGraph({text:x.id},x.list,{text:x.title});b.pop(),x=b[b.length-1],S=b.length>1,S&&x.list.push(e);break}case 17:{a++;let e=u(),t=e;if(n[a]===9){for(a++,t=u();l(n[a]);)t+=` `+u();s(10)}c(),x={id:e,title:t,list:[]},b.push(x),S=!0;break}case 11:{a++;let e=s(12).trim();t.setAccTitle(e),S&&x.list.push(e);break}case 13:{a++;let e=s(14).trim();t.setAccDescription(e),S&&x.list.push(e);break}case 15:{let e=r[a++].trim();t.setAccDescription(e),S&&x.list.push(e);break}case 18:case 19:case 20:case 21:{a++;let n=ce[e-18];S?x.list.push({stmt:`dir`,value:n}):t.setDirection(n);break}case 22:{let e=r[a++],n=d(),i=p();c(),t.addClass(n,i),S&&x.list.push(e);break}case 26:{let e=r[a++],n=d();t.setClass(n,d()),S&&x.list.push(e);break}case 27:{let e=r[a++],n=d(),i=p();c(),t.addCssStyles(n,i),S&&x.list.push(e);break}default:{l(e)||o(S?`'END', ${K}`:K);let t=y();if(S)for(let e of t)x.list.push(e)}}}}var ue=[];function de(e){let t=[],n=[],r=e.subgraphs,i=t=>{let n=[];for(let r of t){let t=e.classes.get(r);if(t!==void 0){for(let e of t.styles)n.push(e.trim());for(let e of t.textStyles)n.push(e.trim())}}return n},a=new Map,o=new Set;for(let e=r.length-1;e>=0;e--){let t=r[e];o.add(t.id);for(let e of t.nodes)a.set(e,t.id)}for(let e=r.length-1;e>=0;e--){let n=r[e];t.push({id:n.id,label:n.title,alias:``,attributes:ue,isGroup:!0,parentId:a.get(n.id),cssStyles:n.cssStyles,cssCompiledStyles:i(n.classes),cssClasses:n.classes.join(` `),dir:n.dir,labelType:n.labelType})}let s=new Map;for(let[n,r]of e.entities)o.has(n)?s.set(r.id,n):t.push({id:r.id,label:r.label,alias:r.alias,attributes:r.attributes,isGroup:!1,parentId:a.get(n),cssStyles:r.cssStyles,cssCompiledStyles:i(r.cssClasses.split(` `)),cssClasses:r.cssClasses,dir:void 0,labelType:`markdown`});return e.relationships.forEach((e,t)=>{n.push({id:`id_${e.entityA}_${e.entityB}_${t}`,start:s.get(e.entityA)??e.entityA,end:s.get(e.entityB)??e.entityB,label:e.roleA,arrowTypeStart:e.relSpec.cardB.toLowerCase(),arrowTypeEnd:e.relSpec.cardA.toLowerCase(),pattern:e.relSpec.relType===`IDENTIFYING`?`solid`:`dashed`})}),{nodes:t,edges:n}}var J=18,fe=5,pe=6,me=10,he=3.5;function Y(e,t,n,r,i){let a=(e,a)=>m(t-r*e-i*a)+`,`+m(n-i*e+r*a),o=e=>`M${a(e,-fe)}L${a(e,fe)}`,s=`M${a(0,-pe)}L${a(me,0)}L${a(0,pe)}`,c=e=>`<circle class="pele-marker" cx="${m(t-r*e)}" cy="${m(n-i*e)}" r="${he}" fill="var(--_bg)"/>`,l=e=>`<path class="pele-marker" d="${e}"/>`;switch(e){case`only_one`:return l(o(6)+o(10));case`zero_or_one`:return l(o(6))+c(13.5);case`one_or_more`:return l(s+o(me+3.5));case`zero_or_more`:return l(s)+c(me+he+.5);case`md_parent`:return`<path class="pele-marker" d="M${a(0,0)}L${a(6,4)}L${a(12,0)}L${a(6,-4)}Z" fill="var(--_bg)"/>`}return``}var ge=48,_e=20,ve=64,X=20,Z=28,ye=38,be=96,xe=18,Se=12,Ce=9,we=12,Te=16,Ee=9,De=260,Oe=1e6,ke=[],Ae=18,je=14,Me=` fill="var(--_s)" stroke="var(--_b)"`;function Ne(e,t,n){let r=e.er?.[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}function Q(e,n,i,l,u){let f=e.lines;if(f.length===0)return``;let g=f.length===1&&f[0].length===1?f[0][0]:void 0;if(g&&g.icon===void 0&&g.math===void 0&&g.style===0)return`<text${l} x="${m(n)}" y="${m(i)}">${t(g.text)}</text>`;let _=r(e),v=e.size*.35,y=i-v-e.lineHeight/2,b=``,x=``;for(let r=0;r<f.length;r++){let d=f[r],g=y+c(e,r);if(p(d)){x+=s(h(e,r),n+e.widths[r]/2,g,l,u);continue}i=g+v;let S=!1;for(let e of d)e.icon!==void 0&&(S=!0);let C=n,w=!1;for(let n of d){if(n.icon!==void 0){let t=e.size*1.1;x+=`<svg class="pele-icon" data-icon="${a(n.icon)}" x="${m(C)}" y="${m(i-e.size*.35-t/2)}" width="${m(t)}" height="${m(t)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${u?.(n.icon)??``}</svg>`}else if(n.text!==``){let e=S||!w?` x="${m(C)}" y="${m(i)}"`:``;b+=`<tspan${e}${o(n.style&~_)}>${t(n.text)}</tspan>`,w=!0}C+=n.width}}return`<text${d(l,_)} xml:space="preserve">${b}</text>${x}`}function $(e){let t=C(e);return t===e?e:t.replace(/</g,`<`).replace(/>/g,`>`)}function Pe(e,t,n){return g(e.direction)?_(n,r=>Fe(e,t,n,r)):Fe(e,t,n,!1)}function Fe(r,o,c,d){let p=de(r),h=c.fontSize??16,g=Math.round(h*.875),_=c.measurer??ae(c.fontFamily,c.fontFamilyMono),C=c.padding??8,E=c.icons,D=new Map,O=[],k=[];p.nodes.forEach((e,t)=>D.set(e.id,t));let A=[],oe=[],j=[],M=new Map,N=[];for(let e of p.edges){let t=D.get(e.start),n=D.get(e.end);if(t===void 0||n===void 0)continue;let r=f(e.label,!0,_,g,200),i;if(t===n){i={label:r,band:0,at:0};let e=M.get(t);e?e.push(i):M.set(t,[i])}N.push(i),j.push(e),oe.push(r),A.push({src:t,dst:n,minlen:1,labelW:r.width>0?r.width+12:0,labelH:r.height>0?r.height+4:0,route:[],labelX:0,labelY:0})}let P=e=>{let t=e;for(let e=0;e<p.nodes.length;e++){let e=p.nodes[t].parentId,n=e===void 0?void 0:D.get(e);if(n===void 0)break;let r=p.nodes[n].dir;if(r)return r===`LR`||r===`RL`;t=n}return r.direction===`LR`||r.direction===`RL`};for(let e=0;e<p.nodes.length;e++){let t=p.nodes[e],n=u(t.cssStyles.length>0?t.cssCompiledStyles.concat(t.cssStyles):t.cssCompiledStyles),r=+!!n.bold|(n.italic?2:0),i=n.fontSize??h,a=n.fontSize??g,o=n.fontSize??Math.round(h*.75),s=t.isGroup?f(t.label,!0,_,i,4e3,r):f(t.alias||t.label,!0,_,i,240,r),c=M.get(e)??ke,l=c.length>0&&!t.isGroup&&P(e),d={node:t,style:n,label:s,w:0,h:0,headH:0,rows:[],cols:[],rowSize:a,keySize:o,below:l},m=0,v=0;for(let e of c)e.band=Math.max(ye,l?e.label.width+12:e.label.height+6),v+=e.band,m=Math.max(m,l?e.label.height:e.label.width);let y=Math.max(be,l?v+8:0),b;if(t.isGroup)b=re(0,0),b.isGroup=!0,b.dir=t.dir?T(t.dir):void 0,b.padX=X,b.padTop=d.label.height>0?d.label.height+16:X,b.padBottom=X,b.minW=Math.max(d.label.width+2*X-12,be);else{let e=Math.max(s.height,Math.round(i*1.5));if(t.attributes.length===0)d.w=Math.max(s.width+2*xe,y),d.h=Math.max(e+2*Se,l?0:v+8);else{let n=Math.round(a*1.5),i=[0,0,0,0];for(let e of t.attributes){let t=[f($(e.type),!0,_,a,Oe,r),f($(e.name),!0,_,a,Oe,r),f(e.keys.join(`, `),!1,_,o,Oe,r),f($(e.comment),!0,_,a,De,r)],s=n;for(let e=0;e<4;e++)t[e].width>i[e]&&(i[e]=t[e].width),t[e].height>s&&(s=t[e].height);d.rows.push({cells:t,h:s+Ee}),d.h+=s+Ee}let c=0,l=0;for(let e of i)e!==0&&(l+=e+(c>0?Te:0),c++);d.w=Math.max(l+2*we,s.width+2*xe,y);let u=c>0?(d.w-l-2*we)/c:0,p=we;for(let e of i)d.cols.push(p),e>0&&(p+=e+u+Te);d.headH=e+2*Ce,d.h+=d.headH}let n=c.length>0?2*(J+Z*.75+10+m):0;b=l?re(d.w,d.h+n):re(d.w+n,d.h)}b.seq=O.length,O.push(d),k.push(b)}p.nodes.forEach((e,t)=>{k[t].parent=e.parentId===void 0?-1:D.get(e.parentId)??-1});let F=te(k,A,d?`TB`:T(r.direction),{nodeSep:Ne(o,`nodeSpacing`,ge),edgeSep:_e,rankSep:Ne(o,`rankSpacing`,ve),portSep:24});Le(A,k,O);let I=F.width;for(let[e,t]of M){let n=k[e];if(!n.isGroup)continue;let r=0;for(let e of t)r=Math.max(r,e.label.width);I=Math.max(I,n.x+n.w/2+J+Z*.75+10+r)}let L=b(r.title,_,h,4e3),R=L.height>0?L.height+12:0,z=Math.max(I,L.width),se=C+(z-I)/2,B=C+R;ne(k,A,se,B);let V=Math.ceil(z+2*C),H=Math.ceil(F.height+R+2*C),U=[],W=new Map,ce=!1;for(let e of k)e.isGroup&&(ce=!0);if(ce)for(let e of A)ee(W,e.route);let G=``,le=``;for(let e=0;e<O.length;e++){let r=O[e],o=k[e],u=r.node,d=n(u.cssClasses.replace(/^default\s?/,``));if(o.isGroup){r.w=o.w,r.h=o.h;let e=o.x-o.w/2,t=o.y-o.h/2,n=w(o,r.label.width,W,X);G+=`<g class="pele-cluster${d}" data-id="${a(u.id)}"><rect x="${m(e)}" y="${m(t)}" width="${m(o.w)}" height="${m(o.h)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${i(r.style.shape)}/>`+s(r.label,n,t+8+r.label.height/2,` class="pele-cluster-label" fill="var(--_m)"${r.style.text}`,E)+`</g>`;continue}let f=r.w,p=r.h,h=-f/2,g=-p/2,_=r.style.text,v=`x="${m(h)}" y="${m(g)}" width="${m(f)}" height="${m(p)}"`,y=s(r.label,0,r.rows.length>0?g+r.headH/2:0,` class="pele-label"${_}`,E),b=ie(u.alias||u.label);if(/ internal-link(?: |$)/.test(d+` `)&&y!==``&&c.links!==!1){let e=x(b,c),n=t(b);y=`<a class="internal-link"${e?` href="${n}"${S(c)}`:``} data-href="${n}">${y}</a>`,U.push({id:u.label,href:b,internal:!0})}let C;if(r.rows.length===0)C=`<rect ${v}${i(Me+r.style.shape)}/>`+y;else{let e=Math.round(r.rowSize*1.5),n=r.style.stroke?t(r.style.stroke):`var(--_b)`,a=``,o=``,s=g+r.headH;for(let t=0;t<r.rows.length;t++){let n=r.rows[t];if(t%2==0){let e=`x="${m(h)}" width="${m(f)}"`;t===r.rows.length-1?a+=`<rect ${e} y="${m(s)}" height="${m(n.h)}"${l}/><rect ${e} y="${m(s)}" height="${m(n.h/2)}"/>`:a+=`<rect ${e} y="${m(s)}" height="${m(n.h)}"/>`}let i=s+Ee/2+e/2+r.rowSize*.35,[c,u,d,p]=n.cells;o+=Q(c,h+r.cols[0],i,` class="pele-er-type" fill="var(--_m)"${_}`,E)+Q(u,h+r.cols[1],i,` class="pele-er-name"${_}`,E)+Q(d,h+r.cols[2],i,` class="pele-er-keys" font-size="${r.keySize}" fill="var(--_m)"${_}`,E)+Q(p,h+r.cols[3],i,` class="pele-er-comment" fill="var(--_m)"${_}`,E),s+=n.h}let c=m(g+r.headH);C=`<rect ${v}${i(Me+r.style.shape)}/><g class="pele-er-stripes" fill="var(--_bg)"${r.style.shape.includes(`fill:`)?` opacity="0.6"`:``}>${a}</g><path class="pele-er-divider" d="M${m(h)},${c}H${m(h+f)}" stroke="${n}"/><rect ${v} fill="none" stroke="var(--_b)"${i(r.style.line)}/>`+y+`<g class="pele-er-attributes" font-size="${r.rowSize}">${o}</g>`}le+=`<g class="pele-node pele-entity${d}" data-id="${a(u.label)}" transform="translate(${m(o.x)},${m(o.y)})">${C}</g>`}for(let[e,t]of M){let n=O[e],r=0;for(let e of t)r+=e.band;let i=Math.min(1,Math.max((n.below?n.w:n.h)-8,0)/r),a=-r*i/2;for(let e of t)e.band*=i,e.at=a+e.band/2,a+=e.band}let K=``,q=``;for(let e=0;e<A.length;e++){let t=A[e],n=j[e],r=oe[e],i,o,s,c=N[e];if(c){let e=k[t.src],a=O[t.src],l=Math.max(Math.min(c.band/2-6,13),1),u=J+Z*.75+6;if(a.below){let d=e.x+c.at,f=e.y+a.h/2,p=m(f+J),h=m(f+J+Z);i=`M${m(d-l)},${m(f)}V${p}C${m(d-l)},${h} ${m(d+l)},${h} ${m(d+l)},${p}V${m(f)}`,o=Y(n.arrowTypeStart,d-l,f,0,-1),s=Y(n.arrowTypeEnd,d+l,f,0,-1),t.labelX=d,t.labelY=f+u+r.height/2}else{let d=e.x+a.w/2,f=e.y+c.at,p=m(d+J),h=m(d+J+Z);i=`M${m(d)},${m(f-l)}H${p}C${h},${m(f-l)} ${h},${m(f+l)} ${p},${m(f+l)}H${m(d)}`,o=Y(n.arrowTypeStart,d,f-l,-1,0),s=Y(n.arrowTypeEnd,d,f+l,-1,0),t.labelX=d+u+r.width/2,t.labelY=f}}else{let e=Ie(t.route);if(e.length<6)continue;Re(e,0,O[t.src],k[t.src]),Re(e,e.length-3,O[t.dst],k[t.dst]);let r=Math.abs(e[e.length-3]-e[0]),a=Math.abs(e[e.length-2]-e[1]),c=e.length===6&&(r<.01||a<.01||Math.hypot(r,a)<=3*J)?0:J,l=y(e,void 0,c,c);i=c>0?`M${m(l.sx)},${m(l.sy)}L${l.d.slice(1)}L${m(l.ex)},${m(l.ey)}`:l.d,o=Y(n.arrowTypeStart,l.sx,l.sy,l.sdx,l.sdy),s=Y(n.arrowTypeEnd,l.ex,l.ey,l.edx,l.edy)}let l=n.pattern===`dashed`;if(K+=`<g class="pele-edge pele-er-${l?`non-identifying`:`identifying`}" data-id="${a(n.id)}"><path d="${i}"${l?` stroke-dasharray="4 3"`:``}/>`+o+s+`</g>`,r.width>0){let e=t.labelX,i=t.labelY;q+=v(n.id,r,e,i,``,E)}}return{svg:e(`er`,V,H,h,c,r,s(L,V/2,C+L.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(G?`<g class="pele-clusters">${G}</g>`:``)+(K?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${K}</g>`:``)+(q?`<g class="pele-edge-labels" font-size="${g}">${q}</g>`:``)+`<g class="pele-nodes">${le}</g>`),width:V,height:H,links:U}}function Ie(e){let t=e.slice(0,3);for(let n=3;n<e.length;n+=3){let r=t.length-3,i=i=>Math.abs(t[r+i]-e[n+i])<.01&&Math.abs(e[n+i]-e[n+3+i])<.01;n+3<e.length&&(i(0)||i(1))||t.push(e[n],e[n+1],e[n+2])}return t}function Le(e,t,n){let r=new Map,i=(e,n,i,a)=>{let o=t[e],s=n[i]-o.x,c=n[i+1]-o.y,l;if(Math.abs(Math.abs(c)-o.h/2)<.5)l=c<0?0:2;else if(Math.abs(Math.abs(s)-o.w/2)<.5)l=s<0?3:1;else return;let u=e*4+l,d={route:n,at:i,toward:n[a+(l&1?1:0)]},f=r.get(u);f?f.push(d):r.set(u,[d])};for(let t of e){let e=t.route.length-3;t.src===t.dst||e<3||(i(t.src,t.route,0,3),i(t.dst,t.route,e,e-3))}for(let[e,i]of r){if(i.length<2)continue;let r=e>>2,a=(e&1)==1,o=t[r].isGroup?t[r]:n[r],s=a?o.h:o.w,c=Math.max(Math.min(Ae,(s-2*je)/(i.length-1)),0),l=a?t[r].y:t[r].x;i.sort((e,t)=>e.toward-t.toward);for(let e=0;e<i.length;e++)i[e].route[i[e].at+ +!!a]=l+(e-(i.length-1)/2)*c}}function Re(e,t,n,r){if(r.isGroup)return;let i=e[t]-r.x,a=e[t+1]-r.y;r.w!==n.w&&Math.abs(Math.abs(i)-r.w/2)<.5&&(e[t]-=Math.sign(i)*(r.w-n.w)/2),r.h!==n.h&&Math.abs(Math.abs(a)-r.h/2)<.5&&(e[t+1]-=Math.sign(a)*(r.h-n.h)/2)}var ze={type:`er`,math:!0,parse(e,t,n){let r=new oe;return n&&(r.title=n),q(e,r),r},render:Pe};export{ze as er};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,b as t,d as n,i as r,o as i,s as a,u as o,x as s}from"./
|
|
1
|
+
import{_ as e,b as t,d as n,i as r,o as i,s as a,u as o,x as s}from"./C2npZzkn.js";import{o as c,r as l}from"./DciMwFJ1.js";import{a as u,i as d,s as f}from"./BXBhaEho.js";import{t as p}from"./DDAG55ce.js";import{a as m,i as h,o as g}from"./BA78_vo5.js";import{PeleError as _,g as v,h as y,s as b,u as x}from"./CMikI1NP.js";var S=1e5;function C(e){switch(e){case`[]`:return`square`;case`()`:return`round`;case`(())`:return`circle`;case`>]`:return`rect_left_inv_arrow`;case`{}`:return`diamond`;case`{{}}`:return`hexagon`;case`([])`:return`stadium`;case`[[]]`:return`subroutine`;case`[()]`:return`cylinder`;case`((()))`:return`doublecircle`;case`[//]`:return`lean_right`;case`[\\\\]`:return`lean_left`;case`[/\\]`:return`trapezoid`;case`[\\/]`:return`inv_trapezoid`;case`<[]>`:return`block_arrow`;default:return`na`}}function w(e){switch(e.trim().slice(-1)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`>`:return`arrow_point`;default:return``}}function T(e){switch(e.trim().charAt(0)){case`x`:return`arrow_cross`;case`o`:return`arrow_circle`;case`<`:return`arrow_point`;default:return`arrow_open`}}function E(e){return e.includes(`==`)?`thick`:`normal`}function D(e){return e.includes(`.-`)?`dotted`:`solid`}function O(e,t){let n=e.flat(),r=-1;for(let e of n)if(e.type===`column-setting`){r=e.columns??-1;break}return{list:n,at:0,parent:t,children:[],columns:r}}var k=class{type=`block`;title;root={id:`root`,type:`composite`,children:[],columns:-1};blocks=[];edges=[];classes=new Map;byId=new Map;typeStr2Type=C;edgeStrToEdgeData=w;edgeStrToEdgeStartData=T;edgeStrToThickness=E;edgeStrToPattern=D;warn;pending=new Set;edgeCount=new Map;ids=0;colors=0;spaces=0;constructor(e={}){this.warn=e.warn}generateId(){return`id-`+ ++this.ids}addStyleClass(e,t=``){let n=this.classes.get(e);n||(n={id:e,styles:[],textStyles:[]},this.classes.set(e,n));for(let e of t.split(`,`)){let t=e.indexOf(`;`),r=(t===-1?e:e.slice(0,t)+e.slice(t+1)).trim();e.includes(`color`)&&n.textStyles.push(r.replace(`fill`,`bgFill`).replace(`color`,`fill`)),n.styles.push(r)}}addStyle2Node(e,t=``){this.named(e).styles=t.split(`,`)}setCssClass(e,t){for(let n of e.split(`,`))(this.named(n.trim()).classes??=[]).push(t)}named(e){let t=this.byId.get(e);return t===void 0&&(t={id:e,type:`na`,children:[]},this.byId.set(e,t),this.pending.add(e)),t}setHierarchy(e){let t=[O(e,this.root)];for(;t.length>0;){let e=t[t.length-1];if(e.at===e.list.length){e.parent.children=e.children,t.pop();continue}let n=e.list[e.at++];switch(e.columns>0&&n.type!==`column-setting`&&typeof n.widthInColumns==`number`&&n.widthInColumns>e.columns&&this.warn?.(`Block ${n.id} width ${n.widthInColumns} exceeds configured column width ${e.columns}`),n.type){case`classDef`:this.addStyleClass(n.id,n.css);continue;case`applyClass`:this.setCssClass(n.id,n.styleClass??``);continue;case`applyStyles`:n.stylesStr&&this.addStyle2Node(n.id,n.stylesStr);continue;case`column-setting`:e.parent.columns=n.columns??-1;continue;case`edge`:{let e=(this.edgeCount.get(n.id)??0)+1;this.edgeCount.set(n.id,e),n.id=e+`-`+n.id,this.edges.push(n);continue}}n.id??=this.generateId(),n.label||=n.type===`composite`?``:n.id;let r=this.byId.get(n.id),i=r===void 0||this.pending.delete(n.id);i?(r&&(n.classes=r.classes,n.styles=r.styles),n.type===`composite`&&(n.colorIndex=this.colors++),this.byId.set(n.id,n)):(n.type!==`na`&&(r.type=n.type),n.label!==n.id&&(r.label=n.label));let a=n.children;if(n.children=[],n.type===`space`){let t=n.width??1;if(!(t<=S-this.spaces))throw new _(`A block diagram can hold at most ${S} space blocks.`,`limit`,{type:`block`});this.spaces+=Math.max(t,0);for(let r=0;r<t;r++){let t={...n,id:n.id+`-`+r,children:[]};this.byId.set(t.id,t),e.children.push(t)}}else i&&e.children.push(n);a&&a.length>0&&t.push(O(a,n))}this.blocks=this.root.children??[]}},A=`$end.INVALID.BLOCK_DIAGRAM_KEY.id-block.COLUMNS.MD_STR.STR.SPACE_BLOCK.DEFAULT.LINKSTYLE.INTERPOLATE.classDef.DEFAULT_CLASSDEF_ID.CLASSDEF_ID.CLASSDEF_STYLEOPTS.class.CLASSENTITY_IDS.STYLECLASS.style.STYLE_ENTITY_IDS.STYLE_DEFINITION_DATA.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.end.NODE_DSTART.NODE_DEND.BLOCK_ARROW_START.BLOCK_ARROW_END.DIR.NODE_ID.LINK.START_LINK.LINK_LABEL.SIZE.EOF`.split(`.`),j=[`right`,`left`,`x`,`y`,`up`,`down`],M=new Uint8Array(128);for(let e of[9,10,11,12,13,32,40,41,45,58,60,61,62,91,123,125])M[e]=1;function ee(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(e,t,a)=>(n.push(e),r.push(t),i.push(s),s=a,!0),l=(t,n)=>c(t,e.slice(s,n),n),u=e=>{a.push(o),o=e},d=()=>{a.length>0&&(o=a.pop())},f=n=>{for(;n<t&&y(e.charCodeAt(n));)n++;return n},p=n=>{for(;n<t;){let t=e.charCodeAt(n);if(t<48||t>57)break;n++}return n},m=n=>{for(;n<t&&v(e.charCodeAt(n));)n++;return n},h=t=>e.startsWith(t,s)&&!v(e.charCodeAt(s+t.length)),g=()=>(e.charCodeAt(s+1)===96?(u(2),s+=2):(u(1),s++),!0),_=t=>{if(e.charCodeAt(t)!==46)return-1;do t++;while(e.charCodeAt(t)===46);if(e.charCodeAt(t)!==45)return-1;let n=e.charCodeAt(t+1);return n===120||n===111||n===62?t+2:t+1},b=t=>{let n=e.charCodeAt(t);(n===120||n===111||n===60)&&t++;let r=e.charCodeAt(t);if(r===46)return _(t);if(r!==45&&r!==61)return-1;let i=t+1;for(;e.charCodeAt(i)===r;)i++;if(i-t===1)return r===45?_(i):-1;let a=e.charCodeAt(i);return a===120||a===111||a===62?i+1:i-t>=3?i:-1},x=()=>{let t=b(s);if(t>=0)return l(33,f(t));let n=e.charCodeAt(s)===60?s+1:s,r=e.charCodeAt(n),i=e.charCodeAt(n+1);return r===45&&(i===45||i===46)||r===61&&i===61?(u(6),l(34,f(n+2))):!1},S=n=>{let r=e.indexOf(`
|
|
2
2
|
`,s);return r===-1&&(r=t),d(),l(n,r)},C=(t,n)=>{let r=m(s);if(r===s)return!1;for(;e.charCodeAt(r)===44;){let e=f(r+1),t=m(e);if(t===e)break;r=t}return o=n,l(t,r)},w=n=>{if(y(n))return s=f(s+1),!0;let r;switch(n){case 98:if(e.startsWith(`block`,s)){if(h(`block-beta`))return l(2,s+10);if(e.charCodeAt(s+5)===58)return l(3,s+6);if(!v(e.charCodeAt(s+5)))return l(2,s+5)}break;case 99:if(e.startsWith(`columns`,s)){if(r=f(s+7),r>s+7){if(e.startsWith(`auto`,r)&&!v(e.charCodeAt(r+4)))return c(4,`-1`,r+4);let t=p(r);if(t>r)return c(4,e.slice(r,t),t)}}else if(e.startsWith(`class`,s)){let t=e.startsWith(`Def`,s+5),n=t?s+8:s+5;if(r=f(n),r>n)return u(t?7:9),l(t?11:15,r)}break;case 34:return g();case 115:if(e.startsWith(`space`,s)){if(e.charCodeAt(s+5)===58){let t=p(s+6);if(t>s+6)return c(7,e.slice(s+6,t),t)}if(!v(e.charCodeAt(s+5)))return c(7,`1`,s+5)}else if(e.startsWith(`style`,s)&&(r=f(s+5),r>s+5))return u(11),l(18,r);break;case 100:if(h(`default`))return l(8,s+7);break;case 108:if(h(`linkStyle`))return l(9,s+9);break;case 105:if(h(`interpolate`))return l(10,s+11);break;case 97:if(e.startsWith(`accTitle`,s)){if(r=f(s+8),e.charCodeAt(r)===58)return u(13),l(21,f(r+1))}else if(e.startsWith(`accDescr`,s)){r=f(s+8);let t=e.charCodeAt(r);if(t===58)return u(14),l(23,f(r+1));if(t===123)return u(15),s=f(r+1),!0}break;case 101:if(h(`end`))return l(26,f(s+3));break;case 45:return e.charCodeAt(s+1)===41?(u(3),l(27,s+2)):x();case 61:return x();case 60:return e.charCodeAt(s+1)===91?(u(4),l(29,s+2)):x();case 40:{let t=e.charCodeAt(s+1),n=t===45||t===91?2:t===40?e.charCodeAt(s+2)===40?3:2:1;return u(3),l(27,s+n)}case 41:case 123:return u(3),l(27,e.charCodeAt(s+1)===n?s+2:s+1);case 62:return u(3),l(27,s+1);case 91:{let t=e.charCodeAt(s+1);return u(3),l(27,t===91||t===124||t===40||t===92||t===47?s+2:s+1)}case 58:{let t=p(s+1);return t>s+1&&c(36,e.slice(s+1,t),t)}}for(r=s;r<t;){let t=e.charCodeAt(r);if(t<128?M[t]===1:y(t))break;r++}return r>s&&l(32,r)},T=t=>{let n=e.charCodeAt(s+1),r=0;switch(t){case 34:return g();case 40:r=n===45?2:n===40?e.charCodeAt(s+2)===40?3:2:1;break;case 41:r=n===41?e.charCodeAt(s+2)===41?3:2:n===93?2:1;break;case 125:r=n===125?2:1;break;case 45:r=n===41?2:0;break;case 93:r=n===93||n===41||n===62?2:1;break;case 92:case 47:r=n===93?2:0}return r!==0&&(d(),l(28,s+r))},E=t=>{if(t===41)return d(),d(),c(30,`]>`,f(s+1));let n=f(t===44?s+1:s);for(let r of j)if(e.startsWith(r,n)){let i=f(n+r.length);return c(31,e.slice(t===44?n:s,i),i)}return!1};for(;;){if(s>=t){let e=-1;switch(o){case 0:e=37;break;case 1:e=6;break;case 8:e=14;break;case 10:e=17;break;case 12:e=20;break;case 13:e=22;break;case 14:e=24;break;case 15:e=25}s=t,e!==-1&&c(e,``,t);break}let a=e.charCodeAt(s),p=!0;switch(o){case 0:p=w(a);break;case 1:if(a===34)d(),s++;else{let n=e.indexOf(`"`,s);l(6,n===-1?t:n)}break;case 2:if(a===96)p=e.charCodeAt(s+1)===34,p&&(d(),s+=2);else if(a===34)p=!1;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===96||t===34)break;n++}l(5,n)}break;case 3:p=T(a);break;case 4:if(a===34)g();else if(a===93&&e.charCodeAt(s+1)===62){let t=f(s+2);p=e.charCodeAt(t)===40,p&&(u(5),s=t+1)}else p=!1;break;case 5:p=E(a);break;case 6:if(a===34)e.charCodeAt(s+1)===96?g():(l(35,s+1),u(1));else{let e=b(f(s));p=e>=0,p&&(d(),l(33,f(e)))}break;case 7:{let t=12,n=e.startsWith(`DEFAULT`,s)?s+7:s,r=f(n);(n===s||r===n)&&(t=13,n=m(s),r=f(n)),p=n>s&&r>n,p&&(o=8,l(t,r));break}case 8:S(14);break;case 9:p=C(16,10);break;case 10:S(17);break;case 11:p=C(19,12);break;case 12:S(20);break;case 13:S(22);break;case 14:S(24);break;case 15:if(a===125)d(),s++;else{let n=e.indexOf(`}`,s);l(25,n===-1?t:n)}}if(!p)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var N=`'NODE_ID', 'COLUMNS', 'SPACE_BLOCK', 'BLOCK_DIAGRAM_KEY', 'id-block', 'classDef', 'class', 'style'`;function P(e){let t=e[e.length-1];return Array.isArray(t)?(e.pop(),e.concat(t)):e}function te(e,t){let{types:n,texts:r,starts:i}=ee(e),a=0,o=t=>{let r=n[a];throw r===1?b(`block`,e,i[a],``,!0):b(`block`,e,i[a],`Expecting ${t}, got '${A[r]}'`)},s=e=>(n[a]!==e&&o(`'${A[e]}'`),r[a++]),c=()=>{let e=s(32);if(n[a]===27){let t=r[a++];return{id:e,label:s(6),typeStr:t+s(28)}}if(n[a]===29){let t=r[a++],i=s(6),o=[s(31)];for(;n[a]===31;)o.push(r[a++]);return{id:e,label:i,typeStr:t+s(30),directions:o}}return{id:e}},l=()=>{let e=c(),i=n[a]===36?parseInt(r[a++],10):1,o={id:e.id,label:e.label,type:t.typeStr2Type(e.typeStr),directions:e.directions,widthInColumns:i},l;for(;n[a]===33||n[a]===34;){let e=``;n[a++]===34&&(s(35),e=s(6),s(33));let i=r[a-1],u=c(),d=t.edgeStrToEdgeData(i),f=t.edgeStrToEdgeStartData(i),p=t.edgeStrToThickness(i),m=t.edgeStrToPattern(i);l??=[{id:o.id,label:o.label,type:o.type,directions:o.directions}],o={id:u.id,label:u.label,type:t.typeStr2Type(u.typeStr),directions:u.directions},l.push({id:l[l.length-1].id+`-`+u.id,start:l[l.length-1].id,end:u.id,label:e,type:`edge`,thickness:p,pattern:m,directions:u.directions,arrowTypeEnd:d,arrowTypeStart:f},o)}return l??o};s(2);let u=[],d=[];for(;;)switch(n[a]){case 32:d.push(l());break;case 4:d.push({type:`column-setting`,columns:parseInt(r[a++],10)});break;case 7:{let e=parseInt(r[a++],10);d.push({id:t.generateId(),type:`space`,label:``,width:e,children:[]});break}case 2:a++,u.push({list:d,header:void 0}),d=[];break;case 3:a++,n[a]!==32&&o(`'NODE_ID'`),u.push({list:d,header:l()}),d=[];break;case 26:{let e=u.pop();if(e===void 0||d.length===0)return o(N);a++;let n=t.generateId(),r=P(d);d=e.list,d.push(e.header===void 0?{id:n,type:`composite`,label:``,children:r}:{...e.header,type:`composite`,children:r});break}case 11:{a++;let e=s(13).trim();d.push({type:`classDef`,id:e,css:s(14).trim()});break}case 15:{a++;let e=s(16).trim();d.push({type:`applyClass`,id:e,styleClass:s(17).trim()});break}case 18:{a++;let e=s(19).trim();d.push({type:`applyStyles`,id:e,stylesStr:s(20).trim()});break}case 37:u.length>0&&o(N+`, 'end'`),d.length===0&&o(N),t.setHierarchy(P(d));return;default:o(d.length===0?N:N+(u.length>0?`, 'end'`:`, 'EOF'`))}}var F=1,I=2,L=4,R=8,z=7,B=20,V=12;function ne(e){let t=0;if(e)for(let n of e)switch(n.trim()){case`right`:t|=F;break;case`left`:t|=I;break;case`up`:t|=L;break;case`down`:t|=R;break;case`x`:t|=F|I;break;case`y`:t|=L|R}return t}var H=(e,t)=>e&t?1:0;function U(e){return e!==0&&(e&(L|R))===0?`x`:e!==0&&(e&(F|I))===0?`y`:``}function re(e,t,n){let r=U(e),i=H(e,I)-H(e,F),a=H(e,L)-H(e,R);if(r===`x`){let r=Math.max(n+8,14)+2*z,a=Math.min(r/2,B);return{w:Math.max(t+12,16)+a*(e===(F|I)?2:1),h:r,dx:i*a/2,dy:0}}if(r===`y`){let r=Math.max(t+16,14)+2*z,i=Math.min(r/2,B);return{w:r,h:Math.max(n+8,16)+i*(e===(L|R)?2:1),dx:0,dy:a*i/2}}return{w:Math.max(t+16,24)+V*(H(e,I)+H(e,F)),h:Math.max(n+8,24)+V*(H(e,L)+H(e,R)),dx:i*V/2,dy:a*V/2}}function ie(e,t,n,r){let i=U(e),a=t/2,o=n/2,c;if(i===`x`){let t=Math.min(o,B),n=o-z,r=e&I?-a+t:-a,i=e&F?a-t:a;c=[r,-n,i,-n],e&F&&c.push(i,-o,a,0,i,o),c.push(i,n,r,n),e&I&&c.push(r,o,-a,0,r,-o)}else if(i===`y`){let t=Math.min(a,B),n=a-z,r=e&L?-o+t:-o,i=e&R?o-t:o;c=[n,r,n,i],e&R&&c.push(a,i,0,o,-a,i),c.push(-n,i,-n,r),e&L&&c.push(-a,r,0,-o,a,r)}else{let t=e&I?-a+V:-a,n=e&F?a-V:a,r=e&L?-o+V:-o,i=e&R?o-V:o,s=(t+n)/2,l=(r+i)/2,u=Math.min(10,(n-t)/2),d=Math.min(10,(i-r)/2);c=[t,r],e&L&&c.push(s-u,r,s,-o,s+u,r),c.push(n,r),e&F&&c.push(n,l-d,a,l,n,l+d),c.push(n,i),e&R&&c.push(s+u,i,s,o,s-u,i),c.push(t,i),e&I&&c.push(t,l+d,-a,l,t,l-d)}let l=``;for(let e=0;e<c.length;e+=2)l+=(e?` `:``)+s(c[e])+`,`+s(c[e+1]);return`<polygon points="${l}" stroke-linejoin="round"${r}/>`}var ae=1e3;function W(e,t){if(e===0||!Number.isInteger(e))throw new _(`Columns must be an integer !== 0.`,`semantic`,{type:`block`});if(t<0||!Number.isInteger(t))throw new _(`Position must be a non-negative integer.`+t,`semantic`,{type:`block`});return e<0?{px:t,py:0}:{px:t%e,py:Math.floor(t/e)}}function G(e,t,n){let r=e.columns,i=[],a=0,o=0,s=0,c=0;for(let n of e.children){let{px:e,py:l}=W(r,a),u=n.span>=1?Math.min(n.span,ae):1;if(r>0&&u>r-e&&(u=r-e),n.span=u,n.col=e,n.row=l,a+=u,e+u>o&&(o=e+u),l===i.length&&i.push(0),n.children.length===0?i[l]=-1:i[l]>=0&&n.nh>i[l]&&(i[l]=n.nh),n.space)continue;let d=(n.nw-t*(u-1))/u;d>s&&(s=d),n.nh>c&&(c=n.nh)}let l=(i.length-1)*t;for(let e=0;e<i.length;e++)i[e]<0&&(i[e]=c),l+=i[e];e.cols=o,e.heights=i,e.nw=Math.max(e.nw,o*s+(o-1)*t+2*n),e.nh=l+2*n+e.head}function K(e,t,n){let{cols:r,heights:i}=e,a=i.length,o=(e.w-2*n-(r-1)*t)/r,s=e.h-2*n-e.head-(a-1)*t,c=0;for(let e of i)c+=e;let l=c>0?s/c:0,u=c>0?0:s/a,d=e.x-e.w/2+n,f=e.y-e.h/2+n+e.head,p=0;for(let n of e.children){for(;p<n.row;p++)f+=i[p]*l+u+t;n.w=o*n.span+t*(n.span-1),n.h=i[p]*l+u,n.x=d+n.col*(o+t)+n.w/2,n.y=f+n.h/2}}function oe(e,t){let n=[e];for(let e=0;e<n.length;e++)for(let t of n[e].children)n.push(t);for(let e=n.length-1;e>=0;e--){let r=n[e];r.children.length>0&&G(r,t,e===0?0:t)}e.w=e.nw,e.h=e.nh,e.x=e.w/2,e.y=e.h/2;for(let e=0;e<n.length;e++){let r=n[e];r.children.length>0&&K(r,t,e===0?0:t)}return{width:e.w,height:e.h}}var se=12,ce=200,q=8,le=` fill="var(--_s)" stroke="var(--_b)"`,ue=` stroke="var(--_b)"`,de=[],fe=[],pe=[],me=[`default`],he=2e6,ge=new Map([[`square`,`rect`],[`round`,`rounded`],[`circle`,`circle`],[`doublecircle`,`dbl-circ`],[`diamond`,`diam`],[`hexagon`,`hex`],[`stadium`,`stadium`],[`subroutine`,`fr-rect`],[`cylinder`,`cyl`],[`rect_left_inv_arrow`,`odd`],[`lean_right`,`lean-r`],[`lean_left`,`lean-l`],[`trapezoid`,`trap-b`],[`inv_trapezoid`,`trap-t`]]),_e=new Set([`circle`,`dbl-circ`,`diam`]),ve=new Set([`stadium`,`hex`,`odd`,`lean-r`,`lean-l`,`trap-b`,`trap-t`]);function J(e){return e.kind===0&&(e.shape===`circle`||e.shape===`dbl-circ`)}function Y(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.x),o=i;return J(e)?o=Math.sqrt(Math.max(r*r-a*a,0)):e.kind===0&&e.shape===`diam`?o=i*Math.max(1-a/r,0):e.kind===0?o=i-g(e.shape,e.bw,e.bh,n>0?2:0):e.kind===1&&U(e.mask)===`x`&&(o=i-z),e.y+n*o}function X(e,t,n){let r=e.bw/2,i=e.bh/2,a=Math.abs(t-e.y),o=r;return J(e)?o=Math.sqrt(Math.max(i*i-a*a,0)):e.kind===0&&e.shape===`diam`?o=r*Math.max(1-a/i,0):e.kind===0?o=r-g(e.shape,e.bw,e.bh,n>0?1:3):e.kind===1&&U(e.mask)===`y`&&(o=r-z),e.x+n*o}function Z(e,t,n,r){let i=t-e.x,a=n-e.y,o=e.bw/2,s=e.bh/2,c;c=J(e)?o/(Math.hypot(i,a)||1):e.kind===0&&e.shape===`diam`?1/(Math.abs(i)/o+Math.abs(a)/s||1):Math.min(i===0?1/0:o/Math.abs(i),a===0?1/0:s/Math.abs(a)),c===1/0&&(c=0),r.push(e.x+i*c,e.y+a*c)}function ye(e,t,n,r,i){let a=i.x-i.bw/2+1,o=i.x+i.bw/2-1,s=i.y-i.bh/2+1,c=i.y+i.bh/2-1;if(e<a&&n<a||e>o&&n>o||t<s&&r<s||t>c&&r>c)return!1;if(e===n||t===r)return!0;let l=n-e,u=r-t,d=(n,r)=>Math.sign(l*(r-t)-u*(n-e)),f=d(a,s);return f===0||d(o,s)!==f||d(o,c)!==f||d(a,c)!==f}function Q(e,t,n,r){let i=0;for(let a of r)if(a!==t&&a!==n){for(let t=0;t+3<e.length;t+=2)if(ye(e[t],e[t+1],e[t+2],e[t+3],a)){i++;break}}return i}function be(e,t,n,r){let i=e.x-e.bw/2,a=e.x+e.bw/2,o=e.y-e.bh/2,s=e.y+e.bh/2,c=t.x-t.bw/2,l=t.x+t.bw/2,u=t.y-t.bh/2,d=t.y+t.bh/2,f=Math.max(i,c),p=Math.min(a,l),m=Math.max(o,u),h=Math.min(s,d),g=p-f>6,_=h-m>6;if(g&&_){let n=e.bw*e.bh<=t.bw*t.bh?e:t,r=n===e?t:e,i=n.y-n.bh/2-(r.y-r.bh/2),a=r.y+r.bh/2-(n.y+n.bh/2),o=n.x-n.bw/2-(r.x-r.bw/2),s=r.x+r.bw/2-(n.x+n.bw/2),c=Math.min(i,a,o,s),l;return l=c===a?[n.x,Y(n,n.x,1),n.x,r.y+r.bh/2]:c===i?[n.x,Y(n,n.x,-1),n.x,r.y-r.bh/2]:c===s?[X(n,n.y,1),n.y,r.x+r.bw/2,n.y]:[X(n,n.y,-1),n.y,r.x-r.bw/2,n.y],n===e?l:[l[2],l[3],l[0],l[1]]}if(g){let r=Math.min(6,(p-f)/2),i=Math.min(Math.max((f+p)/2+n,f+r),p-r),a=t.y>e.y?1:-1;return[i,Y(e,i,a),i,Y(t,i,-a)]}if(_){let r=Math.min(6,(h-m)/2),i=Math.min(Math.max((m+h)/2+n,m+r),h-r),a=t.x>e.x?1:-1;return[X(e,i,a),i,X(t,i,-a),i]}let v=t.x>e.x?1:-1,y=t.y>e.y?1:-1,b=[X(e,e.y,v),e.y,t.x,e.y,t.x,Y(t,t.x,-y)],x=[e.x,Y(e,e.x,y),e.x,t.y,X(t,t.y,-v),t.y],S=Math.abs(t.x-e.x)>=Math.abs(t.y-e.y),C=S?b:x;if(r===void 0)return C;let w=Q(C,e,t,r);if(w===0)return C;let T=S?x:b,E=Q(T,e,t,r);if(E<w&&(C=T,w=E),w===0)return C;let D=[];return Z(e,t.x,t.y,D),Z(t,e.x,e.y,D),Q(D,e,t,r)<w?D:C}function xe(e,t,n){let r=e.length,i=e[0],a=e[1],o=e[r-2],c=e[r-1],l=e[2]-i,u=e[3]-a,d=Math.hypot(l,u);l/=d||1,u/=d||1;let f=o-e[r-4],p=c-e[r-3],m=Math.hypot(f,p);if(f/=m||1,p/=m||1,r===4&&t+n>d){let e=d/(t+n);t*=e,n*=e}t=Math.min(t,d),n=Math.min(n,m);let h=`M${s(i+l*t)},${s(a+u*t)}`;if(r===6){let r=Math.max(0,Math.min(q,d-t,m-n));h+=`L${s(e[2]-l*r)},${s(e[3]-u*r)}Q${s(e[2])},${s(e[3])} ${s(e[2]+f*r)},${s(e[3]+p*r)}`}return h+=`L${s(o-f*n)},${s(c-p*n)}`,{d:h,sx:i,sy:a,sdx:-l,sdy:-u,ex:o,ey:c,edx:f,edy:p}}function Se(e,t){let n=e.bw/2,r=e.bh/2,i=Math.max(1,Math.min(10+5*(t-1),n,r));if(J(e)){let t=e.x+n*Math.SQRT1_2,r=e.y-n*Math.SQRT1_2,a=2*Math.asin(Math.min(1,i/(2*n))),o=i=>Math.atan2(e.y-n*Math.sin(i)-r,e.x+n*Math.cos(i)-t);return[t,r,i,o(Math.PI/4+a),o(Math.PI/4-a)]}if(e.kind===0&&e.shape===`diam`){let t=Math.atan2(r,n);return[e.x+n/2,e.y-r/2,i,t+Math.PI,t]}return[e.x+n,e.y-r,i,Math.PI,Math.PI/2]}function Ce(e,t,n,r){let[i,a,o,c,l]=Se(e,t),u=c+n/o,d=l-r/o,f=(d-u)%(2*Math.PI);f<=0&&(f+=2*Math.PI);let p=i+o*Math.cos(u),m=a+o*Math.sin(u),h=i+o*Math.cos(d),g=a+o*Math.sin(d),_=i+o*Math.cos(c),v=a+o*Math.sin(c),y=i+o*Math.cos(l),b=a+o*Math.sin(l),x=Math.hypot(_-p,v-m),S=Math.hypot(y-h,b-g);return{d:`M${s(p)},${s(m)}A${s(o)},${s(o)} 0 ${+(f>Math.PI)} 1 ${s(h)},${s(g)}`,sx:_,sy:v,sdx:x>0?(_-p)/x:Math.sin(c),sdy:x>0?(v-m)/x:-Math.cos(c),ex:y,ey:b,edx:S>0?(y-h)/S:-Math.sin(l),edy:S>0?(b-g)/S:Math.cos(l)}}var $=[.5,.3,.7,.15,.85];function we(e,t,n,r,i,a,o){if(o===void 0)return .5;for(let s of $){let c=e[t]+(e[t+2]-e[t])*s,l=e[t+1]+(e[t+3]-e[t+1])*s,u=!0;for(let e of o)if(e!==i&&e!==a&&Math.abs(c-e.x)<(n+e.bw)/2&&Math.abs(l-e.y)<(r+e.bh)/2){u=!1;break}if(u)return s}return .5}function Te(e,t,n){return c(n,r=>Ee(e,t,n,r))}function Ee(c,g,_,v){let y=_.fontSize??16,b=Math.round(y*.875),S=_.measurer??x(_.fontFamily,_.fontFamilyMono),C=_.padding??8,w=_.icons,T=g.block?.padding,E=Math.min(typeof T==`number`&&T>=0?Math.min(T,200):se,v?6:1/0),D=v?80:ce,O=e=>{let t=[],n=e=>{for(let n of e)for(let e of n.split(`;`))t.push(e)};for(let t of e.classes&&e.classes.length>0?e.classes:me){let e=c.classes.get(t);e&&n(e.styles)}return e.styles&&n(e.styles),a(t)},k=(e,t)=>{let n=e.type,r=n===`space`?a(de):O(e),i=+!!r.bold|(r.italic?2:0),s=r.fontSize??y,c=0,u=``,d,f=0,p=0,m=0,g=0,b=0,x=0;if(n===`space`)c=3,d=o(void 0,!1,S,s,D);else if(n===`composite`)c=2,d=o(e.label,!1,S,s,v?l(_):4e3,i),m=d.height>0?d.height+4:0,f=d.width+2*E,p=m+2*E;else if(n===`block_arrow`){c=1,d=o(e.label,!1,S,s,D,i);let t=!0;for(let e of d.lines)for(let n of e)(n.icon!==void 0||n.text.trim()!==``)&&(t=!1);g=ne(e.directions);let n=t?re(g,0,0):re(g,d.width,d.height);f=n.w,p=n.h,b=n.dx,x=n.dy}else{u=ge.get(n??``)??`rect`,d=o(e.label,!1,S,s,D,i);let t=h(u,d.width,d.height);f=t.w,p=u===`cyl`?Math.max(t.h,d.height+40):t.h,x=t.dy}return{children:[],columns:c===2?e.columns??-1:-1,span:c===3?1:e.widthInColumns??1,space:c===3,head:m,nw:f,nh:p,col:0,row:0,cols:0,heights:pe,x:0,y:0,w:0,h:0,block:e,kind:c,index:t,shape:u,label:d,style:r,mask:g,dx:b,dy:x,bw:0,bh:0}},A=k(c.root,0);A.nw=0,A.nh=0;let j=[A],M=new Map;for(let e=0;e<j.length;e++){let t=j[e];if(t.kind===2)for(let e of t.block.children??fe){let n=k(e,j.length);t.children.push(n),j.push(n),n.kind!==3&&M.set(e.id,n)}}let ee=oe(A,E),N=[];for(let e of j)e.kind===0&&_e.has(e.shape)?(e.bw=e.nw,e.bh=e.nh):e.kind===1?(e.bw=e.span>1?e.w:e.nw,e.bh=e.nh):(e.bw=e.w,e.bh=e.kind===0&&ve.has(e.shape)?e.nh:e.h),e.kind===0&&e.shape===`cyl`&&(e.dy=Math.min(12,Math.max(6,e.bw/14))/2),(e.kind===0||e.kind===1)&&N.push(e);let P=new Map,te=new Set,F=[],I=[];for(let e of c.edges){let t=M.get(e.start??``),n=M.get(e.end??``);if(t===void 0||n===void 0)continue;let r=Math.min(t.index,n.index)*j.length+Math.max(t.index,n.index);P.set(r,(P.get(r)??0)+1),e.label&&te.add(r),F.push([t,n]),I.push(e)}let L=I.length*N.length<=he?N:void 0,R=new Map,z=[],B=0,V=0,H=ee.width,U=ee.height,ae=(e,t,n,r)=>{e-n/2<B&&(B=e-n/2),e+n/2>H&&(H=e+n/2),t-r/2<V&&(V=t-r/2),t+r/2>U&&(U=t+r/2)};for(let e=0;e<I.length;e++){let[t,n]=F[e],r=Math.min(t.index,n.index)*j.length+Math.max(t.index,n.index),i=P.get(r)??1,a=R.get(r)??0;R.set(r,a+1);let s=o(I[e].label,!1,S,b,ce),c,l,u;if(t===n){let[e,n,r]=Se(t,a+1);c=[],ae(e,n,2*r+2,2*r+2),l=e+r+6+s.width/2,u=n-r/2}else{let e=te.has(r)?Math.round(b*1.5)+2:14;c=be(t,n,(a-(i-1)/2)*e,L);let o=c.length,d=Math.abs(c[2]-c[0])+Math.abs(c[3]-c[1]),f=Math.abs(c[o-2]-c[o-4])+Math.abs(c[o-1]-c[o-3]),p=o===6&&f>d?2:0,m=s.width>0?we(c,p,s.width+8,s.height,t,n,L):.5;l=c[p]+(c[p+2]-c[p])*m,u=c[p+1]+(c[p+3]-c[p+1])*m}s.width>0&&ae(l,u,s.width+8,s.height),z.push({edge:I[e],points:c,loop:t===n?a+1:0,label:s,lx:l,ly:u})}let W=p(c.title,S,y,v?l(_):4e3),G=W.height>0?W.height+12:0,K=Math.max(H-B,W.width),q=C-B+(K-(H-B))/2,J=C+G-V;for(let e of j)e.x+=q,e.y+=J;let Y=Math.ceil(K+2*C),X=Math.ceil(U-V+G+2*C),Z=``,ye=``;for(let e=1;e<j.length;e++){let a=j[e];if(a.kind===3)continue;let o=t((a.block.classes??de).join(` `)),c=r(a.block.id);if(a.kind===2){let e=a.y-a.h/2;Z+=`<g class="pele-cluster${o}" data-id="${c}"><rect x="${s(a.x-a.w/2)}" y="${s(e)}" width="${s(a.w)}" height="${s(a.h)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${n(a.style.shape)}/>`+i(a.label,a.x,e+(a.head+E)/2+2,` class="pele-cluster-label" fill="var(--_m)"${a.style.text}`,w)+`</g>`;continue}let l=a.kind===1;ye+=`<g class="pele-node pele-shape-${l?`block-arrow`:a.shape}${o}" data-id="${c}" transform="translate(${s(a.x)},${s(a.y)})">`+(l?ie(a.mask,a.bw,a.bh,le+a.style.shape):m(a.shape,a.bw,a.bh,le+a.style.shape,ue+a.style.line))+i(a.label,a.dx,a.dy,` class="pele-label"${a.style.text}`,w)+`</g>`}let Q=``,$=``;for(let e=0;e<z.length;e++){let{edge:t,points:n,loop:i,label:a}=z[e],o=t.arrowTypeStart??``,s=t.arrowTypeEnd??``,c;if(i>0)c=Ce(F[e][0],i,u(o),u(s));else{for(let e=0;e<n.length;e+=2)n[e]+=q,n[e+1]+=J;c=xe(n,u(o),u(s))}let l=r(t.id);if(Q+=`<g class="pele-edge" data-id="${l}"><path d="${c.d}"${t.thickness===`thick`?` stroke-width="2.5"`:``}${t.pattern===`dotted`?` stroke-dasharray="3 4"`:``}/>`+f(o,c.sx,c.sy,c.sdx,c.sdy,`var(--_l)`)+f(s,c.ex,c.ey,c.edx,c.edy,`var(--_l)`)+`</g>`,a.width>0){let n=z[e].lx+q,r=z[e].ly+J;$+=d(t.id,a,n,r,``,w)}}return{svg:e(`block`,Y,X,y,_,c,i(W,Y/2,C+W.height/2,` class="pele-title" font-weight="var(--_tw)"`)+(Z?`<g class="pele-clusters">${Z}</g>`:``)+(Q?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round">${Q}</g>`:``)+`<g class="pele-nodes">${ye}</g>`+($?`<g class="pele-edge-labels" font-size="${b}">${$}</g>`:``)),width:Y,height:X,links:[]}}var De={type:`block`,math:!0,parse(e,t,n){let r=new k;return r.title=n,te(e,r),r},render:Te};export{De as block};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{t as flowchart}from"./Bd-WxALw.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,a as t,o as n,u as r,x as i}from"./
|
|
1
|
+
import{_ as e,a as t,o as n,u as r,x as i}from"./C2npZzkn.js";import{r as a,t as o}from"./DciMwFJ1.js";import{a as s,c,d as l,f as u,g as d,h as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as b,t as x,u as S}from"./CTDYUZPz.js";import{t as C}from"./Ce_hS451.js";import{t as w}from"./C8h1oeAZ.js";import{PeleError as T,d as E,u as D}from"./CMikI1NP.js";var O=1e4;function k(e,t,n,r,i){let a=e.packet?.[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function A(e){return new T(e,`semantic`,{type:`packet`})}function j(e,t,n){let r=Math.floor(k(t,`bitsPerRow`,32,1,4096)),i=[],a=-1,o=[],s=1;for(let t of e.blocks){let{start:e,end:n,bits:c}=t;if(e!==void 0&&n!==void 0&&n<e)throw A(`Packet block ${e} - ${n} is invalid. End must be greater than start.`);if(e??=a+1,e!==a+1)throw A(`Packet block ${e} - ${n??e} is not contiguous. It should start from ${a+1}.`);if(c===0)throw A(`Packet block ${e} is invalid. Cannot have a zero bit field.`);for(n??=e+(c??1)-1,c??=n-e+1,a=n;o.length<=r+1&&i.length<O;){let a=s*r-1;if(n<=a){o.push({start:e,end:n,bits:c,label:t.label}),n===a&&(i.push(o),o=[],s++);break}o.push({start:e,end:a,bits:a-e,label:t.label}),i.push(o),o=[],s++,e=a+1,c=n-e}}return o.length>0&&i.push(o),{type:`packet`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
2
2
|
`):void 0,bitsPerRow:r,rows:i}}var M=[{name:`packet-beta`,pattern:`packet-beta`},p(`packet`),{name:`-`,pattern:`-`,longer:[y]},{name:`+`,pattern:`+`},{name:`:`,pattern:`:`},s,x,v,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y},h,m,S,y,_,b];function N(e){let t=new f(g(e,M,`packet`),M,`packet`),n={$type:`Packet`,blocks:[]},r=()=>{if(t.kind!==-1)for(t.kind!==10&&t.fail(`a line break or the end of input`);t.kind===10;)t.i++};for(;t.kind===10;)t.i++;for(t.accept(0)||t.expect(1);t.kind!==-1;)switch(t.kind){case 10:t.i++;break;case 5:n.accDescr=c(t.take()),r();break;case 6:n.accTitle=d(t.take()),r();break;case 7:n.title=l(t.take()),r();break;case 8:case 3:{let e={$type:`PacketBlock`,label:``};t.accept(3)?e.bits=Number(t.expect(8)):(e.start=Number(t.take()),t.accept(2)&&(e.end=Number(t.expect(8)))),t.expect(4),e.label=u(t.expect(9)),n.blocks.push(e),r();break}default:t.fail(`a field, a title, or a line break`)}return n}function P(e,t,n){return o(n,r=>F(e,t,n,r))}function F(o,s,c,l){let u=c.fontSize??16,d=Math.round(u*.875),f=Math.round(u*.625),p=c.measurer??D(c.fontFamily,c.fontFamilyMono),m=c.padding??8,h=s.packet??{},g=k(s,`rowHeight`,32,1,400),_=k(s,`bitWidth`,32,1,400),v=k(s,`paddingX`,5,0,400),y=k(s,`paddingY`,5,0,400),b=h.showBits!==!1,x=h.bitOrder===`descending`,S=o.bitsPerRow,T=o.rows;if(l){let e=Math.max(1,Math.floor(((c.maxWidth??320)-2*m)/Math.min(_,18)));S=Math.min(S,Math.max(8,2**Math.floor(Math.log2(e))));let t=o.rows[o.rows.length-1],n=t?.[t.length-1]?.end??0;Math.ceil((n+1)/S)>1e4&&(S=o.bitsPerRow),_=Math.min(_,Math.max(18,((c.maxWidth??320)-2*m)/S));let r=e=>e.bits===e.end-e.start,i=[];for(let e of o.rows)for(let t of e){let e=i[i.length-1];e&&r(e)&&r(t)&&e.label===t.label&&t.start===e.end+1&&t.start%o.bitsPerRow===0?(e.end=t.end,e.bits=e.end-e.start):i.push({...t})}T=[];for(let e of i)for(let t=e.start;t<=e.end;){let n=Math.min(e.end,(Math.floor(t/S)+1)*S-1),r=Math.floor(t/S);(T[r]??(T[r]=[])).push({...e,start:t,end:n}),t=n+1}}let O=new Map;if(l)for(let e of T)for(let t of e){let e=Math.max(1,(t.end-t.start+1)*_-Math.min(v,_-1)-6),n=w(E(t.label).trim(),p,d,e);O.set(t,n)}let A=b?f+4:0,j=T.map(e=>{let t=g;if(l)for(let n of e)t=Math.max(t,O.get(n).height+10);return t}),M=[],N=0;for(let e of j)M.push(N),N+=A+e+y;T.length&&(N-=y);let P=Math.min(v,_-1),F=T.length>0?S*_-P:0,I=r(o.title,!1,p,u,l?a(c):4e3,1),L=I.height>0?I.height+(N>0?12:0):0,R=new Map,z=(e,t)=>{let n=R.get(e);return n||R.set(e,n=new Map),n.has(t)||n.set(t,C(E(e).trim(),t,d,Math.round(u*.5),p)),n.get(t)},B=m+Math.max(0,(I.width-F)/2),V=``,H=``;T.forEach((e,r)=>{let a=m+M[r]+A,o=j[r];for(let r of e){let e=r.end-r.start+1,s=r.start%S,c=B+(x?S-s-e:s)*_,u=e*_-P,f=l?void 0:z(r.label,u-6);if(V+=`<g class="pele-node" data-id="${r.start}-${r.end}"><rect x="${i(c)}" y="${i(a)}" width="${i(u)}" height="${i(o)}" fill="var(--_s)" stroke="var(--_b)" style="rx:var(--_r)"/>`+(l?n(O.get(r),c+u/2,a+o/2,``):f&&f.size<=o?`<text x="${i(c+u/2)}" y="${i(a+o/2+f.size*.35)}"${f.size===d?``:` font-size="${i(f.size)}"`}>${t(f.text)}</text>`:``)+`</g>`,!b)continue;let p=x?r.end:r.start,m=x?r.start:r.end;H+=e===1?`<text x="${i(c+u/2)}" y="${i(a-4)}" text-anchor="middle">${p}</text>`:`<text x="${i(c)}" y="${i(a-4)}">${p}</text><text x="${i(c+u)}" y="${i(a-4)}" text-anchor="end">${m}</text>`}});let U=Math.ceil(Math.max(F,I.width)+2*m),W=Math.ceil(N+L+2*m),G=(V?`<g class="pele-packet-fields" font-size="${d}" text-anchor="middle">${V}</g>`:``)+(H?`<g class="pele-packet-bits" font-size="${f}" fill="var(--_m)">${H}</g>`:``)+n(I,U/2,W-m-I.height/2,` class="pele-title" font-weight="var(--_tw)"`);return{svg:e(`packet`,U,W,u,c,o,G),width:U,height:W,links:[]}}var I={type:`packet`,parse:(e,t,n)=>j(N(e),t,n),render:P};export{I as packet};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,i as t,o as n,r,u as i,x as a}from"./
|
|
1
|
+
import{_ as e,i as t,o as n,r,u as i,x as a}from"./C2npZzkn.js";import{o,r as s}from"./DciMwFJ1.js";import{a as c,i as l,s as u}from"./BXBhaEho.js";import{a as d,c as f,d as p,f as m,g as h,h as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T}from"./CTDYUZPz.js";import{PeleError as E,u as ee}from"./CMikI1NP.js";function D(e){throw new E(e,`semantic`,{type:`architecture`})}var O=class{type=`architecture`;title;accTitle;accDescr;nodes=new Map;groups=new Map;edges=[];layoutHints=[];registered=new Map;register(e,t,n){this.registered.has(t)&&D(`The ${e} id [${t}] is already in use by another ${this.registered.get(t)}`),n!==void 0&&(t===n&&D(`The ${e} [${t}] cannot be placed within itself`),this.registered.has(n)||D(`The ${e} [${t}]'s parent does not exist. Please make sure the parent is created before this ${e}`),this.registered.get(n)===`node`&&D(`The ${e} [${t}]'s parent is not a group`)),this.registered.set(t,e===`group`?`group`:`node`)}addService({id:e,icon:t,iconText:n,title:r,in:i}){this.register(`service`,e,i),this.nodes.set(e,{id:e,type:`service`,icon:t,iconText:n,title:r,in:i})}addJunction({id:e,in:t}){this.register(`junction`,e,t),this.nodes.set(e,{id:e,type:`junction`,in:t})}addGroup({id:e,icon:t,title:n,in:r}){this.register(`group`,e,r),this.groups.set(e,{id:e,icon:t,title:n,in:r})}addEdge({lhsId:e,rhsId:t,lhsDir:n,rhsDir:r,lhsInto:i,rhsInto:a,lhsGroup:o,rhsGroup:s,title:c}){let l=[[`left`,e,o],[`right`,t,s]];for(let[e,t]of l)this.registered.has(t)||D(`The ${e}-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);for(let[e,t]of l)this.nodes.has(t)||D(`The ${e}-hand id [${t}] is a group. Add {group} to a service inside it instead.`);let u=this.nodes.get(e).in;if(u!==void 0&&u===this.nodes.get(t).in)for(let[e,t,n]of l)n&&D(`The ${e}-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);this.edges.push({lhsId:e,lhsDir:n,lhsInto:i,lhsGroup:o,rhsId:t,rhsDir:r,rhsInto:a,rhsGroup:s,title:c})}addLayoutHint(e){e.members.length<2&&D(`An align directive requires at least two members; got ${e.members.length}`);let t=new Set;for(let n of e.members)this.registered.get(n)!==`node`&&D(`align ${e.direction} references [${n}], which is not a service or junction`),t.has(n)&&D(`align ${e.direction} lists [${n}] more than once`),t.add(n);this.layoutHints.push(e)}};function k(e,t){e.accDescr&&(t.accDescr=e.accDescr.replace(/\n\s+/g,`
|
|
2
2
|
`)),e.accTitle&&(t.accTitle=e.accTitle.replace(/^\s+/g,``)),e.title&&(t.title=e.title);for(let n of e.groups)t.addGroup(n);for(let n of e.services)t.addService(n);for(let n of e.junctions)t.addJunction(n);for(let n of e.edges)t.addEdge(n);for(let n of e.alignments)t.addLayoutHint({direction:n.direction,members:[...n.members]})}var A={name:`ID`,pattern:/[\w]([-\w]*\w)?/y};function j(e){return{name:e,pattern:e,longer:[A]}}var M=[j(`architecture-beta`),j(`junction`),j(`service`),j(`column`),j(`group`),j(`align`),j(`row`),{name:`--`,pattern:`--`,longer:[S]},j(`in`),{name:`:`,pattern:`:`},{name:`-`,pattern:`-`,longer:[S]},{name:`ARROW_DIRECTION`,pattern:/L|R|T|B/y},{name:`ARROW_GROUP`,pattern:/\{group\}/y},{name:`ARROW_INTO`,pattern:/<|>/y},d,w,x,v,A,_,T,S,b,C,{name:`ARCH_ICON`,pattern:/\([\w-:]+\)/y},{name:`ARCH_TITLE`,pattern:/\[(?:"([^"\\]|\\.)*"|'([^'\\]|\\.)*'|[^\[\]\r\n]+)\]/y}];function N(e){let t=e.slice(1,-1).trim();return(t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`))&&(t=t.slice(1,-1).replace(/\\"/g,`"`).replace(/\\'/g,`'`)),t.trim()}function P(e){let t=new g(y(e,M,`architecture`),M,`architecture`),n={$type:`Architecture`,groups:[],services:[],junctions:[],edges:[],alignments:[]},r=e=>t.kinds[t.i]===e,i=()=>{if(t.kind!==-1)for(t.kind!==19&&t.fail(`a line break or the end of input`);t.kind===19;)t.i++};for(;t.kind===19;)t.i++;for(t.expect(0);t.kind!==-1;){switch(t.kind){case 19:t.i++;continue;case 14:n.accDescr=f(t.take());break;case 15:n.accTitle=h(t.take());break;case 16:n.title=p(t.take());break;case 4:{t.i++;let e={$type:`Group`,id:t.expect(18)};r(24)&&(e.icon=t.take().slice(1,-1)),r(25)&&(e.title=N(t.take())),t.accept(8)&&(e.in=t.expect(18)),n.groups.push(e);break}case 2:{t.i++;let e={$type:`Service`,id:t.expect(18)};r(17)?e.iconText=m(t.take()):r(24)&&(e.icon=t.take().slice(1,-1)),r(25)&&(e.title=N(t.take())),t.accept(8)&&(e.in=t.expect(18)),n.services.push(e);break}case 1:{t.i++;let e={$type:`Junction`,id:t.expect(18)};t.accept(8)&&(e.in=t.expect(18)),n.junctions.push(e);break}case 18:{let e=t.take(),i=t.accept(12);t.expect(9);let a=t.expect(11),o=t.accept(13),s;t.accept(7)||(r(10)||t.fail(`'--' or '-'`),t.i++,s=N(t.expect(25)),t.expect(10));let c=t.accept(13),l=t.expect(11);t.expect(9);let u=t.expect(18),d=t.accept(12);n.edges.push({$type:`Edge`,lhsId:e,lhsGroup:i,lhsDir:a,lhsInto:o,title:s,rhsInto:c,rhsDir:l,rhsId:u,rhsGroup:d});break}case 5:{t.i++,!r(6)&&!r(3)&&t.fail(`'row' or 'column'`);let e=t.take(),i=[t.expect(18),t.expect(18)];for(;r(18);)i.push(t.take());n.alignments.push({$type:`Alignment`,direction:e,members:i});break}default:t.fail(`a group, a service, a junction, an edge, an alignment, a title, or a line break`)}i()}return n}var F=new Map([[`database`,`M4 6a8 3 0 1 0 16 0a8 3 0 1 0-16 0M4 6v12a8 3 0 0 0 16 0V6M4 12a8 3 0 0 0 16 0`],[`server`,`M3 4h18v7H3zM3 13h18v7H3zM7 7.5h.01M7 16.5h.01M11 7.5h6M11 16.5h6`],[`disk`,`M5 3h14v18H5zM12 6.5a4 4 0 1 0 0 8a4 4 0 1 0 0-8M12 10.5h.01M8 18h3`],[`internet`,`M3 12a9 9 0 1 0 18 0a9 9 0 1 0-18 0M3 12h18M12 3a13 13 0 0 0 0 18M12 3a13 13 0 0 1 0 18`],[`cloud`,`M7 18a4 4 0 0 1-.5-7.97A6 6 0 0 1 18 9.5a4.25 4.25 0 0 1-.5 8.5z`]]);function I(e){let t=F.get(e);return t===void 0?``:`<path d="${t}" stroke="var(--_fg)" stroke-width="1.5"/>`}var L=[-1,1,0,0],R=[0,0,-1,1];function te(e){return e===`L`?0:e===`R`?1:e===`T`?2:3}var z=64,B=2**25,V=2**26;function ne(e,t,n,r){let i=e.length,a=t.length,o=a,s=new Map,c=new Map,l=new Int32Array(i+a).fill(o),u=new Int32Array(a+1),d=[];for(let e=0;e<=a;e++)d.push([]);t.forEach((e,t)=>{c.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&n!==t?(l[i+t]=n,u[t]=u[n]+1):u[t]=1}),e.forEach((e,t)=>{s.set(e.id,t);let n=e.in===void 0?void 0:c.get(e.in);n!==void 0&&(l[t]=n),d[l[t]].push(t)});for(let e=0;e<a;e++)d[l[i+e]].push(i+e);let f=[],p=[],m=[],h=[],g=[],_=[],v=Array(i+a),y=Array(i+a),b=(e,t,n,r,a)=>{if(e===t)return;let o=e,s=t,c=l[e],d=l[t];for(;c!==d;)u[c]>=u[d]?(o=i+c,c=l[o]):(s=i+d,d=l[s]);let v=f.length;f.push(e),p.push(t),m.push(n),h.push(r),g.push(o),_.push(s),(a[o]??=[]).push(v),(a[s]??=[]).push(v)};for(let e of r){let t=e.direction===`row`;for(let n=1;n<e.members.length;n++){let r=s.get(e.members[n-1]),i=s.get(e.members[n]);r!==void 0&&i!==void 0&&b(r,i,t?1:3,t?0:2,v)}}for(let e of[!1,!0])for(let t of n){if(t.lhsDir===t.rhsDir!==e)continue;let n=s.get(t.lhsId),r=s.get(t.rhsId);n!==void 0&&r!==void 0&&b(n,r,te(t.lhsDir),te(t.rhsDir),y)}let x=new Int32Array(i+a),S=new Int32Array(i+a),C=new Int32Array(i+a).fill(1),w=new Int32Array(i+a).fill(1),T=new Uint8Array(i+a),E=[],ee=new Map,D=[],O=new Map,k=0,A=0,j=0,M=(e,t)=>{A=0,j=0;for(let n=e;n!==t;n=i+l[n])A+=x[n],j+=S[n]},N=(e,t,n)=>{if(x[e]=t,S[e]=n,T[e]=1,E.push(e),C[e]*w[e]>z)D.push(e);else for(let r=n;r<n+w[e];r++)for(let n=t;n<t+C[e];n++)ee.set((n+B)*V+r+B,e)},P=(e,t,n,r,i)=>x[e]<t+r&&t<x[e]+C[e]&&S[e]<n+i&&n<S[e]+w[e],F=(e,t,n,r)=>{if(n*r>z){for(let i=k;i<E.length;i++)if(P(E[i],e,t,n,r))return E[i];return-1}for(let i=t;i<t+r;i++)for(let t=e;t<e+n;t++){let e=ee.get((t+B)*V+i+B);if(e!==void 0)return e}for(let i of D)if(P(i,e,t,n,r))return i;return-1},I=(e,t,n,r,i,a)=>{let o=`${e},${t},${n},${r},${i},${a}`,s=O.get(o)??0;for(;;){let o=F(e+s*i,t+s*a,n,r);if(o<0)break;s=i>0?x[o]+C[o]-e:i<0?e+n-x[o]:a>0?S[o]+w[o]-t:t+r-S[o]}return O.set(o,s),s},ne=(e,t)=>{let n=g[t]===e,r=n?_[t]:g[t];if(T[r])return;let i=n?m[t]:h[t],a=n?h[t]:m[t];M(n?f[t]:p[t],e);let o=A,s=j;M(n?p[t]:f[t],r);let c=L[i],l=R[i],u=0,d=0,v=L[i]+L[a]===0&&R[i]+R[a]===0;i===a?(c=+(L[i]===0),l=1-c):v||(u=-L[a],d=-R[a]);let b,E;if(c===0?(E=l>0?S[e]+w[e]:S[e]-w[r],b=x[e]+o+u-A):(b=c>0?x[e]+C[e]:x[e]-C[r],E=S[e]+s+d-j),v){let e=y[r];if(e!==void 0&&e.length>1){let t=[];for(let n of e){let e=_[n]===r,o=e?g[n]:_[n];if(!T[o]||(e?m[n]:h[n])!==i||(e?h[n]:m[n])!==a)continue;M(e?f[n]:p[n],o);let s=c===0?x[o]+A:S[o]+j;M(e?p[n]:f[n],r),t.push(s-(c===0?A:j))}t.length>1&&(t.sort((e,t)=>e-t),c===0?b=t[t.length-1>>1]:E=t[t.length-1>>1])}let t=+(c===0),n=1-t,o=I(b,E,C[r],w[r],t,n),s=o===0?0:I(b,E,C[r],w[r],-t,-n),l=o<=s?o:-s;b+=t*l,E+=n*l}else{let e=I(b,E,C[r],w[r],c,l);b+=c*e,E+=l*e}N(r,b,E)},H=e=>{let t=d[e];if(t.length===0)return;E.length=0;let n=[];for(let e of t){if(T[e])continue;k=E.length,n.push(k),ee.clear(),D.length=0,O.clear(),N(e,0,0);let t=k,r=k,i=0;for(;;){if(t<E.length){let e=E[t++],n=v[e];if(n!==void 0)for(let t of n)ne(e,t);continue}if(r>=E.length)break;let e=y[E[r]];e===void 0||i>=e.length?(r++,i=0):ne(E[r],e[i++])}}n.push(E.length);let r=n.length-1,o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=0,f=0;for(let e=0;e<r;e++){let t=1/0,r=1/0,i=-1/0,a=-1/0;for(let o=n[e];o<n[e+1];o++){let e=E[o];t=Math.min(t,x[e]),r=Math.min(r,S[e]),i=Math.max(i,x[e]+C[e]),a=Math.max(a,S[e]+w[e])}o[e]=t,s[e]=r,c[e]=i-t,l[e]=a-r,u+=c[e]*l[e],f=Math.max(f,c[e])}let p=Math.max(f,Math.ceil(Math.sqrt(u*2))),m=0,h=0,g=0,_=0;for(let e=0;e<r;e++){m>0&&m+c[e]>p&&(h+=g,m=0,g=0);for(let t=n[e];t<n[e+1];t++)x[E[t]]+=m-o[e],S[E[t]]+=h-s[e];m+=c[e],g=Math.max(g,l[e]),_=Math.max(_,m)}e<a&&(C[i+e]=_,w[i+e]=h+g)};for(let e=a-1;e>=0;e--)H(e);H(o);let U=new Int32Array(a),W=new Int32Array(a),re=new Int32Array(a),ie=new Uint8Array(a);for(let e=0;e<a;e++){let t=l[i+e];re[e]=t===o?-1:t,U[e]=x[i+e]+(t===o?0:U[t]),W[e]=S[i+e]+(t===o?0:W[t]),d[e].length===0&&(ie[e]=1)}let ae=new Int32Array(i),oe=new Int32Array(i),se=new Int32Array(i);for(let e=0;e<i;e++){let t=l[e];se[e]=t===o?-1:t,ae[e]=x[e]+(t===o?0:U[t]),oe[e]=S[e]+(t===o?0:W[t])}return{col:ae,row:oe,groupCol:U,groupRow:W,groupCols:C.slice(i),groupRows:w.slice(i),groupParent:re,groupEmpty:ie,nodeParent:se}}var H=12,U=6,W=4,re=3,ie=[-1,1,0,0],ae=[0,0,-1,1];function oe(e,t,n,r,i){let a=e.architecture,o=typeof a==`object`&&a&&!Array.isArray(a)?a[t]:void 0;return typeof o==`number`&&Number.isFinite(o)?Math.min(i,Math.max(r,o)):n}function se(e){let t=new Map;for(let n of e.sort((e,t)=>e-t))t.has(n)||t.set(n,t.size);return t}function ce(e,n,r,i,o){return`<svg class="pele-icon" data-icon="${t(e)}" x="${a(n)}" y="${a(r)}" width="${a(i)}" height="${a(i)}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${o?.(e)??I(e)}</svg>`}function le(e,t,n,r){let i=e.lines.length>n;if(!i&&e.width<=t)return e;let a=r.width(`…`,e.size,0),o=[],s=[],c=0;for(let l=0;l<Math.min(n,e.lines.length);l++){let u=e.lines[l].map(e=>({...e})),d=e.widths[l];if(d>t||i&&l===n-1)for(;;){let n=u[u.length-1];if(n===void 0){u.push({text:`…`,style:0,width:a}),d=a;break}let i=d-n.width;if(n.icon===void 0&&i+a<t){let o=0,s=n.text.length;for(;o<s;){let c=o+s+1>>1;i+r.width(n.text.slice(0,c),e.size,n.style)+a<=t?o=c:s=c-1}let c=o>0?n.text.charCodeAt(o-1):0;c>=55296&&c<=56319&&o--,n.text=n.text.slice(0,o).trimEnd()+`…`,n.width=r.width(n.text,e.size,n.style),d=i+n.width;break}u.pop(),d=i}o.push(u),s.push(d),c=Math.max(c,d)}return{...e,lines:o,widths:s,width:c,height:o.length*e.lineHeight}}function ue(e,t){let{x:n,y:r,dx:i,dy:a}=e,{x:o,y:s,dx:c,dy:l}=t,u=n+i*H,d=r+a*H,f=o+c*H,p=s+l*H;if(i*c+a*l===0){let e=i===0?n:o,t=i===0?s:r;return(e-n)*i+(t-r)*a>0&&(e-o)*c+(t-s)*l>0?[n,r,e,t,o,s]:i===0?[n,r,u,d,f,d,f,p,o,s]:[n,r,u,d,u,p,f,p,o,s]}let m=i!==0,h=m?s-r:o-n;if(i===-c&&a===-l){if((o-n)*i+(s-r)*a>0){if(Math.abs(h)<.5)return[n,r,o,s];if(m){let a=i>0?e.x1:t.x1,c=i>0?t.x0:e.x0,l=a<c?(a+c)/2:(n+o)/2;return[n,r,l,r,l,s,o,s]}let c=a>0?e.y1:t.y1,l=a>0?t.y0:e.y0,u=c<l?(c+l)/2:(r+s)/2;return[n,r,n,u,o,u,o,s]}}else if(Math.abs(h)>=1){if(m){let e=i>0?Math.max(n,o)+H:Math.min(n,o)-H;return[n,r,e,r,e,s,o,s]}let e=a>0?Math.max(r,s)+H:Math.min(r,s)-H;return[n,r,n,e,o,e,o,s]}if(m){let i=e.y1+H<=t.y0?(e.y1+t.y0)/2:t.y1+H<=e.y0?(t.y1+e.y0)/2:Math.max(e.y1,t.y1)+H;return[n,r,u,r,u,i,f,i,f,s,o,s]}let g=e.x1+H<=t.x0?(e.x1+t.x0)/2:t.x1+H<=e.x0?(t.x1+e.x0)/2:Math.max(e.x1,t.x1)+H;return[n,r,n,d,g,d,g,p,o,p,o,s]}function de(e){let t=[e[0],e[1]];for(let n=2;n<e.length;n+=2){let r=e[n],i=e[n+1],a=t.length,o=Math.abs(r-t[a-2])<.01,s=Math.abs(i-t[a-1])<.01;o&&s||(a>=4&&(o&&Math.abs(t[a-4]-t[a-2])<.01||s&&Math.abs(t[a-3]-t[a-1])<.01)?(t[a-2]=r,t[a-1]=i):t.push(r,i))}return t}function fe(e,t,n){let r=e.length/2,i=Array(r),o=Array(r);for(let t=0;t<r;t++)i[t]=e[t*2],o[t]=e[t*2+1];let s=(e,t,n)=>{let r=Math.hypot(i[t]-i[e],o[t]-o[e]),a=Math.min(n,Math.max(0,r-1));r>0&&a>0&&(i[e]+=(i[t]-i[e])/r*a,o[e]+=(o[t]-o[e])/r*a)};s(0,1,t),s(r-1,r-2,n);let c=`M${a(i[0])},${a(o[0])}`;for(let e=1;e<r-1;e++){let t=Math.hypot(i[e]-i[e-1],o[e]-o[e-1]),n=Math.hypot(i[e+1]-i[e],o[e+1]-o[e]),r=Math.min(U,t/2,n/2);if(r<.5){c+=`L${a(i[e])},${a(o[e])}`;continue}let s=i[e]-(i[e]-i[e-1])/t*r,l=o[e]-(o[e]-o[e-1])/t*r,u=i[e]+(i[e+1]-i[e])/n*r,d=o[e]+(o[e+1]-o[e])/n*r;c+=`L${a(s)},${a(l)}Q${a(i[e])},${a(o[e])} ${a(u)},${a(d)}`}return c+`L${a(i[r-1])},${a(o[r-1])}`}function G(e,t,n){return o(n,r=>K(e,t,n,r))}function K(o,d,f,p){let m=oe(d,`iconSize`,48,8,512),h=oe(d,`fontSize`,f.fontSize??16,4,128),g=Math.min(oe(d,`padding`,20,0,256),p?12:1/0),_=Math.round(h*.875),v=f.measurer??ee(f.fontFamily,f.fontFamilyMono),y=f.padding??8,b=f.icons,x=m/2,S=[...o.nodes.values()],C=[...o.groups.values()],w=S.length,T=C.length,E=ne(S,C,o.edges,o.layoutHints),D=new Map;S.forEach((e,t)=>D.set(e.id,t));let O=Array(w),k=new Float64Array(w),A=new Float64Array(w),j=p?Math.max(m,64):Math.max(m*2.25,96);for(let e=0;e<w;e++){let t=S[e],n=i(t.type===`service`?t.title:void 0,!0,v,h,j);O[e]=n,k[e]=Math.max(m,2*Math.ceil(n.width/2)),A[e]=m+(n.height>0?W+n.height:0)}let M=[],N=[];for(let e=0;e<w;e++)M.push(E.col[e]),N.push(E.row[e]);for(let e=0;e<T;e++)E.groupEmpty[e]&&(M.push(E.groupCol[e]),N.push(E.groupRow[e]));let P=se(M),F=se(N),I=P.size,L=F.size,R=new Float64Array(I),z=new Float64Array(L),B=p?Math.max(24,2*H):Math.max(40,Math.round(m*.75)),V=new Float64Array(I).fill(B),U=new Float64Array(L).fill(B),G=new Int32Array(w),K=new Int32Array(w);for(let e=0;e<w;e++){let t=G[e]=P.get(E.col[e]),n=K[e]=F.get(E.row[e]);R[t]=Math.max(R[t],k[e]),z[n]=Math.max(z[n],A[e])}for(let e=0;e<T;e++){if(!E.groupEmpty[e])continue;let t=P.get(E.groupCol[e]),n=F.get(E.groupRow[e]);R[t]=Math.max(R[t],m),z[n]=Math.max(z[n],x)}let pe=o.edges.length,me=Array(pe),he=new Int32Array(pe*2);for(let e=0;e<pe;e++){let t=o.edges[e],n=he[e*2]=D.get(t.lhsId)??-1,r=he[e*2+1]=D.get(t.rhsId)??-1,a=i(t.title,!0,v,_,160);if(me[e]=a,!(a.width===0||n<0||r<0)){if(G[n]!==G[r]){let e=Math.min(G[n],G[r]);V[e]=Math.max(V[e],Math.ceil(a.width)+28)}else if(R[G[n]]=Math.max(R[G[n]],2*Math.ceil(a.width/2)+8),K[n]!==K[r]){let e=Math.min(K[n],K[r]);U[e]=Math.max(U[e],Math.ceil(a.height)+24)}}}let ge=Array(T),q=new Int32Array(T),J=new Int32Array(T),_e=new Int32Array(T),Y=new Int32Array(T),ve=new Float64Array(T),ye=new Float64Array(T),be=new Float64Array(T),xe=new Float64Array(T),X=new Float64Array(T),Se=new Float64Array(T),Ce=new Float64Array(I),we=new Float64Array(I),Te=new Float64Array(L),Ee=new Float64Array(L),De=Math.round(h*1.25);for(let e=0;e<T;e++){q[e]=P.get(E.groupCol[e]),J[e]=P.get(E.groupCol[e]+E.groupCols[e]-1),_e[e]=F.get(E.groupRow[e]),Y[e]=F.get(E.groupRow[e]+E.groupRows[e]-1);let t=i(C[e].title,!0,v,h,p?Math.max(80,s(f)/2):320);ge[e]=t;let n=C[e].icon?De:0;X[e]=t.width+n+(t.width>0&&n>0?6:0),Se[e]=Math.max(t.height,n)}for(let e=T-1;e>=0;e--){let t=g+ve[e],n=g+ye[e],r=(Se[e]>0?Math.max(g,Se[e]+12):g)+be[e],i=g+xe[e];if(X[e]>0){let r=t+n;for(let t=q[e];t<=J[e];t++)r+=R[t]+(t<J[e]?we[t]+V[t]+Ce[t+1]:0);X[e]+20>r&&(n+=Math.ceil(X[e]+20-r))}ve[e]=t,ye[e]=n,be[e]=r,xe[e]=i,Ce[q[e]]=Math.max(Ce[q[e]],t),we[J[e]]=Math.max(we[J[e]],n),Te[_e[e]]=Math.max(Te[_e[e]],r),Ee[Y[e]]=Math.max(Ee[Y[e]],i);let a=E.groupParent[e];a<0||(q[a]===q[e]&&(ve[a]=Math.max(ve[a],t)),J[a]===J[e]&&(ye[a]=Math.max(ye[a],n)),_e[a]===_e[e]&&(be[a]=Math.max(be[a],r)),Y[a]===Y[e]&&(xe[a]=Math.max(xe[a],i)))}let Oe=new Float64Array(I),Z=new Float64Array(L),ke=0;for(let e=0;e<I;e++)Oe[e]=ke+Ce[e],ke=Oe[e]+R[e]+we[e]+(e<I-1?V[e]:0);let Ae=0;for(let e=0;e<L;e++)Z[e]=Ae+Te[e],Ae=Z[e]+z[e]+Ee[e]+(e<L-1?U[e]:0);let Q=0,je=0,Me=ke,Ne=Ae,Pe=e=>Oe[q[e]]-ve[e],Fe=e=>Oe[J[e]]+R[J[e]]+ye[e],Ie=e=>Z[_e[e]]-be[e],Le=e=>Z[Y[e]]+z[Y[e]]+xe[e],Re=e=>Oe[G[e]]+R[G[e]]/2,ze=(e,t,n)=>{let r=ie[t],i=ae[t],a=Re(e),o=Z[K[e]],s={x:a,y:o+x,dx:r,dy:i,x0:a-k[e]/2,y0:o,x1:a+k[e]/2,y1:o+A[e],gap:0,wire:!1};S[e].type===`junction`?(s.x0=s.x1=a,s.y0=s.y1=s.y,s.gap=re):r===0?s.y=i<0?o:o+A[e]+(O[e].height>0?2:0):s.x=a+r*x;let c=n?E.nodeParent[e]:-1;return c>=0&&(s.x0=Pe(c),s.x1=Fe(c),s.y0=Ie(c),s.y1=Le(c),s.gap=0,s.wire=S[e].type===`junction`,r===0?s.y=i<0?s.y0:s.y1:s.x=r<0?s.x0:s.x1),s},Be=``,Ve=``,$=[],He=c(`arrow_point`);for(let e=0;e<pe;e++){let n=o.edges[e],r=he[e*2],i=he[e*2+1];if(r<0||i<0)continue;let a=ze(r,te(n.lhsDir),n.lhsGroup),s=ze(i,te(n.rhsDir),n.rhsGroup);a.x===s.x&&a.y===s.y&&a.dx===s.dx&&(a.x-=8*Math.abs(a.dy),a.y-=8*Math.abs(a.dx),s.x+=8*Math.abs(a.dy),s.y+=8*Math.abs(a.dx));let c=ue(a,s);a.wire&&c.unshift(Re(r),Z[K[r]]+x),s.wire&&c.push(Re(i),Z[K[i]]+x);let d=de(c);if(d.length<4)continue;let f=t(`${n.lhsId}-${n.rhsId}`);Be+=`<g class="pele-edge" data-id="${f}"><path d="${fe(d,n.lhsInto&&!a.wire?He+a.gap:0,n.rhsInto&&!s.wire?He+s.gap:0)}"/>`+(n.lhsInto?u(`arrow_point`,a.x+a.dx*a.gap,a.y+a.dy*a.gap,-a.dx,-a.dy,`var(--_l)`):``)+(n.rhsInto?u(`arrow_point`,s.x+s.dx*s.gap,s.y+s.dy*s.gap,-s.dx,-s.dy,`var(--_l)`):``)+`</g>`;let p=-1,m=-1,h=-1,g=-1,_=me[e];for(let e=0;e<d.length;e+=2)Q=Math.min(Q,d[e]-4),Me=Math.max(Me,d[e]+4),je=Math.min(je,d[e+1]-4),Ne=Math.max(Ne,d[e+1]+4);for(let e=0;e+3<d.length;e+=2){let t=Math.abs(d[e+1]-d[e+3])<.01,n=Math.abs(d[e]-d[e+2])+Math.abs(d[e+1]-d[e+3]);t||$.push(d[e],Math.min(d[e+1],d[e+3]),Math.max(d[e+1],d[e+3])),n>m&&(p=e,m=n),t&&n>g&&(h=e,g=n)}if(_.width>0){let e=g>=_.width+8?h:p,t=(d[e]+d[e+2])/2,r=(d[e+1]+d[e+3])/2,i=_.width+8,o=Math.abs(d[e]-d[e+2])<.01;for(let e of[a,s])t+i/2<=e.x0||t-i/2>=e.x1||r+_.height/2<=e.y0||r-_.height/2>=e.y1||(o?t=t>=(e.x0+e.x1)/2?e.x1+i/2+4:e.x0-i/2-4:r=r>=(e.y0+e.y1)/2?e.y1+_.height/2+4:e.y0-_.height/2-4);Q=Math.min(Q,t-i/2),Me=Math.max(Me,t+i/2),je=Math.min(je,r-_.height/2),Ne=Math.max(Ne,r+_.height/2),Ve+=l(`${n.lhsId}-${n.rhsId}`,_,t,r,``,b)}}let Ue=``;for(let e=0;e<T;e++){let i=C[e],o=Pe(e),s=Ie(e),c=Fe(e)-o,l=ge[e],u=``;if(X[e]>0){let t=s+Se[e]+12,r=[];for(let e=0;e<$.length;e+=3)$[e+1]<t&&$[e+2]>s&&$[e]>o&&$[e]<o+c&&r.push($[e]);r.sort((e,t)=>e-t),r.push(o+c-4);let a=o+10;for(let t of r){if(t-6-a>=X[e])break;a=Math.max(a,t+6)}a+X[e]>o+c-4&&(a=o+10);let d=s+6+Se[e]/2,f=a;i.icon&&(u+=ce(i.icon,a,d-De/2,De,b),f+=De+6),u+=n(l,f+l.width/2,d,` class="pele-cluster-label" fill="var(--_m)"`,b)}Ue+=`<g class="pele-cluster" data-id="${t(i.id)}"><rect x="${a(o)}" y="${a(s)}" width="${a(c)}" height="${a(Le(e)-s)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${r}/>`+u+`</g>`}let We=``,Ge=m*.5,Ke=Math.max(6,Math.round(h*.75));for(let e=0;e<w;e++){let o=S[e],s=`data-id="${t(o.id)}" transform="translate(${a(Re(e))},${a(Z[K[e]])})"`;if(o.type===`junction`){We+=`<g class="pele-node pele-junction" ${s}><circle cy="${a(x)}" r="${re}" fill="var(--_l)"/></g>`;continue}let c=``;if(o.icon)c=ce(o.icon,-Ge/2,(m-Ge)/2,Ge,b);else if(o.iconText){let e=i(o.iconText,!1,v,Ke,m-8),t=Math.max(1,Math.floor((m-4)/(e.lineHeight||1)));c=n(le(e,m-8,t,v),0,x,` class="pele-icon-text" font-size="${Ke}"`,b)}We+=`<g class="pele-node pele-service" ${s}><rect x="${a(-x)}" width="${a(m)}" height="${a(m)}" fill="var(--_s)" stroke="var(--_b)"${r}/>`+c+n(O[e],0,m+W+O[e].height/2,` class="pele-label"`,b)+`</g>`}let qe=i(o.title,!1,v,h,p?s(f):4e3,1),Je=qe.height>0?qe.height+12:0,Ye=Math.ceil(Math.max(Me-Q,qe.width)+2*y),Xe=Math.ceil(Ne-je+Je+2*y),Ze=Math.round((Ye-(Me-Q))/2-Q),Qe=Math.round(y+Je-je),$e=(Ue?`<g class="pele-clusters">${Ue}</g>`:``)+(Be?`<g class="pele-edges" fill="none" stroke="var(--_l)" stroke-linecap="round" stroke-linejoin="round">${Be}</g>`:``)+(Ve?`<g class="pele-edge-labels" font-size="${_}">${Ve}</g>`:``)+(We?`<g class="pele-nodes">${We}</g>`:``);return{svg:e(`architecture`,Ye,Xe,h,f,o,n(qe,Ye/2,y+qe.height/2,` class="pele-title" font-weight="var(--_tw)"`)+($e?`<g transform="translate(${Ze},${Qe})">${$e}</g>`:``)),width:Ye,height:Xe,links:[]}}var pe={type:`architecture`,parse(e,t,n){let r=new O;return n&&(r.title=n),k(P(e),r),r},render:G};export{pe as architecture};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as e}from"./
|
|
1
|
+
import{u as e}from"./C2npZzkn.js";var t=/<(?!br\s*\/?>)/gi,n=/:fa-/g,r=/<br\s*\/?>|fl°°?\w+¶ß|&#?\w+;|[\ud800-\udbff][\udc00-\udfff]|[\s\S]/gi;function i(r,i,a,o,s=0){let c=r;return c!==void 0&&(c.includes(`<`)&&(c=c.replace(t,`<`)),c.includes(`:fa-`)&&(c=c.replace(n,`:fa-`))),e(c,!1,i,a,o,s)}function a(e,t,n,a,o=0){let s=i(e,t,n,a,o);if(e===void 0||s.width<=a)return s;let c=``,l=0;for(let i of e.match(r)??[]){if(i.trim()===``||i.length>2&&i[0]===`<`)l=0;else{let e=t.width(i.length>2?`x`:i,n,o);l>0&&l+e>a&&(c+=`
|
|
2
2
|
`,l=0),l+=e}c+=i}return i(c,t,n,a,o)}export{i as n,a as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e,a as t,g as n,i as r,o as i,r as a,s as o,u as s,x as c}from"./
|
|
1
|
+
import{_ as e,a as t,g as n,i as r,o as i,r as a,s as o,u as s,x as c}from"./C2npZzkn.js";import{i as l}from"./DciMwFJ1.js";import{i as u,t as d}from"./DKqMzyyE.js";import{PeleError as f,h as p,s as m,u as ee}from"./CMikI1NP.js";var h=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],g=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function _(e){return!Number.isNaN(e.getTime())}function v(e,t){let n=String(e);return n.length>=t?n:`0`.repeat(t-n.length)+n}function te(e){let t=[`th`,`st`,`nd`,`rd`],n=e%100;return e+(t[(n-20)%10]||t[n]||t[0])}function y(e){let t=-Math.round(e.getTimezoneOffset()/15)*15;return t===0?0:t}function b(e){let t=y(e),n=Math.abs(t);return(t>=0?`+`:`-`)+v(Math.floor(n/60),2)+`:`+v(n%60,2)}function x(e){return e.getDay()||7}function S(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function ne(e){let t=new Date(e.getFullYear(),e.getMonth()+1,0);return t.setHours(23,59,59,999),t.getDate()}function re(e,t){let n=new Date(e);return n.setDate(1),t(n),n.setDate(Math.min(e.getDate(),ne(n))),n}function ie(e,t,n){switch(n){case`M`:return re(e,n=>n.setMonth(e.getMonth()+t));case`y`:return re(e,n=>n.setFullYear(e.getFullYear()+t));case`d`:return S(e,Math.round(t));case`w`:return S(e,Math.round(7*t));case`h`:return new Date(e.getTime()+t*36e5);case`m`:return new Date(e.getTime()+t*6e4);case`s`:return new Date(e.getTime()+t*1e3);default:return new Date(e.getTime()+t)}}function ae(e){return S(e,4-x(e))}function oe(e){let t=ae(e),n=new Date(t.getFullYear(),0,1),r=x(n),i=S(n,4-r+(r>4?7:0)),a=(y(i)-y(t))*6e4,o=(t.getTime()-i.getTime()-a)/6048e5;return(o<0?Math.ceil(o)||0:Math.floor(o))+1}var se=/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g,ce=/\[([^\]]+)]|YYYY|YY|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C=`YYYY-MM-DDTHH:mm:ssZ`;function le(e,t){if(!_(e))return`Invalid Date`;let n=t||C;if(n===`YYYY-MM-DD`)return w(e);let r=!1,i=n.replace(se,t=>{switch(t){case`Q`:return String(Math.ceil((e.getMonth()+1)/3));case`Do`:return`[`+te(e.getDate())+`]`;case`GGGG`:return String(ae(e).getFullYear());case`W`:return String(oe(e));case`WW`:return v(oe(e),2);case`k`:return String(e.getHours()||24);case`kk`:return v(e.getHours()||24,2);case`X`:return String(Math.floor(e.getTime()/1e3));case`x`:return String(e.getTime());case`gggg`:case`wo`:case`w`:case`ww`:case`z`:case`zzz`:return r=!0,t;default:return t}});if(r)return;let a=e.getHours();return i.replace(ce,(t,n)=>{if(n)return n;switch(t){case`YY`:return String(e.getFullYear()).slice(-2);case`YYYY`:return v(e.getFullYear(),4);case`M`:return String(e.getMonth()+1);case`MM`:return v(e.getMonth()+1,2);case`MMM`:return h[e.getMonth()].slice(0,3);case`MMMM`:return h[e.getMonth()];case`D`:return String(e.getDate());case`DD`:return v(e.getDate(),2);case`d`:return String(e.getDay());case`dd`:return g[e.getDay()].slice(0,2);case`ddd`:return g[e.getDay()].slice(0,3);case`dddd`:return g[e.getDay()];case`H`:return String(a);case`HH`:return v(a,2);case`h`:return String(a%12||12);case`hh`:return v(a%12||12,2);case`a`:return a<12?`am`:`pm`;case`A`:return a<12?`AM`:`PM`;case`m`:return String(e.getMinutes());case`mm`:return v(e.getMinutes(),2);case`s`:return String(e.getSeconds());case`ss`:return v(e.getSeconds(),2);case`SSS`:return v(e.getMilliseconds(),3);case`Z`:return b(e);default:return b(e).replace(`:`,``)}})}function w(e){let t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();return(t>=1e3&&t<=9999?t:v(t,4))+(n<10?`-0`:`-`)+n+(r<10?`-0`:`-`)+r}var ue=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,T=/\[[^\]]+]/g,E=/\d/,D=/\d\d/,O=/\d{3}/,de=/\d{4}/,k=/\d\d?/,A=/[+-]?\d+/,fe=/[+-]\d\d:?(\d\d)?|Z/,j=/\d*[^-_:/,()\s\d]+/;function M(e){return(t,n)=>(t[e]=+n,!0)}var N=(e,t)=>{if(t===`Z`)return e.offset=0,!0;let n=t.match(/([+-]|\d\d)/g),r=n[1]*60+(+n[2]||0);return e.offset=r===0?0:n[0]===`+`?-r:r,!0};function pe(e){return(t,n)=>{let r=e.indexOf(n)+1;return r<1?!1:(t.month=r%12||r,!0)}}var me=new Map([[`A`,{re:j,read:(e,t)=>(e.afternoon=t===`PM`,!0)}],[`a`,{re:j,read:(e,t)=>(e.afternoon=t===`pm`,!0)}],[`Q`,{re:E,read:(e,t)=>(e.month=(t-1)*3+1,!0)}],[`S`,{re:E,read:(e,t)=>(e.milliseconds=t*100,!0)}],[`SS`,{re:D,read:(e,t)=>(e.milliseconds=t*10,!0)}],[`SSS`,{re:O,read:(e,t)=>(e.milliseconds=+t,!0)}],[`s`,{re:k,read:M(`seconds`)}],[`ss`,{re:k,read:M(`seconds`)}],[`m`,{re:k,read:M(`minutes`)}],[`mm`,{re:k,read:M(`minutes`)}],[`H`,{re:k,read:M(`hours`)}],[`h`,{re:k,read:M(`hours`)}],[`HH`,{re:k,read:M(`hours`)}],[`hh`,{re:k,read:M(`hours`)}],[`D`,{re:k,read:M(`day`)}],[`DD`,{re:D,read:M(`day`)}],[`Do`,{re:j,read:(e,t)=>{let n=t.match(/\d+/);if(!n)return!1;e.day=+n[0],e.dayGiven=!0;for(let n=1;n<=31;n++)te(n)===t&&(e.day=n);return!0}}],[`w`,{re:k,read:M(`week`)}],[`ww`,{re:D,read:M(`week`)}],[`M`,{re:k,read:M(`month`)}],[`MM`,{re:D,read:M(`month`)}],[`MMM`,{re:j,read:pe(h.map(e=>e.slice(0,3)))}],[`MMMM`,{re:j,read:pe(h)}],[`Y`,{re:A,read:M(`year`)}],[`YY`,{re:D,read:(e,t)=>(e.year=+t+(+t>68?1900:2e3),!0)}],[`YYYY`,{re:de,read:M(`year`)}],[`Z`,{re:fe,read:N}],[`ZZ`,{re:fe,read:N}]]),P,F=null;function he(e){if(e===P)return F;if(P=e,F=null,/[Ll]/.test(e.replace(T,``)))return null;let t=e.match(ue);return t?(F=t.map(e=>me.get(e)??e.replace(/^\[|\]$/g,``)),F):null}function I(e,t,n){if(t===`x`||t===`X`)return new Date((t===`X`?1e3:1)*Number(e));let r=he(t);if(!r)return;let i={},a=e,o=0;for(let e of r){if(typeof e==`string`){o+=e.length;continue}let t=e.re.exec(a.slice(o));if(!t||!e.read(i,t[0]))return;a=a.replace(t[0],``)}i.afternoon!==void 0&&i.hours!==void 0&&(i.afternoon?i.hours<12&&(i.hours+=12):i.hours===12&&(i.hours=0));let s=i.dayGiven||i.day?i.day:!i.year&&!i.month?n.getDate():1,c=i.year||n.getFullYear(),l=0;i.year&&!i.month||(l=i.month>0?i.month-1:n.getMonth());let u=i.hours||0,d=i.minutes||0,f=i.seconds||0,p=i.milliseconds||0;if(i.offset!==void 0)return new Date(Date.UTC(c,l,s,u,d,f,p+i.offset*6e4));if(!i.week)return new Date(c,l,s,u,d,f,p)}function L(e,t,n){let r=I(e,t,n);return r&&_(r)&&le(r,t)===e?r:void 0}var ge=/^[YMDHhmsSZXx\-/.:, T]*$/,_e=/^\s*(active|done|crit|milestone|vert)\s*$/,ve=/^after\s+([\d\w- ]+)/,R=/^until\s+([\d\w- ]+)/,z=/^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/,ye=/[\s,]+/,B=/^\d+$/,be=new Set(g.map(e=>e.toLowerCase())),V=4e8,xe=400,Se=200,Ce=400;function we(e){let t=e===void 0?NaN:+e;return Number.isFinite(t)?t:Date.now()}function Te(e){let t=z.exec(e.trim());return t?[Number.parseFloat(t[1]),t[2]]:[NaN,`ms`]}function Ee(e,t){let n=new Set(e);for(let e of t.toLowerCase().split(ye))e!==``&&n.add(e);return[...n]}var De=class{type=`gantt`;title;accTitle;accDescr;dateFormat=``;axisFormat=``;tickInterval;todayMarker=``;includes=[];excludes=[];inclusiveEndDates=!1;topAxis=!1;displayMode=``;weekday;weekend=`saturday`;sections=[];links=new Map;tasks=[];byId=new Map;currentSection=``;taskCount=0;lastOrder=0;lastTaskId;options;now=0;work=0;includeSet=new Set;excludeSet=new Set;excludedDays=[];datedTokens=!1;constructor(e={}){this.options=e}setDateFormat(e){this.dateFormat=e}enableInclusiveEndDates(){this.inclusiveEndDates=!0}TopAxis(){this.topAxis=!0}setAxisFormat(e){this.axisFormat=e}setTickInterval(e){this.tickInterval=e}setTodayMarker(e){this.todayMarker=e}setIncludes(e){this.includes=Ee(this.includes,e)}setExcludes(e){this.excludes=Ee(this.excludes,e)}setWeekday(e){this.weekday=e}setWeekend(e){this.weekend=e}setDiagramTitle(e){this.title=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
|
|
2
2
|
`)}addSection(e){this.currentSection=e,this.sections.push(e)}addTask(e,t){let n=(t.startsWith(`:`)?t.slice(1):t).split(`,`),r={id:``,task:e,section:this.currentSection,startTime:void 0,endTime:void 0,renderEndTime:null,manualEndTime:!1,processed:!1,active:!1,done:!1,crit:!1,milestone:!1,vert:!1,order:-1,classes:[],prevTaskId:this.lastTaskId,raw:{data:t,start:void 0,end:``}},i;for(;n.length>0&&(i=_e.exec(n[0]))!==null;)r[i[1]]=!0,n.shift();if(n.length===0)throw new f(`Task "${e.trim()}" needs a duration or an end date.`,`semantic`,{type:`gantt`});if(n.length>3)throw new f(`Task "${e.trim()}" has too many fields. A task takes an id, a start, and an end or duration.`,`semantic`,{type:`gantt`});for(let e=0;e<n.length;e++)n[e]=n[e].trim();n.length===3?r.id=n[0]:(this.taskCount++,r.id=`task`+this.taskCount),n.length>1&&(r.raw.start=n[n.length-2]),r.raw.end=n[n.length-1],r.vert||(r.order=this.lastOrder++),this.tasks.push(r),this.lastTaskId=r.id,this.byId.set(r.id,r)}setLink(e,t){let n=u(t);for(let t of e.split(`,`))this.byId.has(t)&&this.links.set(t,n);this.setClass(e,`clickable`)}setClickEvent(e,t,n){this.setClass(e,`clickable`)}setClass(e,t){for(let n of e.split(`,`))this.byId.get(n)?.classes.push(t)}getTasks(e){this.now=we(e),this.work=0,this.includeSet=new Set(this.includes),this.excludeSet=new Set(this.excludes);let t=this.weekend===`friday`?5:this.weekend===`saturday`?6:NaN,n=this.excludeSet.has(`weekends`);this.excludedDays=g.map((e,r)=>{let i=r||7;return n&&(i===t||i===t+1)||this.excludeSet.has(e.toLowerCase())}),this.datedTokens=this.includes.length>0||!ge.test(this.dateFormat.trim());for(let e of this.excludes)e!==`weekends`&&!be.has(e)&&(this.datedTokens=!0);for(let e of this.tasks)e.startTime=e.endTime=void 0,e.renderEndTime=null,e.processed=e.manualEndTime=!1;let r=this.compileTasks();for(let e=0;!r&&e<10;e++)r=this.compileTasks();return this.tasks}isInvalidDate(e){let t=this.excludedDays[e.getDay()];if(!this.datedTokens)return t;let n=this.dateFormat.trim(),r=w(e),i=r;this.spend(Se),n!==`YYYY-MM-DD`&&(this.spend(Ce+n.length*8),i=le(e,n));let a=e=>e.has(r)||i!==void 0&&e.has(i);return a(this.includeSet)?!1:t||a(this.excludeSet)}spend(e){if(this.work+=e,this.work>V)throw new f(`The gantt chart takes too much work to schedule.`,`limit`,{type:`gantt`})}parse(e,t){return this.spend((t.length+1)*(e.length+1)),L(e,t,new Date(this.now))}today(){let e=new Date(this.now);return e.setHours(0,0,0,0),e}warn(e){this.options.warn&&this.options.warn(e())}compileTasks(){let e=!0;for(let t of this.tasks)this.compileTask(t),e&&=t.processed;return e}compileTask(e){let t=e.raw.start;if(t===void 0){let t=e.prevTaskId===void 0?void 0:this.byId.get(e.prevTaskId);e.startTime=t?t.endTime:this.today()}else{let n=this.getStartDate(t);n&&(e.startTime=n)}e.startTime&&(e.endTime=this.getEndDate(e.startTime,e.raw.end),e.endTime&&(e.processed=!0,e.manualEndTime=this.parse(e.raw.end,`YYYY-MM-DD`)!==void 0,this.checkTaskDates(e)))}references(e,t){let n=[],r;for(let e of t.split(` `)){if(e===``)continue;let t=this.byId.get(e);t?n.push(t):(r??=[]).push(e)}if(r){let t=r;this.warn(()=>`Gantt: "${e}" refers to task ids that do not exist: ${t.join(`, `)}.`)}return n}getStartDate(e){let t=e.trim(),n=this.dateFormat.trim();if((n===`x`||n===`X`)&&B.test(t))return this.checked(new Date(Number(t)),t);let r=ve.exec(t);if(r!==null){let e=this.references(`after`,r[1]),t;for(let n of e)(!t||n.endTime>t.endTime)&&(t=n);return t?t.endTime:this.today()}let i=this.parse(t,n);if(i)return i;let a=new Date(t);if(!_(a)||a.getFullYear()<-1e4||a.getFullYear()>1e4)throw new f(`Invalid date:`+t,`semantic`,{type:`gantt`});return a}checked(e,t){if(!_(e))throw new f(`Invalid date:`+t,`semantic`,{type:`gantt`});return e}getEndDate(e,t){let n=t.trim(),r=R.exec(n);if(r!==null){let e=this.references(`until`,r[1]),t;for(let n of e)(!t||n.startTime<t.startTime)&&(t=n);return t?t.startTime:this.today()}let i=this.dateFormat.trim(),a=this.parse(n,i);if(a)return this.inclusiveEndDates?S(a,1):a;let[o,s]=Te(n);if(Number.isNaN(o))return this.warn(()=>`Gantt: "${n}" is neither a date in the "${i}" format nor a duration such as "3d", so the task gets no duration.`),new Date(e);let c=ie(e,o,s);return _(c)?c:new Date(e)}checkTaskDates(e){if(this.excludes.length===0||e.manualEndTime)return;let t=S(e.startTime,1),n=new Date(e.endTime),r=+S(n,1e4),i=!1,a=null;for(;+t<=+n;){if(this.spend(xe),i||(a=+n),i=this.isInvalidDate(t),i&&(n.setDate(n.getDate()+1),+n>r))throw new f("Failed to find a valid date that was not excluded by `excludes` after 10,000 iterations.",`semantic`,{type:`gantt`});t.setDate(t.getDate()+1)}e.endTime=n,e.renderEndTime=a===null?null:new Date(a)}},Oe=`$end.INVALID.open_directive.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.NL.href.callbackname.callbackargs.click.gantt.dateFormat.inclusiveEndDates.topAxis.axisFormat.tickInterval.includes.excludes.todayMarker.weekday_monday.weekday_tuesday.weekday_wednesday.weekday_thursday.weekday_friday.weekday_saturday.weekday_sunday.weekend_friday.weekend_saturday.date.title.accDescription.section.taskTxt.taskData.:.EOF`.split(`.`),ke=/accTitle\s*:\s*/iy,Ae=/accDescr\s*:\s*/iy,je=/accDescr\s*\{\s*/iy,Me=/href\s+"/iy,Ne=/call\s+/iy,Pe=/click\s+/iy,H=/\(\s*\)/y,Fe=/weekday\s+(monday|tuesday|wednesday|thursday|friday|saturday|sunday)\b/iy,Ie=[`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`,`sunday`],U=/weekend\s+(?:(friday)|saturday)\b/iy,Le=/\d\d\d\d-\d\d-\d\d\b/y,Re=/title[^\S\r\n]*(?=[\r\n]|$)/iy,ze=new Map([[97,[[/axisFormat\s[^#\n;]+/iy,17],[/accDescription\s[^#\n;]+/iy,33]]],[103,[[/gantt\b/iy,13]]],[100,[[/dateFormat\s[^#\n;]+/iy,14]]],[105,[[/inclusiveEndDates\b/iy,15],[/includes\s[^#\n;]+/iy,19]]],[116,[[/topAxis\b/iy,16],[/tickInterval\s[^#\n;]+/iy,18],[/todayMarker\s[^\n;]+/iy,21],[/title[^\S\r\n][^\n]+/iy,32]]],[101,[[/excludes\s[^#\n;]+/iy,20]]],[115,[[/section\s[^\n]+/iy,34]]]]);function Be(e){let t=e.length,n=[],r=[],i=[],a=0,o=0,s=(t,a,s)=>{n.push(t),r.push(e.slice(a,s)),i.push(a),o=s},c=t=>(t.lastIndex=o,t.test(e)?t.lastIndex:-1),l=(n,r)=>{let i=e.indexOf(n,r);return i===-1?t:i},u=t=>{let n;switch(t|32){case 97:if((n=c(ke))>=0)return a=1,s(3,o,n),!0;if((n=c(Ae))>=0)return a=2,s(5,o,n),!0;if((n=c(je))>=0)return a=3,o=n,!0;break;case 104:if((n=c(Me))>=0)return a=4,o=n,!0;break;case 99:if((n=c(Ne))>=0)return a=5,o=n,!0;if((n=c(Pe))>=0)return a=7,o=n,!0;break;case 116:if((n=c(Re))>=0)return o=n,!0;break;case 119:{Fe.lastIndex=o;let t=Fe.exec(e);if(t)return s(22+Ie.indexOf(t[1].toLowerCase()),o,Fe.lastIndex),!0;if(U.lastIndex=o,t=U.exec(e),t)return s(t[1]===void 0?30:29,o,U.lastIndex),!0;break}}let r=ze.get(t|32);if(r){for(let[e,t]of r)if((n=c(e))>=0)return s(t,o,n),!0}return!1};for(;;){if(o>=t){let e=38;switch(a){case 1:e=4;break;case 2:e=6;break;case 3:e=7;break;case 4:e=9;break;case 5:e=10;break;case 6:e=11;break;case 7:e=12}s(e,t,t);break}let d=e.charCodeAt(o);switch(a){case 0:{let a=e.charCodeAt(o+1);if(d===37){if(a!==37){let t=l(`
|
|
3
3
|
`,o+1);for(;e.charCodeAt(t)===10;)t++;o=t}else{if(e.charCodeAt(o+2)===123)return s(2,o,o+3),s(1,o,o),{types:n,texts:r,starts:i};o=l(`
|
|
4
4
|
`,o+2)}}else if(d===10){let t=o+1;for(;e.charCodeAt(t)===10;)t++;s(8,o,t)}else if(p(d))for(o++;o<t&&p(e.charCodeAt(o));)o++;else{if(u(d))break;if(d>=48&&d<=57&&c(Le)>=0)s(31,o,o+10);else if(d!==58){let n=o+1;for(;n<t;){let t=e.charCodeAt(n);if(t===58||t===10)break;n++}s(35,o,n)}else{let n=o+1;for(;n<t;){let t=e.charCodeAt(n);if(t===35||t===10||t===59)break;n++}s(n>o+1?36:37,o,n)}}break}case 1:case 2:{let e=a===1?4:6;a=0,s(e,o,l(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e,f as t,n,o as r,r as i,t as a}from"./BLmF1B2i.js";function o(e){return e===`BT`||e===`LR`||e===`RL`?e:`TB`}var s=4e4,c=400,l=500,u=1.5,d=4;function f(e,t,n,r){let i=[];for(let t of e)i.push(t.x,t.y,t.w,t.h);let a=[];for(let e of t)a.push(e.labelX,e.labelY);let o=[];for(let e of n){o.push(e.x,e.y);for(let t of e.ports)o.push(t.px,t.py)}return{nodes:i,routes:t.map(e=>e.route),labels:a,levels:o,total:r}}function p(e,t,n,r){t.forEach((t,n)=>{t.x=e.nodes[4*n],t.y=e.nodes[4*n+1],t.w=e.nodes[4*n+2],t.h=e.nodes[4*n+3]}),n.forEach((t,n)=>{t.route=e.routes[n],t.labelX=e.labels[2*n],t.labelY=e.labels[2*n+1]});let i=0;for(let t of r){t.x=e.levels[i++],t.y=e.levels[i++];for(let n of t.ports)n.px=e.levels[i++],n.py=e.levels[i++]}return e.total}var m=24,h=.5,g=3,_=2,v=Math.max(3,g,_+1),y=.62,b=128;function x(e){return e.tracks?1:e.straight?2:0}function S(e,t,n=0){let r=0;for(let e of t)e.src!==e.dst&&e.route.length>3&&(r+=(e.route.length/3-1)*v);let a=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(r),c=new Float64Array(r),l=new Float64Array(r),u=new Float64Array(r),d=new Int32Array(r),f=new Uint8Array(r),p=0,x=1/0,S=-1/0,C=NaN,w=NaN,T=NaN,E=NaN,D=(e,t,n,r,i,m)=>{let h=p-1;n===T&&r===E&&(m===r&&w===r||i===n&&C===n)&&d[h]===e&&f[h]===t&&(n-C)*(i-n)+(r-w)*(m-r)>0&&(p--,n=C,r=w),C=n,w=r,T=i,E=m,f[p]=t,a[p]=Math.min(n,i),s[p]=Math.max(n,i),o[p]=n<=i?r:m,c[p]=n<=i?m:r,l[p]=Math.min(r,m),u[p]=Math.max(r,m),l[p]<x&&(x=l[p]),u[p]>S&&(S=u[p]),d[p++]=e};for(let e=0;e<t.length;e++){let r=t[e];if(r.src===r.dst)continue;let a=r.route,o=e=>Math.abs(a[e]-a[e-3])<.01||Math.abs(a[e+1]-a[e-2])<.01,s=e=>Math.abs(a[e]-a[e-3])+Math.abs(a[e+1]-a[e-2]),c=e=>n===0&&e>0&&e<a.length-3&&o(e)&&o(e+3)&&s(e)>=.01&&s(e+3)>=.01&&Math.abs(a[e]-a[e-3])<.01!=Math.abs(a[e+3]-a[e])<.01,l=a[0],u=a[1];for(let t=3;t<a.length;t+=3){let r=+(t===3)|(t===a.length-3?2:0),d=l,f=u,p=a[t],m=a[t+1];if(l=p,u=m,o(t)||n===2){if(!c(t)){D(e,r,d,f,p,m);continue}let n=c(t-3)?s(t)/2:s(t),i=c(t+3)?s(t+3)/2:s(t+3),o=(p-a[t-3])/s(t),h=(m-a[t-2])/s(t),g=(a[t+3]-p)/s(t+3),v=(a[t+4]-m)/s(t+3),b=p-o*n,x=m-h*n;D(e,r,d,f,b,x);let S=p-o*n*(1-y),C=m-h*n*(1-y),w=p+g*i*(1-y),T=m+v*i*(1-y);l=p+g*i,u=m+v*i;let E=r|(t+3===a.length-3?2:0),O=b,k=x;for(let t=1;t<=_;t++){let n=t/_,r=1-n,i=r*r*r*b+3*r*r*n*S+3*r*n*n*w+n*n*n*l,a=r*r*r*x+3*r*r*n*C+3*r*n*n*T+n*n*n*u;D(e,E,O,k,i,a),O=i,k=a}continue}if(n===1){let n=a[t+2]===0,i=n?d:(d+p)/2,o=n?(f+m)/2:f;D(e,r,d,f,i,o),D(e,r,i,o,n?p:i,n?o:m),D(e,r,n?p:i,n?o:m,p,m);continue}let h=a[t+2]===0,v=h?i(p-d,m-f):i(m-f,p-d),b=d,x=f;for(let t=1;t<=g;t++){let n=t/g,i=1-n,a=n*n*(3-2*n),o=3*v*n*i*i+3*(1-v)*n*n*i+n*n*n,s=d+(p-d)*(h?a:o),c=f+(m-f)*(h?o:a);D(e,r,b,x,s,c),b=s,x=c}}}let O=S>x?Math.round(Math.sqrt(p)):1,k=S>x?O/(S-x):0,A=e=>Math.min(O-1,Math.floor((e-x)*k)),j=new Int32Array(p),M=new Int32Array(O+1);for(let e=0;e<p;e++){j[e]=A(l[e]);for(let t=j[e],n=A(u[e]);t<=n;t++)M[t+1]++}for(let e=0;e<O;e++)M[e+1]+=M[e];let N=M.slice(0,O),P=new Int32Array(M[O]);for(let e=0;e<p;e++)for(let t=j[e],n=A(u[e]);t<=n;t++)P[N[t]++]=e;let F=new Float64Array(t.length*8),I=(e,t,n,r)=>Math.abs(e[t]-e[n])<h&&Math.abs(e[t]-e[r])<h||Math.abs(e[t+1]-e[n+1])<h&&Math.abs(e[t+1]-e[r+1])<h;for(let e=0;e<t.length;e++){let n=t[e].route;if(n.length<6)continue;let r=3;for(;r+3<n.length&&I(n,0,r,r+3);)r+=3;let i=n.length-3,a=i-3;for(;a>=3&&I(n,i,a,a-3);)a-=3;F.set([n[0],n[1],n[r],n[r+1],n[a],n[a+1],n[i],n[i+1]],e*8)}let L=(e,t,n,r)=>{let i=e*8+(t===1?0:4),a=F[i],o=F[i+1],s=F[i+2]-a,c=F[i+3]-o,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((n-a)*s+(r-o)*c)/l)):0;return Math.hypot(n-a-u*s,r-o-u*c)<h},R=0;for(let n=0;n<O;n++){let r=M[n+1];if(r-M[n]>b)P.subarray(M[n],r).sort((e,t)=>a[e]-a[t]||e-t);else for(let e=M[n]+1;e<r;e++){let t=P[e],r=e;for(;r>M[n]&&a[P[r-1]]>a[t];r--)P[r]=P[r-1];P[r]=t}for(let i=M[n];i<r;i++){let p=P[i],h=s[p]-a[p],g=c[p]-o[p],_=j[p]===n;for(let v=i+1;v<r;v++){let r=P[v];if(a[r]>s[p])break;if(u[r]<l[p]||l[r]>u[p]||d[p]===d[r]||!_&&j[r]!==n)continue;let i=h*(o[r]-o[p])-g*(a[r]-a[p]),y=h*(c[r]-o[p])-g*(s[r]-a[p]);if(i>0==y>0)continue;let b=s[r]-a[r],x=c[r]-o[r],S=b*(o[p]-o[r])-x*(a[p]-a[r]),C=b*(c[p]-o[r])-x*(s[p]-a[r]);if(S>0==C>0)continue;let w=t[d[p]],T=t[d[r]],E=S/(S-C),D=a[p]+E*h,O=o[p]+E*g,k=(t,n,i)=>(f[p]&n)!==0&&(f[r]&i)!==0||Math.abs(D-e[t].x)<e[t].w/2+m&&Math.abs(O-e[t].y)<e[t].h/2+m||L(d[p],n,D,O)&&L(d[r],i,D,O);w.src===T.src&&k(w.src,1,1)||w.src===T.dst&&k(w.src,1,2)||w.dst===T.src&&k(w.dst,2,1)||w.dst===T.dst&&k(w.dst,2,2)||R++}}}return R}function C(e,t,n,r){for(let t of e)t.x+=n,t.y+=r;for(let e of t){for(let t=0;t<e.route.length;t+=3)e.route[t]+=n,e.route[t+1]+=r;e.labelX+=n,e.labelY+=r}}function w(e,t,n=-1){return{w:e,h:t,parent:n,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function T(e){return e===`TB`?0:e===`BT`?2:e===`LR`?3:1}function E(e){return e+2&3}function D(i,o,m,g){let _=i.length,v=new Map,y=[],b=(e,t)=>{let n={id:e,dir:t,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return v.set(e,n),n},C=b(-1,m),w=[];for(let e=0;e<_;e++)w.push([]);let D=[];for(let e=0;e<_;e++){let t=i[e].parent;t>=0&&t<_&&t!==e&&i[t].isGroup?w[t].push(e):(i[e].parent=-1,D.push(e))}C.items=D,y.push(C);let O=new Int32Array(_),k=new Uint8Array(_),A=e=>{for(let t=e;t<y.length;t++){let e=y[t];for(let t of e.items)if(k[t]=1,O[t]=e.id<0?0:O[e.id]+1,i[t].isGroup){let n=b(t,i[t].dir??e.dir);n.items=w[t],y.push(n)}}};A(0);for(let e=0;e<_;e++){if(k[e])continue;let t=i[e].parent;if(w[t]=w[t].filter(t=>t!==e),i[e].parent=-1,C.items.push(e),k[e]=1,O[e]=0,i[e].isGroup){let t=y.length,n=b(e,i[e].dir??m);n.items=w[e],y.push(n),A(t)}}for(let e=y.length-1;e>0;e--){let t=y[e],n=1/0;for(let e of t.items)i[e].seq<n&&(n=i[e].seq);n!==1/0&&(i[t.id].seq=n)}for(let e of y)e.items.sort((e,t)=>i[e].seq-i[t].seq||e-t);let j=0;for(let e of o){let t=e.src,n=e.dst,r=0;for(;O[t]>O[n];r++)t=i[t].parent;for(;O[n]>O[t];r++)n=i[n].parent;for(;t!==n&&i[t].parent!==i[n].parent;r+=2)t=i[t].parent,n=i[n].parent;t!==n&&(j+r>s?(e.src=t,e.dst=n):j+=r)}let M=[],N=[];for(let e=0;e<o.length;e++){let t=o[e];if(t.route=[],t.src===t.dst){M.push(e);continue}let n=t.src,r=t.dst,a=[],s=[];for(;O[n]>O[r];)a.push(n),n=i[n].parent;for(;O[r]>O[n];)s.push(r),r=i[r].parent;if(n===r)N.push(e);else{for(;i[n].parent!==i[r].parent;)a.push(n),s.push(r),n=i[n].parent,r=i[r].parent;v.get(i[n].parent).edges.push({e,a:n,b:r});for(let[t,n]of[[a,!0],[s,!1]])for(let r of t){let t=v.get(i[r].parent),a={e,inner:r,out:n,side:0,hint:NaN,px:0,py:0,route:[]};t.ports.push(a),t.portOf.set(e*2+ +!n,a)}}}let P=new Int32Array(_),F=(e,t,n)=>(n?t.src:t.dst)!==e,I=(e,t)=>{let n=e.dir===`TB`||e.dir===`BT`,s=T(e.dir),c=[],l=[];e.items.forEach((e,a)=>{P[e]=a;let o=i[e],s=t?r(n?o.w:o.h,n?o.h:o.w):r(0,0);s.span=o.isGroup?Math.min(o.span,s.w-2*o.padX):o.span,s.key=z?R[e]:NaN,c.push(s)});let u=(e,t,n)=>i[e].isGroup&&F(e,o[t],n),d=(e,r,a)=>{if(!t||!i[e].isGroup||!F(e,o[r],a))return 0;let s=v.get(e).portOf.get(r*2+ +!a);return n?s.px-i[e].w/2:s.py-i[e].h/2};for(let r of e.edges){let e=o[r.e],i=a(P[r.a],P[r.b],e.minlen);t&&(i.labelW=n?e.labelW:e.labelH,i.labelH=n?e.labelH:e.labelW,i.tailDx=d(r.a,r.e,!0),i.headDx=d(r.b,r.e,!1),i.tailFixed=u(r.a,r.e,!0),i.headFixed=u(r.b,r.e,!1)),l.push(i)}let f=new Int32Array(e.ports.length).fill(-1);return e.ports.forEach((t,n)=>{if(t.side===s||t.side===E(s)){let i=c.length,p=r(0,0,t.side===s?3:4);p.key=z?R[t.out?o[t.e].dst:o[t.e].src]:NaN,p.hint=Number.isNaN(t.hint)&&z&&V?V(e,t):t.hint,c.push(p),f[n]=i;let m=t.out?a(P[t.inner],i):a(i,P[t.inner]);t.out?(m.tailDx=d(t.inner,t.e,!0),m.tailFixed=u(t.inner,t.e,!0)):(m.headDx=d(t.inner,t.e,!1),m.headFixed=u(t.inner,t.e,!1)),l.push(m)}else c[P[t.inner]].pin=t.side===0||t.side===3?-1:1}),{lnodes:c,ledges:l,dummies:f}},L=j>1&&j<=c&&o.length<=l,R=new Float64Array(_).fill(NaN),z=!1,B=0,V,H=y.length>1&&L;for(let e of y)e.dir!==m&&(H=!1);if(H){let t=m===`TB`||m===`BT`,n=new Int32Array(_).fill(-1),s=new Int32Array(_).fill(-1),c=[],l=[],u=[];for(let e=0;e<_;e++)i[e].isGroup&&(s[e]=u.length,u.push(-1));for(let e=0;e<_;e++){let a=i[e].parent;i[e].isGroup?u[s[e]]=a>=0?s[a]:-1:(n[e]=c.length,c.push(r(t?i[e].w:i[e].h,t?i[e].h:i[e].w)),l.push(a>=0?s[a]:-1))}let d=[],f=new Int32Array(o.length).fill(-1);o.forEach((e,r)=>{e.src===e.dst||n[e.src]<0||n[e.dst]<0||(f[r]=d.length,d.push(a(n[e.src],n[e.dst],e.minlen,t?e.labelW:e.labelH,t?e.labelH:e.labelW)))});let p=e(c,d,{...g,groups:{of:Int32Array.from(l),parent:Int32Array.from(u)},orderOnly:!0});B=Math.min(p.crossings??0,p.declared??0);let h=new Float64Array(_),v=new Int32Array(_),y=new Int32Array(_).fill(-1);for(let e=0;e<_;e++)if(!(n[e]<0)){R[e]=c[n[e]].x;for(let t=i[e].parent;t>=0;t=i[t].parent)h[t]+=R[e],v[t]++,y[t]=Math.max(y[t],c[n[e]].rank)}for(let e=0;e<_;e++)v[e]>0&&(R[e]=h[e]/v[e]);V=(e,t)=>{let n=f[t.e];if(n<0||e.id<0||!t.out||t.side!==E(T(e.dir)))return NaN;let r=d[n].points,i=R[o[t.e].src],a=0;for(let t=0;t<r.length;t+=2)r[t]===y[e.id]&&(i=r[t+1]),r[t]===y[e.id]+1&&(a=r[t+1]);return i+a*1e-6}}let U=new Map,W=(t,n,r)=>{if(!L)return{lnodes:n,ledges:r,size:e(n,r,g)};let i=[];for(let e of n)i.push(e.w,e.h,e.kind,e.pin,e.hint,e.key,e.span);for(let e of r)i.push(e.tail,e.head,e.minlen,e.labelW,e.labelH,e.tailDx,e.headDx,+e.tailFixed,+e.headFixed);let a=U.get(t.id);a||U.set(t.id,a=[]);for(let e of a){let t=e.given.length===i.length;for(let n=0;t&&n<i.length;n++)t=Object.is(e.given[n],i[n]);if(t)return e}let o={given:i,lnodes:n,ledges:r,size:e(n,r,g)};return a.push(o),o},G={width:0,height:0},K=()=>{for(let e of y){for(let t of e.ports)i[t.inner].isGroup&&F(t.inner,o[t.e],t.out)&&(v.get(t.inner).portOf.get(t.e*2+ +!t.out).side=t.side);if(e.edges.length===0)continue;let r=!1;for(let t of e.edges){let e=o[t.e];(i[t.a].isGroup&&e.src!==t.a||i[t.b].isGroup&&e.dst!==t.b)&&(r=!0)}if(!r)continue;let{lnodes:a,ledges:s}=I(e,!1);t(a,s),n(a,s,1);let c=T(e.dir);e.edges.forEach((e,t)=>{let n=o[e.e],r=!s[t].reversed;i[e.a].isGroup&&n.src!==e.a&&(v.get(e.a).portOf.get(e.e*2).side=r?E(c):c),i[e.b].isGroup&&n.dst!==e.b&&(v.get(e.b).portOf.get(e.e*2+1).side=r?c:E(c))})}for(let e=y.length-1;e>=0;e--){let t=y[e],n=t.id>=0?i[t.id]:void 0,r=t.dir===`TB`||t.dir===`BT`,a=t.dir===`BT`||t.dir===`RL`,s=I(t,!0),{lnodes:c,ledges:l,size:u}=W(t,s.lnodes,s.ledges),d=s.dummies,f=r?u.width:u.height,p=r?u.height:u.width,m=n?n.padX:0,h=n?n.padTop:0,g=Math.max(f+2*m,n?n.minW:0),_=p+h+(n?n.padBottom:0),b=(g-f)/2,x=h,S=(e,t)=>b+(r?e:a?u.height-t:t),C=(e,t)=>x+(r?a?u.height-t:t:e),w=+!r,T=e=>{let t=[];for(let n=0;n<e.length;n+=2)t.push(S(e[n],e[n+1]),C(e[n],e[n+1]),w);return t};t.items.forEach((e,t)=>{i[e].x=S(c[t].x,c[t].y),i[e].y=C(c[t].x,c[t].y)}),t.edges.forEach((e,n)=>{let r=l[n];t.routes.set(e.e,T(r.points));let i=o[e.e];i.labelW>0&&(i.labelX=S(r.labelX,r.labelY),i.labelY=C(r.labelX,r.labelY))});let E=t.edges.length;t.ports.forEach((e,t)=>{let n=i[e.inner];if(d[t]>=0){let t=T(l[E++].points),n=e.out?t.length-3:0,r=t[n],i=t[n+1];e.side===0?i=0:e.side===2?i=_:r=e.side===3?0:g,e.out?t.push(r,i,w):t.unshift(r,i,w),e.px=r,e.py=i,e.route=t;return}let r=n.x,a=n.y;if(n.isGroup&&F(e.inner,o[e.e],e.out)){let t=v.get(e.inner).portOf.get(e.e*2+ +!e.out);r+=t.px-n.w/2,a+=t.py-n.h/2}else e.side===0?a-=n.h/2:e.side===2?a+=n.h/2:e.side===3?r-=n.w/2:r+=n.w/2;let s=r,c=a;e.side===0?c=0:e.side===2?c=_:s=e.side===3?0:g;let u=e.side===0||e.side===2?0:1;e.px=s,e.py=c,e.route=e.out?[r,a,u,s,c,u]:[s,c,u,r,a,u]}),n?(n.w=g,n.h=_):G={width:g,height:_}}for(let e of y){let t=e.x,n=e.y;for(let r of e.items){let e=i[r];if(e.x+=t,e.y+=n,e.isGroup){let t=v.get(r);t.x=e.x-e.w/2,t.y=e.y-e.h/2}}}let e=(e,t,n,r)=>{for(let i=0;i<t.length;i+=3){let a=t[i]+n,o=t[i+1]+r,s=e.length;s>=3&&Math.abs(e[s-3]-a)<.01&&Math.abs(e[s-2]-o)<.01||e.push(a,o,t[i+2])}};for(let t of y)for(let n of t.edges){let r=o[n.e],a=[],s=[];for(let e=r.src;i[e].parent!==t.id;e=i[e].parent)s.push(v.get(i[e].parent));for(let t of s)e(a,t.portOf.get(n.e*2).route,t.x,t.y);e(a,t.routes.get(n.e),t.x,t.y);let c=[];for(let e=r.dst;i[e].parent!==t.id;e=i[e].parent)c.push(v.get(i[e].parent));for(let t=c.length-1;t>=0;t--)e(a,c[t].portOf.get(n.e*2+1).route,c[t].x,c[t].y);r.route=a,r.labelW>0&&(r.labelX+=t.x,r.labelY+=t.y)}},q=x(g);z=H,K();let J=-1;if(H&&(J=S(i,o,q),J>B*u+d)){let e=f(i,o,y,G);z=!1,K();let t=S(i,o,q);t>=J?(z=!0,G=p(e,i,o,y)):J=t}if(z===H&&L){let e=!1;for(let t of y){if(t.id<0)continue;let n=i[t.id],r=t.dir===`TB`||t.dir===`BT`,a=E(T(t.dir)),s=[];for(let e of t.ports){if(e.side!==a)continue;let i=o[e.e].route,c=t.x+e.px,l=t.y+e.py,u=-1;for(let t=0;t<i.length&&(u<0||e.out);t+=3)Math.abs(i[t]-c)<.01&&Math.abs(i[t+1]-l)<.01&&(u=t);if(u<0)continue;let d=+!r,f=e.out?u+3:u-3;for(;f>=0&&f<i.length&&Math.abs(i[f+d]-i[u+d])<h;)f+=e.out?3:-3;f<0||f>=i.length||(e.hint=i[f+d]-(r?n.x-n.w/2:n.y-n.h/2),s.push([r?e.px:e.py,e.hint]))}s.sort((e,t)=>e[0]-t[0]);for(let t=1;t<s.length;t++)s[t-1][1]>s[t][1]&&(e=!0)}if(e){let e=J>=0?J:S(i,o,q),t=e>0?f(i,o,y,G):void 0;t&&(K(),S(i,o,q)>=e&&(G=p(t,i,o,y)))}}for(let e of N){let t=o[e],n=i[t.src],r=i[t.dst];t.route=[n.x,n.y,0,r.x,r.y,0],t.labelX=(n.x+r.x)/2,t.labelY=(n.y+r.y)/2}for(let e of M){let t=o[e],n=i[t.src];t.labelX=n.x+n.w/2+28+t.labelW/2,t.labelY=n.y}return G}export{D as i,C as n,o as r,w as t};
|
|
1
|
+
import{c as e,f as t,n,o as r,r as i,t as a}from"./BXBhaEho.js";function o(e){return e===`BT`||e===`LR`||e===`RL`?e:`TB`}var s=4e4,c=400,l=500,u=1.5,d=4;function f(e,t,n,r){let i=[];for(let t of e)i.push(t.x,t.y,t.w,t.h);let a=[];for(let e of t)a.push(e.labelX,e.labelY);let o=[];for(let e of n){o.push(e.x,e.y);for(let t of e.ports)o.push(t.px,t.py)}return{nodes:i,routes:t.map(e=>e.route),labels:a,levels:o,total:r}}function p(e,t,n,r){t.forEach((t,n)=>{t.x=e.nodes[4*n],t.y=e.nodes[4*n+1],t.w=e.nodes[4*n+2],t.h=e.nodes[4*n+3]}),n.forEach((t,n)=>{t.route=e.routes[n],t.labelX=e.labels[2*n],t.labelY=e.labels[2*n+1]});let i=0;for(let t of r){t.x=e.levels[i++],t.y=e.levels[i++];for(let n of t.ports)n.px=e.levels[i++],n.py=e.levels[i++]}return e.total}var m=24,h=.5,g=3,_=2,v=Math.max(3,g,_+1),y=.62,b=128;function x(e){return e.tracks?1:e.straight?2:0}function S(e,t,n=0){let r=0;for(let e of t)e.src!==e.dst&&e.route.length>3&&(r+=(e.route.length/3-1)*v);let a=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(r),c=new Float64Array(r),l=new Float64Array(r),u=new Float64Array(r),d=new Int32Array(r),f=new Uint8Array(r),p=0,x=1/0,S=-1/0,C=NaN,w=NaN,T=NaN,E=NaN,D=(e,t,n,r,i,m)=>{let h=p-1;n===T&&r===E&&(m===r&&w===r||i===n&&C===n)&&d[h]===e&&f[h]===t&&(n-C)*(i-n)+(r-w)*(m-r)>0&&(p--,n=C,r=w),C=n,w=r,T=i,E=m,f[p]=t,a[p]=Math.min(n,i),s[p]=Math.max(n,i),o[p]=n<=i?r:m,c[p]=n<=i?m:r,l[p]=Math.min(r,m),u[p]=Math.max(r,m),l[p]<x&&(x=l[p]),u[p]>S&&(S=u[p]),d[p++]=e};for(let e=0;e<t.length;e++){let r=t[e];if(r.src===r.dst)continue;let a=r.route,o=e=>Math.abs(a[e]-a[e-3])<.01||Math.abs(a[e+1]-a[e-2])<.01,s=e=>Math.abs(a[e]-a[e-3])+Math.abs(a[e+1]-a[e-2]),c=e=>n===0&&e>0&&e<a.length-3&&o(e)&&o(e+3)&&s(e)>=.01&&s(e+3)>=.01&&Math.abs(a[e]-a[e-3])<.01!=Math.abs(a[e+3]-a[e])<.01,l=a[0],u=a[1];for(let t=3;t<a.length;t+=3){let r=+(t===3)|(t===a.length-3?2:0),d=l,f=u,p=a[t],m=a[t+1];if(l=p,u=m,o(t)||n===2){if(!c(t)){D(e,r,d,f,p,m);continue}let n=c(t-3)?s(t)/2:s(t),i=c(t+3)?s(t+3)/2:s(t+3),o=(p-a[t-3])/s(t),h=(m-a[t-2])/s(t),g=(a[t+3]-p)/s(t+3),v=(a[t+4]-m)/s(t+3),b=p-o*n,x=m-h*n;D(e,r,d,f,b,x);let S=p-o*n*(1-y),C=m-h*n*(1-y),w=p+g*i*(1-y),T=m+v*i*(1-y);l=p+g*i,u=m+v*i;let E=r|(t+3===a.length-3?2:0),O=b,k=x;for(let t=1;t<=_;t++){let n=t/_,r=1-n,i=r*r*r*b+3*r*r*n*S+3*r*n*n*w+n*n*n*l,a=r*r*r*x+3*r*r*n*C+3*r*n*n*T+n*n*n*u;D(e,E,O,k,i,a),O=i,k=a}continue}if(n===1){let n=a[t+2]===0,i=n?d:(d+p)/2,o=n?(f+m)/2:f;D(e,r,d,f,i,o),D(e,r,i,o,n?p:i,n?o:m),D(e,r,n?p:i,n?o:m,p,m);continue}let h=a[t+2]===0,v=h?i(p-d,m-f):i(m-f,p-d),b=d,x=f;for(let t=1;t<=g;t++){let n=t/g,i=1-n,a=n*n*(3-2*n),o=3*v*n*i*i+3*(1-v)*n*n*i+n*n*n,s=d+(p-d)*(h?a:o),c=f+(m-f)*(h?o:a);D(e,r,b,x,s,c),b=s,x=c}}}let O=S>x?Math.round(Math.sqrt(p)):1,k=S>x?O/(S-x):0,A=e=>Math.min(O-1,Math.floor((e-x)*k)),j=new Int32Array(p),M=new Int32Array(O+1);for(let e=0;e<p;e++){j[e]=A(l[e]);for(let t=j[e],n=A(u[e]);t<=n;t++)M[t+1]++}for(let e=0;e<O;e++)M[e+1]+=M[e];let N=M.slice(0,O),P=new Int32Array(M[O]);for(let e=0;e<p;e++)for(let t=j[e],n=A(u[e]);t<=n;t++)P[N[t]++]=e;let F=new Float64Array(t.length*8),I=(e,t,n,r)=>Math.abs(e[t]-e[n])<h&&Math.abs(e[t]-e[r])<h||Math.abs(e[t+1]-e[n+1])<h&&Math.abs(e[t+1]-e[r+1])<h;for(let e=0;e<t.length;e++){let n=t[e].route;if(n.length<6)continue;let r=3;for(;r+3<n.length&&I(n,0,r,r+3);)r+=3;let i=n.length-3,a=i-3;for(;a>=3&&I(n,i,a,a-3);)a-=3;F.set([n[0],n[1],n[r],n[r+1],n[a],n[a+1],n[i],n[i+1]],e*8)}let L=(e,t,n,r)=>{let i=e*8+(t===1?0:4),a=F[i],o=F[i+1],s=F[i+2]-a,c=F[i+3]-o,l=s*s+c*c,u=l>0?Math.max(0,Math.min(1,((n-a)*s+(r-o)*c)/l)):0;return Math.hypot(n-a-u*s,r-o-u*c)<h},R=0;for(let n=0;n<O;n++){let r=M[n+1];if(r-M[n]>b)P.subarray(M[n],r).sort((e,t)=>a[e]-a[t]||e-t);else for(let e=M[n]+1;e<r;e++){let t=P[e],r=e;for(;r>M[n]&&a[P[r-1]]>a[t];r--)P[r]=P[r-1];P[r]=t}for(let i=M[n];i<r;i++){let p=P[i],h=s[p]-a[p],g=c[p]-o[p],_=j[p]===n;for(let v=i+1;v<r;v++){let r=P[v];if(a[r]>s[p])break;if(u[r]<l[p]||l[r]>u[p]||d[p]===d[r]||!_&&j[r]!==n)continue;let i=h*(o[r]-o[p])-g*(a[r]-a[p]),y=h*(c[r]-o[p])-g*(s[r]-a[p]);if(i>0==y>0)continue;let b=s[r]-a[r],x=c[r]-o[r],S=b*(o[p]-o[r])-x*(a[p]-a[r]),C=b*(c[p]-o[r])-x*(s[p]-a[r]);if(S>0==C>0)continue;let w=t[d[p]],T=t[d[r]],E=S/(S-C),D=a[p]+E*h,O=o[p]+E*g,k=(t,n,i)=>(f[p]&n)!==0&&(f[r]&i)!==0||Math.abs(D-e[t].x)<e[t].w/2+m&&Math.abs(O-e[t].y)<e[t].h/2+m||L(d[p],n,D,O)&&L(d[r],i,D,O);w.src===T.src&&k(w.src,1,1)||w.src===T.dst&&k(w.src,1,2)||w.dst===T.src&&k(w.dst,2,1)||w.dst===T.dst&&k(w.dst,2,2)||R++}}}return R}function C(e,t,n,r){for(let t of e)t.x+=n,t.y+=r;for(let e of t){for(let t=0;t<e.route.length;t+=3)e.route[t]+=n,e.route[t+1]+=r;e.labelX+=n,e.labelY+=r}}function w(e,t,n=-1){return{w:e,h:t,parent:n,isGroup:!1,dir:void 0,padX:0,padTop:0,padBottom:0,minW:0,seq:0,span:0,x:0,y:0}}function T(e){return e===`TB`?0:e===`BT`?2:e===`LR`?3:1}function E(e){return e+2&3}function D(i,o,m,g){let _=i.length,v=new Map,y=[],b=(e,t)=>{let n={id:e,dir:t,items:[],edges:[],ports:[],portOf:new Map,routes:new Map,x:0,y:0};return v.set(e,n),n},C=b(-1,m),w=[];for(let e=0;e<_;e++)w.push([]);let D=[];for(let e=0;e<_;e++){let t=i[e].parent;t>=0&&t<_&&t!==e&&i[t].isGroup?w[t].push(e):(i[e].parent=-1,D.push(e))}C.items=D,y.push(C);let O=new Int32Array(_),k=new Uint8Array(_),A=e=>{for(let t=e;t<y.length;t++){let e=y[t];for(let t of e.items)if(k[t]=1,O[t]=e.id<0?0:O[e.id]+1,i[t].isGroup){let n=b(t,i[t].dir??e.dir);n.items=w[t],y.push(n)}}};A(0);for(let e=0;e<_;e++){if(k[e])continue;let t=i[e].parent;if(w[t]=w[t].filter(t=>t!==e),i[e].parent=-1,C.items.push(e),k[e]=1,O[e]=0,i[e].isGroup){let t=y.length,n=b(e,i[e].dir??m);n.items=w[e],y.push(n),A(t)}}for(let e=y.length-1;e>0;e--){let t=y[e],n=1/0;for(let e of t.items)i[e].seq<n&&(n=i[e].seq);n!==1/0&&(i[t.id].seq=n)}for(let e of y)e.items.sort((e,t)=>i[e].seq-i[t].seq||e-t);let j=0;for(let e of o){let t=e.src,n=e.dst,r=0;for(;O[t]>O[n];r++)t=i[t].parent;for(;O[n]>O[t];r++)n=i[n].parent;for(;t!==n&&i[t].parent!==i[n].parent;r+=2)t=i[t].parent,n=i[n].parent;t!==n&&(j+r>s?(e.src=t,e.dst=n):j+=r)}let M=[],N=[];for(let e=0;e<o.length;e++){let t=o[e];if(t.route=[],t.src===t.dst){M.push(e);continue}let n=t.src,r=t.dst,a=[],s=[];for(;O[n]>O[r];)a.push(n),n=i[n].parent;for(;O[r]>O[n];)s.push(r),r=i[r].parent;if(n===r)N.push(e);else{for(;i[n].parent!==i[r].parent;)a.push(n),s.push(r),n=i[n].parent,r=i[r].parent;v.get(i[n].parent).edges.push({e,a:n,b:r});for(let[t,n]of[[a,!0],[s,!1]])for(let r of t){let t=v.get(i[r].parent),a={e,inner:r,out:n,side:0,hint:NaN,px:0,py:0,route:[]};t.ports.push(a),t.portOf.set(e*2+ +!n,a)}}}let P=new Int32Array(_),F=(e,t,n)=>(n?t.src:t.dst)!==e,I=(e,t)=>{let n=e.dir===`TB`||e.dir===`BT`,s=T(e.dir),c=[],l=[];e.items.forEach((e,a)=>{P[e]=a;let o=i[e],s=t?r(n?o.w:o.h,n?o.h:o.w):r(0,0);s.span=o.isGroup?Math.min(o.span,s.w-2*o.padX):o.span,s.key=z?R[e]:NaN,c.push(s)});let u=(e,t,n)=>i[e].isGroup&&F(e,o[t],n),d=(e,r,a)=>{if(!t||!i[e].isGroup||!F(e,o[r],a))return 0;let s=v.get(e).portOf.get(r*2+ +!a);return n?s.px-i[e].w/2:s.py-i[e].h/2};for(let r of e.edges){let e=o[r.e],i=a(P[r.a],P[r.b],e.minlen);t&&(i.labelW=n?e.labelW:e.labelH,i.labelH=n?e.labelH:e.labelW,i.tailDx=d(r.a,r.e,!0),i.headDx=d(r.b,r.e,!1),i.tailFixed=u(r.a,r.e,!0),i.headFixed=u(r.b,r.e,!1)),l.push(i)}let f=new Int32Array(e.ports.length).fill(-1);return e.ports.forEach((t,n)=>{if(t.side===s||t.side===E(s)){let i=c.length,p=r(0,0,t.side===s?3:4);p.key=z?R[t.out?o[t.e].dst:o[t.e].src]:NaN,p.hint=Number.isNaN(t.hint)&&z&&V?V(e,t):t.hint,c.push(p),f[n]=i;let m=t.out?a(P[t.inner],i):a(i,P[t.inner]);t.out?(m.tailDx=d(t.inner,t.e,!0),m.tailFixed=u(t.inner,t.e,!0)):(m.headDx=d(t.inner,t.e,!1),m.headFixed=u(t.inner,t.e,!1)),l.push(m)}else c[P[t.inner]].pin=t.side===0||t.side===3?-1:1}),{lnodes:c,ledges:l,dummies:f}},L=j>1&&j<=c&&o.length<=l,R=new Float64Array(_).fill(NaN),z=!1,B=0,V,H=y.length>1&&L;for(let e of y)e.dir!==m&&(H=!1);if(H){let t=m===`TB`||m===`BT`,n=new Int32Array(_).fill(-1),s=new Int32Array(_).fill(-1),c=[],l=[],u=[];for(let e=0;e<_;e++)i[e].isGroup&&(s[e]=u.length,u.push(-1));for(let e=0;e<_;e++){let a=i[e].parent;i[e].isGroup?u[s[e]]=a>=0?s[a]:-1:(n[e]=c.length,c.push(r(t?i[e].w:i[e].h,t?i[e].h:i[e].w)),l.push(a>=0?s[a]:-1))}let d=[],f=new Int32Array(o.length).fill(-1);o.forEach((e,r)=>{e.src===e.dst||n[e.src]<0||n[e.dst]<0||(f[r]=d.length,d.push(a(n[e.src],n[e.dst],e.minlen,t?e.labelW:e.labelH,t?e.labelH:e.labelW)))});let p=e(c,d,{...g,groups:{of:Int32Array.from(l),parent:Int32Array.from(u)},orderOnly:!0});B=Math.min(p.crossings??0,p.declared??0);let h=new Float64Array(_),v=new Int32Array(_),y=new Int32Array(_).fill(-1);for(let e=0;e<_;e++)if(!(n[e]<0)){R[e]=c[n[e]].x;for(let t=i[e].parent;t>=0;t=i[t].parent)h[t]+=R[e],v[t]++,y[t]=Math.max(y[t],c[n[e]].rank)}for(let e=0;e<_;e++)v[e]>0&&(R[e]=h[e]/v[e]);V=(e,t)=>{let n=f[t.e];if(n<0||e.id<0||!t.out||t.side!==E(T(e.dir)))return NaN;let r=d[n].points,i=R[o[t.e].src],a=0;for(let t=0;t<r.length;t+=2)r[t]===y[e.id]&&(i=r[t+1]),r[t]===y[e.id]+1&&(a=r[t+1]);return i+a*1e-6}}let U=new Map,W=(t,n,r)=>{if(!L)return{lnodes:n,ledges:r,size:e(n,r,g)};let i=[];for(let e of n)i.push(e.w,e.h,e.kind,e.pin,e.hint,e.key,e.span);for(let e of r)i.push(e.tail,e.head,e.minlen,e.labelW,e.labelH,e.tailDx,e.headDx,+e.tailFixed,+e.headFixed);let a=U.get(t.id);a||U.set(t.id,a=[]);for(let e of a){let t=e.given.length===i.length;for(let n=0;t&&n<i.length;n++)t=Object.is(e.given[n],i[n]);if(t)return e}let o={given:i,lnodes:n,ledges:r,size:e(n,r,g)};return a.push(o),o},G={width:0,height:0},K=()=>{for(let e of y){for(let t of e.ports)i[t.inner].isGroup&&F(t.inner,o[t.e],t.out)&&(v.get(t.inner).portOf.get(t.e*2+ +!t.out).side=t.side);if(e.edges.length===0)continue;let r=!1;for(let t of e.edges){let e=o[t.e];(i[t.a].isGroup&&e.src!==t.a||i[t.b].isGroup&&e.dst!==t.b)&&(r=!0)}if(!r)continue;let{lnodes:a,ledges:s}=I(e,!1);t(a,s),n(a,s,1);let c=T(e.dir);e.edges.forEach((e,t)=>{let n=o[e.e],r=!s[t].reversed;i[e.a].isGroup&&n.src!==e.a&&(v.get(e.a).portOf.get(e.e*2).side=r?E(c):c),i[e.b].isGroup&&n.dst!==e.b&&(v.get(e.b).portOf.get(e.e*2+1).side=r?c:E(c))})}for(let e=y.length-1;e>=0;e--){let t=y[e],n=t.id>=0?i[t.id]:void 0,r=t.dir===`TB`||t.dir===`BT`,a=t.dir===`BT`||t.dir===`RL`,s=I(t,!0),{lnodes:c,ledges:l,size:u}=W(t,s.lnodes,s.ledges),d=s.dummies,f=r?u.width:u.height,p=r?u.height:u.width,m=n?n.padX:0,h=n?n.padTop:0,g=Math.max(f+2*m,n?n.minW:0),_=p+h+(n?n.padBottom:0),b=(g-f)/2,x=h,S=(e,t)=>b+(r?e:a?u.height-t:t),C=(e,t)=>x+(r?a?u.height-t:t:e),w=+!r,T=e=>{let t=[];for(let n=0;n<e.length;n+=2)t.push(S(e[n],e[n+1]),C(e[n],e[n+1]),w);return t};t.items.forEach((e,t)=>{i[e].x=S(c[t].x,c[t].y),i[e].y=C(c[t].x,c[t].y)}),t.edges.forEach((e,n)=>{let r=l[n];t.routes.set(e.e,T(r.points));let i=o[e.e];i.labelW>0&&(i.labelX=S(r.labelX,r.labelY),i.labelY=C(r.labelX,r.labelY))});let E=t.edges.length;t.ports.forEach((e,t)=>{let n=i[e.inner];if(d[t]>=0){let t=T(l[E++].points),n=e.out?t.length-3:0,r=t[n],i=t[n+1];e.side===0?i=0:e.side===2?i=_:r=e.side===3?0:g,e.out?t.push(r,i,w):t.unshift(r,i,w),e.px=r,e.py=i,e.route=t;return}let r=n.x,a=n.y;if(n.isGroup&&F(e.inner,o[e.e],e.out)){let t=v.get(e.inner).portOf.get(e.e*2+ +!e.out);r+=t.px-n.w/2,a+=t.py-n.h/2}else e.side===0?a-=n.h/2:e.side===2?a+=n.h/2:e.side===3?r-=n.w/2:r+=n.w/2;let s=r,c=a;e.side===0?c=0:e.side===2?c=_:s=e.side===3?0:g;let u=e.side===0||e.side===2?0:1;e.px=s,e.py=c,e.route=e.out?[r,a,u,s,c,u]:[s,c,u,r,a,u]}),n?(n.w=g,n.h=_):G={width:g,height:_}}for(let e of y){let t=e.x,n=e.y;for(let r of e.items){let e=i[r];if(e.x+=t,e.y+=n,e.isGroup){let t=v.get(r);t.x=e.x-e.w/2,t.y=e.y-e.h/2}}}let e=(e,t,n,r)=>{for(let i=0;i<t.length;i+=3){let a=t[i]+n,o=t[i+1]+r,s=e.length;s>=3&&Math.abs(e[s-3]-a)<.01&&Math.abs(e[s-2]-o)<.01||e.push(a,o,t[i+2])}};for(let t of y)for(let n of t.edges){let r=o[n.e],a=[],s=[];for(let e=r.src;i[e].parent!==t.id;e=i[e].parent)s.push(v.get(i[e].parent));for(let t of s)e(a,t.portOf.get(n.e*2).route,t.x,t.y);e(a,t.routes.get(n.e),t.x,t.y);let c=[];for(let e=r.dst;i[e].parent!==t.id;e=i[e].parent)c.push(v.get(i[e].parent));for(let t=c.length-1;t>=0;t--)e(a,c[t].portOf.get(n.e*2+1).route,c[t].x,c[t].y);r.route=a,r.labelW>0&&(r.labelX+=t.x,r.labelY+=t.y)}},q=x(g);z=H,K();let J=-1;if(H&&(J=S(i,o,q),J>B*u+d)){let e=f(i,o,y,G);z=!1,K();let t=S(i,o,q);t>=J?(z=!0,G=p(e,i,o,y)):J=t}if(z===H&&L){let e=!1;for(let t of y){if(t.id<0)continue;let n=i[t.id],r=t.dir===`TB`||t.dir===`BT`,a=E(T(t.dir)),s=[];for(let e of t.ports){if(e.side!==a)continue;let i=o[e.e].route,c=t.x+e.px,l=t.y+e.py,u=-1;for(let t=0;t<i.length&&(u<0||e.out);t+=3)Math.abs(i[t]-c)<.01&&Math.abs(i[t+1]-l)<.01&&(u=t);if(u<0)continue;let d=+!r,f=e.out?u+3:u-3;for(;f>=0&&f<i.length&&Math.abs(i[f+d]-i[u+d])<h;)f+=e.out?3:-3;f<0||f>=i.length||(e.hint=i[f+d]-(r?n.x-n.w/2:n.y-n.h/2),s.push([r?e.px:e.py,e.hint]))}s.sort((e,t)=>e[0]-t[0]);for(let t=1;t<s.length;t++)s[t-1][1]>s[t][1]&&(e=!0)}if(e){let e=J>=0?J:S(i,o,q),t=e>0?f(i,o,y,G):void 0;t&&(K(),S(i,o,q)>=e&&(G=p(t,i,o,y)))}}for(let e of N){let t=o[e],n=i[t.src],r=i[t.dst];t.route=[n.x,n.y,0,r.x,r.y,0],t.labelX=(n.x+r.x)/2,t.labelY=(n.y+r.y)/2}for(let e of M){let t=o[e],n=i[t.src];t.labelX=n.x+n.w/2+28+t.labelW/2,t.labelY=n.y}return G}export{D as i,C as n,o as r,w as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as e,f as t,i as n,o as r,u as i,x as a}from"./
|
|
1
|
+
import{_ as e,f as t,i as n,o as r,u as i,x as a}from"./C2npZzkn.js";import{n as o}from"./CtkUy_15.js";import{t as s}from"./DciMwFJ1.js";import{a as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as x,t as S,u as C}from"./CTDYUZPz.js";import{PeleError as ee,u as te}from"./CMikI1NP.js";var w={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4};function T(e){throw new ee(e,`semantic`,{type:`gitGraph`})}function E(e){return e===`REVERSE`?w.REVERSE:e===`HIGHLIGHT`?w.HIGHLIGHT:w.NORMAL}function D(e,t){e.dir&&t.setDirection(e.dir);for(let n of e.statements)O(n,t)}function O(e,t){switch(e.$type){case`Commit`:t.commit({id:e.id,msg:e.message??``,type:e.type===void 0?w.NORMAL:E(e.type),tags:e.tags??void 0});break;case`Branch`:t.branch({name:e.name,order:e.order??0});break;case`Merge`:t.merge({branch:e.branch,id:e.id??``,type:e.type===void 0?void 0:E(e.type),tags:e.tags??void 0});break;case`Checkout`:t.checkout(e.branch);break;case`CherryPicking`:t.cherryPick({id:e.id,targetId:``,tags:e.tags?.length===0?void 0:e.tags,parent:e.parent})}}function k(e,t,n){let r=t.gitGraph,i=typeof r?.mainBranchName==`string`?r.mainBranchName:`main`,a=typeof r?.mainBranchOrder==`number`?r.mainBranchOrder:0,o=new Map,s=new Map([[i,null]]),c=new Map([[i,a]]),l=[],u=null,d=i,f=`LR`,p=0,m=()=>{for(let e=p+1;;e+=2654435761){let t=`${p}-${(Math.imul(e,2654435761)>>>0).toString(16).padStart(8,`0`).slice(0,7)}`;if(!o.has(t))return t}},h=e=>{u=e,o.set(e.id,e),s.set(d,e.id)},g=e=>{s.has(e)||T(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`),d=e;let t=s.get(e);u=t?o.get(t)??null:null};D(e,{setDirection(e){f=e},commit({msg:e,id:t,type:n,tags:r}){let i={id:t||m(),message:e,seq:p++,type:n??w.NORMAL,tags:r?[...r]:[],parents:u===null?[]:[u.id],branch:d};o.has(i.id)&&l.push(`Commit ID ${i.id} already exists`),h(i)},branch({name:e,order:t}){s.has(e)&&T(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${e}")`),s.set(e,u===null?null:u.id),c.set(e,t),g(e)},merge({branch:e,id:t,type:n,tags:r}){let i=s.get(d),a=s.get(e),c=i?o.get(i):void 0,l=a?o.get(a):void 0;c&&l&&c.branch===e&&T(`Cannot merge branch '${e}' into itself.`),d===e&&T(`Incorrect usage of "merge". Cannot merge a branch to itself`),c===void 0&&T(`Incorrect usage of "merge". Current branch (${d})has no commits`),s.has(e)||T(`Incorrect usage of "merge". Branch to be merged (${e}) does not exist`),l===void 0&&T(`Incorrect usage of "merge". Branch to be merged (${e}) has no commits`),c===l&&T(`Incorrect usage of "merge". Both branches have same head`),t&&o.has(t)&&T(`Incorrect usage of "merge". Commit with id:${t} already exists, use different custom id`),h({id:t||m(),message:`merged branch ${e} into ${d}`,seq:p++,parents:u===null?[]:[u.id,a||``],branch:d,type:w.MERGE,customType:n,customId:!!t,tags:r?[...r]:[]})},cherryPick({id:e,targetId:t,tags:n,parent:r}){let i=e?o.get(e):void 0;if(i===void 0&&T(`Incorrect usage of "cherryPick". Source commit id should exist and provided`),r&&!i.parents.includes(r)&&T(`Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.`),i.type===w.MERGE&&!r&&T(`Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.`),t&&o.has(t))return;i.branch===d&&T(`Incorrect usage of "cherryPick". Source commit is already on current branch`);let a=s.get(d);(!a||!o.has(a))&&T(`Incorrect usage of "cherry-pick". Current branch (${d})has no commits`),h({id:m(),message:`cherry-picked ${i.message} into ${d}`,seq:p++,parents:u===null?[]:[u.id,i.id],branch:d,type:w.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${i.id}${i.type===w.MERGE?`|parent:${r}`:``}`]})},checkout:g});let _=[...c].map(([e,t],n)=>({name:e,order:t??parseFloat(`0.${n}`)})).sort((e,t)=>e.order-t.order).map(e=>e.name);return{type:`gitGraph`,title:e.title||n,accTitle:e.accTitle?e.accTitle.replace(/^\s+/g,``):void 0,accDescr:e.accDescr?e.accDescr.replace(/\n\s+/g,`
|
|
2
2
|
`):void 0,direction:f,commits:o,branches:s,lanes:_,currentBranch:d,head:u,warnings:l}}var A={name:`REFERENCE`,pattern:/\w([-\./\w]*[-\w])?/y},j=[A];function M(e){return{name:e,pattern:e,longer:j}}var N=[M(`cherry-pick`),{name:`gitGraph:`,pattern:`gitGraph:`},M(`HIGHLIGHT`),{...m(`gitGraph`),longer:j},M(`checkout`),M(`REVERSE`),{name:`parent:`,pattern:`parent:`},M(`commit`),M(`NORMAL`),M(`branch`),{name:`order:`,pattern:`order:`},M(`switch`),{name:`type:`,pattern:`type:`},M(`merge`),{name:`msg:`,pattern:`msg:`},{name:`tag:`,pattern:`tag:`},{name:`id:`,pattern:`id:`},M(`LR`),M(`TB`),M(`BT`),{name:`:`,pattern:`:`},{...c,opener:/[\t ]*accDescr\s*{/y},S,y,{name:`INT`,pattern:/0|[1-9][0-9]*(?!\.)/y},g,h,C,b,v,x,A];function P(e){let t=new p(_(e,N,`gitGraph`),N,`gitGraph`),n={$type:`GitGraph`,statements:[]},r=()=>{if(t.kind!==-1)for(t.kind!==26&&t.fail(`a line break or the end of input`);t.kind===26;)t.i++},i=()=>t.kind===31?t.take():t.kind===25?d(t.take()):t.fail(`a branch name`),a=()=>d(t.expect(25)),o=()=>(t.kind!==8&&t.kind!==5&&t.kind!==2&&t.fail(`NORMAL, REVERSE, or HIGHLIGHT`),t.take());for(;t.kind===26;)t.i++;if(!t.accept(1)){t.expect(3);let e=t.kinds[t.i+1];(t.kind===17||t.kind===18||t.kind===19)&&e===20?(n.$type=`Direction`,n.dir=t.take(),t.i++):t.accept(20)}for(;t.kind!==-1;)switch(t.kind){case 26:t.i++;break;case 21:n.accDescr=l(t.take()),r();break;case 22:n.accTitle=f(t.take()),r();break;case 23:n.title=u(t.take()),r();break;case 7:{t.i++;let e={$type:`Commit`,tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(12))e.type=o();else if(t.accept(14)||t.kinds[t.i]===25)e.message=a();else break;r(),n.statements.push(e);break}case 9:{t.i++;let e={$type:`Branch`,name:i()};t.accept(10)&&(e.order=parseInt(t.expect(24))),r(),n.statements.push(e);break}case 13:{t.i++;let e={$type:`Merge`,branch:i(),tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(12))e.type=o();else break;r(),n.statements.push(e);break}case 4:case 11:{t.i++;let e={$type:`Checkout`,branch:i()};r(),n.statements.push(e);break}case 0:{t.i++;let e={$type:`CherryPicking`,tags:[]};for(;;)if(t.accept(16))e.id=a();else if(t.accept(15))e.tags.push(a());else if(t.accept(6))e.parent=a();else break;r(),n.statements.push(e);break}default:t.fail(`a statement, a title, or a line break`)}return n}var F=7,ne=44,re=44,I=36,L=8,R=20,z=20,B=7,ie=6,V=Math.SQRT1_2,ae=[`normal`,`reverse`,`highlight`,`merge`,`cherry-pick`];function H(e,t,n){let r=e.gitGraph?.[t];return typeof r==`boolean`?r:n}function oe(e){return B+4+e.width+6}function se(e,t,n,r){let i=`cx="${a(t)}" cy="${a(n)}"`;if(e===w.HIGHLIGHT)return`<rect x="${a(t-F-1)}" y="${a(n-F-1)}" width="${2*F+2}" height="${2*F+2}" rx="2" fill="${r}"/>`;if(e===w.MERGE)return`<circle ${i} r="${F-1}" fill="var(--_bg)" stroke="${r}" stroke-width="2"/><circle ${i} r="2.5" fill="${r}"/>`;let o=`<circle ${i} r="${F}" fill="${r}"/>`;return e===w.REVERSE?o+`<path d="M${a(t-3)},${a(n-3)}l6,6M${a(t-3)},${a(n+3)}l6,-6" fill="none" stroke="var(--_bg)" stroke-width="1.5" stroke-linecap="round"/>`:e===w.CHERRY_PICK?o+`<path d="M${a(t-2.6)},${a(n+1)}L${a(t+.8)},${a(n-4.2)}L${a(t+2.6)},${a(n+1)}" fill="none" stroke="var(--_bg)" stroke-linejoin="round"/><circle cx="${a(t-2.6)}" cy="${a(n+2.2)}" r="1.8" fill="var(--_bg)"/><circle cx="${a(t+2.6)}" cy="${a(n+2.2)}" r="1.8" fill="var(--_bg)"/>`:o}function U(e,t,n){return e.direction===`LR`?s(n,r=>W(e,t,n,r?`TB`:`LR`)):W(e,t,n,e.direction)}function W(s,c,l,u){let d=l.fontSize??16,f=Math.round(d*.75),p=l.measurer??te(l.fontFamily,l.fontFamilyMono),m=l.padding??8,h=H(c,`showBranches`,!0),g=H(c,`showCommitLabel`,!0),_=H(c,`rotateCommitLabel`,!0),v=H(c,`parallelCommits`,!1),y=u!==`LR`,b=u===`BT`,x=new Map;s.lanes.forEach((e,t)=>x.set(e,t));let S=s.lanes.length,C=Math.round(d*.875),ee=s.lanes.map(e=>o(h?e:``,p,C,4e3)),T=[],E=new Map;for(let e of[...s.commits.values()].sort((e,t)=>e.seq-t.seq)){let t=g&&e.type!==w.CHERRY_PICK&&(e.type!==w.MERGE||e.customId===!0),n=[];for(let t of e.tags){let e=o(t,p,f,4e3);e.lines.length>0&&n.push(e)}let r={commit:e,index:T.length,lane:x.get(e.branch)??0,m:0,label:t?o(e.id,p,f,4e3):void 0,tags:n};T.push(r),E.set(e.id,r)}let D=new Float64Array(T.length),O=new Float64Array(T.length),k=new Float64Array(S).fill(F),A=new Float64Array(S).fill(F);T.forEach((e,t)=>{let{label:n,tags:r}=e,i=0,a=0;for(let e of r){let t=oe(e);y?(i=Math.max(i,e.height),a+=t+4):(i=Math.max(i,t),a+=e.height+3)}let o=0,s=0;n!==void 0&&n.lines.length>0&&(_?s=3+V*(n.width+n.height):(o=y?n.height:n.width,s=6+(y?n.width:n.height))),D[t]=Math.max(F,i/2,o/2),O[t]=i/2;let c=F+(r.length>0?ie+a:0),l=F+s,u=e.lane;k[u]=Math.max(k[u],y?l:c),A[u]=Math.max(A[u],y?c:l)});let j=new Float64Array(T.length);y||T.forEach((e,t)=>{if(O[t]!==0)for(let n of e.commit.parents){let r=E.get(n);r!==void 0&&r.lane<e.lane&&(j[t]=O[t]+4)}});let M=(e,t)=>Math.max(ne,D[e]+D[t]+L,j[t]>0?D[e]+I+j[t]:0);T.forEach((e,t)=>{if(!v){e.m=t===0?0:T[t-1].m+M(t-1,t);return}let n=0;for(let r of e.commit.parents){let e=E.get(r);e===void 0||e.index>=t||(n=Math.max(n,e.m+M(e.index,t)))}e.m=n});let N=0;for(let e of T)N=Math.max(N,e.m);let P=new Float64Array(S);for(let e=0;e<S;e++){let t=ee[e],n=t.lines.length===0?0:y?t.width/2+8:t.height/2+2;k[e]=Math.max(k[e],n),A[e]=Math.max(A[e],n),e>0&&(P[e]=P[e-1]+Math.max(re,A[e-1]+k[e]+L))}let U=(e,t)=>y?t:e,W=(e,t)=>y?b?-e:e:t,G=(e,t)=>`${a(U(e,t))},${a(W(e,t))}`,K=1/0,q=1/0,J=-1/0,Y=-1/0,X=(e,t,n,r)=>{e<K&&(K=e),t<q&&(q=t),n>J&&(J=n),r>Y&&(Y=r)},Z=``;if(h)for(let e=0;e<S;e++){let i=ee[e],o=t(e),c=P[e],l=i.width+16,u=i.height+4,d=i.lines.length===0?-R:-R-(y?u:l),f=U(d+(y?u:l)/2,c),p=W(d+(y?u:l)/2,c);X(U(-R,c),W(-R,c),U(-R,c),W(-R,c)),X(U(N+z,c),W(N+z,c),U(N+z,c),W(N+z,c)),Z+=`<g class="pele-branch" data-id="${n(s.lanes[e])}"><path class="pele-lane" d="M${G(-R,c)}L${G(N+z,c)}" stroke="${o}" stroke-dasharray="2 4"/>`,i.lines.length>0&&(X(f-l/2,p-u/2,f+l/2,p+u/2),Z+=`<rect x="${a(f-l/2)}" y="${a(p-u/2)}" width="${a(l)}" height="${a(u)}" fill="${o}" style="rx:var(--_r)"/>`+r(i,f,p,` class="pele-label" fill="var(--_bg)"`)),Z+=`</g>`}let ce=Array.from({length:S},()=>[]);for(let e of T)ce[e.lane].push(e.m);if(v)for(let e of ce)e.sort((e,t)=>e-t);let le=(e,t,n)=>{let r=ce[e],i=0,a=r.length;for(;i<a;){let e=i+a>>1;r[e]<=t?i=e+1:a=e}return i<r.length&&r[i]<n},ue=``,Q=``;for(let e of T){let{commit:n}=e,r=P[e.lane],i=e.m;for(let a=0;a<n.parents.length;a++){let o=E.get(n.parents[a]);if(o===void 0||o===e)continue;let s=P[o.lane],c=o.m;if(o.lane===e.lane){Q+=`<path class="pele-edge" d="M${G(c,s)}L${G(i,r)}" stroke="${t(e.lane)}"/>`;continue}let l=a>0&&n.type===w.MERGE,u=a>0&&!l,d=`M${G(c,s)}`;if(i<=c){let e=(c+i)/2;d+=`C${G(e,s)} ${G(e,r)} ${G(i,r)}`}else if(!l&&!le(e.lane,c,i)){let e=Math.min(I,i-c);d+=`C${G(c+e/2,s)} ${G(c+e/2,r)} ${G(c+e,r)}L${G(i,r)}`}else{let t=o.lane<e.lane&&i-j[e.index]>c?i-j[e.index]:i,n=Math.min(I,t-c),a=s;(!l||le(o.lane,c,i))&&(a=s>r?r+A[e.lane]+L/2:r-k[e.lane]-L/2,n=Math.min(I,(t-c)/2),d+=`C${G(c+n/2,s)} ${G(c+n/2,a)} ${G(c+n,a)}`),d+=`L${G(t-n,a)}C${G(t-n/2,a)} ${G(t-n/2,r)} ${G(t,r)}`,t<i&&(d+=`L${G(i,r)}`)}ue+=`<path class="pele-edge${l?` pele-edge-merge`:u?` pele-edge-cherry-pick`:``}" d="${d}" stroke="${t(l?o.lane:e.lane)}"${u?` stroke-dasharray="4 3"`:``}/>`}}let de=``;for(let e of T){let{commit:i,label:o,tags:s}=e,c=U(e.m,P[e.lane]),l=W(e.m,P[e.lane]),u=i.customType??i.type;X(c-F-1,l-F-1,c+F+1,l+F+1);let d=i.type<w.MERGE&&i.message!==``?`<title>${n(i.message)}</title>`:``;if(d+=se(u,c,l,t(e.lane)),o!==void 0&&o.lines.length>0){let e=o.width,t=o.height,n=(n,r)=>`<rect x="${a(n-e/2-2)}" y="${a(r-t/2+2)}" width="${a(e+4)}" height="${a(t-4)}" rx="3" fill="var(--_bg)"/>`;if(_){let i=V*t/2,s=y?c-F-3-i:c+3,u=y?l:l+F+3+i,f=V*e+i;X(s-f,b?u-f:u-i,s+i,b?u+i:u+f),d+=`<g class="pele-commit-label" transform="rotate(${b?45:-45} ${a(s)} ${a(u)})">`+n(s-e/2,u)+r(o,s-e/2,u,``)+`</g>`}else{let i=y?c-F-6-e/2:c,a=y?l:l+F+6+t/2;X(i-e/2,a-t/2,i+e/2,a+t/2),d+=`<g class="pele-commit-label">${n(i,a)}${r(o,i,a,``)}</g>`}}let f=F+ie;for(let e=y?0:s.length-1;e>=0&&e<s.length;e+=y?1:-1){let t=s[e],n=oe(t),i=t.height,o=y?c+f:c-n/2,u=y?l:l-f-i/2;f+=y?n+4:i+3,X(o,u-i/2,o+n,u+i/2),d+=`<g class="pele-tag"><path d="M${a(o)},${a(u)}L${a(o+B)},${a(u-i/2)}H${a(o+n)}V${a(u+i/2)}H${a(o+B)}Z" fill="var(--_s)" stroke="var(--_b)" stroke-linejoin="round"/><circle cx="${a(o+B)}" cy="${a(u)}" r="1.5" fill="var(--_b)"/>`+r(t,o+B+4+t.width/2,u,` fill="var(--_fg)"`)+`</g>`}let p=i.type===w.MERGE&&u!==w.MERGE?` pele-commit-merge`:``;de+=`<g class="pele-commit pele-commit-${ae[u]??ae[0]}${p}" data-id="${n(i.id)}">${d}</g>`}K>J&&X(0,0,0,0);let $=i(s.title,!1,p,d,4e3,1),fe=$.height>0?$.height+16:0,pe=Math.max(J-K,$.width),me=Math.ceil(pe+2*m),he=Math.ceil(Y-q+fe+2*m),ge=m-K+(pe-(J-K))/2,_e=m+fe-q,ve=r($,me/2,m+$.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${a(ge)},${a(_e)})">`+(Z?`<g class="pele-branches" fill="none" font-size="${C}">${Z}</g>`:``)+(ue||Q?`<g class="pele-edges" fill="none" stroke-width="2" stroke-linecap="round">${ue}${Q}</g>`:``)+(de?`<g class="pele-commits" font-size="${f}" fill="var(--_m)">${de}</g>`:``)+`</g>`;return{svg:e(`gitGraph`,me,he,d,l,s,ve),width:me,height:he,links:[]}}var G={type:`gitGraph`,parse:(e,t,n)=>k(P(e),t,n),render:U};export{G as gitGraph};
|