PageSourceSearch

https://chenhe.me/_astro/ishikawaDiagram-UXIWVN3A.C5vmgHRA.js

js chenhe.me collected 2026-10-03 22:48:16 UTC 17,361 bytes, 1 lines download raw bytes

1import{_ as l,c as lt,N as ct,I as ut,as as dt,z as yt,k as ft,p as et,a as pt,b as gt,g as kt,s as mt,q as wt,e as _t}from"./mermaid.core.C9OoST5E.js";var Q=function(){var t=l(function(t,e,i,n){for(i=i||{},n=t.length;n--;i[t[n]]=e);return i},"o"),e=[1,4],i=[1,14],n=[1,12],s=[1,13],a=[6,7,8],r=[1,20],h=[1,18],o=[1,19],c=[6,7,11],u=[1,6,13,14],y=[1,23],d=[1,24],p=[1,6,7,11,13,14],g={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:l(function(t,e,i,n,s,a,r){var l=a.length-1;switch(s){case 6:case 7:return n;case 15:n.addNode(a[l-1].length,a[l].trim());break;case 16:n.addNode(0,a[l].trim())}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:e},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:e},{6:i,7:[1,10],9:9,12:11,13:n,14:s},t(a,[2,3]),{1:[2,2]},t(a,[2,4]),t(a,[2,5]),{1:[2,6],6:i,12:15,13:n,14:s},{6:i,9:16,12:11,13:n,14:s},{6:r,7:h,10:17,11:o},t(c,[2,18],{14:[1,21]}),t(c,[2,16]),t(c,[2,17]),{6:r,7:h,10:22,11:o},{1:[2,7],6:i,12:15,13:n,14:s},t(u,[2,14],{7:y,11:d}),t(p,[2,8]),t(p,[2,9]),t(p,[2,10]),t(c,[2,15]),t(u,[2,13],{7:y,11:d}),t(p,[2,11]),t(p,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:l(function(t,e){if(!e.recoverable){var i=new Error(t);throw i.hash=e,i}this.trace(t)},"parseError"),parse:l(function(t){var e=this,i=[0],n=[],s=[null],a=[],r=this.table,h="",o=0,c=0,u=a.slice.call(arguments,1),y=Object.create(this.lexer),d={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d.yy[p]=this.yy[p]);y.setInput(t,d.yy),d.yy.lexer=y,d.yy.parser=this,typeof y.yylloc>"u"&&(y.yylloc={});var g=y.yylloc;a.push(g);var f=y.options&&y.options.ranges;function k(){var t;return"number"!=typeof(t=n.pop()||y.lex()||1)&&(t instanceof Array&&(t=(n=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,l(function(t){i.length=i.length-2*t,s.length=s.length-t,a.length=a.length-t},"popStack"),l(k,"lex");for(var m,w,x,_,b,v,S,$,I={};;){if(w=i[i.length-1],this.defaultActions[w]?x=this.defaultActions[w]:((null===m||typeof m>"u")&&(m=k()),x=r[w]&&r[w][m]),typeof x>"u"||!x.length||!x[0]){var E="";for(b in $=[],r[w])this.terminals_[b]&&b>2&&$.push("'"+this.terminals_[b]+"'");E=y.showPosition?"Parse error on line "+(o+1)+":\n"+y.showPosition()+"\nExpecting "+$.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(E,{text:y.match,token:this.terminals_[m]||m,line:y.yylineno,loc:g,expected:$})}if(x[0]instanceof Array&&x.length>1)throw new Error("Parse Error: multiple actions possible at state: "+w+", token: "+m);switch(x[0]){case 1:i.push(m),s.push(y.yytext),a.push(y.yylloc),i.push(x[1]),m=null,c=y.yyleng,h=y.yytext,o=y.yylineno,g=y.yylloc;break;case 2:if(v=this.productions_[x[1]][1],I.$=s[s.length-v],I._$={first_line:a[a.length-(v||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(v||1)].first_column,last_column:a[a.length-1].last_column},f&&(I._$.range=[a[a.length-(v||1)].range[0],a[a.length-1].range[1]]),typeof(_=this.performAction.apply(I,[h,c,o,d.yy,x[1],s,a].concat(u)))<"u")return _;v&&(i=i.slice(0,-1*v*2),s=s.slice(0,-1*v),a=a.slice(0,-1*v)),i.push(this.productions_[x[1]][0]),s.push(I.$),a.push(I._$),S=r[i[i.length-2]][i[i.length-1]],i.push(S);break;case 3:return!0}}return!0},"parse")},f={EOF:1,parseError:l(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:l(function(t,e){return this.yy=e||this.yy||{},this._input=t,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:l(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:l(function(t){var e=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var n=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),i.length-1&&(this.yylineno-=i.length-1);var s=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:i?(i.length===n.length?this.yylloc.first_column:0)+n[n.length-i.length].length-i[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[s[0],s[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):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).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:l(function(t){this.unput(this.match.slice(t))},"less"),pastInput:l(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:l(function(t,e){var i,n,s;if(this.options.backtrack_lexer&&(s={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&&(s.yylloc.range=this.yylloc.range.slice(0))),(n=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=n.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:n?n[n.length-1].length-n[n.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,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(t[0].length),this.matched+=t[0],i=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),i)return i;if(this._backtrack){for(var a in s)this[a]=s[a];return!1}return!1},"test_match"),next:l(function(){if(this.done)return this.EOF;var t,e,i,n;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),a=0;a<s.length;a++)if((i=this._input.match(this.rules[s[a]]))&&(!e||i[0].length>e[0].length)){if(e=i,n=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(i,s[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,s[n]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:l(function(){return this.next()||this.lex()},"lex"),begin:l(function(t){this.conditionStack.push(t)},"begin"),popState:l(function(){return this.conditionStack.length-1>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(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:l(function(t){this.begin(t)},"pushState"),stateStackSize:l(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0}
1,performAction:l(function(t,e,i,n){switch(i){case 0:case 3:return 6;case 1:case 2:return 8;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}}};function k(){this.yy={}}return g.lexer=f,l(k,"Parser"),k.prototype=g,g.Parser=k,new k}();Q.parser=Q;var bt=Q,xt=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,yt()}getRoot(){return this.root}addNode(t,e){const i=ft.sanitizeText(e,lt());if(!this.root)return this.root={text:i,children:[]},this.stack=[{level:0,node:this.root}],void et(i);this.baseLevel??=t;let n=t-this.baseLevel+1;for(n<=0&&(n=1);this.stack.length>1&&this.stack[this.stack.length-1].level>=n;)this.stack.pop();const s={text:i,children:[]};this.stack[this.stack.length-1].node.children.push(s),this.stack.push({level:n,node:s})}getAccTitle(){return pt()}setAccTitle(t){gt(t)}getAccDescription(){return kt()}setAccDescription(t){mt(t)}getDiagramTitle(){return wt()}setDiagramTitle(t){et(t)}},vt=14,F=250,St=30,$t=60,Et=5,ot=82*Math.PI/180,it=Math.cos(ot),st=Math.sin(ot),nt=l((t,e,i)=>{const n=t.node().getBBox(),s=n.width+2*e,a=n.height+2*e;_t(t,a,s,i),t.attr("viewBox",`${n.x-e} ${n.y-e} ${s} ${a}`)},"applyPaddedViewBox"),At=l((t,e,i,n)=>{const s=n.db.getRoot();if(!s)return;const a=lt(),{look:r,handDrawnSeed:l,themeVariables:h}=a,o=ct(a.fontSize)[0]??vt,c="handDrawn"===r,u=s.children??[],y=a.ishikawa?.diagramPadding??20,d=a.ishikawa?.useMaxWidth??!1,p=ut(e),g=p.append("g").attr("class","ishikawa"),f=c?dt.svg(p.node()):void 0,k=f?{roughSvg:f,seed:l??0,lineColor:h?.lineColor??"#333",fillColor:h?.mainBkg??"#fff"}:void 0,m=`ishikawa-arrow-${e}`;c||g.append("defs").append("marker").attr("id",m).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 w=0,x=F;const _=c?void 0:j(g,w,x,w,x,"ishikawa-spine");if(It(g,w,x,s.text,o,k),!u.length)return c&&j(g,w,x,w,x,"ishikawa-spine",k),void nt(p,y,d);w-=20;const b=u.filter((t,e)=>e%2==0),v=u.filter((t,e)=>e%2==1),S=at(b),$=at(v),I=S.total+$.total;let E=F,A=F;if(I>0){const t=2*F,e=.3*F;E=Math.max(e,t*(S.total/I)),A=Math.max(e,t*($.total/I))}const C=2*o;E=Math.max(E,S.max*C),A=Math.max(A,$.max*C),x=Math.max(E,F),_&&_.attr("y1",x).attr("y2",x),g.select(".ishikawa-head-group").attr("transform",`translate(0,${x})`);const L=Math.ceil(u.length/2);for(let t=0;t<L;t++){const e=g.append("g").attr("class","ishikawa-pair");for(const[i,n,s]of[[u[2*t],-1,E],[u[2*t+1],1,A]])i&&Mt(e,i,w,x,n,s,o,k);w=e.selectAll("text").nodes().reduce((t,e)=>Math.min(t,e.getBBox().x),1/0)}if(c)j(g,w,x,0,x,"ishikawa-spine",k);else{_.attr("x1",w);const t=`url(#${m})`;g.selectAll("line.ishikawa-branch, line.ishikawa-sub-branch").attr("marker-start",t)}nt(p,y,d)},"draw"),at=l(t=>{const e=l(t=>t.children.reduce((t,i)=>t+1+e(i),0),"countDescendants");return t.reduce((t,i)=>{const n=e(i);return t.total+=n,t.max=Math.max(t.max,n),t},{total:0,max:0})},"sideStats"),It=l((t,e,i,n,s,a)=>{const r=Math.max(6,Math.floor(110/(.6*s))),l=t.append("g").attr("class","ishikawa-head-group").attr("transform",`translate(${e},${i})`),h=Z(l,ht(n,r),0,0,"ishikawa-head-label","start",s),o=h.node().getBBox(),c=Math.max(60,o.width+6),u=Math.max(40,2*o.height+40),y=`M 0 ${-u/2} L 0 ${u/2} Q ${2.4*c} 0 0 ${-u/2} Z`;if(a){const t=a.roughSvg.path(y,{roughness:1.5,seed:a.seed,fill:a.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:a.lineColor,strokeWidth:2});l.insert(()=>t,":first-child").attr("class","ishikawa-head")}else l.insert("path",":first-child").attr("class","ishikawa-head").attr("d",y);h.attr("transform",`translate(${(c-o.width)/2-o.x+3},${-o.y-o.height/2})`)},"drawHead"),Lt=l((t,e)=>{const i=[],n=[],s=l((t,a,r)=>{const l=-1===e?[...t].reverse():t;
1for(const t of l){const e=i.length,l=t.children??[];i.push({depth:r,text:ht(t.text,15),parentIndex:a,childCount:l.length}),r%2==0?(n.push(e),l.length&&s(l,e,r+1)):(l.length&&s(l,e,r+1),n.push(e))}},"walk");return s(t,-1,2),{entries:i,yOrder:n}},"flattenTree"),Tt=l((t,e,i,n,s,a,r)=>{const l=t.append("g").attr("class","ishikawa-label-group"),h=Z(l,e,i,n+11*s,"ishikawa-label cause","middle",a).node().getBBox();if(r){const t=r.roughSvg.rectangle(h.x-20,h.y-2,h.width+40,h.height+4,{roughness:1.5,seed:r.seed,fill:r.fillColor,fillStyle:"hachure",fillWeight:2.5,hachureGap:5,stroke:r.lineColor,strokeWidth:2});l.insert(()=>t,":first-child").attr("class","ishikawa-label-box")}else l.insert("rect",":first-child").attr("class","ishikawa-label-box").attr("x",h.x-20).attr("y",h.y-2).attr("width",h.width+40).attr("height",h.height+4)},"drawCauseLabel"),K=l((t,e,i,n,s,a)=>{const r=Math.sqrt(n*n+s*s);if(0===r)return;const l=n/r,h=s/r,o=6*-h,c=6*l,u=`M ${e} ${i} L ${e-6*l*2+o} ${i-6*h*2+c} L ${e-6*l*2-o} ${i-6*h*2-c} Z`,y=a.roughSvg.path(u,{roughness:1,seed:a.seed,fill:a.lineColor,fillStyle:"solid",stroke:a.lineColor,strokeWidth:1});t.append(()=>y)},"drawArrowMarker"),Mt=l((t,e,i,n,s,a,r,l)=>{const h=e.children??[],o=a*(h.length?1:.2),c=st*o*s,u=i+-it*o,y=n+c;if(j(t,i,n,u,y,"ishikawa-branch",l),l&&K(t,i,n,i-u,n-y,l),Tt(t,e.text,u,y,s,r,l),!h.length)return;const{entries:d,yOrder:p}=Lt(h,s),g=d.length,f=new Array(g);for(const[t,e]of p.entries())f[e]=n+c*((t+1)/(g+1));const k=new Map;k.set(-1,{x0:i,y0:n,x1:u,y1:y,childCount:h.length,childrenDrawn:0});const m=-it,w=st*s,x=s<0?"ishikawa-label up":"ishikawa-label down";for(const[e,i]of d.entries()){const n=f[e],s=k.get(i.parentIndex),a=t.append("g").attr("class","ishikawa-sub-group");let h=0,o=0,c=0;if(i.depth%2==0){const t=s.y1-s.y0;h=rt(s.x0,s.x1,t?(n-s.y0)/t:.5),o=n,c=h-(i.childCount>0?$t+i.childCount*Et:St),j(a,h,n,c,n,"ishikawa-sub-branch",l),l&&K(a,h,n,1,0,l),Z(a,i.text,c,n,"ishikawa-label align","end",r)}else{const t=s.childrenDrawn++;h=rt(s.x0,s.x1,(s.childCount-t)/(s.childCount+1)),o=s.y0,c=h+m*((n-o)/w),j(a,h,o,c,n,"ishikawa-sub-branch",l),l&&K(a,h,o,h-c,o-n,l),Z(a,i.text,c,n,x,"end",r)}i.childCount>0&&k.set(e,{x0:h,y0:o,x1:c,y1:n,childCount:i.childCount,childrenDrawn:0})}},"drawBranch"),Nt=l(t=>t.split(/<br\s*\/?>|\n/),"splitLines"),ht=l((t,e)=>{if(t.length<=e)return t;const i=[];for(const n of t.split(/\s+/)){const t=i.length-1;t>=0&&i[t].length+1+n.length<=e?i[t]+=" "+n:i.push(n)}return i.join("\n")},"wrapText"),Z=l((t,e,i,n,s,a,r)=>{const l=Nt(e),h=1.05*r,o=t.append("text").attr("class",s).attr("text-anchor",a).attr("x",i).attr("y",n-(l.length-1)*h/2);for(const[t,e]of l.entries())o.append("tspan").attr("x",i).attr("dy",0===t?0:h).text(e);return o},"drawMultilineText"),rt=l((t,e,i)=>t+(e-t)*i,"lerp"),j=l((t,e,i,n,s,a,r)=>{if(r){const l=r.roughSvg.line(e,i,n,s,{roughness:1.5,seed:r.seed,stroke:r.lineColor,strokeWidth:2});return void t.append(()=>l).attr("class",a)}return t.append("line").attr("class",a).attr("x1",e).attr("y1",i).attr("x2",n).attr("y2",s)},"drawLine"),Pt={draw:At},Bt=l(t=>`\n.ishikawa .ishikawa-spine,\n.ishikawa .ishikawa-branch,\n.ishikawa .ishikawa-sub-branch {\n  stroke: ${t.lineColor};\n  stroke-width: 2;\n  fill: none;\n}\n\n.ishikawa .ishikawa-sub-branch {\n  stroke-width: 1;\n}\n\n.ishikawa .ishikawa-arrow {\n  fill: ${t.lineColor};\n}\n\n.ishikawa .ishikawa-head {\n  fill: ${t.mainBkg};\n  stroke: ${t.lineColor};\n  stroke-width: 2;\n}\n\n.ishikawa .ishikawa-label-box {\n  fill: ${t.mainBkg};\n  stroke: ${t.lineColor};\n  stroke-width: 2;\n}\n\n.ishikawa text {\n  font-family: ${t.fontFamily};\n  font-size: ${t.fontSize};\n  fill: ${t.textColor};\n}\n\n.ishikawa .ishikawa-head-label {\n  font-weight: 600;\n  text-anchor: middle;\n  dominant-baseline: middle;\n  font-size: 14px;\n}\n\n.ishikawa .ishikawa-label {\n  text-anchor: end;\n}\n\n.ishikawa .ishikawa-label.cause {\n  text-anchor: middle;\n  dominant-baseline: middle;\n}\n\n.ishikawa .ishikawa-label.align {\n  text-anchor: end;\n  dominant-baseline: middle;\n}\n\n.ishikawa .ishikawa-label.up {\n  dominant-baseline: baseline;\n}\n\n.ishikawa .ishikawa-label.down {\n  dominant-baseline: hanging;\n}\n`,"getStyles"),Dt=Bt,Ct={parser:bt,get db(){return new xt},renderer:Pt,styles:Dt};export{Ct as diagram};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.