@economic/agents-playground 0.0.1-beta.5 → 0.0.1

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.
Files changed (76) hide show
  1. package/README.md +9 -9
  2. package/dist/assets/{_basePickBy-L9tJjs4k.js → _basePickBy-BJ_rm3-n.js} +1 -1
  3. package/dist/assets/{_baseUniq-CJGmJ2Kn.js → _baseUniq-BGPNLZq7.js} +1 -1
  4. package/dist/assets/architecture-PBZL5I3N-BqR3gJ-S.js +1 -0
  5. package/dist/assets/architectureDiagram-2XIMDMQ5-Ci6lZRdi.js +36 -0
  6. package/dist/assets/{blockDiagram-WCTKOSBZ-ByDlnt_h.js → blockDiagram-WCTKOSBZ-Bs2dO4Lh.js} +1 -1
  7. package/dist/assets/{chunk-7E7YKBS2-DC6Ssfw1.js → chunk-7E7YKBS2-CjPkysZ4.js} +1 -1
  8. package/dist/assets/{chunk-C72U2L5F-DyqCQIE3.js → chunk-C72U2L5F-B11-t4Kx.js} +1 -1
  9. package/dist/assets/{chunk-EGIJ26TM-B7Ugi6e1.js → chunk-EGIJ26TM-Dn67x_wP.js} +1 -1
  10. package/dist/assets/{chunk-L3YUKLVL-qKwCol5r.js → chunk-L3YUKLVL-B6prTSRj.js} +1 -1
  11. package/dist/assets/{chunk-NQ4KR5QH-DWw53kPv.js → chunk-NQ4KR5QH-CgXz_uQQ.js} +1 -1
  12. package/dist/assets/{chunk-OZEHJAEY-BmfGg85m.js → chunk-OZEHJAEY-DFGloWwN.js} +1 -1
  13. package/dist/assets/{chunk-R5LLSJPH-DYLrvrgX.js → chunk-R5LLSJPH-iHaJebab.js} +1 -1
  14. package/dist/assets/{chunk-WL4C6EOR-DzVRiTF5.js → chunk-WL4C6EOR-BTGOslpF.js} +1 -1
  15. package/dist/assets/{chunk-XIRO2GV7-DDoKknvy.js → chunk-XIRO2GV7-BbBu2-ax.js} +1 -1
  16. package/dist/assets/{chunk-XZSTWKYB-CvLuTGQr.js → chunk-XZSTWKYB-CR7HLNO4.js} +1 -1
  17. package/dist/assets/classDiagram-VBA2DB6C-DET8D2F6.js +1 -0
  18. package/dist/assets/classDiagram-v2-RAHNMMFH-C_pvaxDg.js +1 -0
  19. package/dist/assets/clone-DCUYwHc1.js +1 -0
  20. package/dist/assets/{dagre-BJ0Et-5X.js → dagre-DHSLkSfU.js} +1 -1
  21. package/dist/assets/dagre-KLK3FWXG-CsIRyGd-.js +4 -0
  22. package/dist/assets/diagram-E7M64L7V-eMkzKdKv.js +24 -0
  23. package/dist/assets/diagram-IFDJBPK2-BDQnMPef.js +43 -0
  24. package/dist/assets/diagram-P4PSJMXO-C1pGlueJ.js +24 -0
  25. package/dist/assets/{erDiagram-INFDFZHY-C0BMPOrX.js → erDiagram-INFDFZHY-oSJOQVMl.js} +1 -1
  26. package/dist/assets/{flowDiagram-PKNHOUZH-B2fIxLUm.js → flowDiagram-PKNHOUZH-DCjCL66H.js} +1 -1
  27. package/dist/assets/ganttDiagram-A5KZAMGK-BEoHssiP.js +292 -0
  28. package/dist/assets/gitGraph-HDMCJU4V-Cldfavhj.js +1 -0
  29. package/dist/assets/gitGraphDiagram-K3NZZRJ6-BaVomO0E.js +65 -0
  30. package/dist/assets/{graphlib-CmaOUyjl.js → graphlib-sSK0q0jO.js} +1 -1
  31. package/dist/assets/{highlighted-body-OFNGDK62-BKuJC0rZ.js → highlighted-body-OFNGDK62-BWa9Mb0y.js} +1 -1
  32. package/dist/assets/{index-rODTN5ZH.js → index-D8W5OEji.js} +8 -8
  33. package/dist/assets/info-3K5VOQVL-Bp03asUc.js +1 -0
  34. package/dist/assets/infoDiagram-LFFYTUFH-BpLjxnPR.js +2 -0
  35. package/dist/assets/{ishikawaDiagram-PHBUUO56-COt-f3vI.js → ishikawaDiagram-PHBUUO56-KwEjkSbo.js} +1 -1
  36. package/dist/assets/{journeyDiagram-4ABVD52K-C-U1F_87.js → journeyDiagram-4ABVD52K-BbJAX67K.js} +1 -1
  37. package/dist/assets/{kanban-definition-K7BYSVSG-CBurs7Od.js → kanban-definition-K7BYSVSG-qoQ-gouW.js} +1 -1
  38. package/dist/assets/mermaid-GHXKKRXX-BonhTQ8Y.js +1 -0
  39. package/dist/assets/mermaid-parser.core-zSGpBtrZ.js +4 -0
  40. package/dist/assets/{mindmap-definition-YRQLILUH-BgwlrWWN.js → mindmap-definition-YRQLILUH-a6cg75mj.js} +1 -1
  41. package/dist/assets/packet-RMMSAZCW-DZw3Th1z.js +1 -0
  42. package/dist/assets/pie-UPGHQEXC-Boxmvw0_.js +1 -0
  43. package/dist/assets/{pieDiagram-SKSYHLDU-DQ65vLhm.js → pieDiagram-SKSYHLDU-Ba8_qWtW.js} +1 -1
  44. package/dist/assets/{quadrantDiagram-337W2JSQ-C3xMuDjL.js → quadrantDiagram-337W2JSQ-BYRgqy3l.js} +1 -1
  45. package/dist/assets/radar-KQ55EAFF-CMpoCV22.js +1 -0
  46. package/dist/assets/{requirementDiagram-Z7DCOOCP-BT86nLzI.js → requirementDiagram-Z7DCOOCP-bWlpEI8M.js} +1 -1
  47. package/dist/assets/{sequenceDiagram-2WXFIKYE-C_zZdkM7.js → sequenceDiagram-2WXFIKYE-DXTnjjaR.js} +1 -1
  48. package/dist/assets/stateDiagram-RAJIS63D-BEPLG8-b.js +1 -0
  49. package/dist/assets/stateDiagram-v2-FVOUBMTO-Cn3GtrPV.js +1 -0
  50. package/dist/assets/treemap-KZPCXAKY-C2Yo6dTQ.js +1 -0
  51. package/dist/assets/{vennDiagram-LZ73GAT5-CwTLFBJg.js → vennDiagram-LZ73GAT5-Bl0Pzjn6.js} +1 -1
  52. package/dist/assets/{xychartDiagram-JWTSCODW-BvFKMIoI.js → xychartDiagram-JWTSCODW-BCXHFEAl.js} +1 -1
  53. package/dist/index.html +2 -2
  54. package/package.json +2 -2
  55. package/dist/assets/architecture-PBZL5I3N-D2-4uytP.js +0 -1
  56. package/dist/assets/architectureDiagram-2XIMDMQ5-CzwfKASt.js +0 -36
  57. package/dist/assets/classDiagram-VBA2DB6C-BFf1_hDn.js +0 -1
  58. package/dist/assets/classDiagram-v2-RAHNMMFH-Cc_Q9nD6.js +0 -1
  59. package/dist/assets/clone-CjD8itTD.js +0 -1
  60. package/dist/assets/dagre-KLK3FWXG-Cj4lt3rZ.js +0 -4
  61. package/dist/assets/diagram-E7M64L7V-Con9XOMz.js +0 -24
  62. package/dist/assets/diagram-IFDJBPK2-DLBrjdhF.js +0 -43
  63. package/dist/assets/diagram-P4PSJMXO-D5R-VbFF.js +0 -24
  64. package/dist/assets/ganttDiagram-A5KZAMGK-CS4Q9uqC.js +0 -292
  65. package/dist/assets/gitGraph-HDMCJU4V-C5SnLwfc.js +0 -1
  66. package/dist/assets/gitGraphDiagram-K3NZZRJ6-Cv0H9yt2.js +0 -65
  67. package/dist/assets/info-3K5VOQVL-DdjJmzis.js +0 -1
  68. package/dist/assets/infoDiagram-LFFYTUFH-BX45-9cE.js +0 -2
  69. package/dist/assets/mermaid-GHXKKRXX-Dar-R5At.js +0 -1
  70. package/dist/assets/mermaid-parser.core-Bzr6VxwG.js +0 -4
  71. package/dist/assets/packet-RMMSAZCW-kdWIWETB.js +0 -1
  72. package/dist/assets/pie-UPGHQEXC-BNgd9bxQ.js +0 -1
  73. package/dist/assets/radar-KQ55EAFF-B8qgTldE.js +0 -1
  74. package/dist/assets/stateDiagram-RAJIS63D-LjyoGrQS.js +0 -1
  75. package/dist/assets/stateDiagram-v2-FVOUBMTO-bXfl44aF.js +0 -1
  76. package/dist/assets/treemap-KZPCXAKY-DoXzvv-b.js +0 -1
@@ -0,0 +1,65 @@
1
+ import{g as e,h as t,p as n}from"./src-B0URjIBy.js";import{B as r,C as i,V as a,W as o,_ as s,a as c,d as l,q as u,s as d,v as f,y as p}from"./chunk-7R4GIKGN-B0Nk6xl6.js";import{h as ee,p as te,r as m}from"./chunk-GEFDOKGD-D5eIWnuf.js";import{t as h}from"./chunk-4BX2VUAB-BMQY333L.js";import{t as g}from"./mermaid-parser.core-zSGpBtrZ.js";import{t as ne}from"./chunk-QZHKN3VN-C-zFVA0L.js";var _={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},re=l.gitGraph,v=t(()=>m({...re,...p().gitGraph}),`getConfig`),y=new ne(()=>{let e=v(),t=e.mainBranchName,n=e.mainBranchOrder;return{mainBranchName:t,commits:new Map,head:null,branchConfig:new Map([[t,{name:t,order:n}]]),branches:new Map([[t,null]]),currBranch:t,direction:`LR`,seq:0,options:{}}});function b(){return te({length:7})}t(b,`getID`);function x(e,t){let n=Object.create(null);return e.reduce((e,r)=>{let i=t(r);return n[i]||(n[i]=!0,e.push(r)),e},[])}t(x,`uniqBy`);var S=t(function(e){y.records.direction=e},`setDirection`),C=t(function(t){e.debug(`options str`,t),t=t?.trim(),t||=`{}`;try{y.records.options=JSON.parse(t)}catch(t){e.error(`error while parsing gitGraph options`,t.message)}},`setOptions`),ie=t(function(){return y.records.options},`getOptions`),ae=t(function(t){let n=t.msg,r=t.id,i=t.type,a=t.tags;e.info(`commit`,n,r,i,a),e.debug(`Entering commit:`,n,r,i,a);let o=v();r=d.sanitizeText(r,o),n=d.sanitizeText(n,o),a=a?.map(e=>d.sanitizeText(e,o));let s={id:r||y.records.seq+`-`+b(),message:n,seq:y.records.seq++,type:i??_.NORMAL,tags:a??[],parents:y.records.head==null?[]:[y.records.head.id],branch:y.records.currBranch};y.records.head=s,e.info(`main branch`,o.mainBranchName),y.records.commits.has(s.id)&&e.warn(`Commit ID ${s.id} already exists`),y.records.commits.set(s.id,s),y.records.branches.set(y.records.currBranch,s.id),e.debug(`in pushCommit `+s.id)},`commit`),oe=t(function(t){let n=t.name,r=t.order;if(n=d.sanitizeText(n,v()),y.records.branches.has(n))throw Error(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${n}")`);y.records.branches.set(n,y.records.head==null?null:y.records.head.id),y.records.branchConfig.set(n,{name:n,order:r}),w(n),e.debug(`in createBranch`)},`branch`),se=t(t=>{let n=t.branch,r=t.id,i=t.type,a=t.tags,o=v();n=d.sanitizeText(n,o),r&&=d.sanitizeText(r,o);let s=y.records.branches.get(y.records.currBranch),c=y.records.branches.get(n),l=s?y.records.commits.get(s):void 0,u=c?y.records.commits.get(c):void 0;if(l&&u&&l.branch===n)throw Error(`Cannot merge branch '${n}' into itself.`);if(y.records.currBranch===n){let e=Error(`Incorrect usage of "merge". Cannot merge a branch to itself`);throw e.hash={text:`merge ${n}`,token:`merge ${n}`,expected:[`branch abc`]},e}if(l===void 0||!l){let e=Error(`Incorrect usage of "merge". Current branch (${y.records.currBranch})has no commits`);throw e.hash={text:`merge ${n}`,token:`merge ${n}`,expected:[`commit`]},e}if(!y.records.branches.has(n)){let e=Error(`Incorrect usage of "merge". Branch to be merged (`+n+`) does not exist`);throw e.hash={text:`merge ${n}`,token:`merge ${n}`,expected:[`branch ${n}`]},e}if(u===void 0||!u){let e=Error(`Incorrect usage of "merge". Branch to be merged (`+n+`) has no commits`);throw e.hash={text:`merge ${n}`,token:`merge ${n}`,expected:[`"commit"`]},e}if(l===u){let e=Error(`Incorrect usage of "merge". Both branches have same head`);throw e.hash={text:`merge ${n}`,token:`merge ${n}`,expected:[`branch abc`]},e}if(r&&y.records.commits.has(r)){let e=Error(`Incorrect usage of "merge". Commit with id:`+r+` already exists, use different custom id`);throw e.hash={text:`merge ${n} ${r} ${i} ${a?.join(` `)}`,token:`merge ${n} ${r} ${i} ${a?.join(` `)}`,expected:[`merge ${n} ${r}_UNIQUE ${i} ${a?.join(` `)}`]},e}let f=c||``,p={id:r||`${y.records.seq}-${b()}`,message:`merged branch ${n} into ${y.records.currBranch}`,seq:y.records.seq++,parents:y.records.head==null?[]:[y.records.head.id,f],branch:y.records.currBranch,type:_.MERGE,customType:i,customId:!!r,tags:a??[]};y.records.head=p,y.records.commits.set(p.id,p),y.records.branches.set(y.records.currBranch,p.id),e.debug(y.records.branches),e.debug(`in mergeBranch`)},`merge`),ce=t(function(t){let n=t.id,r=t.targetId,i=t.tags,a=t.parent;e.debug(`Entering cherryPick:`,n,r,i);let o=v();if(n=d.sanitizeText(n,o),r=d.sanitizeText(r,o),i=i?.map(e=>d.sanitizeText(e,o)),a=d.sanitizeText(a,o),!n||!y.records.commits.has(n)){let e=Error(`Incorrect usage of "cherryPick". Source commit id should exist and provided`);throw e.hash={text:`cherryPick ${n} ${r}`,token:`cherryPick ${n} ${r}`,expected:[`cherry-pick abc`]},e}let s=y.records.commits.get(n);if(s===void 0||!s)throw Error(`Incorrect usage of "cherryPick". Source commit id should exist and provided`);if(a&&!(Array.isArray(s.parents)&&s.parents.includes(a)))throw Error(`Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.`);let c=s.branch;if(s.type===_.MERGE&&!a)throw Error(`Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.`);if(!r||!y.records.commits.has(r)){if(c===y.records.currBranch){let e=Error(`Incorrect usage of "cherryPick". Source commit is already on current branch`);throw e.hash={text:`cherryPick ${n} ${r}`,token:`cherryPick ${n} ${r}`,expected:[`cherry-pick abc`]},e}let t=y.records.branches.get(y.records.currBranch);if(t===void 0||!t){let e=Error(`Incorrect usage of "cherry-pick". Current branch (${y.records.currBranch})has no commits`);throw e.hash={text:`cherryPick ${n} ${r}`,token:`cherryPick ${n} ${r}`,expected:[`cherry-pick abc`]},e}let o=y.records.commits.get(t);if(o===void 0||!o){let e=Error(`Incorrect usage of "cherry-pick". Current branch (${y.records.currBranch})has no commits`);throw e.hash={text:`cherryPick ${n} ${r}`,token:`cherryPick ${n} ${r}`,expected:[`cherry-pick abc`]},e}let l={id:y.records.seq+`-`+b(),message:`cherry-picked ${s?.message} into ${y.records.currBranch}`,seq:y.records.seq++,parents:y.records.head==null?[]:[y.records.head.id,s.id],branch:y.records.currBranch,type:_.CHERRY_PICK,tags:i?i.filter(Boolean):[`cherry-pick:${s.id}${s.type===_.MERGE?`|parent:${a}`:``}`]};y.records.head=l,y.records.commits.set(l.id,l),y.records.branches.set(y.records.currBranch,l.id),e.debug(y.records.branches),e.debug(`in cherryPick`)}},`cherryPick`),w=t(function(e){if(e=d.sanitizeText(e,v()),y.records.branches.has(e)){y.records.currBranch=e;let t=y.records.branches.get(y.records.currBranch);t===void 0||!t?y.records.head=null:y.records.head=y.records.commits.get(t)??null}else{let t=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${e}")`);throw t.hash={text:`checkout ${e}`,token:`checkout ${e}`,expected:[`branch ${e}`]},t}},`checkout`);function T(e,t,n){let r=e.indexOf(t);r===-1?e.push(n):e.splice(r,1,n)}t(T,`upsert`);function E(t){let n=t.reduce((e,t)=>e.seq>t.seq?e:t,t[0]),r=``;t.forEach(function(e){e===n?r+=` *`:r+=` |`});let i=[r,n.id,n.seq];for(let e in y.records.branches)y.records.branches.get(e)===n.id&&i.push(e);if(e.debug(i.join(` `)),n.parents&&n.parents.length==2&&n.parents[0]&&n.parents[1]){let e=y.records.commits.get(n.parents[0]);T(t,n,e),n.parents[1]&&t.push(y.records.commits.get(n.parents[1]))}else if(n.parents.length==0)return;else if(n.parents[0]){let e=y.records.commits.get(n.parents[0]);T(t,n,e)}t=x(t,e=>e.id),E(t)}t(E,`prettyPrintCommitHistory`);var le=t(function(){e.debug(y.records.commits);let t=D()[0];E([t])},`prettyPrint`),ue=t(function(){y.reset(),c()},`clear`),de=t(function(){return[...y.records.branchConfig.values()].map((e,t)=>e.order!==null&&e.order!==void 0?e:{...e,order:parseFloat(`0.${t}`)}).sort((e,t)=>(e.order??0)-(t.order??0)).map(({name:e})=>({name:e}))},`getBranchesAsObjArray`),fe=t(function(){return y.records.branches},`getBranches`),pe=t(function(){return y.records.commits},`getCommits`),D=t(function(){let t=[...y.records.commits.values()];return t.forEach(function(t){e.debug(t.id)}),t.sort((e,t)=>e.seq-t.seq),t},`getCommitsArray`),O={commitType:_,getConfig:v,setDirection:S,setOptions:C,getOptions:ie,commit:ae,branch:oe,merge:se,cherryPick:ce,checkout:w,prettyPrint:le,clear:ue,getBranchesAsObjArray:de,getBranches:fe,getCommits:pe,getCommitsArray:D,getCurrentBranch:t(function(){return y.records.currBranch},`getCurrentBranch`),getDirection:t(function(){return y.records.direction},`getDirection`),getHead:t(function(){return y.records.head},`getHead`),setAccTitle:a,getAccTitle:f,getAccDescription:s,setAccDescription:r,setDiagramTitle:o,getDiagramTitle:i},k=t((e,t)=>{h(e,t),e.dir&&t.setDirection(e.dir);for(let n of e.statements)A(n,t)},`populate`),A=t((n,r)=>{let i={Commit:t(e=>r.commit(j(e)),`Commit`),Branch:t(e=>r.branch(M(e)),`Branch`),Merge:t(e=>r.merge(N(e)),`Merge`),Checkout:t(e=>r.checkout(P(e)),`Checkout`),CherryPicking:t(e=>r.cherryPick(F(e)),`CherryPicking`)}[n.$type];i?i(n):e.error(`Unknown statement type: ${n.$type}`)},`parseStatement`),j=t(e=>({id:e.id,msg:e.message??``,type:e.type===void 0?_.NORMAL:_[e.type],tags:e.tags??void 0}),`parseCommit`),M=t(e=>({name:e.name,order:e.order??0}),`parseBranch`),N=t(e=>({branch:e.branch,id:e.id??``,type:e.type===void 0?void 0:_[e.type],tags:e.tags??void 0}),`parseMerge`),P=t(e=>e.branch,`parseCheckout`),F=t(e=>({id:e.id,targetId:``,tags:e.tags?.length===0?void 0:e.tags,parent:e.parent}),`parseCherryPicking`),I={parse:t(async t=>{let n=await g(`gitGraph`,t);e.debug(n),k(n,O)},`parse`)},L=10,R=40,z=4,B=2,V=8,H=new Map,U=new Map,W=30,G=new Map,K=[],q=0,J=`LR`,me=t(()=>{H.clear(),U.clear(),G.clear(),q=0,K=[],J=`LR`},`clear`),Y=t(e=>{let t=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);return(typeof e==`string`?e.split(/\\n|\n|<br\s*\/?>/gi):e).forEach(e=>{let n=document.createElementNS(`http://www.w3.org/2000/svg`,`tspan`);n.setAttributeNS(`http://www.w3.org/XML/1998/namespace`,`xml:space`,`preserve`),n.setAttribute(`dy`,`1em`),n.setAttribute(`x`,`0`),n.setAttribute(`class`,`row`),n.textContent=e.trim(),t.appendChild(n)}),t},`drawText`),X=t(e=>{let n,r,i;return J===`BT`?(r=t((e,t)=>e<=t,`comparisonFunc`),i=1/0):(r=t((e,t)=>e>=t,`comparisonFunc`),i=0),e.forEach(e=>{let t=J===`TB`||J==`BT`?U.get(e)?.y:U.get(e)?.x;t!==void 0&&r(t,i)&&(n=e,i=t)}),n},`findClosestParent`),he=t(e=>{let t=``,n=1/0;return e.forEach(e=>{let r=U.get(e).y;r<=n&&(t=e,n=r)}),t||void 0},`findClosestParentBT`),ge=t((e,t,n)=>{let r=n,i=n,a=[];e.forEach(e=>{let n=t.get(e);if(!n)throw Error(`Commit not found for key ${e}`);n.parents.length?(r=ve(n),i=Math.max(r,i)):a.push(n),ye(n,r)}),r=i,a.forEach(e=>{be(e,r,n)}),e.forEach(e=>{let n=t.get(e);if(n?.parents.length){let e=he(n.parents);r=U.get(e).y-R,r<=i&&(i=r);let t=H.get(n.branch).pos,a=r-L;U.set(n.id,{x:t,y:a})}})},`setParallelBTPos`),_e=t(e=>{let t=X(e.parents.filter(e=>e!==null));if(!t)throw Error(`Closest parent not found for commit ${e.id}`);let n=U.get(t)?.y;if(n===void 0)throw Error(`Closest parent position not found for commit ${e.id}`);return n},`findClosestParentPos`),ve=t(e=>_e(e)+R,`calculateCommitPosition`),ye=t((e,t)=>{let n=H.get(e.branch);if(!n)throw Error(`Branch not found for commit ${e.id}`);let r=n.pos,i=t+L;return U.set(e.id,{x:r,y:i}),{x:r,y:i}},`setCommitPosition`),be=t((e,t,n)=>{let r=H.get(e.branch);if(!r)throw Error(`Branch not found for commit ${e.id}`);let i=t+n,a=r.pos;U.set(e.id,{x:a,y:i})},`setRootPosition`),xe=t((e,t,n,r,i,a)=>{if(a===_.HIGHLIGHT)e.append(`rect`).attr(`x`,n.x-10).attr(`y`,n.y-10).attr(`width`,20).attr(`height`,20).attr(`class`,`commit ${t.id} commit-highlight${i%V} ${r}-outer`),e.append(`rect`).attr(`x`,n.x-6).attr(`y`,n.y-6).attr(`width`,12).attr(`height`,12).attr(`class`,`commit ${t.id} commit${i%V} ${r}-inner`);else if(a===_.CHERRY_PICK)e.append(`circle`).attr(`cx`,n.x).attr(`cy`,n.y).attr(`r`,10).attr(`class`,`commit ${t.id} ${r}`),e.append(`circle`).attr(`cx`,n.x-3).attr(`cy`,n.y+2).attr(`r`,2.75).attr(`fill`,`#fff`).attr(`class`,`commit ${t.id} ${r}`),e.append(`circle`).attr(`cx`,n.x+3).attr(`cy`,n.y+2).attr(`r`,2.75).attr(`fill`,`#fff`).attr(`class`,`commit ${t.id} ${r}`),e.append(`line`).attr(`x1`,n.x+3).attr(`y1`,n.y+1).attr(`x2`,n.x).attr(`y2`,n.y-5).attr(`stroke`,`#fff`).attr(`class`,`commit ${t.id} ${r}`),e.append(`line`).attr(`x1`,n.x-3).attr(`y1`,n.y+1).attr(`x2`,n.x).attr(`y2`,n.y-5).attr(`stroke`,`#fff`).attr(`class`,`commit ${t.id} ${r}`);else{let o=e.append(`circle`);if(o.attr(`cx`,n.x),o.attr(`cy`,n.y),o.attr(`r`,t.type===_.MERGE?9:10),o.attr(`class`,`commit ${t.id} commit${i%V}`),a===_.MERGE){let a=e.append(`circle`);a.attr(`cx`,n.x),a.attr(`cy`,n.y),a.attr(`r`,6),a.attr(`class`,`commit ${r} ${t.id} commit${i%V}`)}a===_.REVERSE&&e.append(`path`).attr(`d`,`M ${n.x-5},${n.y-5}L${n.x+5},${n.y+5}M${n.x-5},${n.y+5}L${n.x+5},${n.y-5}`).attr(`class`,`commit ${r} ${t.id} commit${i%V}`)}},`drawCommitBullet`),Se=t((e,t,n,r,i)=>{if(t.type!==_.CHERRY_PICK&&(t.customId&&t.type===_.MERGE||t.type!==_.MERGE)&&i.showCommitLabel){let a=e.append(`g`),o=a.insert(`rect`).attr(`class`,`commit-label-bkg`),s=a.append(`text`).attr(`x`,r).attr(`y`,n.y+25).attr(`class`,`commit-label`).text(t.id),c=s.node()?.getBBox();if(c&&(o.attr(`x`,n.posWithOffset-c.width/2-B).attr(`y`,n.y+13.5).attr(`width`,c.width+2*B).attr(`height`,c.height+2*B),J===`TB`||J===`BT`?(o.attr(`x`,n.x-(c.width+4*z+5)).attr(`y`,n.y-12),s.attr(`x`,n.x-(c.width+4*z)).attr(`y`,n.y+c.height-12)):s.attr(`x`,n.posWithOffset-c.width/2),i.rotateCommitLabel))if(J===`TB`||J===`BT`)s.attr(`transform`,`rotate(-45, `+n.x+`, `+n.y+`)`),o.attr(`transform`,`rotate(-45, `+n.x+`, `+n.y+`)`);else{let e=-7.5-(c.width+10)/25*9.5,t=10+c.width/25*8.5;a.attr(`transform`,`translate(`+e+`, `+t+`) rotate(-45, `+r+`, `+n.y+`)`)}}},`drawCommitLabel`),Z=t((e,t,n,r)=>{if(t.tags.length>0){let i=0,a=0,o=0,s=[];for(let r of t.tags.reverse()){let t=e.insert(`polygon`),c=e.append(`circle`),l=e.append(`text`).attr(`y`,n.y-16-i).attr(`class`,`tag-label`).text(r),u=l.node()?.getBBox();if(!u)throw Error(`Tag bbox not found`);a=Math.max(a,u.width),o=Math.max(o,u.height),l.attr(`x`,n.posWithOffset-u.width/2),s.push({tag:l,hole:c,rect:t,yOffset:i}),i+=20}for(let{tag:e,hole:t,rect:i,yOffset:c}of s){let s=o/2,l=n.y-19.2-c;if(i.attr(`class`,`tag-label-bkg`).attr(`points`,`
2
+ ${r-a/2-z/2},${l+B}
3
+ ${r-a/2-z/2},${l-B}
4
+ ${n.posWithOffset-a/2-z},${l-s-B}
5
+ ${n.posWithOffset+a/2+z},${l-s-B}
6
+ ${n.posWithOffset+a/2+z},${l+s+B}
7
+ ${n.posWithOffset-a/2-z},${l+s+B}`),t.attr(`cy`,l).attr(`cx`,r-a/2+z/2).attr(`r`,1.5).attr(`class`,`tag-hole`),J===`TB`||J===`BT`){let o=r+c;i.attr(`class`,`tag-label-bkg`).attr(`points`,`
8
+ ${n.x},${o+2}
9
+ ${n.x},${o-2}
10
+ ${n.x+L},${o-s-2}
11
+ ${n.x+L+a+4},${o-s-2}
12
+ ${n.x+L+a+4},${o+s+2}
13
+ ${n.x+L},${o+s+2}`).attr(`transform`,`translate(12,12) rotate(45, `+n.x+`,`+r+`)`),t.attr(`cx`,n.x+z/2).attr(`cy`,o).attr(`transform`,`translate(12,12) rotate(45, `+n.x+`,`+r+`)`),e.attr(`x`,n.x+5).attr(`y`,o+3).attr(`transform`,`translate(14,14) rotate(45, `+n.x+`,`+r+`)`)}}}},`drawCommitTags`),Ce=t(e=>{switch(e.customType??e.type){case _.NORMAL:return`commit-normal`;case _.REVERSE:return`commit-reverse`;case _.HIGHLIGHT:return`commit-highlight`;case _.MERGE:return`commit-merge`;case _.CHERRY_PICK:return`commit-cherry-pick`;default:return`commit-normal`}},`getCommitClassType`),we=t((e,t,n,r)=>{let i={x:0,y:0};if(e.parents.length>0){let n=X(e.parents);if(n){let a=r.get(n)??i;return t===`TB`?a.y+R:t===`BT`?(r.get(e.id)??i).y-R:a.x+R}}else if(t===`TB`)return W;else if(t===`BT`)return(r.get(e.id)??i).y-R;else return 0;return 0},`calculatePosition`),Te=t((e,t,n)=>{let r=J===`BT`&&n?t:t+L,i=J===`TB`||J===`BT`?r:H.get(e.branch)?.pos,a=J===`TB`||J===`BT`?H.get(e.branch)?.pos:r;if(a===void 0||i===void 0)throw Error(`Position were undefined for commit ${e.id}`);return{x:a,y:i,posWithOffset:r}},`getCommitPosition`),Q=t((e,n,r,i)=>{let a=e.append(`g`).attr(`class`,`commit-bullets`),o=e.append(`g`).attr(`class`,`commit-labels`),s=J===`TB`||J===`BT`?W:0,c=[...n.keys()],l=i.parallelCommits??!1,u=t((e,t)=>{let r=n.get(e)?.seq,i=n.get(t)?.seq;return r!==void 0&&i!==void 0?r-i:0},`sortKeys`),d=c.sort(u);J===`BT`&&(l&&ge(d,n,s),d=d.reverse()),d.forEach(e=>{let t=n.get(e);if(!t)throw Error(`Commit not found for key ${e}`);l&&(s=we(t,J,s,U));let c=Te(t,s,l);if(r){let e=Ce(t),n=t.customType??t.type;xe(a,t,c,e,H.get(t.branch)?.index??0,n),Se(o,t,c,s,i),Z(o,t,c,s)}J===`TB`||J===`BT`?U.set(t.id,{x:c.x,y:c.posWithOffset}):U.set(t.id,{x:c.posWithOffset,y:c.y}),s=J===`BT`&&l?s+R:s+R+L,s>q&&(q=s)})},`drawCommits`),Ee=t((e,n,r,i,a)=>{let o=(J===`TB`||J===`BT`?r.x<i.x:r.y<i.y)?n.branch:e.branch,s=t(e=>e.branch===o,`isOnBranchToGetCurve`),c=t(t=>t.seq>e.seq&&t.seq<n.seq,`isBetweenCommits`);return[...a.values()].some(e=>c(e)&&s(e))},`shouldRerouteArrow`),$=t((e,t,n=0)=>{let r=e+Math.abs(e-t)/2;return n>5?r:K.every(e=>Math.abs(e-r)>=10)?(K.push(r),r):$(e,t-Math.abs(e-t)/5,n+1)},`findLane`),De=t((e,t,n,r)=>{let i=U.get(t.id),a=U.get(n.id);if(i===void 0||a===void 0)throw Error(`Commit positions not found for commits ${t.id} and ${n.id}`);let o=Ee(t,n,i,a,r),s=``,c=``,l=0,u=0,d=H.get(n.branch)?.index;n.type===_.MERGE&&t.id!==n.parents[0]&&(d=H.get(t.branch)?.index);let f;if(o){s=`A 10 10, 0, 0, 0,`,c=`A 10 10, 0, 0, 1,`,l=10,u=10;let e=i.y<a.y?$(i.y,a.y):$(a.y,i.y),n=i.x<a.x?$(i.x,a.x):$(a.x,i.x);J===`TB`?i.x<a.x?f=`M ${i.x} ${i.y} L ${n-l} ${i.y} ${c} ${n} ${i.y+u} L ${n} ${a.y-l} ${s} ${n+u} ${a.y} L ${a.x} ${a.y}`:(d=H.get(t.branch)?.index,f=`M ${i.x} ${i.y} L ${n+l} ${i.y} ${s} ${n} ${i.y+u} L ${n} ${a.y-l} ${c} ${n-u} ${a.y} L ${a.x} ${a.y}`):J===`BT`?i.x<a.x?f=`M ${i.x} ${i.y} L ${n-l} ${i.y} ${s} ${n} ${i.y-u} L ${n} ${a.y+l} ${c} ${n+u} ${a.y} L ${a.x} ${a.y}`:(d=H.get(t.branch)?.index,f=`M ${i.x} ${i.y} L ${n+l} ${i.y} ${c} ${n} ${i.y-u} L ${n} ${a.y+l} ${s} ${n-u} ${a.y} L ${a.x} ${a.y}`):i.y<a.y?f=`M ${i.x} ${i.y} L ${i.x} ${e-l} ${s} ${i.x+u} ${e} L ${a.x-l} ${e} ${c} ${a.x} ${e+u} L ${a.x} ${a.y}`:(d=H.get(t.branch)?.index,f=`M ${i.x} ${i.y} L ${i.x} ${e+l} ${c} ${i.x+u} ${e} L ${a.x-l} ${e} ${s} ${a.x} ${e-u} L ${a.x} ${a.y}`)}else s=`A 20 20, 0, 0, 0,`,c=`A 20 20, 0, 0, 1,`,l=20,u=20,J===`TB`?(i.x<a.x&&(f=n.type===_.MERGE&&t.id!==n.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${a.y-l} ${s} ${i.x+u} ${a.y} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${a.x-l} ${i.y} ${c} ${a.x} ${i.y+u} L ${a.x} ${a.y}`),i.x>a.x&&(s=`A 20 20, 0, 0, 0,`,c=`A 20 20, 0, 0, 1,`,l=20,u=20,f=n.type===_.MERGE&&t.id!==n.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${a.y-l} ${c} ${i.x-u} ${a.y} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${a.x+l} ${i.y} ${s} ${a.x} ${i.y+u} L ${a.x} ${a.y}`),i.x===a.x&&(f=`M ${i.x} ${i.y} L ${a.x} ${a.y}`)):J===`BT`?(i.x<a.x&&(f=n.type===_.MERGE&&t.id!==n.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${a.y+l} ${c} ${i.x+u} ${a.y} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${a.x-l} ${i.y} ${s} ${a.x} ${i.y-u} L ${a.x} ${a.y}`),i.x>a.x&&(s=`A 20 20, 0, 0, 0,`,c=`A 20 20, 0, 0, 1,`,l=20,u=20,f=n.type===_.MERGE&&t.id!==n.parents[0]?`M ${i.x} ${i.y} L ${i.x} ${a.y+l} ${s} ${i.x-u} ${a.y} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${a.x+l} ${i.y} ${c} ${a.x} ${i.y-u} L ${a.x} ${a.y}`),i.x===a.x&&(f=`M ${i.x} ${i.y} L ${a.x} ${a.y}`)):(i.y<a.y&&(f=n.type===_.MERGE&&t.id!==n.parents[0]?`M ${i.x} ${i.y} L ${a.x-l} ${i.y} ${c} ${a.x} ${i.y+u} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${i.x} ${a.y-l} ${s} ${i.x+u} ${a.y} L ${a.x} ${a.y}`),i.y>a.y&&(f=n.type===_.MERGE&&t.id!==n.parents[0]?`M ${i.x} ${i.y} L ${a.x-l} ${i.y} ${s} ${a.x} ${i.y-u} L ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${i.x} ${a.y+l} ${c} ${i.x+u} ${a.y} L ${a.x} ${a.y}`),i.y===a.y&&(f=`M ${i.x} ${i.y} L ${a.x} ${a.y}`));if(f===void 0)throw Error(`Line definition not found`);e.append(`path`).attr(`d`,f).attr(`class`,`arrow arrow`+d%V)},`drawArrow`),Oe=t((e,t)=>{let n=e.append(`g`).attr(`class`,`commit-arrows`);[...t.keys()].forEach(e=>{let r=t.get(e);r.parents&&r.parents.length>0&&r.parents.forEach(e=>{De(n,t.get(e),r,t)})})},`drawArrows`),ke=t((e,t,n)=>{let r=e.append(`g`);t.forEach((e,t)=>{let i=t%V,a=H.get(e.name)?.pos;if(a===void 0)throw Error(`Position not found for branch ${e.name}`);let o=r.append(`line`);o.attr(`x1`,0),o.attr(`y1`,a),o.attr(`x2`,q),o.attr(`y2`,a),o.attr(`class`,`branch branch`+i),J===`TB`?(o.attr(`y1`,W),o.attr(`x1`,a),o.attr(`y2`,q),o.attr(`x2`,a)):J===`BT`&&(o.attr(`y1`,q),o.attr(`x1`,a),o.attr(`y2`,W),o.attr(`x2`,a)),K.push(a);let s=e.name,c=Y(s),l=r.insert(`rect`),u=r.insert(`g`).attr(`class`,`branchLabel`).insert(`g`).attr(`class`,`label branch-label`+i);u.node().appendChild(c);let d=c.getBBox();l.attr(`class`,`branchLabelBkg label`+i).attr(`rx`,4).attr(`ry`,4).attr(`x`,-d.width-4-(n.rotateCommitLabel===!0?30:0)).attr(`y`,-d.height/2+8).attr(`width`,d.width+18).attr(`height`,d.height+4),u.attr(`transform`,`translate(`+(-d.width-14-(n.rotateCommitLabel===!0?30:0))+`, `+(a-d.height/2-1)+`)`),J===`TB`?(l.attr(`x`,a-d.width/2-10).attr(`y`,0),u.attr(`transform`,`translate(`+(a-d.width/2-5)+`, 0)`)):J===`BT`?(l.attr(`x`,a-d.width/2-10).attr(`y`,q),u.attr(`transform`,`translate(`+(a-d.width/2-5)+`, `+q+`)`)):l.attr(`transform`,`translate(-19, `+(a-d.height/2)+`)`)})},`drawBranches`),Ae=t(function(e,t,n,r,i){return H.set(e,{pos:t,index:n}),t+=50+(i?40:0)+(J===`TB`||J===`BT`?r.width/2:0),t},`setBranchPosition`),je={parser:I,db:O,renderer:{draw:t(function(t,r,i,a){me(),e.debug(`in gitgraph renderer`,t+`
14
+ `,`id:`,r,i);let o=a.db;if(!o.getConfig){e.error(`getConfig method is not available on db`);return}let s=o.getConfig(),c=s.rotateCommitLabel??!1;G=o.getCommits();let l=o.getBranchesAsObjArray();J=o.getDirection();let d=n(`[id="${r}"]`),f=0;l.forEach((e,t)=>{let n=Y(e.name),r=d.append(`g`),i=r.insert(`g`).attr(`class`,`branchLabel`),a=i.insert(`g`).attr(`class`,`label branch-label`);a.node()?.appendChild(n);let o=n.getBBox();f=Ae(e.name,f,t,o,c),a.remove(),i.remove(),r.remove()}),Q(d,G,!1,s),s.showBranches&&ke(d,l,s),Oe(d,G),Q(d,G,!0,s),ee.insertTitle(d,`gitTitleText`,s.titleTopMargin??0,o.getDiagramTitle()),u(void 0,d,s.diagramPadding,s.useMaxWidth)},`draw`)},styles:t(e=>`
15
+ .commit-id,
16
+ .commit-msg,
17
+ .branch-label {
18
+ fill: lightgrey;
19
+ color: lightgrey;
20
+ font-family: 'trebuchet ms', verdana, arial, sans-serif;
21
+ font-family: var(--mermaid-font-family);
22
+ }
23
+ ${[0,1,2,3,4,5,6,7].map(t=>`
24
+ .branch-label${t} { fill: ${e[`gitBranchLabel`+t]}; }
25
+ .commit${t} { stroke: ${e[`git`+t]}; fill: ${e[`git`+t]}; }
26
+ .commit-highlight${t} { stroke: ${e[`gitInv`+t]}; fill: ${e[`gitInv`+t]}; }
27
+ .label${t} { fill: ${e[`git`+t]}; }
28
+ .arrow${t} { stroke: ${e[`git`+t]}; }
29
+ `).join(`
30
+ `)}
31
+
32
+ .branch {
33
+ stroke-width: 1;
34
+ stroke: ${e.lineColor};
35
+ stroke-dasharray: 2;
36
+ }
37
+ .commit-label { font-size: ${e.commitLabelFontSize}; fill: ${e.commitLabelColor};}
38
+ .commit-label-bkg { font-size: ${e.commitLabelFontSize}; fill: ${e.commitLabelBackground}; opacity: 0.5; }
39
+ .tag-label { font-size: ${e.tagLabelFontSize}; fill: ${e.tagLabelColor};}
40
+ .tag-label-bkg { fill: ${e.tagLabelBackground}; stroke: ${e.tagLabelBorder}; }
41
+ .tag-hole { fill: ${e.textColor}; }
42
+
43
+ .commit-merge {
44
+ stroke: ${e.primaryColor};
45
+ fill: ${e.primaryColor};
46
+ }
47
+ .commit-reverse {
48
+ stroke: ${e.primaryColor};
49
+ fill: ${e.primaryColor};
50
+ stroke-width: 3;
51
+ }
52
+ .commit-highlight-outer {
53
+ }
54
+ .commit-highlight-inner {
55
+ stroke: ${e.primaryColor};
56
+ fill: ${e.primaryColor};
57
+ }
58
+
59
+ .arrow { stroke-width: 8; stroke-linecap: round; fill: none}
60
+ .gitTitleText {
61
+ text-anchor: middle;
62
+ font-size: 18px;
63
+ fill: ${e.textColor};
64
+ }
65
+ `,`getStyles`)};export{je as diagram};
@@ -1 +1 @@
1
- import{V as e,_ as t,a as n,r}from"./_createAssigner-BmxrMTIs.js";import{a as i}from"./index-rODTN5ZH.js";import{D as a,S as o,a as s,i as c,n as l,r as u,s as d,t as f}from"./_baseUniq-CJGmJ2Kn.js";var p=r(function(e){return f(o(e,1,t,!0))}),m=`\0`,h=`\0`,g=``,_=class{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,`directed`)?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,`compound`)?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=n(void 0),this._defaultEdgeLabelFn=n(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[h]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(t){return e(t)||(t=n(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return a(this._nodes)}sources(){var e=this;return s(this.nodes(),function(t){return i(e._in[t])})}sinks(){var e=this;return s(this.nodes(),function(t){return i(e._out[t])})}setNodes(e,t){var n=arguments,r=this;return d(e,function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=h,this._children[e]={},this._children[h][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],d(this.children(e),e=>{this.setParent(e)}),delete this._children[e]),d(a(this._in[e]),t),delete this._in[e],delete this._preds[e],d(a(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(u(t))t=h;else{t+=``;for(var n=t;!u(n);n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==h)return t}}children(e){if(u(e)&&(e=h),this._isCompound){var t=this._children[e];if(t)return a(t)}else if(e===h)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return a(t)}successors(e){var t=this._sucs[e];if(t)return a(t)}neighbors(e){var t=this.predecessors(e);if(t)return p(t,this.successors(e))}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;d(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),d(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&d(t.nodes(),function(e){t.setParent(e,i(e))}),t}setDefaultEdgeLabel(t){return e(t)||(t=n(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return c(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return l(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,u(n)||(n=``+n);var o=b(this._isDirected,e,t,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(!u(n)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=x(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,v(this._preds[t],e),v(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?S(this._isDirected,arguments[0]):b(this._isDirected,e,t,n);return this._edgeLabels[r]}hasEdge(e,t,n){var r=arguments.length===1?S(this._isDirected,arguments[0]):b(this._isDirected,e,t,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?S(this._isDirected,arguments[0]):b(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],y(this._preds[t],e),y(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=c(n);return t?s(r,function(e){return e.v===t}):r}}outEdges(e,t){var n=this._out[e];if(n){var r=c(n);return t?s(r,function(e){return e.w===t}):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};_.prototype._nodeCount=0,_.prototype._edgeCount=0;function v(e,t){e[t]?e[t]++:e[t]=1}function y(e,t){--e[t]||delete e[t]}function b(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+g+a+g+(u(r)?m:r)}function x(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function S(e,t){return b(e,t.v,t.w,t.name)}export{_ as t};
1
+ import{V as e,_ as t,a as n,r}from"./_createAssigner-BmxrMTIs.js";import{a as i}from"./index-D8W5OEji.js";import{D as a,S as o,a as s,i as c,n as l,r as u,s as d,t as f}from"./_baseUniq-BGPNLZq7.js";var p=r(function(e){return f(o(e,1,t,!0))}),m=`\0`,h=`\0`,g=``,_=class{constructor(e={}){this._isDirected=Object.prototype.hasOwnProperty.call(e,`directed`)?e.directed:!0,this._isMultigraph=Object.prototype.hasOwnProperty.call(e,`multigraph`)?e.multigraph:!1,this._isCompound=Object.prototype.hasOwnProperty.call(e,`compound`)?e.compound:!1,this._label=void 0,this._defaultNodeLabelFn=n(void 0),this._defaultEdgeLabelFn=n(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[h]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(t){return e(t)||(t=n(t)),this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return a(this._nodes)}sources(){var e=this;return s(this.nodes(),function(t){return i(e._in[t])})}sinks(){var e=this;return s(this.nodes(),function(t){return i(e._out[t])})}setNodes(e,t){var n=arguments,r=this;return d(e,function(e){n.length>1?r.setNode(e,t):r.setNode(e)}),this}setNode(e,t){return Object.prototype.hasOwnProperty.call(this._nodes,e)?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=h,this._children[e]={},this._children[h][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.prototype.hasOwnProperty.call(this._nodes,e)}removeNode(e){if(Object.prototype.hasOwnProperty.call(this._nodes,e)){var t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],d(this.children(e),e=>{this.setParent(e)}),delete this._children[e]),d(a(this._in[e]),t),delete this._in[e],delete this._preds[e],d(a(this._out[e]),t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(u(t))t=h;else{t+=``;for(var n=t;!u(n);n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(e){if(this._isCompound){var t=this._parent[e];if(t!==h)return t}}children(e){if(u(e)&&(e=h),this._isCompound){var t=this._children[e];if(t)return a(t)}else if(e===h)return this.nodes();else if(this.hasNode(e))return[]}predecessors(e){var t=this._preds[e];if(t)return a(t)}successors(e){var t=this._sucs[e];if(t)return a(t)}neighbors(e){var t=this.predecessors(e);if(t)return p(t,this.successors(e))}isLeaf(e){return(this.isDirected()?this.successors(e):this.neighbors(e)).length===0}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;d(this._nodes,function(n,r){e(r)&&t.setNode(r,n)}),d(this._edgeObjs,function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var r={};function i(e){var a=n.parent(e);return a===void 0||t.hasNode(a)?(r[e]=a,a):a in r?r[a]:i(a)}return this._isCompound&&d(t.nodes(),function(e){t.setParent(e,i(e))}),t}setDefaultEdgeLabel(t){return e(t)||(t=n(t)),this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return c(this._edgeObjs)}setPath(e,t){var n=this,r=arguments;return l(e,function(e,i){return r.length>1?n.setEdge(e,i,t):n.setEdge(e,i),i}),this}setEdge(){var e,t,n,r,i=!1,a=arguments[0];typeof a==`object`&&a&&`v`in a?(e=a.v,t=a.w,n=a.name,arguments.length===2&&(r=arguments[1],i=!0)):(e=a,t=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),e=``+e,t=``+t,u(n)||(n=``+n);var o=b(this._isDirected,e,t,n);if(Object.prototype.hasOwnProperty.call(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(!u(n)&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(e),this.setNode(t),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(e,t,n);var s=x(this._isDirected,e,t,n);return e=s.v,t=s.w,Object.freeze(s),this._edgeObjs[o]=s,v(this._preds[t],e),v(this._sucs[e],t),this._in[t][o]=s,this._out[e][o]=s,this._edgeCount++,this}edge(e,t,n){var r=arguments.length===1?S(this._isDirected,arguments[0]):b(this._isDirected,e,t,n);return this._edgeLabels[r]}hasEdge(e,t,n){var r=arguments.length===1?S(this._isDirected,arguments[0]):b(this._isDirected,e,t,n);return Object.prototype.hasOwnProperty.call(this._edgeLabels,r)}removeEdge(e,t,n){var r=arguments.length===1?S(this._isDirected,arguments[0]):b(this._isDirected,e,t,n),i=this._edgeObjs[r];return i&&(e=i.v,t=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],y(this._preds[t],e),y(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var r=c(n);return t?s(r,function(e){return e.v===t}):r}}outEdges(e,t){var n=this._out[e];if(n){var r=c(n);return t?s(r,function(e){return e.w===t}):r}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}};_.prototype._nodeCount=0,_.prototype._edgeCount=0;function v(e,t){e[t]?e[t]++:e[t]=1}function y(e,t){--e[t]||delete e[t]}function b(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}return i+g+a+g+(u(r)?m:r)}function x(e,t,n,r){var i=``+t,a=``+n;if(!e&&i>a){var o=i;i=a,a=o}var s={v:i,w:a};return r&&(s.name=r),s}function S(e,t){return b(e,t.v,t.w,t.name)}export{_ as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CFjPhJqf.js";import{h as t,m as n,n as r,r as i,t as a}from"./index-rODTN5ZH.js";var o=e(t(),1),s=n(),c=({code:e,language:t,raw:n,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(i),p=r(),[m,h]=(0,o.useState)(n);return(0,o.useEffect)(()=>{if(!p){h(n);return}let r=p.highlight({code:e,language:t,themes:f},e=>{h(e)});r&&h(r)},[e,t,f,p,n]),(0,s.jsx)(a,{className:c,language:t,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};
1
+ import{o as e}from"./chunk-CFjPhJqf.js";import{h as t,m as n,n as r,r as i,t as a}from"./index-D8W5OEji.js";var o=e(t(),1),s=n(),c=({code:e,language:t,raw:n,className:c,startLine:l,lineNumbers:u,...d})=>{let{shikiTheme:f}=(0,o.useContext)(i),p=r(),[m,h]=(0,o.useState)(n);return(0,o.useEffect)(()=>{if(!p){h(n);return}let r=p.highlight({code:e,language:t,themes:f},e=>{h(e)});r&&h(r)},[e,t,f,p,n]),(0,s.jsx)(a,{className:c,language:t,lineNumbers:u,result:m,startLine:l,...d})};export{c as HighlightedCodeBlockBody};