@asyncapi/studio
Version:
One place that allows you to develop an AsyncAPI document, validate it, convert it to the latest version, preview the documentation and visualize the events flow.
63 lines (60 loc) • 24.4 kB
JavaScript
;(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7064],{76191:function(t,e,r){function a(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}r.d(e,{A:function(){return a}}),(0,r(61452).eW)(a,"populateCommonDb")},99947:function(t,e,r){r.d(e,{A:function(){return i}});var a=r(61452),i=class{constructor(t){this.init=t,this.records=this.init()}static{(0,a.eW)(this,"ImperativeState")}reset(){this.records=this.init()}}},83155:function(t,e,r){r.d(e,{diagram:function(){return ty}});var a=r(76191),i=r(99947),o=r(44828),c=r(76541),n=r(61452),s=r(22596),d=r(33433),h={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},l=c.vZ.gitGraph,$=(0,n.eW)(()=>(0,o.Rb)({...l,...(0,c.iE)().gitGraph}),"getConfig"),m=new i.A(()=>{let t=$(),e=t.mainBranchName,r=t.mainBranchOrder;return{mainBranchName:e,commits:new Map,head:null,branchConfig:new Map([[e,{name:e,order:r}]]),branches:new Map([[e,null]]),currBranch:e,direction:"LR",seq:0,options:{}}});function g(){return(0,o.MX)({length:7})}function y(t,e){let r=Object.create(null);return t.reduce((t,a)=>{let i=e(a);return r[i]||(r[i]=!0,t.push(a)),t},[])}(0,n.eW)(g,"getID"),(0,n.eW)(y,"uniqBy");var p=(0,n.eW)(function(t){m.records.direction=t},"setDirection"),x=(0,n.eW)(function(t){n.cM.debug("options str",t),t=(t=t?.trim())||"{}";try{m.records.options=JSON.parse(t)}catch(t){n.cM.error("error while parsing gitGraph options",t.message)}},"setOptions"),f=(0,n.eW)(function(){return m.records.options},"getOptions"),u=(0,n.eW)(function(t){let e=t.msg,r=t.id,a=t.type,i=t.tags;n.cM.info("commit",e,r,a,i),n.cM.debug("Entering commit:",e,r,a,i);let o=$();r=c.SY.sanitizeText(r,o),e=c.SY.sanitizeText(e,o),i=i?.map(t=>c.SY.sanitizeText(t,o));let s={id:r||m.records.seq+"-"+g(),message:e,seq:m.records.seq++,type:a??h.NORMAL,tags:i??[],parents:null==m.records.head?[]:[m.records.head.id],branch:m.records.currBranch};m.records.head=s,n.cM.info("main branch",o.mainBranchName),m.records.commits.has(s.id)&&n.cM.warn(`Commit ID ${s.id} already exists`),m.records.commits.set(s.id,s),m.records.branches.set(m.records.currBranch,s.id),n.cM.debug("in pushCommit "+s.id)},"commit"),b=(0,n.eW)(function(t){let e=t.name,r=t.order;if(e=c.SY.sanitizeText(e,$()),m.records.branches.has(e))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 ${e}")`);m.records.branches.set(e,null!=m.records.head?m.records.head.id:null),m.records.branchConfig.set(e,{name:e,order:r}),E(e),n.cM.debug("in createBranch")},"branch"),w=(0,n.eW)(t=>{let e=t.branch,r=t.id,a=t.type,i=t.tags,o=$();e=c.SY.sanitizeText(e,o),r&&(r=c.SY.sanitizeText(r,o));let s=m.records.branches.get(m.records.currBranch),d=m.records.branches.get(e),l=s?m.records.commits.get(s):void 0,y=d?m.records.commits.get(d):void 0;if(l&&y&&l.branch===e)throw Error(`Cannot merge branch '${e}' into itself.`);if(m.records.currBranch===e){let t=Error('Incorrect usage of "merge". Cannot merge a branch to itself');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(void 0===l||!l){let t=Error(`Incorrect usage of "merge". Current branch (${m.records.currBranch})has no commits`);throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]},t}if(!m.records.branches.has(e)){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") does not exist");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:[`branch ${e}`]},t}if(void 0===y||!y){let t=Error('Incorrect usage of "merge". Branch to be merged ('+e+") has no commits");throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:['"commit"']},t}if(l===y){let t=Error('Incorrect usage of "merge". Both branches have same head');throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["branch abc"]},t}if(r&&m.records.commits.has(r)){let t=Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw t.hash={text:`merge ${e} ${r} ${a} ${i?.join(" ")}`,token:`merge ${e} ${r} ${a} ${i?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${a} ${i?.join(" ")}`]},t}let p={id:r||`${m.records.seq}-${g()}`,message:`merged branch ${e} into ${m.records.currBranch}`,seq:m.records.seq++,parents:null==m.records.head?[]:[m.records.head.id,d||""],branch:m.records.currBranch,type:h.MERGE,customType:a,customId:!!r,tags:i??[]};m.records.head=p,m.records.commits.set(p.id,p),m.records.branches.set(m.records.currBranch,p.id),n.cM.debug(m.records.branches),n.cM.debug("in mergeBranch")},"merge"),B=(0,n.eW)(function(t){let e=t.id,r=t.targetId,a=t.tags,i=t.parent;n.cM.debug("Entering cherryPick:",e,r,a);let o=$();if(e=c.SY.sanitizeText(e,o),r=c.SY.sanitizeText(r,o),a=a?.map(t=>c.SY.sanitizeText(t,o)),i=c.SY.sanitizeText(i,o),!e||!m.records.commits.has(e)){let t=Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let s=m.records.commits.get(e);if(void 0===s||!s)throw Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(i&&!(Array.isArray(s.parents)&&s.parents.includes(i)))throw Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");let d=s.branch;if(s.type===h.MERGE&&!i)throw Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!m.records.commits.has(r)){if(d===m.records.currBranch){let t=Error('Incorrect usage of "cherryPick". Source commit is already on current branch');throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let t=m.records.branches.get(m.records.currBranch);if(void 0===t||!t){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let o=m.records.commits.get(t);if(void 0===o||!o){let t=Error(`Incorrect usage of "cherry-pick". Current branch (${m.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}let c={id:m.records.seq+"-"+g(),message:`cherry-picked ${s?.message} into ${m.records.currBranch}`,seq:m.records.seq++,parents:null==m.records.head?[]:[m.records.head.id,s.id],branch:m.records.currBranch,type:h.CHERRY_PICK,tags:a?a.filter(Boolean):[`cherry-pick:${s.id}${s.type===h.MERGE?`|parent:${i}`:""}`]};m.records.head=c,m.records.commits.set(c.id,c),m.records.branches.set(m.records.currBranch,c.id),n.cM.debug(m.records.branches),n.cM.debug("in cherryPick")}},"cherryPick"),E=(0,n.eW)(function(t){if(t=c.SY.sanitizeText(t,$()),m.records.branches.has(t)){m.records.currBranch=t;let e=m.records.branches.get(m.records.currBranch);void 0!==e&&e?m.records.head=m.records.commits.get(e)??null:m.records.head=null}else{let e=Error(`Trying to checkout branch which is not yet created. (Help try using "branch ${t}")`);throw e.hash={text:`checkout ${t}`,token:`checkout ${t}`,expected:[`branch ${t}`]},e}},"checkout");function C(t,e,r){let a=t.indexOf(e);-1===a?t.push(r):t.splice(a,1,r)}function M(t){let e=t.reduce((t,e)=>t.seq>e.seq?t:e,t[0]),r="";t.forEach(function(t){t===e?r+=" *":r+=" |"});let a=[r,e.id,e.seq];for(let t in m.records.branches)m.records.branches.get(t)===e.id&&a.push(t);if(n.cM.debug(a.join(" ")),e.parents&&2==e.parents.length&&e.parents[0]&&e.parents[1]){let r=m.records.commits.get(e.parents[0]);C(t,e,r),e.parents[1]&&t.push(m.records.commits.get(e.parents[1]))}else if(0==e.parents.length)return;else if(e.parents[0]){let r=m.records.commits.get(e.parents[0]);C(t,e,r)}M(t=y(t,t=>t.id))}(0,n.eW)(C,"upsert"),(0,n.eW)(M,"prettyPrintCommitHistory");var k=(0,n.eW)(function(){n.cM.debug(m.records.commits),M([R()[0]])},"prettyPrint"),L=(0,n.eW)(function(){m.reset(),(0,c.ZH)()},"clear"),T=(0,n.eW)(function(){return[...m.records.branchConfig.values()].map((t,e)=>null!==t.order&&void 0!==t.order?t:{...t,order:parseFloat(`0.${e}`)}).sort((t,e)=>(t.order??0)-(e.order??0)).map(({name:t})=>({name:t}))},"getBranchesAsObjArray"),W=(0,n.eW)(function(){return m.records.branches},"getBranches"),v=(0,n.eW)(function(){return m.records.commits},"getCommits"),R=(0,n.eW)(function(){let t=[...m.records.commits.values()];return t.forEach(function(t){n.cM.debug(t.id)}),t.sort((t,e)=>t.seq-e.seq),t},"getCommitsArray"),P={commitType:h,getConfig:$,setDirection:p,setOptions:x,getOptions:f,commit:u,branch:b,merge:w,cherryPick:B,checkout:E,prettyPrint:k,clear:L,getBranchesAsObjArray:T,getBranches:W,getCommits:v,getCommitsArray:R,getCurrentBranch:(0,n.eW)(function(){return m.records.currBranch},"getCurrentBranch"),getDirection:(0,n.eW)(function(){return m.records.direction},"getDirection"),getHead:(0,n.eW)(function(){return m.records.head},"getHead"),setAccTitle:c.GN,getAccTitle:c.eu,getAccDescription:c.Mx,setAccDescription:c.U$,setDiagramTitle:c.g2,getDiagramTitle:c.Kr},A=(0,n.eW)((t,e)=>{for(let r of((0,a.A)(t,e),t.dir&&e.setDirection(t.dir),t.statements))I(r,e)},"populate"),I=(0,n.eW)((t,e)=>{let r={Commit:(0,n.eW)(t=>e.commit(G(t)),"Commit"),Branch:(0,n.eW)(t=>e.branch(S(t)),"Branch"),Merge:(0,n.eW)(t=>e.merge(O(t)),"Merge"),Checkout:(0,n.eW)(t=>e.checkout(q(t)),"Checkout"),CherryPicking:(0,n.eW)(t=>e.cherryPick(H(t)),"CherryPicking")}[t.$type];r?r(t):n.cM.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),G=(0,n.eW)(t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?h[t.type]:h.NORMAL,tags:t.tags??void 0}),"parseCommit"),S=(0,n.eW)(t=>({name:t.name,order:t.order??0}),"parseBranch"),O=(0,n.eW)(t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?h[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),q=(0,n.eW)(t=>t.branch,"parseCheckout"),H=(0,n.eW)(t=>({id:t.id,targetId:"",tags:t.tags?.length===0?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),z={parse:(0,n.eW)(async t=>{let e=await (0,s.Qc)("gitGraph",t);n.cM.debug(e),A(e,P)},"parse")},D=new Map,Y=new Map,N=new Map,_=[],j=0,K="LR",F=(0,n.eW)(()=>{D.clear(),Y.clear(),N.clear(),j=0,_=[],K="LR"},"clear"),U=(0,n.eW)(t=>{let e=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach(t=>{let r=document.createElementNS("http://www.w3.org/2000/svg","tspan");r.setAttributeNS("http://www.w3.org/XML/1998/namespace","xml:space","preserve"),r.setAttribute("dy","1em"),r.setAttribute("x","0"),r.setAttribute("class","row"),r.textContent=t.trim(),e.appendChild(r)}),e},"drawText"),V=(0,n.eW)(t=>{let e,r,a;return"BT"===K?(r=(0,n.eW)((t,e)=>t<=e,"comparisonFunc"),a=1/0):(r=(0,n.eW)((t,e)=>t>=e,"comparisonFunc"),a=0),t.forEach(t=>{let i="TB"===K||"BT"==K?Y.get(t)?.y:Y.get(t)?.x;void 0!==i&&r(i,a)&&(e=t,a=i)}),e},"findClosestParent"),Q=(0,n.eW)(t=>{let e="",r=1/0;return t.forEach(t=>{let a=Y.get(t).y;a<=r&&(e=t,r=a)}),e||void 0},"findClosestParentBT"),X=(0,n.eW)((t,e,r)=>{let a=r,i=r,o=[];t.forEach(t=>{let r=e.get(t);if(!r)throw Error(`Commit not found for key ${t}`);r.parents.length?i=Math.max(a=J(r),i):o.push(r),tt(r,a)}),a=i,o.forEach(t=>{te(t,a,r)}),t.forEach(t=>{let r=e.get(t);if(r?.parents.length){let t=Q(r.parents);(a=Y.get(t).y-40)<=i&&(i=a);let e=D.get(r.branch).pos,o=a-10;Y.set(r.id,{x:e,y:o})}})},"setParallelBTPos"),Z=(0,n.eW)(t=>{let e=V(t.parents.filter(t=>null!==t));if(!e)throw Error(`Closest parent not found for commit ${t.id}`);let r=Y.get(e)?.y;if(void 0===r)throw Error(`Closest parent position not found for commit ${t.id}`);return r},"findClosestParentPos"),J=(0,n.eW)(t=>Z(t)+40,"calculateCommitPosition"),tt=(0,n.eW)((t,e)=>{let r=D.get(t.branch);if(!r)throw Error(`Branch not found for commit ${t.id}`);let a=r.pos,i=e+10;return Y.set(t.id,{x:a,y:i}),{x:a,y:i}},"setCommitPosition"),te=(0,n.eW)((t,e,r)=>{let a=D.get(t.branch);if(!a)throw Error(`Branch not found for commit ${t.id}`);let i=a.pos;Y.set(t.id,{x:i,y:e+r})},"setRootPosition"),tr=(0,n.eW)((t,e,r,a,i,o)=>{if(o===h.HIGHLIGHT)t.append("rect").attr("x",r.x-10).attr("y",r.y-10).attr("width",20).attr("height",20).attr("class",`commit ${e.id} commit-highlight${i%8} ${a}-outer`),t.append("rect").attr("x",r.x-6).attr("y",r.y-6).attr("width",12).attr("height",12).attr("class",`commit ${e.id} commit${i%8} ${a}-inner`);else if(o===h.CHERRY_PICK)t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",10).attr("class",`commit ${e.id} ${a}`),t.append("circle").attr("cx",r.x-3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${a}`),t.append("circle").attr("cx",r.x+3).attr("cy",r.y+2).attr("r",2.75).attr("fill","#fff").attr("class",`commit ${e.id} ${a}`),t.append("line").attr("x1",r.x+3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${a}`),t.append("line").attr("x1",r.x-3).attr("y1",r.y+1).attr("x2",r.x).attr("y2",r.y-5).attr("stroke","#fff").attr("class",`commit ${e.id} ${a}`);else{let c=t.append("circle");if(c.attr("cx",r.x),c.attr("cy",r.y),c.attr("r",e.type===h.MERGE?9:10),c.attr("class",`commit ${e.id} commit${i%8}`),o===h.MERGE){let o=t.append("circle");o.attr("cx",r.x),o.attr("cy",r.y),o.attr("r",6),o.attr("class",`commit ${a} ${e.id} commit${i%8}`)}o===h.REVERSE&&t.append("path").attr("d",`M ${r.x-5},${r.y-5}L${r.x+5},${r.y+5}M${r.x-5},${r.y+5}L${r.x+5},${r.y-5}`).attr("class",`commit ${a} ${e.id} commit${i%8}`)}},"drawCommitBullet"),ta=(0,n.eW)((t,e,r,a,i)=>{if(e.type!==h.CHERRY_PICK&&(e.customId&&e.type===h.MERGE||e.type!==h.MERGE)&&i.showCommitLabel){let o=t.append("g"),c=o.insert("rect").attr("class","commit-label-bkg"),n=o.append("text").attr("x",a).attr("y",r.y+25).attr("class","commit-label").text(e.id),s=n.node()?.getBBox();if(s&&(c.attr("x",r.posWithOffset-s.width/2-2).attr("y",r.y+13.5).attr("width",s.width+4).attr("height",s.height+4),"TB"===K||"BT"===K?(c.attr("x",r.x-(s.width+16+5)).attr("y",r.y-12),n.attr("x",r.x-(s.width+16)).attr("y",r.y+s.height-12)):n.attr("x",r.posWithOffset-s.width/2),i.rotateCommitLabel)){if("TB"===K||"BT"===K)n.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),c.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{let t=-7.5-(s.width+10)/25*9.5,e=10+s.width/25*8.5;o.attr("transform","translate("+t+", "+e+") rotate(-45, "+a+", "+r.y+")")}}}},"drawCommitLabel"),ti=(0,n.eW)((t,e,r,a)=>{if(e.tags.length>0){let i=0,o=0,c=0,n=[];for(let a of e.tags.reverse()){let e=t.insert("polygon"),s=t.append("circle"),d=t.append("text").attr("y",r.y-16-i).attr("class","tag-label").text(a),h=d.node()?.getBBox();if(!h)throw Error("Tag bbox not found");o=Math.max(o,h.width),c=Math.max(c,h.height),d.attr("x",r.posWithOffset-h.width/2),n.push({tag:d,hole:s,rect:e,yOffset:i}),i+=20}for(let{tag:t,hole:e,rect:i,yOffset:s}of n){let n=c/2,d=r.y-19.2-s;if(i.attr("class","tag-label-bkg").attr("points",`
${a-o/2-2},${d+2}
${a-o/2-2},${d-2}
${r.posWithOffset-o/2-4},${d-n-2}
${r.posWithOffset+o/2+4},${d-n-2}
${r.posWithOffset+o/2+4},${d+n+2}
${r.posWithOffset-o/2-4},${d+n+2}`),e.attr("cy",d).attr("cx",a-o/2+2).attr("r",1.5).attr("class","tag-hole"),"TB"===K||"BT"===K){let c=a+s;i.attr("class","tag-label-bkg").attr("points",`
${r.x},${c+2}
${r.x},${c-2}
${r.x+10},${c-n-2}
${r.x+10+o+4},${c-n-2}
${r.x+10+o+4},${c+n+2}
${r.x+10},${c+n+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")"),e.attr("cx",r.x+2).attr("cy",c).attr("transform","translate(12,12) rotate(45, "+r.x+","+a+")"),t.attr("x",r.x+5).attr("y",c+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+a+")")}}}},"drawCommitTags"),to=(0,n.eW)(t=>{switch(t.customType??t.type){case h.NORMAL:return"commit-normal";case h.REVERSE:return"commit-reverse";case h.HIGHLIGHT:return"commit-highlight";case h.MERGE:return"commit-merge";case h.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),tc=(0,n.eW)((t,e,r,a)=>{let i={x:0,y:0};if(t.parents.length>0){let r=V(t.parents);if(r){let o=a.get(r)??i;return"TB"===e?o.y+40:"BT"===e?(a.get(t.id)??i).y-40:o.x+40}}else{if("TB"===e)return 30;if("BT"===e)return(a.get(t.id)??i).y-40}return 0},"calculatePosition"),tn=(0,n.eW)((t,e,r)=>{let a="BT"===K&&r?e:e+10,i="TB"===K||"BT"===K?a:D.get(t.branch)?.pos,o="TB"===K||"BT"===K?D.get(t.branch)?.pos:a;if(void 0===o||void 0===i)throw Error(`Position were undefined for commit ${t.id}`);return{x:o,y:i,posWithOffset:a}},"getCommitPosition"),ts=(0,n.eW)((t,e,r,a)=>{let i=t.append("g").attr("class","commit-bullets"),o=t.append("g").attr("class","commit-labels"),c="TB"===K||"BT"===K?30:0,s=[...e.keys()],d=a.parallelCommits??!1,h=s.sort((0,n.eW)((t,r)=>{let a=e.get(t)?.seq,i=e.get(r)?.seq;return void 0!==a&&void 0!==i?a-i:0},"sortKeys"));"BT"===K&&(d&&X(h,e,c),h=h.reverse()),h.forEach(t=>{let n=e.get(t);if(!n)throw Error(`Commit not found for key ${t}`);d&&(c=tc(n,K,c,Y));let s=tn(n,c,d);if(r){let t=to(n),e=n.customType??n.type,r=D.get(n.branch)?.index??0;tr(i,n,s,t,r,e),ta(o,n,s,c,a),ti(o,n,s,c)}"TB"===K||"BT"===K?Y.set(n.id,{x:s.x,y:s.posWithOffset}):Y.set(n.id,{x:s.posWithOffset,y:s.y}),(c="BT"===K&&d?c+40:c+40+10)>j&&(j=c)})},"drawCommits"),td=(0,n.eW)((t,e,r,a,i)=>{let o=("TB"===K||"BT"===K?r.x<a.x:r.y<a.y)?e.branch:t.branch,c=(0,n.eW)(t=>t.branch===o,"isOnBranchToGetCurve"),s=(0,n.eW)(r=>r.seq>t.seq&&r.seq<e.seq,"isBetweenCommits");return[...i.values()].some(t=>s(t)&&c(t))},"shouldRerouteArrow"),th=(0,n.eW)((t,e,r=0)=>{let a=t+Math.abs(t-e)/2;if(r>5)return a;if(_.every(t=>Math.abs(t-a)>=10))return _.push(a),a;let i=Math.abs(t-e);return th(t,e-i/5,r+1)},"findLane"),tl=(0,n.eW)((t,e,r,a)=>{let i;let o=Y.get(e.id),c=Y.get(r.id);if(void 0===o||void 0===c)throw Error(`Commit positions not found for commits ${e.id} and ${r.id}`);let n=td(e,r,o,c,a),s="",d="",l=0,$=0,m=D.get(r.branch)?.index;if(r.type===h.MERGE&&e.id!==r.parents[0]&&(m=D.get(e.branch)?.index),n){s="A 10 10, 0, 0, 0,",d="A 10 10, 0, 0, 1,",l=10,$=10;let t=o.y<c.y?th(o.y,c.y):th(c.y,o.y),r=o.x<c.x?th(o.x,c.x):th(c.x,o.x);"TB"===K?o.x<c.x?i=`M ${o.x} ${o.y} L ${r-l} ${o.y} ${d} ${r} ${o.y+$} L ${r} ${c.y-l} ${s} ${r+$} ${c.y} L ${c.x} ${c.y}`:(m=D.get(e.branch)?.index,i=`M ${o.x} ${o.y} L ${r+l} ${o.y} ${s} ${r} ${o.y+$} L ${r} ${c.y-l} ${d} ${r-$} ${c.y} L ${c.x} ${c.y}`):"BT"===K?o.x<c.x?i=`M ${o.x} ${o.y} L ${r-l} ${o.y} ${s} ${r} ${o.y-$} L ${r} ${c.y+l} ${d} ${r+$} ${c.y} L ${c.x} ${c.y}`:(m=D.get(e.branch)?.index,i=`M ${o.x} ${o.y} L ${r+l} ${o.y} ${d} ${r} ${o.y-$} L ${r} ${c.y+l} ${s} ${r-$} ${c.y} L ${c.x} ${c.y}`):o.y<c.y?i=`M ${o.x} ${o.y} L ${o.x} ${t-l} ${s} ${o.x+$} ${t} L ${c.x-l} ${t} ${d} ${c.x} ${t+$} L ${c.x} ${c.y}`:(m=D.get(e.branch)?.index,i=`M ${o.x} ${o.y} L ${o.x} ${t+l} ${d} ${o.x+$} ${t} L ${c.x-l} ${t} ${s} ${c.x} ${t-$} L ${c.x} ${c.y}`)}else s="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",l=20,$=20,"TB"===K?(o.x<c.x&&(i=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${c.y-l} ${s} ${o.x+$} ${c.y} L ${c.x} ${c.y}`:`M ${o.x} ${o.y} L ${c.x-l} ${o.y} ${d} ${c.x} ${o.y+$} L ${c.x} ${c.y}`),o.x>c.x&&(s="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",l=20,$=20,i=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${c.y-l} ${d} ${o.x-$} ${c.y} L ${c.x} ${c.y}`:`M ${o.x} ${o.y} L ${c.x+l} ${o.y} ${s} ${c.x} ${o.y+$} L ${c.x} ${c.y}`),o.x===c.x&&(i=`M ${o.x} ${o.y} L ${c.x} ${c.y}`)):"BT"===K?(o.x<c.x&&(i=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${c.y+l} ${d} ${o.x+$} ${c.y} L ${c.x} ${c.y}`:`M ${o.x} ${o.y} L ${c.x-l} ${o.y} ${s} ${c.x} ${o.y-$} L ${c.x} ${c.y}`),o.x>c.x&&(s="A 20 20, 0, 0, 0,",d="A 20 20, 0, 0, 1,",l=20,$=20,i=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${c.y+l} ${s} ${o.x-$} ${c.y} L ${c.x} ${c.y}`:`M ${o.x} ${o.y} L ${c.x+l} ${o.y} ${d} ${c.x} ${o.y-$} L ${c.x} ${c.y}`),o.x===c.x&&(i=`M ${o.x} ${o.y} L ${c.x} ${c.y}`)):(o.y<c.y&&(i=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${c.x-l} ${o.y} ${d} ${c.x} ${o.y+$} L ${c.x} ${c.y}`:`M ${o.x} ${o.y} L ${o.x} ${c.y-l} ${s} ${o.x+$} ${c.y} L ${c.x} ${c.y}`),o.y>c.y&&(i=r.type===h.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${c.x-l} ${o.y} ${s} ${c.x} ${o.y-$} L ${c.x} ${c.y}`:`M ${o.x} ${o.y} L ${o.x} ${c.y+l} ${d} ${o.x+$} ${c.y} L ${c.x} ${c.y}`),o.y===c.y&&(i=`M ${o.x} ${o.y} L ${c.x} ${c.y}`));if(void 0===i)throw Error("Line definition not found");t.append("path").attr("d",i).attr("class","arrow arrow"+m%8)},"drawArrow"),t$=(0,n.eW)((t,e)=>{let r=t.append("g").attr("class","commit-arrows");[...e.keys()].forEach(t=>{let a=e.get(t);a.parents&&a.parents.length>0&&a.parents.forEach(t=>{tl(r,e.get(t),a,e)})})},"drawArrows"),tm=(0,n.eW)((t,e,r)=>{let a=t.append("g");e.forEach((t,e)=>{let i=e%8,o=D.get(t.name)?.pos;if(void 0===o)throw Error(`Position not found for branch ${t.name}`);let c=a.append("line");c.attr("x1",0),c.attr("y1",o),c.attr("x2",j),c.attr("y2",o),c.attr("class","branch branch"+i),"TB"===K?(c.attr("y1",30),c.attr("x1",o),c.attr("y2",j),c.attr("x2",o)):"BT"===K&&(c.attr("y1",j),c.attr("x1",o),c.attr("y2",30),c.attr("x2",o)),_.push(o);let n=U(t.name),s=a.insert("rect"),d=a.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+i);d.node().appendChild(n);let h=n.getBBox();s.attr("class","branchLabelBkg label"+i).attr("rx",4).attr("ry",4).attr("x",-h.width-4-(!0===r.rotateCommitLabel?30:0)).attr("y",-h.height/2+8).attr("width",h.width+18).attr("height",h.height+4),d.attr("transform","translate("+(-h.width-14-(!0===r.rotateCommitLabel?30:0))+", "+(o-h.height/2-1)+")"),"TB"===K?(s.attr("x",o-h.width/2-10).attr("y",0),d.attr("transform","translate("+(o-h.width/2-5)+", 0)")):"BT"===K?(s.attr("x",o-h.width/2-10).attr("y",j),d.attr("transform","translate("+(o-h.width/2-5)+", "+j+")")):s.attr("transform","translate(-19, "+(o-h.height/2)+")")})},"drawBranches"),tg=(0,n.eW)(function(t,e,r,a,i){return D.set(t,{pos:e,index:r}),e+=50+(i?40:0)+("TB"===K||"BT"===K?a.width/2:0)},"setBranchPosition"),ty={parser:z,db:P,renderer:{draw:(0,n.eW)(function(t,e,r,a){F(),n.cM.debug("in gitgraph renderer",t+"\n","id:",e,r);let i=a.db;if(!i.getConfig){n.cM.error("getConfig method is not available on db");return}let s=i.getConfig(),h=s.rotateCommitLabel??!1;N=i.getCommits();let l=i.getBranchesAsObjArray();K=i.getDirection();let $=(0,d.Ys)(`[id="${e}"]`),m=0;l.forEach((t,e)=>{let r=U(t.name),a=$.append("g"),i=a.insert("g").attr("class","branchLabel"),o=i.insert("g").attr("class","label branch-label");o.node()?.appendChild(r);let c=r.getBBox();m=tg(t.name,m,e,c,h),o.remove(),i.remove(),a.remove()}),ts($,N,!1,s),s.showBranches&&tm($,l,s),t$($,N),ts($,N,!0,s),o.w8.insertTitle($,"gitTitleText",s.titleTopMargin??0,i.getDiagramTitle()),(0,c.Rw)(void 0,$,s.diagramPadding,s.useMaxWidth)},"draw")},styles:(0,n.eW)(t=>`
.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(e=>`
.branch-label${e} { fill: ${t["gitBranchLabel"+e]}; }
.commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }
.commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }
.label${e} { fill: ${t["git"+e]}; }
.arrow${e} { stroke: ${t["git"+e]}; }
`).join("\n")}
.branch {
stroke-width: 1;
stroke: ${t.lineColor};
stroke-dasharray: 2;
}
.commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}
.commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }
.tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}
.tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }
.tag-hole { fill: ${t.textColor}; }
.commit-merge {
stroke: ${t.primaryColor};
fill: ${t.primaryColor};
}
.commit-reverse {
stroke: ${t.primaryColor};
fill: ${t.primaryColor};
stroke-width: 3;
}
.commit-highlight-outer {
}
.commit-highlight-inner {
stroke: ${t.primaryColor};
fill: ${t.primaryColor};
}
.arrow { stroke-width: 8; stroke-linecap: round; fill: none}
.gitTitleText {
text-anchor: middle;
font-size: 18px;
fill: ${t.textColor};
}
`,"getStyles")}}}]);