@softistx/pulsarix-widget 0.7.2 → 0.8.0
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/README.md +15 -8
- package/dist/chunks/abnfDiagram-XWFEHMT6.jcqkp43e.js +1 -0
- package/dist/chunks/architecture-WOLXFQ4H.6qa86taq.js +1 -0
- package/dist/chunks/architectureDiagram-CSQXQB3N.pk9dxdfb.js +36 -0
- package/dist/chunks/blockDiagram-BEDRHYPZ.ehefn7dt.js +140 -0
- package/dist/chunks/bpmnIcons-APHXDYXF.whh96nc8.js +1 -0
- package/dist/chunks/c4Diagram-M2UUVUY5.knj3as6x.js +38 -0
- package/dist/chunks/chat-markdown-DLDNLXM9.tvekh9sm.js +301 -0
- package/dist/chunks/classDiagram-v2-KXABOMEV.vtb7vjzn.js +217 -0
- package/dist/chunks/cose-bilkent-JH36ORCC.gb18dr42.js +1 -0
- package/dist/chunks/cynefin-EF2NZ3EQ.e86yfa9w.js +1 -0
- package/dist/chunks/cynefinDiagram-NJNITYFG.akmr90zk.js +62 -0
- package/dist/chunks/dagre-KIHZ2IZ3.7n7s7vq2.js +4 -0
- package/dist/chunks/diagram-7YQZDPLS.d3sdv0py.js +41 -0
- package/dist/chunks/diagram-QBROCOUO.2v08zs42.js +200 -0
- package/dist/chunks/diagram-RJJCUUZO.tpnwa621.js +30 -0
- package/dist/chunks/diagram-WERXNKYE.hz7tgbtr.js +24 -0
- package/dist/chunks/diagram-YHHI257C.9gge9ecb.js +3 -0
- package/dist/chunks/diagram-YR4HJLHV.bajpx75b.js +24 -0
- package/dist/chunks/ebnfDiagram-N527522P.hxbbq671.js +1 -0
- package/dist/chunks/editor-shortcuts-dialog-I77EAez1.0s00eh53.js +1 -0
- package/dist/chunks/editor.h5bxwyxn.js +4 -0
- package/dist/chunks/elk-O5DQBFGD.vy7cdqps.js +27 -0
- package/dist/chunks/emoji-picker-BofyuTmK.qf287fk6.js +4 -0
- package/dist/chunks/erDiagram-K3K3BIDK.kzs3v0ts.js +99 -0
- package/dist/chunks/eventmodeling-K75KTNOO.9yb5zf47.js +1 -0
- package/dist/chunks/flow-diagram-OPO1ep57.5006stqg.js +7 -0
- package/dist/chunks/flowDiagram-Z6JWZHQI.zf0kndsp.js +1 -0
- package/dist/chunks/ganttDiagram-3PRQTZWP.qkcp8pvg.js +292 -0
- package/dist/chunks/gitGraph-VSP46ZUC.txpj8e6d.js +1 -0
- package/dist/chunks/gitGraphDiagram-VXDFKS5L.ry9dejxm.js +106 -0
- package/dist/chunks/grid-E2QIVN74.q51enfx7.js +1 -0
- package/dist/chunks/illustration-BoOzuxNg.h0gnxa4s.js +1 -0
- package/dist/chunks/index.0hrfbrja.js +44 -0
- package/dist/chunks/index.153rcscj.js +2 -0
- package/dist/chunks/index.20dvswea.js +2 -0
- package/dist/chunks/index.23p1k2rx.js +2 -0
- package/dist/chunks/index.3k4gyba0.js +2 -0
- package/dist/chunks/index.51yk4ene.js +2 -0
- package/dist/chunks/index.9zhger75.js +142 -0
- package/dist/chunks/index.bfeafb22.js +1 -0
- package/dist/chunks/index.cf9nd6xy.js +2 -0
- package/dist/chunks/index.eec12m3n.js +16 -0
- package/dist/chunks/index.fab58nn0.js +2 -0
- package/dist/chunks/index.fgsp5qqn.js +303 -0
- package/dist/chunks/index.fv9af3wd.js +333 -0
- package/dist/chunks/index.fvh2m60c.js +2 -0
- package/dist/chunks/index.gqa9s37g.js +2 -0
- package/dist/chunks/index.h6120080.js +2 -0
- package/dist/chunks/index.q9dsw4bt.js +2 -0
- package/dist/chunks/index.vnhefjwh.js +2 -0
- package/dist/chunks/index.x163xe9c.js +89 -0
- package/dist/chunks/index.x1xqs5m5.js +214 -0
- package/dist/chunks/index.yf0h5qnv.js +2 -0
- package/dist/chunks/info-OHQRW6UA.xea9bh7d.js +1 -0
- package/dist/chunks/infoDiagram-EZ3ZOAHP.r2yygqw8.js +2 -0
- package/dist/chunks/ishikawaDiagram-S3EKX5GW.gwqtdvb2.js +70 -0
- package/dist/chunks/journeyDiagram-POQNLL5X.rp31qkq5.js +139 -0
- package/dist/chunks/kanban-definition-BH5XI6FM.ymsqx6en.js +89 -0
- package/dist/chunks/katex.n08hp8fc.js +257 -0
- package/dist/chunks/markup-color-chrome-ykGNUl8y.06cy435c.js +1 -0
- package/dist/chunks/markup-custom-color-C8Xc6JxB.an2wngns.js +1 -0
- package/dist/chunks/mention-list-Dhq70jL5.1k61f24q.js +1 -0
- package/dist/chunks/mermaid.core.x45crg0h.js +12 -0
- package/dist/chunks/mindmap-definition-WVAN44T4.5cbd4rg2.js +98 -0
- package/dist/chunks/packet-JDAUHWVQ.c7dmae11.js +1 -0
- package/dist/chunks/panel.rzp4q8s3.js +7 -0
- package/dist/chunks/pegDiagram-D4NLKWP3.fsryts4r.js +1 -0
- package/dist/chunks/pie-XZMESJXO.6rv4kzjx.js +1 -0
- package/dist/chunks/pieDiagram-36ENHN4W.k4k2gvg0.js +39 -0
- package/dist/chunks/plated-illustration-BzxADkoZ.wtc9psry.js +1 -0
- package/dist/chunks/quadrantDiagram-ZQUDMS73.j7nj12w0.js +7 -0
- package/dist/chunks/radar-ABXABTNO.58dfc8ba.js +1 -0
- package/dist/chunks/railroad-I3PHUGI6.00fqbahv.js +1 -0
- package/dist/chunks/railroad-abnf-LNEFI6M7.gt1x50q5.js +1 -0
- package/dist/chunks/railroad-ebnf-DWYD2UWJ.qr5qfkga.js +1 -0
- package/dist/chunks/railroad-peg-JR7BVNR7.m61rq7hj.js +1 -0
- package/dist/chunks/railroadDiagram-JIZHGYPL.a681wt3b.js +1 -0
- package/dist/chunks/render-VIF2ZAQL.rn9hpsbx.js +1 -0
- package/dist/chunks/requirementDiagram-AXW2TVFA.shapgy39.js +84 -0
- package/dist/chunks/sankeyDiagram-FBCJTAIF.2syz1e2b.js +40 -0
- package/dist/chunks/sequenceDiagram-3LA2ROMG.jq1w12a6.js +169 -0
- package/dist/chunks/sizeCapture-2Q2CQKSF.jtv53a6j.js +1 -0
- package/dist/chunks/stateDiagram-v2-ATKHQDJO.x0g2rngz.js +291 -0
- package/dist/chunks/swimlanes-YQL5WMAO.j7j7c6ex.js +1 -0
- package/dist/chunks/swimlanesDiagram-UCCPES4V.tzqcsrmd.js +8 -0
- package/dist/chunks/timeline-definition-7Z437IG3.s5bvn8dr.js +120 -0
- package/dist/chunks/treeView-D4JQ5SDB.0x1grm2t.js +1 -0
- package/dist/chunks/treemap-SAJKECNS.1te19jsm.js +1 -0
- package/dist/chunks/usecaseDiagram-RDK6N6HP.9k4r423e.js +370 -0
- package/dist/chunks/vennDiagram-SHRQU5PJ.82q5dzm6.js +34 -0
- package/dist/chunks/wardley-7MLQ67FV.zp6gykk3.js +1 -0
- package/dist/chunks/wardleyDiagram-F3OXNVQS.fm4tw2nc.js +78 -0
- package/dist/chunks/xychartDiagram-GDYJKCDI.57vqn2zd.js +7 -0
- package/dist/index.js +23 -4695
- package/docs/integration.md +146 -33
- package/package.json +7 -6
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import{e,ae,Qn,h,p,F,k,j,A,L,I,R,M,O,D,m,Y,K,g}from"./index.fgsp5qqn.js";var fe=(t,s)=>Qn(t,"a",-s),St=fe;function kt(t,s){let i=de(t),n=i.filter((c)=>he(c,t)),r=0,o=0,a=[];if(n.length>1){let c=Wt(n);for(let f=0;f<n.length;++f){let l=n[f];l.angle=Math.atan2(l.x-c.x,l.y-c.y)}n.sort((f,l)=>l.angle-f.angle);let d=n[n.length-1];for(let f=0;f<n.length;++f){let l=n[f];o+=(d.x+l.x)*(l.y-d.y);let S={x:(l.x+d.x)/2,y:(l.y+d.y)/2},y=null;for(let E=0;E<l.parentIndex.length;++E)if(d.parentIndex.includes(l.parentIndex[E])){let w=t[l.parentIndex[E]],N=Math.atan2(l.x-w.x,l.y-w.y),q=Math.atan2(d.x-w.x,d.y-w.y),V=q-N;if(V<0)V+=2*Math.PI;let P=q-V/2,b=ot(S,{x:w.x+w.radius*Math.sin(P),y:w.y+w.radius*Math.cos(P)});if(b>w.radius*2)b=w.radius*2;if(y==null||y.width>b)y={circle:w,width:b,p1:l,p2:d,large:b>w.radius,sweep:!0}}if(y!=null)a.push(y),r+=Et(y.circle.radius,y.width),d=l}}else{let c=t[0];for(let f=1;f<t.length;++f)if(t[f].radius<c.radius)c=t[f];let d=!1;for(let f=0;f<t.length;++f)if(ot(t[f],c)>Math.abs(c.radius-t[f].radius)){d=!0;break}if(d)r=o=0;else r=c.radius*c.radius*Math.PI,a.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-0.0000000001,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0})}if(o/=2,s)s.area=r+o,s.arcArea=r,s.polygonArea=o,s.arcs=a,s.innerPoints=n,s.intersectionPoints=i;return r+o}function he(t,s){return s.every((i)=>ot(t,i)<i.radius+0.0000000001)}function de(t){let s=[];for(let i=0;i<t.length;++i)for(let n=i+1;n<t.length;++n){let r=Gt(t[i],t[n]);for(let o of r)o.parentIndex=[i,n],s.push(o)}return s}function Et(t,s){return t*t*Math.acos(1-s/t)-(t-s)*Math.sqrt(s*(2*t-s))}function ot(t,s){return Math.sqrt((t.x-s.x)*(t.x-s.x)+(t.y-s.y)*(t.y-s.y))}function Rt(t,s,i){if(i>=t+s)return 0;if(i<=Math.abs(t-s))return Math.PI*Math.min(t,s)*Math.min(t,s);let n=t-(i*i-s*s+t*t)/(2*i),r=s-(i*i-t*t+s*s)/(2*i);return Et(t,n)+Et(s,r)}function Gt(t,s){let i=ot(t,s),n=t.radius,r=s.radius;if(i>=n+r||i<=Math.abs(n-r))return[];let o=(n*n-r*r+i*i)/(2*i),a=Math.sqrt(n*n-o*o),c=t.x+o*(s.x-t.x)/i,d=t.y+o*(s.y-t.y)/i,f=-(s.y-t.y)*(a/i),l=-(s.x-t.x)*(a/i);return[{x:c+f,y:d-l},{x:c-f,y:d+l}]}function Wt(t){let s={x:0,y:0};for(let i of t)s.x+=i.x,s.y+=i.y;return s.x/=t.length,s.y/=t.length,s}function ge(t,s,i,n){n=n||{};let r=n.maxIterations||100,o=n.tolerance||0.0000000001,a=t(s),c=t(i),d=i-s;if(a*c>0)throw"Initial bisect points must have opposite signs";if(a===0)return s;if(c===0)return i;for(let f=0;f<r;++f){d/=2;let l=s+d,S=t(l);if(S*a>=0)s=l;if(Math.abs(d)<o||S===0)return l}return s+d}function Tt(t){let s=Array(t);for(let i=0;i<t;++i)s[i]=0;return s}function qt(t,s){return Tt(t).map(()=>Tt(s))}function pt(t,s){let i=0;for(let n=0;n<t.length;++n)i+=t[n]*s[n];return i}function zt(t){return Math.sqrt(pt(t,t))}function At(t,s,i){for(let n=0;n<s.length;++n)t[n]=s[n]*i}function gt(t,s,i,n,r){for(let o=0;o<t.length;++o)t[o]=s*i[o]+n*r[o]}function Kt(t,s,i){i=i||{};let n=i.maxIterations||s.length*200,r=i.nonZeroDelta||1.05,o=i.zeroDelta||0.001,a=i.minErrorDelta||0.000001,c=i.minErrorDelta||0.00001,d=i.rho!==void 0?i.rho:1,f=i.chi!==void 0?i.chi:2,l=i.psi!==void 0?i.psi:-0.5,S=i.sigma!==void 0?i.sigma:0.5,y,E=s.length,w=Array(E+1);w[0]=s,w[0].fx=t(s),w[0].id=0;for(let T=0;T<E;++T){let u=s.slice();u[T]=u[T]?u[T]*r:o,w[T+1]=u,w[T+1].fx=t(u),w[T+1].id=T+1}function N(T){for(let u=0;u<T.length;u++)w[E][u]=T[u];w[E].fx=T.fx}let q=(T,u)=>T.fx-u.fx,V=s.slice(),P=s.slice(),b=s.slice(),_=s.slice();for(let T=0;T<n;++T){if(w.sort(q),i.history){let v=w.map((x)=>{let W=x.slice();return W.fx=x.fx,W.id=x.id,W});v.sort((x,W)=>x.id-W.id),i.history.push({x:w[0].slice(),fx:w[0].fx,simplex:v})}y=0;for(let v=0;v<E;++v)y=Math.max(y,Math.abs(w[0][v]-w[1][v]));if(Math.abs(w[0].fx-w[E].fx)<a&&y<c)break;for(let v=0;v<E;++v){V[v]=0;for(let x=0;x<E;++x)V[v]+=w[x][v];V[v]/=E}let u=w[E];if(gt(P,1+d,V,-d,u),P.fx=t(P),P.fx<w[0].fx)if(gt(_,1+f,V,-f,u),_.fx=t(_),_.fx<P.fx)N(_);else N(P);else if(P.fx>=w[E-1].fx){let v=!1;if(P.fx>u.fx)if(gt(b,1+l,V,-l,u),b.fx=t(b),b.fx<u.fx)N(b);else v=!0;else if(gt(b,1-l*d,V,l*d,u),b.fx=t(b),b.fx<P.fx)N(b);else v=!0;if(v){if(S>=1)break;for(let x=1;x<w.length;++x)gt(w[x],1-S,w[0],S,w[x]),w[x].fx=t(w[x])}}else N(P)}return w.sort(q),{fx:w[0].fx,x:w[0]}}function xe(t,s,i,n,r,o,a){let c=i.fx,d=pt(i.fxprime,s),f=c,l=c,S=d,y=0;r=r||1,o=o||0.000001,a=a||0.1;function E(w,N,q){for(let V=0;V<16;++V)if(r=(w+N)/2,gt(n.x,1,i.x,r,s),f=n.fx=t(n.x,n.fxprime),S=pt(n.fxprime,s),f>c+o*r*d||f>=q)N=r;else{if(Math.abs(S)<=-a*d)return r;if(S*(N-w)>=0)N=w;w=r,q=f}return 0}for(let w=0;w<10;++w){if(gt(n.x,1,i.x,r,s),f=n.fx=t(n.x,n.fxprime),S=pt(n.fxprime,s),f>c+o*r*d||w&&f>=l)return E(y,r,l);if(Math.abs(S)<=-a*d)return r;if(S>=0)return E(r,y,f);l=f,y=r,r*=2}return r}function ye(t,s,i){let n={x:s.slice(),fx:0,fxprime:s.slice()},r={x:s.slice(),fx:0,fxprime:s.slice()},o=s.slice(),a,c,d=1,f;i=i||{},f=i.maxIterations||s.length*20,n.fx=t(n.x,n.fxprime),a=n.fxprime.slice(),At(a,n.fxprime,-1);for(let l=0;l<f;++l){if(d=xe(t,a,n,r,d),i.history)i.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:d});if(!d)At(a,n.fxprime,-1);else{gt(o,1,r.fxprime,-1,n.fxprime);let S=pt(n.fxprime,n.fxprime),y=Math.max(0,pt(o,r.fxprime)/S);gt(a,y,a,-1,r.fxprime),c=n,n=r,r=c}if(zt(n.fxprime)<=0.00001)break}if(i.history)i.history.push({x:n.x.slice(),fx:n.fx,fxprime:n.fxprime.slice(),alpha:d});return n}function Ht(t,s={}){s.maxIterations=s.maxIterations||500;let i=s.initialLayout||ve,n=s.lossFunction||mt,r=pe(t,s),o=i(r,s),a=Object.keys(o),c=[];for(let l of a)c.push(o[l].x),c.push(o[l].y);let f=Kt((l)=>{let S={};for(let y=0;y<a.length;++y){let E=a[y];S[E]={x:l[2*y],y:l[2*y+1],radius:o[E].radius}}return n(S,r)},c,s).x;for(let l=0;l<a.length;++l){let S=a[l];o[S].x=f[2*l],o[S].y=f[2*l+1]}return o}var Yt=0.0000000001;function Ct(t,s,i){if(Math.min(t,s)*Math.min(t,s)*Math.PI<=i+Yt)return Math.abs(t-s);return ge((n)=>Rt(t,s,n)-i,0,t+s)}function pe(t,s={}){let i=s.distinct,n=t.map((c)=>Object.assign({},c));function r(c){return c.join(";")}if(i){let c=new Map;for(let d of n)for(let f=0;f<d.sets.length;f++){let l=String(d.sets[f]);c.set(l,d.size+(c.get(l)||0));for(let S=f+1;S<d.sets.length;S++){let y=String(d.sets[S]),E=`${l};${y}`,w=`${y};${l}`;c.set(E,d.size+(c.get(E)||0)),c.set(w,d.size+(c.get(w)||0))}}for(let d of n)if(d.sets.length<3)d.size=c.get(r(d.sets))}let o=[],a=new Set;for(let c of n)if(c.sets.length===1)o.push(c.sets[0]);else if(c.sets.length===2){let d=c.sets[0],f=c.sets[1];a.add(r(c.sets)),a.add(r([f,d]))}o.sort((c,d)=>c===d?0:c<d?-1:1);for(let c=0;c<o.length;++c){let d=o[c];for(let f=c+1;f<o.length;++f){let l=o[f];if(!a.has(r([d,l])))n.push({sets:[d,l],size:0})}}return n}function me(t,s,i){let n=qt(s.length,s.length),r=qt(s.length,s.length);return t.filter((o)=>o.sets.length===2).forEach((o)=>{let a=i[o.sets[0]],c=i[o.sets[1]],d=Math.sqrt(s[a].size/Math.PI),f=Math.sqrt(s[c].size/Math.PI),l=Ct(d,f,o.size);n[a][c]=n[c][a]=l;let S=0;if(o.size+0.0000000001>=Math.min(s[a].size,s[c].size))S=1;else if(o.size<=0.0000000001)S=-1;r[a][c]=r[c][a]=S}),{distances:n,constraints:r}}function be(t,s,i,n){for(let o=0;o<s.length;++o)s[o]=0;let r=0;for(let o=0;o<i.length;++o){let a=t[2*o],c=t[2*o+1];for(let d=o+1;d<i.length;++d){let f=t[2*d],l=t[2*d+1],S=i[o][d],y=n[o][d],E=(f-a)*(f-a)+(l-c)*(l-c),w=Math.sqrt(E),N=E-S*S;if(y>0&&w<=S||y<0&&w>=S)continue;r+=2*N*N,s[2*o]+=4*N*(a-f),s[2*o+1]+=4*N*(c-l),s[2*d]+=4*N*(f-a),s[2*d+1]+=4*N*(l-c)}}return r}function ve(t,s={}){let i=Ie(t,s),n=s.lossFunction||mt;if(t.length>=8){let r=ke(t,s),o=n(r,t),a=n(i,t);if(o+0.00000001<a)i=r}return i}function ke(t,s={}){let i=s.restarts||10,n=[],r={};for(let y of t)if(y.sets.length===1)r[y.sets[0]]=n.length,n.push(y);let{distances:o,constraints:a}=me(t,n,r),c=zt(o.map(zt))/o.length;o=o.map((y)=>y.map((E)=>E/c));let d=(y,E)=>be(y,E,o,a),f=null;for(let y=0;y<i;++y){let E=Tt(o.length*2).map(Math.random),w=ye(d,E,s);if(!f||w.fx<f.fx)f=w}let l=f.x,S={};for(let y=0;y<n.length;++y){let E=n[y];S[E.sets[0]]={x:l[2*y]*c,y:l[2*y+1]*c,radius:Math.sqrt(E.size/Math.PI)}}if(s.history)for(let y of s.history)At(y.x,c);return S}function Ie(t,s){let i=s&&s.lossFunction?s.lossFunction:mt,n={},r={};for(let S of t)if(S.sets.length===1){let y=S.sets[0];n[y]={x:10000000000,y:10000000000,rowid:n.length,size:S.size,radius:Math.sqrt(S.size/Math.PI)},r[y]=[]}t=t.filter((S)=>S.sets.length===2);for(let S of t){let y=S.weight!=null?S.weight:1,E=S.sets[0],w=S.sets[1];if(S.size+Yt>=Math.min(n[E].size,n[w].size))y=0;r[E].push({set:w,size:S.size,weight:y}),r[w].push({set:E,size:S.size,weight:y})}let o=[];Object.keys(r).forEach((S)=>{let y=0;for(let E=0;E<r[S].length;++E)y+=r[S][E].size*r[S][E].weight;o.push({set:S,size:y})});function a(S,y){return y.size-S.size}o.sort(a);let c={};function d(S){return S.set in c}function f(S,y){n[y].x=S.x,n[y].y=S.y,c[y]=!0}f({x:0,y:0},o[0].set);for(let S=1;S<o.length;++S){let y=o[S].set,E=r[y].filter(d),w=n[y];if(E.sort(a),E.length===0)throw"ERROR: missing pairwise overlap information";let N=[];for(var l=0;l<E.length;++l){let P=n[E[l].set],b=Ct(w.radius,P.radius,E[l].size);N.push({x:P.x+b,y:P.y}),N.push({x:P.x-b,y:P.y}),N.push({y:P.y+b,x:P.x}),N.push({y:P.y-b,x:P.x});for(let _=l+1;_<E.length;++_){let T=n[E[_].set],u=Ct(w.radius,T.radius,E[_].size),v=Gt({x:P.x,y:P.y,radius:b},{x:T.x,y:T.y,radius:u});N.push(...v)}}let q=100000000000000000000000000000000000000000000000000,V=N[0];for(let P of N){n[y].x=P.x,n[y].y=P.y;let b=i(n,t);if(b<q)q=b,V=P}f(V,y)}return n}function mt(t,s){let i=0;for(let n of s){if(n.sets.length===1)continue;let r;if(n.sets.length===2){let a=t[n.sets[0]],c=t[n.sets[1]];r=Rt(a.radius,c.radius,ot(a,c))}else r=kt(n.sets.map((a)=>t[a]));let o=n.weight!=null?n.weight:1;i+=o*(r-n.size)*(r-n.size)}return i}function Xt(t,s){let i=0;for(let n of s){if(n.sets.length===1)continue;let r;if(n.sets.length===2){let c=t[n.sets[0]],d=t[n.sets[1]];r=Rt(c.radius,d.radius,ot(c,d))}else r=kt(n.sets.map((c)=>t[c]));let o=n.weight!=null?n.weight:1,a=Math.log((r+1)/(n.size+1));i+=o*a*a}return i}function Me(t,s,i){if(i==null)t.sort((r,o)=>o.radius-r.radius);else t.sort(i);if(t.length>0){let r=t[0].x,o=t[0].y;for(let a of t)a.x-=r,a.y-=o}if(t.length===2){if(ot(t[0],t[1])<Math.abs(t[1].radius-t[0].radius))t[1].x=t[0].x+t[0].radius-t[1].radius-0.0000000001,t[1].y=t[0].y}if(t.length>1){let r=Math.atan2(t[1].x,t[1].y)-s,o=Math.cos(r),a=Math.sin(r);for(let c of t){let{x:d,y:f}=c;c.x=o*d-a*f,c.y=a*d+o*f}}if(t.length>2){let r=Math.atan2(t[2].x,t[2].y)-s;while(r<0)r+=2*Math.PI;while(r>2*Math.PI)r-=2*Math.PI;if(r>Math.PI){let o=t[1].y/(0.0000000001+t[1].x);for(let a of t){var n=(a.x+o*a.y)/(1+o*o);a.x=2*n-a.x,a.y=2*n*o-a.y}}}}function Se(t){t.forEach((r)=>{r.parent=r});function s(r){if(r.parent!==r)r.parent=s(r.parent);return r.parent}function i(r,o){let a=s(r),c=s(o);a.parent=c}for(let r=0;r<t.length;++r)for(let o=r+1;o<t.length;++o){let a=t[r].radius+t[o].radius;if(ot(t[r],t[o])+0.0000000001<a)i(t[o],t[r])}let n=new Map;for(let r=0;r<t.length;++r){let o=s(t[r]).parent.setid;if(!n.has(o))n.set(o,[]);n.get(o).push(t[r])}return t.forEach((r)=>{delete r.parent}),Array.from(n.values())}function Dt(t){let s=(i)=>{let n=t.reduce((o,a)=>Math.max(o,a[i]+a.radius),Number.NEGATIVE_INFINITY),r=t.reduce((o,a)=>Math.min(o,a[i]-a.radius),Number.POSITIVE_INFINITY);return{max:n,min:r}};return{xRange:s("x"),yRange:s("y")}}function Zt(t,s,i){if(s==null)s=Math.PI/2;let n=$t(t).map((f)=>Object.assign({},f)),r=Se(n);for(let f of r){Me(f,s,i);let l=Dt(f);f.size=(l.xRange.max-l.xRange.min)*(l.yRange.max-l.yRange.min),f.bounds=l}r.sort((f,l)=>l.size-f.size),n=r[0];let o=n.bounds,a=(o.xRange.max-o.xRange.min)/50;function c(f,l,S){if(!f)return;let y=f.bounds,E,w;if(l)E=o.xRange.max-y.xRange.min+a;else{E=o.xRange.max-y.xRange.max;let N=(y.xRange.max-y.xRange.min)/2-(o.xRange.max-o.xRange.min)/2;if(N<0)E+=N}if(S)w=o.yRange.max-y.yRange.min+a;else{w=o.yRange.max-y.yRange.max;let N=(y.yRange.max-y.yRange.min)/2-(o.yRange.max-o.yRange.min)/2;if(N<0)w+=N}for(let N of f)N.x+=E,N.y+=w,n.push(N)}let d=1;while(d<r.length)c(r[d],!0,!1),c(r[d+1],!1,!0),c(r[d+2],!0,!0),d+=3,o=Dt(n);return Qt(n)}function Jt(t,s,i,n,r){let o=$t(t);s-=2*n,i-=2*n;let{xRange:a,yRange:c}=Dt(o);if(a.max===a.min||c.max===c.min)return console.log("not scaling solution: zero size detected"),t;let d,f;if(r){let E=Math.sqrt(r/Math.PI)*2;d=s/E,f=i/E}else d=s/(a.max-a.min),f=i/(c.max-c.min);let l=Math.min(f,d),S=(s-(a.max-a.min)*l)/2,y=(i-(c.max-c.min)*l)/2;return Qt(o.map((E)=>({radius:l*E.radius,x:n+S+(E.x-a.min)*l,y:n+y+(E.y-c.min)*l,setid:E.setid})))}function Qt(t){let s={};for(let i of t)s[i.setid]=i;return s}function $t(t){return Object.keys(t).map((i)=>Object.assign(t[i],{setid:i}))}function te(t={}){let s=!1,i=600,n=350,r=15,o=1000,a=Math.PI/2,c=!0,d=null,f=!0,l=!0,S=null,y=null,E=!1,w=null,N=t&&t.symmetricalTextCentre?t.symmetricalTextCentre:!1,q={},V=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],P=0,b=function(v){if(v in q)return q[v];var x=q[v]=V[P];if(P+=1,P>=V.length)P=0;return x},_=Ht,T=mt;function u(v){let x=v.datum(),W=new Set;x.forEach((z)=>{if(z.size==0&&z.sets.length==1)W.add(z.sets[0])}),x=x.filter((z)=>!z.sets.some((J)=>W.has(J)));let C={},H={};if(x.length>0){let z=_(x,{lossFunction:T,distinct:E});if(c)z=Zt(z,a,y);C=Jt(z,i,n,r,d),H=ne(C,x,N)}let at={};x.forEach((z)=>{if(z.label)at[z.sets]=z.label});function nt(z){if(z.sets in at)return at[z.sets];if(z.sets.length==1)return""+z.sets[0]}v.selectAll("svg").data([C]).enter().append("svg");let Z=v.select("svg");if(s)Z.attr("viewBox",`0 0 ${i} ${n}`);else Z.attr("width",i).attr("height",n);let G={},X=!1;Z.selectAll(".venn-area path").each(function(z){let J=this.getAttribute("d");if(z.sets.length==1&&J&&!E)X=!0,G[z.sets[0]]=Ee(J)});function B(z){return(J)=>{let yt=z.sets.map((dt)=>{let ht=G[dt],rt=C[dt];if(!ht)ht={x:i/2,y:n/2,radius:1};if(!rt)rt={x:i/2,y:n/2,radius:1};return{x:ht.x*(1-J)+rt.x*J,y:ht.y*(1-J)+rt.y*J,radius:ht.radius*(1-J)+rt.radius*J}});return Ut(yt,w)}}let Q=Z.selectAll(".venn-area").data(x,(z)=>z.sets),st=Q.enter().append("g").attr("class",(z)=>`venn-area venn-${z.sets.length==1?"circle":"intersection"}${z.colour||z.color?" venn-coloured":""}`).attr("data-venn-sets",(z)=>z.sets.join("_")),tt=st.append("path"),lt=st.append("text").attr("class","label").text((z)=>nt(z)).attr("text-anchor","middle").attr("dy",".35em").attr("x",i/2).attr("y",n/2);if(l)tt.style("fill-opacity","0").filter((z)=>z.sets.length==1).style("fill",(z)=>z.colour?z.colour:z.color?z.color:b(z.sets)).style("fill-opacity",".25"),lt.style("fill",(z)=>{if(z.colour||z.color)return"#FFF";if(t.textFill)return t.textFill;return z.sets.length==1?b(z.sets):"#444"});function it(z){if(typeof z.transition==="function")return z.transition("venn").duration(o);return z}let et=v;if(X&&typeof et.transition==="function")et=it(v),et.selectAll("path").attrTween("d",B);else et.selectAll("path").attr("d",(z)=>Ut(z.sets.map((J)=>C[J])),w);let U=et.selectAll("text").filter((z)=>(z.sets in H)).text((z)=>nt(z)).attr("x",(z)=>Math.floor(H[z.sets].x)).attr("y",(z)=>Math.floor(H[z.sets].y));if(f)if(X)if("on"in U)U.on("end",wt(C,nt));else U.each("end",wt(C,nt));else U.each(wt(C,nt));let ft=it(Q.exit()).remove();if(typeof Q.transition==="function")ft.selectAll("path").attrTween("d",B);let ut=ft.selectAll("text").attr("x",i/2).attr("y",n/2);if(S!==null)lt.style("font-size","0px"),U.style("font-size",S),ut.style("font-size","0px");return{circles:C,textCentres:H,nodes:Q,enter:st,update:et,exit:ft}}return u.wrap=function(v){if(!arguments.length)return f;return f=v,u},u.useViewBox=function(){return s=!0,u},u.width=function(v){if(!arguments.length)return i;return i=v,u},u.height=function(v){if(!arguments.length)return n;return n=v,u},u.padding=function(v){if(!arguments.length)return r;return r=v,u},u.distinct=function(v){if(!arguments.length)return E;return E=v,u},u.colours=function(v){if(!arguments.length)return b;return b=v,u},u.colors=function(v){if(!arguments.length)return b;return b=v,u},u.fontSize=function(v){if(!arguments.length)return S;return S=v,u},u.round=function(v){if(!arguments.length)return w;return w=v,u},u.duration=function(v){if(!arguments.length)return o;return o=v,u},u.layoutFunction=function(v){if(!arguments.length)return _;return _=v,u},u.normalize=function(v){if(!arguments.length)return c;return c=v,u},u.scaleToFit=function(v){if(!arguments.length)return d;return d=v,u},u.styled=function(v){if(!arguments.length)return l;return l=v,u},u.orientation=function(v){if(!arguments.length)return a;return a=v,u},u.orientationOrder=function(v){if(!arguments.length)return y;return y=v,u},u.lossFunction=function(v){if(!arguments.length)return T;return T=v==="default"?mt:v==="logRatio"?Xt:v,u},u}function wt(t,s){return function(i){let n=this,r=t[i.sets[0]].radius||50,o=s(i)||"",a=o.split(/\s+/).reverse(),c=3,d=(o.length+a.length)/3,f=a.pop(),l=[f],S=0,y=1.1;n.textContent=null;let E=[];function w(b){let _=n.ownerDocument.createElementNS(n.namespaceURI,"tspan");return _.textContent=b,E.push(_),n.append(_),_}let N=w(f);while(!0){if(f=a.pop(),!f)break;l.push(f);let b=l.join(" ");if(N.textContent=b,b.length>d&&N.getComputedTextLength()>r)l.pop(),N.textContent=l.join(" "),l=[f],N=w(f),S++}let q=0.35-S*y/2,V=n.getAttribute("x"),P=n.getAttribute("y");E.forEach((b,_)=>{b.setAttribute("x",V),b.setAttribute("y",P),b.setAttribute("dy",`${q+_*y}em`)})}}function _t(t,s,i){let n=s[0].radius-ot(s[0],t);for(let r=1;r<s.length;++r){let o=s[r].radius-ot(s[r],t);if(o<=n)n=o}for(let r=0;r<i.length;++r){let o=ot(i[r],t)-i[r].radius;if(o<=n)n=o}return n}function ee(t,s,i){let n=[];for(let l of t)n.push({x:l.x,y:l.y}),n.push({x:l.x+l.radius/2,y:l.y}),n.push({x:l.x-l.radius/2,y:l.y}),n.push({x:l.x,y:l.y+l.radius/2}),n.push({x:l.x,y:l.y-l.radius/2});let r=n[0],o=_t(n[0],t,s);for(let l=1;l<n.length;++l){let S=_t(n[l],t,s);if(S>=o)r=n[l],o=S}let a=Kt((l)=>-1*_t({x:l[0],y:l[1]},t,s),[r.x,r.y],{maxIterations:500,minErrorDelta:0.0000000001}).x,c={x:i?0:a[0],y:a[1]},d=!0;for(let l of t)if(ot(c,l)>l.radius){d=!1;break}for(let l of s)if(ot(c,l)<l.radius){d=!1;break}if(d)return c;if(t.length==1)return{x:t[0].x,y:t[0].y};let f={};if(kt(t,f),f.arcs.length===0)return{x:0,y:-1000,disjoint:!0};if(f.arcs.length==1)return{x:f.arcs[0].circle.x,y:f.arcs[0].circle.y};if(s.length)return ee(t,[]);return Wt(f.arcs.map((l)=>l.p1))}function we(t){let s={},i=Object.keys(t);for(let n of i)s[n]=[];for(let n=0;n<i.length;n++){let r=i[n],o=t[r];for(let a=n+1;a<i.length;++a){let c=i[a],d=t[c],f=ot(o,d);if(f+d.radius<=o.radius+0.0000000001)s[c].push(r);else if(f+o.radius<=d.radius+0.0000000001)s[r].push(c)}}return s}function ne(t,s,i){let n={},r=we(t);for(let o=0;o<s.length;++o){let a=s[o].sets,c={},d={};for(let y=0;y<a.length;++y){c[a[y]]=!0;let E=r[a[y]];for(let w=0;w<E.length;++w)d[E[w]]=!0}let f=[],l=[];for(let y in t)if(y in c)f.push(t[y]);else if(!(y in d))l.push(t[y]);let S=ee(f,l,i);if(n[a]=S,S.disjoint&&s[o].size>0)console.log("WARNING: area "+a+" not represented on screen")}return n}function _e(t,s,i){let n=[];return n.push(`
|
|
2
|
+
M`,t,s),n.push(`
|
|
3
|
+
m`,-i,0),n.push(`
|
|
4
|
+
a`,i,i,0,1,0,i*2,0),n.push(`
|
|
5
|
+
a`,i,i,0,1,0,-i*2,0),n.join(" ")}function Ee(t){let s=t.split(" ");return{x:Number.parseFloat(s[1]),y:Number.parseFloat(s[2]),radius:-Number.parseFloat(s[4])}}function se(t){if(t.length===0)return[];let s={};return kt(t,s),s.arcs}function ie(t,s){if(t.length===0)return"M 0 0";let i=Math.pow(10,s||0),n=s!=null?(o)=>Math.round(o*i)/i:(o)=>o;if(t.length==1){let o=t[0].circle;return _e(n(o.x),n(o.y),n(o.radius))}let r=[`
|
|
6
|
+
M`,n(t[0].p2.x),n(t[0].p2.y)];for(let o of t){let a=n(o.circle.radius);r.push(`
|
|
7
|
+
A`,a,a,0,o.large?1:0,o.sweep?1:0,n(o.p1.x),n(o.p1.y))}return r.join(" ")}function Ut(t,s){return ie(se(t),s)}function re(t,s={}){let{lossFunction:i,layoutFunction:n=Ht,normalize:r=!0,orientation:o=Math.PI/2,orientationOrder:a,width:c=600,height:d=350,padding:f=15,scaleToFit:l=!1,symmetricalTextCentre:S=!1,distinct:y,round:E=2}=s,w=n(t,{lossFunction:i==="default"||!i?mt:i==="logRatio"?Xt:i,distinct:y});if(r)w=Zt(w,o,a);let N=Jt(w,c,d,f,l),q=ne(N,t,S),V=new Map(Object.keys(N).map((_)=>[_,{set:_,x:N[_].x,y:N[_].y,radius:N[_].radius}])),P=t.map((_)=>{let T=_.sets.map((x)=>V.get(x)),u=se(T),v=ie(u,E);return{circles:T,arcs:u,path:v,area:_,has:new Set(_.sets)}});function b(_){let T="";for(let u of P)if(u.has.size>_.length&&_.every((v)=>u.has.has(v)))T+=" "+u.path;return T}return P.map(({circles:_,arcs:T,path:u,area:v})=>({data:v,text:q[v.sets],circles:_,arcs:T,path:u,distinctPath:u+b(v.sets)}))}var Nt=function(){var t=e(function(P,b,_,T){for(_=_||{},T=P.length;T--;_[P[T]]=b);return _},"o"),s=[5,8],i=[7,8,11,12,17,19,22,24],n=[1,17],r=[1,18],o=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],c=[1,39],d=[7,8,11,12,17,19,22,24,27],f=[1,57],l=[1,56],S=[1,58],y=[1,59],E=[1,60],w=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],N={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(b,_,T,u,v,x,W){var C=x.length-1;switch(v){case 1:return x[C-1];case 2:case 3:case 4:this.$=[];break;case 5:x[C-1].push(x[C]),this.$=x[C-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=x[C];break;case 8:u.setDiagramTitle(x[C].substr(6)),this.$=x[C].substr(6);break;case 9:if(u.addSubsetData([x[C]],void 0,void 0),u.setIndentMode)u.setIndentMode(!0);break;case 10:if(u.addSubsetData([x[C-1]],x[C],void 0),u.setIndentMode)u.setIndentMode(!0);break;case 11:if(u.addSubsetData([x[C-2]],void 0,parseFloat(x[C])),u.setIndentMode)u.setIndentMode(!0);break;case 12:if(u.addSubsetData([x[C-3]],x[C-2],parseFloat(x[C])),u.setIndentMode)u.setIndentMode(!0);break;case 13:if(x[C].length<2)throw Error("union requires multiple identifiers");if(u.validateUnionIdentifiers)u.validateUnionIdentifiers(x[C]);if(u.addSubsetData(x[C],void 0,void 0),u.setIndentMode)u.setIndentMode(!0);break;case 14:if(x[C-1].length<2)throw Error("union requires multiple identifiers");if(u.validateUnionIdentifiers)u.validateUnionIdentifiers(x[C-1]);if(u.addSubsetData(x[C-1],x[C],void 0),u.setIndentMode)u.setIndentMode(!0);break;case 15:if(x[C-2].length<2)throw Error("union requires multiple identifiers");if(u.validateUnionIdentifiers)u.validateUnionIdentifiers(x[C-2]);if(u.addSubsetData(x[C-2],void 0,parseFloat(x[C])),u.setIndentMode)u.setIndentMode(!0);break;case 16:if(x[C-3].length<2)throw Error("union requires multiple identifiers");if(u.validateUnionIdentifiers)u.validateUnionIdentifiers(x[C-3]);if(u.addSubsetData(x[C-3],x[C-2],parseFloat(x[C])),u.setIndentMode)u.setIndentMode(!0);break;case 17:case 18:case 19:u.addTextData(x[C-1],x[C],void 0);break;case 20:case 21:u.addTextData(x[C-2],x[C-1],x[C]);break;case 23:u.addStyleData(x[C-1],x[C]);break;case 24:case 25:case 26:var H=u.getCurrentSets();if(!H)throw Error("text requires set");u.addTextData(H,x[C],void 0);break;case 27:case 28:var H=u.getCurrentSets();if(!H)throw Error("text requires set");u.addTextData(H,x[C-1],x[C]);break;case 29:case 41:this.$=[x[C]];break;case 30:case 42:this.$=[...x[C-2],x[C]];break;case 31:this.$=[x[C-2],x[C]];break;case 33:this.$=x[C].join(" ");break;case 34:this.$=[x[C]];break;case 35:x[C-1].push(x[C]),this.$=x[C-1];break;case 43:case 44:this.$=x[C];break}},"anonymous"),table:[t(s,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(i,[2,4],{6:5}),t(s,[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(i,[2,5]),t(i,[2,6]),t(i,[2,7]),t(i,[2,8]),{13:16,20:n,21:r},{13:20,18:19,20:n,21:r},{13:20,18:21,20:n,21:r},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:n,21:r},t(i,[2,9],{14:[1,27],15:[1,28]}),t(o,[2,43]),t(o,[2,44]),t(i,[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(i,[2,22]),t(i,[2,24],{14:[1,35]}),t(i,[2,25],{14:[1,36]}),t(i,[2,26]),{20:c,25:37,26:38,27:a},t(i,[2,10],{15:[1,40]}),{16:[1,41]},t(i,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:n,21:r},t(i,[2,17],{14:[1,45]}),t(i,[2,18],{14:[1,46]}),t(i,[2,19]),t(i,[2,27]),t(i,[2,28]),t(i,[2,23],{27:[1,47]}),t(d,[2,29]),{15:[1,48]},{16:[1,49]},t(i,[2,11]),{16:[1,50]},t(i,[2,15]),t(o,[2,42]),t(i,[2,20]),t(i,[2,21]),{20:c,26:51},{16:f,20:l,21:[1,53],28:52,29:54,30:55,31:S,32:y,33:E},t(i,[2,12]),t(i,[2,16]),t(d,[2,30]),t(d,[2,31]),t(d,[2,32]),t(d,[2,33],{30:61,16:f,20:l,31:S,32:y,33:E}),t(w,[2,34]),t(w,[2,36]),t(w,[2,37]),t(w,[2,38]),t(w,[2,39]),t(w,[2,40]),t(w,[2,35])],defaultActions:{6:[2,1]},parseError:e(function(b,_){if(_.recoverable)this.trace(b);else{var T=Error(b);throw T.hash=_,T}},"parseError"),parse:e(function(b){var _=this,T=[0],u=[],v=[null],x=[],W=this.table,C="",H=0,at=0,nt=0,Z=2,G=1,X=x.slice.call(arguments,1),B=Object.create(this.lexer),Q={yy:{}};for(var st in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,st))Q.yy[st]=this.yy[st];if(B.setInput(b,Q.yy),Q.yy.lexer=B,Q.yy.parser=this,typeof B.yylloc>"u")B.yylloc={};var tt=B.yylloc;x.push(tt);var lt=B.options&&B.options.ranges;if(typeof Q.yy.parseError==="function")this.parseError=Q.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function it(ct){T.length=T.length-2*ct,v.length=v.length-ct,x.length=x.length-ct}e(it,"popStack");function et(){var ct=u.pop()||B.lex()||G;if(typeof ct!=="number"){if(ct instanceof Array)u=ct,ct=u.pop();ct=_.symbols_[ct]||ct}return ct}e(et,"lex");var U,ft,ut,z,J,yt,dt={},ht,rt,Bt,vt;while(!0){if(ut=T[T.length-1],this.defaultActions[ut])z=this.defaultActions[ut];else{if(U===null||typeof U>"u")U=et();z=W[ut]&&W[ut][U]}if(typeof z>"u"||!z.length||!z[0]){var Mt="";vt=[];for(ht in W[ut])if(this.terminals_[ht]&&ht>Z)vt.push("'"+this.terminals_[ht]+"'");if(B.showPosition)Mt="Parse error on line "+(H+1)+`:
|
|
8
|
+
`+B.showPosition()+`
|
|
9
|
+
Expecting `+vt.join(", ")+", got '"+(this.terminals_[U]||U)+"'";else Mt="Parse error on line "+(H+1)+": Unexpected "+(U==G?"end of input":"'"+(this.terminals_[U]||U)+"'");this.parseError(Mt,{text:B.match,token:this.terminals_[U]||U,line:B.yylineno,loc:tt,expected:vt})}if(z[0]instanceof Array&&z.length>1)throw Error("Parse Error: multiple actions possible at state: "+ut+", token: "+U);switch(z[0]){case 1:if(T.push(U),v.push(B.yytext),x.push(B.yylloc),T.push(z[1]),U=null,!ft){if(at=B.yyleng,C=B.yytext,H=B.yylineno,tt=B.yylloc,nt>0)nt--}else U=ft,ft=null;break;case 2:if(rt=this.productions_[z[1]][1],dt.$=v[v.length-rt],dt._$={first_line:x[x.length-(rt||1)].first_line,last_line:x[x.length-1].last_line,first_column:x[x.length-(rt||1)].first_column,last_column:x[x.length-1].last_column},lt)dt._$.range=[x[x.length-(rt||1)].range[0],x[x.length-1].range[1]];if(yt=this.performAction.apply(dt,[C,at,H,Q.yy,z[1],v,x].concat(X)),typeof yt<"u")return yt;if(rt)T=T.slice(0,-1*rt*2),v=v.slice(0,-1*rt),x=x.slice(0,-1*rt);T.push(this.productions_[z[1]][0]),v.push(dt.$),x.push(dt._$),Bt=W[T[T.length-2]][T[T.length-1]],T.push(Bt);break;case 3:return!0}}return!0},"parse")},q=function(){var P={EOF:1,parseError:e(function(_,T){if(this.yy.parser)this.yy.parser.parseError(_,T);else throw Error(_)},"parseError"),setInput:e(function(b,_){if(this.yy=_||this.yy||{},this._input=b,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];return this.offset=0,this},"setInput"),input:e(function(){var b=this._input[0];this.yytext+=b,this.yyleng++,this.offset++,this.match+=b,this.matched+=b;var _=b.match(/(?:\r\n?|\n).*/g);if(_)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),b},"input"),unput:e(function(b){var _=b.length,T=b.split(/(?:\r\n?|\n)/g);this._input=b+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-_),this.offset-=_;var u=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),T.length-1)this.yylineno-=T.length-1;var v=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:T?(T.length===u.length?this.yylloc.first_column:0)+u[u.length-T.length].length-T[0].length:this.yylloc.first_column-_},this.options.ranges)this.yylloc.range=[v[0],v[0]+this.yyleng-_];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
10
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(b){this.unput(this.match.slice(b))},"less"),pastInput:e(function(){var b=this.matched.substr(0,this.matched.length-this.match.length);return(b.length>20?"...":"")+b.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var b=this.match;if(b.length<20)b+=this._input.substr(0,20-b.length);return(b.substr(0,20)+(b.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var b=this.pastInput(),_=Array(b.length+1).join("-");return b+this.upcomingInput()+`
|
|
11
|
+
`+_+"^"},"showPosition"),test_match:e(function(b,_){var T,u,v;if(this.options.backtrack_lexer){if(v={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)v.yylloc.range=this.yylloc.range.slice(0)}if(u=b[0].match(/(?:\r\n?|\n).*/g),u)this.yylineno+=u.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:u?u[u.length-1].length-u[u.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+b[0].length},this.yytext+=b[0],this.match+=b[0],this.matches=b,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(b[0].length),this.matched+=b[0],T=this.performAction.call(this,this.yy,this,_,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(T)return T;else if(this._backtrack){for(var x in v)this[x]=v[x];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var b,_,T,u;if(!this._more)this.yytext="",this.match="";var v=this._currentRules();for(var x=0;x<v.length;x++)if(T=this._input.match(this.rules[v[x]]),T&&(!_||T[0].length>_[0].length)){if(_=T,u=x,this.options.backtrack_lexer)if(b=this.test_match(T,v[x]),b!==!1)return b;else if(this._backtrack){_=!1;continue}else return!1;else if(!this.options.flex)break}if(_){if(b=this.test_match(_,v[u]),b!==!1)return b;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
12
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var _=this.next();if(_)return _;else return this.lex()},"lex"),begin:e(function(_){this.conditionStack.push(_)},"begin"),popState:e(function(){var _=this.conditionStack.length-1;if(_>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(_){if(_=this.conditionStack.length-1-Math.abs(_||0),_>=0)return this.conditionStack[_];else return"INITIAL"},"topState"),pushState:e(function(_){this.begin(_)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(_,T,u,v){var x=v;switch(u){case 0:break;case 1:break;case 2:break;case 3:if(_.getIndentMode&&_.getIndentMode())return _.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:if(_.setIndentMode)_.setIndentMode(!1);this.begin("INITIAL"),this.unput(T.yytext);break;case 6:return this.begin("bol"),8;break;case 7:break;case 8:break;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(_.consumeIndentText)_.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return T.yytext=T.yytext.slice(2,-2),14;break;case 17:return T.yytext=T.yytext.slice(1,-1).trim(),14;break;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}}};return P}();N.lexer=q;function V(){this.yy={}}return e(V,"Parser"),V.prototype=N,N.Parser=V,new V}();Nt.parser=Nt;var ze=Nt,Ot=[],Lt=[],jt=[],Ft=new Set,Pt,Vt=!1,Ae=e((t,s,i)=>{let n=It(t).sort(),r=i??10/Math.pow(t.length,2);if(Pt=n,n.length===1)Ft.add(n[0]);Ot.push({sets:n,size:r,label:s?bt(s):void 0})},"addSubsetData"),Ce=e(()=>Ot,"getSubsetData"),bt=e((t)=>{let s=t.trim();if(s.length>=2&&s.startsWith('"')&&s.endsWith('"'))return s.slice(1,-1);return s},"normalizeText"),De=e((t)=>t?bt(t):t,"normalizeStyleValue"),Re=e((t,s,i)=>{let n=bt(s);Lt.push({sets:It(t).sort(),id:n,label:i?bt(i):void 0})},"addTextData"),Ne=e((t,s)=>{let i=It(t).sort(),n={};for(let[r,o]of s)n[r]=De(o)??o;jt.push({targets:i,styles:n})},"addStyleData"),Oe=e(()=>jt,"getStyleData"),It=e((t)=>t.map((s)=>bt(s)),"normalizeIdentifierList"),Le=e((t)=>{let i=It(t).filter((n)=>!Ft.has(n));if(i.length>0)throw Error(`unknown set identifier: ${i.join(", ")}`)},"validateUnionIdentifiers"),je=e(()=>Lt,"getTextData"),Fe=e(()=>Pt,"getCurrentSets"),Pe=e(()=>Vt,"getIndentMode"),Ve=e((t)=>{Vt=t},"setIndentMode"),Be=F.venn;function oe(){return K(Be,k().venn)}e(oe,"getConfig");var qe=e(()=>{A(),Ot.length=0,Lt.length=0,jt.length=0,Ft.clear(),Pt=void 0,Vt=!1},"customClear"),Ue={getConfig:oe,clear:qe,setAccTitle:L,getAccTitle:I,setDiagramTitle:O,getDiagramTitle:D,getAccDescription:M,setAccDescription:R,addSubsetData:Ae,getSubsetData:Ce,addTextData:Re,addStyleData:Ne,validateUnionIdentifiers:Le,getTextData:je,getStyleData:Oe,getCurrentSets:Fe,getIndentMode:Pe,setIndentMode:Ve},Ge=e((t)=>`
|
|
13
|
+
.venn-title {
|
|
14
|
+
font-size: 32px;
|
|
15
|
+
fill: ${t.vennTitleTextColor};
|
|
16
|
+
font-family: ${t.fontFamily};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.venn-circle text {
|
|
20
|
+
font-size: 48px;
|
|
21
|
+
font-family: ${t.fontFamily};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.venn-intersection text {
|
|
25
|
+
font-size: 48px;
|
|
26
|
+
fill: ${t.vennSetTextColor};
|
|
27
|
+
font-family: ${t.fontFamily};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.venn-text-node {
|
|
31
|
+
font-family: ${t.fontFamily};
|
|
32
|
+
color: ${t.vennSetTextColor};
|
|
33
|
+
}
|
|
34
|
+
`,"getStyles"),We=Ge;function le(t){let s=new Map;for(let i of t){let n=i.targets.join("|"),r=s.get(n);if(r)Object.assign(r,i.styles);else s.set(n,{...i.styles})}return s}e(le,"buildStyleByKey");var Ke=e((t,s,i,n)=>{let r=n.db,o=r.getConfig?.(),{themeVariables:a,look:c,handDrawnSeed:d}=k(),f=c==="handDrawn",l=[a.venn1,a.venn2,a.venn3,a.venn4,a.venn5,a.venn6,a.venn7,a.venn8].filter(Boolean),S=r.getDiagramTitle?.(),y=r.getSubsetData(),E=r.getTextData(),w=le(r.getStyleData()),N=ue(y),q=o?.width??800,V=o?.height??450,P=1600,b=q/1600,_=S?48*b:0,T=a.primaryTextColor??a.textColor,u=Y(s);if(u.attr("viewBox",`0 0 ${q} ${V}`),S)u.append("text").text(S).attr("class","venn-title").attr("font-size",`${32*b}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*b).style("fill",a.vennTitleTextColor||a.titleColor);let v=m(document.createElement("div")),x=te().width(q).height(V-_);v.datum(N).call(x);let W=f?g.svg(v.select("svg").node()):void 0,C=re(N,{width:q,height:V-_,padding:o?.padding??15}),H=new Map;for(let G of C){let X=xt([...G.data.sets].sort());H.set(X,G)}if(E.length>0)ce(o,H,v,E,b,w);let at=ae(a.background||"#f4f4f4");if(v.selectAll(".venn-circle").each(function(G,X){let B=m(this),st=xt([...G.sets].sort()),tt=w.get(st),lt=l.length>0?l[X%l.length]:void 0,it=tt?.fill||lt||a.primaryColor;B.classed(`venn-set-${X%8}`,!0);let et=tt?.["fill-opacity"]??0.1,U=tt?.stroke||it,ft=tt?.["stroke-width"]||`${5*b}`;if(f&&W){let z=H.get(st);if(z&&z.circles.length>0){let J=z.circles[0],yt=W.circle(J.x,J.y,J.radius*2,{roughness:0.7,seed:d,fill:St(it,0.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+X*60,stroke:U,strokeWidth:parseFloat(String(ft))});B.select("path").remove(),B.node()?.insertBefore(yt,B.select("text").node())}}else B.select("path").style("fill",it).style("fill-opacity",et).style("stroke",U).style("stroke-width",ft).style("stroke-opacity",0.95);let ut=tt?.color||(at?h(it,30):p(it,30));B.select("text").style("font-size",`${48*b}px`).style("fill",ut)}),f&&W)v.selectAll(".venn-intersection").each(function(G){let X=m(this),Q=xt([...G.sets].sort()),st=w.get(Q),tt=st?.fill;if(tt){let lt=X.select("path"),it=lt.attr("d");if(it){let et=W.path(it,{roughness:0.7,seed:d,fill:St(tt,0.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),U=lt.node();U?.parentNode?.insertBefore(et,U),lt.remove()}}else X.select("path").style("fill-opacity",0);X.select("text").style("font-size",`${48*b}px`).style("fill",st?.color??a.vennSetTextColor??T)});else v.selectAll(".venn-intersection text").style("font-size",`${48*b}px`).style("fill",(G)=>{let B=xt([...G.sets].sort());return w.get(B)?.color??a.vennSetTextColor??T}),v.selectAll(".venn-intersection path").style("fill-opacity",(G)=>{let B=xt([...G.sets].sort());return w.get(B)?.fill?1:0}).style("fill",(G)=>{let B=xt([...G.sets].sort());return w.get(B)?.fill??"transparent"});let nt=u.append("g").attr("transform",`translate(0, ${_})`),Z=v.select("svg").node();if(Z&&"childNodes"in Z)for(let G of[...Z.childNodes])nt.node()?.appendChild(G);j(u,V,q,o?.useMaxWidth??!0)},"draw");function xt(t){return t.join("|")}e(xt,"stableSetsKey");function ce(t,s,i,n,r,o){let a=t?.useDebugLayout??!1,d=i.select("svg").append("g").attr("class","venn-text-nodes"),f=new Map;for(let l of n){let S=xt(l.sets),y=f.get(S);if(y)y.push(l);else f.set(S,[l])}for(let[l,S]of f.entries()){let y=s.get(l);if(!y?.text)continue;let E=y.text.x,w=y.text.y,N=Math.min(...y.circles.map((Z)=>Z.radius)),q=Math.min(...y.circles.map((Z)=>Z.radius-Math.hypot(E-Z.x,w-Z.y))),V=Number.isFinite(q)?Math.max(0,q):0;if(V===0&&Number.isFinite(N))V=N*0.6;let P=d.append("g").attr("class","venn-text-area").attr("font-size",`${40*r}px`);if(a)P.append("circle").attr("class","venn-text-debug-circle").attr("cx",E).attr("cy",w).attr("r",V).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*r).attr("stroke-dasharray",`${6*r} ${4*r}`);let b=Math.max(80*r,V*2*0.95),_=Math.max(60*r,V*2*0.95),v=(y.data.label&&y.data.label.length>0?Math.min(32*r,V*0.25):0)+(S.length<=2?30*r:0),x=E-b/2,W=w-_/2+v,C=Math.max(1,Math.ceil(Math.sqrt(S.length))),H=Math.max(1,Math.ceil(S.length/C)),at=b/C,nt=_/H;for(let[Z,G]of S.entries()){let X=Z%C,B=Math.floor(Z/C),Q=x+at*(X+0.5),st=W+nt*(B+0.5);if(a)P.append("rect").attr("class","venn-text-debug-cell").attr("x",x+at*X).attr("y",W+nt*B).attr("width",at).attr("height",nt).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*r).attr("stroke-dasharray",`${4*r} ${3*r}`);let tt=at*0.9,lt=nt*0.9,it=P.append("foreignObject").attr("class","venn-text-node-fo").attr("width",tt).attr("height",lt).attr("x",Q-tt/2).attr("y",st-lt/2).attr("overflow","visible"),et=o.get(G.id)?.color,U=it.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(G.label??G.id);if(et)U.style("color",et)}}}e(ce,"renderTextNodes");function ue(t){let s=new Set(t.map((r)=>[...r.sets].sort().join("|"))),i=new Map(t.filter((r)=>r.sets.length===1&&r.size!==void 0).map((r)=>[r.sets[0],r.size])),n=[];for(let r of t){if(r.sets.length<3)continue;let o=[...r.sets].sort();for(let a=0;a<o.length-1;a++)for(let c=a+1;c<o.length;c++){let d=[o[a],o[c]],f=d.join("|");if(!s.has(f)){s.add(f);let l=i.get(d[0]),S=i.get(d[1]),y=l!==void 0&&S!==void 0?Math.min(l,S)/4:2.5;n.push({sets:d,size:y,label:""})}}}return n.length>0?[...t,...n]:t}e(ue,"ensurePairwiseSubsets");var He={draw:Ke},rn={parser:ze,db:Ue,renderer:He,styles:We};export{rn as diagram};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Xo}from"./index.9zhger75.js";export{Xo as createWardleyServices};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import{ee}from"./index.yf0h5qnv.js";import{e,n,Me,k,j,A,L,I,R,M,O,D,u,Y,K}from"./index.fgsp5qqn.js";import{se}from"./index.9zhger75.js";var at=e((a,i)=>{let o=a<=1?a*100:a;if(o<0||o>100)throw Error(`${i} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${a}`);return o},"toPercent"),G=e((a,i,o)=>({x:at(i,`${o} evolution`),y:at(a,`${o} visibility`)}),"toCoordinates"),lt=e((a)=>{if(!a)return;if(a==="+<>")return"bidirectional";if(a==="+<")return"backward";if(a==="+>")return"forward";return},"getFlowFromPort"),Yt=e((a)=>{if(!a?.startsWith("+"))return{};let o=/^\+'([^']*)'/.exec(a)?.[1];if(a.includes("<>"))return{flow:"bidirectional",label:o};if(a.includes("<"))return{flow:"backward",label:o};if(a.includes(">"))return{flow:"forward",label:o};return{label:o}},"extractFlowFromArrow"),It=e((a,i)=>{if(ee(a,i),a.size)i.setSize(a.size.width,a.size.height);if(a.evolution){let o=a.evolution.stages.map((r)=>{if(r.secondName)return`${r.name.trim()} / ${r.secondName.trim()}`;return r.name.trim()}),g=a.evolution.stages.filter((r)=>r.boundary!==void 0).map((r)=>r.boundary);i.updateAxes({stages:o,stageBoundaries:g})}if(a.anchors.forEach((o)=>{let g=G(o.visibility,o.evolution,`Anchor "${o.name}"`);i.addNode(o.name,o.name,g.x,g.y,"anchor")}),a.components.forEach((o)=>{let g=G(o.visibility,o.evolution,`Component "${o.name}"`),r=o.label?(o.label.negX?-1:1)*o.label.offsetX:void 0,c=o.label?(o.label.negY?-1:1)*o.label.offsetY:void 0,b=o.decorator?.strategy;i.addNode(o.name,o.name,g.x,g.y,"component",r,c,o.inertia,b)}),a.notes.forEach((o)=>{let g=G(o.visibility,o.evolution,`Note "${o.text}"`);i.addNote(o.text,g.x,g.y)}),a.pipelines.forEach((o)=>{let g=i.getNode(o.parent);if(!g||typeof g.y!=="number")throw Error(`Pipeline "${o.parent}" must reference an existing component with coordinates.`);let r=g.y;i.startPipeline(o.parent),o.components.forEach((c)=>{let b=`${o.parent}_${c.name}`,T=c.label?(c.label.negX?-1:1)*c.label.offsetX:void 0,w=c.label?(c.label.negY?-1:1)*c.label.offsetY:void 0,J=at(c.evolution,`Pipeline component "${c.name}" evolution`);i.addNode(b,c.name,J,r,"pipeline-component",T,w),i.addPipelineComponent(o.parent,b)})}),a.links.forEach((o)=>{let g=!!o.arrow&&(o.arrow.includes("-.->")||o.arrow.includes(".-.")),r=lt(o.fromPort)??lt(o.toPort),{flow:c,label:b}=Yt(o.arrow);if(!r&&c)r=c;let T=o.linkLabel,w=b??T;i.addLink(i.resolveNodeId(o.from),i.resolveNodeId(o.to),g,w,r)}),a.evolves.forEach((o)=>{let g=i.getNode(o.component);if(g?.y!==void 0){let r=at(o.target,`Evolve target for "${o.component}"`);i.addTrend(o.component,r,g.y)}}),a.annotations.length>0){let o=a.annotations[0],g=G(o.x,o.y,"Annotations box");i.setAnnotationsBox(g.x,g.y)}a.annotation.forEach((o)=>{let g=G(o.x,o.y,`Annotation ${o.number}`);i.addAnnotation(o.number,[{x:g.x,y:g.y}],o.text)}),a.accelerators.forEach((o)=>{let g=G(o.x,o.y,`Accelerator "${o.name}"`);i.addAccelerator(o.name,g.x,g.y)}),a.deaccelerators.forEach((o)=>{let g=G(o.x,o.y,`Deaccelerator "${o.name}"`);i.addDeaccelerator(o.name,g.x,g.y)})},"populateDb"),ct={parser:{yy:void 0},parse:e(async(a)=>{let i=await se("wardley",a);n.debug(i);let o=ct.parser?.yy;if(!o||typeof o.addNode!=="function")throw 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.");It(i,o)},"parse")},Bt=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={}}static{e(this,"WardleyBuilder")}addNode(a){let i=this.nodes.get(a.id)??{id:a.id,label:a.label},o={...i,...a,className:a.className??i.className,labelOffsetX:a.labelOffsetX??i.labelOffsetX,labelOffsetY:a.labelOffsetY??i.labelOffsetY};this.nodes.set(a.id,o)}addLink(a){this.links.push(a)}addTrend(a){this.trends.set(a.nodeId,a)}startPipeline(a){this.pipelines.set(a,{nodeId:a,componentIds:[]});let i=this.nodes.get(a);if(i)i.isPipelineParent=!0}addPipelineComponent(a,i){let o=this.pipelines.get(a);if(o)o.componentIds.push(i);let g=this.nodes.get(i);if(g)g.inPipeline=!0}addAnnotation(a){this.annotations.push(a)}addNote(a){this.notes.push(a)}addAccelerator(a){this.accelerators.push(a)}addDeaccelerator(a){this.deaccelerators.push(a)}setAnnotationsBox(a,i){this.annotationsBox={x:a,y:i}}setAxes(a){this.axes={...this.axes,...a}}setSize(a,i){this.size={width:a,height:i}}getNode(a){return this.nodes.get(a)}resolveNodeId(a){if(this.nodes.has(a))return a;for(let[i,o]of this.nodes)if(o.label===a)return i;return a}build(){let a=[];for(let i of this.nodes.values()){if(typeof i.x!=="number"||typeof i.y!=="number")throw Error(`Node "${i.label}" is missing coordinates`);a.push(i)}return{nodes:a,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}},P=new Bt;function pt(){return u()["wardley-beta"]}e(pt,"getConfig");function ht(a,i,o,g,r,c,b,T,w){P.addNode({id:a,label:i,x:o,y:g,className:r,labelOffsetX:c,labelOffsetY:b,inertia:T,sourceStrategy:w})}e(ht,"addNode");function ft(a,i,o=!1,g,r){P.addLink({source:a,target:i,dashed:o,label:g,flow:r})}e(ft,"addLink");function xt(a,i,o){P.addTrend({nodeId:a,targetX:i,targetY:o})}e(xt,"addTrend");function gt(a,i,o){P.addAnnotation({number:a,coordinates:i,text:o})}e(gt,"addAnnotation");function yt(a,i,o){P.addNote({text:a,x:i,y:o})}e(yt,"addNote");function ut(a,i,o){P.addAccelerator({name:a,x:i,y:o})}e(ut,"addAccelerator");function wt(a,i,o){P.addDeaccelerator({name:a,x:i,y:o})}e(wt,"addDeaccelerator");function mt(a,i){P.setAnnotationsBox(a,i)}e(mt,"setAnnotationsBox");function kt(a,i){P.setSize(a,i)}e(kt,"setSize");function bt(a){P.startPipeline(a)}e(bt,"startPipeline");function $t(a,i){P.addPipelineComponent(a,i)}e($t,"addPipelineComponent");function vt(a){P.setAxes(a)}e(vt,"updateAxes");function Pt(a){return P.getNode(a)}e(Pt,"getNode");function Ct(a){return P.resolveNodeId(a)}e(Ct,"resolveNodeId");function St(){return P.build()}e(St,"getWardleyData");function Mt(){P.clear(),A()}e(Mt,"clear");var Ft={getConfig:pt,addNode:ht,addLink:ft,addTrend:xt,addAnnotation:gt,addNote:yt,addAccelerator:ut,addDeaccelerator:wt,setAnnotationsBox:mt,setSize:kt,startPipeline:bt,addPipelineComponent:$t,updateAxes:vt,getNode:Pt,resolveNodeId:Ct,getWardleyData:St,clear:Mt,setAccTitle:L,getAccTitle:I,setDiagramTitle:O,getDiagramTitle:D,getAccDescription:M,setAccDescription:R},Rt=["Genesis","Custom Built","Product","Commodity"],Ot=e(()=>{let{themeVariables:a}=u();return{backgroundColor:a.wardley?.backgroundColor??a.background??"#fff",axisColor:a.wardley?.axisColor??"#000",axisTextColor:a.wardley?.axisTextColor??a.primaryTextColor??"#222",gridColor:a.wardley?.gridColor??"rgba(100, 100, 100, 0.2)",componentFill:a.wardley?.componentFill??"#fff",componentStroke:a.wardley?.componentStroke??"#000",componentLabelColor:a.wardley?.componentLabelColor??a.primaryTextColor??"#222",linkStroke:a.wardley?.linkStroke??"#000",evolutionStroke:a.wardley?.evolutionStroke??"#dc3545",annotationStroke:a.wardley?.annotationStroke??"#000",annotationTextColor:a.wardley?.annotationTextColor??a.primaryTextColor??"#222",annotationFill:a.wardley?.annotationFill??a.background??"#fff"}},"getTheme"),Dt=e(()=>{let a=u()["wardley-beta"];return{width:a?.width??900,height:a?.height??600,padding:a?.padding??48,nodeRadius:a?.nodeRadius??6,nodeLabelOffset:a?.nodeLabelOffset??8,axisFontSize:a?.axisFontSize??12,labelFontSize:a?.labelFontSize??10,showGrid:a?.showGrid??!1,useMaxWidth:a?.useMaxWidth??!0}},"getConfigValues"),Gt=e((a,i,o,g)=>{n.debug(`Rendering Wardley map
|
|
2
|
+
`+a);let r=Dt(),c=Ot(),b=r.nodeRadius*1.6,T=g.db,w=T.getWardleyData(),J=T.getDiagramTitle(),W=w.size?.width??r.width,C=w.size?.height??r.height,V=Y(i);V.selectAll("*").remove(),j(V,C,W,r.useMaxWidth),V.attr("viewBox",`0 0 ${W} ${C}`);let N=V.append("g").attr("class","wardley-map"),rt=V.append("defs");rt.append("marker").attr("id",`arrow-${i}`).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",c.evolutionStroke).attr("stroke","none"),rt.append("marker").attr("id",`link-arrow-end-${i}`).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",c.linkStroke).attr("stroke","none"),rt.append("marker").attr("id",`link-arrow-start-${i}`).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",c.linkStroke).attr("stroke","none"),N.append("rect").attr("class","wardley-background").attr("width",W).attr("height",C).attr("fill",c.backgroundColor);let _=W-r.padding*2,Z=C-r.padding*2;if(J)N.append("text").attr("class","wardley-title").attr("x",W/2).attr("y",r.padding/2).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize*1.05).attr("font-weight","bold").attr("text-anchor","middle").attr("dominant-baseline","middle").text(J);let H=e((t)=>r.padding+t/100*_,"projectX"),B=e((t)=>C-r.padding-t/100*Z,"projectY"),Q=N.append("g").attr("class","wardley-axes");Q.append("line").attr("x1",r.padding).attr("x2",W-r.padding).attr("y1",C-r.padding).attr("y2",C-r.padding).attr("stroke",c.axisColor).attr("stroke-width",1),Q.append("line").attr("x1",r.padding).attr("x2",r.padding).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke",c.axisColor).attr("stroke-width",1);let Nt=w.axes.xLabel??"Evolution",zt=w.axes.yLabel??"Visibility";Q.append("text").attr("class","wardley-axis-label wardley-axis-label-x").attr("x",r.padding+_/2).attr("y",C-r.padding/4).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").text(Nt),Q.append("text").attr("class","wardley-axis-label wardley-axis-label-y").attr("x",r.padding/3).attr("y",r.padding+Z/2).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize).attr("font-weight","bold").attr("text-anchor","middle").attr("transform",`rotate(-90 ${r.padding/3} ${r.padding+Z/2})`).text(zt);let U=w.axes.stages&&w.axes.stages.length>0?w.axes.stages:Rt;if(U.length>0){let t=N.append("g").attr("class","wardley-stages"),d=w.axes.stageBoundaries,s=[];if(d&&d.length===U.length){let l=0;d.forEach((h)=>{s.push({start:l,end:h}),l=h})}else{let l=1/U.length;U.forEach((h,f)=>{s.push({start:f*l,end:(f+1)*l})})}U.forEach((l,h)=>{let f=s[h],y=r.padding+f.start*_,x=r.padding+f.end*_,m=(y+x)/2;if(h>0)t.append("line").attr("x1",y).attr("x2",y).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke","#000").attr("stroke-width",1).attr("stroke-dasharray","5 5").attr("opacity",0.8);t.append("text").attr("class","wardley-stage-label").attr("x",m).attr("y",C-r.padding/1.5).attr("fill",c.axisTextColor).attr("font-size",r.axisFontSize-2).attr("text-anchor","middle").text(l)})}if(r.showGrid){let t=N.append("g").attr("class","wardley-grid");for(let d=1;d<4;d++){let s=d/4,l=r.padding+_*s;t.append("line").attr("x1",l).attr("x2",l).attr("y1",r.padding).attr("y2",C-r.padding).attr("stroke",c.gridColor).attr("stroke-dasharray","2 6"),t.append("line").attr("x1",r.padding).attr("x2",W-r.padding).attr("y1",C-r.padding-Z*s).attr("y2",C-r.padding-Z*s).attr("stroke",c.gridColor).attr("stroke-dasharray","2 6")}}let p=new Map;if(w.nodes.forEach((t)=>{p.set(t.id,{x:H(t.x),y:B(t.y),node:t})}),w.pipelines.length>0){let t=N.append("g").attr("class","wardley-pipelines"),d=N.append("g").attr("class","wardley-pipeline-links");w.pipelines.forEach((s)=>{if(s.componentIds.length===0)return;let l=s.componentIds.map((x)=>({id:x,pos:p.get(x),node:w.nodes.find((m)=>m.id===x)})).filter((x)=>x.pos&&x.node).sort((x,m)=>x.node.x-m.node.x);for(let x=0;x<l.length-1;x++){let m=l[x],v=l[x+1];d.append("line").attr("class","wardley-pipeline-evolution-link").attr("x1",m.pos.x).attr("y1",m.pos.y).attr("x2",v.pos.x).attr("y2",v.pos.y).attr("stroke",c.linkStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4")}let h=1/0,f=-1/0,y=0;if(s.componentIds.forEach((x)=>{let m=p.get(x);if(m)h=Math.min(h,m.x),f=Math.max(f,m.x),y=m.y}),h!==1/0&&f!==-1/0){let m=r.nodeRadius*4,v=y-m/2,z=p.get(s.nodeId);if(z){let E=(h+f)/2;z.x=E,z.y=v-b/6}t.append("rect").attr("class","wardley-pipeline-box").attr("x",h-15).attr("y",v).attr("width",f-h+30).attr("height",m).attr("fill","none").attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}})}let st=N.append("g").attr("class","wardley-links"),it=new Map;w.pipelines.forEach((t)=>{it.set(t.nodeId,new Set(t.componentIds))});let dt=w.links.filter((t)=>{if(!p.has(t.source)||!p.has(t.target))return!1;if(it.get(t.target)?.has(t.source))return!1;return!0});st.selectAll("line").data(dt).enter().append("line").attr("class",(t)=>`wardley-link${t.dashed?" wardley-link--dashed":""}`).attr("x1",(t)=>{let d=p.get(t.source),s=p.get(t.target),h=w.nodes.find((m)=>m.id===t.source).isPipelineParent?b/Math.sqrt(2):r.nodeRadius,f=s.x-d.x,y=s.y-d.y,x=Math.sqrt(f*f+y*y);return d.x+f/x*h}).attr("y1",(t)=>{let d=p.get(t.source),s=p.get(t.target),h=w.nodes.find((m)=>m.id===t.source).isPipelineParent?b/Math.sqrt(2):r.nodeRadius,f=s.x-d.x,y=s.y-d.y,x=Math.sqrt(f*f+y*y);return d.y+y/x*h}).attr("x2",(t)=>{let d=p.get(t.source),s=p.get(t.target),h=w.nodes.find((m)=>m.id===t.target).isPipelineParent?b/Math.sqrt(2):r.nodeRadius,f=d.x-s.x,y=d.y-s.y,x=Math.sqrt(f*f+y*y);return s.x+f/x*h}).attr("y2",(t)=>{let d=p.get(t.source),s=p.get(t.target),h=w.nodes.find((m)=>m.id===t.target).isPipelineParent?b/Math.sqrt(2):r.nodeRadius,f=d.x-s.x,y=d.y-s.y,x=Math.sqrt(f*f+y*y);return s.y+y/x*h}).attr("stroke",c.linkStroke).attr("stroke-width",1).attr("stroke-dasharray",(t)=>t.dashed?"6 6":null).attr("marker-end",(t)=>{if(t.flow==="forward"||t.flow==="bidirectional")return`url(#link-arrow-end-${i})`;return null}).attr("marker-start",(t)=>{if(t.flow==="backward"||t.flow==="bidirectional")return`url(#link-arrow-start-${i})`;return null}),st.selectAll("text").data(dt.filter((t)=>t.label)).enter().append("text").attr("class","wardley-link-label").attr("x",(t)=>{let d=p.get(t.source),s=p.get(t.target),l=(d.x+s.x)/2,h=s.y-d.y,f=s.x-d.x,y=Math.sqrt(f*f+h*h),x=8,m=h/y;return l+m*8}).attr("y",(t)=>{let d=p.get(t.source),s=p.get(t.target),l=(d.y+s.y)/2,h=s.x-d.x,f=s.y-d.y,y=Math.sqrt(h*h+f*f),x=8,m=-h/y;return l+m*8}).attr("fill",c.axisTextColor).attr("font-size",r.labelFontSize).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("transform",(t)=>{let d=p.get(t.source),s=p.get(t.target),l=(d.x+s.x)/2,h=(d.y+s.y)/2,f=s.x-d.x,y=s.y-d.y,x=Math.sqrt(f*f+y*y),m=8,v=y/x,z=-f/x,E=l+v*8,tt=h+z*8,q=Math.atan2(y,f)*180/Math.PI;if(q>90||q<-90)q+=180;return`rotate(${q} ${E} ${tt})`}).text((t)=>t.label);let Lt=N.append("g").attr("class","wardley-trends"),Tt=w.trends.map((t)=>{let d=p.get(t.nodeId);if(!d)return null;let s=H(t.targetX),l=B(t.targetY),h=s-d.x,f=l-d.y,y=Math.sqrt(h*h+f*f),x=r.nodeRadius+2,m=y>x?s-h/y*x:s,v=y>x?l-f/y*x:l;return{origin:d,targetX:s,targetY:l,adjustedX2:m,adjustedY2:v}}).filter((t)=>t!==null);Lt.selectAll("line").data(Tt).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",c.evolutionStroke).attr("stroke-width",1).attr("stroke-dasharray","4 4").attr("marker-end",`url(#arrow-${i})`);let X=N.append("g").attr("class","wardley-nodes").selectAll("g").data(w.nodes).enter().append("g").attr("class",(t)=>["wardley-node",t.className?`wardley-node--${t.className}`:""].filter(Boolean).join(" "));X.filter((t)=>t.sourceStrategy==="outsource").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",r.nodeRadius*2).attr("fill","#666").attr("stroke",c.componentStroke).attr("stroke-width",1),X.filter((t)=>t.sourceStrategy==="buy").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",r.nodeRadius*2).attr("fill","#ccc").attr("stroke",c.componentStroke).attr("stroke-width",1),X.filter((t)=>t.sourceStrategy==="build").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",r.nodeRadius*2).attr("fill","#eee").attr("stroke","#000").attr("stroke-width",1);let F=X.filter((t)=>t.sourceStrategy==="market");F.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",r.nodeRadius*2).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),X.filter((t)=>!t.isPipelineParent&&t.sourceStrategy!=="market"&&t.className!=="anchor").append("circle").attr("cx",(t)=>p.get(t.id).x).attr("cy",(t)=>p.get(t.id).y).attr("r",r.nodeRadius).attr("fill",c.componentFill).attr("stroke",c.componentStroke).attr("stroke-width",1);let ot=r.nodeRadius*0.7,S=r.nodeRadius*1.2;if(F.append("line").attr("class","wardley-market-line").attr("x1",(t)=>p.get(t.id).x).attr("y1",(t)=>p.get(t.id).y-S).attr("x2",(t)=>p.get(t.id).x-S*Math.cos(Math.PI/6)).attr("y2",(t)=>p.get(t.id).y+S*Math.sin(Math.PI/6)).attr("stroke",c.componentStroke).attr("stroke-width",1),F.append("line").attr("class","wardley-market-line").attr("x1",(t)=>p.get(t.id).x-S*Math.cos(Math.PI/6)).attr("y1",(t)=>p.get(t.id).y+S*Math.sin(Math.PI/6)).attr("x2",(t)=>p.get(t.id).x+S*Math.cos(Math.PI/6)).attr("y2",(t)=>p.get(t.id).y+S*Math.sin(Math.PI/6)).attr("stroke",c.componentStroke).attr("stroke-width",1),F.append("line").attr("class","wardley-market-line").attr("x1",(t)=>p.get(t.id).x+S*Math.cos(Math.PI/6)).attr("y1",(t)=>p.get(t.id).y+S*Math.sin(Math.PI/6)).attr("x2",(t)=>p.get(t.id).x).attr("y2",(t)=>p.get(t.id).y-S).attr("stroke",c.componentStroke).attr("stroke-width",1),F.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>p.get(t.id).x).attr("cy",(t)=>p.get(t.id).y-S).attr("r",ot).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),F.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>p.get(t.id).x-S*Math.cos(Math.PI/6)).attr("cy",(t)=>p.get(t.id).y+S*Math.sin(Math.PI/6)).attr("r",ot).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),F.append("circle").attr("class","wardley-market-dot").attr("cx",(t)=>p.get(t.id).x+S*Math.cos(Math.PI/6)).attr("cy",(t)=>p.get(t.id).y+S*Math.sin(Math.PI/6)).attr("r",ot).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",2),X.filter((t)=>t.isPipelineParent===!0).append("rect").attr("x",(t)=>p.get(t.id).x-b/2).attr("y",(t)=>p.get(t.id).y-b/2).attr("width",b).attr("height",b).attr("fill",c.componentFill).attr("stroke",c.componentStroke).attr("stroke-width",1),X.filter((t)=>t.inertia===!0).append("line").attr("class","wardley-inertia").attr("x1",(t)=>{let d=p.get(t.id),s=t.isPipelineParent?b/2+15:r.nodeRadius+15;if(t.sourceStrategy)s+=r.nodeRadius+10;return d.x+s}).attr("y1",(t)=>{let d=p.get(t.id),s=t.isPipelineParent?b:r.nodeRadius*2;return d.y-s/2}).attr("x2",(t)=>{let d=p.get(t.id),s=t.isPipelineParent?b/2+15:r.nodeRadius+15;if(t.sourceStrategy)s+=r.nodeRadius+10;return d.x+s}).attr("y2",(t)=>{let d=p.get(t.id),s=t.isPipelineParent?b:r.nodeRadius*2;return d.y+s/2}).attr("stroke",c.componentStroke).attr("stroke-width",6),X.append("text").attr("x",(t)=>{let d=p.get(t.id);if(t.className==="anchor")return t.labelOffsetX!==void 0?d.x+t.labelOffsetX:d.x;let s=r.nodeLabelOffset;if(t.sourceStrategy&&t.labelOffsetX===void 0)s+=10;let l=t.labelOffsetX??s;return d.x+l}).attr("y",(t)=>{let d=p.get(t.id);if(t.className==="anchor")return t.labelOffsetY!==void 0?d.y+t.labelOffsetY:d.y-3;let s=-r.nodeLabelOffset;if(t.sourceStrategy&&t.labelOffsetY===void 0)s-=10;let l=t.labelOffsetY??s;return d.y+l}).attr("class","wardley-node-label").attr("fill",(t)=>{if(t.className==="evolved")return c.evolutionStroke;if(t.className==="anchor")return"#000";return c.componentLabelColor}).attr("font-size",r.labelFontSize).attr("font-weight",(t)=>t.className==="anchor"?"bold":"normal").attr("text-anchor",(t)=>t.className==="anchor"?"middle":"start").attr("dominant-baseline",(t)=>t.className==="anchor"?"middle":"auto").text((t)=>t.label),w.annotations.length>0){let t=N.append("g").attr("class","wardley-annotations");if(w.annotations.forEach((d)=>{let s=d.coordinates.map((l)=>({x:H(l.x),y:B(l.y)}));if(s.length>1)for(let l=0;l<s.length-1;l++)t.append("line").attr("class","wardley-annotation-line").attr("x1",s[l].x).attr("y1",s[l].y).attr("x2",s[l+1].x).attr("y2",s[l+1].y).attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("stroke-dasharray","4 4");s.forEach((l)=>{let h=t.append("g").attr("class","wardley-annotation");h.append("circle").attr("cx",l.x).attr("cy",l.y).attr("r",10).attr("fill","white").attr("stroke",c.axisColor).attr("stroke-width",1.5),h.append("text").attr("x",l.x).attr("y",l.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(d.number)})}),w.annotationsBox){let d=H(w.annotationsBox.x),s=B(w.annotationsBox.y),l=10,h=16,f=11,y=t.append("g").attr("class","wardley-annotations-box"),x=[...w.annotations].filter((v)=>v.text).sort((v,z)=>v.number-z.number),m=[];if(x.forEach((v,z)=>{let E=y.append("text").attr("x",d+l).attr("y",s+l+(z+1)*h).attr("font-size",f).attr("fill",c.axisTextColor).attr("text-anchor","start").attr("dominant-baseline","middle").text(`${v.number}. ${v.text}`);m.push(E)}),m.length>0){let v=0,z=0;m.forEach((nt)=>{let et=nt.node(),Et=et.getComputedTextLength();v=Math.max(v,Et);let Ht=et.getBBox();z=Math.max(z,Ht.height)});let E=v+l*2+105,tt=x.length*h+l*2+z/2,q=r.padding,Wt=W-r.padding-E,At=r.padding,Xt=C-r.padding-tt;d=Math.max(q,Math.min(d,Wt)),s=Math.max(At,Math.min(s,Xt)),m.forEach((nt,et)=>{nt.attr("x",d+l).attr("y",s+l+(et+1)*h)}),y.insert("rect","text").attr("x",d).attr("y",s).attr("width",E).attr("height",tt).attr("fill","white").attr("stroke",c.axisColor).attr("stroke-width",1.5).attr("rx",4).attr("ry",4)}}}if(w.notes.length>0){let t=N.append("g").attr("class","wardley-notes");w.notes.forEach((d)=>{let s=H(d.x),l=B(d.y);t.append("text").attr("x",s).attr("y",l).attr("text-anchor","start").attr("font-size",11).attr("fill",c.axisTextColor).attr("font-weight","bold").text(d.text)})}if(w.accelerators.length>0){let t=N.append("g").attr("class","wardley-accelerators");w.accelerators.forEach((d)=>{let s=H(d.x),l=B(d.y),h=60,f=30,y=20,x=`
|
|
3
|
+
M ${s} ${l-15}
|
|
4
|
+
L ${s+60-20} ${l-15}
|
|
5
|
+
L ${s+60-20} ${l-15-8}
|
|
6
|
+
L ${s+60} ${l}
|
|
7
|
+
L ${s+60-20} ${l+15+8}
|
|
8
|
+
L ${s+60-20} ${l+15}
|
|
9
|
+
L ${s} ${l+15}
|
|
10
|
+
Z
|
|
11
|
+
`;t.append("path").attr("d",x).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),t.append("text").attr("x",s+30).attr("y",l+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(d.name)})}if(w.deaccelerators.length>0){let t=N.append("g").attr("class","wardley-deaccelerators");w.deaccelerators.forEach((d)=>{let s=H(d.x),l=B(d.y),h=60,f=30,y=20,x=`
|
|
12
|
+
M ${s+60} ${l-15}
|
|
13
|
+
L ${s+20} ${l-15}
|
|
14
|
+
L ${s+20} ${l-15-8}
|
|
15
|
+
L ${s} ${l}
|
|
16
|
+
L ${s+20} ${l+15+8}
|
|
17
|
+
L ${s+20} ${l+15}
|
|
18
|
+
L ${s+60} ${l+15}
|
|
19
|
+
Z
|
|
20
|
+
`;t.append("path").attr("d",x).attr("fill","white").attr("stroke",c.componentStroke).attr("stroke-width",1),t.append("text").attr("x",s+30).attr("y",l+15+15).attr("text-anchor","middle").attr("font-size",10).attr("fill",c.axisTextColor).attr("font-weight","bold").text(d.name)})}},"draw"),qt={draw:Gt},jt=e(({wardley:a}={})=>{let i=Me(),o=k(),g=K(i,o.themeVariables),r=K(g.wardley,a);return`
|
|
21
|
+
.wardley-background {
|
|
22
|
+
fill: ${r.backgroundColor};
|
|
23
|
+
}
|
|
24
|
+
.wardley-axes line, .wardley-axes path {
|
|
25
|
+
stroke: ${r.axisColor};
|
|
26
|
+
}
|
|
27
|
+
.wardley-axis-label {
|
|
28
|
+
fill: ${r.axisTextColor};
|
|
29
|
+
}
|
|
30
|
+
.wardley-stage-label {
|
|
31
|
+
fill: ${r.axisTextColor};
|
|
32
|
+
}
|
|
33
|
+
.wardley-grid line {
|
|
34
|
+
stroke: ${r.gridColor};
|
|
35
|
+
}
|
|
36
|
+
.wardley-node circle {
|
|
37
|
+
fill: ${r.componentFill};
|
|
38
|
+
stroke: ${r.componentStroke};
|
|
39
|
+
}
|
|
40
|
+
.wardley-node-label {
|
|
41
|
+
fill: ${r.componentLabelColor};
|
|
42
|
+
}
|
|
43
|
+
.wardley-link {
|
|
44
|
+
stroke: ${r.linkStroke};
|
|
45
|
+
}
|
|
46
|
+
.wardley-link--dashed {
|
|
47
|
+
stroke-dasharray: 4 4;
|
|
48
|
+
}
|
|
49
|
+
.wardley-link-label {
|
|
50
|
+
fill: ${r.axisTextColor};
|
|
51
|
+
}
|
|
52
|
+
.wardley-trend line {
|
|
53
|
+
stroke: ${r.evolutionStroke};
|
|
54
|
+
}
|
|
55
|
+
.wardley-annotation-line {
|
|
56
|
+
stroke: ${r.annotationStroke};
|
|
57
|
+
}
|
|
58
|
+
.wardley-annotation circle {
|
|
59
|
+
fill: ${r.annotationFill};
|
|
60
|
+
stroke: ${r.annotationStroke};
|
|
61
|
+
}
|
|
62
|
+
.wardley-annotation text {
|
|
63
|
+
fill: ${r.annotationTextColor};
|
|
64
|
+
}
|
|
65
|
+
.wardley-annotations-box rect {
|
|
66
|
+
fill: ${r.annotationFill};
|
|
67
|
+
stroke: ${r.annotationStroke};
|
|
68
|
+
}
|
|
69
|
+
.wardley-annotations-box text {
|
|
70
|
+
fill: ${r.annotationTextColor};
|
|
71
|
+
}
|
|
72
|
+
.wardley-pipeline-box {
|
|
73
|
+
stroke: ${r.componentStroke};
|
|
74
|
+
}
|
|
75
|
+
.wardley-notes text {
|
|
76
|
+
fill: ${r.axisTextColor};
|
|
77
|
+
}
|
|
78
|
+
`},"styles"),ae={parser:ct,db:Ft,renderer:qt,styles:jt};export{ae as diagram};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{e,n,Me,F,k,q,j,A,L,I,R,M,O,D,La,Y,K,ks}from"./index.fgsp5qqn.js";import{Ri,Kt}from"./index.cf9nd6xy.js";var Dt=function(){var t=e(function(G,h,l,u){for(l=l||{},u=G.length;u--;l[G[u]]=h);return l},"o"),i=[1,10,12,14,16,18,19,21,23],s=[2,6],a=[1,3],o=[1,5],x=[1,6],c=[1,7],p=[1,5,10,12,14,16,18,19,21,23,36,37,38],d=[1,25],S=[1,26],v=[1,28],E=[1,29],U=[1,30],et=[1,31],it=[1,32],X=[1,33],J=[1,34],st=[1,35],at=[1,36],y=[1,37],N=[1,43],g=[1,42],W=[1,47],H=[1,50],C=[1,10,12,14,16,18,19,21,23,36,37,38],ot=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],z=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],gt=[1,65],P=[26,28],w={trace:e(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",28:"COMMA",29:"NUMBER_WITH_DECIMAL",30:"STR",33:"ARROW_DELIMITER",36:"NEWLINE",37:"SEMI",38:"EOF",40:"MD_STR",42:"AMP",43:"NUM",44:"ALPHA",45:"PLUS",46:"EQUALS",47:"MULT",48:"DOT",49:"BRKT",50:"MINUS",51:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:e(function(h,l,u,f,_,r,rt){var m=r.length-1;switch(_){case 5:f.setOrientation(r[m]);break;case 9:f.setDiagramTitle(r[m].text.trim());break;case 12:f.setLineData({text:"",type:"text"},r[m]);break;case 13:f.setLineData(r[m-1],r[m]);break;case 14:f.setBarData({text:"",type:"text"},r[m]);break;case 15:f.setBarData(r[m-1],r[m]);break;case 16:this.$=r[m].trim(),f.setAccTitle(this.$);break;case 17:case 18:this.$=r[m].trim(),f.setAccDescription(this.$);break;case 19:this.$=r[m-1];break;case 20:case 30:this.$=[r[m-2],...r[m]];break;case 21:case 31:this.$=[r[m]];break;case 22:this.$={value:Number(r[m-1]),label:r[m]};break;case 23:this.$={value:Number(r[m]),label:""};break;case 24:f.setXAxisTitle(r[m]);break;case 25:f.setXAxisTitle(r[m-1]);break;case 26:f.setXAxisTitle({type:"text",text:""});break;case 27:f.setXAxisBand(r[m]);break;case 28:f.setXAxisRangeData(Number(r[m-2]),Number(r[m]));break;case 29:this.$=r[m-1];break;case 32:f.setYAxisTitle(r[m]);break;case 33:f.setYAxisTitle(r[m-1]);break;case 34:f.setYAxisTitle({type:"text",text:""});break;case 35:f.setYAxisRangeData(Number(r[m-2]),Number(r[m]));break;case 39:this.$={text:r[m],type:"text"};break;case 40:this.$={text:r[m],type:"text"};break;case 41:this.$={text:r[m],type:"markdown"};break;case 42:this.$=r[m];break;case 43:this.$=r[m-1]+""+r[m];break}},"anonymous"),table:[t(i,s,{3:1,4:2,7:4,5:a,36:o,37:x,38:c}),{1:[3]},t(i,s,{4:2,7:4,3:8,5:a,36:o,37:x,38:c}),t(i,s,{4:2,7:4,6:9,3:10,5:a,8:[1,11],36:o,37:x,38:c}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(p,[2,36]),t(p,[2,37]),t(p,[2,38]),{1:[2,1]},t(i,s,{4:2,7:4,3:21,5:a,36:o,37:x,38:c}),{1:[2,3]},t(p,[2,5]),t(i,[2,7],{4:22,36:o,37:x,38:c}),{11:23,30:d,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},{11:39,13:38,24:N,29:g,30:d,31:40,32:41,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},{11:45,15:44,29:W,30:d,35:46,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},{11:49,17:48,24:H,30:d,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},{11:52,17:51,24:H,30:d,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},{20:[1,53]},{22:[1,54]},t(C,[2,18]),{1:[2,2]},t(C,[2,8]),t(C,[2,9]),t(ot,[2,39],{41:55,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y}),t(ot,[2,40]),t(ot,[2,41]),t(z,[2,42]),t(z,[2,44]),t(z,[2,45]),t(z,[2,46]),t(z,[2,47]),t(z,[2,48]),t(z,[2,49]),t(z,[2,50]),t(z,[2,51]),t(z,[2,52]),t(z,[2,53]),t(C,[2,10]),t(C,[2,24],{32:41,31:56,24:N,29:g}),t(C,[2,26]),t(C,[2,27]),{33:[1,57]},{11:59,30:d,34:58,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},t(C,[2,11]),t(C,[2,32],{35:60,29:W}),t(C,[2,34]),{33:[1,61]},t(C,[2,12]),{17:62,24:H},{25:63,27:64,29:gt},t(C,[2,14]),{17:66,24:H},t(C,[2,16]),t(C,[2,17]),t(z,[2,43]),t(C,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},t(C,[2,33]),{29:[1,70]},t(C,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},t(P,[2,23],{30:[1,73]}),t(C,[2,15]),t(C,[2,28]),t(C,[2,29]),{11:59,30:d,34:74,39:24,40:S,41:27,42:v,43:E,44:U,45:et,46:it,47:X,48:J,49:st,50:at,51:y},t(C,[2,35]),t(C,[2,19]),{25:75,27:64,29:gt},t(P,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:e(function(h,l){if(l.recoverable)this.trace(h);else{var u=Error(h);throw u.hash=l,u}},"parseError"),parse:e(function(h){var l=this,u=[0],f=[],_=[null],r=[],rt=this.table,m="",mt=0,Ft=0,Xt=0,ue=2,Yt=1,de=r.slice.call(arguments,1),B=Object.create(this.lexer),ht={yy:{}};for(var Ct in this.yy)if(Object.prototype.hasOwnProperty.call(this.yy,Ct))ht.yy[Ct]=this.yy[Ct];if(B.setInput(h,ht.yy),ht.yy.lexer=B,ht.yy.parser=this,typeof B.yylloc>"u")B.yylloc={};var St=B.yylloc;r.push(St);var xe=B.options&&B.options.ranges;if(typeof ht.yy.parseError==="function")this.parseError=ht.yy.parseError;else this.parseError=Object.getPrototypeOf(this).parseError;function fe(Z){u.length=u.length-2*Z,_.length=_.length-Z,r.length=r.length-Z}e(fe,"popStack");function Nt(){var Z=f.pop()||B.lex()||Yt;if(typeof Z!=="number"){if(Z instanceof Array)f=Z,Z=f.pop();Z=l.symbols_[Z]||Z}return Z}e(Nt,"lex");var V,Rt,lt,Q,Ie,_t,ut={},bt,nt,Ht,yt;while(!0){if(lt=u[u.length-1],this.defaultActions[lt])Q=this.defaultActions[lt];else{if(V===null||typeof V>"u")V=Nt();Q=rt[lt]&&rt[lt][V]}if(typeof Q>"u"||!Q.length||!Q[0]){var Tt="";yt=[];for(bt in rt[lt])if(this.terminals_[bt]&&bt>ue)yt.push("'"+this.terminals_[bt]+"'");if(B.showPosition)Tt="Parse error on line "+(mt+1)+`:
|
|
2
|
+
`+B.showPosition()+`
|
|
3
|
+
Expecting `+yt.join(", ")+", got '"+(this.terminals_[V]||V)+"'";else Tt="Parse error on line "+(mt+1)+": Unexpected "+(V==Yt?"end of input":"'"+(this.terminals_[V]||V)+"'");this.parseError(Tt,{text:B.match,token:this.terminals_[V]||V,line:B.yylineno,loc:St,expected:yt})}if(Q[0]instanceof Array&&Q.length>1)throw Error("Parse Error: multiple actions possible at state: "+lt+", token: "+V);switch(Q[0]){case 1:if(u.push(V),_.push(B.yytext),r.push(B.yylloc),u.push(Q[1]),V=null,!Rt){if(Ft=B.yyleng,m=B.yytext,mt=B.yylineno,St=B.yylloc,Xt>0)Xt--}else V=Rt,Rt=null;break;case 2:if(nt=this.productions_[Q[1]][1],ut.$=_[_.length-nt],ut._$={first_line:r[r.length-(nt||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(nt||1)].first_column,last_column:r[r.length-1].last_column},xe)ut._$.range=[r[r.length-(nt||1)].range[0],r[r.length-1].range[1]];if(_t=this.performAction.apply(ut,[m,Ft,mt,ht.yy,Q[1],_,r].concat(de)),typeof _t<"u")return _t;if(nt)u=u.slice(0,-1*nt*2),_=_.slice(0,-1*nt),r=r.slice(0,-1*nt);u.push(this.productions_[Q[1]][0]),_.push(ut.$),r.push(ut._$),Ht=rt[u[u.length-2]][u[u.length-1]],u.push(Ht);break;case 3:return!0}}return!0},"parse")},tt=function(){var G={EOF:1,parseError:e(function(l,u){if(this.yy.parser)this.yy.parser.parseError(l,u);else throw Error(l)},"parseError"),setInput:e(function(h,l){if(this.yy=l||this.yy||{},this._input=h,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];return this.offset=0,this},"setInput"),input:e(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var l=h.match(/(?:\r\n?|\n).*/g);if(l)this.yylineno++,this.yylloc.last_line++;else this.yylloc.last_column++;if(this.options.ranges)this.yylloc.range[1]++;return this._input=this._input.slice(1),h},"input"),unput:e(function(h){var l=h.length,u=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-l),this.offset-=l;var f=this.match.split(/(?:\r\n?|\n)/g);if(this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),u.length-1)this.yylineno-=u.length-1;var _=this.yylloc.range;if(this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:u?(u.length===f.length?this.yylloc.first_column:0)+f[f.length-u.length].length-u[0].length:this.yylloc.first_column-l},this.options.ranges)this.yylloc.range=[_[0],_[0]+this.yyleng-l];return this.yyleng=this.yytext.length,this},"unput"),more:e(function(){return this._more=!0,this},"more"),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:e(function(h){this.unput(this.match.slice(h))},"less"),pastInput:e(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:e(function(){var h=this.match;if(h.length<20)h+=this._input.substr(0,20-h.length);return(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:e(function(){var h=this.pastInput(),l=Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
|
5
|
+
`+l+"^"},"showPosition"),test_match:e(function(h,l){var u,f,_;if(this.options.backtrack_lexer){if(_={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)_.yylloc.range=this.yylloc.range.slice(0)}if(f=h[0].match(/(?:\r\n?|\n).*/g),f)this.yylineno+=f.length;if(this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:f?f[f.length-1].length-f[f.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+h[0].length},this.yytext+=h[0],this.match+=h[0],this.matches=h,this.yyleng=this.yytext.length,this.options.ranges)this.yylloc.range=[this.offset,this.offset+=this.yyleng];if(this._more=!1,this._backtrack=!1,this._input=this._input.slice(h[0].length),this.matched+=h[0],u=this.performAction.call(this,this.yy,this,l,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input)this.done=!1;if(u)return u;else if(this._backtrack){for(var r in _)this[r]=_[r];return!1}return!1},"test_match"),next:e(function(){if(this.done)return this.EOF;if(!this._input)this.done=!0;var h,l,u,f;if(!this._more)this.yytext="",this.match="";var _=this._currentRules();for(var r=0;r<_.length;r++)if(u=this._input.match(this.rules[_[r]]),u&&(!l||u[0].length>l[0].length)){if(l=u,f=r,this.options.backtrack_lexer)if(h=this.test_match(u,_[r]),h!==!1)return h;else if(this._backtrack){l=!1;continue}else return!1;else if(!this.options.flex)break}if(l){if(h=this.test_match(l,_[f]),h!==!1)return h;return!1}if(this._input==="")return this.EOF;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
|
6
|
+
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:e(function(){var l=this.next();if(l)return l;else return this.lex()},"lex"),begin:e(function(l){this.conditionStack.push(l)},"begin"),popState:e(function(){var l=this.conditionStack.length-1;if(l>0)return this.conditionStack.pop();else return this.conditionStack[0]},"popState"),_currentRules:e(function(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1])return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;else return this.conditions.INITIAL.rules},"_currentRules"),topState:e(function(l){if(l=this.conditionStack.length-1-Math.abs(l||0),l>=0)return this.conditionStack[l];else return"INITIAL"},"topState"),pushState:e(function(l){this.begin(l)},"pushState"),stateStackSize:e(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:e(function(l,u,f,_){var r=_;switch(f){case 0:break;case 1:break;case 2:return this.popState(),36;break;case 3:return this.popState(),36;break;case 4:return 36;case 5:break;case 6:return 10;case 7:return this.pushState("acc_title"),19;break;case 8:return this.popState(),"acc_title_value";break;case 9:return this.pushState("acc_descr"),21;break;case 10:return this.popState(),"acc_descr_value";break;case 11:this.pushState("acc_descr_multiline");break;case 12:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:return 5;case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";break;case 18:return this.pushState("axis_data"),"Y_AXIS";break;case 19:return this.pushState("axis_band_data"),24;break;case 20:return 33;case 21:return this.pushState("data"),16;break;case 22:return this.pushState("data"),18;break;case 23:return this.pushState("data_inner"),24;break;case 24:return 29;case 25:return this.popState(),26;break;case 26:this.popState();break;case 27:this.pushState("string");break;case 28:this.popState();break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 44;case 33:return"COLON";case 34:return 45;case 35:return 28;case 36:return 46;case 37:return 47;case 38:return 49;case 39:return 51;case 40:return 48;case 41:return 42;case 42:return 50;case 43:return 43;case 44:break;case 45:return 37;case 46:return 38}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\})/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}};return G}();w.lexer=tt;function T(){this.yy={}}return e(T,"Parser"),T.prototype=w,w.Parser=T,new T}();Dt.parser=Dt;var pe=Dt;function kt(t){return t.type==="bar"}e(kt,"isBarPlot");function wt(t){return t.type==="band"}e(wt,"isBandAxisData");function dt(t){return t.type==="linear"}e(dt,"isLinearAxisData");var Et=class{constructor(t){this.parentGroup=t}static{e(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((d,S)=>Math.max(S.length,d),0)*i,height:i};let s={width:0,height:0},a=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i),o=a.node()?.getScreenCTM?.(),x=e((d)=>d&&d>0?d:1,"toScale"),c=x(o?.a),p=x(o?.d);for(let d of t){let S=ks(a,1,d),v=S?S.width/c:d.length*i,E=S?S.height/p:i;s.width=Math.max(s.width,v),s.height=Math.max(s.height,E)}return a.remove(),s}},$t=0.7,Ut=0.2,Gt=class{constructor(t,i,s,a){this.axisConfig=t,this.title=i,this.textDimensionCalculator=s,this.axisThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.normalizedLabelRotationInRad=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.normalizedLabelRotationInRad=this.axisConfig.labelRotation>=-90&&this.axisConfig.labelRotation<=90?this.axisConfig.labelRotation*Math.PI/180:0}static{e(this,"BaseAxis")}setRange(t){if(this.range=t,this.axisPosition==="left"||this.axisPosition==="right")this.boundingRect.height=t[1]-t[0];else this.boundingRect.width=t[1]-t[0];this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map((t)=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){if($t*this.getTickDistance()>this.outerPadding*2)this.outerPadding=Math.floor($t*this.getTickDistance()/2);this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),a=Ut*t.width;this.outerPadding=Math.min(s.width/2,a);let o=s.height;if(this.axisPosition==="bottom"&&this.normalizedLabelRotationInRad!==0)o=Math.max(o,Math.abs(Math.sin(this.normalizedLabelRotationInRad)*s.width)+Math.abs(Math.cos(this.normalizedLabelRotationInRad)*s.height));if(o+=this.axisConfig.labelPadding*2,this.labelTextHeight=s.height,o<=i)i-=o,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,a<=i)i-=a,this.showTitle=!0}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth)i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0;if(this.axisConfig.showLabel){let s=this.getLabelDimension(),a=Ut*t.height;this.outerPadding=Math.min(s.height/2,a);let o=s.width+this.axisConfig.labelPadding*2;if(o<=i)i-=o,this.showLabel=!0}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength)this.showTick=!0,i-=this.axisConfig.tickLength;if(this.axisConfig.showTitle&&this.title){let s=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),a=s.height+this.axisConfig.titlePadding*2;if(this.titleTextHeight=s.height,a<=i)i-=a,this.showTitle=!0}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){if(this.axisPosition==="left"||this.axisPosition==="right")this.calculateSpaceIfDrawnVertical(t);else this.calculateSpaceIfDrawnHorizontally(t);return this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateOffsetByRotation(t){let i=this.normalizedLabelRotationInRad;if(i===0)return 0;return Math.sin(i)*this.getLabelDimension()[t]/2}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(i),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))});if(this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${i},${this.getScaleValue(s)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(s)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]});return t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i)+this.calculateOffsetByRotation("height"),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0)+Math.abs(this.calculateOffsetByRotation("width")),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:this.normalizedLabelRotationInRad*180/Math.PI,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i} L ${this.getScaleValue(s)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel)t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map((i)=>({text:i.toString(),x:this.getScaleValue(i),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+this.axisConfig.titlePadding*2:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))});if(this.showTick){let i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map((s)=>({path:`M ${this.getScaleValue(s)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(s)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}if(this.showTitle)t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]});return t}getDrawableElements(){if(this.axisPosition==="left")return this.getDrawableElementsForLeftAxis();if(this.axisPosition==="right")throw Error("Drawing of right axis is not implemented");if(this.axisPosition==="bottom")return this.getDrawableElementsForBottomAxis();if(this.axisPosition==="top")return this.getDrawableElementsForTopAxis();return[]}},me=class extends Gt{static{e(this,"BandAxis")}constructor(t,i,s,a,o){super(t,a,o,i);this.categories=s,this.scale=Ri().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=Ri().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(0.5),n.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},be=class extends Gt{static{e(this,"LinearAxis")}constructor(t,i,s,a,o){super(t,a,o,i);this.domain=s,this.scale=Kt().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];if(this.axisPosition==="left")t.reverse();this.scale=Kt().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};function Pt(t,i,s,a){let o=new Et(a);if(wt(t))return new me(i,s,t.categories,t.title,o);return new be(i,s,[t.min,t.max],t.title,o)}e(Pt,"getAxis");var ye=class{constructor(t,i,s,a){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=a,this.titleWidth=0,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{e(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),s=Math.max(i.width,t.width),a=i.height+2*this.chartConfig.titlePadding;if(a<=t.height&&this.chartConfig.showTitle&&this.chartData.title)this.boundingRect.width=s,this.boundingRect.height=a,this.titleWidth=i.width,this.showChartTitle=!0;return{width:this.boundingRect.width,height:this.boundingRect.height}}alignTo(t,i){let s=Math.min(this.titleWidth,this.chartConfig.width)/2,a=Math.min(Math.max((t+i)/2,s),this.chartConfig.width-s);this.boundingRect.x=a-s,this.boundingRect.width=s*2}getDrawableElements(){let t=[];if(this.showChartTitle)t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]});return t}};function qt(t,i,s,a){let o=new Et(a);return new ye(o,t,i,s)}e(qt,"getChartTitleComponent");var ke=0.75,we=0.5,Ae=0.35;function Lt(t){return{fontSize:t,markerSize:t*ke,markerSpacing:t*Ae,itemSpacing:t*we}}e(Lt,"getLegendLayout");var Ce=class{constructor(t,i,s,a){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=s,this.chartThemeConfig=a,this.boundingRect={x:0,y:0,width:0,height:0},this.visiblePlots=[]}static{e(this,"ChartLegend")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){if(this.visiblePlots=this.chartConfig.showLegend?this.chartData.plots.filter((d)=>d.title):[],this.visiblePlots.length===0)return this.boundingRect.width=0,this.boundingRect.height=0,{width:0,height:0};let{fontSize:i,markerSize:s,markerSpacing:a,itemSpacing:o}=Lt(this.chartConfig.legendFontSize),x=this.textDimensionCalculator.getMaxDimension(this.visiblePlots.map((d)=>d.title),i),c=this.chartConfig.legendPadding*2+s+a+x.width,p=this.chartConfig.legendPadding*2+this.visiblePlots.length*i+(this.visiblePlots.length-1)*o;if(c<=t.width&&p<=t.height)this.boundingRect.width=c,this.boundingRect.height=p;else this.visiblePlots=[],this.boundingRect.width=0,this.boundingRect.height=0;return{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(this.visiblePlots.length===0)return[];let{fontSize:t,markerSize:i,markerSpacing:s,itemSpacing:a}=Lt(this.chartConfig.legendFontSize),o=t+a,x=this.boundingRect.x+this.chartConfig.legendPadding,c=this.boundingRect.y+this.chartConfig.legendPadding,p=[],d=[];for(let[S,v]of this.visiblePlots.entries())if(kt(v))p.push({x,y:c+S*o,width:i,height:i,fill:v.fill,strokeFill:v.fill,strokeWidth:0});else{let E=c+S*o+i/2;d.push({path:`M ${x},${E} L ${x+i},${E}`,strokeFill:v.strokeFill,strokeWidth:v.strokeWidth})}return[{groupTexts:["legend","markers"],type:"rect",data:p},{groupTexts:["legend","markers"],type:"path",data:d},{groupTexts:["legend","label"],type:"text",data:this.visiblePlots.map((S,v)=>({text:S.title,x:x+i+s,y:c+v*o+i/2,fill:this.chartThemeConfig.legendTextColor,fontSize:t,rotation:0,verticalPos:"middle",horizontalPos:"left"}))}]}};function jt(t,i,s,a){let o=new Et(a);return new Ce(o,t,i,s)}e(jt,"getChartLegendComponent");var Se=class{constructor(t,i,s,a,o){this.plotData=t,this.xAxis=i,this.yAxis=s,this.orientation=a,this.plotIndex=o}static{e(this,"LinePlot")}getDrawableElement(){let t=this.plotData.data.map((a)=>[this.xAxis.getScaleValue(a[0]),this.yAxis.getScaleValue(a[1])]),i;if(this.orientation==="horizontal")i=La().y((a)=>a[0]).x((a)=>a[1])(t);else i=La().x((a)=>a[0]).y((a)=>a[1])(t);if(!i)return[];let s=[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:i,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}];if(this.plotData.pointLabels&&this.plotData.pointLabels.length>0){let x=[];for(let[c,[p,d]]of t.entries()){let S=this.plotData.pointLabels[c];if(!S)continue;if(this.orientation==="horizontal")x.push({x:d+10,y:p,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"left",fontSize:12,rotation:0});else x.push({x:p,y:d-10,text:S,fill:this.plotData.strokeFill,verticalPos:"middle",horizontalPos:"center",fontSize:12,rotation:0})}if(x.length>0)s.push({groupTexts:["plot",`line-plot-${this.plotIndex}`,"labels"],type:"text",data:x})}return s}},Re=class{constructor(t,i,s,a,o,x){this.barData=t,this.boundingRect=i,this.xAxis=s,this.yAxis=a,this.orientation=o,this.plotIndex=x}static{e(this,"BarPlot")}getDrawableElement(){let t=this.barData.data.map((o)=>[this.xAxis.getScaleValue(o[0]),this.yAxis.getScaleValue(o[1])]),i=0.05,s=Math.min(this.xAxis.getAxisOuterPadding()*2,this.xAxis.getTickDistance())*0.95,a=s/2;if(this.orientation==="horizontal")return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map((o)=>({x:this.boundingRect.x,y:o[0]-a,height:s,width:o[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}];return[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map((o)=>({x:o[0]-a,y:o[1],width:s,height:this.boundingRect.y+this.boundingRect.height-o[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},_e=class{constructor(t,i,s){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0}}static{e(this,"BasePlot")}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[i,s]of this.chartData.plots.entries())switch(s.type){case"line":{let a=new Se(s,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break;case"bar":{let a=new Re(s,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...a.getDrawableElement())}break}return t}};function Qt(t,i,s){return new _e(t,i,s)}e(Qt,"getPlotComponent");var Te=class{constructor(t,i,s,a){this.chartConfig=t,this.chartData=i,this.componentStore={title:qt(t,i,s,a),plot:Qt(t,i,s),legend:jt(t,i,s,a),xAxis:Pt(i.xAxis,t.xAxis,{titleColor:s.xAxisTitleColor,labelColor:s.xAxisLabelColor,tickColor:s.xAxisTickColor,axisLineColor:s.xAxisLineColor},a),yAxis:Pt(i.yAxis,t.yAxis,{titleColor:s.yAxisTitleColor,labelColor:s.yAxisLabelColor,tickColor:s.yAxisTickColor,axisLineColor:s.yAxisLineColor},a)}}static{e(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,a=0,o={width:0,height:0},x=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),c=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),p=this.componentStore.plot.calculateSpace({width:x,height:c});if(t-=p.width,i-=p.height,p=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),a=p.height,i-=p.height,this.componentStore.xAxis.setAxisPosition("bottom"),p=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=p.height,this.componentStore.yAxis.setAxisPosition("left"),p=this.componentStore.yAxis.calculateSpace({width:t,height:i}),s=p.width,t-=p.width,o=this.componentStore.legend.calculateSpace({width:t,height:c}),t-=o.width,t>0)x+=t,t=0;if(i>0)c+=i,i=0;if(this.componentStore.plot.calculateSpace({width:x,height:c}),this.componentStore.plot.setBoundingBoxXY({x:s,y:a}),this.componentStore.title.alignTo(s,s+x),this.componentStore.legend.setBoundingBoxXY({x:s+x,y:a+Math.max((c-o.height)/2,0)}),this.componentStore.xAxis.setRange([s,s+x]),this.componentStore.xAxis.setBoundingBoxXY({x:s,y:a+c}),this.componentStore.yAxis.setRange([a,a+c]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some((d)=>kt(d)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,s=0,a=0,o=0,x={width:0,height:0},c=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),p=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),d=this.componentStore.plot.calculateSpace({width:c,height:p});if(t-=d.width,i-=d.height,d=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i}),s=d.height,i-=d.height,this.componentStore.xAxis.setAxisPosition("left"),d=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=d.width,a=d.width,this.componentStore.yAxis.setAxisPosition("top"),d=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=d.height,o=s+d.height,x=this.componentStore.legend.calculateSpace({width:t,height:p}),t-=x.width,t>0)c+=t,t=0;if(i>0)p+=i,i=0;if(this.componentStore.plot.calculateSpace({width:c,height:p}),this.componentStore.plot.setBoundingBoxXY({x:a,y:o}),this.componentStore.title.alignTo(a,a+c),this.componentStore.legend.setBoundingBoxXY({x:a+c,y:o+Math.max((p-x.height)/2,0)}),this.componentStore.yAxis.setRange([a,a+c]),this.componentStore.yAxis.setBoundingBoxXY({x:a,y:s}),this.componentStore.xAxis.setRange([o,o+p]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:o}),this.chartData.plots.some((S)=>kt(S)))this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){if(this.chartConfig.chartOrientation==="horizontal")this.calculateHorizontalSpace();else this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis);for(let i of Object.values(this.componentStore))t.push(...i.getDrawableElements());return t}},De=class{static{e(this,"XYChartBuilder")}static build(t,i,s,a){return new Te(t,i,s,a).getDrawableElement()}},xt=0,Zt,ft=Bt(),pt=Mt(),b=zt(),vt=pt.plotColorPalette.split(",").map((t)=>t.trim()),At=!1,It=!1;function Mt(){let t=Me(),i=k();return K(t.xyChart,i.themeVariables.xyChart)}e(Mt,"getChartDefaultThemeConfig");function Bt(){let t=k();return K(F.xyChart,t.xyChart)}e(Bt,"getChartDefaultConfig");function zt(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}e(zt,"getChartDefaultData");function ct(t){let i=k();return q(t.trim(),i)}e(ct,"textSanitizer");function Jt(t){Zt=t}e(Jt,"setTmpSVGG");function te(t){if(t==="horizontal")ft.chartOrientation="horizontal";else ft.chartOrientation="vertical"}e(te,"setOrientation");function ee(t){b.xAxis.title=ct(t.text)}e(ee,"setXAxisTitle");function Ot(t,i){b.xAxis={type:"linear",title:b.xAxis.title,min:t,max:i},At=!0}e(Ot,"setXAxisRangeData");function ie(t){b.xAxis={type:"band",title:b.xAxis.title,categories:t.map((i)=>ct(i.text))},At=!0}e(ie,"setXAxisBand");function se(t){b.yAxis.title=ct(t.text)}e(se,"setYAxisTitle");function ae(t,i){b.yAxis={type:"linear",title:b.yAxis.title,min:t,max:i},It=!0}e(ae,"setYAxisRangeData");function ne(t){let i=Math.min(...t),s=Math.max(...t),a=dt(b.yAxis)?b.yAxis.min:1/0,o=dt(b.yAxis)?b.yAxis.max:-1/0;b.yAxis={type:"linear",title:b.yAxis.title,min:Math.min(a,i),max:Math.max(o,s)}}e(ne,"setYAxisRangeFromPlotData");function Vt(t){let i=[];if(t.length===0)return i;if(!At){let s=dt(b.xAxis)?b.xAxis.min:1/0,a=dt(b.xAxis)?b.xAxis.max:-1/0;Ot(Math.min(s,1),Math.max(a,t.length))}if(wt(b.xAxis)&&t.length>b.xAxis.categories.length)t=t.slice(0,b.xAxis.categories.length);if(!It)ne(t);if(wt(b.xAxis))i=b.xAxis.categories.map((s,a)=>[s,t[a]]);if(dt(b.xAxis)){let s=b.xAxis.min,a=b.xAxis.max;if(t.length===1)i=[[`${s}`,t[0]]];else{let o=(a-s)/(t.length-1);i=t.map((x,c)=>[`${s+c*o}`,x])}}return i}e(Vt,"transformDataWithoutCategory");function Wt(t){return vt[t===0?0:t%vt.length]}e(Wt,"getPlotColorFromPalette");function oe(t,i){let s=i.map((c)=>c.value),a=i.map((c)=>c.label?ct(c.label):""),o=Vt(s),x=a.some((c)=>c!=="");b.plots.push({type:"line",title:ct(t.text),strokeFill:Wt(xt),strokeWidth:2,data:o,...x?{pointLabels:a}:{}}),xt++}e(oe,"setLineData");function re(t,i){let s=i.map((o)=>o.value),a=Vt(s);b.plots.push({type:"bar",title:ct(t.text),fill:Wt(xt),data:a}),xt++}e(re,"setBarData");function he(){if(b.plots.length===0)throw Error("No Plot to render, please provide a plot with some data");return b.title=D(),De.build(ft,b,pt,Zt)}e(he,"getDrawableElem");function le(){return pt}e(le,"getChartThemeConfig");function ce(){return ft}e(ce,"getChartConfig");function ge(){return b}e(ge,"getXYChartData");var Pe=e(function(){A(),xt=0,ft=Bt(),b=zt(),pt=Mt(),vt=pt.plotColorPalette.split(",").map((t)=>t.trim()),At=!1,It=!1},"clear"),Le={getDrawableElem:he,clear:Pe,setAccTitle:L,getAccTitle:I,setDiagramTitle:O,getDiagramTitle:D,getAccDescription:M,setAccDescription:R,setOrientation:te,setXAxisTitle:ee,setXAxisRangeData:Ot,setXAxisBand:ie,setYAxisTitle:se,setYAxisRangeData:ae,setLineData:oe,setBarData:re,setTmpSVGG:Jt,getChartThemeConfig:le,getChartConfig:ce,getXYChartData:ge},ve=e((t,i,s,a)=>{let o=a.db,x=o.getChartThemeConfig(),c=o.getChartConfig(),p=o.getXYChartData().plots[0].data.map((y)=>y[1]);function d(y){return y==="top"?"text-before-edge":"middle"}e(d,"getDominantBaseLine");function S(y){return y==="left"?"start":y==="right"?"end":"middle"}e(S,"getTextAnchor");function v(y){return`translate(${y.x}, ${y.y}) rotate(${y.rotation||0})`}e(v,"getTextTransformation"),n.debug(`Rendering xychart chart
|
|
7
|
+
`+t);let E=Y(i),U=E.append("g").attr("class","main"),et=U.append("rect").attr("width",c.width).attr("height",c.height).attr("class","background");j(E,c.height,c.width,!0),E.attr("viewBox",`0 0 ${c.width} ${c.height}`),et.attr("fill",x.backgroundColor),o.setTmpSVGG(E.append("g").attr("class","mermaid-tmp-group"));let it=o.getDrawableElem(),X={};function J(y){let N=U,g="";for(let[W]of y.entries()){let H=U;if(W>0&&X[g])H=X[g];if(g+=y[W],N=X[g],!N)N=X[g]=H.append("g").attr("class",y[W])}return N}e(J,"getGroup");for(let y of it){if(y.data.length===0)continue;let N=J(y.groupTexts);switch(y.type){case"rect":if(N.selectAll("rect").data(y.data).enter().append("rect").attr("x",(g)=>g.x).attr("y",(g)=>g.y).attr("width",(g)=>g.width).attr("height",(g)=>g.height).attr("fill",(g)=>g.fill).attr("stroke",(g)=>g.strokeFill).attr("stroke-width",(g)=>g.strokeWidth),c.showDataLabel){let g=c.showDataLabelOutsideBar;if(c.chartOrientation==="horizontal"){let W=function(w,tt){let{data:T,label:G}=w;return tt*G.length*H<=T.width-C};var st=W;e(W,"fitsHorizontally");let H=0.7,C=10,ot=y.data.map((w,tt)=>({data:w,label:p[tt].toString()})).filter((w)=>w.data.width>0&&w.data.height>0),z=ot.map((w)=>{let{data:tt}=w,T=tt.height*0.7;while(!W(w,T)&&T>0)T-=1;return T}),gt=Math.floor(Math.min(...z)),P=e((w)=>{if(g)return w.data.x+w.data.width+C;else return w.data.x+w.data.width-C},"determineLabelXPosition");N.selectAll("text").data(ot).enter().append("text").attr("x",P).attr("y",(w)=>w.data.y+w.data.height/2).attr("text-anchor",g?"start":"end").attr("dominant-baseline","middle").attr("fill",x.dataLabelColor).attr("font-size",`${gt}px`).text((w)=>w.label)}else{let W=function(P,w,tt){let{data:T,label:G}=P,h=0.7,l=w*G.length*0.7,u=T.x+T.width/2,f=u-l/2,_=u+l/2,r=f>=T.x&&_<=T.x+T.width,rt=T.y+tt+w<=T.y+T.height;return r&&rt};var at=W;e(W,"fitsInBar");let H=10,C=y.data.map((P,w)=>({data:P,label:p[w].toString()})).filter((P)=>P.data.width>0&&P.data.height>0),ot=C.map((P)=>{let{data:w,label:tt}=P,T=w.width/(tt.length*0.7);while(!W(P,T,H)&&T>0)T-=1;return T}),z=Math.floor(Math.min(...ot)),gt=e((P)=>{if(g)return P.data.y-H;else return P.data.y+H},"determineLabelYPosition");N.selectAll("text").data(C).enter().append("text").attr("x",(P)=>P.data.x+P.data.width/2).attr("y",gt).attr("text-anchor","middle").attr("dominant-baseline",g?"auto":"hanging").attr("fill",x.dataLabelColor).attr("font-size",`${z}px`).text((P)=>P.label)}}break;case"text":N.selectAll("text").data(y.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",(g)=>g.fill).attr("font-size",(g)=>g.fontSize).attr("dominant-baseline",(g)=>d(g.verticalPos)).attr("text-anchor",(g)=>S(g.horizontalPos)).attr("transform",(g)=>v(g)).text((g)=>g.text);break;case"path":N.selectAll("path").data(y.data).enter().append("path").attr("d",(g)=>g.path).attr("fill",(g)=>g.fill?g.fill:"none").attr("stroke",(g)=>g.strokeFill).attr("stroke-width",(g)=>g.strokeWidth);break}}},"draw"),Ee={draw:ve},$e={parser:pe,db:Le,renderer:Ee};export{$e as diagram};
|