@hardikg/mdview 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-d5-zUW3h.js → abnfDiagram-VCTEODGH-BJQEGN-7.js} +1 -1
- package/dist/client/assets/{arc-DIbSNhHb.js → arc-C6Oi4WlG.js} +1 -1
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-Cq_KBCV9.js → architectureDiagram-5GKGNRK7-CvFdvi3K.js} +1 -1
- package/dist/client/assets/{blockDiagram-NRAW4CY4-CKgrJGzB.js → blockDiagram-NRAW4CY4-D8P8a3XW.js} +1 -1
- package/dist/client/assets/{c4Diagram-UCG6FXSJ-CamsXU_i.js → c4Diagram-UCG6FXSJ-WcmmjfHX.js} +1 -1
- package/dist/client/assets/channel-UA4WTF8Q.js +1 -0
- package/dist/client/assets/{chunk-2Q5K7J3B-DHB85OBA.js → chunk-2Q5K7J3B-LeZsbe9d.js} +1 -1
- package/dist/client/assets/{chunk-5VM5RSS4-C3v07bfZ.js → chunk-5VM5RSS4-COq9euGx.js} +1 -1
- package/dist/client/assets/{chunk-F27PBJKO-bDA5q_T9.js → chunk-F27PBJKO-BxcjnaqW.js} +1 -1
- package/dist/client/assets/{chunk-G27WJ6UU-DjS6mkGt.js → chunk-G27WJ6UU-CscpPXiS.js} +1 -1
- package/dist/client/assets/{chunk-JWPE2WC7-ln94eTAD.js → chunk-JWPE2WC7-DD0M0JL-.js} +1 -1
- package/dist/client/assets/{chunk-LCL6LL3I-SEXOnCPG.js → chunk-LCL6LL3I-DXhJ59Qq.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-Dpgmgmgq.js → chunk-POPQ4Y6H-Bj3eKHA8.js} +1 -1
- package/dist/client/assets/{chunk-SVP7TREG-C_qgSQCy.js → chunk-SVP7TREG-CDQ9vZv1.js} +1 -1
- package/dist/client/assets/{chunk-XXDRQBXY-CguISEfl.js → chunk-XXDRQBXY-91VBn0TQ.js} +1 -1
- package/dist/client/assets/classDiagram-DTDB5LWJ-Ch3MnxRH.js +1 -0
- package/dist/client/assets/classDiagram-v2-JRS7N3AN-Ch3MnxRH.js +1 -0
- package/dist/client/assets/{cose-bilkent-JH36ORCC-CjtLn09K.js → cose-bilkent-JH36ORCC-BaQN6N6K.js} +1 -1
- package/dist/client/assets/{cynefin-OW5HDTMX-BgNmTgCR.js → cynefin-OW5HDTMX-DFpC3uqz.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-BFfuQ7YY.js → cynefinDiagram-5FMLGOSQ-CSeSIxw6.js} +1 -1
- package/dist/client/assets/{dagre-3AP2YEHR-BDLHOy1Z.js → dagre-3AP2YEHR-BBkMnw1s.js} +1 -1
- package/dist/client/assets/{diagram-S7CK7UJ4-CfzUQiTU.js → diagram-S7CK7UJ4-BRdjuShi.js} +1 -1
- package/dist/client/assets/{diagram-UQ7AKVKN-Ds3lTKuY.js → diagram-UQ7AKVKN-D-RaNNET.js} +1 -1
- package/dist/client/assets/{diagram-VSXAHHWV-lwAuvia3.js → diagram-VSXAHHWV-eL5_j9pa.js} +1 -1
- package/dist/client/assets/{diagram-VX7I27RA-CsU4EPwU.js → diagram-VX7I27RA-nlUjCwlX.js} +1 -1
- package/dist/client/assets/{diagram-Z3DM3KII-DFieIgnM.js → diagram-Z3DM3KII-DvhXGz8M.js} +1 -1
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-BzR_CBzj.js → ebnfDiagram-PWID7BFC-LgynLQ4Z.js} +1 -1
- package/dist/client/assets/{erDiagram-SSCWMZ5O-joYlyDrM.js → erDiagram-SSCWMZ5O-Bc2j9FRV.js} +1 -1
- package/dist/client/assets/{flowDiagram-A5DVABFB-DVyMxsTJ.js → flowDiagram-A5DVABFB-ClpDS0y_.js} +1 -1
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-Cf4FwZsI.js → ganttDiagram-EL5Y4UJY-_RmNHCQH.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-9grceorS.js → gitGraphDiagram-WWUBYQGX-F1UGJQ4d.js} +1 -1
- package/dist/client/assets/index-BP_8buXC.css +1 -0
- package/dist/client/assets/index-DqIihcNP.js +2 -0
- package/dist/client/assets/{infoDiagram-RXCK75RN-ja-7F4cO.js → infoDiagram-RXCK75RN-BR20W1yx.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-uRRSMmsi.js → ishikawaDiagram-5VMMS53U-D6bgpoOj.js} +1 -1
- package/dist/client/assets/{journeyDiagram-EYS64GPL-BdD_OYKc.js → journeyDiagram-EYS64GPL-CBjB_0Bx.js} +1 -1
- package/dist/client/assets/{kanban-definition-3QL26DDD-3rMqnFFk.js → kanban-definition-3QL26DDD-Bz0HhYZd.js} +1 -1
- package/dist/client/assets/{layout-3dyJkKek.js → layout-BmTy4KT7.js} +1 -1
- package/dist/client/assets/{linear-B49R1aTA.js → linear-Cgk2Kw-d.js} +1 -1
- package/dist/client/assets/{mermaid.core-CVM43n3z.js → mermaid.core-Dq2piIpp.js} +65 -65
- package/dist/client/assets/{mindmap-definition-FBJOCRG2-B8QesUuH.js → mindmap-definition-FBJOCRG2-BSbZ3zKk.js} +1 -1
- package/dist/client/assets/{pegDiagram-XKGWAZYB-BeO8X3By.js → pegDiagram-XKGWAZYB-BLsHBZ_O.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-DD3M93Je.js → pieDiagram-E7YTZNPT-BTtaojGC.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-LxJ8Qxzg.js → quadrantDiagram-AXDQQJYC-W-VPz1gZ.js} +1 -1
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-Cc6-wuTB.js → railroadDiagram-O6MQD6OU-CstXUJhE.js} +1 -1
- package/dist/client/assets/{requirementDiagram-EFPCY7ZU-D-vaSng7.js → requirementDiagram-EFPCY7ZU-DPpI_Lvd.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-C-SrB4wj.js → sankeyDiagram-P5KCCOFB-B3HiW1sY.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-BpUTXTa1.js → sequenceDiagram-WJ2MYXX4-CfpZAY9b.js} +1 -1
- package/dist/client/assets/{sizeCapture-X5ZJPWSS-BG1rRkMg.js → sizeCapture-X5ZJPWSS-Dsdx6W_J.js} +1 -1
- package/dist/client/assets/{stateDiagram-HBIQ2CUA-CAsJ9kP3.js → stateDiagram-HBIQ2CUA-DPm-o7Ee.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-4QOOHH4V-DDqXMzve.js +1 -0
- package/dist/client/assets/{swimlanes-XN3QIQJK-DH5txxCi.js → swimlanes-XN3QIQJK-BPdZeRls.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-VK2B7HYN-BHORPcrU.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-DPSR_k-5.js → timeline-definition-24CTP7MA-1bs3iV0k.js} +1 -1
- package/dist/client/assets/{vennDiagram-4TSXK5OY-CRMSJqLq.js → vennDiagram-4TSXK5OY-vYOlmqTL.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-DRCnYQxB.js → wardleyDiagram-VM6X3IG4-DTPUMRNL.js} +1 -1
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-x5N3gqvJ.js → xychartDiagram-S5SC5T6Z-M5kqQyt7.js} +1 -1
- package/dist/client/index.html +2 -2
- package/package.json +1 -1
- package/dist/client/assets/channel-MJp4QxQY.js +0 -1
- package/dist/client/assets/classDiagram-DTDB5LWJ-BlbBfPMZ.js +0 -1
- package/dist/client/assets/classDiagram-v2-JRS7N3AN-BlbBfPMZ.js +0 -1
- package/dist/client/assets/index-7zMmn_PY.js +0 -2
- package/dist/client/assets/index-CcKPW3Oc.css +0 -1
- package/dist/client/assets/stateDiagram-v2-4QOOHH4V-ssPfmTD6.js +0 -1
- package/dist/client/assets/swimlanesDiagram-VK2B7HYN-Cqi1auey.js +0 -8
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{c as r,s as e}from"./flowDiagram-A5DVABFB-ClpDS0y_.js";import{_ as a}from"./mermaid.core-Dq2piIpp.js";import"./chunk-5VM5RSS4-COq9euGx.js";import"./chunk-XXDRQBXY-91VBn0TQ.js";import"./chunk-POPQ4Y6H-Bj3eKHA8.js";import"./chunk-F27PBJKO-BxcjnaqW.js";import"./channel-UA4WTF8Q.js";import"./index-DqIihcNP.js";var o=a(t=>`${e(t)}
|
|
2
|
+
.swimlane.cluster rect {
|
|
3
|
+
stroke: ${t.clusterBorder} !important;
|
|
4
|
+
}
|
|
5
|
+
[data-look="neo"].cluster rect {
|
|
6
|
+
filter: none;
|
|
7
|
+
}
|
|
8
|
+
`,"getStyles"),s=o,n=r({defaultLayout:"swimlane",styles:s});export{n as diagram};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as l,y as pt,V as Wt,W as Pt,X as Bt,c as gt,l as S,D as Vt,L as Ft,Y as ft,j as J,t as zt,$ as Gt,p as Ot}from"./mermaid.core-
|
|
1
|
+
import{_ as l,y as pt,V as Wt,W as Pt,X as Bt,c as gt,l as S,D as Vt,L as Ft,Y as ft,j as J,t as zt,$ as Gt,p as Ot}from"./mermaid.core-Dq2piIpp.js";import{d as ot}from"./arc-C6Oi4WlG.js";import"./index-DqIihcNP.js";var tt=(function(){var e=l(function(k,s,d,h){for(d=d||{},h=k.length;h--;d[k[h]]=s);return d},"o"),t=[6,11,13,14,15,17,19,20,23,24],n=[1,12],i=[1,13],r=[1,14],o=[1,15],c=[1,16],a=[1,19],p=[1,20],y={trace:l(function(){},"trace"),yy:{},symbols_:{error:2,start:3,timeline_header:4,document:5,EOF:6,timeline:7,timeline_lr:8,timeline_td:9,line:10,SPACE:11,statement:12,NEWLINE:13,title:14,acc_title:15,acc_title_value:16,acc_descr:17,acc_descr_value:18,acc_descr_multiline_value:19,section:20,period_statement:21,event_statement:22,period:23,event:24,$accept:0,$end:1},terminals_:{2:"error",6:"EOF",7:"timeline",8:"timeline_lr",9:"timeline_td",11:"SPACE",13:"NEWLINE",14:"title",15:"acc_title",16:"acc_title_value",17:"acc_descr",18:"acc_descr_value",19:"acc_descr_multiline_value",20:"section",23:"period",24:"event"},productions_:[0,[3,3],[4,1],[4,1],[4,1],[5,0],[5,2],[10,2],[10,1],[10,1],[10,1],[12,1],[12,2],[12,2],[12,1],[12,1],[12,1],[12,1],[21,1],[22,1]],performAction:l(function(s,d,h,g,m,u,w){var v=u.length-1;switch(m){case 1:return u[v-1];case 3:g.setDirection("LR");break;case 4:g.setDirection("TD");break;case 5:this.$=[];break;case 6:u[v-1].push(u[v]),this.$=u[v-1];break;case 7:case 8:this.$=u[v];break;case 9:case 10:this.$=[];break;case 11:g.getCommonDb().setDiagramTitle(u[v].substr(6)),this.$=u[v].substr(6);break;case 12:this.$=u[v].trim(),g.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=u[v].trim(),g.getCommonDb().setAccDescription(this.$);break;case 15:g.addSection(u[v].substr(8)),this.$=u[v].substr(8);break;case 18:g.addTask(u[v],0,""),this.$=u[v];break;case 19:g.addEvent(u[v].substr(2)),this.$=u[v];break}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(t,[2,5],{5:6}),e(t,[2,2]),e(t,[2,3]),e(t,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,10],{1:[2,1]}),e(t,[2,6]),{12:21,14:n,15:i,17:r,19:o,20:c,21:17,22:18,23:a,24:p},e(t,[2,8]),e(t,[2,9]),e(t,[2,11]),{16:[1,22]},{18:[1,23]},e(t,[2,14]),e(t,[2,15]),e(t,[2,16]),e(t,[2,17]),e(t,[2,18]),e(t,[2,19]),e(t,[2,7]),e(t,[2,12]),e(t,[2,13])],defaultActions:{},parseError:l(function(s,d){if(d.recoverable)this.trace(s);else{var h=new Error(s);throw h.hash=d,h}},"parseError"),parse:l(function(s){var d=this,h=[0],g=[],m=[null],u=[],w=this.table,v="",M=0,C=0,P=2,V=1,L=u.slice.call(arguments,1),_=Object.create(this.lexer),R={yy:{}};for(var F in this.yy)Object.prototype.hasOwnProperty.call(this.yy,F)&&(R.yy[F]=this.yy[F]);_.setInput(s,R.yy),R.yy.lexer=_,R.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var z=_.yylloc;u.push(z);var q=_.options&&_.options.ranges;typeof R.yy.parseError=="function"?this.parseError=R.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function X(A){h.length=h.length-2*A,m.length=m.length-A,u.length=u.length-A}l(X,"popStack");function O(){var A;return A=g.pop()||_.lex()||V,typeof A!="number"&&(A instanceof Array&&(g=A,A=g.pop()),A=d.symbols_[A]||A),A}l(O,"lex");for(var $,N,b,T,E={},H,I,B,D;;){if(N=h[h.length-1],this.defaultActions[N]?b=this.defaultActions[N]:(($===null||typeof $>"u")&&($=O()),b=w[N]&&w[N][$]),typeof b>"u"||!b.length||!b[0]){var K="";D=[];for(H in w[N])this.terminals_[H]&&H>P&&D.push("'"+this.terminals_[H]+"'");_.showPosition?K="Parse error on line "+(M+1)+`:
|
|
2
2
|
`+_.showPosition()+`
|
|
3
3
|
Expecting `+D.join(", ")+", got '"+(this.terminals_[$]||$)+"'":K="Parse error on line "+(M+1)+": Unexpected "+($==V?"end of input":"'"+(this.terminals_[$]||$)+"'"),this.parseError(K,{text:_.match,token:this.terminals_[$]||$,line:_.yylineno,loc:z,expected:D})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+N+", token: "+$);switch(b[0]){case 1:h.push($),m.push(_.yytext),u.push(_.yylloc),h.push(b[1]),$=null,C=_.yyleng,v=_.yytext,M=_.yylineno,z=_.yylloc;break;case 2:if(I=this.productions_[b[1]][1],E.$=m[m.length-I],E._$={first_line:u[u.length-(I||1)].first_line,last_line:u[u.length-1].last_line,first_column:u[u.length-(I||1)].first_column,last_column:u[u.length-1].last_column},q&&(E._$.range=[u[u.length-(I||1)].range[0],u[u.length-1].range[1]]),T=this.performAction.apply(E,[v,C,M,R.yy,b[1],m,u].concat(L)),typeof T<"u")return T;I&&(h=h.slice(0,-1*I*2),m=m.slice(0,-1*I),u=u.slice(0,-1*I)),h.push(this.productions_[b[1]][0]),m.push(E.$),u.push(E._$),B=w[h[h.length-2]][h[h.length-1]],h.push(B);break;case 3:return!0}}return!0},"parse")},x=(function(){var k={EOF:1,parseError:l(function(d,h){if(this.yy.parser)this.yy.parser.parseError(d,h);else throw new Error(d)},"parseError"),setInput:l(function(s,d){return this.yy=d||this.yy||{},this._input=s,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 s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var d=s.match(/(?:\r\n?|\n).*/g);return d?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:l(function(s){var d=s.length,h=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-d),this.offset-=d;var g=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),h.length-1&&(this.yylineno-=h.length-1);var m=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:h?(h.length===g.length?this.yylloc.first_column:0)+g[g.length-h.length].length-h[0].length:this.yylloc.first_column-d},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-d]),this.yyleng=this.yytext.length,this},"unput"),more:l(function(){return this._more=!0,this},"more"),reject:l(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).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:l(function(s){this.unput(this.match.slice(s))},"less"),pastInput:l(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:l(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:l(function(){var s=this.pastInput(),d=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
|
package/dist/client/assets/{vennDiagram-4TSXK5OY-CRMSJqLq.js → vennDiagram-4TSXK5OY-vYOlmqTL.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b2 as Gt,s as Kt,g as Ht,o as Xt,n as Yt,a as Zt,b as Jt,_ as S,y as St,D as Qt,j as rt,an as $t,V as te,W as ee,X as ne,d as se,p as ie,A as re,B as oe}from"./mermaid.core-CVM43n3z.js";import"./index-7zMmn_PY.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(Q(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)Q(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Q(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)Q(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);Q(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=jt(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function U(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const W=I.sets.map(J=>{let G=V[J],Y=k[J];return G||(G={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:G.x*(1-C)+Y.x*C,y:G.y*(1-C)+Y.y*C,radius:G.radius*(1-C)+Y.radius*C}});return wt(W,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),j=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),F=j.append("path"),L=j.append("text").attr("class","label").text(I=>U(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>U(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,U)):D.each("end",ot(k,U)):D.each(ot(k,U)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",q);const X=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),X.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:j,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Ft(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Ft(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=Ft(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
|
|
1
|
+
import{b2 as Gt,s as Kt,g as Ht,o as Xt,n as Yt,a as Zt,b as Jt,_ as S,y as St,D as Qt,j as rt,an as $t,V as te,W as ee,X as ne,d as se,p as ie,A as re,B as oe}from"./mermaid.core-Dq2piIpp.js";import"./index-DqIihcNP.js";const kt=(t,n)=>Gt(t,"a",-n),_t=1e-10;function st(t,n){const s=le(t),e=s.filter(l=>ae(l,t));let i=0,r=0;const o=[];if(e.length>1){const l=Et(e);for(let u=0;u<e.length;++u){const a=e[u];a.angle=Math.atan2(a.x-l.x,a.y-l.y)}e.sort((u,a)=>a.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){const a=e[u];r+=(h.x+a.x)*(a.y-h.y);const p={x:(a.x+h.x)/2,y:(a.y+h.y)/2};let d=null;for(let m=0;m<a.parentIndex.length;++m)if(h.parentIndex.includes(a.parentIndex[m])){const y=t[a.parentIndex[m]],M=Math.atan2(a.x-y.x,a.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y);let T=E-M;T<0&&(T+=2*Math.PI);const w=E-T/2;let g=K(p,{x:y.x+y.radius*Math.sin(w),y:y.y+y.radius*Math.cos(w)});g>y.radius*2&&(g=y.radius*2),(d==null||d.width>g)&&(d={circle:y,width:g,p1:a,p2:h,large:g>y.radius,sweep:!0})}d!=null&&(o.push(d),i+=lt(d.circle.radius,d.width),h=a)}}else{let l=t[0];for(let u=1;u<t.length;++u)t[u].radius<l.radius&&(l=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(K(t[u],l)>Math.abs(l.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=l.radius*l.radius*Math.PI,o.push({circle:l,p1:{x:l.x,y:l.y+l.radius},p2:{x:l.x-_t,y:l.y+l.radius},width:l.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=o,n.innerPoints=e,n.intersectionPoints=s),i+r}function ae(t,n){return n.every(s=>K(t,s)<s.radius+_t)}function le(t){const n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){const i=Tt(t[s],t[e]);for(const r of i)r.parentIndex=[s,e],n.push(r)}return n}function lt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}function K(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}function xt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);const e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return lt(t,e)+lt(n,i)}function Tt(t,n){const s=K(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];const r=(e*e-i*i+s*s)/(2*s),o=Math.sqrt(e*e-r*r),l=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(o/s),a=-(n.x-t.x)*(o/s);return[{x:l+u,y:h-a},{x:l-u,y:h+a}]}function Et(t){const n={x:0,y:0};for(const s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}function ce(t,n,s,e){e=e||{};const i=e.maxIterations||100,r=e.tolerance||1e-10,o=t(n),l=t(s);let h=s-n;if(o*l>0)throw"Initial bisect points must have opposite signs";if(o===0)return n;if(l===0)return s;for(let u=0;u<i;++u){h/=2;const a=n+h,p=t(a);if(p*o>=0&&(n=a),Math.abs(h)<r||p===0)return a}return n+h}function ct(t){const n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}function Mt(t,n){return ct(t).map(()=>ct(n))}function tt(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}function ut(t){return Math.sqrt(tt(t,t))}function ht(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}function Q(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}function zt(t,n,s){s=s||{};const e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,o=s.minErrorDelta||1e-6,l=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,a=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5;let d;const m=n.length,y=new Array(m+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let v=0;v<m;++v){const c=n.slice();c[v]=c[v]?c[v]*i:r,y[v+1]=c,y[v+1].fx=t(c),y[v+1].id=v+1}function M(v){for(let c=0;c<v.length;c++)y[m][c]=v[c];y[m].fx=v.fx}const E=(v,c)=>v.fx-c.fx,T=n.slice(),w=n.slice(),g=n.slice(),b=n.slice();for(let v=0;v<e;++v){if(y.sort(E),s.history){const x=y.map(f=>{const O=f.slice();return O.fx=f.fx,O.id=f.id,O});x.sort((f,O)=>f.id-O.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:x})}d=0;for(let x=0;x<m;++x)d=Math.max(d,Math.abs(y[0][x]-y[1][x]));if(Math.abs(y[0].fx-y[m].fx)<o&&d<l)break;for(let x=0;x<m;++x){T[x]=0;for(let f=0;f<m;++f)T[x]+=y[f][x];T[x]/=m}const c=y[m];if(Q(w,1+h,T,-h,c),w.fx=t(w),w.fx<y[0].fx)Q(b,1+u,T,-u,c),b.fx=t(b),b.fx<w.fx?M(b):M(w);else if(w.fx>=y[m-1].fx){let x=!1;if(w.fx>c.fx?(Q(g,1+a,T,-a,c),g.fx=t(g),g.fx<c.fx?M(g):x=!0):(Q(g,1-a*h,T,a*h,c),g.fx=t(g),g.fx<w.fx?M(g):x=!0),x){if(p>=1)break;for(let f=1;f<y.length;++f)Q(y[f],1-p,y[0],p,y[f]),y[f].fx=t(y[f])}}else M(w)}return y.sort(E),{fx:y[0].fx,x:y[0]}}function ue(t,n,s,e,i,r,o){const l=s.fx,h=tt(s.fxprime,n);let u=l,a=l,p=h,d=0;i=i||1,r=r||1e-6,o=o||.1;function m(y,M,E){for(let T=0;T<16;++T)if(i=(y+M)/2,Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||u>=E)M=i;else{if(Math.abs(p)<=-o*h)return i;p*(M-y)>=0&&(M=y),y=i,E=u}return 0}for(let y=0;y<10;++y){if(Q(e.x,1,s.x,i,n),u=e.fx=t(e.x,e.fxprime),p=tt(e.fxprime,n),u>l+r*i*h||y&&u>=a)return m(d,i,a);if(Math.abs(p)<=-o*h)return i;if(p>=0)return m(i,d,u);a=u,d=i,i*=2}return i}function he(t,n,s){let e={x:n.slice(),fx:0,fxprime:n.slice()},i={x:n.slice(),fx:0,fxprime:n.slice()};const r=n.slice();let o,l,h=1,u;s=s||{},u=s.maxIterations||n.length*20,e.fx=t(e.x,e.fxprime),o=e.fxprime.slice(),ht(o,e.fxprime,-1);for(let a=0;a<u;++a){if(h=ue(t,o,e,i,h),s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),!h)ht(o,e.fxprime,-1);else{Q(r,1,i.fxprime,-1,e.fxprime);const p=tt(e.fxprime,e.fxprime),d=Math.max(0,tt(r,i.fxprime)/p);Q(o,d,o,-1,i.fxprime),l=e,e=i,i=l}if(ut(e.fxprime)<=1e-5)break}return s.history&&s.history.push({x:e.x.slice(),fx:e.fx,fxprime:e.fxprime.slice(),alpha:h}),e}function At(t,n={}){n.maxIterations=n.maxIterations||500;const s=n.initialLayout||xe,e=n.lossFunction||et,i=fe(t,n),r=s(i,n),o=Object.keys(r),l=[];for(const a of o)l.push(r[a].x),l.push(r[a].y);const u=zt(a=>{const p={};for(let d=0;d<o.length;++d){const m=o[d];p[m]={x:a[2*d],y:a[2*d+1],radius:r[m].radius}}return e(p,i)},l,n).x;for(let a=0;a<o.length;++a){const p=o[a];r[p].x=u[2*a],r[p].y=u[2*a+1]}return r}const Rt=1e-10;function ft(t,n,s){return Math.min(t,n)*Math.min(t,n)*Math.PI<=s+Rt?Math.abs(t-n):ce(e=>xt(t,n,e)-s,0,t+n)}function fe(t,n={}){const s=n.distinct,e=t.map(l=>Object.assign({},l));function i(l){return l.join(";")}if(s){const l=new Map;for(const h of e)for(let u=0;u<h.sets.length;u++){const a=String(h.sets[u]);l.set(a,h.size+(l.get(a)||0));for(let p=u+1;p<h.sets.length;p++){const d=String(h.sets[p]),m=`${a};${d}`,y=`${d};${a}`;l.set(m,h.size+(l.get(m)||0)),l.set(y,h.size+(l.get(y)||0))}}for(const h of e)h.sets.length<3&&(h.size=l.get(i(h.sets)))}const r=[],o=new Set;for(const l of e)if(l.sets.length===1)r.push(l.sets[0]);else if(l.sets.length===2){const h=l.sets[0],u=l.sets[1];o.add(i(l.sets)),o.add(i([u,h]))}r.sort((l,h)=>l===h?0:l<h?-1:1);for(let l=0;l<r.length;++l){const h=r[l];for(let u=l+1;u<r.length;++u){const a=r[u];o.has(i([h,a]))||e.push({sets:[h,a],size:0})}}return e}function de(t,n,s){const e=Mt(n.length,n.length),i=Mt(n.length,n.length);return t.filter(r=>r.sets.length===2).forEach(r=>{const o=s[r.sets[0]],l=s[r.sets[1]],h=Math.sqrt(n[o].size/Math.PI),u=Math.sqrt(n[l].size/Math.PI),a=ft(h,u,r.size);e[o][l]=e[l][o]=a;let p=0;r.size+1e-10>=Math.min(n[o].size,n[l].size)?p=1:r.size<=1e-10&&(p=-1),i[o][l]=i[l][o]=p}),{distances:e,constraints:i}}function ge(t,n,s,e){for(let r=0;r<n.length;++r)n[r]=0;let i=0;for(let r=0;r<s.length;++r){const o=t[2*r],l=t[2*r+1];for(let h=r+1;h<s.length;++h){const u=t[2*h],a=t[2*h+1],p=s[r][h],d=e[r][h],m=(u-o)*(u-o)+(a-l)*(a-l),y=Math.sqrt(m),M=m-p*p;d>0&&y<=p||d<0&&y>=p||(i+=2*M*M,n[2*r]+=4*M*(o-u),n[2*r+1]+=4*M*(l-a),n[2*h]+=4*M*(u-o),n[2*h+1]+=4*M*(a-l))}}return i}function xe(t,n={}){let s=pe(t,n);const e=n.lossFunction||et;if(t.length>=8){const i=ye(t,n),r=e(i,t),o=e(s,t);r+1e-8<o&&(s=i)}return s}function ye(t,n={}){const s=n.restarts||10,e=[],i={};for(const d of t)d.sets.length===1&&(i[d.sets[0]]=e.length,e.push(d));let{distances:r,constraints:o}=de(t,e,i);const l=ut(r.map(ut))/r.length;r=r.map(d=>d.map(m=>m/l));const h=(d,m)=>ge(d,m,r,o);let u=null;for(let d=0;d<s;++d){const m=ct(r.length*2).map(Math.random),y=he(h,m,n);(!u||y.fx<u.fx)&&(u=y)}const a=u.x,p={};for(let d=0;d<e.length;++d){const m=e[d];p[m.sets[0]]={x:a[2*d]*l,y:a[2*d+1]*l,radius:Math.sqrt(m.size/Math.PI)}}if(n.history)for(const d of n.history)ht(d.x,l);return p}function pe(t,n){const s=n&&n.lossFunction?n.lossFunction:et,e={},i={};for(const p of t)if(p.sets.length===1){const d=p.sets[0];e[d]={x:1e10,y:1e10,rowid:e.length,size:p.size,radius:Math.sqrt(p.size/Math.PI)},i[d]=[]}t=t.filter(p=>p.sets.length===2);for(const p of t){let d=p.weight!=null?p.weight:1;const m=p.sets[0],y=p.sets[1];p.size+Rt>=Math.min(e[m].size,e[y].size)&&(d=0),i[m].push({set:y,size:p.size,weight:d}),i[y].push({set:m,size:p.size,weight:d})}const r=[];Object.keys(i).forEach(p=>{let d=0;for(let m=0;m<i[p].length;++m)d+=i[p][m].size*i[p][m].weight;r.push({set:p,size:d})});function o(p,d){return d.size-p.size}r.sort(o);const l={};function h(p){return p.set in l}function u(p,d){e[d].x=p.x,e[d].y=p.y,l[d]=!0}u({x:0,y:0},r[0].set);for(let p=1;p<r.length;++p){const d=r[p].set,m=i[d].filter(h),y=e[d];if(m.sort(o),m.length===0)throw"ERROR: missing pairwise overlap information";const M=[];for(var a=0;a<m.length;++a){const w=e[m[a].set],g=ft(y.radius,w.radius,m[a].size);M.push({x:w.x+g,y:w.y}),M.push({x:w.x-g,y:w.y}),M.push({y:w.y+g,x:w.x}),M.push({y:w.y-g,x:w.x});for(let b=a+1;b<m.length;++b){const v=e[m[b].set],c=ft(y.radius,v.radius,m[b].size),x=Tt({x:w.x,y:w.y,radius:g},{x:v.x,y:v.y,radius:c});M.push(...x)}}let E=1e50,T=M[0];for(const w of M){e[d].x=w.x,e[d].y=w.y;const g=s(e,t);g<E&&(E=g,T=w)}u(T,d)}return e}function et(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const o=t[e.sets[0]],l=t[e.sets[1]];i=xt(o.radius,l.radius,K(o,l))}else i=st(e.sets.map(o=>t[o]));const r=e.weight!=null?e.weight:1;s+=r*(i-e.size)*(i-e.size)}return s}function Dt(t,n){let s=0;for(const e of n){if(e.sets.length===1)continue;let i;if(e.sets.length===2){const l=t[e.sets[0]],h=t[e.sets[1]];i=xt(l.radius,h.radius,K(l,h))}else i=st(e.sets.map(l=>t[l]));const r=e.weight!=null?e.weight:1,o=Math.log((i+1)/(e.size+1));s+=r*o*o}return s}function me(t,n,s){if(s==null?t.sort((i,r)=>r.radius-i.radius):t.sort(s),t.length>0){const i=t[0].x,r=t[0].y;for(const o of t)o.x-=i,o.y-=r}if(t.length===2&&K(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const i=Math.atan2(t[1].x,t[1].y)-n,r=Math.cos(i),o=Math.sin(i);for(const l of t){const h=l.x,u=l.y;l.x=r*h-o*u,l.y=o*h+r*u}}if(t.length>2){let i=Math.atan2(t[2].x,t[2].y)-n;for(;i<0;)i+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI;if(i>Math.PI){const r=t[1].y/(1e-10+t[1].x);for(const o of t){var e=(o.x+r*o.y)/(1+r*r);o.x=2*e-o.x,o.y=2*e*r-o.y}}}}function be(t){t.forEach(i=>{i.parent=i});function n(i){return i.parent!==i&&(i.parent=n(i.parent)),i.parent}function s(i,r){const o=n(i),l=n(r);o.parent=l}for(let i=0;i<t.length;++i)for(let r=i+1;r<t.length;++r){const o=t[i].radius+t[r].radius;K(t[i],t[r])+1e-10<o&&s(t[r],t[i])}const e=new Map;for(let i=0;i<t.length;++i){const r=n(t[i]).parent.setid;e.has(r)||e.set(r,[]),e.get(r).push(t[i])}return t.forEach(i=>{delete i.parent}),Array.from(e.values())}function dt(t){const n=s=>{const e=t.reduce((r,o)=>Math.max(r,o[s]+o.radius),Number.NEGATIVE_INFINITY),i=t.reduce((r,o)=>Math.min(r,o[s]-o.radius),Number.POSITIVE_INFINITY);return{max:e,min:i}};return{xRange:n("x"),yRange:n("y")}}function Ct(t,n,s){n==null&&(n=Math.PI/2);let e=jt(t).map(u=>Object.assign({},u));const i=be(e);for(const u of i){me(u,n,s);const a=dt(u);u.size=(a.xRange.max-a.xRange.min)*(a.yRange.max-a.yRange.min),u.bounds=a}i.sort((u,a)=>a.size-u.size),e=i[0];let r=e.bounds;const o=(r.xRange.max-r.xRange.min)/50;function l(u,a,p){if(!u)return;const d=u.bounds;let m,y;if(a)m=r.xRange.max-d.xRange.min+o;else{m=r.xRange.max-d.xRange.max;const M=(d.xRange.max-d.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;M<0&&(m+=M)}if(p)y=r.yRange.max-d.yRange.min+o;else{y=r.yRange.max-d.yRange.max;const M=(d.yRange.max-d.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;M<0&&(y+=M)}for(const M of u)M.x+=m,M.y+=y,e.push(M)}let h=1;for(;h<i.length;)l(i[h],!0,!1),l(i[h+1],!1,!0),l(i[h+2],!0,!0),h+=3,r=dt(e);return Ot(e)}function Nt(t,n,s,e,i){const r=jt(t);n-=2*e,s-=2*e;const{xRange:o,yRange:l}=dt(r);if(o.max===o.min||l.max===l.min)return console.log("not scaling solution: zero size detected"),t;let h,u;if(i){const m=Math.sqrt(i/Math.PI)*2;h=n/m,u=s/m}else h=n/(o.max-o.min),u=s/(l.max-l.min);const a=Math.min(u,h),p=(n-(o.max-o.min)*a)/2,d=(s-(l.max-l.min)*a)/2;return Ot(r.map(m=>({radius:a*m.radius,x:e+p+(m.x-o.min)*a,y:e+d+(m.y-l.min)*a,setid:m.setid})))}function Ot(t){const n={};for(const s of t)n[s.setid]=s;return n}function jt(t){return Object.keys(t).map(s=>Object.assign(t[s],{setid:s}))}function ve(t={}){let n=!1,s=600,e=350,i=15,r=1e3,o=Math.PI/2,l=!0,h=null,u=!0,a=!0,p=null,d=null,m=!1,y=null,M=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,E={},T=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],w=0,g=function(x){if(x in E)return E[x];var f=E[x]=T[w];return w+=1,w>=T.length&&(w=0),f},b=At,v=et;function c(x){let f=x.datum();const O=new Set;f.forEach(I=>{I.size==0&&I.sets.length==1&&O.add(I.sets[0])}),f=f.filter(I=>!I.sets.some(C=>O.has(C)));let k={},R={};if(f.length>0){let I=b(f,{lossFunction:v,distinct:m});l&&(I=Ct(I,o,d)),k=Nt(I,s,e,i,h),R=Lt(k,f,M)}const Z={};f.forEach(I=>{I.label&&(Z[I.sets]=I.label)});function U(I){if(I.sets in Z)return Z[I.sets];if(I.sets.length==1)return""+I.sets[0]}x.selectAll("svg").data([k]).enter().append("svg");const B=x.select("svg");n?B.attr("viewBox",`0 0 ${s} ${e}`):B.attr("width",s).attr("height",e);const V={};let z=!1;B.selectAll(".venn-area path").each(function(I){const C=this.getAttribute("d");I.sets.length==1&&C&&!m&&(z=!0,V[I.sets[0]]=Me(C))});function q(I){return C=>{const W=I.sets.map(J=>{let G=V[J],Y=k[J];return G||(G={x:s/2,y:e/2,radius:1}),Y||(Y={x:s/2,y:e/2,radius:1}),{x:G.x*(1-C)+Y.x*C,y:G.y*(1-C)+Y.y*C,radius:G.radius*(1-C)+Y.radius*C}});return wt(W,y)}}const A=B.selectAll(".venn-area").data(f,I=>I.sets),j=A.enter().append("g").attr("class",I=>`venn-area venn-${I.sets.length==1?"circle":"intersection"}${I.colour||I.color?" venn-coloured":""}`).attr("data-venn-sets",I=>I.sets.join("_")),F=j.append("path"),L=j.append("text").attr("class","label").text(I=>U(I)).attr("text-anchor","middle").attr("dy",".35em").attr("x",s/2).attr("y",e/2);a&&(F.style("fill-opacity","0").filter(I=>I.sets.length==1).style("fill",I=>I.colour?I.colour:I.color?I.color:g(I.sets)).style("fill-opacity",".25"),L.style("fill",I=>I.colour||I.color?"#FFF":t.textFill?t.textFill:I.sets.length==1?g(I.sets):"#444"));function P(I){return typeof I.transition=="function"?I.transition("venn").duration(r):I}let _=x;z&&typeof _.transition=="function"?(_=P(x),_.selectAll("path").attrTween("d",q)):_.selectAll("path").attr("d",I=>wt(I.sets.map(C=>k[C])),y);const D=_.selectAll("text").filter(I=>I.sets in R).text(I=>U(I)).attr("x",I=>Math.floor(R[I.sets].x)).attr("y",I=>Math.floor(R[I.sets].y));u&&(z?"on"in D?D.on("end",ot(k,U)):D.each("end",ot(k,U)):D.each(ot(k,U)));const N=P(A.exit()).remove();typeof A.transition=="function"&&N.selectAll("path").attrTween("d",q);const X=N.selectAll("text").attr("x",s/2).attr("y",e/2);return p!==null&&(L.style("font-size","0px"),D.style("font-size",p),X.style("font-size","0px")),{circles:k,textCentres:R,nodes:A,enter:j,update:_,exit:N}}return c.wrap=function(x){return arguments.length?(u=x,c):u},c.useViewBox=function(){return n=!0,c},c.width=function(x){return arguments.length?(s=x,c):s},c.height=function(x){return arguments.length?(e=x,c):e},c.padding=function(x){return arguments.length?(i=x,c):i},c.distinct=function(x){return arguments.length?(m=x,c):m},c.colours=function(x){return arguments.length?(g=x,c):g},c.colors=function(x){return arguments.length?(g=x,c):g},c.fontSize=function(x){return arguments.length?(p=x,c):p},c.round=function(x){return arguments.length?(y=x,c):y},c.duration=function(x){return arguments.length?(r=x,c):r},c.layoutFunction=function(x){return arguments.length?(b=x,c):b},c.normalize=function(x){return arguments.length?(l=x,c):l},c.scaleToFit=function(x){return arguments.length?(h=x,c):h},c.styled=function(x){return arguments.length?(a=x,c):a},c.orientation=function(x){return arguments.length?(o=x,c):o},c.orientationOrder=function(x){return arguments.length?(d=x,c):d},c.lossFunction=function(x){return arguments.length?(v=x==="default"?et:x==="logRatio"?Dt:x,c):v},c}function ot(t,n){return function(s){const e=this,i=t[s.sets[0]].radius||50,r=n(s)||"",o=r.split(/\s+/).reverse(),h=(r.length+o.length)/3;let u=o.pop(),a=[u],p=0;const d=1.1;e.textContent=null;const m=[];function y(g){const b=e.ownerDocument.createElementNS(e.namespaceURI,"tspan");return b.textContent=g,m.push(b),e.append(b),b}let M=y(u);for(;u=o.pop(),!!u;){a.push(u);const g=a.join(" ");M.textContent=g,g.length>h&&M.getComputedTextLength()>i&&(a.pop(),M.textContent=a.join(" "),a=[u],M=y(u),p++)}const E=.35-p*d/2,T=e.getAttribute("x"),w=e.getAttribute("y");m.forEach((g,b)=>{g.setAttribute("x",T),g.setAttribute("y",w),g.setAttribute("dy",`${E+b*d}em`)})}}function at(t,n,s){let e=n[0].radius-K(n[0],t);for(let i=1;i<n.length;++i){const r=n[i].radius-K(n[i],t);r<=e&&(e=r)}for(let i=0;i<s.length;++i){const r=K(s[i],t)-s[i].radius;r<=e&&(e=r)}return e}function Ft(t,n,s){const e=[];for(const a of t)e.push({x:a.x,y:a.y}),e.push({x:a.x+a.radius/2,y:a.y}),e.push({x:a.x-a.radius/2,y:a.y}),e.push({x:a.x,y:a.y+a.radius/2}),e.push({x:a.x,y:a.y-a.radius/2});let i=e[0],r=at(e[0],t,n);for(let a=1;a<e.length;++a){const p=at(e[a],t,n);p>=r&&(i=e[a],r=p)}const o=zt(a=>-1*at({x:a[0],y:a[1]},t,n),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,l={x:s?0:o[0],y:o[1]};let h=!0;for(const a of t)if(K(l,a)>a.radius){h=!1;break}for(const a of n)if(K(l,a)<a.radius){h=!1;break}if(h)return l;if(t.length==1)return{x:t[0].x,y:t[0].y};const u={};return st(t,u),u.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:u.arcs.length==1?{x:u.arcs[0].circle.x,y:u.arcs[0].circle.y}:n.length?Ft(t,[]):Et(u.arcs.map(a=>a.p1))}function Ie(t){const n={},s=Object.keys(t);for(const e of s)n[e]=[];for(let e=0;e<s.length;e++){const i=s[e],r=t[i];for(let o=e+1;o<s.length;++o){const l=s[o],h=t[l],u=K(r,h);u+h.radius<=r.radius+1e-10?n[l].push(i):u+r.radius<=h.radius+1e-10&&n[i].push(l)}}return n}function Lt(t,n,s){const e={},i=Ie(t);for(let r=0;r<n.length;++r){const o=n[r].sets,l={},h={};for(let d=0;d<o.length;++d){l[o[d]]=!0;const m=i[o[d]];for(let y=0;y<m.length;++y)h[m[y]]=!0}const u=[],a=[];for(let d in t)d in l?u.push(t[d]):d in h||a.push(t[d]);const p=Ft(u,a,s);e[o]=p,p.disjoint&&n[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return e}function ke(t,n,s){const e=[];return e.push(`
|
|
2
2
|
M`,t,n),e.push(`
|
|
3
3
|
m`,-s,0),e.push(`
|
|
4
4
|
a`,s,s,0,1,0,s*2,0),e.push(`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as zt}from"./chunk-JWPE2WC7-
|
|
1
|
+
import{p as zt}from"./chunk-JWPE2WC7-DD0M0JL-.js";import{s as Lt,g as Tt,o as At,n as Xt,a as Et,b as Yt,_ as y,E as It,y as Bt,A as Q,l as et,D as Ft,d as Rt,p as Ot,c as V}from"./mermaid.core-Dq2piIpp.js";import{p as Wt}from"./cynefin-OW5HDTMX-DFpC3uqz.js";import"./index-DqIihcNP.js";var G=y((a,o)=>{const e=a<=1?a*100:a;if(e<0||e>100)throw new Error(`${o} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return e},"toPercent"),E=y((a,o,e)=>({x:G(o,`${e} evolution`),y:G(a,`${e} visibility`)}),"toCoordinates"),tt=y(a=>{if(a){if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward"}},"getFlowFromPort"),Dt=y(a=>{if(!(a!=null&&a.startsWith("+")))return{};const o=/^\+'([^']*)'/.exec(a),e=o==null?void 0:o[1];return a.includes("<>")?{flow:"bidirectional",label:e}:a.includes("<")?{flow:"backward",label:e}:a.includes(">")?{flow:"forward",label:e}:{label:e}},"extractFlowFromArrow"),Gt=y((a,o)=>{if(zt(a,o),a.size&&o.setSize(a.size.width,a.size.height),a.evolution){const e=a.evolution.stages.map(r=>r.secondName?`${r.name.trim()} / ${r.secondName.trim()}`:r.name.trim()),p=a.evolution.stages.filter(r=>r.boundary!==void 0).map(r=>r.boundary);o.updateAxes({stages:e,stageBoundaries:p})}if(a.anchors.forEach(e=>{const p=E(e.visibility,e.evolution,`Anchor "${e.name}"`);o.addNode(e.name,e.name,p.x,p.y,"anchor")}),a.components.forEach(e=>{var v;const p=E(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,d=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,m=(v=e.decorator)==null?void 0:v.strategy;o.addNode(e.name,e.name,p.x,p.y,"component",r,d,e.inertia,m)}),a.notes.forEach(e=>{const p=E(e.visibility,e.evolution,`Note "${e.text}"`);o.addNote(e.text,p.x,p.y)}),a.pipelines.forEach(e=>{const p=o.getNode(e.parent);if(!p||typeof p.y!="number")throw new Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);const r=p.y;o.startPipeline(e.parent),e.components.forEach(d=>{const m=`${e.parent}_${d.name}`,v=d.label?(d.label.negX?-1:1)*d.label.offsetX:void 0,g=d.label?(d.label.negY?-1:1)*d.label.offsetY:void 0,L=G(d.evolution,`Pipeline component "${d.name}" evolution`);o.addNode(m,d.name,L,r,"pipeline-component",v,g),o.addPipelineComponent(e.parent,m)})}),a.links.forEach(e=>{const p=!!e.arrow&&(e.arrow.includes("-.->")||e.arrow.includes(".-."));let r=tt(e.fromPort)??tt(e.toPort);const{flow:d,label:m}=Dt(e.arrow);!r&&d&&(r=d);const v=e.linkLabel,g=m??v;o.addLink(o.resolveNodeId(e.from),o.resolveNodeId(e.to),p,g,r)}),a.evolves.forEach(e=>{const p=o.getNode(e.component);if((p==null?void 0:p.y)!==void 0){const r=G(e.target,`Evolve target for "${e.component}"`);o.addTrend(e.component,r,p.y)}}),a.annotations.length>0){const e=a.annotations[0],p=E(e.x,e.y,"Annotations box");o.setAnnotationsBox(p.x,p.y)}a.annotation.forEach(e=>{const p=E(e.x,e.y,`Annotation ${e.number}`);o.addAnnotation(e.number,[{x:p.x,y:p.y}],e.text)}),a.accelerators.forEach(e=>{const p=E(e.x,e.y,`Accelerator "${e.name}"`);o.addAccelerator(e.name,p.x,p.y)}),a.deaccelerators.forEach(e=>{const p=E(e.x,e.y,`Deaccelerator "${e.name}"`);o.addDeaccelerator(e.name,p.x,p.y)})},"populateDb"),at={parser:{yy:void 0},parse:y(async a=>{var p;const o=await Wt("wardley",a);et.debug(o);const e=(p=at.parser)==null?void 0:p.yy;if(!e||typeof e.addNode!="function")throw new Error("parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.");Gt(o,e)},"parse")},I,qt=(I=class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}addNode(o){const e=this.nodes.get(o.id)??{id:o.id,label:o.label},p={...e,...o,className:o.className??e.className,labelOffsetX:o.labelOffsetX??e.labelOffsetX,labelOffsetY:o.labelOffsetY??e.labelOffsetY};this.nodes.set(o.id,p)}addLink(o){this.links.push(o)}addTrend(o){this.trends.set(o.nodeId,o)}startPipeline(o){this.pipelines.set(o,{nodeId:o,componentIds:[]});const e=this.nodes.get(o);e&&(e.isPipelineParent=!0)}addPipelineComponent(o,e){const p=this.pipelines.get(o);p&&p.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(o){this.annotations.push(o)}addNote(o){this.notes.push(o)}addAccelerator(o){this.accelerators.push(o)}addDeaccelerator(o){this.deaccelerators.push(o)}setAnnotationsBox(o,e){this.annotationsBox={x:o,y:e}}setAxes(o){this.axes={...this.axes,...o}}setSize(o,e){this.size={width:o,height:e}}getNode(o){return this.nodes.get(o)}resolveNodeId(o){if(this.nodes.has(o))return o;for(const[e,p]of this.nodes)if(p.label===o)return e;return o}build(){const o=[];for(const e of this.nodes.values()){if(typeof e.x!="number"||typeof e.y!="number")throw new Error(`Node "${e.label}" is missing coordinates`);o.push(e)}return{nodes:o,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}},y(I,"WardleyBuilder"),I),b=new qt;function rt(){return V()["wardley-beta"]}y(rt,"getConfig");function ot(a,o,e,p,r,d,m,v,g){b.addNode({id:a,label:o,x:e,y:p,className:r,labelOffsetX:d,labelOffsetY:m,inertia:v,sourceStrategy:g})}y(ot,"addNode");function st(a,o,e=!1,p,r){b.addLink({source:a,target:o,dashed:e,label:p,flow:r})}y(st,"addLink");function nt(a,o,e){b.addTrend({nodeId:a,targetX:o,targetY:e})}y(nt,"addTrend");function it(a,o,e){b.addAnnotation({number:a,coordinates:o,text:e})}y(it,"addAnnotation");function dt(a,o,e){b.addNote({text:a,x:o,y:e})}y(dt,"addNote");function lt(a,o,e){b.addAccelerator({name:a,x:o,y:e})}y(lt,"addAccelerator");function ct(a,o,e){b.addDeaccelerator({name:a,x:o,y:e})}y(ct,"addDeaccelerator");function pt(a,o){b.setAnnotationsBox(a,o)}y(pt,"setAnnotationsBox");function ht(a,o){b.setSize(a,o)}y(ht,"setSize");function xt(a){b.startPipeline(a)}y(xt,"startPipeline");function ft(a,o){b.addPipelineComponent(a,o)}y(ft,"addPipelineComponent");function gt(a){b.setAxes(a)}y(gt,"updateAxes");function ut(a){return b.getNode(a)}y(ut,"getNode");function yt(a){return b.resolveNodeId(a)}y(yt,"resolveNodeId");function mt(){return b.build()}y(mt,"getWardleyData");function wt(){b.clear(),Ot()}y(wt,"clear");var Ht={getConfig:rt,addNode:ot,addLink:st,addTrend:nt,addAnnotation:it,addNote:dt,addAccelerator:lt,addDeaccelerator:ct,setAnnotationsBox:pt,setSize:ht,startPipeline:xt,addPipelineComponent:ft,updateAxes:gt,getNode:ut,resolveNodeId:yt,getWardleyData:mt,clear:wt,setAccTitle:Yt,getAccTitle:Et,setDiagramTitle:Xt,getDiagramTitle:At,getAccDescription:Tt,setAccDescription:Lt},jt=["Genesis","Custom Built","Product","Commodity"],Vt=y(()=>{var o,e,p,r,d,m,v,g,L,M,k,N;const{themeVariables:a}=V();return{backgroundColor:((o=a.wardley)==null?void 0:o.backgroundColor)??a.background??"#fff",axisColor:((e=a.wardley)==null?void 0:e.axisColor)??"#000",axisTextColor:((p=a.wardley)==null?void 0:p.axisTextColor)??a.primaryTextColor??"#222",gridColor:((r=a.wardley)==null?void 0:r.gridColor)??"rgba(100, 100, 100, 0.2)",componentFill:((d=a.wardley)==null?void 0:d.componentFill)??"#fff",componentStroke:((m=a.wardley)==null?void 0:m.componentStroke)??"#000",componentLabelColor:((v=a.wardley)==null?void 0:v.componentLabelColor)??a.primaryTextColor??"#222",linkStroke:((g=a.wardley)==null?void 0:g.linkStroke)??"#000",evolutionStroke:((L=a.wardley)==null?void 0:L.evolutionStroke)??"#dc3545",annotationStroke:((M=a.wardley)==null?void 0:M.annotationStroke)??"#000",annotationTextColor:((k=a.wardley)==null?void 0:k.annotationTextColor)??a.primaryTextColor??"#222",annotationFill:((N=a.wardley)==null?void 0:N.annotationFill)??a.background??"#fff"}},"getTheme"),_t=y(()=>{const a=V()["wardley-beta"];return{width:(a==null?void 0:a.width)??900,height:(a==null?void 0:a.height)??600,padding:(a==null?void 0:a.padding)??48,nodeRadius:(a==null?void 0:a.nodeRadius)??6,nodeLabelOffset:(a==null?void 0:a.nodeLabelOffset)??8,axisFontSize:(a==null?void 0:a.axisFontSize)??12,labelFontSize:(a==null?void 0:a.labelFontSize)??10,showGrid:(a==null?void 0:a.showGrid)??!1,useMaxWidth:(a==null?void 0:a.useMaxWidth)??!0}},"getConfigValues"),Zt=y((a,o,e,p)=>{var J,K;et.debug(`Rendering Wardley map
|
|
2
2
|
`+a);const r=_t(),d=Vt(),m=r.nodeRadius*1.6,v=p.db,g=v.getWardleyData(),L=v.getDiagramTitle(),M=((J=g.size)==null?void 0:J.width)??r.width,k=((K=g.size)==null?void 0:K.height)??r.height,N=Ft(o);N.selectAll("*").remove(),Rt(N,k,M,r.useMaxWidth),N.attr("viewBox",`0 0 ${M} ${k}`);const P=N.append("g").attr("class","wardley-map"),q=N.append("defs");q.append("marker").attr("id",`arrow-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",6).attr("markerHeight",6).attr("orient","auto-start-reverse").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.evolutionStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-end-${o}`).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("fill",d.linkStroke).attr("stroke","none"),q.append("marker").attr("id",`link-arrow-start-${o}`).attr("viewBox","0 0 10 10").attr("refX",1).attr("refY",5).attr("markerWidth",5).attr("markerHeight",5).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z").attr("fill",d.linkStroke).attr("stroke","none"),P.append("rect").attr("class","wardley-background").attr("width",M).attr("height",k).attr("fill",d.backgroundColor);const B=M-r.padding*2,F=k-r.padding*2;L&&P.append("text").attr("class","wardley-title").attr("x",M/2).attr("y",r.padding/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(L);const T=y(t=>r.padding+t/100*B,"projectX"),A=y(t=>k-r.padding-t/100*F,"projectY"),O=P.append("g").attr("class","wardley-axes");O.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1),O.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.axisColor).attr("stroke-width",1);const kt=g.axes.xLabel??"Evolution",bt=g.axes.yLabel??"Visibility";O.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+B/2).attr("y",k-r.padding/4).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(kt),O.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+F/2).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+F/2})`).text(bt);const R=g.axes.stages&&g.axes.stages.length>0?g.axes.stages:jt;if(R.length>0){const t=P.append("g").attr("class","wardley-stages"),n=g.axes.stageBoundaries,s=[];if(n&&n.length===R.length){let i=0;n.forEach(h=>{s.push({start:i,end:h}),i=h})}else{const i=1/R.length;R.forEach((h,l)=>{s.push({start:l*i,end:(l+1)*i})})}R.forEach((i,h)=>{const l=s[h],x=r.padding+l.start*B,f=r.padding+l.end*B,u=(x+f)/2;h>0&&t.append("line").attr("x1",x).attr("x2",x).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",.8),t.append("text").attr("class","wardley-stage-label").attr("x",u).attr("y",k-r.padding/1.5).attr("fill",d.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(i)})}if(r.showGrid){const t=P.append("g").attr("class","wardley-grid");for(let n=1;n<4;n++){const s=n/4,i=r.padding+B*s;t.append("line").attr("x1",i).attr("x2",i).attr("y1",r.padding).attr("y2",k-r.padding).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",M-r.padding).attr("y1",k-r.padding-F*s).attr("y2",k-r.padding-F*s).attr("stroke",d.gridColor).attr("stroke-dasharray","2 6")}}const c=new Map;if(g.nodes.forEach(t=>{c.set(t.id,{x:T(t.x),y:A(t.y),node:t})}),g.pipelines.length>0){const t=P.append("g").attr("class","wardley-pipelines"),n=P.append("g").attr("class","wardley-pipeline-links");g.pipelines.forEach(s=>{if(s.componentIds.length===0)return;const i=s.componentIds.map(f=>({id:f,pos:c.get(f),node:g.nodes.find(u=>u.id===f)})).filter(f=>f.pos&&f.node).sort((f,u)=>f.node.x-u.node.x);for(let f=0;f<i.length-1;f++){const u=i[f],w=i[f+1];n.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",u.pos.x).attr("y1",u.pos.y).attr("x2",w.pos.x).attr("y2",w.pos.y).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,l=-1/0,x=0;if(s.componentIds.forEach(f=>{const u=c.get(f);u&&(h=Math.min(h,u.x),l=Math.max(l,u.x),x=u.y)}),h!==1/0&&l!==-1/0){const u=r.nodeRadius*4,w=x-u/2,S=c.get(s.nodeId);if(S){const z=(h+l)/2;S.x=z,S.y=w-m/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",w).attr("width",l-h+30).attr("height",u).attr("fill","none").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const _=P.append("g").attr("class","wardley-links"),Z=new Map;g.pipelines.forEach(t=>{Z.set(t.nodeId,new Set(t.componentIds))});const U=g.links.filter(t=>{if(!c.has(t.source)||!c.has(t.target))return!1;const n=Z.get(t.target);return!(n!=null&&n.has(t.source))});_.selectAll("line").data(U).enter().append("line").attr("class",t=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.x+l/f*h}).attr("y1",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.source).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x);return n.y+x/f*h}).attr("x2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.x+l/f*h}).attr("y2",t=>{const n=c.get(t.source),s=c.get(t.target),h=g.nodes.find(u=>u.id===t.target).isPipelineParent?m/Math.sqrt(2):r.nodeRadius,l=n.x-s.x,x=n.y-s.y,f=Math.sqrt(l*l+x*x);return s.y+x/f*h}).attr("stroke",d.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>t.flow==="forward"||t.flow==="bidirectional"?`url(#link-arrow-end-${o})`:null).attr("marker-start",t=>t.flow==="backward"||t.flow==="bidirectional"?`url(#link-arrow-start-${o})`:null),_.selectAll("text").data(U.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=s.y-n.y,l=s.x-n.x,x=Math.sqrt(l*l+h*h),f=8,u=h/x;return i+u*f}).attr("y",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.y+s.y)/2,h=s.x-n.x,l=s.y-n.y,x=Math.sqrt(h*h+l*l),f=8,u=-h/x;return i+u*f}).attr("fill",d.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const n=c.get(t.source),s=c.get(t.target),i=(n.x+s.x)/2,h=(n.y+s.y)/2,l=s.x-n.x,x=s.y-n.y,f=Math.sqrt(l*l+x*x),u=8,w=x/f,S=-l/f,z=i+w*u,W=h+S*u;let Y=Math.atan2(x,l)*180/Math.PI;return(Y>90||Y<-90)&&(Y+=180),`rotate(${Y} ${z} ${W})`}).text(t=>t.label);const $t=P.append("g").attr("class","wardley-trends"),vt=g.trends.map(t=>{const n=c.get(t.nodeId);if(!n)return null;const s=T(t.targetX),i=A(t.targetY),h=s-n.x,l=i-n.y,x=Math.sqrt(h*h+l*l),f=r.nodeRadius+2,u=x>f?s-h/x*f:s,w=x>f?i-l/x*f:i;return{origin:n,targetX:s,targetY:i,adjustedX2:u,adjustedY2:w}}).filter(t=>t!==null);$t.selectAll("line").data(vt).enter().append("line").attr("class","wardley-trend").attr("x1",t=>t.origin.x).attr("y1",t=>t.origin.y).attr("x2",t=>t.adjustedX2).attr("y2",t=>t.adjustedY2).attr("stroke",d.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${o})`);const C=P.append("g").attr("class","wardley-nodes").selectAll("g").data(g.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));C.filter(t=>t.sourceStrategy==="outsource").append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#666").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="buy").append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.sourceStrategy==="build").append("circle").attr("class","wardley-build-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const X=C.filter(t=>t.sourceStrategy==="market");X.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius*2).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y).attr("r",r.nodeRadius).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1);const H=r.nodeRadius*.7,$=r.nodeRadius*1.2;if(X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x).attr("y1",t=>c.get(t.id).y-$).attr("x2",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y2",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("line").attr("class","wardley-market-line").attr("x1",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("y1",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("x2",t=>c.get(t.id).x).attr("y2",t=>c.get(t.id).y-$).attr("stroke",d.componentStroke).attr("stroke-width",1),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x).attr("cy",t=>c.get(t.id).y-$).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x-$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),X.append("circle").attr("class","wardley-market-dot").attr("cx",t=>c.get(t.id).x+$*Math.cos(Math.PI/6)).attr("cy",t=>c.get(t.id).y+$*Math.sin(Math.PI/6)).attr("r",H).attr("fill","white").attr("stroke",d.componentStroke).attr("stroke-width",2),C.filter(t=>t.isPipelineParent===!0).append("rect").attr("x",t=>c.get(t.id).x-m/2).attr("y",t=>c.get(t.id).y-m/2).attr("width",m).attr("height",m).attr("fill",d.componentFill).attr("stroke",d.componentStroke).attr("stroke-width",1),C.filter(t=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y1",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y-s/2}).attr("x2",t=>{const n=c.get(t.id);let s=t.isPipelineParent?m/2+15:r.nodeRadius+15;return t.sourceStrategy&&(s+=r.nodeRadius+10),n.x+s}).attr("y2",t=>{const n=c.get(t.id),s=t.isPipelineParent?m:r.nodeRadius*2;return n.y+s/2}).attr("stroke",d.componentStroke).attr("stroke-width",6),C.append("text").attr("x",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?n.x+t.labelOffsetX:n.x;let s=r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetX===void 0&&(s+=10);const i=t.labelOffsetX??s;return n.x+i}).attr("y",t=>{const n=c.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?n.y+t.labelOffsetY:n.y-3;let s=-r.nodeLabelOffset;t.sourceStrategy&&t.labelOffsetY===void 0&&(s-=10);const i=t.labelOffsetY??s;return n.y+i}).attr("class","wardley-node-label").attr("fill",t=>t.className==="evolved"?d.evolutionStroke:t.className==="anchor"?"#000":d.componentLabelColor).attr("font-size",r.labelFontSize).attr("font-weight",t=>t.className==="anchor"?"bold":"normal").attr("text-anchor",t=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",t=>t.className==="anchor"?"middle":"auto").text(t=>t.label),g.annotations.length>0){const t=P.append("g").attr("class","wardley-annotations");if(g.annotations.forEach(n=>{const s=n.coordinates.map(i=>({x:T(i.x),y:A(i.y)}));if(s.length>1)for(let i=0;i<s.length-1;i++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[i].x).attr("y1",s[i].y).attr("x2",s[i+1].x).attr("y2",s[i+1].y).attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach(i=>{const h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",i.x).attr("cy",i.y).attr("r",10).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",i.x).attr("y",i.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.number)})}),g.annotationsBox){let n=T(g.annotationsBox.x),s=A(g.annotationsBox.y);const i=10,h=16,l=11,x=t.append("g").attr("class","wardley-annotations-box"),f=[...g.annotations].filter(w=>w.text).sort((w,S)=>w.number-S.number),u=[];if(f.forEach((w,S)=>{const z=x.append("text").attr("x",n+i).attr("y",s+i+(S+1)*h).attr("font-size",l).attr("fill",d.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${w.number}. ${w.text}`);u.push(z)}),u.length>0){let w=0,S=0;u.forEach(j=>{const D=j.node(),Nt=D.getComputedTextLength();w=Math.max(w,Nt);const Ct=D.getBBox();S=Math.max(S,Ct.height)});const z=w+i*2+105,W=f.length*h+i*2+S/2,Y=r.padding,Pt=M-r.padding-z,St=r.padding,Mt=k-r.padding-W;n=Math.max(Y,Math.min(n,Pt)),s=Math.max(St,Math.min(s,Mt)),u.forEach((j,D)=>{j.attr("x",n+i).attr("y",s+i+(D+1)*h)}),x.insert("rect","text").attr("x",n).attr("y",s).attr("width",z).attr("height",W).attr("fill","white").attr("stroke",d.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(g.notes.length>0){const t=P.append("g").attr("class","wardley-notes");g.notes.forEach(n=>{const s=T(n.x),i=A(n.y);t.append("text").attr("x",s).attr("y",i).attr("text-anchor","start").attr("font-size",11).attr("fill",d.axisTextColor).attr("font-weight","bold").text(n.text)})}if(g.accelerators.length>0){const t=P.append("g").attr("class","wardley-accelerators");g.accelerators.forEach(n=>{const s=T(n.x),i=A(n.y),h=60,l=30,x=20,f=`
|
|
3
3
|
M ${s} ${i-l/2}
|
|
4
4
|
L ${s+h-x} ${i-l/2}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as pi,g as mi,o as $t,n as yi,a as bi,b as wi,_ as a,l as Ut,D as Ai,d as Ci,p as Si,y as Dt,i as Ri,A as Gt,B as _i,E as ki,aC as Ti,R as Xt}from"./mermaid.core-
|
|
1
|
+
import{s as pi,g as mi,o as $t,n as yi,a as bi,b as wi,_ as a,l as Ut,D as Ai,d as Ci,p as Si,y as Dt,i as Ri,A as Gt,B as _i,E as ki,aC as Ti,R as Xt}from"./mermaid.core-Dq2piIpp.js";import{i as Di}from"./init-Gi6I4Gst.js";import{o as Pi}from"./ordinal-Cboi1Yqb.js";import{l as Nt}from"./linear-Cgk2Kw-d.js";import"./index-DqIihcNP.js";import"./defaultLocale-DX6XiGOO.js";function vi(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function St(){var e=Pi().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,h,p=!1,u=0,f=0,R=.5;delete e.unknown;function C(){var y=t().length,E=n<s,v=E?n:s,L=E?s:n;o=(L-v)/Math.max(1,y-u+f*2),p&&(o=Math.floor(o)),v+=(L-v-o*(y-u))*R,h=o*(1-u),p&&(v=Math.round(v),h=Math.round(h));var M=vi(y).map(function(b){return v+o*b});return i(E?M.reverse():M)}return e.domain=function(y){return arguments.length?(t(y),C()):t()},e.range=function(y){return arguments.length?([s,n]=y,s=+s,n=+n,C()):[s,n]},e.rangeRound=function(y){return[s,n]=y,s=+s,n=+n,p=!0,C()},e.bandwidth=function(){return h},e.step=function(){return o},e.round=function(y){return arguments.length?(p=!!y,C()):p},e.padding=function(y){return arguments.length?(u=Math.min(1,f=+y),C()):u},e.paddingInner=function(y){return arguments.length?(u=Math.min(1,y),C()):u},e.paddingOuter=function(y){return arguments.length?(f=+y,C()):f},e.align=function(y){return arguments.length?(R=Math.max(0,Math.min(1,y)),C()):R},e.copy=function(){return St(t(),[s,n]).round(p).paddingInner(u).paddingOuter(f).align(R)},Di.apply(C(),arguments)}var Rt=(function(){var e=a(function(W,l,g,d){for(g=g||{},d=W.length;d--;g[W[d]]=l);return g},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],h=[1,7],p=[1,5,10,12,14,16,18,19,21,23,36,37,38],u=[1,25],f=[1,26],R=[1,28],C=[1,29],y=[1,30],E=[1,31],v=[1,32],L=[1,33],M=[1,34],b=[1,35],D=[1,36],c=[1,37],z=[1,43],F=[1,42],X=[1,47],N=[1,50],k=[1,10,12,14,16,18,19,21,23,36,37,38],H=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],A=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],S=[1,65],O=[26,28],T={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:a(function(l,g,d,x,_,r,lt){var m=r.length-1;switch(_){case 5:x.setOrientation(r[m]);break;case 9:x.setDiagramTitle(r[m].text.trim());break;case 12:x.setLineData({text:"",type:"text"},r[m]);break;case 13:x.setLineData(r[m-1],r[m]);break;case 14:x.setBarData({text:"",type:"text"},r[m]);break;case 15:x.setBarData(r[m-1],r[m]);break;case 16:this.$=r[m].trim(),x.setAccTitle(this.$);break;case 17:case 18:this.$=r[m].trim(),x.setAccDescription(this.$);break;case 19:this.$=r[m-1];break;case 20:case 30:this.$=[r[m-2],...r[m]];break;case 21:case 31:this.$=[r[m]];break;case 22:this.$={value:Number(r[m-1]),label:r[m]};break;case 23:this.$={value:Number(r[m]),label:""};break;case 24:x.setXAxisTitle(r[m]);break;case 25:x.setXAxisTitle(r[m-1]);break;case 26:x.setXAxisTitle({type:"text",text:""});break;case 27:x.setXAxisBand(r[m]);break;case 28:x.setXAxisRangeData(Number(r[m-2]),Number(r[m]));break;case 29:this.$=r[m-1];break;case 32:x.setYAxisTitle(r[m]);break;case 33:x.setYAxisTitle(r[m-1]);break;case 34:x.setYAxisTitle({type:"text",text:""});break;case 35:x.setYAxisRangeData(Number(r[m-2]),Number(r[m]));break;case 39:this.$={text:r[m],type:"text"};break;case 40:this.$={text:r[m],type:"text"};break;case 41:this.$={text:r[m],type:"markdown"};break;case 42:this.$=r[m];break;case 43:this.$=r[m-1]+""+r[m];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,36:n,37:o,38:h}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,36:n,37:o,38:h}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],36:n,37:o,38:h}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(p,[2,36]),e(p,[2,37]),e(p,[2,38]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,36:n,37:o,38:h}),{1:[2,3]},e(p,[2,5]),e(t,[2,7],{4:22,36:n,37:o,38:h}),{11:23,30:u,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:39,13:38,24:z,29:F,30:u,31:40,32:41,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:45,15:44,29:X,30:u,35:46,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:49,17:48,24:N,30:u,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{11:52,17:51,24:N,30:u,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},{20:[1,53]},{22:[1,54]},e(k,[2,18]),{1:[2,2]},e(k,[2,8]),e(k,[2,9]),e(H,[2,39],{41:55,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c}),e(H,[2,40]),e(H,[2,41]),e(A,[2,42]),e(A,[2,44]),e(A,[2,45]),e(A,[2,46]),e(A,[2,47]),e(A,[2,48]),e(A,[2,49]),e(A,[2,50]),e(A,[2,51]),e(A,[2,52]),e(A,[2,53]),e(k,[2,10]),e(k,[2,24],{32:41,31:56,24:z,29:F}),e(k,[2,26]),e(k,[2,27]),{33:[1,57]},{11:59,30:u,34:58,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},e(k,[2,11]),e(k,[2,32],{35:60,29:X}),e(k,[2,34]),{33:[1,61]},e(k,[2,12]),{17:62,24:N},{25:63,27:64,29:S},e(k,[2,14]),{17:66,24:N},e(k,[2,16]),e(k,[2,17]),e(A,[2,43]),e(k,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},e(k,[2,33]),{29:[1,70]},e(k,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},e(O,[2,23],{30:[1,73]}),e(k,[2,15]),e(k,[2,28]),e(k,[2,29]),{11:59,30:u,34:74,39:24,40:f,41:27,42:R,43:C,44:y,45:E,46:v,47:L,48:M,49:b,50:D,51:c},e(k,[2,35]),e(k,[2,19]),{25:75,27:64,29:S},e(O,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:a(function(l,g){if(g.recoverable)this.trace(l);else{var d=new Error(l);throw d.hash=g,d}},"parseError"),parse:a(function(l){var g=this,d=[0],x=[],_=[null],r=[],lt=this.table,m="",dt=0,Ot=0,ui=2,Vt=1,di=r.slice.call(arguments,1),P=Object.create(this.lexer),$={yy:{}};for(var bt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,bt)&&($.yy[bt]=this.yy[bt]);P.setInput(l,$.yy),$.yy.lexer=P,$.yy.parser=this,typeof P.yylloc>"u"&&(P.yylloc={});var wt=P.yylloc;r.push(wt);var xi=P.options&&P.options.ranges;typeof $.yy.parseError=="function"?this.parseError=$.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function fi(B){d.length=d.length-2*B,_.length=_.length-B,r.length=r.length-B}a(fi,"popStack");function Ft(){var B;return B=x.pop()||P.lex()||Vt,typeof B!="number"&&(B instanceof Array&&(x=B,B=x.pop()),B=g.symbols_[B]||B),B}a(Ft,"lex");for(var I,U,V,At,j={},xt,Y,Wt,ft;;){if(U=d[d.length-1],this.defaultActions[U]?V=this.defaultActions[U]:((I===null||typeof I>"u")&&(I=Ft()),V=lt[U]&<[U][I]),typeof V>"u"||!V.length||!V[0]){var Ct="";ft=[];for(xt in lt[U])this.terminals_[xt]&&xt>ui&&ft.push("'"+this.terminals_[xt]+"'");P.showPosition?Ct="Parse error on line "+(dt+1)+`:
|
|
2
2
|
`+P.showPosition()+`
|
|
3
3
|
Expecting `+ft.join(", ")+", got '"+(this.terminals_[I]||I)+"'":Ct="Parse error on line "+(dt+1)+": Unexpected "+(I==Vt?"end of input":"'"+(this.terminals_[I]||I)+"'"),this.parseError(Ct,{text:P.match,token:this.terminals_[I]||I,line:P.yylineno,loc:wt,expected:ft})}if(V[0]instanceof Array&&V.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+I);switch(V[0]){case 1:d.push(I),_.push(P.yytext),r.push(P.yylloc),d.push(V[1]),I=null,Ot=P.yyleng,m=P.yytext,dt=P.yylineno,wt=P.yylloc;break;case 2:if(Y=this.productions_[V[1]][1],j.$=_[_.length-Y],j._$={first_line:r[r.length-(Y||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(Y||1)].first_column,last_column:r[r.length-1].last_column},xi&&(j._$.range=[r[r.length-(Y||1)].range[0],r[r.length-1].range[1]]),At=this.performAction.apply(j,[m,Ot,dt,$.yy,V[1],_,r].concat(di)),typeof At<"u")return At;Y&&(d=d.slice(0,-1*Y*2),_=_.slice(0,-1*Y),r=r.slice(0,-1*Y)),d.push(this.productions_[V[1]][0]),_.push(j.$),r.push(j._$),Wt=lt[d[d.length-2]][d[d.length-1]],d.push(Wt);break;case 3:return!0}}return!0},"parse")},ht=(function(){var W={EOF:1,parseError:a(function(g,d){if(this.yy.parser)this.yy.parser.parseError(g,d);else throw new Error(g)},"parseError"),setInput:a(function(l,g){return this.yy=g||this.yy||{},this._input=l,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:a(function(){var l=this._input[0];this.yytext+=l,this.yyleng++,this.offset++,this.match+=l,this.matched+=l;var g=l.match(/(?:\r\n?|\n).*/g);return g?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),l},"input"),unput:a(function(l){var g=l.length,d=l.split(/(?:\r\n?|\n)/g);this._input=l+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-g),this.offset-=g;var x=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),d.length-1&&(this.yylineno-=d.length-1);var _=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:d?(d.length===x.length?this.yylloc.first_column:0)+x[x.length-d.length].length-d[0].length:this.yylloc.first_column-g},this.options.ranges&&(this.yylloc.range=[_[0],_[0]+this.yyleng-g]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(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).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(l){this.unput(this.match.slice(l))},"less"),pastInput:a(function(){var l=this.matched.substr(0,this.matched.length-this.match.length);return(l.length>20?"...":"")+l.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var l=this.match;return l.length<20&&(l+=this._input.substr(0,20-l.length)),(l.substr(0,20)+(l.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var l=this.pastInput(),g=new Array(l.length+1).join("-");return l+this.upcomingInput()+`
|
package/dist/client/index.html
CHANGED
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
strict CSP `script-src 'self'` set by the server blocks inline scripts.
|
|
13
13
|
-->
|
|
14
14
|
<script src="/bootstrap.js"></script>
|
|
15
|
-
<script type="module" crossorigin src="/assets/index-
|
|
16
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
15
|
+
<script type="module" crossorigin src="/assets/index-DqIihcNP.js"></script>
|
|
16
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BP_8buXC.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
19
19
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ai as o,aj as n}from"./mermaid.core-CVM43n3z.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-LCL6LL3I-SEXOnCPG.js";import{_ as i}from"./mermaid.core-CVM43n3z.js";import"./chunk-5VM5RSS4-C3v07bfZ.js";import"./chunk-XXDRQBXY-CguISEfl.js";import"./chunk-POPQ4Y6H-Dpgmgmgq.js";import"./chunk-F27PBJKO-bDA5q_T9.js";import"./index-7zMmn_PY.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-LCL6LL3I-SEXOnCPG.js";import{_ as i}from"./mermaid.core-CVM43n3z.js";import"./chunk-5VM5RSS4-C3v07bfZ.js";import"./chunk-XXDRQBXY-CguISEfl.js";import"./chunk-POPQ4Y6H-Dpgmgmgq.js";import"./chunk-F27PBJKO-bDA5q_T9.js";import"./index-7zMmn_PY.js";var n={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{n as diagram};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function n(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=n(r);fetch(r.href,o)}})();var Ve,E,On,Dn,J,en,Kn,Un,rt,Se,de,Wn,Ot,ft,pt,Me={},He=[],Ji=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,je=Array.isArray;function B(e,t){for(var n in t)e[n]=t[n];return e}function Dt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Gi(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Ve.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return Ee(e,a,i,r,null)}function Ee(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++On,__i:-1,__u:0};return r==null&&E.vnode!=null&&E.vnode(o),o}function ee(e){return e.children}function he(e,t){this.props=e,this.context=t}function ae(e,t){if(t==null)return e.__?ae(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ae(e):null}function Xi(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=B({},t);o.__v=t.__v+1,E.vnode&&E.vnode(o),Kt(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??ae(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Vn(i,o,r),t.__e=t.__=null,o.__e!=n&&Bn(o)}}function Bn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Bn(e)}function tn(e){(!e.__d&&(e.__d=!0)&&J.push(e)&&!Re.__r++||en!=E.debounceRendering)&&((en=E.debounceRendering)||Kn)(Re)}function Re(){try{for(var e,t=1;J.length;)J.length>t&&J.sort(Un),e=J.shift(),t=J.length,Xi(e)}finally{J.length=Re.__r=0}}function zn(e,t,n,i,r,o,a,s,d,c,h){var u,f,p,_,m,w,k,g=i&&i.__k||He,I=t.length;for(d=Yi(n,t,g,d,I),u=0;u<I;u++)(p=n.__k[u])!=null&&(f=p.__i!=-1&&g[p.__i]||Me,p.__i=u,w=Kt(e,p,f,r,o,a,s,d,c,h),_=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Ut(f.ref,null,p),h.push(p.ref,p.__c||_,p)),m==null&&_!=null&&(m=_),(k=!!(4&p.__u))||f.__k===p.__k?(d=qn(p,d,e,k),k&&f.__e&&(f.__e=null)):typeof p.type=="function"&&w!==void 0?d=w:_&&(d=_.nextSibling),p.__u&=-7);return n.__e=m,d}function Yi(e,t,n,i,r){var o,a,s,d,c,h=n.length,u=h,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Ee(null,a,null,null,null):je(a)?a=e.__k[o]=Ee(ee,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Ee(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,d=o+f,a.__=e,a.__b=e.__b+1,s=null,(c=a.__i=Qi(a,n,d,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(r>h?f--:r<h&&f++),typeof a.type!="function"&&(a.__u|=4)):c!=d&&(c==d-1?f--:c==d+1?f++:(c>d?f--:f++,a.__u|=4))):e.__k[o]=null;if(u)for(o=0;o<h;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=ae(s)),Jn(s,s));return i}function qn(e,t,n,i){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=qn(r[o],t,n,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=ae(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Qi(e,t,n,i){var r,o,a,s=e.key,d=e.type,c=t[n],h=c!=null&&(2&c.__u)==0;if(c===null&&s==null||h&&s==c.key&&d==c.type)return n;if(i>(h?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((c=t[a=r>=0?r--:o++])!=null&&(2&c.__u)==0&&s==c.key&&d==c.type)return a}return-1}function nn(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ji.test(t)?n:n+"px"}function be(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||nn(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||nn(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Wn,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[de]=i[de]:(n[de]=Ot,e.addEventListener(t,o?pt:ft,o)):e.removeEventListener(t,o?pt:ft,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function rn(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Se]==null)t[Se]=Ot++;else if(t[Se]<n[de])return;return n(E.event?E.event(t):t)}}}function Kt(e,t,n,i,r,o,a,s,d,c){var h,u,f,p,_,m,w,k,g,I,M,F,q,y,x,v=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(d=!!(32&n.__u),o=[s=t.__e=n.__e]),(h=E.__b)&&h(t);e:if(typeof v=="function")try{if(k=t.props,g=v.prototype&&v.prototype.render,I=(h=v.contextType)&&i[h.__c],M=h?I?I.props.value:h.__:i,n.__c?w=(u=t.__c=n.__c).__=u.__E:(g?t.__c=u=new v(k,M):(t.__c=u=new he(k,M),u.constructor=v,u.render=er),I&&I.sub(u),u.state||(u.state={}),u.__n=i,f=u.__d=!0,u.__h=[],u._sb=[]),g&&u.__s==null&&(u.__s=u.state),g&&v.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=B({},u.__s)),B(u.__s,v.getDerivedStateFromProps(k,u.__s))),p=u.props,_=u.state,u.__v=t,f)g&&v.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),g&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(g&&v.getDerivedStateFromProps==null&&k!==p&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(k,M),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(k,u.__s,M)===!1){t.__v!=n.__v&&(u.props=k,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(C){C&&(C.__=t)}),He.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(k,u.__s,M),g&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(p,_,m)})}if(u.context=M,u.props=k,u.__P=e,u.__e=!1,F=E.__r,q=0,g)u.state=u.__s,u.__d=!1,F&&F(t),h=u.render(u.props,u.state,u.context),He.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,F&&F(t),h=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++q<25);u.state=u.__s,u.getChildContext!=null&&(i=B(B({},i),u.getChildContext())),g&&!f&&u.getSnapshotBeforeUpdate!=null&&(m=u.getSnapshotBeforeUpdate(p,_)),y=h!=null&&h.type===ee&&h.key==null?jn(h.props.children):h,s=zn(e,je(y)?y:[y],t,n,i,r,o,a,s,d,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),w&&(u.__E=u.__=null)}catch(C){if(t.__v=null,d||o!=null)if(C.then){for(t.__u|=d?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else{for(x=o.length;x--;)Dt(o[x]);_t(t)}else t.__e=n.__e,t.__k=n.__k,C.then||_t(t);E.__e(C,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Zi(n.__e,t,n,i,r,o,a,d,c);return(h=E.diffed)&&h(t),128&t.__u?void 0:s}function _t(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(_t))}function Vn(e,t,n){for(var i=0;i<n.length;i++)Ut(n[i],n[++i],n[++i]);E.__c&&E.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){E.__e(o,r.__v)}})}function jn(e){return typeof e!="object"||e==null||e.__b>0?e:je(e)?e.map(jn):B({},e)}function Zi(e,t,n,i,r,o,a,s,d){var c,h,u,f,p,_,m,w=n.props||Me,k=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!g&&(g?p.localName==g:p.nodeType==3)){e=p,o[c]=null;break}}if(e==null){if(g==null)return document.createTextNode(k);e=document.createElementNS(r,g,k.is&&k),s&&(E.__m&&E.__m(t,o),s=!1),o=null}if(g==null)w===k||s&&e.data==k||(e.data=k);else{if(o=o&&Ve.call(e.childNodes),!s&&o!=null)for(w={},c=0;c<e.attributes.length;c++)w[(p=e.attributes[c]).name]=p.value;for(c in w)p=w[c],c=="dangerouslySetInnerHTML"?u=p:c=="children"||c in k||c=="value"&&"defaultValue"in k||c=="checked"&&"defaultChecked"in k||be(e,c,null,p,r);for(c in k)p=k[c],c=="children"?f=p:c=="dangerouslySetInnerHTML"?h=p:c=="value"?_=p:c=="checked"?m=p:s&&typeof p!="function"||w[c]===p||be(e,c,p,w[c],r);if(h)s||u&&(h.__html==u.__html||h.__html==e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(u&&(e.innerHTML=""),zn(t.type=="template"?e.content:e,je(f)?f:[f],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&ae(n,0),s,d),o!=null)for(c=o.length;c--;)Dt(o[c]);s||(c="value",g=="progress"&&_==null?e.removeAttribute("value"):_!=null&&(_!==e[c]||g=="progress"&&!_||g=="option"&&_!=w[c])&&be(e,c,_,w[c],r),c="checked",m!=null&&m!=e[c]&&be(e,c,m,w[c],r))}return e}function Ut(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){E.__e(r,n)}}function Jn(e,t,n){var i,r;if(E.unmount&&E.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ut(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){E.__e(o,t)}i.base=i.__P=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Jn(i[r],t,n||typeof e.type!="function");n||Dt(e.__e),e.__c=e.__=e.__e=void 0}function er(e,t,n){return this.constructor(e,n)}function tr(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),E.__&&E.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Kt(t,e=t.__k=Gi(ee,null,[e]),r||Me,Me,t.namespaceURI,r?null:t.firstChild?Ve.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Vn(o,e,a)}Ve=He.slice,E={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},On=0,Dn=function(e){return e!=null&&e.constructor===void 0},he.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=B({},this.state),typeof e=="function"&&(e=e(B({},n),this.props)),e&&B(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),tn(this))},he.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),tn(this))},he.prototype.render=ee,J=[],Kn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Un=function(e,t){return e.__v.__b-t.__v.__b},Re.__r=0,rt=Math.random().toString(8),Se="__d"+rt,de="__a"+rt,Wn=/(PointerCapture)$|Capture$/i,Ot=0,ft=rn(!1),pt=rn(!0);var nr=0;function l(e,t,n,i,r,o){t||(t={});var a,s,d=t;if("ref"in d)for(s in d={},t)s=="ref"?a=t[s]:d[s]=t[s];var c={type:e,props:d,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--nr,__i:-1,__u:0,__source:r,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)d[s]===void 0&&(d[s]=a[s]);return E.vnode&&E.vnode(c),c}const Je=["flexoki","paper","solarized","everforest","rose-pine","kanagawa","catppuccin","high-contrast"];var ve,$,ot,on,me=0,Gn=[],T=E,ln=T.__b,an=T.__r,sn=T.diffed,cn=T.__c,un=T.unmount,dn=T.__;function Wt(e,t){T.__h&&T.__h($,e,me||t),me=0;var n=$.__H||($.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function z(e){return me=1,ir(Qn,e)}function ir(e,t,n){var i=Wt(ve++,2);if(i.t=e,!i.__c&&(i.__=[Qn(void 0,t),function(s){var d=i.__N?i.__N[0]:i.__[0],c=i.t(d,s);d!==c&&(i.__N=[c,i.__[1]],i.__c.setState({}))}],i.__c=$,!$.__f)){var r=function(s,d,c){if(!i.__c.__H)return!0;var h=i.__c.__H.__.filter(function(f){return f.__c});if(h.every(function(f){return!f.__N}))return!o||o.call(this,s,d,c);var u=i.__c.props!==s;return h.some(function(f){if(f.__N){var p=f.__[0];f.__=f.__N,f.__N=void 0,p!==f.__[0]&&(u=!0)}}),o&&o.call(this,s,d,c)||u};$.__f=!0;var o=$.shouldComponentUpdate,a=$.componentWillUpdate;$.componentWillUpdate=function(s,d,c){if(this.__e){var h=o;o=void 0,r(s,d,c),o=h}a&&a.call(this,s,d,c)},$.shouldComponentUpdate=r}return i.__N||i.__}function b(e,t){var n=Wt(ve++,3);!T.__s&&Yn(n.__H,t)&&(n.__=e,n.u=t,$.__H.__h.push(n))}function K(e){return me=5,O(function(){return{current:e}},[])}function O(e,t){var n=Wt(ve++,7);return Yn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Xn(e,t){return me=8,O(function(){return e},t)}function rr(){for(var e;e=Gn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ce),t.__h.some(vt),t.__h=[]}catch(n){t.__h=[],T.__e(n,e.__v)}}}T.__b=function(e){$=null,ln&&ln(e)},T.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),dn&&dn(e,t)},T.__r=function(e){an&&an(e),ve=0;var t=($=e.__c).__H;t&&(ot===$?(t.__h=[],$.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Ce),t.__h.some(vt),t.__h=[],ve=0)),ot=$},T.diffed=function(e){sn&&sn(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Gn.push(t)!==1&&on===T.requestAnimationFrame||((on=T.requestAnimationFrame)||or)(rr)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),ot=$=null},T.__c=function(e,t){t.some(function(n){try{n.__h.some(Ce),n.__h=n.__h.filter(function(i){return!i.__||vt(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],T.__e(i,n.__v)}}),cn&&cn(e,t)},T.unmount=function(e){un&&un(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Ce(i)}catch(r){t=r}}),n.__H=void 0,t&&T.__e(t,n.__v))};var hn=typeof requestAnimationFrame=="function";function or(e){var t,n=function(){clearTimeout(i),hn&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);hn&&(t=requestAnimationFrame(n))}function Ce(e){var t=$,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),$=t}function vt(e){var t=$;e.__c=e.__(),$=t}function Yn(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Qn(e,t){return typeof t=="function"?t(e):t}var lr=Symbol.for("preact-signals");function Bt(){if(Q>1)Q--;else{var e,t=!1;for((function(){var r=Oe;for(Oe=void 0;r!==void 0;)r.S.v===r.v&&(r.S.i=r.i),r=r.o})();fe!==void 0;){var n=fe;for(fe=void 0,Fe++;n!==void 0;){var i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ti(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=i}}if(Fe=0,Q--,t)throw e}}var S=void 0;function Zn(e){var t=S;S=void 0;try{return e()}finally{S=t}}var fe=void 0,Q=0,Fe=0,fn=0,Oe=void 0,De=0;function ei(e){if(S!==void 0){var t=e.n;if(t===void 0||t.t!==S)return t={i:0,S:e,p:S.s,n:void 0,t:S,e:void 0,x:void 0,r:t},S.s!==void 0&&(S.s.n=t),S.s=t,e.n=t,32&S.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=S.s,t.n=void 0,S.s.n=t,S.s=t),t}}function N(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}N.prototype.brand=lr;N.prototype.h=function(){return!0};N.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n!==void 0?n.e=e:Zn(function(){var i;(i=t.W)==null||i.call(t)}))};N.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,i=e.x;n!==void 0&&(n.x=i,e.e=void 0),i!==void 0&&(i.e=n,e.x=void 0),e===this.t&&(this.t=i,i===void 0&&Zn(function(){var r;(r=t.Z)==null||r.call(t)}))}};N.prototype.subscribe=function(e){var t=this;return Ge(function(){var n=t.value,i=S;S=void 0;try{e(n)}finally{S=i}},{name:"sub"})};N.prototype.valueOf=function(){return this.value};N.prototype.toString=function(){return this.value+""};N.prototype.toJSON=function(){return this.value};N.prototype.peek=function(){var e=S;S=void 0;try{return this.value}finally{S=e}};Object.defineProperty(N.prototype,"value",{get:function(){var e=ei(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Fe>100)throw new Error("Cycle detected");(function(n){Q!==0&&Fe===0&&n.l!==fn&&(n.l=fn,Oe={S:n,v:n.v,i:n.i,o:Oe})})(this),this.v=e,this.i++,De++,Q++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Bt()}}}});function P(e,t){return new N(e,t)}function ti(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ni(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function ii(e){for(var t=e.s,n=void 0;t!==void 0;){var i=t.p;t.i===-1?(t.S.U(t),i!==void 0&&(i.n=t.n),t.n!==void 0&&(t.n.p=i)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=i}e.s=n}function te(e,t){N.call(this,void 0),this.x=e,this.s=void 0,this.g=De-1,this.f=4,this.W=t==null?void 0:t.watched,this.Z=t==null?void 0:t.unwatched,this.name=t==null?void 0:t.name}te.prototype=new N;te.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===De))return!0;if(this.g=De,this.f|=1,this.i>0&&!ti(this))return this.f&=-2,!0;var e=S;try{ni(this),S=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return S=e,ii(this),this.f&=-2,!0};te.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}N.prototype.S.call(this,e)};te.prototype.U=function(e){if(this.t!==void 0&&(N.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};te.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(te.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ei(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ri(e,t){return new te(e,t)}function oi(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Q++;var n=S;S=void 0;try{t()}catch(i){throw e.f&=-2,e.f|=8,zt(e),i}finally{S=n,Bt()}}}function zt(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,oi(e)}function ar(e){if(S!==this)throw new Error("Out-of-order effect");ii(this),S=e,this.f&=-2,8&this.f&&zt(this),Bt()}function ce(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t==null?void 0:t.name}ce.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.m=t)}finally{e()}};ce.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,oi(this),ni(this),Q++;var e=S;return S=this,ar.bind(this,e)};ce.prototype.N=function(){2&this.f||(this.f|=2,this.u=fe,fe=this)};ce.prototype.d=function(){this.f|=8,1&this.f||zt(this)};ce.prototype.dispose=function(){this.d()};function Ge(e,t){var n=new ce(e,t);try{n.c()}catch(r){throw n.d(),r}var i=n.d.bind(n);return i[Symbol.dispose]=i,i}var ke;function ue(e,t){E[e]=t.bind(null,E[e]||function(){})}function Ke(e){if(ke){var t=ke;ke=void 0,t()}ke=e&&e.S()}function li(e){var t=this,n=e.data,i=j(n);i.value=n;var r=O(function(){for(var o=t.__v;o=o.__;)if(o.__c){o.__c.__$f|=4;break}return t.__$u.c=function(){var a,s=t.__$u.S(),d=r.value;s(),Dn(d)||((a=t.base)==null?void 0:a.nodeType)!==3?(t.__$f|=1,t.setState({})):t.base.data=d},ri(function(){var a=i.value.value;return a===0?0:a===!0?"":a||""})},[]);return r.value}li.displayName="_st";Object.defineProperties(N.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:li},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});ue("__b",function(e,t){if(typeof t.type=="string"){var n,i=t.props;for(var r in i)if(r!=="children"){var o=i[r];o instanceof N&&(n||(t.__np=n={}),n[r]=o,i[r]=o.peek())}}e(t)});ue("__r",function(e,t){e(t),Ke();var n,i=t.__c;i&&(i.__$f&=-2,(n=i.__$u)===void 0&&(i.__$u=n=(function(r){var o;return Ge(function(){o=this}),o.c=function(){i.__$f|=1,i.setState({})},o})())),Ke(n)});ue("__e",function(e,t,n,i){Ke(),e(t,n,i)});ue("diffed",function(e,t){Ke();var n;if(typeof t.type=="string"&&(n=t.__e)){var i=t.__np,r=t.props;if(i){var o=n.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in i)&&(s.d(),o[a]=void 0)}else n.U=o={};for(var d in i){var c=o[d],h=i[d];c===void 0?(c=sr(n,d,h,r),o[d]=c):c.o(h,r)}}}e(t)});function sr(e,t,n,i){var r=t in e&&e.ownerSVGElement===void 0,o=P(n);return{o:function(a,s){o.value=a,i=s},d:Ge(function(){var a=o.value.value;i[t]!==a&&(i[t]=a,r?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}ue("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var i=n.U;if(i){n.U=void 0;for(var r in i){var o=i[r];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});ue("__h",function(e,t,n,i){(i<3||i===9)&&(t.__$f|=2),e(t,n,i)});he.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,i=n&&n.s!==void 0;for(var r in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){if(!(i||2&this.__$f||4&this.__$f)||1&this.__$f)return!0}else if(!(i||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!=="__source"&&e[o]!==this.props[o])return!0;for(var a in this.props)if(!(a in e))return!0;return!1};function j(e){return O(function(){return P(e)},[])}const Xe=P(!1);function cr(){Xe.value=!0}function Le(){Xe.value=!1}const se=P(null),mt=P(null);async function ai(){const e=await fetch("/api/tree");if(!e.ok)return;const t=await e.json();se.value=t,mt.value=t.config??null}function ur(){return b(()=>{ai()},[]),se.value}function si(e){const t=[];function n(i){for(const r of i)r.type==="file"&&r.isMarkdown?t.push({relPath:r.relPath,name:r.name}):r.type==="dir"&&r.children&&n(r.children)}return n(e),t}function dr(e,t){if(!t)return{...e,score:0,matchRanges:[]};const n=t.toLowerCase(),i=e.relPath.toLowerCase(),o=e.name.toLowerCase().indexOf(n);if(o!==-1){const h=e.relPath.length-e.name.length+o;return{...e,score:1e3-h-e.relPath.length,matchRanges:[[h,h+n.length]]}}const a=i.indexOf(n);if(a!==-1)return{...e,score:500-a-e.relPath.length,matchRanges:[[a,a+n.length]]};const s=[];let d=0,c=-1;for(let h=0;h<i.length&&d<n.length;h++)i[h]===n[d]?(c===-1&&(c=h),d++):c!==-1&&(s.push([c,c+1]),c=-1);return c!==-1&&s.push([c,d-(n.length-1)+c]),d===n.length?{...e,score:100-e.relPath.length,matchRanges:s}:null}function hr(e,t,n=50){const i=[];for(const r of e){const o=dr(r,t);o&&i.push(o)}return i.sort((r,o)=>o.score-r.score),i.slice(0,n)}function ci(e){for(const t of e){if(t.type==="file"&&t.isMarkdown)return t.relPath;if(t.type==="dir"&&t.children){const n=ci(t.children);if(n)return n}}return null}function ui(e,t){for(const n of e){const i=n.relPath===t||n.relPath.startsWith(`${t}/`);if(n.type==="file"){if(i&&n.isMarkdown)return n.relPath;continue}if(n.children&&(i||t.startsWith(`${n.relPath}/`))){const r=ui(n.children,t);if(r)return r}}return null}function fr(e,t){if(t.length===0)return e;const n=[];let i=0;for(const[r,o]of t)r>i&&n.push(e.slice(i,r)),n.push({mark:e.slice(r,o)}),i=o;return i<e.length&&n.push(e.slice(i)),n.map((r,o)=>typeof r=="string"?l("span",{children:r},o):l("mark",{class:"palette-match",children:r.mark},o))}function pr({currentPath:e,onSelect:t}){const n=Xe.value,i=se.value,[r,o]=z(""),[a,s]=z(0),d=K(null),c=K(null),h=O(()=>i?si(i.tree):[],[i]),u=O(()=>n?r.trim()?hr(h,r.trim()):h.slice(0,50).map(_=>({..._,score:0,matchRanges:[]})):[],[h,r,n]);if(b(()=>{n&&(o(""),s(0),requestAnimationFrame(()=>{var _,m;(_=d.current)==null||_.focus(),(m=d.current)==null||m.select()}))},[n]),b(()=>{a>=u.length&&s(Math.max(0,u.length-1))},[u.length,a]),b(()=>{if(!n||!c.current)return;const _=c.current.children[a];_==null||_.scrollIntoView({block:"nearest"})},[a,n]),!n)return null;function f(_){const m=u[_];m&&(t(m.relPath),Le())}function p(_){_.key==="Escape"?(_.preventDefault(),Le()):_.key==="ArrowDown"||_.ctrlKey&&_.key==="n"?(_.preventDefault(),s(m=>u.length===0?0:(m+1)%u.length)):_.key==="ArrowUp"||_.ctrlKey&&_.key==="p"?(_.preventDefault(),s(m=>u.length===0?0:(m-1+u.length)%u.length)):_.key==="Enter"&&(_.preventDefault(),f(a))}return l("div",{class:"palette-overlay",role:"dialog","aria-modal":"true","aria-label":"Switch file",onClick:Le,children:l("div",{class:"palette",onClick:_=>_.stopPropagation(),children:[l("div",{class:"palette-input-wrap",children:[l("span",{class:"palette-prefix","aria-hidden":!0,children:"⌘P"}),l("input",{ref:d,type:"text",class:"palette-input",placeholder:"Switch file…",value:r,onInput:_=>{o(_.target.value),s(0)},onKeyDown:p,"aria-label":"Find file"})]}),l("ul",{class:"palette-list",ref:c,role:"listbox",children:[u.length===0&&l("li",{class:"palette-empty",children:"No files match"}),u.map((_,m)=>{const w=m===a,k=e===_.relPath,g=_.relPath.lastIndexOf("/"),I=g>=0?_.relPath.slice(0,g+1):"",M=g>=0?_.relPath.slice(g+1):_.relPath;return l("li",{class:`palette-item${w?" is-active":""}${k?" is-current":""}`,role:"option","aria-selected":w,onMouseEnter:()=>s(m),onClick:()=>f(m),children:[l("span",{class:"palette-item-name",children:_.matchRanges.length>0?fr(_.relPath,_.matchRanges):l(ee,{children:[I&&l("span",{class:"palette-dir",children:I}),l("span",{children:M})]})}),k&&l("span",{class:"palette-tag",children:"current"})]},_.relPath)})]}),l("div",{class:"palette-foot",children:[l("span",{children:[l("kbd",{children:"↑"}),l("kbd",{children:"↓"})," navigate"]}),l("span",{children:[l("kbd",{children:"Enter"})," open"]}),l("span",{children:[l("kbd",{children:"Esc"})," close"]})]})]})})}function _r(e,t=Date.now()){const n=Math.max(0,t-e),i=Math.round(n/1e3);if(i<30)return"just now";if(i<90)return"1 minute ago";const r=Math.round(i/60);if(r<60)return`${r} minutes ago`;const o=Math.round(r/60);if(o<24)return o===1?"1 hour ago":`${o} hours ago`;const a=Math.round(o/24);return a<30?a===1?"yesterday":`${a} days ago`:new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function vr(e){return new Date(e).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}const U=P(null);P([]);const ge=P(null);let di=0;function mr(e,t=600){U.value=e,ge.value=e,di=performance.now()+t}function gr(e,t,n,i){if(e.length===0)return null;if(t<=0)return e[0].id;if(t+n>=i-1)return e[e.length-1].id;const r=16,o=6;let a=e[0].id;for(const s of e)if(s.top-r<=t+o)a=s.id;else break;return a}const yr=.35;function wr(e,t,n,i){if(e.length===0)return null;if(t<=0)return e[0].id;if(t+n>=i-1)return e[e.length-1].id;const r=t+n*yr;let o=e[0].id;for(const a of e)if(a.top<=r)o=a.id;else break;return o}function br(e){b(()=>{if(!e)return;let t=0,n=[],i=[];function r(){const c=e.getBoundingClientRect(),h=e.scrollTop;n=Array.from(e.querySelectorAll(".markdown-content :is(h1,h2,h3,h4,h5,h6)[id]")),i=n.map(u=>{const f=u.getBoundingClientRect();return{id:u.id,top:f.top-c.top+h}})}function o(){if(performance.now()<di)return;const c=e,h=c.scrollTop,u=c.clientHeight,f=c.scrollHeight,p=gr(i,h,u,f);p!==U.value&&(U.value=p);const _=wr(i,h,u,f);_!==ge.value&&(ge.value=_)}function a(){cancelAnimationFrame(t),t=requestAnimationFrame(o)}r(),o();const s=new ResizeObserver(()=>{r(),o()});s.observe(e);const d=new MutationObserver(()=>{r(),o()});return d.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden"]}),e.addEventListener("scroll",a,{passive:!0}),()=>{cancelAnimationFrame(t),s.disconnect(),d.disconnect(),e.removeEventListener("scroll",a)}},[e])}let pn=!1;function kr(e){try{return localStorage.getItem(e)}catch(t){return pn||(pn=!0,console.warn("[mdview] localStorage read blocked; falling back to defaults. Theme/UI prefs will not persist across reloads.",t)),null}}function xr(e,t){try{localStorage.setItem(e,t)}catch{}}function qt(e,t,n){const i=kr(e),r=i!==null?n.parse(i):null,o=P(r??t);return{signal:o,set(a){o.value=a,xr(e,n.serialize(a))}}}function X(e,t){return qt(e,t,{parse:n=>n==="1"?!0:n==="0"?!1:null,serialize:n=>n?"1":"0"})}function Ye(e,t,n){const i=r=>Math.min(n.max,Math.max(n.min,r));return qt(e,t,{parse:r=>{const o=Number(r);return Number.isFinite(o)?i(o):null},serialize:r=>String(i(r))})}function hi(e,t,n){return qt(e,t,{parse:i=>n.includes(i)?i:null,serialize:i=>i})}const gt=X("mdview-tree-collapsed",!1),yt=X("mdview-outline-collapsed",!1),wt=X("mdview-focus-mode",!1),bt=X("mdview-minimap",!1),kt=X("mdview-wide-layout",!1),xt=wt.signal,St=bt.signal,fi=kt.signal;function pi(){wt.set(!wt.signal.value)}function _i(){bt.set(!bt.signal.value)}function vi(){kt.set(!kt.signal.value)}const mi=264,gi=280,Ue=180,We=480,_n=140,Vt=Ye("mdview-tree-width",mi,{min:Ue,max:We}),jt=Ye("mdview-outline-width",gi,{min:Ue,max:We}),Sr=gt.signal,Er=yt.signal,vn=Vt.signal,mn=jt.signal;function $e(){gt.set(!gt.signal.value)}function Te(){yt.set(!yt.signal.value)}function Cr(e){Vt.set(e)}function Lr(e){jt.set(e)}function $r(){Vt.set(mi)}function Tr(){jt.set(gi)}const Pr=225;function yi(e){let t=0;for(const n of e)t+=1+yi(n.children);return t}function Ar(e,t){const n=document.createElement("div");n.innerHTML=e;const i=(n.textContent??"").trim(),r=i.length===0?0:i.split(/\s+/).filter(Boolean).length,o=Math.max(1,Math.round(r/Pr)),a=yi(t);return{words:r,readingMinutes:o,headings:a}}function Ir(e){const t=e.words.toLocaleString(),n=e.headings;return`${e.readingMinutes} min read · ${t} word${e.words===1?"":"s"} · ${n} heading${n===1?"":"s"}`}const Et="is-dimmed",Ct="is-focused",gn=new Set(["H1","H2","H3","H4","H5","H6"]);function yn(e){return Number(e.tagName[1])}function wi(e){e.querySelectorAll(`.${Et}, .${Ct}`).forEach(t=>{t.classList.remove(Et,Ct)})}function Nr(e,t){if(wi(e),!t)return;const n=e.querySelector(`#${CSS.escape(t)}`);if(!n||!gn.has(n.tagName))return;const i=yn(n),r=n.closest(".markdown-content")??e,o=Array.from(r.children),a=o.indexOf(n);if(a<0)return;let s=o.length;for(let d=a+1;d<o.length;d++){const c=o[d];if(gn.has(c.tagName)&&yn(c)<=i){s=d;break}}for(let d=0;d<o.length;d++){const c=o[d];d>=a&&d<s?c.classList.add(Ct):c.classList.add(Et)}}function Mr(e){wi(e)}async function Hr(e,t,n){for(const i of n)try{await i.run(e,t)}catch(r){console.error(`[mdview] wire "${i.name}" failed:`,r)}}function Rr(){return new URLSearchParams(window.location.search).get("root")}function bi(){return new URLSearchParams(window.location.search).get("file")}function ki(e,t=""){const i=new URLSearchParams(window.location.search).get("embed"),r=new URLSearchParams({file:e});i!==null&&r.set("embed",i);const o=`?${r.toString()}${t}`;history.pushState({file:e},"",o)}const Qe=P(bi());function Pe(e){Qe.value=e}function Fr(){b(()=>{const t=()=>Pe(bi());return window.addEventListener("popstate",t),()=>window.removeEventListener("popstate",t)},[]);const e=Xn((t,n="")=>{Pe(t),ki(t,n)},[]);return{currentPath:Qe.value,setCurrentPath:Pe,navigate:e}}const Lt=new Set(["H1","H2","H3","H4","H5","H6"]),Jt="section-toggle",Or="section-heading-collapsed",lt="data-section-collapsed-by",H=new Set;let wn,R=null,bn=!1;function kn(e){return Number(e.tagName[1])}function Gt(e){return!!e&&Lt.has(e.tagName)}function xi(e,t){const n=e[t];if(!n||!Lt.has(n.tagName))return null;const i=kn(n);for(let r=t+1;r<e.length;r++){const o=e[r];if(Lt.has(o.tagName)&&kn(o)<=i)return r}return e.length}function Xt(e){return Array.from(e.children)}function Si(e){return Xt(e).filter(t=>Gt(t)&&!!t.id)}function we(e,t,n){const i=Xt(e),r=i.indexOf(t);if(r<0)return;const o=xi(i,r);if(o===null)return;const a=t.querySelector(`button.${Jt}`);a&&(a.setAttribute("aria-expanded",n?"false":"true"),a.setAttribute("aria-label",n?"Expand section":"Collapse section"),a.title=n?"Expand section":"Collapse section"),t.classList.toggle(Or,n);for(let s=r+1;s<o;s++){const d=i[s];n?d.hasAttribute("hidden")||(d.setAttribute("hidden",""),d.setAttribute(lt,t.id)):d.getAttribute(lt)===t.id&&(d.removeAttribute("hidden"),d.removeAttribute(lt))}}function Dr(e,t){const n=t.id,i=!H.has(n);i?H.add(n):H.delete(n),we(e,t,i)}function Yt(e,t){for(const n of Si(e))t?H.add(n.id):H.delete(n.id),we(e,n,t)}function Kr(){R&&Yt(R,!1)}function Ur(){R&&Yt(R,!0)}function $t(e){if(!R||H.size===0||!e||!R.contains(e))return;const t=Xt(R);for(let n=0;n<t.length;n++){const i=t[n];if(!Gt(i)||!i.id||!H.has(i.id))continue;const r=xi(t,n);if(r!==null)for(let o=n+1;o<r;o++){const a=t[o];if(a===e||a.contains(e)){H.delete(i.id),we(R,i,!1);break}}}}function at(e){e&&$t(document.getElementById(e))}function Wr(e,t){const n=document.createElement("button");return n.type="button",n.className=Jt,n.setAttribute("aria-expanded","true"),n.setAttribute("aria-label","Collapse section"),n.title="Collapse section",n.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),Dr(e,t)}),n}let pe=null;function Br(){R&&pe===null&&(pe=[...H],Yt(R,!1))}function zr(){if(!(!R||!pe)){for(const e of pe){H.add(e);const t=document.getElementById(e);t&&Gt(t)&&R.contains(t)&&we(R,t,!0)}pe=null}}function qr(){bn||(window.addEventListener("beforeprint",Br),window.addEventListener("afterprint",zr),bn=!0)}const Vr={name:"collapsible-sections",run:e=>{R=e;const t=Qe.value;t!==wn&&(H.clear(),wn=t);const n=Si(e);for(const r of n)r.querySelector(`button.${Jt}`)||r.insertBefore(Wr(e,r),r.firstChild);const i=new Set(n.map(r=>r.id));for(const r of[...H])i.has(r)||H.delete(r);for(const r of n)we(e,r,H.has(r.id));qr()}};function jr(e){e.querySelectorAll("pre").forEach(n=>{var o;if(n.closest(".mermaid-block")||(o=n.parentElement)!=null&&o.classList.contains("pre-wrap"))return;const i=document.createElement("div");i.className="pre-wrap",n.replaceWith(i),i.appendChild(n);const r=document.createElement("button");r.type="button",r.className="copy-btn",r.textContent="Copy",r.setAttribute("aria-label","Copy code to clipboard"),r.addEventListener("click",async a=>{a.stopPropagation();const s=n.querySelector("code"),d=((s==null?void 0:s.textContent)??n.textContent??"").replace(/\s+$/,"");try{await navigator.clipboard.writeText(d),r.textContent="Copied",r.classList.add("is-copied")}catch{r.textContent="Failed"}window.setTimeout(()=>{r.textContent="Copy",r.classList.remove("is-copied")},1600)}),i.appendChild(r)})}function Jr(e){e.querySelectorAll("a[href]").forEach(n=>{if(n.dataset.externalProcessed==="1"||n.hasAttribute("data-internal-link"))return;const i=n.getAttribute("href")??"";if(/^https?:\/\//i.test(i)&&!n.classList.contains("heading-anchor")){if(n.target="_blank",n.rel="noopener noreferrer",n.classList.add("is-external"),!n.querySelector(".external-icon")){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","external-icon"),r.setAttribute("viewBox","0 0 12 12"),r.setAttribute("width","11"),r.setAttribute("height","11"),r.setAttribute("aria-hidden","true"),r.innerHTML='<path fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5h5v5M9.5 2.5L4 8M2.5 5.2v4.3h4.3"/>',n.appendChild(r)}n.dataset.externalProcessed="1"}})}const Ze=P(null);function xn(e,t){Ze.value={src:e,alt:t}}function Ae(){Ze.value=null}function Gr(e){e.querySelectorAll(".markdown-content img").forEach(n=>{n.dataset.lightboxWired!=="1"&&(n.closest(".mermaid-block")||(n.dataset.lightboxWired="1",n.classList.add("img-zoomable"),n.setAttribute("tabindex","0"),n.setAttribute("role","button"),n.setAttribute("aria-label",`Open ${n.alt||"image"} fullscreen`),n.addEventListener("click",()=>{xn(n.src,n.alt)}),n.addEventListener("keydown",i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),xn(n.src,n.alt))})))})}const Xr="modulepreload",Yr=function(e){return"/"+e},Sn={},Qt=function(t,n,i){let r=Promise.resolve();if(n&&n.length>0){let a=function(c){return Promise.all(c.map(h=>Promise.resolve(h).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const s=document.querySelector("meta[property=csp-nonce]"),d=(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"));r=a(n.map(c=>{if(c=Yr(c),c in Sn)return;Sn[c]=!0;const h=c.endsWith(".css"),u=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=h?"stylesheet":Xr,h||(f.as="script"),f.crossOrigin="",f.href=c,d&&f.setAttribute("nonce",d),document.head.appendChild(f),h)return new Promise((p,_)=>{f.addEventListener("load",p),f.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(a){const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=a,window.dispatchEvent(s),!s.defaultPrevented)throw a}return r.then(a=>{for(const s of a||[])s.status==="rejected"&&o(s.reason);return t().catch(o)})};let st=null,En=!1;function Qr(){return st||(st=Qt(()=>import("./katex-C5jXJg4s.js"),[])),st}async function Zr(){if(En)return;En=!0;const e=(await Qt(async()=>{const{default:n}=await import("./katex.min-DXaO1tdm.js");return{default:n}},[])).default,t=document.createElement("link");t.rel="stylesheet",t.href=e,document.head.appendChild(t)}async function eo(e){const t=e.querySelectorAll("span.math-inline:not([data-rendered])"),n=e.querySelectorAll("div.math-block:not([data-rendered])");if(t.length===0&&n.length===0)return;const[i]=await Promise.all([Qr(),Zr()]),r=i.default;for(const o of t){const a=decodeURIComponent(o.dataset.source??"");try{r.render(a,o,{displayMode:!1,throwOnError:!1})}catch(s){o.textContent=`[math error: ${s.message}]`}o.dataset.rendered="true"}for(const o of n){const a=decodeURIComponent(o.dataset.source??"");try{r.render(a,o,{displayMode:!0,throwOnError:!1})}catch(s){o.textContent=`[math error: ${s.message}]`}o.dataset.rendered="true"}}const to=/\.(md|markdown|mdx)$/i;function Cn(e){return e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0}function no(e){return!!(e.target&&e.target!==""&&e.target!=="_self"||e.hasAttribute("download"))}function io(e,t){e.addEventListener("click",n=>{const i=n.target.closest("a");if(!i)return;const r=i.matches("[data-internal-link]")?i.getAttribute("data-internal-link"):null;if(r!==null){if(Cn(n))return;n.preventDefault();const c=r??"",h=c.indexOf("#"),u=h>=0?c.slice(0,h):c,f=h>=0?c.slice(h):"";t(u,f);return}if(Cn(n)||no(i))return;const o=i.href;if(!o)return;let a;try{a=new URL(o)}catch{return}if(a.origin!==window.location.origin||!to.test(a.pathname))return;n.preventDefault();let s;try{s=decodeURIComponent(a.pathname)}catch{s=a.pathname}const d=s.replace(/^\/+/,"");t(d,a.hash)})}const ro=["light","dark"],Tt=window.matchMedia("(prefers-color-scheme: dark)");function oo(){try{const e=localStorage.getItem("mdview-theme");if(e==="light"||e==="dark")return e}catch{}return null}const Ei=oo(),Ci=hi("mdview-theme",Ei??(Tt.matches?"dark":"light"),ro),Z=Ci.signal,Li=P(Ei!==null);function lo(e){Ci.set(e),Li.value=!0}function $i(){lo(Z.value==="dark"?"light":"dark")}function ao(){return b(()=>{const e=t=>{Li.value||(Z.value=t.matches?"dark":"light")};return Tt.addEventListener("change",e),()=>Tt.removeEventListener("change",e)},[]),b(()=>{document.documentElement.dataset.theme=Z.value}),Z.value}let ct=null,so=0,Pt=null;function co(){return ct||(ct=Qt(()=>import("./mermaid.core-CVM43n3z.js").then(e=>e.cc),[])),ct}function uo(){return Z.value==="dark"?"dark":"default"}async function Ti(e){const t=e.querySelectorAll(".mermaid-block");if(t.length===0)return;const i=(await co()).default,r=uo();if(Pt!==r){i.initialize({startOnLoad:!1,theme:r,securityLevel:"strict"}),Pt=r;for(const o of Array.from(t))delete o.dataset.rendered}await Promise.all(Array.from(t).map(o=>ho(i,o)))}async function ho(e,t){if(t.dataset.rendered)return;const n=decodeURIComponent(t.dataset.source??""),i=`mermaid-${++so}`;try{if(!await e.parse(n,{suppressErrors:!0})){Ln(t,"syntax error");return}const{svg:o}=await e.render(i,n);t.innerHTML=o,t.dataset.rendered="true"}catch(r){Ln(t,r.message)}finally{fo(i)}}function Ln(e,t){const n=document.createElement("pre");n.className="mermaid-error",n.textContent=`Mermaid: ${t}`,e.replaceChildren(n),e.dataset.rendered="true"}function fo(e){for(const t of[e,`d${e}`]){const n=document.getElementById(t);n&&n.parentElement===document.body&&n.remove()}}Ge(()=>{if(Z.value,Pt===null)return;const e=document.querySelector(".markdown-content");e&&Ti(e)});function po(e){e.querySelectorAll(".markdown-content :is(h1,h2,h3,h4,h5,h6)[id]").forEach(n=>{if(n.querySelector(".heading-anchor"))return;const i=document.createElement("a");i.className="heading-anchor",i.href=`#${n.id}`,i.setAttribute("aria-label",`Copy link to ${n.textContent??""}`),i.title="Copy link to this section",i.textContent="#",i.addEventListener("click",async r=>{r.preventDefault();const a=new URLSearchParams(window.location.search).get("file"),s=`${window.location.origin}${window.location.pathname}${a?`?file=${encodeURIComponent(a)}`:""}#${n.id}`;try{await navigator.clipboard.writeText(s),i.textContent="✓",i.classList.add("is-copied")}catch{i.textContent="!"}window.setTimeout(()=>{i.textContent="#",i.classList.remove("is-copied")},1500)}),n.appendChild(i)})}const _o=[Vr,{name:"mermaid",run:e=>Ti(e)},{name:"math",run:e=>eo(e)},{name:"internal-links",run:(e,t)=>io(e,t.onInternalNavigate)},{name:"copy-buttons",run:e=>jr(e)},{name:"permalinks",run:e=>po(e)},{name:"external-links",run:e=>Jr(e)},{name:"image-lightbox",run:e=>Gr(e)}];function vo({file:e,onInternalNavigate:t}){const n=K(null),i=O(()=>Ar(e.html,e.outline),[e]);return b(()=>{n.current&&(n.current.innerHTML=e.html,Hr(n.current,{onInternalNavigate:t},_o))},[e]),b(()=>{n.current&&(xt.value?Nr(n.current,ge.value):Mr(n.current))},[xt.value,ge.value,e]),l("article",{class:"markdown-body",children:[e.frontmatter&&Object.keys(e.frontmatter).length>0&&l("details",{class:"frontmatter-block",children:[l("summary",{children:"frontmatter"}),l("pre",{children:l("code",{children:JSON.stringify(e.frontmatter,null,2)})})]}),i.words>0&&l("div",{class:"doc-stats","aria-label":"Document statistics",children:[l("span",{children:Ir(i)}),e.lastModified>0&&l(ee,{children:[l("span",{class:"doc-stats-sep","aria-hidden":!0,children:"·"}),l("span",{class:"doc-stats-updated",title:vr(e.lastModified),children:["Updated ",_r(e.lastModified)]})]})]}),l("div",{ref:n,class:"markdown-content"})]})}function mo(){return l("div",{class:"skeleton","aria-hidden":"true",children:[l("div",{class:"skeleton__h1"}),l("div",{class:"skeleton__meta"}),l("div",{class:"skeleton__line",style:{width:"94%"}}),l("div",{class:"skeleton__line",style:{width:"88%"}}),l("div",{class:"skeleton__line",style:{width:"76%"}}),l("div",{class:"skeleton__h2"}),l("div",{class:"skeleton__line",style:{width:"92%"}}),l("div",{class:"skeleton__line",style:{width:"84%"}}),l("div",{class:"skeleton__code"}),l("div",{class:"skeleton__line",style:{width:"90%"}}),l("div",{class:"skeleton__line",style:{width:"70%"}})]})}const go=["node_modules","dist","build","out","target","coverage","vendor","__pycache__","venv","Pods","DerivedData","_build"],A=e=>({width:e,height:e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":1.6,"stroke-linecap":"round","stroke-linejoin":"round"});function Pi({size:e=14,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:l("polyline",{points:"9 6 15 12 9 18"})})}function yo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:l("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z"})})}function wo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("path",{d:"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v1H3V7z"}),l("path",{d:"M3 9h18l-2 8a2 2 0 0 1-2 1.5H6A2 2 0 0 1 4 17L3 9z"})]})}function bo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9l-6-6z"}),l("polyline",{points:"14 3 14 9 20 9"})]})}function ko({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("path",{d:"M14 3H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9l-6-6z"}),l("polyline",{points:"14 3 14 9 20 9"}),l("path",{d:"M8 14l2 2 2-3 2 3 2-2"})]})}function xo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("circle",{cx:"12",cy:"12",r:"4"}),l("line",{x1:"12",y1:"2",x2:"12",y2:"5"}),l("line",{x1:"12",y1:"19",x2:"12",y2:"22"}),l("line",{x1:"2",y1:"12",x2:"5",y2:"12"}),l("line",{x1:"19",y1:"12",x2:"22",y2:"12"}),l("line",{x1:"4.5",y1:"4.5",x2:"6.6",y2:"6.6"}),l("line",{x1:"17.4",y1:"17.4",x2:"19.5",y2:"19.5"}),l("line",{x1:"4.5",y1:"19.5",x2:"6.6",y2:"17.4"}),l("line",{x1:"17.4",y1:"6.6",x2:"19.5",y2:"4.5"})]})}function So({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:l("path",{d:"M21 13.5A8.5 8.5 0 0 1 10.5 3a7 7 0 1 0 10.5 10.5z"})})}function Eo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),l("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),l("polyline",{points:"15 9 12 12 15 15"})]})}function Co({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),l("line",{x1:"9",y1:"4",x2:"9",y2:"20"}),l("polyline",{points:"13 9 16 12 13 15"})]})}function Lo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),l("line",{x1:"15",y1:"4",x2:"15",y2:"20"}),l("polyline",{points:"9 9 12 12 9 15"})]})}function $o({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("rect",{x:"3",y:"4",width:"18",height:"16",rx:"2"}),l("line",{x1:"15",y1:"4",x2:"15",y2:"20"}),l("polyline",{points:"11 9 8 12 11 15"})]})}function To({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("rect",{x:"2",y:"6",width:"20",height:"13",rx:"2"}),l("line",{x1:"6",y1:"10",x2:"6.01",y2:"10"}),l("line",{x1:"10",y1:"10",x2:"10.01",y2:"10"}),l("line",{x1:"14",y1:"10",x2:"14.01",y2:"10"}),l("line",{x1:"18",y1:"10",x2:"18.01",y2:"10"}),l("line",{x1:"6",y1:"14",x2:"6.01",y2:"14"}),l("line",{x1:"18",y1:"14",x2:"18.01",y2:"14"}),l("line",{x1:"9",y1:"14",x2:"15",y2:"14"})]})}function Po({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("circle",{cx:"12",cy:"12",r:"3"}),l("circle",{cx:"12",cy:"12",r:"9"})]})}function Ao({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("rect",{x:"4",y:"3",width:"16",height:"18",rx:"2"}),l("line",{x1:"8",y1:"7",x2:"14",y2:"7"}),l("line",{x1:"8",y1:"11",x2:"16",y2:"11"}),l("line",{x1:"8",y1:"15",x2:"12",y2:"15"}),l("line",{x1:"8",y1:"19",x2:"14",y2:"19"})]})}function Io({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("circle",{cx:"12",cy:"12",r:"3"}),l("path",{d:"M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.9-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.6 1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.9 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.6-1.1 1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.9.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"})]})}function Ai({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:l("polyline",{points:"20 6 9 17 4 12"})})}function No({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("polyline",{points:"4 9 4 4 9 4"}),l("polyline",{points:"20 9 20 4 15 4"}),l("polyline",{points:"4 15 4 20 9 20"}),l("polyline",{points:"20 15 20 20 15 20"})]})}function Mo({size:e=16,class:t}){return l("svg",{...A(e),class:t,"aria-hidden":!0,children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("line",{x1:"12",y1:"11",x2:"12",y2:"16"}),l("line",{x1:"12",y1:"8",x2:"12",y2:"8"})]})}const Ho=["Hidden from the tree to keep the watcher under the OS file-watch limit:","• dotfiles / dotdirs (.git, .next, .venv, …)",`• built-in heavy dirs: ${go.join(", ")}`,"","Add your own in ~/.config/mdview/config.json:",'{ "ignore": ["my-build-dir"] }',"","Restart mdview after editing."].join(`
|
|
2
|
-
`);function Ro({tree:e,currentPath:t,onSelect:n,onCollapse:i}){return l("div",{class:"pane-content",children:[l("div",{class:"pane-head",children:[l("span",{class:"pane-head-title",children:["Files",l("span",{class:"pane-head-info",role:"button",tabIndex:0,"aria-label":"Why some folders aren't shown","data-tooltip":Ho,"data-tooltip-multiline":!0,"data-tooltip-align":"left",children:l(Mo,{size:11})})]}),l("button",{class:"pane-head-btn","aria-label":"Hide file tree","data-tooltip":"Hide file tree (⌘B)","data-tooltip-align":"right",onClick:i,children:l(Eo,{size:14})})]}),e.length===0?l("p",{class:"tree-empty",children:["No folders open. Run ",l("code",{children:"mdview <path>"})," to add one."]}):l("ul",{class:"tree",role:"tree",children:e.map(r=>l(Ii,{node:r,currentPath:t,onSelect:n,depth:0},r.relPath))})]})}function Ii({node:e,currentPath:t,onSelect:n,depth:i}){const r=(t==null?void 0:t.startsWith(e.relPath+"/"))??!1,o=i===0&&!e.relPath.includes("/"),[a,s]=z(r||o);b(()=>{r&&s(!0)},[t]);const d=`${10+i*14}px`;if(e.type==="dir")return l("li",{class:"tree-li tree-li-dir",role:"treeitem","aria-expanded":a,children:[l("button",{class:`tree-item tree-dir ${a?"is-open":""} ${o?"tree-root":""}`,style:{paddingLeft:d},onClick:()=>s(p=>!p),children:[l("span",{class:`chev ${a?"open":""}`,"aria-hidden":!0,children:l(Pi,{size:12})}),l("span",{class:"tree-icon","aria-hidden":!0,children:a?l(wo,{size:15}):l(yo,{size:15})}),l("span",{class:"name",children:e.name})]}),a&&e.children&&e.children.length>0&&l("ul",{class:"tree-children",style:{paddingLeft:`${10+i*14+7}px`},children:e.children.map(p=>l(Ii,{node:p,currentPath:t,onSelect:n,depth:i+1},p.relPath))})]});const c=e.isMarkdown??!1,h=t===e.relPath,u=`tree-item tree-file ${c?"":"is-disabled"} ${h?"is-current":""}`,f=c?`/?file=${encodeURIComponent(e.relPath)}`:void 0;return l("li",{class:"tree-li tree-li-file",role:"treeitem",children:c?l("a",{class:u,style:{paddingLeft:d},href:f,title:e.name,onClick:p=>{p.metaKey||p.ctrlKey||p.shiftKey||p.altKey||(p.preventDefault(),n(e.relPath))},children:[l("span",{class:"tree-icon","aria-hidden":!0,children:l(ko,{size:14})}),l("span",{class:"name",children:e.name})]}):l("span",{class:u,style:{paddingLeft:d},title:e.name,children:[l("span",{class:"tree-icon","aria-hidden":!0,children:l(bo,{size:14})}),l("span",{class:"name",children:e.name})]})})}const et=P(!1);function Ni(){et.value=!0}function Ie(){et.value=!1}function Mi(e,t,n=[]){for(const i of e){const r=[...n,i];if(i.id===t)return r;const o=Mi(i.children,t,r);if(o)return o}return null}function $n(e){return e.trim().toLowerCase()}function Fo({outline:e,fileName:t,onJump:n}){var o;const i=U.value;let r=i?Mi(e,i)??[]:[];return t&&r.length>0&&((o=r[0])==null?void 0:o.level)===1&&$n(r[0].text)===$n(t)&&(r=r.slice(1)),l("nav",{class:"breadcrumbs","aria-label":"Current section",children:[t&&l("button",{type:"button",class:"bc-item bc-root",onClick:()=>n(null),title:"Scroll to top",children:t}),r.map((a,s)=>{const d=s===r.length-1;return l("span",{class:"bc-step",children:[l("span",{class:"bc-sep","aria-hidden":!0,children:"›"}),l("button",{type:"button",class:`bc-item${d?" is-current":""}`,onClick:()=>n(a.id),"aria-current":d?"location":void 0,children:a.text})]},a.id)})]})}const Hi="mdview-palette";function Oo(){try{const e=localStorage.getItem(Hi);if(e&&Je.includes(e))return e}catch{}return null}const Ri=Oo(),Fi=hi(Hi,Ri??"flexoki",Je),oe=Fi.signal,Oi=P(Ri!==null);function Di(e){Fi.set(e),Oi.value=!0}function Do(){return b(()=>{var e;!Oi.value&&((e=mt.value)!=null&&e.palette)&&(oe.value=mt.value.palette)}),b(()=>{document.documentElement.dataset.palette=oe.value}),oe.value}const Ko={flexoki:"Flexoki",paper:"Paper",solarized:"Solarized",everforest:"Everforest","rose-pine":"Rosé Pine",kanagawa:"Kanagawa",catppuccin:"Catppuccin","high-contrast":"High contrast"};function ut({icon:e,label:t,shortcut:n,on:i,onToggle:r}){return l("button",{class:`view-menu-row${i?" is-on":""}`,role:"menuitemcheckbox","aria-checked":i,onClick:r,children:[l("span",{class:"view-menu-icon","aria-hidden":!0,children:e}),l("span",{class:"view-menu-label",children:t}),n&&l("span",{class:"view-menu-kbd","aria-hidden":!0,children:n}),l("span",{class:"view-menu-check","aria-hidden":!0,children:i?l(Ai,{size:14}):null})]})}function Uo(){const[e,t]=z(!1),n=K(null);b(()=>{if(!e)return;function s(c){var h;(h=n.current)!=null&&h.contains(c.target)||t(!1)}function d(c){c.key==="Escape"&&t(!1)}return document.addEventListener("mousedown",s),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",s),document.removeEventListener("keydown",d)}},[e]);const i=xt.value,r=St.value,o=fi.value,a=oe.value;return l("div",{class:"view-menu",ref:n,children:[l("button",{class:`icon-btn${e?" is-active":""}`,"aria-label":"View settings","data-tooltip":"View settings","aria-haspopup":"menu","aria-expanded":e,onClick:()=>t(s=>!s),children:l(Io,{})}),e&&l("div",{class:"view-menu-popover",role:"menu","aria-label":"View settings",children:[l("div",{class:"view-menu-section",children:[l(ut,{icon:l(Po,{size:14}),label:"Focus mode",shortcut:"f",on:i,onToggle:pi}),l(ut,{icon:l(Ao,{size:14}),label:"Minimap",shortcut:"m",on:r,onToggle:_i}),l(ut,{icon:l(No,{size:14}),label:"Wide layout",on:o,onToggle:vi})]}),l("div",{class:"view-menu-divider"}),l("div",{class:"view-menu-section",children:[l("div",{class:"view-menu-heading",children:"Palette"}),Je.map(s=>l("button",{role:"menuitemradio","aria-checked":a===s,class:`view-menu-row view-menu-palette${a===s?" is-on":""}`,onClick:()=>Di(s),children:[l("span",{class:`palette-swatch palette-swatch-${s}`,"aria-hidden":!0}),l("span",{class:"view-menu-label",children:Ko[s]}),l("span",{class:"view-menu-check","aria-hidden":!0,children:a===s?l(Ai,{size:14}):null})]},s))]})]})]})}function Wo({outline:e,fileName:t,onJumpHeading:n}){const i=Z.value,r=i==="dark"?"Switch to light (⌘\\)":"Switch to dark (⌘\\)";return l("div",{class:"header-inner",children:[l("div",{class:"header-left",children:l("span",{class:"brand",children:"mdview"})}),l("div",{class:"header-center",children:l(Fo,{outline:e,fileName:t,onJump:n})}),l("div",{class:"header-right",children:[l(Uo,{}),l("button",{class:"icon-btn theme-btn","aria-label":r,"data-tooltip":r,onClick:$i,children:i==="dark"?l(xo,{}):l(So,{})}),l("button",{class:"icon-btn","aria-label":"Keyboard shortcuts","data-tooltip":"Shortcuts (?)","data-tooltip-align":"right",onClick:Ni,children:l(To,{})})]})]})}function Bo(){const e=Ze.value;return b(()=>{if(!e)return;function t(i){i.key==="Escape"&&Ae()}window.addEventListener("keydown",t);const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",t),document.body.style.overflow=n}},[e]),e?l("div",{class:"lightbox-overlay",role:"dialog","aria-modal":"true","aria-label":e.alt||"Image preview",onClick:Ae,children:[l("button",{type:"button",class:"lightbox-close","aria-label":"Close image preview",onClick:t=>{t.stopPropagation(),Ae()},children:"×"}),l("img",{class:"lightbox-img",src:e.src,alt:e.alt,onClick:t=>t.stopPropagation()})]}):null}const ye=P(null);function zo(e){ye.value=e}function tt(e){const t=[];for(const n of e)t.push({id:n.id,level:n.level}),t.push(...tt(n.children));return t}function Tn(e,t,n){var a,s;const i=tt(e);if(i.length===0)return null;if(!t)return n===1?((a=i[0])==null?void 0:a.id)??null:((s=i[i.length-1])==null?void 0:s.id)??null;const r=i.findIndex(d=>d.id===t);if(r<0)return null;const o=i[r].level;if(n===1){for(let d=r+1;d<i.length;d++)if(i[d].level===o)return i[d].id}else for(let d=r-1;d>=0;d--)if(i[d].level===o)return i[d].id;return null}function qo(e,t){if(!e)return[];const n=tt(t),i=e.scrollHeight;if(i===0)return[];const r=[],o=e.getBoundingClientRect();for(const{id:a,level:s}of n){const d=e.querySelector(`#${CSS.escape(a)}`);if(!d)continue;const u=(d.getBoundingClientRect().top-o.top+e.scrollTop)/i;r.push({id:a,level:s,ratio:Math.max(0,Math.min(1,u))})}return r}function Vo({outline:e}){const t=ye.value,[n,i]=z([]),[r,o]=z({top:0,height:0}),a=K(null);b(()=>{if(!t)return;const c=()=>i(qo(t,e));c();const h=new ResizeObserver(c);return h.observe(t),()=>h.disconnect()},[t,e]),b(()=>{if(!t)return;const c=()=>{const h=t.scrollHeight||1;o({top:t.scrollTop/h,height:t.clientHeight/h})};return c(),t.addEventListener("scroll",c,{passive:!0}),()=>t.removeEventListener("scroll",c)},[t]);function s(c){const h=a.current;if(!h||!t)return;const u=h.getBoundingClientRect(),f=Math.max(0,Math.min(1,(c-u.top)/u.height));t.scrollTo({top:f*t.scrollHeight,behavior:"smooth"})}if(!t||n.length===0)return null;const d=U.value;return l("div",{ref:a,class:"minimap",role:"navigation","aria-label":"Document minimap",onClick:c=>s(c.clientY),children:[n.map(c=>l("div",{class:`minimap-bar minimap-level-${c.level}${d===c.id?" is-active":""}`,style:{top:`${(c.ratio*100).toFixed(2)}%`},title:c.id},c.id)),l("div",{class:"minimap-viewport",style:{top:`${(r.top*100).toFixed(2)}%`,height:`${(r.height*100).toFixed(2)}%`}})]})}const G=1,le=6,Be=Ye("mdview-outline-min-level",G,{min:G,max:le}),ze=Ye("mdview-outline-max-level",le,{min:G,max:le}),Ki=Be.signal,Ui=ze.signal;function jo(e){Be.set(e),e>ze.signal.value&&ze.set(e)}function Jo(e){ze.set(e),e<Be.signal.value&&Be.set(e)}const Go=ri(()=>{const e=Ki.value,t=Ui.value,n=new Set;for(let i=e;i<=t;i++)n.add(i);return n});function Wi(e,t){const n=[];for(const i of e){const r=Wi(i.children,t);t.has(i.level)?n.push({...i,children:r}):n.push(...r)}return n}function Xo({nodes:e,onJump:t,onCollapse:n}){const i=Go.value,r=Ki.value,o=Ui.value,a=O(()=>Wi(e,i),[e,i]),s=r===o?`H${r}`:`H${r}–H${o}`,d=le-G,c=(r-G)/d*100,h=100-(o-G)/d*100;return l("nav",{class:"outline","aria-label":"Document outline",children:[l("div",{class:"outline-head",children:[l("button",{class:"pane-head-btn","aria-label":"Hide outline","data-tooltip":"Hide outline (⌘.)","data-tooltip-align":"left",onClick:n,children:l(Lo,{size:14})}),l("span",{class:"outline-title",children:"On this page"}),l("div",{class:"outline-depth","data-tooltip":`Show ${s}`,"data-tooltip-align":"right",children:[l("span",{class:"outline-depth-label","aria-hidden":!0,children:s}),l("div",{class:"outline-depth-range",role:"group","aria-label":"Heading depth range",children:[l("div",{class:"outline-depth-track","aria-hidden":!0,children:l("div",{class:"outline-depth-track-fill",style:`left:${c}%;right:${h}%`})}),l("input",{type:"range",class:"outline-depth-slider outline-depth-slider-min",min:G,max:le,step:1,value:r,"aria-label":`Minimum heading level (currently H${r})`,onInput:u=>{const f=Number(u.currentTarget.value);Number.isFinite(f)&&jo(f)}}),l("input",{type:"range",class:"outline-depth-slider outline-depth-slider-max",min:G,max:le,step:1,value:o,"aria-label":`Maximum heading level (currently H${o})`,onInput:u=>{const f=Number(u.currentTarget.value);Number.isFinite(f)&&Jo(f)}})]})]})]}),a.length===0?l("div",{class:"outline-empty",children:e.length===0?"No headings":"All levels hidden"}):l("ul",{children:a.map(u=>l(Bi,{node:u,onJump:t,depth:0},u.id))})]})}function Bi({node:e,onJump:t,depth:n}){const[i,r]=z(!1),o=e.children.length>0,a=U.value===e.id,s=Math.min(n,5);return l("li",{class:`outline-li depth-${s}`,children:[l("div",{class:`outline-row ${a?"is-active":""}`,children:[o?l("button",{class:`outline-toggle ${i?"":"open"}`,"aria-label":i?"Expand section":"Collapse section",onClick:d=>{d.stopPropagation(),r(c=>!c)},children:l(Pi,{size:11})}):l("span",{class:"outline-toggle is-spacer","aria-hidden":!0}),l("button",{class:"outline-link",onClick:()=>t(e.id),title:e.text,children:e.text})]}),o&&!i&&l("ul",{class:"outline-children",children:e.children.map(d=>l(Bi,{node:d,onJump:t,depth:n+1},d.id))})]})}function Yo({scroller:e,trigger:t}){const[n,i]=z(0);return b(()=>{if(!e)return;let r=0;function o(){if(!e)return;const s=e.scrollHeight-e.clientHeight;if(s<=0){i(0);return}const d=Math.max(0,Math.min(1,e.scrollTop/s));i(d)}function a(){cancelAnimationFrame(r),r=requestAnimationFrame(o)}return e.addEventListener("scroll",a,{passive:!0}),o(),()=>{cancelAnimationFrame(r),e.removeEventListener("scroll",a)}},[e,t]),l("div",{class:"reading-progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.round(n*100),"aria-label":"Reading progress",children:l("div",{class:"reading-progress__bar",style:{width:`${n*100}%`}})})}function Pn(e){const t=K(null),n=K(e);return n.current=e,b(()=>{const i=t.current;if(!i)return;let r=null;function o(d){if(!r)return;const{side:c,onResize:h,min:u,max:f}=n.current,p=d.clientX-r.startX,_=c==="left"?r.startWidth+p:r.startWidth-p;h(Math.min(f,Math.max(u,_)))}function a(){if(!r)return;const{collapseAt:d,onCollapse:c,getCurrent:h}=n.current,u=h(),f=t.current;try{f==null||f.releasePointerCapture(r.pointerId)}catch{}r=null,document.body.style.cursor="",document.body.style.userSelect="",window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",a),u<d&&c()}function s(d){r={startX:d.clientX,startWidth:n.current.getCurrent(),pointerId:d.pointerId};try{i.setPointerCapture(d.pointerId)}catch{}document.body.style.cursor="col-resize",document.body.style.userSelect="none",window.addEventListener("pointermove",o),window.addEventListener("pointerup",a),d.preventDefault()}return i.addEventListener("pointerdown",s),()=>{if(i.removeEventListener("pointerdown",s),window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",a),r){try{i.releasePointerCapture(r.pointerId)}catch{}document.body.style.cursor="",document.body.style.userSelect=""}}},[]),l("div",{ref:t,class:`resizer resizer-${e.side}`,role:"separator","aria-orientation":"vertical","aria-label":e.ariaLabel})}const nt=P(!1),Zt=P("doc"),At=X("mdview-search-case",!1),It=X("mdview-search-word",!1),Nt=X("mdview-search-regex",!1),Qo=At.signal,Zo=It.signal,el=Nt.signal;function tl(){At.set(!At.signal.value)}function nl(){It.set(!It.signal.value)}function il(){Nt.set(!Nt.signal.value)}function dt(e="doc"){Zt.value=e,nt.value=!0}function _e(){nt.value=!1}function rl(e){Zt.value=e}function An(e,t){let n=null,i=null;const r=((...o)=>{i=o,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=i;i=null,a&&e(...a)},t)});return r.cancel=()=>{n!==null&&(clearTimeout(n),n=null),i=null},r.flush=()=>{if(n===null)return;clearTimeout(n),n=null;const o=i;i=null,o&&e(...o)},r}async function ol(e,t,n){const i=new URLSearchParams({q:e});t.caseSensitive&&i.set("case","1"),t.wholeWord&&i.set("word","1"),t.regex&&i.set("regex","1");const r=await fetch(`/api/search?${i.toString()}`,{signal:n});if(!r.ok)throw new Error(`HTTP ${r.status}`);return await r.json()}const ll={caseSensitive:!1,wholeWord:!1,regex:!1};function al(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function sl(e,t){if(!e)return{test:()=>null,matchAll:()=>[],matchAllWithBudget:()=>({matches:[],truncated:!1}),query:e,valid:!0};let n;if(t.regex)try{n=new RegExp(e,t.caseSensitive?"g":"gi")}catch{return{test:()=>null,matchAll:()=>[],matchAllWithBudget:()=>({matches:[],truncated:!1}),query:e,valid:!1}}else{let i=al(e);t.wholeWord&&(i=`\\b${i}\\b`),n=new RegExp(i,t.caseSensitive?"g":"gi")}return{query:e,valid:!0,test(i){return n.lastIndex=0,n.exec(i)},matchAll(i){n.lastIndex=0;const r=[];let o;for(;(o=n.exec(i))!==null;){if(o[0].length===0){n.lastIndex++;continue}r.push({index:o.index,length:o[0].length})}return r},matchAllWithBudget(i,r){n.lastIndex=0;const o=[],a=performance.now()+r;let s;for(;(s=n.exec(i))!==null;){if(s[0].length===0){n.lastIndex++;continue}if(o.push({index:s.index,length:s[0].length}),performance.now()>a)return{matches:o,truncated:!0}}return{matches:o,truncated:!1}}}}const it="search-hit",Mt="is-active";function xe(e){e.querySelectorAll(`mark.${it}`).forEach(n=>{const i=n.parentNode;if(i){for(;n.firstChild;)i.insertBefore(n.firstChild,n);i.removeChild(n),i.normalize()}})}function cl(e){let t=e.parentNode;for(;t;){if(t instanceof HTMLElement&&t.tagName==="MARK"&&t.classList.contains(it))return!0;t=t.parentNode}return!1}function ul(e,t,n=ll){if(!t)return[];const i=sl(t,n);if(!i.valid)return[];const r=[],o=e.querySelector(".markdown-content")??e,a=document.createTreeWalker(o,NodeFilter.SHOW_TEXT,{acceptNode(d){if(!d.nodeValue||cl(d))return NodeFilter.FILTER_REJECT;const c=d.parentElement;return!c||c.closest(".heading-anchor, .copy-btn, .external-icon, .search-bar")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let s=a.nextNode();for(;s;){const d=s.nodeValue??"";for(const c of i.matchAll(d))r.push({node:s,start:c.index,end:c.index+c.length});s=a.nextNode()}return r}function dl(e,t){const n=[],i=new Map;e.forEach(o=>{const a=i.get(o.node)??[];a.push(o),i.set(o.node,a)});const r=new Map;return e.forEach((o,a)=>{r.set(o,a)}),i.forEach((o,a)=>{var h;o.sort((u,f)=>u.start-f.start);let s=0;const d=a.parentNode;if(!d)return;const c=document.createDocumentFragment();o.forEach(u=>{u.start>s&&c.appendChild(document.createTextNode(a.nodeValue.slice(s,u.start)));const f=document.createElement("mark");f.className=it;const p=r.get(u);p===t&&f.classList.add(Mt),f.dataset.hit=String(p),f.textContent=a.nodeValue.slice(u.start,u.end),c.appendChild(f),n.push(f),s=u.end}),s<(((h=a.nodeValue)==null?void 0:h.length)??0)&&c.appendChild(document.createTextNode(a.nodeValue.slice(s))),d.replaceChild(c,a)}),n}function hl(e,t){const n=e.querySelectorAll(`mark.${it}`);let i=null;return n.forEach(r=>{Number(r.dataset.hit??-1)===t?(r.classList.add(Mt),i=r):r.classList.remove(Mt)}),i}const fl=250,pl=150;function _l({scroller:e,fileTrigger:t,onOpenFile:n}){const[i,r]=z(""),o=Zt.value,a=Qo.value,s=Zo.value,d=el.value,c=K(null),h=j([]),u=j(0),f=j(0),p=j(null),_=j(!1),m=j(null),w=j(0);b(()=>{var v,C;(v=c.current)==null||v.focus(),(C=c.current)==null||C.select()},[]);const k=O(()=>An((v,C,D)=>{xe(v);const ne=ul(v,C,D);h.value=ne,u.value=0,ne.length>0?(dl(ne,0),f.value=v.querySelectorAll("mark.search-hit").length,requestAnimationFrame(()=>{const V=v.querySelector("mark.search-hit.is-active");V&&($t(V),V.scrollIntoView({behavior:"smooth",block:"center"}))})):f.value=0},pl),[]);b(()=>{if(o==="doc"&&e){if(!i.trim()){k.cancel(),xe(e),h.value=[],u.value=0,f.value=0;return}return k(e,i,{caseSensitive:a,wholeWord:s,regex:d}),()=>k.cancel()}},[i,o,e,t,a,s,d]),b(()=>{if(o!=="doc"||!e||h.value.length===0)return;const v=hl(e,u.value);v&&($t(v),v.scrollIntoView({behavior:"smooth",block:"center"}))},[u.value,o,e,h.value.length]);const g=K(null),I=O(()=>An((v,C)=>{var ne;(ne=g.current)==null||ne.abort();const D=new AbortController;g.current=D,(async()=>{try{const V=await ol(v,C,D.signal);if(D.signal.aborted)return;p.value=V,m.value=null,w.value=0}catch(V){if(V.name==="AbortError")return;m.value=V.message}finally{g.current===D&&(g.current=null),D.signal.aborted||(_.value=!1)}})()},fl),[]);b(()=>{var v;if(o==="folder"){if(!i.trim()){I.cancel(),(v=g.current)==null||v.abort(),g.current=null,p.value=null,m.value=null,_.value=!1;return}return _.value=!0,I(i.trim(),{caseSensitive:a,wholeWord:s,regex:d}),()=>{var C;I.cancel(),(C=g.current)==null||C.abort(),g.current=null}}},[i,o,a,s,d]),b(()=>()=>{e&&xe(e)},[e]),b(()=>{o!=="doc"&&e&&xe(e)},[o,e]);function M(){if(o==="doc"){if(h.value.length===0)return;u.value=(u.value+1)%h.value.length}else{const v=ht(p.value);if(v.length===0)return;w.value=(w.value+1)%v.length}}function F(){if(o==="doc"){if(h.value.length===0)return;u.value=(u.value-1+h.value.length)%h.value.length}else{const v=ht(p.value);if(v.length===0)return;w.value=(w.value-1+v.length)%v.length}}function q(){const C=ht(p.value)[w.value];C&&(n(C.relPath),_e())}function y(v){v!==o&&rl(v)}function x(v){v.key==="Escape"?(v.preventDefault(),_e()):v.key==="Tab"?(v.preventDefault(),y(o==="doc"?"folder":"doc")):v.key==="Enter"?(v.preventDefault(),o==="doc"?v.shiftKey?F():M():q()):v.key==="ArrowDown"?(v.preventDefault(),M()):v.key==="ArrowUp"&&(v.preventDefault(),F())}return l("div",{class:"search-bar",role:"search","aria-label":"Find",children:[l("div",{class:"search-scope",role:"tablist","aria-label":"Search scope",children:[l("button",{type:"button",role:"tab","aria-selected":o==="doc",class:`scope-pill${o==="doc"?" is-active":""}`,"data-tooltip":"Search in document (Tab)","data-tooltip-side":"top",onClick:()=>y("doc"),tabIndex:-1,children:"Doc"}),l("button",{type:"button",role:"tab","aria-selected":o==="folder",class:`scope-pill${o==="folder"?" is-active":""}`,"data-tooltip":"Search across folder (⇧⌘F)","data-tooltip-side":"top",onClick:()=>y("folder"),tabIndex:-1,children:"Folder"})]}),l("input",{ref:c,type:"search",class:"search-input",placeholder:o==="doc"?"Find in document":"Find in folder",value:i,onInput:v=>r(v.target.value),onKeyDown:x,"aria-label":"Search query"}),l("div",{class:"search-options",role:"group","aria-label":"Search options",children:[l("button",{type:"button",class:`search-opt${a?" is-on":""}`,"aria-pressed":a,title:"Match case",onClick:tl,tabIndex:-1,children:"Aa"}),l("button",{type:"button",class:`search-opt${s?" is-on":""}`,"aria-pressed":s,title:"Whole word",onClick:nl,tabIndex:-1,children:"ab"}),l("button",{type:"button",class:`search-opt${d?" is-on":""}`,"aria-pressed":d,title:"Regular expression",onClick:il,tabIndex:-1,children:".*"})]}),l("span",{class:"search-count","aria-live":"polite",children:ml(o,i.trim(),u.value,f.value,_.value,p.value)}),l("button",{type:"button",class:"search-btn",onClick:F,"aria-label":"Previous match",title:"Previous (↑ / Shift+Enter)",children:"↑"}),l("button",{type:"button",class:"search-btn",onClick:M,"aria-label":"Next match",title:"Next (↓ / Enter)",children:"↓"}),l("button",{type:"button",class:"search-btn search-close",onClick:_e,"aria-label":"Close search",title:"Close (Esc)",children:"×"}),o==="folder"&&l(gl,{state:p.value,loading:_.value,error:m.value,query:i.trim(),activeIndex:w.value,onHover:v=>w.value=v,onPick:v=>{w.value=v,q()}})]})}function ht(e){if(!e)return[];const t=[];for(const n of e.results)for(const i of n.hits)t.push({relPath:n.relPath,fileTotal:n.total,fileTruncated:n.truncated,hit:i});return t}function vl(e){if(e.results.length===0)return"No matches";const t=e.results.reduce((r,o)=>r+o.total,0),n=e.results.length===1?"file":"files",i=e.truncated?"+":"";return`${t}${i} hits in ${e.results.length} ${n}`}function ml(e,t,n,i,r,o){return e==="doc"?t?i===0?"No matches":`${Math.min(n+1,i)} / ${i}`:"":r?"…":o?vl(o):""}function gl({state:e,loading:t,error:n,query:i,activeIndex:r,onHover:o,onPick:a}){if(!i)return null;if(t&&!e)return l("div",{class:"search-results",children:l("div",{class:"search-empty",children:"Searching…"})});if(n)return l("div",{class:"search-results",children:l("div",{class:"search-empty",children:["Error: ",n]})});if(!e||e.results.length===0)return l("div",{class:"search-results",children:l("div",{class:"search-empty",children:"No matches"})});let s=0;return l("div",{class:"search-results",children:[e.results.map(d=>l("section",{class:"search-file-group",children:[l("header",{class:"search-file-head",children:[l("span",{class:"search-file-path",children:d.relPath}),l("span",{class:"search-file-count",children:[d.total,d.truncated?"+":""," hits"]})]}),l("ul",{children:d.hits.map(c=>{const h=s++;return l("li",{class:`search-hit-row${h===r?" is-active":""}`,onMouseEnter:()=>o(h),onClick:()=>a(h),children:[l("span",{class:"search-hit-line",children:["L",c.line]}),l("span",{class:"search-hit-snippet",children:yl(c.snippet,c.highlight)})]},`${d.relPath}:${c.line}:${c.col}`)})})]},d.relPath)),e.truncated&&l("div",{class:"search-empty",children:"More results truncated — refine your query."})]})}function yl(e,t){const[n,i]=t;return l(ee,{children:[l("span",{children:e.slice(0,n)}),l("mark",{class:"search-hit",children:e.slice(n,i)}),l("span",{children:e.slice(i)})]})}const wl=typeof navigator<"u"&&/mac/i.test(navigator.platform||navigator.userAgent),ie=wl?"⌘":"Ctrl";function L(e){return e.metaKey||e.ctrlKey}function In(e,t){const n=tt(e.outline).map(r=>r.id);if(n.length===0)return;const i=U.value;if(t===1){const r=i?n.indexOf(i):-1,o=n[Math.min(r+1,n.length-1)];o&&e.onJumpHeading(o)}else{const r=i?n.indexOf(i):n.length,o=n[Math.max(r-1,0)];o&&e.onJumpHeading(o)}}function Nn(e){var a;const t=se.value;if(!t)return null;const n=si(t.tree);if(n.length===0)return null;const i=Qe.value,r=i?n.findIndex(s=>s.relPath===i):-1;if(r<0)return((a=n[0])==null?void 0:a.relPath)??null;const o=r+e;return o<0||o>=n.length?null:n[o].relPath}function Mn(e){const t=ye.value;t&&t.scrollBy({top:e*(t.clientHeight/2),behavior:"smooth"})}let Ne=0;const bl=600,zi=[{id:"palette",group:"Find",label:"Switch file (quick switcher)",displayKeys:[ie,"P"],whenTyping:"allow",match:e=>L(e)&&e.key.toLowerCase()==="p",run:()=>cr()},{id:"search-doc-meta",group:"Find",label:"Open in-doc search",displayKeys:[ie,"F"],whenTyping:"allow",match:e=>L(e)&&!e.shiftKey&&e.key.toLowerCase()==="f",run:()=>dt("doc")},{id:"search-folder-meta",group:"Find",label:"Open folder-wide search",displayKeys:[ie,"⇧","F"],whenTyping:"allow",match:e=>L(e)&&e.shiftKey&&e.key.toLowerCase()==="f",run:()=>dt("folder")},{id:"search-doc-slash",group:"Find",label:"Open search (no modifier)",displayKeys:["/"],whenTyping:"block",match:e=>!L(e)&&e.key==="/",run:()=>dt("doc")},{id:"shortcuts-panel",group:"View",label:"Show shortcuts panel",displayKeys:["?"],whenTyping:"block",match:e=>!L(e)&&e.key==="?",run:()=>Ni()},{id:"toggle-tree",group:"View",label:"Toggle file tree",displayKeys:[ie,"B"],whenTyping:"allow",match:e=>L(e)&&e.key.toLowerCase()==="b",run:()=>$e()},{id:"toggle-outline",group:"View",label:"Toggle outline",displayKeys:[ie,"."],whenTyping:"allow",match:e=>L(e)&&e.key===".",run:()=>Te()},{id:"toggle-theme",group:"View",label:"Toggle theme",displayKeys:[ie,"\\"],whenTyping:"allow",match:e=>L(e)&&e.key==="\\",run:()=>$i()},{id:"toggle-focus",group:"View",label:"Toggle focus mode",displayKeys:["f"],whenTyping:"block",match:e=>!L(e)&&!e.shiftKey&&e.key==="f",run:()=>pi()},{id:"toggle-minimap",group:"View",label:"Toggle minimap",displayKeys:["m"],whenTyping:"block",match:e=>!L(e)&&!e.shiftKey&&e.key==="m",run:()=>_i()},{id:"toggle-wide-layout",group:"View",label:"Toggle wide layout",displayKeys:["w"],whenTyping:"block",match:e=>!L(e)&&!e.shiftKey&&e.key==="w",run:()=>vi()},{id:"expand-all-sections",group:"View",label:"Expand all sections",displayKeys:["e"],whenTyping:"block",match:e=>!L(e)&&!e.shiftKey&&e.key==="e",run:()=>Kr()},{id:"collapse-all-sections",group:"View",label:"Collapse all sections",displayKeys:["⇧","E"],whenTyping:"block",match:e=>!L(e)&&e.shiftKey&&e.key==="E",run:()=>Ur()},{id:"next-heading",group:"Navigation",label:"Next heading",displayKeys:["j"],whenTyping:"block",match:e=>!L(e)&&e.key==="j",run:e=>In(e,1)},{id:"prev-heading",group:"Navigation",label:"Previous heading",displayKeys:["k"],whenTyping:"block",match:e=>!L(e)&&e.key==="k",run:e=>In(e,-1)},{id:"doc-top",group:"Navigation",label:"Top of document (gg)",displayKeys:["g","g"],whenTyping:"block",match:e=>{if(L(e)||e.shiftKey||e.key!=="g")return!1;const t=performance.now();return t-Ne<bl?(Ne=0,!0):(Ne=t,!1)},run:()=>{const e=ye.value;e&&e.scrollTo({top:0,behavior:"smooth"})}},{id:"doc-bottom",group:"Navigation",label:"Bottom of document",displayKeys:["⇧","G"],whenTyping:"block",match:e=>!L(e)&&e.shiftKey&&e.key==="G",run:()=>{const e=ye.value;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})}},{id:"next-file",group:"Navigation",label:"Next file",displayKeys:["⇧","L"],whenTyping:"block",match:e=>!L(e)&&e.shiftKey&&e.key==="L",run:e=>{const t=Nn(1);t&&e.navigate(t)}},{id:"prev-file",group:"Navigation",label:"Previous file",displayKeys:["⇧","H"],whenTyping:"block",match:e=>!L(e)&&e.shiftKey&&e.key==="H",run:e=>{const t=Nn(-1);t&&e.navigate(t)}},{id:"next-same-level",group:"Navigation",label:"Next heading at same level",displayKeys:["]"],whenTyping:"block",match:e=>!L(e)&&e.key==="]",run:e=>{const t=Tn(e.outline,U.value,1);t&&e.onJumpHeading(t)}},{id:"prev-same-level",group:"Navigation",label:"Previous heading at same level",displayKeys:["["],whenTyping:"block",match:e=>!L(e)&&e.key==="[",run:e=>{const t=Tn(e.outline,U.value,-1);t&&e.onJumpHeading(t)}},{id:"half-page-down",group:"Navigation",label:"Half page down",displayKeys:["Ctrl","D"],whenTyping:"block",match:e=>e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.key.toLowerCase()==="d",run:()=>Mn(1)},{id:"half-page-up",group:"Navigation",label:"Half page up",displayKeys:["Ctrl","U"],whenTyping:"block",match:e=>e.ctrlKey&&!e.metaKey&&!e.shiftKey&&e.key.toLowerCase()==="u",run:()=>Mn(-1)}],kl=[{id:"esc-close",group:"Navigation",label:"Close search / lightbox / panel",displayKeys:["Esc"],match:()=>!1,run:()=>{}},{id:"enter-next",group:"Find",label:"Next match (in search)",displayKeys:["Enter"],match:()=>!1,run:()=>{}},{id:"shift-enter-prev",group:"Find",label:"Previous match (in search)",displayKeys:["⇧","Enter"],match:()=>!1,run:()=>{}}];function Hn(e){e.key!=="g"&&(Ne=0)}const Rn=["Navigation","Find","View"];function xl(e){var n;const t=new Map;for(const i of Rn)t.set(i,[]);for(const i of e)(n=t.get(i.group))==null||n.push(i);return Rn.map(i=>({heading:i,items:t.get(i)??[]}))}function Sl(){const e=et.value,t=O(()=>xl([...zi,...kl]),[]);return b(()=>{if(!e)return;function n(i){i.key==="Escape"&&Ie()}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e]),e?l("div",{class:"shortcuts-overlay",role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",onClick:Ie,children:l("div",{class:"shortcuts-panel",onClick:n=>n.stopPropagation(),children:[l("div",{class:"shortcuts-head",children:[l("span",{class:"shortcuts-eyebrow",children:"Keyboard shortcuts"}),l("button",{type:"button",class:"shortcuts-close","aria-label":"Close shortcuts panel",onClick:Ie,children:"×"})]}),l("div",{class:"shortcuts-body",children:t.filter(n=>n.items.length>0).map(n=>l("section",{class:"shortcuts-group",children:[l("h3",{class:"shortcuts-group-title",children:n.heading}),l("ul",{children:n.items.map(i=>l("li",{children:[l("span",{class:"shortcut-label",children:i.label}),l("span",{class:"shortcut-keys",children:i.displayKeys.map((r,o)=>l("span",{children:[o>0&&l("span",{class:"shortcut-plus","aria-hidden":!0,children:"+"}),l("kbd",{children:r})]},`${r}-${o}`))})]},i.id))})]},n.heading))}),l("div",{class:"shortcuts-foot",children:["Press ",l("kbd",{children:"Esc"})," or click outside to close"]})]})}):null}const El=4;function Cl(e,t){const n=El;b(()=>{const i=e.current;if(!i)return;function r(o){o.altKey&&(o.preventDefault(),i.scrollBy({top:o.deltaY*n,left:o.deltaX*n,behavior:"auto"}))}return i.addEventListener("wheel",r,{passive:!1}),()=>{i.removeEventListener("wheel",r)}},[e,n])}const W=P(null),qe=P(null),Ht=P(!1);async function qi(e){Ht.value=!0,qe.value=null;try{const t=new URLSearchParams({palette:oe.value});e&&t.set("path",e);const n=`/api/file?${t}`,i=await fetch(n);if(!i.ok){const r=await i.json().catch(()=>({error:`HTTP ${i.status}`}));throw new Error(r.error??`HTTP ${i.status}`)}W.value=await i.json()}catch(t){qe.value=t.message,W.value=null}finally{Ht.value=!1}}function Ll(e){if(!(e instanceof HTMLElement))return!1;const t=e.tagName;return t==="INPUT"||t==="TEXTAREA"||e.isContentEditable}function $l(e){return e.key!=="Escape"?!1:Ze.value?(Ae(),e.preventDefault(),!0):Xe.value?(Le(),e.preventDefault(),!0):et.value?(Ie(),e.preventDefault(),!0):nt.value?(_e(),e.preventDefault(),!0):!1}function Tl(e){b(()=>{const t={outline:e.outline,onJumpHeading:e.onJumpHeading,navigate:e.navigate};function n(i){if($l(i))return;const r=Ll(i.target);for(const o of zi)if(!(r&&o.whenTyping==="block")&&o.match(i)){i.preventDefault(),o.run(t),Hn(i);return}Hn(i)}return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[e.outline,e.onJumpHeading,e.navigate])}function Pl(e){b(()=>{const t=new EventSource("/api/watch"),n=i=>{try{const r=JSON.parse(i.data);e(r)}catch{}};return t.addEventListener("change",n),t.addEventListener("add",n),t.addEventListener("unlink",n),t.addEventListener("config",n),t.addEventListener("workspace",n),()=>t.close()},[e])}function Al(e,t,n){if(e.kind!=="change")return!1;const i=(t==null?void 0:t.relPath)??n;return i!==null&&e.relPath===i}function Il({currentPath:e,scrollerRef:t}){const n=Xn(i=>{var r;if(Al(i,W.value,e)){const o=((r=t.current)==null?void 0:r.scrollTop)??0;qi(e).then(()=>{requestAnimationFrame(()=>{t.current&&(t.current.scrollTop=o)})});return}(i.kind==="add"||i.kind==="unlink"||i.kind==="config"||i.kind==="workspace")&&ai()},[e,t]);Pl(n)}let re=null,Rt=[],Y=null,Fn=null;function Vi(){return typeof window>"u"||window.parent===window?!1:new URLSearchParams(window.location.search).get("embed")==="vscode"}function Ft(e){if(re===null){Rt.push(e);return}window.parent.postMessage(e,re)}function Nl(e){if(Y=e,Fn!==null)return;const t=n=>{if(re===null){if(n.source===window.parent&&n.data!==null&&typeof n.data=="object"&&n.data.type==="mdview/init"){re=n.origin;for(const i of Rt)window.parent.postMessage(i,re);Rt=[],Y==null||Y(n.data)}return}n.origin===re&&(n.data===null||typeof n.data!="object"||typeof n.data.type!="string"||Y==null||Y(n.data))};Fn=t,window.addEventListener("message",t)}function Ml(){var q;ao(),Do();const e=ur(),{currentPath:t,setCurrentPath:n,navigate:i}=Fr(),r=Vi(),o=K(null),a=Sr.value,s=Er.value,d=vn.value,c=mn.value,h=fi.value;b(()=>{const y=se.value;if(!y)return;const x=y.roots.length===1?y.roots[0]:void 0;if((x==null?void 0:x.kind)==="file"){n(`${x.id}/${x.filePath}`);return}if(t===null){const v=Rr(),D=(v?ui(y.tree,v):null)??ci(y.tree);D&&n(D)}},[e,t]),b(()=>{qi(t)},[t,oe.value]),b(()=>{_e()},[t]),b(()=>{const y=W.value;let x=null;if(y){if(y.title)x=y.title;else if(t){const v=t.lastIndexOf("/");x=v>=0?t.slice(v+1):t}}document.title=x?`${x} | mdview`:"mdview"},[W.value,t]),b(()=>{if(!W.value||!o.current)return;const y=window.location.hash.slice(1);y?requestAnimationFrame(()=>{at(y);const x=document.getElementById(y);x==null||x.scrollIntoView({behavior:"auto",block:"start"})}):o.current.scrollTop=0},[W.value]),br(o.current),b(()=>{zo(o.current)},[o.current]),b(()=>{h?document.documentElement.dataset.wide="1":delete document.documentElement.dataset.wide},[h]),Il({currentPath:t,scrollerRef:o}),Tl({outline:((q=W.value)==null?void 0:q.outline)??[],onJumpHeading:y=>p(y),navigate:y=>i(y)}),Cl(o);const u=y=>i(y),f=(y,x)=>{if(r&&y){Ft({type:"mdview/internal-link-clicked",relPath:y,fromFile:t??""});return}if(i(y,x),x){const v=x.slice(1);requestAnimationFrame(()=>{var C;at(v),(C=document.getElementById(v))==null||C.scrollIntoView({behavior:"smooth"})})}},p=y=>{history.replaceState(history.state,"",`#${y}`),mr(y),at(y);const x=document.getElementById(y);if(x==null||x.scrollIntoView({behavior:"smooth"}),r&&x){const v=x.getAttribute("data-source-line"),C=v!==null?parseInt(v,10):null;C!==null&&!Number.isNaN(C)&&Ft({type:"mdview/heading-clicked",line:C,file:t??""})}},_=y=>{var x;if(y===null){history.replaceState(history.state,"",window.location.pathname+window.location.search),U.value=null,(x=o.current)==null||x.scrollTo({top:0,behavior:"smooth"});return}p(y)},m=W.value,w=se.value,k=St.value,g=["app-shell",r?"embed":"",a?"tree-collapsed":"",s?"outline-collapsed":"",k?"has-minimap":""].filter(Boolean).join(" "),I=`--tree-width:${r?0:d}px;--outline-width:${c}px`,M=()=>{$r(),a||$e()},F=()=>{Tr(),s||Te()};return l("div",{class:g,style:I,children:[!r&&l("aside",{class:"pane-tree","aria-label":"File tree",children:a?l("button",{class:"rail-btn","aria-label":"Expand file tree",title:"Expand file tree",onClick:$e,children:[l(Co,{size:15}),l("span",{class:"rail-label",children:"FILES"})]}):w&&l(Ro,{tree:w.tree,currentPath:t,onSelect:u,onCollapse:$e})}),!r&&!a&&l(Pn,{side:"left",ariaLabel:"Resize file tree",getCurrent:()=>vn.value,onResize:Cr,collapseAt:_n,onCollapse:M,min:Ue,max:We}),l("header",{class:"pane-header",children:[l(Wo,{outline:(m==null?void 0:m.outline)??[],fileName:(m==null?void 0:m.title)??null,onJumpHeading:_}),l(Yo,{scroller:o.current,trigger:m})]}),l("main",{class:"pane-main",ref:o,children:[nt.value&&l(_l,{scroller:o.current,fileTrigger:m,onOpenFile:u}),(w==null?void 0:w.roots.length)===0&&l("div",{class:"status",children:["No folders open. Run ",l("code",{children:"mdview <path>"})," in a folder to add one."]}),Ht.value&&!m&&l(mo,{}),qe.value&&l("div",{class:"status status-error",children:["Error: ",qe.value]}),m&&l(vo,{file:m,onInternalNavigate:f}),m&&St.value&&l(Vo,{outline:m.outline})]}),l(Bo,{}),l(Sl,{}),l(pr,{currentPath:t,onSelect:u}),!s&&l(Pn,{side:"right",ariaLabel:"Resize outline",getCurrent:()=>mn.value,onResize:Lr,collapseAt:_n,onCollapse:F,min:Ue,max:We}),l("aside",{class:"pane-outline","aria-label":"Outline",children:s?l("button",{class:"rail-btn","aria-label":"Expand outline",title:"Expand outline",onClick:Te,children:[l($o,{size:15}),l("span",{class:"rail-label",children:"OUTLINE"})]}):m&&l(Xo,{nodes:m.outline,onJump:p,onCollapse:Te})})]})}const Hl=new Set(["mdview/init","mdview/set-file","mdview/cursor-changed","mdview/palette-changed"]);function Rl(e){return e.length===0||e.startsWith("/")?!1:!e.split("/").some(t=>t==="..")}function Fl(e){if(Hl.has(e.type))switch(e.type){case"mdview/init":{Ft({type:"mdview/ready"});break}case"mdview/set-file":{const t=e.relPath;typeof t=="string"&&Rl(t)&&(Pe(t),ki(t));break}case"mdview/cursor-changed":{const t=e.line;if(typeof t!="number")break;requestAnimationFrame(()=>{const n=Array.from(document.querySelectorAll(".markdown-content :is(h1,h2,h3,h4,h5,h6)[data-source-line]"));let i=null;for(const r of n){const o=parseInt(r.getAttribute("data-source-line")??"",10);!Number.isNaN(o)&&o<=t&&(i=r)}i==null||i.scrollIntoView({behavior:"smooth",block:"start"})});break}case"mdview/palette-changed":{const t=e.palette;typeof t=="string"&&Je.includes(t)&&Di(t);break}}}Vi()&&Nl(Fl);const ji=document.getElementById("app");if(!ji)throw new Error("Missing #app");tr(l(Ml,{}),ji);export{Qt as _};
|