ruru
Version:
Grafast-flavoured GraphiQL distribution
2 lines • 25.5 kB
JavaScript
export const __webpack_esm_id__=7764;export const __webpack_esm_ids__=[7764];export const __webpack_esm_modules__={15348(t,e,r){function n(t,e){t.accDescr&&e.setAccDescription?.(t.accDescr),t.accTitle&&e.setAccTitle?.(t.accTitle),t.title&&e.setDiagramTitle?.(t.title)}r.r(e),r.d(e,{populateCommonDb:()=>n}),(0,r(60162).__name)(n,"populateCommonDb")},77165(t,e,r){r.r(e),r.d(e,{ImperativeState:()=>o});var n=r(60162),o=class{constructor(t){this.init=t,this.records=this.init()}static{(0,n.__name)(this,"ImperativeState")}reset(){this.records=this.init()}}},77764(t,e,r){r.r(e),r.d(e,{diagram:()=>ut});var n=r(15348),o=r(77165),a=r(82029),c=r(54141),s=r(60162),i=r(73744),m=r(79806),d={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},h=c.defaultConfig_default.gitGraph,$=(0,s.__name)(()=>(0,a.cleanAndMerge)({...h,...(0,c.getConfig)().gitGraph}),"getConfig"),l=new o.ImperativeState(()=>{const 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,a.random)({length:7})}function y(t,e){const r=Object.create(null);return t.reduce((t,n)=>{const o=e(n);return r[o]||(r[o]=!0,t.push(n)),t},[])}(0,s.__name)(g,"getID"),(0,s.__name)(y,"uniqBy");var p=(0,s.__name)(function(t){l.records.direction=t},"setDirection"),f=(0,s.__name)(function(t){s.log.debug("options str",t),t=t?.trim(),t=t||"{}";try{l.records.options=JSON.parse(t)}catch(t){s.log.error("error while parsing gitGraph options",t.message)}},"setOptions"),x=(0,s.__name)(function(){return l.records.options},"getOptions"),u=(0,s.__name)(function(t){let e=t.msg,r=t.id;const n=t.type;let o=t.tags;s.log.info("commit",e,r,n,o),s.log.debug("Entering commit:",e,r,n,o);const a=$();r=c.common_default.sanitizeText(r,a),e=c.common_default.sanitizeText(e,a),o=o?.map(t=>c.common_default.sanitizeText(t,a));const i={id:r||l.records.seq+"-"+g(),message:e,seq:l.records.seq++,type:n??d.NORMAL,tags:o??[],parents:null==l.records.head?[]:[l.records.head.id],branch:l.records.currBranch};l.records.head=i,s.log.info("main branch",a.mainBranchName),l.records.commits.has(i.id)&&s.log.warn(`Commit ID ${i.id} already exists`),l.records.commits.set(i.id,i),l.records.branches.set(l.records.currBranch,i.id),s.log.debug("in pushCommit "+i.id)},"commit"),_=(0,s.__name)(function(t){let e=t.name;const r=t.order;if(e=c.common_default.sanitizeText(e,$()),l.records.branches.has(e))throw new 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}")`);l.records.branches.set(e,null!=l.records.head?l.records.head.id:null),l.records.branchConfig.set(e,{name:e,order:r}),B(e),s.log.debug("in createBranch")},"branch"),b=(0,s.__name)(t=>{let e=t.branch,r=t.id;const n=t.type,o=t.tags,a=$();e=c.common_default.sanitizeText(e,a),r&&(r=c.common_default.sanitizeText(r,a));const i=l.records.branches.get(l.records.currBranch),m=l.records.branches.get(e),h=i?l.records.commits.get(i):void 0,y=m?l.records.commits.get(m):void 0;if(h&&y&&h.branch===e)throw new Error(`Cannot merge branch '${e}' into itself.`);if(l.records.currBranch===e){const t=new 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===h||!h){const t=new Error(`Incorrect usage of "merge". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`merge ${e}`,token:`merge ${e}`,expected:["commit"]},t}if(!l.records.branches.has(e)){const t=new 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){const t=new 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(h===y){const t=new 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&&l.records.commits.has(r)){const t=new Error('Incorrect usage of "merge". Commit with id:'+r+" already exists, use different custom id");throw t.hash={text:`merge ${e} ${r} ${n} ${o?.join(" ")}`,token:`merge ${e} ${r} ${n} ${o?.join(" ")}`,expected:[`merge ${e} ${r}_UNIQUE ${n} ${o?.join(" ")}`]},t}const p=m||"",f={id:r||`${l.records.seq}-${g()}`,message:`merged branch ${e} into ${l.records.currBranch}`,seq:l.records.seq++,parents:null==l.records.head?[]:[l.records.head.id,p],branch:l.records.currBranch,type:d.MERGE,customType:n,customId:!!r,tags:o??[]};l.records.head=f,l.records.commits.set(f.id,f),l.records.branches.set(l.records.currBranch,f.id),s.log.debug(l.records.branches),s.log.debug("in mergeBranch")},"merge"),w=(0,s.__name)(function(t){let e=t.id,r=t.targetId,n=t.tags,o=t.parent;s.log.debug("Entering cherryPick:",e,r,n);const a=$();if(e=c.common_default.sanitizeText(e,a),r=c.common_default.sanitizeText(r,a),n=n?.map(t=>c.common_default.sanitizeText(t,a)),o=c.common_default.sanitizeText(o,a),!e||!l.records.commits.has(e)){const t=new 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}const i=l.records.commits.get(e);if(void 0===i||!i)throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided');if(o&&(!Array.isArray(i.parents)||!i.parents.includes(o)))throw new Error("Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit.");const m=i.branch;if(i.type===d.MERGE&&!o)throw new Error("Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified.");if(!r||!l.records.commits.has(r)){if(m===l.records.currBranch){const t=new 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}const t=l.records.branches.get(l.records.currBranch);if(void 0===t||!t){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}const a=l.records.commits.get(t);if(void 0===a||!a){const t=new Error(`Incorrect usage of "cherry-pick". Current branch (${l.records.currBranch})has no commits`);throw t.hash={text:`cherryPick ${e} ${r}`,token:`cherryPick ${e} ${r}`,expected:["cherry-pick abc"]},t}const c={id:l.records.seq+"-"+g(),message:`cherry-picked ${i?.message} into ${l.records.currBranch}`,seq:l.records.seq++,parents:null==l.records.head?[]:[l.records.head.id,i.id],branch:l.records.currBranch,type:d.CHERRY_PICK,tags:n?n.filter(Boolean):[`cherry-pick:${i.id}${i.type===d.MERGE?`|parent:${o}`:""}`]};l.records.head=c,l.records.commits.set(c.id,c),l.records.branches.set(l.records.currBranch,c.id),s.log.debug(l.records.branches),s.log.debug("in cherryPick")}},"cherryPick"),B=(0,s.__name)(function(t){if(t=c.common_default.sanitizeText(t,$()),!l.records.branches.has(t)){const e=new 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}{l.records.currBranch=t;const e=l.records.branches.get(l.records.currBranch);l.records.head=void 0!==e&&e?l.records.commits.get(e)??null:null}},"checkout");function E(t,e,r){const n=t.indexOf(e);-1===n?t.push(r):t.splice(n,1,r)}function C(t){const e=t.reduce((t,e)=>t.seq>e.seq?t:e,t[0]);let r="";t.forEach(function(t){r+=t===e?"\t*":"\t|"});const n=[r,e.id,e.seq];for(const t in l.records.branches)l.records.branches.get(t)===e.id&&n.push(t);if(s.log.debug(n.join(" ")),e.parents&&2==e.parents.length&&e.parents[0]&&e.parents[1]){const r=l.records.commits.get(e.parents[0]);E(t,e,r),e.parents[1]&&t.push(l.records.commits.get(e.parents[1]))}else{if(0==e.parents.length)return;if(e.parents[0]){const r=l.records.commits.get(e.parents[0]);E(t,e,r)}}C(t=y(t,t=>t.id))}(0,s.__name)(E,"upsert"),(0,s.__name)(C,"prettyPrintCommitHistory");var T=(0,s.__name)(function(){s.log.debug(l.records.commits),C([P()[0]])},"prettyPrint"),k=(0,s.__name)(function(){l.reset(),(0,c.clear)()},"clear"),L=(0,s.__name)(function(){return[...l.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"),M=(0,s.__name)(function(){return l.records.branches},"getBranches"),v=(0,s.__name)(function(){return l.records.commits},"getCommits"),P=(0,s.__name)(function(){const t=[...l.records.commits.values()];return t.forEach(function(t){s.log.debug(t.id)}),t.sort((t,e)=>t.seq-e.seq),t},"getCommitsArray"),R={commitType:d,getConfig:$,setDirection:p,setOptions:f,getOptions:x,commit:u,branch:_,merge:b,cherryPick:w,checkout:B,prettyPrint:T,clear:k,getBranchesAsObjArray:L,getBranches:M,getCommits:v,getCommitsArray:P,getCurrentBranch:(0,s.__name)(function(){return l.records.currBranch},"getCurrentBranch"),getDirection:(0,s.__name)(function(){return l.records.direction},"getDirection"),getHead:(0,s.__name)(function(){return l.records.head},"getHead"),setAccTitle:c.setAccTitle,getAccTitle:c.getAccTitle,getAccDescription:c.getAccDescription,setAccDescription:c.setAccDescription,setDiagramTitle:c.setDiagramTitle,getDiagramTitle:c.getDiagramTitle},A=(0,s.__name)((t,e)=>{(0,n.populateCommonDb)(t,e),t.dir&&e.setDirection(t.dir);for(const r of t.statements)I(r,e)},"populate"),I=(0,s.__name)((t,e)=>{const r={Commit:(0,s.__name)(t=>e.commit(G(t)),"Commit"),Branch:(0,s.__name)(t=>e.branch(O(t)),"Branch"),Merge:(0,s.__name)(t=>e.merge(D(t)),"Merge"),Checkout:(0,s.__name)(t=>e.checkout(q(t)),"Checkout"),CherryPicking:(0,s.__name)(t=>e.cherryPick(H(t)),"CherryPicking")}[t.$type];r?r(t):s.log.error(`Unknown statement type: ${t.$type}`)},"parseStatement"),G=(0,s.__name)(t=>({id:t.id,msg:t.message??"",type:void 0!==t.type?d[t.type]:d.NORMAL,tags:t.tags??void 0}),"parseCommit"),O=(0,s.__name)(t=>({name:t.name,order:t.order??0}),"parseBranch"),D=(0,s.__name)(t=>({branch:t.branch,id:t.id??"",type:void 0!==t.type?d[t.type]:void 0,tags:t.tags??void 0}),"parseMerge"),q=(0,s.__name)(t=>t.branch,"parseCheckout"),H=(0,s.__name)(t=>({id:t.id,targetId:"",tags:0===t.tags?.length?void 0:t.tags,parent:t.parent}),"parseCherryPicking"),z={parse:(0,s.__name)(async t=>{const e=await(0,i.parse)("gitGraph",t);s.log.debug(e),A(e,R)},"parse")},S=(0,c.getConfig2)(),N=S?.gitGraph,W=10,j=40,F=new Map,K=new Map,Y=new Map,V=[],U=0,J="LR",Q=(0,s.__name)(()=>{F.clear(),K.clear(),Y.clear(),U=0,V=[],J="LR"},"clear"),X=(0,s.__name)(t=>{const e=document.createElementNS("http://www.w3.org/2000/svg","text");return("string"==typeof t?t.split(/\\n|\n|<br\s*\/?>/gi):t).forEach(t=>{const 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"),Z=(0,s.__name)(t=>{let e,r,n;return"BT"===J?(r=(0,s.__name)((t,e)=>t<=e,"comparisonFunc"),n=1/0):(r=(0,s.__name)((t,e)=>t>=e,"comparisonFunc"),n=0),t.forEach(t=>{const o="TB"===J||"BT"==J?K.get(t)?.y:K.get(t)?.x;void 0!==o&&r(o,n)&&(e=t,n=o)}),e},"findClosestParent"),tt=(0,s.__name)(t=>{let e="",r=1/0;return t.forEach(t=>{const n=K.get(t).y;n<=r&&(e=t,r=n)}),e||void 0},"findClosestParentBT"),et=(0,s.__name)((t,e,r)=>{let n=r,o=r;const a=[];t.forEach(t=>{const r=e.get(t);if(!r)throw new Error(`Commit not found for key ${t}`);r.parents.length?(n=nt(r),o=Math.max(n,o)):a.push(r),ot(r,n)}),n=o,a.forEach(t=>{at(t,n,r)}),t.forEach(t=>{const r=e.get(t);if(r?.parents.length){const t=tt(r.parents);n=K.get(t).y-j,n<=o&&(o=n);const e=F.get(r.branch).pos,a=n-W;K.set(r.id,{x:e,y:a})}})},"setParallelBTPos"),rt=(0,s.__name)(t=>{const e=Z(t.parents.filter(t=>null!==t));if(!e)throw new Error(`Closest parent not found for commit ${t.id}`);const r=K.get(e)?.y;if(void 0===r)throw new Error(`Closest parent position not found for commit ${t.id}`);return r},"findClosestParentPos"),nt=(0,s.__name)(t=>rt(t)+j,"calculateCommitPosition"),ot=(0,s.__name)((t,e)=>{const r=F.get(t.branch);if(!r)throw new Error(`Branch not found for commit ${t.id}`);const n=r.pos,o=e+W;return K.set(t.id,{x:n,y:o}),{x:n,y:o}},"setCommitPosition"),at=(0,s.__name)((t,e,r)=>{const n=F.get(t.branch);if(!n)throw new Error(`Branch not found for commit ${t.id}`);const o=e+r,a=n.pos;K.set(t.id,{x:a,y:o})},"setRootPosition"),ct=(0,s.__name)((t,e,r,n,o,a)=>{if(a===d.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${o%8} ${n}-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${o%8} ${n}-inner`);else if(a===d.CHERRY_PICK)t.append("circle").attr("cx",r.x).attr("cy",r.y).attr("r",10).attr("class",`commit ${e.id} ${n}`),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} ${n}`),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} ${n}`),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} ${n}`),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} ${n}`);else{const c=t.append("circle");if(c.attr("cx",r.x),c.attr("cy",r.y),c.attr("r",e.type===d.MERGE?9:10),c.attr("class",`commit ${e.id} commit${o%8}`),a===d.MERGE){const a=t.append("circle");a.attr("cx",r.x),a.attr("cy",r.y),a.attr("r",6),a.attr("class",`commit ${n} ${e.id} commit${o%8}`)}a===d.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 ${n} ${e.id} commit${o%8}`)}},"drawCommitBullet"),st=(0,s.__name)((t,e,r,n)=>{if(e.type!==d.CHERRY_PICK&&(e.customId&&e.type===d.MERGE||e.type!==d.MERGE)&&N?.showCommitLabel){const o=t.append("g"),a=o.insert("rect").attr("class","commit-label-bkg"),c=o.append("text").attr("x",n).attr("y",r.y+25).attr("class","commit-label").text(e.id),s=c.node()?.getBBox();if(s&&(a.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"===J||"BT"===J?(a.attr("x",r.x-(s.width+16+5)).attr("y",r.y-12),c.attr("x",r.x-(s.width+16)).attr("y",r.y+s.height-12)):c.attr("x",r.posWithOffset-s.width/2),N.rotateCommitLabel))if("TB"===J||"BT"===J)c.attr("transform","rotate(-45, "+r.x+", "+r.y+")"),a.attr("transform","rotate(-45, "+r.x+", "+r.y+")");else{const t=-7.5-(s.width+10)/25*9.5,e=10+s.width/25*8.5;o.attr("transform","translate("+t+", "+e+") rotate(-45, "+n+", "+r.y+")")}}},"drawCommitLabel"),it=(0,s.__name)((t,e,r,n)=>{if(e.tags.length>0){let o=0,a=0,c=0;const s=[];for(const n of e.tags.reverse()){const e=t.insert("polygon"),i=t.append("circle"),m=t.append("text").attr("y",r.y-16-o).attr("class","tag-label").text(n),d=m.node()?.getBBox();if(!d)throw new Error("Tag bbox not found");a=Math.max(a,d.width),c=Math.max(c,d.height),m.attr("x",r.posWithOffset-d.width/2),s.push({tag:m,hole:i,rect:e,yOffset:o}),o+=20}for(const{tag:t,hole:e,rect:o,yOffset:i}of s){const s=c/2,m=r.y-19.2-i;if(o.attr("class","tag-label-bkg").attr("points",`\n ${n-a/2-2},${m+2} \n ${n-a/2-2},${m-2}\n ${r.posWithOffset-a/2-4},${m-s-2}\n ${r.posWithOffset+a/2+4},${m-s-2}\n ${r.posWithOffset+a/2+4},${m+s+2}\n ${r.posWithOffset-a/2-4},${m+s+2}`),e.attr("cy",m).attr("cx",n-a/2+2).attr("r",1.5).attr("class","tag-hole"),"TB"===J||"BT"===J){const c=n+i;o.attr("class","tag-label-bkg").attr("points",`\n ${r.x},${c+2}\n ${r.x},${c-2}\n ${r.x+W},${c-s-2}\n ${r.x+W+a+4},${c-s-2}\n ${r.x+W+a+4},${c+s+2}\n ${r.x+W},${c+s+2}`).attr("transform","translate(12,12) rotate(45, "+r.x+","+n+")"),e.attr("cx",r.x+2).attr("cy",c).attr("transform","translate(12,12) rotate(45, "+r.x+","+n+")"),t.attr("x",r.x+5).attr("y",c+3).attr("transform","translate(14,14) rotate(45, "+r.x+","+n+")")}}}},"drawCommitTags"),mt=(0,s.__name)(t=>{switch(t.customType??t.type){case d.NORMAL:return"commit-normal";case d.REVERSE:return"commit-reverse";case d.HIGHLIGHT:return"commit-highlight";case d.MERGE:return"commit-merge";case d.CHERRY_PICK:return"commit-cherry-pick";default:return"commit-normal"}},"getCommitClassType"),dt=(0,s.__name)((t,e,r,n)=>{const o={x:0,y:0};if(!(t.parents.length>0))return"TB"===e?30:"BT"===e?(n.get(t.id)??o).y-j:0;{const r=Z(t.parents);if(r){const a=n.get(r)??o;return"TB"===e?a.y+j:"BT"===e?(n.get(t.id)??o).y-j:a.x+j}}return 0},"calculatePosition"),ht=(0,s.__name)((t,e,r)=>{const n="BT"===J&&r?e:e+W,o="TB"===J||"BT"===J?n:F.get(t.branch)?.pos,a="TB"===J||"BT"===J?F.get(t.branch)?.pos:n;if(void 0===a||void 0===o)throw new Error(`Position were undefined for commit ${t.id}`);return{x:a,y:o,posWithOffset:n}},"getCommitPosition"),$t=(0,s.__name)((t,e,r)=>{if(!N)throw new Error("GitGraph config not found");const n=t.append("g").attr("class","commit-bullets"),o=t.append("g").attr("class","commit-labels");let a="TB"===J||"BT"===J?30:0;const c=[...e.keys()],i=N?.parallelCommits??!1,m=(0,s.__name)((t,r)=>{const n=e.get(t)?.seq,o=e.get(r)?.seq;return void 0!==n&&void 0!==o?n-o:0},"sortKeys");let d=c.sort(m);"BT"===J&&(i&&et(d,e,a),d=d.reverse()),d.forEach(t=>{const c=e.get(t);if(!c)throw new Error(`Commit not found for key ${t}`);i&&(a=dt(c,J,a,K));const s=ht(c,a,i);if(r){const t=mt(c),e=c.customType??c.type,r=F.get(c.branch)?.index??0;ct(n,c,s,t,r,e),st(o,c,s,a),it(o,c,s,a)}"TB"===J||"BT"===J?K.set(c.id,{x:s.x,y:s.posWithOffset}):K.set(c.id,{x:s.posWithOffset,y:s.y}),a="BT"===J&&i?a+j:a+j+W,a>U&&(U=a)})},"drawCommits"),lt=(0,s.__name)((t,e,r,n,o)=>{const a=("TB"===J||"BT"===J?r.x<n.x:r.y<n.y)?e.branch:t.branch,c=(0,s.__name)(t=>t.branch===a,"isOnBranchToGetCurve"),i=(0,s.__name)(r=>r.seq>t.seq&&r.seq<e.seq,"isBetweenCommits");return[...o.values()].some(t=>i(t)&&c(t))},"shouldRerouteArrow"),gt=(0,s.__name)((t,e,r=0)=>{const n=t+Math.abs(t-e)/2;if(r>5)return n;if(V.every(t=>Math.abs(t-n)>=10))return V.push(n),n;const o=Math.abs(t-e);return gt(t,e-o/5,r+1)},"findLane"),yt=(0,s.__name)((t,e,r,n)=>{const o=K.get(e.id),a=K.get(r.id);if(void 0===o||void 0===a)throw new Error(`Commit positions not found for commits ${e.id} and ${r.id}`);const c=lt(e,r,o,a,n);let s,i="",m="",h=0,$=0,l=F.get(r.branch)?.index;if(r.type===d.MERGE&&e.id!==r.parents[0]&&(l=F.get(e.branch)?.index),c){i="A 10 10, 0, 0, 0,",m="A 10 10, 0, 0, 1,",h=10,$=10;const t=o.y<a.y?gt(o.y,a.y):gt(a.y,o.y),r=o.x<a.x?gt(o.x,a.x):gt(a.x,o.x);"TB"===J?o.x<a.x?s=`M ${o.x} ${o.y} L ${r-h} ${o.y} ${m} ${r} ${o.y+$} L ${r} ${a.y-h} ${i} ${r+$} ${a.y} L ${a.x} ${a.y}`:(l=F.get(e.branch)?.index,s=`M ${o.x} ${o.y} L ${r+h} ${o.y} ${i} ${r} ${o.y+$} L ${r} ${a.y-h} ${m} ${r-$} ${a.y} L ${a.x} ${a.y}`):"BT"===J?o.x<a.x?s=`M ${o.x} ${o.y} L ${r-h} ${o.y} ${i} ${r} ${o.y-$} L ${r} ${a.y+h} ${m} ${r+$} ${a.y} L ${a.x} ${a.y}`:(l=F.get(e.branch)?.index,s=`M ${o.x} ${o.y} L ${r+h} ${o.y} ${m} ${r} ${o.y-$} L ${r} ${a.y+h} ${i} ${r-$} ${a.y} L ${a.x} ${a.y}`):o.y<a.y?s=`M ${o.x} ${o.y} L ${o.x} ${t-h} ${i} ${o.x+$} ${t} L ${a.x-h} ${t} ${m} ${a.x} ${t+$} L ${a.x} ${a.y}`:(l=F.get(e.branch)?.index,s=`M ${o.x} ${o.y} L ${o.x} ${t+h} ${m} ${o.x+$} ${t} L ${a.x-h} ${t} ${i} ${a.x} ${t-$} L ${a.x} ${a.y}`)}else i="A 20 20, 0, 0, 0,",m="A 20 20, 0, 0, 1,",h=20,$=20,"TB"===J?(o.x<a.x&&(s=r.type===d.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${a.y-h} ${i} ${o.x+$} ${a.y} L ${a.x} ${a.y}`:`M ${o.x} ${o.y} L ${a.x-h} ${o.y} ${m} ${a.x} ${o.y+$} L ${a.x} ${a.y}`),o.x>a.x&&(i="A 20 20, 0, 0, 0,",m="A 20 20, 0, 0, 1,",h=20,$=20,s=r.type===d.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${a.y-h} ${m} ${o.x-$} ${a.y} L ${a.x} ${a.y}`:`M ${o.x} ${o.y} L ${a.x+h} ${o.y} ${i} ${a.x} ${o.y+$} L ${a.x} ${a.y}`),o.x===a.x&&(s=`M ${o.x} ${o.y} L ${a.x} ${a.y}`)):"BT"===J?(o.x<a.x&&(s=r.type===d.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${a.y+h} ${m} ${o.x+$} ${a.y} L ${a.x} ${a.y}`:`M ${o.x} ${o.y} L ${a.x-h} ${o.y} ${i} ${a.x} ${o.y-$} L ${a.x} ${a.y}`),o.x>a.x&&(i="A 20 20, 0, 0, 0,",m="A 20 20, 0, 0, 1,",h=20,$=20,s=r.type===d.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${o.x} ${a.y+h} ${i} ${o.x-$} ${a.y} L ${a.x} ${a.y}`:`M ${o.x} ${o.y} L ${a.x-h} ${o.y} ${i} ${a.x} ${o.y-$} L ${a.x} ${a.y}`),o.x===a.x&&(s=`M ${o.x} ${o.y} L ${a.x} ${a.y}`)):(o.y<a.y&&(s=r.type===d.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${a.x-h} ${o.y} ${m} ${a.x} ${o.y+$} L ${a.x} ${a.y}`:`M ${o.x} ${o.y} L ${o.x} ${a.y-h} ${i} ${o.x+$} ${a.y} L ${a.x} ${a.y}`),o.y>a.y&&(s=r.type===d.MERGE&&e.id!==r.parents[0]?`M ${o.x} ${o.y} L ${a.x-h} ${o.y} ${i} ${a.x} ${o.y-$} L ${a.x} ${a.y}`:`M ${o.x} ${o.y} L ${o.x} ${a.y+h} ${m} ${o.x+$} ${a.y} L ${a.x} ${a.y}`),o.y===a.y&&(s=`M ${o.x} ${o.y} L ${a.x} ${a.y}`));if(void 0===s)throw new Error("Line definition not found");t.append("path").attr("d",s).attr("class","arrow arrow"+l%8)},"drawArrow"),pt=(0,s.__name)((t,e)=>{const r=t.append("g").attr("class","commit-arrows");[...e.keys()].forEach(t=>{const n=e.get(t);n.parents&&n.parents.length>0&&n.parents.forEach(t=>{yt(r,e.get(t),n,e)})})},"drawArrows"),ft=(0,s.__name)((t,e)=>{const r=t.append("g");e.forEach((t,e)=>{const n=e%8,o=F.get(t.name)?.pos;if(void 0===o)throw new Error(`Position not found for branch ${t.name}`);const a=r.append("line");a.attr("x1",0),a.attr("y1",o),a.attr("x2",U),a.attr("y2",o),a.attr("class","branch branch"+n),"TB"===J?(a.attr("y1",30),a.attr("x1",o),a.attr("y2",U),a.attr("x2",o)):"BT"===J&&(a.attr("y1",U),a.attr("x1",o),a.attr("y2",30),a.attr("x2",o)),V.push(o);const c=t.name,s=X(c),i=r.insert("rect"),m=r.insert("g").attr("class","branchLabel").insert("g").attr("class","label branch-label"+n);m.node().appendChild(s);const d=s.getBBox();i.attr("class","branchLabelBkg label"+n).attr("rx",4).attr("ry",4).attr("x",-d.width-4-(!0===N?.rotateCommitLabel?30:0)).attr("y",-d.height/2+8).attr("width",d.width+18).attr("height",d.height+4),m.attr("transform","translate("+(-d.width-14-(!0===N?.rotateCommitLabel?30:0))+", "+(o-d.height/2-1)+")"),"TB"===J?(i.attr("x",o-d.width/2-10).attr("y",0),m.attr("transform","translate("+(o-d.width/2-5)+", 0)")):"BT"===J?(i.attr("x",o-d.width/2-10).attr("y",U),m.attr("transform","translate("+(o-d.width/2-5)+", "+U+")")):i.attr("transform","translate(-19, "+(o-d.height/2)+")")})},"drawBranches"),xt=(0,s.__name)(function(t,e,r,n,o){return F.set(t,{pos:e,index:r}),e+(50+(o?40:0)+("TB"===J||"BT"===J?n.width/2:0))},"setBranchPosition"),ut={parser:z,db:R,renderer:{draw:(0,s.__name)(function(t,e,r,n){if(Q(),s.log.debug("in gitgraph renderer",t+"\n","id:",e,r),!N)throw new Error("GitGraph config not found");const o=N.rotateCommitLabel??!1,i=n.db;Y=i.getCommits();const d=i.getBranchesAsObjArray();J=i.getDirection();const h=(0,m.select)(`[id="${e}"]`);let $=0;d.forEach((t,e)=>{const r=X(t.name),n=h.append("g"),a=n.insert("g").attr("class","branchLabel"),c=a.insert("g").attr("class","label branch-label");c.node()?.appendChild(r);const s=r.getBBox();$=xt(t.name,$,e,s,o),c.remove(),a.remove(),n.remove()}),$t(h,Y,!1),N.showBranches&&ft(h,d),pt(h,Y),$t(h,Y,!0),a.utils_default.insertTitle(h,"gitTitleText",N.titleTopMargin??0,i.getDiagramTitle()),(0,c.setupGraphViewbox2)(void 0,h,N.diagramPadding,N.useMaxWidth)},"draw")},styles:(0,s.__name)(t=>`\n .commit-id,\n .commit-msg,\n .branch-label {\n fill: lightgrey;\n color: lightgrey;\n font-family: 'trebuchet ms', verdana, arial, sans-serif;\n font-family: var(--mermaid-font-family);\n }\n ${[0,1,2,3,4,5,6,7].map(e=>`\n .branch-label${e} { fill: ${t["gitBranchLabel"+e]}; }\n .commit${e} { stroke: ${t["git"+e]}; fill: ${t["git"+e]}; }\n .commit-highlight${e} { stroke: ${t["gitInv"+e]}; fill: ${t["gitInv"+e]}; }\n .label${e} { fill: ${t["git"+e]}; }\n .arrow${e} { stroke: ${t["git"+e]}; }\n `).join("\n")}\n\n .branch {\n stroke-width: 1;\n stroke: ${t.lineColor};\n stroke-dasharray: 2;\n }\n .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};}\n .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; }\n .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};}\n .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; }\n .tag-hole { fill: ${t.textColor}; }\n\n .commit-merge {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n .commit-reverse {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n stroke-width: 3;\n }\n .commit-highlight-outer {\n }\n .commit-highlight-inner {\n stroke: ${t.primaryColor};\n fill: ${t.primaryColor};\n }\n\n .arrow { stroke-width: 8; stroke-linecap: round; fill: none}\n .gitTitleText {\n text-anchor: middle;\n font-size: 18px;\n fill: ${t.textColor};\n }\n`,"getStyles")}}};
//# sourceMappingURL=7764.js.map