| 6 | `+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){var s=this.next();return s||this.lex()},"lex"),begin:l(function(s){this.conditionStack.push(s)},"begin"),popState:l(function(){var s=this.conditionStack.length-1;return s>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:l(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:l(function(s){return s=this.conditionStack.length-1-Math.abs(s||0),s>=0?this.conditionStack[s]:"INITIAL"},"topState"),pushState:l(function(s){this.begin(s)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:l(function(s,i,h,f){var n=f;switch(h){case 0:return 6;case 1:return 8;case 2:return 8;case 3:return 6;case 4:return 7;case 5:return 13;case 6:return 14;case 7:return 11}},"anonymous"),rules:[/^(?:\s*%%.*)/i,/^(?:ishikawa-beta\b)/i,/^(?:ishikawa\b)/i,/^(?:[\s]+[\n])/i,/^(?:[\n]+)/i,/^(?:[\s]+)/i,/^(?:[^\n]+)/i,/^(?:$)/i],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7],inclusive:!0}}};return M})();N.lexer=D;function $(){this.yy={}}return l($,"Parser"),$.prototype=N,N.Parser=$,new $})();et.parser=et;var vt=et,St=class{constructor(){this.stack=[],this.clear=this.clear.bind(this),this.addNode=this.addNode.bind(this),this.getRoot=this.getRoot.bind(this)}static{l(this,"IshikawaDB")}clear(){this.root=void 0,this.stack=[],this.baseLevel=void 0,rt()}getRoot(){return this.root}addNode(t,d){let a=nt.sanitizeText(d,J());if(!this.root){this.baseLevel=t,this.root={text:a,children:[]},this.stack=[{level:0,node:this.root}],Q(a);return}let r=t-(this.baseLevel??0);for(r<=0&&(r=1);this.stack.length>1&&this.stack[this.stack.length-1].level>=r;)this.stack.pop();let o=this.stack[this.stack.length-1].node,y={text:a,children:[]};o.children.push(y),this.stack.push({level:r,node:y})}getAccTitle(){return ot()}setAccTitle(t){lt(t)}getAccDescription(){return ct()}setAccDescription(t){ht(t)}getDiagramTitle(){return ut()}setDiagramTitle(t){Q(t)}},Et=14,j=250,$t=30,At=60,It=5,bt=82*Math.PI/180,pt=Math.cos(bt),gt=Math.sin(bt),kt=l((t,d,a)=>{let r=t.node().getBBox(),o=r.width+d*2,y=r.height+d*2;at(t,y,o,a),t.attr("viewBox",`${r.x-d} ${r.y-d} ${o} ${y}`)},"applyPaddedViewBox"),Lt=l((t,d,a,r)=>{let y=r.db.getRoot();if(!y)return;let p=J(),{look:u,handDrawnSeed:w,themeVariables:c}=p,m=yt(p.fontSize)[0]??Et,k=u==="handDrawn",_=y.children??[],x=p.ishikawa?.diagramPadding??20,N=p.ishikawa?.useMaxWidth??!1,D=dt(d),$=D.append("g").attr("class","ishikawa"),M=k?ft.svg(D.node()):void 0,e=M?{roughSvg:M,seed:w??0,lineColor:c?.lineColor??"#333",fillColor:c?.mainBkg??"#fff"}:void 0,s=`ishikawa-arrow-${d}`;k||$.append("defs").append("marker").attr("id",s).attr("viewBox","0 0 10 10").attr("refX",0).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 Z").attr("class","ishikawa-arrow");let i=0,h=j,f=k?void 0:z($,i,h,i,h,"ishikawa-spine");if(Tt($,i,h,y.text,m,e),!_.length){k&&z($,i,h,i,h,"ishikawa-spine",e),kt(D,x,N);return}i-=20;let n=_.filter((g,E)=>E%2===0),v=_.filter((g,E)=>E%2===1),b=mt(n),I=mt(v),S=b.total+I.total,A=j,L=j;if(S>0){let g=j*2,E=j*.3;A=Math.max(E,g*(b.total/S)),L=Math.max(E,g*(I.total/S))}let O=m*2;A=Math.max(A,b.max*O),L=Math.max(L,I.max*O),h=Math.max(A,j),f&&f.attr("y1",h).attr("y2",h),$.select(".ishikawa-head-group").attr("transform",`translate(0,${h})`);let Z=Math.ceil(_.length/2);for(let g=0;g<Z;g++){let E=$.append("g").attr("class","ishikawa-pair");for(let[V,R,X]of[[_[g*2],-1,A],[_[g*2+1],1,L]])V&&Bt(E,V,i,h,R,X,m,e);i=E.selectAll("text").nodes().reduce((V,R)=>Math.min(V,R.getBBox().x),1/0)}if(k)z($,i,h,0,h,"ishikawa-spine",e);else{f.attr("x1",i);let g=`url(#${s})`;$.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start",g)}kt(D,x,N)},"draw"),mt=l(t=>{let d=l(a=>a.children.reduce((r,o)=>r+1+d(o),0),"countDescendants");return t.reduce((a,r)=>{let o=d(r);return a.total+=o,a.max=Math.max(a.max,o),a},{total:0,max:0})},"sideStats"),Tt=l((t,d,a,r,o,y)=>{let p=Math.max(6,Math.floor(110/(o*.6))),u=t.append("g").attr("class","ishikawa-head-group").attr("transform",`translate(${d},${a})`),w=U(u,_t(r,p),0,0,"ishikawa-head-label","start",o),c=w.node().getBBox(),m=Math.max(60,c.width+6),k=Math.max(40,c.height*2+40),_=`M 0 ${-k/2} L 0 ${k/2} Q ${m*2.4} 0 0 ${-k/2} Z`;if(y){let x=y.roughSvg.path(_,{roughness:1.5,seed:y.seed,fill:y.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:y.lineColor,strokeWidth:2});u.insert(()=>x,":first-child").attr("class","ishikawa-head")}else u.insert("path",":first-child").attr("class","ishikawa-head").attr("d",_);w.attr("transform",`translate(${(m-c.width)/2-c.x+3},${-c.y-c.height/2})`)},"drawHead"),Mt=l((t,d)=>{let a=[],r=[],o=l((y,p,u)=>{let w=d===-1?[...y].reverse():y;for(let c of w){let m=a.length,k=c.children??[];a.push({depth:u,text:_t(c.text,15),parentIndex:p,childCount:k.length}),u%2===0?(r.push(m),k.length&&o(k,m,u+1)):(k.length&&o(k,m,u+1),r.push(m))}},"walk");return o(t,-1,2),{entries:a,yOrder:r}},"flattenTree"),Pt=l((t,d,a,r,o,y,p)=>{let u=t.append("g").attr("class","ishikawa-label-group"),c=U(u,d,a,r+11*o,"ishikawa-label cause","middle",y).node().getBBox();if(p){let m=p.roughSvg.rectangle(c.x-20,c.y-2,c.width+40,c.height+4,{roughness:1.5,seed:p.seed,fill:p.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:p.lineColor,strokeWidth:2});u.insert(()=>m,":first-child").attr("class","ishikawa-label-box")}else u.insert("rect",":first-child").attr("class","ishikawa-label-box").attr("x",c.x-20).attr("y",c.y-2).attr("width",c.width+40).attr("height",c.height+4)},"drawCauseLabel"),tt=l((t,d,a,r,o,y)=>{let p=Math.sqrt(r*r+o*o);if(p===0)return;let u=r/p,w=o/p,c=6,m=-w*c,k=u*c,_=d,x=a,N=`M ${_} ${x} L ${_-u*c*2+m} ${x-w*c*2+k} L ${_-u*c*2-m} ${x-w*c*2-k} Z`,D=y.roughSvg.path(N,{roughness:1,seed:y.seed,fill:y.lineColor,fillStyle:"solid",stroke:y.lineColor,strokeWidth:1});t.append(()=>D)},"drawArrowMarker"),Bt=l((t,d,a,r,o,y,p,u)=>{let w=d.children??[],c=y*(w.length?1:.2),m=-pt*c,k=gt*c*o,_=a+m,x=r+k;if(z(t,a,r,_,x,"ishikawa-branch",u),u&&tt(t,a,r,a-_,r-x,u),Pt(t,d.text,_,x,o,p,u),!w.length)return;let{entries:N,yOrder:D}=Mt(w,o),$=N.length,M=new Array($);for(let[f,n]of D.entries())M[n]=r+k*((f+1)/($+1));let e=new Map;e.set(-1,{x0:a,y0:r,x1:_,y1:x,childCount:w.length,childrenDrawn:0});let s=-pt,i=gt*o,h=o<0?"ishikawa-label up":"ishikawa-label down";for(let[f,n]of N.entries()){let v=M[f],b=e.get(n.parentIndex),I=t.append("g").attr("class","ishikawa-sub-group"),S=0,A=0,L=0;if(n.depth%2===0){let O=b.y1-b.y0;S=wt(b.x0,b.x1,O?(v-b.y0)/O:.5),A=v,L=S-(n.childCount>0?At+n.childCount*It:$t),z(I,S,v,L,v,"ishikawa-sub-branch",u),u&&tt(I,S,v,1,0,u),U(I,n.text,L,v,"ishikawa-label align","end",p)}else{let O=b.childrenDrawn++;S=wt(b.x0,b.x1,(b.childCount-O)/(b.childCount+1)),A=b.y0,L=S+s*((v-A)/i),z(I,S,A,L,v,"ishikawa-sub-branch",u),u&&tt(I,S,A,S-L,A-v,u),U(I,n.text,L,v,h,"end",p)}n.childCount>0&&e.set(f,{x0:S,y0:A,x1:L,y1:v,childCount:n.childCount,childrenDrawn:0})}},"drawBranch"),Nt=l(t=>t.split(/<br\s*\/?>|\n/),"splitLines"),_t=l((t,d)=>{if(t.length<=d)return t;let a=[];for(let r of t.split(/\s+/)){let o=a.length-1;o>=0&&a[o].length+1+r.length<=d?a[o]+=" "+r:a.push(r)}return a.join(` |