UNPKG

@eventcatalogtest/studio

Version:

A drag and drop UI for distributed systems that keeps your diagrams where they belong – in your repo

63 lines (60 loc) 24.4 kB
"use strict";exports.id=7039,exports.ids=[7039],exports.modules={51734:(a,b,c)=>{c.d(b,{m:()=>e});var d=c(32892),e=class{constructor(a){this.init=a,this.records=this.init()}static{(0,d.K2)(this,"ImperativeState")}reset(){this.records=this.init()}}},57039:(a,b,c)=>{c.d(b,{diagram:()=>aq});var d=c(87124),e=c(51734),f=c(65299),g=c(32892),h=c(66689),i=c(38073),j={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},k=g.UI.gitGraph,l=(0,g.K2)(()=>(0,f.$t)({...k,...(0,g.zj)().gitGraph}),"getConfig"),m=new e.m(()=>{let a=l(),b=a.mainBranchName,c=a.mainBranchOrder;return{mainBranchName:b,commits:new Map,head:null,branchConfig:new Map([[b,{name:b,order:c}]]),branches:new Map([[b,null]]),currBranch:b,direction:"LR",seq:0,options:{}}});function n(){return(0,f.yT)({length:7})}function o(a,b){let c=Object.create(null);return a.reduce((a,d)=>{let e=b(d);return c[e]||(c[e]=!0,a.push(d)),a},[])}(0,g.K2)(n,"getID"),(0,g.K2)(o,"uniqBy");var p=(0,g.K2)(function(a){m.records.direction=a},"setDirection"),q=(0,g.K2)(function(a){g.Rm.debug("options str",a),a=(a=a?.trim())||"{}";try{m.records.options=JSON.parse(a)}catch(a){g.Rm.error("error while parsing gitGraph options",a.message)}},"setOptions"),r=(0,g.K2)(function(){return m.records.options},"getOptions"),s=(0,g.K2)(function(a){let b=a.msg,c=a.id,d=a.type,e=a.tags;g.Rm.info("commit",b,c,d,e),g.Rm.debug("Entering commit:",b,c,d,e);let f=l();c=g.Y2.sanitizeText(c,f),b=g.Y2.sanitizeText(b,f),e=e?.map(a=>g.Y2.sanitizeText(a,f));let h={id:c||m.records.seq+"-"+n(),message:b,seq:m.records.seq++,type:d??j.NORMAL,tags:e??[],parents:null==m.records.head?[]:[m.records.head.id],branch:m.records.currBranch};m.records.head=h,g.Rm.info("main branch",f.mainBranchName),m.records.commits.has(h.id)&&g.Rm.warn(`Commit ID ${h.id} already exists`),m.records.commits.set(h.id,h),m.records.branches.set(m.records.currBranch,h.id),g.Rm.debug("in pushCommit "+h.id)},"commit"),t=(0,g.K2)(function(a){let b=a.name,c=a.order;if(b=g.Y2.sanitizeText(b,l()),m.records.branches.has(b))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 ${b}")`);m.records.branches.set(b,null!=m.records.head?m.records.head.id:null),m.records.branchConfig.set(b,{name:b,order:c}),w(b),g.Rm.debug("in createBranch")},"branch"),u=(0,g.K2)(a=>{let b=a.branch,c=a.id,d=a.type,e=a.tags,f=l();b=g.Y2.sanitizeText(b,f),c&&(c=g.Y2.sanitizeText(c,f));let h=m.records.branches.get(m.records.currBranch),i=m.records.branches.get(b),k=h?m.records.commits.get(h):void 0,o=i?m.records.commits.get(i):void 0;if(k&&o&&k.branch===b)throw Error(`Cannot merge branch '${b}' into itself.`);if(m.records.currBranch===b){let a=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw a.hash={text:`merge ${b}`,token:`merge ${b}`,expected:["branch abc"]},a}if(void 0===k||!k){let a=Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw a.hash={text:`merge ${b}`,token:`merge ${b}`,expected:["commit"]},a}if(!m.records.branches.has(b)){let a=Error('Incorrect usage of "merge". Branch to be merged ('+b+") does not exist");throw a.hash={text:`merge ${b}`,token:`merge ${b}`,expected:[`branch ${b}`]},a}if(void 0===o||!o){let a=Error('Incorrect usage of "merge". Branch to be merged ('+b+") has no commits");throw a.hash={text:`merge ${b}`,token:`merge ${b}`,expected:['"commit"']},a}if(k===o){let a=Error('Incorrect usage of "merge". Both branches have same head');throw a.hash={text:`merge ${b}`,token:`merge ${b}`,expected:["branch abc"]},a}if(c&&m.records.commits.has(c)){let a=Error('Incorrect usage of "merge". Commit with id:'+c+" already exists, use different custom id");throw a.hash={text:`merge ${b} ${c} ${d} ${e?.join(" ")}`,token:`merge ${b} ${c} ${d} ${e?.join(" ")}`,expected:[`merge ${b} ${c}_UNIQUE ${d} ${e?.join(" ")}`]},a}let p={id:c||`${m.records.seq}-${n()}`,message:`merged branch ${b} into ${m.records.currBranch}`,seq:m.records.seq++,parents:null==m.records.head?[]:[m.records.head.id,i||""],branch:m.records.currBranch,type:j.MERGE,customType:d,customId:!!c,tags:e??[]};m.records.head=p,m.records.commits.set(p.id,p),m.records.branches.set(m.records.currBranch,p.id),g.Rm.debug(m.records.branches),g.Rm.debug("in mergeBranch")},"merge"),v=(0,g.K2)(function(a){let b=a.id,c=a.targetId,d=a.tags,e=a.parent;g.Rm.debug("Entering cherryPick:",b,c,d);let f=l();if(b=g.Y2.sanitizeText(b,f),c=g.Y2.sanitizeText(c,f),d=d?.map(a=>g.Y2.sanitizeText(a,f)),e=g.Y2.sanitizeText(e,f),!b||!m.records.commits.has(b)){let a=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw a.hash={text:`cherryPick ${b} ${c}`,token:`cherryPick ${b} ${c}`,expected:["cherry-pick abc"]},a}let h=m.records.commits.get(b);if(void 0===h||!h)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(e&&!(Array.isArray(h.parents)&&h.parents.includes(e)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let i=h.branch;if(h.type===j.MERGE&&!e)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!c||!m.records.commits.has(c)){if(i===m.records.currBranch){let a=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw a.hash={text:`cherryPick ${b} ${c}`,token:`cherryPick ${b} ${c}`,expected:["cherry-pick abc"]},a}let a=m.records.branches.get(m.records.currBranch);if(void 0===a||!a){let a=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw a.hash={text:`cherryPick ${b} ${c}`,token:`cherryPick ${b} ${c}`,expected:["cherry-pick abc"]},a}let f=m.records.commits.get(a);if(void 0===f||!f){let a=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw a.hash={text:`cherryPick ${b} ${c}`,token:`cherryPick ${b} ${c}`,expected:["cherry-pick abc"]},a}let k={id:m.records.seq+"-"+n(),message:`cherry-picked ${h?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:null==m.records.head?[]:[m.records.head.id,h.id],branch:m.records.currBranch,type:j.CHERRY_PICK,tags:d?d.filter(Boolean):[`cherry-pick:${h.id}${h.type===j.MERGE?`|parent:${e}`:""}`]};m.records.head=k,m.records.commits.set(k.id,k),m.records.branches.set(m.records.currBranch,k.id),g.Rm.debug(m.records.branches),g.Rm.debug("in cherryPick")}},"cherryPick"),w=(0,g.K2)(function(a){if(a=g.Y2.sanitizeText(a,l()),m.records.branches.has(a)){m.records.currBranch=a;let b=m.records.branches.get(m.records.currBranch);void 0!==b&&b?m.records.head=m.records.commits.get(b)??null:m.records.head=null}else{let b=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${a}")`);throw b.hash={text:`checkout ${a}`,token:`checkout ${a}`,expected:[`branch ${a}`]},b}},"checkout");function x(a,b,c){let d=a.indexOf(b);-1===d?a.push(c):a.splice(d,1,c)}function y(a){let b=a.reduce((a,b)=>a.seq>b.seq?a:b,a[0]),c="";a.forEach(function(a){a===b?c+=" *":c+=" |"});let d=[c,b.id,b.seq];for(let a in m.records.branches)m.records.branches.get(a)===b.id&&d.push(a);if(g.Rm.debug(d.join(" ")),b.parents&&2==b.parents.length&&b.parents[0]&&b.parents[1]){let c=m.records.commits.get(b.parents[0]);x(a,b,c),b.parents[1]&&a.push(m.records.commits.get(b.parents[1]))}else if(0==b.parents.length)return;else if(b.parents[0]){let c=m.records.commits.get(b.parents[0]);x(a,b,c)}y(a=o(a,a=>a.id))}(0,g.K2)(x,"upsert"),(0,g.K2)(y,"prettyPrintCommitHistory");var z=(0,g.K2)(function(){g.Rm.debug(m.records.commits),y([E()[0]])},"prettyPrint"),A=(0,g.K2)(function(){m.reset(),(0,g.IU)()},"clear"),B=(0,g.K2)(function(){return[...m.records.branchConfig.values()].map((a,b)=>null!==a.order&&void 0!==a.order?a:{...a,order:parseFloat(`0.${b}`)}).sort((a,b)=>(a.order??0)-(b.order??0)).map(({name:a})=>({name:a}))},"getBranchesAsObjArray"),C=(0,g.K2)(function(){return m.records.branches},"getBranches"),D=(0,g.K2)(function(){return m.records.commits},"getCommits"),E=(0,g.K2)(function(){let a=[...m.records.commits.values()];return a.forEach(function(a){g.Rm.debug(a.id)}),a.sort((a,b)=>a.seq-b.seq),a},"getCommitsArray"),F={commitType:j,getConfig:l,setDirection:p,setOptions:q,getOptions:r,commit:s,branch:t,merge:u,cherryPick:v,checkout:w,prettyPrint:z,clear:A,getBranchesAsObjArray:B,getBranches:C,getCommits:D,getCommitsArray:E,getCurrentBranch:(0,g.K2)(function(){return m.records.currBranch},"getCurrentBranch"),getDirection:(0,g.K2)(function(){return m.records.direction},"getDirection"),getHead:(0,g.K2)(function(){return m.records.head},"getHead"),setAccTitle:g.SV,getAccTitle:g.iN,getAccDescription:g.m7,setAccDescription:g.EI,setDiagramTitle:g.ke,getDiagramTitle:g.ab},G=(0,g.K2)((a,b)=>{for(let c of((0,d.S)(a,b),a.dir&&b.setDirection(a.dir),a.statements))H(c,b)},"populate"),H=(0,g.K2)((a,b)=>{let c={Commit:(0,g.K2)(a=>b.commit(I(a)),"Commit"),Branch:(0,g.K2)(a=>b.branch(J(a)),"Branch"),Merge:(0,g.K2)(a=>b.merge(K(a)),"Merge"),Checkout:(0,g.K2)(a=>b.checkout(L(a)),"Checkout"),CherryPicking:(0,g.K2)(a=>b.cherryPick(M(a)),"CherryPicking")}[a.$type];c?c(a):g.Rm.error(`Unknown statement type: ${a.$type}`)},"parseStatement"),I=(0,g.K2)(a=>({id:a.id,msg:a.message??"",type:void 0!==a.type?j[a.type]:j.NORMAL,tags:a.tags??void 0}),"parseCommit"),J=(0,g.K2)(a=>({name:a.name,order:a.order??0}),"parseBranch"),K=(0,g.K2)(a=>({branch:a.branch,id:a.id??"",type:void 0!==a.type?j[a.type]:void 0,tags:a.tags??void 0}),"parseMerge"),L=(0,g.K2)(a=>a.branch,"parseCheckout"),M=(0,g.K2)(a=>({id:a.id,targetId:"",tags:a.tags?.length===0?void 0:a.tags,parent:a.parent}),"parseCherryPicking"),N={parse:(0,g.K2)(async a=>{let b=await (0,h.qg)("gitGraph",a);g.Rm.debug(b),G(b,F)},"parse")},O=(0,g.D7)(),P=O?.gitGraph,Q=new Map,R=new Map,S=new Map,T=[],U=0,V="LR",W=(0,g.K2)(()=>{Q.clear(),R.clear(),S.clear(),U=0,T=[],V="LR"},"clear"),X=(0,g.K2)(a=>{let b=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof a?a.split(/\\n|\n|<br\s*\/?>/gi):a).forEach(a=>{let c=document.createElementNS("http://www.w3.org/2000/svg","tspan");c.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),c.setAttribute("dy","1em"),c.setAttribute("x","0"),c.setAttribute("class","row"),c.textContent=a.trim(),b.appendChild(c)}),b},"drawText"),Y=(0,g.K2)(a=>{let b,c,d;return"BT"===V?(c=(0,g.K2)((a,b)=>a<=b,"comparisonFunc"),d=1/0):(c=(0,g.K2)((a,b)=>a>=b,"comparisonFunc"),d=0),a.forEach(a=>{let e="TB"===V||"BT"==V?R.get(a)?.y:R.get(a)?.x;void 0!==e&&c(e,d)&&(b=a,d=e)}),b},"findClosestParent"),Z=(0,g.K2)(a=>{let b="",c=1/0;return a.forEach(a=>{let d=R.get(a).y;d<=c&&(b=a,c=d)}),b||void 0},"findClosestParentBT"),$=(0,g.K2)((a,b,c)=>{let d=c,e=c,f=[];a.forEach(a=>{let c=b.get(a);if(!c)throw Error(`Commit not found for key ${a}`);c.parents.length?e=Math.max(d=aa(c),e):f.push(c),ab(c,d)}),d=e,f.forEach(a=>{ac(a,d,c)}),a.forEach(a=>{let c=b.get(a);if(c?.parents.length){let a=Z(c.parents);(d=R.get(a).y-40)<=e&&(e=d);let b=Q.get(c.branch).pos,f=d-10;R.set(c.id,{x:b,y:f})}})},"setParallelBTPos"),_=(0,g.K2)(a=>{let b=Y(a.parents.filter(a=>null!==a));if(!b)throw Error(`Closest parent not found for commit ${a.id}`);let c=R.get(b)?.y;if(void 0===c)throw Error(`Closest parent position not found for commit ${a.id}`);return c},"findClosestParentPos"),aa=(0,g.K2)(a=>_(a)+40,"calculateCommitPosition"),ab=(0,g.K2)((a,b)=>{let c=Q.get(a.branch);if(!c)throw Error(`Branch not found for commit ${a.id}`);let d=c.pos,e=b+10;return R.set(a.id,{x:d,y:e}),{x:d,y:e}},"setCommitPosition"),ac=(0,g.K2)((a,b,c)=>{let d=Q.get(a.branch);if(!d)throw Error(`Branch not found for commit ${a.id}`);let e=d.pos;R.set(a.id,{x:e,y:b+c})},"setRootPosition"),ad=(0,g.K2)((a,b,c,d,e,f)=>{if(f===j.HIGHLIGHT)a.append("rect").attr("x",c.x-10).attr("y",c.y-10).attr("width",20).attr("height",20).attr("class",`commit ${b.id} commit-highlight${e%8} ${d}-outer`),a.append("rect").attr("x",c.x-6).attr("y",c.y-6).attr("width",12).attr("height",12).attr("class",`commit ${b.id} commit${e%8} ${d}-inner`);else if(f===j.CHERRY_PICK)a.append("circle").attr("cx",c.x).attr("cy",c.y).attr("r",10).attr("class",`commit ${b.id} ${d}`),a.append("circle").attr("cx",c.x-3).attr("cy",c.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${b.id} ${d}`),a.append("circle").attr("cx",c.x+3).attr("cy",c.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${b.id} ${d}`),a.append("line").attr("x1",c.x+3).attr("y1",c.y+1).attr("x2",c.x).attr("y2",c.y-5).attr("stroke","#fff").attr("class",`commit ${b.id} ${d}`),a.append("line").attr("x1",c.x-3).attr("y1",c.y+1).attr("x2",c.x).attr("y2",c.y-5).attr("stroke","#fff").attr("class",`commit ${b.id} ${d}`);else{let g=a.append("circle");if(g.attr("cx",c.x),g.attr("cy",c.y),g.attr("r",b.type===j.MERGE?9:10),g.attr("class",`commit ${b.id} commit${e%8}`),f===j.MERGE){let f=a.append("circle");f.attr("cx",c.x),f.attr("cy",c.y),f.attr("r",6),f.attr("class",`commit ${d} ${b.id} commit${e%8}`)}f===j.REVERSE&&a.append("path").attr("d",`M ${c.x-5},${c.y-5}L${c.x+5},${c.y+5}M${c.x-5},${c.y+5}L${c.x+5},${c.y-5}`).attr("class",`commit ${d} ${b.id} commit${e%8}`)}},"drawCommitBullet"),ae=(0,g.K2)((a,b,c,d)=>{if(b.type!==j.CHERRY_PICK&&(b.customId&&b.type===j.MERGE||b.type!==j.MERGE)&&P?.showCommitLabel){let e=a.append("g"),f=e.insert("rect").attr("class","commit-label-bkg"),g=e.append("text").attr("x",d).attr("y",c.y+25).attr("class","commit-label").text(b.id),h=g.node()?.getBBox();if(h&&(f.attr("x",c.posWithOffset-h.width/2-2).attr("y",c.y+13.5).attr("width",h.width+4).attr("height",h.height+4),"TB"===V||"BT"===V?(f.attr("x",c.x-(h.width+16+5)).attr("y",c.y-12),g.attr("x",c.x-(h.width+16)).attr("y",c.y+h.height-12)):g.attr("x",c.posWithOffset-h.width/2),P.rotateCommitLabel))if("TB"===V||"BT"===V)g.attr("transform","rotate(-45, "+c.x+", "+c.y+")"),f.attr("transform","rotate(-45, "+c.x+", "+c.y+")");else{let a=-7.5-(h.width+10)/25*9.5,b=10+h.width/25*8.5;e.attr("transform","translate("+a+", "+b+") rotate(-45, "+d+", "+c.y+")")}}},"drawCommitLabel"),af=(0,g.K2)((a,b,c,d)=>{if(b.tags.length>0){let e=0,f=0,g=0,h=[];for(let d of b.tags.reverse()){let b=a.insert("polygon"),i=a.append("circle"),j=a.append("text").attr("y",c.y-16-e).attr("class","tag-label").text(d),k=j.node()?.getBBox();if(!k)throw Error("Tag bbox not found");f=Math.max(f,k.width),g=Math.max(g,k.height),j.attr("x",c.posWithOffset-k.width/2),h.push({tag:j,hole:i,rect:b,yOffset:e}),e+=20}for(let{tag:a,hole:b,rect:e,yOffset:i}of h){let h=g/2,j=c.y-19.2-i;if(e.attr("class","tag-label-bkg").attr("points",` ${d-f/2-2},${j+2} ${d-f/2-2},${j-2} ${c.posWithOffset-f/2-4},${j-h-2} ${c.posWithOffset+f/2+4},${j-h-2} ${c.posWithOffset+f/2+4},${j+h+2} ${c.posWithOffset-f/2-4},${j+h+2}`),b.attr("cy",j).attr("cx",d-f/2+2).attr("r",1.5).attr("class","tag-hole"),"TB"===V||"BT"===V){let g=d+i;e.attr("class","tag-label-bkg").attr("points",` ${c.x},${g+2} ${c.x},${g-2} ${c.x+10},${g-h-2} ${c.x+10+f+4},${g-h-2} ${c.x+10+f+4},${g+h+2} ${c.x+10},${g+h+2}`).attr("transform","translate(12,12) rotate(45, "+c.x+","+d+")"),b.attr("cx",c.x+2).attr("cy",g).attr("transform","translate(12,12) rotate(45, "+c.x+","+d+")"),a.attr("x",c.x+5).attr("y",g+3).attr("transform","translate(14,14) rotate(45, "+c.x+","+d+")")}}}},"drawCommitTags"),ag=(0,g.K2)(a=>{switch(a.customType??a.type){case j.NORMAL:return"commit-normal";case j.REVERSE:return"commit-reverse";case j.HIGHLIGHT:return"commit-highlight";case j.MERGE:return"commit-merge";case j.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),ah=(0,g.K2)((a,b,c,d)=>{let e={x:0,y:0};if(a.parents.length>0){let c=Y(a.parents);if(c){let f=d.get(c)??e;return"TB"===b?f.y+40:"BT"===b?(d.get(a.id)??e).y-40:f.x+40}}else if("TB"===b)return 30;else if("BT"===b)return(d.get(a.id)??e).y-40;return 0},"calculatePosition"),ai=(0,g.K2)((a,b,c)=>{let d="BT"===V&&c?b:b+10,e="TB"===V||"BT"===V?d:Q.get(a.branch)?.pos,f="TB"===V||"BT"===V?Q.get(a.branch)?.pos:d;if(void 0===f||void 0===e)throw Error(`Position were undefined for commit ${a.id}`);return{x:f,y:e,posWithOffset:d}},"getCommitPosition"),aj=(0,g.K2)((a,b,c)=>{if(!P)throw Error("GitGraph config not found");let d=a.append("g").attr("class","commit-bullets"),e=a.append("g").attr("class","commit-labels"),f=30*("TB"===V||"BT"===V),h=[...b.keys()],i=P?.parallelCommits??!1,j=h.sort((0,g.K2)((a,c)=>{let d=b.get(a)?.seq,e=b.get(c)?.seq;return void 0!==d&&void 0!==e?d-e:0},"sortKeys"));"BT"===V&&(i&&$(j,b,f),j=j.reverse()),j.forEach(a=>{let g=b.get(a);if(!g)throw Error(`Commit not found for key ${a}`);i&&(f=ah(g,V,f,R));let h=ai(g,f,i);if(c){let a=ag(g),b=g.customType??g.type,c=Q.get(g.branch)?.index??0;ad(d,g,h,a,c,b),ae(e,g,h,f),af(e,g,h,f)}"TB"===V||"BT"===V?R.set(g.id,{x:h.x,y:h.posWithOffset}):R.set(g.id,{x:h.posWithOffset,y:h.y}),(f="BT"===V&&i?f+40:f+40+10)>U&&(U=f)})},"drawCommits"),ak=(0,g.K2)((a,b,c,d,e)=>{let f=("TB"===V||"BT"===V?c.x<d.x:c.y<d.y)?b.branch:a.branch,h=(0,g.K2)(a=>a.branch===f,"isOnBranchToGetCurve"),i=(0,g.K2)(c=>c.seq>a.seq&&c.seq<b.seq,"isBetweenCommits");return[...e.values()].some(a=>i(a)&&h(a))},"shouldRerouteArrow"),al=(0,g.K2)((a,b,c=0)=>{let d=a+Math.abs(a-b)/2;if(c>5)return d;if(T.every(a=>Math.abs(a-d)>=10))return T.push(d),d;let e=Math.abs(a-b);return al(a,b-e/5,c+1)},"findLane"),am=(0,g.K2)((a,b,c,d)=>{let e,f=R.get(b.id),g=R.get(c.id);if(void 0===f||void 0===g)throw Error(`Commit positions not found for commits ${b.id} and ${c.id}`);let h=ak(b,c,f,g,d),i="",k="",l=0,m=0,n=Q.get(c.branch)?.index;if(c.type===j.MERGE&&b.id!==c.parents[0]&&(n=Q.get(b.branch)?.index),h){i="A 10 10, 0, 0, 0,",k="A 10 10, 0, 0, 1,",l=10,m=10;let a=f.y<g.y?al(f.y,g.y):al(g.y,f.y),c=f.x<g.x?al(f.x,g.x):al(g.x,f.x);"TB"===V?f.x<g.x?e=`M ${f.x} ${f.y} L ${c-l} ${f.y} ${k} ${c} ${f.y+m} L ${c} ${g.y-l} ${i} ${c+m} ${g.y} L ${g.x} ${g.y}`:(n=Q.get(b.branch)?.index,e=`M ${f.x} ${f.y} L ${c+l} ${f.y} ${i} ${c} ${f.y+m} L ${c} ${g.y-l} ${k} ${c-m} ${g.y} L ${g.x} ${g.y}`):"BT"===V?f.x<g.x?e=`M ${f.x} ${f.y} L ${c-l} ${f.y} ${i} ${c} ${f.y-m} L ${c} ${g.y+l} ${k} ${c+m} ${g.y} L ${g.x} ${g.y}`:(n=Q.get(b.branch)?.index,e=`M ${f.x} ${f.y} L ${c+l} ${f.y} ${k} ${c} ${f.y-m} L ${c} ${g.y+l} ${i} ${c-m} ${g.y} L ${g.x} ${g.y}`):f.y<g.y?e=`M ${f.x} ${f.y} L ${f.x} ${a-l} ${i} ${f.x+m} ${a} L ${g.x-l} ${a} ${k} ${g.x} ${a+m} L ${g.x} ${g.y}`:(n=Q.get(b.branch)?.index,e=`M ${f.x} ${f.y} L ${f.x} ${a+l} ${k} ${f.x+m} ${a} L ${g.x-l} ${a} ${i} ${g.x} ${a-m} L ${g.x} ${g.y}`)}else i="A 20 20, 0, 0, 0,",k="A 20 20, 0, 0, 1,",l=20,m=20,"TB"===V?(f.x<g.x&&(e=c.type===j.MERGE&&b.id!==c.parents[0]?`M ${f.x} ${f.y} L ${f.x} ${g.y-l} ${i} ${f.x+m} ${g.y} L ${g.x} ${g.y}`:`M ${f.x} ${f.y} L ${g.x-l} ${f.y} ${k} ${g.x} ${f.y+m} L ${g.x} ${g.y}`),f.x>g.x&&(i="A 20 20, 0, 0, 0,",k="A 20 20, 0, 0, 1,",l=20,m=20,e=c.type===j.MERGE&&b.id!==c.parents[0]?`M ${f.x} ${f.y} L ${f.x} ${g.y-l} ${k} ${f.x-m} ${g.y} L ${g.x} ${g.y}`:`M ${f.x} ${f.y} L ${g.x+l} ${f.y} ${i} ${g.x} ${f.y+m} L ${g.x} ${g.y}`),f.x===g.x&&(e=`M ${f.x} ${f.y} L ${g.x} ${g.y}`)):"BT"===V?(f.x<g.x&&(e=c.type===j.MERGE&&b.id!==c.parents[0]?`M ${f.x} ${f.y} L ${f.x} ${g.y+l} ${k} ${f.x+m} ${g.y} L ${g.x} ${g.y}`:`M ${f.x} ${f.y} L ${g.x-l} ${f.y} ${i} ${g.x} ${f.y-m} L ${g.x} ${g.y}`),f.x>g.x&&(i="A 20 20, 0, 0, 0,",k="A 20 20, 0, 0, 1,",l=20,m=20,e=c.type===j.MERGE&&b.id!==c.parents[0]?`M ${f.x} ${f.y} L ${f.x} ${g.y+l} ${i} ${f.x-m} ${g.y} L ${g.x} ${g.y}`:`M ${f.x} ${f.y} L ${g.x-l} ${f.y} ${i} ${g.x} ${f.y-m} L ${g.x} ${g.y}`),f.x===g.x&&(e=`M ${f.x} ${f.y} L ${g.x} ${g.y}`)):(f.y<g.y&&(e=c.type===j.MERGE&&b.id!==c.parents[0]?`M ${f.x} ${f.y} L ${g.x-l} ${f.y} ${k} ${g.x} ${f.y+m} L ${g.x} ${g.y}`:`M ${f.x} ${f.y} L ${f.x} ${g.y-l} ${i} ${f.x+m} ${g.y} L ${g.x} ${g.y}`),f.y>g.y&&(e=c.type===j.MERGE&&b.id!==c.parents[0]?`M ${f.x} ${f.y} L ${g.x-l} ${f.y} ${i} ${g.x} ${f.y-m} L ${g.x} ${g.y}`:`M ${f.x} ${f.y} L ${f.x} ${g.y+l} ${k} ${f.x+m} ${g.y} L ${g.x} ${g.y}`),f.y===g.y&&(e=`M ${f.x} ${f.y} L ${g.x} ${g.y}`));if(void 0===e)throw Error("Line definition not found");a.append("path").attr("d",e).attr("class","arrow arrow"+n%8)},"drawArrow"),an=(0,g.K2)((a,b)=>{let c=a.append("g").attr("class","commit-arrows");[...b.keys()].forEach(a=>{let d=b.get(a);d.parents&&d.parents.length>0&&d.parents.forEach(a=>{am(c,b.get(a),d,b)})})},"drawArrows"),ao=(0,g.K2)((a,b)=>{let c=a.append("g");b.forEach((a,b)=>{let d=b%8,e=Q.get(a.name)?.pos;if(void 0===e)throw Error(`Position not found for branch ${a.name}`);let f=c.append("line");f.attr("x1",0),f.attr("y1",e),f.attr("x2",U),f.attr("y2",e),f.attr("class","branch branch"+d),"TB"===V?(f.attr("y1",30),f.attr("x1",e),f.attr("y2",U),f.attr("x2",e)):"BT"===V&&(f.attr("y1",U),f.attr("x1",e),f.attr("y2",30),f.attr("x2",e)),T.push(e);let g=X(a.name),h=c.insert("rect"),i=c.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+d);i.node().appendChild(g);let j=g.getBBox();h.attr("class","branchLabelBkg label"+d).attr("rx",4).attr("ry",4).attr("x",-j.width-4-30*(P?.rotateCommitLabel===!0)).attr("y",-j.height/2+8).attr("width",j.width+18).attr("height",j.height+4),i.attr("transform","translate("+(-j.width-14-30*(P?.rotateCommitLabel===!0))+", "+(e-j.height/2-1)+")"),"TB"===V?(h.attr("x",e-j.width/2-10).attr("y",0),i.attr("transform","translate("+(e-j.width/2-5)+", 0)")):"BT"===V?(h.attr("x",e-j.width/2-10).attr("y",U),i.attr("transform","translate("+(e-j.width/2-5)+", "+U+")")):h.attr("transform","translate(-19, "+(e-j.height/2)+")")})},"drawBranches"),ap=(0,g.K2)(function(a,b,c,d,e){return Q.set(a,{pos:b,index:c}),b+=50+40*!!e+("TB"===V||"BT"===V?d.width/2:0)},"setBranchPosition"),aq={parser:N,db:F,renderer:{draw:(0,g.K2)(function(a,b,c,d){if(W(),g.Rm.debug("in gitgraph renderer",a+"\n","id:",b,c),!P)throw Error("GitGraph config not found");let e=P.rotateCommitLabel??!1,h=d.db;S=h.getCommits();let j=h.getBranchesAsObjArray();V=h.getDirection();let k=(0,i.Ltv)(`[id="${b}"]`),l=0;j.forEach((a,b)=>{let c=X(a.name),d=k.append("g"),f=d.insert("g").attr("class","branchLabel"),g=f.insert("g").attr("class","label branch-label");g.node()?.appendChild(c);let h=c.getBBox();l=ap(a.name,l,b,h,e),g.remove(),f.remove(),d.remove()}),aj(k,S,!1),P.showBranches&&ao(k,j),an(k,S),aj(k,S,!0),f._K.insertTitle(k,"gitTitleText",P.titleTopMargin??0,h.getDiagramTitle()),(0,g.mj)(void 0,k,P.diagramPadding,P.useMaxWidth)},"draw")},styles:(0,g.K2)(a=>` .commit-id, .commit-msg, .branch-label { fill: lightgrey; color: lightgrey; font-family: 'trebuchet ms', verdana, arial, sans-serif; font-family: var(--mermaid-font-family); } ${[0,1,2,3,4,5,6,7].map(b=>` .branch-label${b} { fill: ${a["gitBranchLabel"+b]}; } .commit${b} { stroke: ${a["git"+b]}; fill: ${a["git"+b]}; } .commit-highlight${b} { stroke: ${a["gitInv"+b]}; fill: ${a["gitInv"+b]}; } .label${b} { fill: ${a["git"+b]}; } .arrow${b} { stroke: ${a["git"+b]}; } `).join("\n")} .branch { stroke-width: 1; stroke: ${a.lineColor}; stroke-dasharray: 2; } .commit-label { font-size: ${a.commitLabelFontSize}; fill: ${a.commitLabelColor};} .commit-label-bkg { font-size: ${a.commitLabelFontSize}; fill: ${a.commitLabelBackground}; opacity: 0.5; } .tag-label { font-size: ${a.tagLabelFontSize}; fill: ${a.tagLabelColor};} .tag-label-bkg { fill: ${a.tagLabelBackground}; stroke: ${a.tagLabelBorder}; } .tag-hole { fill: ${a.textColor}; } .commit-merge { stroke: ${a.primaryColor}; fill: ${a.primaryColor}; } .commit-reverse { stroke: ${a.primaryColor}; fill: ${a.primaryColor}; stroke-width: 3; } .commit-highlight-outer { } .commit-highlight-inner { stroke: ${a.primaryColor}; fill: ${a.primaryColor}; } .arrow { stroke-width: 8; stroke-linecap: round; fill: none} .gitTitleText { text-anchor: middle; font-size: 18px; fill: ${a.textColor}; } `,"getStyles")}},87124:(a,b,c)=>{function d(a,b){a.accDescr&&b.setAccDescription?.(a.accDescr),a.accTitle&&b.setAccTitle?.(a.accTitle),a.title&&b.setDiagramTitle?.(a.title)}c.d(b,{S:()=>d}),(0,c(32892).K2)(d,"populateCommonDb")}};