35 lines
42 KiB
JavaScript
35 lines
42 KiB
JavaScript
|
|
import{a as Bt}from"./chunk-LRIF4GLE.mjs";import{a as Pt}from"./chunk-5IMINLNL.mjs";import{o as jt}from"./chunk-QA3QBVWF.mjs";import"./chunk-KNLZD3CH.mjs";import{O as Rt,S as zt,T as Ct,U as Ot,V as Vt,W as Nt,X as Lt,Y as Ft,d as Tt,e as Et,f as _t,g as ct,j as At,t as it}from"./chunk-67TQ5CYL.mjs";import{h as rt}from"./chunk-7W6UQGC5.mjs";import{a as d}from"./chunk-AQ6EADP3.mjs";var ut=(function(){var t=d(function(D,x,b,k){for(b=b||{},k=D.length;k--;b[D[k]]=x);return b},"o"),n=[5,8],s=[7,8,11,12,17,19,22,24],e=[1,17],i=[1,18],r=[7,8,11,12,14,15,16,17,19,20,21,22,24,27],a=[1,31],c=[1,39],h=[7,8,11,12,17,19,22,24,27],u=[1,57],o=[1,56],p=[1,58],g=[1,59],v=[1,60],y=[7,8,11,12,16,17,19,20,22,24,27,31,32,33],S={trace:d(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:d(function(x,b,k,l,m,f,V){var I=f.length-1;switch(m){case 1:return f[I-1];case 2:case 3:case 4:this.$=[];break;case 5:f[I-1].push(f[I]),this.$=f[I-1];break;case 6:this.$=[];break;case 7:case 22:case 32:case 36:case 37:case 38:case 39:case 40:this.$=f[I];break;case 8:l.setDiagramTitle(f[I].substr(6)),this.$=f[I].substr(6);break;case 9:l.addSubsetData([f[I]],void 0,void 0),l.setIndentMode&&l.setIndentMode(!0);break;case 10:l.addSubsetData([f[I-1]],f[I],void 0),l.setIndentMode&&l.setIndentMode(!0);break;case 11:l.addSubsetData([f[I-2]],void 0,parseFloat(f[I])),l.setIndentMode&&l.setIndentMode(!0);break;case 12:l.addSubsetData([f[I-3]],f[I-2],parseFloat(f[I])),l.setIndentMode&&l.setIndentMode(!0);break;case 13:if(f[I].length<2)throw new Error("union requires multiple identifiers");l.validateUnionIdentifiers&&l.validateUnionIdentifiers(f[I]),l.addSubsetData(f[I],void 0,void 0),l.setIndentMode&&l.setIndentMode(!0);break;case 14:if(f[I-1].length<2)throw new Error("union requires multiple identifiers");l.validateUnionIdentifiers&&l.validateUnionIdentifiers(f[I-1]),l.addSubsetData(f[I-1],f[I],void 0),l.setIndentMode&&l.setIndentMode(!0);break;case 15:if(f[I-2].length<2)throw new Error("union requires multiple identifiers");l.validateUnionIdentifiers&&l.validateUnionIdentifiers(f[I-2]),l.addSubsetData(f[I-2],void 0,parseFloat(f[I])),l.setIndentMode&&l.setIndentMode(!0);break;case 16:if(f[I-3].length<2)throw new Error("union requires multiple identifiers");l.validateUnionIdentifiers&&l.validateUnionIdentifiers(f[I-3]),l.addSubsetData(f[I-3],f[I-2],parseFloat(f[I])),l.setIndentMode&&l.setIndentMode(!0);break;case 17:case 18:case 19:l.addTextData(f[I-1],f[I],void 0);break;case 20:case 21:l.addTextData(f[I-2],f[I-1],f[I]);break;case 23:l.addStyleData(f[I-1],f[I]);break;case 24:case 25:case 26:var C=l.getCurrentSets();if(!C)throw new Error("text requires set");l.addTextData(C,f[I],void 0);break;case 27:case 28:var C=l.getCurrentSets();if(!C)throw new Error("text requires set");l.addTextData(C,f[I-1],f[I]);break;case 29:case 41:this.$=[f[I]];break;case 30:case 42:this.$=[...f[I-2],f[I]];break;case 31:this.$=[f[I-2],f[I]];break;case 33:this.$=f[I].join(" ");break;case 34:this.$=[f[I]];break;case 35:f[I-1].push(f[I]),this.$=f[I-1];break;case 43:case 44:this.$=f[I];break}},"anonymous"),table:[t(n,[2,2],{3:1,4:2}),{1:[3]},{5:[1,3],8:[1,4]},t(s,
|
||
|
|
`+_.showPosition()+`
|
||
|
|
Expecting `+st.join(", ")+", got '"+(this.terminals_[A]||A)+"'":lt="Parse error on line "+(C+1)+": Unexpected "+(A==R?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(lt,{text:_.match,token:this.terminals_[A]||A,line:_.yylineno,loc:L,expected:st})}if(M[0]instanceof Array&&M.length>1)throw new Error("Parse Error: multiple actions possible at state: "+U+", token: "+A);switch(M[0]){case 1:k.push(A),m.push(_.yytext),f.push(_.yylloc),k.push(M[1]),A=null,K?(A=K,K=null):(G=_.yyleng,I=_.yytext,C=_.yylineno,L=_.yylloc,F>0&&F--);break;case 2:if(P=this.productions_[M[1]][1],Z.$=m[m.length-P],Z._$={first_line:f[f.length-(P||1)].first_line,last_line:f[f.length-1].last_line,first_column:f[f.length-(P||1)].first_column,last_column:f[f.length-1].last_column},H&&(Z._$.range=[f[f.length-(P||1)].range[0],f[f.length-1].range[1]]),et=this.performAction.apply(Z,[I,G,C,O.yy,M[1],m,f].concat(z)),typeof et<"u")return et;P&&(k=k.slice(0,-1*P*2),m=m.slice(0,-1*P),f=f.slice(0,-1*P)),k.push(this.productions_[M[1]][0]),m.push(Z.$),f.push(Z._$),wt=V[k[k.length-2]][k[k.length-1]],k.push(wt);break;case 3:return!0}}return!0},"parse")},E=(function(){var D={EOF:1,parseError:d(function(b,k){if(this.yy.parser)this.yy.parser.parseError(b,k);else throw new Error(b)},"parseError"),setInput:d(function(x,b){return this.yy=b||this.yy||{},this._input=x,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:d(function(){var x=this._input[0];this.yytext+=x,this.yyleng++,this.offset++,this.match+=x,this.matched+=x;var b=x.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),x},"input"),unput:d(function(x){var b=x.length,k=x.split(/(?:\r\n?|\n)/g);this._input=x+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var l=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),k.length-1&&(this.yylineno-=k.length-1);var m=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:k?(k.length===l.length?this.yylloc.first_column:0)+l[l.length-k.length].length-k[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[m[0],m[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},"unput"),more:d(function(){return this._more=!0,this},"more"),reject:d(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).
|
||
|
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:d(function(x){this.unput(this.match.slice(x))},"less"),pastInput:d(function(){var x=this.matched.substr(0,this.matched.length-this.match.length);return(x.length>20?"...":"")+x.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:d(function(){var x=this.match;return x.length<20&&(x+=this._input.substr(0,20-x.length)),(x.substr(0,20)+(x.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:d(function(){var x=this.pastInput(),b=new Array(x.length+1).join("-");return x+this.upcomingInput()+`
|
||
|
|
`+b+"^"},"showPosition"),test_match:d(function(x,b){var k,l,m;if(this.options.backtrack_lexer&&(m={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&&(m.yylloc.range=this.yylloc.range.slice(0))),l=x[0].match(/(?:\r\n?|\n).*/g),l&&(this.yylineno+=l.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:l?l[l.length-1].length-l[l.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+x[0].length},this.yytext+=x[0],this.match+=x[0],this.matches=x,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(x[0].length),this.matched+=x[0],k=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),k)return k;if(this._backtrack){for(var f in m)this[f]=m[f];return!1}return!1},"test_match"),next:d(function(){if(this.done)return this.EOF;this._input||(this.done=!0);var x,b,k,l;this._more||(this.yytext="",this.match="");for(var m=this._currentRules(),f=0;f<m.length;f++)if(k=this._input.match(this.rules[m[f]]),k&&(!b||k[0].length>b[0].length)){if(b=k,l=f,this.options.backtrack_lexer){if(x=this.test_match(k,m[f]),x!==!1)return x;if(this._backtrack){b=!1;continue}else return!1}else if(!this.options.flex)break}return b?(x=this.test_match(b,m[l]),x!==!1?x:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
|
||
|
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:d(function(){var b=this.next();return b||this.lex()},"lex"),begin:d(function(b){this.conditionStack.push(b)},"begin"),popState:d(function(){var b=this.conditionStack.length-1;return b>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:d(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:d(function(b){return b=this.conditionStack.length-1-Math.abs(b||0),b>=0?this.conditionStack[b]:"INITIAL"},"topState"),pushState:d(function(b){this.begin(b)},"pushState"),stateStackSize:d(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:d(function(b,k,l,m){var f=m;switch(l){case 0:break;case 1:break;case 2:break;case 3:if(b.getIndentMode&&b.getIndentMode())return b.consumeIndentText=!0,this.begin("INITIAL"),22;break;case 4:break;case 5:b.setIndentMode&&b.setIndentMode(!1),this.begin("INITIAL"),this.unput(k.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(b.consumeIndentText)b.consumeIndentText=!1;else return 19;break;case 15:return 24;case 16:return k.yytext=k.yytext.slice(2,-2),14;break;case 17:return k.yytext=k.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 D})();S.lexer=E;function w(){this.yy={}}return d(w,"Parser"),w.prototype=S,S.Parser=w,new w})();ut.parser=ut;var qt=ut;var ft=[],ht=[],dt=[],gt=new Set,xt,yt=!1,ue=d((t,n,s)=>{let e=ot(t).sort(),i=s??10/Math.pow(t.length,2);xt=e,e.length===1&>.add(e[0]),ft.push({sets:e,size:i,label:n?nt(n):void 0})},"addSubsetData"),fe=d(()=>ft,"getSubsetData"),nt=d(t=>{let n=t.trim();return n.length>=2&&n.startsWith('"')&&n.endsWith('"')?n.slice(1,-1):n},"normalizeText"),he=d(t=>t&&nt(t),"normalizeStyleValue"),de=d((t,n,s)=>{let e=nt(n);ht.push({sets:ot(t).sort(),id:e,label:s?nt(s):void 0})},"addTextData"),ge=d((t,n)=>{let s=ot(t).sort(),e={};for(let[i,r]of n)e[i]=he(r)??r;dt.push({targets:s,styles:e})},"addStyleData"),xe=d(()=>dt,"getStyleData"),ot=d(t=>t.map(n=>nt(n)),"normalizeIdentifierList"),ye=d(t=>{let s=ot(t).filter(e=>!gt.has(e));if(s.length>0)throw new Error(`unknown set identifier: ${s.join(", ")}`)},"validateUnionIdentifiers"),pe=d(()=>ht,"getTextData"),me=d(()=>xt,"getCurrentSets"),be=d(()=>yt,"getIndentMode"),ve=d(t=>{yt=t},"setIndentMode"),ke=At.venn;function Me(){return jt(ke,it().venn)}d(Me,"getConfig");var Ie=d(()=>{zt(),ft.length=0,ht.length=0,dt.length=0,gt.clear(),xt=void 0,yt=!1},"customClear"),Gt={getConfig:Me,clear:Ie,setAccTitle:Ct,getAccTitle:Ot,setDiagramTitle:Lt,getDiagramTitle:Ft,getAccDescription:Nt,setAccDescription:Vt,addSubsetData:ue,getSubsetData:fe,addTextData:de,addStyleData:ge,validateUnionIdentifiers:ye,getTextData:pe,getStyleData:xe,getCurrentSets:me,getIndentMode:be,setIndentMode:ve};var Se=d(t=>`
|
||
|
|
.venn-title {
|
||
|
|
font-size: 32px;
|
||
|
|
fill: ${t.vennTitleTextColor};
|
||
|
|
font-family: ${t.fontFamily};
|
||
|
|
}
|
||
|
|
|
||
|
|
.venn-circle text {
|
||
|
|
font-size: 48px;
|
||
|
|
font-family: ${t.fontFamily};
|
||
|
|
}
|
||
|
|
|
||
|
|
.venn-intersection text {
|
||
|
|
font-size: 48px;
|
||
|
|
fill: ${t.vennSetTextColor};
|
||
|
|
font-family: ${t.fontFamily};
|
||
|
|
}
|
||
|
|
|
||
|
|
.venn-text-node {
|
||
|
|
font-family: ${t.fontFamily};
|
||
|
|
color: ${t.vennSetTextColor};
|
||
|
|
}
|
||
|
|
`,"getStyles"),Ut=Se;function at(t,n){let s=we(t),e=s.filter(c=>De(c,t)),i=0,r=0,a=[];if(e.length>1){let c=Yt(e);for(let u=0;u<e.length;++u){let o=e[u];o.angle=Math.atan2(o.x-c.x,o.y-c.y)}e.sort((u,o)=>o.angle-u.angle);let h=e[e.length-1];for(let u=0;u<e.length;++u){let o=e[u];r+=(h.x+o.x)*(o.y-h.y);let p={x:(o.x+h.x)/2,y:(o.y+h.y)/2},g=null;for(let v=0;v<o.parentIndex.length;++v)if(h.parentIndex.includes(o.parentIndex[v])){let y=t[o.parentIndex[v]],S=Math.atan2(o.x-y.x,o.y-y.y),E=Math.atan2(h.x-y.x,h.y-y.y),w=E-S;w<0&&(w+=2*Math.PI);let D=E-w/2,x=q(p,{x:y.x+y.radius*Math.sin(D),y:y.y+y.radius*Math.cos(D)});x>y.radius*2&&(x=y.radius*2),(g==null||g.width>x)&&(g={circle:y,width:x,p1:o,p2:h,large:x>y.radius,sweep:!0})}g!=null&&(a.push(g),i+=bt(g.circle.radius,g.width),h=o)}}else{let c=t[0];for(let u=1;u<t.length;++u)t[u].radius<c.radius&&(c=t[u]);let h=!1;for(let u=0;u<t.length;++u)if(q(t[u],c)>Math.abs(c.radius-t[u].radius)){h=!0;break}h?i=r=0:(i=c.radius*c.radius*Math.PI,a.push({circle:c,p1:{x:c.x,y:c.y+c.radius},p2:{x:c.x-1e-10,y:c.y+c.radius},width:c.radius*2,large:!0,sweep:!0}))}return r/=2,n&&(n.area=i+r,n.arcArea=i,n.polygonArea=r,n.arcs=a,n.innerPoints=e,n.intersectionPoints=s),i+r}d(at,"intersectionArea");function De(t,n){return n.every(s=>q(t,s)<s.radius+1e-10)}d(De,"containedInCircles");function we(t){let n=[];for(let s=0;s<t.length;++s)for(let e=s+1;e<t.length;++e){let i=Kt(t[s],t[e]);for(let r of i)r.parentIndex=[s,e],n.push(r)}return n}d(we,"getIntersectionPoints");function bt(t,n){return t*t*Math.acos(1-n/t)-(t-n)*Math.sqrt(n*(2*t-n))}d(bt,"circleArea");function q(t,n){return Math.sqrt((t.x-n.x)*(t.x-n.x)+(t.y-n.y)*(t.y-n.y))}d(q,"distance");function Dt(t,n,s){if(s>=t+n)return 0;if(s<=Math.abs(t-n))return Math.PI*Math.min(t,n)*Math.min(t,n);let e=t-(s*s-n*n+t*t)/(2*s),i=n-(s*s-t*t+n*n)/(2*s);return bt(t,e)+bt(n,i)}d(Dt,"circleOverlap");function Kt(t,n){let s=q(t,n),e=t.radius,i=n.radius;if(s>=e+i||s<=Math.abs(e-i))return[];let r=(e*e-i*i+s*s)/(2*s),a=Math.sqrt(e*e-r*r),c=t.x+r*(n.x-t.x)/s,h=t.y+r*(n.y-t.y)/s,u=-(n.y-t.y)*(a/s),o=-(n.x-t.x)*(a/s);return[{x:c+u,y:h-o},{x:c-u,y:h+o}]}d(Kt,"circleCircleIntersection");function Yt(t){let n={x:0,y:0};for(let s of t)n.x+=s.x,n.y+=s.y;return n.x/=t.length,n.y/=t.length,n}d(Yt,"getCenter");function Te(t,n,s,e){e=e||{};let i=e.maxIterations||100,r=e.tolerance||1e-10,a=t(n),c=t(s),h=s-n;if(a*c>0)throw"Initial bisect points must have opposite signs";if(a===0)return n;if(c===0)return s;for(let u=0;u<i;++u){h/=2;let o=n+h,p=t(o);if(p*a>=0&&(n=o),Math.abs(h)<r||p===0)return o}return n+h}d(Te,"bisect");function vt(t){let n=new Array(t);for(let s=0;s<t;++s)n[s]=0;return n}d(vt,"zeros");function Wt(t,n){return vt(t).map(()=>vt(n))}d(Wt,"zerosM");function $(t,n){let s=0;for(let e=0;e<t.length;++e)s+=t[e]*n[e];return s}d($,"dot");function kt(t){return Math.sqrt($(t,t))}d(kt,"norm2");function Mt(t,n,s){for(let e=0;e<n.length;++e)t[e]=n[e]*s}d(Mt,"scale");function J(t,n,s,e,i){for(let r=0;r<t.length;++r)t[r]=n*s[r]+e*i[r]}d(J,"weightedSum");function Xt(t,n,s){s=s||{};let e=s.maxIterations||n.length*200,i=s.nonZeroDelta||1.05,r=s.zeroDelta||.001,a=s.minErrorDelta||1e-6,c=s.minErrorDelta||1e-5,h=s.rho!==void 0?s.rho:1,u=s.chi!==void 0?s.chi:2,o=s.psi!==void 0?s.psi:-.5,p=s.sigma!==void 0?s.sigma:.5,g,v=n.length,y=new Array(v+1);y[0]=n,y[0].fx=t(n),y[0].id=0;for(let k=0;k<v;++k){let l=n.slice();l[k]=l[k]?l[k]*i:r,y[k+1]=l,y[k+1].fx=t(l),y[k+1].id=k+1}function S(k){for(let l=0;l<k.length;l++)y[v][l]=k[l];y[v].fx=k.fx}d(S,"updateSimplex");let E=d((k,l)=>k.fx-l.fx,"sortOrder"),w=n.slice(),D=n.slice(),x=n.slice(),b=n.slice();for(let k=0;k<e;++k){if(y.sort(E),s.history){let m=y.map(f=>{let V=f.slice();return V.fx=f.fx,V.id=f.id,V});m.sort((f,V)=>f.id-V.id),s.history.push({x:y[0].slice(),fx:y[0].fx,simplex:m})}g=0;for(let m=0;m<v;++m)g=Math.max(g,Math.abs(y[0][m]-y[1][m]));if(Math.abs(y[0].fx-y[v].fx)<a&&g<c)break;for(let m=0;m<v;++m){w[m]=0;for(let f=0;f<v;++f)w[m]+=y[f][m];w[m]/=v}let l=y[v];if(J(D,1+h,w,-h,l),D.fx=t(D),D.fx<y[0].fx)J(b,1+u,w,-u,l),b.fx=t(b),b.fx<D.fx?S(b):S(D);else if(D
|
||
|
|
M`,t,n),e.push(`
|
||
|
|
m`,-s,0),e.push(`
|
||
|
|
a`,s,s,0,1,0,s*2,0),e.push(`
|
||
|
|
a`,s,s,0,1,0,-s*2,0),e.join(" ")}d(je,"circlePath");function Pe(t){let n=t.split(" ");return{x:Number.parseFloat(n[1]),y:Number.parseFloat(n[2]),radius:-Number.parseFloat(n[4])}}d(Pe,"circleFromPath");function oe(t){if(t.length===0)return[];let n={};return at(t,n),n.arcs}d(oe,"intersectionAreaArcs");function ae(t,n){if(t.length===0)return"M 0 0";let s=Math.pow(10,n||0),e=n!=null?r=>Math.round(r*s)/s:r=>r;if(t.length==1){let r=t[0].circle;return je(e(r.x),e(r.y),e(r.radius))}let i=[`
|
||
|
|
M`,e(t[0].p2.x),e(t[0].p2.y)];for(let r of t){let a=e(r.circle.radius);i.push(`
|
||
|
|
A`,a,a,0,r.large?1:0,r.sweep?1:0,e(r.p1.x),e(r.p1.y))}return i.join(" ")}d(ae,"arcsToPath");function Ht(t,n){return ae(oe(t),n)}d(Ht,"intersectionAreaPath");function le(t,n={}){let{lossFunction:s,layoutFunction:e=Zt,normalize:i=!0,orientation:r=Math.PI/2,orientationOrder:a,width:c=600,height:h=350,padding:u=15,scaleToFit:o=!1,symmetricalTextCentre:p=!1,distinct:g,round:v=2}=n,y=e(t,{lossFunction:s==="default"||!s?tt:s==="logRatio"?Qt:s,distinct:g});i&&(y=$t(y,r,a));let S=te(y,c,h,u,o),E=re(S,t,p),w=new Map(Object.keys(S).map(b=>[b,{set:b,x:S[b].x,y:S[b].y,radius:S[b].radius}])),D=t.map(b=>{let k=b.sets.map(f=>w.get(f)),l=oe(k),m=ae(l,v);return{circles:k,arcs:l,path:m,area:b,has:new Set(b.sets)}});function x(b){let k="";for(let l of D)l.has.size>b.length&&b.every(m=>l.has.has(m))&&(k+=" "+l.path);return k}return d(x,"genDistinctPath"),D.map(({circles:b,arcs:k,path:l,area:m})=>({data:m,text:E[m.sets],circles:b,arcs:k,path:l,distinctPath:l+x(m.sets)}))}d(le,"layout");function qe(t){let n=new Map;for(let s of t){let e=s.targets.join("|"),i=n.get(e);i?Object.assign(i,s.styles):n.set(e,{...s.styles})}return n}d(qe,"buildStyleByKey");var Ge=d((t,n,s,e)=>{let i=e.db,r=i.getConfig?.(),{themeVariables:a,look:c,handDrawnSeed:h}=it(),u=c==="handDrawn",o=[a.venn1,a.venn2,a.venn3,a.venn4,a.venn5,a.venn6,a.venn7,a.venn8].filter(Boolean),p=i.getDiagramTitle?.(),g=i.getSubsetData(),v=i.getTextData(),y=qe(i.getStyleData()),S=r?.width??800,E=r?.height??450,D=S/1600,x=p?48*D:0,b=a.primaryTextColor??a.textColor,k=Bt(n);k.attr("viewBox",`0 0 ${S} ${E}`),p&&k.append("text").text(p).attr("class","venn-title").attr("font-size",`${32*D}px`).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("x","50%").attr("y",32*D).style("fill",a.vennTitleTextColor||a.titleColor);let l=rt(document.createElement("div")),m=se().width(S).height(E-x);l.datum(g).call(m);let f=u?Pt.svg(l.select("svg").node()):void 0,V=le(g,{width:S,height:E-x,padding:r?.padding??15}),I=new Map;for(let T of V){let R=Q([...T.data.sets].sort());I.set(R,T)}v.length>0&&Ue(r,I,l,v,D,y);let C=Tt(a.background||"#f4f4f4");l.selectAll(".venn-circle").each(function(T,R){let z=rt(this),O=Q([...T.sets].sort()),N=y.get(O),L=N?.fill||o[R%o.length]||a.primaryColor;z.classed(`venn-set-${R%8}`,!0);let H=N?.["fill-opacity"]??.1,Y=N?.stroke||L,j=N?.["stroke-width"]||`${5*D}`;if(u&&f){let K=I.get(O);if(K&&K.circles.length>0){let U=K.circles[0],M=f.circle(U.x,U.y,U.radius*2,{roughness:.7,seed:h,fill:ct(L,.7),fillStyle:"hachure",fillWeight:2,hachureGap:8,hachureAngle:-41+R*60,stroke:Y,strokeWidth:parseFloat(String(j))});z.select("path").remove(),z.node()?.insertBefore(M,z.select("text").node())}}else z.select("path").style("fill",L).style("fill-opacity",H).style("stroke",Y).style("stroke-width",j).style("stroke-opacity",.95);let A=N?.color||(C?Et(L,30):_t(L,30));z.select("text").style("font-size",`${48*D}px`).style("fill",A)}),u&&f?l.selectAll(".venn-intersection").each(function(T){let R=rt(this),_=Q([...T.sets].sort()),O=y.get(_),N=O?.fill;if(N){let L=R.select("path"),H=L.attr("d");if(H){let Y=f.path(H,{roughness:.7,seed:h,fill:ct(N,.3),fillStyle:"cross-hatch",fillWeight:2,hachureGap:6,hachureAngle:60,stroke:"none"}),j=L.node();j?.parentNode?.insertBefore(Y,j),L.remove()}}else R.select("path").style("fill-opacity",0);R.select("text").style("font-size",`${48*D}px`).style("fill",O?.color??a.vennSetTextColor??b)}):(l.selectAll(".venn-intersection text").style("font-size",`${48*D}px`).style("fill",T=>{let z=Q([...T.sets].sort());return y.get(z)?.color??a.vennSetTextColor??b}),l.selectAll(".venn-intersection path").style("fill-opacity",T=>{let z=Q([...T.sets].sort());return y.get(z)?.fill?1:0}).style("fill",T=>{let z=Q([...T.sets].sort());return y.get(z)?.fill??"transparent"}));let G=k.append("g").attr("transform",`translate(0, ${x})`),F=l.select("svg").node();if(F&&"childNodes"in F)for(let T of[...F.childNodes])G.node()?.appendChild(T);Rt(k,E,S,r?.useMaxWidth??!0)},"draw");function Q(t){return t.join("|")}d(Q,"stableSetsKey");function Ue(t,n,s,e,i,r){let a=t?.useDebugLayout??!1,h=s.select("s
|