1import{aD as Gt,s as Wt,g as Kt,q as Ht,p as Xt,a as Yt,b as Zt,_ as w,D as wt,I as Jt,d as ot,as as Qt,V as $t,W as te,X as ee,e as ne,z as se,F as ie,G as oe}from"./mermaid.core.CFYjPDOT.js";const kt=(t,e)=>Gt(t,"a",-e),_t=1e-10;function st(t,e){const n=ae(t),s=n.filter(e=>re(e,t));let i=0,r=0;const o=[];if(s.length>1){const e=Et(s);for(let t=0;t<s.length;++t){const n=s[t];n.angle=Math.atan2(n.x-e.x,n.y-e.y)}s.sort((t,e)=>e.angle-t.angle);let n=s[s.length-1];for(let e=0;e<s.length;++e){const a=s[e];r+=(n.x+a.x)*(a.y-n.y);const l={x:(a.x+n.x)/2,y:(a.y+n.y)/2};let c=null;for(let e=0;e<a.parentIndex.length;++e)if(n.parentIndex.includes(a.parentIndex[e])){const s=t[a.parentIndex[e]],i=Math.atan2(a.x-s.x,a.y-s.y),r=Math.atan2(n.x-s.x,n.y-s.y);let o=r-i;o<0&&(o+=2*Math.PI);const h=r-o/2;let u=q(l,{x:s.x+s.radius*Math.sin(h),y:s.y+s.radius*Math.cos(h)});u>2*s.radius&&(u=2*s.radius),(null==c||c.width>u)&&(c={circle:s,width:u,p1:a,p2:n,large:u>s.radius,sweep:!0})}null!=c&&(o.push(c),i+=lt(c.circle.radius,c.width),n=a)}}else{let e=t[0];for(let n=1;n<t.length;++n)t[n].radius<e.radius&&(e=t[n]);let n=!1;for(let s=0;s<t.length;++s)if(q(t[s],e)>Math.abs(e.radius-t[s].radius)){n=!0;break}n?i=r=0:(i=e.radius*e.radius*Math.PI,o.push({circle:e,p1:{x:e.x,y:e.y+e.radius},p2:{x:e.x-_t,y:e.y+e.radius},width:2*e.radius,large:!0,sweep:!0}))}return r/=2,e&&(e.area=i+r,e.arcArea=i,e.polygonArea=r,e.arcs=o,e.innerPoints=s,e.intersectionPoints=n),i+r}function re(t,e){return e.every(e=>q(t,e)<e.radius+_t)}function ae(t){const e=[];for(let n=0;n<t.length;++n)for(let s=n+1;s<t.length;++s){const i=Tt(t[n],t[s]);for(const t of i)t.parentIndex=[n,s],e.push(t)}return e}function lt(t,e){return t*t*Math.acos(1-e/t)-(t-e)*Math.sqrt(e*(2*t-e))}function q(t,e){return Math.sqrt((t.x-e.x)*(t.x-e.x)+(t.y-e.y)*(t.y-e.y))}function xt(t,e,n){if(n>=t+e)return 0;if(n<=Math.abs(t-e))return Math.PI*Math.min(t,e)*Math.min(t,e);const s=e-(n*n-t*t+e*e)/(2*n);return lt(t,t-(n*n-e*e+t*t)/(2*n))+lt(e,s)}function Tt(t,e){const n=q(t,e),s=t.radius,i=e.radius;if(n>=s+i||n<=Math.abs(s-i))return[];const r=(s*s-i*i+n*n)/(2*n),o=Math.sqrt(s*s-r*r),a=t.x+r*(e.x-t.x)/n,l=t.y+r*(e.y-t.y)/n,c=-(e.y-t.y)*(o/n),h=-(e.x-t.x)*(o/n);return[{x:a+c,y:l-h},{x:a-c,y:l+h}]}function Et(t){const e={x:0,y:0};for(const n of t)e.x+=n.x,e.y+=n.y;return e.x/=t.length,e.y/=t.length,e}function le(t,e,n,s){const i=(s=s||{}).maxIterations||100,r=s.tolerance||1e-10,o=t(e),a=t(n);let l=n-e;if(o*a>0)throw"Initial bisect points must have opposite signs";if(0===o)return e;if(0===a)return n;for(let n=0;n<i;++n){l/=2;const n=e+l,s=t(n);if(s*o>=0&&(e=n),Math.abs(l)<r||0===s)return n}return e+l}function ct(t){const e=new Array(t);for(let n=0;n<t;++n)e[n]=0;return e}function Mt(t,e){return ct(t).map(()=>ct(e))}function $(t,e){let n=0;for(let s=0;s<t.length;++s)n+=t[s]*e[s];return n}function ut(t){return Math.sqrt($(t,t))}function ft(t,e,n){for(let s=0;s<e.length;++s)t[s]=e[s]*n}function J(t,e,n,s,i){for(let r=0;r<t.length;++r)t[r]=e*n[r]+s*i[r]}function zt(t,e,n){const s=(n=n||{}).maxIterations||200*e.length,i=n.nonZeroDelta||1.05,r=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,a=n.minErrorDelta||1e-5,l=void 0!==n.rho?n.rho:1,c=void 0!==n.chi?n.chi:2,h=void 0!==n.psi?n.psi:-.5,u=void 0!==n.sigma?n.sigma:.5;let f;const d=e.length,y=new Array(d+1);y[0]=e,y[0].fx=t(e),y[0].id=0;for(let n=0;n<d;++n){const s=e.slice();s[n]=s[n]?s[n]*i:r,y[n+1]=s,y[n+1].fx=t(s),y[n+1].id=n+1}function g(t){for(let e=0;e<t.length;e++)y[d][e]=t[e];y[d].fx=t.fx}const x=(t,e)=>t.fx-e.fx,p=e.slice(),m=e.slice(),b=e.slice(),w=e.slice();for(let e=0;e<s;++e){if(y.sort(x),n.history){const t=y.map(t=>{const e=t.slice();return e.fx=t.fx,e.id=t.id,e});t.sort((t,e)=>t.id-e.id),n.history.push({x:y[0].slice(),fx:y[0].fx,simplex:t})}f=0;for(let t=0;t<d;++t)f=Math.max(f,Math.abs(y[0][t]-y[1][t]));if(Math.abs(y[0].fx-y[d].fx)<o&&f<a)break;for(let t=0;t<d;++t){p[t]=0;for(let e=0;e<d;++e)p[t]+=y[e][t];p[t]/=d}const e=y[d];if(J(m,1+l,p,-l,e),m.fx=t(m),m.fx<y[0].fx)J(w,1+c,p,-c,e),w.fx=t(w),w.fx<m.fx?g(w):g(m);else if(m.fx>=y[d-1].fx){let n=!1;if(m.fx>e.fx?(J(b,1+h,p,-h,e),b.fx=t(b),b.fx<e.fx?g(b):n=!0):(J(b,1-h*l,p,h*l,e),b.fx=t(b),b.fx<m.fx?g(b):n=!0),n){if(u>=1)break;for(let e=1;e<y.length;++e)J(y[e],1-u,y[0],u,y[e]),y[e].fx=t(y[e])}}else g(m)}return y.sort(x),{fx:y[0].fx,x:y[0]}}function ce(t,e,n,s,i,r,o){const a=n.fx,l=$(n.fxprime,e);let c=a,h=a,u=l,f=0;function d(h,f,d){for(let y=0;y<16;++y)if(i=(h+f)/2,J(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=$(s.fxprime,e),c>a+r*i*l||c>=d)f=i;else{if(Math.abs(u)<=-o*l)return i;u*(f-h)>=0&&(f=h),h=i,d=c}return 0}i=i||1,r=r||1e-6,o=o||.1;for(let y=0;y<10;++y){if(J(s.x,1,n.x,i,e),c=s.fx=t(s.x,s.fxprime),u=$(s.fxprime,e),c>a+r*i*l||y&&c>=h)return d(f,i,h);
1if(Math.abs(u)<=-o*l)return i;if(u>=0)return d(i,f,c);h=c,f=i,i*=2}return i}function ue(t,e,n){let s={x:e.slice(),fx:0,fxprime:e.slice()},i={x:e.slice(),fx:0,fxprime:e.slice()};const r=e.slice();let o,a,l,c=1;l=(n=n||{}).maxIterations||20*e.length,s.fx=t(s.x,s.fxprime),o=s.fxprime.slice(),ft(o,s.fxprime,-1);for(let e=0;e<l;++e){if(c=ce(t,o,s,i,c),n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),c){J(r,1,i.fxprime,-1,s.fxprime);const t=$(s.fxprime,s.fxprime);J(o,Math.max(0,$(r,i.fxprime)/t),o,-1,i.fxprime),a=s,s=i,i=a}else ft(o,s.fxprime,-1);if(ut(s.fxprime)<=1e-5)break}return n.history&&n.history.push({x:s.x.slice(),fx:s.fx,fxprime:s.fxprime.slice(),alpha:c}),s}function At(t,e={}){e.maxIterations=e.maxIterations||500;const n=e.initialLayout||ge,s=e.lossFunction||tt,i=fe(t,e),r=n(i,e),o=Object.keys(r),a=[];for(const t of o)a.push(r[t].x),a.push(r[t].y);const l=zt(t=>{const e={};for(let n=0;n<o.length;++n){const s=o[n];e[s]={x:t[2*n],y:t[2*n+1],radius:r[s].radius}}return s(e,i)},a,e).x;for(let t=0;t<o.length;++t){const e=o[t];r[e].x=l[2*t],r[e].y=l[2*t+1]}return r}const Dt=1e-10;function ht(t,e,n){return Math.min(t,e)*Math.min(t,e)*Math.PI<=n+Dt?Math.abs(t-e):le(s=>xt(t,e,s)-n,0,t+e)}function fe(t,e={}){const n=e.distinct,s=t.map(t=>Object.assign({},t));function i(t){return t.join(";")}if(n){const t=new Map;for(const e of s)for(let n=0;n<e.sets.length;n++){const s=String(e.sets[n]);t.set(s,e.size+(t.get(s)||0));for(let i=n+1;i<e.sets.length;i++){const n=String(e.sets[i]),r=`${s};${n}`,o=`${n};${s}`;t.set(r,e.size+(t.get(r)||0)),t.set(o,e.size+(t.get(o)||0))}}for(const e of s)e.sets.length<3&&(e.size=t.get(i(e.sets)))}const r=[],o=new Set;for(const t of s)if(1===t.sets.length)r.push(t.sets[0]);else if(2===t.sets.length){const e=t.sets[0],n=t.sets[1];o.add(i(t.sets)),o.add(i([n,e]))}r.sort((t,e)=>t===e?0:t<e?-1:1);for(let t=0;t<r.length;++t){const e=r[t];for(let n=t+1;n<r.length;++n){const t=r[n];o.has(i([e,t]))||s.push({sets:[e,t],size:0})}}return s}function he(t,e,n){const s=Mt(e.length,e.length),i=Mt(e.length,e.length);return t.filter(t=>2===t.sets.length).forEach(t=>{const r=n[t.sets[0]],o=n[t.sets[1]],a=ht(Math.sqrt(e[r].size/Math.PI),Math.sqrt(e[o].size/Math.PI),t.size);s[r][o]=s[o][r]=a;let l=0;t.size+1e-10>=Math.min(e[r].size,e[o].size)?l=1:t.size<=1e-10&&(l=-1),i[r][o]=i[o][r]=l}),{distances:s,constraints:i}}function de(t,e,n,s){for(let t=0;t<e.length;++t)e[t]=0;let i=0;for(let r=0;r<n.length;++r){const o=t[2*r],a=t[2*r+1];for(let l=r+1;l<n.length;++l){const c=t[2*l],h=t[2*l+1],u=n[r][l],f=s[r][l],d=(c-o)*(c-o)+(h-a)*(h-a),y=Math.sqrt(d),g=d-u*u;f>0&&y<=u||f<0&&y>=u||(i+=2*g*g,e[2*r]+=4*g*(o-c),e[2*r+1]+=4*g*(a-h),e[2*l]+=4*g*(c-o),e[2*l+1]+=4*g*(h-a))}}return i}function ge(t,e={}){let n=ye(t,e);const s=e.lossFunction||tt;if(t.length>=8){const i=xe(t,e);s(i,t)+1e-8<s(n,t)&&(n=i)}return n}function xe(t,e={}){const n=e.restarts||10,s=[],i={};for(const e of t)1===e.sets.length&&(i[e.sets[0]]=s.length,s.push(e));let{distances:r,constraints:o}=he(t,s,i);const a=ut(r.map(ut))/r.length;r=r.map(t=>t.map(t=>t/a));const l=(t,e)=>de(t,e,r,o);let c=null;for(let t=0;t<n;++t){const t=ue(l,ct(2*r.length).map(Math.random),e);(!c||t.fx<c.fx)&&(c=t)}const h=c.x,u={};for(let t=0;t<s.length;++t){const e=s[t];u[e.sets[0]]={x:h[2*t]*a,y:h[2*t+1]*a,radius:Math.sqrt(e.size/Math.PI)}}if(e.history)for(const t of e.history)ft(t.x,a);return u}function ye(t,e){const n=e&&e.lossFunction?e.lossFunction:tt,s={},i={};for(const e of t)if(1===e.sets.length){const t=e.sets[0];s[t]={x:1e10,y:1e10,rowid:s.length,size:e.size,radius:Math.sqrt(e.size/Math.PI)},i[t]=[]}t=t.filter(t=>2===t.sets.length);for(const e of t){let t=null!=e.weight?e.weight:1;const n=e.sets[0],r=e.sets[1];e.size+Dt>=Math.min(s[n].size,s[r].size)&&(t=0),i[n].push({set:r,size:e.size,weight:t}),i[r].push({set:n,size:e.size,weight:t})}const r=[];function o(t,e){return e.size-t.size}
1Object.keys(i).forEach(t=>{let e=0;for(let n=0;n<i[t].length;++n)e+=i[t][n].size*i[t][n].weight;r.push({set:t,size:e})}),r.sort(o);const a={};function l(t){return t.set in a}function c(t,e){s[e].x=t.x,s[e].y=t.y,a[e]=!0}c({x:0,y:0},r[0].set);for(let e=1;e<r.length;++e){const a=r[e].set,u=i[a].filter(l),f=s[a];if(u.sort(o),0===u.length)throw"ERROR: missing pairwise overlap information";const d=[];for(var h=0;h<u.length;++h){const t=s[u[h].set],e=ht(f.radius,t.radius,u[h].size);d.push({x:t.x+e,y:t.y}),d.push({x:t.x-e,y:t.y}),d.push({y:t.y+e,x:t.x}),d.push({y:t.y-e,x:t.x});for(let n=h+1;n<u.length;++n){const i=s[u[n].set],r=ht(f.radius,i.radius,u[n].size),o=Tt({x:t.x,y:t.y,radius:e},{x:i.x,y:i.y,radius:r});d.push(...o)}}let y=1e50,g=d[0];for(const e of d){s[a].x=e.x,s[a].y=e.y;const i=n(s,t);i<y&&(y=i,g=e)}c(g,a)}return s}function tt(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=xt(n.radius,i.radius,q(n,i))}else e=st(s.sets.map(e=>t[e]));n+=(null!=s.weight?s.weight:1)*(e-s.size)*(e-s.size)}return n}function Rt(t,e){let n=0;for(const s of e){if(1===s.sets.length)continue;let e;if(2===s.sets.length){const n=t[s.sets[0]],i=t[s.sets[1]];e=xt(n.radius,i.radius,q(n,i))}else e=st(s.sets.map(e=>t[e]));const i=null!=s.weight?s.weight:1,r=Math.log((e+1)/(s.size+1));n+=i*r*r}return n}function pe(t,e,n){if(null==n?t.sort((t,e)=>e.radius-t.radius):t.sort(n),t.length>0){const e=t[0].x,n=t[0].y;for(const s of t)s.x-=e,s.y-=n}if(2===t.length&&q(t[0],t[1])<Math.abs(t[1].radius-t[0].radius)&&(t[1].x=t[0].x+t[0].radius-t[1].radius-1e-10,t[1].y=t[0].y),t.length>1){const n=Math.atan2(t[1].x,t[1].y)-e,s=Math.cos(n),i=Math.sin(n);for(const e of t){const t=e.x,n=e.y;e.x=s*t-i*n,e.y=i*t+s*n}}if(t.length>2){let n=Math.atan2(t[2].x,t[2].y)-e;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){const e=t[1].y/(1e-10+t[1].x);for(const n of t){var s=(n.x+e*n.y)/(1+e*e);n.x=2*s-n.x,n.y=2*s*e-n.y}}}}function me(t){function e(t){return t.parent!==t&&(t.parent=e(t.parent)),t.parent}function n(t,n){const s=e(t),i=e(n);s.parent=i}t.forEach(t=>{t.parent=t});for(let e=0;e<t.length;++e)for(let s=e+1;s<t.length;++s){const i=t[e].radius+t[s].radius;q(t[e],t[s])+1e-10<i&&n(t[s],t[e])}const s=new Map;for(let n=0;n<t.length;++n){const i=e(t[n]).parent.setid;s.has(i)||s.set(i,[]),s.get(i).push(t[n])}return t.forEach(t=>{delete t.parent}),Array.from(s.values())}function dt(t){const e=e=>({max:t.reduce((t,n)=>Math.max(t,n[e]+n.radius),Number.NEGATIVE_INFINITY),min:t.reduce((t,n)=>Math.min(t,n[e]-n.radius),Number.POSITIVE_INFINITY)});return{xRange:e("x"),yRange:e("y")}}function Ct(t,e,n){null==e&&(e=Math.PI/2);let s=Ft(t).map(t=>Object.assign({},t));const i=me(s);for(const t of i){pe(t,e,n);const s=dt(t);t.size=(s.xRange.max-s.xRange.min)*(s.yRange.max-s.yRange.min),t.bounds=s}i.sort((t,e)=>e.size-t.size),s=i[0];let r=s.bounds;const o=(r.xRange.max-r.xRange.min)/50;function a(t,e,n){if(!t)return;const i=t.bounds;let a,l;if(e)a=r.xRange.max-i.xRange.min+o;else{a=r.xRange.max-i.xRange.max;const t=(i.xRange.max-i.xRange.min)/2-(r.xRange.max-r.xRange.min)/2;t<0&&(a+=t)}if(n)l=r.yRange.max-i.yRange.min+o;else{l=r.yRange.max-i.yRange.max;const t=(i.yRange.max-i.yRange.min)/2-(r.yRange.max-r.yRange.min)/2;t<0&&(l+=t)}for(const e of t)e.x+=a,e.y+=l,s.push(e)}let l=1;for(;l<i.length;)a(i[l],!0,!1),a(i[l+1],!1,!0),a(i[l+2],!0,!0),l+=3,r=dt(s);return Ot(s)}function Nt(t,e,n,s,i){const r=Ft(t);e-=2*s,n-=2*s;const{xRange:o,yRange:a}=dt(r);if(o.max===o.min||a.max===a.min)return console.log("not scaling solution: zero size detected"),t;let l,c;if(i){const t=2*Math.sqrt(i/Math.PI);l=e/t,c=n/t}else l=e/(o.max-o.min),c=n/(a.max-a.min);const h=Math.min(c,l),u=(e-(o.max-o.min)*h)/2,f=(n-(a.max-a.min)*h)/2;return Ot(r.map(t=>({radius:h*t.radius,x:s+u+(t.x-o.min)*h,y:s+f+(t.y-a.min)*h,setid:t.setid})))}function Ot(t){const e={};for(const n of t)e[n.setid]=n;return e}function Ft(t){return Object.keys(t).map(e=>Object.assign(t[e],{setid:e}))}function be(t={}){let e=!1,n=600,s=350,i=15,r=1e3,o=Math.PI/2,a=!0,l=null,c=!0,h=!0,u=null,f=null,d=!1,y=null,g=!(!t||!t.symmetricalTextCentre)&&t.symmetricalTextCentre,x={},p=t&&t.colourScheme?t.colourScheme:t&&t.colorScheme?t.colorScheme:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],m=0,b=function(t){if(t in x)return x[t];var e=x[t]=p[m];return m+=1,m>
1=p.length&&(m=0),e},w=At,v=tt;function I(x){let p=x.datum();const m=new Set;p.forEach(t=>{0==t.size&&1==t.sets.length&&m.add(t.sets[0])}),p=p.filter(t=>!t.sets.some(t=>m.has(t)));let I={},M={};if(p.length>0){let t=w(p,{lossFunction:v,distinct:d});a&&(t=Ct(t,o,f)),I=Nt(t,n,s,i,l),M=jt(I,p,g)}const k={};function _(t){return t.sets in k?k[t.sets]:1==t.sets.length?""+t.sets[0]:void 0}p.forEach(t=>{t.label&&(k[t.sets]=t.label)}),x.selectAll("svg").data([I]).enter().append("svg");const S=x.select("svg");e?S.attr("viewBox",`0 0 ${n} ${s}`):S.attr("width",n).attr("height",s);const E={};let T=!1;function z(t){return e=>St(t.sets.map(t=>{let i=E[t],r=I[t];return i||(i={x:n/2,y:s/2,radius:1}),r||(r={x:n/2,y:s/2,radius:1}),{x:i.x*(1-e)+r.x*e,y:i.y*(1-e)+r.y*e,radius:i.radius*(1-e)+r.radius*e}}),y)}S.selectAll(".venn-area path").each(function(t){const e=this.getAttribute("d");1==t.sets.length&&e&&!d&&(T=!0,E[t.sets[0]]=ke(e))});const A=S.selectAll(".venn-area").data(p,t=>t.sets),R=A.enter().append("g").attr("class",t=>`venn-area venn-${1==t.sets.length?"circle":"intersection"}${t.colour||t.color?" venn-coloured":""}`).attr("data-venn-sets",t=>t.sets.join("_")),D=R.append("path"),N=R.append("text").attr("class","label").text(t=>_(t)).attr("text-anchor","middle").attr("dy",".35em").attr("x",n/2).attr("y",s/2);function O(t){return"function"==typeof t.transition?t.transition("venn").duration(r):t}h&&(D.style("fill-opacity","0").filter(t=>1==t.sets.length).style("fill",t=>t.colour?t.colour:t.color?t.color:b(t.sets)).style("fill-opacity",".25"),N.style("fill",e=>e.colour||e.color?"#FFF":t.textFill?t.textFill:1==e.sets.length?b(e.sets):"#444"));let F=x;T&&"function"==typeof F.transition?(F=O(x),F.selectAll("path").attrTween("d",z)):F.selectAll("path").attr("d",t=>St(t.sets.map(t=>I[t])),y);const $=F.selectAll("text").filter(t=>t.sets in M).text(t=>_(t)).attr("x",t=>Math.floor(M[t.sets].x)).attr("y",t=>Math.floor(M[t.sets].y));c&&(T?"on"in $?$.on("end",rt(I,_)):$.each("end",rt(I,_)):$.each(rt(I,_)));const C=O(A.exit()).remove();"function"==typeof A.transition&&C.selectAll("path").attrTween("d",z);const P=C.selectAll("text").attr("x",n/2).attr("y",s/2);return null!==u&&(N.style("font-size","0px"),$.style("font-size",u),P.style("font-size","0px")),{circles:I,textCentres:M,nodes:A,enter:R,update:F,exit:C}}return I.wrap=function(t){return arguments.length?(c=t,I):c},I.useViewBox=function(){return e=!0,I},I.width=function(t){return arguments.length?(n=t,I):n},I.height=function(t){return arguments.length?(s=t,I):s},I.padding=function(t){return arguments.length?(i=t,I):i},I.distinct=function(t){return arguments.length?(d=t,I):d},I.colours=function(t){return arguments.length?(b=t,I):b},I.colors=function(t){return arguments.length?(b=t,I):b},I.fontSize=function(t){return arguments.length?(u=t,I):u},I.round=function(t){return arguments.length?(y=t,I):y},I.duration=function(t){return arguments.length?(r=t,I):r},I.layoutFunction=function(t){return arguments.length?(w=t,I):w},I.normalize=function(t){return arguments.length?(a=t,I):a},I.scaleToFit=function(t){return arguments.length?(l=t,I):l},I.styled=function(t){return arguments.length?(h=t,I):h},I.orientation=function(t){return arguments.length?(o=t,I):o},I.orientationOrder=function(t){return arguments.length?(f=t,I):f},I.lossFunction=function(t){return arguments.length?(v="default"===t?tt:"logRatio"===t?Rt:t,I):v},I}function rt(t,e){return function(n){const s=this,i=t[n.sets[0]].radius||50,r=e(n)||"",o=r.split(/\s+/).reverse(),a=(r.length+o.length)/3;let l=o.pop(),c=[l],h=0;s.textContent=null;const u=[];function f(t){const e=s.ownerDocument.createElementNS(s.namespaceURI,"tspan");return e.textContent=t,u.push(e),s.append(e),e}let d=f(l);for(;l=o.pop(),l;){c.push(l);const t=c.join(" ");d.textContent=t,t.length>a&&d.getComputedTextLength()>i&&(c.pop(),d.textContent=c.join(" "),c=[l],d=f(l),h++)}const y=.35-1.1*h/2,g=s.getAttribute("x"),x=s.getAttribute("y");u.forEach((t,e)=>{t.setAttribute("x",g),t.setAttribute("y",x),t.setAttribute("dy",`${y+1.1*e}em`)})}}function at(t,e,n){let s=e[0].radius-q(e[0],t);for(let n=1;n<e.length;++n){const i=e[n].radius-q(e[n],t);i<=s&&(s=i)}for(let e=0;e<n.length;++e){const i=q(n[e],t)-n[e].radius;i<=s&&(s=i)}return s}function Lt(t,e,n){const s=[];for(const e of t)s.push({x:e.x,y:e.y}),s.push({x:e.x+e.radius/2,y:e.y}),s.push({x:e.x-e.radius/2,y:e.y}),s.push({x:e.x,y:e.y+e.radius/2}),s.push({x:e.x,y:e.y-e.radius/2});let i=s[0],r=at(s[0],t,e);for(let n=1;n<s.length;++n){const o=at(s[n],t,e);o>=r&&(i=s[n],r=o)}const o=zt(n=>-1*at({x:n[0],y:n[1]},t,e),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,a={x:n?0:o[0],y:o[1]};let l=!0;for(const e of t)if(q(a,e)>
1e.radius){l=!1;break}for(const t of e)if(q(a,t)<t.radius){l=!1;break}if(l)return a;if(1==t.length)return{x:t[0].x,y:t[0].y};const c={};return st(t,c),0===c.arcs.length?{x:0,y:-1e3,disjoint:!0}:1==c.arcs.length?{x:c.arcs[0].circle.x,y:c.arcs[0].circle.y}:e.length?Lt(t,[]):Et(c.arcs.map(t=>t.p1))}function ve(t){const e={},n=Object.keys(t);for(const t of n)e[t]=[];for(let s=0;s<n.length;s++){const i=n[s],r=t[i];for(let o=s+1;o<n.length;++o){const s=n[o],a=t[s],l=q(r,a);l+a.radius<=r.radius+1e-10?e[s].push(i):l+r.radius<=a.radius+1e-10&&e[i].push(s)}}return e}function jt(t,e,n){const s={},i=ve(t);for(let r=0;r<e.length;++r){const o=e[r].sets,a={},l={};for(let t=0;t<o.length;++t){a[o[t]]=!0;const e=i[o[t]];for(let t=0;t<e.length;++t)l[e[t]]=!0}const c=[],h=[];for(let e in t)e in a?c.push(t[e]):e in l||h.push(t[e]);const u=Lt(c,h,n);s[o]=u,u.disjoint&&e[r].size>0&&console.log("WARNING: area "+o+" not represented on screen")}return s}function Ie(t,e,n){const s=[];return s.push("\nM",t,e),s.push("\nm",-n,0),s.push("\na",n,n,0,1,0,2*n,0),s.push("\na",n,n,0,1,0,2*-n,0),s.join(" ")}function ke(t){const e=t.split(" ");return{x:Number.parseFloat(e[1]),y:Number.parseFloat(e[2]),radius:-Number.parseFloat(e[4])}}function Pt(t){if(0===t.length)return[];const e={};return st(t,e),e.arcs}function Vt(t,e){if(0===t.length)return"M 0 0";const n=Math.pow(10,e||0),s=null!=e?t=>Math.round(t*n)/n:t=>t;if(1==t.length){const e=t[0].circle;return Ie(s(e.x),s(e.y),s(e.radius))}const i=["\nM",s(t[0].p2.x),s(t[0].p2.y)];for(const e of t){const t=s(e.circle.radius);i.push("\nA",t,t,0,e.large?1:0,e.sweep?1:0,s(e.p1.x),s(e.p1.y))}return i.join(" ")}function St(t,e){return Vt(Pt(t),e)}function Me(t,e={}){const{lossFunction:n,layoutFunction:s=At,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:o,width:a=600,height:l=350,padding:c=15,scaleToFit:h=!1,symmetricalTextCentre:u=!1,distinct:f,round:d=2}=e;let y=s(t,{lossFunction:"default"!==n&&n?"logRatio"===n?Rt:n:tt,distinct:f});i&&(y=Ct(y,r,o));const g=Nt(y,a,l,c,h),x=jt(g,t,u),p=new Map(Object.keys(g).map(t=>[t,{set:t,x:g[t].x,y:g[t].y,radius:g[t].radius}])),m=t.map(t=>{const e=t.sets.map(t=>p.get(t)),n=Pt(e);return{circles:e,arcs:n,path:Vt(n,d),area:t,has:new Set(t.sets)}});function b(t){let e="";for(const n of m)n.has.size>t.length&&t.every(t=>n.has.has(t))&&(e+=" "+n.path);return e}return m.map(({circles:t,arcs:e,path:n,area:s})=>({data:s,text:x[s.sets],circles:t,arcs:e,path:n,distinctPath:n+b(s.sets)}))}var gt=function(){var t=w(function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n},"o"),e=[5,8],n=[7,8,11,12,17,19,22,24],s=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],o=[1,31],a=[1,39],l=[7,8,11,12,17,19,22,24,27],c=[1,57],h=[1,56],u=[1,58],f=[1,59],d=[1,60],y=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],g={trace:w(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],[3
10,1],[30,1],[30,1],[30,1],[30,1],[18,1],[18,3],[13,1],[13,1]],performAction:w(function(t,e,n,s,i,r,o){var a=r.length-1;switch(i){case 1:return r[a-1];case 2:case 3:case 4:case 6:this.$=[];break;case 5:case 35:r[a-1].push(r[a]),this.$=r[a-1];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:case 43:case 44:this.$=r[a];break;case 8:s.setDiagramTitle(r[a].substr(6)),this.$=r[a].substr(6);break;case 9:s.addSubsetData([r[a]],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 10:s.addSubsetData([r[a-1]],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 11:s.addSubsetData([r[a-2]],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 12:s.addSubsetData([r[a-3]],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 13:if(r[a].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a]),s.addSubsetData(r[a],void 0,void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 14:if(r[a-1].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-1]),s.addSubsetData(r[a-1],r[a],void 0),s.setIndentMode&&s.setIndentMode(!0);break;case 15:if(r[a-2].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-2]),s.addSubsetData(r[a-2],void 0,parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 16:if(r[a-3].length<2)throw new Error("union requires multiple identifiers");s.validateUnionIdentifiers&&s.validateUnionIdentifiers(r[a-3]),s.addSubsetData(r[a-3],r[a-2],parseFloat(r[a])),s.setIndentMode&&s.setIndentMode(!0);break;case 17:case 18:case 19:s.addTextData(r[a-1],r[a],void 0);break;case 20:case 21:s.addTextData(r[a-2],r[a-1],r[a]);break;case 23:s.addStyleData(r[a-1],r[a]);break;case 24:case 25:case 26:if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a],void 0);break;case 27:case 28:var l;if(!(l=s.getCurrentSets()))throw new Error("text requires set");s.addTextData(l,r[a-1],r[a]);break;case 29:case 41:case 34:this.$=[r[a]];break;case 30:case 42:this.$=[...r[a-2],r[a]];break;case 31:this.$=[r[a-2],r[a]];break;case 33:this.$=r[a].join(" ")}},"anonymous"),table:[t(e,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(n,[2,4],{6:5}),t(e,[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(n,[2,5]),t(n,[2,6]),t(n,[2,7]),t(n,[2,8]),{13:16,20:s,21:i},{13:20,18:19,20:s,21:i},{13:20,18:21,20:s,21:i},{16:[1,25],20:[1,23],21:[1,24],23:22},{13:20,18:26,20:s,21:i},t(n,[2,9],{14:[1,27],15:[1,28]}),t(r,[2,43]),t(r,[2,44]),t(n,[2,13],{14:[1,29],15:[1,30],27:o}),t(r,[2,41]),{16:[1,34],20:[1,32],21:[1,33],27:o},t(n,[2,22]),t(n,[2,24],{14:[1,35]}),t(n,[2,25],{14:[1,36]}),t(n,[2,26]),{20:a,25:37,26:38,27:o},t(n,[2,10],{15:[1,40]}),{16:[1,41]},t(n,[2,14],{15:[1,42]}),{16:[1,43]},{13:44,20:s,21:i},t(n,[2,17],{14:[1,45]}),t(n,[2,18],{14:[1,46]}),t(n,[2,19]),t(n,[2,27]),t(n,[2,28]),t(n,[2,23],{27:[1,47]}),t(l,[2,29]),{15:[1,48]},{16:[1,49]},t(n,[2,11]),{16:[1,50]},t(n,[2,15]),t(r,[2,42]),t(n,[2,20]),t(n,[2,21]),{20:a,26:51},{16:c,20:h,21:[1,53],28:52,29:54,30:55,31:u,32:f,33:d},t(n,[2,12]),t(n,[2,16]),t(l,[2,30]),t(l,[2,31]),t(l,[2,32]),t(l,[2,33],{30:61,16:c,20:h,31:u,32:f,33:d}),t(y,[2,34]),t(y,[2,36]),t(y,[2,37]),t(y,[2,38]),t(y,[2,39]),t(y,[2,40]),t(y,[2,35])],defaultActions:{6:[2,1]},parseError:w(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:w(function(t){var e=this,n=[0],s=[],i=[null],r=[],o=this.table,a="",l=0,c=0,h=r.slice.call(arguments,1),u=Object.create(this.lexer),f={yy:{}};for(var d in this.yy)Object.prototype.hasOwnProperty.call(this.yy,d)&&(f.yy[d]=this.yy[d]);u.setInput(t,f.yy),f.yy.lexer=u,f.yy.parser=this,typeof u.yylloc>"u"&&(u.yylloc={});var y=u.yylloc;r.push(y);var g=u.options&&u.options.ranges;function x(){var t;return"number"!=typeof(t=s.pop()||u.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof f.yy.parseError?this.parseError=f.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,w(function(t){n.length=n.length-2*t,i.length=i.length-t,r.length=r.length-t},"popStack"),w(x,"lex");for(var p,m,b,v,I,M,k,_,S={};;){if(m=n[n.length-1],this.defaultActions[m]?b=this.defaultActions[m]:((null===p||typeof p>"u")&&(p=x()),b=o[m]&&o[m][p]),typeof b>"u"||!b.length||!b[0]){var E="";for(I in _=[],o[m])this.terminals_[I]&&I>2&&_.push("'"+this.terminals_[I]+"'");E=u.showPosition?"Parse error on line "+(l+1)+":\n"+u.showPosition()+"\nExpecting "+_.join(", ")+", got '"+(this.terminals_[p]||p)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==p?"end of input":"'"+(this.terminals_[p]||p)+"'"),this.parseError(E,{text:u.match,token:this.terminals_[p]||p,line:u.yylineno,loc:y,expected:_})}if(b[0]instanceof Array&&b.length>1)throw new Error("Parse Error: multiple actions possible at state: "+m+", token: "+p);switch(b[0]){case 1:n.push(p),i.push(u.yytext),r.push(u.yylloc),n.push(b[1]),p=null,c=u.yyleng,a=u.yytext,l=u.yylineno,y=u.yylloc;break;case 2:if(M=this.productions_[b[1]][1],S.$=i[i.length-M],S._$={first_line:r[r.length-(M||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(M||1)].first_column,last_column:r[r.length-1].last_column},g&&(S._$.range=[r[r.length-(M||1)].range[0],r[r.length-1].range[1]]),typeof(v=this.performAction.apply(S,[a,c,l,f.yy,b[1],i,r].concat(h)))<"u")return v;M&&(n=n.slice(0,-1*M*2),i=i.slice(0,-1*M),r=r.slice(0,-1*M)),n.push(this.productions_[b[1]][0]),i.push(S.$),r.push(S._$),k=o[n[n.length-2]][n[n.length-1]],n.push(k);break;case 3:return!0}}return!0},"parse")},x={EOF:1,parseError:w(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:w(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:w(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:w(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:w(function(){return this._more=!0,this},"more"),reject:w(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:w(function(t){this.unput(this.match.slice(t))},"less"),pastInput:w(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:w(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:w(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:w(function(t,e){var n,s,i;if(this.options.backtrack_lexer&&(i={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(i.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var r in i)this[r]=i[r];return!1}return!1},"test_match"),next:w(function(){if(this.done)return this.EOF;var t,e,n,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var i=this._currentRules(),r=0;r<i.length;r++)if((n=this._input.match(this.rules[i[r]]))&&(!e||n[0].length>e[0].length)){if(e=n,s=r,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,i[r])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,i[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:w(function(){return this.next()||this.lex()},"lex"),begin:w(function(t){this.conditionStack.push(t)},"begin"),popState:w(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:w(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:w(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:w(function(t){this.begin(t)},"pushState"),stateStackSize:w(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:w(function(t,e,n,s){switch(n){case 0:case 1:case 2:case 4:case 7:case 8:break;case 3:if(t.getIndentMode&&t.getIndentMode())return t.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 5:t.setIndentMode&&t.setIndentMode(!1),this.begin("INITIAL"),this.unput(e.yytext);break;case 6:return this.begin("bol"),8;case 9:return 7;case 10:return 11;case 11:return 5;case 12:return 12;case 13:return 17;case 14:if(!t.consumeIndentText)return 19;t.consumeIndentText=!1;break;case 15:return 24;case 16:return e.yytext=e.yytext.slice(2,-2),14;case 17:return e.yytext=e.yytext.slice(1,-1).trim(),14;case 18:return 16;case 19:return 31;case 20:return 33;case 21:return 32;case 22:return 20;case 23:return 21;case 24:return 27;case 25:return 15}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:[ \t]+(?=[\n\r]))/i,/^(?:[ \t]+(?=text\b))/i,/^(?:[ \t]+)/i,/^(?:[^ \t\n\r])/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:[ \t]+)/i,/^(?:$)/i,/^(?:title\s[^#\n;]+)/i,/^(?:venn-beta\b)/i,/^(?:set\b)/i,/^(?:union\b)/i,/^(?:text\b)/i,/^(?:style\b)/i,/^(?:\["[^\"]*"\])/i,/^(?:\[[^\]\"]+\])/i,/^(?:[+-]?(\d+(\.\d+)?|\.\d+))/i,/^(?:#[0-9a-fA-F]{3,8})/i,/^(?:rgba\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:rgb\(\s*[0-9.]+\s*[,]\s*[0-9.]+\s*[,]\s*[0-9.]+\s*\))/i,/^(?:[A-Za-z_][A-Za-z0-9\-_]*)/i,/^(?:"[^\"]*")/i,/^(?:,)/i,/^(?::)/i],conditions:{bol:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0},INITIAL:{rules:[0,1,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25],inclusive:!0}}};function p(){this.yy={}}return g.lexer=x,w(p,"Parser"),p.prototype=g,g.Parser=p,new p}();gt.parser=gt;var vt,Se=gt,yt=[],pt=[],mt=[],bt=new Set,It=!1,we=w((t,e,n)=>{const s=it(t).sort(),i=n??10/Math.pow(t.length,2);vt=s,1===s.length&&bt.add(s[0]),yt.push({sets:s,size:i,label:e?nt(e):void 0})},"addSubsetData"),_e=w(()=>yt,"getSubsetData"),nt=w(t=>{const e=t.trim();return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e},"normalizeText"),Te=w(t=>t&&nt(t),"normalizeStyleValue"),Ee=w((t,e,n)=>{const s=nt(e);pt.push({sets:it(t).sort(),id:s,label:n?nt(n):void 0})},"addTextData"),ze=w((t,e)=>{const n=it(t).sort(),s={};for(const[t,n]of e)s[t]=Te(n)??n;mt.push({targets:n,styles:s})},"addStyleData"),Ae=w(()=>mt,"getStyleData"),it=w(t=>t.map(t=>nt(t)),"normalizeIdentifierList"),De=w(t=>{const e=it(t).filter(t=>!bt.has(t));if(e.length>0)throw new Error(`unknown set identifier: ${e.join(", ")}`)},"validateUnionIdentifiers"),Re=w(()=>pt,"getTextData"),Ce=w(()=>vt,"getCurrentSets"),Ne=w(()=>It,"getIndentMode"),Oe=w(t=>{It=t},"setIndentMode"),Fe=oe.venn;function Bt(){return ie(Fe,wt().venn)}w(Bt,"getConfig");var Le=w(()=>{se(),yt.length=0,pt.length=0,mt.length=0,bt.clear(),vt=void 0,It=!1},"customClear"),je={getConfig:Bt,clear:Le,setAccTitle:Zt,getAccTitle:Yt,setDiagramTitle:Xt,getDiagramTitle:Ht,getAccDescription:Kt,setAccDescription:Wt,addSubsetData:we,getSubsetData:_e,addTextData:Ee,addStyleData:ze,validateUnionIdentifiers:De,getTextData:Re,getStyleData:Ae,getCurrentSets:Ce,getIndentMode:Ne,setIndentMode:Oe},Pe=w(t=>`\n .venn-title {\n font-size: 32px;\n fill: ${t.vennTitleTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-circle text {\n font-size: 48px;\n font-family: ${t.fontFamily};\n }\n\n .venn-intersection text {\n font-size: 48px;\n fill: ${t.vennSetTextColor};\n font-family: ${t.fontFamily};\n }\n\n .venn-text-node {\n font-family: ${t.fontFamily};\n color: ${t.vennSetTextColor};\n }\n`,"getStyles"),Ve=Pe;function qt(t){const e=new Map;for(const n of t){const t=n.targets.join("|"),s=e.get(t);s?Object.assign(s,n.styles):e.set(t,{...n.styles})}return e}w(qt,"buildStyleByKey");var Be=w((t,e,n,s)=>{const i=s.db,r=i.getConfig?.(),{themeVariables:o,look:a,handDrawnSeed:l}=wt(),c="handDrawn"===a,h=[o.venn1,o.venn2,o.venn3,o.venn4,o.venn5,o.venn6,o.venn7,o.venn8].filter(
1Boolean),u=i.getDiagramTitle?.(),f=i.getSubsetData(),d=i.getTextData(),y=qt(i.getStyleData()),g=r?.width??800,x=r?.height??450,p=g/1600,m=u?48*p:0,b=o.primaryTextColor??o.textColor,w=Jt(e);w.attr("viewBox",`0 0 ${g} ${x}`),u&&w.append("text").text(u).attr("class","venn-title").attr("font-size",32*p+"px").attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*p).style("fill",o.vennTitleTextColor||o.titleColor);const v=ot(document.createElement("div")),I=be().width(g).height(x-m);v.datum(f).call(I);const M=c?Qt.svg(v.select("svg").node()):void 0,k=Me(f,{width:g,height:x-m,padding:r?.padding??15}),_=new Map;for(const t of k){const e=Q([...t.data.sets].sort());_.set(e,t)}d.length>0&&Ut(r,_,v,d,p,y);const S=$t(o.background||"#f4f4f4");v.selectAll(".venn-circle").each(function(t,e){const n=ot(this),s=Q([...t.sets].sort()),i=y.get(s),r=i?.fill||h[e%h.length]||o.primaryColor;n.classed("venn-set-"+e%8,!0);const a=i?.["fill-opacity"]??.1,u=i?.stroke||r,f=i?.["stroke-width"]||""+5*p;if(c&&M){const t=_.get(s);if(t&&t.circles.length>0){const s=t.circles[0],i=M.circle(s.x,s.y,2*s.radius,{roughness:.7,seed:l,fill:kt(r,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:60*e-41,stroke:u,strokeWidth:parseFloat(String(f))});n.select("path").remove(),n.node()?.insertBefore(i,n.select("text").node())}}else n.select("path").style("fill",r).style("fill-opacity",a).style("stroke",u).style("stroke-width",f).style("stroke-opacity",.95);const d=i?.color||(S?te(r,30):ee(r,30));n.select("text").style("font-size",48*p+"px").style("fill",d)}),c&&M?v.selectAll(".venn-intersection").each(function(t){const e=ot(this),n=Q([...t.sets].sort()),s=y.get(n),i=s?.fill;if(i){const t=e.select("path"),n=t.attr("d");if(n){const e=M.path(n,{roughness:.7,seed:l,fill:kt(i,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),s=t.node();s?.parentNode?.insertBefore(e,s),t.remove()}}else e.select("path").style("fill-opacity",0);e.select("text").style("font-size",48*p+"px").style("fill",s?.color??o.vennSetTextColor??b)}):(v.selectAll(".venn-intersection text").style("font-size",48*p+"px").style("fill",t=>{const e=Q([...t.sets].sort());return y.get(e)?.color??o.vennSetTextColor??b}),v.selectAll(".venn-intersection path").style("fill-opacity",t=>{const e=Q([...t.sets].sort());return y.get(e)?.fill?1:0}).style("fill",t=>{const e=Q([...t.sets].sort());return y.get(e)?.fill??"transparent"}));const E=w.append("g").attr("transform",`translate(0, ${m})`),T=v.select("svg").node();if(T&&"childNodes"in T)for(const t of[...T.childNodes])E.node()?.appendChild(t);ne(w,x,g,r?.useMaxWidth??!0)},"draw");function Q(t){return t.join("|")}function Ut(t,e,n,s,i,r){const o=t?.useDebugLayout??!1,a=n.select("svg").append("g").attr("class","venn-text-nodes"),l=new Map;for(const t of s){const e=Q(t.sets),n=l.get(e);n?n.push(t):l.set(e,[t])}for(const[t,n]of l.entries()){const s=e.get(t);if(!s?.text)continue;const l=s.text.x,c=s.text.y,h=Math.min(...s.circles.map(t=>t.radius)),u=Math.min(...s.circles.map(t=>t.radius-Math.hypot(l-t.x,c-t.y)));let f=Number.isFinite(u)?Math.max(0,u):0;0===f&&Number.isFinite(h)&&(f=.6*h);const d=a.append("g").attr("class","venn-text-area").attr("font-size",40*i+"px");o&&d.append("circle").attr("class","venn-text-debug-circle").attr("cx",l).attr("cy",c).attr("r",f).attr("fill","none").attr("stroke","purple").attr("stroke-width",1.5*i).attr("stroke-dasharray",`${6*i} ${4*i}`);const y=Math.max(80*i,2*f*.95),g=Math.max(60*i,2*f*.95),x=(s.data.label&&s.data.label.length>0?Math.min(32*i,.25*f):0)+(n.length<=2?30*i:0),p=l-y/2,m=c-g/2+x,b=Math.max(1,Math.ceil(Math.sqrt(n.length))),w=y/b,v=g/Math.max(1,Math.ceil(n.length/b));for(const[t,e]of n.entries()){const n=t%b,s=Math.floor(t/b),a=p+w*(n+.5),l=m+v*(s+.5);o&&d.append("rect").attr("class","venn-text-debug-cell").attr("x",p+w*n).attr("y",m+v*s).attr("width",w).attr("height",v).attr("fill","none").attr("stroke","teal").attr("stroke-width",1*i).attr("stroke-dasharray",`${4*i} ${3*i}`);const c=.9*w,h=.9*v,u=d.append("foreignObject").attr("class","venn-text-node-fo").attr("width",c).attr("height",h).attr("x",a-c/2).attr("y",l-h/2).attr("overflow","visible"),f=r.get(e.id)?.color,y=u.append("xhtml:span").attr("class","venn-text-node").style("display","flex").style("width","100%").style("height","100%").style("white-space","normal").style("align-items","center").style("justify-content","center").style("text-align","center").style("overflow-wrap","normal").style("word-break","normal").text(e.label??e.id);f&&y.style("color",f)}}}w(Q,"stableSetsKey"),w(Ut,"renderTextNodes");var qe={draw:Be},Ge={parser:Se,db:je,renderer:qe,styles:Ve};export{Ge as diagram};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.