vibelet 1.2.236 → 1.2.237
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/dist/index.cjs +1 -1
- package/dist/inventory-scan-worker.cjs +1 -1
- package/dist/runtime-version.cjs +1 -1
- package/dist/vibelet.mjs +70 -38
- package/dist/web/assets/App-BY3qcVsa.css +1 -0
- package/dist/web/assets/App-CLTYkSvy.js +2 -0
- package/dist/web/assets/BrowserControlPanel-DJHj2vwI.js +1 -0
- package/dist/web/assets/{ChipGroup-oOAXQU_U.js → ChipGroup-DCvI-4nb.js} +1 -1
- package/dist/web/assets/FilesControlPanel-B-pqZWgH.js +1 -0
- package/dist/web/assets/{GlobalPendingDialog-BRjrQWQb.js → GlobalPendingDialog-M2Dbntba.js} +1 -1
- package/dist/web/assets/{ImageViewer-BKLAZsx-.js → ImageViewer-ChfsVDQe.js} +1 -1
- package/dist/web/assets/{LanguageSettingsPanel-CaykSwtb.js → LanguageSettingsPanel-P7H9JLtq.js} +1 -1
- package/dist/web/assets/{MarkdownModePanel-MUsXqLwF.js → MarkdownModePanel-B4zGnWRC.js} +1 -1
- package/dist/web/assets/{NewSessionDialog-BY2zzDZo.css → NewSessionDialog-5JSvL7EJ.css} +1 -1
- package/dist/web/assets/NewSessionDialog-Cw6WvtMR.js +1 -0
- package/dist/web/assets/{NotificationSettingsPanel-BBUZhjoO.js → NotificationSettingsPanel-BAcpsROS.js} +1 -1
- package/dist/web/assets/ObsidianFileEditor-D2QjjPA3.css +1 -0
- package/dist/web/assets/RemoteLifeOSBlock-C46RjZWn.js +2 -0
- package/dist/web/assets/RemoteLifeOSBlock-DVhFsnY2.css +1 -0
- package/dist/web/assets/SessionTerminalPanel-pCQpIA-I.js +1 -0
- package/dist/web/assets/{ThemeSettingsPanel-BgkL7mH7.js → ThemeSettingsPanel-JUF7qFiS.js} +1 -1
- package/dist/web/assets/{abnfDiagram-VRR7QNED-ODGFDhJw.js → abnfDiagram-VRR7QNED-BUn7dXdz.js} +1 -1
- package/dist/web/assets/{arc-BbkJgSU9.js → arc-BW2CYTF6.js} +1 -1
- package/dist/web/assets/{architectureDiagram-ZJ3FMSHR-Db8s926b.js → architectureDiagram-ZJ3FMSHR-QlFDuk3c.js} +1 -1
- package/dist/web/assets/{arrow-right-BCjDgKWi.js → arrow-right-BkDm1nz1.js} +1 -1
- package/dist/web/assets/{blockDiagram-677ZJIJ3-BavQ_vBo.js → blockDiagram-677ZJIJ3-Di1jkO8N.js} +1 -1
- package/dist/web/assets/{c4Diagram-LMCZKHZV-XWI6vuqV.js → c4Diagram-LMCZKHZV-BIE5S3xC.js} +1 -1
- package/dist/web/assets/channel-CgLW9Jd5.js +1 -0
- package/dist/web/assets/{chunk-2Q5K7J3B-B6hV61Y7.js → chunk-2Q5K7J3B-BZdVpYMm.js} +1 -1
- package/dist/web/assets/{chunk-32BRIVSS-DX3VKIDK.js → chunk-32BRIVSS-DniTjuKD.js} +1 -1
- package/dist/web/assets/{chunk-5VM5RSS4-CYMCskaD.js → chunk-5VM5RSS4-zU4WGQUt.js} +1 -1
- package/dist/web/assets/{chunk-EX3LRPZG-DBoGg_4O.js → chunk-EX3LRPZG-B_EGZWf3.js} +1 -1
- package/dist/web/assets/{chunk-JWPE2WC7-CRtoh7C6.js → chunk-JWPE2WC7-8R4xqfzd.js} +1 -1
- package/dist/web/assets/{chunk-MOJQB5TN-C-oFYT6N.js → chunk-MOJQB5TN-CmpQblce.js} +1 -1
- package/dist/web/assets/{chunk-RYQCIY6F-CH1nwWiv.js → chunk-RYQCIY6F-DrT9S-SZ.js} +1 -1
- package/dist/web/assets/{chunk-V7JOEXUC-BN4Ew-5h.js → chunk-V7JOEXUC-CEP012wY.js} +1 -1
- package/dist/web/assets/{chunk-VR4S4FIN-C2l6p76I.js → chunk-VR4S4FIN-DcSau3fK.js} +1 -1
- package/dist/web/assets/{chunk-XXDRQBXY-CqFQntEs.js → chunk-XXDRQBXY-BoXCe4yS.js} +1 -1
- package/dist/web/assets/classDiagram-OUVF2IWQ-BTbMtdvt.js +1 -0
- package/dist/web/assets/classDiagram-v2-EOCWNBFH-BTbMtdvt.js +1 -0
- package/dist/web/assets/clsx-DNJkZJoV.js +1 -0
- package/dist/web/assets/{collectMessageImages-B29C7mI7.js → collectMessageImages-CUMbRGiF.js} +1 -1
- package/dist/web/assets/{cose-bilkent-JH36ORCC-e57V0sEJ.js → cose-bilkent-JH36ORCC-DKrqebqO.js} +1 -1
- package/dist/web/assets/{cynefin-VYW2F7L2-Bfk1s_pC.js → cynefin-VYW2F7L2-bQLn5vS2.js} +1 -1
- package/dist/web/assets/{cynefinDiagram-TSTJHNR4-D3quCWPS.js → cynefinDiagram-TSTJHNR4-ezXQFC9o.js} +1 -1
- package/dist/web/assets/{dagre-VKFMJZFB-g44y_PH_.js → dagre-VKFMJZFB-CDV8r_Bq.js} +1 -1
- package/dist/web/assets/{diagram-FQU43EPY-LnQzEtH4.js → diagram-FQU43EPY-BICapB67.js} +1 -1
- package/dist/web/assets/{diagram-G47NLZAW-CflyOpm5.js → diagram-G47NLZAW-TuVLjwN6.js} +1 -1
- package/dist/web/assets/{diagram-NH7WQ7WH-DBXAi8Ov.js → diagram-NH7WQ7WH-B3dBWl3F.js} +1 -1
- package/dist/web/assets/{diagram-OA4YK3LP-Dg_Dijvf.js → diagram-OA4YK3LP-DeIQlN-6.js} +1 -1
- package/dist/web/assets/{diagram-WEI45ONY-BuwomISz.js → diagram-WEI45ONY-DZcwYcod.js} +1 -1
- package/dist/web/assets/{ebnfDiagram-CCIWWBDH-BDsa6V-M.js → ebnfDiagram-CCIWWBDH-4KcDP5Zj.js} +1 -1
- package/dist/web/assets/{erDiagram-Q63AITRT-DjC-G50r.js → erDiagram-Q63AITRT-D4KIuggo.js} +1 -1
- package/dist/web/assets/{file-editor-FileCodeEditor-DMbYLQga.js → file-editor-FileCodeEditor-Dn3f5PUl.js} +1 -1
- package/dist/web/assets/file-editor-ObsidianCodeEditor-BgXz3c5Z.js +48 -0
- package/dist/web/assets/{file-editor-ObsidianFileEditor-cHj5bINn.js → file-editor-ObsidianFileEditor-CM9ucogo.js} +1 -1
- package/dist/web/assets/{flowDiagram-23GEKE2U-BJQ8jmJz.js → flowDiagram-23GEKE2U-BeHvede_.js} +1 -1
- package/dist/web/assets/{folder-plus-CaEac9Pu.js → folder-plus-BVS_Q2fe.js} +1 -1
- package/dist/web/assets/{ganttDiagram-NO4QXBWP-C_Ep_sqX.js → ganttDiagram-NO4QXBWP-DrwEUqQX.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-IHSO6WYX-yqq5qCor.js → gitGraphDiagram-IHSO6WYX-Cm7T6TME.js} +1 -1
- package/dist/web/assets/{highlighted-body-TPN3WLV5-DsgrYxxe.js → highlighted-body-TPN3WLV5-DJAPujEc.js} +1 -1
- package/dist/web/assets/{index-BBUiU9K_.css → index-B3XA1dVd.css} +1 -1
- package/dist/web/assets/index-CX8KV6EH.js +2 -0
- package/dist/web/assets/{index-CfjAw18S.js → index-CapF4a8Y.js} +1 -1
- package/dist/web/assets/{infoDiagram-FWYZ7A6U-BG84MMEG.js → infoDiagram-FWYZ7A6U-CgeulgC-.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-FXEZZL3T-BVbSAqPD.js → ishikawaDiagram-FXEZZL3T-x4glLaWe.js} +1 -1
- package/dist/web/assets/{journeyDiagram-5HDEW3XC-DR9u9PjY.js → journeyDiagram-5HDEW3XC-DHGcWBDR.js} +1 -1
- package/dist/web/assets/{kanban-definition-HUTT4EX6-BNL6Cjqp.js → kanban-definition-HUTT4EX6-CqYivdRn.js} +1 -1
- package/dist/web/assets/{linear-BABQawCG.js → linear-BKnAjtJN.js} +1 -1
- package/dist/web/assets/{mermaid-O7DHMXV3-D-nTO-tY.js → mermaid-O7DHMXV3-B3e3pugB.js} +2 -2
- package/dist/web/assets/{mermaid-O7DHMXV3-DQjp4PWc.css → mermaid-O7DHMXV3-CgN6EJ9a.css} +1 -1
- package/dist/web/assets/{mermaid.core-D1pd82vj.js → mermaid.core-CTf8qcol.js} +2 -2
- package/dist/web/assets/{mindmap-definition-LN4V7U3C-BjvItyAf.js → mindmap-definition-LN4V7U3C-NQnwG7IB.js} +1 -1
- package/dist/web/assets/{pegDiagram-2B236MQR-Bfs8YxC7.js → pegDiagram-2B236MQR-jfLjzzsG.js} +1 -1
- package/dist/web/assets/{pieDiagram-ENE6RG2P-DdELzb-R.js → pieDiagram-ENE6RG2P-CgxRYPCf.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-ABIIQ3AL-AzJ5Sqrb.js → quadrantDiagram-ABIIQ3AL-0zHgV223.js} +1 -1
- package/dist/web/assets/{railroadDiagram-RFXS5EU6-s2d1tZs2.js → railroadDiagram-RFXS5EU6-CQqf55Rk.js} +1 -1
- package/dist/web/assets/{requirementDiagram-TGXJPOKE-OBPiuQUS.js → requirementDiagram-TGXJPOKE-Dm9cKzLN.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-HTMAVEWB-B0z9UoWs.js → sankeyDiagram-HTMAVEWB-BRBxR71X.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-DBY2YBRQ-B-eaTrbT.js → sequenceDiagram-DBY2YBRQ-DxVBmbfg.js} +1 -1
- package/dist/web/assets/{sizeCapture-X5ZJPWSS--cmYiv7G.js → sizeCapture-X5ZJPWSS-DNNwG-Sh.js} +1 -1
- package/dist/web/assets/{stateDiagram-2N3HPSRC-_MuFncei.js → stateDiagram-2N3HPSRC-C8KGcqhJ.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-6OUMAXLB-Bk6KXy8V.js +1 -0
- package/dist/web/assets/{swimlanes-5IMT3BWC-c7JaTQfX.js → swimlanes-5IMT3BWC-CRe3WzWn.js} +2 -2
- package/dist/web/assets/swimlanesDiagram-G3AALYLV-DsL6VYKg.js +1 -0
- package/dist/web/assets/{timeline-definition-FHXFAJF6-CnOYde68.js → timeline-definition-FHXFAJF6-CQqiFe9j.js} +1 -1
- package/dist/web/assets/{vennDiagram-L72KCM5P-DZbkibLf.js → vennDiagram-L72KCM5P-C_5c80TB.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-EHGQE667-go5O5Sd2.js → wardleyDiagram-EHGQE667-DJ2RRwLP.js} +1 -1
- package/dist/web/assets/{xychartDiagram-FW5EYKEG-B9THiMzF.js → xychartDiagram-FW5EYKEG-MgVCQknE.js} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/obsidian-editor-assets.json +1 -1
- package/package.json +1 -1
- package/dist/web/assets/App-C560TMeI.js +0 -2
- package/dist/web/assets/App-iPVf4ne3.css +0 -1
- package/dist/web/assets/BrowserControlPanel-7SS9C-wJ.js +0 -1
- package/dist/web/assets/FilesControlPanel-c4WfDaKU.js +0 -1
- package/dist/web/assets/NewSessionDialog-6g3uTjpL.js +0 -1
- package/dist/web/assets/ObsidianFileEditor-BM1om3jV.css +0 -1
- package/dist/web/assets/RemoteLifeOSBlock-BGPY9LfG.css +0 -1
- package/dist/web/assets/RemoteLifeOSBlock-bq0Spc3-.js +0 -2
- package/dist/web/assets/TerminalControlPanel-_G2RVzCv.js +0 -1
- package/dist/web/assets/channel-CVgTHrkc.js +0 -1
- package/dist/web/assets/classDiagram-OUVF2IWQ-CNwRwjLB.js +0 -1
- package/dist/web/assets/classDiagram-v2-EOCWNBFH-CNwRwjLB.js +0 -1
- package/dist/web/assets/clsx-pdz_ZVGy.js +0 -1
- package/dist/web/assets/file-editor-ObsidianCodeEditor-TJxlWj2j.js +0 -48
- package/dist/web/assets/index-BIOvx5-n.js +0 -2
- package/dist/web/assets/stateDiagram-v2-6OUMAXLB-B40jPaIC.js +0 -1
- package/dist/web/assets/swimlanesDiagram-G3AALYLV-9bT14x9O.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as r,s as t}from"./flowDiagram-23GEKE2U-BeHvede_.js";import{_ as e}from"./mermaid.core-CTf8qcol.js";import"./RemoteLifeOSBlock-C46RjZWn.js";import"./chunk-5VM5RSS4-zU4WGQUt.js";import"./chunk-XXDRQBXY-BoXCe4yS.js";import"./chunk-VR4S4FIN-DcSau3fK.js";import"./chunk-32BRIVSS-DniTjuKD.js";import"./purify.es-BNLkGfTg.js";import"./channel-CgLW9Jd5.js";import"./index-CX8KV6EH.js";import"./marked.esm-BBjA1da9.js";import"./App-CLTYkSvy.js";import"./index-CapF4a8Y.js";import"./file-editor-index-C6CU7Fik.js";var o=r({defaultLayout:"swimlane",styles:e(r=>`${t(r)}\n .swimlane.cluster rect {\n stroke: ${r.clusterBorder} !important;\n }\n [data-look="neo"].cluster rect {\n filter: none;\n }\n`,"getStyles")});export{o as diagram};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as t,z as e,a9 as n,aa as i,ab as r,c as a,l as s,F as o,a1 as c,ac as l,d as h,u as d,ad as p,q as u}from"./mermaid.core-D1pd82vj.js";import{d as g}from"./arc-BbkJgSU9.js";import"./index-BIOvx5-n.js";import"./RemoteLifeOSBlock-bq0Spc3-.js";import"./App-C560TMeI.js";import"./index-CfjAw18S.js";import"./file-editor-index-C6CU7Fik.js";import"./purify.es-BNLkGfTg.js";import"./marked.esm-BBjA1da9.js";var y=function(){var e=t(function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},"o"),n=[6,11,13,14,15,17,19,20,23,24],i=[1,12],r=[1,13],a=[1,14],s=[1,15],o=[1,16],c=[1,19],l=[1,20],h={trace:t(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:t(function(t,e,n,i,r,a,s){var o=a.length-1;switch(r){case 1:return a[o-1];case 3:i.setDirection("LR");break;case 4:i.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:a[o-1].push(a[o]),this.$=a[o-1];break;case 7:case 8:this.$=a[o];break;case 11:i.getCommonDb().setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 12:this.$=a[o].trim(),i.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=a[o].trim(),i.getCommonDb().setAccDescription(this.$);break;case 15:i.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 18:i.addTask(a[o],0,""),this.$=a[o];break;case 19:i.addEvent(a[o].substr(2)),this.$=a[o]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(n,[2,5],{5:6}),e(n,[2,2]),e(n,[2,3]),e(n,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:i,15:r,17:a,19:s,20:o,21:17,22:18,23:c,24:l},e(n,[2,10],{1:[2,1]}),e(n,[2,6]),{12:21,14:i,15:r,17:a,19:s,20:o,21:17,22:18,23:c,24:l},e(n,[2,8]),e(n,[2,9]),e(n,[2,11]),{16:[1,22]},{18:[1,23]},e(n,[2,14]),e(n,[2,15]),e(n,[2,16]),e(n,[2,17]),e(n,[2,18]),e(n,[2,19]),e(n,[2,7]),e(n,[2,12]),e(n,[2,13])],defaultActions:{},parseError:t(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:t(function(e){var n=this,i=[0],r=[],a=[null],s=[],o=this.table,c="",l=0,h=0,d=s.slice.call(arguments,1),p=Object.create(this.lexer),u={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(u.yy[g]=this.yy[g]);p.setInput(e,u.yy),u.yy.lexer=p,u.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var y=p.yylloc;s.push(y);var f=p.options&&p.options.ranges;function m(){var t;return"number"!=typeof(t=r.pop()||p.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,t(function(t){i.length=i.length-2*t,a.length=a.length-t,s.length=s.length-t},"popStack"),t(m,"lex");for(var x,b,k,w,_,$,v,S,E={};;){if(b=i[i.length-1],this.defaultActions[b]?k=this.defaultActions[b]:(null==x&&(x=m()),k=o[b]&&o[b][x]),void 0===k||!k.length||!k[0]){var T;for(_ in S=[],o[b])this.terminals_[_]&&_>2&&S.push("'"+this.terminals_[_]+"'");T=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[x]||x)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==x?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(T,{text:p.match,token:this.terminals_[x]||x,line:p.yylineno,loc:y,expected:S})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+x);switch(k[0]){case 1:i.push(x),a.push(p.yytext),s.push(p.yylloc),i.push(k[1]),x=null,h=p.yyleng,c=p.yytext,l=p.yylineno,y=p.yylloc;break;case 2:if($=this.productions_[k[1]][1],E.$=a[a.length-$],E._$={first_line:s[s.length-($||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-($||1)].first_column,last_column:s[s.length-1].last_column},f&&(E._$.range=[s[s.length-($||1)].range[0],s[s.length-1].range[1]]),void 0!==(w=this.performAction.apply(E,[c,h,l,u.yy,k[1],a,s].concat(d))))return w;$&&(i=i.slice(0,-1*$*2),a=a.slice(0,-1*$),s=s.slice(0,-1*$)),i.push(this.productions_[k[1]][0]),a.push(E.$),s.push(E._$),v=o[i[i.length-2]][i[i.length-1]],i.push(v);break;case 3:return!0}}return!0},"parse")},d=function(){return{EOF:1,parseError:t(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:t(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:t(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:t(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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),n.length-1&&(this.yylineno-=n.length-1);var r=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:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:t(function(t){this.unput(this.match.slice(t))},"less"),pastInput:t(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:t(function(t,e){var n,i,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in r)this[a]=r[a];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),a=0;a<r.length;a++)if((n=this._input.match(this.rules[r[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){return this.next()||this.lex()},"lex"),begin:t(function(t){this.conditionStack.push(t)},"begin"),popState:t(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:t(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:t(function(t){this.begin(t)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(t,e,n,i){switch(n){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function p(){this.yy={}}return h.lexer=d,t(p,"Parser"),p.prototype=h,h.Parser=p,new p}();y.parser=y;var f=y,m={};d(m,{addEvent:()=>C,addSection:()=>I,addTask:()=>L,addTaskOrg:()=>N,clear:()=>S,default:()=>O,getCommonDb:()=>v,getDirection:()=>T,getSections:()=>M,getTasks:()=>H,setDirection:()=>E});var x="",b=0,k="LR",w=[],_=[],$=[],v=t(()=>p,"getCommonDb"),S=t(function(){w.length=0,_.length=0,x="",$.length=0,k="LR",u()},"clear"),E=t(function(t){k=t},"setDirection"),T=t(function(){return k},"getDirection"),I=t(function(t){x=t,w.push(t)},"addSection"),M=t(function(){return w},"getSections"),H=t(function(){let t=D(),e=0;for(;!t&&e<100;)t=D(),e++;return _.push(...$),_},"getTasks"),L=t(function(t,e,n){const i={id:b++,section:x,type:x,task:t,score:e||0,events:n?[n]:[]};$.push(i)},"addTask"),C=t(function(t){$.find(t=>t.id===b-1).events.push(t)},"addEvent"),N=t(function(t){const e={section:x,type:x,description:t,task:t,classes:[]};_.push(e)},"addTaskOrg"),D=t(function(){const e=t(function(t){return $[t].processed},"compileTask");let n=!0;for(const[t,i]of $.entries())e(t),n=n&&i.processed;return n},"compileTasks"),O={clear:S,getCommonDb:v,getDirection:T,setDirection:E,addSection:I,getSections:M,getTasks:H,addTask:L,addTaskOrg:N,addEvent:C},A=0,j=t(function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},"drawRect"),B=t(function(e,n){const i=e.append("circle").attr("cx",n.cx).attr("cy",n.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=e.append("g");function a(t){const e=g().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(15/2.2);t.append("path").attr("class","mouth").attr("d",e).attr("transform","translate("+n.cx+","+(n.cy+2)+")")}function s(t){const e=g().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(15/2.2);t.append("path").attr("class","mouth").attr("d",e).attr("transform","translate("+n.cx+","+(n.cy+7)+")")}function o(t){t.append("line").attr("class","mouth").attr("stroke",2).attr("x1",n.cx-5).attr("y1",n.cy+7).attr("x2",n.cx+5).attr("y2",n.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return r.append("circle").attr("cx",n.cx-5).attr("cy",n.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",n.cx+5).attr("cy",n.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),t(a,"smile"),t(s,"sad"),t(o,"ambivalent"),n.score>3?a(r):n.score<3?s(r):o(r),i},"drawFace"),R=t(function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n},"drawCircle"),P=t(function(t,e){const n=e.text.replace(/<br\s*\/?>/gi," "),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.attr("class","legend"),i.style("text-anchor",e.anchor),void 0!==e.class&&i.attr("class",e.class);const r=i.append("tspan");return r.attr("x",e.x+2*e.textMargin),r.text(n),i},"drawText"),F=t(function(e,n){function i(t,e,n,i,r){return t+","+e+" "+(t+n)+","+e+" "+(t+n)+","+(e+i-r)+" "+(t+n-1.2*r)+","+(e+i)+" "+t+","+(e+i)}t(i,"genPoints");const r=e.append("polygon");r.attr("points",i(n.x,n.y,50,20,7)),r.attr("class","labelBox"),n.y=n.y+n.labelMargin,n.x=n.x+.5*n.labelMargin,P(e,n)},"drawLabel"),W=t(function(t,e,n){const i=t.append("g"),r=q();r.x=e.x,r.y=e.y,r.fill=e.fill,r.width=n.width,r.height=n.height,r.class="journey-section section-type-"+e.num,r.rx=3,r.ry=3,j(i,r),Z(n)(e.text,i,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+e.num},n,e.colour)},"drawSection"),z=-1,V=t(function(t,e,n,i){const r=e.x+n.width/2,a=t.append("g");z++,a.append("line").attr("id",i+"-task"+z).attr("x1",r).attr("y1",e.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),B(a,{cx:r,cy:300+30*(5-e.score),score:e.score});const s=q();s.x=e.x,s.y=e.y,s.fill=e.fill,s.width=n.width,s.height=n.height,s.class="task task-type-"+e.num,s.rx=3,s.ry=3,j(a,s),Z(n)(e.task,a,s.x,s.y,s.width,s.height,{class:"task"},n,e.colour)},"drawTask"),G=t(function(t,e){j(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},"drawBackgroundRect"),U=t(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),q=t(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Z=function(){function e(t,e,n,i,a,s,o,c){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function n(t,e,n,i,a,s,o,c,l){const{taskFontSize:h,taskFontFamily:d}=c,p=t.split(/<br\s*\/?>/gi);for(let u=0;u<p.length;u++){const t=u*h-h*(p.length-1)/2,c=e.append("text").attr("x",n+a/2).attr("y",i).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",d);c.append("tspan").attr("x",n+a/2).attr("dy",t).text(p[u]),c.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(c,o)}}function i(t,e,i,a,s,o,c,l){const h=e.append("switch"),d=h.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),n(t,h,i,a,s,o,c,l),r(d,c)}function r(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return t(e,"byText"),t(n,"byTspan"),t(i,"byFo"),t(r,"_setTextAttrs"),function(t){return"fo"===t.textPlacement?i:"old"===t.textPlacement?e:n}}(),Y=t(function(t,e){A=0,z=-1,t.append("defs").append("marker").attr("id",e+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function X(t,e){t.each(function(){var t,n=h(this),i=n.text().split(/(\s+|<br>)/).reverse(),r=[],a=n.attr("y"),s=parseFloat(n.attr("dy")),o=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",s+"em");for(let c=0;c<i.length;c++)t=i[i.length-1-c],r.push(t),o.text(r.join(" ").trim()),(o.node().getComputedTextLength()>e||"<br>"===t)&&(r.pop(),o.text(r.join(" ").trim()),r="<br>"===t?[""]:[t],o=n.append("tspan").attr("x",0).attr("y",a).attr("dy","1.1em").text(t))})}t(X,"wrap");var J=t(function(t,e,n,i,r,a=!1){const{theme:s,look:o}=i,c=s?.includes("redux"),l=n%(i?.themeVariables?.THEME_COLOR_LIMIT??12)-1,d=t.append("g");e.section=l,d.attr("class",(e.class?e.class+" ":"")+"timeline-node section-"+l);const p=d.append("g"),u=d.append("g"),g=u.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(X,e.width).node().getBBox(),y=i.fontSize?.replace?i.fontSize.replace("px",""):i.fontSize;if(e.height=g.height+1.1*y*.5+e.padding,e.height=Math.max(e.height,e.maxHeight),e.width=e.width+2*e.padding,u.attr("transform","translate("+e.width/2+", "+e.padding/2+")"),c&&u.attr("transform",`translate(${e.width/2}, ${a?e.padding/2+3:e.padding})`),Q(p,e,l,r,i),"neo"===o&&(d.attr("data-look","neo"),c)){const e=s.includes("dark"),n=t.node()?.ownerSVGElement??t.node(),i=h(n),r=i.attr("id")??"",a=r?`${r}-drop-shadow`:"drop-shadow";if(i.select(`#${a}`).empty()){const t=i.select("defs");(t.empty()?i.append("defs"):t).append("filter").attr("id",a).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",e?"0.2":"0.06").attr("flood-color",e?"#FFFFFF":"#000000")}}return e},"drawNode"),K=t(function(t,e,n){const i=t.append("g"),r=i.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(X,e.width).node().getBBox(),a=n.fontSize?.replace?n.fontSize.replace("px",""):n.fontSize;return i.remove(),r.height+1.1*a*.5+e.padding},"getVirtualNodeHeight"),Q=t(function(t,e,n,i,r){const{theme:a}=r,s=a?.includes("redux")?0:5,o=s>0?`M0 ${e.height-5} v${10-e.height} q0,-${s},${s},-${s} h${e.width-10} q${s},0,${s},${s} v${e.height-5} H0 Z`:`M0 ${e.height-5} v${-(e.height-5)} h${e.width} v${e.height} H0 Z`;t.append("path").attr("id",i+"-node-"+A++).attr("class","node-bkg node-"+e.type).attr("d",o),a?.includes("redux")||t.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",e.height).attr("x2",e.width).attr("y2",e.height)},"defaultBkg"),tt={drawRect:j,drawCircle:R,drawSection:W,drawText:P,drawLabel:F,drawTask:V,drawBackgroundRect:G,getTextObj:U,getNoteRect:q,initGraphics:Y,drawNode:J,getVirtualNodeHeight:K},et=t(function(t,e,n,i){const r=a(),{look:o,theme:c,themeVariables:d}=r,{useGradient:p,gradientStart:u,gradientStop:g}=d,y=r.timeline?.leftMargin??50;s.debug("timeline",i.db);const f=r.securityLevel;let m;"sandbox"===f&&(m=h("#i"+e));const x=h("sandbox"===f?m.nodes()[0].contentDocument.body:"body").select("#"+e);x.append("g");const b=i.db.getTasks(),k=i.db.getCommonDb().getDiagramTitle();s.debug("task",b),tt.initGraphics(x,e);const w=i.db.getSections();s.debug("sections",w);let _=0,$=0,v=0,S=0,E=50+y,T=50;S=50;let I=0,M=!0;w.forEach(function(t){const e={number:I,descr:t,section:I,width:150,padding:20,maxHeight:_},n=tt.getVirtualNodeHeight(x,e,r);s.debug("sectionHeight before draw",n),_=Math.max(_,n+20)});let H=0,L=0;s.debug("tasks.length",b.length);for(const[a,l]of b.entries()){const t={number:a,descr:l,section:l.section,width:150,padding:20,maxHeight:$},e=tt.getVirtualNodeHeight(x,t,r);s.debug("taskHeight before draw",e),$=Math.max($,e+20),H=Math.max(H,l.events.length);let n=0;for(const i of l.events){const t={descr:i,section:l.section,number:l.section,width:150,padding:20,maxHeight:50};n+=tt.getVirtualNodeHeight(x,t,r)}l.events.length>0&&(n+=10*(l.events.length-1)),L=Math.max(L,n)}s.debug("maxSectionHeight before draw",_),s.debug("maxTaskHeight before draw",$),w&&w.length>0?w.forEach(t=>{const n=b.filter(e=>e.section===t),i={number:I,descr:t,section:I,width:200*Math.max(n.length,1)-50,padding:20,maxHeight:_};s.debug("sectionNode",i);const a=x.append("g"),o=tt.drawNode(a,i,I,r,e);s.debug("sectionNode output",o),a.attr("transform",`translate(${E}, 50)`),T+=_+50,n.length>0&&nt(x,n,I,E,T,$,r,H,L,_,!1,e),E+=200*Math.max(n.length,1),T=50,I++}):(M=!1,nt(x,b,I,E,T,$,r,H,L,_,!0,e));const C=x.node().getBBox();if(s.debug("bounds",C),k&&x.append("text").text(k).attr("x","neo"===o?2*C.x+y:C.width/2-y).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),v=M?_+$+150:$+100,x.append("g").attr("class","lineWrapper").append("line").attr("x1",y).attr("y1",v).attr("x2",C.width+3*y).attr("y2",v).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${e}-arrowhead)`),"neo"===o&&p&&"neutral"!==c){const t=x.select("defs"),e=(t.empty()?x.append("defs"):t).append("linearGradient").attr("id",x.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");e.append("stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),e.append("stop").attr("offset","100%").attr("stop-color",g).attr("stop-opacity",1)}l(void 0,x,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),nt=t(function(t,e,n,i,r,a,o,c,l,h,d,p){for(const u of e){const e={descr:u.task,section:n,number:n,width:150,padding:20,maxHeight:a};s.debug("taskNode",e);const c=t.append("g").attr("class","taskWrapper"),h=tt.drawNode(c,e,n,o,p).height;if(s.debug("taskHeight after draw",h),c.attr("transform",`translate(${i}, ${r})`),a=Math.max(a,h),u.events){const e=t.append("g").attr("class","lineWrapper");let s=a;r+=100,s+=it(t,u.events,n,i,r,o,p),r-=100,e.append("line").attr("x1",i+95).attr("y1",r+a).attr("x2",i+95).attr("y2",r+a+100+l+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${p}-arrowhead)`).attr("stroke-dasharray","5,5")}i+=200,d&&!o.timeline?.disableMulticolor&&n++}r-=10},"drawTasks"),it=t(function(t,e,n,i,r,a,o){let c=0;const l=r;r+=100;for(const h of e){const e={descr:h,section:n,number:n,width:150,padding:20,maxHeight:50};s.debug("eventNode",e);const l=t.append("g").attr("class","eventWrapper"),d=tt.drawNode(l,e,n,a,o,!0).height;c+=d,l.attr("transform",`translate(${i}, ${r})`),r=r+10+d}return r=l,c},"drawEvents"),rt={setConf:t(()=>{},"setConf"),draw:et},at=t(function(t,e,n,i){const r=a(),h=r.timeline?.leftMargin??50;s.debug("timeline",i.db);const d=o(e);d.append("g");const p=i.db.getTasks(),u=i.db.getCommonDb().getDiagramTitle();s.debug("task",p),tt.initGraphics(d);const g=i.db.getSections();s.debug("sections",g);let y=0,f=0;const m=50+h;let x=50;const b=x,k=m+230;let w=0;const _=g&&g.length>0,$=_?k:m+230,v=Math.max(50,580);g.forEach(function(t){const e={number:w,descr:t,section:w,width:v,padding:5,maxHeight:y},n=tt.getVirtualNodeHeight(d,e,r);s.debug("sectionHeight before draw",n),y=Math.max(y,n)});let S=0;s.debug("tasks.length",p.length);for(const[a,o]of p.entries()){const t={number:a,descr:o,section:o.section,width:200,padding:5,maxHeight:f},e=tt.getVirtualNodeHeight(d,t,r);s.debug("taskHeight before draw",e),f=Math.max(f,e);let n=0;for(const i of o.events){const t={descr:i,section:o.section,number:o.section,width:300,padding:5,maxHeight:50};n+=tt.getVirtualNodeHeight(d,t,r)}o.events.length>0&&(n+=10*(o.events.length-1)),S=Math.max(S,n)+0}s.debug("maxSectionHeight before draw",y),s.debug("maxTaskHeight before draw",f);const E=Math.max(f,S)+30;_?g.forEach(t=>{const e=p.filter(e=>e.section===t),n={number:w,descr:t,section:w,width:v,padding:5,maxHeight:y};s.debug("sectionNode",n);const i=d.append("g"),a=tt.drawNode(i,n,w,r);s.debug("sectionNode output",a);const o=$-230;i.attr("transform",`translate(${o}, ${x})`);const c=x+a.height+20;e.length>0&&st(d,e,w,$,c,f,r,E,!1);const l=e.length,h=a.height+20+E*Math.max(l,1)-(l>0?60:0);x+=h,w++}):st(d,p,w,$,x,f,r,E,!0);let T=d.node()?.getBBox();if(!T)throw new Error("bbox not found");if(s.debug("bounds",T),u){if(d.append("text").text(u).attr("x",T.width/2-h).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),T=d.node()?.getBBox(),!T)throw new Error("bbox not found");s.debug("bounds after title",T)}const[I]=c(r.fontSize),M=2*(I??16),H=.5*(I??16)+20,L=d.append("g").attr("class","lineWrapper");L.append("line").attr("x1",$).attr("y1",b-M).attr("x2",$).attr("y2",T.y+T.height+H).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),L.lower(),l(void 0,d,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),st=t(function(t,e,n,i,r,a,o,c,l){for(const h of e){const e={descr:h.task,section:n,number:n,width:200,padding:5,maxHeight:a};s.debug("taskNode",e);const d=t.append("g").attr("class","taskWrapper"),p=tt.drawNode(d,e,n,o),u=p.height;s.debug("taskHeight after draw",u);const g=i-20-p.width;if(d.attr("transform",`translate(${g}, ${r})`),a=Math.max(a,u),h.events&&h.events.length>0){const e=r,a=i+50;ot(t,h.events,n,i,a,e,o)}r+=c,l&&!o.timeline?.disableMulticolor&&n++}},"drawTasks"),ot=t(function(t,e,n,i,r,a,o){let c=a;for(const l of e){const e={descr:l,section:n,number:n,width:300,padding:5,maxHeight:0};s.debug("eventNode",e);const a=t.append("g").attr("class","eventWrapper"),h=tt.drawNode(a,e,n,o).height;a.attr("transform",`translate(${r}, ${c})`);const d=c+h/2;t.append("g").attr("class","lineWrapper").append("line").attr("x1",i).attr("y1",d).attr("x2",r).attr("y2",d).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),c=c+h+10}return c-a},"drawEvents"),ct={setConf:t(()=>{},"setConf"),draw:at},lt=t(t=>{const{theme:n}=e(),i=n?.includes("dark"),r=n?.includes("color"),a=t.svgId?.replace(/^#/,"")??"",s=a?`url(#${a}-drop-shadow)`:t.dropShadow??"none";let o="";for(let e=0;e<t.THEME_COLOR_LIMIT;e++){const n=""+(17-3*e),a=r?t.borderColorArray[e]:t.mainBkg,c=r?t.borderColorArray[e]:t.nodeBorder;o+=`\n .section-${e-1} rect,\n .section-${e-1} path,\n .section-${e-1} circle {\n fill: ${i&&r?t.mainBkg:a};\n stroke: ${c};\n stroke-width: ${t.strokeWidth};\n filter: ${s};\n }\n\n .section-${e-1} text {\n fill: ${t.nodeBorder};\n font-weight: ${t.fontWeight}\n }\n\n .node-icon-${e-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+e]};\n }\n\n .section-edge-${e-1} {\n stroke: ${t["cScale"+e]};\n }\n\n .edge-depth-${e-1} {\n stroke-width: ${n};\n }\n\n .section-${e-1} line {\n stroke: ${t["cScaleInv"+e]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${t.nodeBorder};\n stroke-width:${t.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${t.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${t.clusterBorder??"#efefef"};\n }\n `}return o},"genReduxSections"),ht=t(t=>{let e="";for(let a=0;a<t.THEME_COLOR_LIMIT;a++)t["lineColor"+a]=t["lineColor"+a]||t["cScaleInv"+a],n(t["lineColor"+a])?t["lineColor"+a]=i(t["lineColor"+a],20):t["lineColor"+a]=r(t["lineColor"+a],20);for(let n=0;n<t.THEME_COLOR_LIMIT;n++){const i=""+(17-3*n);e+=`\n .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} path {\n fill: ${t["cScale"+n]};\n }\n .section-${n-1} text {\n fill: ${t["cScaleLabel"+n]};\n }\n .node-icon-${n-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+n]};\n }\n .section-edge-${n-1}{\n stroke: ${t["cScale"+n]};\n }\n .edge-depth-${n-1}{\n stroke-width: ${i};\n }\n .section-${n-1} line {\n stroke: ${t["cScaleInv"+n]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${t["cScaleLabel"+n]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${t.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${t.clusterBorder??"#efefef"};\n }\n `}return e},"genSections"),dt=t(t=>{const{theme:n}=e(),i=n?.includes("redux"),r="neutral"===n,a=t.svgId?.replace(/^#/,"")??"";let s="";if(t.useGradient&&a&&t.THEME_COLOR_LIMIT&&!r)for(let e=0;e<t.THEME_COLOR_LIMIT;e++)s+=`\n .section-${e-1}[data-look="neo"] rect,\n .section-${e-1}[data-look="neo"] path,\n .section-${e-1}[data-look="neo"] circle {\n fill: ${t.mainBkg};\n stroke: url(#${a}-gradient);\n stroke-width: 2;\n }\n .section-${e-1}[data-look="neo"] line {\n stroke: url(#${a}-gradient);\n stroke-width: 2;\n }`;return`\n .edge {\n stroke-width: 3;\n }\n ${i?lt(t):ht(t)}\n ${s}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),pt={db:m,renderer:{setConf:t(()=>{},"setConf"),draw:t((t,e,n,i)=>"TD"===(i?.db?.getDirection?.()??"LR")?ct.draw(t,e,n,i):rt.draw(t,e,n,i),"draw")},parser:f,styles:dt};export{pt as diagram};
|
|
1
|
+
import{_ as t,z as e,a9 as n,aa as i,ab as r,c as a,l as s,F as o,a1 as c,ac as l,d as h,u as d,ad as p,q as u}from"./mermaid.core-CTf8qcol.js";import{d as g}from"./arc-BW2CYTF6.js";import"./index-CX8KV6EH.js";import"./RemoteLifeOSBlock-C46RjZWn.js";import"./App-CLTYkSvy.js";import"./index-CapF4a8Y.js";import"./file-editor-index-C6CU7Fik.js";import"./purify.es-BNLkGfTg.js";import"./marked.esm-BBjA1da9.js";var y=function(){var e=t(function(t,e,n,i){for(n=n||{},i=t.length;i--;n[t[i]]=e);return n},"o"),n=[6,11,13,14,15,17,19,20,23,24],i=[1,12],r=[1,13],a=[1,14],s=[1,15],o=[1,16],c=[1,19],l=[1,20],h={trace:t(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:t(function(t,e,n,i,r,a,s){var o=a.length-1;switch(r){case 1:return a[o-1];case 3:i.setDirection("LR");break;case 4:i.setDirection("TD");break;case 5:case 9:case 10:this.$=[];break;case 6:a[o-1].push(a[o]),this.$=a[o-1];break;case 7:case 8:this.$=a[o];break;case 11:i.getCommonDb().setDiagramTitle(a[o].substr(6)),this.$=a[o].substr(6);break;case 12:this.$=a[o].trim(),i.getCommonDb().setAccTitle(this.$);break;case 13:case 14:this.$=a[o].trim(),i.getCommonDb().setAccDescription(this.$);break;case 15:i.addSection(a[o].substr(8)),this.$=a[o].substr(8);break;case 18:i.addTask(a[o],0,""),this.$=a[o];break;case 19:i.addEvent(a[o].substr(2)),this.$=a[o]}},"anonymous"),table:[{3:1,4:2,7:[1,3],8:[1,4],9:[1,5]},{1:[3]},e(n,[2,5],{5:6}),e(n,[2,2]),e(n,[2,3]),e(n,[2,4]),{6:[1,7],10:8,11:[1,9],12:10,13:[1,11],14:i,15:r,17:a,19:s,20:o,21:17,22:18,23:c,24:l},e(n,[2,10],{1:[2,1]}),e(n,[2,6]),{12:21,14:i,15:r,17:a,19:s,20:o,21:17,22:18,23:c,24:l},e(n,[2,8]),e(n,[2,9]),e(n,[2,11]),{16:[1,22]},{18:[1,23]},e(n,[2,14]),e(n,[2,15]),e(n,[2,16]),e(n,[2,17]),e(n,[2,18]),e(n,[2,19]),e(n,[2,7]),e(n,[2,12]),e(n,[2,13])],defaultActions:{},parseError:t(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:t(function(e){var n=this,i=[0],r=[],a=[null],s=[],o=this.table,c="",l=0,h=0,d=s.slice.call(arguments,1),p=Object.create(this.lexer),u={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(u.yy[g]=this.yy[g]);p.setInput(e,u.yy),u.yy.lexer=p,u.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var y=p.yylloc;s.push(y);var f=p.options&&p.options.ranges;function m(){var t;return"number"!=typeof(t=r.pop()||p.lex()||1)&&(t instanceof Array&&(t=(r=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof u.yy.parseError?this.parseError=u.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,t(function(t){i.length=i.length-2*t,a.length=a.length-t,s.length=s.length-t},"popStack"),t(m,"lex");for(var x,b,k,w,_,$,v,S,E={};;){if(b=i[i.length-1],this.defaultActions[b]?k=this.defaultActions[b]:(null==x&&(x=m()),k=o[b]&&o[b][x]),void 0===k||!k.length||!k[0]){var T;for(_ in S=[],o[b])this.terminals_[_]&&_>2&&S.push("'"+this.terminals_[_]+"'");T=p.showPosition?"Parse error on line "+(l+1)+":\n"+p.showPosition()+"\nExpecting "+S.join(", ")+", got '"+(this.terminals_[x]||x)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==x?"end of input":"'"+(this.terminals_[x]||x)+"'"),this.parseError(T,{text:p.match,token:this.terminals_[x]||x,line:p.yylineno,loc:y,expected:S})}if(k[0]instanceof Array&&k.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+x);switch(k[0]){case 1:i.push(x),a.push(p.yytext),s.push(p.yylloc),i.push(k[1]),x=null,h=p.yyleng,c=p.yytext,l=p.yylineno,y=p.yylloc;break;case 2:if($=this.productions_[k[1]][1],E.$=a[a.length-$],E._$={first_line:s[s.length-($||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-($||1)].first_column,last_column:s[s.length-1].last_column},f&&(E._$.range=[s[s.length-($||1)].range[0],s[s.length-1].range[1]]),void 0!==(w=this.performAction.apply(E,[c,h,l,u.yy,k[1],a,s].concat(d))))return w;$&&(i=i.slice(0,-1*$*2),a=a.slice(0,-1*$),s=s.slice(0,-1*$)),i.push(this.productions_[k[1]][0]),a.push(E.$),s.push(E._$),v=o[i[i.length-2]][i[i.length-1]],i.push(v);break;case 3:return!0}}return!0},"parse")},d=function(){return{EOF:1,parseError:t(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:t(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:t(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:t(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var i=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),n.length-1&&(this.yylineno-=n.length-1);var r=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:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:t(function(){return this._more=!0,this},"more"),reject:t(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:t(function(t){this.unput(this.match.slice(t))},"less"),pastInput:t(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:t(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:t(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:t(function(t,e){var n,i,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(i=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in r)this[a]=r[a];return!1}return!1},"test_match"),next:t(function(){if(this.done)return this.EOF;var t,e,n,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),a=0;a<r.length;a++)if((n=this._input.match(this.rules[r[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,i=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[i]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:t(function(){return this.next()||this.lex()},"lex"),begin:t(function(t){this.conditionStack.push(t)},"begin"),popState:t(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:t(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:t(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:t(function(t){this.begin(t)},"pushState"),stateStackSize:t(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:t(function(t,e,n,i){switch(n){case 0:case 1:case 3:case 4:break;case 2:return 13;case 5:return 8;case 6:return 9;case 7:return 7;case 8:return 14;case 9:return this.begin("acc_title"),15;case 10:return this.popState(),"acc_title_value";case 11:return this.begin("acc_descr"),17;case 12:return this.popState(),"acc_descr_value";case 13:this.begin("acc_descr_multiline");break;case 14:this.popState();break;case 15:return"acc_descr_multiline_value";case 16:return 20;case 17:return 24;case 18:return 23;case 19:return 6;case 20:return"INVALID"}},"anonymous"),rules:[/^(?:%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[\n]+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:timeline[ \t]+LR\b)/i,/^(?:timeline[ \t]+TD\b)/i,/^(?:timeline\b)/i,/^(?:title\s[^\n]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:section\s[^:\n]+)/i,/^(?::\s(?:[^:\n]|:(?!\s))+)/i,/^(?:[^#:\n]+)/i,/^(?:$)/i,/^(?:.)/i],conditions:{acc_descr_multiline:{rules:[14,15],inclusive:!1},acc_descr:{rules:[12],inclusive:!1},acc_title:{rules:[10],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,11,13,16,17,18,19,20],inclusive:!0}}}}();function p(){this.yy={}}return h.lexer=d,t(p,"Parser"),p.prototype=h,h.Parser=p,new p}();y.parser=y;var f=y,m={};d(m,{addEvent:()=>C,addSection:()=>I,addTask:()=>L,addTaskOrg:()=>N,clear:()=>S,default:()=>O,getCommonDb:()=>v,getDirection:()=>T,getSections:()=>M,getTasks:()=>H,setDirection:()=>E});var x="",b=0,k="LR",w=[],_=[],$=[],v=t(()=>p,"getCommonDb"),S=t(function(){w.length=0,_.length=0,x="",$.length=0,k="LR",u()},"clear"),E=t(function(t){k=t},"setDirection"),T=t(function(){return k},"getDirection"),I=t(function(t){x=t,w.push(t)},"addSection"),M=t(function(){return w},"getSections"),H=t(function(){let t=D(),e=0;for(;!t&&e<100;)t=D(),e++;return _.push(...$),_},"getTasks"),L=t(function(t,e,n){const i={id:b++,section:x,type:x,task:t,score:e||0,events:n?[n]:[]};$.push(i)},"addTask"),C=t(function(t){$.find(t=>t.id===b-1).events.push(t)},"addEvent"),N=t(function(t){const e={section:x,type:x,description:t,task:t,classes:[]};_.push(e)},"addTaskOrg"),D=t(function(){const e=t(function(t){return $[t].processed},"compileTask");let n=!0;for(const[t,i]of $.entries())e(t),n=n&&i.processed;return n},"compileTasks"),O={clear:S,getCommonDb:v,getDirection:T,setDirection:E,addSection:I,getSections:M,getTasks:H,addTask:L,addTaskOrg:N,addEvent:C},A=0,j=t(function(t,e){const n=t.append("rect");return n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),n.attr("rx",e.rx),n.attr("ry",e.ry),void 0!==e.class&&n.attr("class",e.class),n},"drawRect"),B=t(function(e,n){const i=e.append("circle").attr("cx",n.cx).attr("cy",n.cy).attr("class","face").attr("r",15).attr("stroke-width",2).attr("overflow","visible"),r=e.append("g");function a(t){const e=g().startAngle(Math.PI/2).endAngle(Math.PI/2*3).innerRadius(7.5).outerRadius(15/2.2);t.append("path").attr("class","mouth").attr("d",e).attr("transform","translate("+n.cx+","+(n.cy+2)+")")}function s(t){const e=g().startAngle(3*Math.PI/2).endAngle(Math.PI/2*5).innerRadius(7.5).outerRadius(15/2.2);t.append("path").attr("class","mouth").attr("d",e).attr("transform","translate("+n.cx+","+(n.cy+7)+")")}function o(t){t.append("line").attr("class","mouth").attr("stroke",2).attr("x1",n.cx-5).attr("y1",n.cy+7).attr("x2",n.cx+5).attr("y2",n.cy+7).attr("class","mouth").attr("stroke-width","1px").attr("stroke","#666")}return r.append("circle").attr("cx",n.cx-5).attr("cy",n.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),r.append("circle").attr("cx",n.cx+5).attr("cy",n.cy-5).attr("r",1.5).attr("stroke-width",2).attr("fill","#666").attr("stroke","#666"),t(a,"smile"),t(s,"sad"),t(o,"ambivalent"),n.score>3?a(r):n.score<3?s(r):o(r),i},"drawFace"),R=t(function(t,e){const n=t.append("circle");return n.attr("cx",e.cx),n.attr("cy",e.cy),n.attr("class","actor-"+e.pos),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("r",e.r),void 0!==n.class&&n.attr("class",n.class),void 0!==e.title&&n.append("title").text(e.title),n},"drawCircle"),P=t(function(t,e){const n=e.text.replace(/<br\s*\/?>/gi," "),i=t.append("text");i.attr("x",e.x),i.attr("y",e.y),i.attr("class","legend"),i.style("text-anchor",e.anchor),void 0!==e.class&&i.attr("class",e.class);const r=i.append("tspan");return r.attr("x",e.x+2*e.textMargin),r.text(n),i},"drawText"),F=t(function(e,n){function i(t,e,n,i,r){return t+","+e+" "+(t+n)+","+e+" "+(t+n)+","+(e+i-r)+" "+(t+n-1.2*r)+","+(e+i)+" "+t+","+(e+i)}t(i,"genPoints");const r=e.append("polygon");r.attr("points",i(n.x,n.y,50,20,7)),r.attr("class","labelBox"),n.y=n.y+n.labelMargin,n.x=n.x+.5*n.labelMargin,P(e,n)},"drawLabel"),W=t(function(t,e,n){const i=t.append("g"),r=q();r.x=e.x,r.y=e.y,r.fill=e.fill,r.width=n.width,r.height=n.height,r.class="journey-section section-type-"+e.num,r.rx=3,r.ry=3,j(i,r),Z(n)(e.text,i,r.x,r.y,r.width,r.height,{class:"journey-section section-type-"+e.num},n,e.colour)},"drawSection"),z=-1,V=t(function(t,e,n,i){const r=e.x+n.width/2,a=t.append("g");z++,a.append("line").attr("id",i+"-task"+z).attr("x1",r).attr("y1",e.y).attr("x2",r).attr("y2",450).attr("class","task-line").attr("stroke-width","1px").attr("stroke-dasharray","4 2").attr("stroke","#666"),B(a,{cx:r,cy:300+30*(5-e.score),score:e.score});const s=q();s.x=e.x,s.y=e.y,s.fill=e.fill,s.width=n.width,s.height=n.height,s.class="task task-type-"+e.num,s.rx=3,s.ry=3,j(a,s),Z(n)(e.task,a,s.x,s.y,s.width,s.height,{class:"task"},n,e.colour)},"drawTask"),G=t(function(t,e){j(t,{x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,class:"rect"}).lower()},"drawBackgroundRect"),U=t(function(){return{x:0,y:0,fill:void 0,"text-anchor":"start",width:100,height:100,textMargin:0,rx:0,ry:0}},"getTextObj"),q=t(function(){return{x:0,y:0,width:100,anchor:"start",height:100,rx:0,ry:0}},"getNoteRect"),Z=function(){function e(t,e,n,i,a,s,o,c){r(e.append("text").attr("x",n+a/2).attr("y",i+s/2+5).style("font-color",c).style("text-anchor","middle").text(t),o)}function n(t,e,n,i,a,s,o,c,l){const{taskFontSize:h,taskFontFamily:d}=c,p=t.split(/<br\s*\/?>/gi);for(let u=0;u<p.length;u++){const t=u*h-h*(p.length-1)/2,c=e.append("text").attr("x",n+a/2).attr("y",i).attr("fill",l).style("text-anchor","middle").style("font-size",h).style("font-family",d);c.append("tspan").attr("x",n+a/2).attr("dy",t).text(p[u]),c.attr("y",i+s/2).attr("dominant-baseline","central").attr("alignment-baseline","central"),r(c,o)}}function i(t,e,i,a,s,o,c,l){const h=e.append("switch"),d=h.append("foreignObject").attr("x",i).attr("y",a).attr("width",s).attr("height",o).attr("position","fixed").append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").attr("class","label").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),n(t,h,i,a,s,o,c,l),r(d,c)}function r(t,e){for(const n in e)n in e&&t.attr(n,e[n])}return t(e,"byText"),t(n,"byTspan"),t(i,"byFo"),t(r,"_setTextAttrs"),function(t){return"fo"===t.textPlacement?i:"old"===t.textPlacement?e:n}}(),Y=t(function(t,e){A=0,z=-1,t.append("defs").append("marker").attr("id",e+"-arrowhead").attr("refX",5).attr("refY",2).attr("markerWidth",6).attr("markerHeight",4).attr("orient","auto").append("path").attr("d","M 0,0 V 4 L6,2 Z")},"initGraphics");function X(t,e){t.each(function(){var t,n=h(this),i=n.text().split(/(\s+|<br>)/).reverse(),r=[],a=n.attr("y"),s=parseFloat(n.attr("dy")),o=n.text(null).append("tspan").attr("x",0).attr("y",a).attr("dy",s+"em");for(let c=0;c<i.length;c++)t=i[i.length-1-c],r.push(t),o.text(r.join(" ").trim()),(o.node().getComputedTextLength()>e||"<br>"===t)&&(r.pop(),o.text(r.join(" ").trim()),r="<br>"===t?[""]:[t],o=n.append("tspan").attr("x",0).attr("y",a).attr("dy","1.1em").text(t))})}t(X,"wrap");var J=t(function(t,e,n,i,r,a=!1){const{theme:s,look:o}=i,c=s?.includes("redux"),l=n%(i?.themeVariables?.THEME_COLOR_LIMIT??12)-1,d=t.append("g");e.section=l,d.attr("class",(e.class?e.class+" ":"")+"timeline-node section-"+l);const p=d.append("g"),u=d.append("g"),g=u.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(X,e.width).node().getBBox(),y=i.fontSize?.replace?i.fontSize.replace("px",""):i.fontSize;if(e.height=g.height+1.1*y*.5+e.padding,e.height=Math.max(e.height,e.maxHeight),e.width=e.width+2*e.padding,u.attr("transform","translate("+e.width/2+", "+e.padding/2+")"),c&&u.attr("transform",`translate(${e.width/2}, ${a?e.padding/2+3:e.padding})`),Q(p,e,l,r,i),"neo"===o&&(d.attr("data-look","neo"),c)){const e=s.includes("dark"),n=t.node()?.ownerSVGElement??t.node(),i=h(n),r=i.attr("id")??"",a=r?`${r}-drop-shadow`:"drop-shadow";if(i.select(`#${a}`).empty()){const t=i.select("defs");(t.empty()?i.append("defs"):t).append("filter").attr("id",a).attr("height","130%").attr("width","130%").append("feDropShadow").attr("dx","4").attr("dy","4").attr("stdDeviation",0).attr("flood-opacity",e?"0.2":"0.06").attr("flood-color",e?"#FFFFFF":"#000000")}}return e},"drawNode"),K=t(function(t,e,n){const i=t.append("g"),r=i.append("text").text(e.descr).attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle").call(X,e.width).node().getBBox(),a=n.fontSize?.replace?n.fontSize.replace("px",""):n.fontSize;return i.remove(),r.height+1.1*a*.5+e.padding},"getVirtualNodeHeight"),Q=t(function(t,e,n,i,r){const{theme:a}=r,s=a?.includes("redux")?0:5,o=s>0?`M0 ${e.height-5} v${10-e.height} q0,-${s},${s},-${s} h${e.width-10} q${s},0,${s},${s} v${e.height-5} H0 Z`:`M0 ${e.height-5} v${-(e.height-5)} h${e.width} v${e.height} H0 Z`;t.append("path").attr("id",i+"-node-"+A++).attr("class","node-bkg node-"+e.type).attr("d",o),a?.includes("redux")||t.append("line").attr("class","node-line-"+n).attr("x1",0).attr("y1",e.height).attr("x2",e.width).attr("y2",e.height)},"defaultBkg"),tt={drawRect:j,drawCircle:R,drawSection:W,drawText:P,drawLabel:F,drawTask:V,drawBackgroundRect:G,getTextObj:U,getNoteRect:q,initGraphics:Y,drawNode:J,getVirtualNodeHeight:K},et=t(function(t,e,n,i){const r=a(),{look:o,theme:c,themeVariables:d}=r,{useGradient:p,gradientStart:u,gradientStop:g}=d,y=r.timeline?.leftMargin??50;s.debug("timeline",i.db);const f=r.securityLevel;let m;"sandbox"===f&&(m=h("#i"+e));const x=h("sandbox"===f?m.nodes()[0].contentDocument.body:"body").select("#"+e);x.append("g");const b=i.db.getTasks(),k=i.db.getCommonDb().getDiagramTitle();s.debug("task",b),tt.initGraphics(x,e);const w=i.db.getSections();s.debug("sections",w);let _=0,$=0,v=0,S=0,E=50+y,T=50;S=50;let I=0,M=!0;w.forEach(function(t){const e={number:I,descr:t,section:I,width:150,padding:20,maxHeight:_},n=tt.getVirtualNodeHeight(x,e,r);s.debug("sectionHeight before draw",n),_=Math.max(_,n+20)});let H=0,L=0;s.debug("tasks.length",b.length);for(const[a,l]of b.entries()){const t={number:a,descr:l,section:l.section,width:150,padding:20,maxHeight:$},e=tt.getVirtualNodeHeight(x,t,r);s.debug("taskHeight before draw",e),$=Math.max($,e+20),H=Math.max(H,l.events.length);let n=0;for(const i of l.events){const t={descr:i,section:l.section,number:l.section,width:150,padding:20,maxHeight:50};n+=tt.getVirtualNodeHeight(x,t,r)}l.events.length>0&&(n+=10*(l.events.length-1)),L=Math.max(L,n)}s.debug("maxSectionHeight before draw",_),s.debug("maxTaskHeight before draw",$),w&&w.length>0?w.forEach(t=>{const n=b.filter(e=>e.section===t),i={number:I,descr:t,section:I,width:200*Math.max(n.length,1)-50,padding:20,maxHeight:_};s.debug("sectionNode",i);const a=x.append("g"),o=tt.drawNode(a,i,I,r,e);s.debug("sectionNode output",o),a.attr("transform",`translate(${E}, 50)`),T+=_+50,n.length>0&&nt(x,n,I,E,T,$,r,H,L,_,!1,e),E+=200*Math.max(n.length,1),T=50,I++}):(M=!1,nt(x,b,I,E,T,$,r,H,L,_,!0,e));const C=x.node().getBBox();if(s.debug("bounds",C),k&&x.append("text").text(k).attr("x","neo"===o?2*C.x+y:C.width/2-y).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),v=M?_+$+150:$+100,x.append("g").attr("class","lineWrapper").append("line").attr("x1",y).attr("y1",v).attr("x2",C.width+3*y).attr("y2",v).attr("stroke-width",4).attr("stroke","black").attr("marker-end",`url(#${e}-arrowhead)`),"neo"===o&&p&&"neutral"!==c){const t=x.select("defs"),e=(t.empty()?x.append("defs"):t).append("linearGradient").attr("id",x.attr("id")+"-gradient").attr("gradientUnits","objectBoundingBox").attr("x1","0%").attr("y1","0%").attr("x2","100%").attr("y2","0%");e.append("stop").attr("offset","0%").attr("stop-color",u).attr("stop-opacity",1),e.append("stop").attr("offset","100%").attr("stop-color",g).attr("stop-opacity",1)}l(void 0,x,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),nt=t(function(t,e,n,i,r,a,o,c,l,h,d,p){for(const u of e){const e={descr:u.task,section:n,number:n,width:150,padding:20,maxHeight:a};s.debug("taskNode",e);const c=t.append("g").attr("class","taskWrapper"),h=tt.drawNode(c,e,n,o,p).height;if(s.debug("taskHeight after draw",h),c.attr("transform",`translate(${i}, ${r})`),a=Math.max(a,h),u.events){const e=t.append("g").attr("class","lineWrapper");let s=a;r+=100,s+=it(t,u.events,n,i,r,o,p),r-=100,e.append("line").attr("x1",i+95).attr("y1",r+a).attr("x2",i+95).attr("y2",r+a+100+l+100).attr("stroke-width",2).attr("stroke","black").attr("marker-end",`url(#${p}-arrowhead)`).attr("stroke-dasharray","5,5")}i+=200,d&&!o.timeline?.disableMulticolor&&n++}r-=10},"drawTasks"),it=t(function(t,e,n,i,r,a,o){let c=0;const l=r;r+=100;for(const h of e){const e={descr:h,section:n,number:n,width:150,padding:20,maxHeight:50};s.debug("eventNode",e);const l=t.append("g").attr("class","eventWrapper"),d=tt.drawNode(l,e,n,a,o,!0).height;c+=d,l.attr("transform",`translate(${i}, ${r})`),r=r+10+d}return r=l,c},"drawEvents"),rt={setConf:t(()=>{},"setConf"),draw:et},at=t(function(t,e,n,i){const r=a(),h=r.timeline?.leftMargin??50;s.debug("timeline",i.db);const d=o(e);d.append("g");const p=i.db.getTasks(),u=i.db.getCommonDb().getDiagramTitle();s.debug("task",p),tt.initGraphics(d);const g=i.db.getSections();s.debug("sections",g);let y=0,f=0;const m=50+h;let x=50;const b=x,k=m+230;let w=0;const _=g&&g.length>0,$=_?k:m+230,v=Math.max(50,580);g.forEach(function(t){const e={number:w,descr:t,section:w,width:v,padding:5,maxHeight:y},n=tt.getVirtualNodeHeight(d,e,r);s.debug("sectionHeight before draw",n),y=Math.max(y,n)});let S=0;s.debug("tasks.length",p.length);for(const[a,o]of p.entries()){const t={number:a,descr:o,section:o.section,width:200,padding:5,maxHeight:f},e=tt.getVirtualNodeHeight(d,t,r);s.debug("taskHeight before draw",e),f=Math.max(f,e);let n=0;for(const i of o.events){const t={descr:i,section:o.section,number:o.section,width:300,padding:5,maxHeight:50};n+=tt.getVirtualNodeHeight(d,t,r)}o.events.length>0&&(n+=10*(o.events.length-1)),S=Math.max(S,n)+0}s.debug("maxSectionHeight before draw",y),s.debug("maxTaskHeight before draw",f);const E=Math.max(f,S)+30;_?g.forEach(t=>{const e=p.filter(e=>e.section===t),n={number:w,descr:t,section:w,width:v,padding:5,maxHeight:y};s.debug("sectionNode",n);const i=d.append("g"),a=tt.drawNode(i,n,w,r);s.debug("sectionNode output",a);const o=$-230;i.attr("transform",`translate(${o}, ${x})`);const c=x+a.height+20;e.length>0&&st(d,e,w,$,c,f,r,E,!1);const l=e.length,h=a.height+20+E*Math.max(l,1)-(l>0?60:0);x+=h,w++}):st(d,p,w,$,x,f,r,E,!0);let T=d.node()?.getBBox();if(!T)throw new Error("bbox not found");if(s.debug("bounds",T),u){if(d.append("text").text(u).attr("x",T.width/2-h).attr("font-size","4ex").attr("font-weight","bold").attr("y",20),T=d.node()?.getBBox(),!T)throw new Error("bbox not found");s.debug("bounds after title",T)}const[I]=c(r.fontSize),M=2*(I??16),H=.5*(I??16)+20,L=d.append("g").attr("class","lineWrapper");L.append("line").attr("x1",$).attr("y1",b-M).attr("x2",$).attr("y2",T.y+T.height+H).attr("stroke-width",4).attr("stroke","black").attr("marker-end","url(#arrowhead)"),L.lower(),l(void 0,d,r.timeline?.padding??50,r.timeline?.useMaxWidth??!1)},"draw"),st=t(function(t,e,n,i,r,a,o,c,l){for(const h of e){const e={descr:h.task,section:n,number:n,width:200,padding:5,maxHeight:a};s.debug("taskNode",e);const d=t.append("g").attr("class","taskWrapper"),p=tt.drawNode(d,e,n,o),u=p.height;s.debug("taskHeight after draw",u);const g=i-20-p.width;if(d.attr("transform",`translate(${g}, ${r})`),a=Math.max(a,u),h.events&&h.events.length>0){const e=r,a=i+50;ot(t,h.events,n,i,a,e,o)}r+=c,l&&!o.timeline?.disableMulticolor&&n++}},"drawTasks"),ot=t(function(t,e,n,i,r,a,o){let c=a;for(const l of e){const e={descr:l,section:n,number:n,width:300,padding:5,maxHeight:0};s.debug("eventNode",e);const a=t.append("g").attr("class","eventWrapper"),h=tt.drawNode(a,e,n,o).height;a.attr("transform",`translate(${r}, ${c})`);const d=c+h/2;t.append("g").attr("class","lineWrapper").append("line").attr("x1",i).attr("y1",d).attr("x2",r).attr("y2",d).attr("stroke-width",2).attr("stroke","black").attr("marker-end","url(#arrowhead)").attr("stroke-dasharray","5,5"),c=c+h+10}return c-a},"drawEvents"),ct={setConf:t(()=>{},"setConf"),draw:at},lt=t(t=>{const{theme:n}=e(),i=n?.includes("dark"),r=n?.includes("color"),a=t.svgId?.replace(/^#/,"")??"",s=a?`url(#${a}-drop-shadow)`:t.dropShadow??"none";let o="";for(let e=0;e<t.THEME_COLOR_LIMIT;e++){const n=""+(17-3*e),a=r?t.borderColorArray[e]:t.mainBkg,c=r?t.borderColorArray[e]:t.nodeBorder;o+=`\n .section-${e-1} rect,\n .section-${e-1} path,\n .section-${e-1} circle {\n fill: ${i&&r?t.mainBkg:a};\n stroke: ${c};\n stroke-width: ${t.strokeWidth};\n filter: ${s};\n }\n\n .section-${e-1} text {\n fill: ${t.nodeBorder};\n font-weight: ${t.fontWeight}\n }\n\n .node-icon-${e-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+e]};\n }\n\n .section-edge-${e-1} {\n stroke: ${t["cScale"+e]};\n }\n\n .edge-depth-${e-1} {\n stroke-width: ${n};\n }\n\n .section-${e-1} line {\n stroke: ${t["cScaleInv"+e]};\n stroke-width: 3;\n }\n\n .lineWrapper line {\n stroke: ${t.nodeBorder};\n stroke-width:${t.strokeWidth}\n }\n\n .disabled,\n .disabled circle,\n .disabled text {\n fill: ${t.tertiaryColor??"lightgray"};\n }\n\n .disabled text {\n fill: ${t.clusterBorder??"#efefef"};\n }\n `}return o},"genReduxSections"),ht=t(t=>{let e="";for(let a=0;a<t.THEME_COLOR_LIMIT;a++)t["lineColor"+a]=t["lineColor"+a]||t["cScaleInv"+a],n(t["lineColor"+a])?t["lineColor"+a]=i(t["lineColor"+a],20):t["lineColor"+a]=r(t["lineColor"+a],20);for(let n=0;n<t.THEME_COLOR_LIMIT;n++){const i=""+(17-3*n);e+=`\n .section-${n-1} rect, .section-${n-1} path, .section-${n-1} circle, .section-${n-1} path {\n fill: ${t["cScale"+n]};\n }\n .section-${n-1} text {\n fill: ${t["cScaleLabel"+n]};\n }\n .node-icon-${n-1} {\n font-size: 40px;\n color: ${t["cScaleLabel"+n]};\n }\n .section-edge-${n-1}{\n stroke: ${t["cScale"+n]};\n }\n .edge-depth-${n-1}{\n stroke-width: ${i};\n }\n .section-${n-1} line {\n stroke: ${t["cScaleInv"+n]} ;\n stroke-width: 3;\n }\n\n .lineWrapper line{\n stroke: ${t["cScaleLabel"+n]} ;\n }\n\n .disabled, .disabled circle, .disabled text {\n fill: ${t.tertiaryColor??"lightgray"};\n }\n .disabled text {\n fill: ${t.clusterBorder??"#efefef"};\n }\n `}return e},"genSections"),dt=t(t=>{const{theme:n}=e(),i=n?.includes("redux"),r="neutral"===n,a=t.svgId?.replace(/^#/,"")??"";let s="";if(t.useGradient&&a&&t.THEME_COLOR_LIMIT&&!r)for(let e=0;e<t.THEME_COLOR_LIMIT;e++)s+=`\n .section-${e-1}[data-look="neo"] rect,\n .section-${e-1}[data-look="neo"] path,\n .section-${e-1}[data-look="neo"] circle {\n fill: ${t.mainBkg};\n stroke: url(#${a}-gradient);\n stroke-width: 2;\n }\n .section-${e-1}[data-look="neo"] line {\n stroke: url(#${a}-gradient);\n stroke-width: 2;\n }`;return`\n .edge {\n stroke-width: 3;\n }\n ${i?lt(t):ht(t)}\n ${s}\n .section-root rect, .section-root path, .section-root circle {\n fill: ${t.git0};\n }\n .section-root text {\n fill: ${t.gitBranchLabel0};\n }\n .icon-container {\n height:100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n .edge {\n fill: none;\n }\n .eventWrapper {\n filter: brightness(120%);\n }\n`},"getStyles"),pt={db:m,renderer:{setConf:t(()=>{},"setConf"),draw:t((t,e,n,i)=>"TD"===(i?.db?.getDirection?.()??"LR")?ct.draw(t,e,n,i):rt.draw(t,e,n,i),"draw")},parser:f,styles:dt};export{pt as diagram};
|
package/dist/web/assets/{vennDiagram-L72KCM5P-DZbkibLf.js → vennDiagram-L72KCM5P-C_5c80TB.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b3 as t,_ as e,s as n,g as s,p as i,o as r,a as o,b as a,z as l,F as c,d as h,ak as u,a9 as f,aa as d,ab as y,e as g,q as x,B as p,D as m}from"./mermaid.core-D1pd82vj.js";import"./RemoteLifeOSBlock-bq0Spc3-.js";import"./index-BIOvx5-n.js";import"./purify.es-BNLkGfTg.js";import"./marked.esm-BBjA1da9.js";import"./App-C560TMeI.js";import"./index-CfjAw18S.js";import"./file-editor-index-C6CU7Fik.js";const b=(e,n)=>t(e,"a",-n);function v(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let s=n+1;s<t.length;++s){const i=w(t[n],t[s]);for(const t of i)t.parentIndex=[n,s],e.push(t)}return e}(t),s=n.filter(e=>function(t,e){return e.every(e=>M(t,e)<e.radius+1e-10)}(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=_(s);for(let t=0;t<s.length;++t){const n=s[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}s.sort((t,e)=>e.angle-t.angle);let n=s[s.length-1];for(let a=0;a<s.length;++a){const e=s[a];r+=(n.x+e.x)*(e.y-n.y);const l={x:(e.x+n.x)/2,y:(e.y+n.y)/2};let c=null;for(let s=0;s<e.parentIndex.length;++s)if(n.parentIndex.includes(e.parentIndex[s])){const i=t[e.parentIndex[s]],r=Math.atan2(e.x-i.x,e.y-i.y),o=Math.atan2(n.x-i.x,n.y-i.y);let a=o-r;a<0&&(a+=2*Math.PI);const h=o-a/2;let u=M(l,{x:i.x+i.radius*Math.sin(h),y:i.y+i.radius*Math.cos(h)});u>2*i.radius&&(u=2*i.radius),(null==c||c.width>u)&&(c={circle:i,width:u,p1:e,p2:n,large:u>i.radius,sweep:!0})}null!=c&&(o.push(c),i+=I(c.circle.radius,c.width),n=e)}}else{let e=t[0];for(let s=1;s<t.length;++s)t[s].radius<e.radius&&(e=t[s]);let n=!1;for(let s=0;s<t.length;++s)if(M(t[s],e)>Math.abs(e.radius-t[s].radius)){n=!0;break}n?i=r=0:(i=e.radius*e.radius*Math.PI,o.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-1e-10,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return r/=2,e&&(e.area=i+r,e.arcArea=i,e.polygonArea=r,e.arcs=o,e.innerPoints=s,e.intersectionPoints=n),i+r}function I(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function M(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function k(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(n*n-t*t+e*e)/(2*n);return I(t,t-(n*n-e*e+t*t)/(2*n))+I(e,s)}function w(t,e){const n=M(t,e),s=t.radius,i=e.radius;if(n>=s+i||n<=Math.abs(s-i))return[];const r=(s*s-i*i+n*n)/(2*n),o=Math.sqrt(s*s-r*r),a=t.x+r*(e.x-t.x)/n,l=t.y+r*(e.y-t.y)/n,c=-(e.y-t.y)*(o/n),h=-(e.x-t.x)*(o/n);return[{x:a+c,y:l-h},{x:a-c,y:l+h}]}function _(t){const e={x:0,y:0};for(const n of t)e.x+=n.x,e.y+=n.y;return e.x/=t.length,e.y/=t.length,e}function S(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function E(t,e){return S(t).map(()=>S(e))}function T(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function z(t){return Math.sqrt(T(t,t))}function A(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function R(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function N(t,e,n){const s=(n=n||{}).maxIterations||200*e.length,i=n.nonZeroDelta||1.05,r=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,a=n.minErrorDelta||1e-5,l=void 0!==n.rho?n.rho:1,c=void 0!==n.chi?n.chi:2,h=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f;const d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e),y[0].id=0;for(let I=0;I<d;++I){const n=e.slice();n[I]=n[I]?n[I]*i:r,y[I+1]=n,y[I+1].fx=t(n),y[I+1].id=I+1}function g(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const x=(t,e)=>t.fx-e.fx,p=e.slice(),m=e.slice(),b=e.slice(),v=e.slice();for(let I=0;I<s;++I){if(y.sort(x),n.history){const t=y.map(t=>{const e=t.slice();return e.fx=t.fx,e.id=t.id,e});t.sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:t})}f=0;for(let t=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<o&&f<a)break;for(let t=0;t<d;++t){p[t]=0;for(let e=0;e<d;++e)p[t]+=y[e][t];p[t]/=d}const e=y[d];if(R(m,1+l,p,-l,e),m.fx=t(m),m.fx<y[0].fx)R(v,1+c,p,-c,e),v.fx=t(v),v.fx<m.fx?g(v):g(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(R(b,1+h,p,-h,e),b.fx=t(b),b.fx<e.fx?g(b):n=!0):(R(b,1-h*l,p,h*l,e),b.fx=t(b),b.fx<m.fx?g(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)R(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else g(m)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function D(t,e,n,s,i,r,o){const a=n.fx,l=T(n.fxprime,e);let c=a,h=a,u=l,f=0;function d(h,f,d){for(let y=0;y<16;++y)if(i=(h+f)/2,R(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=T(s.fxprime,e),c>a+r*i*l||c>=d)f=i;else{if(Math.abs(u)<=-o*l)return i;u*(f-h)>=0&&(f=h),h=i,d=c}return 0}i=i||1,r=r||1e-6,o=o||.1;for(let y=0;y<10;++y){if(R(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=T(s.fxprime,e),c>a+r*i*l||y&&c>=h)return d(f,i,h);if(Math.abs(u)<=-o*l)return i;if(u>=0)return d(i,f,c);h=c,f=i,i*=2}return i}function O(t,e,n){let s={x:e.slice(),fx:0,fxprime:e.slice()},i={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let o,a,l,c=1;l=(n=n||{}).maxIterations||20*e.length,s.fx=t(s.x,s.fxprime),o=s.fxprime.slice(),A(o,s.fxprime,-1);for(let h=0;h<l;++h){if(c=D(t,o,s,i,c),n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),c){R(r,1,i.fxprime,-1,s.fxprime);const t=T(s.fxprime,s.fxprime);R(o,Math.max(0,T(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else A(o,s.fxprime,-1);if(z(s.fxprime)<=1e-5)break}return n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),s}function F(t,e={}){e.maxIterations=e.maxIterations||500;const n=e.initialLayout||$,s=e.lossFunction||P,i=function(t,e={}){const n=e.distinct,s=t.map(t=>Object.assign({},t));function i(t){return t.join(";")}if(n){const t=new Map;for(const e of s)for(let n=0;n<e.sets.length;n++){const s=String(e.sets[n]);t.set(s,e.size+(t.get(s)||0));for(let i=n+1;i<e.sets.length;i++){const n=String(e.sets[i]),r=`${s};${n}`,o=`${n};${s}`;t.set(r,e.size+(t.get(r)||0)),t.set(o,e.size+(t.get(o)||0))}}for(const e of s)e.sets.length<3&&(e.size=t.get(i(e.sets)))}const r=[],o=new Set;for(const a of s)if(1===a.sets.length)r.push(a.sets[0]);else if(2===a.sets.length){const t=a.sets[0],e=a.sets[1];o.add(i(a.sets)),o.add(i([e,t]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let a=0;a<r.length;++a){const t=r[a];for(let e=a+1;e<r.length;++e){const n=r[e];o.has(i([t,n]))||s.push({sets:[t,n],size:0})}}return s}(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const c of o)a.push(r[c].x),a.push(r[c].y);const l=N(t=>{const e={};for(let n=0;n<o.length;++n){const s=o[n];e[s]={x:t[2*n],y:t[2*n+1],radius:r[s].radius}}return s(e,i)},a,e).x;for(let c=0;c<o.length;++c){const t=o[c];r[t].x=l[2*c],r[t].y=l[2*c+1]}return r}const C=1e-10;function j(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+C?Math.abs(t-e):function(t,e,n,s){const i=(s=s||{}).maxIterations||100,r=s.tolerance||1e-10,o=t(e),a=t(n);let l=n-e;if(o*a>0)throw"Initial bisect points must have opposite signs";if(0===o)return e;if(0===a)return n;for(let c=0;c<i;++c){l/=2;const n=e+l,s=t(n);if(s*o>=0&&(e=n),Math.abs(l)<r||0===s)return n}return e+l}(s=>k(t,e,s)-n,0,t+e)}function $(t,e={}){let n=function(t,e){const n=e&&e.lossFunction?e.lossFunction:P,s={},i={};for(const u of t)if(1===u.sets.length){const t=u.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:u.size,radius:Math.sqrt(u.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const u of t){let t=null!=u.weight?u.weight:1;const e=u.sets[0],n=u.sets[1];u.size+C>=Math.min(s[e].size,s[n].size)&&(t=0),i[e].push({set:n,size:u.size,weight:t}),i[n].push({set:e,size:u.size,weight:t})}const r=[];function o(t,e){return e.size-t.size}Object.keys(i).forEach(t=>{let e=0;for(let n=0;n<i[t].length;++n)e+=i[t][n].size*i[t][n].weight;r.push({set:t,size:e})}),r.sort(o);const a={};function l(t){return t.set in a}function c(t,e){s[e].x=t.x,s[e].y=t.y,a[e]=!0}c({x:0,y:0},r[0].set);for(let u=1;u<r.length;++u){const e=r[u].set,a=i[e].filter(l),f=s[e];if(a.sort(o),0===a.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<a.length;++h){const t=s[a[h].set],e=j(f.radius,t.radius,a[h].size);d.push({x:t.x+e,y:t.y}),d.push({x:t.x-e,y:t.y}),d.push({y:t.y+e,x:t.x}),d.push({y:t.y-e,x:t.x});for(let n=h+1;n<a.length;++n){const i=s[a[n].set],r=j(f.radius,i.radius,a[n].size),o=w({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,g=d[0];for(const i of d){s[e].x=i.x,s[e].y=i.y;const r=n(s,t);r<y&&(y=r,g=i)}c(g,e)}return s}(t,e);const s=e.lossFunction||P;if(t.length>=8){const i=function(t,e={}){const n=e.restarts||10,s=[],i={};for(const f of t)1===f.sets.length&&(i[f.sets[0]]=s.length,s.push(f));let{distances:r,constraints:o}=function(t,e,n){const s=E(e.length,e.length),i=E(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{const r=n[t.sets[0]],o=n[t.sets[1]],a=j(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[o].size/Math.PI),t.size);s[r][o]=s[o][r]=a;let l=0;t.size+1e-10>=Math.min(e[r].size,e[o].size)?l=1:t.size<=1e-10&&(l=-1),i[r][o]=i[o][r]=l}),{distances:s,constraints:i}}(t,s,i);const a=z(r.map(z))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>function(t,e,n,s){for(let r=0;r<e.length;++r)e[r]=0;let i=0;for(let r=0;r<n.length;++r){const o=t[2*r],a=t[2*r+1];for(let l=r+1;l<n.length;++l){const c=t[2*l],h=t[2*l+1],u=n[r][l],f=s[r][l],d=(c-o)*(c-o)+(h-a)*(h-a),y=Math.sqrt(d),g=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*g*g,e[2*r]+=4*g*(o-c),e[2*r+1]+=4*g*(a-h),e[2*l]+=4*g*(c-o),e[2*l+1]+=4*g*(h-a))}}return i}(t,e,r,o);let c=null;for(let f=0;f<n;++f){const t=O(l,S(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let f=0;f<s.length;++f){const t=s[f];u[t.sets[0]]={x:h[2*f]*a,y:h[2*f+1]*a,radius:Math.sqrt(t.size/Math.PI)}}if(e.history)for(const f of e.history)A(f.x,a);return u}(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}return n}function P(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=k(n.radius,i.radius,M(n,i))}else e=v(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function L(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=k(n.radius,i.radius,M(n,i))}else e=v(s.sets.map(e=>t[e]));const i=null!=s.weight?s.weight:1,r=Math.log((e+1)/(s.size+1));n+=i*r*r}return n}function q(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),t.length>0){const e=t[0].x,n=t[0].y;for(const s of t)s.x-=e,s.y-=n}if(2===t.length&&M(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 n=Math.atan2(t[1].x,t[1].y)-e,s=Math.cos(n),i=Math.sin(n);for(const e of t){const t=e.x,n=e.y;e.x=s*t-i*n,e.y=i*t+s*n}}if(t.length>2){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(const n of t){var s=(n.x+e*n.y)/(1+e*e);n.x=2*s-n.x,n.y=2*s*e-n.y}}}}function B(t){const e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function U(t,e,n){null==e&&(e=Math.PI/2);let s=V(t).map(t=>Object.assign({},t));const i=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}function n(t,n){const s=e(t),i=e(n);s.parent=i}t.forEach(t=>{t.parent=t});for(let i=0;i<t.length;++i)for(let e=i+1;e<t.length;++e){const s=t[i].radius+t[e].radius;M(t[i],t[e])+1e-10<s&&n(t[e],t[i])}const s=new Map;for(let i=0;i<t.length;++i){const n=e(t[i]).parent.setid;s.has(n)||s.set(n,[]),s.get(n).push(t[i])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(s);for(const c of i){q(c,e,n);const t=B(c);c.size=(t.xRange.max-t.xRange.min)*(t.yRange.max-t.yRange.min),c.bounds=t}i.sort((t,e)=>e.size-t.size),s=i[0];let r=s.bounds;const o=(r.xRange.max-r.xRange.min)/50;function a(t,e,n){if(!t)return;const i=t.bounds;let a,l;if(e)a=r.xRange.max-i.xRange.min+o;else{a=r.xRange.max-i.xRange.max;const t=(i.xRange.max-i.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;t<0&&(a+=t)}if(n)l=r.yRange.max-i.yRange.min+o;else{l=r.yRange.max-i.yRange.max;const t=(i.yRange.max-i.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;t<0&&(l+=t)}for(const r of t)r.x+=a,r.y+=l,s.push(r)}let l=1;for(;l<i.length;)a(i[l],!0,!1),a(i[l+1],!1,!0),a(i[l+2],!0,!0),l+=3,r=B(s);return W(s)}function G(t,e,n,s,i){const r=V(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=B(r);if(o.max===o.min||a.max===a.min)return console.log("not scaling solution: zero size detected"),t;let l,c;if(i){const t=2*Math.sqrt(i/Math.PI);l=e/t,c=n/t}else l=e/(o.max-o.min),c=n/(a.max-a.min);const h=Math.min(c,l),u=(e-(o.max-o.min)*h)/2,f=(n-(a.max-a.min)*h)/2;return W(r.map(t=>({radius:h*t.radius,x:s+u+(t.x-o.min)*h,y:s+f+(t.y-a.min)*h,setid:t.setid})))}function W(t){const e={};for(const n of t)e[n.setid]=n;return e}function V(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function X(t,e){return function(n){const s=this,i=t[n.sets[0]].radius||50,r=e(n)||"",o=r.split(/\s+/).reverse(),a=(r.length+o.length)/3;let l=o.pop(),c=[l],h=0;s.textContent=null;const u=[];function f(t){const e=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return e.textContent=t,u.push(e),s.append(e),e}let d=f(l);for(;l=o.pop(),l;){c.push(l);const t=c.join(" ");d.textContent=t,t.length>a&&d.getComputedTextLength()>i&&(c.pop(),d.textContent=c.join(" "),c=[l],d=f(l),h++)}const y=.35-1.1*h/2,g=s.getAttribute("x"),x=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",x),t.setAttribute("dy",`${y+1.1*e}em`)})}}function Y(t,e,n){let s=e[0].radius-M(e[0],t);for(let i=1;i<e.length;++i){const n=e[i].radius-M(e[i],t);n<=s&&(s=n)}for(let i=0;i<n.length;++i){const e=M(n[i],t)-n[i].radius;e<=s&&(s=e)}return s}function K(t,e,n){const s=[];for(const h of t)s.push({x:h.x,y:h.y}),s.push({x:h.x+h.radius/2,y:h.y}),s.push({x:h.x-h.radius/2,y:h.y}),s.push({x:h.x,y:h.y+h.radius/2}),s.push({x:h.x,y:h.y-h.radius/2});let i=s[0],r=Y(s[0],t,e);for(let h=1;h<s.length;++h){const n=Y(s[h],t,e);n>=r&&(i=s[h],r=n)}const o=N(n=>-1*Y({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,a={x:n?0:o[0],y:o[1]};let l=!0;for(const h of t)if(M(a,h)>h.radius){l=!1;break}for(const h of e)if(M(a,h)<h.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return v(t,c),0===c.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==c.arcs.length?{x:c.arcs[0].circle.x,y:c.arcs[0].circle.y}:e.length?K(t,[]):_(c.arcs.map(t=>t.p1))}function Z(t,e,n){const s={},i=function(t){const e={},n=Object.keys(t);for(const s of n)e[s]=[];for(let s=0;s<n.length;s++){const i=n[s],r=t[i];for(let o=s+1;o<n.length;++o){const s=n[o],a=t[s],l=M(r,a);l+a.radius<=r.radius+1e-10?e[s].push(i):l+r.radius<=a.radius+1e-10&&e[i].push(s)}}return e}(t);for(let r=0;r<e.length;++r){const o=e[r].sets,a={},l={};for(let t=0;t<o.length;++t){a[o[t]]=!0;const e=i[o[t]];for(let t=0;t<e.length;++t)l[e[t]]=!0}const c=[],h=[];for(let e in t)e in a?c.push(t[e]):e in l||h.push(t[e]);const u=K(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function H(t){if(0===t.length)return[];const e={};return v(t,e),e.arcs}function J(t,e){if(0===t.length)return"M 0 0";const n=Math.pow(10,e||0),s=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length){const e=t[0].circle;return function(t,e,n){const s=[];return s.push("\nM",t,e),s.push("\nm",-n,0),s.push("\na",n,n,0,1,0,2*n,0),s.push("\na",n,n,0,1,0,2*-n,0),s.join(" ")}(s(e.x),s(e.y),s(e.radius))}const i=["\nM",s(t[0].p2.x),s(t[0].p2.y)];for(const r of t){const t=s(r.circle.radius);i.push("\nA",t,t,0,r.large?1:0,r.sweep?1:0,s(r.p1.x),s(r.p1.y))}return i.join(" ")}function Q(t,e){return J(H(t),e)}var tt=function(){var t=e(function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],i=[1,17],r=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],l=[1,39],c=[7,8,11,12,17,19,22,24,27],h=[1,57],u=[1,56],f=[1,58],d=[1,59],y=[1,60],g=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],x={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:e(function(t,e,n,s,i,r,o){var a=r.length-1;switch(i){case 1:return r[a-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:r[a-1].push(r[a]),this.$=r[a-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=r[a];break;case 8:s.setDiagramTitle(r[a].substr(6)),this.$=r[a].substr(6);break;case 9:s.addSubsetData([r[a]],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 10:s.addSubsetData([r[a-1]],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 11:s.addSubsetData([r[a-2]],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 12:s.addSubsetData([r[a-3]],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 13:if(r[a].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a]),s.addSubsetData(r[a],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 14:if(r[a-1].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-1]),s.addSubsetData(r[a-1],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 15:if(r[a-2].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-2]),s.addSubsetData(r[a-2],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 16:if(r[a-3].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-3]),s.addSubsetData(r[a-3],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 17:case 18:case 19:s.addTextData(r[a-1],r[a],void 0);break;case 20:case 21:s.addTextData(r[a-2],r[a-1],r[a]);break;case 23:s.addStyleData(r[a-1],r[a]);break;case 24:case 25:case 26:if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a],void 0);break;case 27:case 28:var l;if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a-1],r[a]);break;case 29:case 41:case 34:this.$=[r[a]];break;case 30:case 42:this.$=[...r[a-2],r[a]];break;case 31:this.$=[r[a-2],r[a]];break;case 33:this.$=r[a].join(" ")}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:i,21:r},{13:20,18:19,20:i,21:r},{13:20,18:21,20:i,21:r},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:i,21:r},t(s,[2,9],{14:[1,27],15:[1,28]}),t(o,[2,43]),t(o,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:a}),t(o,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:a},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:i,21:r},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(c,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(o,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:h,20:u,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:y},t(s,[2,12]),t(s,[2,16]),t(c,[2,30]),t(c,[2,31]),t(c,[2,32]),t(c,[2,33],{30:61,16:h,20:u,31:f,32:d,33:y}),t(g,[2,34]),t(g,[2,36]),t(g,[2,37]),t(g,[2,38]),t(g,[2,39]),t(g,[2,40]),t(g,[2,35])],defaultActions:{6:[2,1]},parseError:e(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:e(function(t){var n=this,s=[0],i=[],r=[null],o=[],a=this.table,l="",c=0,h=0,u=o.slice.call(arguments,1),f=Object.create(this.lexer),d={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(d.yy[y]=this.yy[y]);f.setInput(t,d.yy),d.yy.lexer=f,d.yy.parser=this,void 0===f.yylloc&&(f.yylloc={});var g=f.yylloc;o.push(g);var x=f.options&&f.options.ranges;function p(){var t;return"number"!=typeof(t=i.pop()||f.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,e(function(t){s.length=s.length-2*t,r.length=r.length-t,o.length=o.length-t},"popStack"),e(p,"lex");for(var m,b,v,I,M,k,w,_,S={};;){if(b=s[s.length-1],this.defaultActions[b]?v=this.defaultActions[b]:(null==m&&(m=p()),v=a[b]&&a[b][m]),void 0===v||!v.length||!v[0]){var E;for(M in _=[],a[b])this.terminals_[M]&&M>2&&_.push("'"+this.terminals_[M]+"'");E=f.showPosition?"Parse error on line "+(c+1)+":\n"+f.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(E,{text:f.match,token:this.terminals_[m]||m,line:f.yylineno,loc:g,expected:_})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(v[0]){case 1:s.push(m),r.push(f.yytext),o.push(f.yylloc),s.push(v[1]),m=null,h=f.yyleng,l=f.yytext,c=f.yylineno,g=f.yylloc;break;case 2:if(k=this.productions_[v[1]][1],S.$=r[r.length-k],S._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},x&&(S._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),void 0!==(I=this.performAction.apply(S,[l,h,c,d.yy,v[1],r,o].concat(u))))return I;k&&(s=s.slice(0,-1*k*2),r=r.slice(0,-1*k),o=o.slice(0,-1*k)),s.push(this.productions_[v[1]][0]),r.push(S.$),o.push(S._$),w=a[s[s.length-2]][s[s.length-1]],s.push(w);break;case 3:return!0}}return!0},"parse")},p=function(){return{EOF:1,parseError:e(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:e(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:e(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:e(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=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),n.length-1&&(this.yylineno-=n.length-1);var i=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:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:e(function(t){this.unput(this.match.slice(t))},"less"),pastInput:e(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:e(function(t,e){var n,s,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in i)this[r]=i[r];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;var t,e,n,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),r=0;r<i.length;r++)if((n=this._input.match(this.rules[i[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){return this.next()||this.lex()},"lex"),begin:e(function(t){this.conditionStack.push(t)},"begin"),popState:e(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:e(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:e(function(t){this.begin(t)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(t,e,n,s){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}}}();function m(){this.yy={}}return x.lexer=p,e(m,"Parser"),m.prototype=x,x.Parser=m,new m}();tt.parser=tt;var et,nt=tt,st=[],it=[],rt=[],ot=new Set,at=!1,lt=e((t,e,n)=>{const s=gt(t).sort(),i=n??10/Math.pow(t.length,2);et=s,1===s.length&&ot.add(s[0]),st.push({sets:s,size:i,label:e?ht(e):void 0})},"addSubsetData"),ct=e(()=>st,"getSubsetData"),ht=e(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),ut=e(t=>t?ht(t):t,"normalizeStyleValue"),ft=e((t,e,n)=>{const s=ht(e);it.push({sets:gt(t).sort(),id:s,label:n?ht(n):void 0})},"addTextData"),dt=e((t,e)=>{const n=gt(t).sort(),s={};for(const[i,r]of e)s[i]=ut(r)??r;rt.push({targets:n,styles:s})},"addStyleData"),yt=e(()=>rt,"getStyleData"),gt=e(t=>t.map(t=>ht(t)),"normalizeIdentifierList"),xt=e(t=>{const e=gt(t).filter(t=>!ot.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),pt=e(()=>it,"getTextData"),mt=e(()=>et,"getCurrentSets"),bt=e(()=>at,"getIndentMode"),vt=e(t=>{at=t},"setIndentMode"),It=m.venn;function Mt(){return p(It,l().venn)}e(Mt,"getConfig");var kt={getConfig:Mt,clear:e(()=>{x(),st.length=0,it.length=0,rt.length=0,ot.clear(),et=void 0,at=!1},"customClear"),setAccTitle:a,getAccTitle:o,setDiagramTitle:r,getDiagramTitle:i,getAccDescription:s,setAccDescription:n,addSubsetData:lt,getSubsetData:ct,addTextData:ft,addStyleData:dt,validateUnionIdentifiers:xt,getTextData:pt,getStyleData:yt,getCurrentSets:mt,getIndentMode:bt,setIndentMode:vt},wt=e(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles");function _t(t){const e=new Map;for(const n of t){const t=n.targets.join("|"),s=e.get(t);s?Object.assign(s,n.styles):e.set(t,{...n.styles})}return e}e(_t,"buildStyleByKey");var St=e((t,e,n,s)=>{const i=s.db,r=i.getConfig?.(),{themeVariables:o,look:a,handDrawnSeed:x}=l(),p="handDrawn"===a,m=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),v=i.getDiagramTitle?.(),I=i.getSubsetData(),M=i.getTextData(),k=_t(i.getStyleData()),w=zt(I),_=r?.width??800,S=r?.height??450,E=_/1600,T=v?48*E:0,z=o.primaryTextColor??o.textColor,A=c(e);A.attr("viewBox",`0 0 ${_} ${S}`),v&&A.append("text").text(v).attr("class","venn-title").attr("font-size",32*E+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*E).style("fill",o.vennTitleTextColor||o.titleColor);const R=h(document.createElement("div")),N=function(t={}){let e=!1,n=600,s=350,i=15,r=1e3,o=Math.PI/2,a=!0,l=null,c=!0,h=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,x={},p=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,b=function(t){if(t in x)return x[t];var e=x[t]=p[m];return m+=1,m>=p.length&&(m=0),e},v=F,I=P;function M(x){let p=x.datum();const m=new Set;p.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),p=p.filter(t=>!t.sets.some(t=>m.has(t)));let M={},k={};if(p.length>0){let t=v(p,{lossFunction:I,distinct:d});a&&(t=U(t,o,f)),M=G(t,n,s,i,l),k=Z(M,p,g)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}p.forEach(t=>{t.label&&(w[t.sets]=t.label)}),x.selectAll("svg").data([M]).enter().append("svg");const S=x.select("svg");e?S.attr("viewBox",`0 0 ${n} ${s}`):S.attr("width",n).attr("height",s);const E={};let T=!1;function z(t){return e=>Q(t.sets.map(t=>{let i=E[t],r=M[t];return i||(i={x:n/2,y:s/2,radius:1}),r||(r={x:n/2,y:s/2,radius:1}),{x:i.x*(1-e)+r.x*e,y:i.y*(1-e)+r.y*e,radius:i.radius*(1-e)+r.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){const e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){const e=t.split(" ");return{x:Number.parseFloat(e[1]),y:Number.parseFloat(e[2]),radius:-Number.parseFloat(e[4])}}(e))});const A=S.selectAll(".venn-area").data(p,t=>t.sets),R=A.enter().append("g").attr("class",t=>`venn-area venn-${1==t.sets.length?"circle":"intersection"}${t.colour||t.color?" venn-coloured":""}`).attr("data-venn-sets",t=>t.sets.join("_")),N=R.append("path"),D=R.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",s/2);function O(t){return"function"==typeof t.transition?t.transition("venn").duration(r):t}h&&(N.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour?t.colour:t.color?t.color:b(t.sets)).style("fill-opacity",".25"),D.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let F=x;T&&"function"==typeof F.transition?(F=O(x),F.selectAll("path").attrTween("d",z)):F.selectAll("path").attr("d",t=>Q(t.sets.map(t=>M[t])),y);const C=F.selectAll("text").filter(t=>t.sets in k).text(t=>_(t)).attr("x",t=>Math.floor(k[t.sets].x)).attr("y",t=>Math.floor(k[t.sets].y));c&&(T?"on"in C?C.on("end",X(M,_)):C.each("end",X(M,_)):C.each(X(M,_)));const j=O(A.exit()).remove();"function"==typeof A.transition&&j.selectAll("path").attrTween("d",z);const $=j.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(D.style("font-size","0px"),C.style("font-size",u),$.style("font-size","0px")),{circles:M,textCentres:k,nodes:A,enter:R,update:F,exit:j}}return M.wrap=function(t){return arguments.length?(c=t,M):c},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(s=t,M):s},M.padding=function(t){return arguments.length?(i=t,M):i},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(b=t,M):b},M.colors=function(t){return arguments.length?(b=t,M):b},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(r=t,M):r},M.layoutFunction=function(t){return arguments.length?(v=t,M):v},M.normalize=function(t){return arguments.length?(a=t,M):a},M.scaleToFit=function(t){return arguments.length?(l=t,M):l},M.styled=function(t){return arguments.length?(h=t,M):h},M.orientation=function(t){return arguments.length?(o=t,M):o},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?P:"logRatio"===t?L:t,M):I},M}().width(_).height(S-T);R.datum(w).call(N);const D=p?u.svg(R.select("svg").node()):void 0,O=function(t,e={}){const{lossFunction:n,layoutFunction:s=F,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:a=600,height:l=350,padding:c=15,scaleToFit:h=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e;let y=s(t,{lossFunction:"default"!==n&&n?"logRatio"===n?L:n:P,distinct:f});i&&(y=U(y,r,o));const g=G(y,a,l,c,h),x=Z(g,t,u),p=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>p.get(t)),n=H(e);return{circles:e,arcs:n,path:J(n,d),area:t,has:new Set(t.sets)}});function b(t){let e="";for(const n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e}return m.map(({circles:t,arcs:e,path:n,area:s})=>({data:s,text:x[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}(w,{width:_,height:S-T,padding:r?.padding??15}),C=new Map;for(const l of O){const t=Et([...l.data.sets].sort());C.set(t,l)}M.length>0&&Tt(r,C,R,M,E,k);const j=f(o.background||"#f4f4f4");R.selectAll(".venn-circle").each(function(t,e){const n=h(this),s=Et([...t.sets].sort()),i=k.get(s),r=i?.fill||m[e%m.length]||o.primaryColor;n.classed("venn-set-"+e%8,!0);const a=i?.["fill-opacity"]??.1,l=i?.stroke||r,c=i?.["stroke-width"]||""+5*E;if(p&&D){const t=C.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=D.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:x,fill:b(r,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:l,strokeWidth:parseFloat(String(c))});n.select("path").remove(),n.node()?.insertBefore(i,n.select("text").node())}}else n.select("path").style("fill",r).style("fill-opacity",a).style("stroke",l).style("stroke-width",c).style("stroke-opacity",.95);const u=i?.color||(j?d(r,30):y(r,30));n.select("text").style("font-size",48*E+"px").style("fill",u)}),p&&D?R.selectAll(".venn-intersection").each(function(t){const e=h(this),n=Et([...t.sets].sort()),s=k.get(n),i=s?.fill;if(i){const t=e.select("path"),n=t.attr("d");if(n){const e=D.path(n,{roughness:.7,seed:x,fill:b(i,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),s=t.node();s?.parentNode?.insertBefore(e,s),t.remove()}}else e.select("path").style("fill-opacity",0);e.select("text").style("font-size",48*E+"px").style("fill",s?.color??o.vennSetTextColor??z)}):(R.selectAll(".venn-intersection text").style("font-size",48*E+"px").style("fill",t=>{const e=Et([...t.sets].sort());return k.get(e)?.color??o.vennSetTextColor??z}),R.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=Et([...t.sets].sort());return k.get(e)?.fill?1:0}).style("fill",t=>{const e=Et([...t.sets].sort());return k.get(e)?.fill??"transparent"}));const $=A.append("g").attr("transform",`translate(0, ${T})`),q=R.select("svg").node();if(q&&"childNodes"in q)for(const l of[...q.childNodes])$.node()?.appendChild(l);g(A,S,_,r?.useMaxWidth??!0)},"draw");function Et(t){return t.join("|")}function Tt(t,e,n,s,i,r){const o=t?.useDebugLayout??!1,a=n.select("svg").append("g").attr("class","venn-text-nodes"),l=new Map;for(const c of s){const t=Et(c.sets),e=l.get(t);e?e.push(c):l.set(t,[c])}for(const[c,h]of l.entries()){const t=e.get(c);if(!t?.text)continue;const n=t.text.x,s=t.text.y,l=Math.min(...t.circles.map(t=>t.radius)),u=Math.min(...t.circles.map(t=>t.radius-Math.hypot(n-t.x,s-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(l)&&(f=.6*l);const d=a.append("g").attr("class","venn-text-area").attr("font-size",40*i+"px");o&&d.append("circle").attr("class","venn-text-debug-circle").attr("cx",n).attr("cy",s).attr("r",f).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const y=Math.max(80*i,2*f*.95),g=Math.max(60*i,2*f*.95),x=(t.data.label&&t.data.label.length>0?Math.min(32*i,.25*f):0)+(h.length<=2?30*i:0),p=n-y/2,m=s-g/2+x,b=Math.max(1,Math.ceil(Math.sqrt(h.length))),v=y/b,I=g/Math.max(1,Math.ceil(h.length/b));for(const[e,a]of h.entries()){const t=e%b,n=Math.floor(e/b),s=p+v*(t+.5),l=m+I*(n+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",p+v*t).attr("y",m+I*n).attr("width",v).attr("height",I).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const c=.9*v,h=.9*I,u=d.append("foreignObject").attr("class","venn-text-node-fo").attr("width",c).attr("height",h).attr("x",s-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(a.id)?.color,y=u.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(a.label??a.id);f&&y.style("color",f)}}}function zt(t){const e=new Set(t.map(t=>[...t.sets].sort().join("|"))),n=new Map(t.filter(t=>1===t.sets.length&&void 0!==t.size).map(t=>[t.sets[0],t.size])),s=[];for(const i of t){if(i.sets.length<3)continue;const t=[...i.sets].sort();for(let i=0;i<t.length-1;i++)for(let r=i+1;r<t.length;r++){const o=[t[i],t[r]],a=o.join("|");if(!e.has(a)){e.add(a);const t=n.get(o[0]),i=n.get(o[1]),r=void 0!==t&&void 0!==i?Math.min(t,i)/4:2.5;s.push({sets:o,size:r,label:""})}}}return s.length>0?[...t,...s]:t}e(Et,"stableSetsKey"),e(Tt,"renderTextNodes"),e(zt,"ensurePairwiseSubsets");var At={parser:nt,db:kt,renderer:{draw:St},styles:wt};export{At as diagram};
|
|
1
|
+
import{b3 as t,_ as e,s as n,g as s,p as i,o as r,a as o,b as a,z as l,F as c,d as h,ak as u,a9 as f,aa as d,ab as y,e as g,q as x,B as p,D as m}from"./mermaid.core-CTf8qcol.js";import"./RemoteLifeOSBlock-C46RjZWn.js";import"./index-CX8KV6EH.js";import"./purify.es-BNLkGfTg.js";import"./marked.esm-BBjA1da9.js";import"./App-CLTYkSvy.js";import"./index-CapF4a8Y.js";import"./file-editor-index-C6CU7Fik.js";const b=(e,n)=>t(e,"a",-n);function v(t,e){const n=function(t){const e=[];for(let n=0;n<t.length;++n)for(let s=n+1;s<t.length;++s){const i=w(t[n],t[s]);for(const t of i)t.parentIndex=[n,s],e.push(t)}return e}(t),s=n.filter(e=>function(t,e){return e.every(e=>M(t,e)<e.radius+1e-10)}(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=_(s);for(let t=0;t<s.length;++t){const n=s[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}s.sort((t,e)=>e.angle-t.angle);let n=s[s.length-1];for(let a=0;a<s.length;++a){const e=s[a];r+=(n.x+e.x)*(e.y-n.y);const l={x:(e.x+n.x)/2,y:(e.y+n.y)/2};let c=null;for(let s=0;s<e.parentIndex.length;++s)if(n.parentIndex.includes(e.parentIndex[s])){const i=t[e.parentIndex[s]],r=Math.atan2(e.x-i.x,e.y-i.y),o=Math.atan2(n.x-i.x,n.y-i.y);let a=o-r;a<0&&(a+=2*Math.PI);const h=o-a/2;let u=M(l,{x:i.x+i.radius*Math.sin(h),y:i.y+i.radius*Math.cos(h)});u>2*i.radius&&(u=2*i.radius),(null==c||c.width>u)&&(c={circle:i,width:u,p1:e,p2:n,large:u>i.radius,sweep:!0})}null!=c&&(o.push(c),i+=I(c.circle.radius,c.width),n=e)}}else{let e=t[0];for(let s=1;s<t.length;++s)t[s].radius<e.radius&&(e=t[s]);let n=!1;for(let s=0;s<t.length;++s)if(M(t[s],e)>Math.abs(e.radius-t[s].radius)){n=!0;break}n?i=r=0:(i=e.radius*e.radius*Math.PI,o.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-1e-10,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return r/=2,e&&(e.area=i+r,e.arcArea=i,e.polygonArea=r,e.arcs=o,e.innerPoints=s,e.intersectionPoints=n),i+r}function I(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function M(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function k(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(n*n-t*t+e*e)/(2*n);return I(t,t-(n*n-e*e+t*t)/(2*n))+I(e,s)}function w(t,e){const n=M(t,e),s=t.radius,i=e.radius;if(n>=s+i||n<=Math.abs(s-i))return[];const r=(s*s-i*i+n*n)/(2*n),o=Math.sqrt(s*s-r*r),a=t.x+r*(e.x-t.x)/n,l=t.y+r*(e.y-t.y)/n,c=-(e.y-t.y)*(o/n),h=-(e.x-t.x)*(o/n);return[{x:a+c,y:l-h},{x:a-c,y:l+h}]}function _(t){const e={x:0,y:0};for(const n of t)e.x+=n.x,e.y+=n.y;return e.x/=t.length,e.y/=t.length,e}function S(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function E(t,e){return S(t).map(()=>S(e))}function T(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function z(t){return Math.sqrt(T(t,t))}function A(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function R(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function N(t,e,n){const s=(n=n||{}).maxIterations||200*e.length,i=n.nonZeroDelta||1.05,r=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,a=n.minErrorDelta||1e-5,l=void 0!==n.rho?n.rho:1,c=void 0!==n.chi?n.chi:2,h=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f;const d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e),y[0].id=0;for(let I=0;I<d;++I){const n=e.slice();n[I]=n[I]?n[I]*i:r,y[I+1]=n,y[I+1].fx=t(n),y[I+1].id=I+1}function g(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const x=(t,e)=>t.fx-e.fx,p=e.slice(),m=e.slice(),b=e.slice(),v=e.slice();for(let I=0;I<s;++I){if(y.sort(x),n.history){const t=y.map(t=>{const e=t.slice();return e.fx=t.fx,e.id=t.id,e});t.sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:t})}f=0;for(let t=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<o&&f<a)break;for(let t=0;t<d;++t){p[t]=0;for(let e=0;e<d;++e)p[t]+=y[e][t];p[t]/=d}const e=y[d];if(R(m,1+l,p,-l,e),m.fx=t(m),m.fx<y[0].fx)R(v,1+c,p,-c,e),v.fx=t(v),v.fx<m.fx?g(v):g(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(R(b,1+h,p,-h,e),b.fx=t(b),b.fx<e.fx?g(b):n=!0):(R(b,1-h*l,p,h*l,e),b.fx=t(b),b.fx<m.fx?g(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)R(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else g(m)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function D(t,e,n,s,i,r,o){const a=n.fx,l=T(n.fxprime,e);let c=a,h=a,u=l,f=0;function d(h,f,d){for(let y=0;y<16;++y)if(i=(h+f)/2,R(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=T(s.fxprime,e),c>a+r*i*l||c>=d)f=i;else{if(Math.abs(u)<=-o*l)return i;u*(f-h)>=0&&(f=h),h=i,d=c}return 0}i=i||1,r=r||1e-6,o=o||.1;for(let y=0;y<10;++y){if(R(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=T(s.fxprime,e),c>a+r*i*l||y&&c>=h)return d(f,i,h);if(Math.abs(u)<=-o*l)return i;if(u>=0)return d(i,f,c);h=c,f=i,i*=2}return i}function O(t,e,n){let s={x:e.slice(),fx:0,fxprime:e.slice()},i={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let o,a,l,c=1;l=(n=n||{}).maxIterations||20*e.length,s.fx=t(s.x,s.fxprime),o=s.fxprime.slice(),A(o,s.fxprime,-1);for(let h=0;h<l;++h){if(c=D(t,o,s,i,c),n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),c){R(r,1,i.fxprime,-1,s.fxprime);const t=T(s.fxprime,s.fxprime);R(o,Math.max(0,T(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else A(o,s.fxprime,-1);if(z(s.fxprime)<=1e-5)break}return n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),s}function F(t,e={}){e.maxIterations=e.maxIterations||500;const n=e.initialLayout||$,s=e.lossFunction||P,i=function(t,e={}){const n=e.distinct,s=t.map(t=>Object.assign({},t));function i(t){return t.join(";")}if(n){const t=new Map;for(const e of s)for(let n=0;n<e.sets.length;n++){const s=String(e.sets[n]);t.set(s,e.size+(t.get(s)||0));for(let i=n+1;i<e.sets.length;i++){const n=String(e.sets[i]),r=`${s};${n}`,o=`${n};${s}`;t.set(r,e.size+(t.get(r)||0)),t.set(o,e.size+(t.get(o)||0))}}for(const e of s)e.sets.length<3&&(e.size=t.get(i(e.sets)))}const r=[],o=new Set;for(const a of s)if(1===a.sets.length)r.push(a.sets[0]);else if(2===a.sets.length){const t=a.sets[0],e=a.sets[1];o.add(i(a.sets)),o.add(i([e,t]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let a=0;a<r.length;++a){const t=r[a];for(let e=a+1;e<r.length;++e){const n=r[e];o.has(i([t,n]))||s.push({sets:[t,n],size:0})}}return s}(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const c of o)a.push(r[c].x),a.push(r[c].y);const l=N(t=>{const e={};for(let n=0;n<o.length;++n){const s=o[n];e[s]={x:t[2*n],y:t[2*n+1],radius:r[s].radius}}return s(e,i)},a,e).x;for(let c=0;c<o.length;++c){const t=o[c];r[t].x=l[2*c],r[t].y=l[2*c+1]}return r}const C=1e-10;function j(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+C?Math.abs(t-e):function(t,e,n,s){const i=(s=s||{}).maxIterations||100,r=s.tolerance||1e-10,o=t(e),a=t(n);let l=n-e;if(o*a>0)throw"Initial bisect points must have opposite signs";if(0===o)return e;if(0===a)return n;for(let c=0;c<i;++c){l/=2;const n=e+l,s=t(n);if(s*o>=0&&(e=n),Math.abs(l)<r||0===s)return n}return e+l}(s=>k(t,e,s)-n,0,t+e)}function $(t,e={}){let n=function(t,e){const n=e&&e.lossFunction?e.lossFunction:P,s={},i={};for(const u of t)if(1===u.sets.length){const t=u.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:u.size,radius:Math.sqrt(u.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const u of t){let t=null!=u.weight?u.weight:1;const e=u.sets[0],n=u.sets[1];u.size+C>=Math.min(s[e].size,s[n].size)&&(t=0),i[e].push({set:n,size:u.size,weight:t}),i[n].push({set:e,size:u.size,weight:t})}const r=[];function o(t,e){return e.size-t.size}Object.keys(i).forEach(t=>{let e=0;for(let n=0;n<i[t].length;++n)e+=i[t][n].size*i[t][n].weight;r.push({set:t,size:e})}),r.sort(o);const a={};function l(t){return t.set in a}function c(t,e){s[e].x=t.x,s[e].y=t.y,a[e]=!0}c({x:0,y:0},r[0].set);for(let u=1;u<r.length;++u){const e=r[u].set,a=i[e].filter(l),f=s[e];if(a.sort(o),0===a.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<a.length;++h){const t=s[a[h].set],e=j(f.radius,t.radius,a[h].size);d.push({x:t.x+e,y:t.y}),d.push({x:t.x-e,y:t.y}),d.push({y:t.y+e,x:t.x}),d.push({y:t.y-e,x:t.x});for(let n=h+1;n<a.length;++n){const i=s[a[n].set],r=j(f.radius,i.radius,a[n].size),o=w({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,g=d[0];for(const i of d){s[e].x=i.x,s[e].y=i.y;const r=n(s,t);r<y&&(y=r,g=i)}c(g,e)}return s}(t,e);const s=e.lossFunction||P;if(t.length>=8){const i=function(t,e={}){const n=e.restarts||10,s=[],i={};for(const f of t)1===f.sets.length&&(i[f.sets[0]]=s.length,s.push(f));let{distances:r,constraints:o}=function(t,e,n){const s=E(e.length,e.length),i=E(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{const r=n[t.sets[0]],o=n[t.sets[1]],a=j(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[o].size/Math.PI),t.size);s[r][o]=s[o][r]=a;let l=0;t.size+1e-10>=Math.min(e[r].size,e[o].size)?l=1:t.size<=1e-10&&(l=-1),i[r][o]=i[o][r]=l}),{distances:s,constraints:i}}(t,s,i);const a=z(r.map(z))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>function(t,e,n,s){for(let r=0;r<e.length;++r)e[r]=0;let i=0;for(let r=0;r<n.length;++r){const o=t[2*r],a=t[2*r+1];for(let l=r+1;l<n.length;++l){const c=t[2*l],h=t[2*l+1],u=n[r][l],f=s[r][l],d=(c-o)*(c-o)+(h-a)*(h-a),y=Math.sqrt(d),g=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*g*g,e[2*r]+=4*g*(o-c),e[2*r+1]+=4*g*(a-h),e[2*l]+=4*g*(c-o),e[2*l+1]+=4*g*(h-a))}}return i}(t,e,r,o);let c=null;for(let f=0;f<n;++f){const t=O(l,S(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let f=0;f<s.length;++f){const t=s[f];u[t.sets[0]]={x:h[2*f]*a,y:h[2*f+1]*a,radius:Math.sqrt(t.size/Math.PI)}}if(e.history)for(const f of e.history)A(f.x,a);return u}(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}return n}function P(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=k(n.radius,i.radius,M(n,i))}else e=v(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function L(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=k(n.radius,i.radius,M(n,i))}else e=v(s.sets.map(e=>t[e]));const i=null!=s.weight?s.weight:1,r=Math.log((e+1)/(s.size+1));n+=i*r*r}return n}function q(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),t.length>0){const e=t[0].x,n=t[0].y;for(const s of t)s.x-=e,s.y-=n}if(2===t.length&&M(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 n=Math.atan2(t[1].x,t[1].y)-e,s=Math.cos(n),i=Math.sin(n);for(const e of t){const t=e.x,n=e.y;e.x=s*t-i*n,e.y=i*t+s*n}}if(t.length>2){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(const n of t){var s=(n.x+e*n.y)/(1+e*e);n.x=2*s-n.x,n.y=2*s*e-n.y}}}}function B(t){const e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function U(t,e,n){null==e&&(e=Math.PI/2);let s=V(t).map(t=>Object.assign({},t));const i=function(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}function n(t,n){const s=e(t),i=e(n);s.parent=i}t.forEach(t=>{t.parent=t});for(let i=0;i<t.length;++i)for(let e=i+1;e<t.length;++e){const s=t[i].radius+t[e].radius;M(t[i],t[e])+1e-10<s&&n(t[e],t[i])}const s=new Map;for(let i=0;i<t.length;++i){const n=e(t[i]).parent.setid;s.has(n)||s.set(n,[]),s.get(n).push(t[i])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}(s);for(const c of i){q(c,e,n);const t=B(c);c.size=(t.xRange.max-t.xRange.min)*(t.yRange.max-t.yRange.min),c.bounds=t}i.sort((t,e)=>e.size-t.size),s=i[0];let r=s.bounds;const o=(r.xRange.max-r.xRange.min)/50;function a(t,e,n){if(!t)return;const i=t.bounds;let a,l;if(e)a=r.xRange.max-i.xRange.min+o;else{a=r.xRange.max-i.xRange.max;const t=(i.xRange.max-i.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;t<0&&(a+=t)}if(n)l=r.yRange.max-i.yRange.min+o;else{l=r.yRange.max-i.yRange.max;const t=(i.yRange.max-i.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;t<0&&(l+=t)}for(const r of t)r.x+=a,r.y+=l,s.push(r)}let l=1;for(;l<i.length;)a(i[l],!0,!1),a(i[l+1],!1,!0),a(i[l+2],!0,!0),l+=3,r=B(s);return W(s)}function G(t,e,n,s,i){const r=V(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=B(r);if(o.max===o.min||a.max===a.min)return console.log("not scaling solution: zero size detected"),t;let l,c;if(i){const t=2*Math.sqrt(i/Math.PI);l=e/t,c=n/t}else l=e/(o.max-o.min),c=n/(a.max-a.min);const h=Math.min(c,l),u=(e-(o.max-o.min)*h)/2,f=(n-(a.max-a.min)*h)/2;return W(r.map(t=>({radius:h*t.radius,x:s+u+(t.x-o.min)*h,y:s+f+(t.y-a.min)*h,setid:t.setid})))}function W(t){const e={};for(const n of t)e[n.setid]=n;return e}function V(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function X(t,e){return function(n){const s=this,i=t[n.sets[0]].radius||50,r=e(n)||"",o=r.split(/\s+/).reverse(),a=(r.length+o.length)/3;let l=o.pop(),c=[l],h=0;s.textContent=null;const u=[];function f(t){const e=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return e.textContent=t,u.push(e),s.append(e),e}let d=f(l);for(;l=o.pop(),l;){c.push(l);const t=c.join(" ");d.textContent=t,t.length>a&&d.getComputedTextLength()>i&&(c.pop(),d.textContent=c.join(" "),c=[l],d=f(l),h++)}const y=.35-1.1*h/2,g=s.getAttribute("x"),x=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",x),t.setAttribute("dy",`${y+1.1*e}em`)})}}function Y(t,e,n){let s=e[0].radius-M(e[0],t);for(let i=1;i<e.length;++i){const n=e[i].radius-M(e[i],t);n<=s&&(s=n)}for(let i=0;i<n.length;++i){const e=M(n[i],t)-n[i].radius;e<=s&&(s=e)}return s}function K(t,e,n){const s=[];for(const h of t)s.push({x:h.x,y:h.y}),s.push({x:h.x+h.radius/2,y:h.y}),s.push({x:h.x-h.radius/2,y:h.y}),s.push({x:h.x,y:h.y+h.radius/2}),s.push({x:h.x,y:h.y-h.radius/2});let i=s[0],r=Y(s[0],t,e);for(let h=1;h<s.length;++h){const n=Y(s[h],t,e);n>=r&&(i=s[h],r=n)}const o=N(n=>-1*Y({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,a={x:n?0:o[0],y:o[1]};let l=!0;for(const h of t)if(M(a,h)>h.radius){l=!1;break}for(const h of e)if(M(a,h)<h.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return v(t,c),0===c.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==c.arcs.length?{x:c.arcs[0].circle.x,y:c.arcs[0].circle.y}:e.length?K(t,[]):_(c.arcs.map(t=>t.p1))}function Z(t,e,n){const s={},i=function(t){const e={},n=Object.keys(t);for(const s of n)e[s]=[];for(let s=0;s<n.length;s++){const i=n[s],r=t[i];for(let o=s+1;o<n.length;++o){const s=n[o],a=t[s],l=M(r,a);l+a.radius<=r.radius+1e-10?e[s].push(i):l+r.radius<=a.radius+1e-10&&e[i].push(s)}}return e}(t);for(let r=0;r<e.length;++r){const o=e[r].sets,a={},l={};for(let t=0;t<o.length;++t){a[o[t]]=!0;const e=i[o[t]];for(let t=0;t<e.length;++t)l[e[t]]=!0}const c=[],h=[];for(let e in t)e in a?c.push(t[e]):e in l||h.push(t[e]);const u=K(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function H(t){if(0===t.length)return[];const e={};return v(t,e),e.arcs}function J(t,e){if(0===t.length)return"M 0 0";const n=Math.pow(10,e||0),s=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length){const e=t[0].circle;return function(t,e,n){const s=[];return s.push("\nM",t,e),s.push("\nm",-n,0),s.push("\na",n,n,0,1,0,2*n,0),s.push("\na",n,n,0,1,0,2*-n,0),s.join(" ")}(s(e.x),s(e.y),s(e.radius))}const i=["\nM",s(t[0].p2.x),s(t[0].p2.y)];for(const r of t){const t=s(r.circle.radius);i.push("\nA",t,t,0,r.large?1:0,r.sweep?1:0,s(r.p1.x),s(r.p1.y))}return i.join(" ")}function Q(t,e){return J(H(t),e)}var tt=function(){var t=e(function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],i=[1,17],r=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],l=[1,39],c=[7,8,11,12,17,19,22,24,27],h=[1,57],u=[1,56],f=[1,58],d=[1,59],y=[1,60],g=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],x={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,optNewlines:4,VENN:5,document:6,EOF:7,NEWLINE:8,line:9,statement:10,TITLE:11,SET:12,identifier:13,BRACKET_LABEL:14,COLON:15,NUMERIC:16,UNION:17,identifierList:18,TEXT:19,IDENTIFIER:20,STRING:21,INDENT_TEXT:22,indentedTextTail:23,STYLE:24,stylesOpt:25,styleField:26,COMMA:27,styleValue:28,valueTokens:29,valueToken:30,HEXCOLOR:31,RGBCOLOR:32,RGBACOLOR:33,$accept:0,$end:1},terminals_:{2:"error",5:"VENN",7:"EOF",8:"NEWLINE",11:"TITLE",12:"SET",14:"BRACKET_LABEL",15:"COLON",16:"NUMERIC",17:"UNION",19:"TEXT",20:"IDENTIFIER",21:"STRING",22:"INDENT_TEXT",24:"STYLE",27:"COMMA",31:"HEXCOLOR",32:"RGBCOLOR",33:"RGBACOLOR"},productions_:[0,[3,4],[4,0],[4,2],[6,0],[6,2],[9,1],[9,1],[10,1],[10,2],[10,3],[10,4],[10,5],[10,2],[10,3],[10,4],[10,5],[10,3],[10,3],[10,3],[10,4],[10,4],[10,2],[10,3],[23,1],[23,1],[23,1],[23,2],[23,2],[25,1],[25,3],[26,3],[28,1],[28,1],[29,1],[29,2],[30,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:e(function(t,e,n,s,i,r,o){var a=r.length-1;switch(i){case 1:return r[a-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:r[a-1].push(r[a]),this.$=r[a-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=r[a];break;case 8:s.setDiagramTitle(r[a].substr(6)),this.$=r[a].substr(6);break;case 9:s.addSubsetData([r[a]],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 10:s.addSubsetData([r[a-1]],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 11:s.addSubsetData([r[a-2]],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 12:s.addSubsetData([r[a-3]],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 13:if(r[a].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a]),s.addSubsetData(r[a],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 14:if(r[a-1].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-1]),s.addSubsetData(r[a-1],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 15:if(r[a-2].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-2]),s.addSubsetData(r[a-2],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 16:if(r[a-3].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-3]),s.addSubsetData(r[a-3],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 17:case 18:case 19:s.addTextData(r[a-1],r[a],void 0);break;case 20:case 21:s.addTextData(r[a-2],r[a-1],r[a]);break;case 23:s.addStyleData(r[a-1],r[a]);break;case 24:case 25:case 26:if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a],void 0);break;case 27:case 28:var l;if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a-1],r[a]);break;case 29:case 41:case 34:this.$=[r[a]];break;case 30:case 42:this.$=[...r[a-2],r[a]];break;case 31:this.$=[r[a-2],r[a]];break;case 33:this.$=r[a].join(" ")}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,[2,4],{6:5}),t(n,[2,3]),{7:[1,6],8:[1,8],9:7,10:9,11:[1,10],12:[1,11],17:[1,12],19:[1,13],22:[1,14],24:[1,15]},{1:[2,1]},t(s,[2,5]),t(s,[2,6]),t(s,[2,7]),t(s,[2,8]),{13:16,20:i,21:r},{13:20,18:19,20:i,21:r},{13:20,18:21,20:i,21:r},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:i,21:r},t(s,[2,9],{14:[1,27],15:[1,28]}),t(o,[2,43]),t(o,[2,44]),t(s,[2,13],{14:[1,29],15:[1,30],27:a}),t(o,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:a},t(s,[2,22]),t(s,[2,24],{14:[1,35]}),t(s,[2,25],{14:[1,36]}),t(s,[2,26]),{20:l,25:37,26:38,27:a},t(s,[2,10],{15:[1,40]}),{16:[1,41]},t(s,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:i,21:r},t(s,[2,17],{14:[1,45]}),t(s,[2,18],{14:[1,46]}),t(s,[2,19]),t(s,[2,27]),t(s,[2,28]),t(s,[2,23],{27:[1,47]}),t(c,[2,29]),{15:[1,48]},{16:[1,49]},t(s,[2,11]),{16:[1,50]},t(s,[2,15]),t(o,[2,42]),t(s,[2,20]),t(s,[2,21]),{20:l,26:51},{16:h,20:u,21:[1,53],28:52,29:54,30:55,31:f,32:d,33:y},t(s,[2,12]),t(s,[2,16]),t(c,[2,30]),t(c,[2,31]),t(c,[2,32]),t(c,[2,33],{30:61,16:h,20:u,31:f,32:d,33:y}),t(g,[2,34]),t(g,[2,36]),t(g,[2,37]),t(g,[2,38]),t(g,[2,39]),t(g,[2,40]),t(g,[2,35])],defaultActions:{6:[2,1]},parseError:e(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:e(function(t){var n=this,s=[0],i=[],r=[null],o=[],a=this.table,l="",c=0,h=0,u=o.slice.call(arguments,1),f=Object.create(this.lexer),d={yy:{}};for(var y in this.yy)Object.prototype.hasOwnProperty.call(this.yy,y)&&(d.yy[y]=this.yy[y]);f.setInput(t,d.yy),d.yy.lexer=f,d.yy.parser=this,void 0===f.yylloc&&(f.yylloc={});var g=f.yylloc;o.push(g);var x=f.options&&f.options.ranges;function p(){var t;return"number"!=typeof(t=i.pop()||f.lex()||1)&&(t instanceof Array&&(t=(i=t).pop()),t=n.symbols_[t]||t),t}"function"==typeof d.yy.parseError?this.parseError=d.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,e(function(t){s.length=s.length-2*t,r.length=r.length-t,o.length=o.length-t},"popStack"),e(p,"lex");for(var m,b,v,I,M,k,w,_,S={};;){if(b=s[s.length-1],this.defaultActions[b]?v=this.defaultActions[b]:(null==m&&(m=p()),v=a[b]&&a[b][m]),void 0===v||!v.length||!v[0]){var E;for(M in _=[],a[b])this.terminals_[M]&&M>2&&_.push("'"+this.terminals_[M]+"'");E=f.showPosition?"Parse error on line "+(c+1)+":\n"+f.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(E,{text:f.match,token:this.terminals_[m]||m,line:f.yylineno,loc:g,expected:_})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+b+", token: "+m);switch(v[0]){case 1:s.push(m),r.push(f.yytext),o.push(f.yylloc),s.push(v[1]),m=null,h=f.yyleng,l=f.yytext,c=f.yylineno,g=f.yylloc;break;case 2:if(k=this.productions_[v[1]][1],S.$=r[r.length-k],S._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},x&&(S._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),void 0!==(I=this.performAction.apply(S,[l,h,c,d.yy,v[1],r,o].concat(u))))return I;k&&(s=s.slice(0,-1*k*2),r=r.slice(0,-1*k),o=o.slice(0,-1*k)),s.push(this.productions_[v[1]][0]),r.push(S.$),o.push(S._$),w=a[s[s.length-2]][s[s.length-1]],s.push(w);break;case 3:return!0}}return!0},"parse")},p=function(){return{EOF:1,parseError:e(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:e(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:e(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:e(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=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),n.length-1&&(this.yylineno-=n.length-1);var i=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:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:e(function(t){this.unput(this.match.slice(t))},"less"),pastInput:e(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:e(function(t,e){var n,s,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in i)this[r]=i[r];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;var t,e,n,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),r=0;r<i.length;r++)if((n=this._input.match(this.rules[i[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){return this.next()||this.lex()},"lex"),begin:e(function(t){this.conditionStack.push(t)},"begin"),popState:e(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:e(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:e(function(t){this.begin(t)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(t,e,n,s){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}}}();function m(){this.yy={}}return x.lexer=p,e(m,"Parser"),m.prototype=x,x.Parser=m,new m}();tt.parser=tt;var et,nt=tt,st=[],it=[],rt=[],ot=new Set,at=!1,lt=e((t,e,n)=>{const s=gt(t).sort(),i=n??10/Math.pow(t.length,2);et=s,1===s.length&&ot.add(s[0]),st.push({sets:s,size:i,label:e?ht(e):void 0})},"addSubsetData"),ct=e(()=>st,"getSubsetData"),ht=e(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),ut=e(t=>t?ht(t):t,"normalizeStyleValue"),ft=e((t,e,n)=>{const s=ht(e);it.push({sets:gt(t).sort(),id:s,label:n?ht(n):void 0})},"addTextData"),dt=e((t,e)=>{const n=gt(t).sort(),s={};for(const[i,r]of e)s[i]=ut(r)??r;rt.push({targets:n,styles:s})},"addStyleData"),yt=e(()=>rt,"getStyleData"),gt=e(t=>t.map(t=>ht(t)),"normalizeIdentifierList"),xt=e(t=>{const e=gt(t).filter(t=>!ot.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),pt=e(()=>it,"getTextData"),mt=e(()=>et,"getCurrentSets"),bt=e(()=>at,"getIndentMode"),vt=e(t=>{at=t},"setIndentMode"),It=m.venn;function Mt(){return p(It,l().venn)}e(Mt,"getConfig");var kt={getConfig:Mt,clear:e(()=>{x(),st.length=0,it.length=0,rt.length=0,ot.clear(),et=void 0,at=!1},"customClear"),setAccTitle:a,getAccTitle:o,setDiagramTitle:r,getDiagramTitle:i,getAccDescription:s,setAccDescription:n,addSubsetData:lt,getSubsetData:ct,addTextData:ft,addStyleData:dt,validateUnionIdentifiers:xt,getTextData:pt,getStyleData:yt,getCurrentSets:mt,getIndentMode:bt,setIndentMode:vt},wt=e(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles");function _t(t){const e=new Map;for(const n of t){const t=n.targets.join("|"),s=e.get(t);s?Object.assign(s,n.styles):e.set(t,{...n.styles})}return e}e(_t,"buildStyleByKey");var St=e((t,e,n,s)=>{const i=s.db,r=i.getConfig?.(),{themeVariables:o,look:a,handDrawnSeed:x}=l(),p="handDrawn"===a,m=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(Boolean),v=i.getDiagramTitle?.(),I=i.getSubsetData(),M=i.getTextData(),k=_t(i.getStyleData()),w=zt(I),_=r?.width??800,S=r?.height??450,E=_/1600,T=v?48*E:0,z=o.primaryTextColor??o.textColor,A=c(e);A.attr("viewBox",`0 0 ${_} ${S}`),v&&A.append("text").text(v).attr("class","venn-title").attr("font-size",32*E+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*E).style("fill",o.vennTitleTextColor||o.titleColor);const R=h(document.createElement("div")),N=function(t={}){let e=!1,n=600,s=350,i=15,r=1e3,o=Math.PI/2,a=!0,l=null,c=!0,h=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,x={},p=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,b=function(t){if(t in x)return x[t];var e=x[t]=p[m];return m+=1,m>=p.length&&(m=0),e},v=F,I=P;function M(x){let p=x.datum();const m=new Set;p.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),p=p.filter(t=>!t.sets.some(t=>m.has(t)));let M={},k={};if(p.length>0){let t=v(p,{lossFunction:I,distinct:d});a&&(t=U(t,o,f)),M=G(t,n,s,i,l),k=Z(M,p,g)}const w={};function _(t){return t.sets in w?w[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}p.forEach(t=>{t.label&&(w[t.sets]=t.label)}),x.selectAll("svg").data([M]).enter().append("svg");const S=x.select("svg");e?S.attr("viewBox",`0 0 ${n} ${s}`):S.attr("width",n).attr("height",s);const E={};let T=!1;function z(t){return e=>Q(t.sets.map(t=>{let i=E[t],r=M[t];return i||(i={x:n/2,y:s/2,radius:1}),r||(r={x:n/2,y:s/2,radius:1}),{x:i.x*(1-e)+r.x*e,y:i.y*(1-e)+r.y*e,radius:i.radius*(1-e)+r.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){const e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=function(t){const e=t.split(" ");return{x:Number.parseFloat(e[1]),y:Number.parseFloat(e[2]),radius:-Number.parseFloat(e[4])}}(e))});const A=S.selectAll(".venn-area").data(p,t=>t.sets),R=A.enter().append("g").attr("class",t=>`venn-area venn-${1==t.sets.length?"circle":"intersection"}${t.colour||t.color?" venn-coloured":""}`).attr("data-venn-sets",t=>t.sets.join("_")),N=R.append("path"),D=R.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",s/2);function O(t){return"function"==typeof t.transition?t.transition("venn").duration(r):t}h&&(N.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour?t.colour:t.color?t.color:b(t.sets)).style("fill-opacity",".25"),D.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let F=x;T&&"function"==typeof F.transition?(F=O(x),F.selectAll("path").attrTween("d",z)):F.selectAll("path").attr("d",t=>Q(t.sets.map(t=>M[t])),y);const C=F.selectAll("text").filter(t=>t.sets in k).text(t=>_(t)).attr("x",t=>Math.floor(k[t.sets].x)).attr("y",t=>Math.floor(k[t.sets].y));c&&(T?"on"in C?C.on("end",X(M,_)):C.each("end",X(M,_)):C.each(X(M,_)));const j=O(A.exit()).remove();"function"==typeof A.transition&&j.selectAll("path").attrTween("d",z);const $=j.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(D.style("font-size","0px"),C.style("font-size",u),$.style("font-size","0px")),{circles:M,textCentres:k,nodes:A,enter:R,update:F,exit:j}}return M.wrap=function(t){return arguments.length?(c=t,M):c},M.useViewBox=function(){return e=!0,M},M.width=function(t){return arguments.length?(n=t,M):n},M.height=function(t){return arguments.length?(s=t,M):s},M.padding=function(t){return arguments.length?(i=t,M):i},M.distinct=function(t){return arguments.length?(d=t,M):d},M.colours=function(t){return arguments.length?(b=t,M):b},M.colors=function(t){return arguments.length?(b=t,M):b},M.fontSize=function(t){return arguments.length?(u=t,M):u},M.round=function(t){return arguments.length?(y=t,M):y},M.duration=function(t){return arguments.length?(r=t,M):r},M.layoutFunction=function(t){return arguments.length?(v=t,M):v},M.normalize=function(t){return arguments.length?(a=t,M):a},M.scaleToFit=function(t){return arguments.length?(l=t,M):l},M.styled=function(t){return arguments.length?(h=t,M):h},M.orientation=function(t){return arguments.length?(o=t,M):o},M.orientationOrder=function(t){return arguments.length?(f=t,M):f},M.lossFunction=function(t){return arguments.length?(I="default"===t?P:"logRatio"===t?L:t,M):I},M}().width(_).height(S-T);R.datum(w).call(N);const D=p?u.svg(R.select("svg").node()):void 0,O=function(t,e={}){const{lossFunction:n,layoutFunction:s=F,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:a=600,height:l=350,padding:c=15,scaleToFit:h=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e;let y=s(t,{lossFunction:"default"!==n&&n?"logRatio"===n?L:n:P,distinct:f});i&&(y=U(y,r,o));const g=G(y,a,l,c,h),x=Z(g,t,u),p=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>p.get(t)),n=H(e);return{circles:e,arcs:n,path:J(n,d),area:t,has:new Set(t.sets)}});function b(t){let e="";for(const n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e}return m.map(({circles:t,arcs:e,path:n,area:s})=>({data:s,text:x[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}(w,{width:_,height:S-T,padding:r?.padding??15}),C=new Map;for(const l of O){const t=Et([...l.data.sets].sort());C.set(t,l)}M.length>0&&Tt(r,C,R,M,E,k);const j=f(o.background||"#f4f4f4");R.selectAll(".venn-circle").each(function(t,e){const n=h(this),s=Et([...t.sets].sort()),i=k.get(s),r=i?.fill||m[e%m.length]||o.primaryColor;n.classed("venn-set-"+e%8,!0);const a=i?.["fill-opacity"]??.1,l=i?.stroke||r,c=i?.["stroke-width"]||""+5*E;if(p&&D){const t=C.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=D.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:x,fill:b(r,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:l,strokeWidth:parseFloat(String(c))});n.select("path").remove(),n.node()?.insertBefore(i,n.select("text").node())}}else n.select("path").style("fill",r).style("fill-opacity",a).style("stroke",l).style("stroke-width",c).style("stroke-opacity",.95);const u=i?.color||(j?d(r,30):y(r,30));n.select("text").style("font-size",48*E+"px").style("fill",u)}),p&&D?R.selectAll(".venn-intersection").each(function(t){const e=h(this),n=Et([...t.sets].sort()),s=k.get(n),i=s?.fill;if(i){const t=e.select("path"),n=t.attr("d");if(n){const e=D.path(n,{roughness:.7,seed:x,fill:b(i,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),s=t.node();s?.parentNode?.insertBefore(e,s),t.remove()}}else e.select("path").style("fill-opacity",0);e.select("text").style("font-size",48*E+"px").style("fill",s?.color??o.vennSetTextColor??z)}):(R.selectAll(".venn-intersection text").style("font-size",48*E+"px").style("fill",t=>{const e=Et([...t.sets].sort());return k.get(e)?.color??o.vennSetTextColor??z}),R.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=Et([...t.sets].sort());return k.get(e)?.fill?1:0}).style("fill",t=>{const e=Et([...t.sets].sort());return k.get(e)?.fill??"transparent"}));const $=A.append("g").attr("transform",`translate(0, ${T})`),q=R.select("svg").node();if(q&&"childNodes"in q)for(const l of[...q.childNodes])$.node()?.appendChild(l);g(A,S,_,r?.useMaxWidth??!0)},"draw");function Et(t){return t.join("|")}function Tt(t,e,n,s,i,r){const o=t?.useDebugLayout??!1,a=n.select("svg").append("g").attr("class","venn-text-nodes"),l=new Map;for(const c of s){const t=Et(c.sets),e=l.get(t);e?e.push(c):l.set(t,[c])}for(const[c,h]of l.entries()){const t=e.get(c);if(!t?.text)continue;const n=t.text.x,s=t.text.y,l=Math.min(...t.circles.map(t=>t.radius)),u=Math.min(...t.circles.map(t=>t.radius-Math.hypot(n-t.x,s-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(l)&&(f=.6*l);const d=a.append("g").attr("class","venn-text-area").attr("font-size",40*i+"px");o&&d.append("circle").attr("class","venn-text-debug-circle").attr("cx",n).attr("cy",s).attr("r",f).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const y=Math.max(80*i,2*f*.95),g=Math.max(60*i,2*f*.95),x=(t.data.label&&t.data.label.length>0?Math.min(32*i,.25*f):0)+(h.length<=2?30*i:0),p=n-y/2,m=s-g/2+x,b=Math.max(1,Math.ceil(Math.sqrt(h.length))),v=y/b,I=g/Math.max(1,Math.ceil(h.length/b));for(const[e,a]of h.entries()){const t=e%b,n=Math.floor(e/b),s=p+v*(t+.5),l=m+I*(n+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",p+v*t).attr("y",m+I*n).attr("width",v).attr("height",I).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const c=.9*v,h=.9*I,u=d.append("foreignObject").attr("class","venn-text-node-fo").attr("width",c).attr("height",h).attr("x",s-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(a.id)?.color,y=u.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(a.label??a.id);f&&y.style("color",f)}}}function zt(t){const e=new Set(t.map(t=>[...t.sets].sort().join("|"))),n=new Map(t.filter(t=>1===t.sets.length&&void 0!==t.size).map(t=>[t.sets[0],t.size])),s=[];for(const i of t){if(i.sets.length<3)continue;const t=[...i.sets].sort();for(let i=0;i<t.length-1;i++)for(let r=i+1;r<t.length;r++){const o=[t[i],t[r]],a=o.join("|");if(!e.has(a)){e.add(a);const t=n.get(o[0]),i=n.get(o[1]),r=void 0!==t&&void 0!==i?Math.min(t,i)/4:2.5;s.push({sets:o,size:r,label:""})}}}return s.length>0?[...t,...s]:t}e(Et,"stableSetsKey"),e(Tt,"renderTextNodes"),e(zt,"ensurePairwiseSubsets");var At={parser:nt,db:kt,renderer:{draw:St},styles:wt};export{At as diagram};
|
package/dist/web/assets/{wardleyDiagram-EHGQE667-go5O5Sd2.js → wardleyDiagram-EHGQE667-DJ2RRwLP.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t;import{p as e}from"./chunk-JWPE2WC7-CRtoh7C6.js";import{_ as a,s as r,g as n,p as o,o as i,a as s,b as l,W as d,z as c,B as p,l as x,F as h,e as y,q as f,c as g}from"./mermaid.core-D1pd82vj.js";import{p as u}from"./cynefin-VYW2F7L2-Bfk1s_pC.js";import"./index-BIOvx5-n.js";import"./RemoteLifeOSBlock-bq0Spc3-.js";import"./App-C560TMeI.js";import"./index-CfjAw18S.js";import"./file-editor-index-C6CU7Fik.js";import"./purify.es-BNLkGfTg.js";import"./marked.esm-BBjA1da9.js";var m=a((t,e)=>{const a=t<=1?100*t:t;if(a<0||a>100)throw new Error(`${e} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${t}`);return a},"toPercent"),w=a((t,e,a)=>({x:m(e,`${a} evolution`),y:m(t,`${a} visibility`)}),"toCoordinates"),k=a(t=>{if(t)return"+<>"===t?"bidirectional":"+<"===t?"backward":"+>"===t?"forward":void 0},"getFlowFromPort"),b=a(t=>{if(!t?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(t),a=e?.[1];return t.includes("<>")?{flow:"bidirectional",label:a}:t.includes("<")?{flow:"backward",label:a}:t.includes(">")?{flow:"forward",label:a}:{label:a}},"extractFlowFromArrow"),$=a((t,a)=>{if(e(t,a),t.size&&a.setSize(t.size.width,t.size.height),t.evolution){const e=t.evolution.stages.map(t=>t.secondName?`${t.name.trim()} / ${t.secondName.trim()}`:t.name.trim()),r=t.evolution.stages.filter(t=>void 0!==t.boundary).map(t=>t.boundary);a.updateAxes({stages:e,stageBoundaries:r})}if(t.anchors.forEach(t=>{const e=w(t.visibility,t.evolution,`Anchor "${t.name}"`);a.addNode(t.name,t.name,e.x,e.y,"anchor")}),t.components.forEach(t=>{const e=w(t.visibility,t.evolution,`Component "${t.name}"`),r=t.label?(t.label.negX?-1:1)*t.label.offsetX:void 0,n=t.label?(t.label.negY?-1:1)*t.label.offsetY:void 0,o=t.decorator?.strategy;a.addNode(t.name,t.name,e.x,e.y,"component",r,n,t.inertia,o)}),t.notes.forEach(t=>{const e=w(t.visibility,t.evolution,`Note "${t.text}"`);a.addNote(t.text,e.x,e.y)}),t.pipelines.forEach(t=>{const e=a.getNode(t.parent);if(!e||"number"!=typeof e.y)throw new Error(`Pipeline "${t.parent}" must reference an existing component with coordinates.`);const r=e.y;a.startPipeline(t.parent),t.components.forEach(e=>{const n=`${t.parent}_${e.name}`,o=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,s=m(e.evolution,`Pipeline component "${e.name}" evolution`);a.addNode(n,e.name,s,r,"pipeline-component",o,i),a.addPipelineComponent(t.parent,n)})}),t.links.forEach(t=>{const e=!!t.arrow&&(t.arrow.includes("-.->")||t.arrow.includes(".-."));let r=k(t.fromPort)??k(t.toPort);const{flow:n,label:o}=b(t.arrow);!r&&n&&(r=n);const i=t.linkLabel,s=o??i;a.addLink(a.resolveNodeId(t.from),a.resolveNodeId(t.to),e,s,r)}),t.evolves.forEach(t=>{const e=a.getNode(t.component);if(void 0!==e?.y){const r=m(t.target,`Evolve target for "${t.component}"`);a.addTrend(t.component,r,e.y)}}),t.annotations.length>0){const e=t.annotations[0],r=w(e.x,e.y,"Annotations box");a.setAnnotationsBox(r.x,r.y)}t.annotation.forEach(t=>{const e=w(t.x,t.y,`Annotation ${t.number}`);a.addAnnotation(t.number,[{x:e.x,y:e.y}],t.text)}),t.accelerators.forEach(t=>{const e=w(t.x,t.y,`Accelerator "${t.name}"`);a.addAccelerator(t.name,e.x,e.y)}),t.deaccelerators.forEach(t=>{const e=w(t.x,t.y,`Deaccelerator "${t.name}"`);a.addDeaccelerator(t.name,e.x,e.y)})},"populateDb"),v={parser:{yy:void 0},parse:a(async t=>{const e=await u("wardley",t);x.debug(e);const a=v.parser?.yy;if(!a||"function"!=typeof a.addNode)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.");$(e,a)},"parse")},S=new(a(t=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(t){const e=this.nodes.get(t.id)??{id:t.id,label:t.label},a={...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY};this.nodes.set(t.id,a)}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});const e=this.nodes.get(t);e&&(e.isPipelineParent=!0)}addPipelineComponent(t,e){const a=this.pipelines.get(t);a&&a.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;for(const[e,a]of this.nodes)if(a.label===t)return e;return t}build(){const t=[];for(const e of this.nodes.values()){if("number"!=typeof e.x||"number"!=typeof e.y)throw new Error(`Node "${e.label}" is missing coordinates`);t.push(e)}return{nodes:t,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}},"WardleyBuilder"),t);function M(){return g()["wardley-beta"]}function C(t,e,a,r,n,o,i,s,l){S.addNode({id:t,label:e,x:a,y:r,className:n,labelOffsetX:o,labelOffsetY:i,inertia:s,sourceStrategy:l})}function P(t,e,a=!1,r,n){S.addLink({source:t,target:e,dashed:a,label:r,flow:n})}function N(t,e,a){S.addTrend({nodeId:t,targetX:e,targetY:a})}function z(t,e,a){S.addAnnotation({number:t,coordinates:e,text:a})}function L(t,e,a){S.addNote({text:t,x:e,y:a})}function T(t,e,a){S.addAccelerator({name:t,x:e,y:a})}function A(t,e,a){S.addDeaccelerator({name:t,x:e,y:a})}function E(t,e){S.setAnnotationsBox(t,e)}function I(t,e){S.setSize(t,e)}function B(t){S.startPipeline(t)}function F(t,e){S.addPipelineComponent(t,e)}function R(t){S.setAxes(t)}function Y(t){return S.getNode(t)}function O(t){return S.resolveNodeId(t)}function X(){return S.build()}function j(){S.clear(),f()}a(M,"getConfig"),a(C,"addNode"),a(P,"addLink"),a(N,"addTrend"),a(z,"addAnnotation"),a(L,"addNote"),a(T,"addAccelerator"),a(A,"addDeaccelerator"),a(E,"setAnnotationsBox"),a(I,"setSize"),a(B,"startPipeline"),a(F,"addPipelineComponent"),a(R,"updateAxes"),a(Y,"getNode"),a(O,"resolveNodeId"),a(X,"getWardleyData"),a(j,"clear");var W={getConfig:M,addNode:C,addLink:P,addTrend:N,addAnnotation:z,addNote:L,addAccelerator:T,addDeaccelerator:A,setAnnotationsBox:E,setSize:I,startPipeline:B,addPipelineComponent:F,updateAxes:R,getNode:Y,resolveNodeId:O,getWardleyData:X,clear:j,setAccTitle:l,getAccTitle:s,setDiagramTitle:i,getDiagramTitle:o,getAccDescription:n,setAccDescription:r},D=["Genesis","Custom Built","Product","Commodity"],q=a(()=>{const{themeVariables:t}=g();return{backgroundColor:t.wardley?.backgroundColor??t.background??"#fff",axisColor:t.wardley?.axisColor??"#000",axisTextColor:t.wardley?.axisTextColor??t.primaryTextColor??"#222",gridColor:t.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:t.wardley?.componentFill??"#fff",componentStroke:t.wardley?.componentStroke??"#000",componentLabelColor:t.wardley?.componentLabelColor??t.primaryTextColor??"#222",linkStroke:t.wardley?.linkStroke??"#000",evolutionStroke:t.wardley?.evolutionStroke??"#dc3545",annotationStroke:t.wardley?.annotationStroke??"#000",annotationTextColor:t.wardley?.annotationTextColor??t.primaryTextColor??"#222",annotationFill:t.wardley?.annotationFill??t.background??"#fff"}},"getTheme"),G=a(()=>{const t=g()["wardley-beta"];return{width:t?.width??900,height:t?.height??600,padding:t?.padding??48,nodeRadius:t?.nodeRadius??6,nodeLabelOffset:t?.nodeLabelOffset??8,axisFontSize:t?.axisFontSize??12,labelFontSize:t?.labelFontSize??10,showGrid:t?.showGrid??!1,useMaxWidth:t?.useMaxWidth??!0}},"getConfigValues"),V={parser:v,db:W,renderer:{draw:a((t,e,r,n)=>{x.debug("Rendering Wardley map\n"+t);const o=G(),i=q(),s=1.6*o.nodeRadius,l=n.db,d=l.getWardleyData(),c=l.getDiagramTitle(),p=d.size?.width??o.width,f=d.size?.height??o.height,g=h(e);g.selectAll("*").remove(),y(g,f,p,o.useMaxWidth),g.attr("viewBox",`0 0 ${p} ${f}`);const u=g.append("g").attr("class","wardley-map"),m=g.append("defs");m.append("marker").attr("id",`arrow-${e}`).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",i.evolutionStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-end-${e}`).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",i.linkStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-start-${e}`).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",i.linkStroke).attr("stroke","none"),u.append("rect").attr("class","wardley-background").attr("width",p).attr("height",f).attr("fill",i.backgroundColor);const w=p-2*o.padding,k=f-2*o.padding;c&&u.append("text").attr("class","wardley-title").attr("x",p/2).attr("y",o.padding/2).attr("fill",i.axisTextColor).attr("font-size",1.05*o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(c);const b=a(t=>o.padding+t/100*w,"projectX"),$=a(t=>f-o.padding-t/100*k,"projectY"),v=u.append("g").attr("class","wardley-axes");v.append("line").attr("x1",o.padding).attr("x2",p-o.padding).attr("y1",f-o.padding).attr("y2",f-o.padding).attr("stroke",i.axisColor).attr("stroke-width",1),v.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",f-o.padding).attr("stroke",i.axisColor).attr("stroke-width",1);const S=d.axes.xLabel??"Evolution",M=d.axes.yLabel??"Visibility";v.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+w/2).attr("y",f-o.padding/4).attr("fill",i.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(S),v.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+k/2).attr("fill",i.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+k/2})`).text(M);const C=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:D;if(C.length>0){const t=u.append("g").attr("class","wardley-stages"),e=d.axes.stageBoundaries,a=[];if(e&&e.length===C.length){let t=0;e.forEach(e=>{a.push({start:t,end:e}),t=e})}else{const t=1/C.length;C.forEach((e,r)=>{a.push({start:r*t,end:(r+1)*t})})}C.forEach((e,r)=>{const n=a[r],s=o.padding+n.start*w,l=(s+(o.padding+n.end*w))/2;r>0&&t.append("line").attr("x1",s).attr("x2",s).attr("y1",o.padding).attr("y2",f-o.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",l).attr("y",f-o.padding/1.5).attr("fill",i.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(e)})}if(o.showGrid){const t=u.append("g").attr("class","wardley-grid");for(let e=1;e<4;e++){const a=e/4,r=o.padding+w*a;t.append("line").attr("x1",r).attr("x2",r).attr("y1",o.padding).attr("y2",f-o.padding).attr("stroke",i.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",o.padding).attr("x2",p-o.padding).attr("y1",f-o.padding-k*a).attr("y2",f-o.padding-k*a).attr("stroke",i.gridColor).attr("stroke-dasharray","2 6")}}const P=new Map;if(d.nodes.forEach(t=>{P.set(t.id,{x:b(t.x),y:$(t.y),node:t})}),d.pipelines.length>0){const t=u.append("g").attr("class","wardley-pipelines"),e=u.append("g").attr("class","wardley-pipeline-links");d.pipelines.forEach(a=>{if(0===a.componentIds.length)return;const r=a.componentIds.map(t=>({id:t,pos:P.get(t),node:d.nodes.find(e=>e.id===t)})).filter(t=>t.pos&&t.node).sort((t,e)=>t.node.x-e.node.x);for(let t=0;t<r.length-1;t++){const a=r[t],n=r[t+1];e.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",a.pos.x).attr("y1",a.pos.y).attr("x2",n.pos.x).attr("y2",n.pos.y).attr("stroke",i.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let n=1/0,l=-1/0,c=0;if(a.componentIds.forEach(t=>{const e=P.get(t);e&&(n=Math.min(n,e.x),l=Math.max(l,e.x),c=e.y)}),n!==1/0&&l!==-1/0){const e=15,r=4*o.nodeRadius,d=c-r/2,p=P.get(a.nodeId);if(p){const t=(n+l)/2;p.x=t,p.y=d-s/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",n-e).attr("y",d).attr("width",l-n+2*e).attr("height",r).attr("fill","none").attr("stroke",i.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const N=u.append("g").attr("class","wardley-links"),z=new Map;d.pipelines.forEach(t=>{z.set(t.nodeId,new Set(t.componentIds))});const L=d.links.filter(t=>{if(!P.has(t.source)||!P.has(t.target))return!1;const e=z.get(t.target);return!e?.has(t.source)});N.selectAll("line").data(L).enter().append("line").attr("class",t=>"wardley-link"+(t.dashed?" wardley-link--dashed":"")).attr("x1",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=a.x-e.x,i=a.y-e.y,l=Math.sqrt(n*n+i*i);return e.x+n/l*r}).attr("y1",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=a.x-e.x,i=a.y-e.y,l=Math.sqrt(n*n+i*i);return e.y+i/l*r}).attr("x2",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=e.x-a.x,i=e.y-a.y,l=Math.sqrt(n*n+i*i);return a.x+n/l*r}).attr("y2",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=e.x-a.x,i=e.y-a.y,l=Math.sqrt(n*n+i*i);return a.y+i/l*r}).attr("stroke",i.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>"forward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-end-${e})`:null).attr("marker-start",t=>"backward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-start-${e})`:null),N.selectAll("text").data(L.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.x+a.x)/2,n=a.y-e.y,o=a.x-e.x;return r+n/Math.sqrt(o*o+n*n)*8}).attr("y",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.y+a.y)/2,n=a.x-e.x,o=a.y-e.y;return r+-n/Math.sqrt(n*n+o*o)*8}).attr("fill",i.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.x+a.x)/2,n=(e.y+a.y)/2,o=a.x-e.x,i=a.y-e.y,s=Math.sqrt(o*o+i*i),l=r+i/s*8,d=n+-o/s*8;let c=180*Math.atan2(i,o)/Math.PI;return(c>90||c<-90)&&(c+=180),`rotate(${c} ${l} ${d})`}).text(t=>t.label);const T=u.append("g").attr("class","wardley-trends"),A=d.trends.map(t=>{const e=P.get(t.nodeId);if(!e)return null;const a=b(t.targetX),r=$(t.targetY),n=a-e.x,i=r-e.y,s=Math.sqrt(n*n+i*i),l=o.nodeRadius+2;return{origin:e,targetX:a,targetY:r,adjustedX2:s>l?a-n/s*l:a,adjustedY2:s>l?r-i/s*l:r}}).filter(t=>null!==t);T.selectAll("line").data(A).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",i.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${e})`);const E=u.append("g").attr("class","wardley-nodes").selectAll("g").data(d.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));E.filter(t=>"outsource"===t.sourceStrategy).append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","#666").attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>"buy"===t.sourceStrategy).append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","#ccc").attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>"build"===t.sourceStrategy).append("circle").attr("class","wardley-build-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const I=E.filter(t=>"market"===t.sourceStrategy);I.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>!t.isPipelineParent&&"market"!==t.sourceStrategy&&"anchor"!==t.className).append("circle").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",o.nodeRadius).attr("fill",i.componentFill).attr("stroke",i.componentStroke).attr("stroke-width",1);const B=.7*o.nodeRadius,F=1.2*o.nodeRadius;if(I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x).attr("y1",t=>P.get(t.id).y-F).attr("x2",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("y2",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("stroke",i.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("y1",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("x2",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("y2",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("stroke",i.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("y1",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("x2",t=>P.get(t.id).x).attr("y2",t=>P.get(t.id).y-F).attr("stroke",i.componentStroke).attr("stroke-width",1),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y-F).attr("r",B).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("cy",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("r",B).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("cy",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("r",B).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",2),E.filter(t=>!0===t.isPipelineParent).append("rect").attr("x",t=>P.get(t.id).x-s/2).attr("y",t=>P.get(t.id).y-s/2).attr("width",s).attr("height",s).attr("fill",i.componentFill).attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>!0===t.inertia).append("line").attr("class","wardley-inertia").attr("x1",t=>{const e=P.get(t.id);let a=t.isPipelineParent?s/2+15:o.nodeRadius+15;return t.sourceStrategy&&(a+=o.nodeRadius+10),e.x+a}).attr("y1",t=>{const e=P.get(t.id),a=t.isPipelineParent?s:2*o.nodeRadius;return e.y-a/2}).attr("x2",t=>{const e=P.get(t.id);let a=t.isPipelineParent?s/2+15:o.nodeRadius+15;return t.sourceStrategy&&(a+=o.nodeRadius+10),e.x+a}).attr("y2",t=>{const e=P.get(t.id),a=t.isPipelineParent?s:2*o.nodeRadius;return e.y+a/2}).attr("stroke",i.componentStroke).attr("stroke-width",6),E.append("text").attr("x",t=>{const e=P.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetX?e.x+t.labelOffsetX:e.x;let a=o.nodeLabelOffset;t.sourceStrategy&&void 0===t.labelOffsetX&&(a+=10);const r=t.labelOffsetX??a;return e.x+r}).attr("y",t=>{const e=P.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetY?e.y+t.labelOffsetY:e.y-3;let a=-o.nodeLabelOffset;t.sourceStrategy&&void 0===t.labelOffsetY&&(a-=10);const r=t.labelOffsetY??a;return e.y+r}).attr("class","wardley-node-label").attr("fill",t=>"evolved"===t.className?i.evolutionStroke:"anchor"===t.className?"#000":i.componentLabelColor).attr("font-size",o.labelFontSize).attr("font-weight",t=>"anchor"===t.className?"bold":"normal").attr("text-anchor",t=>"anchor"===t.className?"middle":"start").attr("dominant-baseline",t=>"anchor"===t.className?"middle":"auto").text(t=>t.label),d.annotations.length>0){const t=u.append("g").attr("class","wardley-annotations");if(d.annotations.forEach(e=>{const a=e.coordinates.map(t=>({x:b(t.x),y:$(t.y)}));if(a.length>1)for(let r=0;r<a.length-1;r++)t.append("line").attr("class","wardley-annotation-line").attr("x1",a[r].x).attr("y1",a[r].y).attr("x2",a[r+1].x).attr("y2",a[r+1].y).attr("stroke",i.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");a.forEach(a=>{const r=t.append("g").attr("class","wardley-annotation");r.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("fill","white").attr("stroke",i.axisColor).attr("stroke-width",1.5),r.append("text").attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.number)})}),d.annotationsBox){let e=b(d.annotationsBox.x),a=$(d.annotationsBox.y);const r=10,n=16,s=11,l=t.append("g").attr("class","wardley-annotations-box"),c=[...d.annotations].filter(t=>t.text).sort((t,e)=>t.number-e.number),x=[];if(c.forEach((t,o)=>{const d=l.append("text").attr("x",e+r).attr("y",a+r+(o+1)*n).attr("font-size",s).attr("fill",i.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${t.number}. ${t.text}`);x.push(d)}),x.length>0){let t=0,s=0;x.forEach(e=>{const a=e.node(),r=a.getComputedTextLength();t=Math.max(t,r);const n=a.getBBox();s=Math.max(s,n.height)});const d=t+2*r+105,h=c.length*n+2*r+s/2,y=o.padding,g=p-o.padding-d,u=o.padding,m=f-o.padding-h;e=Math.max(y,Math.min(e,g)),a=Math.max(u,Math.min(a,m)),x.forEach((t,o)=>{t.attr("x",e+r).attr("y",a+r+(o+1)*n)}),l.insert("rect","text").attr("x",e).attr("y",a).attr("width",d).attr("height",h).attr("fill","white").attr("stroke",i.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(d.notes.length>0){const t=u.append("g").attr("class","wardley-notes");d.notes.forEach(e=>{const a=b(e.x),r=$(e.y);t.append("text").attr("x",a).attr("y",r).attr("text-anchor","start").attr("font-size",11).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.text)})}if(d.accelerators.length>0){const t=u.append("g").attr("class","wardley-accelerators");d.accelerators.forEach(e=>{const a=b(e.x),r=$(e.y),n=`\n M ${a} ${r-15}\n L ${a+60-20} ${r-15}\n L ${a+60-20} ${r-15-8}\n L ${a+60} ${r}\n L ${a+60-20} ${r+15+8}\n L ${a+60-20} ${r+15}\n L ${a} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.name)})}if(d.deaccelerators.length>0){const t=u.append("g").attr("class","wardley-deaccelerators");d.deaccelerators.forEach(e=>{const a=b(e.x),r=$(e.y),n=`\n M ${a+60} ${r-15}\n L ${a+20} ${r-15}\n L ${a+20} ${r-15-8}\n L ${a} ${r}\n L ${a+20} ${r+15+8}\n L ${a+20} ${r+15}\n L ${a+60} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.name)})}},"draw")},styles:a(({wardley:t}={})=>{const e=d(),a=c(),r=p(e,a.themeVariables),n=p(r.wardley,t);return`\n .wardley-background {\n fill: ${n.backgroundColor};\n }\n .wardley-axes line, .wardley-axes path {\n stroke: ${n.axisColor};\n }\n .wardley-axis-label {\n fill: ${n.axisTextColor};\n }\n .wardley-stage-label {\n fill: ${n.axisTextColor};\n }\n .wardley-grid line {\n stroke: ${n.gridColor};\n }\n .wardley-node circle {\n fill: ${n.componentFill};\n stroke: ${n.componentStroke};\n }\n .wardley-node-label {\n fill: ${n.componentLabelColor};\n }\n .wardley-link {\n stroke: ${n.linkStroke};\n }\n .wardley-link--dashed {\n stroke-dasharray: 4 4;\n }\n .wardley-link-label {\n fill: ${n.axisTextColor};\n }\n .wardley-trend line {\n stroke: ${n.evolutionStroke};\n }\n .wardley-annotation-line {\n stroke: ${n.annotationStroke};\n }\n .wardley-annotation circle {\n fill: ${n.annotationFill};\n stroke: ${n.annotationStroke};\n }\n .wardley-annotation text {\n fill: ${n.annotationTextColor};\n }\n .wardley-annotations-box rect {\n fill: ${n.annotationFill};\n stroke: ${n.annotationStroke};\n }\n .wardley-annotations-box text {\n fill: ${n.annotationTextColor};\n }\n .wardley-pipeline-box {\n stroke: ${n.componentStroke};\n }\n .wardley-notes text {\n fill: ${n.axisTextColor};\n }\n `},"styles")};export{V as diagram};
|
|
1
|
+
var t;import{p as e}from"./chunk-JWPE2WC7-8R4xqfzd.js";import{_ as a,s as r,g as n,p as o,o as i,a as s,b as l,W as d,z as c,B as p,l as x,F as h,e as y,q as f,c as g}from"./mermaid.core-CTf8qcol.js";import{p as u}from"./cynefin-VYW2F7L2-bQLn5vS2.js";import"./index-CX8KV6EH.js";import"./RemoteLifeOSBlock-C46RjZWn.js";import"./App-CLTYkSvy.js";import"./index-CapF4a8Y.js";import"./file-editor-index-C6CU7Fik.js";import"./purify.es-BNLkGfTg.js";import"./marked.esm-BBjA1da9.js";var m=a((t,e)=>{const a=t<=1?100*t:t;if(a<0||a>100)throw new Error(`${e} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${t}`);return a},"toPercent"),w=a((t,e,a)=>({x:m(e,`${a} evolution`),y:m(t,`${a} visibility`)}),"toCoordinates"),k=a(t=>{if(t)return"+<>"===t?"bidirectional":"+<"===t?"backward":"+>"===t?"forward":void 0},"getFlowFromPort"),b=a(t=>{if(!t?.startsWith("+"))return{};const e=/^\+'([^']*)'/.exec(t),a=e?.[1];return t.includes("<>")?{flow:"bidirectional",label:a}:t.includes("<")?{flow:"backward",label:a}:t.includes(">")?{flow:"forward",label:a}:{label:a}},"extractFlowFromArrow"),$=a((t,a)=>{if(e(t,a),t.size&&a.setSize(t.size.width,t.size.height),t.evolution){const e=t.evolution.stages.map(t=>t.secondName?`${t.name.trim()} / ${t.secondName.trim()}`:t.name.trim()),r=t.evolution.stages.filter(t=>void 0!==t.boundary).map(t=>t.boundary);a.updateAxes({stages:e,stageBoundaries:r})}if(t.anchors.forEach(t=>{const e=w(t.visibility,t.evolution,`Anchor "${t.name}"`);a.addNode(t.name,t.name,e.x,e.y,"anchor")}),t.components.forEach(t=>{const e=w(t.visibility,t.evolution,`Component "${t.name}"`),r=t.label?(t.label.negX?-1:1)*t.label.offsetX:void 0,n=t.label?(t.label.negY?-1:1)*t.label.offsetY:void 0,o=t.decorator?.strategy;a.addNode(t.name,t.name,e.x,e.y,"component",r,n,t.inertia,o)}),t.notes.forEach(t=>{const e=w(t.visibility,t.evolution,`Note "${t.text}"`);a.addNote(t.text,e.x,e.y)}),t.pipelines.forEach(t=>{const e=a.getNode(t.parent);if(!e||"number"!=typeof e.y)throw new Error(`Pipeline "${t.parent}" must reference an existing component with coordinates.`);const r=e.y;a.startPipeline(t.parent),t.components.forEach(e=>{const n=`${t.parent}_${e.name}`,o=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,s=m(e.evolution,`Pipeline component "${e.name}" evolution`);a.addNode(n,e.name,s,r,"pipeline-component",o,i),a.addPipelineComponent(t.parent,n)})}),t.links.forEach(t=>{const e=!!t.arrow&&(t.arrow.includes("-.->")||t.arrow.includes(".-."));let r=k(t.fromPort)??k(t.toPort);const{flow:n,label:o}=b(t.arrow);!r&&n&&(r=n);const i=t.linkLabel,s=o??i;a.addLink(a.resolveNodeId(t.from),a.resolveNodeId(t.to),e,s,r)}),t.evolves.forEach(t=>{const e=a.getNode(t.component);if(void 0!==e?.y){const r=m(t.target,`Evolve target for "${t.component}"`);a.addTrend(t.component,r,e.y)}}),t.annotations.length>0){const e=t.annotations[0],r=w(e.x,e.y,"Annotations box");a.setAnnotationsBox(r.x,r.y)}t.annotation.forEach(t=>{const e=w(t.x,t.y,`Annotation ${t.number}`);a.addAnnotation(t.number,[{x:e.x,y:e.y}],t.text)}),t.accelerators.forEach(t=>{const e=w(t.x,t.y,`Accelerator "${t.name}"`);a.addAccelerator(t.name,e.x,e.y)}),t.deaccelerators.forEach(t=>{const e=w(t.x,t.y,`Deaccelerator "${t.name}"`);a.addDeaccelerator(t.name,e.x,e.y)})},"populateDb"),v={parser:{yy:void 0},parse:a(async t=>{const e=await u("wardley",t);x.debug(e);const a=v.parser?.yy;if(!a||"function"!=typeof a.addNode)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.");$(e,a)},"parse")},S=new(a(t=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(t){const e=this.nodes.get(t.id)??{id:t.id,label:t.label},a={...e,...t,className:t.className??e.className,labelOffsetX:t.labelOffsetX??e.labelOffsetX,labelOffsetY:t.labelOffsetY??e.labelOffsetY};this.nodes.set(t.id,a)}addLink(t){this.links.push(t)}addTrend(t){this.trends.set(t.nodeId,t)}startPipeline(t){this.pipelines.set(t,{nodeId:t,componentIds:[]});const e=this.nodes.get(t);e&&(e.isPipelineParent=!0)}addPipelineComponent(t,e){const a=this.pipelines.get(t);a&&a.componentIds.push(e);const r=this.nodes.get(e);r&&(r.inPipeline=!0)}addAnnotation(t){this.annotations.push(t)}addNote(t){this.notes.push(t)}addAccelerator(t){this.accelerators.push(t)}addDeaccelerator(t){this.deaccelerators.push(t)}setAnnotationsBox(t,e){this.annotationsBox={x:t,y:e}}setAxes(t){this.axes={...this.axes,...t}}setSize(t,e){this.size={width:t,height:e}}getNode(t){return this.nodes.get(t)}resolveNodeId(t){if(this.nodes.has(t))return t;for(const[e,a]of this.nodes)if(a.label===t)return e;return t}build(){const t=[];for(const e of this.nodes.values()){if("number"!=typeof e.x||"number"!=typeof e.y)throw new Error(`Node "${e.label}" is missing coordinates`);t.push(e)}return{nodes:t,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}},"WardleyBuilder"),t);function M(){return g()["wardley-beta"]}function C(t,e,a,r,n,o,i,s,l){S.addNode({id:t,label:e,x:a,y:r,className:n,labelOffsetX:o,labelOffsetY:i,inertia:s,sourceStrategy:l})}function P(t,e,a=!1,r,n){S.addLink({source:t,target:e,dashed:a,label:r,flow:n})}function N(t,e,a){S.addTrend({nodeId:t,targetX:e,targetY:a})}function z(t,e,a){S.addAnnotation({number:t,coordinates:e,text:a})}function L(t,e,a){S.addNote({text:t,x:e,y:a})}function T(t,e,a){S.addAccelerator({name:t,x:e,y:a})}function A(t,e,a){S.addDeaccelerator({name:t,x:e,y:a})}function E(t,e){S.setAnnotationsBox(t,e)}function I(t,e){S.setSize(t,e)}function B(t){S.startPipeline(t)}function F(t,e){S.addPipelineComponent(t,e)}function R(t){S.setAxes(t)}function Y(t){return S.getNode(t)}function O(t){return S.resolveNodeId(t)}function X(){return S.build()}function j(){S.clear(),f()}a(M,"getConfig"),a(C,"addNode"),a(P,"addLink"),a(N,"addTrend"),a(z,"addAnnotation"),a(L,"addNote"),a(T,"addAccelerator"),a(A,"addDeaccelerator"),a(E,"setAnnotationsBox"),a(I,"setSize"),a(B,"startPipeline"),a(F,"addPipelineComponent"),a(R,"updateAxes"),a(Y,"getNode"),a(O,"resolveNodeId"),a(X,"getWardleyData"),a(j,"clear");var W={getConfig:M,addNode:C,addLink:P,addTrend:N,addAnnotation:z,addNote:L,addAccelerator:T,addDeaccelerator:A,setAnnotationsBox:E,setSize:I,startPipeline:B,addPipelineComponent:F,updateAxes:R,getNode:Y,resolveNodeId:O,getWardleyData:X,clear:j,setAccTitle:l,getAccTitle:s,setDiagramTitle:i,getDiagramTitle:o,getAccDescription:n,setAccDescription:r},D=["Genesis","Custom Built","Product","Commodity"],q=a(()=>{const{themeVariables:t}=g();return{backgroundColor:t.wardley?.backgroundColor??t.background??"#fff",axisColor:t.wardley?.axisColor??"#000",axisTextColor:t.wardley?.axisTextColor??t.primaryTextColor??"#222",gridColor:t.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:t.wardley?.componentFill??"#fff",componentStroke:t.wardley?.componentStroke??"#000",componentLabelColor:t.wardley?.componentLabelColor??t.primaryTextColor??"#222",linkStroke:t.wardley?.linkStroke??"#000",evolutionStroke:t.wardley?.evolutionStroke??"#dc3545",annotationStroke:t.wardley?.annotationStroke??"#000",annotationTextColor:t.wardley?.annotationTextColor??t.primaryTextColor??"#222",annotationFill:t.wardley?.annotationFill??t.background??"#fff"}},"getTheme"),G=a(()=>{const t=g()["wardley-beta"];return{width:t?.width??900,height:t?.height??600,padding:t?.padding??48,nodeRadius:t?.nodeRadius??6,nodeLabelOffset:t?.nodeLabelOffset??8,axisFontSize:t?.axisFontSize??12,labelFontSize:t?.labelFontSize??10,showGrid:t?.showGrid??!1,useMaxWidth:t?.useMaxWidth??!0}},"getConfigValues"),V={parser:v,db:W,renderer:{draw:a((t,e,r,n)=>{x.debug("Rendering Wardley map\n"+t);const o=G(),i=q(),s=1.6*o.nodeRadius,l=n.db,d=l.getWardleyData(),c=l.getDiagramTitle(),p=d.size?.width??o.width,f=d.size?.height??o.height,g=h(e);g.selectAll("*").remove(),y(g,f,p,o.useMaxWidth),g.attr("viewBox",`0 0 ${p} ${f}`);const u=g.append("g").attr("class","wardley-map"),m=g.append("defs");m.append("marker").attr("id",`arrow-${e}`).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",i.evolutionStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-end-${e}`).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",i.linkStroke).attr("stroke","none"),m.append("marker").attr("id",`link-arrow-start-${e}`).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",i.linkStroke).attr("stroke","none"),u.append("rect").attr("class","wardley-background").attr("width",p).attr("height",f).attr("fill",i.backgroundColor);const w=p-2*o.padding,k=f-2*o.padding;c&&u.append("text").attr("class","wardley-title").attr("x",p/2).attr("y",o.padding/2).attr("fill",i.axisTextColor).attr("font-size",1.05*o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(c);const b=a(t=>o.padding+t/100*w,"projectX"),$=a(t=>f-o.padding-t/100*k,"projectY"),v=u.append("g").attr("class","wardley-axes");v.append("line").attr("x1",o.padding).attr("x2",p-o.padding).attr("y1",f-o.padding).attr("y2",f-o.padding).attr("stroke",i.axisColor).attr("stroke-width",1),v.append("line").attr("x1",o.padding).attr("x2",o.padding).attr("y1",o.padding).attr("y2",f-o.padding).attr("stroke",i.axisColor).attr("stroke-width",1);const S=d.axes.xLabel??"Evolution",M=d.axes.yLabel??"Visibility";v.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",o.padding+w/2).attr("y",f-o.padding/4).attr("fill",i.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(S),v.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",o.padding/3).attr("y",o.padding+k/2).attr("fill",i.axisTextColor).attr("font-size",o.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${o.padding/3} ${o.padding+k/2})`).text(M);const C=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:D;if(C.length>0){const t=u.append("g").attr("class","wardley-stages"),e=d.axes.stageBoundaries,a=[];if(e&&e.length===C.length){let t=0;e.forEach(e=>{a.push({start:t,end:e}),t=e})}else{const t=1/C.length;C.forEach((e,r)=>{a.push({start:r*t,end:(r+1)*t})})}C.forEach((e,r)=>{const n=a[r],s=o.padding+n.start*w,l=(s+(o.padding+n.end*w))/2;r>0&&t.append("line").attr("x1",s).attr("x2",s).attr("y1",o.padding).attr("y2",f-o.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",l).attr("y",f-o.padding/1.5).attr("fill",i.axisTextColor).attr("font-size",o.axisFontSize-2).attr("text-anchor","middle").text(e)})}if(o.showGrid){const t=u.append("g").attr("class","wardley-grid");for(let e=1;e<4;e++){const a=e/4,r=o.padding+w*a;t.append("line").attr("x1",r).attr("x2",r).attr("y1",o.padding).attr("y2",f-o.padding).attr("stroke",i.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",o.padding).attr("x2",p-o.padding).attr("y1",f-o.padding-k*a).attr("y2",f-o.padding-k*a).attr("stroke",i.gridColor).attr("stroke-dasharray","2 6")}}const P=new Map;if(d.nodes.forEach(t=>{P.set(t.id,{x:b(t.x),y:$(t.y),node:t})}),d.pipelines.length>0){const t=u.append("g").attr("class","wardley-pipelines"),e=u.append("g").attr("class","wardley-pipeline-links");d.pipelines.forEach(a=>{if(0===a.componentIds.length)return;const r=a.componentIds.map(t=>({id:t,pos:P.get(t),node:d.nodes.find(e=>e.id===t)})).filter(t=>t.pos&&t.node).sort((t,e)=>t.node.x-e.node.x);for(let t=0;t<r.length-1;t++){const a=r[t],n=r[t+1];e.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",a.pos.x).attr("y1",a.pos.y).attr("x2",n.pos.x).attr("y2",n.pos.y).attr("stroke",i.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let n=1/0,l=-1/0,c=0;if(a.componentIds.forEach(t=>{const e=P.get(t);e&&(n=Math.min(n,e.x),l=Math.max(l,e.x),c=e.y)}),n!==1/0&&l!==-1/0){const e=15,r=4*o.nodeRadius,d=c-r/2,p=P.get(a.nodeId);if(p){const t=(n+l)/2;p.x=t,p.y=d-s/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",n-e).attr("y",d).attr("width",l-n+2*e).attr("height",r).attr("fill","none").attr("stroke",i.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}const N=u.append("g").attr("class","wardley-links"),z=new Map;d.pipelines.forEach(t=>{z.set(t.nodeId,new Set(t.componentIds))});const L=d.links.filter(t=>{if(!P.has(t.source)||!P.has(t.target))return!1;const e=z.get(t.target);return!e?.has(t.source)});N.selectAll("line").data(L).enter().append("line").attr("class",t=>"wardley-link"+(t.dashed?" wardley-link--dashed":"")).attr("x1",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=a.x-e.x,i=a.y-e.y,l=Math.sqrt(n*n+i*i);return e.x+n/l*r}).attr("y1",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.source).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=a.x-e.x,i=a.y-e.y,l=Math.sqrt(n*n+i*i);return e.y+i/l*r}).attr("x2",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=e.x-a.x,i=e.y-a.y,l=Math.sqrt(n*n+i*i);return a.x+n/l*r}).attr("y2",t=>{const e=P.get(t.source),a=P.get(t.target),r=d.nodes.find(e=>e.id===t.target).isPipelineParent?s/Math.sqrt(2):o.nodeRadius,n=e.x-a.x,i=e.y-a.y,l=Math.sqrt(n*n+i*i);return a.y+i/l*r}).attr("stroke",i.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",t=>t.dashed?"6 6":null).attr("marker-end",t=>"forward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-end-${e})`:null).attr("marker-start",t=>"backward"===t.flow||"bidirectional"===t.flow?`url(#link-arrow-start-${e})`:null),N.selectAll("text").data(L.filter(t=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.x+a.x)/2,n=a.y-e.y,o=a.x-e.x;return r+n/Math.sqrt(o*o+n*n)*8}).attr("y",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.y+a.y)/2,n=a.x-e.x,o=a.y-e.y;return r+-n/Math.sqrt(n*n+o*o)*8}).attr("fill",i.axisTextColor).attr("font-size",o.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",t=>{const e=P.get(t.source),a=P.get(t.target),r=(e.x+a.x)/2,n=(e.y+a.y)/2,o=a.x-e.x,i=a.y-e.y,s=Math.sqrt(o*o+i*i),l=r+i/s*8,d=n+-o/s*8;let c=180*Math.atan2(i,o)/Math.PI;return(c>90||c<-90)&&(c+=180),`rotate(${c} ${l} ${d})`}).text(t=>t.label);const T=u.append("g").attr("class","wardley-trends"),A=d.trends.map(t=>{const e=P.get(t.nodeId);if(!e)return null;const a=b(t.targetX),r=$(t.targetY),n=a-e.x,i=r-e.y,s=Math.sqrt(n*n+i*i),l=o.nodeRadius+2;return{origin:e,targetX:a,targetY:r,adjustedX2:s>l?a-n/s*l:a,adjustedY2:s>l?r-i/s*l:r}}).filter(t=>null!==t);T.selectAll("line").data(A).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",i.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${e})`);const E=u.append("g").attr("class","wardley-nodes").selectAll("g").data(d.nodes).enter().append("g").attr("class",t=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));E.filter(t=>"outsource"===t.sourceStrategy).append("circle").attr("class","wardley-outsource-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","#666").attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>"buy"===t.sourceStrategy).append("circle").attr("class","wardley-buy-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","#ccc").attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>"build"===t.sourceStrategy).append("circle").attr("class","wardley-build-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);const I=E.filter(t=>"market"===t.sourceStrategy);I.append("circle").attr("class","wardley-market-overlay").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",2*o.nodeRadius).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>!t.isPipelineParent&&"market"!==t.sourceStrategy&&"anchor"!==t.className).append("circle").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y).attr("r",o.nodeRadius).attr("fill",i.componentFill).attr("stroke",i.componentStroke).attr("stroke-width",1);const B=.7*o.nodeRadius,F=1.2*o.nodeRadius;if(I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x).attr("y1",t=>P.get(t.id).y-F).attr("x2",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("y2",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("stroke",i.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("y1",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("x2",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("y2",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("stroke",i.componentStroke).attr("stroke-width",1),I.append("line").attr("class","wardley-market-line").attr("x1",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("y1",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("x2",t=>P.get(t.id).x).attr("y2",t=>P.get(t.id).y-F).attr("stroke",i.componentStroke).attr("stroke-width",1),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x).attr("cy",t=>P.get(t.id).y-F).attr("r",B).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x-F*Math.cos(Math.PI/6)).attr("cy",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("r",B).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",2),I.append("circle").attr("class","wardley-market-dot").attr("cx",t=>P.get(t.id).x+F*Math.cos(Math.PI/6)).attr("cy",t=>P.get(t.id).y+F*Math.sin(Math.PI/6)).attr("r",B).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",2),E.filter(t=>!0===t.isPipelineParent).append("rect").attr("x",t=>P.get(t.id).x-s/2).attr("y",t=>P.get(t.id).y-s/2).attr("width",s).attr("height",s).attr("fill",i.componentFill).attr("stroke",i.componentStroke).attr("stroke-width",1),E.filter(t=>!0===t.inertia).append("line").attr("class","wardley-inertia").attr("x1",t=>{const e=P.get(t.id);let a=t.isPipelineParent?s/2+15:o.nodeRadius+15;return t.sourceStrategy&&(a+=o.nodeRadius+10),e.x+a}).attr("y1",t=>{const e=P.get(t.id),a=t.isPipelineParent?s:2*o.nodeRadius;return e.y-a/2}).attr("x2",t=>{const e=P.get(t.id);let a=t.isPipelineParent?s/2+15:o.nodeRadius+15;return t.sourceStrategy&&(a+=o.nodeRadius+10),e.x+a}).attr("y2",t=>{const e=P.get(t.id),a=t.isPipelineParent?s:2*o.nodeRadius;return e.y+a/2}).attr("stroke",i.componentStroke).attr("stroke-width",6),E.append("text").attr("x",t=>{const e=P.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetX?e.x+t.labelOffsetX:e.x;let a=o.nodeLabelOffset;t.sourceStrategy&&void 0===t.labelOffsetX&&(a+=10);const r=t.labelOffsetX??a;return e.x+r}).attr("y",t=>{const e=P.get(t.id);if("anchor"===t.className)return void 0!==t.labelOffsetY?e.y+t.labelOffsetY:e.y-3;let a=-o.nodeLabelOffset;t.sourceStrategy&&void 0===t.labelOffsetY&&(a-=10);const r=t.labelOffsetY??a;return e.y+r}).attr("class","wardley-node-label").attr("fill",t=>"evolved"===t.className?i.evolutionStroke:"anchor"===t.className?"#000":i.componentLabelColor).attr("font-size",o.labelFontSize).attr("font-weight",t=>"anchor"===t.className?"bold":"normal").attr("text-anchor",t=>"anchor"===t.className?"middle":"start").attr("dominant-baseline",t=>"anchor"===t.className?"middle":"auto").text(t=>t.label),d.annotations.length>0){const t=u.append("g").attr("class","wardley-annotations");if(d.annotations.forEach(e=>{const a=e.coordinates.map(t=>({x:b(t.x),y:$(t.y)}));if(a.length>1)for(let r=0;r<a.length-1;r++)t.append("line").attr("class","wardley-annotation-line").attr("x1",a[r].x).attr("y1",a[r].y).attr("x2",a[r+1].x).attr("y2",a[r+1].y).attr("stroke",i.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");a.forEach(a=>{const r=t.append("g").attr("class","wardley-annotation");r.append("circle").attr("cx",a.x).attr("cy",a.y).attr("r",10).attr("fill","white").attr("stroke",i.axisColor).attr("stroke-width",1.5),r.append("text").attr("x",a.x).attr("y",a.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.number)})}),d.annotationsBox){let e=b(d.annotationsBox.x),a=$(d.annotationsBox.y);const r=10,n=16,s=11,l=t.append("g").attr("class","wardley-annotations-box"),c=[...d.annotations].filter(t=>t.text).sort((t,e)=>t.number-e.number),x=[];if(c.forEach((t,o)=>{const d=l.append("text").attr("x",e+r).attr("y",a+r+(o+1)*n).attr("font-size",s).attr("fill",i.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${t.number}. ${t.text}`);x.push(d)}),x.length>0){let t=0,s=0;x.forEach(e=>{const a=e.node(),r=a.getComputedTextLength();t=Math.max(t,r);const n=a.getBBox();s=Math.max(s,n.height)});const d=t+2*r+105,h=c.length*n+2*r+s/2,y=o.padding,g=p-o.padding-d,u=o.padding,m=f-o.padding-h;e=Math.max(y,Math.min(e,g)),a=Math.max(u,Math.min(a,m)),x.forEach((t,o)=>{t.attr("x",e+r).attr("y",a+r+(o+1)*n)}),l.insert("rect","text").attr("x",e).attr("y",a).attr("width",d).attr("height",h).attr("fill","white").attr("stroke",i.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(d.notes.length>0){const t=u.append("g").attr("class","wardley-notes");d.notes.forEach(e=>{const a=b(e.x),r=$(e.y);t.append("text").attr("x",a).attr("y",r).attr("text-anchor","start").attr("font-size",11).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.text)})}if(d.accelerators.length>0){const t=u.append("g").attr("class","wardley-accelerators");d.accelerators.forEach(e=>{const a=b(e.x),r=$(e.y),n=`\n M ${a} ${r-15}\n L ${a+60-20} ${r-15}\n L ${a+60-20} ${r-15-8}\n L ${a+60} ${r}\n L ${a+60-20} ${r+15+8}\n L ${a+60-20} ${r+15}\n L ${a} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.name)})}if(d.deaccelerators.length>0){const t=u.append("g").attr("class","wardley-deaccelerators");d.deaccelerators.forEach(e=>{const a=b(e.x),r=$(e.y),n=`\n M ${a+60} ${r-15}\n L ${a+20} ${r-15}\n L ${a+20} ${r-15-8}\n L ${a} ${r}\n L ${a+20} ${r+15+8}\n L ${a+20} ${r+15}\n L ${a+60} ${r+15}\n Z\n `;t.append("path").attr("d",n).attr("fill","white").attr("stroke",i.componentStroke).attr("stroke-width",1),t.append("text").attr("x",a+30).attr("y",r+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",i.axisTextColor).attr("font-weight","bold").text(e.name)})}},"draw")},styles:a(({wardley:t}={})=>{const e=d(),a=c(),r=p(e,a.themeVariables),n=p(r.wardley,t);return`\n .wardley-background {\n fill: ${n.backgroundColor};\n }\n .wardley-axes line, .wardley-axes path {\n stroke: ${n.axisColor};\n }\n .wardley-axis-label {\n fill: ${n.axisTextColor};\n }\n .wardley-stage-label {\n fill: ${n.axisTextColor};\n }\n .wardley-grid line {\n stroke: ${n.gridColor};\n }\n .wardley-node circle {\n fill: ${n.componentFill};\n stroke: ${n.componentStroke};\n }\n .wardley-node-label {\n fill: ${n.componentLabelColor};\n }\n .wardley-link {\n stroke: ${n.linkStroke};\n }\n .wardley-link--dashed {\n stroke-dasharray: 4 4;\n }\n .wardley-link-label {\n fill: ${n.axisTextColor};\n }\n .wardley-trend line {\n stroke: ${n.evolutionStroke};\n }\n .wardley-annotation-line {\n stroke: ${n.annotationStroke};\n }\n .wardley-annotation circle {\n fill: ${n.annotationFill};\n stroke: ${n.annotationStroke};\n }\n .wardley-annotation text {\n fill: ${n.annotationTextColor};\n }\n .wardley-annotations-box rect {\n fill: ${n.annotationFill};\n stroke: ${n.annotationStroke};\n }\n .wardley-annotations-box text {\n fill: ${n.annotationTextColor};\n }\n .wardley-pipeline-box {\n stroke: ${n.componentStroke};\n }\n .wardley-notes text {\n fill: ${n.axisTextColor};\n }\n `},"styles")};export{V as diagram};
|