import{a as xt}from"./chunk-AZZRMDJM.mjs";import{a as pt,b as gt,c as mt,f as U}from"./chunk-LII3EMHJ.mjs";import"./chunk-KNLZD3CH.mjs";import{O as ot,S as lt,T as ct,U as ht,V as ut,W as yt,X as ft,Y as dt,_ as P}from"./chunk-67TQ5CYL.mjs";import{F as G,h as z}from"./chunk-7W6UQGC5.mjs";import{a as s}from"./chunk-AQ6EADP3.mjs";var Z=(function(){var t=s(function(h,i,r,o){for(r=r||{},o=h.length;o--;r[h[o]]=i);return r},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],d=[1,10],n=[1,11],u=[1,12],p=[1,13],c=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(i,r,o,y,f,l,_){var k=l.length-1;switch(f){case 1:return l[k-1];case 2:this.$=[];break;case 3:l[k-1].push(l[k]),this.$=l[k-1];break;case 4:case 5:this.$=l[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(l[k].substr(6)),this.$=l[k].substr(6);break;case 9:this.$=l[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=l[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(l[k].substr(8)),this.$=l[k].substr(8);break;case 13:y.addTask(l[k-1],l[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:d,14:n,16:u,17:p,18:c},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:d,14:n,16:u,17:p,18:c},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(i,r){if(r.recoverable)this.trace(i);else{var o=new Error(i);throw o.hash=r,o}},"parseError"),parse:s(function(i){var r=this,o=[0],y=[],f=[null],l=[],_=this.table,k="",E=0,it=0,rt=0,St=2,st=1,Mt=l.slice.call(arguments,1),b=Object.create(this.lexer),A={yy:{}};for(var Y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,Y)&&(A.yy[Y]=this.yy[Y]);b.setInput(i,A.yy),A.yy.lexer=b,A.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var q=b.yylloc;l.push(q);var Ct=b.options&&b.options.ranges;typeof A.yy.parseError=="function"?this.parseError=A.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function Ut(w){o.length=o.length-2*w,f.length=f.length-w,l.length=l.length-w}s(Ut,"popStack");function Et(){var w;return w=y.pop()||b.lex()||st,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=r.symbols_[w]||w),w}s(Et,"lex");for(var v,D,F,T,Zt,H,V={},j,M,at,W;;){if(F=o[o.length-1],this.defaultActions[F]?T=this.defaultActions[F]:((v===null||typeof v>"u")&&(v=Et()),T=_[F]&&_[F][v]),typeof T>"u"||!T.length||!T[0]){var X="";W=[];for(j in _[F])this.terminals_[j]&&j>St&&W.push("'"+this.terminals_[j]+"'");b.showPosition?X="Parse error on line "+(E+1)+`: `+b.showPosition()+` Expecting `+W.join(", ")+", got '"+(this.terminals_[v]||v)+"'":X="Parse error on line "+(E+1)+": Unexpected "+(v==st?"end of input":"'"+(this.terminals_[v]||v)+"'"),this.parseError(X,{text:b.match,token:this.terminals_[v]||v,line:b.yylineno,loc:q,expected:W})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+F+", token: "+v);switch(T[0]){case 1:o.push(v),f.push(b.yytext),l.push(b.yylloc),o.push(T[1]),v=null,D?(v=D,D=null):(it=b.yyleng,k=b.yytext,E=b.yylineno,q=b.yylloc,rt>0&&rt--);break;case 2:if(M=this.productions_[T[1]][1],V.$=f[f.length-M],V._$={first_line:l[l.length-(M||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(M||1)].first_column,last_column:l[l.length-1].last_column},Ct&&(V._$.range=[l[l.length-(M||1)].range[0],l[l.length-1].range[1]]),H=this.performAction.apply(V,[k,it,E,A.yy,T[1],f,l].concat(Mt)),typeof H<"u")return H;M&&(o=o.slice(0,-1*M*2),f=f.slice(0,-1*M),l=l.slice(0,-1*M)),o.push(this.productions_[T[1]][0]),f.push(V.$),l.push(V._$),at=_[o[o.length-2]][o[o.length-1]],o.push(at);break;case 3:return!0}}return!0},"parse")},m=(function(){var h={EOF:1,parseError:s(function(r,o){if(this.yy.parser)this.yy.parser.parseError(r,o);else throw new Error(r)},"parseError"),setInput:s(function(i,r){return this.yy=r||this.yy||{},this._input=i,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var i=this._input[0];this.yytext+=i,this.yyleng++,this.offset++,this.match+=i,this.matched+=i;var r=i.match(/(?:\r\n?|\n).*/g);return r?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),i},"input"),unput:s(function(i){var r=i.length,o=i.split(/(?:\r\n?|\n)/g);this._input=i+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-r),this.offset-=r;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),o.length-1&&(this.yylineno-=o.length-1);var f=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:o?(o.length===y.length?this.yylloc.first_column:0)+y[y.length-o.length].length-o[0].length:this.yylloc.first_column-r},this.options.ranges&&(this.yylloc.range=[f[0],f[0]+this.yyleng-r]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(i){this.unput(this.match.slice(i))},"less"),pastInput:s(function(){var i=this.matched.substr(0,this.matched.length-this.match.length);return(i.length>20?"...":"")+i.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var i=this.match;return i.length<20&&(i+=this._input.substr(0,20-i.length)),(i.substr(0,20)+(i.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var i=this.pastInput(),r=new Array(i.length+1).join("-");return i+this.upcomingInput()+` `+r+"^"},"showPosition"),test_match:s(function(i,r){var o,y,f;if(this.options.backtrack_lexer&&(f={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(f.yylloc.range=this.yylloc.range.slice(0))),y=i[0].match(/(?:\r\n?|\n).*/g),y&&(this.yylineno+=y.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:y?y[y.length-1].length-y[y.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+i[0].length},this.yytext+=i[0],this.match+=i[0],this.matches=i,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(i[0].length),this.matched+=i[0],o=this.performAction.call(this,this.yy,this,r,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),o)return o;if(this._backtrack){for(var l in f)this[l]=f[l];return!1}return!1},"test_match"),next:s(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var i,r,o,y;this._more||(this.yytext="",this.match="");for(var f=this._currentRules(),l=0;lr[0].length)){if(r=o,y=l,this.options.backtrack_lexer){if(i=this.test_match(o,f[l]),i!==!1)return i;if(this._backtrack){r=!1;continue}else return!1}else if(!this.options.flex)break}return r?(i=this.test_match(r,f[y]),i!==!1?i:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text. `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:s(function(){var r=this.next();return r||this.lex()},"lex"),begin:s(function(r){this.conditionStack.push(r)},"begin"),popState:s(function(){var r=this.conditionStack.length-1;return r>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:s(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:s(function(r){return r=this.conditionStack.length-1-Math.abs(r||0),r>=0?this.conditionStack[r]:"INITIAL"},"topState"),pushState:s(function(r){this.begin(r)},"pushState"),stateStackSize:s(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:s(function(r,o,y,f){var l=f;switch(y){case 0:break;case 1:break;case 2:return 10;case 3:break;case 4:break;case 5:return 4;case 6:return 11;case 7:return this.begin("acc_title"),12;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.begin("acc_descr"),14;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.begin("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 17;case 15:return 18;case 16:return 19;case 17:return":";case 18:return 6;case 19:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:journey\b)/i,/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^#:\n;]+)/i,/^(?:[^#:\n;]+)/i,/^(?::[^#\n;]+)/i,/^(?::)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,9,11,14,15,16,17,18,19],inclusive:!0}}};return h})();g.lexer=m;function x(){this.yy={}}return s(x,"Parser"),x.prototype=g,g.Parser=x,new x})();Z.parser=Z;var kt=Z;var L="",J=[],B=[],N=[],Pt=s(function(){J.length=0,B.length=0,L="",N.length=0,lt()},"clear"),It=s(function(t){L=t,J.push(t)},"addSection"),At=s(function(){return J},"getSections"),Ft=s(function(){let t=bt(),e=100,a=0;for(;!t&&a{a.people&&t.push(...a.people)}),[...new Set(t)].sort()},"updateActors"),Lt=s(function(t,e){let a=e.substr(1).split(":"),d=0,n=[];a.length===1?(d=Number(a[0]),n=[]):(d=Number(a[0]),n=a[1].split(","));let u=n.map(c=>c.trim()),p={section:L,type:L,people:u,task:t,score:d};N.push(p)},"addTask"),Rt=s(function(t){let e={section:L,type:L,description:t,task:t,classes:[]};B.push(e)},"addTaskOrg"),bt=s(function(){let t=s(function(a){return N[a].processed},"compileTask"),e=!0;for(let[a,d]of N.entries())t(a),e=e&&d.processed;return e},"compileTasks"),Bt=s(function(){return Vt()},"getActors"),K={getConfig:s(()=>P().journey,"getConfig"),clear:Pt,setDiagramTitle:ft,getDiagramTitle:dt,setAccTitle:ct,getAccTitle:ht,setAccDescription:ut,getAccDescription:yt,addSection:It,getSections:At,getTasks:Ft,addTask:Lt,addTaskOrg:Rt,getActors:Bt};var Nt=s(t=>`.label { font-family: ${t.fontFamily}; color: ${t.textColor}; } .mouth { stroke: #666; } line { stroke: ${t.textColor} } .legend { fill: ${t.textColor}; font-family: ${t.fontFamily}; } .label text { fill: #333; } .label { color: ${t.textColor} } .face { ${t.faceColor?`fill: ${t.faceColor}`:"fill: #FFF8DC"}; stroke: #999; } .node rect, .node circle, .node ellipse, .node polygon, .node path { fill: ${t.mainBkg}; stroke: ${t.nodeBorder}; stroke-width: 1px; } .node .label { text-align: center; } .node.clickable { cursor: pointer; } .arrowheadPath { fill: ${t.arrowheadColor}; } .edgePath .path { stroke: ${t.lineColor}; stroke-width: 1.5px; } .flowchart-link { stroke: ${t.lineColor}; fill: none; } .edgeLabel { background-color: ${t.edgeLabelBackground}; rect { opacity: 0.5; } text-align: center; } .cluster rect { } .cluster text { fill: ${t.titleColor}; } div.mermaidTooltip { position: absolute; text-align: center; max-width: 200px; padding: 2px; font-family: ${t.fontFamily}; font-size: 12px; background: ${t.tertiaryColor}; border: 1px solid ${t.border2}; border-radius: 2px; pointer-events: none; z-index: 100; } .task-type-0, .section-type-0 { ${t.fillType0?`fill: ${t.fillType0}`:""}; } .task-type-1, .section-type-1 { ${t.fillType0?`fill: ${t.fillType1}`:""}; } .task-type-2, .section-type-2 { ${t.fillType0?`fill: ${t.fillType2}`:""}; } .task-type-3, .section-type-3 { ${t.fillType0?`fill: ${t.fillType3}`:""}; } .task-type-4, .section-type-4 { ${t.fillType0?`fill: ${t.fillType4}`:""}; } .task-type-5, .section-type-5 { ${t.fillType0?`fill: ${t.fillType5}`:""}; } .task-type-6, .section-type-6 { ${t.fillType0?`fill: ${t.fillType6}`:""}; } .task-type-7, .section-type-7 { ${t.fillType0?`fill: ${t.fillType7}`:""}; } .actor-0 { ${t.actor0?`fill: ${t.actor0}`:""}; } .actor-1 { ${t.actor1?`fill: ${t.actor1}`:""}; } .actor-2 { ${t.actor2?`fill: ${t.actor2}`:""}; } .actor-3 { ${t.actor3?`fill: ${t.actor3}`:""}; } .actor-4 { ${t.actor4?`fill: ${t.actor4}`:""}; } .actor-5 { ${t.actor5?`fill: ${t.actor5}`:""}; } ${xt()} `,"getStyles"),_t=Nt;var tt=s(function(t,e){return pt(t,e)},"drawRect"),jt=s(function(t,e){let d=t.append("circle").attr("cx",e.cx).attr("cy",e.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),n=t.append("g");n.append("circle").attr("cx",e.cx-15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),n.append("circle").attr("cx",e.cx+15/3).attr("cy",e.cy-15/3).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666");function u(g){let m=G().startAngle(Math.PI/2).endAngle(3*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+2)+")")}s(u,"smile");function p(g){let m=G().startAngle(3*Math.PI/2).endAngle(5*(Math.PI/2)).innerRadius(7.5).outerRadius(6.8181818181818175);g.append("path").attr("class","mouth").attr("d",m).attr("transform","translate("+e.cx+","+(e.cy+7)+")")}s(p,"sad");function c(g){g.append("line").attr("class","mouth").attr("stroke",2).attr("x1",e.cx-5).attr("y1",e.cy+7).attr("x2",e.cx+5).attr("y2",e.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return s(c,"ambivalent"),e.score>3?u(n):e.score<3?p(n):c(n),d},"drawFace"),vt=s(function(t,e){let a=t.append("circle");return a.attr("cx",e.cx),a.attr("cy",e.cy),a.attr("class","actor-"+e.pos),a.attr("fill",e.fill),a.attr("stroke",e.stroke),a.attr("r",e.r),a.class!==void 0&&a.attr("class",a.class),e.title!==void 0&&a.append("title").text(e.title),a},"drawCircle"),wt=s(function(t,e){return mt(t,e)},"drawText"),Wt=s(function(t,e){function a(n,u,p,c,g){return n+","+u+" "+(n+p)+","+u+" "+(n+p)+","+(u+c-g)+" "+(n+p-g*1.2)+","+(u+c)+" "+n+","+(u+c)}s(a,"genPoints");let d=t.append("polygon");d.attr("points",a(e.x,e.y,50,20,7)),d.attr("class","labelBox"),e.y=e.y+e.labelMargin,e.x=e.x+.5*e.labelMargin,wt(t,e)},"drawLabel"),zt=s(function(t,e,a){let d=t.append("g"),n=U();n.x=e.x,n.y=e.y,n.fill=e.fill,n.width=a.width*e.taskCount+a.diagramMarginX*(e.taskCount-1),n.height=a.height,n.class="journey-section section-type-"+e.num,n.rx=3,n.ry=3,tt(d,n),Tt(a)(e.text,d,n.x,n.y,n.width,n.height,{class:"journey-section section-type-"+e.num},a,e.colour)},"drawSection"),Q=-1,Ot=s(function(t,e,a,d){let n=e.x+a.width/2,u=t.append("g");Q++,u.append("line").attr("id",d+"-task"+Q).attr("x1",n).attr("y1",e.y).attr("x2",n).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),jt(u,{cx:n,cy:300+(5-e.score)*30,score:e.score});let c=U();c.x=e.x,c.y=e.y,c.fill=e.fill,c.width=a.width,c.height=a.height,c.class="task task-type-"+e.num,c.rx=3,c.ry=3,tt(u,c);let g=e.x+14;e.people.forEach(m=>{let x=e.actors[m].color,h={cx:g,cy:e.y,r:7,fill:x,stroke:"#000",title:m,pos:e.actors[m].position};vt(u,h),g+=10}),Tt(a)(e.task,u,c.x,c.y,c.width,c.height,{class:"task"},a,e.colour)},"drawTask"),Yt=s(function(t,e){gt(t,e)},"drawBackgroundRect"),Tt=(function(){function t(n,u,p,c,g,m,x,h){let i=u.append("text").attr("x",p+g/2).attr("y",c+m/2+5).style("font-color",h).style("text-anchor","middle").text(n);d(i,x)}s(t,"byText");function e(n,u,p,c,g,m,x,h,i){let{taskFontSize:r,taskFontFamily:o}=h,y=n.split(//gi);for(let f=0;f{let u=C[n].color,p={cx:20,cy:d,r:7,fill:u,stroke:"#000",pos:C[n].position};R.drawCircle(t,p);let c=t.append("text").attr("visibility","hidden").text(n),g=c.node().getBoundingClientRect().width;c.remove();let m=[];if(g<=a)m=[n];else{let x=n.split(" "),h="";c=t.append("text").attr("visibility","hidden"),x.forEach(i=>{let r=h?`${h} ${i}`:i;if(c.text(r),c.node().getBoundingClientRect().width>a){if(h&&m.push(h),h=i,c.text(i),c.node().getBoundingClientRect().width>a){let y="";for(let f of i)y+=f,c.text(y+"-"),c.node().getBoundingClientRect().width>a&&(m.push(y.slice(0,-1)+"-"),y=f);h=y}}else h=r}),h&&m.push(h),c.remove()}m.forEach((x,h)=>{let i={x:40,y:d+7+h*20,fill:"#666",text:x,textMargin:e.boxTextMargin??5},o=R.drawText(t,i).node().getBoundingClientRect().width;o>O&&o>e.leftMargin-o&&(O=o)}),d+=Math.max(20,m.length*20)})}s(Ht,"drawActorLegend");var S=P().journey,I=0,Xt=s(function(t,e,a,d){let n=P(),u=n.journey.titleColor,p=n.journey.titleFontSize,c=n.journey.titleFontFamily,g=n.securityLevel,m;g==="sandbox"&&(m=z("#i"+e));let x=g==="sandbox"?z(m.nodes()[0].contentDocument.body):z("body");$.init();let h=x.select("#"+e);R.initGraphics(h,e);let i=d.db.getTasks(),r=d.db.getDiagramTitle(),o=d.db.getActors();for(let E in C)delete C[E];let y=0;o.forEach(E=>{C[E]={color:S.actorColours[y%S.actorColours.length],position:y},y++}),Ht(h),I=S.leftMargin+O,$.insert(0,0,I,Object.keys(C).length*50),Gt(h,i,0,e);let f=$.getBounds();r&&h.append("text").text(r).attr("x",I).attr("font-size",p).attr("font-weight","bold").attr("y",25).attr("fill",u).attr("font-family",c);let l=f.stopy-f.starty+2*S.diagramMarginY,_=I+f.stopx+2*S.diagramMarginX;ot(h,l,_,S.useMaxWidth),h.append("line").attr("x1",I).attr("y1",S.height*4).attr("x2",_-I-4).attr("y2",S.height*4).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#"+e+"-arrowhead)");let k=r?70:0;h.attr("viewBox",`${f.startx} -25 ${_} ${l+k}`),h.attr("preserveAspectRatio","xMinYMin meet"),h.attr("height",l+k+25)},"draw"),$={data:{startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},verticalPos:0,sequenceItems:[],init:s(function(){this.sequenceItems=[],this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0},this.verticalPos=0},"init"),updateVal:s(function(t,e,a,d){t[e]===void 0?t[e]=a:t[e]=d(a,t[e])},"updateVal"),updateBounds:s(function(t,e,a,d){let n=P().journey,u=this,p=0;function c(g){return s(function(x){p++;let h=u.sequenceItems.length-p+1;u.updateVal(x,"starty",e-h*n.boxMargin,Math.min),u.updateVal(x,"stopy",d+h*n.boxMargin,Math.max),u.updateVal($.data,"startx",t-h*n.boxMargin,Math.min),u.updateVal($.data,"stopx",a+h*n.boxMargin,Math.max),g!=="activation"&&(u.updateVal(x,"startx",t-h*n.boxMargin,Math.min),u.updateVal(x,"stopx",a+h*n.boxMargin,Math.max),u.updateVal($.data,"starty",e-h*n.boxMargin,Math.min),u.updateVal($.data,"stopy",d+h*n.boxMargin,Math.max))},"updateItemBounds")}s(c,"updateFn"),this.sequenceItems.forEach(c())},"updateBounds"),insert:s(function(t,e,a,d){let n=Math.min(t,a),u=Math.max(t,a),p=Math.min(e,d),c=Math.max(e,d);this.updateVal($.data,"startx",n,Math.min),this.updateVal($.data,"starty",p,Math.min),this.updateVal($.data,"stopx",u,Math.max),this.updateVal($.data,"stopy",c,Math.max),this.updateBounds(n,p,u,c)},"insert"),bumpVerticalPos:s(function(t){this.verticalPos=this.verticalPos+t,this.data.stopy=this.verticalPos},"bumpVerticalPos"),getVerticalPos:s(function(){return this.verticalPos},"getVerticalPos"),getBounds:s(function(){return this.data},"getBounds")},et=S.sectionFills,$t=S.sectionColours,Gt=s(function(t,e,a,d){let n=P().journey,u="",p=n.height*2+n.diagramMarginY,c=a+p,g=0,m="#CCC",x="black",h=0;for(let[i,r]of e.entries()){if(u!==r.section){m=et[g%et.length],h=g%et.length,x=$t[g%$t.length];let y=0,f=r.section;for(let _=i;_(C[f]&&(y[f]=C[f]),y),{});r.x=i*n.taskMargin+i*n.width+I,r.y=c,r.width=n.diagramMarginX,r.height=n.diagramMarginY,r.colour=x,r.fill=m,r.num=h,r.actors=o,R.drawTask(t,r,n,d),$.insert(r.x,r.y,r.x+r.width+n.taskMargin,450)}},"drawTasks"),nt={setConf:Dt,draw:Xt};var be={parser:kt,db:K,renderer:nt,styles:_t,init:s(t=>{nt.setConf(t.journey),K.clear()},"init")};export{be as diagram};