import{pasZ}from"./chunk-JJENOPKO-qcZaRmSp.js";import{IasF}from"./chunk-FBCX6ULS-CsFYE_Yz.js";import{zasU,_ash,dasrr,Aaser,Bastr,Casar,lasw,sasnr,gassr,basor,cascr,pasir,qasdr,easE,rashr,jaslr,uas$r,Dasfr}from"./index-feIz3mEO.js";import{pasgr}from"./gitGraph-F2EDSAW4-CeKxUnS5.js";import"./reduce-r67mb1VR.js";import"./min-0hQ8dWgY.js";varx={NORMAL:0,REVERSE:1,HIGHLIGHT:2,MERGE:3,CHERRY_PICK:4},yr=U.gitGraph,z=h(()=>er({...yr,...tr().gitGraph}),"getConfig"),i=newF(()=>{constt=z(),r=t.mainBranchName,a=t.mainBranchOrder;return{mainBranchName:r,commits:newMap,head:null,branchConfig:newMap([[r,{name:r,order:a}]]),branches:newMap([[r,null]]),currBranch:r,direction:"LR",seq:0,options:{}}});functionj(){returnar({length:7})}h(j,"getID");functionN(t,r){consta=Object.create(null);returnt.reduce((s,e)=>{constn=r(e);returna[n]||(a[n]=!0,s.push(e)),s},[])}h(N,"uniqBy");varur=h(function(t){i.records.direction=t},"setDirection"),xr=h(function(t){w.debug("options str",t),t=t==null?void0:t.trim(),t=t||"{}";try{i.records.options=JSON.parse(t)}catch(r){w.error("error while parsing gitGraph options",r.message)}},"setOptions"),pr=h(function(){returni.records.options},"getOptions"),br=h(function(t){letr=t.msg,a=t.id;consts=t.type;lete=t.tags;w.info("commit",r,a,s,e),w.debug("Entering commit:",r,a,s,e);constn=z();a=E.sanitizeText(a,n),r=E.sanitizeText(r,n),e=e==null?void0:e.map(o=>E.sanitizeText(o,n));constc={id:a||i.records.seq+"-"+j(),message:r,seq:i.records.seq++,type:s??x.NORMAL,tags:e??[],parents:i.records.head==null?[]:[i.records.head.id],branch:i.records.currBranch};i.records.head=c,w.info("main branch",n.mainBranchName),i.records.commits.set(c.id,c),i.records.branches.set(i.records.currBranch,c.id),w.debug("in pushCommit "+c.id)},"commit"),mr=h(function(t){letr=t.name;consta=t.order;if(r=E.sanitizeText(r,z()),i.records.branches.has(r))thrownewError(`Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")`);i.records.branches.set(r,i.records.head!=null?i.records.head.id:null),i.records.branchConfig.set(r,{name:r,order:a}),_(r),w.debug("in createBranch")},"branch"),wr=h(t=>{letr=t.branch,a=t.id;consts=t.type,e=t.tags,n=z();r=E.sanitizeText(r,n),a&&(a=E.sanitizeText(a,n));constc=i.records.branches.get(i.records.currBranch),o=i.records.branches.get(r),$=c?i.records.commits.get(c):void0,l=o?i.records.commits.get(o):void0;if($&&l&&$.branch===r)thrownewError(`Cannot merge branch '${r}' into itself.`);if(i.records.currBranch===r){constd=newError('Incorrect usage of "merge". Cannot merge a branch to itself');throwd.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},d}if($===void0||!$){constd=newError(`Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits`);throwd.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["commit"]},d}if(!i.records.branches.has(r)){constd=newError('Incorrect usage of "merge". Branch to be merged ('+r+") does not exist");throwd.hash={text:`merge ${r}`,token:`merge ${r}`,expected:[`branch ${r}`]},d}if(l===void0||!l){constd=newError('Incorrect usage of "merge". Branch to be merged ('+r+") has no commits");throwd.hash={text:`merge ${r}`,token:`merge ${r}`,expected:['"commit"']},d}if($===l){constd=newError('Incorrect usage of "merge". Both branches have same head');throwd.hash={text:`merge ${r}`,token:`merge ${r}`,expected:["branch abc"]},d}if(a&&i.records.commits.has(a)){constd=newError('Incorrect usage of "merge". Commit with id:'+a+" already exists, use different custom Id");throwd.hash={text:`merge ${r}${a}${s}${e==null?void0:e.join(" ")}`,token:`merge ${r}${a}${s}${e==null?void0:e.join(" ")}`,expected:[`merge ${r}${a}_UNIQUE ${s}${e==null?void0:e.join(" ")}`]},d}constf=o||"",g={id:a||`${i.records.seq}-${j()}`,message:`merged branch ${r} into ${i.records.currBranch}`,seq:i.records.seq++,parents:i.records.head==null?[]:[i.records.head.id,f],branch:i.records.currBranch,type:x.MERGE,customType:s,custo