Socket
Socket
Sign inDemoInstall

@gitgraph/js

Package Overview
Dependencies
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gitgraph/js - npm Package Compare versions

Comparing version 1.0.0-3 to 1.0.0-4

2

lib/bundle.min.js

@@ -1,1 +0,1 @@

!function(){return function t(e,r,s){function i(a,o){if(!r[a]){if(!e[a]){var h="function"==typeof require&&require;if(!o&&h)return h(a,!0);if(n)return n(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return i(e[a][1][t]||t)},l,l.exports,t,e,r,s)}return r[a].exports}for(var n="function"==typeof require&&require,a=0;a<s.length;a++)i(s[a]);return i}}()({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./user-api/branch-user-api"),i="";r.DELETED_BRANCH_NAME=i;class n{constructor(t){this.gitgraph=t.gitgraph,this.name=t.name,this.style=t.style,this.parentCommitHash=t.parentCommitHash,this.commitDefaultOptions=t.commitDefaultOptions||{style:{}},this.onGraphUpdate=t.onGraphUpdate}getUserApi(){return new s.BranchUserApi(this,this.gitgraph,this.onGraphUpdate)}isDeleted(){return this.name===i}}r.Branch=n,r.createDeletedBranch=function(t,e,r){return new n({name:i,gitgraph:t,style:e,onGraphUpdate:r})}},{"./user-api/branch-user-api":14}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.BranchesOrder=class{constructor(t,e,r){this.branches=new Set,this.colors=e,t.forEach(t=>this.branches.add(t.branchToDisplay)),r&&(this.branches=new Set(Array.from(this.branches).sort(r)))}get(t){return Array.from(this.branches).findIndex(e=>e===t)}getColorOf(t){return this.colors[this.get(t)%this.colors.length]}}},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./utils");r.BranchesPathsCalculator=class{constructor(t,e,r,s,i,n){this.branchesPaths=new Map,this.commits=t,this.branches=e,this.commitSpacing=r,this.isGraphVertical=s,this.isGraphReverse=i,this.createDeletedBranch=n}execute(){return this.fromCommits(),this.withMergeCommits(),this.smoothBranchesPaths()}fromCommits(){this.commits.forEach(t=>{let e=this.branches.get(t.branchToDisplay);e||(e=this.getDeletedBranchInPath()||this.createDeletedBranch());const r=[],s=this.branchesPaths.get(e),i=this.commits.find(({hash:e})=>e===t.parents[0]);s?r.push(...s):i&&r.push({x:i.x,y:i.y}),r.push({x:t.x,y:t.y}),this.branchesPaths.set(e,r)})}withMergeCommits(){this.commits.filter(({parents:t})=>t.length>1).forEach(t=>{const e=this.commits.find(({hash:e})=>e===t.parents[1]);if(!e)return;const r=e.branches?e.branches[0]:"";let s=this.branches.get(r);if(!s&&!(s=this.getDeletedBranchInPath()))return;const i=[...this.branchesPaths.get(s)||[]];this.branchesPaths.set(s,[...i,{x:t.x,y:t.y,mergeCommit:!0}])})}getDeletedBranchInPath(){return Array.from(this.branchesPaths.keys()).find(t=>t.isDeleted())}smoothBranchesPaths(){const t=new Map;return this.branchesPaths.forEach((e,r)=>{if(e.length<=1)return void t.set(r,[e]);e=this.isGraphVertical?e.sort((t,e)=>t.y>e.y?-1:1):e.sort((t,e)=>t.x>e.x?1:-1),this.isGraphReverse&&(e=e.reverse());const i=e.reduce((t,r,i)=>(r.mergeCommit?(t[t.length-1].push(s.pick(r,["x","y"])),e[i-1]&&t.push([e[i-1]])):t[t.length-1].push(r),t),[[]]);this.isGraphReverse&&i.forEach(t=>t.reverse()),this.isGraphVertical?i.forEach(e=>{if(e.length<=1)return;const s=e[0],i=e[e.length-1],n=e[1].x,a=Math.round(Math.abs(s.y-i.y)/this.commitSpacing)-1,o=a>0?new Array(a).fill(0).map((t,r)=>({x:n,y:e[0].y-this.commitSpacing*(r+1)})):[],h=t.get(r)||[];t.set(r,[...h,[s,...o,i]])}):i.forEach(e=>{if(e.length<=1)return;const s=e[0],i=e[e.length-1],n=e[1].y,a=Math.round(Math.abs(s.x-i.x)/this.commitSpacing)-1,o=a>0?new Array(a).fill(0).map((t,r)=>({y:n,x:e[0].x+this.commitSpacing*(r+1)})):[],h=t.get(r)||[];t.set(r,[...h,[s,...o,i]])})}),t}},r.toSvgPath=function(t,e,r){return t.map(t=>"M"+t.map(({x:t,y:s},i,n)=>{if(e&&n.length>1&&(1===i||i===n.length-1)){const e=n[i-1];if(r){const r=(e.y+s)/2;return`C ${e.x} ${r} ${t} ${r} ${t} ${s}`}{const r=(e.x+t)/2;return`C ${r} ${e.y} ${r} ${s} ${t} ${s}`}}return`L ${t} ${s}`}).join(" ").slice(1)).join(" ")}},{"./utils":16}],4:[function(t,e,r){var s;s=function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=t("./gitgraph");r.GitgraphCore=e.GitgraphCore,r.Mode=e.Mode;var s=t("./user-api/gitgraph-user-api");r.GitgraphUserApi=s.GitgraphUserApi;var i=t("./user-api/branch-user-api");r.BranchUserApi=i.BranchUserApi;var n=t("./branch");r.Branch=n.Branch;var a=t("./commit");r.Commit=a.Commit;var o=t("./tag");r.Tag=o.Tag;var h=t("./refs");r.Refs=h.Refs;var c=t("./template");r.MergeStyle=c.MergeStyle,r.TemplateName=c.TemplateName,r.templateExtend=c.templateExtend;var l=t("./orientation");r.Orientation=l.Orientation;var m=t("./branches-paths");r.toSvgPath=m.toSvgPath;var u=t("./utils");r.arrowSvgPath=u.arrowSvgPath},"object"==typeof r&&void 0!==e?s():"function"==typeof define&&define.amd?define(s):s()},{"./branch":1,"./branches-paths":3,"./commit":5,"./gitgraph":6,"./orientation":10,"./refs":11,"./tag":12,"./template":13,"./user-api/branch-user-api":14,"./user-api/gitgraph-user-api":15,"./utils":16}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./tag"),i=()=>(Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)).substring(0,40);class n{constructor(t){let e,r;this.refs=[],this.x=0,this.y=0;try{[,e,r]=t.author.match(/(.*) <(.*)>/)}catch(s){[e,r]=[t.author,""]}this.author={name:e,email:r,timestamp:Date.now()},this.committer={name:e,email:r,timestamp:Date.now()},this.subject=t.subject,this.body=t.body||"",this.hash=t.hash||i(),this.hashAbbrev=this.hash.substring(0,7),this.parents=t.parents?t.parents:[],this.parentsAbbrev=this.parents.map(t=>t.substring(0,7)),this.style=Object.assign({},t.style,{message:Object.assign({},t.style.message),dot:Object.assign({},t.style.dot)}),this.dotText=t.dotText,this.onClick=(()=>t.onClick?t.onClick(this):void 0),this.onMessageClick=(()=>t.onMessageClick?t.onMessageClick(this):void 0),this.onMouseOver=(()=>t.onMouseOver?t.onMouseOver(this):void 0),this.onMouseOut=(()=>t.onMouseOut?t.onMouseOut(this):void 0),this.renderDot=t.renderDot,this.renderMessage=t.renderMessage,this.renderTooltip=t.renderTooltip}get message(){let t="";return this.style.message.displayHash&&(t+=`${this.hashAbbrev} `),t+=this.subject,this.style.message.displayAuthor&&(t+=` - ${this.author.name} <${this.author.email}>`),t}get branchToDisplay(){return this.branches?this.branches[0]:""}setRefs(t){return this.refs=t.getNames(this.hash),this}setTags(t,e){return this.tags=t.getNames(this.hash).map(t=>new s.Tag(t,e(t),this.style)),this}setBranches(t){return this.branches=t,this}setPosition({x:t,y:e}){return this.x=t,this.y=e,this}withDefaultColor(t){const e=Object.assign({},this.style,{dot:Object.assign({},this.style.dot),message:Object.assign({},this.style.message)});e.color||(e.color=t),e.dot.color||(e.dot.color=t),e.message.color||(e.message.color=t);const r=this.cloneCommit();return r.style=e,r}cloneCommit(){const t=new n({author:`${this.author.name} <${this.author.email}>`,subject:this.subject,style:this.style,body:this.body,hash:this.hash,parents:this.parents,dotText:this.dotText,onClick:this.onClick,onMessageClick:this.onMessageClick,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,renderDot:this.renderDot,renderMessage:this.renderMessage,renderTooltip:this.renderTooltip});return t.refs=this.refs,t.branches=this.branches,t.tags=this.tags,t.x=this.x,t.y=this.y,t}}r.Commit=n},{"./tag":12}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./branch"),i=t("./graph-rows"),n=t("./branches-order"),a=t("./template"),o=t("./refs"),h=t("./branches-paths"),c=t("./utils"),l=t("./orientation"),m=t("./user-api/gitgraph-user-api");var u;!function(t){t.Compact="compact"}(u||(u={})),r.Mode=u;r.GitgraphCore=class{constructor(t={}){this.refs=new o.Refs,this.tags=new o.Refs,this.tagStyles={},this.commits=[],this.branches=new Map,this.listeners=[],this.template=a.getTemplate(t.template),this.currentBranch=this.createBranch("master"),this.orientation=t.orientation,this.reverseArrow=c.booleanOptionOr(t.reverseArrow,!1),this.initCommitOffsetX=c.numberOptionOr(t.initCommitOffsetX,0),this.initCommitOffsetY=c.numberOptionOr(t.initCommitOffsetY,0),this.mode=t.mode,this.author=t.author||"Sergio Flores <saxo-guy@epic.com>",this.commitMessage=t.commitMessage||"He doesn't like George Michael! Boooo!",this.generateCommitHash="function"==typeof t.generateCommitHash?t.generateCommitHash:()=>void 0,this.branchesOrderFunction="function"==typeof t.compareBranchesOrder?t.compareBranchesOrder:void 0}get isHorizontal(){return this.orientation===l.Orientation.Horizontal||this.orientation===l.Orientation.HorizontalReverse}get isVertical(){return!this.isHorizontal}get isReverse(){return this.orientation===l.Orientation.HorizontalReverse||this.orientation===l.Orientation.VerticalReverse}getUserApi(){return new m.GitgraphUserApi(this,()=>this.next())}subscribe(t){this.listeners.push(t);let e=!0;return()=>{if(!e)return;e=!1;const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}}getRenderedData(){const t=this.computeRenderedCommits(),e=this.computeRenderedBranchesPaths(t),r=this.computeCommitMessagesX(e);return this.computeBranchesColor(t,e),{commits:t,branchesPaths:e,commitMessagesX:r}}createBranch(t){let e={gitgraph:this,name:"",parentCommitHash:this.refs.getCommit("HEAD"),style:this.template.branch,onGraphUpdate:()=>this.next()};"string"==typeof t?e.name=t:(t.style=t.style||{},e=Object.assign({},e,t,{style:Object.assign({},e.style,t.style,{label:Object.assign({},e.style.label,t.style.label)})}));const r=new s.Branch(e);return this.branches.set(r.name,r),r}computeRenderedCommits(){const t=this.commits.map(t=>this.withBranches(t));return t.map(t=>t.setRefs(this.refs)).map(e=>this.withPosition(t,e)).map(e=>e.withDefaultColor(this.getBranchDefaultColor(t,e.branchToDisplay))).map(t=>t.setTags(this.tags,t=>Object.assign({},this.tagStyles[t],this.template.tag)))}computeRenderedBranchesPaths(t){return new h.BranchesPathsCalculator(t,this.branches,this.template.commit.spacing,this.isVertical,this.isReverse,()=>s.createDeletedBranch(this,this.template.branch,()=>this.next())).execute()}computeBranchesColor(t,e){Array.from(e).forEach(([e])=>{e.computedColor=e.style.color||this.getBranchDefaultColor(t,e.name)})}computeCommitMessagesX(t){return Array.from(t).length*this.template.branch.spacing}withBranches(t){const e=this.getBranches();let r=Array.from((e.get(t.hash)||new Set).values());return 0===r.length&&(r=[s.DELETED_BRANCH_NAME]),t.setBranches(r)}getBranches(){const t=new Map,e=[];return this.refs.getAllNames().filter(t=>"HEAD"!==t).forEach(r=>{const s=this.refs.getCommit(r);for(s&&e.push(s);e.length>0;){const s=e.pop(),i=this.commits.find(({hash:t})=>t===s),n=t.get(s)||new Set;n.add(r),t.set(s,n),i.parents.length>0&&e.push(i.parents[0])}}),t}withPosition(t,e){const r=i.createGraphRows(this.mode,this.commits),s=r.getRowOf(e.hash),a=r.getMaxRow(),o=new n.BranchesOrder(t,this.template.colors,this.branchesOrderFunction).get(e.branchToDisplay);switch(this.orientation){default:return e.setPosition({x:this.initCommitOffsetX+this.template.branch.spacing*o,y:this.initCommitOffsetY+this.template.commit.spacing*(a-s)});case l.Orientation.VerticalReverse:return e.setPosition({x:this.initCommitOffsetX+this.template.branch.spacing*o,y:this.initCommitOffsetY+this.template.commit.spacing*s});case l.Orientation.Horizontal:return e.setPosition({x:this.initCommitOffsetX+this.template.commit.spacing*s,y:this.initCommitOffsetY+this.template.branch.spacing*o});case l.Orientation.HorizontalReverse:return e.setPosition({x:this.initCommitOffsetX+this.template.commit.spacing*(a-s),y:this.initCommitOffsetY+this.template.branch.spacing*o})}}getBranchDefaultColor(t,e){return new n.BranchesOrder(t,this.template.colors,this.branchesOrderFunction).getColorOf(e)}next(){this.listeners.forEach(t=>t(this.getRenderedData()))}}},{"./branch":1,"./branches-order":2,"./branches-paths":3,"./graph-rows":8,"./orientation":10,"./refs":11,"./template":13,"./user-api/gitgraph-user-api":15,"./utils":16}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./regular");r.CompactGraphRows=class extends s.RegularGraphRows{computeRowsFromCommits(t){t.forEach((e,r)=>{let s=r;if(0!==r){const i=this.getRowOf(e.parents[0]),n=t[r-1];s=Math.max(i+1,this.getRowOf(n.hash)),e.parents.length>1&&i<this.getRowOf(e.parents[1])&&s++}this.rows.set(e.hash,s)})}}},{"./regular":9}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("../gitgraph"),i=t("./compact"),n=t("./regular");r.createGraphRows=function(t,e){return t===s.Mode.Compact?new i.CompactGraphRows(e):new n.RegularGraphRows(e)}},{"../gitgraph":6,"./compact":7,"./regular":9}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.RegularGraphRows=class{constructor(t){this.rows=new Map,this.computeRowsFromCommits(t)}getRowOf(t){return this.rows.get(t)||0}getMaxRow(){return function(t){const e=new Set;return t.forEach(t=>e.add(t)),Array.from(e)}(Array.from(this.rows.values())).length-1}computeRowsFromCommits(t){t.forEach((t,e)=>{this.rows.set(t.hash,e)})}}},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(t){t.VerticalReverse="vertical-reverse",t.Horizontal="horizontal",t.HorizontalReverse="horizontal-reverse"}(r.Orientation||(r.Orientation={}))},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Refs=class{constructor(){this.commitPerName=new Map,this.namesPerCommit=new Map}set(t,e){const r=this.commitPerName.get(t);return r&&this.removeNameFrom(r,t),this.addNameTo(e,t),this.addCommitTo(t,e),this}getCommit(t){return this.commitPerName.get(t)}getNames(t){return this.namesPerCommit.get(t)||[]}getAllNames(){return Array.from(this.commitPerName.keys())}hasCommit(t){return this.namesPerCommit.has(t)}hasName(t){return this.commitPerName.has(t)}removeNameFrom(t,e){const r=this.namesPerCommit.get(t)||[];this.namesPerCommit.set(t,r.filter(t=>t!==e))}addNameTo(t,e){const r=this.namesPerCommit.get(t)||[];this.namesPerCommit.set(t,[...r,e])}addCommitTo(t,e){this.commitPerName.set(t,e)}}},{}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./template"),i=t("./utils");r.Tag=class{get style(){return{strokeColor:this.tagStyle.strokeColor||this.commitStyle.color,bgColor:this.tagStyle.bgColor||this.commitStyle.color,color:this.tagStyle.color||"white",font:this.tagStyle.font||this.commitStyle.message.font||s.DEFAULT_FONT,borderRadius:i.numberOptionOr(this.tagStyle.borderRadius,10),pointerWidth:i.numberOptionOr(this.tagStyle.pointerWidth,12)}}constructor(t,e,r){this.name=t,this.tagStyle=e,this.commitStyle=r}}},{"./template":13,"./utils":16}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./utils");var i;!function(t){t.Bezier="bezier",t.Straight="straight"}(i||(i={})),r.MergeStyle=i,r.DEFAULT_FONT="normal 12pt Calibri";class n{constructor(t){t.branch=t.branch||{},t.branch.label=t.branch.label||{},t.arrow=t.arrow||{},t.commit=t.commit||{},t.commit.dot=t.commit.dot||{},t.commit.message=t.commit.message||{},this.colors=t.colors||["#000000"],this.branch={color:t.branch.color,lineWidth:t.branch.lineWidth||2,mergeStyle:t.branch.mergeStyle||i.Bezier,spacing:s.numberOptionOr(t.branch.spacing,20),label:{display:s.booleanOptionOr(t.branch.label.display,!0),color:t.branch.label.color||t.commit.color,strokeColor:t.branch.label.strokeColor||t.commit.color,bgColor:t.branch.label.bgColor||"white",font:t.branch.label.font||t.commit.message.font||r.DEFAULT_FONT,borderRadius:s.numberOptionOr(t.branch.label.borderRadius,10)}},this.arrow={size:t.arrow.size||null,color:t.arrow.color||null,offset:t.arrow.offset||2},this.commit={color:t.commit.color,spacing:s.numberOptionOr(t.commit.spacing,25),hasTooltipInCompactMode:s.booleanOptionOr(t.commit.hasTooltipInCompactMode,!0),dot:{color:t.commit.dot.color||t.commit.color,size:t.commit.dot.size||3,strokeWidth:s.numberOptionOr(t.commit.dot.strokeWidth,0),strokeColor:t.commit.dot.strokeColor,font:t.commit.dot.font||t.commit.message.font||"normal 10pt Calibri"},message:{display:s.booleanOptionOr(t.commit.message.display,!0),displayAuthor:s.booleanOptionOr(t.commit.message.displayAuthor,!0),displayHash:s.booleanOptionOr(t.commit.message.displayHash,!0),color:t.commit.message.color||t.commit.color,font:t.commit.message.font||r.DEFAULT_FONT}},this.tag=t.tag||{}}}r.Template=n;const a=new n({colors:["#6963FF","#47E8D4","#6BDB52","#E84BA5","#FFA657"],branch:{color:"#000000",lineWidth:4,spacing:50,mergeStyle:i.Straight},commit:{spacing:60,dot:{size:16,strokeColor:"#000000",strokeWidth:4},message:{color:"black"}},arrow:{size:16,offset:-1.5}});r.blackArrowTemplate=a;const o=new n({colors:["#979797","#008fb5","#f1c109"],branch:{lineWidth:10,spacing:50},commit:{spacing:80,dot:{size:14},message:{font:"normal 14pt Arial"}}});var h;function c(t){return t?"string"==typeof t?{[h.BlackArrow]:a,[h.Metro]:o}[t]:t:o}r.metroTemplate=o,function(t){t.Metro="metro",t.BlackArrow="blackarrow"}(h||(h={})),r.TemplateName=h,r.templateExtend=function(t,e){const r=c(t);return e.branch||(e.branch={}),e.commit||(e.commit={}),{colors:e.colors||r.colors,arrow:Object.assign({},r.arrow,e.arrow),branch:Object.assign({},r.branch,e.branch,{label:Object.assign({},r.branch.label,e.branch.label)}),commit:Object.assign({},r.commit,e.commit,{dot:Object.assign({},r.commit.dot,e.commit.dot),message:Object.assign({},r.commit.message,e.commit.message)}),tag:Object.assign({},r.tag,e.tag)}},r.getTemplate=c},{"./utils":16}],14:[function(t,e,r){"use strict";var s=this&&this.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&(r[s[i]]=t[s[i]])}return r};Object.defineProperty(r,"__esModule",{value:!0});const i=t("../gitgraph"),n=t("../commit"),a=t("../utils");class o{constructor(t,e,r){this._branch=t,this.name=t.name,this._graph=e,this._onGraphUpdate=r}commit(t){return"string"==typeof t&&(t={subject:t}),t||(t={}),this._commitWithParents(t,[]),this._onGraphUpdate(),this}merge(...t){let e=t[0];(function(t){return"object"==typeof t&&!(t instanceof o)})(e)||(e={branch:t[0],fastForward:!1,commitOptions:{subject:t[1]}});const{branch:r,fastForward:s,commitOptions:i}=e,n="string"==typeof r?r:r.name,a=this._graph.refs.getCommit(n);if(!a)throw new Error(`The branch called "${n}" is unknown`);let h=!1;const c=this._graph.refs.getCommit(this._branch.name);return h=!!c&&this._areCommitsConnected(c,a),s&&h?this._fastForwardTo(a):this._commitWithParents(Object.assign({},i,{subject:i&&i.subject||`Merge branch ${n}`}),[a]),this._onGraphUpdate(),this}tag(t){let e,r;return"string"==typeof t?e=t:(e=t.name,r=t.style),this._graph.getUserApi().tag({name:e,ref:this._branch.name,style:r}),this}checkout(){return this._graph.currentBranch=this._branch,this}_commitWithParents(t,e){const r=this._graph.refs.getCommit(this._branch.name);r?e.unshift(r):this._branch.parentCommitHash&&e.unshift(this._branch.parentCommitHash);const{tag:i}=t,a=s(t,["tag"]),o=new n.Commit(Object.assign({hash:this._graph.generateCommitHash(),author:this._branch.commitDefaultOptions.author||this._graph.author,subject:this._branch.commitDefaultOptions.subject||this._graph.commitMessage},a,{parents:e,style:this._getCommitStyle(t.style)}));if(r){this._graph.refs.getNames(r).forEach(t=>this._graph.refs.set(t,o.hash))}else this._graph.refs.set(this._branch.name,o.hash);this._graph.commits.push(o),this.checkout(),this._graph.refs.set("HEAD",o.hash),i&&this.tag(i)}_areCommitsConnected(t,e){const r=this._graph.commits.find(({hash:t})=>e===t);return!!r&&(!(0===r.parents.length)&&(!!r.parents.includes(t)||r.parents.some(e=>this._areCommitsConnected(t,e))))}_fastForwardTo(t){this._graph.refs.set(this._branch.name,t)}_getCommitStyle(t={}){const e=Object.assign({},a.withoutUndefinedKeys(this._graph.template.commit.message),a.withoutUndefinedKeys(this._branch.commitDefaultOptions.style.message),t.message);return(this._graph.isHorizontal||this._graph.mode===i.Mode.Compact)&&(e.display=!1),Object.assign({},a.withoutUndefinedKeys(this._graph.template.commit),a.withoutUndefinedKeys(this._branch.commitDefaultOptions.style),t,{message:e,dot:Object.assign({},a.withoutUndefinedKeys(this._graph.template.commit.dot),a.withoutUndefinedKeys(this._branch.commitDefaultOptions.style.dot),t.dot)})}}r.BranchUserApi=o},{"../commit":5,"../gitgraph":6,"../utils":16}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("../commit"),i=t("../branch"),n=t("../refs");r.GitgraphUserApi=class{constructor(t,e){this._graph=t,this._onGraphUpdate=e}clear(){return this._graph.refs=new n.Refs,this._graph.tags=new n.Refs,this._graph.commits=[],this._graph.branches=new Map,this._graph.currentBranch=this._graph.createBranch("master"),this._onGraphUpdate(),this}commit(t){return this._graph.currentBranch.getUserApi().commit(t),this}branch(t){return this._graph.createBranch(t).getUserApi()}tag(...t){let e,r,s,i;if("string"==typeof t[0]?(e=t[0],r=t[1]):(e=t[0].name,r=t[0].ref,s=t[0].style),!r){const t=this._graph.refs.getCommit("HEAD");if(!t)return this;r=t}if(this._graph.refs.hasCommit(r)&&(i=r),this._graph.refs.hasName(r)&&(i=this._graph.refs.getCommit(r)),!i)throw new Error(`The ref "${r}" does not exist`);return this._graph.tags.set(e,i),this._graph.tagStyles[e]=s,this._onGraphUpdate(),this}import(t){const e=new Error("Only `git2json` format is supported for imported data.");if(!Array.isArray(t))throw e;if(!t.every(t=>"object"==typeof t&&"object"==typeof t.author&&Array.isArray(t.refs)))throw e;const r=t.map(t=>Object.assign({},t,{style:Object.assign({},this._graph.template.commit),author:`${t.author.name} <${t.author.email}>`})).reverse();return this.clear(),this._graph.commits=r.map(t=>new s.Commit(t)),r.forEach(({refs:t,hash:e})=>{t&&e&&(t.map(t=>t.split("tag: ")).map(([t,e])=>e).filter(t=>"string"==typeof t).forEach(t=>this._graph.tags.set(t,e)),t.filter(t=>!t.startsWith("tag: ")).forEach(t=>this._graph.refs.set(t,e)))}),this._graph.commits.map(t=>this._withBranches(t)).reduce((t,e)=>e.branches?(e.branches.forEach(e=>t.add(e)),t):t,new Set).forEach(t=>this.branch(t)),this._onGraphUpdate(),this}_withBranches(t){const e=this._getBranches();let r=Array.from((e.get(t.hash)||new Set).values());return 0===r.length&&(r=[i.DELETED_BRANCH_NAME]),t.setBranches(r)}_getBranches(){const t=new Map,e=[];return this._graph.refs.getAllNames().filter(t=>"HEAD"!==t).forEach(r=>{const s=this._graph.refs.getCommit(r);for(s&&e.push(s);e.length>0;){const s=e.pop(),i=this._graph.commits.find(({hash:t})=>t===s),n=t.get(s)||new Set;n.add(r),t.set(s,n),i.parents.length>0&&e.push(i.parents[0])}}),t}}},{"../branch":1,"../commit":5,"../refs":11}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./orientation");function i(t,e){return Object.assign({},e.reduce((e,r)=>Object.assign({},e,{[r]:t[r]}),{}))}function n(t){return void 0===t}r.booleanOptionOr=function(t,e){return"boolean"==typeof t?t:e},r.numberOptionOr=function(t,e){return"number"==typeof t?t:e},r.pick=i,r.debug=function(t,e){console.log(JSON.stringify(t.map(t=>i(t,e)),null,2))},r.isUndefined=n,r.withoutUndefinedKeys=function(t={}){return Object.keys(t).reduce((e,r)=>n(t[r])?e:Object.assign({},e,{[r]:t[r]}),{})},r.arrowSvgPath=function(t,e,r){const i=r.style.dot.size,n=t.template.arrow.size,a=i+t.template.arrow.offset,o=Math.PI/7,h=function(t,e,r){const i=e.x-r.x,n=e.y-r.y,a=t.template.commit.spacing;let o,h;switch(t.orientation){case s.Orientation.Horizontal:o=n,h=-a;break;case s.Orientation.HorizontalReverse:o=n,h=a;break;case s.Orientation.VerticalReverse:o=-a,h=i;break;default:o=a,h=i}return t.isVertical?Math.abs(n)>a&&(h=0):Math.abs(i)>a&&(o=0),t.reverseArrow&&(o*=-1,h*=-1),Math.atan2(o,h)}(t,e,r),c=a*Math.cos(h),l=a*Math.sin(h),m=(a+n)*Math.cos(h-o),u=(a+n)*Math.sin(h-o),p=(a+n/2)*Math.cos(h),g=(a+n/2)*Math.sin(h),d=(a+n)*Math.cos(h+o),f=(a+n)*Math.sin(h+o);return`M${c},${l} L${m},${u} Q${p},${g} ${d},${f} L${d},${f}`}},{"./orientation":10}],17:[function(t,e,r){var s,i;s=this,i=function(t,e){"use strict";var r="http://www.w3.org/2000/svg";function s(t){var e=document.createElementNS(r,"g");return t.children.forEach(function(t){return t&&e.appendChild(t)}),t.translate&&e.setAttribute("transform","translate("+t.translate.x+", "+t.translate.y+")"),t.fill&&e.setAttribute("fill",t.fill),t.stroke&&e.setAttribute("stroke",t.stroke),t.strokeWidth&&e.setAttribute("stroke-width",t.strokeWidth.toString()),t.onClick&&e.addEventListener("click",t.onClick),t.onMouseOver&&e.addEventListener("mouseover",t.onMouseOver),t.onMouseOut&&e.addEventListener("mouseout",t.onMouseOut),e}function i(t){var e=document.createElementNS(r,"text");return e.setAttribute("alignment-baseline","central"),e.setAttribute("dominant-baseline","central"),e.textContent=t.content,t.fill&&e.setAttribute("fill",t.fill),t.font&&e.setAttribute("style","font: "+t.font),t.anchor&&e.setAttribute("text-anchor",t.anchor),t.translate&&(e.setAttribute("x",t.translate.x.toString()),e.setAttribute("y",t.translate.y.toString())),t.onClick&&e.addEventListener("click",t.onClick),e}function n(t){var e=document.createElementNS(r,"path");return e.setAttribute("d",t.d),t.fill&&e.setAttribute("fill",t.fill),t.stroke&&e.setAttribute("stroke",t.stroke),t.strokeWidth&&e.setAttribute("stroke-width",t.strokeWidth.toString()),t.translate&&e.setAttribute("transform","translate("+t.translate.x+", "+t.translate.y+")"),e}function a(t){var e=document.createElementNS(r,"use");return e.setAttribute("href","#"+t),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","#"+t),e}var o=10,h=5;function c(t,e){var n=function(t){var e=document.createElementNS(r,"rect");return e.setAttribute("width",t.width.toString()),e.setAttribute("height",t.height.toString()),t.borderRadius&&e.setAttribute("rx",t.borderRadius.toString()),t.fill&&e.setAttribute("fill",t.fill||"transparent"),t.stroke&&e.setAttribute("stroke",t.stroke),e}({width:0,height:0,borderRadius:t.style.label.borderRadius,stroke:t.style.label.strokeColor||e.style.color,fill:t.style.label.bgColor}),a=i({content:t.name,translate:{x:o,y:0},font:t.style.label.font,fill:t.style.label.color||e.style.color}),c=s({children:[n]});return new MutationObserver(function(){var t=a.getBBox(),e=t.height,r=t.width+2*o,s=e+2*h;n.setAttribute("width",r.toString()),n.setAttribute("height",s.toString()),a.setAttribute("y",(s/2).toString())}).observe(c,{attributes:!1,subtree:!1,childList:!0}),c.appendChild(a),c}var l=10,m=5;var u=10,p=10;function g(t){var e=0;if(t){var r=t.getBoundingClientRect().height,s=window.getComputedStyle(t).marginTop||"0px";e=r+parseInt(s.replace("px",""),10)}return e}t.createGitgraph=function(t,d){var f,b,y={},v={},O=!1,w=0,C=null,A=function(t){var e=document.createElementNS(r,"svg");return t?(t.children&&t.children.forEach(function(t){return e.appendChild(t)}),t.viewBox&&e.setAttribute("viewBox",t.viewBox),t.height&&e.setAttribute("height",t.height.toString()),t.width&&e.setAttribute("width",t.width.toString()),e):e}();new MutationObserver(function(){var t,r,s,i,n,a,c,m;O?(O=!1,a=Array.from(b.children),c=0,m=_.orientation===e.Orientation.VerticalReverse?a:a.reverse(),v=m.reduce(function(t,e){var r=parseInt(e.getAttribute("transform").split(",")[1].slice(0,-1),10),s=e.getElementsByTagName("foreignObject")[0],i=s&&s.firstElementChild;return t[r]=r+c,c+=g(i),t},{}),M(f)):(_.isHorizontal||Object.keys(y).forEach(function(t){var e=y[t],r=e.branchLabel,s=e.tags,i=e.message,n=w;if(r){x(r,n);var a=r.getBBox().width+2*o;n+=a+10}s.forEach(function(t){x(t,n);var e=parseFloat(t.getAttribute("data-offset")||"0"),r=t.getBBox().width+2*l+e;n+=r+10}),i&&x(i,n)}),t=A.getBBox(),r=t.height,s=t.width,i=_.isHorizontal?50:o+u,n=_.isHorizontal?50:h+u,A.setAttribute("width",(s+i).toString()),A.setAttribute("height",(r+n).toString()))}).observe(A,{attributes:!1,subtree:!0,childList:!0}),t.appendChild(A);var _=new e.GitgraphCore(d);return _.subscribe(function(t){O=!0,M(t)}),_.getUserApi();function M(t){y={};var h=t.commits,g=t.branchesPaths;w=t.commitMessagesX,f=t,b=function(t){return s({children:t.map(function(o){var h=E(o),g=h.x,d=h.y;return s({translate:{x:g,y:d},children:[function(t){if(t.renderDot)return t.renderDot(t);var o=t.hash,h=function(t){var e=document.createElementNS(r,"circle");return e.setAttribute("cx",t.radius.toString()),e.setAttribute("cy",t.radius.toString()),e.setAttribute("r",t.radius.toString()),t.id&&e.setAttribute("id",t.id),t.fill&&e.setAttribute("fill",t.fill),e}({id:o,radius:t.style.dot.size,fill:t.style.dot.color||""}),c="clip-"+t.hash,l=document.createElementNS(r,"clipPath");l.setAttribute("id",c),l.appendChild(a(o));var m=a(o);m.setAttribute("clip-path","url(#"+c+")"),m.setAttribute("stroke",t.style.dot.strokeColor||"");var g=t.style.dot.strokeWidth?2*t.style.dot.strokeWidth:0;m.setAttribute("stroke-width",g.toString());var d,f,b=t.dotText?i({content:t.dotText,font:t.style.dot.font,anchor:"middle",translate:{x:t.style.dot.size,y:t.style.dot.size}}):null;return s({onClick:t.onClick,onMouseOver:function(){!function(t){if(A.firstChild&&(!_.isVertical||_.mode===e.Mode.Compact)&&(!_.isVertical||t.style.hasTooltipInCompactMode)){var r=t.renderTooltip?t.renderTooltip(t):function(t){var e=n({d:"",fill:"#EEE"}),r=i({translate:{x:p+u,y:0},content:t.hashAbbrev+" - "+t.subject,fill:"#333"}),a=2*t.style.dot.size,o=s({translate:{x:a,y:a/2},children:[e]});return new MutationObserver(function(){var t=r.getBBox().width,s=p+t+2*u,i=["M 0,0","L "+p+","+p,"V 20","Q "+p+",25 "+(p+5)+",25","H "+(s-5),"Q "+s+",25 "+s+",20","V -20","Q "+s+",-25 "+(s-5)+",-25","H "+(p+5),"Q "+p+",-25 "+p+",-20","V -"+p,"z"].join(" ");e.setAttribute("d",i.toString())}).observe(o,{attributes:!1,subtree:!1,childList:!0}),o.appendChild(r),o}(t);C=s({translate:E(t),children:[r]}),A.firstChild.appendChild(C)}}(t),t.onMouseOver()},onMouseOut:function(){C&&C.remove(),t.onMouseOut()},children:[(d=[h,l],f=document.createElementNS(r,"defs"),d.forEach(function(t){return f.appendChild(t)}),f),m,b]})}(o)].concat(function(r){if(!_.template.arrow.size)return[null];var i=r.style.dot.size;return r.parents.map(function(a){var o=t.find(function(t){var e=t.hash;return e===a});if(!o)return null;var h=_.reverseArrow?{x:i+(o.x-r.x),y:i+(o.y-r.y)}:{x:i,y:i},c=n({d:e.arrowSvgPath(_,o,r),fill:_.template.arrow.color||""});return s({translate:h,children:[c]})})}(o),[s({translate:{x:-g,y:0},children:[function(t){if(!t.style.message.display)return null;var e;if(t.renderMessage)return S(e=s({children:[]})),e.appendChild(t.renderMessage(t)),B(t,e),e;var n=i({content:t.message,fill:t.style.message.color||"",font:t.style.message.font,onClick:t.onMessageClick});if(e=s({translate:{x:0,y:t.style.dot.size},children:[n]}),t.body){var a=function(t){var e=document.createElementNS(r,"foreignObject");e.setAttribute("width",t.width.toString()),t.translate&&(e.setAttribute("x",t.translate.x.toString()),e.setAttribute("y",t.translate.y.toString()));var s=document.createElement("p");return s.textContent=t.content,e.appendChild(s),e}({width:600,translate:{x:10,y:0},content:t.body});S(e),e.appendChild(a)}return B(t,e),e}(o)].concat(function(t){return Array.from(_.branches.values()).map(function(e){if(!e.style.label.display)return null;var r,i=_.refs.getCommit(e.name);if(t.hash!==i)return null;if(t.branchToDisplay!==e.name)return null;if(_.isVertical)r=s({children:[c(e,t)]});else{var n=2*t.style.dot.size;r=s({translate:{x:t.x,y:n+10},children:[c(e,t)]})}return function(t,e){y[t.hashAbbrev]||k(t),y[t.hashAbbrev].branchLabel=e}(t,r),r})}(o),function(t){return t.tags?t.tags.map(function(e){var r=function(t){var e=n({d:"",fill:t.style.bgColor,stroke:t.style.strokeColor}),r=i({content:t.name,fill:t.style.color,font:t.style.font,translate:{x:0,y:0}}),a=s({children:[e]}),o=t.style.pointerWidth;return a.setAttribute("data-offset",o.toString()),new MutationObserver(function(){var s=r.getBBox(),i=s.height,n=s.width;if(0!==i&&0!==n){var a=t.style.borderRadius,h=o+n+2*l,c=i+2*m,u=["M 0,0","L "+o+","+c/2,"V "+c/2,"Q "+o+","+c/2+" "+(o+a)+","+c/2,"H "+(h-a),"Q "+h+","+c/2+" "+h+","+(c/2-a),"V -"+(c/2-a),"Q "+h+",-"+c/2+" "+(h-a)+",-"+c/2,"H "+(o+a),"Q "+o+",-"+c/2+" "+o+",-"+c/2,"V -"+c/2,"z"].join(" ");e.setAttribute("d",u.toString()),r.setAttribute("x",(o+l).toString())}}).observe(a,{attributes:!1,subtree:!1,childList:!0}),a.appendChild(r),a}(e);return function(t,e){y[t.hashAbbrev]||k(t),y[t.hashAbbrev].tags.push(e)}(t,r),s({translate:{x:0,y:t.style.dot.size},children:[r]})}):[]}(o))})])})})})}(h),A.innerHTML="",A.appendChild(s({translate:{x:o,y:u},children:[function(t){var r=_.template.commit.dot.size,i=_.template.branch.mergeStyle===e.MergeStyle.Bezier;return s({children:Array.from(t).map(function(t){var s=t[0],a=t[1];return n({d:e.toSvgPath(a.map(function(t){return t.map(E)}),i,_.isVertical),fill:"transparent",stroke:s.computedColor||"",strokeWidth:s.style.lineWidth,translate:{x:r,y:r}})})})}(g),b]}))}function x(t,e){var r=t.getAttribute("transform")||"translate(0, 0)";t.setAttribute("transform",r.replace(/translate\(([\d\.]+),/,"translate("+e+","))}function S(t){function e(t){if("foreignObject"===t.nodeName){var r=t.firstChild&&t.firstChild.parentElement;if(!r)return;r.setAttribute("height",g(r.firstElementChild).toString())}t.childNodes.forEach(e)}new MutationObserver(function(t){t.forEach(function(t){return e(t.target)})}).observe(t,{attributes:!1,subtree:!1,childList:!0})}function E(t){var e=t.x,r=t.y;return{x:e,y:v[r]||r}}function B(t,e){y[t.hashAbbrev]||k(t),y[t.hashAbbrev].message=e}function k(t){y[t.hashAbbrev]={branchLabel:null,tags:[],message:null}}},t.Mode=e.Mode,t.Orientation=e.Orientation,t.TemplateName=e.TemplateName,t.templateExtend=e.templateExtend,t.MergeStyle=e.MergeStyle,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof r&&void 0!==e?i(r,t("@gitgraph/core")):"function"==typeof define&&define.amd?define(["exports","@gitgraph/core"],i):i((s.gitgraph=s.gitgraph||{},s.gitgraph.core={}),s.gitgraph.core)},{"@gitgraph/core":4}]},{},[17]);
!function(){return function t(e,r,s){function i(a,o){if(!r[a]){if(!e[a]){var h="function"==typeof require&&require;if(!o&&h)return h(a,!0);if(n)return n(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return i(e[a][1][t]||t)},l,l.exports,t,e,r,s)}return r[a].exports}for(var n="function"==typeof require&&require,a=0;a<s.length;a++)i(s[a]);return i}}()({1:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./user-api/branch-user-api"),i="";r.DELETED_BRANCH_NAME=i;class n{constructor(t){this.gitgraph=t.gitgraph,this.name=t.name,this.style=t.style,this.parentCommitHash=t.parentCommitHash,this.commitDefaultOptions=t.commitDefaultOptions||{style:{}},this.onGraphUpdate=t.onGraphUpdate}getUserApi(){return new s.BranchUserApi(this,this.gitgraph,this.onGraphUpdate)}isDeleted(){return this.name===i}}r.Branch=n,r.createDeletedBranch=function(t,e,r){return new n({name:i,gitgraph:t,style:e,onGraphUpdate:r})}},{"./user-api/branch-user-api":14}],2:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.BranchesOrder=class{constructor(t,e,r){this.branches=new Set,this.colors=e,t.forEach(t=>this.branches.add(t.branchToDisplay)),r&&(this.branches=new Set(Array.from(this.branches).sort(r)))}get(t){return Array.from(this.branches).findIndex(e=>e===t)}getColorOf(t){return this.colors[this.get(t)%this.colors.length]}}},{}],3:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./utils");r.BranchesPathsCalculator=class{constructor(t,e,r,s,i,n){this.branchesPaths=new Map,this.commits=t,this.branches=e,this.commitSpacing=r,this.isGraphVertical=s,this.isGraphReverse=i,this.createDeletedBranch=n}execute(){return this.fromCommits(),this.withMergeCommits(),this.smoothBranchesPaths()}fromCommits(){this.commits.forEach(t=>{let e=this.branches.get(t.branchToDisplay);e||(e=this.getDeletedBranchInPath()||this.createDeletedBranch());const r=[],s=this.branchesPaths.get(e),i=this.commits.find(({hash:e})=>e===t.parents[0]);s?r.push(...s):i&&r.push({x:i.x,y:i.y}),r.push({x:t.x,y:t.y}),this.branchesPaths.set(e,r)})}withMergeCommits(){this.commits.filter(({parents:t})=>t.length>1).forEach(t=>{const e=this.commits.find(({hash:e})=>e===t.parents[1]);if(!e)return;const r=e.branches?e.branches[0]:"";let s=this.branches.get(r);if(!s&&!(s=this.getDeletedBranchInPath()))return;const i=[...this.branchesPaths.get(s)||[]];this.branchesPaths.set(s,[...i,{x:t.x,y:t.y,mergeCommit:!0}])})}getDeletedBranchInPath(){return Array.from(this.branchesPaths.keys()).find(t=>t.isDeleted())}smoothBranchesPaths(){const t=new Map;return this.branchesPaths.forEach((e,r)=>{if(e.length<=1)return void t.set(r,[e]);e=this.isGraphVertical?e.sort((t,e)=>t.y>e.y?-1:1):e.sort((t,e)=>t.x>e.x?1:-1),this.isGraphReverse&&(e=e.reverse());const i=e.reduce((t,r,i)=>(r.mergeCommit?(t[t.length-1].push(s.pick(r,["x","y"])),e[i-1]&&t.push([e[i-1]])):t[t.length-1].push(r),t),[[]]);this.isGraphReverse&&i.forEach(t=>t.reverse()),this.isGraphVertical?i.forEach(e=>{if(e.length<=1)return;const s=e[0],i=e[e.length-1],n=e[1].x,a=Math.round(Math.abs(s.y-i.y)/this.commitSpacing)-1,o=a>0?new Array(a).fill(0).map((t,r)=>({x:n,y:e[0].y-this.commitSpacing*(r+1)})):[],h=t.get(r)||[];t.set(r,[...h,[s,...o,i]])}):i.forEach(e=>{if(e.length<=1)return;const s=e[0],i=e[e.length-1],n=e[1].y,a=Math.round(Math.abs(s.x-i.x)/this.commitSpacing)-1,o=a>0?new Array(a).fill(0).map((t,r)=>({y:n,x:e[0].x+this.commitSpacing*(r+1)})):[],h=t.get(r)||[];t.set(r,[...h,[s,...o,i]])})}),t}},r.toSvgPath=function(t,e,r){return t.map(t=>"M"+t.map(({x:t,y:s},i,n)=>{if(e&&n.length>1&&(1===i||i===n.length-1)){const e=n[i-1];if(r){const r=(e.y+s)/2;return`C ${e.x} ${r} ${t} ${r} ${t} ${s}`}{const r=(e.x+t)/2;return`C ${r} ${e.y} ${r} ${s} ${t} ${s}`}}return`L ${t} ${s}`}).join(" ").slice(1)).join(" ")}},{"./utils":16}],4:[function(t,e,r){var s;s=function(){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var e=t("./gitgraph");r.GitgraphCore=e.GitgraphCore,r.Mode=e.Mode;var s=t("./user-api/gitgraph-user-api");r.GitgraphUserApi=s.GitgraphUserApi;var i=t("./user-api/branch-user-api");r.BranchUserApi=i.BranchUserApi;var n=t("./branch");r.Branch=n.Branch;var a=t("./commit");r.Commit=a.Commit;var o=t("./tag");r.Tag=o.Tag;var h=t("./refs");r.Refs=h.Refs;var c=t("./template");r.MergeStyle=c.MergeStyle,r.TemplateName=c.TemplateName,r.templateExtend=c.templateExtend;var l=t("./orientation");r.Orientation=l.Orientation;var m=t("./branches-paths");r.toSvgPath=m.toSvgPath;var u=t("./utils");r.arrowSvgPath=u.arrowSvgPath},"object"==typeof r&&void 0!==e?s():"function"==typeof define&&define.amd?define(s):s()},{"./branch":1,"./branches-paths":3,"./commit":5,"./gitgraph":6,"./orientation":10,"./refs":11,"./tag":12,"./template":13,"./user-api/branch-user-api":14,"./user-api/gitgraph-user-api":15,"./utils":16}],5:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./tag"),i=()=>(Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)+Math.random().toString(16).substring(3)).substring(0,40);class n{constructor(t){let e,r;this.refs=[],this.x=0,this.y=0;try{[,e,r]=t.author.match(/(.*) <(.*)>/)}catch(s){[e,r]=[t.author,""]}this.author={name:e,email:r,timestamp:Date.now()},this.committer={name:e,email:r,timestamp:Date.now()},this.subject=t.subject,this.body=t.body||"",this.hash=t.hash||i(),this.hashAbbrev=this.hash.substring(0,7),this.parents=t.parents?t.parents:[],this.parentsAbbrev=this.parents.map(t=>t.substring(0,7)),this.style=Object.assign({},t.style,{message:Object.assign({},t.style.message),dot:Object.assign({},t.style.dot)}),this.dotText=t.dotText,this.onClick=(()=>t.onClick?t.onClick(this):void 0),this.onMessageClick=(()=>t.onMessageClick?t.onMessageClick(this):void 0),this.onMouseOver=(()=>t.onMouseOver?t.onMouseOver(this):void 0),this.onMouseOut=(()=>t.onMouseOut?t.onMouseOut(this):void 0),this.renderDot=t.renderDot,this.renderMessage=t.renderMessage,this.renderTooltip=t.renderTooltip}get message(){let t="";return this.style.message.displayHash&&(t+=`${this.hashAbbrev} `),t+=this.subject,this.style.message.displayAuthor&&(t+=` - ${this.author.name} <${this.author.email}>`),t}get branchToDisplay(){return this.branches?this.branches[0]:""}setRefs(t){return this.refs=t.getNames(this.hash),this}setTags(t,e){return this.tags=t.getNames(this.hash).map(t=>new s.Tag(t,e(t),this.style)),this}setBranches(t){return this.branches=t,this}setPosition({x:t,y:e}){return this.x=t,this.y=e,this}withDefaultColor(t){const e=Object.assign({},this.style,{dot:Object.assign({},this.style.dot),message:Object.assign({},this.style.message)});e.color||(e.color=t),e.dot.color||(e.dot.color=t),e.message.color||(e.message.color=t);const r=this.cloneCommit();return r.style=e,r}cloneCommit(){const t=new n({author:`${this.author.name} <${this.author.email}>`,subject:this.subject,style:this.style,body:this.body,hash:this.hash,parents:this.parents,dotText:this.dotText,onClick:this.onClick,onMessageClick:this.onMessageClick,onMouseOver:this.onMouseOver,onMouseOut:this.onMouseOut,renderDot:this.renderDot,renderMessage:this.renderMessage,renderTooltip:this.renderTooltip});return t.refs=this.refs,t.branches=this.branches,t.tags=this.tags,t.x=this.x,t.y=this.y,t}}r.Commit=n},{"./tag":12}],6:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./branch"),i=t("./graph-rows"),n=t("./branches-order"),a=t("./template"),o=t("./refs"),h=t("./branches-paths"),c=t("./utils"),l=t("./orientation"),m=t("./user-api/gitgraph-user-api");var u;!function(t){t.Compact="compact"}(u||(u={})),r.Mode=u;r.GitgraphCore=class{constructor(t={}){this.refs=new o.Refs,this.tags=new o.Refs,this.tagStyles={},this.commits=[],this.branches=new Map,this.listeners=[],this.nextTimeoutId=null,this.template=a.getTemplate(t.template),this.currentBranch=this.createBranch("master"),this.orientation=t.orientation,this.reverseArrow=c.booleanOptionOr(t.reverseArrow,!1),this.initCommitOffsetX=c.numberOptionOr(t.initCommitOffsetX,0),this.initCommitOffsetY=c.numberOptionOr(t.initCommitOffsetY,0),this.mode=t.mode,this.author=t.author||"Sergio Flores <saxo-guy@epic.com>",this.commitMessage=t.commitMessage||"He doesn't like George Michael! Boooo!",this.generateCommitHash="function"==typeof t.generateCommitHash?t.generateCommitHash:()=>void 0,this.branchesOrderFunction="function"==typeof t.compareBranchesOrder?t.compareBranchesOrder:void 0}get isHorizontal(){return this.orientation===l.Orientation.Horizontal||this.orientation===l.Orientation.HorizontalReverse}get isVertical(){return!this.isHorizontal}get isReverse(){return this.orientation===l.Orientation.HorizontalReverse||this.orientation===l.Orientation.VerticalReverse}getUserApi(){return new m.GitgraphUserApi(this,()=>this.next())}subscribe(t){this.listeners.push(t);let e=!0;return()=>{if(!e)return;e=!1;const r=this.listeners.indexOf(t);this.listeners.splice(r,1)}}getRenderedData(){const t=this.computeRenderedCommits(),e=this.computeRenderedBranchesPaths(t),r=this.computeCommitMessagesX(e);return this.computeBranchesColor(t,e),{commits:t,branchesPaths:e,commitMessagesX:r}}createBranch(t){let e={gitgraph:this,name:"",parentCommitHash:this.refs.getCommit("HEAD"),style:this.template.branch,onGraphUpdate:()=>this.next()};"string"==typeof t?e.name=t:(t.style=t.style||{},e=Object.assign({},e,t,{style:Object.assign({},e.style,t.style,{label:Object.assign({},e.style.label,t.style.label)})}));const r=new s.Branch(e);return this.branches.set(r.name,r),r}computeRenderedCommits(){const t=this.getBranches(),e=this.commits.map(e=>this.withBranches(t,e)),r=i.createGraphRows(this.mode,this.commits),s=new n.BranchesOrder(e,this.template.colors,this.branchesOrderFunction);return e.map(t=>t.setRefs(this.refs)).map(t=>this.withPosition(r,s,t)).map(t=>t.withDefaultColor(this.getBranchDefaultColor(s,t.branchToDisplay))).map(t=>t.setTags(this.tags,t=>Object.assign({},this.tagStyles[t],this.template.tag)))}computeRenderedBranchesPaths(t){return new h.BranchesPathsCalculator(t,this.branches,this.template.commit.spacing,this.isVertical,this.isReverse,()=>s.createDeletedBranch(this,this.template.branch,()=>this.next())).execute()}computeBranchesColor(t,e){const r=new n.BranchesOrder(t,this.template.colors,this.branchesOrderFunction);Array.from(e).forEach(([t])=>{t.computedColor=t.style.color||this.getBranchDefaultColor(r,t.name)})}computeCommitMessagesX(t){return Array.from(t).length*this.template.branch.spacing}withBranches(t,e){let r=Array.from((t.get(e.hash)||new Set).values());return 0===r.length&&(r=[s.DELETED_BRANCH_NAME]),e.setBranches(r)}getBranches(){const t=new Map,e=[];return this.refs.getAllNames().filter(t=>"HEAD"!==t).forEach(r=>{const s=this.refs.getCommit(r);for(s&&e.push(s);e.length>0;){const s=e.pop(),i=this.commits.find(({hash:t})=>t===s),n=t.get(s)||new Set;n.add(r),t.set(s,n),i.parents.length>0&&e.push(i.parents[0])}}),t}withPosition(t,e,r){const s=t.getRowOf(r.hash),i=t.getMaxRow(),n=e.get(r.branchToDisplay);switch(this.orientation){default:return r.setPosition({x:this.initCommitOffsetX+this.template.branch.spacing*n,y:this.initCommitOffsetY+this.template.commit.spacing*(i-s)});case l.Orientation.VerticalReverse:return r.setPosition({x:this.initCommitOffsetX+this.template.branch.spacing*n,y:this.initCommitOffsetY+this.template.commit.spacing*s});case l.Orientation.Horizontal:return r.setPosition({x:this.initCommitOffsetX+this.template.commit.spacing*s,y:this.initCommitOffsetY+this.template.branch.spacing*n});case l.Orientation.HorizontalReverse:return r.setPosition({x:this.initCommitOffsetX+this.template.commit.spacing*(i-s),y:this.initCommitOffsetY+this.template.branch.spacing*n})}}getBranchDefaultColor(t,e){return t.getColorOf(e)}next(){this.nextTimeoutId&&window.clearTimeout(this.nextTimeoutId),this.nextTimeoutId=window.setTimeout(()=>{this.listeners.forEach(t=>t(this.getRenderedData()))},0)}}},{"./branch":1,"./branches-order":2,"./branches-paths":3,"./graph-rows":8,"./orientation":10,"./refs":11,"./template":13,"./user-api/gitgraph-user-api":15,"./utils":16}],7:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./regular");r.CompactGraphRows=class extends s.RegularGraphRows{computeRowsFromCommits(t){t.forEach((e,r)=>{let s=r;if(0!==r){const i=this.getRowOf(e.parents[0]),n=t[r-1];s=Math.max(i+1,this.getRowOf(n.hash)),e.parents.length>1&&i<this.getRowOf(e.parents[1])&&s++}this.rows.set(e.hash,s)})}}},{"./regular":9}],8:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("../gitgraph"),i=t("./compact"),n=t("./regular");r.GraphRows=n.RegularGraphRows,r.createGraphRows=function(t,e){return t===s.Mode.Compact?new i.CompactGraphRows(e):new n.RegularGraphRows(e)}},{"../gitgraph":6,"./compact":7,"./regular":9}],9:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.RegularGraphRows=class{constructor(t){this.rows=new Map,this.maxRowCache=void 0,this.computeRowsFromCommits(t)}getRowOf(t){return this.rows.get(t)||0}getMaxRow(){return void 0===this.maxRowCache&&(this.maxRowCache=function(t){const e=new Set;return t.forEach(t=>e.add(t)),Array.from(e)}(Array.from(this.rows.values())).length-1),this.maxRowCache}computeRowsFromCommits(t){t.forEach((t,e)=>{this.rows.set(t.hash,e)}),this.maxRowCache=void 0}}},{}],10:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),function(t){t.VerticalReverse="vertical-reverse",t.Horizontal="horizontal",t.HorizontalReverse="horizontal-reverse"}(r.Orientation||(r.Orientation={}))},{}],11:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});r.Refs=class{constructor(){this.commitPerName=new Map,this.namesPerCommit=new Map}set(t,e){const r=this.commitPerName.get(t);return r&&this.removeNameFrom(r,t),this.addNameTo(e,t),this.addCommitTo(t,e),this}getCommit(t){return this.commitPerName.get(t)}getNames(t){return this.namesPerCommit.get(t)||[]}getAllNames(){return Array.from(this.commitPerName.keys())}hasCommit(t){return this.namesPerCommit.has(t)}hasName(t){return this.commitPerName.has(t)}removeNameFrom(t,e){const r=this.namesPerCommit.get(t)||[];this.namesPerCommit.set(t,r.filter(t=>t!==e))}addNameTo(t,e){const r=this.namesPerCommit.get(t)||[];this.namesPerCommit.set(t,[...r,e])}addCommitTo(t,e){this.commitPerName.set(t,e)}}},{}],12:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./template"),i=t("./utils");r.Tag=class{get style(){return{strokeColor:this.tagStyle.strokeColor||this.commitStyle.color,bgColor:this.tagStyle.bgColor||this.commitStyle.color,color:this.tagStyle.color||"white",font:this.tagStyle.font||this.commitStyle.message.font||s.DEFAULT_FONT,borderRadius:i.numberOptionOr(this.tagStyle.borderRadius,10),pointerWidth:i.numberOptionOr(this.tagStyle.pointerWidth,12)}}constructor(t,e,r){this.name=t,this.tagStyle=e,this.commitStyle=r}}},{"./template":13,"./utils":16}],13:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./utils");var i;!function(t){t.Bezier="bezier",t.Straight="straight"}(i||(i={})),r.MergeStyle=i,r.DEFAULT_FONT="normal 12pt Calibri";class n{constructor(t){t.branch=t.branch||{},t.branch.label=t.branch.label||{},t.arrow=t.arrow||{},t.commit=t.commit||{},t.commit.dot=t.commit.dot||{},t.commit.message=t.commit.message||{},this.colors=t.colors||["#000000"],this.branch={color:t.branch.color,lineWidth:t.branch.lineWidth||2,mergeStyle:t.branch.mergeStyle||i.Bezier,spacing:s.numberOptionOr(t.branch.spacing,20),label:{display:s.booleanOptionOr(t.branch.label.display,!0),color:t.branch.label.color||t.commit.color,strokeColor:t.branch.label.strokeColor||t.commit.color,bgColor:t.branch.label.bgColor||"white",font:t.branch.label.font||t.commit.message.font||r.DEFAULT_FONT,borderRadius:s.numberOptionOr(t.branch.label.borderRadius,10)}},this.arrow={size:t.arrow.size||null,color:t.arrow.color||null,offset:t.arrow.offset||2},this.commit={color:t.commit.color,spacing:s.numberOptionOr(t.commit.spacing,25),hasTooltipInCompactMode:s.booleanOptionOr(t.commit.hasTooltipInCompactMode,!0),dot:{color:t.commit.dot.color||t.commit.color,size:t.commit.dot.size||3,strokeWidth:s.numberOptionOr(t.commit.dot.strokeWidth,0),strokeColor:t.commit.dot.strokeColor,font:t.commit.dot.font||t.commit.message.font||"normal 10pt Calibri"},message:{display:s.booleanOptionOr(t.commit.message.display,!0),displayAuthor:s.booleanOptionOr(t.commit.message.displayAuthor,!0),displayHash:s.booleanOptionOr(t.commit.message.displayHash,!0),color:t.commit.message.color||t.commit.color,font:t.commit.message.font||r.DEFAULT_FONT}},this.tag=t.tag||{}}}r.Template=n;const a=new n({colors:["#6963FF","#47E8D4","#6BDB52","#E84BA5","#FFA657"],branch:{color:"#000000",lineWidth:4,spacing:50,mergeStyle:i.Straight},commit:{spacing:60,dot:{size:16,strokeColor:"#000000",strokeWidth:4},message:{color:"black"}},arrow:{size:16,offset:-1.5}});r.blackArrowTemplate=a;const o=new n({colors:["#979797","#008fb5","#f1c109"],branch:{lineWidth:10,spacing:50},commit:{spacing:80,dot:{size:14},message:{font:"normal 14pt Arial"}}});var h;function c(t){return t?"string"==typeof t?{[h.BlackArrow]:a,[h.Metro]:o}[t]:t:o}r.metroTemplate=o,function(t){t.Metro="metro",t.BlackArrow="blackarrow"}(h||(h={})),r.TemplateName=h,r.templateExtend=function(t,e){const r=c(t);return e.branch||(e.branch={}),e.commit||(e.commit={}),{colors:e.colors||r.colors,arrow:Object.assign({},r.arrow,e.arrow),branch:Object.assign({},r.branch,e.branch,{label:Object.assign({},r.branch.label,e.branch.label)}),commit:Object.assign({},r.commit,e.commit,{dot:Object.assign({},r.commit.dot,e.commit.dot),message:Object.assign({},r.commit.message,e.commit.message)}),tag:Object.assign({},r.tag,e.tag)}},r.getTemplate=c},{"./utils":16}],14:[function(t,e,r){"use strict";var s=this&&this.__rest||function(t,e){var r={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(r[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(s=Object.getOwnPropertySymbols(t);i<s.length;i++)e.indexOf(s[i])<0&&(r[s[i]]=t[s[i]])}return r};Object.defineProperty(r,"__esModule",{value:!0});const i=t("../gitgraph"),n=t("../commit"),a=t("../utils");class o{constructor(t,e,r){this._branch=t,this.name=t.name,this._graph=e,this._onGraphUpdate=r}commit(t){return"string"==typeof t&&(t={subject:t}),t||(t={}),this._commitWithParents(t,[]),this._onGraphUpdate(),this}merge(...t){let e=t[0];(function(t){return"object"==typeof t&&!(t instanceof o)})(e)||(e={branch:t[0],fastForward:!1,commitOptions:{subject:t[1]}});const{branch:r,fastForward:s,commitOptions:i}=e,n="string"==typeof r?r:r.name,a=this._graph.refs.getCommit(n);if(!a)throw new Error(`The branch called "${n}" is unknown`);let h=!1;const c=this._graph.refs.getCommit(this._branch.name);return h=!!c&&this._areCommitsConnected(c,a),s&&h?this._fastForwardTo(a):this._commitWithParents(Object.assign({},i,{subject:i&&i.subject||`Merge branch ${n}`}),[a]),this._onGraphUpdate(),this}tag(t){let e,r;return"string"==typeof t?e=t:(e=t.name,r=t.style),this._graph.getUserApi().tag({name:e,ref:this._branch.name,style:r}),this}checkout(){return this._graph.currentBranch=this._branch,this}_commitWithParents(t,e){const r=this._graph.refs.getCommit(this._branch.name);r?e.unshift(r):this._branch.parentCommitHash&&e.unshift(this._branch.parentCommitHash);const{tag:i}=t,a=s(t,["tag"]),o=new n.Commit(Object.assign({hash:this._graph.generateCommitHash(),author:this._branch.commitDefaultOptions.author||this._graph.author,subject:this._branch.commitDefaultOptions.subject||this._graph.commitMessage},a,{parents:e,style:this._getCommitStyle(t.style)}));if(r){this._graph.refs.getNames(r).forEach(t=>this._graph.refs.set(t,o.hash))}else this._graph.refs.set(this._branch.name,o.hash);this._graph.commits.push(o),this.checkout(),this._graph.refs.set("HEAD",o.hash),i&&this.tag(i)}_areCommitsConnected(t,e){const r=this._graph.commits.find(({hash:t})=>e===t);return!!r&&(!(0===r.parents.length)&&(!!r.parents.includes(t)||r.parents.some(e=>this._areCommitsConnected(t,e))))}_fastForwardTo(t){this._graph.refs.set(this._branch.name,t)}_getCommitStyle(t={}){const e=Object.assign({},a.withoutUndefinedKeys(this._graph.template.commit.message),a.withoutUndefinedKeys(this._branch.commitDefaultOptions.style.message),t.message);return(this._graph.isHorizontal||this._graph.mode===i.Mode.Compact)&&(e.display=!1),Object.assign({},a.withoutUndefinedKeys(this._graph.template.commit),a.withoutUndefinedKeys(this._branch.commitDefaultOptions.style),t,{message:e,dot:Object.assign({},a.withoutUndefinedKeys(this._graph.template.commit.dot),a.withoutUndefinedKeys(this._branch.commitDefaultOptions.style.dot),t.dot)})}}r.BranchUserApi=o},{"../commit":5,"../gitgraph":6,"../utils":16}],15:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("../commit"),i=t("../branch"),n=t("../refs");r.GitgraphUserApi=class{constructor(t,e){this._graph=t,this._onGraphUpdate=e}clear(){return this._graph.refs=new n.Refs,this._graph.tags=new n.Refs,this._graph.commits=[],this._graph.branches=new Map,this._graph.currentBranch=this._graph.createBranch("master"),this._onGraphUpdate(),this}commit(t){return this._graph.currentBranch.getUserApi().commit(t),this}branch(t){return this._graph.createBranch(t).getUserApi()}tag(...t){let e,r,s,i;if("string"==typeof t[0]?(e=t[0],r=t[1]):(e=t[0].name,r=t[0].ref,s=t[0].style),!r){const t=this._graph.refs.getCommit("HEAD");if(!t)return this;r=t}if(this._graph.refs.hasCommit(r)&&(i=r),this._graph.refs.hasName(r)&&(i=this._graph.refs.getCommit(r)),!i)throw new Error(`The ref "${r}" does not exist`);return this._graph.tags.set(e,i),this._graph.tagStyles[e]=s,this._onGraphUpdate(),this}import(t){const e=new Error("Only `git2json` format is supported for imported data.");if(!Array.isArray(t))throw e;if(!t.every(t=>"object"==typeof t&&"object"==typeof t.author&&Array.isArray(t.refs)))throw e;const r=t.map(t=>Object.assign({},t,{style:Object.assign({},this._graph.template.commit),author:`${t.author.name} <${t.author.email}>`})).reverse();this.clear(),this._graph.commits=r.map(t=>new s.Commit(t)),r.forEach(({refs:t,hash:e})=>{t&&e&&(t.map(t=>t.split("tag: ")).map(([t,e])=>e).filter(t=>"string"==typeof t).forEach(t=>this._graph.tags.set(t,e)),t.filter(t=>!t.startsWith("tag: ")).forEach(t=>this._graph.refs.set(t,e)))});const i=this._getBranches();return this._graph.commits.map(t=>this._withBranches(i,t)).reduce((t,e)=>e.branches?(e.branches.forEach(e=>t.add(e)),t):t,new Set).forEach(t=>this.branch(t)),this._onGraphUpdate(),this}_withBranches(t,e){let r=Array.from((t.get(e.hash)||new Set).values());return 0===r.length&&(r=[i.DELETED_BRANCH_NAME]),e.setBranches(r)}_getBranches(){const t=new Map,e=[];return this._graph.refs.getAllNames().filter(t=>"HEAD"!==t).forEach(r=>{const s=this._graph.refs.getCommit(r);for(s&&e.push(s);e.length>0;){const s=e.pop(),i=this._graph.commits.find(({hash:t})=>t===s),n=t.get(s)||new Set;n.add(r),t.set(s,n),i.parents.length>0&&e.push(i.parents[0])}}),t}}},{"../branch":1,"../commit":5,"../refs":11}],16:[function(t,e,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});const s=t("./orientation");function i(t,e){return Object.assign({},e.reduce((e,r)=>Object.assign({},e,{[r]:t[r]}),{}))}function n(t){return void 0===t}r.booleanOptionOr=function(t,e){return"boolean"==typeof t?t:e},r.numberOptionOr=function(t,e){return"number"==typeof t?t:e},r.pick=i,r.debug=function(t,e){console.log(JSON.stringify(t.map(t=>i(t,e)),null,2))},r.isUndefined=n,r.withoutUndefinedKeys=function(t={}){return Object.keys(t).reduce((e,r)=>n(t[r])?e:Object.assign({},e,{[r]:t[r]}),{})},r.arrowSvgPath=function(t,e,r){const i=r.style.dot.size,n=t.template.arrow.size,a=i+t.template.arrow.offset,o=Math.PI/7,h=function(t,e,r){const i=e.x-r.x,n=e.y-r.y,a=t.template.commit.spacing;let o,h;switch(t.orientation){case s.Orientation.Horizontal:o=n,h=-a;break;case s.Orientation.HorizontalReverse:o=n,h=a;break;case s.Orientation.VerticalReverse:o=-a,h=i;break;default:o=a,h=i}return t.isVertical?Math.abs(n)>a&&(h=0):Math.abs(i)>a&&(o=0),t.reverseArrow&&(o*=-1,h*=-1),Math.atan2(o,h)}(t,e,r),c=a*Math.cos(h),l=a*Math.sin(h),m=(a+n)*Math.cos(h-o),u=(a+n)*Math.sin(h-o),p=(a+n/2)*Math.cos(h),g=(a+n/2)*Math.sin(h),d=(a+n)*Math.cos(h+o),f=(a+n)*Math.sin(h+o);return`M${c},${l} L${m},${u} Q${p},${g} ${d},${f} L${d},${f}`}},{"./orientation":10}],17:[function(t,e,r){var s,i;s=this,i=function(t,e){"use strict";var r="http://www.w3.org/2000/svg";function s(t){var e=document.createElementNS(r,"g");return t.children.forEach(function(t){return t&&e.appendChild(t)}),t.translate&&e.setAttribute("transform","translate("+t.translate.x+", "+t.translate.y+")"),t.fill&&e.setAttribute("fill",t.fill),t.stroke&&e.setAttribute("stroke",t.stroke),t.strokeWidth&&e.setAttribute("stroke-width",t.strokeWidth.toString()),t.onClick&&e.addEventListener("click",t.onClick),t.onMouseOver&&e.addEventListener("mouseover",t.onMouseOver),t.onMouseOut&&e.addEventListener("mouseout",t.onMouseOut),e}function i(t){var e=document.createElementNS(r,"text");return e.setAttribute("alignment-baseline","central"),e.setAttribute("dominant-baseline","central"),e.textContent=t.content,t.fill&&e.setAttribute("fill",t.fill),t.font&&e.setAttribute("style","font: "+t.font),t.anchor&&e.setAttribute("text-anchor",t.anchor),t.translate&&(e.setAttribute("x",t.translate.x.toString()),e.setAttribute("y",t.translate.y.toString())),t.onClick&&e.addEventListener("click",t.onClick),e}function n(t){var e=document.createElementNS(r,"path");return e.setAttribute("d",t.d),t.fill&&e.setAttribute("fill",t.fill),t.stroke&&e.setAttribute("stroke",t.stroke),t.strokeWidth&&e.setAttribute("stroke-width",t.strokeWidth.toString()),t.translate&&e.setAttribute("transform","translate("+t.translate.x+", "+t.translate.y+")"),e}function a(t){var e=document.createElementNS(r,"use");return e.setAttribute("href","#"+t),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href","#"+t),e}var o=10,h=5;function c(t,e){var n=function(t){var e=document.createElementNS(r,"rect");return e.setAttribute("width",t.width.toString()),e.setAttribute("height",t.height.toString()),t.borderRadius&&e.setAttribute("rx",t.borderRadius.toString()),t.fill&&e.setAttribute("fill",t.fill||"transparent"),t.stroke&&e.setAttribute("stroke",t.stroke),e}({width:0,height:0,borderRadius:t.style.label.borderRadius,stroke:t.style.label.strokeColor||e.style.color,fill:t.style.label.bgColor}),a=i({content:t.name,translate:{x:o,y:0},font:t.style.label.font,fill:t.style.label.color||e.style.color}),c=s({children:[n]});return new MutationObserver(function(){var t=a.getBBox(),e=t.height,r=t.width+2*o,s=e+2*h;n.setAttribute("width",r.toString()),n.setAttribute("height",s.toString()),a.setAttribute("y",(s/2).toString())}).observe(c,{attributes:!1,subtree:!1,childList:!0}),c.appendChild(a),c}var l=10,m=5;var u=10,p=10;function g(t){var e=0;if(t){var r=t.getBoundingClientRect().height,s=window.getComputedStyle(t).marginTop||"0px";e=r+parseInt(s.replace("px",""),10)}return e}t.createGitgraph=function(t,d){var f,b,y={},v={},w=!1,O=0,C=null,A=function(t){var e=document.createElementNS(r,"svg");return t?(t.children&&t.children.forEach(function(t){return e.appendChild(t)}),t.viewBox&&e.setAttribute("viewBox",t.viewBox),t.height&&e.setAttribute("height",t.height.toString()),t.width&&e.setAttribute("width",t.width.toString()),e):e}();new MutationObserver(function(){var t,r,s,i,n,a,c,m;w?(w=!1,a=Array.from(b.children),c=0,m=_.orientation===e.Orientation.VerticalReverse?a:a.reverse(),v=m.reduce(function(t,e){var r=parseInt(e.getAttribute("transform").split(",")[1].slice(0,-1),10),s=e.getElementsByTagName("foreignObject")[0],i=s&&s.firstElementChild;return t[r]=r+c,c+=g(i),t},{}),M(f)):(_.isHorizontal||Object.keys(y).forEach(function(t){var e=y[t],r=e.branchLabel,s=e.tags,i=e.message,n=O;if(r){x(r,n);var a=r.getBBox().width+2*o;n+=a+10}s.forEach(function(t){x(t,n);var e=parseFloat(t.getAttribute("data-offset")||"0"),r=t.getBBox().width+2*l+e;n+=r+10}),i&&x(i,n)}),t=A.getBBox(),r=t.height,s=t.width,i=_.isHorizontal?50:o+u,n=_.isHorizontal?50:h+u,A.setAttribute("width",(s+i).toString()),A.setAttribute("height",(r+n).toString()))}).observe(A,{attributes:!1,subtree:!0,childList:!0}),t.appendChild(A);var _=new e.GitgraphCore(d);return _.subscribe(function(t){w=!0,M(t)}),_.getUserApi();function M(t){y={};var h=t.commits,g=t.branchesPaths;O=t.commitMessagesX,f=t,b=function(t){return s({children:t.map(function(o){var h=E(o),g=h.x,d=h.y;return s({translate:{x:g,y:d},children:[function(t){if(t.renderDot)return t.renderDot(t);var o=t.hash,h=function(t){var e=document.createElementNS(r,"circle");return e.setAttribute("cx",t.radius.toString()),e.setAttribute("cy",t.radius.toString()),e.setAttribute("r",t.radius.toString()),t.id&&e.setAttribute("id",t.id),t.fill&&e.setAttribute("fill",t.fill),e}({id:o,radius:t.style.dot.size,fill:t.style.dot.color||""}),c="clip-"+t.hash,l=document.createElementNS(r,"clipPath");l.setAttribute("id",c),l.appendChild(a(o));var m=a(o);m.setAttribute("clip-path","url(#"+c+")"),m.setAttribute("stroke",t.style.dot.strokeColor||"");var g=t.style.dot.strokeWidth?2*t.style.dot.strokeWidth:0;m.setAttribute("stroke-width",g.toString());var d,f,b=t.dotText?i({content:t.dotText,font:t.style.dot.font,anchor:"middle",translate:{x:t.style.dot.size,y:t.style.dot.size}}):null;return s({onClick:t.onClick,onMouseOver:function(){!function(t){if(A.firstChild&&(!_.isVertical||_.mode===e.Mode.Compact)&&(!_.isVertical||t.style.hasTooltipInCompactMode)){var r=t.renderTooltip?t.renderTooltip(t):function(t){var e=n({d:"",fill:"#EEE"}),r=i({translate:{x:p+u,y:0},content:t.hashAbbrev+" - "+t.subject,fill:"#333"}),a=2*t.style.dot.size,o=s({translate:{x:a,y:a/2},children:[e]});return new MutationObserver(function(){var t=r.getBBox().width,s=p+t+2*u,i=["M 0,0","L "+p+","+p,"V 20","Q "+p+",25 "+(p+5)+",25","H "+(s-5),"Q "+s+",25 "+s+",20","V -20","Q "+s+",-25 "+(s-5)+",-25","H "+(p+5),"Q "+p+",-25 "+p+",-20","V -"+p,"z"].join(" ");e.setAttribute("d",i.toString())}).observe(o,{attributes:!1,subtree:!1,childList:!0}),o.appendChild(r),o}(t);C=s({translate:E(t),children:[r]}),A.firstChild.appendChild(C)}}(t),t.onMouseOver()},onMouseOut:function(){C&&C.remove(),t.onMouseOut()},children:[(d=[h,l],f=document.createElementNS(r,"defs"),d.forEach(function(t){return f.appendChild(t)}),f),m,b]})}(o)].concat(function(r){if(!_.template.arrow.size)return[null];var i=r.style.dot.size;return r.parents.map(function(a){var o=t.find(function(t){var e=t.hash;return e===a});if(!o)return null;var h=_.reverseArrow?{x:i+(o.x-r.x),y:i+(o.y-r.y)}:{x:i,y:i},c=n({d:e.arrowSvgPath(_,o,r),fill:_.template.arrow.color||""});return s({translate:h,children:[c]})})}(o),[s({translate:{x:-g,y:0},children:[function(t){if(!t.style.message.display)return null;var e;if(t.renderMessage)return S(e=s({children:[]})),e.appendChild(t.renderMessage(t)),B(t,e),e;var n=i({content:t.message,fill:t.style.message.color||"",font:t.style.message.font,onClick:t.onMessageClick});if(e=s({translate:{x:0,y:t.style.dot.size},children:[n]}),t.body){var a=function(t){var e=document.createElementNS(r,"foreignObject");e.setAttribute("width",t.width.toString()),t.translate&&(e.setAttribute("x",t.translate.x.toString()),e.setAttribute("y",t.translate.y.toString()));var s=document.createElement("p");return s.textContent=t.content,e.appendChild(s),e}({width:600,translate:{x:10,y:0},content:t.body});S(e),e.appendChild(a)}return B(t,e),e}(o)].concat(function(t){return Array.from(_.branches.values()).map(function(e){if(!e.style.label.display)return null;var r,i=_.refs.getCommit(e.name);if(t.hash!==i)return null;if(t.branchToDisplay!==e.name)return null;if(_.isVertical)r=s({children:[c(e,t)]});else{var n=2*t.style.dot.size;r=s({translate:{x:t.x,y:n+10},children:[c(e,t)]})}return function(t,e){y[t.hashAbbrev]||k(t),y[t.hashAbbrev].branchLabel=e}(t,r),r})}(o),function(t){return t.tags?_.isHorizontal?[]:t.tags.map(function(e){var r=function(t){var e=n({d:"",fill:t.style.bgColor,stroke:t.style.strokeColor}),r=i({content:t.name,fill:t.style.color,font:t.style.font,translate:{x:0,y:0}}),a=s({children:[e]}),o=t.style.pointerWidth;return a.setAttribute("data-offset",o.toString()),new MutationObserver(function(){var s=r.getBBox(),i=s.height,n=s.width;if(0!==i&&0!==n){var a=t.style.borderRadius,h=o+n+2*l,c=i+2*m,u=["M 0,0","L "+o+","+c/2,"V "+c/2,"Q "+o+","+c/2+" "+(o+a)+","+c/2,"H "+(h-a),"Q "+h+","+c/2+" "+h+","+(c/2-a),"V -"+(c/2-a),"Q "+h+",-"+c/2+" "+(h-a)+",-"+c/2,"H "+(o+a),"Q "+o+",-"+c/2+" "+o+",-"+c/2,"V -"+c/2,"z"].join(" ");e.setAttribute("d",u.toString()),r.setAttribute("x",(o+l).toString())}}).observe(a,{attributes:!1,subtree:!1,childList:!0}),a.appendChild(r),a}(e);return function(t,e){y[t.hashAbbrev]||k(t),y[t.hashAbbrev].tags.push(e)}(t,r),s({translate:{x:0,y:t.style.dot.size},children:[r]})}):[]}(o))})])})})})}(h),A.innerHTML="",A.appendChild(s({translate:{x:o,y:u},children:[function(t){var r=_.template.commit.dot.size,i=_.template.branch.mergeStyle===e.MergeStyle.Bezier;return s({children:Array.from(t).map(function(t){var s=t[0],a=t[1];return n({d:e.toSvgPath(a.map(function(t){return t.map(E)}),i,_.isVertical),fill:"transparent",stroke:s.computedColor||"",strokeWidth:s.style.lineWidth,translate:{x:r,y:r}})})})}(g),b]}))}function x(t,e){var r=t.getAttribute("transform")||"translate(0, 0)";t.setAttribute("transform",r.replace(/translate\(([\d\.]+),/,"translate("+e+","))}function S(t){function e(t){if("foreignObject"===t.nodeName){var r=t.firstChild&&t.firstChild.parentElement;if(!r)return;r.setAttribute("height",g(r.firstElementChild).toString())}t.childNodes.forEach(e)}new MutationObserver(function(t){t.forEach(function(t){return e(t.target)})}).observe(t,{attributes:!1,subtree:!1,childList:!0})}function E(t){var e=t.x,r=t.y;return{x:e,y:v[r]||r}}function B(t,e){y[t.hashAbbrev]||k(t),y[t.hashAbbrev].message=e}function k(t){y[t.hashAbbrev]={branchLabel:null,tags:[],message:null}}},t.Mode=e.Mode,t.Orientation=e.Orientation,t.TemplateName=e.TemplateName,t.templateExtend=e.templateExtend,t.MergeStyle=e.MergeStyle,Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof r&&void 0!==e?i(r,t("@gitgraph/core")):"function"==typeof define&&define.amd?define(["exports","@gitgraph/core"],i):i((s.gitgraph=s.gitgraph||{},s.gitgraph.core={}),s.gitgraph.core)},{"@gitgraph/core":4}]},{},[17]);

@@ -592,2 +592,4 @@ (function (global, factory) {

return [];
if (gitgraph.isHorizontal)
return [];
return commit.tags.map(function (tag) {

@@ -594,0 +596,0 @@ var tagElement = createTag(tag);

@@ -310,2 +310,4 @@ import { GitgraphCore, MergeStyle, arrowSvgPath, toSvgPath, Mode, Orientation, TemplateName, templateExtend, } from "@gitgraph/core";

return [];
if (gitgraph.isHorizontal)
return [];
return commit.tags.map(function (tag) {

@@ -312,0 +314,0 @@ var tagElement = createTag(tag);

{
"name": "@gitgraph/js",
"version": "1.0.0-3",
"version": "1.0.0-4",
"description": "Draw pretty git graphs in the browser",

@@ -50,3 +50,3 @@ "author": "Nicolas Carlo <nicolascarlo.espeon@gmail.com>",

"dependencies": {
"@gitgraph/core": "1.1.0-5"
"@gitgraph/core": "1.1.0-6"
},

@@ -62,3 +62,3 @@ "devDependencies": {

},
"gitHead": "286138e6c83a19e40b8b5eac4b6859bbc20c5c06"
"gitHead": "b9ea800f158b69d401b8dd758157b835c857b6b5"
}

@@ -71,2 +71,2 @@ # `@gitgraph/js`

[stories]: https://github.com/nicoespeon/gitgraph.js/tree/master/packages/stories/src/gitgraph-js/
[migration-guide]: ./MIGRATE_FROM_GITGRAPH.JS.md
[migration-guide]: https://github.com/nicoespeon/gitgraph.js/blob/master/packages/gitgraph-js/MIGRATE_FROM_GITGRAPH.JS.md

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc