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