var CSe=Object.defineProperty;var kSe=(Rt,jt,Pn)=>jt in Rt?CSe(Rt,jt,{enumerable:!0,configurable:!0,writable:!0,value:Pn}):Rt[jt]=Pn;var re=(Rt,jt,Pn)=>(kSe(Rt,typeof jt!="symbol"?jt+"":jt,Pn),Pn),cU=(Rt,jt,Pn)=>{if(!jt.has(Rt))throw TypeError("Cannot "+Pn)};var fU=(Rt,jt,Pn)=>(cU(Rt,jt,"read from private field"),Pn?Pn.call(Rt):jt.get(Rt)),dU=(Rt,jt,Pn)=>{if(jt.has(Rt))throw TypeError("Cannot add the same private member more than once");jt instanceof WeakSet?jt.add(Rt):jt.set(Rt,Pn)},mA=(Rt,jt,Pn,Gr)=>(cU(Rt,jt,"write to private field"),Gr?Gr.call(Rt,Pn):jt.set(Rt,Pn),Pn);(function(Rt){typeof define=="function"&&define.amd?define(Rt):Rt()})(function(){var Vf;"use strict";function Rt(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void Rt(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function jt(e){var t="",n,r;try{r=1,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-container">',r=2,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-item-info-header">',r=3,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<i class="icon-picture"></i>',r=4,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+"Image Preview</div></div>",r=5,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-panes clearfix">',r=6,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-left">',r=7,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-image">',r=8,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+"<div>",r=9,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+"<img/></div></div>",r=10,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-filename"></div></div>',r=11,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-right">',r=12,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semItem.pug",t=t+'<div class="g-sem-tags"></div></div></div>'}catch(i){Rt(i,n,r)}return t}const Pn="";function Gr(e){var t=""+e,n=hU.exec(t);if(!n)return e;var r,i,a,s="";for(r=n.index,i=0;r<t.length;r++){switch(t.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;case 62:a="&gt;";break;default:continue}i!==r&&(s+=t.substring(i,r)),i=r+1,s+=a}return i!==r?s+t.substring(i,r):s}var hU=/["&<>]/;function yA(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void yA(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function gU(e){var t="",n,r,i;try{var a=e||{};(function(s){i=1,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",(function(){var o=s;if(typeof o.length=="number")for(var u=0,l=o.length;u<l;u++){var c=o[u];i=2,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+'<table class="table table-condensed table-hover">',i=3,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<caption>",i=4,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=c.name)==null?"":n)+"</caption>",i=5,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<thead>",i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<th>",i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"Name</th>",i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<th>",i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"Value</th></thead>",i=8,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<tbody>",i=9,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",(function(){var f=c.data;if(typeof f.length=="number")for(var d=0,h=f.length;d<h;d++){var g=f[d];i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<tr>",i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+" ",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=d)==null?"":n)+"</td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=g)==null?"":n)+"</td></tr>"}else{var h=0;for(var d in f){h++;var g=f[d];i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<tr>",i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+" ",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=d)==null?"":n)+"</td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=g)==null?"":n)+"</td></tr>"}}}).call(this),t=t+"</tbody></table>"}else{var l=0;for(var u in o){l++;var c=o[u];i=2,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+'<table class="table table-condensed table-hover">',i=3,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<caption>",i=4,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=c.name)==null?"":n)+"</caption>",i=5,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<thead>",i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<th>",i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"Name</th>",i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<th>",i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"Value</th></thead>",i=8,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<tbody>",i=9,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",(function(){var g=c.data;if(typeof g.length=="number")for(var p=0,v=g.length;p<v;p++){var m=g[p];i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<tr>",i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+" ",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=p)==null?"":n)+"</td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=m)==null?"":n)+"</td></tr>"}else{var v=0;for(var p in g){v++;var m=g[p];i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<tr>",i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+" ",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=p)==null?"":n)+"</td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+"<td>",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/semMetadata.pug",t=t+Gr((n=m)==null?"":n)+"</td></tr>"}}}).call(this),t=t+"</tbody></table>"}}}).call(this)}).call(this,"config"in a?a.config:typeof config<"u"?config:void 0)}catch(s){yA(s,r,i)}return t}const _Se="";var bA={};(function(e){(function(t){var n=Object.assign(new Error,{name:"ConfigIniParser Error",message:"Parse config ini file error"}),r=Object.assign(new Error,{name:"ConfigIniParser Error",message:"The specify section not found"}),i=Object.assign(new Error,{name:"ConfigIniParser Error",message:"The specify option not found"}),a=Object.assign(new Error,{name:"ConfigIniParser Error",message:"Found duplicated section in the given ini file"}),s=Object.assign(new Error,{name:"ConfigIniParser Error",message:"Multiple call parse on the same parser instance"}),o=Object.assign(new TypeError,{name:"ConfigIniParser Error",message:"The argument type is not correct"}),u="__DEFAULT_SECTION__",l=/^\s*\[\s*([^\]]+?)\s*\]\s*$/,c=/\s*([^=:\s]+)\s*[=:]\s*(.*)\s*/,f=/^\s*[#;].*/,d=/^\s*$/,h=1,g=1,p=2,v=-1,m=`
`;function y(S,_){for(var k=S.sections,T=0;T<k.length;T++){var A=k[T];if(A.name==_)return A}}function b(S,_){for(var k=S.sections,T=0;T<k.length;T++){var A=k[T];if(A.name==_)return T}return v}function w(S,_){for(var k=S.options,T=0;T<k.length;T++){var A=k[T];if(A.name==_)return A}}function E(S,_){for(var k=S.options,T=0;T<k.length;T++){var A=k[T];if(A.name==_)return T}return v}function F(S){return{name:S,options:[]}}function x(S,_){return{name:S,value:_}}var C=function(S){this.delimiter=S||m,this._calledParse=!1,this._ini={sections:[]},this._ini.sections.push(F(u))};C.prototype.addSection=function(S){if(y(this._ini,S))throw a;var _=F(S);return this._ini.sections.push(_),this},C.prototype.get=function(S,_,k){var T=y(this._ini,S||u);if(T){var A=w(T,_);if(A)return A.value}if(k===void 0)throw i;return k},C.prototype.getOptionFromDefaultSection=function(S,_){return this.get(null,S,_)},C.prototype.getBoolean=function(S,_){var k=this.get(S||u,_);return isNaN(k)?String(k).toLowerCase()=="true":k!=0},C.prototype.getBooleanFromDefaultSection=function(S){return this.getBoolean(null,S)},C.prototype.getNumber=function(S,_){return+this.get(S||u,_)},C.prototype.getNumberFromDefaultSection=function(S){return this.getNumber(null,S)},C.prototype.isHaveSection=function(S){if(!S)throw o;return!!y(this._ini,S)},C.prototype.isHaveOption=function(S,_){var k=y(this._ini,S||u);if(k){var T=w(k,_);if(T)return!0}return!1},C.prototype.isHaveOptionInDefaultSection=function(S){return this.isHaveOption(null,S)},C.prototype.items=function(S){for(var _=y(this._ini,S||u),k=[],T=0;T<_.options.length;T++){var A=_.options[T];k.push([A.name,A.value])}return k},C.prototype.options=function(S){var _=y(this._ini,S||u);if(_){for(var k=[],T=_.options,A,$=0;$<T.length;$++)A=T[$],k.push(A.name);return k}else throw r},C.prototype.removeOption=function(S,_){var k=y(this._ini,S||u);if(k){var T=E(k,_);if(T!=v)return k.options.splice(T,1),!0}return!1},C.prototype.removeOptionFromDefaultSection=function(S){return this.removeOption(null,S)},C.prototype.removeSection=function(S){var _=b(this._ini,S||u);return _!=v?(this._ini.sections.splice(_,1),S===u&&this._ini.sections.push(F(u)),!0):!1},C.prototype.sections=function(){for(var S=[],_=this._ini.sections,k,T=0;T<_.length;T++)k=_[T],k.name!=u&&S.push(k.name);return S},C.prototype.set=function(S,_,k){var T=y(this._ini,S||u),A;if(T)return A=w(T,_),A?(A.value=k,this):(A=x(_,k),T.options.push(A),this);throw r},C.prototype.setOptionInDefaultSection=function(S,_){return this.set(null,S,_)},C.prototype.stringify=function(S){for(var _=[],k=this._ini.sections,T,A,$,M=0;M<k.length;M++){T=k[M],T.name!=u&&_.push("["+T.name+"]"),A=T.options;for(var D=0;D<A.length;D++)$=A[D],_.push($.name+"="+$.value);_.length>0&&_.push("")}return _.join(S||this.delimiter)},C.prototype.parse=function(S){if(this._calledParse)throw s;this._calledParse=!0;for(var _=S.split(this.delimiter),k=y(this._ini,u),T=0;T<_.length;T++){var A=_[T];if(!(A.match(f)||A.match(d))){var $=A.match(l);if($){var M=$[h];if(y(this._ini,M))throw a;k=F(M),this._ini.sections.push(k);continue}var D=A.match(c);if(D){var P=D[g],N=D[p],O=x(P,N);k.options.push(O);continue}throw n}}return this},C.Errors={Error:n,ErrorNoSection:r,ErrorNoOption:i,ErrorDuplicateSectionError:a,ErrorCallParseMultipleTimes:s,ErrorIncorrectArgumentType:o},t.ConfigIniParser=C})(e)})(bA);const{restRequest:wA}=girder.rest,B1=girder.views.View,pU=girder.collections.FileCollection,vU=B1.extend({className:"g-sem-view",initialize:function(e){this._semImageView=null,this._semMetadataView=null,this.collection=new pU,this.collection.altUrl="item/"+(e.itemId||e.item.get("_id"))+"/files",this.collection.append=!0;var t=this;this.collection.on("g:changed",function(){wA({url:`item/${e.item.id}/tiff_thumbnail`}).done(n=>{t.image=`data:image/png;base64,${n}`,t.trigger("g:tiffLoaded")}),wA({url:`item/${e.item.id}/tiff_metadata`}).done(n=>{const r=new bA.ConfigIniParser(`\r
`);r.parse(n),t.config=r,t.trigger("g:configLoaded")})}).fetch({itemId:e.item.id}),this.listenTo(this,"g:tiffLoaded",this.render)},render:function(){return this.$el.html(jt()),this._semImageView=new mU({el:this.$(".g-sem-image"),parentView:this}),this._semMetadataView=new yU({el:this.$(".g-sem-tags"),parentView:this}),this._semImageView.render(),this._semMetadataView.render(),this}}),mU=B1.extend({className:"g-sem-image",initialize:function(e){this.listenTo(this.parentView,"g:tiffLoaded",this.render)},render:function(){var e=this.$("div > img");return this.parentView.image&&(e[0].src=this.parentView.image,e[0].width=768),this}}),yU=B1.extend({className:"g-sem-tags",initialize:function(e){this.listenTo(this.parentView,"g:configLoaded",this.render)},render:function(){const e=[];return this.parentView.config&&(this.parentView.config.sections().forEach(t=>{var n={name:t,data:{}};this.parentView.config.items(t).forEach(r=>{n.data[r[0]]=r[1]}),e.push(n)}),this.$el.html(gU({config:e}))),this}});function L1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bU(e){if(Array.isArray(e))return e}function wU(e){if(Array.isArray(e))return L1(e)}function ro(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xU(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,FA(r.key),r)}}function io(e,t,n){return t&&xU(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function $i(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=z1(e))||t){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a,s=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return s=u.done,u},e:function(u){o=!0,a=u},f:function(){try{s||n.return==null||n.return()}finally{if(o)throw a}}}}function xA(e,t,n){return(t=FA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function EU(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function FU(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,i,a,s,o=[],u=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=a.call(n)).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(c){l=!0,i=c}finally{try{if(!u&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(l)throw i}}return o}}function SU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function CU(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pn(e,t){return bU(e)||FU(e,t)||z1(e,t)||SU()}function EA(e){return wU(e)||EU(e)||z1(e)||CU()}function kU(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function FA(e){var t=kU(e,"string");return typeof t=="symbol"?t:t+""}function tn(e){"@babel/helpers - typeof";return tn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tn(e)}function z1(e,t){if(e){if(typeof e=="string")return L1(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?L1(e,t):void 0}}var nn=typeof window>"u"?null:window,SA=nn?nn.navigator:null;nn&&nn.document;var _U=tn(""),CA=tn({}),AU=tn(function(){}),TU=typeof HTMLElement>"u"?"undefined":tn(HTMLElement),Wf=function(t){return t&&t.instanceString&&Lt(t.instanceString)?t.instanceString():null},Me=function(t){return t!=null&&tn(t)==_U},Lt=function(t){return t!=null&&tn(t)===AU},kt=function(t){return!Yr(t)&&(Array.isArray?Array.isArray(t):t!=null&&t instanceof Array)},ut=function(t){return t!=null&&tn(t)===CA&&!kt(t)&&t.constructor===Object},MU=function(t){return t!=null&&tn(t)===CA},ve=function(t){return t!=null&&tn(t)===tn(1)&&!isNaN(t)},$U=function(t){return ve(t)&&Math.floor(t)===t},Zg=function(t){if(TU!=="undefined")return t!=null&&t instanceof HTMLElement},Yr=function(t){return Hf(t)||kA(t)},Hf=function(t){return Wf(t)==="collection"&&t._private.single},kA=function(t){return Wf(t)==="collection"&&!t._private.single},q1=function(t){return Wf(t)==="core"},_A=function(t){return Wf(t)==="stylesheet"},DU=function(t){return Wf(t)==="event"},ao=function(t){return t==null?!0:!!(t===""||t.match(/^\s+$/))},RU=function(t){return typeof HTMLElement>"u"?!1:t instanceof HTMLElement},PU=function(t){return ut(t)&&ve(t.x1)&&ve(t.x2)&&ve(t.y1)&&ve(t.y2)},NU=function(t){return MU(t)&&Lt(t.then)},OU=function(){return SA&&SA.userAgent.match(/msie|trident|edge/i)},Wl=function(t,n){n||(n=function(){if(arguments.length===1)return arguments[0];if(arguments.length===0)return"undefined";for(var a=[],s=0;s<arguments.length;s++)a.push(arguments[s]);return a.join("$")});var r=function(){var a=this,s=arguments,o,u=n.apply(a,s),l=r.cache;return(o=l[u])||(o=l[u]=t.apply(a,s)),o};return r.cache={},r},U1=Wl(function(e){return e.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}),Qg=Wl(function(e){return e.replace(/(-\w)/g,function(t){return t[1].toUpperCase()})}),AA=Wl(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),TA=function(t){return ao(t)?t:t.charAt(0).toUpperCase()+t.substring(1)},rn="(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))",IU="rgb[a]?\\(("+rn+"[%]?)\\s*,\\s*("+rn+"[%]?)\\s*,\\s*("+rn+"[%]?)(?:\\s*,\\s*("+rn+"))?\\)",BU="rgb[a]?\\((?:"+rn+"[%]?)\\s*,\\s*(?:"+rn+"[%]?)\\s*,\\s*(?:"+rn+"[%]?)(?:\\s*,\\s*(?:"+rn+"))?\\)",LU="hsl[a]?\\(("+rn+")\\s*,\\s*("+rn+"[%])\\s*,\\s*("+rn+"[%])(?:\\s*,\\s*("+rn+"))?\\)",zU="hsl[a]?\\((?:"+rn+")\\s*,\\s*(?:"+rn+"[%])\\s*,\\s*(?:"+rn+"[%])(?:\\s*,\\s*(?:"+rn+"))?\\)",qU="\\#[0-9a-fA-F]{3}",UU="\\#[0-9a-fA-F]{6}",MA=function(t,n){return t<n?-1:t>n?1:0},VU=function(t,n){return-1*MA(t,n)},Ie=Object.assign!=null?Object.assign.bind(Object):function(e){for(var t=arguments,n=1;n<t.length;n++){var r=t[n];if(r!=null)for(var i=Object.keys(r),a=0;a<i.length;a++){var s=i[a];e[s]=r[s]}}return e},WU=function(t){if(!(!(t.length===4||t.length===7)||t[0]!=="#")){var n=t.length===4,r,i,a,s=16;return n?(r=parseInt(t[1]+t[1],s),i=parseInt(t[2]+t[2],s),a=parseInt(t[3]+t[3],s)):(r=parseInt(t[1]+t[2],s),i=parseInt(t[3]+t[4],s),a=parseInt(t[5]+t[6],s)),[r,i,a]}},HU=function(t){var n,r,i,a,s,o,u,l;function c(g,p,v){return v<0&&(v+=1),v>1&&(v-=1),v<1/6?g+(p-g)*6*v:v<1/2?p:v<2/3?g+(p-g)*(2/3-v)*6:g}var f=new RegExp("^"+LU+"$").exec(t);if(f){if(r=parseInt(f[1]),r<0?r=(360- -1*r%360)%360:r>360&&(r=r%360),r/=360,i=parseFloat(f[2]),i<0||i>100||(i=i/100,a=parseFloat(f[3]),a<0||a>100)||(a=a/100,s=f[4],s!==void 0&&(s=parseFloat(s),s<0||s>1)))return;if(i===0)o=u=l=Math.round(a*255);else{var d=a<.5?a*(1+i):a+i-a*i,h=2*a-d;o=Math.round(255*c(h,d,r+1/3)),u=Math.round(255*c(h,d,r)),l=Math.round(255*c(h,d,r-1/3))}n=[o,u,l,s]}return n},jU=function(t){var n,r=new RegExp("^"+IU+"$").exec(t);if(r){n=[];for(var i=[],a=1;a<=3;a++){var s=r[a];if(s[s.length-1]==="%"&&(i[a]=!0),s=parseFloat(s),i[a]&&(s=s/100*255),s<0||s>255)return;n.push(Math.floor(s))}var o=i[1]||i[2]||i[3],u=i[1]&&i[2]&&i[3];if(o&&!u)return;var l=r[4];if(l!==void 0){if(l=parseFloat(l),l<0||l>1)return;n.push(l)}}return n},GU=function(t){return YU[t.toLowerCase()]},$A=function(t){return(kt(t)?t:null)||GU(t)||WU(t)||jU(t)||HU(t)},YU={transparent:[0,0,0,0],aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],grey:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},DA=function(t){for(var n=t.map,r=t.keys,i=r.length,a=0;a<i;a++){var s=r[a];if(ut(s))throw Error("Tried to set map with object key");a<r.length-1?(n[s]==null&&(n[s]={}),n=n[s]):n[s]=t.value}},RA=function(t){for(var n=t.map,r=t.keys,i=r.length,a=0;a<i;a++){var s=r[a];if(ut(s))throw Error("Tried to get map with object key");if(n=n[s],n==null)return n}return n},Jg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V1,PA;function Gf(){if(PA)return V1;PA=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return V1=e,V1}var W1,NA;function XU(){if(NA)return W1;NA=1;var e=typeof Jg=="object"&&Jg&&Jg.Object===Object&&Jg;return W1=e,W1}var H1,OA;function ep(){if(OA)return H1;OA=1;var e=XU(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return H1=n,H1}var j1,IA;function KU(){if(IA)return j1;IA=1;var e=ep(),t=function(){return e.Date.now()};return j1=t,j1}var G1,BA;function ZU(){if(BA)return G1;BA=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return G1=t,G1}var Y1,LA;function QU(){if(LA)return Y1;LA=1;var e=ZU(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Y1=n,Y1}var X1,zA;function K1(){if(zA)return X1;zA=1;var e=ep(),t=e.Symbol;return X1=t,X1}var Z1,qA;function JU(){if(qA)return Z1;qA=1;var e=K1(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,i=e?e.toStringTag:void 0;function a(s){var o=n.call(s,i),u=s[i];try{s[i]=void 0;var l=!0}catch{}var c=r.call(s);return l&&(o?s[i]=u:delete s[i]),c}return Z1=a,Z1}var Q1,UA;function eV(){if(UA)return Q1;UA=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Q1=n,Q1}var J1,VA;function WA(){if(VA)return J1;VA=1;var e=K1(),t=JU(),n=eV(),r="[object Null]",i="[object Undefined]",a=e?e.toStringTag:void 0;function s(o){return o==null?o===void 0?i:r:a&&a in Object(o)?t(o):n(o)}return J1=s,J1}var eb,HA;function tV(){if(HA)return eb;HA=1;function e(t){return t!=null&&typeof t=="object"}return eb=e,eb}var tb,jA;function Yf(){if(jA)return tb;jA=1;var e=WA(),t=tV(),n="[object Symbol]";function r(i){return typeof i=="symbol"||t(i)&&e(i)==n}return tb=r,tb}var nb,GA;function nV(){if(GA)return nb;GA=1;var e=QU(),t=Gf(),n=Yf(),r=0/0,i=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,s=/^0o[0-7]+$/i,o=parseInt;function u(l){if(typeof l=="number")return l;if(n(l))return r;if(t(l)){var c=typeof l.valueOf=="function"?l.valueOf():l;l=t(c)?c+"":c}if(typeof l!="string")return l===0?l:+l;l=e(l);var f=a.test(l);return f||s.test(l)?o(l.slice(2),f?2:8):i.test(l)?r:+l}return nb=u,nb}var rb,YA;function rV(){if(YA)return rb;YA=1;var e=Gf(),t=KU(),n=nV(),r="Expected a function",i=Math.max,a=Math.min;function s(o,u,l){var c,f,d,h,g,p,v=0,m=!1,y=!1,b=!0;if(typeof o!="function")throw new TypeError(r);u=n(u)||0,e(l)&&(m=!!l.leading,y="maxWait"in l,d=y?i(n(l.maxWait)||0,u):d,b="trailing"in l?!!l.trailing:b);function w(A){var $=c,M=f;return c=f=void 0,v=A,h=o.apply(M,$),h}function E(A){return v=A,g=setTimeout(C,u),m?w(A):h}function F(A){var $=A-p,M=A-v,D=u-$;return y?a(D,d-M):D}function x(A){var $=A-p,M=A-v;return p===void 0||$>=u||$<0||y&&M>=d}function C(){var A=t();if(x(A))return S(A);g=setTimeout(C,F(A))}function S(A){return g=void 0,b&&c?w(A):(c=f=void 0,h)}function _(){g!==void 0&&clearTimeout(g),v=0,c=p=f=g=void 0}function k(){return g===void 0?h:S(t())}function T(){var A=t(),$=x(A);if(c=arguments,f=this,p=A,$){if(g===void 0)return E(p);if(y)return clearTimeout(g),g=setTimeout(C,u),w(p)}return g===void 0&&(g=setTimeout(C,u)),h}return T.cancel=_,T.flush=k,T}return rb=s,rb}var iV=rV(),Xf=jf(iV),ib=nn?nn.performance:null,XA=ib&&ib.now?function(){return ib.now()}:function(){return Date.now()},aV=function(){if(nn){if(nn.requestAnimationFrame)return function(e){nn.requestAnimationFrame(e)};if(nn.mozRequestAnimationFrame)return function(e){nn.mozRequestAnimationFrame(e)};if(nn.webkitRequestAnimationFrame)return function(e){nn.webkitRequestAnimationFrame(e)};if(nn.msRequestAnimationFrame)return function(e){nn.msRequestAnimationFrame(e)}}return function(e){e&&setTimeout(function(){e(XA())},1e3/60)}}(),tp=function(t){return aV(t)},ss=XA,Hl=9261,KA=65599,Kf=5381,ZA=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hl,r=n,i;i=t.next(),!i.done;)r=r*KA+i.value|0;return r},Zf=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Hl;return n*KA+t|0},Qf=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Kf;return(n<<5)+n+t|0},sV=function(t,n){return t*2097152+n},so=function(t){return t[0]*2097152+t[1]},np=function(t,n){return[Zf(t[0],n[0]),Qf(t[1],n[1])]},QA=function(t,n){var r={value:0,done:!1},i=0,a=t.length,s={next:function(){return i<a?r.value=t[i++]:r.done=!0,r}};return ZA(s,n)},oo=function(t,n){var r={value:0,done:!1},i=0,a=t.length,s={next:function(){return i<a?r.value=t.charCodeAt(i++):r.done=!0,r}};return ZA(s,n)},JA=function(){return oV(arguments)},oV=function(t){for(var n,r=0;r<t.length;r++){var i=t[r];r===0?n=oo(i):n=oo(i,n)}return n},eT=!0,uV=console.warn!=null,lV=console.trace!=null,ab=Number.MAX_SAFE_INTEGER||9007199254740991,tT=function(){return!0},rp=function(){return!1},nT=function(){return 0},sb=function(){},zt=function(t){throw new Error(t)},rT=function(t){if(t!==void 0)eT=!!t;else return eT},gt=function(t){rT()&&(uV?console.warn(t):(console.log(t),lV&&console.trace()))},cV=function(t){return Ie({},t)},ga=function(t){return t==null?t:kt(t)?t.slice():ut(t)?cV(t):t},fV=function(t){return t.slice()},iT=function(t,n){for(n=t="";t++<36;n+=t*51&52?(t^15?8^Math.random()*(t^20?16:4):4).toString(16):"-");return n},dV={},aT=function(){return dV},an=function(t){var n=Object.keys(t);return function(r){for(var i={},a=0;a<n.length;a++){var s=n[a],o=r==null?void 0:r[s];i[s]=o===void 0?t[s]:o}return i}},uo=function(t,n,r){for(var i=t.length-1;i>=0;i--)t[i]===n&&t.splice(i,1)},ob=function(t){t.splice(0,t.length)},hV=function(t,n){for(var r=0;r<n.length;r++){var i=n[r];t.push(i)}},ui=function(t,n,r){return r&&(n=AA(r,n)),t[n]},os=function(t,n,r,i){r&&(n=AA(r,n)),t[n]=i},gV=function(){function e(){ro(this,e),this._obj={}}return io(e,[{key:"set",value:function(n,r){return this._obj[n]=r,this}},{key:"delete",value:function(n){return this._obj[n]=void 0,this}},{key:"clear",value:function(){this._obj={}}},{key:"has",value:function(n){return this._obj[n]!==void 0}},{key:"get",value:function(n){return this._obj[n]}}])}(),us=typeof Map<"u"?Map:gV,pV="undefined",vV=function(){function e(t){if(ro(this,e),this._obj=Object.create(null),this.size=0,t!=null){var n;t.instanceString!=null&&t.instanceString()===this.instanceString()?n=t.toArray():n=t;for(var r=0;r<n.length;r++)this.add(n[r])}}return io(e,[{key:"instanceString",value:function(){return"set"}},{key:"add",value:function(n){var r=this._obj;r[n]!==1&&(r[n]=1,this.size++)}},{key:"delete",value:function(n){var r=this._obj;r[n]===1&&(r[n]=0,this.size--)}},{key:"clear",value:function(){this._obj=Object.create(null)}},{key:"has",value:function(n){return this._obj[n]===1}},{key:"toArray",value:function(){var n=this;return Object.keys(this._obj).filter(function(r){return n.has(r)})}},{key:"forEach",value:function(n,r){return this.toArray().forEach(n,r)}}])}(),jl=(typeof Set>"u"?"undefined":tn(Set))!==pV?Set:vV,ip=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(t===void 0||n===void 0||!q1(t)){zt("An element must have a core reference and parameters set");return}var i=n.group;if(i==null&&(n.data&&n.data.source!=null&&n.data.target!=null?i="edges":i="nodes"),i!=="nodes"&&i!=="edges"){zt("An element must be of type `nodes` or `edges`; you specified `"+i+"`");return}this.length=1,this[0]=this;var a=this._private={cy:t,single:!0,data:n.data||{},position:n.position||{x:0,y:0},autoWidth:void 0,autoHeight:void 0,autoPadding:void 0,compoundBoundsClean:!1,listeners:[],group:i,style:{},rstyle:{},styleCxts:[],styleKeys:{},removed:!0,selected:!!n.selected,selectable:n.selectable===void 0?!0:!!n.selectable,locked:!!n.locked,grabbed:!1,grabbable:n.grabbable===void 0?!0:!!n.grabbable,pannable:n.pannable===void 0?i==="edges":!!n.pannable,active:!1,classes:new jl,animation:{current:[],queue:[]},rscratch:{},scratch:n.scratch||{},edges:[],children:[],parent:n.parent&&n.parent.isNode()?n.parent:null,traversalCache:{},backgrounding:!1,bbCache:null,bbCacheShift:{x:0,y:0},bodyBounds:null,overlayBounds:null,labelBounds:{all:null,source:null,target:null,main:null},arrowBounds:{source:null,target:null,"mid-source":null,"mid-target":null}};if(a.position.x==null&&(a.position.x=0),a.position.y==null&&(a.position.y=0),n.renderedPosition){var s=n.renderedPosition,o=t.pan(),u=t.zoom();a.position={x:(s.x-o.x)/u,y:(s.y-o.y)/u}}var l=[];kt(n.classes)?l=n.classes:Me(n.classes)&&(l=n.classes.split(/\s+/));for(var c=0,f=l.length;c<f;c++){var d=l[c];!d||d===""||a.classes.add(d)}this.createEmitter(),(r===void 0||r)&&this.restore();var h=n.style||n.css;h&&(gt("Setting a `style` bypass at element creation should be done only when absolutely necessary.  Try to use the stylesheet instead."),this.style(h))},sT=function(t){return t={bfs:t.bfs||!t.dfs,dfs:t.dfs||!t.bfs},function(r,i,a){var s;ut(r)&&!Yr(r)&&(s=r,r=s.roots||s.root,i=s.visit,a=s.directed),a=arguments.length===2&&!Lt(i)?i:a,i=Lt(i)?i:function(){};for(var o=this._private.cy,u=r=Me(r)?this.filter(r):r,l=[],c=[],f={},d={},h={},g=0,p,v=this.byGroup(),m=v.nodes,y=v.edges,b=0;b<u.length;b++){var w=u[b],E=w.id();w.isNode()&&(l.unshift(w),t.bfs&&(h[E]=!0,c.push(w)),d[E]=0)}for(var F=function(){var A=t.bfs?l.shift():l.pop(),$=A.id();if(t.dfs){if(h[$])return 0;h[$]=!0,c.push(A)}var M=d[$],D=f[$],P=D!=null?D.source():null,N=D!=null?D.target():null,O=D==null?void 0:A.same(P)?N[0]:P[0],q;if(q=i(A,D,O,g++,M),q===!0)return p=A,1;if(q===!1)return 1;for(var z=A.connectedEdges().filter(function(te){return(!a||te.source().same(A))&&y.has(te)}),W=0;W<z.length;W++){var Y=z[W],J=Y.connectedNodes().filter(function(te){return!te.same(A)&&m.has(te)}),X=J.id();J.length!==0&&!h[X]&&(J=J[0],l.push(J),t.bfs&&(h[X]=!0,c.push(J)),f[X]=Y,d[X]=d[$]+1)}},x;l.length!==0&&(x=F(),!(x!==0&&x===1)););for(var C=o.collection(),S=0;S<c.length;S++){var _=c[S],k=f[_.id()];k!=null&&C.push(k),C.push(_)}return{path:o.collection(C),found:o.collection(p)}}},Jf={breadthFirstSearch:sT({bfs:!0}),depthFirstSearch:sT({dfs:!0})};Jf.bfs=Jf.breadthFirstSearch,Jf.dfs=Jf.depthFirstSearch;var ap={exports:{}},mV=ap.exports,oT;function yV(){return oT||(oT=1,function(e,t){(function(){var n,r,i,a,s,o,u,l,c,f,d,h,g,p,v;i=Math.floor,f=Math.min,r=function(m,y){return m<y?-1:m>y?1:0},c=function(m,y,b,w,E){var F;if(b==null&&(b=0),E==null&&(E=r),b<0)throw new Error("lo must be non-negative");for(w==null&&(w=m.length);b<w;)F=i((b+w)/2),E(y,m[F])<0?w=F:b=F+1;return[].splice.apply(m,[b,b-b].concat(y)),y},o=function(m,y,b){return b==null&&(b=r),m.push(y),p(m,0,m.length-1,b)},s=function(m,y){var b,w;return y==null&&(y=r),b=m.pop(),m.length?(w=m[0],m[0]=b,v(m,0,y)):w=b,w},l=function(m,y,b){var w;return b==null&&(b=r),w=m[0],m[0]=y,v(m,0,b),w},u=function(m,y,b){var w;return b==null&&(b=r),m.length&&b(m[0],y)<0&&(w=[m[0],y],y=w[0],m[0]=w[1],v(m,0,b)),y},a=function(m,y){var b,w,E,F,x,C;for(y==null&&(y=r),F=(function(){C=[];for(var S=0,_=i(m.length/2);0<=_?S<_:S>_;0<=_?S++:S--)C.push(S);return C}).apply(this).reverse(),x=[],w=0,E=F.length;w<E;w++)b=F[w],x.push(v(m,b,y));return x},g=function(m,y,b){var w;if(b==null&&(b=r),w=m.indexOf(y),w!==-1)return p(m,0,w,b),v(m,w,b)},d=function(m,y,b){var w,E,F,x,C;if(b==null&&(b=r),E=m.slice(0,y),!E.length)return E;for(a(E,b),C=m.slice(y),F=0,x=C.length;F<x;F++)w=C[F],u(E,w,b);return E.sort(b).reverse()},h=function(m,y,b){var w,E,F,x,C,S,_,k,T;if(b==null&&(b=r),y*10<=m.length){if(F=m.slice(0,y).sort(b),!F.length)return F;for(E=F[F.length-1],_=m.slice(y),x=0,S=_.length;x<S;x++)w=_[x],b(w,E)<0&&(c(F,w,0,null,b),F.pop(),E=F[F.length-1]);return F}for(a(m,b),T=[],C=0,k=f(y,m.length);0<=k?C<k:C>k;0<=k?++C:--C)T.push(s(m,b));return T},p=function(m,y,b,w){var E,F,x;for(w==null&&(w=r),E=m[b];b>y;){if(x=b-1>>1,F=m[x],w(E,F)<0){m[b]=F,b=x;continue}break}return m[b]=E},v=function(m,y,b){var w,E,F,x,C;for(b==null&&(b=r),E=m.length,C=y,F=m[y],w=2*y+1;w<E;)x=w+1,x<E&&!(b(m[w],m[x])<0)&&(w=x),m[y]=m[w],y=w,w=2*y+1;return m[y]=F,p(m,C,y,b)},n=function(){m.push=o,m.pop=s,m.replace=l,m.pushpop=u,m.heapify=a,m.updateItem=g,m.nlargest=d,m.nsmallest=h;function m(y){this.cmp=y??r,this.nodes=[]}return m.prototype.push=function(y){return o(this.nodes,y,this.cmp)},m.prototype.pop=function(){return s(this.nodes,this.cmp)},m.prototype.peek=function(){return this.nodes[0]},m.prototype.contains=function(y){return this.nodes.indexOf(y)!==-1},m.prototype.replace=function(y){return l(this.nodes,y,this.cmp)},m.prototype.pushpop=function(y){return u(this.nodes,y,this.cmp)},m.prototype.heapify=function(){return a(this.nodes,this.cmp)},m.prototype.updateItem=function(y){return g(this.nodes,y,this.cmp)},m.prototype.clear=function(){return this.nodes=[]},m.prototype.empty=function(){return this.nodes.length===0},m.prototype.size=function(){return this.nodes.length},m.prototype.clone=function(){var y;return y=new m,y.nodes=this.nodes.slice(0),y},m.prototype.toArray=function(){return this.nodes.slice(0)},m.prototype.insert=m.prototype.push,m.prototype.top=m.prototype.peek,m.prototype.front=m.prototype.peek,m.prototype.has=m.prototype.contains,m.prototype.copy=m.prototype.clone,m}(),function(m,y){return e.exports=y()}(this,function(){return n})}).call(mV)}(ap)),ap.exports}var ub,uT;function bV(){return uT||(uT=1,ub=yV()),ub}var wV=bV(),ed=jf(wV),xV=an({root:null,weight:function(t){return 1},directed:!1}),EV={dijkstra:function(t){if(!ut(t)){var n=arguments;t={root:n[0],weight:n[1],directed:n[2]}}var r=xV(t),i=r.root,a=r.weight,s=r.directed,o=this,u=a,l=Me(i)?this.filter(i)[0]:i[0],c={},f={},d={},h=this.byGroup(),g=h.nodes,p=h.edges;p.unmergeBy(function(M){return M.isLoop()});for(var v=function(D){return c[D.id()]},m=function(D,P){c[D.id()]=P,y.updateItem(D)},y=new ed(function(M,D){return v(M)-v(D)}),b=0;b<g.length;b++){var w=g[b];c[w.id()]=w.same(l)?0:1/0,y.push(w)}for(var E=function(D,P){for(var N=(s?D.edgesTo(P):D.edgesWith(P)).intersect(p),O=1/0,q,z=0;z<N.length;z++){var W=N[z],Y=u(W);(Y<O||!q)&&(O=Y,q=W)}return{edge:q,dist:O}};y.size()>0;){var F=y.pop(),x=v(F),C=F.id();if(d[C]=x,x!==1/0)for(var S=F.neighborhood().intersect(g),_=0;_<S.length;_++){var k=S[_],T=k.id(),A=E(F,k),$=x+A.dist;$<v(k)&&(m(k,$),f[T]={node:F,edge:A.edge})}}return{distanceTo:function(D){var P=Me(D)?g.filter(D)[0]:D[0];return d[P.id()]},pathTo:function(D){var P=Me(D)?g.filter(D)[0]:D[0],N=[],O=P,q=O.id();if(P.length>0)for(N.unshift(P);f[q];){var z=f[q];N.unshift(z.edge),N.unshift(z.node),O=z.node,q=O.id()}return o.spawn(N)}}}},FV={kruskal:function(t){t=t||function(b){return 1};for(var n=this.byGroup(),r=n.nodes,i=n.edges,a=r.length,s=new Array(a),o=r,u=function(w){for(var E=0;E<s.length;E++){var F=s[E];if(F.has(w))return E}},l=0;l<a;l++)s[l]=this.spawn(r[l]);for(var c=i.sort(function(b,w){return t(b)-t(w)}),f=0;f<c.length;f++){var d=c[f],h=d.source()[0],g=d.target()[0],p=u(h),v=u(g),m=s[p],y=s[v];p!==v&&(o.merge(d),m.merge(y),s.splice(v,1))}return o}},SV=an({root:null,goal:null,weight:function(t){return 1},heuristic:function(t){return 0},directed:!1}),CV={aStar:function(t){var n=this.cy(),r=SV(t),i=r.root,a=r.goal,s=r.heuristic,o=r.directed,u=r.weight;i=n.collection(i)[0],a=n.collection(a)[0];var l=i.id(),c=a.id(),f={},d={},h={},g=new ed(function(q,z){return d[q.id()]-d[z.id()]}),p=new jl,v={},m={},y=function(z,W){g.push(z),p.add(W)},b,w,E=function(){b=g.pop(),w=b.id(),p.delete(w)},F=function(z){return p.has(z)};y(i,l),f[l]=0,d[l]=s(i);for(var x=0;g.size()>0;){if(E(),x++,w===c){for(var C=[],S=a,_=c,k=m[_];C.unshift(S),k!=null&&C.unshift(k),S=v[_],S!=null;)_=S.id(),k=m[_];return{found:!0,distance:f[w],path:this.spawn(C),steps:x}}h[w]=!0;for(var T=b._private.edges,A=0;A<T.length;A++){var $=T[A];if(this.hasElementWithId($.id())&&!(o&&$.data("source")!==w)){var M=$.source(),D=$.target(),P=M.id()!==w?M:D,N=P.id();if(this.hasElementWithId(N)&&!h[N]){var O=f[w]+u($);if(!F(N)){f[N]=O,d[N]=O+s(P),y(P,N),v[N]=b,m[N]=$;continue}O<f[N]&&(f[N]=O,d[N]=O+s(P),v[N]=b,m[N]=$)}}}}return{found:!1,distance:void 0,path:void 0,steps:x}}},kV=an({weight:function(t){return 1},directed:!1}),_V={floydWarshall:function(t){for(var n=this.cy(),r=kV(t),i=r.weight,a=r.directed,s=i,o=this.byGroup(),u=o.nodes,l=o.edges,c=u.length,f=c*c,d=function(Y){return u.indexOf(Y)},h=function(Y){return u[Y]},g=new Array(f),p=0;p<f;p++){var v=p%c,m=(p-v)/c;m===v?g[p]=0:g[p]=1/0}for(var y=new Array(f),b=new Array(f),w=0;w<l.length;w++){var E=l[w],F=E.source()[0],x=E.target()[0];if(F!==x){var C=d(F),S=d(x),_=C*c+S,k=s(E);if(g[_]>k&&(g[_]=k,y[_]=S,b[_]=E),!a){var T=S*c+C;!a&&g[T]>k&&(g[T]=k,y[T]=C,b[T]=E)}}}for(var A=0;A<c;A++)for(var $=0;$<c;$++)for(var M=$*c+A,D=0;D<c;D++){var P=$*c+D,N=A*c+D;g[M]+g[N]<g[P]&&(g[P]=g[M]+g[N],y[P]=y[M])}var O=function(Y){return(Me(Y)?n.filter(Y):Y)[0]},q=function(Y){return d(O(Y))},z={distance:function(Y,J){var X=q(Y),te=q(J);return g[X*c+te]},path:function(Y,J){var X=q(Y),te=q(J),ie=h(X);if(X===te)return ie.collection();if(y[X*c+te]==null)return n.collection();var se=n.collection(),B=X,I;for(se.merge(ie);X!==te;)B=X,X=y[X*c+te],I=b[B*c+X],se.merge(I),se.merge(h(X));return se}};return z}},AV=an({weight:function(t){return 1},directed:!1,root:null}),TV={bellmanFord:function(t){var n=this,r=AV(t),i=r.weight,a=r.directed,s=r.root,o=i,u=this,l=this.cy(),c=this.byGroup(),f=c.edges,d=c.nodes,h=d.length,g=new us,p=!1,v=[];s=l.collection(s)[0],f.unmergeBy(function(Qe){return Qe.isLoop()});for(var m=f.length,y=function(Fe){var ke=g.get(Fe.id());return ke||(ke={},g.set(Fe.id(),ke)),ke},b=function(Fe){return(Me(Fe)?l.$(Fe):Fe)[0]},w=function(Fe){return y(b(Fe)).dist},E=function(Fe){for(var ke=arguments.length>1&&arguments[1]!==void 0?arguments[1]:s,Be=b(Fe),Ue=[],Le=Be;;){if(Le==null)return n.spawn();var Ve=y(Le),Xe=Ve.edge,nt=Ve.pred;if(Ue.unshift(Le[0]),Le.same(ke)&&Ue.length>0)break;Xe!=null&&Ue.unshift(Xe),Le=nt}return u.spawn(Ue)},F=0;F<h;F++){var x=d[F],C=y(x);x.same(s)?C.dist=0:C.dist=1/0,C.pred=null,C.edge=null}for(var S=!1,_=function(Fe,ke,Be,Ue,Le,Ve){var Xe=Ue.dist+Ve;Xe<Le.dist&&!Be.same(Ue.edge)&&(Le.dist=Xe,Le.pred=Fe,Le.edge=Be,S=!0)},k=1;k<h;k++){S=!1;for(var T=0;T<m;T++){var A=f[T],$=A.source(),M=A.target(),D=o(A),P=y($),N=y(M);_($,M,A,P,N,D),a||_(M,$,A,N,P,D)}if(!S)break}if(S)for(var O=[],q=0;q<m;q++){var z=f[q],W=z.source(),Y=z.target(),J=o(z),X=y(W).dist,te=y(Y).dist;if(X+J<te||!a&&te+J<X)if(p||(gt("Graph contains a negative weight cycle for Bellman-Ford"),p=!0),t.findNegativeWeightCycles!==!1){var ie=[];X+J<te&&ie.push(W),!a&&te+J<X&&ie.push(Y);for(var se=ie.length,B=0;B<se;B++){var I=ie[B],U=[I];U.push(y(I).edge);for(var L=y(I).pred;U.indexOf(L)===-1;)U.push(L),U.push(y(L).edge),L=y(L).pred;U=U.slice(U.indexOf(L));for(var ae=U[0].id(),de=0,Ce=2;Ce<U.length;Ce+=2)U[Ce].id()<ae&&(ae=U[Ce].id(),de=Ce);U=U.slice(de).concat(U.slice(0,de)),U.push(U[0]);var Ye=U.map(function(Qe){return Qe.id()}).join(",");O.indexOf(Ye)===-1&&(v.push(u.spawn(U)),O.push(Ye))}}else break}return{distanceTo:w,pathTo:E,hasNegativeWeightCycle:p,negativeWeightCycles:v}}},MV=Math.sqrt(2),$V=function(t,n,r){r.length===0&&zt("Karger-Stein must be run on a connected (sub)graph");for(var i=r[t],a=i[1],s=i[2],o=n[a],u=n[s],l=r,c=l.length-1;c>=0;c--){var f=l[c],d=f[1],h=f[2];(n[d]===o&&n[h]===u||n[d]===u&&n[h]===o)&&l.splice(c,1)}for(var g=0;g<l.length;g++){var p=l[g];p[1]===u?(l[g]=p.slice(),l[g][1]=o):p[2]===u&&(l[g]=p.slice(),l[g][2]=o)}for(var v=0;v<n.length;v++)n[v]===u&&(n[v]=o);return l},lb=function(t,n,r,i){for(;r>i;){var a=Math.floor(Math.random()*n.length);n=$V(a,t,n),r--}return n},DV={kargerStein:function(){var t=this,n=this.byGroup(),r=n.nodes,i=n.edges;i.unmergeBy(function(N){return N.isLoop()});var a=r.length,s=i.length,o=Math.ceil(Math.pow(Math.log(a)/Math.LN2,2)),u=Math.floor(a/MV);if(a<2){zt("At least 2 nodes are required for Karger-Stein algorithm");return}for(var l=[],c=0;c<s;c++){var f=i[c];l.push([c,r.indexOf(f.source()),r.indexOf(f.target())])}for(var d=1/0,h=[],g=new Array(a),p=new Array(a),v=new Array(a),m=function(O,q){for(var z=0;z<a;z++)q[z]=O[z]},y=0;y<=o;y++){for(var b=0;b<a;b++)p[b]=b;var w=lb(p,l.slice(),a,u),E=w.slice();m(p,v);var F=lb(p,w,u,2),x=lb(v,E,u,2);F.length<=x.length&&F.length<d?(d=F.length,h=F,m(p,g)):x.length<=F.length&&x.length<d&&(d=x.length,h=x,m(v,g))}for(var C=this.spawn(h.map(function(N){return i[N[0]]})),S=this.spawn(),_=this.spawn(),k=g[0],T=0;T<g.length;T++){var A=g[T],$=r[T];A===k?S.merge($):_.merge($)}var M=function(O){var q=t.spawn();return O.forEach(function(z){q.merge(z),z.connectedEdges().forEach(function(W){t.contains(W)&&!C.contains(W)&&q.merge(W)})}),q},D=[M(S),M(_)],P={cut:C,components:D,partition1:S,partition2:_};return P}},RV=function(t){return{x:t.x,y:t.y}},sp=function(t,n,r){return{x:t.x*n+r.x,y:t.y*n+r.y}},lT=function(t,n,r){return{x:(t.x-r.x)/n,y:(t.y-r.y)/n}},Gl=function(t){return{x:t[0],y:t[1]}},PV=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=1/0,a=n;a<r;a++){var s=t[a];isFinite(s)&&(i=Math.min(s,i))}return i},NV=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=-1/0,a=n;a<r;a++){var s=t[a];isFinite(s)&&(i=Math.max(s,i))}return i},OV=function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=0,a=0,s=n;s<r;s++){var o=t[s];isFinite(o)&&(i+=o,a++)}return i/a},IV=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:t.length,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;i?t=t.slice(n,r):(r<t.length&&t.splice(r,t.length-r),n>0&&t.splice(0,n));for(var o=0,u=t.length-1;u>=0;u--){var l=t[u];s?isFinite(l)||(t[u]=-1/0,o++):t.splice(u,1)}a&&t.sort(function(d,h){return d-h});var c=t.length,f=Math.floor(c/2);return c%2!==0?t[f+1+o]:(t[f-1+o]+t[f+o])/2},BV=function(t){return Math.PI*t/180},op=function(t,n){return Math.atan2(n,t)-Math.PI/2},cb=Math.log2||function(e){return Math.log(e)/Math.log(2)},cT=function(t){return t>0?1:t<0?-1:0},hu=function(t,n){return Math.sqrt(gu(t,n))},gu=function(t,n){var r=n.x-t.x,i=n.y-t.y;return r*r+i*i},LV=function(t){for(var n=t.length,r=0,i=0;i<n;i++)r+=t[i];for(var a=0;a<n;a++)t[a]=t[a]/r;return t},vn=function(t,n,r,i){return(1-i)*(1-i)*t+2*(1-i)*i*n+i*i*r},Yl=function(t,n,r,i){return{x:vn(t.x,n.x,r.x,i),y:vn(t.y,n.y,r.y,i)}},zV=function(t,n,r,i){var a={x:n.x-t.x,y:n.y-t.y},s=hu(t,n),o={x:a.x/s,y:a.y/s};return r=r??0,i=i??r*s,{x:t.x+o.x*i,y:t.y+o.y*i}},td=function(t,n,r){return Math.max(t,Math.min(r,n))},Rr=function(t){if(t==null)return{x1:1/0,y1:1/0,x2:-1/0,y2:-1/0,w:0,h:0};if(t.x1!=null&&t.y1!=null){if(t.x2!=null&&t.y2!=null&&t.x2>=t.x1&&t.y2>=t.y1)return{x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,w:t.x2-t.x1,h:t.y2-t.y1};if(t.w!=null&&t.h!=null&&t.w>=0&&t.h>=0)return{x1:t.x1,y1:t.y1,x2:t.x1+t.w,y2:t.y1+t.h,w:t.w,h:t.h}}},qV=function(t){return{x1:t.x1,x2:t.x2,w:t.w,y1:t.y1,y2:t.y2,h:t.h}},UV=function(t){t.x1=1/0,t.y1=1/0,t.x2=-1/0,t.y2=-1/0,t.w=0,t.h=0},VV=function(t,n,r){return{x1:t.x1+n,x2:t.x2+n,y1:t.y1+r,y2:t.y2+r,w:t.w,h:t.h}},fT=function(t,n){t.x1=Math.min(t.x1,n.x1),t.x2=Math.max(t.x2,n.x2),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,n.y1),t.y2=Math.max(t.y2,n.y2),t.h=t.y2-t.y1},WV=function(t,n,r){t.x1=Math.min(t.x1,n),t.x2=Math.max(t.x2,n),t.w=t.x2-t.x1,t.y1=Math.min(t.y1,r),t.y2=Math.max(t.y2,r),t.h=t.y2-t.y1},up=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return t.x1-=n,t.x2+=n,t.y1-=n,t.y2+=n,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},lp=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[0],r,i,a,s;if(n.length===1)r=i=a=s=n[0];else if(n.length===2)r=a=n[0],s=i=n[1];else if(n.length===4){var o=pn(n,4);r=o[0],i=o[1],a=o[2],s=o[3]}return t.x1-=s,t.x2+=i,t.y1-=r,t.y2+=a,t.w=t.x2-t.x1,t.h=t.y2-t.y1,t},dT=function(t,n){t.x1=n.x1,t.y1=n.y1,t.x2=n.x2,t.y2=n.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1},fb=function(t,n){return!(t.x1>n.x2||n.x1>t.x2||t.x2<n.x1||n.x2<t.x1||t.y2<n.y1||n.y2<t.y1||t.y1>n.y2||n.y1>t.y2)},Xl=function(t,n,r){return t.x1<=n&&n<=t.x2&&t.y1<=r&&r<=t.y2},HV=function(t,n){return Xl(t,n.x,n.y)},hT=function(t,n){return Xl(t,n.x1,n.y1)&&Xl(t,n.x2,n.y2)},gT=function(t,n,r,i,a,s,o){var u=arguments.length>7&&arguments[7]!==void 0?arguments[7]:"auto",l=u==="auto"?vu(a,s):u,c=a/2,f=s/2;l=Math.min(l,c,f);var d=l!==c,h=l!==f,g;if(d){var p=r-c+l-o,v=i-f-o,m=r+c-l+o,y=v;if(g=lo(t,n,r,i,p,v,m,y,!1),g.length>0)return g}if(h){var b=r+c+o,w=i-f+l-o,E=b,F=i+f-l+o;if(g=lo(t,n,r,i,b,w,E,F,!1),g.length>0)return g}if(d){var x=r-c+l-o,C=i+f+o,S=r+c-l+o,_=C;if(g=lo(t,n,r,i,x,C,S,_,!1),g.length>0)return g}if(h){var k=r-c-o,T=i-f+l-o,A=k,$=i+f-l+o;if(g=lo(t,n,r,i,k,T,A,$,!1),g.length>0)return g}var M;{var D=r-c+l,P=i-f+l;if(M=nd(t,n,r,i,D,P,l+o),M.length>0&&M[0]<=D&&M[1]<=P)return[M[0],M[1]]}{var N=r+c-l,O=i-f+l;if(M=nd(t,n,r,i,N,O,l+o),M.length>0&&M[0]>=N&&M[1]<=O)return[M[0],M[1]]}{var q=r+c-l,z=i+f-l;if(M=nd(t,n,r,i,q,z,l+o),M.length>0&&M[0]>=q&&M[1]>=z)return[M[0],M[1]]}{var W=r-c+l,Y=i+f-l;if(M=nd(t,n,r,i,W,Y,l+o),M.length>0&&M[0]<=W&&M[1]>=Y)return[M[0],M[1]]}return[]},jV=function(t,n,r,i,a,s,o){var u=o,l=Math.min(r,a),c=Math.max(r,a),f=Math.min(i,s),d=Math.max(i,s);return l-u<=t&&t<=c+u&&f-u<=n&&n<=d+u},GV=function(t,n,r,i,a,s,o,u,l){var c={x1:Math.min(r,o,a)-l,x2:Math.max(r,o,a)+l,y1:Math.min(i,u,s)-l,y2:Math.max(i,u,s)+l};return!(t<c.x1||t>c.x2||n<c.y1||n>c.y2)},YV=function(t,n,r,i){r-=i;var a=n*n-4*t*r;if(a<0)return[];var s=Math.sqrt(a),o=2*t,u=(-n+s)/o,l=(-n-s)/o;return[u,l]},XV=function(t,n,r,i,a){var s=1e-5;t===0&&(t=s),n/=t,r/=t,i/=t;var o,u,l,c,f,d,h,g;if(u=(3*r-n*n)/9,l=-(27*i)+n*(9*r-2*(n*n)),l/=54,o=u*u*u+l*l,a[1]=0,h=n/3,o>0){f=l+Math.sqrt(o),f=f<0?-Math.pow(-f,1/3):Math.pow(f,1/3),d=l-Math.sqrt(o),d=d<0?-Math.pow(-d,1/3):Math.pow(d,1/3),a[0]=-h+f+d,h+=(f+d)/2,a[4]=a[2]=-h,h=Math.sqrt(3)*(-d+f)/2,a[3]=h,a[5]=-h;return}if(a[5]=a[3]=0,o===0){g=l<0?-Math.pow(-l,1/3):Math.pow(l,1/3),a[0]=-h+2*g,a[4]=a[2]=-(g+h);return}u=-u,c=u*u*u,c=Math.acos(l/Math.sqrt(c)),g=2*Math.sqrt(u),a[0]=-h+g*Math.cos(c/3),a[2]=-h+g*Math.cos((c+2*Math.PI)/3),a[4]=-h+g*Math.cos((c+4*Math.PI)/3)},KV=function(t,n,r,i,a,s,o,u){var l=1*r*r-4*r*a+2*r*o+4*a*a-4*a*o+o*o+i*i-4*i*s+2*i*u+4*s*s-4*s*u+u*u,c=1*9*r*a-3*r*r-3*r*o-6*a*a+3*a*o+9*i*s-3*i*i-3*i*u-6*s*s+3*s*u,f=1*3*r*r-6*r*a+r*o-r*t+2*a*a+2*a*t-o*t+3*i*i-6*i*s+i*u-i*n+2*s*s+2*s*n-u*n,d=1*r*a-r*r+r*t-a*t+i*s-i*i+i*n-s*n,h=[];XV(l,c,f,d,h);for(var g=1e-7,p=[],v=0;v<6;v+=2)Math.abs(h[v+1])<g&&h[v]>=0&&h[v]<=1&&p.push(h[v]);p.push(1),p.push(0);for(var m=-1,y,b,w,E=0;E<p.length;E++)y=Math.pow(1-p[E],2)*r+2*(1-p[E])*p[E]*a+p[E]*p[E]*o,b=Math.pow(1-p[E],2)*i+2*(1-p[E])*p[E]*s+p[E]*p[E]*u,w=Math.pow(y-t,2)+Math.pow(b-n,2),m>=0?w<m&&(m=w):m=w;return m},ZV=function(t,n,r,i,a,s){var o=[t-r,n-i],u=[a-r,s-i],l=u[0]*u[0]+u[1]*u[1],c=o[0]*o[0]+o[1]*o[1],f=o[0]*u[0]+o[1]*u[1],d=f*f/l;return f<0?c:d>l?(t-a)*(t-a)+(n-s)*(n-s):c-d},Pr=function(t,n,r){for(var i,a,s,o,u,l=0,c=0;c<r.length/2;c++)if(i=r[c*2],a=r[c*2+1],c+1<r.length/2?(s=r[(c+1)*2],o=r[(c+1)*2+1]):(s=r[(c+1-r.length/2)*2],o=r[(c+1-r.length/2)*2+1]),!(i==t&&s==t))if(i>=t&&t>=s||i<=t&&t<=s)u=(t-i)/(s-i)*(o-a)+a,u>n&&l++;else continue;return l%2!==0},ls=function(t,n,r,i,a,s,o,u,l){var c=new Array(r.length),f;u[0]!=null?(f=Math.atan(u[1]/u[0]),u[0]<0?f=f+Math.PI/2:f=-f-Math.PI/2):f=u;for(var d=Math.cos(-f),h=Math.sin(-f),g=0;g<c.length/2;g++)c[g*2]=s/2*(r[g*2]*d-r[g*2+1]*h),c[g*2+1]=o/2*(r[g*2+1]*d+r[g*2]*h),c[g*2]+=i,c[g*2+1]+=a;var p;if(l>0){var v=fp(c,-l);p=cp(v)}else p=c;return Pr(t,n,p)},QV=function(t,n,r,i,a,s,o,u){for(var l=new Array(r.length*2),c=0;c<u.length;c++){var f=u[c];l[c*4+0]=f.startX,l[c*4+1]=f.startY,l[c*4+2]=f.stopX,l[c*4+3]=f.stopY;var d=Math.pow(f.cx-t,2)+Math.pow(f.cy-n,2);if(d<=Math.pow(f.radius,2))return!0}return Pr(t,n,l)},cp=function(t){for(var n=new Array(t.length/2),r,i,a,s,o,u,l,c,f=0;f<t.length/4;f++){r=t[f*4],i=t[f*4+1],a=t[f*4+2],s=t[f*4+3],f<t.length/4-1?(o=t[(f+1)*4],u=t[(f+1)*4+1],l=t[(f+1)*4+2],c=t[(f+1)*4+3]):(o=t[0],u=t[1],l=t[2],c=t[3]);var d=lo(r,i,a,s,o,u,l,c,!0);n[f*2]=d[0],n[f*2+1]=d[1]}return n},fp=function(t,n){for(var r=new Array(t.length*2),i,a,s,o,u=0;u<t.length/2;u++){i=t[u*2],a=t[u*2+1],u<t.length/2-1?(s=t[(u+1)*2],o=t[(u+1)*2+1]):(s=t[0],o=t[1]);var l=o-a,c=-(s-i),f=Math.sqrt(l*l+c*c),d=l/f,h=c/f;r[u*4]=i+d*n,r[u*4+1]=a+h*n,r[u*4+2]=s+d*n,r[u*4+3]=o+h*n}return r},JV=function(t,n,r,i,a,s){var o=r-t,u=i-n;o/=a,u/=s;var l=Math.sqrt(o*o+u*u),c=l-1;if(c<0)return[];var f=c/l;return[(r-t)*f+t,(i-n)*f+n]},pu=function(t,n,r,i,a,s,o){return t-=a,n-=s,t/=r/2+o,n/=i/2+o,t*t+n*n<=1},nd=function(t,n,r,i,a,s,o){var u=[r-t,i-n],l=[t-a,n-s],c=u[0]*u[0]+u[1]*u[1],f=2*(l[0]*u[0]+l[1]*u[1]),d=l[0]*l[0]+l[1]*l[1]-o*o,h=f*f-4*c*d;if(h<0)return[];var g=(-f+Math.sqrt(h))/(2*c),p=(-f-Math.sqrt(h))/(2*c),v=Math.min(g,p),m=Math.max(g,p),y=[];if(v>=0&&v<=1&&y.push(v),m>=0&&m<=1&&y.push(m),y.length===0)return[];var b=y[0]*u[0]+t,w=y[0]*u[1]+n;if(y.length>1){if(y[0]==y[1])return[b,w];var E=y[1]*u[0]+t,F=y[1]*u[1]+n;return[b,w,E,F]}else return[b,w]},db=function(t,n,r){return n<=t&&t<=r||r<=t&&t<=n?t:t<=n&&n<=r||r<=n&&n<=t?n:r},lo=function(t,n,r,i,a,s,o,u,l){var c=t-a,f=r-t,d=o-a,h=n-s,g=i-n,p=u-s,v=d*h-p*c,m=f*h-g*c,y=p*f-d*g;if(y!==0){var b=v/y,w=m/y,E=.001,F=0-E,x=1+E;return F<=b&&b<=x&&F<=w&&w<=x?[t+b*f,n+b*g]:l?[t+b*f,n+b*g]:[]}else return v===0||m===0?db(t,r,o)===o?[o,u]:db(t,r,a)===a?[a,s]:db(a,o,r)===r?[r,i]:[]:[]},rd=function(t,n,r,i,a,s,o,u){var l=[],c,f=new Array(r.length),d=!0;s==null&&(d=!1);var h;if(d){for(var g=0;g<f.length/2;g++)f[g*2]=r[g*2]*s+i,f[g*2+1]=r[g*2+1]*o+a;if(u>0){var p=fp(f,-u);h=cp(p)}else h=f}else h=r;for(var v,m,y,b,w=0;w<h.length/2;w++)v=h[w*2],m=h[w*2+1],w<h.length/2-1?(y=h[(w+1)*2],b=h[(w+1)*2+1]):(y=h[0],b=h[1]),c=lo(t,n,i,a,v,m,y,b),c.length!==0&&l.push(c[0],c[1]);return l},eW=function(t,n,r,i,a,s,o,u,l){var c=[],f,d=new Array(r.length*2);l.forEach(function(y,b){b===0?(d[d.length-2]=y.startX,d[d.length-1]=y.startY):(d[b*4-2]=y.startX,d[b*4-1]=y.startY),d[b*4]=y.stopX,d[b*4+1]=y.stopY,f=nd(t,n,i,a,y.cx,y.cy,y.radius),f.length!==0&&c.push(f[0],f[1])});for(var h=0;h<d.length/4;h++)f=lo(t,n,i,a,d[h*4],d[h*4+1],d[h*4+2],d[h*4+3],!1),f.length!==0&&c.push(f[0],f[1]);if(c.length>2){for(var g=[c[0],c[1]],p=Math.pow(g[0]-t,2)+Math.pow(g[1]-n,2),v=1;v<c.length/2;v++){var m=Math.pow(c[v*2]-t,2)+Math.pow(c[v*2+1]-n,2);m<=p&&(g[0]=c[v*2],g[1]=c[v*2+1],p=m)}return g}return c},dp=function(t,n,r){var i=[t[0]-n[0],t[1]-n[1]],a=Math.sqrt(i[0]*i[0]+i[1]*i[1]),s=(a-r)/a;return s<0&&(s=1e-5),[n[0]+s*i[0],n[1]+s*i[1]]},sr=function(t,n){var r=hb(t,n);return r=pT(r),r},pT=function(t){for(var n,r,i=t.length/2,a=1/0,s=1/0,o=-1/0,u=-1/0,l=0;l<i;l++)n=t[2*l],r=t[2*l+1],a=Math.min(a,n),o=Math.max(o,n),s=Math.min(s,r),u=Math.max(u,r);for(var c=2/(o-a),f=2/(u-s),d=0;d<i;d++)n=t[2*d]=t[2*d]*c,r=t[2*d+1]=t[2*d+1]*f,a=Math.min(a,n),o=Math.max(o,n),s=Math.min(s,r),u=Math.max(u,r);if(s<-1)for(var h=0;h<i;h++)r=t[2*h+1]=t[2*h+1]+(-1-s);return t},hb=function(t,n){var r=1/t*2*Math.PI,i=t%2===0?Math.PI/2+r/2:Math.PI/2;i+=n;for(var a=new Array(t*2),s,o=0;o<t;o++)s=o*r+i,a[2*o]=Math.cos(s),a[2*o+1]=Math.sin(-s);return a},vu=function(t,n){return Math.min(t/4,n/4,8)},vT=function(t,n){return Math.min(t/10,n/10,8)},gb=function(){return 8},tW=function(t,n,r){return[t-2*n+r,2*(n-t),t]},pb=function(t,n){return{heightOffset:Math.min(15,.05*n),widthOffset:Math.min(100,.25*t),ctrlPtOffsetPct:.05}},nW=an({dampingFactor:.8,precision:1e-6,iterations:200,weight:function(t){return 1}}),rW={pageRank:function(t){for(var n=nW(t),r=n.dampingFactor,i=n.precision,a=n.iterations,s=n.weight,o=this._private.cy,u=this.byGroup(),l=u.nodes,c=u.edges,f=l.length,d=f*f,h=c.length,g=new Array(d),p=new Array(f),v=(1-r)/f,m=0;m<f;m++){for(var y=0;y<f;y++){var b=m*f+y;g[b]=0}p[m]=0}for(var w=0;w<h;w++){var E=c[w],F=E.data("source"),x=E.data("target");if(F!==x){var C=l.indexOfId(F),S=l.indexOfId(x),_=s(E),k=S*f+C;g[k]+=_,p[C]+=_}}for(var T=1/f+v,A=0;A<f;A++)if(p[A]===0)for(var $=0;$<f;$++){var M=$*f+A;g[M]=T}else for(var D=0;D<f;D++){var P=D*f+A;g[P]=g[P]/p[A]+v}for(var N=new Array(f),O=new Array(f),q,z=0;z<f;z++)N[z]=1;for(var W=0;W<a;W++){for(var Y=0;Y<f;Y++)O[Y]=0;for(var J=0;J<f;J++)for(var X=0;X<f;X++){var te=J*f+X;O[J]+=g[te]*N[X]}LV(O),q=N,N=O,O=q;for(var ie=0,se=0;se<f;se++){var B=q[se]-N[se];ie+=B*B}if(ie<i)break}var I={rank:function(L){return L=o.collection(L)[0],N[l.indexOf(L)]}};return I}},mT=an({root:null,weight:function(t){return 1},directed:!1,alpha:0}),Kl={degreeCentralityNormalized:function(t){t=mT(t);var n=this.cy(),r=this.nodes(),i=r.length;if(t.directed){for(var c={},f={},d=0,h=0,g=0;g<i;g++){var p=r[g],v=p.id();t.root=p;var m=this.degreeCentrality(t);d<m.indegree&&(d=m.indegree),h<m.outdegree&&(h=m.outdegree),c[v]=m.indegree,f[v]=m.outdegree}return{indegree:function(b){return d==0?0:(Me(b)&&(b=n.filter(b)),c[b.id()]/d)},outdegree:function(b){return h===0?0:(Me(b)&&(b=n.filter(b)),f[b.id()]/h)}}}else{for(var a={},s=0,o=0;o<i;o++){var u=r[o];t.root=u;var l=this.degreeCentrality(t);s<l.degree&&(s=l.degree),a[u.id()]=l.degree}return{degree:function(b){return s===0?0:(Me(b)&&(b=n.filter(b)),a[b.id()]/s)}}}},degreeCentrality:function(t){t=mT(t);var n=this.cy(),r=this,i=t,a=i.root,s=i.weight,o=i.directed,u=i.alpha;if(a=n.collection(a)[0],o){for(var h=a.connectedEdges(),g=h.filter(function(F){return F.target().same(a)&&r.has(F)}),p=h.filter(function(F){return F.source().same(a)&&r.has(F)}),v=g.length,m=p.length,y=0,b=0,w=0;w<g.length;w++)y+=s(g[w]);for(var E=0;E<p.length;E++)b+=s(p[E]);return{indegree:Math.pow(v,1-u)*Math.pow(y,u),outdegree:Math.pow(m,1-u)*Math.pow(b,u)}}else{for(var l=a.connectedEdges().intersection(r),c=l.length,f=0,d=0;d<l.length;d++)f+=s(l[d]);return{degree:Math.pow(c,1-u)*Math.pow(f,u)}}}};Kl.dc=Kl.degreeCentrality,Kl.dcn=Kl.degreeCentralityNormalised=Kl.degreeCentralityNormalized;var yT=an({harmonic:!0,weight:function(){return 1},directed:!1,root:null}),Zl={closenessCentralityNormalized:function(t){for(var n=yT(t),r=n.harmonic,i=n.weight,a=n.directed,s=this.cy(),o={},u=0,l=this.nodes(),c=this.floydWarshall({weight:i,directed:a}),f=0;f<l.length;f++){for(var d=0,h=l[f],g=0;g<l.length;g++)if(f!==g){var p=c.distance(h,l[g]);r?d+=1/p:d+=p}r||(d=1/d),u<d&&(u=d),o[h.id()]=d}return{closeness:function(m){return u==0?0:(Me(m)?m=s.filter(m)[0].id():m=m.id(),o[m]/u)}}},closenessCentrality:function(t){var n=yT(t),r=n.root,i=n.weight,a=n.directed,s=n.harmonic;r=this.filter(r)[0];for(var o=this.dijkstra({root:r,weight:i,directed:a}),u=0,l=this.nodes(),c=0;c<l.length;c++){var f=l[c];if(!f.same(r)){var d=o.distanceTo(f);s?u+=1/d:u+=d}}return s?u:1/u}};Zl.cc=Zl.closenessCentrality,Zl.ccn=Zl.closenessCentralityNormalised=Zl.closenessCentralityNormalized;var iW=an({weight:null,directed:!1}),vb={betweennessCentrality:function(t){for(var n=iW(t),r=n.directed,i=n.weight,a=i!=null,s=this.cy(),o=this.nodes(),u={},l={},c=0,f={set:function(b,w){l[b]=w,w>c&&(c=w)},get:function(b){return l[b]}},d=0;d<o.length;d++){var h=o[d],g=h.id();r?u[g]=h.outgoers().nodes():u[g]=h.openNeighborhood().nodes(),f.set(g,0)}for(var p=function(){for(var b=o[v].id(),w=[],E={},F={},x={},C=new ed(function(J,X){return x[J]-x[X]}),S=0;S<o.length;S++){var _=o[S].id();E[_]=[],F[_]=0,x[_]=1/0}for(F[b]=1,x[b]=0,C.push(b);!C.empty();){var k=C.pop();if(w.push(k),a)for(var T=0;T<u[k].length;T++){var A=u[k][T],$=s.getElementById(k),M=void 0;$.edgesTo(A).length>0?M=$.edgesTo(A)[0]:M=A.edgesTo($)[0];var D=i(M);A=A.id(),x[A]>x[k]+D&&(x[A]=x[k]+D,C.nodes.indexOf(A)<0?C.push(A):C.updateItem(A),F[A]=0,E[A]=[]),x[A]==x[k]+D&&(F[A]=F[A]+F[k],E[A].push(k))}else for(var P=0;P<u[k].length;P++){var N=u[k][P].id();x[N]==1/0&&(C.push(N),x[N]=x[k]+1),x[N]==x[k]+1&&(F[N]=F[N]+F[k],E[N].push(k))}}for(var O={},q=0;q<o.length;q++)O[o[q].id()]=0;for(;w.length>0;){for(var z=w.pop(),W=0;W<E[z].length;W++){var Y=E[z][W];O[Y]=O[Y]+F[Y]/F[z]*(1+O[z])}z!=o[v].id()&&f.set(z,f.get(z)+O[z])}},v=0;v<o.length;v++)p();var m={betweenness:function(b){var w=s.collection(b).id();return f.get(w)},betweennessNormalized:function(b){if(c==0)return 0;var w=s.collection(b).id();return f.get(w)/c}};return m.betweennessNormalised=m.betweennessNormalized,m}};vb.bc=vb.betweennessCentrality;var aW=an({expandFactor:2,inflateFactor:2,multFactor:1,maxIterations:20,attributes:[function(e){return 1}]}),sW=function(t){return aW(t)},oW=function(t,n){for(var r=0,i=0;i<n.length;i++)r+=n[i](t);return r},uW=function(t,n,r){for(var i=0;i<n;i++)t[i*n+i]=r},bT=function(t,n){for(var r,i=0;i<n;i++){r=0;for(var a=0;a<n;a++)r+=t[a*n+i];for(var s=0;s<n;s++)t[s*n+i]=t[s*n+i]/r}},lW=function(t,n,r){for(var i=new Array(r*r),a=0;a<r;a++){for(var s=0;s<r;s++)i[a*r+s]=0;for(var o=0;o<r;o++)for(var u=0;u<r;u++)i[a*r+u]+=t[a*r+o]*n[o*r+u]}return i},cW=function(t,n,r){for(var i=t.slice(0),a=1;a<r;a++)t=lW(t,i,n);return t},fW=function(t,n,r){for(var i=new Array(n*n),a=0;a<n*n;a++)i[a]=Math.pow(t[a],r);return bT(i,n),i},dW=function(t,n,r,i){for(var a=0;a<r;a++){var s=Math.round(t[a]*Math.pow(10,i))/Math.pow(10,i),o=Math.round(n[a]*Math.pow(10,i))/Math.pow(10,i);if(s!==o)return!1}return!0},hW=function(t,n,r,i){for(var a=[],s=0;s<n;s++){for(var o=[],u=0;u<n;u++)Math.round(t[s*n+u]*1e3)/1e3>0&&o.push(r[u]);o.length!==0&&a.push(i.collection(o))}return a},gW=function(t,n){for(var r=0;r<t.length;r++)if(!n[r]||t[r].id()!==n[r].id())return!1;return!0},pW=function(t){for(var n=0;n<t.length;n++)for(var r=0;r<t.length;r++)n!=r&&gW(t[n],t[r])&&t.splice(r,1);return t},wT=function(t){for(var n=this.nodes(),r=this.edges(),i=this.cy(),a=sW(t),s={},o=0;o<n.length;o++)s[n[o].id()]=o;for(var u=n.length,l=u*u,c=new Array(l),f,d=0;d<l;d++)c[d]=0;for(var h=0;h<r.length;h++){var g=r[h],p=s[g.source().id()],v=s[g.target().id()],m=oW(g,a.attributes);c[p*u+v]+=m,c[v*u+p]+=m}uW(c,u,a.multFactor),bT(c,u);for(var y=!0,b=0;y&&b<a.maxIterations;)y=!1,f=cW(c,u,a.expandFactor),c=fW(f,u,a.inflateFactor),dW(c,f,l,4)||(y=!0),b++;var w=hW(c,u,n,i);return w=pW(w),w},vW={markovClustering:wT,mcl:wT},mW=function(t){return t},xT=function(t,n){return Math.abs(n-t)},ET=function(t,n,r){return t+xT(n,r)},FT=function(t,n,r){return t+Math.pow(r-n,2)},yW=function(t){return Math.sqrt(t)},bW=function(t,n,r){return Math.max(t,xT(n,r))},id=function(t,n,r,i,a){for(var s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:mW,o=i,u,l,c=0;c<t;c++)u=n(c),l=r(c),o=a(o,u,l);return s(o)},Ql={euclidean:function(t,n,r){return t>=2?id(t,n,r,0,FT,yW):id(t,n,r,0,ET)},squaredEuclidean:function(t,n,r){return id(t,n,r,0,FT)},manhattan:function(t,n,r){return id(t,n,r,0,ET)},max:function(t,n,r){return id(t,n,r,-1/0,bW)}};Ql["squared-euclidean"]=Ql.squaredEuclidean,Ql.squaredeuclidean=Ql.squaredEuclidean;function hp(e,t,n,r,i,a){var s;return Lt(e)?s=e:s=Ql[e]||Ql.euclidean,t===0&&Lt(e)?s(i,a):s(t,n,r,i,a)}var wW=an({k:2,m:2,sensitivityThreshold:1e-4,distance:"euclidean",maxIterations:10,attributes:[],testMode:!1,testCentroids:null}),mb=function(t){return wW(t)},gp=function(t,n,r,i,a){var s=a!=="kMedoids",o=s?function(f){return r[f]}:function(f){return i[f](r)},u=function(d){return i[d](n)},l=r,c=n;return hp(t,i.length,o,u,l,c)},yb=function(t,n,r){for(var i=r.length,a=new Array(i),s=new Array(i),o=new Array(n),u=null,l=0;l<i;l++)a[l]=t.min(r[l]).value,s[l]=t.max(r[l]).value;for(var c=0;c<n;c++){u=[];for(var f=0;f<i;f++)u[f]=Math.random()*(s[f]-a[f])+a[f];o[c]=u}return o},ST=function(t,n,r,i,a){for(var s=1/0,o=0,u=0;u<n.length;u++){var l=gp(r,t,n[u],i,a);l<s&&(s=l,o=u)}return o},CT=function(t,n,r){for(var i=[],a=null,s=0;s<n.length;s++)a=n[s],r[a.id()]===t&&i.push(a);return i},xW=function(t,n,r){return Math.abs(n-t)<=r},EW=function(t,n,r){for(var i=0;i<t.length;i++)for(var a=0;a<t[i].length;a++){var s=Math.abs(t[i][a]-n[i][a]);if(s>r)return!1}return!0},FW=function(t,n,r){for(var i=0;i<r;i++)if(t===n[i])return!0;return!1},kT=function(t,n){var r=new Array(n);if(t.length<50)for(var i=0;i<n;i++){for(var a=t[Math.floor(Math.random()*t.length)];FW(a,r,i);)a=t[Math.floor(Math.random()*t.length)];r[i]=a}else for(var s=0;s<n;s++)r[s]=t[Math.floor(Math.random()*t.length)];return r},_T=function(t,n,r){for(var i=0,a=0;a<n.length;a++)i+=gp("manhattan",n[a],t,r,"kMedoids");return i},SW=function(t){var n=this.cy(),r=this.nodes(),i=null,a=mb(t),s=new Array(a.k),o={},u;a.testMode?typeof a.testCentroids=="number"?(a.testCentroids,u=yb(r,a.k,a.attributes)):tn(a.testCentroids)==="object"?u=a.testCentroids:u=yb(r,a.k,a.attributes):u=yb(r,a.k,a.attributes);for(var l=!0,c=0;l&&c<a.maxIterations;){for(var f=0;f<r.length;f++)i=r[f],o[i.id()]=ST(i,u,a.distance,a.attributes,"kMeans");l=!1;for(var d=0;d<a.k;d++){var h=CT(d,r,o);if(h.length!==0){for(var g=a.attributes.length,p=u[d],v=new Array(g),m=new Array(g),y=0;y<g;y++){m[y]=0;for(var b=0;b<h.length;b++)i=h[b],m[y]+=a.attributes[y](i);v[y]=m[y]/h.length,xW(v[y],p[y],a.sensitivityThreshold)||(l=!0)}u[d]=v,s[d]=n.collection(h)}}c++}return s},CW=function(t){var n=this.cy(),r=this.nodes(),i=null,a=mb(t),s=new Array(a.k),o,u={},l,c=new Array(a.k);a.testMode?typeof a.testCentroids=="number"||(tn(a.testCentroids)==="object"?o=a.testCentroids:o=kT(r,a.k)):o=kT(r,a.k);for(var f=!0,d=0;f&&d<a.maxIterations;){for(var h=0;h<r.length;h++)i=r[h],u[i.id()]=ST(i,o,a.distance,a.attributes,"kMedoids");f=!1;for(var g=0;g<o.length;g++){var p=CT(g,r,u);if(p.length!==0){c[g]=_T(o[g],p,a.attributes);for(var v=0;v<p.length;v++)l=_T(p[v],p,a.attributes),l<c[g]&&(c[g]=l,o[g]=p[v],f=!0);s[g]=n.collection(p)}}d++}return s},kW=function(t,n,r,i,a){for(var s,o,u=0;u<n.length;u++)for(var l=0;l<t.length;l++)i[u][l]=Math.pow(r[u][l],a.m);for(var c=0;c<t.length;c++)for(var f=0;f<a.attributes.length;f++){s=0,o=0;for(var d=0;d<n.length;d++)s+=i[d][c]*a.attributes[f](n[d]),o+=i[d][c];t[c][f]=s/o}},_W=function(t,n,r,i,a){for(var s=0;s<t.length;s++)n[s]=t[s].slice();for(var o,u,l,c=2/(a.m-1),f=0;f<r.length;f++)for(var d=0;d<i.length;d++){o=0;for(var h=0;h<r.length;h++)u=gp(a.distance,i[d],r[f],a.attributes,"cmeans"),l=gp(a.distance,i[d],r[h],a.attributes,"cmeans"),o+=Math.pow(u/l,c);t[d][f]=1/o}},AW=function(t,n,r,i){for(var a=new Array(r.k),s=0;s<a.length;s++)a[s]=[];for(var o,u,l=0;l<n.length;l++){o=-1/0,u=-1;for(var c=0;c<n[0].length;c++)n[l][c]>o&&(o=n[l][c],u=c);a[u].push(t[l])}for(var f=0;f<a.length;f++)a[f]=i.collection(a[f]);return a},AT=function(t){var n=this.cy(),r=this.nodes(),i=mb(t),a,s,o,u,l;u=new Array(r.length);for(var c=0;c<r.length;c++)u[c]=new Array(i.k);o=new Array(r.length);for(var f=0;f<r.length;f++)o[f]=new Array(i.k);for(var d=0;d<r.length;d++){for(var h=0,g=0;g<i.k;g++)o[d][g]=Math.random(),h+=o[d][g];for(var p=0;p<i.k;p++)o[d][p]=o[d][p]/h}s=new Array(i.k);for(var v=0;v<i.k;v++)s[v]=new Array(i.attributes.length);l=new Array(r.length);for(var m=0;m<r.length;m++)l[m]=new Array(i.k);for(var y=!0,b=0;y&&b<i.maxIterations;)y=!1,kW(s,r,o,l,i),_W(o,u,s,r,i),EW(o,u,i.sensitivityThreshold)||(y=!0),b++;return a=AW(r,o,i,n),{clusters:a,degreeOfMembership:o}},TW={kMeans:SW,kMedoids:CW,fuzzyCMeans:AT,fcm:AT},MW=an({distance:"euclidean",linkage:"min",mode:"threshold",threshold:1/0,addDendrogram:!1,dendrogramDepth:0,attributes:[]}),$W={single:"min",complete:"max"},DW=function(t){var n=MW(t),r=$W[n.linkage];return r!=null&&(n.linkage=r),n},TT=function(t,n,r,i,a){for(var s=0,o=1/0,u,l=a.attributes,c=function(S,_){return hp(a.distance,l.length,function(k){return l[k](S)},function(k){return l[k](_)},S,_)},f=0;f<t.length;f++){var d=t[f].key,h=r[d][i[d]];h<o&&(s=d,o=h)}if(a.mode==="threshold"&&o>=a.threshold||a.mode==="dendrogram"&&t.length===1)return!1;var g=n[s],p=n[i[s]],v;a.mode==="dendrogram"?v={left:g,right:p,key:g.key}:v={value:g.value.concat(p.value),key:g.key},t[g.index]=v,t.splice(p.index,1),n[g.key]=v;for(var m=0;m<t.length;m++){var y=t[m];g.key===y.key?u=1/0:a.linkage==="min"?(u=r[g.key][y.key],r[g.key][y.key]>r[p.key][y.key]&&(u=r[p.key][y.key])):a.linkage==="max"?(u=r[g.key][y.key],r[g.key][y.key]<r[p.key][y.key]&&(u=r[p.key][y.key])):a.linkage==="mean"?u=(r[g.key][y.key]*g.size+r[p.key][y.key]*p.size)/(g.size+p.size):a.mode==="dendrogram"?u=c(y.value,g.value):u=c(y.value[0],g.value[0]),r[g.key][y.key]=r[y.key][g.key]=u}for(var b=0;b<t.length;b++){var w=t[b].key;if(i[w]===g.key||i[w]===p.key){for(var E=w,F=0;F<t.length;F++){var x=t[F].key;r[w][x]<r[w][E]&&(E=x)}i[w]=E}t[b].index=b}return g.key=p.key=g.index=p.index=null,!0},Jl=function(t,n,r){t&&(t.value?n.push(t.value):(t.left&&Jl(t.left,n),t.right&&Jl(t.right,n)))},bb=function(t,n){if(!t)return"";if(t.left&&t.right){var r=bb(t.left,n),i=bb(t.right,n),a=n.add({group:"nodes",data:{id:r+","+i}});return n.add({group:"edges",data:{source:r,target:a.id()}}),n.add({group:"edges",data:{source:i,target:a.id()}}),a.id()}else if(t.value)return t.value.id()},wb=function(t,n,r){if(!t)return[];var i=[],a=[],s=[];return n===0?(t.left&&Jl(t.left,i),t.right&&Jl(t.right,a),s=i.concat(a),[r.collection(s)]):n===1?t.value?[r.collection(t.value)]:(t.left&&Jl(t.left,i),t.right&&Jl(t.right,a),[r.collection(i),r.collection(a)]):t.value?[r.collection(t.value)]:(t.left&&(i=wb(t.left,n-1,r)),t.right&&(a=wb(t.right,n-1,r)),i.concat(a))},MT=function(t){for(var n=this.cy(),r=this.nodes(),i=DW(t),a=i.attributes,s=function(b,w){return hp(i.distance,a.length,function(E){return a[E](b)},function(E){return a[E](w)},b,w)},o=[],u=[],l=[],c=[],f=0;f<r.length;f++){var d={value:i.mode==="dendrogram"?r[f]:[r[f]],key:f,index:f};o[f]=d,c[f]=d,u[f]=[],l[f]=0}for(var h=0;h<o.length;h++)for(var g=0;g<=h;g++){var p=void 0;i.mode==="dendrogram"?p=h===g?1/0:s(o[h].value,o[g].value):p=h===g?1/0:s(o[h].value[0],o[g].value[0]),u[h][g]=p,u[g][h]=p,p<u[h][l[h]]&&(l[h]=g)}for(var v=TT(o,c,u,l,i);v;)v=TT(o,c,u,l,i);var m;return i.mode==="dendrogram"?(m=wb(o[0],i.dendrogramDepth,n),i.addDendrogram&&bb(o[0],n)):(m=new Array(o.length),o.forEach(function(y,b){y.key=y.index=null,m[b]=n.collection(y.value)})),m},RW={hierarchicalClustering:MT,hca:MT},PW=an({distance:"euclidean",preference:"median",damping:.8,maxIterations:1e3,minIterations:100,attributes:[]}),NW=function(t){var n=t.damping,r=t.preference;.5<=n&&n<1||zt("Damping must range on [0.5, 1).  Got: ".concat(n));var i=["median","mean","min","max"];return i.some(function(a){return a===r})||ve(r)||zt("Preference must be one of [".concat(i.map(function(a){return"'".concat(a,"'")}).join(", "),"] or a number.  Got: ").concat(r)),PW(t)},OW=function(t,n,r,i){var a=function(o,u){return i[u](o)};return-hp(t,i.length,function(s){return a(n,s)},function(s){return a(r,s)},n,r)},IW=function(t,n){var r=null;return n==="median"?r=IV(t):n==="mean"?r=OV(t):n==="min"?r=PV(t):n==="max"?r=NV(t):r=n,r},BW=function(t,n,r){for(var i=[],a=0;a<t;a++)n[a*t+a]+r[a*t+a]>0&&i.push(a);return i},$T=function(t,n,r){for(var i=[],a=0;a<t;a++){for(var s=-1,o=-1/0,u=0;u<r.length;u++){var l=r[u];n[a*t+l]>o&&(s=l,o=n[a*t+l])}s>0&&i.push(s)}for(var c=0;c<r.length;c++)i[r[c]]=r[c];return i},LW=function(t,n,r){for(var i=$T(t,n,r),a=0;a<r.length;a++){for(var s=[],o=0;o<i.length;o++)i[o]===r[a]&&s.push(o);for(var u=-1,l=-1/0,c=0;c<s.length;c++){for(var f=0,d=0;d<s.length;d++)f+=n[s[d]*t+s[c]];f>l&&(u=c,l=f)}r[a]=s[u]}return i=$T(t,n,r),i},DT=function(t){for(var n=this.cy(),r=this.nodes(),i=NW(t),a={},s=0;s<r.length;s++)a[r[s].id()]=s;var o,u,l,c,f,d;o=r.length,u=o*o,l=new Array(u);for(var h=0;h<u;h++)l[h]=-1/0;for(var g=0;g<o;g++)for(var p=0;p<o;p++)g!==p&&(l[g*o+p]=OW(i.distance,r[g],r[p],i.attributes));c=IW(l,i.preference);for(var v=0;v<o;v++)l[v*o+v]=c;f=new Array(u);for(var m=0;m<u;m++)f[m]=0;d=new Array(u);for(var y=0;y<u;y++)d[y]=0;for(var b=new Array(o),w=new Array(o),E=new Array(o),F=0;F<o;F++)b[F]=0,w[F]=0,E[F]=0;for(var x=new Array(o*i.minIterations),C=0;C<x.length;C++)x[C]=0;var S;for(S=0;S<i.maxIterations;S++){for(var _=0;_<o;_++){for(var k=-1/0,T=-1/0,A=-1,$=0,M=0;M<o;M++)b[M]=f[_*o+M],$=d[_*o+M]+l[_*o+M],$>=k?(T=k,k=$,A=M):$>T&&(T=$);for(var D=0;D<o;D++)f[_*o+D]=(1-i.damping)*(l[_*o+D]-k)+i.damping*b[D];f[_*o+A]=(1-i.damping)*(l[_*o+A]-T)+i.damping*b[A]}for(var P=0;P<o;P++){for(var N=0,O=0;O<o;O++)b[O]=d[O*o+P],w[O]=Math.max(0,f[O*o+P]),N+=w[O];N-=w[P],w[P]=f[P*o+P],N+=w[P];for(var q=0;q<o;q++)d[q*o+P]=(1-i.damping)*Math.min(0,N-w[q])+i.damping*b[q];d[P*o+P]=(1-i.damping)*(N-w[P])+i.damping*b[P]}for(var z=0,W=0;W<o;W++){var Y=d[W*o+W]+f[W*o+W]>0?1:0;x[S%i.minIterations*o+W]=Y,z+=Y}if(z>0&&(S>=i.minIterations-1||S==i.maxIterations-1)){for(var J=0,X=0;X<o;X++){E[X]=0;for(var te=0;te<i.minIterations;te++)E[X]+=x[te*o+X];(E[X]===0||E[X]===i.minIterations)&&J++}if(J===o)break}}for(var ie=BW(o,f,d),se=LW(o,l,ie),B={},I=0;I<ie.length;I++)B[ie[I]]=[];for(var U=0;U<r.length;U++){var L=a[r[U].id()],ae=se[L];ae!=null&&B[ae].push(r[U])}for(var de=new Array(ie.length),Ce=0;Ce<ie.length;Ce++)de[Ce]=n.collection(B[ie[Ce]]);return de},zW={affinityPropagation:DT,ap:DT},qW=an({root:void 0,directed:!1}),UW={hierholzer:function(t){if(!ut(t)){var n=arguments;t={root:n[0],directed:n[1]}}var r=qW(t),i=r.root,a=r.directed,s=this,o=!1,u,l,c;i&&(c=Me(i)?this.filter(i)[0].id():i[0].id());var f={},d={};a?s.forEach(function(y){var b=y.id();if(y.isNode()){var w=y.indegree(!0),E=y.outdegree(!0),F=w-E,x=E-w;F==1?u?o=!0:u=b:x==1?l?o=!0:l=b:(x>1||F>1)&&(o=!0),f[b]=[],y.outgoers().forEach(function(C){C.isEdge()&&f[b].push(C.id())})}else d[b]=[void 0,y.target().id()]}):s.forEach(function(y){var b=y.id();if(y.isNode()){var w=y.degree(!0);w%2&&(u?l?o=!0:l=b:u=b),f[b]=[],y.connectedEdges().forEach(function(E){return f[b].push(E.id())})}else d[b]=[y.source().id(),y.target().id()]});var h={found:!1,trail:void 0};if(o)return h;if(l&&u)if(a){if(c&&l!=c)return h;c=l}else{if(c&&l!=c&&u!=c)return h;c||(c=l)}else c||(c=s[0].id());var g=function(b){for(var w=b,E=[b],F,x,C;f[w].length;)F=f[w].shift(),x=d[F][0],C=d[F][1],w!=C?(f[C]=f[C].filter(function(S){return S!=F}),w=C):!a&&w!=x&&(f[x]=f[x].filter(function(S){return S!=F}),w=x),E.unshift(F),E.unshift(w);return E},p=[],v=[];for(v=g(c);v.length!=1;)f[v[0]].length==0?(p.unshift(s.getElementById(v.shift())),p.unshift(s.getElementById(v.shift()))):v=g(v.shift()).concat(v);p.unshift(s.getElementById(v.shift()));for(var m in f)if(f[m].length)return h;return h.found=!0,h.trail=this.spawn(p,!0),h}},pp=function(){var t=this,n={},r=0,i=0,a=[],s=[],o={},u=function(d,h){for(var g=s.length-1,p=[],v=t.spawn();s[g].x!=d||s[g].y!=h;)p.push(s.pop().edge),g--;p.push(s.pop().edge),p.forEach(function(m){var y=m.connectedNodes().intersection(t);v.merge(m),y.forEach(function(b){var w=b.id(),E=b.connectedEdges().intersection(t);v.merge(b),n[w].cutVertex?v.merge(E.filter(function(F){return F.isLoop()})):v.merge(E)})}),a.push(v)},l=function(d,h,g){d===g&&(i+=1),n[h]={id:r,low:r++,cutVertex:!1};var p=t.getElementById(h).connectedEdges().intersection(t);if(p.size()===0)a.push(t.spawn(t.getElementById(h)));else{var v,m,y,b;p.forEach(function(w){v=w.source().id(),m=w.target().id(),y=v===h?m:v,y!==g&&(b=w.id(),o[b]||(o[b]=!0,s.push({x:h,y,edge:w})),y in n?n[h].low=Math.min(n[h].low,n[y].id):(l(d,y,h),n[h].low=Math.min(n[h].low,n[y].low),n[h].id<=n[y].low&&(n[h].cutVertex=!0,u(h,y))))})}};t.forEach(function(f){if(f.isNode()){var d=f.id();d in n||(i=0,l(d,d),n[d].cutVertex=i>1)}});var c=Object.keys(n).filter(function(f){return n[f].cutVertex}).map(function(f){return t.getElementById(f)});return{cut:t.spawn(c),components:a}},VW={hopcroftTarjanBiconnected:pp,htbc:pp,htb:pp,hopcroftTarjanBiconnectedComponents:pp},vp=function(){var t=this,n={},r=0,i=[],a=[],s=t.spawn(t),o=function(l){a.push(l),n[l]={index:r,low:r++,explored:!1};var c=t.getElementById(l).connectedEdges().intersection(t);if(c.forEach(function(p){var v=p.target().id();v!==l&&(v in n||o(v),n[v].explored||(n[l].low=Math.min(n[l].low,n[v].low)))}),n[l].index===n[l].low){for(var f=t.spawn();;){var d=a.pop();if(f.merge(t.getElementById(d)),n[d].low=n[l].index,n[d].explored=!0,d===l)break}var h=f.edgesWith(f),g=f.merge(h);i.push(g),s=s.difference(g)}};return t.forEach(function(u){if(u.isNode()){var l=u.id();l in n||o(l)}}),{cut:s,components:i}},WW={tarjanStronglyConnected:vp,tsc:vp,tscc:vp,tarjanStronglyConnectedComponents:vp},RT={};[Jf,EV,FV,CV,_V,TV,DV,rW,Kl,Zl,vb,vW,TW,RW,zW,UW,VW,WW].forEach(function(e){Ie(RT,e)});/*!
Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable
Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com)
Licensed under The MIT License (http://opensource.org/licenses/MIT)
*/var PT=0,NT=1,OT=2,Di=function(t){if(!(this instanceof Di))return new Di(t);this.id="Thenable/1.0.7",this.state=PT,this.fulfillValue=void 0,this.rejectReason=void 0,this.onFulfilled=[],this.onRejected=[],this.proxy={then:this.then.bind(this)},typeof t=="function"&&t.call(this,this.fulfill.bind(this),this.reject.bind(this))};Di.prototype={fulfill:function(t){return IT(this,NT,"fulfillValue",t)},reject:function(t){return IT(this,OT,"rejectReason",t)},then:function(t,n){var r=this,i=new Di;return r.onFulfilled.push(zT(t,i,"fulfill")),r.onRejected.push(zT(n,i,"reject")),BT(r),i.proxy}};var IT=function(t,n,r,i){return t.state===PT&&(t.state=n,t[r]=i,BT(t)),t},BT=function(t){t.state===NT?LT(t,"onFulfilled",t.fulfillValue):t.state===OT&&LT(t,"onRejected",t.rejectReason)},LT=function(t,n,r){if(t[n].length!==0){var i=t[n];t[n]=[];var a=function(){for(var o=0;o<i.length;o++)i[o](r)};typeof setImmediate=="function"?setImmediate(a):setTimeout(a,0)}},zT=function(t,n,r){return function(i){if(typeof t!="function")n[r].call(n,i);else{var a;try{a=t(i)}catch(s){n.reject(s);return}qT(n,a)}}},qT=function(t,n){if(t===n||t.proxy===n){t.reject(new TypeError("cannot resolve promise with itself"));return}var r;if(tn(n)==="object"&&n!==null||typeof n=="function")try{r=n.then}catch(a){t.reject(a);return}if(typeof r=="function"){var i=!1;try{r.call(n,function(a){i||(i=!0,a===n?t.reject(new TypeError("circular thenable chain")):qT(t,a))},function(a){i||(i=!0,t.reject(a))})}catch(a){i||t.reject(a)}return}t.fulfill(n)};Di.all=function(e){return new Di(function(t,n){for(var r=new Array(e.length),i=0,a=function(u,l){r[u]=l,i++,i===e.length&&t(r)},s=0;s<e.length;s++)(function(o){var u=e[o],l=u!=null&&u.then!=null;if(l)u.then(function(f){a(o,f)},function(f){n(f)});else{var c=u;a(o,c)}})(s)})},Di.resolve=function(e){return new Di(function(t,n){t(e)})},Di.reject=function(e){return new Di(function(t,n){n(e)})};var ec=typeof Promise<"u"?Promise:Di,xb=function(t,n,r){var i=q1(t),a=!i,s=this._private=Ie({duration:1e3},n,r);if(s.target=t,s.style=s.style||s.css,s.started=!1,s.playing=!1,s.hooked=!1,s.applying=!1,s.progress=0,s.completes=[],s.frames=[],s.complete&&Lt(s.complete)&&s.completes.push(s.complete),a){var o=t.position();s.startPosition=s.startPosition||{x:o.x,y:o.y},s.startStyle=s.startStyle||t.cy().style().getAnimationStartStyle(t,s.style)}if(i){var u=t.pan();s.startPan={x:u.x,y:u.y},s.startZoom=t.zoom()}this.length=1,this[0]=this},mu=xb.prototype;Ie(mu,{instanceString:function(){return"animation"},hook:function(){var t=this._private;if(!t.hooked){var n,r=t.target._private.animation;t.queue?n=r.queue:n=r.current,n.push(this),Yr(t.target)&&t.target.cy().addToAnimationPool(t.target),t.hooked=!0}return this},play:function(){var t=this._private;return t.progress===1&&(t.progress=0),t.playing=!0,t.started=!1,t.stopped=!1,this.hook(),this},playing:function(){return this._private.playing},apply:function(){var t=this._private;return t.applying=!0,t.started=!1,t.stopped=!1,this.hook(),this},applying:function(){return this._private.applying},pause:function(){var t=this._private;return t.playing=!1,t.started=!1,this},stop:function(){var t=this._private;return t.playing=!1,t.started=!1,t.stopped=!0,this},rewind:function(){return this.progress(0)},fastforward:function(){return this.progress(1)},time:function(t){var n=this._private;return t===void 0?n.progress*n.duration:this.progress(t/n.duration)},progress:function(t){var n=this._private,r=n.playing;return t===void 0?n.progress:(r&&this.pause(),n.progress=t,n.started=!1,r&&this.play(),this)},completed:function(){return this._private.progress===1},reverse:function(){var t=this._private,n=t.playing;n&&this.pause(),t.progress=1-t.progress,t.started=!1;var r=function(l,c){var f=t[l];f!=null&&(t[l]=t[c],t[c]=f)};if(r("zoom","startZoom"),r("pan","startPan"),r("position","startPosition"),t.style)for(var i=0;i<t.style.length;i++){var a=t.style[i],s=a.name,o=t.startStyle[s];t.startStyle[s]=a,t.style[i]=o}return n&&this.play(),this},promise:function(t){var n=this._private,r;switch(t){case"frame":r=n.frames;break;default:case"complete":case"completed":r=n.completes}return new ec(function(i,a){r.push(function(){i()})})}}),mu.complete=mu.completed,mu.run=mu.play,mu.running=mu.playing;var HW={animated:function(){return function(){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return!1;var s=i[0];if(s)return s._private.animation.current.length>0}},clearQueue:function(){return function(){var n=this,r=n.length!==void 0,i=r?n:[n],a=this._private.cy||this;if(!a.styleEnabled())return this;for(var s=0;s<i.length;s++){var o=i[s];o._private.animation.queue=[]}return this}},delay:function(){return function(n,r){var i=this._private.cy||this;return i.styleEnabled()?this.animate({delay:n,duration:n,complete:r}):this}},delayAnimation:function(){return function(n,r){var i=this._private.cy||this;return i.styleEnabled()?this.animation({delay:n,duration:n,complete:r}):this}},animation:function(){return function(n,r){var i=this,a=i.length!==void 0,s=a?i:[i],o=this._private.cy||this,u=!a,l=!u;if(!o.styleEnabled())return this;var c=o.style();n=Ie({},n,r);var f=Object.keys(n).length===0;if(f)return new xb(s[0],n);switch(n.duration===void 0&&(n.duration=400),n.duration){case"slow":n.duration=600;break;case"fast":n.duration=200;break}if(l&&(n.style=c.getPropsList(n.style||n.css),n.css=void 0),l&&n.renderedPosition!=null){var d=n.renderedPosition,h=o.pan(),g=o.zoom();n.position=lT(d,g,h)}if(u&&n.panBy!=null){var p=n.panBy,v=o.pan();n.pan={x:v.x+p.x,y:v.y+p.y}}var m=n.center||n.centre;if(u&&m!=null){var y=o.getCenterPan(m.eles,n.zoom);y!=null&&(n.pan=y)}if(u&&n.fit!=null){var b=n.fit,w=o.getFitViewport(b.eles||b.boundingBox,b.padding);w!=null&&(n.pan=w.pan,n.zoom=w.zoom)}if(u&&ut(n.zoom)){var E=o.getZoomedViewport(n.zoom);E!=null?(E.zoomed&&(n.zoom=E.zoom),E.panned&&(n.pan=E.pan)):n.zoom=null}return new xb(s[0],n)}},animate:function(){return function(n,r){var i=this,a=i.length!==void 0,s=a?i:[i],o=this._private.cy||this;if(!o.styleEnabled())return this;r&&(n=Ie({},n,r));for(var u=0;u<s.length;u++){var l=s[u],c=l.animated()&&(n.queue===void 0||n.queue),f=l.animation(n,c?{queue:!0}:void 0);f.play()}return this}},stop:function(){return function(n,r){var i=this,a=i.length!==void 0,s=a?i:[i],o=this._private.cy||this;if(!o.styleEnabled())return this;for(var u=0;u<s.length;u++){for(var l=s[u],c=l._private,f=c.animation.current,d=0;d<f.length;d++){var h=f[d],g=h._private;r&&(g.duration=0)}n&&(c.animation.queue=[]),r||(c.animation.current=[])}return o.notify("draw"),this}}},Eb,UT;function mp(){if(UT)return Eb;UT=1;var e=Array.isArray;return Eb=e,Eb}var Fb,VT;function jW(){if(VT)return Fb;VT=1;var e=mp(),t=Yf(),n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(a,s){if(e(a))return!1;var o=typeof a;return o=="number"||o=="symbol"||o=="boolean"||a==null||t(a)?!0:r.test(a)||!n.test(a)||s!=null&&a in Object(s)}return Fb=i,Fb}var Sb,WT;function GW(){if(WT)return Sb;WT=1;var e=WA(),t=Gf(),n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function s(o){if(!t(o))return!1;var u=e(o);return u==r||u==i||u==n||u==a}return Sb=s,Sb}var Cb,HT;function YW(){if(HT)return Cb;HT=1;var e=ep(),t=e["__core-js_shared__"];return Cb=t,Cb}var kb,jT;function XW(){if(jT)return kb;jT=1;var e=YW(),t=function(){var r=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return r?"Symbol(src)_1."+r:""}();function n(r){return!!t&&t in r}return kb=n,kb}var _b,GT;function KW(){if(GT)return _b;GT=1;var e=Function.prototype,t=e.toString;function n(r){if(r!=null){try{return t.call(r)}catch{}try{return r+""}catch{}}return""}return _b=n,_b}var Ab,YT;function ZW(){if(YT)return Ab;YT=1;var e=GW(),t=XW(),n=Gf(),r=KW(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,s=Function.prototype,o=Object.prototype,u=s.toString,l=o.hasOwnProperty,c=RegExp("^"+u.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(d){if(!n(d)||t(d))return!1;var h=e(d)?c:a;return h.test(r(d))}return Ab=f,Ab}var Tb,XT;function QW(){if(XT)return Tb;XT=1;function e(t,n){return t==null?void 0:t[n]}return Tb=e,Tb}var Mb,KT;function $b(){if(KT)return Mb;KT=1;var e=ZW(),t=QW();function n(r,i){var a=t(r,i);return e(a)?a:void 0}return Mb=n,Mb}var Db,ZT;function yp(){if(ZT)return Db;ZT=1;var e=$b(),t=e(Object,"create");return Db=t,Db}var Rb,QT;function JW(){if(QT)return Rb;QT=1;var e=yp();function t(){this.__data__=e?e(null):{},this.size=0}return Rb=t,Rb}var Pb,JT;function eH(){if(JT)return Pb;JT=1;function e(t){var n=this.has(t)&&delete this.__data__[t];return this.size-=n?1:0,n}return Pb=e,Pb}var Nb,eM;function tH(){if(eM)return Nb;eM=1;var e=yp(),t="__lodash_hash_undefined__",n=Object.prototype,r=n.hasOwnProperty;function i(a){var s=this.__data__;if(e){var o=s[a];return o===t?void 0:o}return r.call(s,a)?s[a]:void 0}return Nb=i,Nb}var Ob,tM;function nH(){if(tM)return Ob;tM=1;var e=yp(),t=Object.prototype,n=t.hasOwnProperty;function r(i){var a=this.__data__;return e?a[i]!==void 0:n.call(a,i)}return Ob=r,Ob}var Ib,nM;function rH(){if(nM)return Ib;nM=1;var e=yp(),t="__lodash_hash_undefined__";function n(r,i){var a=this.__data__;return this.size+=this.has(r)?0:1,a[r]=e&&i===void 0?t:i,this}return Ib=n,Ib}var Bb,rM;function iH(){if(rM)return Bb;rM=1;var e=JW(),t=eH(),n=tH(),r=nH(),i=rH();function a(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,Bb=a,Bb}var Lb,iM;function aH(){if(iM)return Lb;iM=1;function e(){this.__data__=[],this.size=0}return Lb=e,Lb}var zb,aM;function sM(){if(aM)return zb;aM=1;function e(t,n){return t===n||t!==t&&n!==n}return zb=e,zb}var qb,oM;function bp(){if(oM)return qb;oM=1;var e=sM();function t(n,r){for(var i=n.length;i--;)if(e(n[i][0],r))return i;return-1}return qb=t,qb}var Ub,uM;function sH(){if(uM)return Ub;uM=1;var e=bp(),t=Array.prototype,n=t.splice;function r(i){var a=this.__data__,s=e(a,i);if(s<0)return!1;var o=a.length-1;return s==o?a.pop():n.call(a,s,1),--this.size,!0}return Ub=r,Ub}var Vb,lM;function oH(){if(lM)return Vb;lM=1;var e=bp();function t(n){var r=this.__data__,i=e(r,n);return i<0?void 0:r[i][1]}return Vb=t,Vb}var Wb,cM;function uH(){if(cM)return Wb;cM=1;var e=bp();function t(n){return e(this.__data__,n)>-1}return Wb=t,Wb}var Hb,fM;function lH(){if(fM)return Hb;fM=1;var e=bp();function t(n,r){var i=this.__data__,a=e(i,n);return a<0?(++this.size,i.push([n,r])):i[a][1]=r,this}return Hb=t,Hb}var jb,dM;function cH(){if(dM)return jb;dM=1;var e=aH(),t=sH(),n=oH(),r=uH(),i=lH();function a(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,jb=a,jb}var Gb,hM;function fH(){if(hM)return Gb;hM=1;var e=$b(),t=ep(),n=e(t,"Map");return Gb=n,Gb}var Yb,gM;function dH(){if(gM)return Yb;gM=1;var e=iH(),t=cH(),n=fH();function r(){this.size=0,this.__data__={hash:new e,map:new(n||t),string:new e}}return Yb=r,Yb}var Xb,pM;function hH(){if(pM)return Xb;pM=1;function e(t){var n=typeof t;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?t!=="__proto__":t===null}return Xb=e,Xb}var Kb,vM;function wp(){if(vM)return Kb;vM=1;var e=hH();function t(n,r){var i=n.__data__;return e(r)?i[typeof r=="string"?"string":"hash"]:i.map}return Kb=t,Kb}var Zb,mM;function gH(){if(mM)return Zb;mM=1;var e=wp();function t(n){var r=e(this,n).delete(n);return this.size-=r?1:0,r}return Zb=t,Zb}var Qb,yM;function pH(){if(yM)return Qb;yM=1;var e=wp();function t(n){return e(this,n).get(n)}return Qb=t,Qb}var Jb,bM;function vH(){if(bM)return Jb;bM=1;var e=wp();function t(n){return e(this,n).has(n)}return Jb=t,Jb}var e2,wM;function mH(){if(wM)return e2;wM=1;var e=wp();function t(n,r){var i=e(this,n),a=i.size;return i.set(n,r),this.size+=i.size==a?0:1,this}return e2=t,e2}var t2,xM;function yH(){if(xM)return t2;xM=1;var e=dH(),t=gH(),n=pH(),r=vH(),i=mH();function a(s){var o=-1,u=s==null?0:s.length;for(this.clear();++o<u;){var l=s[o];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=n,a.prototype.has=r,a.prototype.set=i,t2=a,t2}var n2,EM;function bH(){if(EM)return n2;EM=1;var e=yH(),t="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var s=arguments,o=i?i.apply(this,s):s[0],u=a.cache;if(u.has(o))return u.get(o);var l=r.apply(this,s);return a.cache=u.set(o,l)||u,l};return a.cache=new(n.Cache||e),a}return n.Cache=e,n2=n,n2}var r2,FM;function wH(){if(FM)return r2;FM=1;var e=bH(),t=500;function n(r){var i=e(r,function(s){return a.size===t&&a.clear(),s}),a=i.cache;return i}return r2=n,r2}var i2,SM;function CM(){if(SM)return i2;SM=1;var e=wH(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,n=/\\(\\)?/g,r=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(s,o,u,l){a.push(u?l.replace(n,"$1"):o||s)}),a});return i2=r,i2}var a2,kM;function _M(){if(kM)return a2;kM=1;function e(t,n){for(var r=-1,i=t==null?0:t.length,a=Array(i);++r<i;)a[r]=n(t[r],r,t);return a}return a2=e,a2}var s2,AM;function xH(){if(AM)return s2;AM=1;var e=K1(),t=_M(),n=mp(),r=Yf(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function s(o){if(typeof o=="string")return o;if(n(o))return t(o,s)+"";if(r(o))return a?a.call(o):"";var u=o+"";return u=="0"&&1/o==-1/0?"-0":u}return s2=s,s2}var o2,TM;function MM(){if(TM)return o2;TM=1;var e=xH();function t(n){return n==null?"":e(n)}return o2=t,o2}var u2,$M;function DM(){if($M)return u2;$M=1;var e=mp(),t=jW(),n=CM(),r=MM();function i(a,s){return e(a)?a:t(a,s)?[a]:n(r(a))}return u2=i,u2}var l2,RM;function c2(){if(RM)return l2;RM=1;var e=Yf();function t(n){if(typeof n=="string"||e(n))return n;var r=n+"";return r=="0"&&1/n==-1/0?"-0":r}return l2=t,l2}var f2,PM;function EH(){if(PM)return f2;PM=1;var e=DM(),t=c2();function n(r,i){i=e(i,r);for(var a=0,s=i.length;r!=null&&a<s;)r=r[t(i[a++])];return a&&a==s?r:void 0}return f2=n,f2}var d2,NM;function FH(){if(NM)return d2;NM=1;var e=EH();function t(n,r,i){var a=n==null?void 0:e(n,r);return a===void 0?i:a}return d2=t,d2}var SH=FH(),CH=jf(SH),h2,OM;function kH(){if(OM)return h2;OM=1;var e=$b(),t=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch{}}();return h2=t,h2}var g2,IM;function _H(){if(IM)return g2;IM=1;var e=kH();function t(n,r,i){r=="__proto__"&&e?e(n,r,{configurable:!0,enumerable:!0,value:i,writable:!0}):n[r]=i}return g2=t,g2}var p2,BM;function AH(){if(BM)return p2;BM=1;var e=_H(),t=sM(),n=Object.prototype,r=n.hasOwnProperty;function i(a,s,o){var u=a[s];(!(r.call(a,s)&&t(u,o))||o===void 0&&!(s in a))&&e(a,s,o)}return p2=i,p2}var v2,LM;function TH(){if(LM)return v2;LM=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function n(r,i){var a=typeof r;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(r))&&r>-1&&r%1==0&&r<i}return v2=n,v2}var m2,zM;function MH(){if(zM)return m2;zM=1;var e=AH(),t=DM(),n=TH(),r=Gf(),i=c2();function a(s,o,u,l){if(!r(s))return s;o=t(o,s);for(var c=-1,f=o.length,d=f-1,h=s;h!=null&&++c<f;){var g=i(o[c]),p=u;if(g==="__proto__"||g==="constructor"||g==="prototype")return s;if(c!=d){var v=h[g];p=l?l(v,g,h):void 0,p===void 0&&(p=r(v)?v:n(o[c+1])?[]:{})}e(h,g,p),h=h[g]}return s}return m2=a,m2}var y2,qM;function $H(){if(qM)return y2;qM=1;var e=MH();function t(n,r,i){return n==null?n:e(n,r,i)}return y2=t,y2}var DH=$H(),RH=jf(DH),b2,UM;function PH(){if(UM)return b2;UM=1;function e(t,n){var r=-1,i=t.length;for(n||(n=Array(i));++r<i;)n[r]=t[r];return n}return b2=e,b2}var w2,VM;function NH(){if(VM)return w2;VM=1;var e=_M(),t=PH(),n=mp(),r=Yf(),i=CM(),a=c2(),s=MM();function o(u){return n(u)?e(u,a):r(u)?[u]:t(i(s(u)))}return w2=o,w2}var OH=NH(),IH=jf(OH),BH={data:function(t){var n={field:"data",bindingEvent:"data",allowBinding:!1,allowSetting:!1,allowGetting:!1,settingEvent:"data",settingTriggersEvent:!1,triggerFnName:"trigger",immutableKeys:{},updateStyle:!1,beforeGet:function(i){},beforeSet:function(i,a){},onSet:function(i){},canSet:function(i){return!0}};return t=Ie({},n,t),function(i,a){var s=t,o=this,u=o.length!==void 0,l=u?o:[o],c=u?o[0]:o;if(Me(i)){var f=i.indexOf(".")!==-1,d=f&&IH(i);if(s.allowGetting&&a===void 0){var h;return c&&(s.beforeGet(c),d&&c._private[s.field][i]===void 0?h=CH(c._private[s.field],d):h=c._private[s.field][i]),h}else if(s.allowSetting&&a!==void 0){var g=!s.immutableKeys[i];if(g){var p=xA({},i,a);s.beforeSet(o,p);for(var v=0,m=l.length;v<m;v++){var y=l[v];s.canSet(y)&&(d&&c._private[s.field][i]===void 0?RH(y._private[s.field],d,a):y._private[s.field][i]=a)}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}}}else if(s.allowSetting&&ut(i)){var b=i,w,E,F=Object.keys(b);s.beforeSet(o,b);for(var x=0;x<F.length;x++){w=F[x],E=b[w];var C=!s.immutableKeys[w];if(C)for(var S=0;S<l.length;S++){var _=l[S];s.canSet(_)&&(_._private[s.field][w]=E)}}s.updateStyle&&o.updateStyle(),s.onSet(o),s.settingTriggersEvent&&o[s.triggerFnName](s.settingEvent)}else if(s.allowBinding&&Lt(i)){var k=i;o.on(s.bindingEvent,k)}else if(s.allowGetting&&i===void 0){var T;return c&&(s.beforeGet(c),T=c._private[s.field]),T}return o}},removeData:function(t){var n={field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!1,immutableKeys:{}};return t=Ie({},n,t),function(i){var a=t,s=this,o=s.length!==void 0,u=o?s:[s];if(Me(i)){for(var l=i.split(/\s+/),c=l.length,f=0;f<c;f++){var d=l[f];if(!ao(d)){var h=!a.immutableKeys[d];if(h)for(var g=0,p=u.length;g<p;g++)u[g]._private[a.field][d]=void 0}}a.triggerEvent&&s[a.triggerFnName](a.event)}else if(i===void 0){for(var v=0,m=u.length;v<m;v++)for(var y=u[v]._private[a.field],b=Object.keys(y),w=0;w<b.length;w++){var E=b[w],F=!a.immutableKeys[E];F&&(y[E]=void 0)}a.triggerEvent&&s[a.triggerFnName](a.event)}return s}}},LH={eventAliasesOn:function(t){var n=t;n.addListener=n.listen=n.bind=n.on,n.unlisten=n.unbind=n.off=n.removeListener,n.trigger=n.emit,n.pon=n.promiseOn=function(r,i){var a=this,s=Array.prototype.slice.call(arguments,0);return new ec(function(o,u){var l=function(h){a.off.apply(a,f),o(h)},c=s.concat([l]),f=c.concat([]);a.on.apply(a,c)})}}},pt={};[HW,BH,LH].forEach(function(e){Ie(pt,e)});var zH={animate:pt.animate(),animation:pt.animation(),animated:pt.animated(),clearQueue:pt.clearQueue(),delay:pt.delay(),delayAnimation:pt.delayAnimation(),stop:pt.stop()},xp={classes:function(t){var n=this;if(t===void 0){var r=[];return n[0]._private.classes.forEach(function(g){return r.push(g)}),r}else kt(t)||(t=(t||"").match(/\S+/g)||[]);for(var i=[],a=new jl(t),s=0;s<n.length;s++){for(var o=n[s],u=o._private,l=u.classes,c=!1,f=0;f<t.length;f++){var d=t[f],h=l.has(d);if(!h){c=!0;break}}c||(c=l.size!==t.length),c&&(u.classes=a,i.push(o))}return i.length>0&&this.spawn(i).updateStyle().emit("class"),n},addClass:function(t){return this.toggleClass(t,!0)},hasClass:function(t){var n=this[0];return n!=null&&n._private.classes.has(t)},toggleClass:function(t,n){kt(t)||(t=t.match(/\S+/g)||[]);for(var r=this,i=n===void 0,a=[],s=0,o=r.length;s<o;s++)for(var u=r[s],l=u._private.classes,c=!1,f=0;f<t.length;f++){var d=t[f],h=l.has(d),g=!1;n||i&&!h?(l.add(d),g=!0):(!n||i&&h)&&(l.delete(d),g=!0),!c&&g&&(a.push(u),c=!0)}return a.length>0&&this.spawn(a).updateStyle().emit("class"),r},removeClass:function(t){return this.toggleClass(t,!1)},flashClass:function(t,n){var r=this;if(n==null)n=250;else if(n===0)return r;return r.addClass(t),setTimeout(function(){r.removeClass(t)},n),r}};xp.className=xp.classNames=xp.classes;var lt={metaChar:"[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]",comparatorOp:"=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=",boolOp:"\\?|\\!|\\^",string:`"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`,number:rn,meta:"degree|indegree|outdegree",separator:"\\s*,\\s*",descendant:"\\s+",child:"\\s+>\\s+",subject:"\\$",group:"node|edge|\\*",directedEdge:"\\s+->\\s+",undirectedEdge:"\\s+<->\\s+"};lt.variable="(?:[\\w-.]|(?:\\\\"+lt.metaChar+"))+",lt.className="(?:[\\w-]|(?:\\\\"+lt.metaChar+"))+",lt.value=lt.string+"|"+lt.number,lt.id=lt.variable,function(){var e,t,n;for(e=lt.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],lt.comparatorOp+="|@"+t;for(e=lt.comparatorOp.split("|"),n=0;n<e.length;n++)t=e[n],!(t.indexOf("!")>=0)&&t!=="="&&(lt.comparatorOp+="|\\!"+t)}();var Et=function(){return{checks:[]}},Se={GROUP:0,COLLECTION:1,FILTER:2,DATA_COMPARE:3,DATA_EXIST:4,DATA_BOOL:5,META_COMPARE:6,STATE:7,ID:8,CLASS:9,UNDIRECTED_EDGE:10,DIRECTED_EDGE:11,NODE_SOURCE:12,NODE_TARGET:13,NODE_NEIGHBOR:14,CHILD:15,DESCENDANT:16,PARENT:17,ANCESTOR:18,COMPOUND_SPLIT:19,TRUE:20},x2=[{selector:":selected",matches:function(t){return t.selected()}},{selector:":unselected",matches:function(t){return!t.selected()}},{selector:":selectable",matches:function(t){return t.selectable()}},{selector:":unselectable",matches:function(t){return!t.selectable()}},{selector:":locked",matches:function(t){return t.locked()}},{selector:":unlocked",matches:function(t){return!t.locked()}},{selector:":visible",matches:function(t){return t.visible()}},{selector:":hidden",matches:function(t){return!t.visible()}},{selector:":transparent",matches:function(t){return t.transparent()}},{selector:":grabbed",matches:function(t){return t.grabbed()}},{selector:":free",matches:function(t){return!t.grabbed()}},{selector:":removed",matches:function(t){return t.removed()}},{selector:":inside",matches:function(t){return!t.removed()}},{selector:":grabbable",matches:function(t){return t.grabbable()}},{selector:":ungrabbable",matches:function(t){return!t.grabbable()}},{selector:":animated",matches:function(t){return t.animated()}},{selector:":unanimated",matches:function(t){return!t.animated()}},{selector:":parent",matches:function(t){return t.isParent()}},{selector:":childless",matches:function(t){return t.isChildless()}},{selector:":child",matches:function(t){return t.isChild()}},{selector:":orphan",matches:function(t){return t.isOrphan()}},{selector:":nonorphan",matches:function(t){return t.isChild()}},{selector:":compound",matches:function(t){return t.isNode()?t.isParent():t.source().isParent()||t.target().isParent()}},{selector:":loop",matches:function(t){return t.isLoop()}},{selector:":simple",matches:function(t){return t.isSimple()}},{selector:":active",matches:function(t){return t.active()}},{selector:":inactive",matches:function(t){return!t.active()}},{selector:":backgrounding",matches:function(t){return t.backgrounding()}},{selector:":nonbackgrounding",matches:function(t){return!t.backgrounding()}}].sort(function(e,t){return VU(e.selector,t.selector)}),qH=function(){for(var e={},t,n=0;n<x2.length;n++)t=x2[n],e[t.selector]=t.matches;return e}(),UH=function(t,n){return qH[t](n)},VH="("+x2.map(function(e){return e.selector}).join("|")+")",tc=function(t){return t.replace(new RegExp("\\\\("+lt.metaChar+")","g"),function(n,r){return r})},co=function(t,n,r){t[t.length-1]=r},E2=[{name:"group",query:!0,regex:"("+lt.group+")",populate:function(t,n,r){var i=pn(r,1),a=i[0];n.checks.push({type:Se.GROUP,value:a==="*"?a:a+"s"})}},{name:"state",query:!0,regex:VH,populate:function(t,n,r){var i=pn(r,1),a=i[0];n.checks.push({type:Se.STATE,value:a})}},{name:"id",query:!0,regex:"\\#("+lt.id+")",populate:function(t,n,r){var i=pn(r,1),a=i[0];n.checks.push({type:Se.ID,value:tc(a)})}},{name:"className",query:!0,regex:"\\.("+lt.className+")",populate:function(t,n,r){var i=pn(r,1),a=i[0];n.checks.push({type:Se.CLASS,value:tc(a)})}},{name:"dataExists",query:!0,regex:"\\[\\s*("+lt.variable+")\\s*\\]",populate:function(t,n,r){var i=pn(r,1),a=i[0];n.checks.push({type:Se.DATA_EXIST,field:tc(a)})}},{name:"dataCompare",query:!0,regex:"\\[\\s*("+lt.variable+")\\s*("+lt.comparatorOp+")\\s*("+lt.value+")\\s*\\]",populate:function(t,n,r){var i=pn(r,3),a=i[0],s=i[1],o=i[2],u=new RegExp("^"+lt.string+"$").exec(o)!=null;u?o=o.substring(1,o.length-1):o=parseFloat(o),n.checks.push({type:Se.DATA_COMPARE,field:tc(a),operator:s,value:o})}},{name:"dataBool",query:!0,regex:"\\[\\s*("+lt.boolOp+")\\s*("+lt.variable+")\\s*\\]",populate:function(t,n,r){var i=pn(r,2),a=i[0],s=i[1];n.checks.push({type:Se.DATA_BOOL,field:tc(s),operator:a})}},{name:"metaCompare",query:!0,regex:"\\[\\[\\s*("+lt.meta+")\\s*("+lt.comparatorOp+")\\s*("+lt.number+")\\s*\\]\\]",populate:function(t,n,r){var i=pn(r,3),a=i[0],s=i[1],o=i[2];n.checks.push({type:Se.META_COMPARE,field:tc(a),operator:s,value:parseFloat(o)})}},{name:"nextQuery",separator:!0,regex:lt.separator,populate:function(t,n){var r=t.currentSubject,i=t.edgeCount,a=t.compoundCount,s=t[t.length-1];r!=null&&(s.subject=r,t.currentSubject=null),s.edgeCount=i,s.compoundCount=a,t.edgeCount=0,t.compoundCount=0;var o=t[t.length++]=Et();return o}},{name:"directedEdge",separator:!0,regex:lt.directedEdge,populate:function(t,n){if(t.currentSubject==null){var r=Et(),i=n,a=Et();return r.checks.push({type:Se.DIRECTED_EDGE,source:i,target:a}),co(t,n,r),t.edgeCount++,a}else{var s=Et(),o=n,u=Et();return s.checks.push({type:Se.NODE_SOURCE,source:o,target:u}),co(t,n,s),t.edgeCount++,u}}},{name:"undirectedEdge",separator:!0,regex:lt.undirectedEdge,populate:function(t,n){if(t.currentSubject==null){var r=Et(),i=n,a=Et();return r.checks.push({type:Se.UNDIRECTED_EDGE,nodes:[i,a]}),co(t,n,r),t.edgeCount++,a}else{var s=Et(),o=n,u=Et();return s.checks.push({type:Se.NODE_NEIGHBOR,node:o,neighbor:u}),co(t,n,s),u}}},{name:"child",separator:!0,regex:lt.child,populate:function(t,n){if(t.currentSubject==null){var r=Et(),i=Et(),a=t[t.length-1];return r.checks.push({type:Se.CHILD,parent:a,child:i}),co(t,n,r),t.compoundCount++,i}else if(t.currentSubject===n){var s=Et(),o=t[t.length-1],u=Et(),l=Et(),c=Et(),f=Et();return s.checks.push({type:Se.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=n.checks,n.checks=[{type:Se.TRUE}],f.checks.push({type:Se.TRUE}),u.checks.push({type:Se.PARENT,parent:f,child:c}),co(t,o,s),t.currentSubject=l,t.compoundCount++,c}else{var d=Et(),h=Et(),g=[{type:Se.PARENT,parent:d,child:h}];return d.checks=n.checks,n.checks=g,t.compoundCount++,h}}},{name:"descendant",separator:!0,regex:lt.descendant,populate:function(t,n){if(t.currentSubject==null){var r=Et(),i=Et(),a=t[t.length-1];return r.checks.push({type:Se.DESCENDANT,ancestor:a,descendant:i}),co(t,n,r),t.compoundCount++,i}else if(t.currentSubject===n){var s=Et(),o=t[t.length-1],u=Et(),l=Et(),c=Et(),f=Et();return s.checks.push({type:Se.COMPOUND_SPLIT,left:o,right:u,subject:l}),l.checks=n.checks,n.checks=[{type:Se.TRUE}],f.checks.push({type:Se.TRUE}),u.checks.push({type:Se.ANCESTOR,ancestor:f,descendant:c}),co(t,o,s),t.currentSubject=l,t.compoundCount++,c}else{var d=Et(),h=Et(),g=[{type:Se.ANCESTOR,ancestor:d,descendant:h}];return d.checks=n.checks,n.checks=g,t.compoundCount++,h}}},{name:"subject",modifier:!0,regex:lt.subject,populate:function(t,n){if(t.currentSubject!=null&&t.currentSubject!==n)return gt("Redefinition of subject in selector `"+t.toString()+"`"),!1;t.currentSubject=n;var r=t[t.length-1],i=r.checks[0],a=i==null?null:i.type;a===Se.DIRECTED_EDGE?i.type=Se.NODE_TARGET:a===Se.UNDIRECTED_EDGE&&(i.type=Se.NODE_NEIGHBOR,i.node=i.nodes[1],i.neighbor=i.nodes[0],i.nodes=null)}}];E2.forEach(function(e){return e.regexObj=new RegExp("^"+e.regex)});var WH=function(t){for(var n,r,i,a=0;a<E2.length;a++){var s=E2[a],o=s.name,u=t.match(s.regexObj);if(u!=null){r=u,n=s,i=o;var l=u[0];t=t.substring(l.length);break}}return{expr:n,match:r,name:i,remaining:t}},HH=function(t){var n=t.match(/^\s+/);if(n){var r=n[0];t=t.substring(r.length)}return t},jH=function(t){var n=this,r=n.inputText=t,i=n[0]=Et();for(n.length=1,r=HH(r);;){var a=WH(r);if(a.expr==null)return gt("The selector `"+t+"`is invalid"),!1;var s=a.match.slice(1),o=a.expr.populate(n,i,s);if(o===!1)return!1;if(o!=null&&(i=o),r=a.remaining,r.match(/^\s*$/))break}var u=n[n.length-1];n.currentSubject!=null&&(u.subject=n.currentSubject),u.edgeCount=n.edgeCount,u.compoundCount=n.compoundCount;for(var l=0;l<n.length;l++){var c=n[l];if(c.compoundCount>0&&c.edgeCount>0)return gt("The selector `"+t+"` is invalid because it uses both a compound selector and an edge selector"),!1;if(c.edgeCount>1)return gt("The selector `"+t+"` is invalid because it uses multiple edge selectors"),!1;c.edgeCount===1&&gt("The selector `"+t+"` is deprecated.  Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons.  Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes.")}return!0},GH=function(){if(this.toStringCache!=null)return this.toStringCache;for(var t=function(c){return c??""},n=function(c){return Me(c)?'"'+c+'"':t(c)},r=function(c){return" "+c+" "},i=function(c,f){var d=c.type,h=c.value;switch(d){case Se.GROUP:{var g=t(h);return g.substring(0,g.length-1)}case Se.DATA_COMPARE:{var p=c.field,v=c.operator;return"["+p+r(t(v))+n(h)+"]"}case Se.DATA_BOOL:{var m=c.operator,y=c.field;return"["+t(m)+y+"]"}case Se.DATA_EXIST:{var b=c.field;return"["+b+"]"}case Se.META_COMPARE:{var w=c.operator,E=c.field;return"[["+E+r(t(w))+n(h)+"]]"}case Se.STATE:return h;case Se.ID:return"#"+h;case Se.CLASS:return"."+h;case Se.PARENT:case Se.CHILD:return a(c.parent,f)+r(">")+a(c.child,f);case Se.ANCESTOR:case Se.DESCENDANT:return a(c.ancestor,f)+" "+a(c.descendant,f);case Se.COMPOUND_SPLIT:{var F=a(c.left,f),x=a(c.subject,f),C=a(c.right,f);return F+(F.length>0?" ":"")+x+C}case Se.TRUE:return""}},a=function(c,f){return c.checks.reduce(function(d,h,g){return d+(f===c&&g===0?"$":"")+i(h,f)},"")},s="",o=0;o<this.length;o++){var u=this[o];s+=a(u,u.subject),this.length>1&&o<this.length-1&&(s+=", ")}return this.toStringCache=s,s},YH={parse:jH,toString:GH},WM=function(t,n,r){var i,a=Me(t),s=ve(t),o=Me(r),u,l,c=!1,f=!1,d=!1;switch(n.indexOf("!")>=0&&(n=n.replace("!",""),f=!0),n.indexOf("@")>=0&&(n=n.replace("@",""),c=!0),(a||o||c)&&(u=!a&&!s?"":""+t,l=""+r),c&&(t=u=u.toLowerCase(),r=l=l.toLowerCase()),n){case"*=":i=u.indexOf(l)>=0;break;case"$=":i=u.indexOf(l,u.length-l.length)>=0;break;case"^=":i=u.indexOf(l)===0;break;case"=":i=t===r;break;case">":d=!0,i=t>r;break;case">=":d=!0,i=t>=r;break;case"<":d=!0,i=t<r;break;case"<=":d=!0,i=t<=r;break;default:i=!1;break}return f&&(t!=null||!d)&&(i=!i),i},XH=function(t,n){switch(n){case"?":return!!t;case"!":return!t;case"^":return t===void 0}},KH=function(t){return t!==void 0},F2=function(t,n){return t.data(n)},ZH=function(t,n){return t[n]()},Gt=[],Pt=function(t,n){return t.checks.every(function(r){return Gt[r.type](r,n)})};Gt[Se.GROUP]=function(e,t){var n=e.value;return n==="*"||n===t.group()},Gt[Se.STATE]=function(e,t){var n=e.value;return UH(n,t)},Gt[Se.ID]=function(e,t){var n=e.value;return t.id()===n},Gt[Se.CLASS]=function(e,t){var n=e.value;return t.hasClass(n)},Gt[Se.META_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return WM(ZH(t,n),r,i)},Gt[Se.DATA_COMPARE]=function(e,t){var n=e.field,r=e.operator,i=e.value;return WM(F2(t,n),r,i)},Gt[Se.DATA_BOOL]=function(e,t){var n=e.field,r=e.operator;return XH(F2(t,n),r)},Gt[Se.DATA_EXIST]=function(e,t){var n=e.field;return e.operator,KH(F2(t,n))},Gt[Se.UNDIRECTED_EDGE]=function(e,t){var n=e.nodes[0],r=e.nodes[1],i=t.source(),a=t.target();return Pt(n,i)&&Pt(r,a)||Pt(r,i)&&Pt(n,a)},Gt[Se.NODE_NEIGHBOR]=function(e,t){return Pt(e.node,t)&&t.neighborhood().some(function(n){return n.isNode()&&Pt(e.neighbor,n)})},Gt[Se.DIRECTED_EDGE]=function(e,t){return Pt(e.source,t.source())&&Pt(e.target,t.target())},Gt[Se.NODE_SOURCE]=function(e,t){return Pt(e.source,t)&&t.outgoers().some(function(n){return n.isNode()&&Pt(e.target,n)})},Gt[Se.NODE_TARGET]=function(e,t){return Pt(e.target,t)&&t.incomers().some(function(n){return n.isNode()&&Pt(e.source,n)})},Gt[Se.CHILD]=function(e,t){return Pt(e.child,t)&&Pt(e.parent,t.parent())},Gt[Se.PARENT]=function(e,t){return Pt(e.parent,t)&&t.children().some(function(n){return Pt(e.child,n)})},Gt[Se.DESCENDANT]=function(e,t){return Pt(e.descendant,t)&&t.ancestors().some(function(n){return Pt(e.ancestor,n)})},Gt[Se.ANCESTOR]=function(e,t){return Pt(e.ancestor,t)&&t.descendants().some(function(n){return Pt(e.descendant,n)})},Gt[Se.COMPOUND_SPLIT]=function(e,t){return Pt(e.subject,t)&&Pt(e.left,t)&&Pt(e.right,t)},Gt[Se.TRUE]=function(){return!0},Gt[Se.COLLECTION]=function(e,t){var n=e.value;return n.has(t)},Gt[Se.FILTER]=function(e,t){var n=e.value;return n(t)};var QH=function(t){var n=this;if(n.length===1&&n[0].checks.length===1&&n[0].checks[0].type===Se.ID)return t.getElementById(n[0].checks[0].value).collection();var r=function(a){for(var s=0;s<n.length;s++){var o=n[s];if(Pt(o,a))return!0}return!1};return n.text()==null&&(r=function(){return!0}),t.filter(r)},JH=function(t){for(var n=this,r=0;r<n.length;r++){var i=n[r];if(Pt(i,t))return!0}return!1},ej={matches:JH,filter:QH},fo=function(t){this.inputText=t,this.currentSubject=null,this.compoundCount=0,this.edgeCount=0,this.length=0,t==null||Me(t)&&t.match(/^\s*$/)||(Yr(t)?this.addQuery({checks:[{type:Se.COLLECTION,value:t.collection()}]}):Lt(t)?this.addQuery({checks:[{type:Se.FILTER,value:t}]}):Me(t)?this.parse(t)||(this.invalid=!0):zt("A selector must be created from a string; found "))},ho=fo.prototype;[YH,ej].forEach(function(e){return Ie(ho,e)}),ho.text=function(){return this.inputText},ho.size=function(){return this.length},ho.eq=function(e){return this[e]},ho.sameText=function(e){return!this.invalid&&!e.invalid&&this.text()===e.text()},ho.addQuery=function(e){this[this.length++]=e},ho.selector=ho.toString;var go={allAre:function(t){var n=new fo(t);return this.every(function(r){return n.matches(r)})},is:function(t){var n=new fo(t);return this.some(function(r){return n.matches(r)})},some:function(t,n){for(var r=0;r<this.length;r++){var i=n?t.apply(n,[this[r],r,this]):t(this[r],r,this);if(i)return!0}return!1},every:function(t,n){for(var r=0;r<this.length;r++){var i=n?t.apply(n,[this[r],r,this]):t(this[r],r,this);if(!i)return!1}return!0},same:function(t){if(this===t)return!0;t=this.cy().collection(t);var n=this.length,r=t.length;return n!==r?!1:n===1?this[0]===t[0]:this.every(function(i){return t.hasElementWithId(i.id())})},anySame:function(t){return t=this.cy().collection(t),this.some(function(n){return t.hasElementWithId(n.id())})},allAreNeighbors:function(t){t=this.cy().collection(t);var n=this.neighborhood();return t.every(function(r){return n.hasElementWithId(r.id())})},contains:function(t){t=this.cy().collection(t);var n=this;return t.every(function(r){return n.hasElementWithId(r.id())})}};go.allAreNeighbours=go.allAreNeighbors,go.has=go.contains,go.equal=go.equals=go.same;var li=function(t,n){return function(i,a,s,o){var u=i,l=this,c;if(u==null?c="":Yr(u)&&u.length===1&&(c=u.id()),l.length===1&&c){var f=l[0]._private,d=f.traversalCache=f.traversalCache||{},h=d[n]=d[n]||[],g=oo(c),p=h[g];return p||(h[g]=t.call(l,i,a,s,o))}else return t.call(l,i,a,s,o)}},nc={parent:function(t){var n=[];if(this.length===1){var r=this[0]._private.parent;if(r)return r}for(var i=0;i<this.length;i++){var a=this[i],s=a._private.parent;s&&n.push(s)}return this.spawn(n,!0).filter(t)},parents:function(t){for(var n=[],r=this.parent();r.nonempty();){for(var i=0;i<r.length;i++){var a=r[i];n.push(a)}r=r.parent()}return this.spawn(n,!0).filter(t)},commonAncestors:function(t){for(var n,r=0;r<this.length;r++){var i=this[r],a=i.parents();n=n||a,n=n.intersect(a)}return n.filter(t)},orphans:function(t){return this.stdFilter(function(n){return n.isOrphan()}).filter(t)},nonorphans:function(t){return this.stdFilter(function(n){return n.isChild()}).filter(t)},children:li(function(e){for(var t=[],n=0;n<this.length;n++)for(var r=this[n],i=r._private.children,a=0;a<i.length;a++)t.push(i[a]);return this.spawn(t,!0).filter(e)},"children"),siblings:function(t){return this.parent().children().not(this).filter(t)},isParent:function(){var t=this[0];if(t)return t.isNode()&&t._private.children.length!==0},isChildless:function(){var t=this[0];if(t)return t.isNode()&&t._private.children.length===0},isChild:function(){var t=this[0];if(t)return t.isNode()&&t._private.parent!=null},isOrphan:function(){var t=this[0];if(t)return t.isNode()&&t._private.parent==null},descendants:function(t){var n=[];function r(i){for(var a=0;a<i.length;a++){var s=i[a];n.push(s),s.children().nonempty()&&r(s.children())}}return r(this.children()),this.spawn(n,!0).filter(t)}};function S2(e,t,n,r){for(var i=[],a=new jl,s=e.cy(),o=s.hasCompoundNodes(),u=0;u<e.length;u++){var l=e[u];n?i.push(l):o&&r(i,a,l)}for(;i.length>0;){var c=i.shift();t(c),a.add(c.id()),o&&r(i,a,c)}return e}function HM(e,t,n){if(n.isParent())for(var r=n._private.children,i=0;i<r.length;i++){var a=r[i];t.has(a.id())||e.push(a)}}nc.forEachDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return S2(this,e,t,HM)};function jM(e,t,n){if(n.isChild()){var r=n._private.parent;t.has(r.id())||e.push(r)}}nc.forEachUp=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return S2(this,e,t,jM)};function tj(e,t,n){jM(e,t,n),HM(e,t,n)}nc.forEachUpAndDown=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return S2(this,e,t,tj)},nc.ancestors=nc.parents;var ad,GM;ad=GM={data:pt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),removeData:pt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,immutableKeys:{id:!0,source:!0,target:!0,parent:!0},updateStyle:!0}),scratch:pt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:pt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),rscratch:pt.data({field:"rscratch",allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!0}),removeRscratch:pt.removeData({field:"rscratch",triggerEvent:!1}),id:function(){var t=this[0];if(t)return t._private.data.id}},ad.attr=ad.data,ad.removeAttr=ad.removeData;var nj=GM,Ep={};function C2(e){return function(t){var n=this;if(t===void 0&&(t=!0),n.length!==0)if(n.isNode()&&!n.removed()){for(var r=0,i=n[0],a=i._private.edges,s=0;s<a.length;s++){var o=a[s];!t&&o.isLoop()||(r+=e(i,o))}return r}else return}}Ie(Ep,{degree:C2(function(e,t){return t.source().same(t.target())?2:1}),indegree:C2(function(e,t){return t.target().same(e)?1:0}),outdegree:C2(function(e,t){return t.source().same(e)?1:0})});function rc(e,t){return function(n){for(var r,i=this.nodes(),a=0;a<i.length;a++){var s=i[a],o=s[e](n);o!==void 0&&(r===void 0||t(o,r))&&(r=o)}return r}}Ie(Ep,{minDegree:rc("degree",function(e,t){return e<t}),maxDegree:rc("degree",function(e,t){return e>t}),minIndegree:rc("indegree",function(e,t){return e<t}),maxIndegree:rc("indegree",function(e,t){return e>t}),minOutdegree:rc("outdegree",function(e,t){return e<t}),maxOutdegree:rc("outdegree",function(e,t){return e>t})}),Ie(Ep,{totalDegree:function(t){for(var n=0,r=this.nodes(),i=0;i<r.length;i++)n+=r[i].degree(t);return n}});var Ri,YM,XM=function(t,n,r){for(var i=0;i<t.length;i++){var a=t[i];if(!a.locked()){var s=a._private.position,o={x:n.x!=null?n.x-s.x:0,y:n.y!=null?n.y-s.y:0};a.isParent()&&!(o.x===0&&o.y===0)&&a.children().shift(o,r),a.dirtyBoundingBoxCache()}}},KM={field:"position",bindingEvent:"position",allowBinding:!0,allowSetting:!0,settingEvent:"position",settingTriggersEvent:!0,triggerFnName:"emitAndNotify",allowGetting:!0,validKeys:["x","y"],beforeGet:function(t){t.updateCompoundBounds()},beforeSet:function(t,n){XM(t,n,!1)},onSet:function(t){t.dirtyCompoundBoundsCache()},canSet:function(t){return!t.locked()}};Ri=YM={position:pt.data(KM),silentPosition:pt.data(Ie({},KM,{allowBinding:!1,allowSetting:!0,settingTriggersEvent:!1,allowGetting:!1,beforeSet:function(t,n){XM(t,n,!0)},onSet:function(t){t.dirtyCompoundBoundsCache()}})),positions:function(t,n){if(ut(t))n?this.silentPosition(t):this.position(t);else if(Lt(t)){var r=t,i=this.cy();i.startBatch();for(var a=0;a<this.length;a++){var s=this[a],o=void 0;(o=r(s,a))&&(n?s.silentPosition(o):s.position(o))}i.endBatch()}return this},silentPositions:function(t){return this.positions(t,!0)},shift:function(t,n,r){var i;if(ut(t)?(i={x:ve(t.x)?t.x:0,y:ve(t.y)?t.y:0},r=n):Me(t)&&ve(n)&&(i={x:0,y:0},i[t]=n),i!=null){var a=this.cy();a.startBatch();for(var s=0;s<this.length;s++){var o=this[s];if(!(a.hasCompoundNodes()&&o.isChild()&&o.ancestors().anySame(this))){var u=o.position(),l={x:u.x+i.x,y:u.y+i.y};r?o.silentPosition(l):o.position(l)}}a.endBatch()}return this},silentShift:function(t,n){return ut(t)?this.shift(t,!0):Me(t)&&ve(n)&&this.shift(t,n,!0),this},renderedPosition:function(t,n){var r=this[0],i=this.cy(),a=i.zoom(),s=i.pan(),o=ut(t)?t:void 0,u=o!==void 0||n!==void 0&&Me(t);if(r&&r.isNode())if(u)for(var l=0;l<this.length;l++){var c=this[l];n!==void 0?c.position(t,(n-s[t])/a):o!==void 0&&c.position(lT(o,a,s))}else{var f=r.position();return o=sp(f,a,s),t===void 0?o:o[t]}else if(!u)return;return this},relativePosition:function(t,n){var r=this[0],i=this.cy(),a=ut(t)?t:void 0,s=a!==void 0||n!==void 0&&Me(t),o=i.hasCompoundNodes();if(r&&r.isNode())if(s)for(var u=0;u<this.length;u++){var l=this[u],c=o?l.parent():null,f=c&&c.length>0,d=f;f&&(c=c[0]);var h=d?c.position():{x:0,y:0};n!==void 0?l.position(t,n+h[t]):a!==void 0&&l.position({x:a.x+h.x,y:a.y+h.y})}else{var g=r.position(),p=o?r.parent():null,v=p&&p.length>0,m=v;v&&(p=p[0]);var y=m?p.position():{x:0,y:0};return a={x:g.x-y.x,y:g.y-y.y},t===void 0?a:a[t]}else if(!s)return;return this}},Ri.modelPosition=Ri.point=Ri.position,Ri.modelPositions=Ri.points=Ri.positions,Ri.renderedPoint=Ri.renderedPosition,Ri.relativePoint=Ri.relativePosition;var rj=YM,ic,po;ic=po={},po.renderedBoundingBox=function(e){var t=this.boundingBox(e),n=this.cy(),r=n.zoom(),i=n.pan(),a=t.x1*r+i.x,s=t.x2*r+i.x,o=t.y1*r+i.y,u=t.y2*r+i.y;return{x1:a,x2:s,y1:o,y2:u,w:s-a,h:u-o}},po.dirtyCompoundBoundsCache=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();return!t.styleEnabled()||!t.hasCompoundNodes()?this:(this.forEachUp(function(n){if(n.isParent()){var r=n._private;r.compoundBoundsClean=!1,r.bbCache=null,e||n.emitAndNotify("bounds")}}),this)},po.updateCompoundBounds=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,t=this.cy();if(!t.styleEnabled()||!t.hasCompoundNodes())return this;if(!e&&t.batching())return this;function n(s){if(!s.isParent())return;var o=s._private,u=s.children(),l=s.pstyle("compound-sizing-wrt-labels").value==="include",c={width:{val:s.pstyle("min-width").pfValue,left:s.pstyle("min-width-bias-left"),right:s.pstyle("min-width-bias-right")},height:{val:s.pstyle("min-height").pfValue,top:s.pstyle("min-height-bias-top"),bottom:s.pstyle("min-height-bias-bottom")}},f=u.boundingBox({includeLabels:l,includeOverlays:!1,useCache:!1}),d=o.position;(f.w===0||f.h===0)&&(f={w:s.pstyle("width").pfValue,h:s.pstyle("height").pfValue},f.x1=d.x-f.w/2,f.x2=d.x+f.w/2,f.y1=d.y-f.h/2,f.y2=d.y+f.h/2);function h(S,_,k){var T=0,A=0,$=_+k;return S>0&&$>0&&(T=_/$*S,A=k/$*S),{biasDiff:T,biasComplementDiff:A}}function g(S,_,k,T){if(k.units==="%")switch(T){case"width":return S>0?k.pfValue*S:0;case"height":return _>0?k.pfValue*_:0;case"average":return S>0&&_>0?k.pfValue*(S+_)/2:0;case"min":return S>0&&_>0?S>_?k.pfValue*_:k.pfValue*S:0;case"max":return S>0&&_>0?S>_?k.pfValue*S:k.pfValue*_:0;default:return 0}else return k.units==="px"?k.pfValue:0}var p=c.width.left.value;c.width.left.units==="px"&&c.width.val>0&&(p=p*100/c.width.val);var v=c.width.right.value;c.width.right.units==="px"&&c.width.val>0&&(v=v*100/c.width.val);var m=c.height.top.value;c.height.top.units==="px"&&c.height.val>0&&(m=m*100/c.height.val);var y=c.height.bottom.value;c.height.bottom.units==="px"&&c.height.val>0&&(y=y*100/c.height.val);var b=h(c.width.val-f.w,p,v),w=b.biasDiff,E=b.biasComplementDiff,F=h(c.height.val-f.h,m,y),x=F.biasDiff,C=F.biasComplementDiff;o.autoPadding=g(f.w,f.h,s.pstyle("padding"),s.pstyle("padding-relative-to").value),o.autoWidth=Math.max(f.w,c.width.val),d.x=(-w+f.x1+f.x2+E)/2,o.autoHeight=Math.max(f.h,c.height.val),d.y=(-x+f.y1+f.y2+C)/2}for(var r=0;r<this.length;r++){var i=this[r],a=i._private;(!a.compoundBoundsClean||e)&&(n(i),t.batching()||(a.compoundBoundsClean=!0))}return this};var ci=function(t){return t===1/0||t===-1/0?0:t},Pi=function(t,n,r,i,a){i-n===0||a-r===0||n==null||r==null||i==null||a==null||(t.x1=n<t.x1?n:t.x1,t.x2=i>t.x2?i:t.x2,t.y1=r<t.y1?r:t.y1,t.y2=a>t.y2?a:t.y2,t.w=t.x2-t.x1,t.h=t.y2-t.y1)},yu=function(t,n){return n==null?t:Pi(t,n.x1,n.y1,n.x2,n.y2)},sd=function(t,n,r){return ui(t,n,r)},Fp=function(t,n,r){if(!n.cy().headless()){var i=n._private,a=i.rstyle,s=a.arrowWidth/2,o=n.pstyle(r+"-arrow-shape").value,u,l;if(o!=="none"){r==="source"?(u=a.srcX,l=a.srcY):r==="target"?(u=a.tgtX,l=a.tgtY):(u=a.midX,l=a.midY);var c=i.arrowBounds=i.arrowBounds||{},f=c[r]=c[r]||{};f.x1=u-s,f.y1=l-s,f.x2=u+s,f.y2=l+s,f.w=f.x2-f.x1,f.h=f.y2-f.y1,up(f,1),Pi(t,f.x1,f.y1,f.x2,f.y2)}}},k2=function(t,n,r){if(!n.cy().headless()){var i;r?i=r+"-":i="";var a=n._private,s=a.rstyle,o=n.pstyle(i+"label").strValue;if(o){var u=n.pstyle("text-halign"),l=n.pstyle("text-valign"),c=sd(s,"labelWidth",r),f=sd(s,"labelHeight",r),d=sd(s,"labelX",r),h=sd(s,"labelY",r),g=n.pstyle(i+"text-margin-x").pfValue,p=n.pstyle(i+"text-margin-y").pfValue,v=n.isEdge(),m=n.pstyle(i+"text-rotation"),y=n.pstyle("text-outline-width").pfValue,b=n.pstyle("text-border-width").pfValue,w=b/2,E=n.pstyle("text-background-padding").pfValue,F=2,x=f,C=c,S=C/2,_=x/2,k,T,A,$;if(v)k=d-S,T=d+S,A=h-_,$=h+_;else{switch(u.value){case"left":k=d-C,T=d;break;case"center":k=d-S,T=d+S;break;case"right":k=d,T=d+C;break}switch(l.value){case"top":A=h-x,$=h;break;case"center":A=h-_,$=h+_;break;case"bottom":A=h,$=h+x;break}}var M=g-Math.max(y,w)-E-F,D=g+Math.max(y,w)+E+F,P=p-Math.max(y,w)-E-F,N=p+Math.max(y,w)+E+F;k+=M,T+=D,A+=P,$+=N;var O=r||"main",q=a.labelBounds,z=q[O]=q[O]||{};z.x1=k,z.y1=A,z.x2=T,z.y2=$,z.w=T-k,z.h=$-A,z.leftPad=M,z.rightPad=D,z.topPad=P,z.botPad=N;var W=v&&m.strValue==="autorotate",Y=m.pfValue!=null&&m.pfValue!==0;if(W||Y){var J=W?sd(a.rstyle,"labelAngle",r):m.pfValue,X=Math.cos(J),te=Math.sin(J),ie=(k+T)/2,se=(A+$)/2;if(!v){switch(u.value){case"left":ie=T;break;case"right":ie=k;break}switch(l.value){case"top":se=$;break;case"bottom":se=A;break}}var B=function(Qe,Fe){return Qe=Qe-ie,Fe=Fe-se,{x:Qe*X-Fe*te+ie,y:Qe*te+Fe*X+se}},I=B(k,A),U=B(k,$),L=B(T,A),ae=B(T,$);k=Math.min(I.x,U.x,L.x,ae.x),T=Math.max(I.x,U.x,L.x,ae.x),A=Math.min(I.y,U.y,L.y,ae.y),$=Math.max(I.y,U.y,L.y,ae.y)}var de=O+"Rot",Ce=q[de]=q[de]||{};Ce.x1=k,Ce.y1=A,Ce.x2=T,Ce.y2=$,Ce.w=T-k,Ce.h=$-A,Pi(t,k,A,T,$),Pi(a.labelBounds.all,k,A,T,$)}return t}},ij=function(t,n){if(!n.cy().headless()){var r=n.pstyle("outline-opacity").value,i=n.pstyle("outline-width").value;if(r>0&&i>0){var a=n.pstyle("outline-offset").value,s=n.pstyle("shape").value,o=i+a,u=(t.w+o*2)/t.w,l=(t.h+o*2)/t.h,c=0,f=0;["diamond","pentagon","round-triangle"].includes(s)?(u=(t.w+o*2.4)/t.w,f=-o/3.6):["concave-hexagon","rhomboid","right-rhomboid"].includes(s)?u=(t.w+o*2.4)/t.w:s==="star"?(u=(t.w+o*2.8)/t.w,l=(t.h+o*2.6)/t.h,f=-o/3.8):s==="triangle"?(u=(t.w+o*2.8)/t.w,l=(t.h+o*2.4)/t.h,f=-o/1.4):s==="vee"&&(u=(t.w+o*4.4)/t.w,l=(t.h+o*3.8)/t.h,f=-o*.5);var d=t.h*l-t.h,h=t.w*u-t.w;if(lp(t,[Math.ceil(d/2),Math.ceil(h/2)]),c!=0||f!==0){var g=VV(t,c,f);fT(t,g)}}}},aj=function(t,n){var r=t._private.cy,i=r.styleEnabled(),a=r.headless(),s=Rr(),o=t._private,u=t.isNode(),l=t.isEdge(),c,f,d,h,g,p,v=o.rstyle,m=u&&i?t.pstyle("bounds-expansion").pfValue:[0],y=function(Ye){return Ye.pstyle("display").value!=="none"},b=!i||y(t)&&(!l||y(t.source())&&y(t.target()));if(b){var w=0,E=0;i&&n.includeOverlays&&(w=t.pstyle("overlay-opacity").value,w!==0&&(E=t.pstyle("overlay-padding").value));var F=0,x=0;i&&n.includeUnderlays&&(F=t.pstyle("underlay-opacity").value,F!==0&&(x=t.pstyle("underlay-padding").value));var C=Math.max(E,x),S=0,_=0;if(i&&(S=t.pstyle("width").pfValue,_=S/2),u&&n.includeNodes){var k=t.position();g=k.x,p=k.y;var T=t.outerWidth(),A=T/2,$=t.outerHeight(),M=$/2;c=g-A,f=g+A,d=p-M,h=p+M,Pi(s,c,d,f,h),i&&n.includeOutlines&&ij(s,t)}else if(l&&n.includeEdges)if(i&&!a){var D=t.pstyle("curve-style").strValue;if(c=Math.min(v.srcX,v.midX,v.tgtX),f=Math.max(v.srcX,v.midX,v.tgtX),d=Math.min(v.srcY,v.midY,v.tgtY),h=Math.max(v.srcY,v.midY,v.tgtY),c-=_,f+=_,d-=_,h+=_,Pi(s,c,d,f,h),D==="haystack"){var P=v.haystackPts;if(P&&P.length===2){if(c=P[0].x,d=P[0].y,f=P[1].x,h=P[1].y,c>f){var N=c;c=f,f=N}if(d>h){var O=d;d=h,h=O}Pi(s,c-_,d-_,f+_,h+_)}}else if(D==="bezier"||D==="unbundled-bezier"||D.endsWith("segments")||D.endsWith("taxi")){var q;switch(D){case"bezier":case"unbundled-bezier":q=v.bezierPts;break;case"segments":case"taxi":case"round-segments":case"round-taxi":q=v.linePts;break}if(q!=null)for(var z=0;z<q.length;z++){var W=q[z];c=W.x-_,f=W.x+_,d=W.y-_,h=W.y+_,Pi(s,c,d,f,h)}}}else{var Y=t.source(),J=Y.position(),X=t.target(),te=X.position();if(c=J.x,f=te.x,d=J.y,h=te.y,c>f){var ie=c;c=f,f=ie}if(d>h){var se=d;d=h,h=se}c-=_,f+=_,d-=_,h+=_,Pi(s,c,d,f,h)}if(i&&n.includeEdges&&l&&(Fp(s,t,"mid-source"),Fp(s,t,"mid-target"),Fp(s,t,"source"),Fp(s,t,"target")),i){var B=t.pstyle("ghost").value==="yes";if(B){var I=t.pstyle("ghost-offset-x").pfValue,U=t.pstyle("ghost-offset-y").pfValue;Pi(s,s.x1+I,s.y1+U,s.x2+I,s.y2+U)}}var L=o.bodyBounds=o.bodyBounds||{};dT(L,s),lp(L,m),up(L,1),i&&(c=s.x1,f=s.x2,d=s.y1,h=s.y2,Pi(s,c-C,d-C,f+C,h+C));var ae=o.overlayBounds=o.overlayBounds||{};dT(ae,s),lp(ae,m),up(ae,1);var de=o.labelBounds=o.labelBounds||{};de.all!=null?UV(de.all):de.all=Rr(),i&&n.includeLabels&&(n.includeMainLabels&&k2(s,t,null),l&&(n.includeSourceLabels&&k2(s,t,"source"),n.includeTargetLabels&&k2(s,t,"target")))}return s.x1=ci(s.x1),s.y1=ci(s.y1),s.x2=ci(s.x2),s.y2=ci(s.y2),s.w=ci(s.x2-s.x1),s.h=ci(s.y2-s.y1),s.w>0&&s.h>0&&b&&(lp(s,m),up(s,1)),s},ZM=function(t){var n=0,r=function(s){return(s?1:0)<<n++},i=0;return i+=r(t.incudeNodes),i+=r(t.includeEdges),i+=r(t.includeLabels),i+=r(t.includeMainLabels),i+=r(t.includeSourceLabels),i+=r(t.includeTargetLabels),i+=r(t.includeOverlays),i+=r(t.includeOutlines),i},QM=function(t){var n=function(o){return Math.round(o)};if(t.isEdge()){var r=t.source().position(),i=t.target().position();return QA([n(r.x),n(r.y),n(i.x),n(i.y)])}else{var a=t.position();return QA([n(a.x),n(a.y)])}},JM=function(t,n){var r=t._private,i,a=t.isEdge(),s=n==null?e$:ZM(n),o=s===e$;if(r.bbCache==null?(i=aj(t,od),r.bbCache=i,r.bbCachePosKey=QM(t)):i=r.bbCache,!o){var u=t.isNode();i=Rr(),(n.includeNodes&&u||n.includeEdges&&!u)&&(n.includeOverlays?yu(i,r.overlayBounds):yu(i,r.bodyBounds)),n.includeLabels&&(n.includeMainLabels&&(!a||n.includeSourceLabels&&n.includeTargetLabels)?yu(i,r.labelBounds.all):(n.includeMainLabels&&yu(i,r.labelBounds.mainRot),n.includeSourceLabels&&yu(i,r.labelBounds.sourceRot),n.includeTargetLabels&&yu(i,r.labelBounds.targetRot))),i.w=i.x2-i.x1,i.h=i.y2-i.y1}return i},od={includeNodes:!0,includeEdges:!0,includeLabels:!0,includeMainLabels:!0,includeSourceLabels:!0,includeTargetLabels:!0,includeOverlays:!0,includeUnderlays:!0,includeOutlines:!0,useCache:!0},e$=ZM(od),t$=an(od);po.boundingBox=function(e){var t,n=e===void 0||e.useCache===void 0||e.useCache===!0,r=Wl(function(c){var f=c._private;return f.bbCache==null||f.styleDirty||f.bbCachePosKey!==QM(c)},function(c){return c.id()});if(n&&this.length===1&&!r(this[0]))e===void 0?e=od:e=t$(e),t=JM(this[0],e);else{t=Rr(),e=e||od;var i=t$(e),a=this,s=a.cy(),o=s.styleEnabled();this.edges().forEach(r),this.nodes().forEach(r),o&&this.recalculateRenderedStyle(n),this.updateCompoundBounds(!n);for(var u=0;u<a.length;u++){var l=a[u];r(l)&&l.dirtyBoundingBoxCache(),yu(t,JM(l,i))}}return t.x1=ci(t.x1),t.y1=ci(t.y1),t.x2=ci(t.x2),t.y2=ci(t.y2),t.w=ci(t.x2-t.x1),t.h=ci(t.y2-t.y1),t},po.dirtyBoundingBoxCache=function(){for(var e=0;e<this.length;e++){var t=this[e]._private;t.bbCache=null,t.bbCachePosKey=null,t.bodyBounds=null,t.overlayBounds=null,t.labelBounds.all=null,t.labelBounds.source=null,t.labelBounds.target=null,t.labelBounds.main=null,t.labelBounds.sourceRot=null,t.labelBounds.targetRot=null,t.labelBounds.mainRot=null,t.arrowBounds.source=null,t.arrowBounds.target=null,t.arrowBounds["mid-source"]=null,t.arrowBounds["mid-target"]=null}return this.emitAndNotify("bounds"),this},po.boundingBoxAt=function(e){var t=this.nodes(),n=this.cy(),r=n.hasCompoundNodes(),i=n.collection();if(r&&(i=t.filter(function(l){return l.isParent()}),t=t.not(i)),ut(e)){var a=e;e=function(){return a}}var s=function(c,f){return c._private.bbAtOldPos=e(c,f)},o=function(c){return c._private.bbAtOldPos};n.startBatch(),t.forEach(s).silentPositions(e),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0));var u=qV(this.boundingBox({useCache:!1}));return t.silentPositions(o),r&&(i.dirtyCompoundBoundsCache(),i.dirtyBoundingBoxCache(),i.updateCompoundBounds(!0)),n.endBatch(),u},ic.boundingbox=ic.bb=ic.boundingBox,ic.renderedBoundingbox=ic.renderedBoundingBox;var sj=po,ud,ld;ud=ld={};var n$=function(t){t.uppercaseName=TA(t.name),t.autoName="auto"+t.uppercaseName,t.labelName="label"+t.uppercaseName,t.outerName="outer"+t.uppercaseName,t.uppercaseOuterName=TA(t.outerName),ud[t.name]=function(){var r=this[0],i=r._private,a=i.cy,s=a._private.styleEnabled;if(r)if(s){if(r.isParent())return r.updateCompoundBounds(),i[t.autoName]||0;var o=r.pstyle(t.name);switch(o.strValue){case"label":return r.recalculateRenderedStyle(),i.rstyle[t.labelName]||0;default:return o.pfValue}}else return 1},ud["outer"+t.uppercaseName]=function(){var r=this[0],i=r._private,a=i.cy,s=a._private.styleEnabled;if(r)if(s){var o=r[t.name](),u=r.pstyle("border-width").pfValue,l=2*r.padding();return o+u+l}else return 1},ud["rendered"+t.uppercaseName]=function(){var r=this[0];if(r){var i=r[t.name]();return i*this.cy().zoom()}},ud["rendered"+t.uppercaseOuterName]=function(){var r=this[0];if(r){var i=r[t.outerName]();return i*this.cy().zoom()}}};n$({name:"width"}),n$({name:"height"}),ld.padding=function(){var e=this[0],t=e._private;return e.isParent()?(e.updateCompoundBounds(),t.autoPadding!==void 0?t.autoPadding:e.pstyle("padding").pfValue):e.pstyle("padding").pfValue},ld.paddedHeight=function(){var e=this[0];return e.height()+2*e.padding()},ld.paddedWidth=function(){var e=this[0];return e.width()+2*e.padding()};var oj=ld,uj=function(t,n){if(t.isEdge()&&t.takesUpSpace())return n(t)},lj=function(t,n){if(t.isEdge()&&t.takesUpSpace()){var r=t.cy();return sp(n(t),r.zoom(),r.pan())}},cj=function(t,n){if(t.isEdge()&&t.takesUpSpace()){var r=t.cy(),i=r.pan(),a=r.zoom();return n(t).map(function(s){return sp(s,a,i)})}},fj=function(t){return t.renderer().getControlPoints(t)},dj=function(t){return t.renderer().getSegmentPoints(t)},hj=function(t){return t.renderer().getSourceEndpoint(t)},gj=function(t){return t.renderer().getTargetEndpoint(t)},pj=function(t){return t.renderer().getEdgeMidpoint(t)},r$={controlPoints:{get:fj,mult:!0},segmentPoints:{get:dj,mult:!0},sourceEndpoint:{get:hj},targetEndpoint:{get:gj},midpoint:{get:pj}},vj=function(t){return"rendered"+t[0].toUpperCase()+t.substr(1)},mj=Object.keys(r$).reduce(function(e,t){var n=r$[t],r=vj(t);return e[t]=function(){return uj(this,n.get)},n.mult?e[r]=function(){return cj(this,n.get)}:e[r]=function(){return lj(this,n.get)},e},{}),yj=Ie({},rj,sj,oj,mj);/*!
  Event object based on jQuery events, MIT license

  https://jquery.org/license/
  https://tldrlegal.com/license/mit-license
  https://github.com/jquery/jquery/blob/master/src/event.js
  */var i$=function(t,n){this.recycle(t,n)};function cd(){return!1}function Sp(){return!0}i$.prototype={instanceString:function(){return"event"},recycle:function(t,n){if(this.isImmediatePropagationStopped=this.isPropagationStopped=this.isDefaultPrevented=cd,t!=null&&t.preventDefault?(this.type=t.type,this.isDefaultPrevented=t.defaultPrevented?Sp:cd):t!=null&&t.type?n=t:this.type=t,n!=null&&(this.originalEvent=n.originalEvent,this.type=n.type!=null?n.type:this.type,this.cy=n.cy,this.target=n.target,this.position=n.position,this.renderedPosition=n.renderedPosition,this.namespace=n.namespace,this.layout=n.layout),this.cy!=null&&this.position!=null&&this.renderedPosition==null){var r=this.position,i=this.cy.zoom(),a=this.cy.pan();this.renderedPosition={x:r.x*i+a.x,y:r.y*i+a.y}}this.timeStamp=t&&t.timeStamp||Date.now()},preventDefault:function(){this.isDefaultPrevented=Sp;var t=this.originalEvent;t&&t.preventDefault&&t.preventDefault()},stopPropagation:function(){this.isPropagationStopped=Sp;var t=this.originalEvent;t&&t.stopPropagation&&t.stopPropagation()},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Sp,this.stopPropagation()},isDefaultPrevented:cd,isPropagationStopped:cd,isImmediatePropagationStopped:cd};var a$=/^([^.]+)(\.(?:[^.]+))?$/,bj=".*",s$={qualifierCompare:function(t,n){return t===n},eventMatches:function(){return!0},addEventFields:function(){},callbackContext:function(t){return t},beforeEmit:function(){},afterEmit:function(){},bubble:function(){return!1},parent:function(){return null},context:null},o$=Object.keys(s$),wj={};function Cp(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:wj,t=arguments.length>1?arguments[1]:void 0,n=0;n<o$.length;n++){var r=o$[n];this[r]=e[r]||s$[r]}this.context=t||this.context,this.listeners=[],this.emitting=0}var vo=Cp.prototype,u$=function(t,n,r,i,a,s,o){Lt(i)&&(a=i,i=null),o&&(s==null?s=o:s=Ie({},s,o));for(var u=kt(r)?r:r.split(/\s+/),l=0;l<u.length;l++){var c=u[l];if(!ao(c)){var f=c.match(a$);if(f){var d=f[1],h=f[2]?f[2]:null,g=n(t,c,d,h,i,a,s);if(g===!1)break}}}},l$=function(t,n){return t.addEventFields(t.context,n),new i$(n.type,n)},xj=function(t,n,r){if(DU(r)){n(t,r);return}else if(ut(r)){n(t,l$(t,r));return}for(var i=kt(r)?r:r.split(/\s+/),a=0;a<i.length;a++){var s=i[a];if(!ao(s)){var o=s.match(a$);if(o){var u=o[1],l=o[2]?o[2]:null,c=l$(t,{type:u,namespace:l,target:t.context});n(t,c)}}}};vo.on=vo.addListener=function(e,t,n,r,i){return u$(this,function(a,s,o,u,l,c,f){Lt(c)&&a.listeners.push({event:s,callback:c,type:o,namespace:u,qualifier:l,conf:f})},e,t,n,r,i),this},vo.one=function(e,t,n,r){return this.on(e,t,n,r,{one:!0})},vo.removeListener=vo.off=function(e,t,n,r){var i=this;this.emitting!==0&&(this.listeners=fV(this.listeners));for(var a=this.listeners,s=function(l){var c=a[l];u$(i,function(f,d,h,g,p,v){if((c.type===h||e==="*")&&(!g&&c.namespace!==".*"||c.namespace===g)&&(!p||f.qualifierCompare(c.qualifier,p))&&(!v||c.callback===v))return a.splice(l,1),!1},e,t,n,r)},o=a.length-1;o>=0;o--)s(o);return this},vo.removeAllListeners=function(){return this.removeListener("*")},vo.emit=vo.trigger=function(e,t,n){var r=this.listeners,i=r.length;return this.emitting++,kt(t)||(t=[t]),xj(this,function(a,s){n!=null&&(r=[{event:s.event,type:s.type,namespace:s.namespace,callback:n}],i=r.length);for(var o=function(){var c=r[u];if(c.type===s.type&&(!c.namespace||c.namespace===s.namespace||c.namespace===bj)&&a.eventMatches(a.context,c,s)){var f=[s];t!=null&&hV(f,t),a.beforeEmit(a.context,c,s),c.conf&&c.conf.one&&(a.listeners=a.listeners.filter(function(g){return g!==c}));var d=a.callbackContext(a.context,c,s),h=c.callback.apply(d,f);a.afterEmit(a.context,c,s),h===!1&&(s.stopPropagation(),s.preventDefault())}},u=0;u<i;u++)o();a.bubble(a.context)&&!s.isPropagationStopped()&&a.parent(a.context).emit(s,t)},e),this.emitting--,this};var Ej={qualifierCompare:function(t,n){return t==null||n==null?t==null&&n==null:t.sameText(n)},eventMatches:function(t,n,r){var i=n.qualifier;return i!=null?t!==r.target&&Hf(r.target)&&i.matches(r.target):!0},addEventFields:function(t,n){n.cy=t.cy(),n.target=t},callbackContext:function(t,n,r){return n.qualifier!=null?r.target:t},beforeEmit:function(t,n){n.conf&&n.conf.once&&n.conf.onceCollection.removeListener(n.event,n.qualifier,n.callback)},bubble:function(){return!0},parent:function(t){return t.isChild()?t.parent():t.cy()}},kp=function(t){return Me(t)?new fo(t):t},c$={createEmitter:function(){for(var t=0;t<this.length;t++){var n=this[t],r=n._private;r.emitter||(r.emitter=new Cp(Ej,n))}return this},emitter:function(){return this._private.emitter},on:function(t,n,r){for(var i=kp(n),a=0;a<this.length;a++){var s=this[a];s.emitter().on(t,i,r)}return this},removeListener:function(t,n,r){for(var i=kp(n),a=0;a<this.length;a++){var s=this[a];s.emitter().removeListener(t,i,r)}return this},removeAllListeners:function(){for(var t=0;t<this.length;t++){var n=this[t];n.emitter().removeAllListeners()}return this},one:function(t,n,r){for(var i=kp(n),a=0;a<this.length;a++){var s=this[a];s.emitter().one(t,i,r)}return this},once:function(t,n,r){for(var i=kp(n),a=0;a<this.length;a++){var s=this[a];s.emitter().on(t,i,r,{once:!0,onceCollection:this})}},emit:function(t,n){for(var r=0;r<this.length;r++){var i=this[r];i.emitter().emit(t,n)}return this},emitAndNotify:function(t,n){if(this.length!==0)return this.cy().notify(t,this),this.emit(t,n),this}};pt.eventAliasesOn(c$);var f$={nodes:function(t){return this.filter(function(n){return n.isNode()}).filter(t)},edges:function(t){return this.filter(function(n){return n.isEdge()}).filter(t)},byGroup:function(){for(var t=this.spawn(),n=this.spawn(),r=0;r<this.length;r++){var i=this[r];i.isNode()?t.push(i):n.push(i)}return{nodes:t,edges:n}},filter:function(t,n){if(t===void 0)return this;if(Me(t)||Yr(t))return new fo(t).filter(this);if(Lt(t)){for(var r=this.spawn(),i=this,a=0;a<i.length;a++){var s=i[a],o=n?t.apply(n,[s,a,i]):t(s,a,i);o&&r.push(s)}return r}return this.spawn()},not:function(t){if(t){Me(t)&&(t=this.filter(t));for(var n=this.spawn(),r=0;r<this.length;r++){var i=this[r],a=t.has(i);a||n.push(i)}return n}else return this},absoluteComplement:function(){var t=this.cy();return t.mutableElements().not(this)},intersect:function(t){if(Me(t)){var n=t;return this.filter(n)}for(var r=this.spawn(),i=this,a=t,s=this.length<t.length,o=s?i:a,u=s?a:i,l=0;l<o.length;l++){var c=o[l];u.has(c)&&r.push(c)}return r},xor:function(t){var n=this._private.cy;Me(t)&&(t=n.$(t));var r=this.spawn(),i=this,a=t,s=function(u,l){for(var c=0;c<u.length;c++){var f=u[c],d=f._private.data.id,h=l.hasElementWithId(d);h||r.push(f)}};return s(i,a),s(a,i),r},diff:function(t){var n=this._private.cy;Me(t)&&(t=n.$(t));var r=this.spawn(),i=this.spawn(),a=this.spawn(),s=this,o=t,u=function(c,f,d){for(var h=0;h<c.length;h++){var g=c[h],p=g._private.data.id,v=f.hasElementWithId(p);v?a.merge(g):d.push(g)}};return u(s,o,r),u(o,s,i),{left:r,right:i,both:a}},add:function(t){var n=this._private.cy;if(!t)return this;if(Me(t)){var r=t;t=n.mutableElements().filter(r)}for(var i=this.spawnSelf(),a=0;a<t.length;a++){var s=t[a],o=!this.has(s);o&&i.push(s)}return i},merge:function(t){var n=this._private,r=n.cy;if(!t)return this;if(t&&Me(t)){var i=t;t=r.mutableElements().filter(i)}for(var a=n.map,s=0;s<t.length;s++){var o=t[s],u=o._private.data.id,l=!a.has(u);if(l){var c=this.length++;this[c]=o,a.set(u,{ele:o,index:c})}}return this},unmergeAt:function(t){var n=this[t],r=n.id(),i=this._private,a=i.map;this[t]=void 0,a.delete(r);var s=t===this.length-1;if(this.length>1&&!s){var o=this.length-1,u=this[o],l=u._private.data.id;this[o]=void 0,this[t]=u,a.set(l,{ele:u,index:t})}return this.length--,this},unmergeOne:function(t){t=t[0];var n=this._private,r=t._private.data.id,i=n.map,a=i.get(r);if(!a)return this;var s=a.index;return this.unmergeAt(s),this},unmerge:function(t){var n=this._private.cy;if(!t)return this;if(t&&Me(t)){var r=t;t=n.mutableElements().filter(r)}for(var i=0;i<t.length;i++)this.unmergeOne(t[i]);return this},unmergeBy:function(t){for(var n=this.length-1;n>=0;n--){var r=this[n];t(r)&&this.unmergeAt(n)}return this},map:function(t,n){for(var r=[],i=this,a=0;a<i.length;a++){var s=i[a],o=n?t.apply(n,[s,a,i]):t(s,a,i);r.push(o)}return r},reduce:function(t,n){for(var r=n,i=this,a=0;a<i.length;a++)r=t(r,i[a],a,i);return r},max:function(t,n){for(var r=-1/0,i,a=this,s=0;s<a.length;s++){var o=a[s],u=n?t.apply(n,[o,s,a]):t(o,s,a);u>r&&(r=u,i=o)}return{value:r,ele:i}},min:function(t,n){for(var r=1/0,i,a=this,s=0;s<a.length;s++){var o=a[s],u=n?t.apply(n,[o,s,a]):t(o,s,a);u<r&&(r=u,i=o)}return{value:r,ele:i}}},ct=f$;ct.u=ct["|"]=ct["+"]=ct.union=ct.or=ct.add,ct["\\"]=ct["!"]=ct["-"]=ct.difference=ct.relativeComplement=ct.subtract=ct.not,ct.n=ct["&"]=ct["."]=ct.and=ct.intersection=ct.intersect,ct["^"]=ct["(+)"]=ct["(-)"]=ct.symmetricDifference=ct.symdiff=ct.xor,ct.fnFilter=ct.filterFn=ct.stdFilter=ct.filter,ct.complement=ct.abscomp=ct.absoluteComplement;var Fj={isNode:function(){return this.group()==="nodes"},isEdge:function(){return this.group()==="edges"},isLoop:function(){return this.isEdge()&&this.source()[0]===this.target()[0]},isSimple:function(){return this.isEdge()&&this.source()[0]!==this.target()[0]},group:function(){var t=this[0];if(t)return t._private.group}},d$=function(t,n){var r=t.cy(),i=r.hasCompoundNodes();function a(c){var f=c.pstyle("z-compound-depth");return f.value==="auto"?i?c.zDepth():0:f.value==="bottom"?-1:f.value==="top"?ab:0}var s=a(t)-a(n);if(s!==0)return s;function o(c){var f=c.pstyle("z-index-compare");return f.value==="auto"&&c.isNode()?1:0}var u=o(t)-o(n);if(u!==0)return u;var l=t.pstyle("z-index").value-n.pstyle("z-index").value;return l!==0?l:t.poolIndex()-n.poolIndex()},_p={forEach:function(t,n){if(Lt(t))for(var r=this.length,i=0;i<r;i++){var a=this[i],s=n?t.apply(n,[a,i,this]):t(a,i,this);if(s===!1)break}return this},toArray:function(){for(var t=[],n=0;n<this.length;n++)t.push(this[n]);return t},slice:function(t,n){var r=[],i=this.length;n==null&&(n=i),t==null&&(t=0),t<0&&(t=i+t),n<0&&(n=i+n);for(var a=t;a>=0&&a<n&&a<i;a++)r.push(this[a]);return this.spawn(r)},size:function(){return this.length},eq:function(t){return this[t]||this.spawn()},first:function(){return this[0]||this.spawn()},last:function(){return this[this.length-1]||this.spawn()},empty:function(){return this.length===0},nonempty:function(){return!this.empty()},sort:function(t){if(!Lt(t))return this;var n=this.toArray().sort(t);return this.spawn(n)},sortByZIndex:function(){return this.sort(d$)},zDepth:function(){var t=this[0];if(t){var n=t._private,r=n.group;if(r==="nodes"){var i=n.data.parent?t.parents().size():0;return t.isParent()?i:ab-1}else{var a=n.source,s=n.target,o=a.zDepth(),u=s.zDepth();return Math.max(o,u,0)}}}};_p.each=_p.forEach;var Sj=function(){var t="undefined",n=(typeof Symbol>"u"?"undefined":tn(Symbol))!=t&&tn(Symbol.iterator)!=t;n&&(_p[Symbol.iterator]=function(){var r=this,i={value:void 0,done:!1},a=0,s=this.length;return xA({next:function(){return a<s?i.value=r[a++]:(i.value=void 0,i.done=!0),i}},Symbol.iterator,function(){return this})})};Sj();var Cj=an({nodeDimensionsIncludeLabels:!1}),Ap={layoutDimensions:function(t){t=Cj(t);var n;if(!this.takesUpSpace())n={w:0,h:0};else if(t.nodeDimensionsIncludeLabels){var r=this.boundingBox();n={w:r.w,h:r.h}}else n={w:this.outerWidth(),h:this.outerHeight()};return(n.w===0||n.h===0)&&(n.w=n.h=1),n},layoutPositions:function(t,n,r){var i=this.nodes().filter(function(E){return!E.isParent()}),a=this.cy(),s=n.eles,o=function(F){return F.id()},u=Wl(r,o);t.emit({type:"layoutstart",layout:t}),t.animations=[];var l=function(F,x,C){var S={x:x.x1+x.w/2,y:x.y1+x.h/2},_={x:(C.x-S.x)*F,y:(C.y-S.y)*F};return{x:S.x+_.x,y:S.y+_.y}},c=n.spacingFactor&&n.spacingFactor!==1,f=function(){if(!c)return null;for(var F=Rr(),x=0;x<i.length;x++){var C=i[x],S=u(C,x);WV(F,S.x,S.y)}return F},d=f(),h=Wl(function(E,F){var x=u(E,F);if(c){var C=Math.abs(n.spacingFactor);x=l(C,d,x)}return n.transform!=null&&(x=n.transform(E,x)),x},o);if(n.animate){for(var g=0;g<i.length;g++){var p=i[g],v=h(p,g),m=n.animateFilter==null||n.animateFilter(p,g);if(m){var y=p.animation({position:v,duration:n.animationDuration,easing:n.animationEasing});t.animations.push(y)}else p.position(v)}if(n.fit){var b=a.animation({fit:{boundingBox:s.boundingBoxAt(h),padding:n.padding},duration:n.animationDuration,easing:n.animationEasing});t.animations.push(b)}else if(n.zoom!==void 0&&n.pan!==void 0){var w=a.animation({zoom:n.zoom,pan:n.pan,duration:n.animationDuration,easing:n.animationEasing});t.animations.push(w)}t.animations.forEach(function(E){return E.play()}),t.one("layoutready",n.ready),t.emit({type:"layoutready",layout:t}),ec.all(t.animations.map(function(E){return E.promise()})).then(function(){t.one("layoutstop",n.stop),t.emit({type:"layoutstop",layout:t})})}else i.positions(h),n.fit&&a.fit(n.eles,n.padding),n.zoom!=null&&a.zoom(n.zoom),n.pan&&a.pan(n.pan),t.one("layoutready",n.ready),t.emit({type:"layoutready",layout:t}),t.one("layoutstop",n.stop),t.emit({type:"layoutstop",layout:t});return this},layout:function(t){var n=this.cy();return n.makeLayout(Ie({},t,{eles:this}))}};Ap.createLayout=Ap.makeLayout=Ap.layout;function h$(e,t,n){var r=n._private,i=r.styleCache=r.styleCache||[],a;return(a=i[e])!=null||(a=i[e]=t(n)),a}function Tp(e,t){return e=oo(e),function(r){return h$(e,t,r)}}function Mp(e,t){e=oo(e);var n=function(i){return t.call(i)};return function(){var i=this[0];if(i)return h$(e,n,i)}}var Nn={recalculateRenderedStyle:function(t){var n=this.cy(),r=n.renderer(),i=n.styleEnabled();return r&&i&&r.recalculateRenderedStyle(this,t),this},dirtyStyleCache:function(){var t=this.cy(),n=function(a){return a._private.styleCache=null};if(t.hasCompoundNodes()){var r;r=this.spawnSelf().merge(this.descendants()).merge(this.parents()),r.merge(r.connectedEdges()),r.forEach(n)}else this.forEach(function(i){n(i),i.connectedEdges().forEach(n)});return this},updateStyle:function(t){var n=this._private.cy;if(!n.styleEnabled())return this;if(n.batching()){var r=n._private.batchStyleEles;return r.merge(this),this}var i=n.hasCompoundNodes(),a=this;t=!!(t||t===void 0),i&&(a=this.spawnSelf().merge(this.descendants()).merge(this.parents()));var s=a;return t?s.emitAndNotify("style"):s.emit("style"),a.forEach(function(o){return o._private.styleDirty=!0}),this},cleanStyle:function(){var t=this.cy();if(t.styleEnabled())for(var n=0;n<this.length;n++){var r=this[n];r._private.styleDirty&&(r._private.styleDirty=!1,t.style().apply(r))}},parsedStyle:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,r=this[0],i=r.cy();if(i.styleEnabled()&&r){r._private.styleDirty&&(r._private.styleDirty=!1,i.style().apply(r));var a=r._private.style[t];return a??(n?i.style().getDefaultProperty(t):null)}},numericStyle:function(t){var n=this[0];if(n.cy().styleEnabled()&&n){var r=n.pstyle(t);return r.pfValue!==void 0?r.pfValue:r.value}},numericStyleUnits:function(t){var n=this[0];if(n.cy().styleEnabled()&&n)return n.pstyle(t).units},renderedStyle:function(t){var n=this.cy();if(!n.styleEnabled())return this;var r=this[0];if(r)return n.style().getRenderedStyle(r,t)},style:function(t,n){var r=this.cy();if(!r.styleEnabled())return this;var i=!1,a=r.style();if(ut(t)){var s=t;a.applyBypass(this,s,i),this.emitAndNotify("style")}else if(Me(t))if(n===void 0){var o=this[0];return o?a.getStylePropertyValue(o,t):void 0}else a.applyBypass(this,t,n,i),this.emitAndNotify("style");else if(t===void 0){var u=this[0];return u?a.getRawStyle(u):void 0}return this},removeStyle:function(t){var n=this.cy();if(!n.styleEnabled())return this;var r=!1,i=n.style(),a=this;if(t===void 0)for(var s=0;s<a.length;s++){var o=a[s];i.removeAllBypasses(o,r)}else{t=t.split(/\s+/);for(var u=0;u<a.length;u++){var l=a[u];i.removeBypasses(l,t,r)}}return this.emitAndNotify("style"),this},show:function(){return this.css("display","element"),this},hide:function(){return this.css("display","none"),this},effectiveOpacity:function(){var t=this.cy();if(!t.styleEnabled())return 1;var n=t.hasCompoundNodes(),r=this[0];if(r){var i=r._private,a=r.pstyle("opacity").value;if(!n)return a;var s=i.data.parent?r.parents():null;if(s)for(var o=0;o<s.length;o++){var u=s[o],l=u.pstyle("opacity").value;a=l*a}return a}},transparent:function(){var t=this.cy();if(!t.styleEnabled())return!1;var n=this[0],r=n.cy().hasCompoundNodes();if(n)return r?n.effectiveOpacity()===0:n.pstyle("opacity").value===0},backgrounding:function(){var t=this.cy();if(!t.styleEnabled())return!1;var n=this[0];return!!n._private.backgrounding}};function _2(e,t){var n=e._private,r=n.data.parent?e.parents():null;if(r)for(var i=0;i<r.length;i++){var a=r[i];if(!t(a))return!1}return!0}function A2(e){var t=e.ok,n=e.edgeOkViaNode||e.ok,r=e.parentOk||e.ok;return function(){var i=this.cy();if(!i.styleEnabled())return!0;var a=this[0],s=i.hasCompoundNodes();if(a){var o=a._private;if(!t(a))return!1;if(a.isNode())return!s||_2(a,r);var u=o.source,l=o.target;return n(u)&&(!s||_2(u,n))&&(u===l||n(l)&&(!s||_2(l,n)))}}}var ac=Tp("eleTakesUpSpace",function(e){return e.pstyle("display").value==="element"&&e.width()!==0&&(e.isNode()?e.height()!==0:!0)});Nn.takesUpSpace=Mp("takesUpSpace",A2({ok:ac}));var kj=Tp("eleInteractive",function(e){return e.pstyle("events").value==="yes"&&e.pstyle("visibility").value==="visible"&&ac(e)}),_j=Tp("parentInteractive",function(e){return e.pstyle("visibility").value==="visible"&&ac(e)});Nn.interactive=Mp("interactive",A2({ok:kj,parentOk:_j,edgeOkViaNode:ac})),Nn.noninteractive=function(){var e=this[0];if(e)return!e.interactive()};var Aj=Tp("eleVisible",function(e){return e.pstyle("visibility").value==="visible"&&e.pstyle("opacity").pfValue!==0&&ac(e)}),Tj=ac;Nn.visible=Mp("visible",A2({ok:Aj,edgeOkViaNode:Tj})),Nn.hidden=function(){var e=this[0];if(e)return!e.visible()},Nn.isBundledBezier=Mp("isBundledBezier",function(){return this.cy().styleEnabled()?!this.removed()&&this.pstyle("curve-style").value==="bezier"&&this.takesUpSpace():!1}),Nn.bypass=Nn.css=Nn.style,Nn.renderedCss=Nn.renderedStyle,Nn.removeBypass=Nn.removeCss=Nn.removeStyle,Nn.pstyle=Nn.parsedStyle;var mo={};function g$(e){return function(){var t=arguments,n=[];if(t.length===2){var r=t[0],i=t[1];this.on(e.event,r,i)}else if(t.length===1&&Lt(t[0])){var a=t[0];this.on(e.event,a)}else if(t.length===0||t.length===1&&kt(t[0])){for(var s=t.length===1?t[0]:null,o=0;o<this.length;o++){var u=this[o],l=!e.ableField||u._private[e.ableField],c=u._private[e.field]!=e.value;if(e.overrideAble){var f=e.overrideAble(u);if(f!==void 0&&(l=f,!f))return this}l&&(u._private[e.field]=e.value,c&&n.push(u))}var d=this.spawn(n);d.updateStyle(),d.emit(e.event),s&&d.emit(s)}return this}}function sc(e){mo[e.field]=function(){var t=this[0];if(t){if(e.overrideField){var n=e.overrideField(t);if(n!==void 0)return n}return t._private[e.field]}},mo[e.on]=g$({event:e.on,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!0}),mo[e.off]=g$({event:e.off,field:e.field,ableField:e.ableField,overrideAble:e.overrideAble,value:!1})}sc({field:"locked",overrideField:function(t){return t.cy().autolock()?!0:void 0},on:"lock",off:"unlock"}),sc({field:"grabbable",overrideField:function(t){return t.cy().autoungrabify()||t.pannable()?!1:void 0},on:"grabify",off:"ungrabify"}),sc({field:"selected",ableField:"selectable",overrideAble:function(t){return t.cy().autounselectify()?!1:void 0},on:"select",off:"unselect"}),sc({field:"selectable",overrideField:function(t){return t.cy().autounselectify()?!1:void 0},on:"selectify",off:"unselectify"}),mo.deselect=mo.unselect,mo.grabbed=function(){var e=this[0];if(e)return e._private.grabbed},sc({field:"active",on:"activate",off:"unactivate"}),sc({field:"pannable",on:"panify",off:"unpanify"}),mo.inactive=function(){var e=this[0];if(e)return!e._private.active};var Gn={},p$=function(t){return function(r){for(var i=this,a=[],s=0;s<i.length;s++){var o=i[s];if(o.isNode()){for(var u=!1,l=o.connectedEdges(),c=0;c<l.length;c++){var f=l[c],d=f.source(),h=f.target();if(t.noIncomingEdges&&h===o&&d!==o||t.noOutgoingEdges&&d===o&&h!==o){u=!0;break}}u||a.push(o)}}return this.spawn(a,!0).filter(r)}},v$=function(t){return function(n){for(var r=this,i=[],a=0;a<r.length;a++){var s=r[a];if(s.isNode())for(var o=s.connectedEdges(),u=0;u<o.length;u++){var l=o[u],c=l.source(),f=l.target();t.outgoing&&c===s?(i.push(l),i.push(f)):t.incoming&&f===s&&(i.push(l),i.push(c))}}return this.spawn(i,!0).filter(n)}},m$=function(t){return function(n){for(var r=this,i=[],a={};;){var s=t.outgoing?r.outgoers():r.incomers();if(s.length===0)break;for(var o=!1,u=0;u<s.length;u++){var l=s[u],c=l.id();a[c]||(a[c]=!0,i.push(l),o=!0)}if(!o)break;r=s}return this.spawn(i,!0).filter(n)}};Gn.clearTraversalCache=function(){for(var e=0;e<this.length;e++)this[e]._private.traversalCache=null},Ie(Gn,{roots:p$({noIncomingEdges:!0}),leaves:p$({noOutgoingEdges:!0}),outgoers:li(v$({outgoing:!0}),"outgoers"),successors:m$({outgoing:!0}),incomers:li(v$({incoming:!0}),"incomers"),predecessors:m$({})}),Ie(Gn,{neighborhood:li(function(e){for(var t=[],n=this.nodes(),r=0;r<n.length;r++)for(var i=n[r],a=i.connectedEdges(),s=0;s<a.length;s++){var o=a[s],u=o.source(),l=o.target(),c=i===u?l:u;c.length>0&&t.push(c[0]),t.push(o[0])}return this.spawn(t,!0).filter(e)},"neighborhood"),closedNeighborhood:function(t){return this.neighborhood().add(this).filter(t)},openNeighborhood:function(t){return this.neighborhood(t)}}),Gn.neighbourhood=Gn.neighborhood,Gn.closedNeighbourhood=Gn.closedNeighborhood,Gn.openNeighbourhood=Gn.openNeighborhood,Ie(Gn,{source:li(function(t){var n=this[0],r;return n&&(r=n._private.source||n.cy().collection()),r&&t?r.filter(t):r},"source"),target:li(function(t){var n=this[0],r;return n&&(r=n._private.target||n.cy().collection()),r&&t?r.filter(t):r},"target"),sources:y$({attr:"source"}),targets:y$({attr:"target"})});function y$(e){return function(n){for(var r=[],i=0;i<this.length;i++){var a=this[i],s=a._private[e.attr];s&&r.push(s)}return this.spawn(r,!0).filter(n)}}Ie(Gn,{edgesWith:li(b$(),"edgesWith"),edgesTo:li(b$({thisIsSrc:!0}),"edgesTo")});function b$(e){return function(n){var r=[],i=this._private.cy,a=e||{};Me(n)&&(n=i.$(n));for(var s=0;s<n.length;s++)for(var o=n[s]._private.edges,u=0;u<o.length;u++){var l=o[u],c=l._private.data,f=this.hasElementWithId(c.source)&&n.hasElementWithId(c.target),d=n.hasElementWithId(c.source)&&this.hasElementWithId(c.target),h=f||d;h&&((a.thisIsSrc||a.thisIsTgt)&&(a.thisIsSrc&&!f||a.thisIsTgt&&!d)||r.push(l))}return this.spawn(r,!0)}}Ie(Gn,{connectedEdges:li(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];if(i.isNode())for(var a=i._private.edges,s=0;s<a.length;s++){var o=a[s];t.push(o)}}return this.spawn(t,!0).filter(e)},"connectedEdges"),connectedNodes:li(function(e){for(var t=[],n=this,r=0;r<n.length;r++){var i=n[r];i.isEdge()&&(t.push(i.source()[0]),t.push(i.target()[0]))}return this.spawn(t,!0).filter(e)},"connectedNodes"),parallelEdges:li(w$(),"parallelEdges"),codirectedEdges:li(w$({codirected:!0}),"codirectedEdges")});function w$(e){var t={codirected:!1};return e=Ie({},t,e),function(r){for(var i=[],a=this.edges(),s=e,o=0;o<a.length;o++)for(var u=a[o],l=u._private,c=l.source,f=c._private.data.id,d=l.data.target,h=c._private.edges,g=0;g<h.length;g++){var p=h[g],v=p._private.data,m=v.target,y=v.source,b=m===d&&y===f,w=f===m&&d===y;(s.codirected&&b||!s.codirected&&(b||w))&&i.push(p)}return this.spawn(i,!0).filter(r)}}Ie(Gn,{components:function(t){var n=this,r=n.cy(),i=r.collection(),a=t==null?n.nodes():t.nodes(),s=[];t!=null&&a.empty()&&(a=t.sources());var o=function(c,f){i.merge(c),a.unmerge(c),f.merge(c)};if(a.empty())return n.spawn();var u=function(){var c=r.collection();s.push(c);var f=a[0];o(f,c),n.bfs({directed:!1,roots:f,visit:function(h){return o(h,c)}}),c.forEach(function(d){d.connectedEdges().forEach(function(h){n.has(h)&&c.has(h.source())&&c.has(h.target())&&c.merge(h)})})};do u();while(a.length>0);return s},component:function(){var t=this[0];return t.cy().mutableElements().components(t)[0]}}),Gn.componentsOf=Gn.components;var On=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(t===void 0){zt("A collection must have a reference to the core");return}var a=new us,s=!1;if(!n)n=[];else if(n.length>0&&ut(n[0])&&!Hf(n[0])){s=!0;for(var o=[],u=new jl,l=0,c=n.length;l<c;l++){var f=n[l];f.data==null&&(f.data={});var d=f.data;if(d.id==null)d.id=iT();else if(t.hasElementWithId(d.id)||u.has(d.id))continue;var h=new ip(t,f,!1);o.push(h),u.add(d.id)}n=o}this.length=0;for(var g=0,p=n.length;g<p;g++){var v=n[g][0];if(v!=null){var m=v._private.data.id;(!r||!a.has(m))&&(r&&a.set(m,{index:this.length,ele:v}),this[this.length]=v,this.length++)}}this._private={eles:this,cy:t,get map(){return this.lazyMap==null&&this.rebuildMap(),this.lazyMap},set map(y){this.lazyMap=y},rebuildMap:function(){for(var b=this.lazyMap=new us,w=this.eles,E=0;E<w.length;E++){var F=w[E];b.set(F.id(),{index:E,ele:F})}}},r&&(this._private.map=a),s&&!i&&this.restore()},_t=ip.prototype=On.prototype=Object.create(Array.prototype);_t.instanceString=function(){return"collection"},_t.spawn=function(e,t){return new On(this.cy(),e,t)},_t.spawnSelf=function(){return this.spawn(this)},_t.cy=function(){return this._private.cy},_t.renderer=function(){return this._private.cy.renderer()},_t.element=function(){return this[0]},_t.collection=function(){return kA(this)?this:new On(this._private.cy,[this])},_t.unique=function(){return new On(this._private.cy,this,!0)},_t.hasElementWithId=function(e){return e=""+e,this._private.map.has(e)},_t.getElementById=function(e){e=""+e;var t=this._private.cy,n=this._private.map.get(e);return n?n.ele:new On(t)},_t.$id=_t.getElementById,_t.poolIndex=function(){var e=this._private.cy,t=e._private.elements,n=this[0]._private.data.id;return t._private.map.get(n).index},_t.indexOf=function(e){var t=e[0]._private.data.id;return this._private.map.get(t).index},_t.indexOfId=function(e){return e=""+e,this._private.map.get(e).index},_t.json=function(e){var t=this.element(),n=this.cy();if(t==null&&e)return this;if(t!=null){var r=t._private;if(ut(e)){if(n.startBatch(),e.data){t.data(e.data);var i=r.data;if(t.isEdge()){var a=!1,s={},o=e.data.source,u=e.data.target;o!=null&&o!=i.source&&(s.source=""+o,a=!0),u!=null&&u!=i.target&&(s.target=""+u,a=!0),a&&(t=t.move(s))}else{var l="parent"in e.data,c=e.data.parent;l&&(c!=null||i.parent!=null)&&c!=i.parent&&(c===void 0&&(c=null),c!=null&&(c=""+c),t=t.move({parent:c}))}}e.position&&t.position(e.position);var f=function(p,v,m){var y=e[p];y!=null&&y!==r[p]&&(y?t[v]():t[m]())};return f("removed","remove","restore"),f("selected","select","unselect"),f("selectable","selectify","unselectify"),f("locked","lock","unlock"),f("grabbable","grabify","ungrabify"),f("pannable","panify","unpanify"),e.classes!=null&&t.classes(e.classes),n.endBatch(),this}else if(e===void 0){var d={data:ga(r.data),position:ga(r.position),group:r.group,removed:r.removed,selected:r.selected,selectable:r.selectable,locked:r.locked,grabbable:r.grabbable,pannable:r.pannable,classes:null};d.classes="";var h=0;return r.classes.forEach(function(g){return d.classes+=h++===0?g:" "+g}),d}}},_t.jsons=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t],r=n.json();e.push(r)}return e},_t.clone=function(){for(var e=this.cy(),t=[],n=0;n<this.length;n++){var r=this[n],i=r.json(),a=new ip(e,i,!1);t.push(a)}return new On(e,t)},_t.copy=_t.clone,_t.restore=function(){for(var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=n.cy(),i=r._private,a=[],s=[],o,u=0,l=n.length;u<l;u++){var c=n[u];t&&!c.removed()||(c.isNode()?a.push(c):s.push(c))}o=a.concat(s);var f,d=function(){o.splice(f,1),f--};for(f=0;f<o.length;f++){var h=o[f],g=h._private,p=g.data;if(h.clearTraversalCache(),!(!t&&!g.removed)){if(p.id===void 0)p.id=iT();else if(ve(p.id))p.id=""+p.id;else if(ao(p.id)||!Me(p.id)){zt("Can not create element with invalid string ID `"+p.id+"`"),d();continue}else if(r.hasElementWithId(p.id)){zt("Can not create second element with ID `"+p.id+"`"),d();continue}}var v=p.id;if(h.isNode()){var m=g.position;m.x==null&&(m.x=0),m.y==null&&(m.y=0)}if(h.isEdge()){for(var y=h,b=["source","target"],w=b.length,E=!1,F=0;F<w;F++){var x=b[F],C=p[x];ve(C)&&(C=p[x]=""+p[x]),C==null||C===""?(zt("Can not create edge `"+v+"` with unspecified "+x),E=!0):r.hasElementWithId(C)||(zt("Can not create edge `"+v+"` with nonexistant "+x+" `"+C+"`"),E=!0)}if(E){d();continue}var S=r.getElementById(p.source),_=r.getElementById(p.target);S.same(_)?S._private.edges.push(y):(S._private.edges.push(y),_._private.edges.push(y)),y._private.source=S,y._private.target=_}g.map=new us,g.map.set(v,{ele:h,index:0}),g.removed=!1,t&&r.addToPool(h)}for(var k=0;k<a.length;k++){var T=a[k],A=T._private.data;ve(A.parent)&&(A.parent=""+A.parent);var $=A.parent,M=$!=null;if(M||T._private.parent){var D=T._private.parent?r.collection().merge(T._private.parent):r.getElementById($);if(D.empty())A.parent=void 0;else if(D[0].removed())gt("Node added with missing parent, reference to parent removed"),A.parent=void 0,T._private.parent=null;else{for(var P=!1,N=D;!N.empty();){if(T.same(N)){P=!0,A.parent=void 0;break}N=N.parent()}P||(D[0]._private.children.push(T),T._private.parent=D[0],i.hasCompoundNodes=!0)}}}if(o.length>0){for(var O=o.length===n.length?n:new On(r,o),q=0;q<O.length;q++){var z=O[q];z.isNode()||(z.parallelEdges().clearTraversalCache(),z.source().clearTraversalCache(),z.target().clearTraversalCache())}var W;i.hasCompoundNodes?W=r.collection().merge(O).merge(O.connectedNodes()).merge(O.parent()):W=O,W.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(e),e?O.emitAndNotify("add"):t&&O.emit("add")}return n},_t.removed=function(){var e=this[0];return e&&e._private.removed},_t.inside=function(){var e=this[0];return e&&!e._private.removed},_t.remove=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,n=this,r=[],i={},a=n._private.cy;function s($){for(var M=$._private.edges,D=0;D<M.length;D++)u(M[D])}function o($){for(var M=$._private.children,D=0;D<M.length;D++)u(M[D])}function u($){var M=i[$.id()];t&&$.removed()||M||(i[$.id()]=!0,$.isNode()?(r.push($),s($),o($)):r.unshift($))}for(var l=0,c=n.length;l<c;l++){var f=n[l];u(f)}function d($,M){var D=$._private.edges;uo(D,M),$.clearTraversalCache()}function h($){$.clearTraversalCache()}var g=[];g.ids={};function p($,M){M=M[0],$=$[0];var D=$._private.children,P=$.id();uo(D,M),M._private.parent=null,g.ids[P]||(g.ids[P]=!0,g.push($))}n.dirtyCompoundBoundsCache(),t&&a.removeFromPool(r);for(var v=0;v<r.length;v++){var m=r[v];if(m.isEdge()){var y=m.source()[0],b=m.target()[0];d(y,m),d(b,m);for(var w=m.parallelEdges(),E=0;E<w.length;E++){var F=w[E];h(F),F.isBundledBezier()&&F.dirtyBoundingBoxCache()}}else{var x=m.parent();x.length!==0&&p(x,m)}t&&(m._private.removed=!0)}var C=a._private.elements;a._private.hasCompoundNodes=!1;for(var S=0;S<C.length;S++){var _=C[S];if(_.isParent()){a._private.hasCompoundNodes=!0;break}}var k=new On(this.cy(),r);k.size()>0&&(e?k.emitAndNotify("remove"):t&&k.emit("remove"));for(var T=0;T<g.length;T++){var A=g[T];(!t||!A.removed())&&A.updateStyle()}return k},_t.move=function(e){var t=this._private.cy,n=this,r=!1,i=!1,a=function(g){return g==null?g:""+g};if(e.source!==void 0||e.target!==void 0){var s=a(e.source),o=a(e.target),u=s!=null&&t.hasElementWithId(s),l=o!=null&&t.hasElementWithId(o);(u||l)&&(t.batch(function(){n.remove(r,i),n.emitAndNotify("moveout");for(var h=0;h<n.length;h++){var g=n[h],p=g._private.data;g.isEdge()&&(u&&(p.source=s),l&&(p.target=o))}n.restore(r,i)}),n.emitAndNotify("move"))}else if(e.parent!==void 0){var c=a(e.parent),f=c===null||t.hasElementWithId(c);if(f){var d=c===null?void 0:c;t.batch(function(){var h=n.remove(r,i);h.emitAndNotify("moveout");for(var g=0;g<n.length;g++){var p=n[g],v=p._private.data;p.isNode()&&(v.parent=d)}h.restore(r,i)}),n.emitAndNotify("move")}}return this},[RT,zH,xp,go,nc,nj,Ep,yj,c$,f$,Fj,_p,Ap,Nn,mo,Gn].forEach(function(e){Ie(_t,e)});var Mj={add:function(t){var n,r=this;if(Yr(t)){var i=t;if(i._private.cy===r)n=i.restore();else{for(var a=[],s=0;s<i.length;s++){var o=i[s];a.push(o.json())}n=new On(r,a)}}else if(kt(t)){var u=t;n=new On(r,u)}else if(ut(t)&&(kt(t.nodes)||kt(t.edges))){for(var l=t,c=[],f=["nodes","edges"],d=0,h=f.length;d<h;d++){var g=f[d],p=l[g];if(kt(p))for(var v=0,m=p.length;v<m;v++){var y=Ie({group:g},p[v]);c.push(y)}}n=new On(r,c)}else{var b=t;n=new ip(r,b).collection()}return n},remove:function(t){if(!Yr(t)){if(Me(t)){var n=t;t=this.$(n)}}return t.remove()}};/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */function $j(e,t,n,r){var i=4,a=.001,s=1e-7,o=10,u=11,l=1/(u-1),c=typeof Float32Array<"u";if(arguments.length!==4)return!1;for(var f=0;f<4;++f)if(typeof arguments[f]!="number"||isNaN(arguments[f])||!isFinite(arguments[f]))return!1;e=Math.min(e,1),n=Math.min(n,1),e=Math.max(e,0),n=Math.max(n,0);var d=c?new Float32Array(u):new Array(u);function h(_,k){return 1-3*k+3*_}function g(_,k){return 3*k-6*_}function p(_){return 3*_}function v(_,k,T){return((h(k,T)*_+g(k,T))*_+p(k))*_}function m(_,k,T){return 3*h(k,T)*_*_+2*g(k,T)*_+p(k)}function y(_,k){for(var T=0;T<i;++T){var A=m(k,e,n);if(A===0)return k;var $=v(k,e,n)-_;k-=$/A}return k}function b(){for(var _=0;_<u;++_)d[_]=v(_*l,e,n)}function w(_,k,T){var A,$,M=0;do $=k+(T-k)/2,A=v($,e,n)-_,A>0?T=$:k=$;while(Math.abs(A)>s&&++M<o);return $}function E(_){for(var k=0,T=1,A=u-1;T!==A&&d[T]<=_;++T)k+=l;--T;var $=(_-d[T])/(d[T+1]-d[T]),M=k+$*l,D=m(M,e,n);return D>=a?y(_,M):D===0?M:w(_,k,k+l)}var F=!1;function x(){F=!0,(e!==t||n!==r)&&b()}var C=function(k){return F||x(),e===t&&n===r?k:k===0?0:k===1?1:v(E(k),t,r)};C.getControlPoints=function(){return[{x:e,y:t},{x:n,y:r}]};var S="generateBezier("+[e,t,n,r]+")";return C.toString=function(){return S},C}/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */var Dj=function(){function e(r){return-r.tension*r.x-r.friction*r.v}function t(r,i,a){var s={x:r.x+a.dx*i,v:r.v+a.dv*i,tension:r.tension,friction:r.friction};return{dx:s.v,dv:e(s)}}function n(r,i){var a={dx:r.v,dv:e(r)},s=t(r,i*.5,a),o=t(r,i*.5,s),u=t(r,i,o),l=1/6*(a.dx+2*(s.dx+o.dx)+u.dx),c=1/6*(a.dv+2*(s.dv+o.dv)+u.dv);return r.x=r.x+l*i,r.v=r.v+c*i,r}return function r(i,a,s){var o={x:-1,v:0,tension:null,friction:null},u=[0],l=0,c=1/1e4,f=16/1e3,d,h,g;for(i=parseFloat(i)||500,a=parseFloat(a)||20,s=s||null,o.tension=i,o.friction=a,d=s!==null,d?(l=r(i,a),h=l/s*f):h=f;g=n(g||o,h),u.push(1+g.x),l+=16,Math.abs(g.x)>c&&Math.abs(g.v)>c;);return d?function(p){return u[p*(u.length-1)|0]}:l}}(),At=function(t,n,r,i){var a=$j(t,n,r,i);return function(s,o,u){return s+(o-s)*a(u)}},$p={linear:function(t,n,r){return t+(n-t)*r},ease:At(.25,.1,.25,1),"ease-in":At(.42,0,1,1),"ease-out":At(0,0,.58,1),"ease-in-out":At(.42,0,.58,1),"ease-in-sine":At(.47,0,.745,.715),"ease-out-sine":At(.39,.575,.565,1),"ease-in-out-sine":At(.445,.05,.55,.95),"ease-in-quad":At(.55,.085,.68,.53),"ease-out-quad":At(.25,.46,.45,.94),"ease-in-out-quad":At(.455,.03,.515,.955),"ease-in-cubic":At(.55,.055,.675,.19),"ease-out-cubic":At(.215,.61,.355,1),"ease-in-out-cubic":At(.645,.045,.355,1),"ease-in-quart":At(.895,.03,.685,.22),"ease-out-quart":At(.165,.84,.44,1),"ease-in-out-quart":At(.77,0,.175,1),"ease-in-quint":At(.755,.05,.855,.06),"ease-out-quint":At(.23,1,.32,1),"ease-in-out-quint":At(.86,0,.07,1),"ease-in-expo":At(.95,.05,.795,.035),"ease-out-expo":At(.19,1,.22,1),"ease-in-out-expo":At(1,0,0,1),"ease-in-circ":At(.6,.04,.98,.335),"ease-out-circ":At(.075,.82,.165,1),"ease-in-out-circ":At(.785,.135,.15,.86),spring:function(t,n,r){if(r===0)return $p.linear;var i=Dj(t,n,r);return function(a,s,o){return a+(s-a)*i(o)}},"cubic-bezier":At};function x$(e,t,n,r,i){if(r===1||t===n)return n;var a=i(t,n,r);return e==null||((e.roundValue||e.color)&&(a=Math.round(a)),e.min!==void 0&&(a=Math.max(a,e.min)),e.max!==void 0&&(a=Math.min(a,e.max))),a}function E$(e,t){return e.pfValue!=null||e.value!=null?e.pfValue!=null&&(t==null||t.type.units!=="%")?e.pfValue:e.value:e}function oc(e,t,n,r,i){var a=i!=null?i.type:null;n<0?n=0:n>1&&(n=1);var s=E$(e,i),o=E$(t,i);if(ve(s)&&ve(o))return x$(a,s,o,n,r);if(kt(s)&&kt(o)){for(var u=[],l=0;l<o.length;l++){var c=s[l],f=o[l];if(c!=null&&f!=null){var d=x$(a,c,f,n,r);u.push(d)}else u.push(f)}return u}}function Rj(e,t,n,r){var i=!r,a=e._private,s=t._private,o=s.easing,u=s.startTime,l=r?e:e.cy(),c=l.style();if(!s.easingImpl)if(o==null)s.easingImpl=$p.linear;else{var f;if(Me(o)){var d=c.parse("transition-timing-function",o);f=d.value}else f=o;var h,g;Me(f)?(h=f,g=[]):(h=f[1],g=f.slice(2).map(function(O){return+O})),g.length>0?(h==="spring"&&g.push(s.duration),s.easingImpl=$p[h].apply(null,g)):s.easingImpl=$p[h]}var p=s.easingImpl,v;if(s.duration===0?v=1:v=(n-u)/s.duration,s.applying&&(v=s.progress),v<0?v=0:v>1&&(v=1),s.delay==null){var m=s.startPosition,y=s.position;if(y&&i&&!e.locked()){var b={};fd(m.x,y.x)&&(b.x=oc(m.x,y.x,v,p)),fd(m.y,y.y)&&(b.y=oc(m.y,y.y,v,p)),e.position(b)}var w=s.startPan,E=s.pan,F=a.pan,x=E!=null&&r;x&&(fd(w.x,E.x)&&(F.x=oc(w.x,E.x,v,p)),fd(w.y,E.y)&&(F.y=oc(w.y,E.y,v,p)),e.emit("pan"));var C=s.startZoom,S=s.zoom,_=S!=null&&r;_&&(fd(C,S)&&(a.zoom=td(a.minZoom,oc(C,S,v,p),a.maxZoom)),e.emit("zoom")),(x||_)&&e.emit("viewport");var k=s.style;if(k&&k.length>0&&i){for(var T=0;T<k.length;T++){var A=k[T],$=A.name,M=A,D=s.startStyle[$],P=c.properties[D.name],N=oc(D,M,v,p,P);c.overrideBypass(e,$,N)}e.emit("style")}}return s.progress=v,v}function fd(e,t){return e==null||t==null?!1:ve(e)&&ve(t)?!0:!!(e&&t)}function Pj(e,t,n,r){var i=t._private;i.started=!0,i.startTime=n-i.progress*i.duration}function F$(e,t){var n=t._private.aniEles,r=[];function i(c,f){var d=c._private,h=d.animation.current,g=d.animation.queue,p=!1;if(h.length===0){var v=g.shift();v&&h.push(v)}for(var m=function(F){for(var x=F.length-1;x>=0;x--){var C=F[x];C()}F.splice(0,F.length)},y=h.length-1;y>=0;y--){var b=h[y],w=b._private;if(w.stopped){h.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,m(w.frames);continue}!w.playing&&!w.applying||(w.playing&&w.applying&&(w.applying=!1),w.started||Pj(c,b,e),Rj(c,b,e,f),w.applying&&(w.applying=!1),m(w.frames),w.step!=null&&w.step(e),b.completed()&&(h.splice(y,1),w.hooked=!1,w.playing=!1,w.started=!1,m(w.completes)),p=!0)}return!f&&h.length===0&&g.length===0&&r.push(c),p}for(var a=!1,s=0;s<n.length;s++){var o=n[s],u=i(o);a=a||u}var l=i(t,!0);(a||l)&&(n.length>0?t.notify("draw",n):t.notify("draw")),n.unmerge(r),t.emit("step")}var Nj={animate:pt.animate(),animation:pt.animation(),animated:pt.animated(),clearQueue:pt.clearQueue(),delay:pt.delay(),delayAnimation:pt.delayAnimation(),stop:pt.stop(),addToAnimationPool:function(t){var n=this;n.styleEnabled()&&n._private.aniEles.merge(t)},stopAnimationLoop:function(){this._private.animationsRunning=!1},startAnimationLoop:function(){var t=this;if(t._private.animationsRunning=!0,!t.styleEnabled())return;function n(){t._private.animationsRunning&&tp(function(a){F$(a,t),n()})}var r=t.renderer();r&&r.beforeRender?r.beforeRender(function(a,s){F$(s,t)},r.beforeRenderPriorities.animations):n()}},Oj={qualifierCompare:function(t,n){return t==null||n==null?t==null&&n==null:t.sameText(n)},eventMatches:function(t,n,r){var i=n.qualifier;return i!=null?t!==r.target&&Hf(r.target)&&i.matches(r.target):!0},addEventFields:function(t,n){n.cy=t,n.target=t},callbackContext:function(t,n,r){return n.qualifier!=null?r.target:t}},Dp=function(t){return Me(t)?new fo(t):t},S$={createEmitter:function(){var t=this._private;return t.emitter||(t.emitter=new Cp(Oj,this)),this},emitter:function(){return this._private.emitter},on:function(t,n,r){return this.emitter().on(t,Dp(n),r),this},removeListener:function(t,n,r){return this.emitter().removeListener(t,Dp(n),r),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},one:function(t,n,r){return this.emitter().one(t,Dp(n),r),this},once:function(t,n,r){return this.emitter().one(t,Dp(n),r),this},emit:function(t,n){return this.emitter().emit(t,n),this},emitAndNotify:function(t,n){return this.emit(t),this.notify(t,n),this}};pt.eventAliasesOn(S$);var T2={png:function(t){var n=this._private.renderer;return t=t||{},n.png(t)},jpg:function(t){var n=this._private.renderer;return t=t||{},t.bg=t.bg||"#fff",n.jpg(t)}};T2.jpeg=T2.jpg;var Rp={layout:function(t){var n=this;if(t==null){zt("Layout options must be specified to make a layout");return}if(t.name==null){zt("A `name` must be specified to make a layout");return}var r=t.name,i=n.extension("layout",r);if(i==null){zt("No such layout `"+r+"` found.  Did you forget to import it and `cytoscape.use()` it?");return}var a;Me(t.eles)?a=n.$(t.eles):a=t.eles!=null?t.eles:n.$();var s=new i(Ie({},t,{cy:n,eles:a}));return s}};Rp.createLayout=Rp.makeLayout=Rp.layout;var Ij={notify:function(t,n){var r=this._private;if(this.batching()){r.batchNotifications=r.batchNotifications||{};var i=r.batchNotifications[t]=r.batchNotifications[t]||this.collection();n!=null&&i.merge(n);return}if(r.notificationsEnabled){var a=this.renderer();this.destroyed()||!a||a.notify(t,n)}},notifications:function(t){var n=this._private;return t===void 0?n.notificationsEnabled:(n.notificationsEnabled=!!t,this)},noNotifications:function(t){this.notifications(!1),t(),this.notifications(!0)},batching:function(){return this._private.batchCount>0},startBatch:function(){var t=this._private;return t.batchCount==null&&(t.batchCount=0),t.batchCount===0&&(t.batchStyleEles=this.collection(),t.batchNotifications={}),t.batchCount++,this},endBatch:function(){var t=this._private;if(t.batchCount===0)return this;if(t.batchCount--,t.batchCount===0){t.batchStyleEles.updateStyle();var n=this.renderer();Object.keys(t.batchNotifications).forEach(function(r){var i=t.batchNotifications[r];i.empty()?n.notify(r):n.notify(r,i)})}return this},batch:function(t){return this.startBatch(),t(),this.endBatch(),this},batchData:function(t){var n=this;return this.batch(function(){for(var r=Object.keys(t),i=0;i<r.length;i++){var a=r[i],s=t[a],o=n.getElementById(a);o.data(s)}})}},Bj=an({hideEdgesOnViewport:!1,textureOnViewport:!1,motionBlur:!1,motionBlurOpacity:.05,pixelRatio:void 0,desktopTapThreshold:4,touchTapThreshold:8,wheelSensitivity:1,debug:!1,showFps:!1,webgl:!1,webglDebug:!1,webglDebugShowAtlases:!1,webglTexSize:2048,webglTexRows:36,webglTexRowsNodes:18,webglBatchSize:2048,webglTexPerBatch:14,webglBgColor:[255,255,255]}),M2={renderTo:function(t,n,r,i){var a=this._private.renderer;return a.renderTo(t,n,r,i),this},renderer:function(){return this._private.renderer},forceRender:function(){return this.notify("draw"),this},resize:function(){return this.invalidateSize(),this.emitAndNotify("resize"),this},initRenderer:function(t){var n=this,r=n.extension("renderer",t.name);if(r==null){zt("Can not initialise: No such renderer `".concat(t.name,"` found. Did you forget to import it and `cytoscape.use()` it?"));return}t.wheelSensitivity!==void 0&&gt("You have set a custom wheel sensitivity.  This will make your app zoom unnaturally when using mainstream mice.  You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine.");var i=Bj(t);i.cy=n,n._private.renderer=new r(i),this.notify("init")},destroyRenderer:function(){var t=this;t.notify("destroy");var n=t.container();if(n)for(n._cyreg=null;n.childNodes.length>0;)n.removeChild(n.childNodes[0]);t._private.renderer=null,t.mutableElements().forEach(function(r){var i=r._private;i.rscratch={},i.rstyle={},i.animation.current=[],i.animation.queue=[]})},onRender:function(t){return this.on("render",t)},offRender:function(t){return this.off("render",t)}};M2.invalidateDimensions=M2.resize;var Pp={collection:function(t,n){return Me(t)?this.$(t):Yr(t)?t.collection():kt(t)?(n||(n={}),new On(this,t,n.unique,n.removed)):new On(this)},nodes:function(t){var n=this.$(function(r){return r.isNode()});return t?n.filter(t):n},edges:function(t){var n=this.$(function(r){return r.isEdge()});return t?n.filter(t):n},$:function(t){var n=this._private.elements;return t?n.filter(t):n.spawnSelf()},mutableElements:function(){return this._private.elements}};Pp.elements=Pp.filter=Pp.$;var mn={},dd="t",Lj="f";mn.apply=function(e){for(var t=this,n=t._private,r=n.cy,i=r.collection(),a=0;a<e.length;a++){var s=e[a],o=t.getContextMeta(s);if(!o.empty){var u=t.getContextStyle(o),l=t.applyContextStyle(o,u,s);s._private.appliedInitStyle?t.updateTransitions(s,l.diffProps):s._private.appliedInitStyle=!0;var c=t.updateStyleHints(s);c&&i.push(s)}}return i},mn.getPropertiesDiff=function(e,t){var n=this,r=n._private.propDiffs=n._private.propDiffs||{},i=e+"-"+t,a=r[i];if(a)return a;for(var s=[],o={},u=0;u<n.length;u++){var l=n[u],c=e[u]===dd,f=t[u]===dd,d=c!==f,h=l.mappedProperties.length>0;if(d||f&&h){var g=void 0;d&&h||d?g=l.properties:h&&(g=l.mappedProperties);for(var p=0;p<g.length;p++){for(var v=g[p],m=v.name,y=!1,b=u+1;b<n.length;b++){var w=n[b],E=t[b]===dd;if(E&&(y=w.properties[v.name]!=null,y))break}!o[m]&&!y&&(o[m]=!0,s.push(m))}}}return r[i]=s,s},mn.getContextMeta=function(e){for(var t=this,n="",r,i=e._private.styleCxtKey||"",a=0;a<t.length;a++){var s=t[a],o=s.selector&&s.selector.matches(e);o?n+=dd:n+=Lj}return r=t.getPropertiesDiff(i,n),e._private.styleCxtKey=n,{key:n,diffPropNames:r,empty:r.length===0}},mn.getContextStyle=function(e){var t=e.key,n=this,r=this._private.contextStyles=this._private.contextStyles||{};if(r[t])return r[t];for(var i={_private:{key:t}},a=0;a<n.length;a++){var s=n[a],o=t[a]===dd;if(o)for(var u=0;u<s.properties.length;u++){var l=s.properties[u];i[l.name]=l}}return r[t]=i,i},mn.applyContextStyle=function(e,t,n){for(var r=this,i=e.diffPropNames,a={},s=r.types,o=0;o<i.length;o++){var u=i[o],l=t[u],c=n.pstyle(u);if(!l)if(c)c.bypass?l={name:u,deleteBypassed:!0}:l={name:u,delete:!0};else continue;if(c!==l){if(l.mapped===s.fn&&c!=null&&c.mapping!=null&&c.mapping.value===l.value){var f=c.mapping,d=f.fnValue=l.value(n);if(d===f.prevFnValue)continue}var h=a[u]={prev:c};r.applyParsedProperty(n,l),h.next=n.pstyle(u),h.next&&h.next.bypass&&(h.next=h.next.bypassed)}}return{diffProps:a}},mn.updateStyleHints=function(e){var t=e._private,n=this,r=n.propertyGroupNames,i=n.propertyGroupKeys,a=function(U,L,ae){return n.getPropertiesHash(U,L,ae)},s=t.styleKey;if(e.removed())return!1;var o=t.group==="nodes",u=e._private.style;r=Object.keys(u);for(var l=0;l<i.length;l++){var c=i[l];t.styleKeys[c]=[Hl,Kf]}for(var f=function(U,L){return t.styleKeys[L][0]=Zf(U,t.styleKeys[L][0])},d=function(U,L){return t.styleKeys[L][1]=Qf(U,t.styleKeys[L][1])},h=function(U,L){f(U,L),d(U,L)},g=function(U,L){for(var ae=0;ae<U.length;ae++){var de=U.charCodeAt(ae);f(de,L),d(de,L)}},p=2e9,v=function(U){return-128<U&&U<128&&Math.floor(U)!==U?p-(U*1024|0):U},m=0;m<r.length;m++){var y=r[m],b=u[y];if(b!=null){var w=this.properties[y],E=w.type,F=w.groupKey,x=void 0;w.hashOverride!=null?x=w.hashOverride(e,b):b.pfValue!=null&&(x=b.pfValue);var C=w.enums==null?b.value:null,S=x!=null,_=C!=null,k=S||_,T=b.units;if(E.number&&k&&!E.multiple){var A=S?x:C;h(v(A),F),!S&&T!=null&&g(T,F)}else g(b.strValue,F)}}for(var $=[Hl,Kf],M=0;M<i.length;M++){var D=i[M],P=t.styleKeys[D];$[0]=Zf(P[0],$[0]),$[1]=Qf(P[1],$[1])}t.styleKey=sV($[0],$[1]);var N=t.styleKeys;t.labelDimsKey=so(N.labelDimensions);var O=a(e,["label"],N.labelDimensions);if(t.labelKey=so(O),t.labelStyleKey=so(np(N.commonLabel,O)),!o){var q=a(e,["source-label"],N.labelDimensions);t.sourceLabelKey=so(q),t.sourceLabelStyleKey=so(np(N.commonLabel,q));var z=a(e,["target-label"],N.labelDimensions);t.targetLabelKey=so(z),t.targetLabelStyleKey=so(np(N.commonLabel,z))}if(o){var W=t.styleKeys,Y=W.nodeBody,J=W.nodeBorder,X=W.nodeOutline,te=W.backgroundImage,ie=W.compound,se=W.pie,B=[Y,J,X,te,ie,se].filter(function(I){return I!=null}).reduce(np,[Hl,Kf]);t.nodeKey=so(B),t.hasPie=se!=null&&se[0]!==Hl&&se[1]!==Kf}return s!==t.styleKey},mn.clearStyleHints=function(e){var t=e._private;t.styleCxtKey="",t.styleKeys={},t.styleKey=null,t.labelKey=null,t.labelStyleKey=null,t.sourceLabelKey=null,t.sourceLabelStyleKey=null,t.targetLabelKey=null,t.targetLabelStyleKey=null,t.nodeKey=null,t.hasPie=null},mn.applyParsedProperty=function(e,t){var n=this,r=t,i=e._private.style,a,s=n.types,o=n.properties[r.name].type,u=r.bypass,l=i[r.name],c=l&&l.bypass,f=e._private,d="mapping",h=function(Y){return Y==null?null:Y.pfValue!=null?Y.pfValue:Y.value},g=function(){var Y=h(l),J=h(r);n.checkTriggers(e,r.name,Y,J)};if(t.name==="curve-style"&&e.isEdge()&&(t.value!=="bezier"&&e.isLoop()||t.value==="haystack"&&(e.source().isParent()||e.target().isParent()))&&(r=t=this.parse(t.name,"bezier",u)),r.delete)return i[r.name]=void 0,g(),!0;if(r.deleteBypassed)return l?l.bypass?(l.bypassed=void 0,g(),!0):!1:(g(),!0);if(r.deleteBypass)return l?l.bypass?(i[r.name]=l.bypassed,g(),!0):!1:(g(),!0);var p=function(){gt("Do not assign mappings to elements without corresponding data (i.e. ele `"+e.id()+"` has no mapping for property `"+r.name+"` with data field `"+r.field+"`); try a `["+r.field+"]` selector to limit scope to elements with `"+r.field+"` defined")};switch(r.mapped){case s.mapData:{for(var v=r.field.split("."),m=f.data,y=0;y<v.length&&m;y++){var b=v[y];m=m[b]}if(m==null)return p(),!1;var w;if(ve(m)){var E=r.fieldMax-r.fieldMin;E===0?w=0:w=(m-r.fieldMin)/E}else return gt("Do not use continuous mappers without specifying numeric data (i.e. `"+r.field+": "+m+"` for `"+e.id()+"` is non-numeric)"),!1;if(w<0?w=0:w>1&&(w=1),o.color){var F=r.valueMin[0],x=r.valueMax[0],C=r.valueMin[1],S=r.valueMax[1],_=r.valueMin[2],k=r.valueMax[2],T=r.valueMin[3]==null?1:r.valueMin[3],A=r.valueMax[3]==null?1:r.valueMax[3],$=[Math.round(F+(x-F)*w),Math.round(C+(S-C)*w),Math.round(_+(k-_)*w),Math.round(T+(A-T)*w)];a={bypass:r.bypass,name:r.name,value:$,strValue:"rgb("+$[0]+", "+$[1]+", "+$[2]+")"}}else if(o.number){var M=r.valueMin+(r.valueMax-r.valueMin)*w;a=this.parse(r.name,M,r.bypass,d)}else return!1;if(!a)return p(),!1;a.mapping=r,r=a;break}case s.data:{for(var D=r.field.split("."),P=f.data,N=0;N<D.length&&P;N++){var O=D[N];P=P[O]}if(P!=null&&(a=this.parse(r.name,P,r.bypass,d)),!a)return p(),!1;a.mapping=r,r=a;break}case s.fn:{var q=r.value,z=r.fnValue!=null?r.fnValue:q(e);if(r.prevFnValue=z,z==null)return gt("Custom function mappers may not return null (i.e. `"+r.name+"` for ele `"+e.id()+"` is null)"),!1;if(a=this.parse(r.name,z,r.bypass,d),!a)return gt("Custom function mappers may not return invalid values for the property type (i.e. `"+r.name+"` for ele `"+e.id()+"` is invalid)"),!1;a.mapping=ga(r),r=a;break}case void 0:break;default:return!1}return u?(c?r.bypassed=l.bypassed:r.bypassed=l,i[r.name]=r):c?l.bypassed=r:i[r.name]=r,g(),!0},mn.cleanElements=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(this.clearStyleHints(r),r.dirtyCompoundBoundsCache(),r.dirtyBoundingBoxCache(),!t)r._private.style={};else for(var i=r._private.style,a=Object.keys(i),s=0;s<a.length;s++){var o=a[s],u=i[o];u!=null&&(u.bypass?u.bypassed=null:i[o]=null)}}},mn.update=function(){var e=this._private.cy,t=e.mutableElements();t.updateStyle()},mn.updateTransitions=function(e,t){var n=this,r=e._private,i=e.pstyle("transition-property").value,a=e.pstyle("transition-duration").pfValue,s=e.pstyle("transition-delay").pfValue;if(i.length>0&&a>0){for(var o={},u=!1,l=0;l<i.length;l++){var c=i[l],f=e.pstyle(c),d=t[c];if(d){var h=d.prev,g=h,p=d.next!=null?d.next:f,v=!1,m=void 0,y=1e-6;g&&(ve(g.pfValue)&&ve(p.pfValue)?(v=p.pfValue-g.pfValue,m=g.pfValue+y*v):ve(g.value)&&ve(p.value)?(v=p.value-g.value,m=g.value+y*v):kt(g.value)&&kt(p.value)&&(v=g.value[0]!==p.value[0]||g.value[1]!==p.value[1]||g.value[2]!==p.value[2],m=g.strValue),v&&(o[c]=p.strValue,this.applyBypass(e,c,m),u=!0))}}if(!u)return;r.transitioning=!0,new ec(function(b){s>0?e.delayAnimation(s).play().promise().then(b):b()}).then(function(){return e.animation({style:o,duration:a,easing:e.pstyle("transition-timing-function").value,queue:!1}).play().promise()}).then(function(){n.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1})}else r.transitioning&&(this.removeBypasses(e,i),e.emitAndNotify("style"),r.transitioning=!1)},mn.checkTrigger=function(e,t,n,r,i,a){var s=this.properties[t],o=i(s);e.removed()||o!=null&&o(n,r,e)&&a(s)},mn.checkZOrderTrigger=function(e,t,n,r){var i=this;this.checkTrigger(e,t,n,r,function(a){return a.triggersZOrder},function(){i._private.cy.notify("zorder",e)})},mn.checkBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(i){return i.triggersBounds},function(i){e.dirtyCompoundBoundsCache(),e.dirtyBoundingBoxCache()})},mn.checkConnectedEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(i){return i.triggersBoundsOfConnectedEdges},function(i){e.connectedEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})},mn.checkParallelEdgesBoundsTrigger=function(e,t,n,r){this.checkTrigger(e,t,n,r,function(i){return i.triggersBoundsOfParallelEdges},function(i){e.parallelEdges().forEach(function(a){a.dirtyBoundingBoxCache()})})},mn.checkTriggers=function(e,t,n,r){e.dirtyStyleCache(),this.checkZOrderTrigger(e,t,n,r),this.checkBoundsTrigger(e,t,n,r),this.checkConnectedEdgesBoundsTrigger(e,t,n,r),this.checkParallelEdgesBoundsTrigger(e,t,n,r)};var hd={};hd.applyBypass=function(e,t,n,r){var i=this,a=[],s=!0;if(t==="*"||t==="**"){if(n!==void 0)for(var o=0;o<i.properties.length;o++){var u=i.properties[o],l=u.name,c=this.parse(l,n,!0);c&&a.push(c)}}else if(Me(t)){var f=this.parse(t,n,!0);f&&a.push(f)}else if(ut(t)){var d=t;r=n;for(var h=Object.keys(d),g=0;g<h.length;g++){var p=h[g],v=d[p];if(v===void 0&&(v=d[Qg(p)]),v!==void 0){var m=this.parse(p,v,!0);m&&a.push(m)}}}else return!1;if(a.length===0)return!1;for(var y=!1,b=0;b<e.length;b++){for(var w=e[b],E={},F=void 0,x=0;x<a.length;x++){var C=a[x];if(r){var S=w.pstyle(C.name);F=E[C.name]={prev:S}}y=this.applyParsedProperty(w,ga(C))||y,r&&(F.next=w.pstyle(C.name))}y&&this.updateStyleHints(w),r&&this.updateTransitions(w,E,s)}return y},hd.overrideBypass=function(e,t,n){t=U1(t);for(var r=0;r<e.length;r++){var i=e[r],a=i._private.style[t],s=this.properties[t].type,o=s.color,u=s.mutiple,l=a?a.pfValue!=null?a.pfValue:a.value:null;!a||!a.bypass?this.applyBypass(i,t,n):(a.value=n,a.pfValue!=null&&(a.pfValue=n),o?a.strValue="rgb("+n.join(",")+")":u?a.strValue=n.join(" "):a.strValue=""+n,this.updateStyleHints(i)),this.checkTriggers(i,t,l,n)}},hd.removeAllBypasses=function(e,t){return this.removeBypasses(e,this.propertyNames,t)},hd.removeBypasses=function(e,t,n){for(var r=!0,i=0;i<e.length;i++){for(var a=e[i],s={},o=0;o<t.length;o++){var u=t[o],l=this.properties[u],c=a.pstyle(l.name);if(!(!c||!c.bypass)){var f="",d=this.parse(u,f,!0),h=s[l.name]={prev:c};this.applyParsedProperty(a,d),h.next=a.pstyle(l.name)}}this.updateStyleHints(a),n&&this.updateTransitions(a,s,r)}};var $2={};$2.getEmSizeInPixels=function(){var e=this.containerCss("font-size");return e!=null?parseFloat(e):1},$2.containerCss=function(e){var t=this._private.cy,n=t.container(),r=t.window();if(r&&n&&r.getComputedStyle)return r.getComputedStyle(n).getPropertyValue(e)};var pa={};pa.getRenderedStyle=function(e,t){return t?this.getStylePropertyValue(e,t,!0):this.getRawStyle(e,!0)},pa.getRawStyle=function(e,t){var n=this;if(e=e[0],e){for(var r={},i=0;i<n.properties.length;i++){var a=n.properties[i],s=n.getStylePropertyValue(e,a.name,t);s!=null&&(r[a.name]=s,r[Qg(a.name)]=s)}return r}},pa.getIndexedStyle=function(e,t,n,r){var i=e.pstyle(t)[n][r];return i??e.cy().style().getDefaultProperty(t)[n][0]},pa.getStylePropertyValue=function(e,t,n){var r=this;if(e=e[0],e){var i=r.properties[t];i.alias&&(i=i.pointsTo);var a=i.type,s=e.pstyle(i.name);if(s){var o=s.value,u=s.units,l=s.strValue;if(n&&a.number&&o!=null&&ve(o)){var c=e.cy().zoom(),f=function(v){return v*c},d=function(v,m){return f(v)+m},h=kt(o),g=h?u.every(function(p){return p!=null}):u!=null;return g?h?o.map(function(p,v){return d(p,u[v])}).join(" "):d(o,u):h?o.map(function(p){return Me(p)?p:""+f(p)}).join(" "):""+f(o)}else if(l!=null)return l}return null}},pa.getAnimationStartStyle=function(e,t){for(var n={},r=0;r<t.length;r++){var i=t[r],a=i.name,s=e.pstyle(a);s!==void 0&&(ut(s)?s=this.parse(a,s.strValue):s=this.parse(a,s)),s&&(n[a]=s)}return n},pa.getPropsList=function(e){var t=this,n=[],r=e,i=t.properties;if(r)for(var a=Object.keys(r),s=0;s<a.length;s++){var o=a[s],u=r[o],l=i[o]||i[U1(o)],c=this.parse(l.name,u);c&&n.push(c)}return n},pa.getNonDefaultPropertiesHash=function(e,t,n){var r=n.slice(),i,a,s,o,u,l;for(u=0;u<t.length;u++)if(i=t[u],a=e.pstyle(i,!1),a!=null)if(a.pfValue!=null)r[0]=Zf(o,r[0]),r[1]=Qf(o,r[1]);else for(s=a.strValue,l=0;l<s.length;l++)o=s.charCodeAt(l),r[0]=Zf(o,r[0]),r[1]=Qf(o,r[1]);return r},pa.getPropertiesHash=pa.getNonDefaultPropertiesHash;var Np={};Np.appendFromJson=function(e){for(var t=this,n=0;n<e.length;n++){var r=e[n],i=r.selector,a=r.style||r.css,s=Object.keys(a);t.selector(i);for(var o=0;o<s.length;o++){var u=s[o],l=a[u];t.css(u,l)}}return t},Np.fromJson=function(e){var t=this;return t.resetToDefault(),t.appendFromJson(e),t},Np.json=function(){for(var e=[],t=this.defaultLength;t<this.length;t++){for(var n=this[t],r=n.selector,i=n.properties,a={},s=0;s<i.length;s++){var o=i[s];a[o.name]=o.strValue}e.push({selector:r?r.toString():"core",style:a})}return e};var D2={};D2.appendFromString=function(e){var t=this,n=this,r=""+e,i,a,s;r=r.replace(/[/][*](\s|.)+?[*][/]/g,"");function o(){r.length>i.length?r=r.substr(i.length):r=""}function u(){a.length>s.length?a=a.substr(s.length):a=""}for(;;){var l=r.match(/^\s*$/);if(l)break;var c=r.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/);if(!c){gt("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: "+r);break}i=c[0];var f=c[1];if(f!=="core"){var d=new fo(f);if(d.invalid){gt("Skipping parsing of block: Invalid selector found in string stylesheet: "+f),o();continue}}var h=c[2],g=!1;a=h;for(var p=[];;){var v=a.match(/^\s*$/);if(v)break;var m=a.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/);if(!m){gt("Skipping parsing of block: Invalid formatting of style property and value definitions found in:"+h),g=!0;break}s=m[0];var y=m[1],b=m[2],w=t.properties[y];if(!w){gt("Skipping property: Invalid property name in: "+s),u();continue}var E=n.parse(y,b);if(!E){gt("Skipping property: Invalid property definition in: "+s),u();continue}p.push({name:y,val:b}),u()}if(g){o();break}n.selector(f);for(var F=0;F<p.length;F++){var x=p[F];n.css(x.name,x.val)}o()}return n},D2.fromString=function(e){var t=this;return t.resetToDefault(),t.appendFromString(e),t};var In={};(function(){var e=rn,t=BU,n=zU,r=qU,i=UU,a=function(B){return"^"+B+"\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"},s=function(B){var I=e+"|\\w+|"+t+"|"+n+"|"+r+"|"+i;return"^"+B+"\\s*\\(([\\w\\.]+)\\s*\\,\\s*("+e+")\\s*\\,\\s*("+e+")\\s*,\\s*("+I+")\\s*\\,\\s*("+I+")\\)$"},o=[`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`,"^(none)$","^(.+)$"];In.types={time:{number:!0,min:0,units:"s|ms",implicitUnits:"ms"},percent:{number:!0,min:0,max:100,units:"%",implicitUnits:"%"},percentages:{number:!0,min:0,max:100,units:"%",implicitUnits:"%",multiple:!0},zeroOneNumber:{number:!0,min:0,max:1,unitless:!0},zeroOneNumbers:{number:!0,min:0,max:1,unitless:!0,multiple:!0},nOneOneNumber:{number:!0,min:-1,max:1,unitless:!0},nonNegativeInt:{number:!0,min:0,integer:!0,unitless:!0},nonNegativeNumber:{number:!0,min:0,unitless:!0},position:{enums:["parent","origin"]},nodeSize:{number:!0,min:0,enums:["label"]},number:{number:!0,unitless:!0},numbers:{number:!0,unitless:!0,multiple:!0},positiveNumber:{number:!0,unitless:!0,min:0,strictMin:!0},size:{number:!0,min:0},bidirectionalSize:{number:!0},bidirectionalSizeMaybePercent:{number:!0,allowPercent:!0},bidirectionalSizes:{number:!0,multiple:!0},sizeMaybePercent:{number:!0,min:0,allowPercent:!0},axisDirection:{enums:["horizontal","leftward","rightward","vertical","upward","downward","auto"]},paddingRelativeTo:{enums:["width","height","average","min","max"]},bgWH:{number:!0,min:0,allowPercent:!0,enums:["auto"],multiple:!0},bgPos:{number:!0,allowPercent:!0,multiple:!0},bgRelativeTo:{enums:["inner","include-padding"],multiple:!0},bgRepeat:{enums:["repeat","repeat-x","repeat-y","no-repeat"],multiple:!0},bgFit:{enums:["none","contain","cover"],multiple:!0},bgCrossOrigin:{enums:["anonymous","use-credentials","null"],multiple:!0},bgClip:{enums:["none","node"],multiple:!0},bgContainment:{enums:["inside","over"],multiple:!0},color:{color:!0},colors:{color:!0,multiple:!0},fill:{enums:["solid","linear-gradient","radial-gradient"]},bool:{enums:["yes","no"]},bools:{enums:["yes","no"],multiple:!0},lineStyle:{enums:["solid","dotted","dashed"]},lineCap:{enums:["butt","round","square"]},linePosition:{enums:["center","inside","outside"]},lineJoin:{enums:["round","bevel","miter"]},borderStyle:{enums:["solid","dotted","dashed","double"]},curveStyle:{enums:["bezier","unbundled-bezier","haystack","segments","straight","straight-triangle","taxi","round-segments","round-taxi"]},radiusType:{enums:["arc-radius","influence-radius"],multiple:!0},fontFamily:{regex:'^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$'},fontStyle:{enums:["italic","normal","oblique"]},fontWeight:{enums:["normal","bold","bolder","lighter","100","200","300","400","500","600","800","900",100,200,300,400,500,600,700,800,900]},textDecoration:{enums:["none","underline","overline","line-through"]},textTransform:{enums:["none","uppercase","lowercase"]},textWrap:{enums:["none","wrap","ellipsis"]},textOverflowWrap:{enums:["whitespace","anywhere"]},textBackgroundShape:{enums:["rectangle","roundrectangle","round-rectangle"]},nodeShape:{enums:["rectangle","roundrectangle","round-rectangle","cutrectangle","cut-rectangle","bottomroundrectangle","bottom-round-rectangle","barrel","ellipse","triangle","round-triangle","square","pentagon","round-pentagon","hexagon","round-hexagon","concavehexagon","concave-hexagon","heptagon","round-heptagon","octagon","round-octagon","tag","round-tag","star","diamond","round-diamond","vee","rhomboid","right-rhomboid","polygon"]},overlayShape:{enums:["roundrectangle","round-rectangle","ellipse"]},cornerRadius:{number:!0,min:0,units:"px|em",implicitUnits:"px",enums:["auto"]},compoundIncludeLabels:{enums:["include","exclude"]},arrowShape:{enums:["tee","triangle","triangle-tee","circle-triangle","triangle-cross","triangle-backcurve","vee","square","circle","diamond","chevron","none"]},arrowFill:{enums:["filled","hollow"]},arrowWidth:{number:!0,units:"%|px|em",implicitUnits:"px",enums:["match-line"]},display:{enums:["element","none"]},visibility:{enums:["hidden","visible"]},zCompoundDepth:{enums:["bottom","orphan","auto","top"]},zIndexCompare:{enums:["auto","manual"]},valign:{enums:["top","center","bottom"]},halign:{enums:["left","center","right"]},justification:{enums:["left","center","right","auto"]},text:{string:!0},data:{mapping:!0,regex:a("data")},layoutData:{mapping:!0,regex:a("layoutData")},scratch:{mapping:!0,regex:a("scratch")},mapData:{mapping:!0,regex:s("mapData")},mapLayoutData:{mapping:!0,regex:s("mapLayoutData")},mapScratch:{mapping:!0,regex:s("mapScratch")},fn:{mapping:!0,fn:!0},url:{regexes:o,singleRegexMatchValue:!0},urls:{regexes:o,singleRegexMatchValue:!0,multiple:!0},propList:{propList:!0},angle:{number:!0,units:"deg|rad",implicitUnits:"rad"},textRotation:{number:!0,units:"deg|rad",implicitUnits:"rad",enums:["none","autorotate"]},polygonPointList:{number:!0,multiple:!0,evenMultiple:!0,min:-1,max:1,unitless:!0},edgeDistances:{enums:["intersection","node-position","endpoints"]},edgeEndpoint:{number:!0,multiple:!0,units:"%|px|em|deg|rad",implicitUnits:"px",enums:["inside-to-node","outside-to-node","outside-to-node-or-label","outside-to-line","outside-to-line-or-label"],singleEnum:!0,validate:function(B,I){switch(B.length){case 2:return I[0]!=="deg"&&I[0]!=="rad"&&I[1]!=="deg"&&I[1]!=="rad";case 1:return Me(B[0])||I[0]==="deg"||I[0]==="rad";default:return!1}}},easing:{regexes:["^(spring)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$","^(cubic-bezier)\\s*\\(\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*,\\s*("+e+")\\s*\\)$"],enums:["linear","ease","ease-in","ease-out","ease-in-out","ease-in-sine","ease-out-sine","ease-in-out-sine","ease-in-quad","ease-out-quad","ease-in-out-quad","ease-in-cubic","ease-out-cubic","ease-in-out-cubic","ease-in-quart","ease-out-quart","ease-in-out-quart","ease-in-quint","ease-out-quint","ease-in-out-quint","ease-in-expo","ease-out-expo","ease-in-out-expo","ease-in-circ","ease-out-circ","ease-in-out-circ"]},gradientDirection:{enums:["to-bottom","to-top","to-left","to-right","to-bottom-right","to-bottom-left","to-top-right","to-top-left","to-right-bottom","to-left-bottom","to-right-top","to-left-top"]},boundsExpansion:{number:!0,multiple:!0,min:0,validate:function(B){var I=B.length;return I===1||I===2||I===4}}};var u={zeroNonZero:function(B,I){return(B==null||I==null)&&B!==I||B==0&&I!=0?!0:B!=0&&I==0},any:function(B,I){return B!=I},emptyNonEmpty:function(B,I){var U=ao(B),L=ao(I);return U&&!L||!U&&L}},l=In.types,c=[{name:"label",type:l.text,triggersBounds:u.any,triggersZOrder:u.emptyNonEmpty},{name:"text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any}],f=[{name:"source-label",type:l.text,triggersBounds:u.any},{name:"source-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"source-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"source-text-offset",type:l.size,triggersBounds:u.any}],d=[{name:"target-label",type:l.text,triggersBounds:u.any},{name:"target-text-rotation",type:l.textRotation,triggersBounds:u.any},{name:"target-text-margin-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-margin-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"target-text-offset",type:l.size,triggersBounds:u.any}],h=[{name:"font-family",type:l.fontFamily,triggersBounds:u.any},{name:"font-style",type:l.fontStyle,triggersBounds:u.any},{name:"font-weight",type:l.fontWeight,triggersBounds:u.any},{name:"font-size",type:l.size,triggersBounds:u.any},{name:"text-transform",type:l.textTransform,triggersBounds:u.any},{name:"text-wrap",type:l.textWrap,triggersBounds:u.any},{name:"text-overflow-wrap",type:l.textOverflowWrap,triggersBounds:u.any},{name:"text-max-width",type:l.size,triggersBounds:u.any},{name:"text-outline-width",type:l.size,triggersBounds:u.any},{name:"line-height",type:l.positiveNumber,triggersBounds:u.any}],g=[{name:"text-valign",type:l.valign,triggersBounds:u.any},{name:"text-halign",type:l.halign,triggersBounds:u.any},{name:"color",type:l.color},{name:"text-outline-color",type:l.color},{name:"text-outline-opacity",type:l.zeroOneNumber},{name:"text-background-color",type:l.color},{name:"text-background-opacity",type:l.zeroOneNumber},{name:"text-background-padding",type:l.size,triggersBounds:u.any},{name:"text-border-opacity",type:l.zeroOneNumber},{name:"text-border-color",type:l.color},{name:"text-border-width",type:l.size,triggersBounds:u.any},{name:"text-border-style",type:l.borderStyle,triggersBounds:u.any},{name:"text-background-shape",type:l.textBackgroundShape,triggersBounds:u.any},{name:"text-justification",type:l.justification}],p=[{name:"events",type:l.bool,triggersZOrder:u.any},{name:"text-events",type:l.bool,triggersZOrder:u.any}],v=[{name:"display",type:l.display,triggersZOrder:u.any,triggersBounds:u.any,triggersBoundsOfConnectedEdges:u.any,triggersBoundsOfParallelEdges:function(B,I,U){return B===I?!1:U.pstyle("curve-style").value==="bezier"}},{name:"visibility",type:l.visibility,triggersZOrder:u.any},{name:"opacity",type:l.zeroOneNumber,triggersZOrder:u.zeroNonZero},{name:"text-opacity",type:l.zeroOneNumber},{name:"min-zoomed-font-size",type:l.size},{name:"z-compound-depth",type:l.zCompoundDepth,triggersZOrder:u.any},{name:"z-index-compare",type:l.zIndexCompare,triggersZOrder:u.any},{name:"z-index",type:l.number,triggersZOrder:u.any}],m=[{name:"overlay-padding",type:l.size,triggersBounds:u.any},{name:"overlay-color",type:l.color},{name:"overlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"overlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"overlay-corner-radius",type:l.cornerRadius}],y=[{name:"underlay-padding",type:l.size,triggersBounds:u.any},{name:"underlay-color",type:l.color},{name:"underlay-opacity",type:l.zeroOneNumber,triggersBounds:u.zeroNonZero},{name:"underlay-shape",type:l.overlayShape,triggersBounds:u.any},{name:"underlay-corner-radius",type:l.cornerRadius}],b=[{name:"transition-property",type:l.propList},{name:"transition-duration",type:l.time},{name:"transition-delay",type:l.time},{name:"transition-timing-function",type:l.easing}],w=function(B,I){return I.value==="label"?-B.poolIndex():I.pfValue},E=[{name:"height",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"width",type:l.nodeSize,triggersBounds:u.any,hashOverride:w},{name:"shape",type:l.nodeShape,triggersBounds:u.any},{name:"shape-polygon-points",type:l.polygonPointList,triggersBounds:u.any},{name:"corner-radius",type:l.cornerRadius},{name:"background-color",type:l.color},{name:"background-fill",type:l.fill},{name:"background-opacity",type:l.zeroOneNumber},{name:"background-blacken",type:l.nOneOneNumber},{name:"background-gradient-stop-colors",type:l.colors},{name:"background-gradient-stop-positions",type:l.percentages},{name:"background-gradient-direction",type:l.gradientDirection},{name:"padding",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"padding-relative-to",type:l.paddingRelativeTo,triggersBounds:u.any},{name:"bounds-expansion",type:l.boundsExpansion,triggersBounds:u.any}],F=[{name:"border-color",type:l.color},{name:"border-opacity",type:l.zeroOneNumber},{name:"border-width",type:l.size,triggersBounds:u.any},{name:"border-style",type:l.borderStyle},{name:"border-cap",type:l.lineCap},{name:"border-join",type:l.lineJoin},{name:"border-dash-pattern",type:l.numbers},{name:"border-dash-offset",type:l.number},{name:"border-position",type:l.linePosition}],x=[{name:"outline-color",type:l.color},{name:"outline-opacity",type:l.zeroOneNumber},{name:"outline-width",type:l.size,triggersBounds:u.any},{name:"outline-style",type:l.borderStyle},{name:"outline-offset",type:l.size,triggersBounds:u.any}],C=[{name:"background-image",type:l.urls},{name:"background-image-crossorigin",type:l.bgCrossOrigin},{name:"background-image-opacity",type:l.zeroOneNumbers},{name:"background-image-containment",type:l.bgContainment},{name:"background-image-smoothing",type:l.bools},{name:"background-position-x",type:l.bgPos},{name:"background-position-y",type:l.bgPos},{name:"background-width-relative-to",type:l.bgRelativeTo},{name:"background-height-relative-to",type:l.bgRelativeTo},{name:"background-repeat",type:l.bgRepeat},{name:"background-fit",type:l.bgFit},{name:"background-clip",type:l.bgClip},{name:"background-width",type:l.bgWH},{name:"background-height",type:l.bgWH},{name:"background-offset-x",type:l.bgPos},{name:"background-offset-y",type:l.bgPos}],S=[{name:"position",type:l.position,triggersBounds:u.any},{name:"compound-sizing-wrt-labels",type:l.compoundIncludeLabels,triggersBounds:u.any},{name:"min-width",type:l.size,triggersBounds:u.any},{name:"min-width-bias-left",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-width-bias-right",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height",type:l.size,triggersBounds:u.any},{name:"min-height-bias-top",type:l.sizeMaybePercent,triggersBounds:u.any},{name:"min-height-bias-bottom",type:l.sizeMaybePercent,triggersBounds:u.any}],_=[{name:"line-style",type:l.lineStyle},{name:"line-color",type:l.color},{name:"line-fill",type:l.fill},{name:"line-cap",type:l.lineCap},{name:"line-opacity",type:l.zeroOneNumber},{name:"line-dash-pattern",type:l.numbers},{name:"line-dash-offset",type:l.number},{name:"line-outline-width",type:l.size},{name:"line-outline-color",type:l.color},{name:"line-gradient-stop-colors",type:l.colors},{name:"line-gradient-stop-positions",type:l.percentages},{name:"curve-style",type:l.curveStyle,triggersBounds:u.any,triggersBoundsOfParallelEdges:function(B,I){return B===I?!1:B==="bezier"||I==="bezier"}},{name:"haystack-radius",type:l.zeroOneNumber,triggersBounds:u.any},{name:"source-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"target-endpoint",type:l.edgeEndpoint,triggersBounds:u.any},{name:"control-point-step-size",type:l.size,triggersBounds:u.any},{name:"control-point-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"control-point-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-distances",type:l.bidirectionalSizes,triggersBounds:u.any},{name:"segment-weights",type:l.numbers,triggersBounds:u.any},{name:"segment-radii",type:l.numbers,triggersBounds:u.any},{name:"radius-type",type:l.radiusType,triggersBounds:u.any},{name:"taxi-turn",type:l.bidirectionalSizeMaybePercent,triggersBounds:u.any},{name:"taxi-turn-min-distance",type:l.size,triggersBounds:u.any},{name:"taxi-direction",type:l.axisDirection,triggersBounds:u.any},{name:"taxi-radius",type:l.number,triggersBounds:u.any},{name:"edge-distances",type:l.edgeDistances,triggersBounds:u.any},{name:"arrow-scale",type:l.positiveNumber,triggersBounds:u.any},{name:"loop-direction",type:l.angle,triggersBounds:u.any},{name:"loop-sweep",type:l.angle,triggersBounds:u.any},{name:"source-distance-from-node",type:l.size,triggersBounds:u.any},{name:"target-distance-from-node",type:l.size,triggersBounds:u.any}],k=[{name:"ghost",type:l.bool,triggersBounds:u.any},{name:"ghost-offset-x",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-offset-y",type:l.bidirectionalSize,triggersBounds:u.any},{name:"ghost-opacity",type:l.zeroOneNumber}],T=[{name:"selection-box-color",type:l.color},{name:"selection-box-opacity",type:l.zeroOneNumber},{name:"selection-box-border-color",type:l.color},{name:"selection-box-border-width",type:l.size},{name:"active-bg-color",type:l.color},{name:"active-bg-opacity",type:l.zeroOneNumber},{name:"active-bg-size",type:l.size},{name:"outside-texture-bg-color",type:l.color},{name:"outside-texture-bg-opacity",type:l.zeroOneNumber}],A=[];In.pieBackgroundN=16,A.push({name:"pie-size",type:l.sizeMaybePercent});for(var $=1;$<=In.pieBackgroundN;$++)A.push({name:"pie-"+$+"-background-color",type:l.color}),A.push({name:"pie-"+$+"-background-size",type:l.percent}),A.push({name:"pie-"+$+"-background-opacity",type:l.zeroOneNumber});var M=[],D=In.arrowPrefixes=["source","mid-source","target","mid-target"];[{name:"arrow-shape",type:l.arrowShape,triggersBounds:u.any},{name:"arrow-color",type:l.color},{name:"arrow-fill",type:l.arrowFill},{name:"arrow-width",type:l.arrowWidth}].forEach(function(se){D.forEach(function(B){var I=B+"-"+se.name,U=se.type,L=se.triggersBounds;M.push({name:I,type:U,triggersBounds:L})})},{});var P=In.properties=[].concat(p,b,v,m,y,k,g,h,c,f,d,E,F,x,C,A,S,_,M,T),N=In.propertyGroups={behavior:p,transition:b,visibility:v,overlay:m,underlay:y,ghost:k,commonLabel:g,labelDimensions:h,mainLabel:c,sourceLabel:f,targetLabel:d,nodeBody:E,nodeBorder:F,nodeOutline:x,backgroundImage:C,pie:A,compound:S,edgeLine:_,edgeArrow:M,core:T},O=In.propertyGroupNames={},q=In.propertyGroupKeys=Object.keys(N);q.forEach(function(se){O[se]=N[se].map(function(B){return B.name}),N[se].forEach(function(B){return B.groupKey=se})});var z=In.aliases=[{name:"content",pointsTo:"label"},{name:"control-point-distance",pointsTo:"control-point-distances"},{name:"control-point-weight",pointsTo:"control-point-weights"},{name:"segment-distance",pointsTo:"segment-distances"},{name:"segment-weight",pointsTo:"segment-weights"},{name:"segment-radius",pointsTo:"segment-radii"},{name:"edge-text-rotation",pointsTo:"text-rotation"},{name:"padding-left",pointsTo:"padding"},{name:"padding-right",pointsTo:"padding"},{name:"padding-top",pointsTo:"padding"},{name:"padding-bottom",pointsTo:"padding"}];In.propertyNames=P.map(function(se){return se.name});for(var W=0;W<P.length;W++){var Y=P[W];P[Y.name]=Y}for(var J=0;J<z.length;J++){var X=z[J],te=P[X.pointsTo],ie={name:X.name,alias:!0,pointsTo:te};P.push(ie),P[X.name]=ie}})(),In.getDefaultProperty=function(e){return this.getDefaultProperties()[e]},In.getDefaultProperties=function(){var e=this._private;if(e.defaultProperties!=null)return e.defaultProperties;for(var t=Ie({"selection-box-color":"#ddd","selection-box-opacity":.65,"selection-box-border-color":"#aaa","selection-box-border-width":1,"active-bg-color":"black","active-bg-opacity":.15,"active-bg-size":30,"outside-texture-bg-color":"#000","outside-texture-bg-opacity":.125,events:"yes","text-events":"no","text-valign":"top","text-halign":"center","text-justification":"auto","line-height":1,color:"#000","text-outline-color":"#000","text-outline-width":0,"text-outline-opacity":1,"text-opacity":1,"text-decoration":"none","text-transform":"none","text-wrap":"none","text-overflow-wrap":"whitespace","text-max-width":9999,"text-background-color":"#000","text-background-opacity":0,"text-background-shape":"rectangle","text-background-padding":0,"text-border-opacity":0,"text-border-width":0,"text-border-style":"solid","text-border-color":"#000","font-family":"Helvetica Neue, Helvetica, sans-serif","font-style":"normal","font-weight":"normal","font-size":16,"min-zoomed-font-size":0,"text-rotation":"none","source-text-rotation":"none","target-text-rotation":"none",visibility:"visible",display:"element",opacity:1,"z-compound-depth":"auto","z-index-compare":"auto","z-index":0,label:"","text-margin-x":0,"text-margin-y":0,"source-label":"","source-text-offset":0,"source-text-margin-x":0,"source-text-margin-y":0,"target-label":"","target-text-offset":0,"target-text-margin-x":0,"target-text-margin-y":0,"overlay-opacity":0,"overlay-color":"#000","overlay-padding":10,"overlay-shape":"round-rectangle","overlay-corner-radius":"auto","underlay-opacity":0,"underlay-color":"#000","underlay-padding":10,"underlay-shape":"round-rectangle","underlay-corner-radius":"auto","transition-property":"none","transition-duration":0,"transition-delay":0,"transition-timing-function":"linear","background-blacken":0,"background-color":"#999","background-fill":"solid","background-opacity":1,"background-image":"none","background-image-crossorigin":"anonymous","background-image-opacity":1,"background-image-containment":"inside","background-image-smoothing":"yes","background-position-x":"50%","background-position-y":"50%","background-offset-x":0,"background-offset-y":0,"background-width-relative-to":"include-padding","background-height-relative-to":"include-padding","background-repeat":"no-repeat","background-fit":"none","background-clip":"node","background-width":"auto","background-height":"auto","border-color":"#000","border-opacity":1,"border-width":0,"border-style":"solid","border-dash-pattern":[4,2],"border-dash-offset":0,"border-cap":"butt","border-join":"miter","border-position":"center","outline-color":"#999","outline-opacity":1,"outline-width":0,"outline-offset":0,"outline-style":"solid",height:30,width:30,shape:"ellipse","shape-polygon-points":"-1, -1,   1, -1,   1, 1,   -1, 1","corner-radius":"auto","bounds-expansion":0,"background-gradient-direction":"to-bottom","background-gradient-stop-colors":"#999","background-gradient-stop-positions":"0%",ghost:"no","ghost-offset-y":0,"ghost-offset-x":0,"ghost-opacity":0,padding:0,"padding-relative-to":"width",position:"origin","compound-sizing-wrt-labels":"include","min-width":0,"min-width-bias-left":0,"min-width-bias-right":0,"min-height":0,"min-height-bias-top":0,"min-height-bias-bottom":0},{"pie-size":"100%"},[{name:"pie-{{i}}-background-color",value:"black"},{name:"pie-{{i}}-background-size",value:"0%"},{name:"pie-{{i}}-background-opacity",value:1}].reduce(function(u,l){for(var c=1;c<=In.pieBackgroundN;c++){var f=l.name.replace("{{i}}",c),d=l.value;u[f]=d}return u},{}),{"line-style":"solid","line-color":"#999","line-fill":"solid","line-cap":"butt","line-opacity":1,"line-outline-width":0,"line-outline-color":"#000","line-gradient-stop-colors":"#999","line-gradient-stop-positions":"0%","control-point-step-size":40,"control-point-weights":.5,"segment-weights":.5,"segment-distances":20,"segment-radii":15,"radius-type":"arc-radius","taxi-turn":"50%","taxi-radius":15,"taxi-turn-min-distance":10,"taxi-direction":"auto","edge-distances":"intersection","curve-style":"haystack","haystack-radius":0,"arrow-scale":1,"loop-direction":"-45deg","loop-sweep":"-90deg","source-distance-from-node":0,"target-distance-from-node":0,"source-endpoint":"outside-to-node","target-endpoint":"outside-to-node","line-dash-pattern":[6,3],"line-dash-offset":0},[{name:"arrow-shape",value:"none"},{name:"arrow-color",value:"#999"},{name:"arrow-fill",value:"filled"},{name:"arrow-width",value:1}].reduce(function(u,l){return In.arrowPrefixes.forEach(function(c){var f=c+"-"+l.name,d=l.value;u[f]=d}),u},{})),n={},r=0;r<this.properties.length;r++){var i=this.properties[r];if(!i.pointsTo){var a=i.name,s=t[a],o=this.parse(a,s);n[a]=o}}return e.defaultProperties=n,e.defaultProperties},In.addDefaultStylesheet=function(){this.selector(":parent").css({shape:"rectangle",padding:10,"background-color":"#eee","border-color":"#ccc","border-width":1}).selector("edge").css({width:3}).selector(":loop").css({"curve-style":"bezier"}).selector("edge:compound").css({"curve-style":"bezier","source-endpoint":"outside-to-line","target-endpoint":"outside-to-line"}).selector(":selected").css({"background-color":"#0169D9","line-color":"#0169D9","source-arrow-color":"#0169D9","target-arrow-color":"#0169D9","mid-source-arrow-color":"#0169D9","mid-target-arrow-color":"#0169D9"}).selector(":parent:selected").css({"background-color":"#CCE1F9","border-color":"#aec8e5"}).selector(":active").css({"overlay-color":"black","overlay-padding":10,"overlay-opacity":.25}),this.defaultLength=this.length};var Op={};Op.parse=function(e,t,n,r){var i=this;if(Lt(t))return i.parseImplWarn(e,t,n,r);var a=r==="mapping"||r===!0||r===!1||r==null?"dontcare":r,s=n?"t":"f",o=""+t,u=JA(e,o,s,a),l=i.propCache=i.propCache||[],c;return(c=l[u])||(c=l[u]=i.parseImplWarn(e,t,n,r)),(n||r==="mapping")&&(c=ga(c),c&&(c.value=ga(c.value))),c},Op.parseImplWarn=function(e,t,n,r){var i=this.parseImpl(e,t,n,r);return!i&&t!=null&&gt("The style property `".concat(e,": ").concat(t,"` is invalid")),i&&(i.name==="width"||i.name==="height")&&t==="label"&&gt("The style value of `label` is deprecated for `"+i.name+"`"),i},Op.parseImpl=function(e,t,n,r){var i=this;e=U1(e);var a=i.properties[e],s=t,o=i.types;if(!a||t===void 0)return null;a.alias&&(a=a.pointsTo,e=a.name);var u=Me(t);u&&(t=t.trim());var l=a.type;if(!l)return null;if(n&&(t===""||t===null))return{name:e,value:t,bypass:!0,deleteBypass:!0};if(Lt(t))return{name:e,value:t,strValue:"fn",mapped:o.fn,bypass:n};var c,f;if(!(!u||r||t.length<7||t[1]!=="a")){if(t.length>=7&&t[0]==="d"&&(c=new RegExp(o.data.regex).exec(t))){if(n)return!1;var d=o.data;return{name:e,value:c,strValue:""+t,mapped:d,field:c[1],bypass:n}}else if(t.length>=10&&t[0]==="m"&&(f=new RegExp(o.mapData.regex).exec(t))){if(n||l.multiple)return!1;var h=o.mapData;if(!(l.color||l.number))return!1;var g=this.parse(e,f[4]);if(!g||g.mapped)return!1;var p=this.parse(e,f[5]);if(!p||p.mapped)return!1;if(g.pfValue===p.pfValue||g.strValue===p.strValue)return gt("`"+e+": "+t+"` is not a valid mapper because the output range is zero; converting to `"+e+": "+g.strValue+"`"),this.parse(e,g.strValue);if(l.color){var v=g.value,m=p.value,y=v[0]===m[0]&&v[1]===m[1]&&v[2]===m[2]&&(v[3]===m[3]||(v[3]==null||v[3]===1)&&(m[3]==null||m[3]===1));if(y)return!1}return{name:e,value:f,strValue:""+t,mapped:h,field:f[1],fieldMin:parseFloat(f[2]),fieldMax:parseFloat(f[3]),valueMin:g.value,valueMax:p.value,bypass:n}}}if(l.multiple&&r!=="multiple"){var b;if(u?b=t.split(/\s+/):kt(t)?b=t:b=[t],l.evenMultiple&&b.length%2!==0)return null;for(var w=[],E=[],F=[],x="",C=!1,S=0;S<b.length;S++){var _=i.parse(e,b[S],n,"multiple");C=C||Me(_.value),w.push(_.value),F.push(_.pfValue!=null?_.pfValue:_.value),E.push(_.units),x+=(S>0?" ":"")+_.strValue}return l.validate&&!l.validate(w,E)?null:l.singleEnum&&C?w.length===1&&Me(w[0])?{name:e,value:w[0],strValue:w[0],bypass:n}:null:{name:e,value:w,pfValue:F,strValue:x,bypass:n,units:E}}var k=function(){for(var B=0;B<l.enums.length;B++){var I=l.enums[B];if(I===t)return{name:e,value:t,strValue:""+t,bypass:n}}return null};if(l.number){var T,A="px";if(l.units&&(T=l.units),l.implicitUnits&&(A=l.implicitUnits),!l.unitless)if(u){var $="px|em"+(l.allowPercent?"|\\%":"");T&&($=T);var M=t.match("^("+rn+")("+$+")?$");M&&(t=M[1],T=M[2]||A)}else(!T||l.implicitUnits)&&(T=A);if(t=parseFloat(t),isNaN(t)&&l.enums===void 0)return null;if(isNaN(t)&&l.enums!==void 0)return t=s,k();if(l.integer&&!$U(t)||l.min!==void 0&&(t<l.min||l.strictMin&&t===l.min)||l.max!==void 0&&(t>l.max||l.strictMax&&t===l.max))return null;var D={name:e,value:t,strValue:""+t+(T||""),units:T,bypass:n};return l.unitless||T!=="px"&&T!=="em"?D.pfValue=t:D.pfValue=T==="px"||!T?t:this.getEmSizeInPixels()*t,(T==="ms"||T==="s")&&(D.pfValue=T==="ms"?t:1e3*t),(T==="deg"||T==="rad")&&(D.pfValue=T==="rad"?t:BV(t)),T==="%"&&(D.pfValue=t/100),D}else if(l.propList){var P=[],N=""+t;if(N!=="none"){for(var O=N.split(/\s*,\s*|\s+/),q=0;q<O.length;q++){var z=O[q].trim();i.properties[z]?P.push(z):gt("`"+z+"` is not a valid property name")}if(P.length===0)return null}return{name:e,value:P,strValue:P.length===0?"none":P.join(" "),bypass:n}}else if(l.color){var W=$A(t);return W?{name:e,value:W,pfValue:W,strValue:"rgb("+W[0]+","+W[1]+","+W[2]+")",bypass:n}:null}else if(l.regex||l.regexes){if(l.enums){var Y=k();if(Y)return Y}for(var J=l.regexes?l.regexes:[l.regex],X=0;X<J.length;X++){var te=new RegExp(J[X]),ie=te.exec(t);if(ie)return{name:e,value:l.singleRegexMatchValue?ie[1]:ie,strValue:""+t,bypass:n}}return null}else return l.string?{name:e,value:""+t,strValue:""+t,bypass:n}:l.enums?k():null};var yn=function(t){if(!(this instanceof yn))return new yn(t);if(!q1(t)){zt("A style must have a core reference");return}this._private={cy:t,coreStyle:{}},this.length=0,this.resetToDefault()},Yn=yn.prototype;Yn.instanceString=function(){return"style"},Yn.clear=function(){for(var e=this._private,t=e.cy,n=t.elements(),r=0;r<this.length;r++)this[r]=void 0;return this.length=0,e.contextStyles={},e.propDiffs={},this.cleanElements(n,!0),n.forEach(function(i){var a=i[0]._private;a.styleDirty=!0,a.appliedInitStyle=!1}),this},Yn.resetToDefault=function(){return this.clear(),this.addDefaultStylesheet(),this},Yn.core=function(e){return this._private.coreStyle[e]||this.getDefaultProperty(e)},Yn.selector=function(e){var t=e==="core"?null:new fo(e),n=this.length++;return this[n]={selector:t,properties:[],mappedProperties:[],index:n},this},Yn.css=function(){var e=this,t=arguments;if(t.length===1)for(var n=t[0],r=0;r<e.properties.length;r++){var i=e.properties[r],a=n[i.name];a===void 0&&(a=n[Qg(i.name)]),a!==void 0&&this.cssRule(i.name,a)}else t.length===2&&this.cssRule(t[0],t[1]);return this},Yn.style=Yn.css,Yn.cssRule=function(e,t){var n=this.parse(e,t);if(n){var r=this.length-1;this[r].properties.push(n),this[r].properties[n.name]=n,n.name.match(/pie-(\d+)-background-size/)&&n.value&&(this._private.hasPie=!0),n.mapped&&this[r].mappedProperties.push(n);var i=!this[r].selector;i&&(this._private.coreStyle[n.name]=n)}return this},Yn.append=function(e){return _A(e)?e.appendToStyle(this):kt(e)?this.appendFromJson(e):Me(e)&&this.appendFromString(e),this},yn.fromJson=function(e,t){var n=new yn(e);return n.fromJson(t),n},yn.fromString=function(e,t){return new yn(e).fromString(t)},[mn,hd,$2,pa,Np,D2,In,Op].forEach(function(e){Ie(Yn,e)}),yn.types=Yn.types,yn.properties=Yn.properties,yn.propertyGroups=Yn.propertyGroups,yn.propertyGroupNames=Yn.propertyGroupNames,yn.propertyGroupKeys=Yn.propertyGroupKeys;var zj={style:function(t){if(t){var n=this.setStyle(t);n.update()}return this._private.style},setStyle:function(t){var n=this._private;return _A(t)?n.style=t.generateStyle(this):kt(t)?n.style=yn.fromJson(this,t):Me(t)?n.style=yn.fromString(this,t):n.style=yn(this),n.style},updateStyle:function(){this.mutableElements().updateStyle()}},qj="single",bu={autolock:function(t){if(t!==void 0)this._private.autolock=!!t;else return this._private.autolock;return this},autoungrabify:function(t){if(t!==void 0)this._private.autoungrabify=!!t;else return this._private.autoungrabify;return this},autounselectify:function(t){if(t!==void 0)this._private.autounselectify=!!t;else return this._private.autounselectify;return this},selectionType:function(t){var n=this._private;if(n.selectionType==null&&(n.selectionType=qj),t!==void 0)(t==="additive"||t==="single")&&(n.selectionType=t);else return n.selectionType;return this},panningEnabled:function(t){if(t!==void 0)this._private.panningEnabled=!!t;else return this._private.panningEnabled;return this},userPanningEnabled:function(t){if(t!==void 0)this._private.userPanningEnabled=!!t;else return this._private.userPanningEnabled;return this},zoomingEnabled:function(t){if(t!==void 0)this._private.zoomingEnabled=!!t;else return this._private.zoomingEnabled;return this},userZoomingEnabled:function(t){if(t!==void 0)this._private.userZoomingEnabled=!!t;else return this._private.userZoomingEnabled;return this},boxSelectionEnabled:function(t){if(t!==void 0)this._private.boxSelectionEnabled=!!t;else return this._private.boxSelectionEnabled;return this},pan:function(){var t=arguments,n=this._private.pan,r,i,a,s,o;switch(t.length){case 0:return n;case 1:if(Me(t[0]))return r=t[0],n[r];if(ut(t[0])){if(!this._private.panningEnabled)return this;a=t[0],s=a.x,o=a.y,ve(s)&&(n.x=s),ve(o)&&(n.y=o),this.emit("pan viewport")}break;case 2:if(!this._private.panningEnabled)return this;r=t[0],i=t[1],(r==="x"||r==="y")&&ve(i)&&(n[r]=i),this.emit("pan viewport");break}return this.notify("viewport"),this},panBy:function(t,n){var r=arguments,i=this._private.pan,a,s,o,u,l;if(!this._private.panningEnabled)return this;switch(r.length){case 1:ut(t)&&(o=r[0],u=o.x,l=o.y,ve(u)&&(i.x+=u),ve(l)&&(i.y+=l),this.emit("pan viewport"));break;case 2:a=t,s=n,(a==="x"||a==="y")&&ve(s)&&(i[a]+=s),this.emit("pan viewport");break}return this.notify("viewport"),this},gc:function(){this.notify("gc")},fit:function(t,n){var r=this.getFitViewport(t,n);if(r){var i=this._private;i.zoom=r.zoom,i.pan=r.pan,this.emit("pan zoom viewport"),this.notify("viewport")}return this},getFitViewport:function(t,n){if(ve(t)&&n===void 0&&(n=t,t=void 0),!(!this._private.panningEnabled||!this._private.zoomingEnabled)){var r;if(Me(t)){var i=t;t=this.$(i)}else if(PU(t)){var a=t;r={x1:a.x1,y1:a.y1,x2:a.x2,y2:a.y2},r.w=r.x2-r.x1,r.h=r.y2-r.y1}else Yr(t)||(t=this.mutableElements());if(!(Yr(t)&&t.empty())){r=r||t.boundingBox();var s=this.width(),o=this.height(),u;if(n=ve(n)?n:0,!isNaN(s)&&!isNaN(o)&&s>0&&o>0&&!isNaN(r.w)&&!isNaN(r.h)&&r.w>0&&r.h>0){u=Math.min((s-2*n)/r.w,(o-2*n)/r.h),u=u>this._private.maxZoom?this._private.maxZoom:u,u=u<this._private.minZoom?this._private.minZoom:u;var l={x:(s-u*(r.x1+r.x2))/2,y:(o-u*(r.y1+r.y2))/2};return{zoom:u,pan:l}}}}},zoomRange:function(t,n){var r=this._private;if(n==null){var i=t;t=i.min,n=i.max}return ve(t)&&ve(n)&&t<=n?(r.minZoom=t,r.maxZoom=n):ve(t)&&n===void 0&&t<=r.maxZoom?r.minZoom=t:ve(n)&&t===void 0&&n>=r.minZoom&&(r.maxZoom=n),this},minZoom:function(t){return t===void 0?this._private.minZoom:this.zoomRange({min:t})},maxZoom:function(t){return t===void 0?this._private.maxZoom:this.zoomRange({max:t})},getZoomedViewport:function(t){var n=this._private,r=n.pan,i=n.zoom,a,s,o=!1;if(n.zoomingEnabled||(o=!0),ve(t)?s=t:ut(t)&&(s=t.level,t.position!=null?a=sp(t.position,i,r):t.renderedPosition!=null&&(a=t.renderedPosition),a!=null&&!n.panningEnabled&&(o=!0)),s=s>n.maxZoom?n.maxZoom:s,s=s<n.minZoom?n.minZoom:s,o||!ve(s)||s===i||a!=null&&(!ve(a.x)||!ve(a.y)))return null;if(a!=null){var u=r,l=i,c=s,f={x:-c/l*(a.x-u.x)+a.x,y:-c/l*(a.y-u.y)+a.y};return{zoomed:!0,panned:!0,zoom:c,pan:f}}else return{zoomed:!0,panned:!1,zoom:s,pan:r}},zoom:function(t){if(t===void 0)return this._private.zoom;var n=this.getZoomedViewport(t),r=this._private;return n==null||!n.zoomed?this:(r.zoom=n.zoom,n.panned&&(r.pan.x=n.pan.x,r.pan.y=n.pan.y),this.emit("zoom"+(n.panned?" pan":"")+" viewport"),this.notify("viewport"),this)},viewport:function(t){var n=this._private,r=!0,i=!0,a=[],s=!1,o=!1;if(!t)return this;if(ve(t.zoom)||(r=!1),ut(t.pan)||(i=!1),!r&&!i)return this;if(r){var u=t.zoom;u<n.minZoom||u>n.maxZoom||!n.zoomingEnabled?s=!0:(n.zoom=u,a.push("zoom"))}if(i&&(!s||!t.cancelOnFailedZoom)&&n.panningEnabled){var l=t.pan;ve(l.x)&&(n.pan.x=l.x,o=!1),ve(l.y)&&(n.pan.y=l.y,o=!1),o||a.push("pan")}return a.length>0&&(a.push("viewport"),this.emit(a.join(" ")),this.notify("viewport")),this},center:function(t){var n=this.getCenterPan(t);return n&&(this._private.pan=n,this.emit("pan viewport"),this.notify("viewport")),this},getCenterPan:function(t,n){if(this._private.panningEnabled){if(Me(t)){var r=t;t=this.mutableElements().filter(r)}else Yr(t)||(t=this.mutableElements());if(t.length!==0){var i=t.boundingBox(),a=this.width(),s=this.height();n=n===void 0?this._private.zoom:n;var o={x:(a-n*(i.x1+i.x2))/2,y:(s-n*(i.y1+i.y2))/2};return o}}},reset:function(){return!this._private.panningEnabled||!this._private.zoomingEnabled?this:(this.viewport({pan:{x:0,y:0},zoom:1}),this)},invalidateSize:function(){this._private.sizeCache=null},size:function(){var t=this._private,n=t.container,r=this;return t.sizeCache=t.sizeCache||(n?function(){var i=r.window().getComputedStyle(n),a=function(o){return parseFloat(i.getPropertyValue(o))};return{width:n.clientWidth-a("padding-left")-a("padding-right"),height:n.clientHeight-a("padding-top")-a("padding-bottom")}}():{width:1,height:1})},width:function(){return this.size().width},height:function(){return this.size().height},extent:function(){var t=this._private.pan,n=this._private.zoom,r=this.renderedExtent(),i={x1:(r.x1-t.x)/n,x2:(r.x2-t.x)/n,y1:(r.y1-t.y)/n,y2:(r.y2-t.y)/n};return i.w=i.x2-i.x1,i.h=i.y2-i.y1,i},renderedExtent:function(){var t=this.width(),n=this.height();return{x1:0,y1:0,x2:t,y2:n,w:t,h:n}},multiClickDebounceTime:function(t){if(t)this._private.multiClickDebounceTime=t;else return this._private.multiClickDebounceTime;return this}};bu.centre=bu.center,bu.autolockNodes=bu.autolock,bu.autoungrabifyNodes=bu.autoungrabify;var gd={data:pt.data({field:"data",bindingEvent:"data",allowBinding:!0,allowSetting:!0,settingEvent:"data",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeData:pt.removeData({field:"data",event:"data",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0}),scratch:pt.data({field:"scratch",bindingEvent:"scratch",allowBinding:!0,allowSetting:!0,settingEvent:"scratch",settingTriggersEvent:!0,triggerFnName:"trigger",allowGetting:!0,updateStyle:!0}),removeScratch:pt.removeData({field:"scratch",event:"scratch",triggerFnName:"trigger",triggerEvent:!0,updateStyle:!0})};gd.attr=gd.data,gd.removeAttr=gd.removeData;var pd=function(t){var n=this;t=Ie({},t);var r=t.container;r&&!Zg(r)&&Zg(r[0])&&(r=r[0]);var i=r?r._cyreg:null;i=i||{},i&&i.cy&&(i.cy.destroy(),i={});var a=i.readies=i.readies||[];r&&(r._cyreg=i),i.cy=n;var s=nn!==void 0&&r!==void 0&&!t.headless,o=t;o.layout=Ie({name:s?"grid":"null"},o.layout),o.renderer=Ie({name:s?"canvas":"null"},o.renderer);var u=function(g,p,v){return p!==void 0?p:v!==void 0?v:g},l=this._private={container:r,ready:!1,options:o,elements:new On(this),listeners:[],aniEles:new On(this),data:o.data||{},scratch:{},layout:null,renderer:null,destroyed:!1,notificationsEnabled:!0,minZoom:1e-50,maxZoom:1e50,zoomingEnabled:u(!0,o.zoomingEnabled),userZoomingEnabled:u(!0,o.userZoomingEnabled),panningEnabled:u(!0,o.panningEnabled),userPanningEnabled:u(!0,o.userPanningEnabled),boxSelectionEnabled:u(!0,o.boxSelectionEnabled),autolock:u(!1,o.autolock,o.autolockNodes),autoungrabify:u(!1,o.autoungrabify,o.autoungrabifyNodes),autounselectify:u(!1,o.autounselectify),styleEnabled:o.styleEnabled===void 0?s:o.styleEnabled,zoom:ve(o.zoom)?o.zoom:1,pan:{x:ut(o.pan)&&ve(o.pan.x)?o.pan.x:0,y:ut(o.pan)&&ve(o.pan.y)?o.pan.y:0},animation:{current:[],queue:[]},hasCompoundNodes:!1,multiClickDebounceTime:u(250,o.multiClickDebounceTime)};this.createEmitter(),this.selectionType(o.selectionType),this.zoomRange({min:o.minZoom,max:o.maxZoom});var c=function(g,p){var v=g.some(NU);if(v)return ec.all(g).then(p);p(g)};l.styleEnabled&&n.setStyle([]);var f=Ie({},o,o.renderer);n.initRenderer(f);var d=function(g,p,v){n.notifications(!1);var m=n.mutableElements();m.length>0&&m.remove(),g!=null&&(ut(g)||kt(g))&&n.add(g),n.one("layoutready",function(b){n.notifications(!0),n.emit(b),n.one("load",p),n.emitAndNotify("load")}).one("layoutstop",function(){n.one("done",v),n.emit("done")});var y=Ie({},n._private.options.layout);y.eles=n.elements(),n.layout(y).run()};c([o.style,o.elements],function(h){var g=h[0],p=h[1];l.styleEnabled&&n.style().append(g),d(p,function(){n.startAnimationLoop(),l.ready=!0,Lt(o.ready)&&n.on("ready",o.ready);for(var v=0;v<a.length;v++){var m=a[v];n.on("ready",m)}i&&(i.readies=[]),n.emit("ready")},o.done)})},Ip=pd.prototype;Ie(Ip,{instanceString:function(){return"core"},isReady:function(){return this._private.ready},destroyed:function(){return this._private.destroyed},ready:function(t){return this.isReady()?this.emitter().emit("ready",[],t):this.on("ready",t),this},destroy:function(){var t=this;if(!t.destroyed())return t.stopAnimationLoop(),t.destroyRenderer(),this.emit("destroy"),t._private.destroyed=!0,t},hasElementWithId:function(t){return this._private.elements.hasElementWithId(t)},getElementById:function(t){return this._private.elements.getElementById(t)},hasCompoundNodes:function(){return this._private.hasCompoundNodes},headless:function(){return this._private.renderer.isHeadless()},styleEnabled:function(){return this._private.styleEnabled},addToPool:function(t){return this._private.elements.merge(t),this},removeFromPool:function(t){return this._private.elements.unmerge(t),this},container:function(){return this._private.container||null},window:function(){var t=this._private.container;if(t==null)return nn;var n=this._private.container.ownerDocument;return n===void 0||n==null?nn:n.defaultView||nn},mount:function(t){if(t!=null){var n=this,r=n._private,i=r.options;return!Zg(t)&&Zg(t[0])&&(t=t[0]),n.stopAnimationLoop(),n.destroyRenderer(),r.container=t,r.styleEnabled=!0,n.invalidateSize(),n.initRenderer(Ie({},i,i.renderer,{name:i.renderer.name==="null"?"canvas":i.renderer.name})),n.startAnimationLoop(),n.style(i.style),n.emit("mount"),n}},unmount:function(){var t=this;return t.stopAnimationLoop(),t.destroyRenderer(),t.initRenderer({name:"null"}),t.emit("unmount"),t},options:function(){return ga(this._private.options)},json:function(t){var n=this,r=n._private,i=n.mutableElements(),a=function(w){return n.getElementById(w.id())};if(ut(t)){if(n.startBatch(),t.elements){var s={},o=function(w,E){for(var F=[],x=[],C=0;C<w.length;C++){var S=w[C];if(!S.data.id){gt("cy.json() cannot handle elements without an ID attribute");continue}var _=""+S.data.id,k=n.getElementById(_);s[_]=!0,k.length!==0?x.push({ele:k,json:S}):(E&&(S.group=E),F.push(S))}n.add(F);for(var T=0;T<x.length;T++){var A=x[T],$=A.ele,M=A.json;$.json(M)}};if(kt(t.elements))o(t.elements);else for(var u=["nodes","edges"],l=0;l<u.length;l++){var c=u[l],f=t.elements[c];kt(f)&&o(f,c)}var d=n.collection();i.filter(function(b){return!s[b.id()]}).forEach(function(b){b.isParent()?d.merge(b):b.remove()}),d.forEach(function(b){return b.children().move({parent:null})}),d.forEach(function(b){return a(b).remove()})}t.style&&n.style(t.style),t.zoom!=null&&t.zoom!==r.zoom&&n.zoom(t.zoom),t.pan&&(t.pan.x!==r.pan.x||t.pan.y!==r.pan.y)&&n.pan(t.pan),t.data&&n.data(t.data);for(var h=["minZoom","maxZoom","zoomingEnabled","userZoomingEnabled","panningEnabled","userPanningEnabled","boxSelectionEnabled","autolock","autoungrabify","autounselectify","multiClickDebounceTime"],g=0;g<h.length;g++){var p=h[g];t[p]!=null&&n[p](t[p])}return n.endBatch(),this}else{var v=!!t,m={};v?m.elements=this.elements().map(function(b){return b.json()}):(m.elements={},i.forEach(function(b){var w=b.group();m.elements[w]||(m.elements[w]=[]),m.elements[w].push(b.json())})),this._private.styleEnabled&&(m.style=n.style().json()),m.data=ga(n.data());var y=r.options;return m.zoomingEnabled=r.zoomingEnabled,m.userZoomingEnabled=r.userZoomingEnabled,m.zoom=r.zoom,m.minZoom=r.minZoom,m.maxZoom=r.maxZoom,m.panningEnabled=r.panningEnabled,m.userPanningEnabled=r.userPanningEnabled,m.pan=ga(r.pan),m.boxSelectionEnabled=r.boxSelectionEnabled,m.renderer=ga(y.renderer),m.hideEdgesOnViewport=y.hideEdgesOnViewport,m.textureOnViewport=y.textureOnViewport,m.wheelSensitivity=y.wheelSensitivity,m.motionBlur=y.motionBlur,m.multiClickDebounceTime=y.multiClickDebounceTime,m}}}),Ip.$id=Ip.getElementById,[Mj,Nj,S$,T2,Rp,Ij,M2,Pp,zj,bu,gd].forEach(function(e){Ie(Ip,e)});var Uj={fit:!0,directed:!1,padding:30,circle:!1,grid:!1,spacingFactor:1.75,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,roots:void 0,depthSort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}},Vj={maximal:!1,acyclic:!1},uc=function(t){return t.scratch("breadthfirst")},C$=function(t,n){return t.scratch("breadthfirst",n)};function k$(e){this.options=Ie({},Uj,Vj,e)}k$.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=n.nodes().filter(function(Fe){return Fe.isChildless()}),i=n,a=e.directed,s=e.acyclic||e.maximal||e.maximalAdjustments>0,o=!!e.boundingBox,u=t.extent(),l=Rr(o?e.boundingBox:{x1:u.x1,y1:u.y1,w:u.w,h:u.h}),c;if(Yr(e.roots))c=e.roots;else if(kt(e.roots)){for(var f=[],d=0;d<e.roots.length;d++){var h=e.roots[d],g=t.getElementById(h);f.push(g)}c=t.collection(f)}else if(Me(e.roots))c=t.$(e.roots);else if(a)c=r.roots();else{var p=n.components();c=t.collection();for(var v=function(){var ke=p[m],Be=ke.maxDegree(!1),Ue=ke.filter(function(Le){return Le.degree(!1)===Be});c=c.add(Ue)},m=0;m<p.length;m++)v()}var y=[],b={},w=function(ke,Be){y[Be]==null&&(y[Be]=[]);var Ue=y[Be].length;y[Be].push(ke),C$(ke,{index:Ue,depth:Be})},E=function(ke,Be){var Ue=uc(ke),Le=Ue.depth,Ve=Ue.index;y[Le][Ve]=null,ke.isChildless()&&w(ke,Be)};i.bfs({roots:c,directed:e.directed,visit:function(ke,Be,Ue,Le,Ve){var Xe=ke[0],nt=Xe.id();Xe.isChildless()&&w(Xe,Ve),b[nt]=!0}});for(var F=[],x=0;x<r.length;x++){var C=r[x];b[C.id()]||F.push(C)}var S=function(ke){for(var Be=y[ke],Ue=0;Ue<Be.length;Ue++){var Le=Be[Ue];if(Le==null){Be.splice(Ue,1),Ue--;continue}C$(Le,{depth:ke,index:Ue})}},_=function(ke,Be){for(var Ue=uc(ke),Le=ke.incomers().filter(function(K){return K.isNode()&&n.has(K)}),Ve=-1,Xe=ke.id(),nt=0;nt<Le.length;nt++){var oe=Le[nt],R=uc(oe);Ve=Math.max(Ve,R.depth)}if(Ue.depth<=Ve){if(!e.acyclic&&Be[Xe])return null;var H=Ve+1;return E(ke,H),Be[Xe]=H,!0}return!1};if(a&&s){var k=[],T={},A=function(ke){return k.push(ke)},$=function(){return k.shift()};for(r.forEach(function(Fe){return k.push(Fe)});k.length>0;){var M=$(),D=_(M,T);if(D)M.outgoers().filter(function(Fe){return Fe.isNode()&&n.has(Fe)}).forEach(A);else if(D===null){gt("Detected double maximal shift for node `"+M.id()+"`.  Bailing maximal adjustment due to cycle.  Use `options.maximal: true` only on DAGs.");break}}}var P=0;if(e.avoidOverlap)for(var N=0;N<r.length;N++){var O=r[N],q=O.layoutDimensions(e),z=q.w,W=q.h;P=Math.max(P,z,W)}var Y={},J=function(ke){if(Y[ke.id()])return Y[ke.id()];for(var Be=uc(ke).depth,Ue=ke.neighborhood(),Le=0,Ve=0,Xe=0;Xe<Ue.length;Xe++){var nt=Ue[Xe];if(!(nt.isEdge()||nt.isParent()||!r.has(nt))){var oe=uc(nt);if(oe!=null){var R=oe.index,H=oe.depth;if(!(R==null||H==null)){var K=y[H].length;H<Be&&(Le+=R/K,Ve++)}}}}return Ve=Math.max(1,Ve),Le=Le/Ve,Ve===0&&(Le=0),Y[ke.id()]=Le,Le},X=function(ke,Be){var Ue=J(ke),Le=J(Be),Ve=Ue-Le;return Ve===0?MA(ke.id(),Be.id()):Ve};e.depthSort!==void 0&&(X=e.depthSort);for(var te=y.length,ie=0;ie<te;ie++)y[ie].sort(X),S(ie);for(var se=[],B=0;B<F.length;B++)se.push(F[B]);var I=function(){for(var ke=0;ke<te;ke++)S(ke)};se.length&&(y.unshift(se),te=y.length,I());for(var U=0,L=0;L<te;L++)U=Math.max(y[L].length,U);var ae={x:l.x1+l.w/2,y:l.y1+l.h/2},de=r.reduce(function(Fe,ke){return function(Be){return{w:Fe.w===-1?Be.w:(Fe.w+Be.w)/2,h:Fe.h===-1?Be.h:(Fe.h+Be.h)/2}}(ke.boundingBox({includeLabels:e.nodeDimensionsIncludeLabels}))},{w:-1,h:-1}),Ce=Math.max(te===1?0:o?(l.h-e.padding*2-de.h)/(te-1):(l.h-e.padding*2-de.h)/(te+1),P),Ye=y.reduce(function(Fe,ke){return Math.max(Fe,ke.length)},0),Qe=function(ke){var Be=uc(ke),Ue=Be.depth,Le=Be.index;if(e.circle){var Ve=Math.min(l.w/2/te,l.h/2/te);Ve=Math.max(Ve,P);var Xe=Ve*Ue+Ve-(te>0&&y[0].length<=3?Ve/2:0),nt=2*Math.PI/y[Ue].length*Le;return Ue===0&&y[0].length===1&&(Xe=1),{x:ae.x+Xe*Math.cos(nt),y:ae.y+Xe*Math.sin(nt)}}else{var oe=y[Ue].length,R=Math.max(oe===1?0:o?(l.w-e.padding*2-de.w)/((e.grid?Ye:oe)-1):(l.w-e.padding*2-de.w)/((e.grid?Ye:oe)+1),P),H={x:ae.x+(Le+1-(oe+1)/2)*R,y:ae.y+(Ue+1-(te+1)/2)*Ce};return H}};return n.nodes().layoutPositions(this,e,Qe),this};var Wj={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,radius:void 0,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function _$(e){this.options=Ie({},Wj,e)}_$.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,a=r.nodes().not(":parent");t.sort&&(a=a.sort(t.sort));for(var s=Rr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=t.sweep===void 0?2*Math.PI-2*Math.PI/a.length:t.sweep,l=u/Math.max(1,a.length-1),c,f=0,d=0;d<a.length;d++){var h=a[d],g=h.layoutDimensions(t),p=g.w,v=g.h;f=Math.max(f,p,v)}if(ve(t.radius)?c=t.radius:a.length<=1?c=0:c=Math.min(s.h,s.w)/2-f,a.length>1&&t.avoidOverlap){f*=1.75;var m=Math.cos(l)-Math.cos(0),y=Math.sin(l)-Math.sin(0),b=Math.sqrt(f*f/(m*m+y*y));c=Math.max(b,c)}var w=function(F,x){var C=t.startAngle+x*l*(i?1:-1),S=c*Math.cos(C),_=c*Math.sin(C),k={x:o.x+S,y:o.y+_};return k};return r.nodes().layoutPositions(this,t,w),this};var Hj={fit:!0,padding:30,startAngle:3/2*Math.PI,sweep:void 0,clockwise:!0,equidistant:!1,minNodeSpacing:10,boundingBox:void 0,avoidOverlap:!0,nodeDimensionsIncludeLabels:!1,height:void 0,width:void 0,spacingFactor:void 0,concentric:function(t){return t.degree()},levelWidth:function(t){return t.maxDegree()/4},animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function A$(e){this.options=Ie({},Hj,e)}A$.prototype.run=function(){for(var e=this.options,t=e,n=t.counterclockwise!==void 0?!t.counterclockwise:t.clockwise,r=e.cy,i=t.eles,a=i.nodes().not(":parent"),s=Rr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:r.width(),h:r.height()}),o={x:s.x1+s.w/2,y:s.y1+s.h/2},u=[],l=0,c=0;c<a.length;c++){var f=a[c],d=void 0;d=t.concentric(f),u.push({value:d,node:f}),f._private.scratch.concentric=d}a.updateStyle();for(var h=0;h<a.length;h++){var g=a[h],p=g.layoutDimensions(t);l=Math.max(l,p.w,p.h)}u.sort(function(de,Ce){return Ce.value-de.value});for(var v=t.levelWidth(a),m=[[]],y=m[0],b=0;b<u.length;b++){var w=u[b];if(y.length>0){var E=Math.abs(y[0].value-w.value);E>=v&&(y=[],m.push(y))}y.push(w)}var F=l+t.minNodeSpacing;if(!t.avoidOverlap){var x=m.length>0&&m[0].length>1,C=Math.min(s.w,s.h)/2-F,S=C/(m.length+x?1:0);F=Math.min(F,S)}for(var _=0,k=0;k<m.length;k++){var T=m[k],A=t.sweep===void 0?2*Math.PI-2*Math.PI/T.length:t.sweep,$=T.dTheta=A/Math.max(1,T.length-1);if(T.length>1&&t.avoidOverlap){var M=Math.cos($)-Math.cos(0),D=Math.sin($)-Math.sin(0),P=Math.sqrt(F*F/(M*M+D*D));_=Math.max(P,_)}T.r=_,_+=F}if(t.equidistant){for(var N=0,O=0,q=0;q<m.length;q++){var z=m[q],W=z.r-O;N=Math.max(N,W)}O=0;for(var Y=0;Y<m.length;Y++){var J=m[Y];Y===0&&(O=J.r),J.r=O,O+=N}}for(var X={},te=0;te<m.length;te++)for(var ie=m[te],se=ie.dTheta,B=ie.r,I=0;I<ie.length;I++){var U=ie[I],L=t.startAngle+(n?1:-1)*se*I,ae={x:o.x+B*Math.cos(L),y:o.y+B*Math.sin(L)};X[U.node.id()]=ae}return i.nodes().layoutPositions(this,t,function(de){var Ce=de.id();return X[Ce]}),this};var R2,jj={ready:function(){},stop:function(){},animate:!0,animationEasing:void 0,animationDuration:void 0,animateFilter:function(t,n){return!0},animationThreshold:250,refresh:20,fit:!0,padding:30,boundingBox:void 0,nodeDimensionsIncludeLabels:!1,randomize:!1,componentSpacing:40,nodeRepulsion:function(t){return 2048},nodeOverlap:4,idealEdgeLength:function(t){return 32},edgeElasticity:function(t){return 32},nestingFactor:1.2,gravity:1,numIter:1e3,initialTemp:1e3,coolingFactor:.99,minTemp:1};function Bp(e){this.options=Ie({},jj,e),this.options.layout=this;var t=this.options.eles.nodes(),n=this.options.eles.edges(),r=n.filter(function(i){var a=i.source().data("id"),s=i.target().data("id"),o=t.some(function(l){return l.data("id")===a}),u=t.some(function(l){return l.data("id")===s});return!o||!u});this.options.eles=this.options.eles.not(r)}Bp.prototype.run=function(){var e=this.options,t=e.cy,n=this;n.stopped=!1,(e.animate===!0||e.animate===!1)&&n.emit({type:"layoutstart",layout:n}),e.debug===!0?R2=!0:R2=!1;var r=Gj(t,n,e);R2&&Xj(r),e.randomize&&Kj(r);var i=ss(),a=function(){Zj(r,t,e),e.fit===!0&&t.fit(e.padding)},s=function(d){return!(n.stopped||d>=e.numIter||(Qj(r,e),r.temperature=r.temperature*e.coolingFactor,r.temperature<e.minTemp))},o=function(){if(e.animate===!0||e.animate===!1)a(),n.one("layoutstop",e.stop),n.emit({type:"layoutstop",layout:n});else{var d=e.eles.nodes(),h=M$(r,e,d);d.layoutPositions(n,e,h)}},u=0,l=!0;if(e.animate===!0){var c=function(){for(var d=0;l&&d<e.refresh;)l=s(u),u++,d++;if(!l)R$(r,e),o();else{var h=ss();h-i>=e.animationThreshold&&a(),tp(c)}};c()}else{for(;l;)l=s(u),u++;R$(r,e),o()}return this},Bp.prototype.stop=function(){return this.stopped=!0,this.thread&&this.thread.stop(),this.emit("layoutstop"),this},Bp.prototype.destroy=function(){return this.thread&&this.thread.stop(),this};var Gj=function(t,n,r){for(var i=r.eles.edges(),a=r.eles.nodes(),s=Rr(r.boundingBox?r.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),o={isCompound:t.hasCompoundNodes(),layoutNodes:[],idToIndex:{},nodeSize:a.size(),graphSet:[],indexToGraph:[],layoutEdges:[],edgeSize:i.size(),temperature:r.initialTemp,clientWidth:s.w,clientHeight:s.h,boundingBox:s},u=r.eles.components(),l={},c=0;c<u.length;c++)for(var f=u[c],d=0;d<f.length;d++){var h=f[d];l[h.id()]=c}for(var c=0;c<o.nodeSize;c++){var g=a[c],p=g.layoutDimensions(r),v={};v.isLocked=g.locked(),v.id=g.data("id"),v.parentId=g.data("parent"),v.cmptId=l[g.id()],v.children=[],v.positionX=g.position("x"),v.positionY=g.position("y"),v.offsetX=0,v.offsetY=0,v.height=p.w,v.width=p.h,v.maxX=v.positionX+v.width/2,v.minX=v.positionX-v.width/2,v.maxY=v.positionY+v.height/2,v.minY=v.positionY-v.height/2,v.padLeft=parseFloat(g.style("padding")),v.padRight=parseFloat(g.style("padding")),v.padTop=parseFloat(g.style("padding")),v.padBottom=parseFloat(g.style("padding")),v.nodeRepulsion=Lt(r.nodeRepulsion)?r.nodeRepulsion(g):r.nodeRepulsion,o.layoutNodes.push(v),o.idToIndex[v.id]=c}for(var m=[],y=0,b=-1,w=[],c=0;c<o.nodeSize;c++){var g=o.layoutNodes[c],E=g.parentId;E!=null?o.layoutNodes[o.idToIndex[E]].children.push(g.id):(m[++b]=g.id,w.push(g.id))}for(o.graphSet.push(w);y<=b;){var F=m[y++],x=o.idToIndex[F],h=o.layoutNodes[x],C=h.children;if(C.length>0){o.graphSet.push(C);for(var c=0;c<C.length;c++)m[++b]=C[c]}}for(var c=0;c<o.graphSet.length;c++)for(var S=o.graphSet[c],d=0;d<S.length;d++){var _=o.idToIndex[S[d]];o.indexToGraph[_]=c}for(var c=0;c<o.edgeSize;c++){var k=i[c],T={};T.id=k.data("id"),T.sourceId=k.data("source"),T.targetId=k.data("target");var A=Lt(r.idealEdgeLength)?r.idealEdgeLength(k):r.idealEdgeLength,$=Lt(r.edgeElasticity)?r.edgeElasticity(k):r.edgeElasticity,M=o.idToIndex[T.sourceId],D=o.idToIndex[T.targetId],P=o.indexToGraph[M],N=o.indexToGraph[D];if(P!=N){for(var O=Yj(T.sourceId,T.targetId,o),q=o.graphSet[O],z=0,v=o.layoutNodes[M];q.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],z++;for(v=o.layoutNodes[D];q.indexOf(v.id)===-1;)v=o.layoutNodes[o.idToIndex[v.parentId]],z++;A*=z*r.nestingFactor}T.idealLength=A,T.elasticity=$,o.layoutEdges.push(T)}return o},Yj=function(t,n,r){var i=T$(t,n,0,r);return 2>i.count?0:i.graph},T$=function(t,n,r,i){var a=i.graphSet[r];if(-1<a.indexOf(t)&&-1<a.indexOf(n))return{count:2,graph:r};for(var s=0,o=0;o<a.length;o++){var u=a[o],l=i.idToIndex[u],c=i.layoutNodes[l].children;if(c.length!==0){var f=i.indexToGraph[i.idToIndex[c[0]]],d=T$(t,n,f,i);if(d.count!==0)if(d.count===1){if(s++,s===2)break}else return d}}return{count:s,graph:r}},Xj,Kj=function(t,n){for(var r=t.clientWidth,i=t.clientHeight,a=0;a<t.nodeSize;a++){var s=t.layoutNodes[a];s.children.length===0&&!s.isLocked&&(s.positionX=Math.random()*r,s.positionY=Math.random()*i)}},M$=function(t,n,r){var i=t.boundingBox,a={x1:1/0,x2:-1/0,y1:1/0,y2:-1/0};return n.boundingBox&&(r.forEach(function(s){var o=t.layoutNodes[t.idToIndex[s.data("id")]];a.x1=Math.min(a.x1,o.positionX),a.x2=Math.max(a.x2,o.positionX),a.y1=Math.min(a.y1,o.positionY),a.y2=Math.max(a.y2,o.positionY)}),a.w=a.x2-a.x1,a.h=a.y2-a.y1),function(s,o){var u=t.layoutNodes[t.idToIndex[s.data("id")]];if(n.boundingBox){var l=(u.positionX-a.x1)/a.w,c=(u.positionY-a.y1)/a.h;return{x:i.x1+l*i.w,y:i.y1+c*i.h}}else return{x:u.positionX,y:u.positionY}}},Zj=function(t,n,r){var i=r.layout,a=r.eles.nodes(),s=M$(t,r,a);a.positions(s),t.ready!==!0&&(t.ready=!0,i.one("layoutready",r.ready),i.emit({type:"layoutready",layout:this}))},Qj=function(t,n,r){Jj(t,n),nG(t),rG(t,n),iG(t),aG(t)},Jj=function(t,n){for(var r=0;r<t.graphSet.length;r++)for(var i=t.graphSet[r],a=i.length,s=0;s<a;s++)for(var o=t.layoutNodes[t.idToIndex[i[s]]],u=s+1;u<a;u++){var l=t.layoutNodes[t.idToIndex[i[u]]];eG(o,l,t,n)}},$$=function(t){return-1+2*t*Math.random()},eG=function(t,n,r,i){var a=t.cmptId,s=n.cmptId;if(!(a!==s&&!r.isCompound)){var o=n.positionX-t.positionX,u=n.positionY-t.positionY,l=1;o===0&&u===0&&(o=$$(l),u=$$(l));var c=tG(t,n,o,u);if(c>0)var f=i.nodeOverlap*c,d=Math.sqrt(o*o+u*u),h=f*o/d,g=f*u/d;else var p=Lp(t,o,u),v=Lp(n,-1*o,-1*u),m=v.x-p.x,y=v.y-p.y,b=m*m+y*y,d=Math.sqrt(b),f=(t.nodeRepulsion+n.nodeRepulsion)/b,h=f*m/d,g=f*y/d;t.isLocked||(t.offsetX-=h,t.offsetY-=g),n.isLocked||(n.offsetX+=h,n.offsetY+=g)}},tG=function(t,n,r,i){if(r>0)var a=t.maxX-n.minX;else var a=n.maxX-t.minX;if(i>0)var s=t.maxY-n.minY;else var s=n.maxY-t.minY;return a>=0&&s>=0?Math.sqrt(a*a+s*s):0},Lp=function(t,n,r){var i=t.positionX,a=t.positionY,s=t.height||1,o=t.width||1,u=r/n,l=s/o,c={};return n===0&&0<r||n===0&&0>r?(c.x=i,c.y=a+s/2,c):0<n&&-1*l<=u&&u<=l?(c.x=i+o/2,c.y=a+o*r/2/n,c):0>n&&-1*l<=u&&u<=l?(c.x=i-o/2,c.y=a-o*r/2/n,c):0<r&&(u<=-1*l||u>=l)?(c.x=i+s*n/2/r,c.y=a+s/2,c):(0>r&&(u<=-1*l||u>=l)&&(c.x=i-s*n/2/r,c.y=a-s/2),c)},nG=function(t,n){for(var r=0;r<t.edgeSize;r++){var i=t.layoutEdges[r],a=t.idToIndex[i.sourceId],s=t.layoutNodes[a],o=t.idToIndex[i.targetId],u=t.layoutNodes[o],l=u.positionX-s.positionX,c=u.positionY-s.positionY;if(!(l===0&&c===0)){var f=Lp(s,l,c),d=Lp(u,-1*l,-1*c),h=d.x-f.x,g=d.y-f.y,p=Math.sqrt(h*h+g*g),v=Math.pow(i.idealLength-p,2)/i.elasticity;if(p!==0)var m=v*h/p,y=v*g/p;else var m=0,y=0;s.isLocked||(s.offsetX+=m,s.offsetY+=y),u.isLocked||(u.offsetX-=m,u.offsetY-=y)}}},rG=function(t,n){if(n.gravity!==0)for(var r=1,i=0;i<t.graphSet.length;i++){var a=t.graphSet[i],s=a.length;if(i===0)var o=t.clientHeight/2,u=t.clientWidth/2;else var l=t.layoutNodes[t.idToIndex[a[0]]],c=t.layoutNodes[t.idToIndex[l.parentId]],o=c.positionX,u=c.positionY;for(var f=0;f<s;f++){var d=t.layoutNodes[t.idToIndex[a[f]]];if(!d.isLocked){var h=o-d.positionX,g=u-d.positionY,p=Math.sqrt(h*h+g*g);if(p>r){var v=n.gravity*h/p,m=n.gravity*g/p;d.offsetX+=v,d.offsetY+=m}}}}},iG=function(t,n){var r=[],i=0,a=-1;for(r.push.apply(r,t.graphSet[0]),a+=t.graphSet[0].length;i<=a;){var s=r[i++],o=t.idToIndex[s],u=t.layoutNodes[o],l=u.children;if(0<l.length&&!u.isLocked){for(var c=u.offsetX,f=u.offsetY,d=0;d<l.length;d++){var h=t.layoutNodes[t.idToIndex[l[d]]];h.offsetX+=c,h.offsetY+=f,r[++a]=l[d]}u.offsetX=0,u.offsetY=0}}},aG=function(t,n){for(var r=0;r<t.nodeSize;r++){var i=t.layoutNodes[r];0<i.children.length&&(i.maxX=void 0,i.minX=void 0,i.maxY=void 0,i.minY=void 0)}for(var r=0;r<t.nodeSize;r++){var i=t.layoutNodes[r];if(!(0<i.children.length||i.isLocked)){var a=sG(i.offsetX,i.offsetY,t.temperature);i.positionX+=a.x,i.positionY+=a.y,i.offsetX=0,i.offsetY=0,i.minX=i.positionX-i.width,i.maxX=i.positionX+i.width,i.minY=i.positionY-i.height,i.maxY=i.positionY+i.height,D$(i,t)}}for(var r=0;r<t.nodeSize;r++){var i=t.layoutNodes[r];0<i.children.length&&!i.isLocked&&(i.positionX=(i.maxX+i.minX)/2,i.positionY=(i.maxY+i.minY)/2,i.width=i.maxX-i.minX,i.height=i.maxY-i.minY)}},sG=function(t,n,r){var i=Math.sqrt(t*t+n*n);if(i>r)var a={x:r*t/i,y:r*n/i};else var a={x:t,y:n};return a},D$=function(t,n){var r=t.parentId;if(r!=null){var i=n.layoutNodes[n.idToIndex[r]],a=!1;if((i.maxX==null||t.maxX+i.padRight>i.maxX)&&(i.maxX=t.maxX+i.padRight,a=!0),(i.minX==null||t.minX-i.padLeft<i.minX)&&(i.minX=t.minX-i.padLeft,a=!0),(i.maxY==null||t.maxY+i.padBottom>i.maxY)&&(i.maxY=t.maxY+i.padBottom,a=!0),(i.minY==null||t.minY-i.padTop<i.minY)&&(i.minY=t.minY-i.padTop,a=!0),a)return D$(i,n)}},R$=function(t,n){for(var r=t.layoutNodes,i=[],a=0;a<r.length;a++){var s=r[a],o=s.cmptId,u=i[o]=i[o]||[];u.push(s)}for(var l=0,a=0;a<i.length;a++){var c=i[a];if(c){c.x1=1/0,c.x2=-1/0,c.y1=1/0,c.y2=-1/0;for(var f=0;f<c.length;f++){var d=c[f];c.x1=Math.min(c.x1,d.positionX-d.width/2),c.x2=Math.max(c.x2,d.positionX+d.width/2),c.y1=Math.min(c.y1,d.positionY-d.height/2),c.y2=Math.max(c.y2,d.positionY+d.height/2)}c.w=c.x2-c.x1,c.h=c.y2-c.y1,l+=c.w*c.h}}i.sort(function(y,b){return b.w*b.h-y.w*y.h});for(var h=0,g=0,p=0,v=0,m=Math.sqrt(l)*t.clientWidth/t.clientHeight,a=0;a<i.length;a++){var c=i[a];if(c){for(var f=0;f<c.length;f++){var d=c[f];d.isLocked||(d.positionX+=h-c.x1,d.positionY+=g-c.y1)}h+=c.w+n.componentSpacing,p+=c.w+n.componentSpacing,v=Math.max(v,c.h),p>m&&(g+=v+n.componentSpacing,h=0,p=0,v=0)}}},oG={fit:!0,padding:30,boundingBox:void 0,avoidOverlap:!0,avoidOverlapPadding:10,nodeDimensionsIncludeLabels:!1,spacingFactor:void 0,condense:!1,rows:void 0,cols:void 0,position:function(t){},sort:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function P$(e){this.options=Ie({},oG,e)}P$.prototype.run=function(){var e=this.options,t=e,n=e.cy,r=t.eles,i=r.nodes().not(":parent");t.sort&&(i=i.sort(t.sort));var a=Rr(t.boundingBox?t.boundingBox:{x1:0,y1:0,w:n.width(),h:n.height()});if(a.h===0||a.w===0)r.nodes().layoutPositions(this,t,function(Y){return{x:a.x1,y:a.y1}});else{var s=i.size(),o=Math.sqrt(s*a.h/a.w),u=Math.round(o),l=Math.round(a.w/a.h*o),c=function(J){if(J==null)return Math.min(u,l);var X=Math.min(u,l);X==u?u=J:l=J},f=function(J){if(J==null)return Math.max(u,l);var X=Math.max(u,l);X==u?u=J:l=J},d=t.rows,h=t.cols!=null?t.cols:t.columns;if(d!=null&&h!=null)u=d,l=h;else if(d!=null&&h==null)u=d,l=Math.ceil(s/u);else if(d==null&&h!=null)l=h,u=Math.ceil(s/l);else if(l*u>s){var g=c(),p=f();(g-1)*p>=s?c(g-1):(p-1)*g>=s&&f(p-1)}else for(;l*u<s;){var v=c(),m=f();(m+1)*v>=s?f(m+1):c(v+1)}var y=a.w/l,b=a.h/u;if(t.condense&&(y=0,b=0),t.avoidOverlap)for(var w=0;w<i.length;w++){var E=i[w],F=E._private.position;(F.x==null||F.y==null)&&(F.x=0,F.y=0);var x=E.layoutDimensions(t),C=t.avoidOverlapPadding,S=x.w+C,_=x.h+C;y=Math.max(y,S),b=Math.max(b,_)}for(var k={},T=function(J,X){return!!k["c-"+J+"-"+X]},A=function(J,X){k["c-"+J+"-"+X]=!0},$=0,M=0,D=function(){M++,M>=l&&(M=0,$++)},P={},N=0;N<i.length;N++){var O=i[N],q=t.position(O);if(q&&(q.row!==void 0||q.col!==void 0)){var z={row:q.row,col:q.col};if(z.col===void 0)for(z.col=0;T(z.row,z.col);)z.col++;else if(z.row===void 0)for(z.row=0;T(z.row,z.col);)z.row++;P[O.id()]=z,A(z.row,z.col)}}var W=function(J,X){var te,ie;if(J.locked()||J.isParent())return!1;var se=P[J.id()];if(se)te=se.col*y+y/2+a.x1,ie=se.row*b+b/2+a.y1;else{for(;T($,M);)D();te=M*y+y/2+a.x1,ie=$*b+b/2+a.y1,A($,M),D()}return{x:te,y:ie}};i.layoutPositions(this,t,W)}return this};var uG={ready:function(){},stop:function(){}};function P2(e){this.options=Ie({},uG,e)}P2.prototype.run=function(){var e=this.options,t=e.eles,n=this;return e.cy,n.emit("layoutstart"),t.nodes().positions(function(){return{x:0,y:0}}),n.one("layoutready",e.ready),n.emit("layoutready"),n.one("layoutstop",e.stop),n.emit("layoutstop"),this},P2.prototype.stop=function(){return this};var lG={positions:void 0,zoom:void 0,pan:void 0,fit:!0,padding:30,spacingFactor:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function N$(e){this.options=Ie({},lG,e)}N$.prototype.run=function(){var e=this.options,t=e.eles,n=t.nodes(),r=Lt(e.positions);function i(a){if(e.positions==null)return RV(a.position());if(r)return e.positions(a);var s=e.positions[a._private.data.id];return s??null}return n.layoutPositions(this,e,function(a,s){var o=i(a);return a.locked()||o==null?!1:o}),this};var cG={fit:!0,padding:30,boundingBox:void 0,animate:!1,animationDuration:500,animationEasing:void 0,animateFilter:function(t,n){return!0},ready:void 0,stop:void 0,transform:function(t,n){return n}};function O$(e){this.options=Ie({},cG,e)}O$.prototype.run=function(){var e=this.options,t=e.cy,n=e.eles,r=Rr(e.boundingBox?e.boundingBox:{x1:0,y1:0,w:t.width(),h:t.height()}),i=function(s,o){return{x:r.x1+Math.round(Math.random()*r.w),y:r.y1+Math.round(Math.random()*r.h)}};return n.nodes().layoutPositions(this,e,i),this};var fG=[{name:"breadthfirst",impl:k$},{name:"circle",impl:_$},{name:"concentric",impl:A$},{name:"cose",impl:Bp},{name:"grid",impl:P$},{name:"null",impl:P2},{name:"preset",impl:N$},{name:"random",impl:O$}];function I$(e){this.options=e,this.notifications=0}var B$=function(){},L$=function(){throw new Error("A headless instance can not render images")};I$.prototype={recalculateRenderedStyle:B$,notify:function(){this.notifications++},init:B$,isHeadless:function(){return!0},png:L$,jpg:L$};var N2={};N2.arrowShapeWidth=.3,N2.registerArrowShapes=function(){var e=this.arrowShapes={},t=this,n=function(l,c,f,d,h,g,p){var v=h.x-f/2-p,m=h.x+f/2+p,y=h.y-f/2-p,b=h.y+f/2+p,w=v<=l&&l<=m&&y<=c&&c<=b;return w},r=function(l,c,f,d,h){var g=l*Math.cos(d)-c*Math.sin(d),p=l*Math.sin(d)+c*Math.cos(d),v=g*f,m=p*f,y=v+h.x,b=m+h.y;return{x:y,y:b}},i=function(l,c,f,d){for(var h=[],g=0;g<l.length;g+=2){var p=l[g],v=l[g+1];h.push(r(p,v,c,f,d))}return h},a=function(l){for(var c=[],f=0;f<l.length;f++){var d=l[f];c.push(d.x,d.y)}return c},s=function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").pfValue*2},o=function(l,c){Me(c)&&(c=e[c]),e[l]=Ie({name:l,points:[-.15,-.3,.15,-.3,.15,.3,-.15,.3],collide:function(d,h,g,p,v,m){var y=a(i(this.points,g+2*m,p,v)),b=Pr(d,h,y);return b},roughCollide:n,draw:function(d,h,g,p){var v=i(this.points,h,g,p);t.arrowShapeImpl("polygon")(d,v)},spacing:function(d){return 0},gap:s},c)};o("none",{collide:rp,roughCollide:rp,draw:sb,spacing:nT,gap:nT}),o("triangle",{points:[-.15,-.3,0,0,.15,-.3]}),o("arrow","triangle"),o("triangle-backcurve",{points:e.triangle.points,controlPoint:[0,-.15],roughCollide:n,draw:function(l,c,f,d,h){var g=i(this.points,c,f,d),p=this.controlPoint,v=r(p[0],p[1],c,f,d);t.arrowShapeImpl(this.name)(l,g,v)},gap:function(l){return s(l)*.8}}),o("triangle-tee",{points:[0,0,.15,-.3,-.15,-.3,0,0],pointsTee:[-.15,-.4,-.15,-.5,.15,-.5,.15,-.4],collide:function(l,c,f,d,h,g,p){var v=a(i(this.points,f+2*p,d,h)),m=a(i(this.pointsTee,f+2*p,d,h)),y=Pr(l,c,v)||Pr(l,c,m);return y},draw:function(l,c,f,d,h){var g=i(this.points,c,f,d),p=i(this.pointsTee,c,f,d);t.arrowShapeImpl(this.name)(l,g,p)}}),o("circle-triangle",{radius:.15,pointsTr:[0,-.15,.15,-.45,-.15,-.45,0,-.15],collide:function(l,c,f,d,h,g,p){var v=h,m=Math.pow(v.x-l,2)+Math.pow(v.y-c,2)<=Math.pow((f+2*p)*this.radius,2),y=a(i(this.points,f+2*p,d,h));return Pr(l,c,y)||m},draw:function(l,c,f,d,h){var g=i(this.pointsTr,c,f,d);t.arrowShapeImpl(this.name)(l,g,d.x,d.y,this.radius*c)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),o("triangle-cross",{points:[0,0,.15,-.3,-.15,-.3,0,0],baseCrossLinePts:[-.15,-.4,-.15,-.4,.15,-.4,.15,-.4],crossLinePts:function(l,c){var f=this.baseCrossLinePts.slice(),d=c/l,h=3,g=5;return f[h]=f[h]-d,f[g]=f[g]-d,f},collide:function(l,c,f,d,h,g,p){var v=a(i(this.points,f+2*p,d,h)),m=a(i(this.crossLinePts(f,g),f+2*p,d,h)),y=Pr(l,c,v)||Pr(l,c,m);return y},draw:function(l,c,f,d,h){var g=i(this.points,c,f,d),p=i(this.crossLinePts(c,h),c,f,d);t.arrowShapeImpl(this.name)(l,g,p)}}),o("vee",{points:[-.15,-.3,0,0,.15,-.3,0,-.15],gap:function(l){return s(l)*.525}}),o("circle",{radius:.15,collide:function(l,c,f,d,h,g,p){var v=h,m=Math.pow(v.x-l,2)+Math.pow(v.y-c,2)<=Math.pow((f+2*p)*this.radius,2);return m},draw:function(l,c,f,d,h){t.arrowShapeImpl(this.name)(l,d.x,d.y,this.radius*c)},spacing:function(l){return t.getArrowWidth(l.pstyle("width").pfValue,l.pstyle("arrow-scale").value)*this.radius}}),o("tee",{points:[-.15,0,-.15,-.1,.15,-.1,.15,0],spacing:function(l){return 1},gap:function(l){return 1}}),o("square",{points:[-.15,0,.15,0,.15,-.3,-.15,-.3]}),o("diamond",{points:[-.15,-.15,0,-.3,.15,-.15,0,0],gap:function(l){return l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}}),o("chevron",{points:[0,0,-.15,-.15,-.1,-.2,0,-.1,.1,-.2,.15,-.15],gap:function(l){return .95*l.pstyle("width").pfValue*l.pstyle("arrow-scale").value}})};var wu={};wu.projectIntoViewport=function(e,t){var n=this.cy,r=this.findContainerClientCoords(),i=r[0],a=r[1],s=r[4],o=n.pan(),u=n.zoom(),l=((e-i)/s-o.x)/u,c=((t-a)/s-o.y)/u;return[l,c]},wu.findContainerClientCoords=function(){if(this.containerBB)return this.containerBB;var e=this.container,t=e.getBoundingClientRect(),n=this.cy.window().getComputedStyle(e),r=function(m){return parseFloat(n.getPropertyValue(m))},i={left:r("padding-left"),right:r("padding-right"),top:r("padding-top"),bottom:r("padding-bottom")},a={left:r("border-left-width"),right:r("border-right-width"),top:r("border-top-width"),bottom:r("border-bottom-width")},s=e.clientWidth,o=e.clientHeight,u=i.left+i.right,l=i.top+i.bottom,c=a.left+a.right,f=t.width/(s+c),d=s-u,h=o-l,g=t.left+i.left+a.left,p=t.top+i.top+a.top;return this.containerBB=[g,p,d,h,f]},wu.invalidateContainerClientCoordsCache=function(){this.containerBB=null},wu.findNearestElement=function(e,t,n,r){return this.findNearestElements(e,t,n,r)[0]},wu.findNearestElements=function(e,t,n,r){var i=this,a=this,s=a.getCachedZSortedEles(),o=[],u=a.cy.zoom(),l=a.cy.hasCompoundNodes(),c=(r?24:8)/u,f=(r?8:2)/u,d=(r?8:2)/u,h=1/0,g,p;n&&(s=s.interactive);function v(x,C){if(x.isNode()){if(p)return;p=x,o.push(x)}if(x.isEdge()&&(C==null||C<h))if(g){if(g.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value&&g.pstyle("z-compound-depth").value===x.pstyle("z-compound-depth").value){for(var S=0;S<o.length;S++)if(o[S].isEdge()){o[S]=x,g=x,h=C??h;break}}}else o.push(x),g=x,h=C??h}function m(x){var C=x.outerWidth()+2*f,S=x.outerHeight()+2*f,_=C/2,k=S/2,T=x.position(),A=x.pstyle("corner-radius").value==="auto"?"auto":x.pstyle("corner-radius").pfValue,$=x._private.rscratch;if(T.x-_<=e&&e<=T.x+_&&T.y-k<=t&&t<=T.y+k){var M=a.nodeShapes[i.getNodeShape(x)];if(M.checkPoint(e,t,0,C,S,T.x,T.y,A,$))return v(x,0),!0}}function y(x){var C=x._private,S=C.rscratch,_=x.pstyle("width").pfValue,k=x.pstyle("arrow-scale").value,T=_/2+c,A=T*T,$=T*2,N=C.source,O=C.target,M;if(S.edgeType==="segments"||S.edgeType==="straight"||S.edgeType==="haystack"){for(var D=S.allpts,P=0;P+3<D.length;P+=2)if(jV(e,t,D[P],D[P+1],D[P+2],D[P+3],$)&&A>(M=ZV(e,t,D[P],D[P+1],D[P+2],D[P+3])))return v(x,M),!0}else if(S.edgeType==="bezier"||S.edgeType==="multibezier"||S.edgeType==="self"||S.edgeType==="compound"){for(var D=S.allpts,P=0;P+5<S.allpts.length;P+=4)if(GV(e,t,D[P],D[P+1],D[P+2],D[P+3],D[P+4],D[P+5],$)&&A>(M=KV(e,t,D[P],D[P+1],D[P+2],D[P+3],D[P+4],D[P+5])))return v(x,M),!0}for(var N=N||C.source,O=O||C.target,q=i.getArrowWidth(_,k),z=[{name:"source",x:S.arrowStartX,y:S.arrowStartY,angle:S.srcArrowAngle},{name:"target",x:S.arrowEndX,y:S.arrowEndY,angle:S.tgtArrowAngle},{name:"mid-source",x:S.midX,y:S.midY,angle:S.midsrcArrowAngle},{name:"mid-target",x:S.midX,y:S.midY,angle:S.midtgtArrowAngle}],P=0;P<z.length;P++){var W=z[P],Y=a.arrowShapes[x.pstyle(W.name+"-arrow-shape").value],J=x.pstyle("width").pfValue;if(Y.roughCollide(e,t,q,W.angle,{x:W.x,y:W.y},J,c)&&Y.collide(e,t,q,W.angle,{x:W.x,y:W.y},J,c))return v(x),!0}l&&o.length>0&&(m(N),m(O))}function b(x,C,S){return ui(x,C,S)}function w(x,C){var S=x._private,_=d,k;C?k=C+"-":k="",x.boundingBox();var T=S.labelBounds[C||"main"],A=x.pstyle(k+"label").value,$=x.pstyle("text-events").strValue==="yes";if(!(!$||!A)){var M=b(S.rscratch,"labelX",C),D=b(S.rscratch,"labelY",C),P=b(S.rscratch,"labelAngle",C),N=x.pstyle(k+"text-margin-x").pfValue,O=x.pstyle(k+"text-margin-y").pfValue,q=T.x1-_-N,z=T.x2+_-N,W=T.y1-_-O,Y=T.y2+_-O;if(P){var J=Math.cos(P),X=Math.sin(P),te=function(ae,de){return ae=ae-M,de=de-D,{x:ae*J-de*X+M,y:ae*X+de*J+D}},ie=te(q,W),se=te(q,Y),B=te(z,W),I=te(z,Y),U=[ie.x+N,ie.y+O,B.x+N,B.y+O,I.x+N,I.y+O,se.x+N,se.y+O];if(Pr(e,t,U))return v(x),!0}else if(Xl(T,e,t))return v(x),!0}}for(var E=s.length-1;E>=0;E--){var F=s[E];F.isNode()?m(F)||w(F):y(F)||w(F)||w(F,"source")||w(F,"target")}return o},wu.getAllInBox=function(e,t,n,r){var i=this.getCachedZSortedEles().interactive,a=[],s=Math.min(e,n),o=Math.max(e,n),u=Math.min(t,r),l=Math.max(t,r);e=s,n=o,t=u,r=l;for(var c=Rr({x1:e,y1:t,x2:n,y2:r}),f=0;f<i.length;f++){var d=i[f];if(d.isNode()){var h=d,g=h.boundingBox({includeNodes:!0,includeEdges:!1,includeLabels:!1});fb(c,g)&&!hT(g,c)&&a.push(h)}else{var p=d,v=p._private,m=v.rscratch;if(m.startX!=null&&m.startY!=null&&!Xl(c,m.startX,m.startY)||m.endX!=null&&m.endY!=null&&!Xl(c,m.endX,m.endY))continue;if(m.edgeType==="bezier"||m.edgeType==="multibezier"||m.edgeType==="self"||m.edgeType==="compound"||m.edgeType==="segments"||m.edgeType==="haystack"){for(var y=v.rstyle.bezierPts||v.rstyle.linePts||v.rstyle.haystackPts,b=!0,w=0;w<y.length;w++)if(!HV(c,y[w])){b=!1;break}b&&a.push(p)}else(m.edgeType==="haystack"||m.edgeType==="straight")&&a.push(p)}}return a};var zp={};zp.calculateArrowAngles=function(e){var t=e._private.rscratch,n=t.edgeType==="haystack",r=t.edgeType==="bezier",i=t.edgeType==="multibezier",a=t.edgeType==="segments",s=t.edgeType==="compound",o=t.edgeType==="self",u,l,c,f,d,h,m,y;if(n?(c=t.haystackPts[0],f=t.haystackPts[1],d=t.haystackPts[2],h=t.haystackPts[3]):(c=t.arrowStartX,f=t.arrowStartY,d=t.arrowEndX,h=t.arrowEndY),m=t.midX,y=t.midY,a)u=c-t.segpts[0],l=f-t.segpts[1];else if(i||s||o||r){var g=t.allpts,p=vn(g[0],g[2],g[4],.1),v=vn(g[1],g[3],g[5],.1);u=c-p,l=f-v}else u=c-m,l=f-y;t.srcArrowAngle=op(u,l);var m=t.midX,y=t.midY;if(n&&(m=(c+d)/2,y=(f+h)/2),u=d-c,l=h-f,a){var g=t.allpts;if(g.length/2%2===0){var b=g.length/2,w=b-2;u=g[b]-g[w],l=g[b+1]-g[w+1]}else if(t.isRound)u=t.midVector[1],l=-t.midVector[0];else{var b=g.length/2-1,w=b-2;u=g[b]-g[w],l=g[b+1]-g[w+1]}}else if(i||s||o){var g=t.allpts,E=t.ctrlpts,F,x,C,S;if(E.length/2%2===0){var _=g.length/2-1,k=_+2,T=k+2;F=vn(g[_],g[k],g[T],0),x=vn(g[_+1],g[k+1],g[T+1],0),C=vn(g[_],g[k],g[T],1e-4),S=vn(g[_+1],g[k+1],g[T+1],1e-4)}else{var k=g.length/2-1,_=k-2,T=k+2;F=vn(g[_],g[k],g[T],.4999),x=vn(g[_+1],g[k+1],g[T+1],.4999),C=vn(g[_],g[k],g[T],.5),S=vn(g[_+1],g[k+1],g[T+1],.5)}u=C-F,l=S-x}if(t.midtgtArrowAngle=op(u,l),t.midDispX=u,t.midDispY=l,u*=-1,l*=-1,a){var g=t.allpts;if(g.length/2%2!==0){if(!t.isRound){var b=g.length/2-1,A=b+2;u=-(g[A]-g[b]),l=-(g[A+1]-g[b+1])}}}if(t.midsrcArrowAngle=op(u,l),a)u=d-t.segpts[t.segpts.length-2],l=h-t.segpts[t.segpts.length-1];else if(i||s||o||r){var g=t.allpts,$=g.length,p=vn(g[$-6],g[$-4],g[$-2],.9),v=vn(g[$-5],g[$-3],g[$-1],.9);u=d-p,l=h-v}else u=d-m,l=h-y;t.tgtArrowAngle=op(u,l)},zp.getArrowWidth=zp.getArrowHeight=function(e,t){var n=this.arrowWidthCache=this.arrowWidthCache||{},r=n[e+", "+t];return r||(r=Math.max(Math.pow(e*13.37,.9),29)*t,n[e+", "+t]=r,r)};var O2,I2,va={},fi={},z$,q$,xu,qp,cs,Eu,Fu,ma,lc,Up,U$,V$,B2,L2,W$,H$=function(t,n,r){r.x=n.x-t.x,r.y=n.y-t.y,r.len=Math.sqrt(r.x*r.x+r.y*r.y),r.nx=r.x/r.len,r.ny=r.y/r.len,r.ang=Math.atan2(r.ny,r.nx)},dG=function(t,n){n.x=t.x*-1,n.y=t.y*-1,n.nx=t.nx*-1,n.ny=t.ny*-1,n.ang=t.ang>0?-(Math.PI-t.ang):Math.PI+t.ang},hG=function(t,n,r,i,a){if(t!==W$?H$(n,t,va):dG(fi,va),H$(n,r,fi),z$=va.nx*fi.ny-va.ny*fi.nx,q$=va.nx*fi.nx-va.ny*-fi.ny,cs=Math.asin(Math.max(-1,Math.min(1,z$))),Math.abs(cs)<1e-6){O2=n.x,I2=n.y,Fu=lc=0;return}xu=1,qp=!1,q$<0?cs<0?cs=Math.PI+cs:(cs=Math.PI-cs,xu=-1,qp=!0):cs>0&&(xu=-1,qp=!0),n.radius!==void 0?lc=n.radius:lc=i,Eu=cs/2,Up=Math.min(va.len/2,fi.len/2),a?(ma=Math.abs(Math.cos(Eu)*lc/Math.sin(Eu)),ma>Up?(ma=Up,Fu=Math.abs(ma*Math.sin(Eu)/Math.cos(Eu))):Fu=lc):(ma=Math.min(Up,lc),Fu=Math.abs(ma*Math.sin(Eu)/Math.cos(Eu))),B2=n.x+fi.nx*ma,L2=n.y+fi.ny*ma,O2=B2-fi.ny*Fu*xu,I2=L2+fi.nx*Fu*xu,U$=n.x+va.nx*ma,V$=n.y+va.ny*ma,W$=n};function j$(e,t){t.radius===0?e.lineTo(t.cx,t.cy):e.arc(t.cx,t.cy,t.radius,t.startAngle,t.endAngle,t.counterClockwise)}function z2(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;return r===0||t.radius===0?{cx:t.x,cy:t.y,radius:0,startX:t.x,startY:t.y,stopX:t.x,stopY:t.y,startAngle:void 0,endAngle:void 0,counterClockwise:void 0}:(hG(e,t,n,r,i),{cx:O2,cy:I2,radius:Fu,startX:U$,startY:V$,stopX:B2,stopY:L2,startAngle:va.ang+Math.PI/2*xu,endAngle:fi.ang-Math.PI/2*xu,counterClockwise:qp})}var vd=.01,gG=Math.sqrt(2*vd),Xn={};Xn.findMidptPtsEtc=function(e,t){var n=t.posPts,r=t.intersectionPts,i=t.vectorNormInverse,a,s=e.pstyle("source-endpoint"),o=e.pstyle("target-endpoint"),u=s.units!=null&&o.units!=null,l=function(E,F,x,C){var S=C-F,_=x-E,k=Math.sqrt(_*_+S*S);return{x:-S/k,y:_/k}},c=e.pstyle("edge-distances").value;switch(c){case"node-position":a=n;break;case"intersection":a=r;break;case"endpoints":{if(u){var f=this.manualEndptToPx(e.source()[0],s),d=pn(f,2),h=d[0],g=d[1],p=this.manualEndptToPx(e.target()[0],o),v=pn(p,2),m=v[0],y=v[1],b={x1:h,y1:g,x2:m,y2:y};i=l(h,g,m,y),a=b}else gt("Edge ".concat(e.id()," has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint.  Falling back on edge-distances:intersection (default).")),a=r;break}}return{midptPts:a,vectorNormInverse:i}},Xn.findHaystackPoints=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=n._private,i=r.rscratch;if(!i.haystack){var a=Math.random()*2*Math.PI;i.source={x:Math.cos(a),y:Math.sin(a)},a=Math.random()*2*Math.PI,i.target={x:Math.cos(a),y:Math.sin(a)}}var s=r.source,o=r.target,u=s.position(),l=o.position(),c=s.width(),f=o.width(),d=s.height(),h=o.height(),g=n.pstyle("haystack-radius").value,p=g/2;i.haystackPts=i.allpts=[i.source.x*c*p+u.x,i.source.y*d*p+u.y,i.target.x*f*p+l.x,i.target.y*h*p+l.y],i.midX=(i.allpts[0]+i.allpts[2])/2,i.midY=(i.allpts[1]+i.allpts[3])/2,i.edgeType="haystack",i.haystack=!0,this.storeEdgeProjections(n),this.calculateArrowAngles(n),this.recalculateEdgeLabelProjections(n),this.calculateLabelAngles(n)}},Xn.findSegmentsPoints=function(e,t){var n=e._private.rscratch,r=e.pstyle("segment-weights"),i=e.pstyle("segment-distances"),a=e.pstyle("segment-radii"),s=e.pstyle("radius-type"),o=Math.min(r.pfValue.length,i.pfValue.length),u=a.pfValue[a.pfValue.length-1],l=s.pfValue[s.pfValue.length-1];n.edgeType="segments",n.segpts=[],n.radii=[],n.isArcRadius=[];for(var c=0;c<o;c++){var f=r.pfValue[c],d=i.pfValue[c],h=1-f,g=f,p=this.findMidptPtsEtc(e,t),v=p.midptPts,m=p.vectorNormInverse,y={x:v.x1*h+v.x2*g,y:v.y1*h+v.y2*g};n.segpts.push(y.x+m.x*d,y.y+m.y*d),n.radii.push(a.pfValue[c]!==void 0?a.pfValue[c]:u),n.isArcRadius.push((s.pfValue[c]!==void 0?s.pfValue[c]:l)==="arc-radius")}},Xn.findLoopPoints=function(e,t,n,r){var i=e._private.rscratch,a=t.dirCounts,s=t.srcPos,o=e.pstyle("control-point-distances"),u=o?o.pfValue[0]:void 0,l=e.pstyle("loop-direction").pfValue,c=e.pstyle("loop-sweep").pfValue,f=e.pstyle("control-point-step-size").pfValue;i.edgeType="self";var d=n,h=f;r&&(d=0,h=u);var g=l-Math.PI/2,p=g-c/2,v=g+c/2,m=l+"_"+c;d=a[m]===void 0?a[m]=0:++a[m],i.ctrlpts=[s.x+Math.cos(p)*1.4*h*(d/3+1),s.y+Math.sin(p)*1.4*h*(d/3+1),s.x+Math.cos(v)*1.4*h*(d/3+1),s.y+Math.sin(v)*1.4*h*(d/3+1)]},Xn.findCompoundLoopPoints=function(e,t,n,r){var i=e._private.rscratch;i.edgeType="compound";var a=t.srcPos,s=t.tgtPos,o=t.srcW,u=t.srcH,l=t.tgtW,c=t.tgtH,f=e.pstyle("control-point-step-size").pfValue,d=e.pstyle("control-point-distances"),h=d?d.pfValue[0]:void 0,g=n,p=f;r&&(g=0,p=h);var v=50,m={x:a.x-o/2,y:a.y-u/2},y={x:s.x-l/2,y:s.y-c/2},b={x:Math.min(m.x,y.x),y:Math.min(m.y,y.y)},w=.5,E=Math.max(w,Math.log(o*vd)),F=Math.max(w,Math.log(l*vd));i.ctrlpts=[b.x,b.y-(1+Math.pow(v,1.12)/100)*p*(g/3+1)*E,b.x-(1+Math.pow(v,1.12)/100)*p*(g/3+1)*F,b.y]},Xn.findStraightEdgePoints=function(e){e._private.rscratch.edgeType="straight"},Xn.findBezierPoints=function(e,t,n,r,i){var a=e._private.rscratch,s=e.pstyle("control-point-step-size").pfValue,o=e.pstyle("control-point-distances"),u=e.pstyle("control-point-weights"),l=o&&u?Math.min(o.value.length,u.value.length):1,c=o?o.pfValue[0]:void 0,f=u.value[0],d=r;a.edgeType=d?"multibezier":"bezier",a.ctrlpts=[];for(var h=0;h<l;h++){var g=(.5-t.eles.length/2+n)*s*(i?-1:1),p=void 0,v=cT(g);d&&(c=o?o.pfValue[h]:s,f=u.value[h]),r?p=c:p=c!==void 0?v*c:void 0;var m=p!==void 0?p:g,y=1-f,b=f,w=this.findMidptPtsEtc(e,t),E=w.midptPts,F=w.vectorNormInverse,x={x:E.x1*y+E.x2*b,y:E.y1*y+E.y2*b};a.ctrlpts.push(x.x+F.x*m,x.y+F.y*m)}},Xn.findTaxiPoints=function(e,t){var n=e._private.rscratch;n.edgeType="segments";var r="vertical",i="horizontal",a="leftward",s="rightward",o="downward",u="upward",l="auto",c=t.posPts,f=t.srcW,d=t.srcH,h=t.tgtW,g=t.tgtH,p=e.pstyle("edge-distances").value,v=p!=="node-position",m=e.pstyle("taxi-direction").value,y=m,b=e.pstyle("taxi-turn"),w=b.units==="%",E=b.pfValue,F=E<0,x=e.pstyle("taxi-turn-min-distance").pfValue,C=v?(f+h)/2:0,S=v?(d+g)/2:0,_=c.x2-c.x1,k=c.y2-c.y1,T=function(ne,ye){return ne>0?Math.max(ne-ye,0):Math.min(ne+ye,0)},A=T(_,C),$=T(k,S),M=!1;y===l?m=Math.abs(A)>Math.abs($)?i:r:y===u||y===o?(m=r,M=!0):(y===a||y===s)&&(m=i,M=!0);var D=m===r,P=D?$:A,N=D?k:_,O=cT(N),q=!1;!(M&&(w||F))&&(y===o&&N<0||y===u&&N>0||y===a&&N>0||y===s&&N<0)&&(O*=-1,P=O*Math.abs(P),q=!0);var z;if(w){var W=E<0?1+E:E;z=W*P}else{var Y=E<0?P:0;z=Y+E*O}var J=function(ne){return Math.abs(ne)<x||Math.abs(ne)>=Math.abs(P)},X=J(z),te=J(Math.abs(P)-Math.abs(z)),ie=X||te;if(ie&&!q)if(D){var se=Math.abs(N)<=d/2,B=Math.abs(_)<=h/2;if(se){var I=(c.x1+c.x2)/2,U=c.y1,L=c.y2;n.segpts=[I,U,I,L]}else if(B){var ae=(c.y1+c.y2)/2,de=c.x1,Ce=c.x2;n.segpts=[de,ae,Ce,ae]}else n.segpts=[c.x1,c.y2]}else{var Ye=Math.abs(N)<=f/2,Qe=Math.abs(k)<=g/2;if(Ye){var Fe=(c.y1+c.y2)/2,ke=c.x1,Be=c.x2;n.segpts=[ke,Fe,Be,Fe]}else if(Qe){var Ue=(c.x1+c.x2)/2,Le=c.y1,Ve=c.y2;n.segpts=[Ue,Le,Ue,Ve]}else n.segpts=[c.x2,c.y1]}else if(D){var Xe=c.y1+z+(v?d/2*O:0),nt=c.x1,oe=c.x2;n.segpts=[nt,Xe,oe,Xe]}else{var R=c.x1+z+(v?f/2*O:0),H=c.y1,K=c.y2;n.segpts=[R,H,R,K]}if(n.isRound){var V=e.pstyle("taxi-radius").value,j=e.pstyle("radius-type").value[0]==="arc-radius";n.radii=new Array(n.segpts.length/2).fill(V),n.isArcRadius=new Array(n.segpts.length/2).fill(j)}},Xn.tryToCorrectInvalidPoints=function(e,t){var n=e._private.rscratch;if(n.edgeType==="bezier"){var r=t.srcPos,i=t.tgtPos,a=t.srcW,s=t.srcH,o=t.tgtW,u=t.tgtH,l=t.srcShape,c=t.tgtShape,f=t.srcCornerRadius,d=t.tgtCornerRadius,h=t.srcRs,g=t.tgtRs,p=!ve(n.startX)||!ve(n.startY),v=!ve(n.arrowStartX)||!ve(n.arrowStartY),m=!ve(n.endX)||!ve(n.endY),y=!ve(n.arrowEndX)||!ve(n.arrowEndY),b=3,w=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth,E=b*w,F=hu({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.startX,y:n.startY}),x=F<E,C=hu({x:n.ctrlpts[0],y:n.ctrlpts[1]},{x:n.endX,y:n.endY}),S=C<E,_=!1;if(p||v||x){_=!0;var k={x:n.ctrlpts[0]-r.x,y:n.ctrlpts[1]-r.y},T=Math.sqrt(k.x*k.x+k.y*k.y),A={x:k.x/T,y:k.y/T},$=Math.max(a,s),M={x:n.ctrlpts[0]+A.x*2*$,y:n.ctrlpts[1]+A.y*2*$},D=l.intersectLine(r.x,r.y,a,s,M.x,M.y,0,f,h);x?(n.ctrlpts[0]=n.ctrlpts[0]+A.x*(E-F),n.ctrlpts[1]=n.ctrlpts[1]+A.y*(E-F)):(n.ctrlpts[0]=D[0]+A.x*E,n.ctrlpts[1]=D[1]+A.y*E)}if(m||y||S){_=!0;var P={x:n.ctrlpts[0]-i.x,y:n.ctrlpts[1]-i.y},N=Math.sqrt(P.x*P.x+P.y*P.y),O={x:P.x/N,y:P.y/N},q=Math.max(a,s),z={x:n.ctrlpts[0]+O.x*2*q,y:n.ctrlpts[1]+O.y*2*q},W=c.intersectLine(i.x,i.y,o,u,z.x,z.y,0,d,g);S?(n.ctrlpts[0]=n.ctrlpts[0]+O.x*(E-C),n.ctrlpts[1]=n.ctrlpts[1]+O.y*(E-C)):(n.ctrlpts[0]=W[0]+O.x*E,n.ctrlpts[1]=W[1]+O.y*E)}_&&this.findEndpoints(e)}},Xn.storeAllpts=function(e){var t=e._private.rscratch;if(t.edgeType==="multibezier"||t.edgeType==="bezier"||t.edgeType==="self"||t.edgeType==="compound"){t.allpts=[],t.allpts.push(t.startX,t.startY);for(var n=0;n+1<t.ctrlpts.length;n+=2)t.allpts.push(t.ctrlpts[n],t.ctrlpts[n+1]),n+3<t.ctrlpts.length&&t.allpts.push((t.ctrlpts[n]+t.ctrlpts[n+2])/2,(t.ctrlpts[n+1]+t.ctrlpts[n+3])/2);t.allpts.push(t.endX,t.endY);var r,i;t.ctrlpts.length/2%2===0?(r=t.allpts.length/2-1,t.midX=t.allpts[r],t.midY=t.allpts[r+1]):(r=t.allpts.length/2-3,i=.5,t.midX=vn(t.allpts[r],t.allpts[r+2],t.allpts[r+4],i),t.midY=vn(t.allpts[r+1],t.allpts[r+3],t.allpts[r+5],i))}else if(t.edgeType==="straight")t.allpts=[t.startX,t.startY,t.endX,t.endY],t.midX=(t.startX+t.endX+t.arrowStartX+t.arrowEndX)/4,t.midY=(t.startY+t.endY+t.arrowStartY+t.arrowEndY)/4;else if(t.edgeType==="segments"){if(t.allpts=[],t.allpts.push(t.startX,t.startY),t.allpts.push.apply(t.allpts,t.segpts),t.allpts.push(t.endX,t.endY),t.isRound){t.roundCorners=[];for(var a=2;a+3<t.allpts.length;a+=2){var s=t.radii[a/2-1],o=t.isArcRadius[a/2-1];t.roundCorners.push(z2({x:t.allpts[a-2],y:t.allpts[a-1]},{x:t.allpts[a],y:t.allpts[a+1],radius:s},{x:t.allpts[a+2],y:t.allpts[a+3]},s,o))}}if(t.segpts.length%4===0){var u=t.segpts.length/2,l=u-2;t.midX=(t.segpts[l]+t.segpts[u])/2,t.midY=(t.segpts[l+1]+t.segpts[u+1])/2}else{var c=t.segpts.length/2-1;if(!t.isRound)t.midX=t.segpts[c],t.midY=t.segpts[c+1];else{var f={x:t.segpts[c],y:t.segpts[c+1]},d=t.roundCorners[c/2];if(d.radius===0){var h={x:t.segpts[c+2],y:t.segpts[c+3]};t.midX=f.x,t.midY=f.y,t.midVector=[f.y-h.y,h.x-f.x]}else{var g=[f.x-d.cx,f.y-d.cy],p=d.radius/Math.sqrt(Math.pow(g[0],2)+Math.pow(g[1],2));g=g.map(function(v){return v*p}),t.midX=d.cx+g[0],t.midY=d.cy+g[1],t.midVector=g}}}}},Xn.checkForInvalidEdgeWarning=function(e){var t=e[0]._private.rscratch;t.nodesOverlap||ve(t.startX)&&ve(t.startY)&&ve(t.endX)&&ve(t.endY)?t.loggedErr=!1:t.loggedErr||(t.loggedErr=!0,gt("Edge `"+e.id()+"` has invalid endpoints and so it is impossible to draw.  Adjust your edge style (e.g. control points) accordingly or use an alternative edge type.  This is expected behaviour when the source node and the target node overlap."))},Xn.findEdgeControlPoints=function(e){var t=this;if(!(!e||e.length===0)){for(var n=this,r=n.cy,i=r.hasCompoundNodes(),a=new us,s=function(S,_){return[].concat(EA(S),[_?1:0]).join("-")},o=[],u=[],l=0;l<e.length;l++){var c=e[l],f=c._private,d=c.pstyle("curve-style").value;if(!(c.removed()||!c.takesUpSpace())){if(d==="haystack"){u.push(c);continue}var h=d==="unbundled-bezier"||d.endsWith("segments")||d==="straight"||d==="straight-triangle"||d.endsWith("taxi"),g=d==="unbundled-bezier"||d==="bezier",p=f.source,v=f.target,m=p.poolIndex(),y=v.poolIndex(),b=[m,y].sort(),w=s(b,h),E=a.get(w);E==null&&(E={eles:[]},o.push({pairId:b,edgeIsUnbundled:h}),a.set(w,E)),E.eles.push(c),h&&(E.hasUnbundled=!0),g&&(E.hasBezier=!0)}}for(var F=function(){var S=o[x],_=S.pairId,k=S.edgeIsUnbundled,T=s(_,k),A=a.get(T),$;if(!A.hasUnbundled){var M=A.eles[0].parallelEdges().filter(function(j){return j.isBundledBezier()});ob(A.eles),M.forEach(function(j){return A.eles.push(j)}),A.eles.sort(function(j,me){return j.poolIndex()-me.poolIndex()})}var D=A.eles[0],P=D.source(),N=D.target();if(P.poolIndex()>N.poolIndex()){var O=P;P=N,N=O}var q=A.srcPos=P.position(),z=A.tgtPos=N.position(),W=A.srcW=P.outerWidth(),Y=A.srcH=P.outerHeight(),J=A.tgtW=N.outerWidth(),X=A.tgtH=N.outerHeight(),te=A.srcShape=n.nodeShapes[t.getNodeShape(P)],ie=A.tgtShape=n.nodeShapes[t.getNodeShape(N)],se=A.srcCornerRadius=P.pstyle("corner-radius").value==="auto"?"auto":P.pstyle("corner-radius").pfValue,B=A.tgtCornerRadius=N.pstyle("corner-radius").value==="auto"?"auto":N.pstyle("corner-radius").pfValue,I=A.tgtRs=N._private.rscratch,U=A.srcRs=P._private.rscratch;A.dirCounts={north:0,west:0,south:0,east:0,northwest:0,southwest:0,northeast:0,southeast:0};for(var L=0;L<A.eles.length;L++){var ae=A.eles[L],de=ae[0]._private.rscratch,Ce=ae.pstyle("curve-style").value,Ye=Ce==="unbundled-bezier"||Ce.endsWith("segments")||Ce.endsWith("taxi"),Qe=!P.same(ae.source());if(!A.calculatedIntersection&&P!==N&&(A.hasBezier||A.hasUnbundled)){A.calculatedIntersection=!0;var Fe=te.intersectLine(q.x,q.y,W,Y,z.x,z.y,0,se,U),ke=A.srcIntn=Fe,Be=ie.intersectLine(z.x,z.y,J,X,q.x,q.y,0,B,I),Ue=A.tgtIntn=Be,Le=A.intersectionPts={x1:Fe[0],x2:Be[0],y1:Fe[1],y2:Be[1]},Ve=A.posPts={x1:q.x,x2:z.x,y1:q.y,y2:z.y},Xe=Math.abs(Be[1]-Fe[1]),nt=Math.abs(Be[0]-Fe[0]),oe=Math.sqrt(nt*nt+Xe*Xe);ve(oe)&&oe>=gG||(oe=Math.sqrt(Math.max(nt*nt,vd)+Math.max(Xe*Xe,vd)));var R=A.vector={x:nt,y:Xe},H=A.vectorNorm={x:R.x/oe,y:R.y/oe},K={x:-H.y,y:H.x};A.nodesOverlap=!ve(oe)||ie.checkPoint(Fe[0],Fe[1],0,J,X,z.x,z.y,B,I)||te.checkPoint(Be[0],Be[1],0,W,Y,q.x,q.y,se,U),A.vectorNormInverse=K,$={nodesOverlap:A.nodesOverlap,dirCounts:A.dirCounts,calculatedIntersection:!0,hasBezier:A.hasBezier,hasUnbundled:A.hasUnbundled,eles:A.eles,srcPos:z,srcRs:I,tgtPos:q,tgtRs:U,srcW:J,srcH:X,tgtW:W,tgtH:Y,srcIntn:Ue,tgtIntn:ke,srcShape:ie,tgtShape:te,posPts:{x1:Ve.x2,y1:Ve.y2,x2:Ve.x1,y2:Ve.y1},intersectionPts:{x1:Le.x2,y1:Le.y2,x2:Le.x1,y2:Le.y1},vector:{x:-R.x,y:-R.y},vectorNorm:{x:-H.x,y:-H.y},vectorNormInverse:{x:-K.x,y:-K.y}}}var V=Qe?$:A;de.nodesOverlap=V.nodesOverlap,de.srcIntn=V.srcIntn,de.tgtIntn=V.tgtIntn,de.isRound=Ce.startsWith("round"),i&&(P.isParent()||P.isChild()||N.isParent()||N.isChild())&&(P.parents().anySame(N)||N.parents().anySame(P)||P.same(N)&&P.isParent())?t.findCompoundLoopPoints(ae,V,L,Ye):P===N?t.findLoopPoints(ae,V,L,Ye):Ce.endsWith("segments")?t.findSegmentsPoints(ae,V):Ce.endsWith("taxi")?t.findTaxiPoints(ae,V):Ce==="straight"||!Ye&&A.eles.length%2===1&&L===Math.floor(A.eles.length/2)?t.findStraightEdgePoints(ae):t.findBezierPoints(ae,V,L,Ye,Qe),t.findEndpoints(ae),t.tryToCorrectInvalidPoints(ae,V),t.checkForInvalidEdgeWarning(ae),t.storeAllpts(ae),t.storeEdgeProjections(ae),t.calculateArrowAngles(ae),t.recalculateEdgeLabelProjections(ae),t.calculateLabelAngles(ae)}},x=0;x<o.length;x++)F();this.findHaystackPoints(u)}};function G$(e){var t=[];if(e!=null){for(var n=0;n<e.length;n+=2){var r=e[n],i=e[n+1];t.push({x:r,y:i})}return t}}Xn.getSegmentPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="segments")return G$(t.segpts)},Xn.getControlPoints=function(e){var t=e[0]._private.rscratch;this.recalculateRenderedStyle(e);var n=t.edgeType;if(n==="bezier"||n==="multibezier"||n==="self"||n==="compound")return G$(t.ctrlpts)},Xn.getEdgeMidpoint=function(e){var t=e[0]._private.rscratch;return this.recalculateRenderedStyle(e),{x:t.midX,y:t.midY}};var md={};md.manualEndptToPx=function(e,t){var n=this,r=e.position(),i=e.outerWidth(),a=e.outerHeight(),s=e._private.rscratch;if(t.value.length===2){var o=[t.pfValue[0],t.pfValue[1]];return t.units[0]==="%"&&(o[0]=o[0]*i),t.units[1]==="%"&&(o[1]=o[1]*a),o[0]+=r.x,o[1]+=r.y,o}else{var u=t.pfValue[0];u=-Math.PI/2+u;var l=2*Math.max(i,a),c=[r.x+Math.cos(u)*l,r.y+Math.sin(u)*l];return n.nodeShapes[this.getNodeShape(e)].intersectLine(r.x,r.y,i,a,c[0],c[1],0,e.pstyle("corner-radius").value==="auto"?"auto":e.pstyle("corner-radius").pfValue,s)}},md.findEndpoints=function(e){var t=this,n,r=e.source()[0],i=e.target()[0],a=r.position(),s=i.position(),o=e.pstyle("target-arrow-shape").value,u=e.pstyle("source-arrow-shape").value,l=e.pstyle("target-distance-from-node").pfValue,c=e.pstyle("source-distance-from-node").pfValue,f=r._private.rscratch,d=i._private.rscratch,h=e.pstyle("curve-style").value,g=e._private.rscratch,p=g.edgeType,v=h==="taxi",m=p==="self"||p==="compound",y=p==="bezier"||p==="multibezier"||m,b=p!=="bezier",w=p==="straight"||p==="segments",E=p==="segments",F=y||b||w,x=m||v,C=e.pstyle("source-endpoint"),S=x?"outside-to-node":C.value,_=r.pstyle("corner-radius").value==="auto"?"auto":r.pstyle("corner-radius").pfValue,k=e.pstyle("target-endpoint"),T=x?"outside-to-node":k.value,A=i.pstyle("corner-radius").value==="auto"?"auto":i.pstyle("corner-radius").pfValue;g.srcManEndpt=C,g.tgtManEndpt=k;var $,M,D,P;if(y){var N=[g.ctrlpts[0],g.ctrlpts[1]],O=b?[g.ctrlpts[g.ctrlpts.length-2],g.ctrlpts[g.ctrlpts.length-1]]:N;$=O,M=N}else if(w){var q=E?g.segpts.slice(0,2):[s.x,s.y],z=E?g.segpts.slice(g.segpts.length-2):[a.x,a.y];$=z,M=q}if(T==="inside-to-node")n=[s.x,s.y];else if(k.units)n=this.manualEndptToPx(i,k);else if(T==="outside-to-line")n=g.tgtIntn;else if(T==="outside-to-node"||T==="outside-to-node-or-label"?D=$:(T==="outside-to-line"||T==="outside-to-line-or-label")&&(D=[a.x,a.y]),n=t.nodeShapes[this.getNodeShape(i)].intersectLine(s.x,s.y,i.outerWidth(),i.outerHeight(),D[0],D[1],0,A,d),T==="outside-to-node-or-label"||T==="outside-to-line-or-label"){var W=i._private.rscratch,Y=W.labelWidth,J=W.labelHeight,X=W.labelX,te=W.labelY,ie=Y/2,se=J/2,B=i.pstyle("text-valign").value;B==="top"?te-=se:B==="bottom"&&(te+=se);var I=i.pstyle("text-halign").value;I==="left"?X-=ie:I==="right"&&(X+=ie);var U=rd(D[0],D[1],[X-ie,te-se,X+ie,te-se,X+ie,te+se,X-ie,te+se],s.x,s.y);if(U.length>0){var L=a,ae=gu(L,Gl(n)),de=gu(L,Gl(U)),Ce=ae;if(de<ae&&(n=U,Ce=de),U.length>2){var Ye=gu(L,{x:U[2],y:U[3]});Ye<Ce&&(n=[U[2],U[3]])}}}var Qe=dp(n,$,t.arrowShapes[o].spacing(e)+l),Fe=dp(n,$,t.arrowShapes[o].gap(e)+l);if(g.endX=Fe[0],g.endY=Fe[1],g.arrowEndX=Qe[0],g.arrowEndY=Qe[1],S==="inside-to-node")n=[a.x,a.y];else if(C.units)n=this.manualEndptToPx(r,C);else if(S==="outside-to-line")n=g.srcIntn;else if(S==="outside-to-node"||S==="outside-to-node-or-label"?P=M:(S==="outside-to-line"||S==="outside-to-line-or-label")&&(P=[s.x,s.y]),n=t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x,a.y,r.outerWidth(),r.outerHeight(),P[0],P[1],0,_,f),S==="outside-to-node-or-label"||S==="outside-to-line-or-label"){var ke=r._private.rscratch,Be=ke.labelWidth,Ue=ke.labelHeight,Le=ke.labelX,Ve=ke.labelY,Xe=Be/2,nt=Ue/2,oe=r.pstyle("text-valign").value;oe==="top"?Ve-=nt:oe==="bottom"&&(Ve+=nt);var R=r.pstyle("text-halign").value;R==="left"?Le-=Xe:R==="right"&&(Le+=Xe);var H=rd(P[0],P[1],[Le-Xe,Ve-nt,Le+Xe,Ve-nt,Le+Xe,Ve+nt,Le-Xe,Ve+nt],a.x,a.y);if(H.length>0){var K=s,V=gu(K,Gl(n)),j=gu(K,Gl(H)),me=V;if(j<V&&(n=[H[0],H[1]],me=j),H.length>2){var ne=gu(K,{x:H[2],y:H[3]});ne<me&&(n=[H[2],H[3]])}}}var ye=dp(n,M,t.arrowShapes[u].spacing(e)+c),Oe=dp(n,M,t.arrowShapes[u].gap(e)+c);g.startX=Oe[0],g.startY=Oe[1],g.arrowStartX=ye[0],g.arrowStartY=ye[1],F&&(!ve(g.startX)||!ve(g.startY)||!ve(g.endX)||!ve(g.endY)?g.badLine=!0:g.badLine=!1)},md.getSourceEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[0],y:t.haystackPts[1]};default:return{x:t.arrowStartX,y:t.arrowStartY}}},md.getTargetEndpoint=function(e){var t=e[0]._private.rscratch;switch(this.recalculateRenderedStyle(e),t.edgeType){case"haystack":return{x:t.haystackPts[2],y:t.haystackPts[3]};default:return{x:t.arrowEndX,y:t.arrowEndY}}};var q2={};function pG(e,t,n){for(var r=function(l,c,f,d){return vn(l,c,f,d)},i=t._private,a=i.rstyle.bezierPts,s=0;s<e.bezierProjPcts.length;s++){var o=e.bezierProjPcts[s];a.push({x:r(n[0],n[2],n[4],o),y:r(n[1],n[3],n[5],o)})}}q2.storeEdgeProjections=function(e){var t=e._private,n=t.rscratch,r=n.edgeType;if(t.rstyle.bezierPts=null,t.rstyle.linePts=null,t.rstyle.haystackPts=null,r==="multibezier"||r==="bezier"||r==="self"||r==="compound"){t.rstyle.bezierPts=[];for(var i=0;i+5<n.allpts.length;i+=4)pG(this,e,n.allpts.slice(i,i+6))}else if(r==="segments")for(var a=t.rstyle.linePts=[],i=0;i+1<n.allpts.length;i+=2)a.push({x:n.allpts[i],y:n.allpts[i+1]});else if(r==="haystack"){var s=n.haystackPts;t.rstyle.haystackPts=[{x:s[0],y:s[1]},{x:s[2],y:s[3]}]}t.rstyle.arrowWidth=this.getArrowWidth(e.pstyle("width").pfValue,e.pstyle("arrow-scale").value)*this.arrowShapeWidth},q2.recalculateEdgeProjections=function(e){this.findEdgeControlPoints(e)};var ya={};ya.recalculateNodeLabelProjection=function(e){var t=e.pstyle("label").strValue;if(!ao(t)){var n,r,i=e._private,a=e.width(),s=e.height(),o=e.padding(),u=e.position(),l=e.pstyle("text-halign").strValue,c=e.pstyle("text-valign").strValue,f=i.rscratch,d=i.rstyle;switch(l){case"left":n=u.x-a/2-o;break;case"right":n=u.x+a/2+o;break;default:n=u.x}switch(c){case"top":r=u.y-s/2-o;break;case"bottom":r=u.y+s/2+o;break;default:r=u.y}f.labelX=n,f.labelY=r,d.labelX=n,d.labelY=r,this.calculateLabelAngles(e),this.applyLabelDimensions(e)}};var Y$=function(t,n){var r=Math.atan(n/t);return t===0&&r<0&&(r=r*-1),r},X$=function(t,n){var r=n.x-t.x,i=n.y-t.y;return Y$(r,i)},vG=function(t,n,r,i){var a=td(0,i-.001,1),s=td(0,i+.001,1),o=Yl(t,n,r,a),u=Yl(t,n,r,s);return X$(o,u)};ya.recalculateEdgeLabelProjections=function(e){var t,n=e._private,r=n.rscratch,i=this,a={mid:e.pstyle("label").strValue,source:e.pstyle("source-label").strValue,target:e.pstyle("target-label").strValue};if(a.mid||a.source||a.target){t={x:r.midX,y:r.midY};var s=function(f,d,h){os(n.rscratch,f,d,h),os(n.rstyle,f,d,h)};s("labelX",null,t.x),s("labelY",null,t.y);var o=Y$(r.midDispX,r.midDispY);s("labelAutoAngle",null,o);var u=function(){if(u.cache)return u.cache;for(var f=[],d=0;d+5<r.allpts.length;d+=4){var h={x:r.allpts[d],y:r.allpts[d+1]},g={x:r.allpts[d+2],y:r.allpts[d+3]},p={x:r.allpts[d+4],y:r.allpts[d+5]};f.push({p0:h,p1:g,p2:p,startDist:0,length:0,segments:[]})}var v=n.rstyle.bezierPts,m=i.bezierProjPcts.length;function y(x,C,S,_,k){var T=hu(C,S),A=x.segments[x.segments.length-1],$={p0:C,p1:S,t0:_,t1:k,startDist:A?A.startDist+A.length:0,length:T};x.segments.push($),x.length+=T}for(var b=0;b<f.length;b++){var w=f[b],E=f[b-1];E&&(w.startDist=E.startDist+E.length),y(w,w.p0,v[b*m],0,i.bezierProjPcts[0]);for(var F=0;F<m-1;F++)y(w,v[b*m+F],v[b*m+F+1],i.bezierProjPcts[F],i.bezierProjPcts[F+1]);y(w,v[b*m+m-1],w.p2,i.bezierProjPcts[m-1],1)}return u.cache=f},l=function(f){var d,h=f==="source";if(a[f]){var g=e.pstyle(f+"-text-offset").pfValue;switch(r.edgeType){case"self":case"compound":case"bezier":case"multibezier":{for(var p=u(),v,m=0,y=0,b=0;b<p.length;b++){for(var w=p[h?b:p.length-1-b],E=0;E<w.segments.length;E++){var F=w.segments[h?E:w.segments.length-1-E],x=b===p.length-1&&E===w.segments.length-1;if(m=y,y+=F.length,y>=g||x){v={cp:w,segment:F};break}}if(v)break}var C=v.cp,S=v.segment,_=(g-m)/S.length,k=S.t1-S.t0,T=h?S.t0+k*_:S.t1-k*_;T=td(0,T,1),t=Yl(C.p0,C.p1,C.p2,T),d=vG(C.p0,C.p1,C.p2,T);break}case"straight":case"segments":case"haystack":{for(var A=0,$,M,D,P,N=r.allpts.length,O=0;O+3<N&&(h?(D={x:r.allpts[O],y:r.allpts[O+1]},P={x:r.allpts[O+2],y:r.allpts[O+3]}):(D={x:r.allpts[N-2-O],y:r.allpts[N-1-O]},P={x:r.allpts[N-4-O],y:r.allpts[N-3-O]}),$=hu(D,P),M=A,A+=$,!(A>=g));O+=2);var q=g-M,z=q/$;z=td(0,z,1),t=zV(D,P,z),d=X$(D,P);break}}s("labelX",f,t.x),s("labelY",f,t.y),s("labelAutoAngle",f,d)}};l("source"),l("target"),this.applyLabelDimensions(e)}},ya.applyLabelDimensions=function(e){this.applyPrefixedLabelDimensions(e),e.isEdge()&&(this.applyPrefixedLabelDimensions(e,"source"),this.applyPrefixedLabelDimensions(e,"target"))},ya.applyPrefixedLabelDimensions=function(e,t){var n=e._private,r=this.getLabelText(e,t),i=oo(r,e._private.labelDimsKey);if(ui(n.rscratch,"prefixedLabelDimsKey",t)!==i){os(n.rscratch,"prefixedLabelDimsKey",t,i);var a=this.calculateLabelDimensions(e,r),s=e.pstyle("line-height").pfValue,o=e.pstyle("text-wrap").strValue,u=ui(n.rscratch,"labelWrapCachedLines",t)||[],l=o!=="wrap"?1:Math.max(u.length,1),c=a.height/l,f=c*s,d=a.width,h=a.height+(l-1)*(s-1)*c;os(n.rstyle,"labelWidth",t,d),os(n.rscratch,"labelWidth",t,d),os(n.rstyle,"labelHeight",t,h),os(n.rscratch,"labelHeight",t,h),os(n.rscratch,"labelLineHeight",t,f)}},ya.getLabelText=function(e,t){var n=e._private,r=t?t+"-":"",i=e.pstyle(r+"label").strValue,a=e.pstyle("text-transform").value,s=function(Y,J){return J?(os(n.rscratch,Y,t,J),J):ui(n.rscratch,Y,t)};if(!i)return"";a=="none"||(a=="uppercase"?i=i.toUpperCase():a=="lowercase"&&(i=i.toLowerCase()));var o=e.pstyle("text-wrap").value;if(o==="wrap"){var u=s("labelKey");if(u!=null&&s("labelWrapKey")===u)return s("labelWrapCachedText");for(var l="​",c=i.split(`
`),f=e.pstyle("text-max-width").pfValue,d=e.pstyle("text-overflow-wrap").value,h=d==="anywhere",g=[],p=/[\s\u200b]+|$/g,v=0;v<c.length;v++){var m=c[v],y=this.calculateLabelDimensions(e,m),b=y.width;if(h){var w=m.split("").join(l);m=w}if(b>f){var E=m.matchAll(p),F="",x=0,C=$i(E),S;try{for(C.s();!(S=C.n()).done;){var _=S.value,k=_[0],T=m.substring(x,_.index);x=_.index+k.length;var A=F.length===0?T:F+T+k,$=this.calculateLabelDimensions(e,A),M=$.width;M<=f?F+=T+k:(F&&g.push(F),F=T+k)}}catch(W){C.e(W)}finally{C.f()}F.match(/^[\s\u200b]+$/)||g.push(F)}else g.push(m)}s("labelWrapCachedLines",g),i=s("labelWrapCachedText",g.join(`
`)),s("labelWrapKey",u)}else if(o==="ellipsis"){var D=e.pstyle("text-max-width").pfValue,P="",N="…",O=!1;if(this.calculateLabelDimensions(e,i).width<D)return i;for(var q=0;q<i.length;q++){var z=this.calculateLabelDimensions(e,P+i[q]+N).width;if(z>D)break;P+=i[q],q===i.length-1&&(O=!0)}return O||(P+=N),P}return i},ya.getLabelJustification=function(e){var t=e.pstyle("text-justification").strValue,n=e.pstyle("text-halign").strValue;if(t==="auto")if(e.isNode())switch(n){case"left":return"right";case"right":return"left";default:return"center"}else return"center";else return t},ya.calculateLabelDimensions=function(e,t){var n=this,r=n.cy.window(),i=r.document,a=0,s=e.pstyle("font-style").strValue,o=e.pstyle("font-size").pfValue,u=e.pstyle("font-family").strValue,l=e.pstyle("font-weight").strValue,c=this.labelCalcCanvas,f=this.labelCalcCanvasContext;if(!c){c=this.labelCalcCanvas=i.createElement("canvas"),f=this.labelCalcCanvasContext=c.getContext("2d");var d=c.style;d.position="absolute",d.left="-9999px",d.top="-9999px",d.zIndex="-1",d.visibility="hidden",d.pointerEvents="none"}f.font="".concat(s," ").concat(l," ").concat(o,"px ").concat(u);for(var h=0,g=0,p=t.split(`
`),v=0;v<p.length;v++){var m=p[v],y=f.measureText(m),b=Math.ceil(y.width),w=o;h=Math.max(b,h),g+=w}return h+=a,g+=a,{width:h,height:g}},ya.calculateLabelAngle=function(e,t){var n=e._private,r=n.rscratch,i=e.isEdge(),a=t?t+"-":"",s=e.pstyle(a+"text-rotation"),o=s.strValue;return o==="none"?0:i&&o==="autorotate"?r.labelAutoAngle:o==="autorotate"?0:s.pfValue},ya.calculateLabelAngles=function(e){var t=this,n=e.isEdge(),r=e._private,i=r.rscratch;i.labelAngle=t.calculateLabelAngle(e),n&&(i.sourceLabelAngle=t.calculateLabelAngle(e,"source"),i.targetLabelAngle=t.calculateLabelAngle(e,"target"))};var K$={},Z$=28,Q$=!1;K$.getNodeShape=function(e){var t=this,n=e.pstyle("shape").value;if(n==="cutrectangle"&&(e.width()<Z$||e.height()<Z$))return Q$||(gt("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"),Q$=!0),"rectangle";if(e.isParent())return n==="rectangle"||n==="roundrectangle"||n==="round-rectangle"||n==="cutrectangle"||n==="cut-rectangle"||n==="barrel"?n:"rectangle";if(n==="polygon"){var r=e.pstyle("shape-polygon-points").value;return t.nodeShapes.makePolygon(r).name}return n};var Vp={};Vp.registerCalculationListeners=function(){var e=this.cy,t=e.collection(),n=this,r=function(s){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(t.merge(s),o)for(var u=0;u<s.length;u++){var l=s[u],c=l._private,f=c.rstyle;f.clean=!1,f.cleanConnected=!1}};n.binder(e).on("bounds.* dirty.*",function(s){var o=s.target;r(o)}).on("style.* background.*",function(s){var o=s.target;r(o,!1)});var i=function(s){if(s){var o=n.onUpdateEleCalcsFns;t.cleanStyle();for(var u=0;u<t.length;u++){var l=t[u],c=l._private.rstyle;l.isNode()&&!c.cleanConnected&&(r(l.connectedEdges()),c.cleanConnected=!0)}if(o)for(var f=0;f<o.length;f++){var d=o[f];d(s,t)}n.recalculateRenderedStyle(t),t=e.collection()}};n.flushRenderedStyleQueue=function(){i(!0)},n.beforeRender(i,n.beforeRenderPriorities.eleCalcs)},Vp.onUpdateEleCalcs=function(e){var t=this.onUpdateEleCalcsFns=this.onUpdateEleCalcsFns||[];t.push(e)},Vp.recalculateRenderedStyle=function(e,t){var n=function(w){return w._private.rstyle.cleanConnected};if(e.length!==0){var r=[],i=[];if(!this.destroyed){t===void 0&&(t=!0);for(var a=0;a<e.length;a++){var s=e[a],o=s._private,u=o.rstyle;s.isEdge()&&(!n(s.source())||!n(s.target()))&&(u.clean=!1),s.isEdge()&&s.isBundledBezier()&&s.parallelEdges().some(function(b){return!b._private.rstyle.clean&&b.isBundledBezier()})&&(u.clean=!1),!(t&&u.clean||s.removed())&&s.pstyle("display").value!=="none"&&(o.group==="nodes"?i.push(s):r.push(s),u.clean=!0)}for(var l=0;l<i.length;l++){var c=i[l],f=c._private,d=f.rstyle,h=c.position();this.recalculateNodeLabelProjection(c),d.nodeX=h.x,d.nodeY=h.y,d.nodeW=c.pstyle("width").pfValue,d.nodeH=c.pstyle("height").pfValue}this.recalculateEdgeProjections(r);for(var g=0;g<r.length;g++){var p=r[g],v=p._private,m=v.rstyle,y=v.rscratch;m.srcX=y.arrowStartX,m.srcY=y.arrowStartY,m.tgtX=y.arrowEndX,m.tgtY=y.arrowEndY,m.midX=y.midX,m.midY=y.midY,m.labelAngle=y.labelAngle,m.sourceLabelAngle=y.sourceLabelAngle,m.targetLabelAngle=y.targetLabelAngle}}}};var Wp={};Wp.updateCachedGrabbedEles=function(){var e=this.cachedZSortedEles;if(e){e.drag=[],e.nondrag=[];for(var t=[],n=0;n<e.length;n++){var r=e[n],i=r._private.rscratch;r.grabbed()&&!r.isParent()?t.push(r):i.inDragLayer?e.drag.push(r):e.nondrag.push(r)}for(var n=0;n<t.length;n++){var r=t[n];e.drag.push(r)}}},Wp.invalidateCachedZSortedEles=function(){this.cachedZSortedEles=null},Wp.getCachedZSortedEles=function(e){if(e||!this.cachedZSortedEles){var t=this.cy.mutableElements().toArray();t.sort(d$),t.interactive=t.filter(function(n){return n.interactive()}),this.cachedZSortedEles=t,this.updateCachedGrabbedEles()}else t=this.cachedZSortedEles;return t};var J$={};[wu,zp,Xn,md,q2,ya,K$,Vp,Wp].forEach(function(e){Ie(J$,e)});var eD={};eD.getCachedImage=function(e,t,n){var r=this,i=r.imageCache=r.imageCache||{},a=i[e];if(a)return a.image.complete||a.image.addEventListener("load",n),a.image;a=i[e]=i[e]||{};var s=a.image=new Image;s.addEventListener("load",n),s.addEventListener("error",function(){s.error=!0});var o="data:",u=e.substring(0,o.length).toLowerCase()===o;return u||(t=t==="null"?null:t,s.crossOrigin=t),s.src=e,s};var cc={};cc.registerBinding=function(e,t,n,r){var i=Array.prototype.slice.apply(arguments,[1]);if(Array.isArray(e)){for(var a=[],s=0;s<e.length;s++){var o=e[s];if(o!==void 0){var u=this.binder(o);a.push(u.on.apply(u,i))}}return a}var u=this.binder(e);return u.on.apply(u,i)},cc.binder=function(e){var t=this,n=t.cy.window(),r=e===n||e===n.document||e===n.document.body||RU(e);if(t.supportsPassiveEvents==null){var i=!1;try{var a=Object.defineProperty({},"passive",{get:function(){return i=!0,!0}});n.addEventListener("test",null,a)}catch{}t.supportsPassiveEvents=i}var s=function(u,l,c){var f=Array.prototype.slice.call(arguments);return r&&t.supportsPassiveEvents&&(f[2]={capture:c??!1,passive:!1,once:!1}),t.bindings.push({target:e,args:f}),(e.addEventListener||e.on).apply(e,f),this};return{on:s,addEventListener:s,addListener:s,bind:s}},cc.nodeIsDraggable=function(e){return e&&e.isNode()&&!e.locked()&&e.grabbable()},cc.nodeIsGrabbable=function(e){return this.nodeIsDraggable(e)&&e.interactive()},cc.load=function(){var e=this,t=e.cy.window(),n=function(R){return R.selected()},r=function(R){var H=R.getRootNode();if(H&&H.nodeType===11&&H.host!==void 0)return H},i=function(R,H,K,V){R==null&&(R=e.cy);for(var j=0;j<H.length;j++){var me=H[j];R.emit({originalEvent:K,type:me,position:V})}},a=function(R){return R.shiftKey||R.metaKey||R.ctrlKey},s=function(R,H){var K=!0;if(e.cy.hasCompoundNodes()&&R&&R.pannable())for(var V=0;H&&V<H.length;V++){var R=H[V];if(R.isNode()&&R.isParent()&&!R.pannable()){K=!1;break}}else K=!0;return K},o=function(R){R[0]._private.grabbed=!0},u=function(R){R[0]._private.grabbed=!1},l=function(R){R[0]._private.rscratch.inDragLayer=!0},c=function(R){R[0]._private.rscratch.inDragLayer=!1},f=function(R){R[0]._private.rscratch.isGrabTarget=!0},d=function(R){R[0]._private.rscratch.isGrabTarget=!1},h=function(R,H){var K=H.addToList,V=K.has(R);!V&&R.grabbable()&&!R.locked()&&(K.merge(R),o(R))},g=function(R,H){if(R.cy().hasCompoundNodes()&&!(H.inDragLayer==null&&H.addToList==null)){var K=R.descendants();H.inDragLayer&&(K.forEach(l),K.connectedEdges().forEach(l)),H.addToList&&h(K,H)}},p=function(R,H){H=H||{};var K=R.cy().hasCompoundNodes();H.inDragLayer&&(R.forEach(l),R.neighborhood().stdFilter(function(V){return!K||V.isEdge()}).forEach(l)),H.addToList&&R.forEach(function(V){h(V,H)}),g(R,H),y(R,{inDragLayer:H.inDragLayer}),e.updateCachedGrabbedEles()},v=p,m=function(R){R&&(e.getCachedZSortedEles().forEach(function(H){u(H),c(H),d(H)}),e.updateCachedGrabbedEles())},y=function(R,H){if(!(H.inDragLayer==null&&H.addToList==null)&&R.cy().hasCompoundNodes()){var K=R.ancestors().orphans();if(!K.same(R)){var V=K.descendants().spawnSelf().merge(K).unmerge(R).unmerge(R.descendants()),j=V.connectedEdges();H.inDragLayer&&(j.forEach(l),V.forEach(l)),H.addToList&&V.forEach(function(me){h(me,H)})}}},b=function(){document.activeElement!=null&&document.activeElement.blur!=null&&document.activeElement.blur()},w=typeof MutationObserver<"u",E=typeof ResizeObserver<"u";w?(e.removeObserver=new MutationObserver(function(oe){for(var R=0;R<oe.length;R++){var H=oe[R],K=H.removedNodes;if(K)for(var V=0;V<K.length;V++){var j=K[V];if(j===e.container){e.destroy();break}}}}),e.container.parentNode&&e.removeObserver.observe(e.container.parentNode,{childList:!0})):e.registerBinding(e.container,"DOMNodeRemoved",function(oe){e.destroy()});var F=Xf(function(){e.cy.resize()},100);w&&(e.styleObserver=new MutationObserver(F),e.styleObserver.observe(e.container,{attributes:!0})),e.registerBinding(t,"resize",F),E&&(e.resizeObserver=new ResizeObserver(F),e.resizeObserver.observe(e.container));var x=function(R,H){for(;R!=null;)H(R),R=R.parentNode},C=function(){e.invalidateContainerClientCoordsCache()};x(e.container,function(oe){e.registerBinding(oe,"transitionend",C),e.registerBinding(oe,"animationend",C),e.registerBinding(oe,"scroll",C)}),e.registerBinding(e.container,"contextmenu",function(oe){oe.preventDefault()});var S=function(){return e.selection[4]!==0},_=function(R){for(var H=e.findContainerClientCoords(),K=H[0],V=H[1],j=H[2],me=H[3],ne=R.touches?R.touches:[R],ye=!1,Oe=0;Oe<ne.length;Oe++){var Ge=ne[Oe];if(K<=Ge.clientX&&Ge.clientX<=K+j&&V<=Ge.clientY&&Ge.clientY<=V+me){ye=!0;break}}if(!ye)return!1;for(var Te=e.container,We=R.target,je=We.parentNode,ze=!1;je;){if(je===Te){ze=!0;break}je=je.parentNode}return!!ze};e.registerBinding(e.container,"mousedown",function(R){if(_(R)&&!(e.hoverData.which===1&&R.which!==1)){R.preventDefault(),b(),e.hoverData.capture=!0,e.hoverData.which=R.which;var H=e.cy,K=[R.clientX,R.clientY],V=e.projectIntoViewport(K[0],K[1]),j=e.selection,me=e.findNearestElements(V[0],V[1],!0,!1),ne=me[0],ye=e.dragData.possibleDragElements;e.hoverData.mdownPos=V,e.hoverData.mdownGPos=K;var Oe=function(){e.hoverData.tapholdCancelled=!1,clearTimeout(e.hoverData.tapholdTimeout),e.hoverData.tapholdTimeout=setTimeout(function(){if(!e.hoverData.tapholdCancelled){var Dt=e.hoverData.down;Dt?Dt.emit({originalEvent:R,type:"taphold",position:{x:V[0],y:V[1]}}):H.emit({originalEvent:R,type:"taphold",position:{x:V[0],y:V[1]}})}},e.tapholdDuration)};if(R.which==3){e.hoverData.cxtStarted=!0;var Ge={originalEvent:R,type:"cxttapstart",position:{x:V[0],y:V[1]}};ne?(ne.activate(),ne.emit(Ge),e.hoverData.down=ne):H.emit(Ge),e.hoverData.downTime=new Date().getTime(),e.hoverData.cxtDragged=!1}else if(R.which==1){ne&&ne.activate();{if(ne!=null&&e.nodeIsGrabbable(ne)){var Te=function(Dt){return{originalEvent:R,type:Dt,position:{x:V[0],y:V[1]}}},We=function(Dt){Dt.emit(Te("grab"))};if(f(ne),!ne.selected())ye=e.dragData.possibleDragElements=H.collection(),v(ne,{addToList:ye}),ne.emit(Te("grabon")).emit(Te("grab"));else{ye=e.dragData.possibleDragElements=H.collection();var je=H.$(function(ze){return ze.isNode()&&ze.selected()&&e.nodeIsGrabbable(ze)});p(je,{addToList:ye}),ne.emit(Te("grabon")),je.forEach(We)}e.redrawHint("eles",!0),e.redrawHint("drag",!0)}e.hoverData.down=ne,e.hoverData.downs=me,e.hoverData.downTime=new Date().getTime()}i(ne,["mousedown","tapstart","vmousedown"],R,{x:V[0],y:V[1]}),ne==null?(j[4]=1,e.data.bgActivePosistion={x:V[0],y:V[1]},e.redrawHint("select",!0),e.redraw()):ne.pannable()&&(j[4]=1),Oe()}j[0]=j[2]=V[0],j[1]=j[3]=V[1]}},!1);var k=r(e.container);e.registerBinding([t,k],"mousemove",function(R){var H=e.hoverData.capture;if(!(!H&&!_(R))){var K=!1,V=e.cy,j=V.zoom(),me=[R.clientX,R.clientY],ne=e.projectIntoViewport(me[0],me[1]),ye=e.hoverData.mdownPos,Oe=e.hoverData.mdownGPos,Ge=e.selection,Te=null;!e.hoverData.draggingEles&&!e.hoverData.dragging&&!e.hoverData.selecting&&(Te=e.findNearestElement(ne[0],ne[1],!0,!1));var We=e.hoverData.last,je=e.hoverData.down,ze=[ne[0]-Ge[2],ne[1]-Ge[3]],Dt=e.dragData.possibleDragElements,Ht;if(Oe){var si=me[0]-Oe[0],oi=si*si,gn=me[1]-Oe[1],$n=gn*gn,Dn=oi+$n;e.hoverData.isOverThresholdDrag=Ht=Dn>=e.desktopTapThreshold2}var $r=a(R);Ht&&(e.hoverData.tapholdCancelled=!0);var Dr=function(){var as=e.hoverData.dragDelta=e.hoverData.dragDelta||[];as.length===0?(as.push(ze[0]),as.push(ze[1])):(as[0]+=ze[0],as[1]+=ze[1])};K=!0,i(Te,["mousemove","vmousemove","tapdrag"],R,{x:ne[0],y:ne[1]});var rs=function(){e.data.bgActivePosistion=void 0,e.hoverData.selecting||V.emit({originalEvent:R,type:"boxstart",position:{x:ne[0],y:ne[1]}}),Ge[4]=1,e.hoverData.selecting=!0,e.redrawHint("select",!0),e.redraw()};if(e.hoverData.which===3){if(Ht){var Mi={originalEvent:R,type:"cxtdrag",position:{x:ne[0],y:ne[1]}};je?je.emit(Mi):V.emit(Mi),e.hoverData.cxtDragged=!0,(!e.hoverData.cxtOver||Te!==e.hoverData.cxtOver)&&(e.hoverData.cxtOver&&e.hoverData.cxtOver.emit({originalEvent:R,type:"cxtdragout",position:{x:ne[0],y:ne[1]}}),e.hoverData.cxtOver=Te,Te&&Te.emit({originalEvent:R,type:"cxtdragover",position:{x:ne[0],y:ne[1]}}))}}else if(e.hoverData.dragging){if(K=!0,V.panningEnabled()&&V.userPanningEnabled()){var is;if(e.hoverData.justStartedPan){var to=e.hoverData.mdownPos;is={x:(ne[0]-to[0])*j,y:(ne[1]-to[1])*j},e.hoverData.justStartedPan=!1}else is={x:ze[0]*j,y:ze[1]*j};V.panBy(is),V.emit("dragpan"),e.hoverData.dragged=!0}ne=e.projectIntoViewport(R.clientX,R.clientY)}else if(Ge[4]==1&&(je==null||je.pannable())){if(Ht){if(!e.hoverData.dragging&&V.boxSelectionEnabled()&&($r||!V.panningEnabled()||!V.userPanningEnabled()))rs();else if(!e.hoverData.selecting&&V.panningEnabled()&&V.userPanningEnabled()){var no=s(je,e.hoverData.downs);no&&(e.hoverData.dragging=!0,e.hoverData.justStartedPan=!0,Ge[4]=0,e.data.bgActivePosistion=Gl(ye),e.redrawHint("select",!0),e.redraw())}je&&je.pannable()&&je.active()&&je.unactivate()}}else{if(je&&je.pannable()&&je.active()&&je.unactivate(),(!je||!je.grabbed())&&Te!=We&&(We&&i(We,["mouseout","tapdragout"],R,{x:ne[0],y:ne[1]}),Te&&i(Te,["mouseover","tapdragover"],R,{x:ne[0],y:ne[1]}),e.hoverData.last=Te),je)if(Ht){if(V.boxSelectionEnabled()&&$r)je&&je.grabbed()&&(m(Dt),je.emit("freeon"),Dt.emit("free"),e.dragData.didDrag&&(je.emit("dragfreeon"),Dt.emit("dragfree"))),rs();else if(je&&je.grabbed()&&e.nodeIsDraggable(je)){var ar=!e.dragData.didDrag;ar&&e.redrawHint("eles",!0),e.dragData.didDrag=!0,e.hoverData.draggingEles||p(Dt,{inDragLayer:!0});var Rn={x:0,y:0};if(ve(ze[0])&&ve(ze[1])&&(Rn.x+=ze[0],Rn.y+=ze[1],ar)){var jr=e.hoverData.dragDelta;jr&&ve(jr[0])&&ve(jr[1])&&(Rn.x+=jr[0],Rn.y+=jr[1])}e.hoverData.draggingEles=!0,Dt.silentShift(Rn).emit("position drag"),e.redrawHint("drag",!0),e.redraw()}}else Dr();K=!0}if(Ge[2]=ne[0],Ge[3]=ne[1],K)return R.stopPropagation&&R.stopPropagation(),R.preventDefault&&R.preventDefault(),!1}},!1);var T,A,$;e.registerBinding(t,"mouseup",function(R){if(!(e.hoverData.which===1&&R.which!==1&&e.hoverData.capture)){var H=e.hoverData.capture;if(H){e.hoverData.capture=!1;var K=e.cy,V=e.projectIntoViewport(R.clientX,R.clientY),j=e.selection,me=e.findNearestElement(V[0],V[1],!0,!1),ne=e.dragData.possibleDragElements,ye=e.hoverData.down,Oe=a(R);if(e.data.bgActivePosistion&&(e.redrawHint("select",!0),e.redraw()),e.hoverData.tapholdCancelled=!0,e.data.bgActivePosistion=void 0,ye&&ye.unactivate(),e.hoverData.which===3){var Ge={originalEvent:R,type:"cxttapend",position:{x:V[0],y:V[1]}};if(ye?ye.emit(Ge):K.emit(Ge),!e.hoverData.cxtDragged){var Te={originalEvent:R,type:"cxttap",position:{x:V[0],y:V[1]}};ye?ye.emit(Te):K.emit(Te)}e.hoverData.cxtDragged=!1,e.hoverData.which=null}else if(e.hoverData.which===1){if(i(me,["mouseup","tapend","vmouseup"],R,{x:V[0],y:V[1]}),!e.dragData.didDrag&&!e.hoverData.dragged&&!e.hoverData.selecting&&!e.hoverData.isOverThresholdDrag&&(i(ye,["click","tap","vclick"],R,{x:V[0],y:V[1]}),A=!1,R.timeStamp-$<=K.multiClickDebounceTime()?(T&&clearTimeout(T),A=!0,$=null,i(ye,["dblclick","dbltap","vdblclick"],R,{x:V[0],y:V[1]})):(T=setTimeout(function(){A||i(ye,["oneclick","onetap","voneclick"],R,{x:V[0],y:V[1]})},K.multiClickDebounceTime()),$=R.timeStamp)),ye==null&&!e.dragData.didDrag&&!e.hoverData.selecting&&!e.hoverData.dragged&&!a(R)&&(K.$(n).unselect(["tapunselect"]),ne.length>0&&e.redrawHint("eles",!0),e.dragData.possibleDragElements=ne=K.collection()),me==ye&&!e.dragData.didDrag&&!e.hoverData.selecting&&me!=null&&me._private.selectable&&(e.hoverData.dragging||(K.selectionType()==="additive"||Oe?me.selected()?me.unselect(["tapunselect"]):me.select(["tapselect"]):Oe||(K.$(n).unmerge(me).unselect(["tapunselect"]),me.select(["tapselect"]))),e.redrawHint("eles",!0)),e.hoverData.selecting){var We=K.collection(e.getAllInBox(j[0],j[1],j[2],j[3]));e.redrawHint("select",!0),We.length>0&&e.redrawHint("eles",!0),K.emit({type:"boxend",originalEvent:R,position:{x:V[0],y:V[1]}});var je=function(Ht){return Ht.selectable()&&!Ht.selected()};K.selectionType()==="additive"||Oe||K.$(n).unmerge(We).unselect(),We.emit("box").stdFilter(je).select().emit("boxselect"),e.redraw()}if(e.hoverData.dragging&&(e.hoverData.dragging=!1,e.redrawHint("select",!0),e.redrawHint("eles",!0),e.redraw()),!j[4]){e.redrawHint("drag",!0),e.redrawHint("eles",!0);var ze=ye&&ye.grabbed();m(ne),ze&&(ye.emit("freeon"),ne.emit("free"),e.dragData.didDrag&&(ye.emit("dragfreeon"),ne.emit("dragfree")))}}j[4]=0,e.hoverData.down=null,e.hoverData.cxtStarted=!1,e.hoverData.draggingEles=!1,e.hoverData.selecting=!1,e.hoverData.isOverThresholdDrag=!1,e.dragData.didDrag=!1,e.hoverData.dragged=!1,e.hoverData.dragDelta=[],e.hoverData.mdownPos=null,e.hoverData.mdownGPos=null,e.hoverData.which=null}}},!1);var M=function(R){if(!e.scrollingPage){var H=e.cy,K=H.zoom(),V=H.pan(),j=e.projectIntoViewport(R.clientX,R.clientY),me=[j[0]*K+V.x,j[1]*K+V.y];if(e.hoverData.draggingEles||e.hoverData.dragging||e.hoverData.cxtStarted||S()){R.preventDefault();return}if(H.panningEnabled()&&H.userPanningEnabled()&&H.zoomingEnabled()&&H.userZoomingEnabled()){R.preventDefault(),e.data.wheelZooming=!0,clearTimeout(e.data.wheelTimeout),e.data.wheelTimeout=setTimeout(function(){e.data.wheelZooming=!1,e.redrawHint("eles",!0),e.redraw()},150);var ne;R.deltaY!=null?ne=R.deltaY/-250:R.wheelDeltaY!=null?ne=R.wheelDeltaY/1e3:ne=R.wheelDelta/1e3,ne=ne*e.wheelSensitivity;var ye=R.deltaMode===1;ye&&(ne*=33);var Oe=H.zoom()*Math.pow(10,ne);R.type==="gesturechange"&&(Oe=e.gestureStartZoom*R.scale),H.zoom({level:Oe,renderedPosition:{x:me[0],y:me[1]}}),H.emit(R.type==="gesturechange"?"pinchzoom":"scrollzoom")}}};e.registerBinding(e.container,"wheel",M,!0),e.registerBinding(t,"scroll",function(R){e.scrollingPage=!0,clearTimeout(e.scrollingPageTimeout),e.scrollingPageTimeout=setTimeout(function(){e.scrollingPage=!1},250)},!0),e.registerBinding(e.container,"gesturestart",function(R){e.gestureStartZoom=e.cy.zoom(),e.hasTouchStarted||R.preventDefault()},!0),e.registerBinding(e.container,"gesturechange",function(oe){e.hasTouchStarted||M(oe)},!0),e.registerBinding(e.container,"mouseout",function(R){var H=e.projectIntoViewport(R.clientX,R.clientY);e.cy.emit({originalEvent:R,type:"mouseout",position:{x:H[0],y:H[1]}})},!1),e.registerBinding(e.container,"mouseover",function(R){var H=e.projectIntoViewport(R.clientX,R.clientY);e.cy.emit({originalEvent:R,type:"mouseover",position:{x:H[0],y:H[1]}})},!1);var D,P,N,O,q,z,W,Y,J,X,te,ie,se,B=function(R,H,K,V){return Math.sqrt((K-R)*(K-R)+(V-H)*(V-H))},I=function(R,H,K,V){return(K-R)*(K-R)+(V-H)*(V-H)},U;e.registerBinding(e.container,"touchstart",U=function(R){if(e.hasTouchStarted=!0,!!_(R)){b(),e.touchData.capture=!0,e.data.bgActivePosistion=void 0;var H=e.cy,K=e.touchData.now,V=e.touchData.earlier;if(R.touches[0]){var j=e.projectIntoViewport(R.touches[0].clientX,R.touches[0].clientY);K[0]=j[0],K[1]=j[1]}if(R.touches[1]){var j=e.projectIntoViewport(R.touches[1].clientX,R.touches[1].clientY);K[2]=j[0],K[3]=j[1]}if(R.touches[2]){var j=e.projectIntoViewport(R.touches[2].clientX,R.touches[2].clientY);K[4]=j[0],K[5]=j[1]}if(R.touches[1]){e.touchData.singleTouchMoved=!0,m(e.dragData.touchDragEles);var me=e.findContainerClientCoords();J=me[0],X=me[1],te=me[2],ie=me[3],D=R.touches[0].clientX-J,P=R.touches[0].clientY-X,N=R.touches[1].clientX-J,O=R.touches[1].clientY-X,se=0<=D&&D<=te&&0<=N&&N<=te&&0<=P&&P<=ie&&0<=O&&O<=ie;var ne=H.pan(),ye=H.zoom();q=B(D,P,N,O),z=I(D,P,N,O),W=[(D+N)/2,(P+O)/2],Y=[(W[0]-ne.x)/ye,(W[1]-ne.y)/ye];var Oe=200,Ge=Oe*Oe;if(z<Ge&&!R.touches[2]){var Te=e.findNearestElement(K[0],K[1],!0,!0),We=e.findNearestElement(K[2],K[3],!0,!0);Te&&Te.isNode()?(Te.activate().emit({originalEvent:R,type:"cxttapstart",position:{x:K[0],y:K[1]}}),e.touchData.start=Te):We&&We.isNode()?(We.activate().emit({originalEvent:R,type:"cxttapstart",position:{x:K[0],y:K[1]}}),e.touchData.start=We):H.emit({originalEvent:R,type:"cxttapstart",position:{x:K[0],y:K[1]}}),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!0,e.touchData.cxtDragged=!1,e.data.bgActivePosistion=void 0,e.redraw();return}}if(R.touches[2])H.boxSelectionEnabled()&&R.preventDefault();else if(!R.touches[1]){if(R.touches[0]){var je=e.findNearestElements(K[0],K[1],!0,!0),ze=je[0];if(ze!=null&&(ze.activate(),e.touchData.start=ze,e.touchData.starts=je,e.nodeIsGrabbable(ze))){var Dt=e.dragData.touchDragEles=H.collection(),Ht=null;e.redrawHint("eles",!0),e.redrawHint("drag",!0),ze.selected()?(Ht=H.$(function(Dn){return Dn.selected()&&e.nodeIsGrabbable(Dn)}),p(Ht,{addToList:Dt})):v(ze,{addToList:Dt}),f(ze);var si=function($r){return{originalEvent:R,type:$r,position:{x:K[0],y:K[1]}}};ze.emit(si("grabon")),Ht?Ht.forEach(function(Dn){Dn.emit(si("grab"))}):ze.emit(si("grab"))}i(ze,["touchstart","tapstart","vmousedown"],R,{x:K[0],y:K[1]}),ze==null&&(e.data.bgActivePosistion={x:j[0],y:j[1]},e.redrawHint("select",!0),e.redraw()),e.touchData.singleTouchMoved=!1,e.touchData.singleTouchStartTime=+new Date,clearTimeout(e.touchData.tapholdTimeout),e.touchData.tapholdTimeout=setTimeout(function(){e.touchData.singleTouchMoved===!1&&!e.pinching&&!e.touchData.selecting&&i(e.touchData.start,["taphold"],R,{x:K[0],y:K[1]})},e.tapholdDuration)}}if(R.touches.length>=1){for(var oi=e.touchData.startPosition=[null,null,null,null,null,null],gn=0;gn<K.length;gn++)oi[gn]=V[gn]=K[gn];var $n=R.touches[0];e.touchData.startGPosition=[$n.clientX,$n.clientY]}}},!1);var L;e.registerBinding(t,"touchmove",L=function(R){var H=e.touchData.capture;if(!(!H&&!_(R))){var K=e.selection,V=e.cy,j=e.touchData.now,me=e.touchData.earlier,ne=V.zoom();if(R.touches[0]){var ye=e.projectIntoViewport(R.touches[0].clientX,R.touches[0].clientY);j[0]=ye[0],j[1]=ye[1]}if(R.touches[1]){var ye=e.projectIntoViewport(R.touches[1].clientX,R.touches[1].clientY);j[2]=ye[0],j[3]=ye[1]}if(R.touches[2]){var ye=e.projectIntoViewport(R.touches[2].clientX,R.touches[2].clientY);j[4]=ye[0],j[5]=ye[1]}var Oe=e.touchData.startGPosition,Ge;if(H&&R.touches[0]&&Oe){for(var Te=[],We=0;We<j.length;We++)Te[We]=j[We]-me[We];var je=R.touches[0].clientX-Oe[0],ze=je*je,Dt=R.touches[0].clientY-Oe[1],Ht=Dt*Dt,si=ze+Ht;Ge=si>=e.touchTapThreshold2}if(H&&e.touchData.cxt){R.preventDefault();var oi=R.touches[0].clientX-J,gn=R.touches[0].clientY-X,$n=R.touches[1].clientX-J,Dn=R.touches[1].clientY-X,$r=I(oi,gn,$n,Dn),Dr=$r/z,rs=150,Mi=rs*rs,is=1.5,to=is*is;if(Dr>=to||$r>=Mi){e.touchData.cxt=!1,e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var no={originalEvent:R,type:"cxttapend",position:{x:j[0],y:j[1]}};e.touchData.start?(e.touchData.start.unactivate().emit(no),e.touchData.start=null):V.emit(no)}}if(H&&e.touchData.cxt){var no={originalEvent:R,type:"cxtdrag",position:{x:j[0],y:j[1]}};e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.touchData.start?e.touchData.start.emit(no):V.emit(no),e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxtDragged=!0;var ar=e.findNearestElement(j[0],j[1],!0,!0);(!e.touchData.cxtOver||ar!==e.touchData.cxtOver)&&(e.touchData.cxtOver&&e.touchData.cxtOver.emit({originalEvent:R,type:"cxtdragout",position:{x:j[0],y:j[1]}}),e.touchData.cxtOver=ar,ar&&ar.emit({originalEvent:R,type:"cxtdragover",position:{x:j[0],y:j[1]}}))}else if(H&&R.touches[2]&&V.boxSelectionEnabled())R.preventDefault(),e.data.bgActivePosistion=void 0,this.lastThreeTouch=+new Date,e.touchData.selecting||V.emit({originalEvent:R,type:"boxstart",position:{x:j[0],y:j[1]}}),e.touchData.selecting=!0,e.touchData.didSelect=!0,K[4]=1,!K||K.length===0||K[0]===void 0?(K[0]=(j[0]+j[2]+j[4])/3,K[1]=(j[1]+j[3]+j[5])/3,K[2]=(j[0]+j[2]+j[4])/3+1,K[3]=(j[1]+j[3]+j[5])/3+1):(K[2]=(j[0]+j[2]+j[4])/3,K[3]=(j[1]+j[3]+j[5])/3),e.redrawHint("select",!0),e.redraw();else if(H&&R.touches[1]&&!e.touchData.didSelect&&V.zoomingEnabled()&&V.panningEnabled()&&V.userZoomingEnabled()&&V.userPanningEnabled()){R.preventDefault(),e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var Rn=e.dragData.touchDragEles;if(Rn){e.redrawHint("drag",!0);for(var jr=0;jr<Rn.length;jr++){var O1=Rn[jr]._private;O1.grabbed=!1,O1.rscratch.inDragLayer=!1}}var as=e.touchData.start,oi=R.touches[0].clientX-J,gn=R.touches[0].clientY-X,$n=R.touches[1].clientX-J,Dn=R.touches[1].clientY-X,sU=B(oi,gn,$n,Dn),vSe=sU/q;if(se){var mSe=oi-D,ySe=gn-P,bSe=$n-N,wSe=Dn-O,xSe=(mSe+bSe)/2,ESe=(ySe+wSe)/2,Xg=V.zoom(),pA=Xg*vSe,I1=V.pan(),oU=Y[0]*Xg+I1.x,uU=Y[1]*Xg+I1.y,FSe={x:-pA/Xg*(oU-I1.x-xSe)+oU,y:-pA/Xg*(uU-I1.y-ESe)+uU};if(as&&as.active()){var Rn=e.dragData.touchDragEles;m(Rn),e.redrawHint("drag",!0),e.redrawHint("eles",!0),as.unactivate().emit("freeon"),Rn.emit("free"),e.dragData.didDrag&&(as.emit("dragfreeon"),Rn.emit("dragfree"))}V.viewport({zoom:pA,pan:FSe,cancelOnFailedZoom:!0}),V.emit("pinchzoom"),q=sU,D=oi,P=gn,N=$n,O=Dn,e.pinching=!0}if(R.touches[0]){var ye=e.projectIntoViewport(R.touches[0].clientX,R.touches[0].clientY);j[0]=ye[0],j[1]=ye[1]}if(R.touches[1]){var ye=e.projectIntoViewport(R.touches[1].clientX,R.touches[1].clientY);j[2]=ye[0],j[3]=ye[1]}if(R.touches[2]){var ye=e.projectIntoViewport(R.touches[2].clientX,R.touches[2].clientY);j[4]=ye[0],j[5]=ye[1]}}else if(R.touches[0]&&!e.touchData.didSelect){var da=e.touchData.start,vA=e.touchData.last,ar;if(!e.hoverData.draggingEles&&!e.swipePanning&&(ar=e.findNearestElement(j[0],j[1],!0,!0)),H&&da!=null&&R.preventDefault(),H&&da!=null&&e.nodeIsDraggable(da))if(Ge){var Rn=e.dragData.touchDragEles,lU=!e.dragData.didDrag;lU&&p(Rn,{inDragLayer:!0}),e.dragData.didDrag=!0;var Kg={x:0,y:0};if(ve(Te[0])&&ve(Te[1])&&(Kg.x+=Te[0],Kg.y+=Te[1],lU)){e.redrawHint("eles",!0);var ha=e.touchData.dragDelta;ha&&ve(ha[0])&&ve(ha[1])&&(Kg.x+=ha[0],Kg.y+=ha[1])}e.hoverData.draggingEles=!0,Rn.silentShift(Kg).emit("position drag"),e.redrawHint("drag",!0),e.touchData.startPosition[0]==me[0]&&e.touchData.startPosition[1]==me[1]&&e.redrawHint("eles",!0),e.redraw()}else{var ha=e.touchData.dragDelta=e.touchData.dragDelta||[];ha.length===0?(ha.push(Te[0]),ha.push(Te[1])):(ha[0]+=Te[0],ha[1]+=Te[1])}if(i(da||ar,["touchmove","tapdrag","vmousemove"],R,{x:j[0],y:j[1]}),(!da||!da.grabbed())&&ar!=vA&&(vA&&vA.emit({originalEvent:R,type:"tapdragout",position:{x:j[0],y:j[1]}}),ar&&ar.emit({originalEvent:R,type:"tapdragover",position:{x:j[0],y:j[1]}})),e.touchData.last=ar,H)for(var jr=0;jr<j.length;jr++)j[jr]&&e.touchData.startPosition[jr]&&Ge&&(e.touchData.singleTouchMoved=!0);if(H&&(da==null||da.pannable())&&V.panningEnabled()&&V.userPanningEnabled()){var SSe=s(da,e.touchData.starts);SSe&&(R.preventDefault(),e.data.bgActivePosistion||(e.data.bgActivePosistion=Gl(e.touchData.startPosition)),e.swipePanning?(V.panBy({x:Te[0]*ne,y:Te[1]*ne}),V.emit("dragpan")):Ge&&(e.swipePanning=!0,V.panBy({x:je*ne,y:Dt*ne}),V.emit("dragpan"),da&&(da.unactivate(),e.redrawHint("select",!0),e.touchData.start=null)));var ye=e.projectIntoViewport(R.touches[0].clientX,R.touches[0].clientY);j[0]=ye[0],j[1]=ye[1]}}for(var We=0;We<j.length;We++)me[We]=j[We];H&&R.touches.length>0&&!e.hoverData.draggingEles&&!e.swipePanning&&e.data.bgActivePosistion!=null&&(e.data.bgActivePosistion=void 0,e.redrawHint("select",!0),e.redraw())}},!1);var ae;e.registerBinding(t,"touchcancel",ae=function(R){var H=e.touchData.start;e.touchData.capture=!1,H&&H.unactivate()});var de,Ce,Ye,Qe;if(e.registerBinding(t,"touchend",de=function(R){var H=e.touchData.start,K=e.touchData.capture;if(K)R.touches.length===0&&(e.touchData.capture=!1),R.preventDefault();else return;var V=e.selection;e.swipePanning=!1,e.hoverData.draggingEles=!1;var j=e.cy,me=j.zoom(),ne=e.touchData.now,ye=e.touchData.earlier;if(R.touches[0]){var Oe=e.projectIntoViewport(R.touches[0].clientX,R.touches[0].clientY);ne[0]=Oe[0],ne[1]=Oe[1]}if(R.touches[1]){var Oe=e.projectIntoViewport(R.touches[1].clientX,R.touches[1].clientY);ne[2]=Oe[0],ne[3]=Oe[1]}if(R.touches[2]){var Oe=e.projectIntoViewport(R.touches[2].clientX,R.touches[2].clientY);ne[4]=Oe[0],ne[5]=Oe[1]}H&&H.unactivate();var Ge;if(e.touchData.cxt){if(Ge={originalEvent:R,type:"cxttapend",position:{x:ne[0],y:ne[1]}},H?H.emit(Ge):j.emit(Ge),!e.touchData.cxtDragged){var Te={originalEvent:R,type:"cxttap",position:{x:ne[0],y:ne[1]}};H?H.emit(Te):j.emit(Te)}e.touchData.start&&(e.touchData.start._private.grabbed=!1),e.touchData.cxt=!1,e.touchData.start=null,e.redraw();return}if(!R.touches[2]&&j.boxSelectionEnabled()&&e.touchData.selecting){e.touchData.selecting=!1;var We=j.collection(e.getAllInBox(V[0],V[1],V[2],V[3]));V[0]=void 0,V[1]=void 0,V[2]=void 0,V[3]=void 0,V[4]=0,e.redrawHint("select",!0),j.emit({type:"boxend",originalEvent:R,position:{x:ne[0],y:ne[1]}});var je=function(Mi){return Mi.selectable()&&!Mi.selected()};We.emit("box").stdFilter(je).select().emit("boxselect"),We.nonempty()&&e.redrawHint("eles",!0),e.redraw()}if(H!=null&&H.unactivate(),R.touches[2])e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);else if(!R.touches[1]){if(!R.touches[0]){if(!R.touches[0]){e.data.bgActivePosistion=void 0,e.redrawHint("select",!0);var ze=e.dragData.touchDragEles;if(H!=null){var Dt=H._private.grabbed;m(ze),e.redrawHint("drag",!0),e.redrawHint("eles",!0),Dt&&(H.emit("freeon"),ze.emit("free"),e.dragData.didDrag&&(H.emit("dragfreeon"),ze.emit("dragfree"))),i(H,["touchend","tapend","vmouseup","tapdragout"],R,{x:ne[0],y:ne[1]}),H.unactivate(),e.touchData.start=null}else{var Ht=e.findNearestElement(ne[0],ne[1],!0,!0);i(Ht,["touchend","tapend","vmouseup","tapdragout"],R,{x:ne[0],y:ne[1]})}var si=e.touchData.startPosition[0]-ne[0],oi=si*si,gn=e.touchData.startPosition[1]-ne[1],$n=gn*gn,Dn=oi+$n,$r=Dn*me*me;e.touchData.singleTouchMoved||(H||j.$(":selected").unselect(["tapunselect"]),i(H,["tap","vclick"],R,{x:ne[0],y:ne[1]}),Ce=!1,R.timeStamp-Qe<=j.multiClickDebounceTime()?(Ye&&clearTimeout(Ye),Ce=!0,Qe=null,i(H,["dbltap","vdblclick"],R,{x:ne[0],y:ne[1]})):(Ye=setTimeout(function(){Ce||i(H,["onetap","voneclick"],R,{x:ne[0],y:ne[1]})},j.multiClickDebounceTime()),Qe=R.timeStamp)),H!=null&&!e.dragData.didDrag&&H._private.selectable&&$r<e.touchTapThreshold2&&!e.pinching&&(j.selectionType()==="single"?(j.$(n).unmerge(H).unselect(["tapunselect"]),H.select(["tapselect"])):H.selected()?H.unselect(["tapunselect"]):H.select(["tapselect"]),e.redrawHint("eles",!0)),e.touchData.singleTouchMoved=!0}}}for(var Dr=0;Dr<ne.length;Dr++)ye[Dr]=ne[Dr];e.dragData.didDrag=!1,R.touches.length===0&&(e.touchData.dragDelta=[],e.touchData.startPosition=[null,null,null,null,null,null],e.touchData.startGPosition=null,e.touchData.didSelect=!1),R.touches.length<2&&(R.touches.length===1&&(e.touchData.startGPosition=[R.touches[0].clientX,R.touches[0].clientY]),e.pinching=!1,e.redrawHint("eles",!0),e.redraw())},!1),typeof TouchEvent>"u"){var Fe=[],ke=function(R){return{clientX:R.clientX,clientY:R.clientY,force:1,identifier:R.pointerId,pageX:R.pageX,pageY:R.pageY,radiusX:R.width/2,radiusY:R.height/2,screenX:R.screenX,screenY:R.screenY,target:R.target}},Be=function(R){return{event:R,touch:ke(R)}},Ue=function(R){Fe.push(Be(R))},Le=function(R){for(var H=0;H<Fe.length;H++){var K=Fe[H];if(K.event.pointerId===R.pointerId){Fe.splice(H,1);return}}},Ve=function(R){var H=Fe.filter(function(K){return K.event.pointerId===R.pointerId})[0];H.event=R,H.touch=ke(R)},Xe=function(R){R.touches=Fe.map(function(H){return H.touch})},nt=function(R){return R.pointerType==="mouse"||R.pointerType===4};e.registerBinding(e.container,"pointerdown",function(oe){nt(oe)||(oe.preventDefault(),Ue(oe),Xe(oe),U(oe))}),e.registerBinding(e.container,"pointerup",function(oe){nt(oe)||(Le(oe),Xe(oe),de(oe))}),e.registerBinding(e.container,"pointercancel",function(oe){nt(oe)||(Le(oe),Xe(oe),ae(oe))}),e.registerBinding(e.container,"pointermove",function(oe){nt(oe)||(oe.preventDefault(),Ve(oe),Xe(oe),L(oe))})}};var fs={};fs.generatePolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,draw:function(r,i,a,s,o,u){this.renderer.nodeShapeImpl("polygon",r,i,a,s,o,this.points)},intersectLine:function(r,i,a,s,o,u,l,c){return rd(o,u,this.points,r,i,a/2,s/2,l)},checkPoint:function(r,i,a,s,o,u,l,c){return ls(r,i,this.points,u,l,s,o,[0,-1],a)}}},fs.generateEllipse=function(){return this.nodeShapes.ellipse={renderer:this,name:"ellipse",draw:function(t,n,r,i,a,s){this.renderer.nodeShapeImpl(this.name,t,n,r,i,a)},intersectLine:function(t,n,r,i,a,s,o,u){return JV(a,s,t,n,r/2+o,i/2+o)},checkPoint:function(t,n,r,i,a,s,o,u){return pu(t,n,i,a,s,o,r)}}},fs.generateRoundPolygon=function(e,t){return this.nodeShapes[e]={renderer:this,name:e,points:t,getOrCreateCorners:function(r,i,a,s,o,u,l){if(u[l]!==void 0&&u[l+"-cx"]===r&&u[l+"-cy"]===i)return u[l];u[l]=new Array(t.length/2),u[l+"-cx"]=r,u[l+"-cy"]=i;var c=a/2,f=s/2;o=o==="auto"?vT(a,s):o;for(var d=new Array(t.length/2),h=0;h<t.length/2;h++)d[h]={x:r+c*t[h*2],y:i+f*t[h*2+1]};var g,p,v,m,y=d.length;for(p=d[y-1],g=0;g<y;g++)v=d[g%y],m=d[(g+1)%y],u[l][g]=z2(p,v,m,o),p=v,v=m;return u[l]},draw:function(r,i,a,s,o,u,l){this.renderer.nodeShapeImpl("round-polygon",r,i,a,s,o,this.points,this.getOrCreateCorners(i,a,s,o,u,l,"drawCorners"))},intersectLine:function(r,i,a,s,o,u,l,c,f){return eW(o,u,this.points,r,i,a,s,l,this.getOrCreateCorners(r,i,a,s,c,f,"corners"))},checkPoint:function(r,i,a,s,o,u,l,c,f){return QV(r,i,this.points,u,l,s,o,this.getOrCreateCorners(u,l,s,o,c,f,"corners"))}}},fs.generateRoundRectangle=function(){return this.nodeShapes["round-rectangle"]=this.nodeShapes.roundrectangle={renderer:this,name:"round-rectangle",points:sr(4,0),draw:function(t,n,r,i,a,s){this.renderer.nodeShapeImpl(this.name,t,n,r,i,a,this.points,s)},intersectLine:function(t,n,r,i,a,s,o,u){return gT(a,s,t,n,r,i,o,u)},checkPoint:function(t,n,r,i,a,s,o,u){var l=i/2,c=a/2;u=u==="auto"?vu(i,a):u,u=Math.min(l,c,u);var f=u*2;return!!(ls(t,n,this.points,s,o,i,a-f,[0,-1],r)||ls(t,n,this.points,s,o,i-f,a,[0,-1],r)||pu(t,n,f,f,s-l+u,o-c+u,r)||pu(t,n,f,f,s+l-u,o-c+u,r)||pu(t,n,f,f,s+l-u,o+c-u,r)||pu(t,n,f,f,s-l+u,o+c-u,r))}}},fs.generateCutRectangle=function(){return this.nodeShapes["cut-rectangle"]=this.nodeShapes.cutrectangle={renderer:this,name:"cut-rectangle",cornerLength:gb(),points:sr(4,0),draw:function(t,n,r,i,a,s){this.renderer.nodeShapeImpl(this.name,t,n,r,i,a,null,s)},generateCutTrianglePts:function(t,n,r,i,a){var s=a==="auto"?this.cornerLength:a,o=n/2,u=t/2,l=r-u,c=r+u,f=i-o,d=i+o;return{topLeft:[l,f+s,l+s,f,l+s,f+s],topRight:[c-s,f,c,f+s,c-s,f+s],bottomRight:[c,d-s,c-s,d,c-s,d-s],bottomLeft:[l+s,d,l,d-s,l+s,d-s]}},intersectLine:function(t,n,r,i,a,s,o,u){var l=this.generateCutTrianglePts(r+2*o,i+2*o,t,n,u),c=[].concat.apply([],[l.topLeft.splice(0,4),l.topRight.splice(0,4),l.bottomRight.splice(0,4),l.bottomLeft.splice(0,4)]);return rd(a,s,c,t,n)},checkPoint:function(t,n,r,i,a,s,o,u){var l=u==="auto"?this.cornerLength:u;if(ls(t,n,this.points,s,o,i,a-2*l,[0,-1],r)||ls(t,n,this.points,s,o,i-2*l,a,[0,-1],r))return!0;var c=this.generateCutTrianglePts(i,a,s,o);return Pr(t,n,c.topLeft)||Pr(t,n,c.topRight)||Pr(t,n,c.bottomRight)||Pr(t,n,c.bottomLeft)}}},fs.generateBarrel=function(){return this.nodeShapes.barrel={renderer:this,name:"barrel",points:sr(4,0),draw:function(t,n,r,i,a,s){this.renderer.nodeShapeImpl(this.name,t,n,r,i,a)},intersectLine:function(t,n,r,i,a,s,o,u){var l=.15,c=.5,f=.85,d=this.generateBarrelBezierPts(r+2*o,i+2*o,t,n),h=function(v){var m=Yl({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},l),y=Yl({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},c),b=Yl({x:v[0],y:v[1]},{x:v[2],y:v[3]},{x:v[4],y:v[5]},f);return[v[0],v[1],m.x,m.y,y.x,y.y,b.x,b.y,v[4],v[5]]},g=[].concat(h(d.topLeft),h(d.topRight),h(d.bottomRight),h(d.bottomLeft));return rd(a,s,g,t,n)},generateBarrelBezierPts:function(t,n,r,i){var a=n/2,s=t/2,o=r-s,u=r+s,l=i-a,c=i+a,f=pb(t,n),d=f.heightOffset,h=f.widthOffset,g=f.ctrlPtOffsetPct*t,p={topLeft:[o,l+d,o+g,l,o+h,l],topRight:[u-h,l,u-g,l,u,l+d],bottomRight:[u,c-d,u-g,c,u-h,c],bottomLeft:[o+h,c,o+g,c,o,c-d]};return p.topLeft.isTop=!0,p.topRight.isTop=!0,p.bottomLeft.isBottom=!0,p.bottomRight.isBottom=!0,p},checkPoint:function(t,n,r,i,a,s,o,u){var l=pb(i,a),c=l.heightOffset,f=l.widthOffset;if(ls(t,n,this.points,s,o,i,a-2*c,[0,-1],r)||ls(t,n,this.points,s,o,i-2*f,a,[0,-1],r))return!0;for(var d=this.generateBarrelBezierPts(i,a,s,o),h=function(C,S,_){var k=_[4],T=_[2],A=_[0],$=_[5],M=_[1],D=Math.min(k,A),P=Math.max(k,A),N=Math.min($,M),O=Math.max($,M);if(D<=C&&C<=P&&N<=S&&S<=O){var q=tW(k,T,A),z=YV(q[0],q[1],q[2],C),W=z.filter(function(Y){return 0<=Y&&Y<=1});if(W.length>0)return W[0]}return null},g=Object.keys(d),p=0;p<g.length;p++){var v=g[p],m=d[v],y=h(t,n,m);if(y!=null){var b=m[5],w=m[3],E=m[1],F=vn(b,w,E,y);if(m.isTop&&F<=n||m.isBottom&&n<=F)return!0}}return!1}}},fs.generateBottomRoundrectangle=function(){return this.nodeShapes["bottom-round-rectangle"]=this.nodeShapes.bottomroundrectangle={renderer:this,name:"bottom-round-rectangle",points:sr(4,0),draw:function(t,n,r,i,a,s){this.renderer.nodeShapeImpl(this.name,t,n,r,i,a,this.points,s)},intersectLine:function(t,n,r,i,a,s,o,u){var l=t-(r/2+o),c=n-(i/2+o),f=c,d=t+(r/2+o),h=lo(a,s,t,n,l,c,d,f,!1);return h.length>0?h:gT(a,s,t,n,r,i,o,u)},checkPoint:function(t,n,r,i,a,s,o,u){u=u==="auto"?vu(i,a):u;var l=2*u;if(ls(t,n,this.points,s,o,i,a-l,[0,-1],r)||ls(t,n,this.points,s,o,i-l,a,[0,-1],r))return!0;var c=i/2+2*r,f=a/2+2*r,d=[s-c,o-f,s-c,o,s+c,o,s+c,o-f];return!!(Pr(t,n,d)||pu(t,n,l,l,s+i/2-u,o+a/2-u,r)||pu(t,n,l,l,s-i/2+u,o+a/2-u,r))}}},fs.registerNodeShapes=function(){var e=this.nodeShapes={},t=this;this.generateEllipse(),this.generatePolygon("triangle",sr(3,0)),this.generateRoundPolygon("round-triangle",sr(3,0)),this.generatePolygon("rectangle",sr(4,0)),e.square=e.rectangle,this.generateRoundRectangle(),this.generateCutRectangle(),this.generateBarrel(),this.generateBottomRoundrectangle();{var n=[0,1,1,0,0,-1,-1,0];this.generatePolygon("diamond",n),this.generateRoundPolygon("round-diamond",n)}this.generatePolygon("pentagon",sr(5,0)),this.generateRoundPolygon("round-pentagon",sr(5,0)),this.generatePolygon("hexagon",sr(6,0)),this.generateRoundPolygon("round-hexagon",sr(6,0)),this.generatePolygon("heptagon",sr(7,0)),this.generateRoundPolygon("round-heptagon",sr(7,0)),this.generatePolygon("octagon",sr(8,0)),this.generateRoundPolygon("round-octagon",sr(8,0));var r=new Array(20);{var i=hb(5,0),a=hb(5,Math.PI/5),s=.5*(3-Math.sqrt(5));s*=1.57;for(var o=0;o<a.length/2;o++)a[o*2]*=s,a[o*2+1]*=s;for(var o=0;o<20/4;o++)r[o*4]=i[o*2],r[o*4+1]=i[o*2+1],r[o*4+2]=a[o*2],r[o*4+3]=a[o*2+1]}r=pT(r),this.generatePolygon("star",r),this.generatePolygon("vee",[-1,-1,0,-.333,1,-1,0,1]),this.generatePolygon("rhomboid",[-1,-1,.333,-1,1,1,-.333,1]),this.generatePolygon("right-rhomboid",[-.333,-1,1,-1,.333,1,-1,1]),this.nodeShapes.concavehexagon=this.generatePolygon("concave-hexagon",[-1,-.95,-.75,0,-1,.95,1,.95,.75,0,1,-.95]);{var u=[-1,-1,.25,-1,1,0,.25,1,-1,1];this.generatePolygon("tag",u),this.generateRoundPolygon("round-tag",u)}e.makePolygon=function(l){var c=l.join("$"),f="polygon-"+c,d;return(d=this[f])?d:t.generatePolygon(f,l)}};var yd={};yd.timeToRender=function(){return this.redrawTotalTime/this.redrawCount},yd.redraw=function(e){e=e||aT();var t=this;t.averageRedrawTime===void 0&&(t.averageRedrawTime=0),t.lastRedrawTime===void 0&&(t.lastRedrawTime=0),t.lastDrawTime===void 0&&(t.lastDrawTime=0),t.requestedFrame=!0,t.renderOptions=e},yd.beforeRender=function(e,t){if(!this.destroyed){t==null&&zt("Priority is not optional for beforeRender");var n=this.beforeRenderCallbacks;n.push({fn:e,priority:t}),n.sort(function(r,i){return i.priority-r.priority})}};var tD=function(t,n,r){for(var i=t.beforeRenderCallbacks,a=0;a<i.length;a++)i[a].fn(n,r)};yd.startRenderLoop=function(){var e=this,t=e.cy;if(!e.renderLoopStarted){e.renderLoopStarted=!0;var n=function(i){if(!e.destroyed){if(!t.batching())if(e.requestedFrame&&!e.skipFrame){tD(e,!0,i);var a=ss();e.render(e.renderOptions);var s=e.lastDrawTime=ss();e.averageRedrawTime===void 0&&(e.averageRedrawTime=s-a),e.redrawCount===void 0&&(e.redrawCount=0),e.redrawCount++,e.redrawTotalTime===void 0&&(e.redrawTotalTime=0);var o=s-a;e.redrawTotalTime+=o,e.lastRedrawTime=o,e.averageRedrawTime=e.averageRedrawTime/2+o/2,e.requestedFrame=!1}else tD(e,!1,i);e.skipFrame=!1,tp(n)}};tp(n)}};var mG=function(t){this.init(t)},nD=mG,fc=nD.prototype;fc.clientFunctions=["redrawHint","render","renderTo","matchCanvasSize","nodeShapeImpl","arrowShapeImpl"],fc.init=function(e){var t=this;t.options=e,t.cy=e.cy;var n=t.container=e.cy.container(),r=t.cy.window();if(r){var i=r.document,a=i.head,s="__________cytoscape_stylesheet",o="__________cytoscape_container",u=i.getElementById(s)!=null;if(n.className.indexOf(o)<0&&(n.className=(n.className||"")+" "+o),!u){var l=i.createElement("style");l.id=s,l.textContent="."+o+" { position: relative; }",a.insertBefore(l,a.children[0])}var c=r.getComputedStyle(n),f=c.getPropertyValue("position");f==="static"&&gt("A Cytoscape container has style position:static and so can not use UI extensions properly")}t.selection=[void 0,void 0,void 0,void 0,0],t.bezierProjPcts=[.05,.225,.4,.5,.6,.775,.95],t.hoverData={down:null,last:null,downTime:null,triggerMode:null,dragging:!1,initialPan:[null,null],capture:!1},t.dragData={possibleDragElements:[]},t.touchData={start:null,capture:!1,startPosition:[null,null,null,null,null,null],singleTouchStartTime:null,singleTouchMoved:!0,now:[null,null,null,null,null,null],earlier:[null,null,null,null,null,null]},t.redraws=0,t.showFps=e.showFps,t.debug=e.debug,t.webgl=e.webgl,t.hideEdgesOnViewport=e.hideEdgesOnViewport,t.textureOnViewport=e.textureOnViewport,t.wheelSensitivity=e.wheelSensitivity,t.motionBlurEnabled=e.motionBlur,t.forcedPixelRatio=ve(e.pixelRatio)?e.pixelRatio:null,t.motionBlur=e.motionBlur,t.motionBlurOpacity=e.motionBlurOpacity,t.motionBlurTransparency=1-t.motionBlurOpacity,t.motionBlurPxRatio=1,t.mbPxRBlurry=1,t.minMbLowQualFrames=4,t.fullQualityMb=!1,t.clearedForMotionBlur=[],t.desktopTapThreshold=e.desktopTapThreshold,t.desktopTapThreshold2=e.desktopTapThreshold*e.desktopTapThreshold,t.touchTapThreshold=e.touchTapThreshold,t.touchTapThreshold2=e.touchTapThreshold*e.touchTapThreshold,t.tapholdDuration=500,t.bindings=[],t.beforeRenderCallbacks=[],t.beforeRenderPriorities={animations:400,eleCalcs:300,eleTxrDeq:200,lyrTxrDeq:150,lyrTxrSkip:100},t.registerNodeShapes(),t.registerArrowShapes(),t.registerCalculationListeners()},fc.notify=function(e,t){var n=this,r=n.cy;if(!this.destroyed){if(e==="init"){n.load();return}if(e==="destroy"){n.destroy();return}(e==="add"||e==="remove"||e==="move"&&r.hasCompoundNodes()||e==="load"||e==="zorder"||e==="mount")&&n.invalidateCachedZSortedEles(),e==="viewport"&&n.redrawHint("select",!0),e==="gc"&&n.redrawHint("gc",!0),(e==="load"||e==="resize"||e==="mount")&&(n.invalidateContainerClientCoordsCache(),n.matchCanvasSize(n.container)),n.redrawHint("eles",!0),n.redrawHint("drag",!0),this.startRenderLoop(),this.redraw()}},fc.destroy=function(){var e=this;e.destroyed=!0,e.cy.stopAnimationLoop();for(var t=0;t<e.bindings.length;t++){var n=e.bindings[t],r=n,i=r.target;(i.off||i.removeEventListener).apply(i,r.args)}if(e.bindings=[],e.beforeRenderCallbacks=[],e.onUpdateEleCalcsFns=[],e.removeObserver&&e.removeObserver.disconnect(),e.styleObserver&&e.styleObserver.disconnect(),e.resizeObserver&&e.resizeObserver.disconnect(),e.labelCalcDiv)try{document.body.removeChild(e.labelCalcDiv)}catch{}},fc.isHeadless=function(){return!1},[N2,J$,eD,cc,fs,yd].forEach(function(e){Ie(fc,e)});var U2=1e3/60,rD={setupDequeueing:function(t){return function(){var r=this,i=this.renderer;if(!r.dequeueingSetup){r.dequeueingSetup=!0;var a=Xf(function(){i.redrawHint("eles",!0),i.redrawHint("drag",!0),i.redraw()},t.deqRedrawThreshold),s=function(l,c){var f=ss(),d=i.averageRedrawTime,h=i.lastRedrawTime,g=[],p=i.cy.extent(),v=i.getPixelRatio();for(l||i.flushRenderedStyleQueue();;){var m=ss(),y=m-f,b=m-c;if(h<U2){var w=U2-(l?d:0);if(b>=t.deqFastCost*w)break}else if(l){if(y>=t.deqCost*h||y>=t.deqAvgCost*d)break}else if(b>=t.deqNoDrawCost*U2)break;var E=t.deq(r,v,p);if(E.length>0)for(var F=0;F<E.length;F++)g.push(E[F]);else break}g.length>0&&(t.onDeqd(r,g),!l&&t.shouldRedraw(r,g,v,p)&&a())},o=t.priority||sb;i.beforeRender(s,o(r))}}}},yG=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:rp;ro(this,e),this.idsByKey=new us,this.keyForId=new us,this.cachesByLvl=new us,this.lvls=[],this.getKey=t,this.doesEleInvalidateKey=n}return io(e,[{key:"getIdsFor",value:function(n){n==null&&zt("Can not get id list for null key");var r=this.idsByKey,i=this.idsByKey.get(n);return i||(i=new jl,r.set(n,i)),i}},{key:"addIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).add(r)}},{key:"deleteIdForKey",value:function(n,r){n!=null&&this.getIdsFor(n).delete(r)}},{key:"getNumberOfIdsForKey",value:function(n){return n==null?0:this.getIdsFor(n).size}},{key:"updateKeyMappingFor",value:function(n){var r=n.id(),i=this.keyForId.get(r),a=this.getKey(n);this.deleteIdForKey(i,r),this.addIdForKey(a,r),this.keyForId.set(r,a)}},{key:"deleteKeyMappingFor",value:function(n){var r=n.id(),i=this.keyForId.get(r);this.deleteIdForKey(i,r),this.keyForId.delete(r)}},{key:"keyHasChangedFor",value:function(n){var r=n.id(),i=this.keyForId.get(r),a=this.getKey(n);return i!==a}},{key:"isInvalid",value:function(n){return this.keyHasChangedFor(n)||this.doesEleInvalidateKey(n)}},{key:"getCachesAt",value:function(n){var r=this.cachesByLvl,i=this.lvls,a=r.get(n);return a||(a=new us,r.set(n,a),i.push(n)),a}},{key:"getCache",value:function(n,r){return this.getCachesAt(r).get(n)}},{key:"get",value:function(n,r){var i=this.getKey(n),a=this.getCache(i,r);return a!=null&&this.updateKeyMappingFor(n),a}},{key:"getForCachedKey",value:function(n,r){var i=this.keyForId.get(n.id()),a=this.getCache(i,r);return a}},{key:"hasCache",value:function(n,r){return this.getCachesAt(r).has(n)}},{key:"has",value:function(n,r){var i=this.getKey(n);return this.hasCache(i,r)}},{key:"setCache",value:function(n,r,i){i.key=n,this.getCachesAt(r).set(n,i)}},{key:"set",value:function(n,r,i){var a=this.getKey(n);this.setCache(a,r,i),this.updateKeyMappingFor(n)}},{key:"deleteCache",value:function(n,r){this.getCachesAt(r).delete(n)}},{key:"delete",value:function(n,r){var i=this.getKey(n);this.deleteCache(i,r)}},{key:"invalidateKey",value:function(n){var r=this;this.lvls.forEach(function(i){return r.deleteCache(n,i)})}},{key:"invalidate",value:function(n){var r=n.id(),i=this.keyForId.get(r);this.deleteKeyMappingFor(n);var a=this.doesEleInvalidateKey(n);return a&&this.invalidateKey(i),a||this.getNumberOfIdsForKey(i)===0}}])}(),iD=25,Hp=50,jp=-4,V2=3,aD=7.99,bG=8,wG=1024,xG=1024,EG=1024,FG=.2,SG=.8,CG=10,kG=.15,_G=.1,AG=.9,TG=.9,MG=100,$G=1,dc={dequeue:"dequeue",downscale:"downscale",highQuality:"highQuality"},DG=an({getKey:null,doesEleInvalidateKey:rp,drawElement:null,getBoundingBox:null,getRotationPoint:null,getRotationOffset:null,isVisible:tT,allowEdgeTxrCaching:!0,allowParentTxrCaching:!0}),bd=function(t,n){var r=this;r.renderer=t,r.onDequeues=[];var i=DG(n);Ie(r,i),r.lookup=new yG(i.getKey,i.doesEleInvalidateKey),r.setupDequeueing()},sn=bd.prototype;sn.reasons=dc,sn.getTextureQueue=function(e){var t=this;return t.eleImgCaches=t.eleImgCaches||{},t.eleImgCaches[e]=t.eleImgCaches[e]||[]},sn.getRetiredTextureQueue=function(e){var t=this,n=t.eleImgCaches.retired=t.eleImgCaches.retired||{},r=n[e]=n[e]||[];return r},sn.getElementQueue=function(){var e=this,t=e.eleCacheQueue=e.eleCacheQueue||new ed(function(n,r){return r.reqs-n.reqs});return t},sn.getElementKeyToQueue=function(){var e=this,t=e.eleKeyToCacheQueue=e.eleKeyToCacheQueue||{};return t},sn.getElement=function(e,t,n,r,i){var a=this,s=this.renderer,o=s.cy.zoom(),u=this.lookup;if(!t||t.w===0||t.h===0||isNaN(t.w)||isNaN(t.h)||!e.visible()||e.removed()||!a.allowEdgeTxrCaching&&e.isEdge()||!a.allowParentTxrCaching&&e.isParent())return null;if(r==null&&(r=Math.ceil(cb(o*n))),r<jp)r=jp;else if(o>=aD||r>V2)return null;var l=Math.pow(2,r),c=t.h*l,f=t.w*l,d=s.eleTextBiggerThanMin(e,l);if(!this.isVisible(e,d))return null;var h=u.get(e,r);if(h&&h.invalidated&&(h.invalidated=!1,h.texture.invalidatedWidth-=h.width),h)return h;var g;if(c<=iD?g=iD:c<=Hp?g=Hp:g=Math.ceil(c/Hp)*Hp,c>EG||f>xG)return null;var p=a.getTextureQueue(g),v=p[p.length-2],m=function(){return a.recycleTexture(g,f)||a.addTexture(g,f)};v||(v=p[p.length-1]),v||(v=m()),v.width-v.usedWidth<f&&(v=m());for(var y=function(D){return D&&D.scaledLabelShown===d},b=i&&i===dc.dequeue,w=i&&i===dc.highQuality,E=i&&i===dc.downscale,F,x=r+1;x<=V2;x++){var C=u.get(e,x);if(C){F=C;break}}var S=F&&F.level===r+1?F:null,_=function(){v.context.drawImage(S.texture.canvas,S.x,0,S.width,S.height,v.usedWidth,0,f,c)};if(v.context.setTransform(1,0,0,1,0,0),v.context.clearRect(v.usedWidth,0,f,g),y(S))_();else if(y(F))if(w){for(var k=F.level;k>r;k--)S=a.getElement(e,t,n,k,dc.downscale);_()}else return a.queueElement(e,F.level-1),F;else{var T;if(!b&&!w&&!E)for(var A=r-1;A>=jp;A--){var $=u.get(e,A);if($){T=$;break}}if(y(T))return a.queueElement(e,r),T;v.context.translate(v.usedWidth,0),v.context.scale(l,l),this.drawElement(v.context,e,t,d,!1),v.context.scale(1/l,1/l),v.context.translate(-v.usedWidth,0)}return h={x:v.usedWidth,texture:v,level:r,scale:l,width:f,height:c,scaledLabelShown:d},v.usedWidth+=Math.ceil(f+bG),v.eleCaches.push(h),u.set(e,r,h),a.checkTextureFullness(v),h},sn.invalidateElements=function(e){for(var t=0;t<e.length;t++)this.invalidateElement(e[t])},sn.invalidateElement=function(e){var t=this,n=t.lookup,r=[],i=n.isInvalid(e);if(i){for(var a=jp;a<=V2;a++){var s=n.getForCachedKey(e,a);s&&r.push(s)}var o=n.invalidate(e);if(o)for(var u=0;u<r.length;u++){var l=r[u],c=l.texture;c.invalidatedWidth+=l.width,l.invalidated=!0,t.checkTextureUtility(c)}t.removeFromQueue(e)}},sn.checkTextureUtility=function(e){e.invalidatedWidth>=FG*e.width&&this.retireTexture(e)},sn.checkTextureFullness=function(e){var t=this,n=t.getTextureQueue(e.height);e.usedWidth/e.width>SG&&e.fullnessChecks>=CG?uo(n,e):e.fullnessChecks++},sn.retireTexture=function(e){var t=this,n=e.height,r=t.getTextureQueue(n),i=this.lookup;uo(r,e),e.retired=!0;for(var a=e.eleCaches,s=0;s<a.length;s++){var o=a[s];i.deleteCache(o.key,o.level)}ob(a);var u=t.getRetiredTextureQueue(n);u.push(e)},sn.addTexture=function(e,t){var n=this,r=n.getTextureQueue(e),i={};return r.push(i),i.eleCaches=[],i.height=e,i.width=Math.max(wG,t),i.usedWidth=0,i.invalidatedWidth=0,i.fullnessChecks=0,i.canvas=n.renderer.makeOffscreenCanvas(i.width,i.height),i.context=i.canvas.getContext("2d"),i},sn.recycleTexture=function(e,t){for(var n=this,r=n.getTextureQueue(e),i=n.getRetiredTextureQueue(e),a=0;a<i.length;a++){var s=i[a];if(s.width>=t)return s.retired=!1,s.usedWidth=0,s.invalidatedWidth=0,s.fullnessChecks=0,ob(s.eleCaches),s.context.setTransform(1,0,0,1,0,0),s.context.clearRect(0,0,s.width,s.height),uo(i,s),r.push(s),s}},sn.queueElement=function(e,t){var n=this,r=n.getElementQueue(),i=n.getElementKeyToQueue(),a=this.getKey(e),s=i[a];if(s)s.level=Math.max(s.level,t),s.eles.merge(e),s.reqs++,r.updateItem(s);else{var o={eles:e.spawn().merge(e),level:t,reqs:1,key:a};r.push(o),i[a]=o}},sn.dequeue=function(e){for(var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=[],a=t.lookup,s=0;s<$G&&n.size()>0;s++){var o=n.pop(),u=o.key,l=o.eles[0],c=a.hasCache(l,o.level);if(r[u]=null,c)continue;i.push(o);var f=t.getBoundingBox(l);t.getElement(l,f,e,o.level,dc.dequeue)}return i},sn.removeFromQueue=function(e){var t=this,n=t.getElementQueue(),r=t.getElementKeyToQueue(),i=this.getKey(e),a=r[i];a!=null&&(a.eles.length===1?(a.reqs=ab,n.updateItem(a),n.pop(),r[i]=null):a.eles.unmerge(e))},sn.onDequeue=function(e){this.onDequeues.push(e)},sn.offDequeue=function(e){uo(this.onDequeues,e)},sn.setupDequeueing=rD.setupDequeueing({deqRedrawThreshold:MG,deqCost:kG,deqAvgCost:_G,deqNoDrawCost:AG,deqFastCost:TG,deq:function(t,n,r){return t.dequeue(n,r)},onDeqd:function(t,n){for(var r=0;r<t.onDequeues.length;r++){var i=t.onDequeues[r];i(n)}},shouldRedraw:function(t,n,r,i){for(var a=0;a<n.length;a++)for(var s=n[a].eles,o=0;o<s.length;o++){var u=s[o].boundingBox();if(fb(u,i))return!0}return!1},priority:function(t){return t.renderer.beforeRenderPriorities.eleTxrDeq}});var RG=1,wd=-4,Gp=2,PG=3.99,NG=50,OG=50,IG=.15,BG=.1,LG=.9,zG=.9,qG=1,sD=250,UG=4e3*4e3,oD=32767,VG=!0,uD=function(t){var n=this,r=n.renderer=t,i=r.cy;n.layersByLevel={},n.firstGet=!0,n.lastInvalidationTime=ss()-2*sD,n.skipping=!1,n.eleTxrDeqs=i.collection(),n.scheduleElementRefinement=Xf(function(){n.refineElementTextures(n.eleTxrDeqs),n.eleTxrDeqs.unmerge(n.eleTxrDeqs)},OG),r.beforeRender(function(s,o){o-n.lastInvalidationTime<=sD?n.skipping=!0:n.skipping=!1},r.beforeRenderPriorities.lyrTxrSkip);var a=function(o,u){return u.reqs-o.reqs};n.layersQueue=new ed(a),n.setupDequeueing()},Bn=uD.prototype,lD=0,WG=Math.pow(2,53)-1;Bn.makeLayer=function(e,t){var n=Math.pow(2,t),r=Math.ceil(e.w*n),i=Math.ceil(e.h*n),a=this.renderer.makeOffscreenCanvas(r,i),s={id:lD=++lD%WG,bb:e,level:t,width:r,height:i,canvas:a,context:a.getContext("2d"),eles:[],elesQueue:[],reqs:0},o=s.context,u=-s.bb.x1,l=-s.bb.y1;return o.scale(n,n),o.translate(u,l),s},Bn.getLayers=function(e,t,n){var r=this,i=r.renderer,a=i.cy,s=a.zoom(),o=r.firstGet;if(r.firstGet=!1,n==null){if(n=Math.ceil(cb(s*t)),n<wd)n=wd;else if(s>=PG||n>Gp)return null}r.validateLayersElesOrdering(n,e);var u=r.layersByLevel,l=Math.pow(2,n),c=u[n]=u[n]||[],f,d=r.levelIsComplete(n,e),h,g=function(){var _=function(M){if(r.validateLayersElesOrdering(M,e),r.levelIsComplete(M,e))return h=u[M],!0},k=function(M){if(!h)for(var D=n+M;wd<=D&&D<=Gp&&!_(D);D+=M);};k(1),k(-1);for(var T=c.length-1;T>=0;T--){var A=c[T];A.invalid&&uo(c,A)}};if(!d)g();else return c;var p=function(){if(!f){f=Rr();for(var _=0;_<e.length;_++)fT(f,e[_].boundingBox())}return f},v=function(_){_=_||{};var k=_.after;p();var T=Math.ceil(f.w*l),A=Math.ceil(f.h*l);if(T>oD||A>oD)return null;var $=T*A;if($>UG)return null;var M=r.makeLayer(f,n);if(k!=null){var D=c.indexOf(k)+1;c.splice(D,0,M)}else(_.insert===void 0||_.insert)&&c.unshift(M);return M};if(r.skipping&&!o)return null;for(var m=null,y=e.length/RG,b=!o,w=0;w<e.length;w++){var E=e[w],F=E._private.rscratch,x=F.imgLayerCaches=F.imgLayerCaches||{},C=x[n];if(C){m=C;continue}if((!m||m.eles.length>=y||!hT(m.bb,E.boundingBox()))&&(m=v({insert:!0,after:m}),!m))return null;h||b?r.queueLayer(m,E):r.drawEleInLayer(m,E,n,t),m.eles.push(E),x[n]=m}return h||(b?null:c)},Bn.getEleLevelForLayerLevel=function(e,t){return e},Bn.drawEleInLayer=function(e,t,n,r){var i=this,a=this.renderer,s=e.context,o=t.boundingBox();o.w===0||o.h===0||!t.visible()||(n=i.getEleLevelForLayerLevel(n,r),a.setImgSmoothing(s,!1),a.drawCachedElement(s,t,null,null,n,VG),a.setImgSmoothing(s,!0))},Bn.levelIsComplete=function(e,t){var n=this,r=n.layersByLevel[e];if(!r||r.length===0)return!1;for(var i=0,a=0;a<r.length;a++){var s=r[a];if(s.reqs>0||s.invalid)return!1;i+=s.eles.length}return i===t.length},Bn.validateLayersElesOrdering=function(e,t){var n=this.layersByLevel[e];if(n)for(var r=0;r<n.length;r++){for(var i=n[r],a=-1,s=0;s<t.length;s++)if(i.eles[0]===t[s]){a=s;break}if(a<0){this.invalidateLayer(i);continue}for(var o=a,s=0;s<i.eles.length;s++)if(i.eles[s]!==t[o+s]){this.invalidateLayer(i);break}}},Bn.updateElementsInLayers=function(e,t){for(var n=this,r=Hf(e[0]),i=0;i<e.length;i++)for(var a=r?null:e[i],s=r?e[i]:e[i].ele,o=s._private.rscratch,u=o.imgLayerCaches=o.imgLayerCaches||{},l=wd;l<=Gp;l++){var c=u[l];c&&(a&&n.getEleLevelForLayerLevel(c.level)!==a.level||t(c,s,a))}},Bn.haveLayers=function(){for(var e=this,t=!1,n=wd;n<=Gp;n++){var r=e.layersByLevel[n];if(r&&r.length>0){t=!0;break}}return t},Bn.invalidateElements=function(e){var t=this;e.length!==0&&(t.lastInvalidationTime=ss(),!(e.length===0||!t.haveLayers())&&t.updateElementsInLayers(e,function(r,i,a){t.invalidateLayer(r)}))},Bn.invalidateLayer=function(e){if(this.lastInvalidationTime=ss(),!e.invalid){var t=e.level,n=e.eles,r=this.layersByLevel[t];uo(r,e),e.elesQueue=[],e.invalid=!0,e.replacement&&(e.replacement.invalid=!0);for(var i=0;i<n.length;i++){var a=n[i]._private.rscratch.imgLayerCaches;a&&(a[t]=null)}}},Bn.refineElementTextures=function(e){var t=this;t.updateElementsInLayers(e,function(r,i,a){var s=r.replacement;if(s||(s=r.replacement=t.makeLayer(r.bb,r.level),s.replaces=r,s.eles=r.eles),!s.reqs)for(var o=0;o<s.eles.length;o++)t.queueLayer(s,s.eles[o])})},Bn.enqueueElementRefinement=function(e){this.eleTxrDeqs.merge(e),this.scheduleElementRefinement()},Bn.queueLayer=function(e,t){var n=this,r=n.layersQueue,i=e.elesQueue,a=i.hasId=i.hasId||{};if(!e.replacement){if(t){if(a[t.id()])return;i.push(t),a[t.id()]=!0}e.reqs?(e.reqs++,r.updateItem(e)):(e.reqs=1,r.push(e))}},Bn.dequeue=function(e){for(var t=this,n=t.layersQueue,r=[],i=0;i<qG&&n.size()!==0;){var a=n.peek();if(a.replacement){n.pop();continue}if(a.replaces&&a!==a.replaces.replacement){n.pop();continue}if(a.invalid){n.pop();continue}var s=a.elesQueue.shift();s&&(t.drawEleInLayer(a,s,a.level,e),i++),r.length===0&&r.push(!0),a.elesQueue.length===0&&(n.pop(),a.reqs=0,a.replaces&&t.applyLayerReplacement(a),t.requestRedraw())}return r},Bn.applyLayerReplacement=function(e){var t=this,n=t.layersByLevel[e.level],r=e.replaces,i=n.indexOf(r);if(!(i<0||r.invalid)){n[i]=e;for(var a=0;a<e.eles.length;a++){var s=e.eles[a]._private,o=s.imgLayerCaches=s.imgLayerCaches||{};o&&(o[e.level]=e)}t.requestRedraw()}},Bn.requestRedraw=Xf(function(){var e=this.renderer;e.redrawHint("eles",!0),e.redrawHint("drag",!0),e.redraw()},100),Bn.setupDequeueing=rD.setupDequeueing({deqRedrawThreshold:NG,deqCost:IG,deqAvgCost:BG,deqNoDrawCost:LG,deqFastCost:zG,deq:function(t,n){return t.dequeue(n)},onDeqd:sb,shouldRedraw:tT,priority:function(t){return t.renderer.beforeRenderPriorities.lyrTxrDeq}});var cD={},fD;function HG(e,t){for(var n=0;n<t.length;n++){var r=t[n];e.lineTo(r.x,r.y)}}function jG(e,t,n){for(var r,i=0;i<t.length;i++){var a=t[i];i===0&&(r=a),e.lineTo(a.x,a.y)}e.quadraticCurveTo(n.x,n.y,r.x,r.y)}function dD(e,t,n){e.beginPath&&e.beginPath();for(var r=t,i=0;i<r.length;i++){var a=r[i];e.lineTo(a.x,a.y)}var s=n,o=n[0];e.moveTo(o.x,o.y);for(var i=1;i<s.length;i++){var a=s[i];e.lineTo(a.x,a.y)}e.closePath&&e.closePath()}function GG(e,t,n,r,i){e.beginPath&&e.beginPath(),e.arc(n,r,i,0,Math.PI*2,!1);var a=t,s=a[0];e.moveTo(s.x,s.y);for(var o=0;o<a.length;o++){var u=a[o];e.lineTo(u.x,u.y)}e.closePath&&e.closePath()}function YG(e,t,n,r){e.arc(t,n,r,0,Math.PI*2,!1)}cD.arrowShapeImpl=function(e){return(fD||(fD={polygon:HG,"triangle-backcurve":jG,"triangle-tee":dD,"circle-triangle":GG,"triangle-cross":dD,circle:YG}))[e]};var ba={};ba.drawElement=function(e,t,n,r,i,a){var s=this;t.isNode()?s.drawNode(e,t,n,r,i,a):s.drawEdge(e,t,n,r,i,a)},ba.drawElementOverlay=function(e,t){var n=this;t.isNode()?n.drawNodeOverlay(e,t):n.drawEdgeOverlay(e,t)},ba.drawElementUnderlay=function(e,t){var n=this;t.isNode()?n.drawNodeUnderlay(e,t):n.drawEdgeUnderlay(e,t)},ba.drawCachedElementPortion=function(e,t,n,r,i,a,s,o){var u=this,l=n.getBoundingBox(t);if(!(l.w===0||l.h===0)){var c=n.getElement(t,l,r,i,a);if(c!=null){var f=o(u,t);if(f===0)return;var d=s(u,t),h=l.x1,g=l.y1,p=l.w,v=l.h,m,y,b,w,E;if(d!==0){var F=n.getRotationPoint(t);b=F.x,w=F.y,e.translate(b,w),e.rotate(d),E=u.getImgSmoothing(e),E||u.setImgSmoothing(e,!0);var x=n.getRotationOffset(t);m=x.x,y=x.y}else m=h,y=g;var C;f!==1&&(C=e.globalAlpha,e.globalAlpha=C*f),e.drawImage(c.texture.canvas,c.x,0,c.width,c.height,m,y,p,v),f!==1&&(e.globalAlpha=C),d!==0&&(e.rotate(-d),e.translate(-b,-w),E||u.setImgSmoothing(e,!1))}else n.drawElement(e,t)}};var XG=function(){return 0},KG=function(t,n){return t.getTextAngle(n,null)},ZG=function(t,n){return t.getTextAngle(n,"source")},QG=function(t,n){return t.getTextAngle(n,"target")},JG=function(t,n){return n.effectiveOpacity()},W2=function(t,n){return n.pstyle("text-opacity").pfValue*n.effectiveOpacity()};ba.drawCachedElement=function(e,t,n,r,i,a){var s=this,o=s.data,u=o.eleTxrCache,l=o.lblTxrCache,c=o.slbTxrCache,f=o.tlbTxrCache,d=t.boundingBox(),h=a===!0?u.reasons.highQuality:null;if(!(d.w===0||d.h===0||!t.visible())&&(!r||fb(d,r))){var g=t.isEdge(),p=t.element()._private.rscratch.badLine;s.drawElementUnderlay(e,t),s.drawCachedElementPortion(e,t,u,n,i,h,XG,JG),(!g||!p)&&s.drawCachedElementPortion(e,t,l,n,i,h,KG,W2),g&&!p&&(s.drawCachedElementPortion(e,t,c,n,i,h,ZG,W2),s.drawCachedElementPortion(e,t,f,n,i,h,QG,W2)),s.drawElementOverlay(e,t)}},ba.drawElements=function(e,t){for(var n=this,r=0;r<t.length;r++){var i=t[r];n.drawElement(e,i)}},ba.drawCachedElements=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var s=t[a];i.drawCachedElement(e,s,n,r)}},ba.drawCachedNodes=function(e,t,n,r){for(var i=this,a=0;a<t.length;a++){var s=t[a];s.isNode()&&i.drawCachedElement(e,s,n,r)}},ba.drawLayeredElements=function(e,t,n,r){var i=this,a=i.data.lyrTxrCache.getLayers(t,n);if(a)for(var s=0;s<a.length;s++){var o=a[s],u=o.bb;u.w===0||u.h===0||e.drawImage(o.canvas,u.x1,u.y1,u.w,u.h)}else i.drawCachedElements(e,t,n,r)};var ds={};ds.drawEdge=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o=t._private.rscratch;if(!(a&&!t.visible())&&!(o.badLine||o.allpts==null||isNaN(o.allpts[0]))){var u;n&&(u=n,e.translate(-u.x1,-u.y1));var l=a?t.pstyle("opacity").value:1,c=a?t.pstyle("line-opacity").value:1,f=t.pstyle("curve-style").value,d=t.pstyle("line-style").value,h=t.pstyle("width").pfValue,g=t.pstyle("line-cap").value,p=t.pstyle("line-outline-width").value,v=t.pstyle("line-outline-color").value,m=l*c,y=l*c,b=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;f==="straight-triangle"?(s.eleStrokeStyle(e,t,M),s.drawEdgeTrianglePath(t,e,o.allpts)):(e.lineWidth=h,e.lineCap=g,s.eleStrokeStyle(e,t,M),s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},w=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:m;if(e.lineWidth=h+p,e.lineCap=g,p>0)s.colorStrokeStyle(e,v[0],v[1],v[2],M);else{e.lineCap="butt";return}f==="straight-triangle"?s.drawEdgeTrianglePath(t,e,o.allpts):(s.drawEdgePath(t,e,o.allpts,d),e.lineCap="butt")},E=function(){i&&s.drawEdgeOverlay(e,t)},F=function(){i&&s.drawEdgeUnderlay(e,t)},x=function(){var M=arguments.length>0&&arguments[0]!==void 0?arguments[0]:y;s.drawArrowheads(e,t,M)},C=function(){s.drawElementText(e,t,null,r)};e.lineJoin="round";var S=t.pstyle("ghost").value==="yes";if(S){var _=t.pstyle("ghost-offset-x").pfValue,k=t.pstyle("ghost-offset-y").pfValue,T=t.pstyle("ghost-opacity").value,A=m*T;e.translate(_,k),b(A),x(A),e.translate(-_,-k)}else w();F(),b(),x(),E(),C(),n&&e.translate(u.x1,u.y1)}};var hD=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(n,r){if(r.visible()){var i=r.pstyle("".concat(t,"-opacity")).value;if(i!==0){var a=this,s=a.usePaths(),o=r._private.rscratch,u=r.pstyle("".concat(t,"-padding")).pfValue,l=2*u,c=r.pstyle("".concat(t,"-color")).value;n.lineWidth=l,o.edgeType==="self"&&!s?n.lineCap="butt":n.lineCap="round",a.colorStrokeStyle(n,c[0],c[1],c[2],i),a.drawEdgePath(r,n,o.allpts,"solid")}}}};ds.drawEdgeOverlay=hD("overlay"),ds.drawEdgeUnderlay=hD("underlay"),ds.drawEdgePath=function(e,t,n,r){var i=e._private.rscratch,a=t,s,o=!1,u=this.usePaths(),l=e.pstyle("line-dash-pattern").pfValue,c=e.pstyle("line-dash-offset").pfValue;if(u){var f=n.join("$"),d=i.pathCacheKey&&i.pathCacheKey===f;d?(s=t=i.pathCache,o=!0):(s=t=new Path2D,i.pathCacheKey=f,i.pathCache=s)}if(a.setLineDash)switch(r){case"dotted":a.setLineDash([1,1]);break;case"dashed":a.setLineDash(l),a.lineDashOffset=c;break;case"solid":a.setLineDash([]);break}if(!o&&!i.badLine)switch(t.beginPath&&t.beginPath(),t.moveTo(n[0],n[1]),i.edgeType){case"bezier":case"self":case"compound":case"multibezier":for(var h=2;h+3<n.length;h+=4)t.quadraticCurveTo(n[h],n[h+1],n[h+2],n[h+3]);break;case"straight":case"haystack":for(var g=2;g+1<n.length;g+=2)t.lineTo(n[g],n[g+1]);break;case"segments":if(i.isRound){var p=$i(i.roundCorners),v;try{for(p.s();!(v=p.n()).done;){var m=v.value;j$(t,m)}}catch(b){p.e(b)}finally{p.f()}t.lineTo(n[n.length-2],n[n.length-1])}else for(var y=2;y+1<n.length;y+=2)t.lineTo(n[y],n[y+1]);break}t=a,u?t.stroke(s):t.stroke(),t.setLineDash&&t.setLineDash([])},ds.drawEdgeTrianglePath=function(e,t,n){t.fillStyle=t.strokeStyle;for(var r=e.pstyle("width").pfValue,i=0;i+1<n.length;i+=2){var a=[n[i+2]-n[i],n[i+3]-n[i+1]],s=Math.sqrt(a[0]*a[0]+a[1]*a[1]),o=[a[1]/s,-a[0]/s],u=[o[0]*r/2,o[1]*r/2];t.beginPath(),t.moveTo(n[i]-u[0],n[i+1]-u[1]),t.lineTo(n[i]+u[0],n[i+1]+u[1]),t.lineTo(n[i+2],n[i+3]),t.closePath(),t.fill()}},ds.drawArrowheads=function(e,t,n){var r=t._private.rscratch,i=r.edgeType==="haystack";i||this.drawArrowhead(e,t,"source",r.arrowStartX,r.arrowStartY,r.srcArrowAngle,n),this.drawArrowhead(e,t,"mid-target",r.midX,r.midY,r.midtgtArrowAngle,n),this.drawArrowhead(e,t,"mid-source",r.midX,r.midY,r.midsrcArrowAngle,n),i||this.drawArrowhead(e,t,"target",r.arrowEndX,r.arrowEndY,r.tgtArrowAngle,n)},ds.drawArrowhead=function(e,t,n,r,i,a,s){if(!(isNaN(r)||r==null||isNaN(i)||i==null||isNaN(a)||a==null)){var o=this,u=t.pstyle(n+"-arrow-shape").value;if(u!=="none"){var l=t.pstyle(n+"-arrow-fill").value==="hollow"?"both":"filled",c=t.pstyle(n+"-arrow-fill").value,f=t.pstyle("width").pfValue,d=t.pstyle(n+"-arrow-width"),h=d.value==="match-line"?f:d.pfValue;d.units==="%"&&(h*=f);var g=t.pstyle("opacity").value;s===void 0&&(s=g);var p=e.globalCompositeOperation;(s!==1||c==="hollow")&&(e.globalCompositeOperation="destination-out",o.colorFillStyle(e,255,255,255,1),o.colorStrokeStyle(e,255,255,255,1),o.drawArrowShape(t,e,l,f,u,h,r,i,a),e.globalCompositeOperation=p);var v=t.pstyle(n+"-arrow-color").value;o.colorFillStyle(e,v[0],v[1],v[2],s),o.colorStrokeStyle(e,v[0],v[1],v[2],s),o.drawArrowShape(t,e,c,f,u,h,r,i,a)}}},ds.drawArrowShape=function(e,t,n,r,i,a,s,o,u){var l=this,c=this.usePaths()&&i!=="triangle-cross",f=!1,d,h=t,g={x:s,y:o},p=e.pstyle("arrow-scale").value,v=this.getArrowWidth(r,p),m=l.arrowShapes[i];if(c){var y=l.arrowPathCache=l.arrowPathCache||[],b=oo(i),w=y[b];w!=null?(d=t=w,f=!0):(d=t=new Path2D,y[b]=d)}f||(t.beginPath&&t.beginPath(),c?m.draw(t,1,0,{x:0,y:0},1):m.draw(t,v,u,g,r),t.closePath&&t.closePath()),t=h,c&&(t.translate(s,o),t.rotate(u),t.scale(v,v)),(n==="filled"||n==="both")&&(c?t.fill(d):t.fill()),(n==="hollow"||n==="both")&&(t.lineWidth=a/(c?v:1),t.lineJoin="miter",c?t.stroke(d):t.stroke()),c&&(t.scale(1/v,1/v),t.rotate(-u),t.translate(-s,-o))};var H2={};H2.safeDrawImage=function(e,t,n,r,i,a,s,o,u,l){if(!(i<=0||a<=0||u<=0||l<=0))try{e.drawImage(t,n,r,i,a,s,o,u,l)}catch(c){gt(c)}},H2.drawInscribedImage=function(e,t,n,r,i){var a=this,s=n.position(),o=s.x,u=s.y,l=n.cy().style(),c=l.getIndexedStyle.bind(l),f=c(n,"background-fit","value",r),d=c(n,"background-repeat","value",r),h=n.width(),g=n.height(),p=n.padding()*2,v=h+(c(n,"background-width-relative-to","value",r)==="inner"?0:p),m=g+(c(n,"background-height-relative-to","value",r)==="inner"?0:p),y=n._private.rscratch,b=c(n,"background-clip","value",r),w=b==="node",E=c(n,"background-image-opacity","value",r)*i,F=c(n,"background-image-smoothing","value",r),x=n.pstyle("corner-radius").value;x!=="auto"&&(x=n.pstyle("corner-radius").pfValue);var C=t.width||t.cachedW,S=t.height||t.cachedH;(C==null||S==null)&&(document.body.appendChild(t),C=t.cachedW=t.width||t.offsetWidth,S=t.cachedH=t.height||t.offsetHeight,document.body.removeChild(t));var _=C,k=S;if(c(n,"background-width","value",r)!=="auto"&&(c(n,"background-width","units",r)==="%"?_=c(n,"background-width","pfValue",r)*v:_=c(n,"background-width","pfValue",r)),c(n,"background-height","value",r)!=="auto"&&(c(n,"background-height","units",r)==="%"?k=c(n,"background-height","pfValue",r)*m:k=c(n,"background-height","pfValue",r)),!(_===0||k===0)){if(f==="contain"){var T=Math.min(v/_,m/k);_*=T,k*=T}else if(f==="cover"){var T=Math.max(v/_,m/k);_*=T,k*=T}var A=o-v/2,$=c(n,"background-position-x","units",r),M=c(n,"background-position-x","pfValue",r);$==="%"?A+=(v-_)*M:A+=M;var D=c(n,"background-offset-x","units",r),P=c(n,"background-offset-x","pfValue",r);D==="%"?A+=(v-_)*P:A+=P;var N=u-m/2,O=c(n,"background-position-y","units",r),q=c(n,"background-position-y","pfValue",r);O==="%"?N+=(m-k)*q:N+=q;var z=c(n,"background-offset-y","units",r),W=c(n,"background-offset-y","pfValue",r);z==="%"?N+=(m-k)*W:N+=W,y.pathCache&&(A-=o,N-=u,o=0,u=0);var Y=e.globalAlpha;e.globalAlpha=E;var J=a.getImgSmoothing(e),X=!1;if(F==="no"&&J?(a.setImgSmoothing(e,!1),X=!0):F==="yes"&&!J&&(a.setImgSmoothing(e,!0),X=!0),d==="no-repeat")w&&(e.save(),y.pathCache?e.clip(y.pathCache):(a.nodeShapes[a.getNodeShape(n)].draw(e,o,u,v,m,x,y),e.clip())),a.safeDrawImage(e,t,0,0,C,S,A,N,_,k),w&&e.restore();else{var te=e.createPattern(t,d);e.fillStyle=te,a.nodeShapes[a.getNodeShape(n)].draw(e,o,u,v,m,x,y),e.translate(A,N),e.fill(),e.translate(-A,-N)}e.globalAlpha=Y,X&&a.setImgSmoothing(e,J)}};var Su={};Su.eleTextBiggerThanMin=function(e,t){if(!t){var n=e.cy().zoom(),r=this.getPixelRatio(),i=Math.ceil(cb(n*r));t=Math.pow(2,i)}var a=e.pstyle("font-size").pfValue*t,s=e.pstyle("min-zoomed-font-size").pfValue;return!(a<s)},Su.drawElementText=function(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this;if(r==null){if(a&&!s.eleTextBiggerThanMin(t))return}else if(r===!1)return;if(t.isNode()){var o=t.pstyle("label");if(!o||!o.value)return;var u=s.getLabelJustification(t);e.textAlign=u,e.textBaseline="bottom"}else{var l=t.element()._private.rscratch.badLine,c=t.pstyle("label"),f=t.pstyle("source-label"),d=t.pstyle("target-label");if(l||(!c||!c.value)&&(!f||!f.value)&&(!d||!d.value))return;e.textAlign="center",e.textBaseline="bottom"}var h=!n,g;n&&(g=n,e.translate(-g.x1,-g.y1)),i==null?(s.drawText(e,t,null,h,a),t.isEdge()&&(s.drawText(e,t,"source",h,a),s.drawText(e,t,"target",h,a))):s.drawText(e,t,i,h,a),n&&e.translate(g.x1,g.y1)},Su.getFontCache=function(e){var t;this.fontCaches=this.fontCaches||[];for(var n=0;n<this.fontCaches.length;n++)if(t=this.fontCaches[n],t.context===e)return t;return t={context:e},this.fontCaches.push(t),t},Su.setupTextStyle=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,r=t.pstyle("font-style").strValue,i=t.pstyle("font-size").pfValue+"px",a=t.pstyle("font-family").strValue,s=t.pstyle("font-weight").strValue,o=n?t.effectiveOpacity()*t.pstyle("text-opacity").value:1,u=t.pstyle("text-outline-opacity").value*o,l=t.pstyle("color").value,c=t.pstyle("text-outline-color").value;e.font=r+" "+s+" "+i+" "+a,e.lineJoin="round",this.colorFillStyle(e,l[0],l[1],l[2],o),this.colorStrokeStyle(e,c[0],c[1],c[2],u)};function j2(e,t,n,r,i){var a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:5,s=arguments.length>6?arguments[6]:void 0;e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),s?e.stroke():e.fill()}Su.getTextAngle=function(e,t){var n,r=e._private,i=r.rscratch,a=t?t+"-":"",s=e.pstyle(a+"text-rotation");if(s.strValue==="autorotate"){var o=ui(i,"labelAngle",t);n=e.isEdge()?o:0}else s.strValue==="none"?n=0:n=s.pfValue;return n},Su.drawText=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=t._private,s=a.rscratch,o=i?t.effectiveOpacity():1;if(!(i&&(o===0||t.pstyle("text-opacity").value===0))){n==="main"&&(n=null);var u=ui(s,"labelX",n),l=ui(s,"labelY",n),c,f,d=this.getLabelText(t,n);if(d!=null&&d!==""&&!isNaN(u)&&!isNaN(l)){this.setupTextStyle(e,t,i);var h=n?n+"-":"",g=ui(s,"labelWidth",n),p=ui(s,"labelHeight",n),v=t.pstyle(h+"text-margin-x").pfValue,m=t.pstyle(h+"text-margin-y").pfValue,y=t.isEdge(),b=t.pstyle("text-halign").value,w=t.pstyle("text-valign").value;y&&(b="center",w="center"),u+=v,l+=m;var E;switch(r?E=this.getTextAngle(t,n):E=0,E!==0&&(c=u,f=l,e.translate(c,f),e.rotate(E),u=0,l=0),w){case"top":break;case"center":l+=p/2;break;case"bottom":l+=p;break}var F=t.pstyle("text-background-opacity").value,x=t.pstyle("text-border-opacity").value,C=t.pstyle("text-border-width").pfValue,S=t.pstyle("text-background-padding").pfValue,_=t.pstyle("text-background-shape").strValue,k=_.indexOf("round")===0,T=2;if(F>0||C>0&&x>0){var A=u-S;switch(b){case"left":A-=g;break;case"center":A-=g/2;break}var $=l-p-S,M=g+2*S,D=p+2*S;if(F>0){var P=e.fillStyle,N=t.pstyle("text-background-color").value;e.fillStyle="rgba("+N[0]+","+N[1]+","+N[2]+","+F*o+")",k?j2(e,A,$,M,D,T):e.fillRect(A,$,M,D),e.fillStyle=P}if(C>0&&x>0){var O=e.strokeStyle,q=e.lineWidth,z=t.pstyle("text-border-color").value,W=t.pstyle("text-border-style").value;if(e.strokeStyle="rgba("+z[0]+","+z[1]+","+z[2]+","+x*o+")",e.lineWidth=C,e.setLineDash)switch(W){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"double":e.lineWidth=C/4,e.setLineDash([]);break;case"solid":e.setLineDash([]);break}if(k?j2(e,A,$,M,D,T,"stroke"):e.strokeRect(A,$,M,D),W==="double"){var Y=C/2;k?j2(e,A+Y,$+Y,M-Y*2,D-Y*2,T,"stroke"):e.strokeRect(A+Y,$+Y,M-Y*2,D-Y*2)}e.setLineDash&&e.setLineDash([]),e.lineWidth=q,e.strokeStyle=O}}var J=2*t.pstyle("text-outline-width").pfValue;if(J>0&&(e.lineWidth=J),t.pstyle("text-wrap").value==="wrap"){var X=ui(s,"labelWrapCachedLines",n),te=ui(s,"labelLineHeight",n),ie=g/2,se=this.getLabelJustification(t);switch(se==="auto"||(b==="left"?se==="left"?u+=-g:se==="center"&&(u+=-ie):b==="center"?se==="left"?u+=-ie:se==="right"&&(u+=ie):b==="right"&&(se==="center"?u+=ie:se==="right"&&(u+=g))),w){case"top":l-=(X.length-1)*te;break;case"center":case"bottom":l-=(X.length-1)*te;break}for(var B=0;B<X.length;B++)J>0&&e.strokeText(X[B],u,l),e.fillText(X[B],u,l),l+=te}else J>0&&e.strokeText(d,u,l),e.fillText(d,u,l);E!==0&&(e.rotate(-E),e.translate(-c,-f))}}};var hc={};hc.drawNode=function(e,t,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0,s=this,o,u,l=t._private,c=l.rscratch,f=t.position();if(!(!ve(f.x)||!ve(f.y))&&!(a&&!t.visible())){var d=a?t.effectiveOpacity():1,h=s.usePaths(),g,p=!1,v=t.padding();o=t.width()+2*v,u=t.height()+2*v;var m;n&&(m=n,e.translate(-m.x1,-m.y1));for(var y=t.pstyle("background-image"),b=y.value,w=new Array(b.length),E=new Array(b.length),F=0,x=0;x<b.length;x++){var C=b[x],S=w[x]=C!=null&&C!=="none";if(S){var _=t.cy().style().getIndexedStyle(t,"background-image-crossorigin","value",x);F++,E[x]=s.getCachedImage(C,_,function(){l.backgroundTimestamp=Date.now(),t.emitAndNotify("background")})}}var k=t.pstyle("background-blacken").value,T=t.pstyle("border-width").pfValue,A=t.pstyle("background-opacity").value*d,$=t.pstyle("border-color").value,M=t.pstyle("border-style").value,D=t.pstyle("border-join").value,P=t.pstyle("border-cap").value,N=t.pstyle("border-position").value,O=t.pstyle("border-dash-pattern").pfValue,q=t.pstyle("border-dash-offset").pfValue,z=t.pstyle("border-opacity").value*d,W=t.pstyle("outline-width").pfValue,Y=t.pstyle("outline-color").value,J=t.pstyle("outline-style").value,X=t.pstyle("outline-opacity").value*d,te=t.pstyle("outline-offset").value,ie=t.pstyle("corner-radius").value;ie!=="auto"&&(ie=t.pstyle("corner-radius").pfValue);var se=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:A;s.eleFillStyle(e,t,V)},B=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:z;s.colorStrokeStyle(e,$[0],$[1],$[2],V)},I=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:X;s.colorStrokeStyle(e,Y[0],Y[1],Y[2],V)},U=function(V,j,me,ne){var ye=s.nodePathCache=s.nodePathCache||[],Oe=JA(me==="polygon"?me+","+ne.join(","):me,""+j,""+V,""+ie),Ge=ye[Oe],Te,We=!1;return Ge!=null?(Te=Ge,We=!0,c.pathCache=Te):(Te=new Path2D,ye[Oe]=c.pathCache=Te),{path:Te,cacheHit:We}},L=t.pstyle("shape").strValue,ae=t.pstyle("shape-polygon-points").pfValue;if(h){e.translate(f.x,f.y);var de=U(o,u,L,ae);g=de.path,p=de.cacheHit}var Ce=function(){if(!p){var V=f;h&&(V={x:0,y:0}),s.nodeShapes[s.getNodeShape(t)].draw(g||e,V.x,V.y,o,u,ie,c)}h?e.fill(g):e.fill()},Ye=function(){for(var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,me=l.backgrounding,ne=0,ye=0;ye<E.length;ye++){var Oe=t.cy().style().getIndexedStyle(t,"background-image-containment","value",ye);if(j&&Oe==="over"||!j&&Oe==="inside"){ne++;continue}w[ye]&&E[ye].complete&&!E[ye].error&&(ne++,s.drawInscribedImage(e,E[ye],t,ye,V))}l.backgrounding=ne!==F,me!==l.backgrounding&&t.updateStyle(!1)},Qe=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:d;s.hasPie(t)&&(s.drawPie(e,t,j),V&&(h||s.nodeShapes[s.getNodeShape(t)].draw(e,f.x,f.y,o,u,ie,c)))},Fe=function(){var V=arguments.length>0&&arguments[0]!==void 0?arguments[0]:d,j=(k>0?k:-k)*V,me=k>0?0:255;k!==0&&(s.colorFillStyle(e,me,me,me,j),h?e.fill(g):e.fill())},ke=function(){if(T>0){if(e.lineWidth=T,e.lineCap=P,e.lineJoin=D,e.setLineDash)switch(M){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash(O),e.lineDashOffset=q;break;case"solid":case"double":e.setLineDash([]);break}if(N!=="center"){if(e.save(),e.lineWidth*=2,N==="inside")h?e.clip(g):e.clip();else{var V=new Path2D;V.rect(-o/2-T,-u/2-T,o+2*T,u+2*T),V.addPath(g),e.clip(V,"evenodd")}h?e.stroke(g):e.stroke(),e.restore()}else h?e.stroke(g):e.stroke();if(M==="double"){e.lineWidth=T/3;var j=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",h?e.stroke(g):e.stroke(),e.globalCompositeOperation=j}e.setLineDash&&e.setLineDash([])}},Be=function(){if(W>0){if(e.lineWidth=W,e.lineCap="butt",e.setLineDash)switch(J){case"dotted":e.setLineDash([1,1]);break;case"dashed":e.setLineDash([4,2]);break;case"solid":case"double":e.setLineDash([]);break}var V=f;h&&(V={x:0,y:0});var j=s.getNodeShape(t),me=T;N==="inside"&&(me=0),N==="outside"&&(me*=2);var ne=(o+me+(W+te))/o,ye=(u+me+(W+te))/u,Oe=o*ne,Ge=u*ye,Te=s.nodeShapes[j].points,We;if(h){var je=U(Oe,Ge,j,Te);We=je.path}if(j==="ellipse")s.drawEllipsePath(We||e,V.x,V.y,Oe,Ge);else if(["round-diamond","round-heptagon","round-hexagon","round-octagon","round-pentagon","round-polygon","round-triangle","round-tag"].includes(j)){var ze=0,Dt=0,Ht=0;j==="round-diamond"?ze=(me+te+W)*1.4:j==="round-heptagon"?(ze=(me+te+W)*1.075,Ht=-(me/2+te+W)/35):j==="round-hexagon"?ze=(me+te+W)*1.12:j==="round-pentagon"?(ze=(me+te+W)*1.13,Ht=-(me/2+te+W)/15):j==="round-tag"?(ze=(me+te+W)*1.12,Dt=(me/2+W+te)*.07):j==="round-triangle"&&(ze=(me+te+W)*(Math.PI/2),Ht=-(me+te/2+W)/Math.PI),ze!==0&&(ne=(o+ze)/o,Oe=o*ne,["round-hexagon","round-tag"].includes(j)||(ye=(u+ze)/u,Ge=u*ye)),ie=ie==="auto"?vT(Oe,Ge):ie;for(var si=Oe/2,oi=Ge/2,gn=ie+(me+W+te)/2,$n=new Array(Te.length/2),Dn=new Array(Te.length/2),$r=0;$r<Te.length/2;$r++)$n[$r]={x:V.x+Dt+si*Te[$r*2],y:V.y+Ht+oi*Te[$r*2+1]};var Dr,rs,Mi,is,to=$n.length;for(rs=$n[to-1],Dr=0;Dr<to;Dr++)Mi=$n[Dr%to],is=$n[(Dr+1)%to],Dn[Dr]=z2(rs,Mi,is,gn),rs=Mi,Mi=is;s.drawRoundPolygonPath(We||e,V.x+Dt,V.y+Ht,o*ne,u*ye,Te,Dn)}else if(["roundrectangle","round-rectangle"].includes(j))ie=ie==="auto"?vu(Oe,Ge):ie,s.drawRoundRectanglePath(We||e,V.x,V.y,Oe,Ge,ie+(me+W+te)/2);else if(["cutrectangle","cut-rectangle"].includes(j))ie=ie==="auto"?gb():ie,s.drawCutRectanglePath(We||e,V.x,V.y,Oe,Ge,null,ie+(me+W+te)/4);else if(["bottomroundrectangle","bottom-round-rectangle"].includes(j))ie=ie==="auto"?vu(Oe,Ge):ie,s.drawBottomRoundRectanglePath(We||e,V.x,V.y,Oe,Ge,ie+(me+W+te)/2);else if(j==="barrel")s.drawBarrelPath(We||e,V.x,V.y,Oe,Ge);else if(j.startsWith("polygon")||["rhomboid","right-rhomboid","round-tag","tag","vee"].includes(j)){var no=(me+W+te)/o;Te=cp(fp(Te,no)),s.drawPolygonPath(We||e,V.x,V.y,o,u,Te)}else{var ar=(me+W+te)/o;Te=cp(fp(Te,-ar)),s.drawPolygonPath(We||e,V.x,V.y,o,u,Te)}if(h?e.stroke(We):e.stroke(),J==="double"){e.lineWidth=me/3;var Rn=e.globalCompositeOperation;e.globalCompositeOperation="destination-out",h?e.stroke(We):e.stroke(),e.globalCompositeOperation=Rn}e.setLineDash&&e.setLineDash([])}},Ue=function(){i&&s.drawNodeOverlay(e,t,f,o,u)},Le=function(){i&&s.drawNodeUnderlay(e,t,f,o,u)},Ve=function(){s.drawElementText(e,t,null,r)},Xe=t.pstyle("ghost").value==="yes";if(Xe){var nt=t.pstyle("ghost-offset-x").pfValue,oe=t.pstyle("ghost-offset-y").pfValue,R=t.pstyle("ghost-opacity").value,H=R*d;e.translate(nt,oe),I(),Be(),se(R*A),Ce(),Ye(H,!0),B(R*z),ke(),Qe(k!==0||T!==0),Ye(H,!1),Fe(H),e.translate(-nt,-oe)}h&&e.translate(-f.x,-f.y),Le(),h&&e.translate(f.x,f.y),I(),Be(),se(),Ce(),Ye(d,!0),B(),ke(),Qe(k!==0||T!==0),Ye(d,!1),Fe(),h&&e.translate(-f.x,-f.y),Ve(),Ue(),n&&e.translate(m.x1,m.y1)}};var gD=function(t){if(!["overlay","underlay"].includes(t))throw new Error("Invalid state");return function(n,r,i,a,s){var o=this;if(r.visible()){var u=r.pstyle("".concat(t,"-padding")).pfValue,l=r.pstyle("".concat(t,"-opacity")).value,c=r.pstyle("".concat(t,"-color")).value,f=r.pstyle("".concat(t,"-shape")).value,d=r.pstyle("".concat(t,"-corner-radius")).value;if(l>0){if(i=i||r.position(),a==null||s==null){var h=r.padding();a=r.width()+2*h,s=r.height()+2*h}o.colorFillStyle(n,c[0],c[1],c[2],l),o.nodeShapes[f].draw(n,i.x,i.y,a+u*2,s+u*2,d),n.fill()}}}};hc.drawNodeOverlay=gD("overlay"),hc.drawNodeUnderlay=gD("underlay"),hc.hasPie=function(e){return e=e[0],e._private.hasPie},hc.drawPie=function(e,t,n,r){t=t[0],r=r||t.position();var i=t.cy().style(),a=t.pstyle("pie-size"),s=r.x,o=r.y,u=t.width(),l=t.height(),c=Math.min(u,l)/2,f=0,d=this.usePaths();d&&(s=0,o=0),a.units==="%"?c=c*a.pfValue:a.pfValue!==void 0&&(c=a.pfValue/2);for(var h=1;h<=i.pieBackgroundN;h++){var g=t.pstyle("pie-"+h+"-background-size").value,p=t.pstyle("pie-"+h+"-background-color").value,v=t.pstyle("pie-"+h+"-background-opacity").value*n,m=g/100;m+f>1&&(m=1-f);var y=1.5*Math.PI+2*Math.PI*f,b=2*Math.PI*m,w=y+b;g===0||f>=1||f+m>1||(e.beginPath(),e.moveTo(s,o),e.arc(s,o,c,y,w),e.closePath(),this.colorFillStyle(e,p[0],p[1],p[2],v),e.fill(),f+=m)}};var or={},eY=100;or.getPixelRatio=function(){var e=this.data.contexts[0];if(this.forcedPixelRatio!=null)return this.forcedPixelRatio;var t=this.cy.window(),n=e.backingStorePixelRatio||e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.msBackingStorePixelRatio||e.oBackingStorePixelRatio||e.backingStorePixelRatio||1;return(t.devicePixelRatio||1)/n},or.paintCache=function(e){for(var t=this.paintCaches=this.paintCaches||[],n=!0,r,i=0;i<t.length;i++)if(r=t[i],r.context===e){n=!1;break}return n&&(r={context:e},t.push(r)),r},or.createGradientStyleFor=function(e,t,n,r,i){var a,s=this.usePaths(),o=n.pstyle(t+"-gradient-stop-colors").value,u=n.pstyle(t+"-gradient-stop-positions").pfValue;if(r==="radial-gradient")if(n.isEdge()){var l=n.sourceEndpoint(),c=n.targetEndpoint(),f=n.midpoint(),d=hu(l,f),h=hu(c,f);a=e.createRadialGradient(f.x,f.y,0,f.x,f.y,Math.max(d,h))}else{var g=s?{x:0,y:0}:n.position(),p=n.paddedWidth(),v=n.paddedHeight();a=e.createRadialGradient(g.x,g.y,0,g.x,g.y,Math.max(p,v))}else if(n.isEdge()){var m=n.sourceEndpoint(),y=n.targetEndpoint();a=e.createLinearGradient(m.x,m.y,y.x,y.y)}else{var b=s?{x:0,y:0}:n.position(),w=n.paddedWidth(),E=n.paddedHeight(),F=w/2,x=E/2,C=n.pstyle("background-gradient-direction").value;switch(C){case"to-bottom":a=e.createLinearGradient(b.x,b.y-x,b.x,b.y+x);break;case"to-top":a=e.createLinearGradient(b.x,b.y+x,b.x,b.y-x);break;case"to-left":a=e.createLinearGradient(b.x+F,b.y,b.x-F,b.y);break;case"to-right":a=e.createLinearGradient(b.x-F,b.y,b.x+F,b.y);break;case"to-bottom-right":case"to-right-bottom":a=e.createLinearGradient(b.x-F,b.y-x,b.x+F,b.y+x);break;case"to-top-right":case"to-right-top":a=e.createLinearGradient(b.x-F,b.y+x,b.x+F,b.y-x);break;case"to-bottom-left":case"to-left-bottom":a=e.createLinearGradient(b.x+F,b.y-x,b.x-F,b.y+x);break;case"to-top-left":case"to-left-top":a=e.createLinearGradient(b.x+F,b.y+x,b.x-F,b.y-x);break}}if(!a)return null;for(var S=u.length===o.length,_=o.length,k=0;k<_;k++)a.addColorStop(S?u[k]:k/(_-1),"rgba("+o[k][0]+","+o[k][1]+","+o[k][2]+","+i+")");return a},or.gradientFillStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"background",t,n,r);if(!i)return null;e.fillStyle=i},or.colorFillStyle=function(e,t,n,r,i){e.fillStyle="rgba("+t+","+n+","+r+","+i+")"},or.eleFillStyle=function(e,t,n){var r=t.pstyle("background-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientFillStyle(e,t,r,n);else{var i=t.pstyle("background-color").value;this.colorFillStyle(e,i[0],i[1],i[2],n)}},or.gradientStrokeStyle=function(e,t,n,r){var i=this.createGradientStyleFor(e,"line",t,n,r);if(!i)return null;e.strokeStyle=i},or.colorStrokeStyle=function(e,t,n,r,i){e.strokeStyle="rgba("+t+","+n+","+r+","+i+")"},or.eleStrokeStyle=function(e,t,n){var r=t.pstyle("line-fill").value;if(r==="linear-gradient"||r==="radial-gradient")this.gradientStrokeStyle(e,t,r,n);else{var i=t.pstyle("line-color").value;this.colorStrokeStyle(e,i[0],i[1],i[2],n)}},or.matchCanvasSize=function(e){var t=this,n=t.data,r=t.findContainerClientCoords(),i=r[2],a=r[3],s=t.getPixelRatio(),o=t.motionBlurPxRatio;(e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE]||e===t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG])&&(s=o);var u=i*s,l=a*s,c;if(!(u===t.canvasWidth&&l===t.canvasHeight)){t.fontCaches=null;var f=n.canvasContainer;f.style.width=i+"px",f.style.height=a+"px";for(var d=0;d<t.CANVAS_LAYERS;d++)c=n.canvases[d],c.width=u,c.height=l,c.style.width=i+"px",c.style.height=a+"px";for(var d=0;d<t.BUFFER_COUNT;d++)c=n.bufferCanvases[d],c.width=u,c.height=l,c.style.width=i+"px",c.style.height=a+"px";t.textureMult=1,s<=1&&(c=n.bufferCanvases[t.TEXTURE_BUFFER],t.textureMult=2,c.width=u*t.textureMult,c.height=l*t.textureMult),t.canvasWidth=u,t.canvasHeight=l,t.pixelRatio=s}},or.renderTo=function(e,t,n,r){this.render({forcedContext:e,forcedZoom:t,forcedPan:n,drawAllLayers:!0,forcedPxRatio:r})},or.clearCanvas=function(){var e=this,t=e.data;function n(r){r.clearRect(0,0,e.canvasWidth,e.canvasHeight)}n(t.contexts[e.NODE]),n(t.contexts[e.DRAG])},or.render=function(e){var t=this;e=e||aT();var n=t.cy,r=e.forcedContext,i=e.drawAllLayers,a=e.drawOnlyNodeLayer,s=e.forcedZoom,o=e.forcedPan,u=e.forcedPxRatio===void 0?this.getPixelRatio():e.forcedPxRatio,l=t.data,c=l.canvasNeedsRedraw,f=t.textureOnViewport&&!r&&(t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming),d=e.motionBlur!==void 0?e.motionBlur:t.motionBlur,h=t.motionBlurPxRatio,g=n.hasCompoundNodes(),p=t.hoverData.draggingEles,v=!!(t.hoverData.selecting||t.touchData.selecting);d=d&&!r&&t.motionBlurEnabled&&!v;var m=d;r||(t.prevPxRatio!==u&&(t.invalidateContainerClientCoordsCache(),t.matchCanvasSize(t.container),t.redrawHint("eles",!0),t.redrawHint("drag",!0)),t.prevPxRatio=u),!r&&t.motionBlurTimeout&&clearTimeout(t.motionBlurTimeout),d&&(t.mbFrames==null&&(t.mbFrames=0),t.mbFrames++,t.mbFrames<3&&(m=!1),t.mbFrames>t.minMbLowQualFrames&&(t.motionBlurPxRatio=t.mbPxRBlurry)),t.clearingMotionBlur&&(t.motionBlurPxRatio=1),t.textureDrawLastFrame&&!f&&(c[t.NODE]=!0,c[t.SELECT_BOX]=!0);var y=n.style(),b=n.zoom(),w=s!==void 0?s:b,E=n.pan(),F={x:E.x,y:E.y},x={zoom:b,pan:{x:E.x,y:E.y}},C=t.prevViewport,S=C===void 0||x.zoom!==C.zoom||x.pan.x!==C.pan.x||x.pan.y!==C.pan.y;!S&&!(p&&!g)&&(t.motionBlurPxRatio=1),o&&(F=o),w*=u,F.x*=u,F.y*=u;var _=t.getCachedZSortedEles();function k(B,I,U,L,ae){var de=B.globalCompositeOperation;B.globalCompositeOperation="destination-out",t.colorFillStyle(B,255,255,255,t.motionBlurTransparency),B.fillRect(I,U,L,ae),B.globalCompositeOperation=de}function T(B,I){var U,L,ae,de;!t.clearingMotionBlur&&(B===l.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]||B===l.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG])?(U={x:E.x*h,y:E.y*h},L=b*h,ae=t.canvasWidth*h,de=t.canvasHeight*h):(U=F,L=w,ae=t.canvasWidth,de=t.canvasHeight),B.setTransform(1,0,0,1,0,0),I==="motionBlur"?k(B,0,0,ae,de):!r&&(I===void 0||I)&&B.clearRect(0,0,ae,de),i||(B.translate(U.x,U.y),B.scale(L,L)),o&&B.translate(o.x,o.y),s&&B.scale(s,s)}if(f||(t.textureDrawLastFrame=!1),f){if(t.textureDrawLastFrame=!0,!t.textureCache){t.textureCache={},t.textureCache.bb=n.mutableElements().boundingBox(),t.textureCache.texture=t.data.bufferCanvases[t.TEXTURE_BUFFER];var A=t.data.bufferContexts[t.TEXTURE_BUFFER];A.setTransform(1,0,0,1,0,0),A.clearRect(0,0,t.canvasWidth*t.textureMult,t.canvasHeight*t.textureMult),t.render({forcedContext:A,drawOnlyNodeLayer:!0,forcedPxRatio:u*t.textureMult});var x=t.textureCache.viewport={zoom:n.zoom(),pan:n.pan(),width:t.canvasWidth,height:t.canvasHeight};x.mpan={x:(0-x.pan.x)/x.zoom,y:(0-x.pan.y)/x.zoom}}c[t.DRAG]=!1,c[t.NODE]=!1;var $=l.contexts[t.NODE],M=t.textureCache.texture,x=t.textureCache.viewport;$.setTransform(1,0,0,1,0,0),d?k($,0,0,x.width,x.height):$.clearRect(0,0,x.width,x.height);var D=y.core("outside-texture-bg-color").value,P=y.core("outside-texture-bg-opacity").value;t.colorFillStyle($,D[0],D[1],D[2],P),$.fillRect(0,0,x.width,x.height);var b=n.zoom();T($,!1),$.clearRect(x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u),$.drawImage(M,x.mpan.x,x.mpan.y,x.width/x.zoom/u,x.height/x.zoom/u)}else t.textureOnViewport&&!r&&(t.textureCache=null);var N=n.extent(),O=t.pinching||t.hoverData.dragging||t.swipePanning||t.data.wheelZooming||t.hoverData.draggingEles||t.cy.animated(),q=t.hideEdgesOnViewport&&O,z=[];if(z[t.NODE]=!c[t.NODE]&&d&&!t.clearedForMotionBlur[t.NODE]||t.clearingMotionBlur,z[t.NODE]&&(t.clearedForMotionBlur[t.NODE]=!0),z[t.DRAG]=!c[t.DRAG]&&d&&!t.clearedForMotionBlur[t.DRAG]||t.clearingMotionBlur,z[t.DRAG]&&(t.clearedForMotionBlur[t.DRAG]=!0),c[t.NODE]||i||a||z[t.NODE]){var W=d&&!z[t.NODE]&&h!==1,$=r||(W?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_NODE]:l.contexts[t.NODE]),Y=d&&!W?"motionBlur":void 0;T($,Y),q?t.drawCachedNodes($,_.nondrag,u,N):t.drawLayeredElements($,_.nondrag,u,N),t.debug&&t.drawDebugPoints($,_.nondrag),!i&&!d&&(c[t.NODE]=!1)}if(!a&&(c[t.DRAG]||i||z[t.DRAG])){var W=d&&!z[t.DRAG]&&h!==1,$=r||(W?t.data.bufferContexts[t.MOTIONBLUR_BUFFER_DRAG]:l.contexts[t.DRAG]);T($,d&&!W?"motionBlur":void 0),q?t.drawCachedNodes($,_.drag,u,N):t.drawCachedElements($,_.drag,u,N),t.debug&&t.drawDebugPoints($,_.drag),!i&&!d&&(c[t.DRAG]=!1)}if(this.drawSelectionRectangle(e,T),d&&h!==1){var J=l.contexts[t.NODE],X=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_NODE],te=l.contexts[t.DRAG],ie=t.data.bufferCanvases[t.MOTIONBLUR_BUFFER_DRAG],se=function(I,U,L){I.setTransform(1,0,0,1,0,0),L||!m?I.clearRect(0,0,t.canvasWidth,t.canvasHeight):k(I,0,0,t.canvasWidth,t.canvasHeight);var ae=h;I.drawImage(U,0,0,t.canvasWidth*ae,t.canvasHeight*ae,0,0,t.canvasWidth,t.canvasHeight)};(c[t.NODE]||z[t.NODE])&&(se(J,X,z[t.NODE]),c[t.NODE]=!1),(c[t.DRAG]||z[t.DRAG])&&(se(te,ie,z[t.DRAG]),c[t.DRAG]=!1)}t.prevViewport=x,t.clearingMotionBlur&&(t.clearingMotionBlur=!1,t.motionBlurCleared=!0,t.motionBlur=!0),d&&(t.motionBlurTimeout=setTimeout(function(){t.motionBlurTimeout=null,t.clearedForMotionBlur[t.NODE]=!1,t.clearedForMotionBlur[t.DRAG]=!1,t.motionBlur=!1,t.clearingMotionBlur=!f,t.mbFrames=0,c[t.NODE]=!0,c[t.DRAG]=!0,t.redraw()},eY)),r||n.emit("render")};var xd;or.drawSelectionRectangle=function(e,t){var n=this,r=n.cy,i=n.data,a=r.style(),s=e.drawOnlyNodeLayer,o=e.drawAllLayers,u=i.canvasNeedsRedraw,l=e.forcedContext;if(n.showFps||!s&&u[n.SELECT_BOX]&&!o){var c=l||i.contexts[n.SELECT_BOX];if(t(c),n.selection[4]==1&&(n.hoverData.selecting||n.touchData.selecting)){var f=n.cy.zoom(),d=a.core("selection-box-border-width").value/f;c.lineWidth=d,c.fillStyle="rgba("+a.core("selection-box-color").value[0]+","+a.core("selection-box-color").value[1]+","+a.core("selection-box-color").value[2]+","+a.core("selection-box-opacity").value+")",c.fillRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]),d>0&&(c.strokeStyle="rgba("+a.core("selection-box-border-color").value[0]+","+a.core("selection-box-border-color").value[1]+","+a.core("selection-box-border-color").value[2]+","+a.core("selection-box-opacity").value+")",c.strokeRect(n.selection[0],n.selection[1],n.selection[2]-n.selection[0],n.selection[3]-n.selection[1]))}if(i.bgActivePosistion&&!n.hoverData.selecting){var f=n.cy.zoom(),h=i.bgActivePosistion;c.fillStyle="rgba("+a.core("active-bg-color").value[0]+","+a.core("active-bg-color").value[1]+","+a.core("active-bg-color").value[2]+","+a.core("active-bg-opacity").value+")",c.beginPath(),c.arc(h.x,h.y,a.core("active-bg-size").pfValue/f,0,2*Math.PI),c.fill()}var g=n.lastRedrawTime;if(n.showFps&&g){g=Math.round(g);var p=Math.round(1e3/g),v="1 frame = "+g+" ms = "+p+" fps";if(c.setTransform(1,0,0,1,0,0),c.fillStyle="rgba(255, 0, 0, 0.75)",c.strokeStyle="rgba(255, 0, 0, 0.75)",c.font="30px Arial",!xd){var m=c.measureText(v);xd=m.actualBoundingBoxAscent}c.fillText(v,0,xd);var y=60;c.strokeRect(0,xd+10,250,20),c.fillRect(0,xd+10,250*Math.min(p/y,1),20)}o||(u[n.SELECT_BOX]=!1)}};function pD(e,t,n){var r=e.createShader(t);if(e.shaderSource(r,n),e.compileShader(r),!e.getShaderParameter(r,e.COMPILE_STATUS))throw new Error(e.getShaderInfoLog(r));return r}function tY(e,t,n){var r=pD(e,e.VERTEX_SHADER,t),i=pD(e,e.FRAGMENT_SHADER,n),a=e.createProgram();if(e.attachShader(a,r),e.attachShader(a,i),e.linkProgram(a),!e.getProgramParameter(a,e.LINK_STATUS))throw new Error("Could not initialize shaders");return a}function nY(e,t,n){n===void 0&&(n=t);var r=e.makeOffscreenCanvas(t,n),i=r.context=r.getContext("2d");return r.clear=function(){return i.clearRect(0,0,r.width,r.height)},r.clear(),r}function G2(e){var t=e.pixelRatio,n=e.cy.zoom(),r=e.cy.pan();return{zoom:n*t,pan:{x:r.x*t,y:r.y*t}}}function rY(e,t,n,r,i){var a=r*n+t.x,s=i*n+t.y;return s=Math.round(e.canvasHeight-s),[a,s]}function Ed(e,t,n){var r=e[0]/255,i=e[1]/255,a=e[2]/255,s=t,o=n||new Array(4);return o[0]=r*s,o[1]=i*s,o[2]=a*s,o[3]=s,o}function gc(e,t){var n=t||new Array(4);return n[0]=(e>>0&255)/255,n[1]=(e>>8&255)/255,n[2]=(e>>16&255)/255,n[3]=(e>>24&255)/255,n}function iY(e){return e[0]+(e[1]<<8)+(e[2]<<16)+(e[3]<<24)}function aY(e,t){var n=e.createTexture();return n.buffer=function(r){e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_NEAREST),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r),e.generateMipmap(e.TEXTURE_2D),e.bindTexture(e.TEXTURE_2D,null)},n.deleteTexture=function(){e.deleteTexture(n)},n}function vD(e,t){switch(t){case"float":return[1,e.FLOAT,4];case"vec2":return[2,e.FLOAT,4];case"vec3":return[3,e.FLOAT,4];case"vec4":return[4,e.FLOAT,4];case"int":return[1,e.INT,4];case"ivec2":return[2,e.INT,4]}}function mD(e,t,n){switch(t){case e.FLOAT:return new Float32Array(n);case e.INT:return new Int32Array(n)}}function sY(e,t,n,r,i,a){switch(t){case e.FLOAT:return new Float32Array(n.buffer,a*r,i);case e.INT:return new Int32Array(n.buffer,a*r,i)}}function oY(e,t,n,r){var i=vD(e,t),a=pn(i,2),s=a[0],o=a[1],u=mD(e,o,r),l=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,l),e.bufferData(e.ARRAY_BUFFER,u,e.STATIC_DRAW),o===e.FLOAT?e.vertexAttribPointer(n,s,o,!1,0,0):o===e.INT&&e.vertexAttribIPointer(n,s,o,0,0),e.enableVertexAttribArray(n),e.bindBuffer(e.ARRAY_BUFFER,null),l}function yo(e,t,n,r){var i=vD(e,n),a=pn(i,3),s=a[0],o=a[1],u=a[2],l=mD(e,o,t*s),c=s*u,f=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,f),e.bufferData(e.ARRAY_BUFFER,t*c,e.DYNAMIC_DRAW),e.enableVertexAttribArray(r),o===e.FLOAT?e.vertexAttribPointer(r,s,o,!1,c,0):o===e.INT&&e.vertexAttribIPointer(r,s,o,c,0),e.vertexAttribDivisor(r,1),e.bindBuffer(e.ARRAY_BUFFER,null);for(var d=new Array(t),h=0;h<t;h++)d[h]=sY(e,o,l,c,s,h);return f.dataArray=l,f.stride=c,f.size=s,f.getView=function(g){return d[g]},f.setPoint=function(g,p,v){var m=d[g];m[0]=p,m[1]=v},f.bufferSubData=function(g){e.bindBuffer(e.ARRAY_BUFFER,f),g?e.bufferSubData(e.ARRAY_BUFFER,0,l,0,g*s):e.bufferSubData(e.ARRAY_BUFFER,0,l)},f}function uY(e,t,n){for(var r=9,i=new Float32Array(t*r),a=new Array(t),s=0;s<t;s++){var o=s*r*4;a[s]=new Float32Array(i.buffer,o,r)}var u=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferData(e.ARRAY_BUFFER,i.byteLength,e.DYNAMIC_DRAW);for(var l=0;l<3;l++){var c=n+l;e.enableVertexAttribArray(c),e.vertexAttribPointer(c,3,e.FLOAT,!1,3*12,l*12),e.vertexAttribDivisor(c,1)}return e.bindBuffer(e.ARRAY_BUFFER,null),u.getMatrixView=function(f){return a[f]},u.setData=function(f,d){a[d].set(f,0)},u.bufferSubData=function(){e.bindBuffer(e.ARRAY_BUFFER,u),e.bufferSubData(e.ARRAY_BUFFER,0,i)},u}function lY(e){var t=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,t);var n=e.createTexture();return e.bindTexture(e.TEXTURE_2D,n),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.bindFramebuffer(e.FRAMEBUFFER,null),t.setFramebufferAttachmentSizes=function(r,i){e.bindTexture(e.TEXTURE_2D,n),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,r,i,0,e.RGBA,e.UNSIGNED_BYTE,null)},t}var yD=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});function Yp(){var e=new yD(9);return yD!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1,e}function bD(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=1,e[5]=0,e[6]=0,e[7]=0,e[8]=1,e}function cY(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],l=t[6],c=t[7],f=t[8],d=n[0],h=n[1],g=n[2],p=n[3],v=n[4],m=n[5],y=n[6],b=n[7],w=n[8];return e[0]=d*r+h*s+g*l,e[1]=d*i+h*o+g*c,e[2]=d*a+h*u+g*f,e[3]=p*r+v*s+m*l,e[4]=p*i+v*o+m*c,e[5]=p*a+v*u+m*f,e[6]=y*r+b*s+w*l,e[7]=y*i+b*o+w*c,e[8]=y*a+b*u+w*f,e}function Xp(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],l=t[6],c=t[7],f=t[8],d=n[0],h=n[1];return e[0]=r,e[1]=i,e[2]=a,e[3]=s,e[4]=o,e[5]=u,e[6]=d*r+h*s+l,e[7]=d*i+h*o+c,e[8]=d*a+h*u+f,e}function wD(e,t,n){var r=t[0],i=t[1],a=t[2],s=t[3],o=t[4],u=t[5],l=t[6],c=t[7],f=t[8],d=Math.sin(n),h=Math.cos(n);return e[0]=h*r+d*s,e[1]=h*i+d*o,e[2]=h*a+d*u,e[3]=h*s-d*r,e[4]=h*o-d*i,e[5]=h*u-d*a,e[6]=l,e[7]=c,e[8]=f,e}function Y2(e,t,n){var r=n[0],i=n[1];return e[0]=r*t[0],e[1]=r*t[1],e[2]=r*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function fY(e,t,n){return e[0]=2/t,e[1]=0,e[2]=0,e[3]=0,e[4]=-2/n,e[5]=0,e[6]=-1,e[7]=1,e[8]=1,e}var Fd={SCREEN:{name:"screen",screen:!0},PICKING:{name:"picking",picking:!0}},xD=an({texRows:24}),pc=an({collection:"default",getKey:null,drawElement:null,getBoundingBox:null,getRotation:null,getRotationPoint:null,getRotationOffset:null,isVisible:function(){return!0},getPadding:0}),dY=function(){function e(t,n,r,i){ro(this,e),this.debugID=Math.floor(Math.random()*1e4),this.r=t,this.texSize=n,this.texRows=r,this.texHeight=Math.floor(n/r),this.enableWrapping=!0,this.locked=!1,this.texture=null,this.needsBuffer=!0,this.freePointer={x:0,row:0},this.keyToLocation=new Map,this.canvas=i(t,n,n),this.scratch=i(t,n,this.texHeight,"scratch")}return io(e,[{key:"lock",value:function(){this.locked=!0}},{key:"getKeys",value:function(){return new Set(this.keyToLocation.keys())}},{key:"getScale",value:function(n){var r=n.w,i=n.h,a=this.texHeight,s=this.texSize,o=a/i,u=r*o,l=i*o;return u>s&&(o=s/r,u=r*o,l=i*o),{scale:o,texW:u,texH:l}}},{key:"draw",value:function(n,r,i){var a=this;if(this.locked)throw new Error("can't draw, atlas is locked");var s=this.texSize,o=this.texRows,u=this.texHeight,l=this.getScale(r),c=l.scale,f=l.texW,d=l.texH,h=[null,null],g=function(b,w){if(i&&w){var E=w.context,F=b.x,x=b.row,C=F,S=u*x;E.save(),E.translate(C,S),E.scale(c,c),i(E,r),E.restore()}},p=function(){g(a.freePointer,a.canvas),h[0]={x:a.freePointer.x,y:a.freePointer.row*u,w:f,h:d},h[1]={x:a.freePointer.x+f,y:a.freePointer.row*u,w:0,h:d},a.freePointer.x+=f,a.freePointer.x==s&&(a.freePointer.x=0,a.freePointer.row++)},v=function(){var b=a.scratch,w=a.canvas;b.clear(),g({x:0,row:0},b);var E=s-a.freePointer.x,F=f-E,x=u;{var C=a.freePointer.x,S=a.freePointer.row*u,_=E;w.context.drawImage(b,0,0,_,x,C,S,_,x),h[0]={x:C,y:S,w:_,h:d}}{var k=E,T=(a.freePointer.row+1)*u,A=F;w&&w.context.drawImage(b,k,0,A,x,0,T,A,x),h[1]={x:0,y:T,w:A,h:d}}a.freePointer.x=F,a.freePointer.row++},m=function(){a.freePointer.x=0,a.freePointer.row++};if(this.freePointer.x+f<=s)p();else{if(this.freePointer.row>=o-1)return!1;this.freePointer.x===s?(m(),p()):this.enableWrapping?v():(m(),p())}return this.keyToLocation.set(n,h),this.needsBuffer=!0,h}},{key:"getOffsets",value:function(n){return this.keyToLocation.get(n)}},{key:"isEmpty",value:function(){return this.freePointer.x===0&&this.freePointer.row===0}},{key:"canFit",value:function(n){if(this.locked)return!1;var r=this.texSize,i=this.texRows,a=this.getScale(n),s=a.texW;return this.freePointer.x+s>r?this.freePointer.row<i-1:!0}},{key:"bufferIfNeeded",value:function(n){this.texture||(this.texture=aY(n,this.debugID)),this.needsBuffer&&(this.texture.buffer(this.canvas),this.needsBuffer=!1,this.locked&&(this.canvas=null,this.scratch=null))}},{key:"dispose",value:function(){this.texture&&(this.texture.deleteTexture(),this.texture=null),this.canvas=null,this.scratch=null,this.locked=!0}}])}(),hY=function(){function e(t,n,r,i){ro(this,e),this.r=t,this.texSize=n,this.texRows=r,this.createTextureCanvas=i,this.atlases=[],this.styleKeyToAtlas=new Map,this.markedKeys=new Set}return io(e,[{key:"getKeys",value:function(){return new Set(this.styleKeyToAtlas.keys())}},{key:"_createAtlas",value:function(){var n=this.r,r=this.texSize,i=this.texRows,a=this.createTextureCanvas;return new dY(n,r,i,a)}},{key:"_getScratchCanvas",value:function(){if(!this.scratch){var n=this.r,r=this.texSize,i=this.texRows,a=this.createTextureCanvas,s=Math.floor(r/i);this.scratch=a(n,r,s,"scratch")}return this.scratch}},{key:"draw",value:function(n,r,i){var a=this.styleKeyToAtlas.get(n);return a||(a=this.atlases[this.atlases.length-1],(!a||!a.canFit(r))&&(a&&a.lock(),a=this._createAtlas(),this.atlases.push(a)),a.draw(n,r,i),this.styleKeyToAtlas.set(n,a)),a}},{key:"getAtlas",value:function(n){return this.styleKeyToAtlas.get(n)}},{key:"hasAtlas",value:function(n){return this.styleKeyToAtlas.has(n)}},{key:"markKeyForGC",value:function(n){this.markedKeys.add(n)}},{key:"gc",value:function(){var n=this,r=this.markedKeys;if(r.size===0){console.log("nothing to garbage collect");return}var i=[],a=new Map,s=null,o=$i(this.atlases),u;try{var l=function(){var f=u.value,d=f.getKeys(),h=gY(r,d);if(h.size===0)return i.push(f),d.forEach(function(E){return a.set(E,f)}),1;s||(s=n._createAtlas(),i.push(s));var g=$i(d),p;try{for(g.s();!(p=g.n()).done;){var v=p.value;if(!h.has(v)){var m=f.getOffsets(v),y=pn(m,2),b=y[0],w=y[1];s.canFit({w:b.w+w.w,h:b.h})||(s.lock(),s=n._createAtlas(),i.push(s)),n._copyTextureToNewAtlas(v,f,s),a.set(v,s)}}}catch(E){g.e(E)}finally{g.f()}f.dispose()};for(o.s();!(u=o.n()).done;)l()}catch(c){o.e(c)}finally{o.f()}this.atlases=i,this.styleKeyToAtlas=a,this.markedKeys=new Set}},{key:"_copyTextureToNewAtlas",value:function(n,r,i){var a=r.getOffsets(n),s=pn(a,2),o=s[0],u=s[1];if(u.w===0)i.draw(n,o,function(d){d.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h)});else{var l=this._getScratchCanvas();l.clear(),l.context.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,0,o.w,o.h),l.context.drawImage(r.canvas,u.x,u.y,u.w,u.h,o.w,0,u.w,u.h);var c=o.w+u.w,f=o.h;i.draw(n,{w:c,h:f},function(d){d.drawImage(l,0,0,c,f,0,0,c,f)})}}},{key:"getCounts",value:function(){return{keyCount:this.styleKeyToAtlas.size,atlasCount:new Set(this.styleKeyToAtlas.values()).size}}}])}();function gY(e,t){return e.intersection?e.intersection(t):new Set(EA(e).filter(function(n){return t.has(n)}))}var pY=function(){function e(t,n){ro(this,e),this.r=t,this.globalOptions=n,this.atlasSize=n.webglTexSize,this.maxAtlasesPerBatch=n.webglTexPerBatch,this.renderTypes=new Map,this.collections=new Map,this.typeAndIdToKey=new Map,this.batchAtlases=[]}return io(e,[{key:"getAtlasSize",value:function(){return this.atlasSize}},{key:"getMaxAtlasesPerBatch",value:function(){return this.maxAtlasesPerBatch}},{key:"addAtlasCollection",value:function(n,r){var i=this.globalOptions,a=i.webglTexSize,s=i.createTextureCanvas,o=r.texRows,u=this._cacheScratchCanvas(s),l=new hY(this.r,a,o,u);this.collections.set(n,l)}},{key:"addRenderType",value:function(n,r){var i=r.collection;if(!this.collections.has(i))throw new Error("invalid atlas collection name '".concat(i,"'"));var a=this.collections.get(i),s=Ie({type:n,atlasCollection:a},r);this.renderTypes.set(n,s)}},{key:"getRenderTypeOpts",value:function(n){return this.renderTypes.get(n)}},{key:"getAtlasCollection",value:function(n){return this.collections.get(n)}},{key:"_cacheScratchCanvas",value:function(n){var r=-1,i=-1,a=null;return function(s,o,u,l){return l?((!a||o!=r||u!=i)&&(r=o,i=u,a=n(s,o,u)),a):n(s,o,u)}}},{key:"_key",value:function(n,r){return"".concat(n,"-").concat(r)}},{key:"invalidate",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.forceRedraw,a=i===void 0?!1:i,s=r.filterEle,o=s===void 0?function(){return!0}:s,u=r.filterType,l=u===void 0?function(){return!0}:u,c=!1,f=!1,d=$i(n),h;try{for(d.s();!(h=d.n()).done;){var g=h.value;if(o(g)){var p=$i(this.renderTypes.values()),v;try{for(p.s();!(v=p.n()).done;){var m=v.value,y=m.type;if(l(y)){var b=m.getKey(g),w=this.collections.get(m.collection);if(a)w.markKeyForGC(b),f=!0;else{var E=m.getID?m.getID(g):g.id(),F=this._key(y,E),x=this.typeAndIdToKey.get(F);x!==void 0&&x!==b&&(this.typeAndIdToKey.delete(F),w.markKeyForGC(x),c=!0)}}}}catch(C){p.e(C)}finally{p.f()}}}}catch(C){d.e(C)}finally{d.f()}return f&&(this.gc(),c=!1),c}},{key:"gc",value:function(){var n=$i(this.collections.values()),r;try{for(n.s();!(r=n.n()).done;){var i=r.value;i.gc()}}catch(a){n.e(a)}finally{n.f()}}},{key:"getOrCreateAtlas",value:function(n,r,i){var a=this.renderTypes.get(r),s=a.getKey(n);i||(i=a.getBoundingBox(n));var o=this.collections.get(a.collection),u=!1,l=o.draw(s,i,function(d){a.drawElement(d,n,i,!0,!0),u=!0});if(u){var c=a.getID?a.getID(n):n.id(),f=this._key(r,c);this.typeAndIdToKey.set(f,s)}return l}},{key:"startBatch",value:function(){this.batchAtlases=[]}},{key:"getAtlasCount",value:function(){return this.batchAtlases.length}},{key:"getAtlases",value:function(){return this.batchAtlases}},{key:"canAddToCurrentBatch",value:function(n,r){if(this.batchAtlases.length===this.maxAtlasesPerBatch){var i=this.renderTypes.get(r),a=i.getKey(n),s=this.collections.get(i.collection),o=s.getAtlas(a);return!!o&&this.batchAtlases.includes(o)}return!0}},{key:"getAtlasIndexForBatch",value:function(n){var r=this.batchAtlases.indexOf(n);if(r<0){if(this.batchAtlases.length===this.maxAtlasesPerBatch)return;this.batchAtlases.push(n),r=this.batchAtlases.length-1}return r}},{key:"getIndexArray",value:function(){return Array.from({length:this.maxAtlasesPerBatch},function(n,r){return r})}},{key:"getAtlasInfo",value:function(n,r){var i=this.renderTypes.get(r),a=i.getBoundingBox(n),s=this.getOrCreateAtlas(n,r,a),o=this.getAtlasIndexForBatch(s);if(o!==void 0){var u=i.getKey(n),l=s.getOffsets(u),c=pn(l,2),f=c[0],d=c[1];return{index:o,tex1:f,tex2:d,bb:a}}}},{key:"setTransformMatrix",value:function(n,r,i,a){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=this.getRenderTypeOpts(i),u=o.getPadding?o.getPadding(n):0;if(a){var l=a.bb,c=a.tex1,f=a.tex2,d=c.w/(c.w+f.w);s||(d=1-d);var h=this.getAdjustedBB(l,u,s,d);this._applyTransformMatrix(r,h,o,n)}else{var g=o.getBoundingBox(n),p=this.getAdjustedBB(g,u,!0,1);this._applyTransformMatrix(r,p,o,n)}}},{key:"_applyTransformMatrix",value:function(n,r,i,a){var s,o;bD(n);var u=i.getRotation?i.getRotation(a):0;if(u!==0){var l=i.getRotationPoint(a),c=l.x,f=l.y;Xp(n,n,[c,f]),wD(n,n,u);var d=i.getRotationOffset(a);s=d.x+r.xOffset,o=d.y}else s=r.x1,o=r.y1;Xp(n,n,[s,o]),Y2(n,n,[r.w,r.h])}},{key:"getAdjustedBB",value:function(n,r,i,a){var s=n.x1,o=n.y1,u=n.w,l=n.h;r&&(s-=r,o-=r,u+=2*r,l+=2*r);var c=0,f=u*a;return i&&a<1?u=f:!i&&a<1&&(c=u-f,s+=c,u=f),{x1:s,y1:o,w:u,h:l,xOffset:c}}},{key:"getDebugInfo",value:function(){var n=[],r=$i(this.collections),i;try{for(r.s();!(i=r.n()).done;){var a=pn(i.value,2),s=a[0],o=a[1],u=o.getCounts(),l=u.keyCount,c=u.atlasCount;n.push({type:s,keyCount:l,atlasCount:c})}}catch(f){r.e(f)}finally{r.f()}return n}}])}(),Kp=0,ED=1,FD=2,X2=3,SD=4,vY=function(){function e(t,n,r){ro(this,e),this.r=t,this.gl=n,this.maxInstances=r.webglBatchSize,this.atlasSize=r.webglTexSize,this.bgColor=r.bgColor,this.debug=r.webglDebug,this.batchDebugInfo=[],r.enableWrapping=!0,r.createTextureCanvas=nY,this.atlasManager=new pY(t,r),this.program=this.createShaderProgram(Fd.SCREEN),this.pickingProgram=this.createShaderProgram(Fd.PICKING),this.vao=this.createVAO()}return io(e,[{key:"addAtlasCollection",value:function(n,r){this.atlasManager.addAtlasCollection(n,r)}},{key:"addAtlasRenderType",value:function(n,r){this.atlasManager.addRenderType(n,r)}},{key:"invalidate",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.type,a=this.atlasManager;return i?a.invalidate(n,{filterType:function(o){return o===i},forceRedraw:!0}):a.invalidate(n)}},{key:"gc",value:function(){this.atlasManager.gc()}},{key:"createShaderProgram",value:function(n){var r=this.gl,i=`#version 300 es
      precision highp float;

      uniform mat3 uPanZoomMatrix;
      uniform int  uAtlasSize;
      
      // instanced
      in vec2 aPosition; 

      in mat3 aTransform;

      // what are we rendering?
      in int aVertType;

      // for picking
      in vec4 aIndex;
      
      // For textures
      in int aAtlasId; // which shader unit/atlas to use
      in vec4 aTex; // x/y/w/h of texture in atlas

      // for edges
      in vec4 aPointAPointB;
      in vec4 aPointCPointD;
      in float aLineWidth;
      in vec4 aColor;

      out vec2 vTexCoord;
      out vec4 vColor;
      flat out int vAtlasId;
      flat out vec4 vIndex;
      flat out int vVertType;

      void main(void) {
        int vid = gl_VertexID;
        vec2 position = aPosition;

        if(aVertType == `.concat(Kp,`) {
          float texX = aTex.x;
          float texY = aTex.y;
          float texW = aTex.z;
          float texH = aTex.w;

          int vid = gl_VertexID;

          if(vid == 1 || vid == 2 || vid == 4) {
            texX += texW;
          }
          if(vid == 2 || vid == 4 || vid == 5) {
            texY += texH;
          }

          float d = float(uAtlasSize);
          vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1

          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
        }
        else if(aVertType == `).concat(SD,`) {
          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
          vColor = aColor;
        }
        else if(aVertType == `).concat(ED,`) {
          vec2 source = aPointAPointB.xy;
          vec2 target = aPointAPointB.zw;

          // adjust the geometry so that the line is centered on the edge
          position.y = position.y - 0.5;

          vec2 xBasis = target - source;
          vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x));
          vec2 point = source + xBasis * position.x + yBasis * aLineWidth * position.y;

          gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0);
          vColor = aColor;
        } 
        else if(aVertType == `).concat(FD,`) {
          vec2 pointA = aPointAPointB.xy;
          vec2 pointB = aPointAPointB.zw;
          vec2 pointC = aPointCPointD.xy;
          vec2 pointD = aPointCPointD.zw;

          // adjust the geometry so that the line is centered on the edge
          position.y = position.y - 0.5;

          vec2 p0 = pointA;
          vec2 p1 = pointB;
          vec2 p2 = pointC;
          vec2 pos = position;
          if(position.x == 1.0) {
            p0 = pointD;
            p1 = pointC;
            p2 = pointB;
            pos = vec2(0.0, -position.y);
          }

          vec2 p01 = p1 - p0;
          vec2 p12 = p2 - p1;
          vec2 p21 = p1 - p2;

          // Find the normal vector.
          vec2 tangent = normalize(normalize(p12) + normalize(p01));
          vec2 normal = vec2(-tangent.y, tangent.x);

          // Find the vector perpendicular to p0 -> p1.
          vec2 p01Norm = normalize(vec2(-p01.y, p01.x));

          // Determine the bend direction.
          float sigma = sign(dot(p01 + p21, normal));
          float width = aLineWidth;

          if(sign(pos.y) == -sigma) {
            // This is an intersecting vertex. Adjust the position so that there's no overlap.
            vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm);
            gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
          } else {
            // This is a non-intersecting vertex. Treat it like a mitre join.
            vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm);
            gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0);
          }

          vColor = aColor;
        } 
        else if(aVertType == `).concat(X2,` && vid < 3) {
          // massage the first triangle into an edge arrow
          if(vid == 0)
            position = vec2(-0.15, -0.3);
          if(vid == 1)
            position = vec2( 0.0,   0.0);
          if(vid == 2)
            position = vec2( 0.15, -0.3);

          gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0);
          vColor = aColor;
        }
        else {
          gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space
        }

        vAtlasId = aAtlasId;
        vIndex = aIndex;
        vVertType = aVertType;
      }
    `),a=this.atlasManager.getIndexArray(),s=`#version 300 es
      precision highp float;

      // define texture unit for each node in the batch
      `.concat(a.map(function(l){return"uniform sampler2D uTexture".concat(l,";")}).join(`
	`),`

      uniform vec4 uBGColor;

      in vec2 vTexCoord;
      in vec4 vColor;
      flat in int vAtlasId;
      flat in vec4 vIndex;
      flat in int vVertType;

      out vec4 outColor;

      void main(void) {
        if(vVertType == `).concat(Kp,`) {
          `).concat(a.map(function(l){return"if(vAtlasId == ".concat(l,") outColor = texture(uTexture").concat(l,", vTexCoord);")}).join(`
	else `),`
        } else if(vVertType == `).concat(X2,`) {
          // blend arrow color with background (using premultiplied alpha)
          outColor.rgb = vColor.rgb + (uBGColor.rgb * (1.0 - vColor.a)); 
          outColor.a = 1.0; // make opaque, masks out line under arrow
        } else {
          outColor = vColor;
        }

        `).concat(n.picking?`if(outColor.a == 0.0) discard;
             else outColor = vIndex;`:"",`
      }
    `),o=tY(r,i,s);o.aPosition=r.getAttribLocation(o,"aPosition"),o.aIndex=r.getAttribLocation(o,"aIndex"),o.aVertType=r.getAttribLocation(o,"aVertType"),o.aTransform=r.getAttribLocation(o,"aTransform"),o.aAtlasId=r.getAttribLocation(o,"aAtlasId"),o.aTex=r.getAttribLocation(o,"aTex"),o.aPointAPointB=r.getAttribLocation(o,"aPointAPointB"),o.aPointCPointD=r.getAttribLocation(o,"aPointCPointD"),o.aLineWidth=r.getAttribLocation(o,"aLineWidth"),o.aColor=r.getAttribLocation(o,"aColor"),o.uPanZoomMatrix=r.getUniformLocation(o,"uPanZoomMatrix"),o.uAtlasSize=r.getUniformLocation(o,"uAtlasSize"),o.uBGColor=r.getUniformLocation(o,"uBGColor"),o.uTextures=[];for(var u=0;u<this.atlasManager.getMaxAtlasesPerBatch();u++)o.uTextures.push(r.getUniformLocation(o,"uTexture".concat(u)));return o}},{key:"createVAO",value:function(){var n=[0,0,1,0,1,1,0,0,1,1,0,1];this.vertexCount=n.length/2;var r=this.maxInstances,i=this.gl,a=this.program,s=i.createVertexArray();return i.bindVertexArray(s),oY(i,"vec2",a.aPosition,n),this.transformBuffer=uY(i,r,a.aTransform),this.indexBuffer=yo(i,r,"vec4",a.aIndex),this.vertTypeBuffer=yo(i,r,"int",a.aVertType),this.atlasIdBuffer=yo(i,r,"int",a.aAtlasId),this.texBuffer=yo(i,r,"vec4",a.aTex),this.pointAPointBBuffer=yo(i,r,"vec4",a.aPointAPointB),this.pointCPointDBuffer=yo(i,r,"vec4",a.aPointCPointD),this.lineWidthBuffer=yo(i,r,"float",a.aLineWidth),this.colorBuffer=yo(i,r,"vec4",a.aColor),i.bindVertexArray(null),s}},{key:"buffers",get:function(){var n=this;return this._buffers||(this._buffers=Object.keys(this).filter(function(r){return r.endsWith("Buffer")}).map(function(r){return n[r]})),this._buffers}},{key:"startFrame",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Fd.SCREEN;this.panZoomMatrix=n,this.renderTarget=r,this.batchDebugInfo=[],this.wrappedCount=0,this.rectangleCount=0,this.startBatch()}},{key:"startBatch",value:function(){this.instanceCount=0,this.atlasManager.startBatch()}},{key:"endFrame",value:function(){this.endBatch()}},{key:"getTempMatrix",value:function(){return this.tempMatrix=this.tempMatrix||Yp()}},{key:"drawTexture",value:function(n,r,i){var a=this.atlasManager;if(n.visible()&&a.getRenderTypeOpts(i).isVisible(n)){a.canAddToCurrentBatch(n,i)||this.endBatch(),this.instanceCount+1>=this.maxInstances&&this.endBatch();var s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=Kp;var o=this.indexBuffer.getView(s);gc(r,o);var u=a.getAtlasInfo(n,i),l=u.index,c=u.tex1,f=u.tex2;f.w>0&&this.wrappedCount++;for(var d=!0,h=0,g=[c,f];h<g.length;h++){var p=g[h];if(p.w!=0){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=Kp;var m=this.indexBuffer.getView(v);gc(r,m);var y=this.atlasIdBuffer.getView(v);y[0]=l;var b=this.texBuffer.getView(v);b[0]=p.x,b[1]=p.y,b[2]=p.w,b[3]=p.h;var w=this.transformBuffer.getMatrixView(v);a.setTransformMatrix(n,w,i,u,d),this.instanceCount++}d=!1}this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawSimpleRectangle",value:function(n,r,i){if(n.visible()){var a=this.atlasManager,s=this.instanceCount;this.vertTypeBuffer.getView(s)[0]=SD;var o=this.indexBuffer.getView(s);gc(r,o);var u=n.pstyle("background-color").value,l=n.pstyle("background-opacity").value,c=this.colorBuffer.getView(s);Ed(u,l,c);var f=this.transformBuffer.getMatrixView(s);a.setTransformMatrix(n,f,i),this.rectangleCount++,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}},{key:"drawEdgeArrow",value:function(n,r,i){if(n.visible()){var a=n._private.rscratch,s,o,u;if(i==="source"?(s=a.arrowStartX,o=a.arrowStartY,u=a.srcArrowAngle):(s=a.arrowEndX,o=a.arrowEndY,u=a.tgtArrowAngle),!(isNaN(s)||s==null||isNaN(o)||o==null||isNaN(u)||u==null)){var l=n.pstyle(i+"-arrow-shape").value;if(l!=="none"){var c=n.pstyle(i+"-arrow-color").value,f=n.pstyle("opacity").value,d=n.pstyle("line-opacity").value,h=f*d,g=n.pstyle("width").pfValue,p=n.pstyle("arrow-scale").value,v=this.r.getArrowWidth(g,p),m=this.instanceCount,y=this.transformBuffer.getMatrixView(m);bD(y),Xp(y,y,[s,o]),Y2(y,y,[v,v]),wD(y,y,u),this.vertTypeBuffer.getView(m)[0]=X2;var b=this.indexBuffer.getView(m);gc(r,b);var w=this.colorBuffer.getView(m);Ed(c,h,w),this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"drawEdgeLine",value:function(n,r){if(n.visible()){var i=this.getEdgePoints(n);if(i){var a=n.pstyle("opacity").value,s=n.pstyle("line-opacity").value,o=n.pstyle("width").pfValue,u=n.pstyle("line-color").value,l=a*s;if(i.length/2+this.instanceCount>this.maxInstances&&this.endBatch(),i.length==4){var c=this.instanceCount;this.vertTypeBuffer.getView(c)[0]=ED;var f=this.indexBuffer.getView(c);gc(r,f);var d=this.colorBuffer.getView(c);Ed(u,l,d);var h=this.lineWidthBuffer.getView(c);h[0]=o;var g=this.pointAPointBBuffer.getView(c);g[0]=i[0],g[1]=i[1],g[2]=i[2],g[3]=i[3],this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}else for(var p=0;p<i.length-2;p+=2){var v=this.instanceCount;this.vertTypeBuffer.getView(v)[0]=FD;var m=this.indexBuffer.getView(v);gc(r,m);var y=this.colorBuffer.getView(v);Ed(u,l,y);var b=this.lineWidthBuffer.getView(v);b[0]=o;var w=i[p-2],E=i[p-1],F=i[p],x=i[p+1],C=i[p+2],S=i[p+3],_=i[p+4],k=i[p+5];p==0&&(w=2*F-C+.001,E=2*x-S+.001),p==i.length-4&&(_=2*C-F+.001,k=2*S-x+.001);var T=this.pointAPointBBuffer.getView(v);T[0]=w,T[1]=E,T[2]=F,T[3]=x;var A=this.pointCPointDBuffer.getView(v);A[0]=C,A[1]=S,A[2]=_,A[3]=k,this.instanceCount++,this.instanceCount>=this.maxInstances&&this.endBatch()}}}}},{key:"getEdgePoints",value:function(n){var r=n._private.rscratch;if(!(r.badLine||r.allpts==null||isNaN(r.allpts[0]))){var i=r.allpts;if(i.length==4)return i;var a=this.getNumSegments(n);return this.getCurveSegmentPoints(i,a)}}},{key:"getNumSegments",value:function(n){var r=15;return Math.min(Math.max(r,5),this.maxInstances)}},{key:"getCurveSegmentPoints",value:function(n,r){if(n.length==4)return n;for(var i=Array((r+1)*2),a=0;a<=r;a++)if(a==0)i[0]=n[0],i[1]=n[1];else if(a==r)i[a*2]=n[n.length-2],i[a*2+1]=n[n.length-1];else{var s=a/r;this.setCurvePoint(n,s,i,a*2)}return i}},{key:"setCurvePoint",value:function(n,r,i,a){if(n.length<=2)i[a]=n[0],i[a+1]=n[1];else{for(var s=Array(n.length-2),o=0;o<s.length;o+=2){var u=(1-r)*n[o]+r*n[o+2],l=(1-r)*n[o+1]+r*n[o+3];s[o]=u,s[o+1]=l}return this.setCurvePoint(s,r,i,a)}}},{key:"endBatch",value:function(){var n=this.gl,r=this.vao,i=this.vertexCount,a=this.instanceCount;if(a!==0){var s=this.renderTarget.picking?this.pickingProgram:this.program;n.useProgram(s),n.bindVertexArray(r);var o=$i(this.buffers),u;try{for(o.s();!(u=o.n()).done;){var l=u.value;l.bufferSubData(a)}}catch(g){o.e(g)}finally{o.f()}for(var c=this.atlasManager.getAtlases(),f=0;f<c.length;f++)c[f].bufferIfNeeded(n);for(var d=0;d<c.length;d++)n.activeTexture(n.TEXTURE0+d),n.bindTexture(n.TEXTURE_2D,c[d].texture),n.uniform1i(s.uTextures[d],d);n.uniformMatrix3fv(s.uPanZoomMatrix,!1,this.panZoomMatrix),n.uniform1i(s.uAtlasSize,this.atlasManager.getAtlasSize());var h=Ed(this.bgColor,1);n.uniform4fv(s.uBGColor,h),n.drawArraysInstanced(n.TRIANGLES,0,i,a),n.bindVertexArray(null),n.bindTexture(n.TEXTURE_2D,null),this.debug&&this.batchDebugInfo.push({count:a,atlasCount:c.length}),this.startBatch()}}},{key:"getDebugInfo",value:function(){var n=this.atlasManager.getDebugInfo(),r=n.reduce(function(s,o){return s+o.atlasCount},0),i=this.batchDebugInfo,a=i.reduce(function(s,o){return s+o.count},0);return{atlasInfo:n,totalAtlases:r,wrappedCount:this.wrappedCount,rectangleCount:this.rectangleCount,batchCount:i.length,batchInfo:i,totalInstances:a}}}])}();function CD(e,t){return"rgba(".concat(e[0],", ").concat(e[1],", ").concat(e[2],", ").concat(t,")")}var mY=function(){function e(t){ro(this,e),this.r=t}return io(e,[{key:"getStyleKey",value:function(n,r){var i=this.getStyle(n,r),a=i.shape,s=i.opacity,o=i.color;if(!a)return null;var u=r.width(),l=r.height(),c=CD(o,s);return oo("".concat(a,"-").concat(u,"-").concat(l,"-").concat(c))}},{key:"isVisible",value:function(n,r){var i=r.pstyle("".concat(n,"-opacity")).value;return i>0}},{key:"getStyle",value:function(n,r){var i=r.pstyle("".concat(n,"-opacity")).value,a=r.pstyle("".concat(n,"-color")).value,s=r.pstyle("".concat(n,"-shape")).value;return{opacity:i,color:a,shape:s}}},{key:"getPadding",value:function(n,r){return r.pstyle("".concat(n,"-padding")).pfValue}},{key:"draw",value:function(n,r,i,a){if(this.isVisible(n,i)){var s=this.r,o=a.w,u=a.h,l=o/2,c=u/2,f=this.getStyle(n,i),d=f.shape,h=f.color,g=f.opacity;r.save(),r.fillStyle=CD(h,g),d==="round-rectangle"||d==="roundrectangle"?s.drawRoundRectanglePath(r,l,c,o,u,"auto"):d==="ellipse"&&s.drawEllipsePath(r,l,c,o,u),r.fill(),r.restore()}}}])}(),kD={};kD.initWebgl=function(e,t){var n=this,r=n.data.contexts[n.WEBGL];e.bgColor=yY(n),e.webglTexSize=Math.min(e.webglTexSize,r.getParameter(r.MAX_TEXTURE_SIZE)),e.webglTexRows=Math.min(e.webglTexRows,54),e.webglTexRowsNodes=Math.min(e.webglTexRowsNodes,54),e.webglBatchSize=Math.min(e.webglBatchSize,16384),e.webglTexPerBatch=Math.min(e.webglTexPerBatch,r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS)),n.webglDebug=e.webglDebug,n.webglDebugShowAtlases=e.webglDebugShowAtlases,n.pickingFrameBuffer=lY(r),n.pickingFrameBuffer.needsDraw=!0;var i=function(l){return function(c){return n.getTextAngle(c,l)}},a=function(l){return function(c){var f=c.pstyle(l);return f&&f.value}};n.drawing=new vY(n,r,e);var s=new mY(n);n.drawing.addAtlasCollection("node",xD({texRows:e.webglTexRowsNodes})),n.drawing.addAtlasCollection("label",xD({texRows:e.webglTexRows})),n.drawing.addAtlasRenderType("node-body",pc({collection:"node",getKey:t.getStyleKey,getBoundingBox:t.getElementBox,drawElement:t.drawElement})),n.drawing.addAtlasRenderType("label",pc({collection:"label",getKey:t.getLabelKey,getBoundingBox:t.getLabelBox,drawElement:t.drawLabel,getRotation:i(null),getRotationPoint:t.getLabelRotationPoint,getRotationOffset:t.getLabelRotationOffset,isVisible:a("label")})),n.drawing.addAtlasRenderType("node-overlay",pc({collection:"node",getBoundingBox:t.getElementBox,getKey:function(l){return s.getStyleKey("overlay",l)},drawElement:function(l,c,f){return s.draw("overlay",l,c,f)},isVisible:function(l){return s.isVisible("overlay",l)},getPadding:function(l){return s.getPadding("overlay",l)}})),n.drawing.addAtlasRenderType("node-underlay",pc({collection:"node",getBoundingBox:t.getElementBox,getKey:function(l){return s.getStyleKey("underlay",l)},drawElement:function(l,c,f){return s.draw("underlay",l,c,f)},isVisible:function(l){return s.isVisible("underlay",l)},getPadding:function(l){return s.getPadding("underlay",l)}})),n.drawing.addAtlasRenderType("edge-source-label",pc({collection:"label",getKey:t.getSourceLabelKey,getBoundingBox:t.getSourceLabelBox,drawElement:t.drawSourceLabel,getRotation:i("source"),getRotationPoint:t.getSourceLabelRotationPoint,getRotationOffset:t.getSourceLabelRotationOffset,isVisible:a("source-label")})),n.drawing.addAtlasRenderType("edge-target-label",pc({collection:"label",getKey:t.getTargetLabelKey,getBoundingBox:t.getTargetLabelBox,drawElement:t.drawTargetLabel,getRotation:i("target"),getRotationPoint:t.getTargetLabelRotationPoint,getRotationOffset:t.getTargetLabelRotationOffset,isVisible:a("target-label")}));var o=Xf(function(){console.log("garbage collect flag set"),n.data.gc=!0},1e4);n.onUpdateEleCalcs(function(u,l){var c=!1;l&&l.length>0&&(c|=n.drawing.invalidate(l)),c&&o()}),bY(n)};function yY(e){var t=e.cy.container(),n=t&&t.style&&t.style.backgroundColor||"white";return $A(n)}function bY(e){{var t=e.render;e.render=function(a){a=a||{};var s=e.cy;e.webgl&&(s.zoom()>aD?(wY(e),t.call(e,a)):(xY(e),AD(e,a,Fd.SCREEN)))}}{var n=e.matchCanvasSize;e.matchCanvasSize=function(a){n.call(e,a),e.pickingFrameBuffer.setFramebufferAttachmentSizes(e.canvasWidth,e.canvasHeight),e.pickingFrameBuffer.needsDraw=!0}}e.findNearestElements=function(a,s,o,u){return _Y(e,a,s)};{var r=e.invalidateCachedZSortedEles;e.invalidateCachedZSortedEles=function(){r.call(e),e.pickingFrameBuffer.needsDraw=!0}}{var i=e.notify;e.notify=function(a,s){i.call(e,a,s),a==="viewport"||a==="bounds"?e.pickingFrameBuffer.needsDraw=!0:a==="background"&&e.drawing.invalidate(s,{type:"node-body"})}}}function wY(e){var t=e.data.contexts[e.WEBGL];t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}function xY(e){var t=function(r){r.save(),r.setTransform(1,0,0,1,0,0),r.clearRect(0,0,e.canvasWidth,e.canvasHeight),r.restore()};t(e.data.contexts[e.NODE]),t(e.data.contexts[e.DRAG])}function EY(e){var t=e.canvasWidth,n=e.canvasHeight,r=G2(e),i=r.pan,a=r.zoom,s=Yp();Xp(s,s,[i.x,i.y]),Y2(s,s,[a,a]);var o=Yp();fY(o,t,n);var u=Yp();return cY(u,o,s),u}function _D(e,t){var n=e.canvasWidth,r=e.canvasHeight,i=G2(e),a=i.pan,s=i.zoom;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,n,r),t.translate(a.x,a.y),t.scale(s,s)}function FY(e,t){e.drawSelectionRectangle(t,function(n){return _D(e,n)})}function SY(e){var t=e.data.contexts[e.NODE];t.save(),_D(e,t),t.strokeStyle="rgba(0, 0, 0, 0.3)",t.beginPath(),t.moveTo(-1e3,0),t.lineTo(1e3,0),t.stroke(),t.beginPath(),t.moveTo(0,-1e3),t.lineTo(0,1e3),t.stroke(),t.restore()}function CY(e){var t=function(i,a,s){for(var o=i.atlasManager.getAtlasCollection(a),u=e.data.contexts[e.NODE],l=.125,c=o.atlases,f=0;f<c.length;f++){var d=c[f],h=d.canvas;if(h){var g=h.width,p=h.height,v=g*f,m=h.height*s;u.save(),u.scale(l,l),u.drawImage(h,v,m),u.strokeStyle="black",u.rect(v,m,g,p),u.stroke(),u.restore()}}},n=0;t(e.drawing,"node",n++),t(e.drawing,"label",n++)}function kY(e,t,n,r,i){var a,s,o,u,l=G2(e),c=l.pan,f=l.zoom;{var d=rY(e,c,f,t,n),h=pn(d,2),g=h[0],p=h[1],v=6;a=g-v/2,s=p-v/2,o=v,u=v}if(o===0||u===0)return[];var m=e.data.contexts[e.WEBGL];m.bindFramebuffer(m.FRAMEBUFFER,e.pickingFrameBuffer),e.pickingFrameBuffer.needsDraw&&(m.viewport(0,0,m.canvas.width,m.canvas.height),AD(e,null,Fd.PICKING),e.pickingFrameBuffer.needsDraw=!1);var y=o*u,b=new Uint8Array(y*4);m.readPixels(a,s,o,u,m.RGBA,m.UNSIGNED_BYTE,b),m.bindFramebuffer(m.FRAMEBUFFER,null);for(var w=new Set,E=0;E<y;E++){var F=b.slice(E*4,E*4+4),x=iY(F)-1;x>=0&&w.add(x)}return w}function _Y(e,t,n){var r=kY(e,t,n),i=e.getCachedZSortedEles(),a,s,o=$i(r),u;try{for(o.s();!(u=o.n()).done;){var l=u.value,c=i[l];if(!a&&c.isNode()&&(a=c),!s&&c.isEdge()&&(s=c),a&&s)break}}catch(f){o.e(f)}finally{o.f()}return[a,s].filter(Boolean)}function AY(e){return e.pstyle("shape").value==="rectangle"&&e.pstyle("background-fill").value==="solid"&&e.pstyle("border-width").pfValue===0&&e.pstyle("background-image").strValue==="none"}function K2(e,t,n){var r=e.drawing;t+=1,n.isNode()?(r.drawTexture(n,t,"node-underlay"),AY(n)?r.drawSimpleRectangle(n,t,"node-body"):r.drawTexture(n,t,"node-body"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"node-overlay")):(r.drawEdgeLine(n,t),r.drawEdgeArrow(n,t,"source"),r.drawEdgeArrow(n,t,"target"),r.drawTexture(n,t,"label"),r.drawTexture(n,t,"edge-source-label"),r.drawTexture(n,t,"edge-target-label"))}function AD(e,t,n){var r;e.webglDebug&&(r=performance.now());var i=e.drawing,a=0;if(n.screen&&e.data.canvasNeedsRedraw[e.SELECT_BOX]&&FY(e,t),e.data.canvasNeedsRedraw[e.NODE]||n.picking){var s=e.data.contexts[e.WEBGL];n.screen?(s.clearColor(0,0,0,0),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA)):s.disable(s.BLEND),s.clear(s.COLOR_BUFFER_BIT|s.DEPTH_BUFFER_BIT),s.viewport(0,0,s.canvas.width,s.canvas.height);var o=EY(e),u=e.getCachedZSortedEles();if(a=u.length,i.startFrame(o,n),n.screen){for(var l=0;l<u.nondrag.length;l++)K2(e,l,u.nondrag[l]);for(var c=0;c<u.drag.length;c++)K2(e,c,u.drag[c])}else if(n.picking)for(var f=0;f<u.length;f++)K2(e,f,u[f]);i.endFrame(),n.screen&&e.webglDebugShowAtlases&&(SY(e),CY(e)),e.data.canvasNeedsRedraw[e.NODE]=!1,e.data.canvasNeedsRedraw[e.DRAG]=!1}if(e.webglDebug){var d=performance.now(),h=!1,g=Math.ceil(d-r),p=i.getDebugInfo(),v=["".concat(a," elements"),"".concat(p.totalInstances," instances"),"".concat(p.batchCount," batches"),"".concat(p.totalAtlases," atlases"),"".concat(p.wrappedCount," wrapped textures"),"".concat(p.rectangleCount," simple rectangles")].join(", ");if(h)console.log("WebGL (".concat(n.name,") - time ").concat(g,"ms, ").concat(v));else{console.log("WebGL (".concat(n.name,") - frame time ").concat(g,"ms")),console.log("Totals:"),console.log("  ".concat(v)),console.log("Texture Atlases Used:");var m=p.atlasInfo,y=$i(m),b;try{for(y.s();!(b=y.n()).done;){var w=b.value;console.log("  ".concat(w.type,": ").concat(w.keyCount," keys, ").concat(w.atlasCount," atlases"))}}catch(E){y.e(E)}finally{y.f()}console.log("")}}e.data.gc&&(console.log("Garbage Collect!"),e.data.gc=!1,i.gc())}var bo={};bo.drawPolygonPath=function(e,t,n,r,i,a){var s=r/2,o=i/2;e.beginPath&&e.beginPath(),e.moveTo(t+s*a[0],n+o*a[1]);for(var u=1;u<a.length/2;u++)e.lineTo(t+s*a[u*2],n+o*a[u*2+1]);e.closePath()},bo.drawRoundPolygonPath=function(e,t,n,r,i,a,s){s.forEach(function(o){return j$(e,o)}),e.closePath()},bo.drawRoundRectanglePath=function(e,t,n,r,i,a){var s=r/2,o=i/2,u=a==="auto"?vu(r,i):Math.min(a,o,s);e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.arcTo(t+s,n-o,t+s,n,u),e.arcTo(t+s,n+o,t,n+o,u),e.arcTo(t-s,n+o,t-s,n,u),e.arcTo(t-s,n-o,t,n-o,u),e.lineTo(t,n-o),e.closePath()},bo.drawBottomRoundRectanglePath=function(e,t,n,r,i,a){var s=r/2,o=i/2,u=a==="auto"?vu(r,i):a;e.beginPath&&e.beginPath(),e.moveTo(t,n-o),e.lineTo(t+s,n-o),e.lineTo(t+s,n),e.arcTo(t+s,n+o,t,n+o,u),e.arcTo(t-s,n+o,t-s,n,u),e.lineTo(t-s,n-o),e.lineTo(t,n-o),e.closePath()},bo.drawCutRectanglePath=function(e,t,n,r,i,a,s){var o=r/2,u=i/2,l=s==="auto"?gb():s;e.beginPath&&e.beginPath(),e.moveTo(t-o+l,n-u),e.lineTo(t+o-l,n-u),e.lineTo(t+o,n-u+l),e.lineTo(t+o,n+u-l),e.lineTo(t+o-l,n+u),e.lineTo(t-o+l,n+u),e.lineTo(t-o,n+u-l),e.lineTo(t-o,n-u+l),e.closePath()},bo.drawBarrelPath=function(e,t,n,r,i){var a=r/2,s=i/2,o=t-a,u=t+a,l=n-s,c=n+s,f=pb(r,i),d=f.widthOffset,h=f.heightOffset,g=f.ctrlPtOffsetPct*d;e.beginPath&&e.beginPath(),e.moveTo(o,l+h),e.lineTo(o,c-h),e.quadraticCurveTo(o+g,c,o+d,c),e.lineTo(u-d,c),e.quadraticCurveTo(u-g,c,u,c-h),e.lineTo(u,l+h),e.quadraticCurveTo(u-g,l,u-d,l),e.lineTo(o+d,l),e.quadraticCurveTo(o+g,l,o,l+h),e.closePath()};for(var TD=Math.sin(0),MD=Math.cos(0),Z2={},Q2={},$D=Math.PI/40,vc=0*Math.PI;vc<2*Math.PI;vc+=$D)Z2[vc]=Math.sin(vc),Q2[vc]=Math.cos(vc);bo.drawEllipsePath=function(e,t,n,r,i){if(e.beginPath&&e.beginPath(),e.ellipse)e.ellipse(t,n,r/2,i/2,0,0,2*Math.PI);else for(var a,s,o=r/2,u=i/2,l=0*Math.PI;l<2*Math.PI;l+=$D)a=t-o*Z2[l]*TD+o*Q2[l]*MD,s=n+u*Q2[l]*TD+u*Z2[l]*MD,l===0?e.moveTo(a,s):e.lineTo(a,s);e.closePath()};var Sd={};Sd.createBuffer=function(e,t){var n=document.createElement("canvas");return n.width=e,n.height=t,[n,n.getContext("2d")]},Sd.bufferCanvasImage=function(e){var t=this.cy,n=t.mutableElements(),r=n.boundingBox(),i=this.findContainerClientCoords(),a=e.full?Math.ceil(r.w):i[2],s=e.full?Math.ceil(r.h):i[3],o=ve(e.maxWidth)||ve(e.maxHeight),u=this.getPixelRatio(),l=1;if(e.scale!==void 0)a*=e.scale,s*=e.scale,l=e.scale;else if(o){var c=1/0,f=1/0;ve(e.maxWidth)&&(c=l*e.maxWidth/a),ve(e.maxHeight)&&(f=l*e.maxHeight/s),l=Math.min(c,f),a*=l,s*=l}o||(a*=u,s*=u,l*=u);var d=document.createElement("canvas");d.width=a,d.height=s,d.style.width=a+"px",d.style.height=s+"px";var h=d.getContext("2d");if(a>0&&s>0){h.clearRect(0,0,a,s),h.globalCompositeOperation="source-over";var g=this.getCachedZSortedEles();if(e.full)h.translate(-r.x1*l,-r.y1*l),h.scale(l,l),this.drawElements(h,g),h.scale(1/l,1/l),h.translate(r.x1*l,r.y1*l);else{var p=t.pan(),v={x:p.x*l,y:p.y*l};l*=t.zoom(),h.translate(v.x,v.y),h.scale(l,l),this.drawElements(h,g),h.scale(1/l,1/l),h.translate(-v.x,-v.y)}e.bg&&(h.globalCompositeOperation="destination-over",h.fillStyle=e.bg,h.rect(0,0,a,s),h.fill())}return d};function TY(e,t){for(var n=atob(e),r=new ArrayBuffer(n.length),i=new Uint8Array(r),a=0;a<n.length;a++)i[a]=n.charCodeAt(a);return new Blob([r],{type:t})}function DD(e){var t=e.indexOf(",");return e.substr(t+1)}function RD(e,t,n){var r=function(){return t.toDataURL(n,e.quality)};switch(e.output){case"blob-promise":return new ec(function(i,a){try{t.toBlob(function(s){s!=null?i(s):a(new Error("`canvas.toBlob()` sent a null value in its callback"))},n,e.quality)}catch(s){a(s)}});case"blob":return TY(DD(r()),n);case"base64":return DD(r());case"base64uri":default:return r()}}Sd.png=function(e){return RD(e,this.bufferCanvasImage(e),"image/png")},Sd.jpg=function(e){return RD(e,this.bufferCanvasImage(e),"image/jpeg")};var PD={};PD.nodeShapeImpl=function(e,t,n,r,i,a,s,o){switch(e){case"ellipse":return this.drawEllipsePath(t,n,r,i,a);case"polygon":return this.drawPolygonPath(t,n,r,i,a,s);case"round-polygon":return this.drawRoundPolygonPath(t,n,r,i,a,s,o);case"roundrectangle":case"round-rectangle":return this.drawRoundRectanglePath(t,n,r,i,a,o);case"cutrectangle":case"cut-rectangle":return this.drawCutRectanglePath(t,n,r,i,a,s,o);case"bottomroundrectangle":case"bottom-round-rectangle":return this.drawBottomRoundRectanglePath(t,n,r,i,a,o);case"barrel":return this.drawBarrelPath(t,n,r,i,a)}};var MY=ND,Je=ND.prototype;Je.CANVAS_LAYERS=3,Je.SELECT_BOX=0,Je.DRAG=1,Je.NODE=2,Je.WEBGL=3,Je.CANVAS_TYPES=["2d","2d","2d","webgl2"],Je.BUFFER_COUNT=3,Je.TEXTURE_BUFFER=0,Je.MOTIONBLUR_BUFFER_NODE=1,Je.MOTIONBLUR_BUFFER_DRAG=2;function ND(e){var t=this,n=t.cy.window(),r=n.document;e.webgl&&(Je.CANVAS_LAYERS=t.CANVAS_LAYERS=4,console.log("webgl rendering enabled")),t.data={canvases:new Array(Je.CANVAS_LAYERS),contexts:new Array(Je.CANVAS_LAYERS),canvasNeedsRedraw:new Array(Je.CANVAS_LAYERS),bufferCanvases:new Array(Je.BUFFER_COUNT),bufferContexts:new Array(Je.CANVAS_LAYERS)};var i="-webkit-tap-highlight-color",a="rgba(0,0,0,0)";t.data.canvasContainer=r.createElement("div");var s=t.data.canvasContainer.style;t.data.canvasContainer.style[i]=a,s.position="relative",s.zIndex="0",s.overflow="hidden";var o=e.cy.container();o.appendChild(t.data.canvasContainer),o.style[i]=a;var u={"-webkit-user-select":"none","-moz-user-select":"-moz-none","user-select":"none","-webkit-tap-highlight-color":"rgba(0,0,0,0)","outline-style":"none"};OU()&&(u["-ms-touch-action"]="none",u["touch-action"]="none");for(var l=0;l<Je.CANVAS_LAYERS;l++){var c=t.data.canvases[l]=r.createElement("canvas"),f=Je.CANVAS_TYPES[l];t.data.contexts[l]=c.getContext(f),t.data.contexts[l]||zt("Could not create canvas of type "+f),Object.keys(u).forEach(function(B){c.style[B]=u[B]}),c.style.position="absolute",c.setAttribute("data-id","layer"+l),c.style.zIndex=String(Je.CANVAS_LAYERS-l),t.data.canvasContainer.appendChild(c),t.data.canvasNeedsRedraw[l]=!1}t.data.topCanvas=t.data.canvases[0],t.data.canvases[Je.NODE].setAttribute("data-id","layer"+Je.NODE+"-node"),t.data.canvases[Je.SELECT_BOX].setAttribute("data-id","layer"+Je.SELECT_BOX+"-selectbox"),t.data.canvases[Je.DRAG].setAttribute("data-id","layer"+Je.DRAG+"-drag"),t.data.canvases[Je.WEBGL]&&t.data.canvases[Je.WEBGL].setAttribute("data-id","layer"+Je.WEBGL+"-webgl");for(var l=0;l<Je.BUFFER_COUNT;l++)t.data.bufferCanvases[l]=r.createElement("canvas"),t.data.bufferContexts[l]=t.data.bufferCanvases[l].getContext("2d"),t.data.bufferCanvases[l].style.position="absolute",t.data.bufferCanvases[l].setAttribute("data-id","buffer"+l),t.data.bufferCanvases[l].style.zIndex=String(-l-1),t.data.bufferCanvases[l].style.visibility="hidden";t.pathsEnabled=!0;var d=Rr(),h=function(I){return{x:(I.x1+I.x2)/2,y:(I.y1+I.y2)/2}},g=function(I){return{x:-I.w/2,y:-I.h/2}},p=function(I){var U=I[0]._private,L=U.oldBackgroundTimestamp===U.backgroundTimestamp;return!L},v=function(I){return I[0]._private.nodeKey},m=function(I){return I[0]._private.labelStyleKey},y=function(I){return I[0]._private.sourceLabelStyleKey},b=function(I){return I[0]._private.targetLabelStyleKey},w=function(I,U,L,ae,de){return t.drawElement(I,U,L,!1,!1,de)},E=function(I,U,L,ae,de){return t.drawElementText(I,U,L,ae,"main",de)},F=function(I,U,L,ae,de){return t.drawElementText(I,U,L,ae,"source",de)},x=function(I,U,L,ae,de){return t.drawElementText(I,U,L,ae,"target",de)},C=function(I){return I.boundingBox(),I[0]._private.bodyBounds},S=function(I){return I.boundingBox(),I[0]._private.labelBounds.main||d},_=function(I){return I.boundingBox(),I[0]._private.labelBounds.source||d},k=function(I){return I.boundingBox(),I[0]._private.labelBounds.target||d},T=function(I,U){return U},A=function(I){return h(C(I))},$=function(I,U,L){var ae=I?I+"-":"";return{x:U.x+L.pstyle(ae+"text-margin-x").pfValue,y:U.y+L.pstyle(ae+"text-margin-y").pfValue}},M=function(I,U,L){var ae=I[0]._private.rscratch;return{x:ae[U],y:ae[L]}},D=function(I){return $("",M(I,"labelX","labelY"),I)},P=function(I){return $("source",M(I,"sourceLabelX","sourceLabelY"),I)},N=function(I){return $("target",M(I,"targetLabelX","targetLabelY"),I)},O=function(I){return g(C(I))},q=function(I){return g(_(I))},z=function(I){return g(k(I))},W=function(I){var U=S(I),L=g(S(I));if(I.isNode()){switch(I.pstyle("text-halign").value){case"left":L.x=-U.w-(U.leftPad||0);break;case"right":L.x=-(U.rightPad||0);break}switch(I.pstyle("text-valign").value){case"top":L.y=-U.h-(U.topPad||0);break;case"bottom":L.y=-(U.botPad||0);break}}return L},Y=t.data.eleTxrCache=new bd(t,{getKey:v,doesEleInvalidateKey:p,drawElement:w,getBoundingBox:C,getRotationPoint:A,getRotationOffset:O,allowEdgeTxrCaching:!1,allowParentTxrCaching:!1}),J=t.data.lblTxrCache=new bd(t,{getKey:m,drawElement:E,getBoundingBox:S,getRotationPoint:D,getRotationOffset:W,isVisible:T}),X=t.data.slbTxrCache=new bd(t,{getKey:y,drawElement:F,getBoundingBox:_,getRotationPoint:P,getRotationOffset:q,isVisible:T}),te=t.data.tlbTxrCache=new bd(t,{getKey:b,drawElement:x,getBoundingBox:k,getRotationPoint:N,getRotationOffset:z,isVisible:T}),ie=t.data.lyrTxrCache=new uD(t);t.onUpdateEleCalcs(function(I,U){Y.invalidateElements(U),J.invalidateElements(U),X.invalidateElements(U),te.invalidateElements(U),ie.invalidateElements(U);for(var L=0;L<U.length;L++){var ae=U[L]._private;ae.oldBackgroundTimestamp=ae.backgroundTimestamp}});var se=function(I){for(var U=0;U<I.length;U++)ie.enqueueElementRefinement(I[U].ele)};Y.onDequeue(se),J.onDequeue(se),X.onDequeue(se),te.onDequeue(se),e.webgl&&t.initWebgl(e,{getStyleKey:v,getLabelKey:m,getSourceLabelKey:y,getTargetLabelKey:b,drawElement:w,drawLabel:E,drawSourceLabel:F,drawTargetLabel:x,getElementBox:C,getLabelBox:S,getSourceLabelBox:_,getTargetLabelBox:k,getElementRotationPoint:A,getElementRotationOffset:O,getLabelRotationPoint:D,getSourceLabelRotationPoint:P,getTargetLabelRotationPoint:N,getLabelRotationOffset:W,getSourceLabelRotationOffset:q,getTargetLabelRotationOffset:z})}Je.redrawHint=function(e,t){var n=this;switch(e){case"eles":n.data.canvasNeedsRedraw[Je.NODE]=t;break;case"drag":n.data.canvasNeedsRedraw[Je.DRAG]=t;break;case"select":n.data.canvasNeedsRedraw[Je.SELECT_BOX]=t;break;case"gc":n.data.gc=!0;break}};var $Y=typeof Path2D<"u";Je.path2dEnabled=function(e){if(e===void 0)return this.pathsEnabled;this.pathsEnabled=!!e},Je.usePaths=function(){return $Y&&this.pathsEnabled},Je.setImgSmoothing=function(e,t){e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled=t:(e.webkitImageSmoothingEnabled=t,e.mozImageSmoothingEnabled=t,e.msImageSmoothingEnabled=t)},Je.getImgSmoothing=function(e){return e.imageSmoothingEnabled!=null?e.imageSmoothingEnabled:e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled},Je.makeOffscreenCanvas=function(e,t){var n;if((typeof OffscreenCanvas>"u"?"undefined":tn(OffscreenCanvas))!=="undefined")n=new OffscreenCanvas(e,t);else{var r=this.cy.window(),i=r.document;n=i.createElement("canvas"),n.width=e,n.height=t}return n},[cD,ba,ds,H2,Su,hc,or,kD,bo,Sd,PD].forEach(function(e){Ie(Je,e)});var DY=[{name:"null",impl:I$},{name:"base",impl:nD},{name:"canvas",impl:MY}],RY=[{type:"layout",extensions:fG},{type:"renderer",extensions:DY}],OD={},ID={};function BD(e,t,n){var r=n,i=function(C){gt("Can not register `"+t+"` for `"+e+"` since `"+C+"` already exists in the prototype and can not be overridden")};if(e==="core"){if(pd.prototype[t])return i(t);pd.prototype[t]=n}else if(e==="collection"){if(On.prototype[t])return i(t);On.prototype[t]=n}else if(e==="layout"){for(var a=function(C){this.options=C,n.call(this,C),ut(this._private)||(this._private={}),this._private.cy=C.cy,this._private.listeners=[],this.createEmitter()},s=a.prototype=Object.create(n.prototype),o=[],u=0;u<o.length;u++){var l=o[u];s[l]=s[l]||function(){return this}}s.start&&!s.run?s.run=function(){return this.start(),this}:!s.start&&s.run&&(s.start=function(){return this.run(),this});var c=n.prototype.stop;s.stop=function(){var x=this.options;if(x&&x.animate){var C=this.animations;if(C)for(var S=0;S<C.length;S++)C[S].stop()}return c?c.call(this):this.emit("layoutstop"),this},s.destroy||(s.destroy=function(){return this}),s.cy=function(){return this._private.cy};var f=function(C){return C._private.cy},d={addEventFields:function(C,S){S.layout=C,S.cy=f(C),S.target=C},bubble:function(){return!0},parent:function(C){return f(C)}};Ie(s,{createEmitter:function(){return this._private.emitter=new Cp(d,this),this},emitter:function(){return this._private.emitter},on:function(C,S){return this.emitter().on(C,S),this},one:function(C,S){return this.emitter().one(C,S),this},once:function(C,S){return this.emitter().one(C,S),this},removeListener:function(C,S){return this.emitter().removeListener(C,S),this},removeAllListeners:function(){return this.emitter().removeAllListeners(),this},emit:function(C,S){return this.emitter().emit(C,S),this}}),pt.eventAliasesOn(s),r=a}else if(e==="renderer"&&t!=="null"&&t!=="base"){var h=LD("renderer","base"),g=h.prototype,p=n,v=n.prototype,m=function(){h.apply(this,arguments),p.apply(this,arguments)},y=m.prototype;for(var b in g){var w=g[b],E=v[b]!=null;if(E)return i(b);y[b]=w}for(var F in v)y[F]=v[F];g.clientFunctions.forEach(function(x){y[x]=y[x]||function(){zt("Renderer does not implement `renderer."+x+"()` on its prototype")}}),r=m}else if(e==="__proto__"||e==="constructor"||e==="prototype")return zt(e+" is an illegal type to be registered, possibly lead to prototype pollutions");return DA({map:OD,keys:[e,t],value:r})}function LD(e,t){return RA({map:OD,keys:[e,t]})}function PY(e,t,n,r,i){return DA({map:ID,keys:[e,t,n,r],value:i})}function NY(e,t,n,r){return RA({map:ID,keys:[e,t,n,r]})}var J2=function(){if(arguments.length===2)return LD.apply(null,arguments);if(arguments.length===3)return BD.apply(null,arguments);if(arguments.length===4)return NY.apply(null,arguments);if(arguments.length===5)return PY.apply(null,arguments);zt("Invalid extension access syntax")};pd.prototype.extension=J2,RY.forEach(function(e){e.extensions.forEach(function(t){BD(e.type,t.name,t.impl)})});var Zp=function(){if(!(this instanceof Zp))return new Zp;this.length=0},Cu=Zp.prototype;Cu.instanceString=function(){return"stylesheet"},Cu.selector=function(e){var t=this.length++;return this[t]={selector:e,properties:[]},this},Cu.css=function(e,t){var n=this.length-1;if(Me(e))this[n].properties.push({name:e,value:t});else if(ut(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var s=i[a],o=r[s];if(o!=null){var u=yn.properties[s]||yn.properties[Qg(s)];if(u!=null){var l=u.name,c=o;this[n].properties.push({name:l,value:c})}}}return this},Cu.style=Cu.css,Cu.generateStyle=function(e){var t=new yn(e);return this.appendToStyle(t)},Cu.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var s=i[a];e.css(s.name,s.value)}}return e};var OY="3.31.2",wo=function(t){if(t===void 0&&(t={}),ut(t))return new pd(t);if(Me(t))return J2.apply(J2,arguments)};wo.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(wo),e.apply(null,t),this},wo.warnings=function(e){return rT(e)},wo.version=OY,wo.stylesheet=wo.Stylesheet=Zp;function zD(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void zD(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function IY(e){var t="",n,r;try{r=1,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div class="g-graph-container">',r=2,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div class="g-item-info-header">',r=3,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<i class="icon-picture"></i>',r=4,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+"GEMD Graph</div></div>",r=5,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div class="g-graph-panes clearfix">',r=6,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div class="g-graph-left">',r=7,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div id="cy"></div></div>',r=8,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div class="g-graph-right">',r=9,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/graphItem.pug",t=t+'<div id="cy-json"></div></div></div>'}catch(i){zD(i,n,r)}return t}const ASe="",{restRequest:BY}=girder.rest,LY=girder.views.View,qD=girder.$;var UD={node:{css:!1,data:!0,position:!0,discludeds:[]},edge:{css:!1,data:!0,discludeds:[]},layoutBy:"cose"};wo("core","graphml",function(e){var t=this,n,r=function(i,a,s,o){function u(l,c){l.children("node").each(function(){var f=a(this),d=f.attr("id");d.includes("[")&&(d=d.split(" [")[0]);var h={data:{id:f.attr("id"),label:d},css:{},position:{}};c!==null&&(h.data.parent=c.attr("id")),f.children("data").each(function(){var g=a(this);h.data[g.attr("key")]=g.text()}),i.add({group:"nodes",data:h.data,css:h.css,position:h.position,style:{"background-color":h.data.color}}),f.children("graph").each(function(){var g=a(this);u(g,f)})})}i.batch(function(){a(a.parseXML(e)).find("graph").first().each(function(){var d=a(this);u(d,null),d.find("edge").each(function(){var h=a(this),g={data:{id:h.attr("id"),source:h.attr("source"),target:h.attr("target")},css:{},position:{}};h.find("data").each(function(){var p=a(this);g.data[p.attr("key")]=p.text()}),i.add({group:"edges",data:g.data,css:g.css})})});var f=typeof s.layoutBy;f==="string"?i.layout({name:s.layoutBy}).run():f==="function"&&s.layoutBy()})};switch(typeof e){case"string":console.log("Importing GraphML..."),n=r(t,qD,UD);break;case"object":qD.extend(!0,UD,e),n=t;break;case"undefined":console.log("Exporter doesn't work yet.");break;default:console.log("Functionality(argument) of .graphml() is not recognized.")}return n});const zY=LY.extend({className:"g-graph-view",initialize:function(e){this.graphId=e.graphId;var t=this;BY({url:`file/${e.graphId}/download`}).done(n=>{t.graphFile=n,t.render()})},render:function(){if(this.$el.html(IY()),document.getElementById("cy")){var e=this,t=wo({container:document.getElementById("cy"),style:[{selector:"node",style:{"background-color":"#666",label:"data(label)"}},{selector:"edge",style:{width:3,"line-color":"#ccc","target-arrow-color":"#ccc","target-arrow-shape":"triangle","curve-style":"bezier"}}],layout:{name:"grid",rows:1},ready:function(){console.log(e.graphFile),this.graphml({layoutBy:"cose"}),this.graphml(e.graphFile)}});t.on("tap","node",function(){const n=JSON.stringify(JSON.parse(this.data("object")),null,2),r=/(https?:\/\/[^\s]+)/g,i=n.replace(r,function(a){return'<a href="'+a+'" target="_blank">'+a+"</a>"});document.getElementById("cy-json").innerHTML="<pre>"+i+"</pre>",console.log("tapped "+this.id())})}return this}});function VD(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void VD(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function qY(e){var t="",n,r;try{r=1,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewWidget.pug",t=t+'<div class="g-widget-item-previews-header">',r=2,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewWidget.pug",t=t+'<i class="icon-eye"></i>',r=3,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewWidget.pug",t=t+" Item Previews</div>",r=5,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewWidget.pug",t=t+'<div class="g-widget-item-previews-container">',r=6,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewWidget.pug",t=t+'<div class="g-widget-item-previews-wrapper"></div></div>'}catch(i){VD(i,n,r)}return t}function Cd(e,t,n,r){if(t===!1||t==null||!t&&(e==="class"||e==="style"))return"";if(t===!0)return" "+(r?e:e+'="'+e+'"');var i=typeof t;return i!=="object"&&i!=="function"||typeof t.toJSON!="function"||(t=t.toJSON()),typeof t=="string"||(t=JSON.stringify(t),n||t.indexOf('"')===-1)?(n&&(t=Qp(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"&#39;")+"'"}function Qp(e){var t=""+e,n=UY.exec(t);if(!n)return e;var r,i,a,s="";for(r=n.index,i=0;r<t.length;r++){switch(t.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;case 62:a="&gt;";break;default:continue}i!==r&&(s+=t.substring(i,r)),i=r+1,s+=a}return i!==r?s+t.substring(i,r):s}var UY=/["&<>]/;function WD(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void WD(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function VY(e){var t="",n,r,i;try{var a=e||{};(function(s,o,u){i=1,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+'<div class="g-widget-item-preview">',i=3,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<h4>",i=4,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<a"+(' class="g-item-preview-link"'+Cd("data-id",u.id,!0,!1))+">",i=4,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+Qp((n=u.name())==null?"":n)+"</a></h4>",i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",(function(){var l=o;if(typeof l.length=="number")for(var c=0,f=l.length;c<f;c++){var d=l[c];i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",d.type==="image"?(i=8,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<div>",i=9,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<img"+Cd("src",d.value,!0,!1)+"/></div>"):d.type==="json"&&(i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<textarea"+(' class="json"'+Cd("data-id",u.id,!0,!1))+">",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+Qp((n=s.stringify(d.value,null,"	"))==null?"":n)+"</textarea>")}else{var f=0;for(var c in l){f++;var d=l[c];i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",d.type==="image"?(i=8,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<div>",i=9,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<img"+Cd("src",d.value,!0,!1)+"/></div>"):d.type==="json"&&(i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+"<textarea"+(' class="json"'+Cd("data-id",u.id,!0,!1))+">",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/itemPreviewItem.pug",t=t+Qp((n=s.stringify(d.value,null,"	"))==null?"":n)+"</textarea>")}}}).call(this),t=t+"</div>"}).call(this,"JSON"in a?a.JSON:typeof JSON<"u"?JSON:void 0,"contents"in a?a.contents:typeof contents<"u"?contents:void 0,"item"in a?a.item:typeof item<"u"?item:void 0)}catch(s){WD(s,r,i)}return t}const TSe="",HD=girder.views.View,{getApiRoot:WY,restRequest:jD}=girder.rest,{_whenAll:GD}=girder.misc,ew=girder.$,YD=girder._;var HY=HD.extend({events:{"click a.g-item-preview-link":function(e){var t=this.$(e.currentTarget).data("id");this.parentView.itemListView.trigger("g:itemClicked",this.collection.get(t))}},initialize:function(e){this.debouncedaddMoreItems=YD.debounce(this.addMoreItems,100),this.onScroll=YD.debounce(this.onScroll,100),this.initialized=!1,this.addingMoreItems=!1,this.supportedItems=[]},setCollection:function(e){this.collection=e,this.listenTo(this.collection,"g:changed",()=>{this.supportedItems=this.collection.filter(this._isSupportedItem.bind(this)),this.supportedItems.length!==0&&(this.isNotFull()||this.isNearBottom())&&this.debouncedaddMoreItems()})},_MAX_JSON_SIZE:2e6,_MAX_IMAGE_SIZE:2e7,_LOAD_BATCH_SIZE:2,_isSupportedItem:function(e){return this._isImageItem(e.name())||this._isJSONItem(e.name())},_isJSONItem:function(e){return/(json)$/i.test(e)},_isImageItem:function(e){return/(jpg|jpeg|png|gif)$/i.test(e)},setElement:function(e){return this.initialized=!1,HD.prototype.setElement.apply(this,arguments)},render:function(){return this.initialized||(this.initialized=!0,this.renderedIndex=0,this.$el.html(qY()),this.$(".g-widget-item-previews-container").on("scroll",e=>this.onScroll(e)),this.debouncedaddMoreItems()),this},isNotFull:function(){return this.$(".g-widget-item-previews-wrapper").height()<=this.$(".g-widget-item-previews-container").height()},allItemAdded:function(){return this.renderedIndex>=this.supportedItems.length},addMoreItems:function(){this.addingMoreItems=!0;var e=this.supportedItems.slice(this.renderedIndex,this.renderedIndex+this._LOAD_BATCH_SIZE);if(this.renderedIndex=Math.min(this.renderedIndex+this._LOAD_BATCH_SIZE,this.supportedItems.length),!!e.length){var t=this.$(".g-widget-item-previews-wrapper");GD(e.map(n=>jD({url:`item/${n.id}/files`,data:{limit:5}}).then(r=>GD(r.map(i=>this.tryGetFileContent(i,i.mimeType)))))).done(n=>{e.forEach((r,i)=>{var a=n[i].filter(s=>s);a.length&&t.append(VY({item:r,contents:a}))}),!this.allItemAdded()&&this.isNotFull()&&this.addMoreItems()}).always(()=>{this.addingMoreItems=!1})}},isNearBottom:function(){var e=this.$(".g-widget-item-previews-container");return e.scrollTop()+e.innerHeight()>=e[0].scrollHeight-200},onScroll:function(e){this.isNearBottom()&&!this.addingMoreItems&&!this.allItemAdded()&&this.addMoreItems()},tryGetFileContent:function(e,t){if(this._isJSONItem(e.name))return e.size>this._MAX_JSON_SIZE?ew.Deferred().resolve(null).promise():this.getJsonContent(`file/${e._id}/download`);if(this._isImageItem(t))return e.size>this._MAX_IMAGE_SIZE?ew.Deferred().resolve(null).promise():this.getImageContent(`file/${e._id}/download`)},getJsonContent:function(e){return jD({url:e,method:"GET",error:null}).then(t=>({type:"json",value:t}))},getImageContent:function(e){var t=ew.Deferred(),r=WY()+"/"+e,i=new Image;return i.onload=function(){t.resolve({type:"image",value:r})},i.src=r,t.promise()}});const{wrap:jY}=girder.utilities.PluginUtils,GY=girder.views.widgets.HierarchyWidget;jY(GY,"render",function(e){return e.call(this),this.parentModel.resourceName==="folder"&&this._showItems&&(this.itemPreviewView=new HY({class:"g-item-previews-container",collection:this.itemListView.collection,parentView:this}),this.$el.append(this.itemPreviewView.$el),this.itemPreviewView.setCollection(this.itemListView.collection),this.itemPreviewView.render()),this});function XD(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void XD(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function YY(e){var t="",n,r;try{r=1,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<div class="form-group">',r=2,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<label for="g-htmdec-data">',r=2,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+"HTMDEC Data",r=3,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<select class="form-control input-sm" id="g-htmdec-data">',r=4,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<option value="default" selected="selected">',r=4,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+"Not HTMDEC</option>",r=5,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<option value="sem">',r=5,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+"SEM Data</option>",r=6,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<option value="pdv">',r=6,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+"PDV Data</option>",r=7,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+'<option value="syncFolder">',r=7,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/filesystemImport.pug",t=t+"Sync Folder</option></select></label></div>"}catch(i){XD(i,n,r)}return t}const XY=girder.router,KD=girder.views.body.FilesystemImportView,{wrap:KY}=girder.utilities.PluginUtils,ZY=girder.$;KD.prototype.events["submit .g-filesystem-import-form"]=function(e){e.preventDefault();var t=this.$("#g-filesystem-import-dest-id").val().trim().split(/\s/)[0],n=this.$("#g-filesystem-import-dest-type").val(),r=this.$("#g-filesystem-import-leaf-items").val();this.$(".g-validation-failed-message").empty(),this.assetstore.off("g:imported").on("g:imported",function(){XY.navigate(n+"/"+t,{trigger:!0})},this).on("g:error",function(i){this.$(".g-validation-failed-message").text(i.responseJSON.message)},this).import({importPath:this.$("#g-filesystem-import-path").val().trim(),leafFoldersAsItems:r,destinationId:t,destinationType:n,dataType:this.$("#g-htmdec-data").val(),progress:!0})},KY(KD,"render",function(e){return e.call(this),ZY(".g-filesystem-import-form > .form-group").last().after(YY()),this});function Xr(e,t,n){return e.fields=t||[],e.fname=n,e}function Kt(e){return e==null?null:e.fname}function ur(e){return e==null?null:e.fields}function ZD(e){return e.length===1?QY(e[0]):JY(e)}const QY=e=>function(t){return t[e]},JY=e=>{const t=e.length;return function(n){for(let r=0;r<t;++r)n=n[e[r]];return n}};function Q(e){throw Error(e)}function hs(e){const t=[],n=e.length;let r=null,i=0,a="",s,o,u;e=e+"";function l(){t.push(a+e.substring(s,o)),a="",s=o+1}for(s=o=0;o<n;++o)if(u=e[o],u==="\\")a+=e.substring(s,o++),s=o;else if(u===r)l(),r=null,i=-1;else{if(r)continue;s===i&&u==='"'||s===i&&u==="'"?(s=o+1,r=u):u==="."&&!i?o>s?l():s=o+1:u==="["?(o>s&&l(),i=s=o+1):u==="]"&&(i||Q("Access path missing open bracket: "+e),i>0&&l(),i=0,s=o+1)}return i&&Q("Access path missing closing bracket: "+e),r&&Q("Access path missing closing quote: "+e),o>s&&(o++,l()),t}function Ni(e,t,n){const r=hs(e);return e=r.length===1?r[0]:e,Xr((n&&n.get||ZD)(r),[e],t||e)}const Jp=Ni("id"),lr=Xr(e=>e,[],"identity"),ku=Xr(()=>0,[],"zero"),kd=Xr(()=>1,[],"one"),Oi=Xr(()=>!0,[],"true"),_u=Xr(()=>!1,[],"false");function eX(e,t,n){const r=[t].concat([].slice.call(n));console[e].apply(console,r)}const tX=0,QD=1,JD=2,nX=3,rX=4;function eR(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:eX,r=e||tX;return{level(i){return arguments.length?(r=+i,this):r},error(){return r>=QD&&n(t||"error","ERROR",arguments),this},warn(){return r>=JD&&n(t||"warn","WARN",arguments),this},info(){return r>=nX&&n(t||"log","INFO",arguments),this},debug(){return r>=rX&&n(t||"log","DEBUG",arguments),this}}}var ee=Array.isArray;function we(e){return e===Object(e)}const tR=e=>e!=="__proto__";function tw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce((r,i)=>{for(const a in i)if(a==="signals")r.signals=iX(r.signals,i.signals);else{const s=a==="legend"?{layout:1}:a==="style"?!0:null;e0(r,a,i[a],s)}return r},{})}function e0(e,t,n,r){if(!tR(t))return;let i,a;if(we(n)&&!ee(n)){a=we(e[t])?e[t]:e[t]={};for(i in n)r&&(r===!0||r[i])?e0(a,i,n[i]):tR(i)&&(a[i]=n[i])}else e[t]=n}function iX(e,t){if(e==null)return t;const n={},r=[];function i(a){n[a.name]||(n[a.name]=1,r.push(a))}return t.forEach(i),e.forEach(i),r}function st(e){return e[e.length-1]}function cr(e){return e==null||e===""?null:+e}const nR=e=>t=>e*Math.exp(t),rR=e=>t=>Math.log(e*t),iR=e=>t=>Math.sign(t)*Math.log1p(Math.abs(t/e)),aR=e=>t=>Math.sign(t)*Math.expm1(Math.abs(t))*e,t0=e=>t=>t<0?-Math.pow(-t,e):Math.pow(t,e);function n0(e,t,n,r){const i=n(e[0]),a=n(st(e)),s=(a-i)*t;return[r(i-s),r(a-s)]}function aX(e,t){return n0(e,t,cr,lr)}function sX(e,t){var n=Math.sign(e[0]);return n0(e,t,rR(n),nR(n))}function oX(e,t,n){return n0(e,t,t0(n),t0(1/n))}function uX(e,t,n){return n0(e,t,iR(n),aR(n))}function r0(e,t,n,r,i){const a=r(e[0]),s=r(st(e)),o=t!=null?r(t):(a+s)/2;return[i(o+(a-o)*n),i(o+(s-o)*n)]}function sR(e,t,n){return r0(e,t,n,cr,lr)}function oR(e,t,n){const r=Math.sign(e[0]);return r0(e,t,n,rR(r),nR(r))}function nw(e,t,n,r){return r0(e,t,n,t0(r),t0(1/r))}function uR(e,t,n,r){return r0(e,t,n,iR(r),aR(r))}function lX(e){return 1+~~(new Date(e).getMonth()/3)}function cX(e){return 1+~~(new Date(e).getUTCMonth()/3)}function be(e){return e!=null?ee(e)?e:[e]:[]}function fX(e,t,n){let r=e[0],i=e[1],a;return i<r&&(a=i,i=r,r=a),a=i-r,a>=n-t?[t,n]:[r=Math.min(Math.max(r,t),n-a),r+a]}function Ke(e){return typeof e=="function"}const dX="descending";function lR(e,t,n){n=n||{},t=be(t)||[];const r=[],i=[],a={},s=n.comparator||hX;return be(e).forEach((o,u)=>{o!=null&&(r.push(t[u]===dX?-1:1),i.push(o=Ke(o)?o:Ni(o,null,n)),(ur(o)||[]).forEach(l=>a[l]=1))}),i.length===0?null:Xr(s(i,r),Object.keys(a))}const i0=(e,t)=>(e<t||e==null)&&t!=null?-1:(e>t||t==null)&&e!=null?1:(t=t instanceof Date?+t:t,(e=e instanceof Date?+e:e)!==e&&t===t?-1:t!==t&&e===e?1:0),hX=(e,t)=>e.length===1?gX(e[0],t[0]):pX(e,t,e.length),gX=(e,t)=>function(n,r){return i0(e(n),e(r))*t},pX=(e,t,n)=>(t.push(0),function(r,i){let a,s=0,o=-1;for(;s===0&&++o<n;)a=e[o],s=i0(a(r),a(i));return s*t[o]});function fr(e){return Ke(e)?e:()=>e}function cR(e,t){let n;return r=>{n&&clearTimeout(n),n=setTimeout(()=>(t(r),n=null),e)}}function Ze(e){for(let t,n,r=1,i=arguments.length;r<i;++r){t=arguments[r];for(n in t)e[n]=t[n]}return e}function gs(e,t){let n=0,r,i,a,s;if(e&&(r=e.length))if(t==null){for(i=e[n];n<r&&(i==null||i!==i);i=e[++n]);for(a=s=i;n<r;++n)i=e[n],i!=null&&(i<a&&(a=i),i>s&&(s=i))}else{for(i=t(e[n]);n<r&&(i==null||i!==i);i=t(e[++n]));for(a=s=i;n<r;++n)i=t(e[n]),i!=null&&(i<a&&(a=i),i>s&&(s=i))}return[a,s]}function vX(e,t){const n=e.length;let r=-1,i,a,s,o,u;if(t==null){for(;++r<n;)if(a=e[r],a!=null&&a>=a){i=s=a;break}if(r===n)return[-1,-1];for(o=u=r;++r<n;)a=e[r],a!=null&&(i>a&&(i=a,o=r),s<a&&(s=a,u=r))}else{for(;++r<n;)if(a=t(e[r],r,e),a!=null&&a>=a){i=s=a;break}if(r===n)return[-1,-1];for(o=u=r;++r<n;)a=t(e[r],r,e),a!=null&&(i>a&&(i=a,o=r),s<a&&(s=a,u=r))}return[o,u]}function xe(e,t){return Object.hasOwn(e,t)}const a0={};function _d(e){let t={},n;function r(a){return xe(t,a)&&t[a]!==a0}const i={size:0,empty:0,object:t,has:r,get(a){return r(a)?t[a]:void 0},set(a,s){return r(a)||(++i.size,t[a]===a0&&--i.empty),t[a]=s,this},delete(a){return r(a)&&(--i.size,++i.empty,t[a]=a0),this},clear(){i.size=i.empty=0,i.object=t={}},test(a){return arguments.length?(n=a,i):n},clean(){const a={};let s=0;for(const o in t){const u=t[o];u!==a0&&(!n||!n(u))&&(a[o]=u,++s)}i.size=s,i.empty=0,i.object=t=a}};return e&&Object.keys(e).forEach(a=>{i.set(a,e[a])}),i}function mX(e,t,n,r,i,a){if(!n&&n!==0)return a;const s=+n;let o=e[0],u=st(e),l;u<o&&(l=o,o=u,u=l),l=Math.abs(t-o);const c=Math.abs(u-t);return l<c&&l<=s?r:c<=s?i:a}function ge(e,t,n){const r=e.prototype=Object.create(t.prototype);return Object.defineProperty(r,"constructor",{value:e,writable:!0,enumerable:!0,configurable:!0}),Ze(r,n)}function Ad(e,t,n,r){let i=t[0],a=t[t.length-1],s;return i>a&&(s=i,i=a,a=s),n=n===void 0||n,r=r===void 0||r,(n?i<=e:i<e)&&(r?e<=a:e<a)}function mc(e){return typeof e=="boolean"}function Au(e){return Object.prototype.toString.call(e)==="[object Date]"}function yX(e){return e&&Ke(e[Symbol.iterator])}function yt(e){return typeof e=="number"}function fR(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Ee(e){return typeof e=="string"}function dR(e,t,n){e&&(e=t?be(e).map(o=>o.replace(/\\(.)/g,"$1")):be(e));const r=e&&e.length,i=n&&n.get||ZD,a=o=>i(t?[o]:hs(o));let s;if(!r)s=function(){return""};else if(r===1){const o=a(e[0]);s=function(u){return""+o(u)}}else{const o=e.map(a);s=function(u){let l=""+o[0](u),c=0;for(;++c<r;)l+="|"+o[c](u);return l}}return Xr(s,e,"key")}function bX(e,t){const n=e[0],r=st(e),i=+t;return i?i===1?r:n+i*(r-n):n}const wX=1e4;function xX(e){e=+e||wX;let t,n,r;const i=()=>{t={},n={},r=0},a=(s,o)=>(++r>e&&(n=t,t={},r=1),t[s]=o);return i(),{clear:i,has:s=>xe(t,s)||xe(n,s),get:s=>xe(t,s)?t[s]:xe(n,s)?a(s,n[s]):void 0,set:(s,o)=>xe(t,s)?t[s]=o:a(s,o)}}function EX(e,t,n,r){const i=t.length,a=n.length;if(!a)return t;if(!i)return n;const s=r||new t.constructor(i+a);let o=0,u=0,l=0;for(;o<i&&u<a;++l)s[l]=e(t[o],n[u])>0?n[u++]:t[o++];for(;o<i;++o,++l)s[l]=t[o];for(;u<a;++u,++l)s[l]=n[u];return s}function s0(e,t){let n="";for(;--t>=0;)n+=e;return n}function FX(e,t,n,r){const i=n||" ",a=e+"",s=t-a.length;return s<=0?a:r==="left"?s0(i,s)+a:r==="center"?s0(i,~~(s/2))+a+s0(i,Math.ceil(s/2)):a+s0(i,s)}function o0(e){return e&&st(e)-e[0]||0}function he(e){return ee(e)?"["+e.map(he)+"]":we(e)||Ee(e)?JSON.stringify(e).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):e}function hR(e){return e==null||e===""?null:!e||e==="false"||e==="0"?!1:!!e}const SX=e=>yt(e)||Au(e)?e:Date.parse(e);function gR(e,t){return t=t||SX,e==null||e===""?null:t(e)}function pR(e){return e==null||e===""?null:e+""}function wa(e){const t={},n=e.length;for(let r=0;r<n;++r)t[e[r]]=!0;return t}function CX(e,t,n,r){const i=r??"…",a=e+"",s=a.length,o=Math.max(0,t-i.length);return s<=t?a:n==="left"?i+a.slice(s-o):n==="center"?a.slice(0,Math.ceil(o/2))+i+a.slice(s-~~(o/2)):a.slice(0,o)+i}function Tu(e,t,n){if(e)if(t){const r=e.length;for(let i=0;i<r;++i){const a=t(e[i]);a&&n(a,i,e)}}else e.forEach(n)}var vR={},rw={},iw=34,Td=10,aw=13;function mR(e){return new Function("d","return {"+e.map(function(t,n){return JSON.stringify(t)+": d["+n+'] || ""'}).join(",")+"}")}function kX(e,t){var n=mR(e);return function(r,i){return t(n(r),i,e)}}function yR(e){var t=Object.create(null),n=[];return e.forEach(function(r){for(var i in r)i in t||n.push(t[i]=i)}),n}function Nr(e,t){var n=e+"",r=n.length;return r<t?new Array(t-r+1).join(0)+n:n}function _X(e){return e<0?"-"+Nr(-e,6):e>9999?"+"+Nr(e,6):Nr(e,4)}function AX(e){var t=e.getUTCHours(),n=e.getUTCMinutes(),r=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":_X(e.getUTCFullYear())+"-"+Nr(e.getUTCMonth()+1,2)+"-"+Nr(e.getUTCDate(),2)+(i?"T"+Nr(t,2)+":"+Nr(n,2)+":"+Nr(r,2)+"."+Nr(i,3)+"Z":r?"T"+Nr(t,2)+":"+Nr(n,2)+":"+Nr(r,2)+"Z":n||t?"T"+Nr(t,2)+":"+Nr(n,2)+"Z":"")}function TX(e){var t=new RegExp('["'+e+`
\r]`),n=e.charCodeAt(0);function r(f,d){var h,g,p=i(f,function(v,m){if(h)return h(v,m-1);g=v,h=d?kX(v,d):mR(v)});return p.columns=g||[],p}function i(f,d){var h=[],g=f.length,p=0,v=0,m,y=g<=0,b=!1;f.charCodeAt(g-1)===Td&&--g,f.charCodeAt(g-1)===aw&&--g;function w(){if(y)return rw;if(b)return b=!1,vR;var F,x=p,C;if(f.charCodeAt(x)===iw){for(;p++<g&&f.charCodeAt(p)!==iw||f.charCodeAt(++p)===iw;);return(F=p)>=g?y=!0:(C=f.charCodeAt(p++))===Td?b=!0:C===aw&&(b=!0,f.charCodeAt(p)===Td&&++p),f.slice(x+1,F-1).replace(/""/g,'"')}for(;p<g;){if((C=f.charCodeAt(F=p++))===Td)b=!0;else if(C===aw)b=!0,f.charCodeAt(p)===Td&&++p;else if(C!==n)continue;return f.slice(x,F)}return y=!0,f.slice(x,g)}for(;(m=w())!==rw;){for(var E=[];m!==vR&&m!==rw;)E.push(m),m=w();d&&(E=d(E,v++))==null||h.push(E)}return h}function a(f,d){return f.map(function(h){return d.map(function(g){return c(h[g])}).join(e)})}function s(f,d){return d==null&&(d=yR(f)),[d.map(c).join(e)].concat(a(f,d)).join(`
`)}function o(f,d){return d==null&&(d=yR(f)),a(f,d).join(`
`)}function u(f){return f.map(l).join(`
`)}function l(f){return f.map(c).join(e)}function c(f){return f==null?"":f instanceof Date?AX(f):t.test(f+="")?'"'+f.replace(/"/g,'""')+'"':f}return{parse:r,parseRows:i,format:s,formatBody:o,formatRows:u,formatRow:l,formatValue:c}}function MX(e){return e}function $X(e){if(e==null)return MX;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],s=e.translate[1];return function(o,u){u||(t=n=0);var l=2,c=o.length,f=new Array(c);for(f[0]=(t+=o[0])*r+a,f[1]=(n+=o[1])*i+s;l<c;)f[l]=o[l],++l;return f}}function DX(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function RX(e,t){return typeof t=="string"&&(t=e.objects[t]),t.type==="GeometryCollection"?{type:"FeatureCollection",features:t.geometries.map(function(n){return bR(e,n)})}:bR(e,t)}function bR(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=wR(e,t);return n==null&&r==null?{type:"Feature",properties:i,geometry:a}:r==null?{type:"Feature",id:n,properties:i,geometry:a}:{type:"Feature",id:n,bbox:r,properties:i,geometry:a}}function wR(e,t){var n=$X(e.transform),r=e.arcs;function i(c,f){f.length&&f.pop();for(var d=r[c<0?~c:c],h=0,g=d.length;h<g;++h)f.push(n(d[h],h));c<0&&DX(f,g)}function a(c){return n(c)}function s(c){for(var f=[],d=0,h=c.length;d<h;++d)i(c[d],f);return f.length<2&&f.push(f[0]),f}function o(c){for(var f=s(c);f.length<4;)f.push(f[0]);return f}function u(c){return c.map(o)}function l(c){var f=c.type,d;switch(f){case"GeometryCollection":return{type:f,geometries:c.geometries.map(l)};case"Point":d=a(c.coordinates);break;case"MultiPoint":d=c.coordinates.map(a);break;case"LineString":d=s(c.arcs);break;case"MultiLineString":d=c.arcs.map(s);break;case"Polygon":d=u(c.arcs);break;case"MultiPolygon":d=c.arcs.map(u);break;default:return null}return{type:f,coordinates:d}}return l(t)}function PX(e,t){var n={},r={},i={},a=[],s=-1;t.forEach(function(l,c){var f=e.arcs[l<0?~l:l],d;f.length<3&&!f[1][0]&&!f[1][1]&&(d=t[++s],t[s]=l,t[c]=d)}),t.forEach(function(l){var c=o(l),f=c[0],d=c[1],h,g;if(h=i[f])if(delete i[h.end],h.push(l),h.end=d,g=r[d]){delete r[g.start];var p=g===h?h:h.concat(g);r[p.start=h.start]=i[p.end=g.end]=p}else r[h.start]=i[h.end]=h;else if(h=r[d])if(delete r[h.start],h.unshift(l),h.start=f,g=i[f]){delete i[g.end];var v=g===h?h:g.concat(h);r[v.start=g.start]=i[v.end=h.end]=v}else r[h.start]=i[h.end]=h;else h=[l],r[h.start=f]=i[h.end=d]=h});function o(l){var c=e.arcs[l<0?~l:l],f=c[0],d;return e.transform?(d=[0,0],c.forEach(function(h){d[0]+=h[0],d[1]+=h[1]})):d=c[c.length-1],l<0?[d,f]:[f,d]}function u(l,c){for(var f in l){var d=l[f];delete c[d.start],delete d.start,delete d.end,d.forEach(function(h){n[h<0?~h:h]=1}),a.push(d)}}return u(i,r),u(r,i),t.forEach(function(l){n[l<0?~l:l]||a.push([l])}),a}function NX(e){return wR(e,OX.apply(this,arguments))}function OX(e,t,n){var r,i,a;if(arguments.length>1)r=IX(e,t,n);else for(i=0,r=new Array(a=e.arcs.length);i<a;++i)r[i]=i;return{type:"MultiLineString",arcs:PX(e,r)}}function IX(e,t,n){var r=[],i=[],a;function s(f){var d=f<0?~f:f;(i[d]||(i[d]=[])).push({i:f,g:a})}function o(f){f.forEach(s)}function u(f){f.forEach(o)}function l(f){f.forEach(u)}function c(f){switch(a=f,f.type){case"GeometryCollection":f.geometries.forEach(c);break;case"LineString":o(f.arcs);break;case"MultiLineString":case"Polygon":u(f.arcs);break;case"MultiPolygon":l(f.arcs);break}}return c(t),i.forEach(n==null?function(f){r.push(f[0].i)}:function(f){n(f[0].g,f[f.length-1].g)&&r.push(f[0].i)}),r}function ps(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function BX(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function yc(e){let t,n,r;e.length!==2?(t=ps,n=(o,u)=>ps(e(o),u),r=(o,u)=>e(o)-u):(t=e===ps||e===BX?e:LX,n=e,r=e);function i(o,u,l=0,c=o.length){if(l<c){if(t(u,u)!==0)return c;do{const f=l+c>>>1;n(o[f],u)<0?l=f+1:c=f}while(l<c)}return l}function a(o,u,l=0,c=o.length){if(l<c){if(t(u,u)!==0)return c;do{const f=l+c>>>1;n(o[f],u)<=0?l=f+1:c=f}while(l<c)}return l}function s(o,u,l=0,c=o.length){const f=i(o,u,l,c-1);return f>l&&r(o[f-1],u)>-r(o[f],u)?f-1:f}return{left:i,center:s,right:a}}function LX(){return 0}function xR(e){return e===null?NaN:+e}function*zX(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}const ER=yc(ps),u0=ER.right,qX=ER.left;yc(xR).center;const Md=u0;function UX(e,t){let n=0,r,i=0,a=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,a+=r*(s-i));else{let s=-1;for(let o of e)(o=t(o,++s,e))!=null&&(o=+o)>=o&&(r=o-i,i+=r/++n,a+=r*(o-i))}if(n>1)return a/(n-1)}function VX(e,t){const n=UX(e,t);return n&&Math.sqrt(n)}class dr{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const n=this._partials;let r=0;for(let i=0;i<this._n&&i<32;i++){const a=n[i],s=t+a,o=Math.abs(t)<Math.abs(a)?t-(s-a):a-(s-t);o&&(n[r++]=o),t=s}return n[r]=t,this._n=r+1,this}valueOf(){const t=this._partials;let n=this._n,r,i,a,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,a=i-(s-r),!a););n>0&&(a<0&&t[n-1]<0||a>0&&t[n-1]>0)&&(i=a*2,r=s+i,i==r-s&&(s=r))}return s}}class FR extends Map{constructor(t,n=kR){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(sw(this,t))}has(t){return super.has(sw(this,t))}set(t,n){return super.set(SR(this,t),n)}delete(t){return super.delete(CR(this,t))}}class l0 extends Set{constructor(t,n=kR){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const r of t)this.add(r)}has(t){return super.has(sw(this,t))}add(t){return super.add(SR(this,t))}delete(t){return super.delete(CR(this,t))}}function sw({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function SR({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function CR({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function kR(e){return e!==null&&typeof e=="object"?e.valueOf():e}function WX(e,t){return Array.from(t,n=>e[n])}function HX(e=ps){if(e===ps)return _R;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function _R(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const jX=Math.sqrt(50),GX=Math.sqrt(10),YX=Math.sqrt(2);function c0(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/Math.pow(10,i),s=a>=jX?10:a>=GX?5:a>=YX?2:1;let o,u,l;return i<0?(l=Math.pow(10,-i)/s,o=Math.round(e*l),u=Math.round(t*l),o/l<e&&++o,u/l>t&&--u,l=-l):(l=Math.pow(10,i)*s,o=Math.round(e/l),u=Math.round(t/l),o*l<e&&++o,u*l>t&&--u),u<o&&.5<=n&&n<2?c0(e,t,n*2):[o,u,l]}function ow(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];const r=t<e,[i,a,s]=r?c0(t,e,n):c0(e,t,n);if(!(a>=i))return[];const o=a-i+1,u=new Array(o);if(r)if(s<0)for(let l=0;l<o;++l)u[l]=(a-l)/-s;else for(let l=0;l<o;++l)u[l]=(a-l)*s;else if(s<0)for(let l=0;l<o;++l)u[l]=(i+l)/-s;else for(let l=0;l<o;++l)u[l]=(i+l)*s;return u}function uw(e,t,n){return t=+t,e=+e,n=+n,c0(e,t,n)[2]}function xo(e,t,n){t=+t,e=+e,n=+n;const r=t<e,i=r?uw(t,e,n):uw(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Mu(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function lw(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function AR(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?_R:HX(i);r>n;){if(r-n>600){const u=r-n+1,l=t-n+1,c=Math.log(u),f=.5*Math.exp(2*c/3),d=.5*Math.sqrt(c*f*(u-f)/u)*(l-u/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/u+d)),g=Math.min(r,Math.floor(t+(u-l)*f/u+d));AR(e,t,h,g,i)}const a=e[t];let s=n,o=r;for($d(e,n,t),i(e[r],a)>0&&$d(e,n,r);s<o;){for($d(e,s,o),++s,--o;i(e[s],a)<0;)++s;for(;i(e[o],a)>0;)--o}i(e[n],a)===0?$d(e,n,o):(++o,$d(e,o,r)),o<=t&&(n=o+1),t<=o&&(r=o-1)}return e}function $d(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function cw(e,t,n){if(e=Float64Array.from(zX(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return lw(e);if(t>=1)return Mu(e);var r,i=(r-1)*t,a=Math.floor(i),s=Mu(AR(e,a).subarray(0,a+1)),o=lw(e.subarray(a+1));return s+(o-s)*(i-a)}}function TR(e,t,n=xR){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),s=+n(e[a],a,e),o=+n(e[a+1],a+1,e);return s+(o-s)*(i-a)}}function XX(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(a=+a)>=a&&(++n,r+=a)}if(n)return r/n}function MR(e,t){return cw(e,.5,t)}function*KX(e){for(const t of e)yield*t}function $R(e){return Array.from(KX(e))}function Kr(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=new Array(i);++r<i;)a[r]=e+r*n;return a}function DR(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function ZX(e,...t){e=new l0(e),t=t.map(QX);e:for(const n of e)for(const r of t)if(!r.has(n)){e.delete(n);continue e}return e}function QX(e){return e instanceof l0?e:new l0(e)}function JX(...e){const t=new l0;for(const n of e)for(const r of n)t.add(r);return t}function eK(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function f0(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function bc(e){return e=f0(Math.abs(e)),e?e[1]:NaN}function tK(e,t){return function(n,r){for(var i=n.length,a=[],s=0,o=e[0],u=0;i>0&&o>0&&(u+o+1>r&&(o=Math.max(1,r-u)),a.push(n.substring(i-=o,i+o)),!((u+=o+1)>r));)o=e[s=(s+1)%e.length];return a.reverse().join(t)}}function nK(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var rK=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function $u(e){if(!(t=rK.exec(e)))throw new Error("invalid format: "+e);var t;return new fw({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}$u.prototype=fw.prototype;function fw(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}fw.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function iK(e){e:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break e;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var RR;function aK(e,t){var n=f0(e,t);if(!n)return e+"";var r=n[0],i=n[1],a=i-(RR=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return a===s?r:a>s?r+new Array(a-s+1).join("0"):a>0?r.slice(0,a)+"."+r.slice(a):"0."+new Array(1-a).join("0")+f0(e,Math.max(0,t+a-1))[0]}function PR(e,t){var n=f0(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const NR={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:eK,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>PR(e*100,t),r:PR,s:aK,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function OR(e){return e}var IR=Array.prototype.map,BR=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function LR(e){var t=e.grouping===void 0||e.thousands===void 0?OR:tK(IR.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",a=e.numerals===void 0?OR:nK(IR.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",o=e.minus===void 0?"−":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function l(f){f=$u(f);var d=f.fill,h=f.align,g=f.sign,p=f.symbol,v=f.zero,m=f.width,y=f.comma,b=f.precision,w=f.trim,E=f.type;E==="n"?(y=!0,E="g"):NR[E]||(b===void 0&&(b=12),w=!0,E="g"),(v||d==="0"&&h==="=")&&(v=!0,d="0",h="=");var F=p==="$"?n:p==="#"&&/[boxX]/.test(E)?"0"+E.toLowerCase():"",x=p==="$"?r:/[%p]/.test(E)?s:"",C=NR[E],S=/[defgprs%]/.test(E);b=b===void 0?6:/[gprs]/.test(E)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function _(k){var T=F,A=x,$,M,D;if(E==="c")A=C(k)+A,k="";else{k=+k;var P=k<0||1/k<0;if(k=isNaN(k)?u:C(Math.abs(k),b),w&&(k=iK(k)),P&&+k==0&&g!=="+"&&(P=!1),T=(P?g==="("?g:o:g==="-"||g==="("?"":g)+T,A=(E==="s"?BR[8+RR/3]:"")+A+(P&&g==="("?")":""),S){for($=-1,M=k.length;++$<M;)if(D=k.charCodeAt($),48>D||D>57){A=(D===46?i+k.slice($+1):k.slice($))+A,k=k.slice(0,$);break}}}y&&!v&&(k=t(k,1/0));var N=T.length+k.length+A.length,O=N<m?new Array(m-N+1).join(d):"";switch(y&&v&&(k=t(O+k,O.length?m-A.length:1/0),O=""),h){case"<":k=T+k+A+O;break;case"=":k=T+O+k+A;break;case"^":k=O.slice(0,N=O.length>>1)+T+k+A+O.slice(N);break;default:k=O+T+k+A;break}return a(k)}return _.toString=function(){return f+""},_}function c(f,d){var h=l((f=$u(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(bc(d)/3)))*3,p=Math.pow(10,-g),v=BR[8+g/3];return function(m){return h(p*m)+v}}return{format:l,formatPrefix:c}}var d0,h0,dw;sK({thousands:",",grouping:[3],currency:["$",""]});function sK(e){return d0=LR(e),h0=d0.format,dw=d0.formatPrefix,d0}function zR(e){return Math.max(0,-bc(Math.abs(e)))}function qR(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bc(t)/3)))*3-bc(Math.abs(e)))}function UR(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bc(t)-bc(e))+1}const hw=new Date,gw=new Date;function on(e,t,n,r){function i(a){return e(a=arguments.length===0?new Date:new Date(+a)),a}return i.floor=a=>(e(a=new Date(+a)),a),i.ceil=a=>(e(a=new Date(a-1)),t(a,1),e(a),a),i.round=a=>{const s=i(a),o=i.ceil(a);return a-s<o-a?s:o},i.offset=(a,s)=>(t(a=new Date(+a),s==null?1:Math.floor(s)),a),i.range=(a,s,o)=>{const u=[];if(a=i.ceil(a),o=o==null?1:Math.floor(o),!(a<s)||!(o>0))return u;let l;do u.push(l=new Date(+a)),t(a,o),e(a);while(l<a&&a<s);return u},i.filter=a=>on(s=>{if(s>=s)for(;e(s),!a(s);)s.setTime(s-1)},(s,o)=>{if(s>=s)if(o<0)for(;++o<=0;)for(;t(s,-1),!a(s););else for(;--o>=0;)for(;t(s,1),!a(s););}),n&&(i.count=(a,s)=>(hw.setTime(+a),gw.setTime(+s),e(hw),e(gw),Math.floor(n(hw,gw))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(r?s=>r(s)%a===0:s=>i.count(0,s)%a===0):i)),i}const wc=on(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);wc.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?on(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):wc),wc.range;const vs=1e3,di=vs*60,ms=di*60,ys=ms*24,pw=ys*7,VR=ys*30,vw=ys*365,bs=on(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*vs)},(e,t)=>(t-e)/vs,e=>e.getUTCSeconds());bs.range;const g0=on(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*vs)},(e,t)=>{e.setTime(+e+t*di)},(e,t)=>(t-e)/di,e=>e.getMinutes());g0.range;const p0=on(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*di)},(e,t)=>(t-e)/di,e=>e.getUTCMinutes());p0.range;const v0=on(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*vs-e.getMinutes()*di)},(e,t)=>{e.setTime(+e+t*ms)},(e,t)=>(t-e)/ms,e=>e.getHours());v0.range;const m0=on(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ms)},(e,t)=>(t-e)/ms,e=>e.getUTCHours());m0.range;const ws=on(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*di)/ys,e=>e.getDate()-1);ws.range;const Eo=on(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ys,e=>e.getUTCDate()-1);Eo.range;const WR=on(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/ys,e=>Math.floor(e/ys));WR.range;function Du(e){return on(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*di)/pw)}const xc=Du(0),y0=Du(1),oK=Du(2),uK=Du(3),Ec=Du(4),lK=Du(5),cK=Du(6);xc.range,y0.range,oK.range,uK.range,Ec.range,lK.range,cK.range;function Ru(e){return on(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/pw)}const Fc=Ru(0),b0=Ru(1),fK=Ru(2),dK=Ru(3),Sc=Ru(4),hK=Ru(5),gK=Ru(6);Fc.range,b0.range,fK.range,dK.range,Sc.range,hK.range,gK.range;const Dd=on(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Dd.range;const Rd=on(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Rd.range;const xa=on(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());xa.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:on(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),xa.range;const Ea=on(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ea.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:on(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),Ea.range;function HR(e,t,n,r,i,a){const s=[[bs,1,vs],[bs,5,5*vs],[bs,15,15*vs],[bs,30,30*vs],[a,1,di],[a,5,5*di],[a,15,15*di],[a,30,30*di],[i,1,ms],[i,3,3*ms],[i,6,6*ms],[i,12,12*ms],[r,1,ys],[r,2,2*ys],[n,1,pw],[t,1,VR],[t,3,3*VR],[e,1,vw]];function o(l,c,f){const d=c<l;d&&([l,c]=[c,l]);const h=f&&typeof f.range=="function"?f:u(l,c,f),g=h?h.range(l,+c+1):[];return d?g.reverse():g}function u(l,c,f){const d=Math.abs(c-l)/f,h=yc(([,,v])=>v).right(s,d);if(h===s.length)return e.every(xo(l/vw,c/vw,f));if(h===0)return wc.every(Math.max(xo(l,c,f),1));const[g,p]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return g.every(p)}return[o,u]}const[pK,vK]=HR(Ea,Rd,Fc,WR,m0,p0),[mK,yK]=HR(xa,Dd,xc,ws,v0,g0),Kn="year",Zr="quarter",hr="month",bn="week",Qr="date",gr="day",xs="dayofyear",hi="hours",gi="minutes",Ii="seconds",Fa="milliseconds",jR=[Kn,Zr,hr,bn,Qr,gr,xs,hi,gi,Ii,Fa],mw=jR.reduce((e,t,n)=>(e[t]=1+n,e),{});function GR(e){const t=be(e).slice(),n={};return t.length||Q("Missing time unit."),t.forEach(i=>{xe(mw,i)?n[i]=1:Q(`Invalid time unit: ${i}.`)}),(n[bn]||n[gr]?1:0)+(n[Zr]||n[hr]||n[Qr]?1:0)+(n[xs]?1:0)>1&&Q(`Incompatible time units: ${e}`),t.sort((i,a)=>mw[i]-mw[a]),t}const bK={[Kn]:"%Y ",[Zr]:"Q%q ",[hr]:"%b ",[Qr]:"%d ",[bn]:"W%U ",[gr]:"%a ",[xs]:"%j ",[hi]:"%H:00",[gi]:"00:%M",[Ii]:":%S",[Fa]:".%L",[`${Kn}-${hr}`]:"%Y-%m ",[`${Kn}-${hr}-${Qr}`]:"%Y-%m-%d ",[`${hi}-${gi}`]:"%H:%M"};function wK(e,t){const n=Ze({},bK,t),r=GR(e),i=r.length;let a="",s=0,o,u;for(s=0;s<i;)for(o=r.length;o>s;--o)if(u=r.slice(s,o).join("-"),n[u]!=null){a+=n[u],s=o;break}return a.trim()}const Pu=new Date;function yw(e){return Pu.setFullYear(e),Pu.setMonth(0),Pu.setDate(1),Pu.setHours(0,0,0,0),Pu}function xK(e){return YR(new Date(e))}function EK(e){return bw(new Date(e))}function YR(e){return ws.count(yw(e.getFullYear())-1,e)}function bw(e){return xc.count(yw(e.getFullYear())-1,e)}function ww(e){return yw(e).getDay()}function FK(e,t,n,r,i,a,s){if(0<=e&&e<100){const o=new Date(-1,t,n,r,i,a,s);return o.setFullYear(e),o}return new Date(e,t,n,r,i,a,s)}function SK(e){return XR(new Date(e))}function CK(e){return xw(new Date(e))}function XR(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Eo.count(t-1,e)}function xw(e){const t=Date.UTC(e.getUTCFullYear(),0,1);return Fc.count(t-1,e)}function Ew(e){return Pu.setTime(Date.UTC(e,0,1)),Pu.getUTCDay()}function kK(e,t,n,r,i,a,s){if(0<=e&&e<100){const o=new Date(Date.UTC(-1,t,n,r,i,a,s));return o.setUTCFullYear(n.y),o}return new Date(Date.UTC(e,t,n,r,i,a,s))}function KR(e,t,n,r,i){const a=t||1,s=st(e),o=(m,y,b)=>(b=b||m,_K(n[b],r[b],m===s&&a,y)),u=new Date,l=wa(e),c=l[Kn]?o(Kn):fr(2012),f=l[hr]?o(hr):l[Zr]?o(Zr):ku,d=l[bn]&&l[gr]?o(gr,1,bn+gr):l[bn]?o(bn,1):l[gr]?o(gr,1):l[Qr]?o(Qr,1):l[xs]?o(xs,1):kd,h=l[hi]?o(hi):ku,g=l[gi]?o(gi):ku,p=l[Ii]?o(Ii):ku,v=l[Fa]?o(Fa):ku;return function(m){u.setTime(+m);const y=c(u);return i(y,f(u),d(u,y),h(u),g(u),p(u),v(u))}}function _K(e,t,n,r){const i=n<=1?e:r?(a,s)=>r+n*Math.floor((e(a,s)-r)/n):(a,s)=>n*Math.floor(e(a,s)/n);return t?(a,s)=>t(i(a,s),s):i}function Cc(e,t,n){return t+e*7-(n+6)%7}const AK={[Kn]:e=>e.getFullYear(),[Zr]:e=>Math.floor(e.getMonth()/3),[hr]:e=>e.getMonth(),[Qr]:e=>e.getDate(),[hi]:e=>e.getHours(),[gi]:e=>e.getMinutes(),[Ii]:e=>e.getSeconds(),[Fa]:e=>e.getMilliseconds(),[xs]:e=>YR(e),[bn]:e=>bw(e),[bn+gr]:(e,t)=>Cc(bw(e),e.getDay(),ww(t)),[gr]:(e,t)=>Cc(1,e.getDay(),ww(t))},TK={[Zr]:e=>3*e,[bn]:(e,t)=>Cc(e,0,ww(t))};function MK(e,t){return KR(e,t||1,AK,TK,FK)}const $K={[Kn]:e=>e.getUTCFullYear(),[Zr]:e=>Math.floor(e.getUTCMonth()/3),[hr]:e=>e.getUTCMonth(),[Qr]:e=>e.getUTCDate(),[hi]:e=>e.getUTCHours(),[gi]:e=>e.getUTCMinutes(),[Ii]:e=>e.getUTCSeconds(),[Fa]:e=>e.getUTCMilliseconds(),[xs]:e=>XR(e),[bn]:e=>xw(e),[gr]:(e,t)=>Cc(1,e.getUTCDay(),Ew(t)),[bn+gr]:(e,t)=>Cc(xw(e),e.getUTCDay(),Ew(t))},DK={[Zr]:e=>3*e,[bn]:(e,t)=>Cc(e,0,Ew(t))};function RK(e,t){return KR(e,t||1,$K,DK,kK)}const PK={[Kn]:xa,[Zr]:Dd.every(3),[hr]:Dd,[bn]:xc,[Qr]:ws,[gr]:ws,[xs]:ws,[hi]:v0,[gi]:g0,[Ii]:bs,[Fa]:wc},NK={[Kn]:Ea,[Zr]:Rd.every(3),[hr]:Rd,[bn]:Fc,[Qr]:Eo,[gr]:Eo,[xs]:Eo,[hi]:m0,[gi]:p0,[Ii]:bs,[Fa]:wc};function Pd(e){return PK[e]}function Nd(e){return NK[e]}function ZR(e,t,n){return e?e.offset(t,n):void 0}function OK(e,t,n){return ZR(Pd(e),t,n)}function IK(e,t,n){return ZR(Nd(e),t,n)}function QR(e,t,n,r){return e?e.range(t,n,r):void 0}function BK(e,t,n,r){return QR(Pd(e),t,n,r)}function LK(e,t,n,r){return QR(Nd(e),t,n,r)}const Od=1e3,Id=Od*60,Bd=Id*60,w0=Bd*24,zK=w0*7,JR=w0*30,Fw=w0*365,e3=[Kn,hr,Qr,hi,gi,Ii,Fa],Ld=e3.slice(0,-1),zd=Ld.slice(0,-1),qd=zd.slice(0,-1),qK=qd.slice(0,-1),UK=[Kn,bn],t3=[Kn,hr],n3=[Kn],Ud=[[Ld,1,Od],[Ld,5,5*Od],[Ld,15,15*Od],[Ld,30,30*Od],[zd,1,Id],[zd,5,5*Id],[zd,15,15*Id],[zd,30,30*Id],[qd,1,Bd],[qd,3,3*Bd],[qd,6,6*Bd],[qd,12,12*Bd],[qK,1,w0],[UK,1,zK],[t3,1,JR],[t3,3,3*JR],[n3,1,Fw]];function VK(e){const t=e.extent,n=e.maxbins||40,r=Math.abs(o0(t))/n;let i=yc(o=>o[2]).right(Ud,r),a,s;return i===Ud.length?(a=n3,s=xo(t[0]/Fw,t[1]/Fw,n)):i?(i=Ud[r/Ud[i-1][2]<Ud[i][2]/r?i-1:i],a=i[0],s=i[1]):(a=e3,s=Math.max(xo(t[0],t[1],n),1)),{units:a,step:s}}function Sw(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Cw(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function Vd(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function r3(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,a=e.days,s=e.shortDays,o=e.months,u=e.shortMonths,l=Wd(i),c=Hd(i),f=Wd(a),d=Hd(a),h=Wd(s),g=Hd(s),p=Wd(o),v=Hd(o),m=Wd(u),y=Hd(u),b={a:P,A:N,b:O,B:q,c:null,d:l3,e:l3,f:dZ,g:EZ,G:SZ,H:lZ,I:cZ,j:fZ,L:c3,m:hZ,M:gZ,p:z,q:W,Q:v3,s:m3,S:pZ,u:vZ,U:mZ,V:yZ,w:bZ,W:wZ,x:null,X:null,y:xZ,Y:FZ,Z:CZ,"%":p3},w={a:Y,A:J,b:X,B:te,c:null,d:d3,e:d3,f:TZ,g:LZ,G:qZ,H:kZ,I:_Z,j:AZ,L:h3,m:MZ,M:$Z,p:ie,q:se,Q:v3,s:m3,S:DZ,u:RZ,U:PZ,V:NZ,w:OZ,W:IZ,x:null,X:null,y:BZ,Y:zZ,Z:UZ,"%":p3},E={a:_,A:k,b:T,B:A,c:$,d:o3,e:o3,f:aZ,g:s3,G:a3,H:u3,I:u3,j:tZ,L:iZ,m:eZ,M:nZ,p:S,q:JK,Q:oZ,s:uZ,S:rZ,u:YK,U:XK,V:KK,w:GK,W:ZK,x:M,X:D,y:s3,Y:a3,Z:QK,"%":sZ};b.x=F(n,b),b.X=F(r,b),b.c=F(t,b),w.x=F(n,w),w.X=F(r,w),w.c=F(t,w);function F(B,I){return function(U){var L=[],ae=-1,de=0,Ce=B.length,Ye,Qe,Fe;for(U instanceof Date||(U=new Date(+U));++ae<Ce;)B.charCodeAt(ae)===37&&(L.push(B.slice(de,ae)),(Qe=i3[Ye=B.charAt(++ae)])!=null?Ye=B.charAt(++ae):Qe=Ye==="e"?" ":"0",(Fe=I[Ye])&&(Ye=Fe(U,Qe)),L.push(Ye),de=ae+1);return L.push(B.slice(de,ae)),L.join("")}}function x(B,I){return function(U){var L=Vd(1900,void 0,1),ae=C(L,B,U+="",0),de,Ce;if(ae!=U.length)return null;if("Q"in L)return new Date(L.Q);if("s"in L)return new Date(L.s*1e3+("L"in L?L.L:0));if(I&&!("Z"in L)&&(L.Z=0),"p"in L&&(L.H=L.H%12+L.p*12),L.m===void 0&&(L.m="q"in L?L.q:0),"V"in L){if(L.V<1||L.V>53)return null;"w"in L||(L.w=1),"Z"in L?(de=Cw(Vd(L.y,0,1)),Ce=de.getUTCDay(),de=Ce>4||Ce===0?b0.ceil(de):b0(de),de=Eo.offset(de,(L.V-1)*7),L.y=de.getUTCFullYear(),L.m=de.getUTCMonth(),L.d=de.getUTCDate()+(L.w+6)%7):(de=Sw(Vd(L.y,0,1)),Ce=de.getDay(),de=Ce>4||Ce===0?y0.ceil(de):y0(de),de=ws.offset(de,(L.V-1)*7),L.y=de.getFullYear(),L.m=de.getMonth(),L.d=de.getDate()+(L.w+6)%7)}else("W"in L||"U"in L)&&("w"in L||(L.w="u"in L?L.u%7:"W"in L?1:0),Ce="Z"in L?Cw(Vd(L.y,0,1)).getUTCDay():Sw(Vd(L.y,0,1)).getDay(),L.m=0,L.d="W"in L?(L.w+6)%7+L.W*7-(Ce+5)%7:L.w+L.U*7-(Ce+6)%7);return"Z"in L?(L.H+=L.Z/100|0,L.M+=L.Z%100,Cw(L)):Sw(L)}}function C(B,I,U,L){for(var ae=0,de=I.length,Ce=U.length,Ye,Qe;ae<de;){if(L>=Ce)return-1;if(Ye=I.charCodeAt(ae++),Ye===37){if(Ye=I.charAt(ae++),Qe=E[Ye in i3?I.charAt(ae++):Ye],!Qe||(L=Qe(B,U,L))<0)return-1}else if(Ye!=U.charCodeAt(L++))return-1}return L}function S(B,I,U){var L=l.exec(I.slice(U));return L?(B.p=c.get(L[0].toLowerCase()),U+L[0].length):-1}function _(B,I,U){var L=h.exec(I.slice(U));return L?(B.w=g.get(L[0].toLowerCase()),U+L[0].length):-1}function k(B,I,U){var L=f.exec(I.slice(U));return L?(B.w=d.get(L[0].toLowerCase()),U+L[0].length):-1}function T(B,I,U){var L=m.exec(I.slice(U));return L?(B.m=y.get(L[0].toLowerCase()),U+L[0].length):-1}function A(B,I,U){var L=p.exec(I.slice(U));return L?(B.m=v.get(L[0].toLowerCase()),U+L[0].length):-1}function $(B,I,U){return C(B,t,I,U)}function M(B,I,U){return C(B,n,I,U)}function D(B,I,U){return C(B,r,I,U)}function P(B){return s[B.getDay()]}function N(B){return a[B.getDay()]}function O(B){return u[B.getMonth()]}function q(B){return o[B.getMonth()]}function z(B){return i[+(B.getHours()>=12)]}function W(B){return 1+~~(B.getMonth()/3)}function Y(B){return s[B.getUTCDay()]}function J(B){return a[B.getUTCDay()]}function X(B){return u[B.getUTCMonth()]}function te(B){return o[B.getUTCMonth()]}function ie(B){return i[+(B.getUTCHours()>=12)]}function se(B){return 1+~~(B.getUTCMonth()/3)}return{format:function(B){var I=F(B+="",b);return I.toString=function(){return B},I},parse:function(B){var I=x(B+="",!1);return I.toString=function(){return B},I},utcFormat:function(B){var I=F(B+="",w);return I.toString=function(){return B},I},utcParse:function(B){var I=x(B+="",!0);return I.toString=function(){return B},I}}}var i3={"-":"",_:" ",0:"0"},wn=/^\s*\d+/,WK=/^%/,HK=/[\\^$*+?|[\]().{}]/g;function ft(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",a=i.length;return r+(a<n?new Array(n-a+1).join(t)+i:i)}function jK(e){return e.replace(HK,"\\$&")}function Wd(e){return new RegExp("^(?:"+e.map(jK).join("|")+")","i")}function Hd(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function GK(e,t,n){var r=wn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function YK(e,t,n){var r=wn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function XK(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function KK(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function ZK(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function a3(e,t,n){var r=wn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function s3(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function QK(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function JK(e,t,n){var r=wn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function eZ(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function o3(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function tZ(e,t,n){var r=wn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function u3(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function nZ(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function rZ(e,t,n){var r=wn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function iZ(e,t,n){var r=wn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function aZ(e,t,n){var r=wn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function sZ(e,t,n){var r=WK.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function oZ(e,t,n){var r=wn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function uZ(e,t,n){var r=wn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function l3(e,t){return ft(e.getDate(),t,2)}function lZ(e,t){return ft(e.getHours(),t,2)}function cZ(e,t){return ft(e.getHours()%12||12,t,2)}function fZ(e,t){return ft(1+ws.count(xa(e),e),t,3)}function c3(e,t){return ft(e.getMilliseconds(),t,3)}function dZ(e,t){return c3(e,t)+"000"}function hZ(e,t){return ft(e.getMonth()+1,t,2)}function gZ(e,t){return ft(e.getMinutes(),t,2)}function pZ(e,t){return ft(e.getSeconds(),t,2)}function vZ(e){var t=e.getDay();return t===0?7:t}function mZ(e,t){return ft(xc.count(xa(e)-1,e),t,2)}function f3(e){var t=e.getDay();return t>=4||t===0?Ec(e):Ec.ceil(e)}function yZ(e,t){return e=f3(e),ft(Ec.count(xa(e),e)+(xa(e).getDay()===4),t,2)}function bZ(e){return e.getDay()}function wZ(e,t){return ft(y0.count(xa(e)-1,e),t,2)}function xZ(e,t){return ft(e.getFullYear()%100,t,2)}function EZ(e,t){return e=f3(e),ft(e.getFullYear()%100,t,2)}function FZ(e,t){return ft(e.getFullYear()%1e4,t,4)}function SZ(e,t){var n=e.getDay();return e=n>=4||n===0?Ec(e):Ec.ceil(e),ft(e.getFullYear()%1e4,t,4)}function CZ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+ft(t/60|0,"0",2)+ft(t%60,"0",2)}function d3(e,t){return ft(e.getUTCDate(),t,2)}function kZ(e,t){return ft(e.getUTCHours(),t,2)}function _Z(e,t){return ft(e.getUTCHours()%12||12,t,2)}function AZ(e,t){return ft(1+Eo.count(Ea(e),e),t,3)}function h3(e,t){return ft(e.getUTCMilliseconds(),t,3)}function TZ(e,t){return h3(e,t)+"000"}function MZ(e,t){return ft(e.getUTCMonth()+1,t,2)}function $Z(e,t){return ft(e.getUTCMinutes(),t,2)}function DZ(e,t){return ft(e.getUTCSeconds(),t,2)}function RZ(e){var t=e.getUTCDay();return t===0?7:t}function PZ(e,t){return ft(Fc.count(Ea(e)-1,e),t,2)}function g3(e){var t=e.getUTCDay();return t>=4||t===0?Sc(e):Sc.ceil(e)}function NZ(e,t){return e=g3(e),ft(Sc.count(Ea(e),e)+(Ea(e).getUTCDay()===4),t,2)}function OZ(e){return e.getUTCDay()}function IZ(e,t){return ft(b0.count(Ea(e)-1,e),t,2)}function BZ(e,t){return ft(e.getUTCFullYear()%100,t,2)}function LZ(e,t){return e=g3(e),ft(e.getUTCFullYear()%100,t,2)}function zZ(e,t){return ft(e.getUTCFullYear()%1e4,t,4)}function qZ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Sc(e):Sc.ceil(e),ft(e.getUTCFullYear()%1e4,t,4)}function UZ(){return"+0000"}function p3(){return"%"}function v3(e){return+e}function m3(e){return Math.floor(+e/1e3)}var kc,kw,y3,_w,b3;VZ({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function VZ(e){return kc=r3(e),kw=kc.format,y3=kc.parse,_w=kc.utcFormat,b3=kc.utcParse,kc}function jd(e){const t={};return n=>t[n]||(t[n]=e(n))}function WZ(e,t){return n=>{const r=e(n),i=r.indexOf(t);if(i<0)return r;let a=HZ(r,i);const s=a<r.length?r.slice(a):"";for(;--a>i;)if(r[a]!=="0"){++a;break}return r.slice(0,a)+s}}function HZ(e,t){let n=e.lastIndexOf("e"),r;if(n>0)return n;for(n=e.length;--n>t;)if(r=e.charCodeAt(n),r>=48&&r<=57)return n+1}function w3(e){const t=jd(e.format),n=e.formatPrefix;return{format:t,formatPrefix:n,formatFloat(r){const i=$u(r||",");if(i.precision==null){switch(i.precision=12,i.type){case"%":i.precision-=2;break;case"e":i.precision-=1;break}return WZ(t(i),t(".1f")(1)[1])}else return t(i)},formatSpan(r,i,a,s){s=$u(s??",f");const o=xo(r,i,a),u=Math.max(Math.abs(r),Math.abs(i));let l;if(s.precision==null)switch(s.type){case"s":return isNaN(l=qR(o,u))||(s.precision=l),n(s,u);case"":case"e":case"g":case"p":case"r":{isNaN(l=UR(o,u))||(s.precision=l-(s.type==="e"));break}case"f":case"%":{isNaN(l=zR(o))||(s.precision=l-(s.type==="%")*2);break}}return t(s)}}}let Aw;jZ();function jZ(){return Aw=w3({format:h0,formatPrefix:dw})}function x3(e){return w3(LR(e))}function Tw(e){return arguments.length?Aw=x3(e):Aw}function E3(e,t,n){n=n||{},we(n)||Q(`Invalid time multi-format specifier: ${n}`);const r=t(Ii),i=t(gi),a=t(hi),s=t(Qr),o=t(bn),u=t(hr),l=t(Zr),c=t(Kn),f=e(n[Fa]||".%L"),d=e(n[Ii]||":%S"),h=e(n[gi]||"%I:%M"),g=e(n[hi]||"%I %p"),p=e(n[Qr]||n[gr]||"%a %d"),v=e(n[bn]||"%b %d"),m=e(n[hr]||"%B"),y=e(n[Zr]||"%B"),b=e(n[Kn]||"%Y");return w=>(r(w)<w?f:i(w)<w?d:a(w)<w?h:s(w)<w?g:u(w)<w?o(w)<w?p:v:c(w)<w?l(w)<w?m:y:b)(w)}function F3(e){const t=jd(e.format),n=jd(e.utcFormat);return{timeFormat:r=>Ee(r)?t(r):E3(t,Pd,r),utcFormat:r=>Ee(r)?n(r):E3(n,Nd,r),timeParse:jd(e.parse),utcParse:jd(e.utcParse)}}let Mw;GZ();function GZ(){return Mw=F3({format:kw,parse:y3,utcFormat:_w,utcParse:b3})}function S3(e){return F3(r3(e))}function x0(e){return arguments.length?Mw=S3(e):Mw}const $w=(e,t)=>Ze({},e,t);function YZ(e,t){const n=e?x3(e):Tw(),r=t?S3(t):x0();return $w(n,r)}function XZ(e,t){const n=arguments.length;return n&&n!==2&&Q("defaultLocale expects either zero or two arguments."),n?$w(Tw(e),x0(t)):$w(Tw(),x0())}const KZ=/^(data:|([A-Za-z]+:)?\/\/)/,ZZ=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,QZ=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,C3="file://";function JZ(e,t){return n=>({options:n||{},sanitize:tQ,load:eQ,fileAccess:!1,file:nQ(),http:iQ(e)})}async function eQ(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function tQ(e,t){t=Ze({},this.options,t);const n=this.fileAccess,r={href:null};let i,a,s;const o=ZZ.test(e.replace(QZ,""));(e==null||typeof e!="string"||!o)&&Q("Sanitize failure, invalid URI: "+he(e));const u=KZ.test(e);return(s=t.baseURL)&&!u&&(!e.startsWith("/")&&!s.endsWith("/")&&(e="/"+e),e=s+e),a=(i=e.startsWith(C3))||t.mode==="file"||t.mode!=="http"&&!u&&n,i?e=e.slice(C3.length):e.startsWith("//")&&(t.defaultProtocol==="file"?(e=e.slice(2),a=!0):e=(t.defaultProtocol||"http")+":"+e),Object.defineProperty(r,"localFile",{value:!!a}),r.href=e,t.target&&(r.target=t.target+""),t.rel&&(r.rel=t.rel+""),t.context==="image"&&t.crossOrigin&&(r.crossOrigin=t.crossOrigin+""),r}function nQ(e){return rQ}async function rQ(){Q("No file system access.")}function iQ(e){return e?async function(t,n){const r=Ze({},this.options.http,n),i=n&&n.response,a=await e(t,r);return a.ok?Ke(a[i])?a[i]():a.text():Q(a.status+""+a.statusText)}:aQ}async function aQ(){Q("No HTTP fetch method available.")}const sQ=e=>e!=null&&e===e,oQ=e=>e==="true"||e==="false"||e===!0||e===!1,uQ=e=>!Number.isNaN(Date.parse(e)),k3=e=>!Number.isNaN(+e)&&!(e instanceof Date),lQ=e=>k3(e)&&Number.isInteger(+e),_3={boolean:hR,integer:cr,number:cr,date:gR,string:pR,unknown:lr},E0=[oQ,lQ,k3,uQ],cQ=["boolean","integer","number","date"];function fQ(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=E0.length,i=E0.map((a,s)=>s+1);for(let a=0,s=0,o,u;a<n;++a)for(u=t?e[a][t]:e[a],o=0;o<r;++o)if(i[o]&&sQ(u)&&!E0[o](u)&&(i[o]=0,++s,s===E0.length))return"string";return cQ[i.reduce((a,s)=>a===0?s:a,0)-1]}function dQ(e,t){return t.reduce((n,r)=>(n[r]=fQ(e,r),n),{})}function A3(e){const t=function(n,r){const i={delimiter:e};return Dw(n,r?Ze(r,i):i)};return t.responseType="text",t}function Dw(e,t){return t.header&&(e=t.header.map(he).join(t.delimiter)+`
`+e),TX(t.delimiter).parse(e+"")}Dw.responseType="text";function hQ(e){return typeof Buffer=="function"&&Ke(Buffer.isBuffer)?Buffer.isBuffer(e):!1}function Rw(e,t){const n=t&&t.property?Ni(t.property):lr;return we(e)&&!hQ(e)?gQ(n(e),t):n(JSON.parse(e))}Rw.responseType="json";function gQ(e,t){return!ee(e)&&yX(e)&&(e=[...e]),t&&t.copy?JSON.parse(JSON.stringify(e)):e}const pQ={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function T3(e,t){let n,r,i,a;return e=Rw(e,t),t&&t.feature?(n=RX,i=t.feature):t&&t.mesh?(n=NX,i=t.mesh,a=pQ[t.filter]):Q("Missing TopoJSON feature or mesh parameter."),r=(r=e.objects[i])?n(e,r,a):Q("Invalid TopoJSON object: "+i),r&&r.features||[r]}T3.responseType="json";const Pw={dsv:Dw,csv:A3(","),tsv:A3("	"),json:Rw,topojson:T3};function M3(e,t){return arguments.length>1?(Pw[e]=t,this):xe(Pw,e)?Pw[e]:null}function vQ(e){const t=M3(e);return t&&t.responseType||"text"}function mQ(e,t,n,r){t=t||{};const i=M3(t.type||"json");return i||Q("Unknown data format type: "+t.type),e=i(e,t),t.parse&&yQ(e,t.parse,n,r),xe(e,"columns")&&delete e.columns,e}function yQ(e,t,n,r){if(!e.length)return;const i=x0();n=n||i.timeParse,r=r||i.utcParse;let a=e.columns||Object.keys(e[0]),s,o,u,l,c,f;t==="auto"&&(t=dQ(e,a)),a=Object.keys(t);const d=a.map(h=>{const g=t[h];let p,v;if(g&&(g.startsWith("date:")||g.startsWith("utc:")))return p=g.split(/:(.+)?/,2),v=p[1],(v[0]==="'"&&v[v.length-1]==="'"||v[0]==='"'&&v[v.length-1]==='"')&&(v=v.slice(1,-1)),(p[0]==="utc"?r:n)(v);if(!_3[g])throw Error("Illegal format pattern: "+h+":"+g);return _3[g]});for(u=0,c=e.length,f=a.length;u<c;++u)for(s=e[u],l=0;l<f;++l)o=a[l],s[o]=d[l](s[o])}const Nw=JZ(typeof fetch<"u"&&fetch);function F0(e){const t=e||lr,n=[],r={};return n.add=i=>{const a=t(i);return r[a]||(r[a]=1,n.push(i)),n},n.remove=i=>{const a=t(i);if(r[a]){r[a]=0;const s=n.indexOf(i);s>=0&&n.splice(s,1)}return n},n}async function S0(e,t){try{await t(e)}catch(n){e.error(n)}}const $3=Symbol("vega_id");let bQ=1;function Ow(e){return!!(e&&Re(e))}function Re(e){return e[$3]}function D3(e,t){return e[$3]=t,e}function vt(e){const t=e===Object(e)?e:{data:e};return Re(t)?t:D3(t,bQ++)}function Iw(e){return C0(e,vt({}))}function C0(e,t){for(const n in e)t[n]=e[n];return t}function R3(e,t){return D3(t,Re(e))}function Nu(e,t){return e?t?(n,r)=>e(n,r)||Re(t(n))-Re(t(r)):(n,r)=>e(n,r)||Re(n)-Re(r):null}function P3(e){return e&&e.constructor===_c}function _c(){const e=[],t=[],n=[],r=[],i=[];let a=null,s=!1;return{constructor:_c,insert(o){const u=be(o),l=u.length;for(let c=0;c<l;++c)e.push(u[c]);return this},remove(o){const u=Ke(o)?r:t,l=be(o),c=l.length;for(let f=0;f<c;++f)u.push(l[f]);return this},modify(o,u,l){const c={field:u,value:fr(l)};return Ke(o)?(c.filter=o,i.push(c)):(c.tuple=o,n.push(c)),this},encode(o,u){return Ke(o)?i.push({filter:o,field:u}):n.push({tuple:o,field:u}),this},clean(o){return a=o,this},reflow(){return s=!0,this},pulse(o,u){const l={},c={};let f,d,h,g,p,v;for(f=0,d=u.length;f<d;++f)l[Re(u[f])]=1;for(f=0,d=t.length;f<d;++f)p=t[f],l[Re(p)]=-1;for(f=0,d=r.length;f<d;++f)g=r[f],u.forEach(y=>{g(y)&&(l[Re(y)]=-1)});for(f=0,d=e.length;f<d;++f)p=e[f],v=Re(p),l[v]?l[v]=1:o.add.push(vt(e[f]));for(f=0,d=u.length;f<d;++f)p=u[f],l[Re(p)]<0&&o.rem.push(p);function m(y,b,w){w?y[b]=w(y):o.encode=b,s||(c[Re(y)]=y)}for(f=0,d=n.length;f<d;++f)h=n[f],p=h.tuple,g=h.field,v=l[Re(p)],v>0&&(m(p,g,h.value),o.modifies(g));for(f=0,d=i.length;f<d;++f)h=i[f],g=h.filter,u.forEach(y=>{g(y)&&l[Re(y)]>0&&m(y,h.field,h.value)}),o.modifies(h.field);if(s)o.mod=t.length||r.length?u.filter(y=>l[Re(y)]>0):u.slice();else for(v in c)o.mod.push(c[v]);return(a||a==null&&(t.length||r.length))&&o.clean(!0),o}}}const k0="_:mod:_";function Bw(){Object.defineProperty(this,k0,{writable:!0,value:{}})}Bw.prototype={set(e,t,n,r){const i=this,a=i[e],s=i[k0];return t!=null&&t>=0?(a[t]!==n||r)&&(a[t]=n,s[t+":"+e]=-1,s[e]=-1):(a!==n||r)&&(i[e]=n,s[e]=ee(n)?1+n.length:-1),i},modified(e,t){const n=this[k0];if(arguments.length){if(ee(e)){for(let r=0;r<e.length;++r)if(n[e[r]])return!0;return!1}}else{for(const r in n)if(n[r])return!0;return!1}return t!=null&&t>=0?t+1<n[e]||!!n[t+":"+e]:!!n[e]},clear(){return this[k0]={},this}};let wQ=0;const xQ="pulse",EQ=new Bw,FQ=1,SQ=2;function Tt(e,t,n,r){this.id=++wQ,this.value=e,this.stamp=-1,this.rank=-1,this.qrank=-1,this.flags=0,t&&(this._update=t),n&&this.parameters(n,r)}function N3(e){return function(t){const n=this.flags;return arguments.length===0?!!(n&e):(this.flags=t?n|e:n&~e,this)}}Tt.prototype={targets(){return this._targets||(this._targets=F0(Jp))},set(e){return this.value!==e?(this.value=e,1):0},skip:N3(FQ),modified:N3(SQ),parameters(e,t,n){t=t!==!1;const r=this._argval=this._argval||new Bw,i=this._argops=this._argops||[],a=[];let s,o,u,l;const c=(f,d,h)=>{h instanceof Tt?(h!==this&&(t&&h.targets().add(this),a.push(h)),i.push({op:h,name:f,index:d})):r.set(f,d,h)};for(s in e)if(o=e[s],s===xQ)be(o).forEach(f=>{f instanceof Tt?f!==this&&(f.targets().add(this),a.push(f)):Q("Pulse parameters must be operator instances.")}),this.source=o;else if(ee(o))for(r.set(s,-1,Array(u=o.length)),l=0;l<u;++l)c(s,l,o[l]);else c(s,-1,o);return this.marshall().clear(),n&&(i.initonly=!0),a},marshall(e){const t=this._argval||EQ,n=this._argops;let r,i,a,s;if(n){const o=n.length;for(i=0;i<o;++i)r=n[i],a=r.op,s=a.modified()&&a.stamp===e,t.set(r.name,r.index,a.value,s);if(n.initonly){for(i=0;i<o;++i)r=n[i],r.op.targets().remove(this);this._argops=null,this._update=null}}return t},detach(){const e=this._argops;let t,n,r,i;if(e)for(t=0,n=e.length;t<n;++t)r=e[t],i=r.op,i._targets&&i._targets.remove(this);this.pulse=null,this.source=null},evaluate(e){const t=this._update;if(t){const n=this.marshall(e.stamp),r=t.call(this,n,e);if(n.clear(),r!==this.value)this.value=r;else if(!this.modified())return e.StopPropagation}},run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?(this.skip(!1),t=0):t=this.evaluate(e),this.pulse=t||e}};function CQ(e,t,n,r){let i=1,a;return e instanceof Tt?a=e:e&&e.prototype instanceof Tt?a=new e:Ke(e)?a=new Tt(null,e):(i=0,a=new Tt(e,t)),this.rank(a),i&&(r=n,n=t),n&&this.connect(a,a.parameters(n,r)),this.touch(a),a}function kQ(e,t){const n=e.rank,r=t.length;for(let i=0;i<r;++i)if(n<t[i].rank){this.rerank(e);return}}let _Q=0;function Lw(e,t,n){this.id=++_Q,this.value=null,n&&(this.receive=n),e&&(this._filter=e),t&&(this._apply=t)}function Fo(e,t,n){return new Lw(e,t,n)}Lw.prototype={_filter:Oi,_apply:lr,targets(){return this._targets||(this._targets=F0(Jp))},consume(e){return arguments.length?(this._consume=!!e,this):!!this._consume},receive(e){if(this._filter(e)){const t=this.value=this._apply(e),n=this._targets,r=n?n.length:0;for(let i=0;i<r;++i)n[i].receive(t);this._consume&&(e.preventDefault(),e.stopPropagation())}},filter(e){const t=Fo(e);return this.targets().add(t),t},apply(e){const t=Fo(null,e);return this.targets().add(t),t},merge(){const e=Fo();this.targets().add(e);for(let t=0,n=arguments.length;t<n;++t)arguments[t].targets().add(e);return e},throttle(e){let t=-1;return this.filter(()=>{const n=Date.now();return n-t>e?(t=n,1):0})},debounce(e){const t=Fo();return this.targets().add(Fo(null,null,cR(e,n=>{const r=n.dataflow;t.receive(n),r&&r.run&&r.run()}))),t},between(e,t){let n=!1;return e.targets().add(Fo(null,null,()=>n=!0)),t.targets().add(Fo(null,null,()=>n=!1)),this.filter(()=>n)},detach(){this._filter=Oi,this._targets=null}};function AQ(e,t,n,r){const i=this,a=Fo(n,r),s=function(l){l.dataflow=i;try{a.receive(l)}catch(c){i.error(c)}finally{i.run()}};let o;typeof e=="string"&&typeof document<"u"?o=document.querySelectorAll(e):o=be(e);const u=o.length;for(let l=0;l<u;++l)o[l].addEventListener(t,s);return a}function TQ(e,t){const n=this.locale();return mQ(e,t,n.timeParse,n.utcParse)}function MQ(e,t,n){return t=this.parse(t,n),this.pulse(e,this.changeset().insert(t))}async function $Q(e,t){const n=this;let r=0,i;try{i=await n.loader().load(e,{context:"dataflow",response:vQ(t&&t.type)});try{i=n.parse(i,t)}catch(a){r=-2,n.warn("Data ingestion failed",e,a)}}catch(a){r=-1,n.warn("Loading failed",e,a)}return{data:i,status:r}}async function DQ(e,t,n){const r=this,i=r._pending||RQ(r);i.requests+=1;const a=await r.request(t,n);return r.pulse(e,r.changeset().remove(Oi).insert(a.data||[])),i.done(),a}function RQ(e){let t;const n=new Promise(r=>t=r);return n.requests=0,n.done=()=>{--n.requests===0&&(e._pending=null,t(e))},e._pending=n}const PQ={skip:!0};function NQ(e,t,n,r,i){return(e instanceof Tt?IQ:OQ)(this,e,t,n,r,i),this}function OQ(e,t,n,r,i,a){const s=Ze({},a,PQ);let o,u;Ke(n)||(n=fr(n)),r===void 0?o=l=>e.touch(n(l)):Ke(r)?(u=new Tt(null,r,i,!1),o=l=>{u.evaluate(l);const c=n(l),f=u.value;P3(f)?e.pulse(c,f,a):e.update(c,f,s)}):o=l=>e.update(n(l),r,s),t.apply(o)}function IQ(e,t,n,r,i,a){if(r===void 0)t.targets().add(n);else{const s=a||{},o=new Tt(null,BQ(n,r),i,!1);o.modified(s.force),o.rank=t.rank,t.targets().add(o),n&&(o.skip(!0),o.value=n.value,o.targets().add(n),e.connect(n,[o]))}}function BQ(e,t){return t=Ke(t)?t:fr(t),e?function(n,r){const i=t(n,r);return e.skip()||(e.skip(i!==this.value).value=i),i}:t}function LQ(e){e.rank=++this._rank}function zQ(e){const t=[e];let n,r,i;for(;t.length;)if(this.rank(n=t.pop()),r=n._targets)for(i=r.length;--i>=0;)t.push(n=r[i]),n===e&&Q("Cycle detected in dataflow graph.")}const _0={},Sa=1,So=2,Es=4,qQ=Sa|So,O3=Sa|Es,Ac=Sa|So|Es,I3=8,Gd=16,B3=32,L3=64;function Ou(e,t,n){this.dataflow=e,this.stamp=t??-1,this.add=[],this.rem=[],this.mod=[],this.fields=null,this.encode=n||null}function zw(e,t){const n=[];return Tu(e,t,r=>n.push(r)),n}function z3(e,t){const n={};return e.visit(t,r=>{n[Re(r)]=1}),r=>n[Re(r)]?null:r}function A0(e,t){return e?(n,r)=>e(n,r)&&t(n,r):t}Ou.prototype={StopPropagation:_0,ADD:Sa,REM:So,MOD:Es,ADD_REM:qQ,ADD_MOD:O3,ALL:Ac,REFLOW:I3,SOURCE:Gd,NO_SOURCE:B3,NO_FIELDS:L3,fork(e){return new Ou(this.dataflow).init(this,e)},clone(){const e=this.fork(Ac);return e.add=e.add.slice(),e.rem=e.rem.slice(),e.mod=e.mod.slice(),e.source&&(e.source=e.source.slice()),e.materialize(Ac|Gd)},addAll(){let e=this;return!e.source||e.add===e.rem||!e.rem.length&&e.source.length===e.add.length||(e=new Ou(this.dataflow).init(this),e.add=e.source,e.rem=[]),e},init(e,t){const n=this;return n.stamp=e.stamp,n.encode=e.encode,e.fields&&!(t&L3)&&(n.fields=e.fields),t&Sa?(n.addF=e.addF,n.add=e.add):(n.addF=null,n.add=[]),t&So?(n.remF=e.remF,n.rem=e.rem):(n.remF=null,n.rem=[]),t&Es?(n.modF=e.modF,n.mod=e.mod):(n.modF=null,n.mod=[]),t&B3?(n.srcF=null,n.source=null):(n.srcF=e.srcF,n.source=e.source,e.cleans&&(n.cleans=e.cleans)),n},runAfter(e){this.dataflow.runAfter(e)},changed(e){const t=e||Ac;return t&Sa&&this.add.length||t&So&&this.rem.length||t&Es&&this.mod.length},reflow(e){if(e)return this.fork(Ac).reflow();const t=this.add.length,n=this.source&&this.source.length;return n&&n!==t&&(this.mod=this.source,t&&this.filter(Es,z3(this,Sa))),this},clean(e){return arguments.length?(this.cleans=!!e,this):this.cleans},modifies(e){const t=this.fields||(this.fields={});return ee(e)?e.forEach(n=>t[n]=!0):t[e]=!0,this},modified(e,t){const n=this.fields;return(t||this.mod.length)&&n?arguments.length?ee(e)?e.some(r=>n[r]):n[e]:!!n:!1},filter(e,t){const n=this;return e&Sa&&(n.addF=A0(n.addF,t)),e&So&&(n.remF=A0(n.remF,t)),e&Es&&(n.modF=A0(n.modF,t)),e&Gd&&(n.srcF=A0(n.srcF,t)),n},materialize(e){e=e||Ac;const t=this;return e&Sa&&t.addF&&(t.add=zw(t.add,t.addF),t.addF=null),e&So&&t.remF&&(t.rem=zw(t.rem,t.remF),t.remF=null),e&Es&&t.modF&&(t.mod=zw(t.mod,t.modF),t.modF=null),e&Gd&&t.srcF&&(t.source=t.source.filter(t.srcF),t.srcF=null),t},visit(e,t){const n=this,r=t;if(e&Gd)return Tu(n.source,n.srcF,r),n;e&Sa&&Tu(n.add,n.addF,r),e&So&&Tu(n.rem,n.remF,r),e&Es&&Tu(n.mod,n.modF,r);const i=n.source;if(e&I3&&i){const a=n.add.length+n.mod.length;a===i.length||(a?Tu(i,z3(n,O3),r):Tu(i,n.srcF,r))}return n}};function q3(e,t,n,r){const i=this;let a=0;this.dataflow=e,this.stamp=t,this.fields=null,this.encode=r||null,this.pulses=n;for(const s of n)if(s.stamp===t){if(s.fields){const o=i.fields||(i.fields={});for(const u in s.fields)o[u]=1}s.changed(i.ADD)&&(a|=i.ADD),s.changed(i.REM)&&(a|=i.REM),s.changed(i.MOD)&&(a|=i.MOD)}this.changes=a}ge(q3,Ou,{fork(e){const t=new Ou(this.dataflow).init(this,e&this.NO_FIELDS);return e!==void 0&&(e&t.ADD&&this.visit(t.ADD,n=>t.add.push(n)),e&t.REM&&this.visit(t.REM,n=>t.rem.push(n)),e&t.MOD&&this.visit(t.MOD,n=>t.mod.push(n))),t},changed(e){return this.changes&e},modified(e){const t=this,n=t.fields;return n&&t.changes&t.MOD?ee(e)?e.some(r=>n[r]):n[e]:0},filter(){Q("MultiPulse does not support filtering.")},materialize(){Q("MultiPulse does not support materialization.")},visit(e,t){const n=this,r=n.pulses,i=r.length;let a=0;if(e&n.SOURCE)for(;a<i;++a)r[a].visit(e,t);else for(;a<i;++a)r[a].stamp===n.stamp&&r[a].visit(e,t);return n}});async function UQ(e,t,n){const r=this,i=[];if(r._pulse)return U3(r);if(r._pending&&await r._pending,t&&await S0(r,t),!r._touched.length)return r.debug("Dataflow invoked, but nothing to do."),r;const a=++r._clock;r._pulse=new Ou(r,a,e),r._touched.forEach(c=>r._enqueue(c,!0)),r._touched=F0(Jp);let s=0,o,u,l;try{for(;r._heap.size()>0;){if(o=r._heap.pop(),o.rank!==o.qrank){r._enqueue(o,!0);continue}u=o.run(r._getPulse(o,e)),u.then?u=await u:u.async&&(i.push(u.async),u=_0),u!==_0&&o._targets&&o._targets.forEach(c=>r._enqueue(c)),++s}}catch(c){r._heap.clear(),l=c}if(r._input={},r._pulse=null,r.debug(`Pulse ${a}: ${s} operators`),l&&(r._postrun=[],r.error(l)),r._postrun.length){const c=r._postrun.sort((f,d)=>d.priority-f.priority);r._postrun=[];for(let f=0;f<c.length;++f)await S0(r,c[f].callback)}return n&&await S0(r,n),i.length&&Promise.all(i).then(c=>r.runAsync(null,()=>{c.forEach(f=>{try{f(r)}catch(d){r.error(d)}})})),r}async function VQ(e,t,n){for(;this._running;)await this._running;const r=()=>this._running=null;return(this._running=this.evaluate(e,t,n)).then(r,r),this._running}function WQ(e,t,n){return this._pulse?U3(this):(this.evaluate(e,t,n),this)}function HQ(e,t,n){if(this._pulse||t)this._postrun.push({priority:n||0,callback:e});else try{e(this)}catch(r){this.error(r)}}function U3(e){return e.error("Dataflow already running. Use runAsync() to chain invocations."),e}function jQ(e,t){const n=e.stamp<this._clock;n&&(e.stamp=this._clock),(n||t)&&(e.qrank=e.rank,this._heap.push(e))}function GQ(e,t){const n=e.source,r=this._clock;return n&&ee(n)?new q3(this,r,n.map(i=>i.pulse),t):this._input[e.id]||YQ(this._pulse,n&&n.pulse)}function YQ(e,t){return t&&t.stamp===e.stamp?t:(e=e.fork(),t&&t!==_0&&(e.source=t.source),e)}const qw={skip:!1,force:!1};function XQ(e,t){const n=t||qw;return this._pulse?this._enqueue(e):this._touched.add(e),n.skip&&e.skip(!0),this}function KQ(e,t,n){const r=n||qw;return(e.set(t)||r.force)&&this.touch(e,r),this}function ZQ(e,t,n){this.touch(e,n||qw);const r=new Ou(this,this._clock+(this._pulse?0:1)),i=e.pulse&&e.pulse.source||[];return r.target=e,this._input[e.id]=t.pulse(r,i),this}function QQ(e){let t=[];return{clear:()=>t=[],size:()=>t.length,peek:()=>t[0],push:n=>(t.push(n),V3(t,0,t.length-1,e)),pop:()=>{const n=t.pop();let r;return t.length?(r=t[0],t[0]=n,JQ(t,0,e)):r=n,r}}}function V3(e,t,n,r){let i,a;const s=e[n];for(;n>t;){if(a=n-1>>1,i=e[a],r(s,i)<0){e[n]=i,n=a;continue}break}return e[n]=s}function JQ(e,t,n){const r=t,i=e.length,a=e[t];let s=(t<<1)+1,o;for(;s<i;)o=s+1,o<i&&n(e[s],e[o])>=0&&(s=o),e[t]=e[s],t=s,s=(t<<1)+1;return e[t]=a,V3(e,r,t,n)}function Yd(){this.logger(eR()),this.logLevel(QD),this._clock=0,this._rank=0,this._locale=XZ();try{this._loader=Nw()}catch{}this._touched=F0(Jp),this._input={},this._pulse=null,this._heap=QQ((e,t)=>e.qrank-t.qrank),this._postrun=[]}function Xd(e){return function(){return this._log[e].apply(this,arguments)}}Yd.prototype={stamp(){return this._clock},loader(e){return arguments.length?(this._loader=e,this):this._loader},locale(e){return arguments.length?(this._locale=e,this):this._locale},logger(e){return arguments.length?(this._log=e,this):this._log},error:Xd("error"),warn:Xd("warn"),info:Xd("info"),debug:Xd("debug"),logLevel:Xd("level"),cleanThreshold:1e4,add:CQ,connect:kQ,rank:LQ,rerank:zQ,pulse:ZQ,touch:XQ,update:KQ,changeset:_c,ingest:MQ,parse:TQ,preload:DQ,request:$Q,events:AQ,on:NQ,evaluate:UQ,run:WQ,runAsync:VQ,runAfter:HQ,_enqueue:jQ,_getPulse:GQ};function G(e,t){Tt.call(this,e,null,t)}ge(G,Tt,{run(e){if(e.stamp<this.stamp)return e.StopPropagation;let t;return this.skip()?this.skip(!1):t=this.evaluate(e),t=t||e,t.then?t=t.then(n=>this.pulse=n):t!==e.StopPropagation&&(this.pulse=t),t},evaluate(e){const t=this.marshall(e.stamp),n=this.transform(t,e);return t.clear(),n},transform(){}});const Kd={};function eJ(e){const t=tJ(e);return t&&t.Definition||null}function tJ(e){return e=e&&e.toLowerCase(),xe(Kd,e)?Kd[e]:null}function*W3(e,t){if(t==null)for(let n of e)n!=null&&n!==""&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)r=t(r,++n,e),r!=null&&r!==""&&(r=+r)>=r&&(yield r)}}function H3(e,t,n){const r=Float64Array.from(W3(e,n));return r.sort(ps),t.map(i=>TR(r,i))}function j3(e,t){return H3(e,[.25,.5,.75],t)}function G3(e,t){const n=e.length,r=VX(e,t),i=j3(e,t),a=(i[2]-i[0])/1.34;return 1.06*(Math.min(r,a)||r||Math.abs(i[0])||1)*Math.pow(n,-.2)}function nJ(e){const t=e.maxbins||20,n=e.base||10,r=Math.log(n),i=e.divide||[5,2];let a=e.extent[0],s=e.extent[1],o,u,l,c,f,d;const h=e.span||s-a||Math.abs(a)||1;if(e.step)o=e.step;else if(e.steps){for(c=h/t,f=0,d=e.steps.length;f<d&&e.steps[f]<c;++f);o=e.steps[Math.max(0,f-1)]}else{for(u=Math.ceil(Math.log(t)/r),l=e.minstep||0,o=Math.max(l,Math.pow(n,Math.round(Math.log(h)/r)-u));Math.ceil(h/o)>t;)o*=n;for(f=0,d=i.length;f<d;++f)c=o/i[f],c>=l&&h/c<=t&&(o=c)}c=Math.log(o);const g=c>=0?0:~~(-c/r)+1,p=Math.pow(n,-g-1);return(e.nice||e.nice===void 0)&&(c=Math.floor(a/o+p)*o,a=a<c?c-o:c,s=Math.ceil(s/o)*o),{start:a,stop:s===a?a+o:s,step:o}}var Fs=Math.random;function rJ(e,t,n,r){if(!e.length)return[void 0,void 0];const i=Float64Array.from(W3(e,r)),a=i.length,s=t;let o,u,l,c;for(l=0,c=Array(s);l<s;++l){for(o=0,u=0;u<a;++u)o+=i[~~(Fs()*a)];c[l]=o/a}return c.sort(ps),[cw(c,n/2),cw(c,1-n/2)]}function iJ(e,t,n,r){r=r||(d=>d);const i=e.length,a=new Float64Array(i);let s=0,o=1,u=r(e[0]),l=u,c=u+t,f;for(;o<i;++o){if(f=r(e[o]),f>=c){for(l=(u+l)/2;s<o;++s)a[s]=l;c=f+t,u=f}l=f}for(l=(u+l)/2;s<o;++s)a[s]=l;return n?aJ(a,t+t/4):a}function aJ(e,t){const n=e.length;let r=0,i=1,a,s;for(;e[r]===e[i];)++i;for(;i<n;){for(a=i+1;e[i]===e[a];)++a;if(e[i]-e[i-1]<t){for(s=i+(r+a-i-i>>1);s<i;)e[s++]=e[i];for(;s>i;)e[s--]=e[r]}r=i,i=a}return e}const Y3=Math.sqrt(2*Math.PI),sJ=Math.SQRT2;let Zd=NaN;function Uw(e,t){e=e||0,t=t??1;let n=0,r=0,i,a;if(Zd===Zd)n=Zd,Zd=NaN;else{do n=Fs()*2-1,r=Fs()*2-1,i=n*n+r*r;while(i===0||i>1);a=Math.sqrt(-2*Math.log(i)/i),n*=a,Zd=r*a}return e+n*t}function X3(e,t,n){n=n??1;const r=(e-(t||0))/n;return Math.exp(-.5*r*r)/(n*Y3)}function Vw(e,t,n){t=t||0,n=n??1;const r=(e-t)/n,i=Math.abs(r);let a;if(i>37)a=0;else{const s=Math.exp(-i*i/2);let o;i<7.07106781186547?(o=.0352624965998911*i+.700383064443688,o=o*i+6.37396220353165,o=o*i+33.912866078383,o=o*i+112.079291497871,o=o*i+221.213596169931,o=o*i+220.206867912376,a=s*o,o=.0883883476483184*i+1.75566716318264,o=o*i+16.064177579207,o=o*i+86.7807322029461,o=o*i+296.564248779674,o=o*i+637.333633378831,o=o*i+793.826512519948,o=o*i+440.413735824752,a=a/o):(o=i+.65,o=i+4/o,o=i+3/o,o=i+2/o,o=i+1/o,a=s/o/2.506628274631)}return r>0?1-a:a}function Ww(e,t,n){return e<0||e>1?NaN:(t||0)+(n??1)*sJ*oJ(2*e-1)}function oJ(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}function K3(e,t){let n,r;const i={mean(a){return arguments.length?(n=a||0,i):n},stdev(a){return arguments.length?(r=a??1,i):r},sample:()=>Uw(n,r),pdf:a=>X3(a,n,r),cdf:a=>Vw(a,n,r),icdf:a=>Ww(a,n,r)};return i.mean(e).stdev(t)}function Z3(e,t){const n=K3();let r=0;const i={data(a){return arguments.length?(e=a,r=a?a.length:0,i.bandwidth(t)):e},bandwidth(a){return arguments.length?(t=a,!t&&e&&(t=G3(e)),i):t},sample(){return e[~~(Fs()*r)]+t*n.sample()},pdf(a){let s=0,o=0;for(;o<r;++o)s+=n.pdf((a-e[o])/t);return s/t/r},cdf(a){let s=0,o=0;for(;o<r;++o)s+=n.cdf((a-e[o])/t);return s/r},icdf(){throw Error("KDE icdf not supported.")}};return i.data(e)}function Q3(e,t){return e=e||0,t=t??1,Math.exp(e+Uw()*t)}function J3(e,t,n){if(e<=0)return 0;t=t||0,n=n??1;const r=(Math.log(e)-t)/n;return Math.exp(-.5*r*r)/(n*Y3*e)}function eP(e,t,n){return Vw(Math.log(e),t,n)}function tP(e,t,n){return Math.exp(Ww(e,t,n))}function uJ(e,t){let n,r;const i={mean(a){return arguments.length?(n=a||0,i):n},stdev(a){return arguments.length?(r=a??1,i):r},sample:()=>Q3(n,r),pdf:a=>J3(a,n,r),cdf:a=>eP(a,n,r),icdf:a=>tP(a,n,r)};return i.mean(e).stdev(t)}function lJ(e,t){let n=0,r;function i(s){const o=[];let u=0,l;for(l=0;l<n;++l)u+=o[l]=s[l]==null?1:+s[l];for(l=0;l<n;++l)o[l]/=u;return o}const a={weights(s){return arguments.length?(r=i(t=s||[]),a):t},distributions(s){return arguments.length?(s?(n=s.length,e=s):(n=0,e=[]),a.weights(t)):e},sample(){const s=Fs();let o=e[n-1],u=r[0],l=0;for(;l<n-1;u+=r[++l])if(s<u){o=e[l];break}return o.sample()},pdf(s){let o=0,u=0;for(;u<n;++u)o+=r[u]*e[u].pdf(s);return o},cdf(s){let o=0,u=0;for(;u<n;++u)o+=r[u]*e[u].cdf(s);return o},icdf(){throw Error("Mixture icdf not supported.")}};return a.distributions(e).weights(t)}function nP(e,t){return t==null&&(t=e??1,e=0),e+(t-e)*Fs()}function rP(e,t,n){return n==null&&(n=t??1,t=0),e>=t&&e<=n?1/(n-t):0}function iP(e,t,n){return n==null&&(n=t??1,t=0),e<t?0:e>n?1:(e-t)/(n-t)}function aP(e,t,n){return n==null&&(n=t??1,t=0),e>=0&&e<=1?t+e*(n-t):NaN}function cJ(e,t){let n,r;const i={min(a){return arguments.length?(n=a||0,i):n},max(a){return arguments.length?(r=a??1,i):r},sample:()=>nP(n,r),pdf:a=>rP(a,n,r),cdf:a=>iP(a,n,r),icdf:a=>aP(a,n,r)};return t==null&&(t=e??1,e=0),i.min(e).max(t)}function sP(e,t,n){let r=0,i=0;for(const a of e){const s=n(a);t(a)==null||s==null||isNaN(s)||(r+=(s-r)/++i)}return{coef:[r],predict:()=>r,rSquared:0}}function Qd(e,t,n,r){const i=r-e*e,a=Math.abs(i)<1e-24?0:(n-e*t)/i;return[t-a*e,a]}function T0(e,t,n,r){e=e.filter(h=>{let g=t(h),p=n(h);return g!=null&&(g=+g)>=g&&p!=null&&(p=+p)>=p}),r&&e.sort((h,g)=>t(h)-t(g));const i=e.length,a=new Float64Array(i),s=new Float64Array(i);let o=0,u=0,l=0,c,f,d;for(d of e)a[o]=c=+t(d),s[o]=f=+n(d),++o,u+=(c-u)/o,l+=(f-l)/o;for(o=0;o<i;++o)a[o]-=u,s[o]-=l;return[a,s,u,l]}function Jd(e,t,n,r){let i=-1,a,s;for(const o of e)a=t(o),s=n(o),a!=null&&(a=+a)>=a&&s!=null&&(s=+s)>=s&&r(a,s,++i)}function Tc(e,t,n,r,i){let a=0,s=0;return Jd(e,t,n,(o,u)=>{const l=u-i(o),c=u-r;a+=l*l,s+=c*c}),1-a/s}function oP(e,t,n){let r=0,i=0,a=0,s=0,o=0;Jd(e,t,n,(c,f)=>{++o,r+=(c-r)/o,i+=(f-i)/o,a+=(c*f-a)/o,s+=(c*c-s)/o});const u=Qd(r,i,a,s),l=c=>u[0]+u[1]*c;return{coef:u,predict:l,rSquared:Tc(e,t,n,i,l)}}function fJ(e,t,n){let r=0,i=0,a=0,s=0,o=0;Jd(e,t,n,(c,f)=>{++o,c=Math.log(c),r+=(c-r)/o,i+=(f-i)/o,a+=(c*f-a)/o,s+=(c*c-s)/o});const u=Qd(r,i,a,s),l=c=>u[0]+u[1]*Math.log(c);return{coef:u,predict:l,rSquared:Tc(e,t,n,i,l)}}function dJ(e,t,n){const[r,i,a,s]=T0(e,t,n);let o=0,u=0,l=0,c=0,f=0,d,h,g;Jd(e,t,n,(y,b)=>{d=r[f++],h=Math.log(b),g=d*b,o+=(b*h-o)/f,u+=(g-u)/f,l+=(g*h-l)/f,c+=(d*g-c)/f});const[p,v]=Qd(u/s,o/s,l/s,c/s),m=y=>Math.exp(p+v*(y-a));return{coef:[Math.exp(p-v*a),v],predict:m,rSquared:Tc(e,t,n,s,m)}}function hJ(e,t,n){let r=0,i=0,a=0,s=0,o=0,u=0;Jd(e,t,n,(f,d)=>{const h=Math.log(f),g=Math.log(d);++u,r+=(h-r)/u,i+=(g-i)/u,a+=(h*g-a)/u,s+=(h*h-s)/u,o+=(d-o)/u});const l=Qd(r,i,a,s),c=f=>l[0]*Math.pow(f,l[1]);return l[0]=Math.exp(l[0]),{coef:l,predict:c,rSquared:Tc(e,t,n,o,c)}}function uP(e,t,n){const[r,i,a,s]=T0(e,t,n),o=r.length;let u=0,l=0,c=0,f=0,d=0,h,g,p,v;for(h=0;h<o;)g=r[h],p=i[h++],v=g*g,u+=(v-u)/h,l+=(v*g-l)/h,c+=(v*v-c)/h,f+=(g*p-f)/h,d+=(v*p-d)/h;const m=c-u*u,y=u*m-l*l,b=(d*u-f*l)/y,w=(f*m-d*l)/y,E=-b*u,F=x=>(x=x-a,b*x*x+w*x+E+s);return{coef:[E-w*a+b*a*a+s,w-2*b*a,b],predict:F,rSquared:Tc(e,t,n,s,F)}}function gJ(e,t,n,r){if(r===0)return sP(e,t,n);if(r===1)return oP(e,t,n);if(r===2)return uP(e,t,n);const[i,a,s,o]=T0(e,t,n),u=i.length,l=[],c=[],f=r+1;let d,h,g,p,v;for(d=0;d<f;++d){for(g=0,p=0;g<u;++g)p+=Math.pow(i[g],d)*a[g];for(l.push(p),v=new Float64Array(f),h=0;h<f;++h){for(g=0,p=0;g<u;++g)p+=Math.pow(i[g],d+h);v[h]=p}c.push(v)}c.push(l);const m=vJ(c),y=b=>{b-=s;let w=o+m[0]+m[1]*b+m[2]*b*b;for(d=3;d<f;++d)w+=m[d]*Math.pow(b,d);return w};return{coef:pJ(f,m,-s,o),predict:y,rSquared:Tc(e,t,n,o,y)}}function pJ(e,t,n,r){const i=Array(e);let a,s,o,u;for(a=0;a<e;++a)i[a]=0;for(a=e-1;a>=0;--a)for(o=t[a],u=1,i[a]+=o,s=1;s<=a;++s)u*=(a+1-s)/s,i[a-s]+=o*Math.pow(n,s)*u;return i[0]+=r,i}function vJ(e){const t=e.length-1,n=[];let r,i,a,s,o;for(r=0;r<t;++r){for(s=r,i=r+1;i<t;++i)Math.abs(e[r][i])>Math.abs(e[r][s])&&(s=i);for(a=r;a<t+1;++a)o=e[a][r],e[a][r]=e[a][s],e[a][s]=o;for(i=r+1;i<t;++i)for(a=t;a>=r;a--)e[a][i]-=e[a][r]*e[r][i]/e[r][r]}for(i=t-1;i>=0;--i){for(o=0,a=i+1;a<t;++a)o+=e[a][i]*n[a];n[i]=(e[t][i]-o)/e[i][i]}return n}const lP=2,cP=1e-12;function mJ(e,t,n,r){const[i,a,s,o]=T0(e,t,n,!0),u=i.length,l=Math.max(2,~~(r*u)),c=new Float64Array(u),f=new Float64Array(u),d=new Float64Array(u).fill(1);for(let h=-1;++h<=lP;){const g=[0,l-1];for(let v=0;v<u;++v){const m=i[v],y=g[0],b=g[1],w=m-i[y]>i[b]-m?y:b;let E=0,F=0,x=0,C=0,S=0;const _=1/Math.abs(i[w]-m||1);for(let A=y;A<=b;++A){const $=i[A],M=a[A],D=yJ(Math.abs(m-$)*_)*d[A],P=$*D;E+=D,F+=P,x+=M*D,C+=M*P,S+=$*P}const[k,T]=Qd(F/E,x/E,C/E,S/E);c[v]=k+T*m,f[v]=Math.abs(a[v]-c[v]),bJ(i,v+1,g)}if(h===lP)break;const p=MR(f);if(Math.abs(p)<cP)break;for(let v=0,m,y;v<u;++v)m=f[v]/(6*p),d[v]=m>=1?cP:(y=1-m*m)*y}return wJ(i,c,s,o)}function yJ(e){return(e=1-e*e*e)*e*e}function bJ(e,t,n){const r=e[t];let i=n[0],a=n[1]+1;if(!(a>=e.length))for(;t>i&&e[a]-r<=r-e[i];)n[0]=++i,n[1]=a,++a}function wJ(e,t,n,r){const i=e.length,a=[];let s=0,o=0,u=[],l;for(;s<i;++s)l=e[s]+n,u[0]===l?u[1]+=(t[s]-u[1])/++o:(o=0,u[1]+=r,u=[l,t[s]],a.push(u));return u[1]+=r,a}const xJ=.5*Math.PI/180;function Hw(e,t,n,r){n=n||25,r=Math.max(n,r||200);const i=p=>[p,e(p)],a=t[0],s=t[1],o=s-a,u=o/r,l=[i(a)],c=[];if(n===r){for(let p=1;p<r;++p)l.push(i(a+p/n*o));return l.push(i(s)),l}else{c.push(i(s));for(let p=n;--p>0;)c.push(i(a+p/n*o))}let f=l[0],d=c[c.length-1];const h=1/o,g=EJ(f[1],c);for(;d;){const p=i((f[0]+d[0])/2);p[0]-f[0]>=u&&FJ(f,p,d,h,g)>xJ?c.push(p):(f=d,l.push(d),c.pop()),d=c[c.length-1]}return l}function EJ(e,t){let n=e,r=e;const i=t.length;for(let a=0;a<i;++a){const s=t[a][1];s<n&&(n=s),s>r&&(r=s)}return 1/(r-n)}function FJ(e,t,n,r,i){const a=Math.atan2(i*(n[1]-e[1]),r*(n[0]-e[0])),s=Math.atan2(i*(t[1]-e[1]),r*(t[0]-e[0]));return Math.abs(a-s)}function SJ(e){return t=>{const n=e.length;let r=1,i=String(e[0](t));for(;r<n;++r)i+="|"+e[r](t);return i}}function jw(e){return!e||!e.length?function(){return""}:e.length===1?e[0]:SJ(e)}function fP(e,t,n){return n||e+(t?"_"+t:"")}const Gw=()=>{},CJ={init:Gw,add:Gw,rem:Gw,idx:0},eh={values:{init:e=>e.cell.store=!0,value:e=>e.cell.data.values(),idx:-1},count:{value:e=>e.cell.num},__count__:{value:e=>e.missing+e.valid},missing:{value:e=>e.missing},valid:{value:e=>e.valid},sum:{init:e=>e.sum=0,value:e=>e.valid?e.sum:void 0,add:(e,t)=>e.sum+=+t,rem:(e,t)=>e.sum-=t},product:{init:e=>e.product=1,value:e=>e.valid?e.product:void 0,add:(e,t)=>e.product*=t,rem:(e,t)=>e.product/=t},mean:{init:e=>e.mean=0,value:e=>e.valid?e.mean:void 0,add:(e,t)=>(e.mean_d=t-e.mean,e.mean+=e.mean_d/e.valid),rem:(e,t)=>(e.mean_d=t-e.mean,e.mean-=e.valid?e.mean_d/e.valid:e.mean)},average:{value:e=>e.valid?e.mean:void 0,req:["mean"],idx:1},variance:{init:e=>e.dev=0,value:e=>e.valid>1?e.dev/(e.valid-1):void 0,add:(e,t)=>e.dev+=e.mean_d*(t-e.mean),rem:(e,t)=>e.dev-=e.mean_d*(t-e.mean),req:["mean"],idx:1},variancep:{value:e=>e.valid>1?e.dev/e.valid:void 0,req:["variance"],idx:2},stdev:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid-1)):void 0,req:["variance"],idx:2},stdevp:{value:e=>e.valid>1?Math.sqrt(e.dev/e.valid):void 0,req:["variance"],idx:2},stderr:{value:e=>e.valid>1?Math.sqrt(e.dev/(e.valid*(e.valid-1))):void 0,req:["variance"],idx:2},distinct:{value:e=>e.cell.data.distinct(e.get),req:["values"],idx:3},ci0:{value:e=>e.cell.data.ci0(e.get),req:["values"],idx:3},ci1:{value:e=>e.cell.data.ci1(e.get),req:["values"],idx:3},median:{value:e=>e.cell.data.q2(e.get),req:["values"],idx:3},q1:{value:e=>e.cell.data.q1(e.get),req:["values"],idx:3},q3:{value:e=>e.cell.data.q3(e.get),req:["values"],idx:3},min:{init:e=>e.min=void 0,value:e=>e.min=Number.isNaN(e.min)?e.cell.data.min(e.get):e.min,add:(e,t)=>{(t<e.min||e.min===void 0)&&(e.min=t)},rem:(e,t)=>{t<=e.min&&(e.min=NaN)},req:["values"],idx:4},max:{init:e=>e.max=void 0,value:e=>e.max=Number.isNaN(e.max)?e.cell.data.max(e.get):e.max,add:(e,t)=>{(t>e.max||e.max===void 0)&&(e.max=t)},rem:(e,t)=>{t>=e.max&&(e.max=NaN)},req:["values"],idx:4},argmin:{init:e=>e.argmin=void 0,value:e=>e.argmin||e.cell.data.argmin(e.get),add:(e,t,n)=>{t<e.min&&(e.argmin=n)},rem:(e,t)=>{t<=e.min&&(e.argmin=void 0)},req:["min","values"],idx:3},argmax:{init:e=>e.argmax=void 0,value:e=>e.argmax||e.cell.data.argmax(e.get),add:(e,t,n)=>{t>e.max&&(e.argmax=n)},rem:(e,t)=>{t>=e.max&&(e.argmax=void 0)},req:["max","values"],idx:3},exponential:{init:(e,t)=>{e.exp=0,e.exp_r=t},value:e=>e.valid?e.exp*(1-e.exp_r)/(1-e.exp_r**e.valid):void 0,add:(e,t)=>e.exp=e.exp_r*e.exp+t,rem:(e,t)=>e.exp=(e.exp-t/e.exp_r**(e.valid-1))/e.exp_r},exponentialb:{value:e=>e.valid?e.exp*(1-e.exp_r):void 0,req:["exponential"],idx:1}},th=Object.keys(eh).filter(e=>e!=="__count__");function kJ(e,t){return(n,r)=>Ze({name:e,aggregate_param:r,out:n||e},CJ,t)}[...th,"__count__"].forEach(e=>{eh[e]=kJ(e,eh[e])});function dP(e,t,n){return eh[e](n,t)}function hP(e,t){return e.idx-t.idx}function _J(e){const t={};e.forEach(r=>t[r.name]=r);const n=r=>{r.req&&r.req.forEach(i=>{t[i]||n(t[i]=eh[i]())})};return e.forEach(n),Object.values(t).sort(hP)}function AJ(){this.valid=0,this.missing=0,this._ops.forEach(e=>e.aggregate_param==null?e.init(this):e.init(this,e.aggregate_param))}function TJ(e,t){if(e==null||e===""){++this.missing;return}e===e&&(++this.valid,this._ops.forEach(n=>n.add(this,e,t)))}function MJ(e,t){if(e==null||e===""){--this.missing;return}e===e&&(--this.valid,this._ops.forEach(n=>n.rem(this,e,t)))}function $J(e){return this._out.forEach(t=>e[t.out]=t.value(this)),e}function gP(e,t){const n=t||lr,r=_J(e),i=e.slice().sort(hP);function a(s){this._ops=r,this._out=i,this.cell=s,this.init()}return a.prototype.init=AJ,a.prototype.add=TJ,a.prototype.rem=MJ,a.prototype.set=$J,a.prototype.get=n,a.fields=e.map(s=>s.out),a}function Yw(e){this._key=e?Ni(e):Re,this.reset()}const Ln=Yw.prototype;Ln.reset=function(){this._add=[],this._rem=[],this._ext=null,this._get=null,this._q=null},Ln.add=function(e){this._add.push(e)},Ln.rem=function(e){this._rem.push(e)},Ln.values=function(){if(this._get=null,this._rem.length===0)return this._add;const e=this._add,t=this._rem,n=this._key,r=e.length,i=t.length,a=Array(r-i),s={};let o,u,l;for(o=0;o<i;++o)s[n(t[o])]=1;for(o=0,u=0;o<r;++o)s[n(l=e[o])]?s[n(l)]=0:a[u++]=l;return this._rem=[],this._add=a},Ln.distinct=function(e){const t=this.values(),n={};let r=t.length,i=0,a;for(;--r>=0;)a=e(t[r])+"",xe(n,a)||(n[a]=1,++i);return i},Ln.extent=function(e){if(this._get!==e||!this._ext){const t=this.values(),n=vX(t,e);this._ext=[t[n[0]],t[n[1]]],this._get=e}return this._ext},Ln.argmin=function(e){return this.extent(e)[0]||{}},Ln.argmax=function(e){return this.extent(e)[1]||{}},Ln.min=function(e){const t=this.extent(e)[0];return t!=null?e(t):void 0},Ln.max=function(e){const t=this.extent(e)[1];return t!=null?e(t):void 0},Ln.quartile=function(e){return(this._get!==e||!this._q)&&(this._q=j3(this.values(),e),this._get=e),this._q},Ln.q1=function(e){return this.quartile(e)[0]},Ln.q2=function(e){return this.quartile(e)[1]},Ln.q3=function(e){return this.quartile(e)[2]},Ln.ci=function(e){return(this._get!==e||!this._ci)&&(this._ci=rJ(this.values(),1e3,.05,e),this._get=e),this._ci},Ln.ci0=function(e){return this.ci(e)[0]},Ln.ci1=function(e){return this.ci(e)[1]};function Co(e){G.call(this,null,e),this._adds=[],this._mods=[],this._alen=0,this._mlen=0,this._drop=!0,this._cross=!1,this._dims=[],this._dnames=[],this._measures=[],this._countOnly=!1,this._counts=null,this._prev=null,this._inputs=null,this._outputs=null}Co.Definition={type:"Aggregate",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:th},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"drop",type:"boolean",default:!0},{name:"cross",type:"boolean",default:!1},{name:"key",type:"field"}]},ge(Co,G,{transform(e,t){const n=this,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.modified();return n.stamp=r.stamp,n.value&&(i||t.modified(n._inputs,!0))?(n._prev=n.value,n.value=i?n.init(e):Object.create(null),t.visit(t.SOURCE,a=>n.add(a))):(n.value=n.value||n.init(e),t.visit(t.REM,a=>n.rem(a)),t.visit(t.ADD,a=>n.add(a))),r.modifies(n._outputs),n._drop=e.drop!==!1,e.cross&&n._dims.length>1&&(n._drop=!1,n.cross()),t.clean()&&n._drop&&r.clean(!0).runAfter(()=>this.clean()),n.changes(r)},cross(){const e=this,t=e.value,n=e._dnames,r=n.map(()=>({})),i=n.length;function a(o){let u,l,c,f;for(u in o)for(c=o[u].tuple,l=0;l<i;++l)r[l][f=c[n[l]]]=f}a(e._prev),a(t);function s(o,u,l){const c=n[l],f=r[l++];for(const d in f){const h=o?o+"|"+d:d;u[c]=f[d],l<i?s(h,u,l):t[h]||e.cell(h,u)}}s("",{},0)},init(e){const t=this._inputs=[],n=this._outputs=[],r={};function i(y){const b=be(ur(y)),w=b.length;let E=0,F;for(;E<w;++E)r[F=b[E]]||(r[F]=1,t.push(F))}this._dims=be(e.groupby),this._dnames=this._dims.map(y=>{const b=Kt(y);return i(y),n.push(b),b}),this.cellkey=e.key?e.key:jw(this._dims),this._countOnly=!0,this._counts=[],this._measures=[];const a=e.fields||[null],s=e.ops||["count"],o=e.aggregate_params||[null],u=e.as||[],l=a.length,c={};let f,d,h,g,p,v,m;for(l!==s.length&&Q("Unmatched number of fields and aggregate ops."),m=0;m<l;++m){if(f=a[m],d=s[m],h=o[m]||null,f==null&&d!=="count"&&Q("Null aggregate field specified."),p=Kt(f),v=fP(d,p,u[m]),n.push(v),d==="count"){this._counts.push(v);continue}g=c[p],g||(i(f),g=c[p]=[],g.field=f,this._measures.push(g)),d!=="count"&&(this._countOnly=!1),g.push(dP(d,h,v))}return this._measures=this._measures.map(y=>gP(y,y.field)),Object.create(null)},cellkey:jw(),cell(e,t){let n=this.value[e];return n?n.num===0&&this._drop&&n.stamp<this.stamp?(n.stamp=this.stamp,this._adds[this._alen++]=n):n.stamp<this.stamp&&(n.stamp=this.stamp,this._mods[this._mlen++]=n):(n=this.value[e]=this.newcell(e,t),this._adds[this._alen++]=n),n},newcell(e,t){const n={key:e,num:0,agg:null,tuple:this.newtuple(t,this._prev&&this._prev[e]),stamp:this.stamp,store:!1};if(!this._countOnly){const r=this._measures,i=r.length;n.agg=Array(i);for(let a=0;a<i;++a)n.agg[a]=new r[a](n)}return n.store&&(n.data=new Yw),n},newtuple(e,t){const n=this._dnames,r=this._dims,i=r.length,a={};for(let s=0;s<i;++s)a[n[s]]=r[s](e);return t?R3(t.tuple,a):vt(a)},clean(){const e=this.value;for(const t in e)e[t].num===0&&delete e[t]},add(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num+=1,this._countOnly)return;n.store&&n.data.add(e);const r=n.agg;for(let i=0,a=r.length;i<a;++i)r[i].add(r[i].get(e),e)},rem(e){const t=this.cellkey(e),n=this.cell(t,e);if(n.num-=1,this._countOnly)return;n.store&&n.data.rem(e);const r=n.agg;for(let i=0,a=r.length;i<a;++i)r[i].rem(r[i].get(e),e)},celltuple(e){const t=e.tuple,n=this._counts;e.store&&e.data.values();for(let r=0,i=n.length;r<i;++r)t[n[r]]=e.num;if(!this._countOnly){const r=e.agg;for(let i=0,a=r.length;i<a;++i)r[i].set(t)}return t},changes(e){const t=this._adds,n=this._mods,r=this._prev,i=this._drop,a=e.add,s=e.rem,o=e.mod;let u,l,c,f;if(r)for(l in r)u=r[l],(!i||u.num)&&s.push(u.tuple);for(c=0,f=this._alen;c<f;++c)a.push(this.celltuple(t[c])),t[c]=null;for(c=0,f=this._mlen;c<f;++c)u=n[c],(u.num===0&&i?s:o).push(this.celltuple(u)),n[c]=null;return this._alen=this._mlen=0,this._prev=null,e}});const DJ=1e-14;function Xw(e){G.call(this,null,e)}Xw.Definition={type:"Bin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"anchor",type:"number"},{name:"maxbins",type:"number",default:20},{name:"base",type:"number",default:10},{name:"divide",type:"number",array:!0,default:[5,2]},{name:"extent",type:"number",array:!0,length:2,required:!0},{name:"span",type:"number"},{name:"step",type:"number"},{name:"steps",type:"number",array:!0},{name:"minstep",type:"number",default:0},{name:"nice",type:"boolean",default:!0},{name:"name",type:"string"},{name:"as",type:"string",array:!0,length:2,default:["bin0","bin1"]}]},ge(Xw,G,{transform(e,t){const n=e.interval!==!1,r=this._bins(e),i=r.start,a=r.step,s=e.as||["bin0","bin1"],o=s[0],u=s[1];let l;return e.modified()?(t=t.reflow(!0),l=t.SOURCE):l=t.modified(ur(e.field))?t.ADD_MOD:t.ADD,t.visit(l,n?c=>{const f=r(c);c[o]=f,c[u]=f==null?null:i+a*(1+(f-i)/a)}:c=>c[o]=r(c)),t.modifies(n?s:o)},_bins(e){if(this.value&&!e.modified())return this.value;const t=e.field,n=nJ(e),r=n.step;let i=n.start,a=i+Math.ceil((n.stop-i)/r)*r,s,o;(s=e.anchor)!=null&&(o=s-(i+r*Math.floor((s-i)/r)),i+=o,a+=o);const u=function(l){let c=cr(t(l));return c==null?null:c<i?-1/0:c>a?1/0:(c=Math.max(i,Math.min(c,a-r)),i+r*Math.floor(DJ+(c-i)/r))};return u.start=i,u.stop=n.stop,u.step=r,this.value=Xr(u,ur(t),e.name||"bin_"+Kt(t))}});function pP(e,t,n){const r=e;let i=t||[],a=n||[],s={},o=0;return{add:u=>a.push(u),remove:u=>s[r(u)]=++o,size:()=>i.length,data:(u,l)=>(o&&(i=i.filter(c=>!s[r(c)]),s={},o=0),l&&u&&i.sort(u),a.length&&(i=u?EX(u,i,a.sort(u)):i.concat(a),a=[]),i)}}function Kw(e){G.call(this,[],e)}Kw.Definition={type:"Collect",metadata:{source:!0},params:[{name:"sort",type:"compare"}]},ge(Kw,G,{transform(e,t){const n=t.fork(t.ALL),r=pP(Re,this.value,n.materialize(n.ADD).add),i=e.sort,a=t.changed()||i&&(e.modified("sort")||t.modified(i.fields));return n.visit(n.REM,r.remove),this.modified(a),this.value=n.source=r.data(Nu(i),a),t.source&&t.source.root&&(this.value.root=t.source.root),n}});function vP(e){Tt.call(this,null,RJ,e)}ge(vP,Tt);function RJ(e){return this.value&&!e.modified()?this.value:lR(e.fields,e.orders)}function Zw(e){G.call(this,null,e)}Zw.Definition={type:"CountPattern",metadata:{generates:!0,changes:!0},params:[{name:"field",type:"field",required:!0},{name:"case",type:"enum",values:["upper","lower","mixed"],default:"mixed"},{name:"pattern",type:"string",default:'[\\w"]+'},{name:"stopwords",type:"string",default:""},{name:"as",type:"string",array:!0,length:2,default:["text","count"]}]};function PJ(e,t,n){switch(t){case"upper":e=e.toUpperCase();break;case"lower":e=e.toLowerCase();break}return e.match(n)}ge(Zw,G,{transform(e,t){const n=f=>d=>{for(var h=PJ(o(d),e.case,a)||[],g,p=0,v=h.length;p<v;++p)s.test(g=h[p])||f(g)},r=this._parameterCheck(e,t),i=this._counts,a=this._match,s=this._stop,o=e.field,u=e.as||["text","count"],l=n(f=>i[f]=1+(i[f]||0)),c=n(f=>i[f]-=1);return r?t.visit(t.SOURCE,l):(t.visit(t.ADD,l),t.visit(t.REM,c)),this._finish(t,u)},_parameterCheck(e,t){let n=!1;return(e.modified("stopwords")||!this._stop)&&(this._stop=new RegExp("^"+(e.stopwords||"")+"$","i"),n=!0),(e.modified("pattern")||!this._match)&&(this._match=new RegExp(e.pattern||"[\\w']+","g"),n=!0),(e.modified("field")||t.modified(e.field.fields))&&(n=!0),n&&(this._counts={}),n},_finish(e,t){const n=this._counts,r=this._tuples||(this._tuples={}),i=t[0],a=t[1],s=e.fork(e.NO_SOURCE|e.NO_FIELDS);let o,u,l;for(o in n)u=r[o],l=n[o]||0,!u&&l?(r[o]=u=vt({}),u[i]=o,u[a]=l,s.add.push(u)):l===0?(u&&s.rem.push(u),n[o]=null,r[o]=null):u[a]!==l&&(u[a]=l,s.mod.push(u));return s.modifies(t)}});function Qw(e){G.call(this,null,e)}Qw.Definition={type:"Cross",metadata:{generates:!0},params:[{name:"filter",type:"expr"},{name:"as",type:"string",array:!0,length:2,default:["a","b"]}]},ge(Qw,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.as||["a","b"],i=r[0],a=r[1],s=!this.value||t.changed(t.ADD_REM)||e.modified("as")||e.modified("filter");let o=this.value;return s?(o&&(n.rem=o),o=t.materialize(t.SOURCE).source,n.add=this.value=NJ(o,i,a,e.filter||Oi)):n.mod=o,n.source=this.value,n.modifies(r)}});function NJ(e,t,n,r){for(var i=[],a={},s=e.length,o=0,u,l;o<s;++o)for(a[t]=l=e[o],u=0;u<s;++u)a[n]=e[u],r(a)&&(i.push(vt(a)),a={},a[t]=l);return i}const mP={kde:Z3,mixture:lJ,normal:K3,lognormal:uJ,uniform:cJ},OJ="distributions",yP="function",IJ="field";function bP(e,t){const n=e[yP];xe(mP,n)||Q("Unknown distribution function: "+n);const r=mP[n]();for(const i in e)i===IJ?r.data((e.from||t()).map(e[i])):i===OJ?r[i](e[i].map(a=>bP(a,t))):typeof r[i]===yP&&r[i](e[i]);return r}function Jw(e){G.call(this,null,e)}const wP=[{key:{function:"normal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"lognormal"},params:[{name:"mean",type:"number",default:0},{name:"stdev",type:"number",default:1}]},{key:{function:"uniform"},params:[{name:"min",type:"number",default:0},{name:"max",type:"number",default:1}]},{key:{function:"kde"},params:[{name:"field",type:"field",required:!0},{name:"from",type:"data"},{name:"bandwidth",type:"number",default:0}]}],BJ={key:{function:"mixture"},params:[{name:"distributions",type:"param",array:!0,params:wP},{name:"weights",type:"number",array:!0}]};Jw.Definition={type:"Density",metadata:{generates:!0},params:[{name:"extent",type:"number",array:!0,length:2},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"method",type:"string",default:"pdf",values:["pdf","cdf"]},{name:"distribution",type:"param",params:wP.concat(BJ)},{name:"as",type:"string",array:!0,default:["value","density"]}]},ge(Jw,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=bP(e.distribution,LJ(t)),i=e.steps||e.minsteps||25,a=e.steps||e.maxsteps||200;let s=e.method||"pdf";s!=="pdf"&&s!=="cdf"&&Q("Invalid density method: "+s),!e.extent&&!r.data&&Q("Missing density extent parameter."),s=r[s];const o=e.as||["value","density"],u=e.extent||gs(r.data()),l=Hw(s,u,i,a).map(c=>{const f={};return f[o[0]]=c[0],f[o[1]]=c[1],vt(f)});this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function LJ(e){return()=>e.materialize(e.SOURCE).source}function xP(e,t){return e?e.map((n,r)=>t[r]||Kt(n)):null}function ex(e,t,n){const r=[],i=f=>f(u);let a,s,o,u,l,c;if(t==null)r.push(e.map(n));else for(a={},s=0,o=e.length;s<o;++s)u=e[s],l=t.map(i),c=a[l],c||(a[l]=c=[],c.dims=l,r.push(c)),c.push(n(u));return r}const EP="bin";function tx(e){G.call(this,null,e)}tx.Definition={type:"DotBin",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"step",type:"number"},{name:"smooth",type:"boolean",default:!1},{name:"as",type:"string",default:EP}]};const zJ=(e,t)=>o0(gs(e,t))/30;ge(tx,G,{transform(e,t){if(this.value&&!(e.modified()||t.changed()))return t;const n=t.materialize(t.SOURCE).source,r=ex(t.source,e.groupby,lr),i=e.smooth||!1,a=e.field,s=e.step||zJ(n,a),o=Nu((g,p)=>a(g)-a(p)),u=e.as||EP,l=r.length;let c=1/0,f=-1/0,d=0,h;for(;d<l;++d){const g=r[d].sort(o);h=-1;for(const p of iJ(g,s,i,a))p<c&&(c=p),p>f&&(f=p),g[++h][u]=p}return this.value={start:c,stop:f,step:s},t.reflow(!0).modifies(u)}});function FP(e){Tt.call(this,null,qJ,e),this.modified(!0)}ge(FP,Tt);function qJ(e){const t=e.expr;return this.value&&!e.modified("expr")?this.value:Xr(n=>t(n,e),ur(t),Kt(t))}function nx(e){G.call(this,[void 0,void 0],e)}nx.Definition={type:"Extent",metadata:{},params:[{name:"field",type:"field",required:!0}]},ge(nx,G,{transform(e,t){const n=this.value,r=e.field,i=t.changed()||t.modified(r.fields)||e.modified("field");let a=n[0],s=n[1];if((i||a==null)&&(a=1/0,s=-1/0),t.visit(i?t.SOURCE:t.ADD,o=>{const u=cr(r(o));u!=null&&(u<a&&(a=u),u>s&&(s=u))}),!Number.isFinite(a)||!Number.isFinite(s)){let o=Kt(r);o&&(o=` for field "${o}"`),t.dataflow.warn(`Infinite extent${o}: [${a}, ${s}]`),a=s=void 0}this.value=[a,s]}});function rx(e,t){Tt.call(this,e),this.parent=t,this.count=0}ge(rx,Tt,{connect(e){return this.detachSubflow=e.detachSubflow,this.targets().add(e),e.source=this},add(e){this.count+=1,this.value.add.push(e)},rem(e){this.count-=1,this.value.rem.push(e)},mod(e){this.value.mod.push(e)},init(e){this.value.init(e,e.NO_SOURCE)},evaluate(){return this.value}});function M0(e){G.call(this,{},e),this._keys=_d();const t=this._targets=[];t.active=0,t.forEach=n=>{for(let r=0,i=t.active;r<i;++r)n(t[r],r,t)}}ge(M0,G,{activate(e){this._targets[this._targets.active++]=e},subflow(e,t,n,r){const i=this.value;let a=xe(i,e)&&i[e],s,o;return a?a.value.stamp<n.stamp&&(a.init(n),this.activate(a)):(o=r||(o=this._group[e])&&o.tuple,s=n.dataflow,a=new rx(n.fork(n.NO_SOURCE),this),s.add(a).connect(t(s,e,o)),i[e]=a,this.activate(a)),a},clean(){const e=this.value;let t=0;for(const n in e)if(e[n].count===0){const r=e[n].detachSubflow;r&&r(),delete e[n],++t}if(t){const n=this._targets.filter(r=>r&&r.count>0);this.initTargets(n)}},initTargets(e){const t=this._targets,n=t.length,r=e?e.length:0;let i=0;for(;i<r;++i)t[i]=e[i];for(;i<n&&t[i]!=null;++i)t[i]=null;t.active=r},transform(e,t){const n=t.dataflow,r=e.key,i=e.subflow,a=this._keys,s=e.modified("key"),o=u=>this.subflow(u,i,t);return this._group=e.group||{},this.initTargets(),t.visit(t.REM,u=>{const l=Re(u),c=a.get(l);c!==void 0&&(a.delete(l),o(c).rem(u))}),t.visit(t.ADD,u=>{const l=r(u);a.set(Re(u),l),o(l).add(u)}),s||t.modified(r.fields)?t.visit(t.MOD,u=>{const l=Re(u),c=a.get(l),f=r(u);c===f?o(f).mod(u):(a.set(l,f),o(c).rem(u),o(f).add(u))}):t.changed(t.MOD)&&t.visit(t.MOD,u=>{o(a.get(Re(u))).mod(u)}),s&&t.visit(t.REFLOW,u=>{const l=Re(u),c=a.get(l),f=r(u);c!==f&&(a.set(l,f),o(c).rem(u),o(f).add(u))}),t.clean()?n.runAfter(()=>{this.clean(),a.clean()}):a.empty>n.cleanThreshold&&n.runAfter(a.clean),t}});function SP(e){Tt.call(this,null,UJ,e)}ge(SP,Tt);function UJ(e){return this.value&&!e.modified()?this.value:ee(e.name)?be(e.name).map(t=>Ni(t)):Ni(e.name,e.as)}function ix(e){G.call(this,_d(),e)}ix.Definition={type:"Filter",metadata:{changes:!0},params:[{name:"expr",type:"expr",required:!0}]},ge(ix,G,{transform(e,t){const n=t.dataflow,r=this.value,i=t.fork(),a=i.add,s=i.rem,o=i.mod,u=e.expr;let l=!0;t.visit(t.REM,f=>{const d=Re(f);r.has(d)?r.delete(d):s.push(f)}),t.visit(t.ADD,f=>{u(f,e)?a.push(f):r.set(Re(f),1)});function c(f){const d=Re(f),h=u(f,e),g=r.get(d);h&&g?(r.delete(d),a.push(f)):!h&&!g?(r.set(d,1),s.push(f)):l&&h&&!g&&o.push(f)}return t.visit(t.MOD,c),e.modified()&&(l=!1,t.visit(t.REFLOW,c)),r.empty>n.cleanThreshold&&n.runAfter(r.clean),i}});function ax(e){G.call(this,[],e)}ax.Definition={type:"Flatten",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"index",type:"string"},{name:"as",type:"string",array:!0}]},ge(ax,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=xP(r,e.as||[]),a=e.index||null,s=i.length;return n.rem=this.value,t.visit(t.SOURCE,o=>{const u=r.map(g=>g(o)),l=u.reduce((g,p)=>Math.max(g,p.length),0);let c=0,f,d,h;for(;c<l;++c){for(d=Iw(o),f=0;f<s;++f)d[i[f]]=(h=u[f][c])==null?null:h;a&&(d[a]=c),n.add.push(d)}}),this.value=n.source=n.add,a&&n.modifies(a),n.modifies(i)}});function sx(e){G.call(this,[],e)}sx.Definition={type:"Fold",metadata:{generates:!0},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0,length:2,default:["key","value"]}]},ge(sx,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=r.map(Kt),a=e.as||["key","value"],s=a[0],o=a[1],u=r.length;return n.rem=this.value,t.visit(t.SOURCE,l=>{for(let c=0,f;c<u;++c)f=Iw(l),f[s]=i[c],f[o]=r[c](l),n.add.push(f)}),this.value=n.source=n.add,n.modifies(a)}});function ox(e){G.call(this,null,e)}ox.Definition={type:"Formula",metadata:{modifies:!0},params:[{name:"expr",type:"expr",required:!0},{name:"as",type:"string",required:!0},{name:"initonly",type:"boolean"}]},ge(ox,G,{transform(e,t){const n=e.expr,r=e.as,i=e.modified(),a=e.initonly?t.ADD:i?t.SOURCE:t.modified(n.fields)||t.modified(r)?t.ADD_MOD:t.ADD;return i&&(t=t.materialize().reflow(!0)),e.initonly||t.modifies(r),t.visit(a,s=>s[r]=n(s,e))}});function CP(e){G.call(this,[],e)}ge(CP,G,{transform(e,t){const n=t.fork(t.ALL),r=e.generator;let i=this.value,a=e.size-i.length,s,o,u;if(a>0){for(s=[];--a>=0;)s.push(u=vt(r(e))),i.push(u);n.add=n.add.length?n.materialize(n.ADD).add.concat(s):s}else o=i.slice(0,-a),n.rem=n.rem.length?n.materialize(n.REM).rem.concat(o):o,i=i.slice(-a);return n.source=this.value=i,n}});const $0={value:"value",median:MR,mean:XX,min:lw,max:Mu},VJ=[];function ux(e){G.call(this,[],e)}ux.Definition={type:"Impute",metadata:{changes:!0},params:[{name:"field",type:"field",required:!0},{name:"key",type:"field",required:!0},{name:"keyvals",array:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"enum",default:"value",values:["value","mean","median","max","min"]},{name:"value",default:0}]};function WJ(e){var t=e.method||$0.value,n;if($0[t]==null)Q("Unrecognized imputation method: "+t);else return t===$0.value?(n=e.value!==void 0?e.value:0,()=>n):$0[t]}function HJ(e){const t=e.field;return n=>n?t(n):NaN}ge(ux,G,{transform(e,t){var n=t.fork(t.ALL),r=WJ(e),i=HJ(e),a=Kt(e.field),s=Kt(e.key),o=(e.groupby||[]).map(Kt),u=jJ(t.source,e.groupby,e.key,e.keyvals),l=[],c=this.value,f=u.domain.length,d,h,g,p,v,m,y,b,w,E;for(v=0,b=u.length;v<b;++v)for(d=u[v],g=d.values,h=NaN,y=0;y<f;++y)if(d[y]==null){for(p=u.domain[y],E={_impute:!0},m=0,w=g.length;m<w;++m)E[o[m]]=g[m];E[s]=p,E[a]=Number.isNaN(h)?h=r(d,i):h,l.push(vt(E))}return l.length&&(n.add=n.materialize(n.ADD).add.concat(l)),c.length&&(n.rem=n.materialize(n.REM).rem.concat(c)),this.value=l,n}});function jJ(e,t,n,r){var i=m=>m(v),a=[],s=r?r.slice():[],o={},u={},l,c,f,d,h,g,p,v;for(s.forEach((m,y)=>o[m]=y+1),d=0,p=e.length;d<p;++d)v=e[d],g=n(v),h=o[g]||(o[g]=s.push(g)),c=(l=t?t.map(i):VJ)+"",(f=u[c])||(f=u[c]=[],a.push(f),f.values=l),f[h-1]=v;return a.domain=s,a}function lx(e){Co.call(this,e)}lx.Definition={type:"JoinAggregate",metadata:{modifies:!0},params:[{name:"groupby",type:"field",array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"ops",type:"enum",array:!0,values:th},{name:"as",type:"string",null:!0,array:!0},{name:"key",type:"field"}]},ge(lx,Co,{transform(e,t){const n=this,r=e.modified();let i;return n.value&&(r||t.modified(n._inputs,!0))?(i=n.value=r?n.init(e):{},t.visit(t.SOURCE,a=>n.add(a))):(i=n.value=n.value||this.init(e),t.visit(t.REM,a=>n.rem(a)),t.visit(t.ADD,a=>n.add(a))),n.changes(),t.visit(t.SOURCE,a=>{Ze(a,i[n.cellkey(a)].tuple)}),t.reflow(r).modifies(this._outputs)},changes(){const e=this._adds,t=this._mods;let n,r;for(n=0,r=this._alen;n<r;++n)this.celltuple(e[n]),e[n]=null;for(n=0,r=this._mlen;n<r;++n)this.celltuple(t[n]),t[n]=null;this._alen=this._mlen=0}});function cx(e){G.call(this,null,e)}cx.Definition={type:"KDE",metadata:{generates:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"cumulative",type:"boolean",default:!1},{name:"counts",type:"boolean",default:!1},{name:"bandwidth",type:"number",default:0},{name:"extent",type:"number",array:!0,length:2},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"steps",type:"number"},{name:"minsteps",type:"number",default:25},{name:"maxsteps",type:"number",default:200},{name:"as",type:"string",array:!0,default:["value","density"]}]},ge(cx,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=t.materialize(t.SOURCE).source,i=ex(r,e.groupby,e.field),a=(e.groupby||[]).map(Kt),s=e.bandwidth,o=e.cumulative?"cdf":"pdf",u=e.as||["value","density"],l=[];let c=e.extent,f=e.steps||e.minsteps||25,d=e.steps||e.maxsteps||200;o!=="pdf"&&o!=="cdf"&&Q("Invalid density method: "+o),e.resolve==="shared"&&(c||(c=gs(r,e.field)),f=d=e.steps||d),i.forEach(h=>{const g=Z3(h,s)[o],p=e.counts?h.length:1,v=c||gs(h);Hw(g,v,f,d).forEach(m=>{const y={};for(let b=0;b<a.length;++b)y[a[b]]=h.dims[b];y[u[0]]=m[0],y[u[1]]=m[1]*p,l.push(vt(y))})}),this.value&&(n.rem=this.value),this.value=n.add=n.source=l}return n}});function kP(e){Tt.call(this,null,GJ,e)}ge(kP,Tt);function GJ(e){return this.value&&!e.modified()?this.value:dR(e.fields,e.flat)}function _P(e){G.call(this,[],e),this._pending=null}ge(_P,G,{transform(e,t){const n=t.dataflow;return this._pending?fx(this,t,this._pending):YJ(e)?t.StopPropagation:e.values?fx(this,t,n.parse(e.values,e.format)):e.async?{async:n.request(e.url,e.format).then(i=>(this._pending=be(i.data),a=>a.touch(this)))}:n.request(e.url,e.format).then(r=>fx(this,t,be(r.data)))}});function YJ(e){return e.modified("async")&&!(e.modified("values")||e.modified("url")||e.modified("format"))}function fx(e,t,n){n.forEach(vt);const r=t.fork(t.NO_FIELDS&t.NO_SOURCE);return r.rem=e.value,e.value=r.source=r.add=n,e._pending=null,r.rem.length&&r.clean(!0),r}function dx(e){G.call(this,{},e)}dx.Definition={type:"Lookup",metadata:{modifies:!0},params:[{name:"index",type:"index",params:[{name:"from",type:"data",required:!0},{name:"key",type:"field",required:!0}]},{name:"values",type:"field",array:!0},{name:"fields",type:"field",array:!0,required:!0},{name:"as",type:"string",array:!0},{name:"default",default:null}]},ge(dx,G,{transform(e,t){const n=e.fields,r=e.index,i=e.values,a=e.default==null?null:e.default,s=e.modified(),o=n.length;let u=s?t.SOURCE:t.ADD,l=t,c=e.as,f,d,h;return i?(d=i.length,o>1&&!c&&Q('Multi-field lookup requires explicit "as" parameter.'),c&&c.length!==o*d&&Q('The "as" parameter has too few output field names.'),c=c||i.map(Kt),f=function(g){for(var p=0,v=0,m,y;p<o;++p)if(y=r.get(n[p](g)),y==null)for(m=0;m<d;++m,++v)g[c[v]]=a;else for(m=0;m<d;++m,++v)g[c[v]]=i[m](y)}):(c||Q("Missing output field names."),f=function(g){for(var p=0,v;p<o;++p)v=r.get(n[p](g)),g[c[p]]=v??a}),s?l=t.reflow(!0):(h=n.some(g=>t.modified(g.fields)),u|=h?t.MOD:0),t.visit(u,f),l.modifies(c)}});function AP(e){Tt.call(this,null,XJ,e)}ge(AP,Tt);function XJ(e){if(this.value&&!e.modified())return this.value;const t=e.extents,n=t.length;let r=1/0,i=-1/0,a,s;for(a=0;a<n;++a)s=t[a],s[0]<r&&(r=s[0]),s[1]>i&&(i=s[1]);return[r,i]}function TP(e){Tt.call(this,null,KJ,e)}ge(TP,Tt);function KJ(e){return this.value&&!e.modified()?this.value:e.values.reduce((t,n)=>t.concat(n),[])}function MP(e){G.call(this,null,e)}ge(MP,G,{transform(e,t){return this.modified(e.modified()),this.value=e,t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function hx(e){Co.call(this,e)}hx.Definition={type:"Pivot",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"value",type:"field",required:!0},{name:"op",type:"enum",values:th,default:"sum"},{name:"limit",type:"number",default:0},{name:"key",type:"field"}]},ge(hx,Co,{_transform:Co.prototype.transform,transform(e,t){return this._transform(ZJ(e,t),t)}});function ZJ(e,t){const n=e.field,r=e.value,i=(e.op==="count"?"__count__":e.op)||"sum",a=ur(n).concat(ur(r)),s=JJ(n,e.limit||0,t);return t.changed()&&e.set("__pivot__",null,null,!0),{key:e.key,groupby:e.groupby,ops:s.map(()=>i),fields:s.map(o=>QJ(o,n,r,a)),as:s.map(o=>o+""),modified:e.modified.bind(e)}}function QJ(e,t,n,r){return Xr(i=>t(i)===e?n(i):NaN,r,e+"")}function JJ(e,t,n){const r={},i=[];return n.visit(n.SOURCE,a=>{const s=e(a);r[s]||(r[s]=1,i.push(s))}),i.sort(i0),t?i.slice(0,t):i}function $P(e){M0.call(this,e)}ge($P,M0,{transform(e,t){const n=e.subflow,r=e.field,i=a=>this.subflow(Re(a),n,t,a);return(e.modified("field")||r&&t.modified(ur(r)))&&Q("PreFacet does not support field modification."),this.initTargets(),r?(t.visit(t.MOD,a=>{const s=i(a);r(a).forEach(o=>s.mod(o))}),t.visit(t.ADD,a=>{const s=i(a);r(a).forEach(o=>s.add(vt(o)))}),t.visit(t.REM,a=>{const s=i(a);r(a).forEach(o=>s.rem(o))})):(t.visit(t.MOD,a=>i(a).mod(a)),t.visit(t.ADD,a=>i(a).add(a)),t.visit(t.REM,a=>i(a).rem(a))),t.clean()&&t.runAfter(()=>this.clean()),t}});function gx(e){G.call(this,null,e)}gx.Definition={type:"Project",metadata:{generates:!0,changes:!0},params:[{name:"fields",type:"field",array:!0},{name:"as",type:"string",null:!0,array:!0}]},ge(gx,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.fields,i=xP(e.fields,e.as||[]),a=r?(o,u)=>eee(o,u,r,i):C0;let s;return this.value?s=this.value:(t=t.addAll(),s=this.value={}),t.visit(t.REM,o=>{const u=Re(o);n.rem.push(s[u]),s[u]=null}),t.visit(t.ADD,o=>{const u=a(o,vt({}));s[Re(o)]=u,n.add.push(u)}),t.visit(t.MOD,o=>{n.mod.push(a(o,s[Re(o)]))}),n}});function eee(e,t,n,r){for(let i=0,a=n.length;i<a;++i)t[r[i]]=n[i](e);return t}function DP(e){G.call(this,null,e)}ge(DP,G,{transform(e,t){return this.value=e.value,e.modified("value")?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function px(e){G.call(this,null,e)}px.Definition={type:"Quantile",metadata:{generates:!0,changes:!0},params:[{name:"groupby",type:"field",array:!0},{name:"field",type:"field",required:!0},{name:"probs",type:"number",array:!0},{name:"step",type:"number",default:.01},{name:"as",type:"string",array:!0,default:["prob","value"]}]};const tee=1e-14;ge(px,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=e.as||["prob","value"];if(this.value&&!e.modified()&&!t.changed())return n.source=this.value,n;const i=t.materialize(t.SOURCE).source,a=ex(i,e.groupby,e.field),s=(e.groupby||[]).map(Kt),o=[],u=e.step||.01,l=e.probs||Kr(u/2,1-tee,u),c=l.length;return a.forEach(f=>{const d=H3(f,l);for(let h=0;h<c;++h){const g={};for(let p=0;p<s.length;++p)g[s[p]]=f.dims[p];g[r[0]]=l[h],g[r[1]]=d[h],o.push(vt(g))}}),this.value&&(n.rem=this.value),this.value=n.add=n.source=o,n}});function RP(e){G.call(this,null,e)}ge(RP,G,{transform(e,t){let n,r;return this.value?r=this.value:(n=t=t.addAll(),r=this.value={}),e.derive&&(n=t.fork(t.NO_SOURCE),t.visit(t.REM,i=>{const a=Re(i);n.rem.push(r[a]),r[a]=null}),t.visit(t.ADD,i=>{const a=Iw(i);r[Re(i)]=a,n.add.push(a)}),t.visit(t.MOD,i=>{const a=r[Re(i)];for(const s in i)a[s]=i[s],n.modifies(s);n.mod.push(a)})),n}});function vx(e){G.call(this,[],e),this.count=0}vx.Definition={type:"Sample",metadata:{},params:[{name:"size",type:"number",default:1e3}]},ge(vx,G,{transform(e,t){const n=t.fork(t.NO_SOURCE),r=e.modified("size"),i=e.size,a=this.value.reduce((c,f)=>(c[Re(f)]=1,c),{});let s=this.value,o=this.count,u=0;function l(c){let f,d;s.length<i?s.push(c):(d=~~((o+1)*Fs()),d<s.length&&d>=u&&(f=s[d],a[Re(f)]&&n.rem.push(f),s[d]=c)),++o}if(t.rem.length&&(t.visit(t.REM,c=>{const f=Re(c);a[f]&&(a[f]=-1,n.rem.push(c)),--o}),s=s.filter(c=>a[Re(c)]!==-1)),(t.rem.length||r)&&s.length<i&&t.source&&(u=o=s.length,t.visit(t.SOURCE,c=>{a[Re(c)]||l(c)}),u=-1),r&&s.length>i){const c=s.length-i;for(let f=0;f<c;++f)a[Re(s[f])]=-1,n.rem.push(s[f]);s=s.slice(c)}return t.mod.length&&t.visit(t.MOD,c=>{a[Re(c)]&&n.mod.push(c)}),t.add.length&&t.visit(t.ADD,l),(t.add.length||u<0)&&(n.add=s.filter(c=>!a[Re(c)])),this.count=o,this.value=n.source=s,n}});function mx(e){G.call(this,null,e)}mx.Definition={type:"Sequence",metadata:{generates:!0,changes:!0},params:[{name:"start",type:"number",required:!0},{name:"stop",type:"number",required:!0},{name:"step",type:"number",default:1},{name:"as",type:"string",default:"data"}]},ge(mx,G,{transform(e,t){if(this.value&&!e.modified())return;const n=t.materialize().fork(t.MOD),r=e.as||"data";return n.rem=this.value?t.rem.concat(this.value):t.rem,this.value=Kr(e.start,e.stop,e.step||1).map(i=>{const a={};return a[r]=i,vt(a)}),n.add=t.add.concat(this.value),n}});function PP(e){G.call(this,null,e),this.modified(!0)}ge(PP,G,{transform(e,t){return this.value=t.source,t.changed()?t.fork(t.NO_SOURCE|t.NO_FIELDS):t.StopPropagation}});function yx(e){G.call(this,null,e)}const NP=["unit0","unit1"];yx.Definition={type:"TimeUnit",metadata:{modifies:!0},params:[{name:"field",type:"field",required:!0},{name:"interval",type:"boolean",default:!0},{name:"units",type:"enum",values:jR,array:!0},{name:"step",type:"number",default:1},{name:"maxbins",type:"number",default:40},{name:"extent",type:"date",array:!0},{name:"timezone",type:"enum",default:"local",values:["local","utc"]},{name:"as",type:"string",array:!0,length:2,default:NP}]},ge(yx,G,{transform(e,t){const n=e.field,r=e.interval!==!1,i=e.timezone==="utc",a=this._floor(e,t),s=(i?Nd:Pd)(a.unit).offset,o=e.as||NP,u=o[0],l=o[1],c=a.step;let f=a.start||1/0,d=a.stop||-1/0,h=t.ADD;return(e.modified()||t.changed(t.REM)||t.modified(ur(n)))&&(t=t.reflow(!0),h=t.SOURCE,f=1/0,d=-1/0),t.visit(h,g=>{const p=n(g);let v,m;p==null?(g[u]=null,r&&(g[l]=null)):(g[u]=v=m=a(p),r&&(g[l]=m=s(v,c)),v<f&&(f=v),m>d&&(d=m))}),a.start=f,a.stop=d,t.modifies(r?o:u)},_floor(e,t){const n=e.timezone==="utc",{units:r,step:i}=e.units?{units:e.units,step:e.step||1}:VK({extent:e.extent||gs(t.materialize(t.SOURCE).source,e.field),maxbins:e.maxbins}),a=GR(r),s=this.value||{},o=(n?RK:MK)(a,i);return o.unit=st(a),o.units=a,o.step=i,o.start=s.start,o.stop=s.stop,this.value=o}});function OP(e){G.call(this,_d(),e)}ge(OP,G,{transform(e,t){const n=t.dataflow,r=e.field,i=this.value,a=o=>i.set(r(o),o);let s=!0;return e.modified("field")||t.modified(r.fields)?(i.clear(),t.visit(t.SOURCE,a)):t.changed()?(t.visit(t.REM,o=>i.delete(r(o))),t.visit(t.ADD,a)):s=!1,this.modified(s),i.empty>n.cleanThreshold&&n.runAfter(i.clean),t.fork()}});function IP(e){G.call(this,null,e)}ge(IP,G,{transform(e,t){(!this.value||e.modified("field")||e.modified("sort")||t.changed()||e.sort&&t.modified(e.sort.fields))&&(this.value=(e.sort?t.source.slice().sort(Nu(e.sort)):t.source).map(e.field))}});function nee(e,t,n,r){const i=nh[e](t,n);return{init:i.init||ku,update:function(a,s){s[r]=i.next(a)}}}const nh={row_number:function(){return{next:e=>e.index+1}},rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?e=n+1:e}}},dense_rank:function(){let e;return{init:()=>e=1,next:t=>{const n=t.index,r=t.data;return n&&t.compare(r[n-1],r[n])?++e:e}}},percent_rank:function(){const e=nh.rank(),t=e.next;return{init:e.init,next:n=>(t(n)-1)/(n.data.length-1)}},cume_dist:function(){let e;return{init:()=>e=0,next:t=>{const n=t.data,r=t.compare;let i=t.index;if(e<i){for(;i+1<n.length&&!r(n[i],n[i+1]);)++i;e=i}return(1+e)/n.length}}},ntile:function(e,t){t=+t,t>0||Q("ntile num must be greater than zero.");const n=nh.cume_dist(),r=n.next;return{init:n.init,next:i=>Math.ceil(t*r(i))}},lag:function(e,t){return t=+t||1,{next:n=>{const r=n.index-t;return r>=0?e(n.data[r]):null}}},lead:function(e,t){return t=+t||1,{next:n=>{const r=n.index+t,i=n.data;return r<i.length?e(i[r]):null}}},first_value:function(e){return{next:t=>e(t.data[t.i0])}},last_value:function(e){return{next:t=>e(t.data[t.i1-1])}},nth_value:function(e,t){return t=+t,t>0||Q("nth_value nth must be greater than zero."),{next:n=>{const r=n.i0+(t-1);return r<n.i1?e(n.data[r]):null}}},prev_value:function(e){let t;return{init:()=>t=null,next:n=>{const r=e(n.data[n.index]);return r!=null?t=r:t}}},next_value:function(e){let t,n;return{init:()=>(t=null,n=-1),next:r=>{const i=r.data;return r.index<=n?t:(n=ree(e,i,r.index))<0?(n=i.length,t=null):t=e(i[n])}}}};function ree(e,t,n){for(let r=t.length;n<r;++n)if(e(t[n])!=null)return n;return-1}const iee=Object.keys(nh);function BP(e){const t=be(e.ops),n=be(e.fields),r=be(e.params),i=be(e.aggregate_params),a=be(e.as),s=this.outputs=[],o=this.windows=[],u={},l={},c=[],f=[];let d=!0;function h(g){be(ur(g)).forEach(p=>u[p]=1)}h(e.sort),t.forEach((g,p)=>{const v=n[p],m=r[p],y=i[p]||null,b=Kt(v),w=fP(g,b,a[p]);if(h(v),s.push(w),xe(nh,g))o.push(nee(g,v,m,w));else{if(v==null&&g!=="count"&&Q("Null aggregate field specified."),g==="count"){c.push(w);return}d=!1;let E=l[b];E||(E=l[b]=[],E.field=v,f.push(E)),E.push(dP(g,y,w))}}),(c.length||f.length)&&(this.cell=aee(f,c,d)),this.inputs=Object.keys(u)}const LP=BP.prototype;LP.init=function(){this.windows.forEach(e=>e.init()),this.cell&&this.cell.init()},LP.update=function(e,t){const n=this.cell,r=this.windows,i=e.data,a=r&&r.length;let s;if(n){for(s=e.p0;s<e.i0;++s)n.rem(i[s]);for(s=e.p1;s<e.i1;++s)n.add(i[s]);n.set(t)}for(s=0;s<a;++s)r[s].update(e,t)};function aee(e,t,n){e=e.map(u=>gP(u,u.field));const r={num:0,agg:null,store:!1,count:t};if(!n)for(var i=e.length,a=r.agg=Array(i),s=0;s<i;++s)a[s]=new e[s](r);if(r.store)var o=r.data=new Yw;return r.add=function(u){if(r.num+=1,!n){o&&o.add(u);for(let l=0;l<i;++l)a[l].add(a[l].get(u),u)}},r.rem=function(u){if(r.num-=1,!n){o&&o.rem(u);for(let l=0;l<i;++l)a[l].rem(a[l].get(u),u)}},r.set=function(u){let l,c;for(o&&o.values(),l=0,c=t.length;l<c;++l)u[t[l]]=r.num;if(!n)for(l=0,c=a.length;l<c;++l)a[l].set(u)},r.init=function(){r.num=0,o&&o.reset();for(let u=0;u<i;++u)a[u].init()},r}function bx(e){G.call(this,{},e),this._mlen=0,this._mods=[]}bx.Definition={type:"Window",metadata:{modifies:!0},params:[{name:"sort",type:"compare"},{name:"groupby",type:"field",array:!0},{name:"ops",type:"enum",array:!0,values:iee.concat(th)},{name:"params",type:"number",null:!0,array:!0},{name:"aggregate_params",type:"number",null:!0,array:!0},{name:"fields",type:"field",null:!0,array:!0},{name:"as",type:"string",null:!0,array:!0},{name:"frame",type:"number",null:!0,array:!0,length:2,default:[null,0]},{name:"ignorePeers",type:"boolean",default:!1}]},ge(bx,G,{transform(e,t){this.stamp=t.stamp;const n=e.modified(),r=Nu(e.sort),i=jw(e.groupby),a=o=>this.group(i(o));let s=this.state;(!s||n)&&(s=this.state=new BP(e)),n||t.modified(s.inputs)?(this.value={},t.visit(t.SOURCE,o=>a(o).add(o))):(t.visit(t.REM,o=>a(o).remove(o)),t.visit(t.ADD,o=>a(o).add(o)));for(let o=0,u=this._mlen;o<u;++o)see(this._mods[o],s,r,e);return this._mlen=0,this._mods=[],t.reflow(n).modifies(s.outputs)},group(e){let t=this.value[e];return t||(t=this.value[e]=pP(Re),t.stamp=-1),t.stamp<this.stamp&&(t.stamp=this.stamp,this._mods[this._mlen++]=t),t}});function see(e,t,n,r){const i=r.sort,a=i&&!r.ignorePeers,s=r.frame||[null,0],o=e.data(n),u=o.length,l=a?yc(i):null,c={i0:0,i1:0,p0:0,p1:0,index:0,data:o,compare:i||fr(-1)};t.init();for(let f=0;f<u;++f)oee(c,s,f,u),a&&uee(c,l),t.update(c,o[f])}function oee(e,t,n,r){e.p0=e.i0,e.p1=e.i1,e.i0=t[0]==null?0:Math.max(0,n-Math.abs(t[0])),e.i1=t[1]==null?r:Math.min(r,n+Math.abs(t[1])+1),e.index=n}function uee(e,t){const n=e.i0,r=e.i1-1,i=e.compare,a=e.data,s=a.length-1;n>0&&!i(a[n],a[n-1])&&(e.i0=t.left(a,a[n])),r<s&&!i(a[r],a[r+1])&&(e.i1=t.right(a,a[r]))}const lee=Object.freeze(Object.defineProperty({__proto__:null,aggregate:Co,bin:Xw,collect:Kw,compare:vP,countpattern:Zw,cross:Qw,density:Jw,dotbin:tx,expression:FP,extent:nx,facet:M0,field:SP,filter:ix,flatten:ax,fold:sx,formula:ox,generate:CP,impute:ux,joinaggregate:lx,kde:cx,key:kP,load:_P,lookup:dx,multiextent:AP,multivalues:TP,params:MP,pivot:hx,prefacet:$P,project:gx,proxy:DP,quantile:px,relay:RP,sample:vx,sequence:mx,sieve:PP,subflow:rx,timeunit:yx,tupleindex:OP,values:IP,window:bx},Symbol.toStringTag,{value:"Module"}));function mt(e){return function(){return e}}const zP=Math.abs,Zn=Math.atan2,Iu=Math.cos,cee=Math.max,wx=Math.min,Ca=Math.sin,Bu=Math.sqrt,Qn=1e-12,Mc=Math.PI,D0=Mc/2,qP=2*Mc;function fee(e){return e>1?0:e<-1?Mc:Math.acos(e)}function UP(e){return e>=1?D0:e<=-1?-D0:Math.asin(e)}const xx=Math.PI,Ex=2*xx,Lu=1e-6,dee=Ex-Lu;function VP(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function hee(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return VP;const n=10**t;return function(r){this._+=r[0];for(let i=1,a=r.length;i<a;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}let Fx=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?VP:hee(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,a,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+a},${this._y1=+s}`}arcTo(t,n,r,i,a){if(t=+t,n=+n,r=+r,i=+i,a=+a,a<0)throw new Error(`negative radius: ${a}`);let s=this._x1,o=this._y1,u=r-t,l=i-n,c=s-t,f=o-n,d=c*c+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>Lu)if(!(Math.abs(f*u-l*c)>Lu)||!a)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,g=i-o,p=u*u+l*l,v=h*h+g*g,m=Math.sqrt(p),y=Math.sqrt(d),b=a*Math.tan((xx-Math.acos((p+d-v)/(2*m*y)))/2),w=b/y,E=b/m;Math.abs(w-1)>Lu&&this._append`L${t+w*c},${n+w*f}`,this._append`A${a},${a},0,0,${+(f*h>c*g)},${this._x1=t+E*u},${this._y1=n+E*l}`}}arc(t,n,r,i,a,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let o=r*Math.cos(i),u=r*Math.sin(i),l=t+o,c=n+u,f=1^s,d=s?i-a:a-i;this._x1===null?this._append`M${l},${c}`:(Math.abs(this._x1-l)>Lu||Math.abs(this._y1-c)>Lu)&&this._append`L${l},${c}`,r&&(d<0&&(d=d%Ex+Ex),d>dee?this._append`A${r},${r},0,1,${f},${t-o},${n-u}A${r},${r},0,1,${f},${this._x1=l},${this._y1=c}`:d>Lu&&this._append`A${r},${r},0,${+(d>=xx)},${f},${this._x1=t+r*Math.cos(a)},${this._y1=n+r*Math.sin(a)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function Sx(){return new Fx}Sx.prototype=Fx.prototype;function R0(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Fx(t)}function gee(e){return e.innerRadius}function pee(e){return e.outerRadius}function vee(e){return e.startAngle}function mee(e){return e.endAngle}function yee(e){return e&&e.padAngle}function bee(e,t,n,r,i,a,s,o){var u=n-e,l=r-t,c=s-i,f=o-a,d=f*u-c*l;if(!(d*d<Qn))return d=(c*(t-a)-f*(e-i))/d,[e+d*u,t+d*l]}function P0(e,t,n,r,i,a,s){var o=e-n,u=t-r,l=(s?a:-a)/Bu(o*o+u*u),c=l*u,f=-l*o,d=e+c,h=t+f,g=n+c,p=r+f,v=(d+g)/2,m=(h+p)/2,y=g-d,b=p-h,w=y*y+b*b,E=i-a,F=d*p-g*h,x=(b<0?-1:1)*Bu(cee(0,E*E*w-F*F)),C=(F*b-y*x)/w,S=(-F*y-b*x)/w,_=(F*b+y*x)/w,k=(-F*y+b*x)/w,T=C-v,A=S-m,$=_-v,M=k-m;return T*T+A*A>$*$+M*M&&(C=_,S=k),{cx:C,cy:S,x01:-c,y01:-f,x11:C*(i/E-1),y11:S*(i/E-1)}}function wee(){var e=gee,t=pee,n=mt(0),r=null,i=vee,a=mee,s=yee,o=null,u=R0(l);function l(){var c,f,d=+e.apply(this,arguments),h=+t.apply(this,arguments),g=i.apply(this,arguments)-D0,p=a.apply(this,arguments)-D0,v=zP(p-g),m=p>g;if(o||(o=c=u()),h<d&&(f=h,h=d,d=f),!(h>Qn))o.moveTo(0,0);else if(v>qP-Qn)o.moveTo(h*Iu(g),h*Ca(g)),o.arc(0,0,h,g,p,!m),d>Qn&&(o.moveTo(d*Iu(p),d*Ca(p)),o.arc(0,0,d,p,g,m));else{var y=g,b=p,w=g,E=p,F=v,x=v,C=s.apply(this,arguments)/2,S=C>Qn&&(r?+r.apply(this,arguments):Bu(d*d+h*h)),_=wx(zP(h-d)/2,+n.apply(this,arguments)),k=_,T=_,A,$;if(S>Qn){var M=UP(S/d*Ca(C)),D=UP(S/h*Ca(C));(F-=M*2)>Qn?(M*=m?1:-1,w+=M,E-=M):(F=0,w=E=(g+p)/2),(x-=D*2)>Qn?(D*=m?1:-1,y+=D,b-=D):(x=0,y=b=(g+p)/2)}var P=h*Iu(y),N=h*Ca(y),O=d*Iu(E),q=d*Ca(E);if(_>Qn){var z=h*Iu(b),W=h*Ca(b),Y=d*Iu(w),J=d*Ca(w),X;if(v<Mc)if(X=bee(P,N,Y,J,z,W,O,q)){var te=P-X[0],ie=N-X[1],se=z-X[0],B=W-X[1],I=1/Ca(fee((te*se+ie*B)/(Bu(te*te+ie*ie)*Bu(se*se+B*B)))/2),U=Bu(X[0]*X[0]+X[1]*X[1]);k=wx(_,(d-U)/(I-1)),T=wx(_,(h-U)/(I+1))}else k=T=0}x>Qn?T>Qn?(A=P0(Y,J,P,N,h,T,m),$=P0(z,W,O,q,h,T,m),o.moveTo(A.cx+A.x01,A.cy+A.y01),T<_?o.arc(A.cx,A.cy,T,Zn(A.y01,A.x01),Zn($.y01,$.x01),!m):(o.arc(A.cx,A.cy,T,Zn(A.y01,A.x01),Zn(A.y11,A.x11),!m),o.arc(0,0,h,Zn(A.cy+A.y11,A.cx+A.x11),Zn($.cy+$.y11,$.cx+$.x11),!m),o.arc($.cx,$.cy,T,Zn($.y11,$.x11),Zn($.y01,$.x01),!m))):(o.moveTo(P,N),o.arc(0,0,h,y,b,!m)):o.moveTo(P,N),!(d>Qn)||!(F>Qn)?o.lineTo(O,q):k>Qn?(A=P0(O,q,z,W,d,-k,m),$=P0(P,N,Y,J,d,-k,m),o.lineTo(A.cx+A.x01,A.cy+A.y01),k<_?o.arc(A.cx,A.cy,k,Zn(A.y01,A.x01),Zn($.y01,$.x01),!m):(o.arc(A.cx,A.cy,k,Zn(A.y01,A.x01),Zn(A.y11,A.x11),!m),o.arc(0,0,d,Zn(A.cy+A.y11,A.cx+A.x11),Zn($.cy+$.y11,$.cx+$.x11),m),o.arc($.cx,$.cy,k,Zn($.y11,$.x11),Zn($.y01,$.x01),!m))):o.arc(0,0,d,E,w,m)}if(o.closePath(),c)return o=null,c+""||null}return l.centroid=function(){var c=(+e.apply(this,arguments)+ +t.apply(this,arguments))/2,f=(+i.apply(this,arguments)+ +a.apply(this,arguments))/2-Mc/2;return[Iu(f)*c,Ca(f)*c]},l.innerRadius=function(c){return arguments.length?(e=typeof c=="function"?c:mt(+c),l):e},l.outerRadius=function(c){return arguments.length?(t=typeof c=="function"?c:mt(+c),l):t},l.cornerRadius=function(c){return arguments.length?(n=typeof c=="function"?c:mt(+c),l):n},l.padRadius=function(c){return arguments.length?(r=c==null?null:typeof c=="function"?c:mt(+c),l):r},l.startAngle=function(c){return arguments.length?(i=typeof c=="function"?c:mt(+c),l):i},l.endAngle=function(c){return arguments.length?(a=typeof c=="function"?c:mt(+c),l):a},l.padAngle=function(c){return arguments.length?(s=typeof c=="function"?c:mt(+c),l):s},l.context=function(c){return arguments.length?(o=c??null,l):o},l}function WP(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function HP(e){this._context=e}HP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Cx(e){return new HP(e)}function jP(e){return e[0]}function GP(e){return e[1]}function YP(e,t){var n=mt(!0),r=null,i=Cx,a=null,s=R0(o);e=typeof e=="function"?e:e===void 0?jP:mt(e),t=typeof t=="function"?t:t===void 0?GP:mt(t);function o(u){var l,c=(u=WP(u)).length,f,d=!1,h;for(r==null&&(a=i(h=s())),l=0;l<=c;++l)!(l<c&&n(f=u[l],l,u))===d&&((d=!d)?a.lineStart():a.lineEnd()),d&&a.point(+e(f,l,u),+t(f,l,u));if(h)return a=null,h+""||null}return o.x=function(u){return arguments.length?(e=typeof u=="function"?u:mt(+u),o):e},o.y=function(u){return arguments.length?(t=typeof u=="function"?u:mt(+u),o):t},o.defined=function(u){return arguments.length?(n=typeof u=="function"?u:mt(!!u),o):n},o.curve=function(u){return arguments.length?(i=u,r!=null&&(a=i(r)),o):i},o.context=function(u){return arguments.length?(u==null?r=a=null:a=i(r=u),o):r},o}function XP(e,t,n){var r=null,i=mt(!0),a=null,s=Cx,o=null,u=R0(l);e=typeof e=="function"?e:e===void 0?jP:mt(+e),t=typeof t=="function"?t:mt(t===void 0?0:+t),n=typeof n=="function"?n:n===void 0?GP:mt(+n);function l(f){var d,h,g,p=(f=WP(f)).length,v,m=!1,y,b=new Array(p),w=new Array(p);for(a==null&&(o=s(y=u())),d=0;d<=p;++d){if(!(d<p&&i(v=f[d],d,f))===m)if(m=!m)h=d,o.areaStart(),o.lineStart();else{for(o.lineEnd(),o.lineStart(),g=d-1;g>=h;--g)o.point(b[g],w[g]);o.lineEnd(),o.areaEnd()}m&&(b[d]=+e(v,d,f),w[d]=+t(v,d,f),o.point(r?+r(v,d,f):b[d],n?+n(v,d,f):w[d]))}if(y)return o=null,y+""||null}function c(){return YP().defined(i).curve(s).context(a)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:mt(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:mt(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:mt(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:mt(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:mt(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:mt(+f),l):n},l.lineX0=l.lineY0=function(){return c().x(e).y(t)},l.lineY1=function(){return c().x(e).y(n)},l.lineX1=function(){return c().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:mt(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,a!=null&&(o=s(a)),l):s},l.context=function(f){return arguments.length?(f==null?a=o=null:o=s(a=f),l):a},l}const xee={draw(e,t){const n=Bu(t/Mc);e.moveTo(n,0),e.arc(0,0,n,0,qP)}};function Eee(e,t){let n=null,r=R0(i);e=typeof e=="function"?e:mt(e||xee),t=typeof t=="function"?t:mt(t===void 0?64:+t);function i(){let a;if(n||(n=a=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),a)return n=null,a+""||null}return i.type=function(a){return arguments.length?(e=typeof a=="function"?a:mt(a),i):e},i.size=function(a){return arguments.length?(t=typeof a=="function"?a:mt(+a),i):t},i.context=function(a){return arguments.length?(n=a??null,i):n},i}function ko(){}function N0(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function O0(e){this._context=e}O0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:N0(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:N0(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Fee(e){return new O0(e)}function KP(e){this._context=e}KP.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:N0(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function See(e){return new KP(e)}function ZP(e){this._context=e}ZP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:N0(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Cee(e){return new ZP(e)}function QP(e,t){this._basis=new O0(e),this._beta=t}QP.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],a=e[n]-r,s=t[n]-i,o=-1,u;++o<=n;)u=o/n,this._basis.point(this._beta*e[o]+(1-this._beta)*(r+u*a),this._beta*t[o]+(1-this._beta)*(i+u*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};const kee=function e(t){function n(r){return t===1?new O0(r):new QP(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function I0(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function kx(e,t){this._context=e,this._k=(1-t)/6}kx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:I0(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:I0(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const _ee=function e(t){function n(r){return new kx(r,t)}return n.tension=function(r){return e(+r)},n}(0);function _x(e,t){this._context=e,this._k=(1-t)/6}_x.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:I0(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Aee=function e(t){function n(r){return new _x(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Ax(e,t){this._context=e,this._k=(1-t)/6}Ax.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:I0(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Tee=function e(t){function n(r){return new Ax(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Tx(e,t,n){var r=e._x1,i=e._y1,a=e._x2,s=e._y2;if(e._l01_a>Qn){var o=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,u=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*o-e._x0*e._l12_2a+e._x2*e._l01_2a)/u,i=(i*o-e._y0*e._l12_2a+e._y2*e._l01_2a)/u}if(e._l23_a>Qn){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,c=3*e._l23_a*(e._l23_a+e._l12_a);a=(a*l+e._x1*e._l23_2a-t*e._l12_2a)/c,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/c}e._context.bezierCurveTo(r,i,a,s,e._x2,e._y2)}function JP(e,t){this._context=e,this._alpha=t}JP.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Tx(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Mee=function e(t){function n(r){return t?new JP(r,t):new kx(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function eN(e,t){this._context=e,this._alpha=t}eN.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Tx(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const $ee=function e(t){function n(r){return t?new eN(r,t):new _x(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function tN(e,t){this._context=e,this._alpha=t}tN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Tx(this,e,t);break}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};const Dee=function e(t){function n(r){return t?new tN(r,t):new Ax(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function nN(e){this._context=e}nN.prototype={areaStart:ko,areaEnd:ko,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Ree(e){return new nN(e)}function rN(e){return e<0?-1:1}function iN(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),o=(a*i+s*r)/(r+i);return(rN(a)+rN(s))*Math.min(Math.abs(a),Math.abs(s),.5*Math.abs(o))||0}function aN(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Mx(e,t,n){var r=e._x0,i=e._y0,a=e._x1,s=e._y1,o=(a-r)/3;e._context.bezierCurveTo(r+o,i+o*t,a-o,s-o*n,a,s)}function B0(e){this._context=e}B0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Mx(this,this._t0,aN(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Mx(this,aN(this,n=iN(this,e,t)),n);break;default:Mx(this,this._t0,n=iN(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function sN(e){this._context=new oN(e)}(sN.prototype=Object.create(B0.prototype)).point=function(e,t){B0.prototype.point.call(this,t,e)};function oN(e){this._context=e}oN.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Pee(e){return new B0(e)}function Nee(e){return new sN(e)}function uN(e){this._context=e}uN.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=lN(e),i=lN(t),a=0,s=1;s<n;++a,++s)this._context.bezierCurveTo(r[0][a],i[0][a],r[1][a],i[1][a],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function lN(e){var t,n=e.length-1,r,i=new Array(n),a=new Array(n),s=new Array(n);for(i[0]=0,a[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,a[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,a[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/a[t-1],a[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/a[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)a[t]=2*e[t+1]-i[t+1];return[i,a]}function Oee(e){return new uN(e)}function L0(e,t){this._context=e,this._t=t}L0.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function Iee(e){return new L0(e,.5)}function Bee(e){return new L0(e,0)}function Lee(e){return new L0(e,1)}function _o(e,t){if(typeof document<"u"&&document.createElement){const n=document.createElement("canvas");if(n&&n.getContext)return n.width=e,n.height=t,n}return null}const zee=()=>typeof Image<"u"?Image:null;function ka(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Ao(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const $x=Symbol("implicit");function Dx(){var e=new FR,t=[],n=[],r=$x;function i(a){let s=e.get(a);if(s===void 0){if(r!==$x)return r;e.set(a,s=t.push(a)-1)}return n[s%n.length]}return i.domain=function(a){if(!arguments.length)return t.slice();t=[],e=new FR;for(const s of a)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(a){return arguments.length?(n=Array.from(a),i):n.slice()},i.unknown=function(a){return arguments.length?(r=a,i):r},i.copy=function(){return Dx(t,n).unknown(r)},ka.apply(i,arguments),i}function $c(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function rh(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function To(){}var zu=.7,Dc=1/zu,Rc="\\s*([+-]?\\d+)\\s*",ih="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",_a="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qee=/^#([0-9a-f]{3,8})$/,Uee=new RegExp(`^rgb\\(${Rc},${Rc},${Rc}\\)$`),Vee=new RegExp(`^rgb\\(${_a},${_a},${_a}\\)$`),Wee=new RegExp(`^rgba\\(${Rc},${Rc},${Rc},${ih}\\)$`),Hee=new RegExp(`^rgba\\(${_a},${_a},${_a},${ih}\\)$`),jee=new RegExp(`^hsl\\(${ih},${_a},${_a}\\)$`),Gee=new RegExp(`^hsla\\(${ih},${_a},${_a},${ih}\\)$`),cN={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};$c(To,ah,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:fN,formatHex:fN,formatHex8:Yee,formatHsl:Xee,formatRgb:dN,toString:dN});function fN(){return this.rgb().formatHex()}function Yee(){return this.rgb().formatHex8()}function Xee(){return mN(this).formatHsl()}function dN(){return this.rgb().formatRgb()}function ah(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=qee.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?hN(t):n===3?new xn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?z0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?z0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Uee.exec(e))?new xn(t[1],t[2],t[3],1):(t=Vee.exec(e))?new xn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Wee.exec(e))?z0(t[1],t[2],t[3],t[4]):(t=Hee.exec(e))?z0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=jee.exec(e))?vN(t[1],t[2]/100,t[3]/100,1):(t=Gee.exec(e))?vN(t[1],t[2]/100,t[3]/100,t[4]):cN.hasOwnProperty(e)?hN(cN[e]):e==="transparent"?new xn(NaN,NaN,NaN,0):null}function hN(e){return new xn(e>>16&255,e>>8&255,e&255,1)}function z0(e,t,n,r){return r<=0&&(e=t=n=NaN),new xn(e,t,n,r)}function Rx(e){return e instanceof To||(e=ah(e)),e?(e=e.rgb(),new xn(e.r,e.g,e.b,e.opacity)):new xn}function Mo(e,t,n,r){return arguments.length===1?Rx(e):new xn(e,t,n,r??1)}function xn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}$c(xn,Mo,rh(To,{brighter(e){return e=e==null?Dc:Math.pow(Dc,e),new xn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?zu:Math.pow(zu,e),new xn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new xn(qu(this.r),qu(this.g),qu(this.b),q0(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:gN,formatHex:gN,formatHex8:Kee,formatRgb:pN,toString:pN}));function gN(){return`#${Uu(this.r)}${Uu(this.g)}${Uu(this.b)}`}function Kee(){return`#${Uu(this.r)}${Uu(this.g)}${Uu(this.b)}${Uu((isNaN(this.opacity)?1:this.opacity)*255)}`}function pN(){const e=q0(this.opacity);return`${e===1?"rgb(":"rgba("}${qu(this.r)}, ${qu(this.g)}, ${qu(this.b)}${e===1?")":`, ${e})`}`}function q0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function qu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Uu(e){return e=qu(e),(e<16?"0":"")+e.toString(16)}function vN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Bi(e,t,n,r)}function mN(e){if(e instanceof Bi)return new Bi(e.h,e.s,e.l,e.opacity);if(e instanceof To||(e=ah(e)),!e)return new Bi;if(e instanceof Bi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),s=NaN,o=a-i,u=(a+i)/2;return o?(t===a?s=(n-r)/o+(n<r)*6:n===a?s=(r-t)/o+2:s=(t-n)/o+4,o/=u<.5?a+i:2-a-i,s*=60):o=u>0&&u<1?0:s,new Bi(s,o,u,e.opacity)}function U0(e,t,n,r){return arguments.length===1?mN(e):new Bi(e,t,n,r??1)}function Bi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$c(Bi,U0,rh(To,{brighter(e){return e=e==null?Dc:Math.pow(Dc,e),new Bi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zu:Math.pow(zu,e),new Bi(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new xn(Px(e>=240?e-240:e+120,i,r),Px(e,i,r),Px(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Bi(yN(this.h),V0(this.s),V0(this.l),q0(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=q0(this.opacity);return`${e===1?"hsl(":"hsla("}${yN(this.h)}, ${V0(this.s)*100}%, ${V0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function yN(e){return e=(e||0)%360,e<0?e+360:e}function V0(e){return Math.max(0,Math.min(1,e||0))}function Px(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const bN=Math.PI/180,wN=180/Math.PI,W0=18,xN=.96422,EN=1,FN=.82521,SN=4/29,Pc=6/29,CN=3*Pc*Pc,Zee=Pc*Pc*Pc;function kN(e){if(e instanceof Aa)return new Aa(e.l,e.a,e.b,e.opacity);if(e instanceof Ss)return _N(e);e instanceof xn||(e=Rx(e));var t=Bx(e.r),n=Bx(e.g),r=Bx(e.b),i=Nx((.2225045*t+.7168786*n+.0606169*r)/EN),a,s;return t===n&&n===r?a=s=i:(a=Nx((.4360747*t+.3850649*n+.1430804*r)/xN),s=Nx((.0139322*t+.0971045*n+.7141733*r)/FN)),new Aa(116*i-16,500*(a-i),200*(i-s),e.opacity)}function H0(e,t,n,r){return arguments.length===1?kN(e):new Aa(e,t,n,r??1)}function Aa(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}$c(Aa,H0,rh(To,{brighter(e){return new Aa(this.l+W0*(e??1),this.a,this.b,this.opacity)},darker(e){return new Aa(this.l-W0*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=xN*Ox(t),e=EN*Ox(e),n=FN*Ox(n),new xn(Ix(3.1338561*t-1.6168667*e-.4906146*n),Ix(-.9787684*t+1.9161415*e+.033454*n),Ix(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function Nx(e){return e>Zee?Math.pow(e,1/3):e/CN+SN}function Ox(e){return e>Pc?e*e*e:CN*(e-SN)}function Ix(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Bx(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Qee(e){if(e instanceof Ss)return new Ss(e.h,e.c,e.l,e.opacity);if(e instanceof Aa||(e=kN(e)),e.a===0&&e.b===0)return new Ss(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*wN;return new Ss(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function j0(e,t,n,r){return arguments.length===1?Qee(e):new Ss(e,t,n,r??1)}function Ss(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function _N(e){if(isNaN(e.h))return new Aa(e.l,0,0,e.opacity);var t=e.h*bN;return new Aa(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}$c(Ss,j0,rh(To,{brighter(e){return new Ss(this.h,this.c,this.l+W0*(e??1),this.opacity)},darker(e){return new Ss(this.h,this.c,this.l-W0*(e??1),this.opacity)},rgb(){return _N(this).rgb()}}));var AN=-.14861,Lx=1.78277,zx=-.29227,G0=-.90649,sh=1.97294,TN=sh*G0,MN=sh*Lx,$N=Lx*zx-G0*AN;function Jee(e){if(e instanceof Vu)return new Vu(e.h,e.s,e.l,e.opacity);e instanceof xn||(e=Rx(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=($N*r+TN*t-MN*n)/($N+TN-MN),a=r-i,s=(sh*(n-i)-zx*a)/G0,o=Math.sqrt(s*s+a*a)/(sh*i*(1-i)),u=o?Math.atan2(s,a)*wN-120:NaN;return new Vu(u<0?u+360:u,o,i,e.opacity)}function qx(e,t,n,r){return arguments.length===1?Jee(e):new Vu(e,t,n,r??1)}function Vu(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}$c(Vu,qx,rh(To,{brighter(e){return e=e==null?Dc:Math.pow(Dc,e),new Vu(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?zu:Math.pow(zu,e),new Vu(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*bN,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new xn(255*(t+n*(AN*r+Lx*i)),255*(t+n*(zx*r+G0*i)),255*(t+n*(sh*r)),this.opacity)}}));function DN(e,t,n,r,i){var a=e*e,s=a*e;return((1-3*e+3*a-s)*t+(4-6*a+3*s)*n+(1+3*e+3*a-3*s)*r+s*i)/6}function RN(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],a=e[r+1],s=r>0?e[r-1]:2*i-a,o=r<t-1?e[r+2]:2*a-i;return DN((n-r/t)*t,s,i,a,o)}}function PN(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],a=e[r%t],s=e[(r+1)%t],o=e[(r+2)%t];return DN((n-r/t)*t,i,a,s,o)}}const Y0=e=>()=>e;function NN(e,t){return function(n){return e+n*t}}function ete(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function X0(e,t){var n=t-e;return n?NN(e,n>180||n<-180?n-360*Math.round(n/360):n):Y0(isNaN(e)?t:e)}function tte(e){return(e=+e)==1?En:function(t,n){return n-t?ete(t,n,e):Y0(isNaN(t)?n:t)}}function En(e,t){var n=t-e;return n?NN(e,n):Y0(isNaN(e)?t:e)}const Ux=function e(t){var n=tte(t);function r(i,a){var s=n((i=Mo(i)).r,(a=Mo(a)).r),o=n(i.g,a.g),u=n(i.b,a.b),l=En(i.opacity,a.opacity);return function(c){return i.r=s(c),i.g=o(c),i.b=u(c),i.opacity=l(c),i+""}}return r.gamma=e,r}(1);function ON(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),a=new Array(n),s,o;for(s=0;s<n;++s)o=Mo(t[s]),r[s]=o.r||0,i[s]=o.g||0,a[s]=o.b||0;return r=e(r),i=e(i),a=e(a),o.opacity=1,function(u){return o.r=r(u),o.g=i(u),o.b=a(u),o+""}}}var nte=ON(RN),rte=ON(PN);function Vx(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function IN(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ite(e,t){return(IN(t)?Vx:BN)(e,t)}function BN(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),a=new Array(n),s;for(s=0;s<r;++s)i[s]=$o(e[s],t[s]);for(;s<n;++s)a[s]=t[s];return function(o){for(s=0;s<r;++s)a[s]=i[s](o);return a}}function LN(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Li(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function zN(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=$o(e[i],t[i]):r[i]=t[i];return function(a){for(i in n)r[i]=n[i](a);return r}}var Wx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hx=new RegExp(Wx.source,"g");function ate(e){return function(){return e}}function ste(e){return function(t){return e(t)+""}}function qN(e,t){var n=Wx.lastIndex=Hx.lastIndex=0,r,i,a,s=-1,o=[],u=[];for(e=e+"",t=t+"";(r=Wx.exec(e))&&(i=Hx.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),o[s]?o[s]+=a:o[++s]=a),(r=r[0])===(i=i[0])?o[s]?o[s]+=i:o[++s]=i:(o[++s]=null,u.push({i:s,x:Li(r,i)})),n=Hx.lastIndex;return n<t.length&&(a=t.slice(n),o[s]?o[s]+=a:o[++s]=a),o.length<2?u[0]?ste(u[0].x):ate(t):(t=u.length,function(l){for(var c=0,f;c<t;++c)o[(f=u[c]).i]=f.x(l);return o.join("")})}function $o(e,t){var n=typeof t,r;return t==null||n==="boolean"?Y0(t):(n==="number"?Li:n==="string"?(r=ah(t))?(t=r,Ux):qN:t instanceof ah?Ux:t instanceof Date?LN:IN(t)?Vx:Array.isArray(t)?BN:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?zN:Li)(e,t)}function ote(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}function ute(e,t){var n=X0(+e,+t);return function(r){var i=n(r);return i-360*Math.floor(i/360)}}function oh(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var UN=180/Math.PI,jx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function VN(e,t,n,r,i,a){var s,o,u;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(u=e*n+t*r)&&(n-=e*u,r-=t*u),(o=Math.sqrt(n*n+r*r))&&(n/=o,r/=o,u/=o),e*r<t*n&&(e=-e,t=-t,u=-u,s=-s),{translateX:i,translateY:a,rotate:Math.atan2(t,e)*UN,skewX:Math.atan(u)*UN,scaleX:s,scaleY:o}}var K0;function lte(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?jx:VN(t.a,t.b,t.c,t.d,t.e,t.f)}function cte(e){return e==null||(K0||(K0=document.createElementNS("http://www.w3.org/2000/svg","g")),K0.setAttribute("transform",e),!(e=K0.transform.baseVal.consolidate()))?jx:(e=e.matrix,VN(e.a,e.b,e.c,e.d,e.e,e.f))}function WN(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function a(l,c,f,d,h,g){if(l!==f||c!==d){var p=h.push("translate(",null,t,null,n);g.push({i:p-4,x:Li(l,f)},{i:p-2,x:Li(c,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,c,f,d){l!==c?(l-c>180?c+=360:c-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:Li(l,c)})):c&&f.push(i(f)+"rotate("+c+r)}function o(l,c,f,d){l!==c?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:Li(l,c)}):c&&f.push(i(f)+"skewX("+c+r)}function u(l,c,f,d,h,g){if(l!==f||c!==d){var p=h.push(i(h)+"scale(",null,",",null,")");g.push({i:p-4,x:Li(l,f)},{i:p-2,x:Li(c,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,c){var f=[],d=[];return l=e(l),c=e(c),a(l.translateX,l.translateY,c.translateX,c.translateY,f,d),s(l.rotate,c.rotate,f,d),o(l.skewX,c.skewX,f,d),u(l.scaleX,l.scaleY,c.scaleX,c.scaleY,f,d),l=c=null,function(h){for(var g=-1,p=d.length,v;++g<p;)f[(v=d[g]).i]=v.x(h);return f.join("")}}}var fte=WN(lte,"px, ","px)","deg)"),dte=WN(cte,", ",")",")"),hte=1e-12;function HN(e){return((e=Math.exp(e))+1/e)/2}function gte(e){return((e=Math.exp(e))-1/e)/2}function pte(e){return((e=Math.exp(2*e))-1)/(e+1)}const vte=function e(t,n,r){function i(a,s){var o=a[0],u=a[1],l=a[2],c=s[0],f=s[1],d=s[2],h=c-o,g=f-u,p=h*h+g*g,v,m;if(p<hte)m=Math.log(d/l)/t,v=function(x){return[o+x*h,u+x*g,l*Math.exp(t*x*m)]};else{var y=Math.sqrt(p),b=(d*d-l*l+r*p)/(2*l*n*y),w=(d*d-l*l-r*p)/(2*d*n*y),E=Math.log(Math.sqrt(b*b+1)-b),F=Math.log(Math.sqrt(w*w+1)-w);m=(F-E)/t,v=function(x){var C=x*m,S=HN(E),_=l/(n*y)*(S*pte(t*C+E)-gte(E));return[o+_*h,u+_*g,l*S/HN(t*C+E)]}}return v.duration=m*1e3*t/Math.SQRT2,v}return i.rho=function(a){var s=Math.max(.001,+a),o=s*s,u=o*o;return e(s,o,u)},i}(Math.SQRT2,2,4);function jN(e){return function(t,n){var r=e((t=U0(t)).h,(n=U0(n)).h),i=En(t.s,n.s),a=En(t.l,n.l),s=En(t.opacity,n.opacity);return function(o){return t.h=r(o),t.s=i(o),t.l=a(o),t.opacity=s(o),t+""}}}const mte=jN(X0);var yte=jN(En);function bte(e,t){var n=En((e=H0(e)).l,(t=H0(t)).l),r=En(e.a,t.a),i=En(e.b,t.b),a=En(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=a(s),e+""}}function GN(e){return function(t,n){var r=e((t=j0(t)).h,(n=j0(n)).h),i=En(t.c,n.c),a=En(t.l,n.l),s=En(t.opacity,n.opacity);return function(o){return t.h=r(o),t.c=i(o),t.l=a(o),t.opacity=s(o),t+""}}}const wte=GN(X0);var xte=GN(En);function YN(e){return function t(n){n=+n;function r(i,a){var s=e((i=qx(i)).h,(a=qx(a)).h),o=En(i.s,a.s),u=En(i.l,a.l),l=En(i.opacity,a.opacity);return function(c){return i.h=s(c),i.s=o(c),i.l=u(Math.pow(c,n)),i.opacity=l(c),i+""}}return r.gamma=t,r}(1)}const Ete=YN(X0);var Fte=YN(En);function Gx(e,t){t===void 0&&(t=e,e=$o);for(var n=0,r=t.length-1,i=t[0],a=new Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(s){var o=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return a[o](s-o)}}function Ste(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}const Cte=Object.freeze(Object.defineProperty({__proto__:null,interpolate:$o,interpolateArray:ite,interpolateBasis:RN,interpolateBasisClosed:PN,interpolateCubehelix:Ete,interpolateCubehelixLong:Fte,interpolateDate:LN,interpolateDiscrete:ote,interpolateHcl:wte,interpolateHclLong:xte,interpolateHsl:mte,interpolateHslLong:yte,interpolateHue:ute,interpolateLab:bte,interpolateNumber:Li,interpolateNumberArray:Vx,interpolateObject:zN,interpolateRgb:Ux,interpolateRgbBasis:nte,interpolateRgbBasisClosed:rte,interpolateRound:oh,interpolateString:qN,interpolateTransformCss:fte,interpolateTransformSvg:dte,interpolateZoom:vte,piecewise:Gx,quantize:Ste},Symbol.toStringTag,{value:"Module"}));function kte(e){return function(){return e}}function Yx(e){return+e}var XN=[0,1];function Or(e){return e}function Xx(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:kte(isNaN(t)?NaN:.5)}function _te(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Ate(e,t,n){var r=e[0],i=e[1],a=t[0],s=t[1];return i<r?(r=Xx(i,r),a=n(s,a)):(r=Xx(r,i),a=n(a,s)),function(o){return a(r(o))}}function Tte(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),a=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=Xx(e[s],e[s+1]),a[s]=n(t[s],t[s+1]);return function(o){var u=Md(e,o,1,r)-1;return a[u](i[u](o))}}function uh(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Z0(){var e=XN,t=XN,n=$o,r,i,a,s=Or,o,u,l;function c(){var d=Math.min(e.length,t.length);return s!==Or&&(s=_te(e[0],e[d-1])),o=d>2?Tte:Ate,u=l=null,f}function f(d){return d==null||isNaN(d=+d)?a:(u||(u=o(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=o(t,e.map(r),Li)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Yx),c()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=oh,c()},f.clamp=function(d){return arguments.length?(s=d?!0:Or,c()):s!==Or},f.interpolate=function(d){return arguments.length?(n=d,c()):n},f.unknown=function(d){return arguments.length?(a=d,f):a},function(d,h){return r=d,i=h,c()}}function KN(){return Z0()(Or,Or)}function ZN(e,t,n,r){var i=xo(e,t,n),a;switch(r=$u(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=qR(i,s))&&(r.precision=a),dw(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(a=UR(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(a=zR(i))&&(r.precision=a-(r.type==="%")*2);break}}return h0(r)}function Wu(e){var t=e.domain;return e.ticks=function(n){var r=t();return ow(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return ZN(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,a=r.length-1,s=r[i],o=r[a],u,l,c=10;for(o<s&&(l=s,s=o,o=l,l=i,i=a,a=l);c-- >0;){if(l=uw(s,o,n),l===u)return r[i]=s,r[a]=o,t(r);if(l>0)s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l;else if(l<0)s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l;else break;u=l}return e},e}function QN(){var e=KN();return e.copy=function(){return uh(e,QN())},ka.apply(e,arguments),Wu(e)}function JN(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Yx),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return JN(e).unknown(t)},e=arguments.length?Array.from(e,Yx):[0,1],Wu(n)}function eO(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],s;return a<i&&(s=n,n=r,r=s,s=i,i=a,a=s),e[n]=t.floor(i),e[r]=t.ceil(a),e}function tO(e){return Math.log(e)}function nO(e){return Math.exp(e)}function Mte(e){return-Math.log(-e)}function $te(e){return-Math.exp(-e)}function Dte(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Rte(e){return e===10?Dte:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Pte(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function rO(e){return(t,n)=>-e(-t,n)}function Kx(e){const t=e(tO,nO),n=t.domain;let r=10,i,a;function s(){return i=Pte(r),a=Rte(r),n()[0]<0?(i=rO(i),a=rO(a),e(Mte,$te)):e(tO,nO),t}return t.base=function(o){return arguments.length?(r=+o,s()):r},t.domain=function(o){return arguments.length?(n(o),s()):n()},t.ticks=o=>{const u=n();let l=u[0],c=u[u.length-1];const f=c<l;f&&([l,c]=[c,l]);let d=i(l),h=i(c),g,p;const v=o==null?10:+o;let m=[];if(!(r%1)&&h-d<v){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(g=1;g<r;++g)if(p=d<0?g/a(-d):g*a(d),!(p<l)){if(p>c)break;m.push(p)}}else for(;d<=h;++d)for(g=r-1;g>=1;--g)if(p=d>0?g/a(-d):g*a(d),!(p<l)){if(p>c)break;m.push(p)}m.length*2<v&&(m=ow(l,c,v))}else m=ow(d,h,Math.min(h-d,v)).map(a);return f?m.reverse():m},t.tickFormat=(o,u)=>{if(o==null&&(o=10),u==null&&(u=r===10?"s":","),typeof u!="function"&&(!(r%1)&&(u=$u(u)).precision==null&&(u.trim=!0),u=h0(u)),o===1/0)return u;const l=Math.max(1,r*o/t.ticks().length);return c=>{let f=c/a(Math.round(i(c)));return f*r<r-.5&&(f*=r),f<=l?u(c):""}},t.nice=()=>n(eO(n(),{floor:o=>a(Math.floor(i(o))),ceil:o=>a(Math.ceil(i(o)))})),t}function iO(){const e=Kx(Z0()).domain([1,10]);return e.copy=()=>uh(e,iO()).base(e.base()),ka.apply(e,arguments),e}function aO(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function sO(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Zx(e){var t=1,n=e(aO(t),sO(t));return n.constant=function(r){return arguments.length?e(aO(t=+r),sO(t)):t},Wu(n)}function oO(){var e=Zx(Z0());return e.copy=function(){return uh(e,oO()).constant(e.constant())},ka.apply(e,arguments)}function uO(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Nte(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Ote(e){return e<0?-e*e:e*e}function Qx(e){var t=e(Or,Or),n=1;function r(){return n===1?e(Or,Or):n===.5?e(Nte,Ote):e(uO(n),uO(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Wu(t)}function Jx(){var e=Qx(Z0());return e.copy=function(){return uh(e,Jx()).exponent(e.exponent())},ka.apply(e,arguments),e}function Ite(){return Jx.apply(null,arguments).exponent(.5)}function lO(){var e=[],t=[],n=[],r;function i(){var s=0,o=Math.max(1,t.length);for(n=new Array(o-1);++s<o;)n[s-1]=TR(e,s/o);return a}function a(s){return s==null||isNaN(s=+s)?r:t[Md(n,s)]}return a.invertExtent=function(s){var o=t.indexOf(s);return o<0?[NaN,NaN]:[o>0?n[o-1]:e[0],o<n.length?n[o]:e[e.length-1]]},a.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let o of s)o!=null&&!isNaN(o=+o)&&e.push(o);return e.sort(ps),i()},a.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},a.unknown=function(s){return arguments.length?(r=s,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return lO().domain(e).range(t).unknown(r)},ka.apply(a,arguments)}function cO(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function s(u){return u!=null&&u<=u?i[Md(r,u,0,n)]:a}function o(){var u=-1;for(r=new Array(n);++u<n;)r[u]=((u+1)*t-(u-n)*e)/(n+1);return s}return s.domain=function(u){return arguments.length?([e,t]=u,e=+e,t=+t,o()):[e,t]},s.range=function(u){return arguments.length?(n=(i=Array.from(u)).length-1,o()):i.slice()},s.invertExtent=function(u){var l=i.indexOf(u);return l<0?[NaN,NaN]:l<1?[e,r[0]]:l>=n?[r[n-1],t]:[r[l-1],r[l]]},s.unknown=function(u){return arguments.length&&(a=u),s},s.thresholds=function(){return r.slice()},s.copy=function(){return cO().domain([e,t]).range(i).unknown(a)},ka.apply(Wu(s),arguments)}function fO(){var e=[.5],t=[0,1],n,r=1;function i(a){return a!=null&&a<=a?t[Md(e,a,0,r)]:n}return i.domain=function(a){return arguments.length?(e=Array.from(a),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(a){return arguments.length?(t=Array.from(a),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(a){var s=t.indexOf(a);return[e[s-1],e[s]]},i.unknown=function(a){return arguments.length?(n=a,i):n},i.copy=function(){return fO().domain(e).range(t).unknown(n)},ka.apply(i,arguments)}function Bte(e){return new Date(e)}function Lte(e){return e instanceof Date?+e:+new Date(+e)}function eE(e,t,n,r,i,a,s,o,u,l){var c=KN(),f=c.invert,d=c.domain,h=l(".%L"),g=l(":%S"),p=l("%I:%M"),v=l("%I %p"),m=l("%a %d"),y=l("%b %d"),b=l("%B"),w=l("%Y");function E(F){return(u(F)<F?h:o(F)<F?g:s(F)<F?p:a(F)<F?v:r(F)<F?i(F)<F?m:y:n(F)<F?b:w)(F)}return c.invert=function(F){return new Date(f(F))},c.domain=function(F){return arguments.length?d(Array.from(F,Lte)):d().map(Bte)},c.ticks=function(F){var x=d();return e(x[0],x[x.length-1],F??10)},c.tickFormat=function(F,x){return x==null?E:l(x)},c.nice=function(F){var x=d();return(!F||typeof F.range!="function")&&(F=t(x[0],x[x.length-1],F??10)),F?d(eO(x,F)):c},c.copy=function(){return uh(c,eE(e,t,n,r,i,a,s,o,u,l))},c}function zte(){return ka.apply(eE(mK,yK,xa,Dd,xc,ws,v0,g0,bs,kw).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function qte(){return ka.apply(eE(pK,vK,Ea,Rd,Fc,Eo,m0,p0,bs,_w).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Q0(){var e=0,t=1,n,r,i,a,s=Or,o=!1,u;function l(f){return f==null||isNaN(f=+f)?u:s(i===0?.5:(f=(a(f)-n)*i,o?Math.max(0,Math.min(1,f)):f))}l.domain=function(f){return arguments.length?([e,t]=f,n=a(e=+e),r=a(t=+t),i=n===r?0:1/(r-n),l):[e,t]},l.clamp=function(f){return arguments.length?(o=!!f,l):o},l.interpolator=function(f){return arguments.length?(s=f,l):s};function c(f){return function(d){var h,g;return arguments.length?([h,g]=d,s=f(h,g),l):[s(0),s(1)]}}return l.range=c($o),l.rangeRound=c(oh),l.unknown=function(f){return arguments.length?(u=f,l):u},function(f){return a=f,n=f(e),r=f(t),i=n===r?0:1/(r-n),l}}function Do(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function tE(){var e=Wu(Q0()(Or));return e.copy=function(){return Do(e,tE())},Ao.apply(e,arguments)}function dO(){var e=Kx(Q0()).domain([1,10]);return e.copy=function(){return Do(e,dO()).base(e.base())},Ao.apply(e,arguments)}function hO(){var e=Zx(Q0());return e.copy=function(){return Do(e,hO()).constant(e.constant())},Ao.apply(e,arguments)}function nE(){var e=Qx(Q0());return e.copy=function(){return Do(e,nE()).exponent(e.exponent())},Ao.apply(e,arguments)}function Ute(){return nE.apply(null,arguments).exponent(.5)}function J0(){var e=0,t=.5,n=1,r=1,i,a,s,o,u,l=Or,c,f=!1,d;function h(p){return isNaN(p=+p)?d:(p=.5+((p=+c(p))-a)*(r*p<r*a?o:u),l(f?Math.max(0,Math.min(1,p)):p))}h.domain=function(p){return arguments.length?([e,t,n]=p,i=c(e=+e),a=c(t=+t),s=c(n=+n),o=i===a?0:.5/(a-i),u=a===s?0:.5/(s-a),r=a<i?-1:1,h):[e,t,n]},h.clamp=function(p){return arguments.length?(f=!!p,h):f},h.interpolator=function(p){return arguments.length?(l=p,h):l};function g(p){return function(v){var m,y,b;return arguments.length?([m,y,b]=v,l=Gx(p,[m,y,b]),h):[l(0),l(.5),l(1)]}}return h.range=g($o),h.rangeRound=g(oh),h.unknown=function(p){return arguments.length?(d=p,h):d},function(p){return c=p,i=p(e),a=p(t),s=p(n),o=i===a?0:.5/(a-i),u=a===s?0:.5/(s-a),r=a<i?-1:1,h}}function gO(){var e=Wu(J0()(Or));return e.copy=function(){return Do(e,gO())},Ao.apply(e,arguments)}function pO(){var e=Kx(J0()).domain([.1,1,10]);return e.copy=function(){return Do(e,pO()).base(e.base())},Ao.apply(e,arguments)}function vO(){var e=Zx(J0());return e.copy=function(){return Do(e,vO()).constant(e.constant())},Ao.apply(e,arguments)}function rE(){var e=Qx(J0());return e.copy=function(){return Do(e,rE()).exponent(e.exponent())},Ao.apply(e,arguments)}function Vte(){return rE.apply(null,arguments).exponent(.5)}function Ta(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const Wte=Ta("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),Hte=Ta("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),jte=Ta("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Gte=Ta("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),Yte=Ta("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Xte=Ta("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Kte=Ta("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Zte=Ta("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Qte=Ta("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Jte=Ta("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");function iE(e,t,n){const r=e-t+n*2;return e?r>0?r:1:0}const ene="identity",Nc="linear",Cs="log",lh="pow",ch="sqrt",ev="symlog",Hu="time",ju="utc",Ma="sequential",Oc="diverging",Ic="quantile",tv="quantize",nv="threshold",aE="ordinal",sE="point",mO="band",oE="bin-ordinal",un="continuous",fh="discrete",dh="discretizing",pi="interpolating",uE="temporal";function tne(e){return function(t){let n=t[0],r=t[1],i;return r<n&&(i=n,n=r,r=i),[e.invert(n),e.invert(r)]}}function nne(e){return function(t){const n=e.range();let r=t[0],i=t[1],a=-1,s,o,u,l;for(i<r&&(o=r,r=i,i=o),u=0,l=n.length;u<l;++u)n[u]>=r&&n[u]<=i&&(a<0&&(a=u),s=u);if(!(a<0))return r=e.invertExtent(n[a]),i=e.invertExtent(n[s]),[r[0]===void 0?r[1]:r[0],i[1]===void 0?i[0]:i[1]]}}function lE(){const e=Dx().unknown(void 0),t=e.domain,n=e.range;let r=[0,1],i,a,s=!1,o=0,u=0,l=.5;delete e.unknown;function c(){const f=t().length,d=r[1]<r[0],h=r[1-d],g=iE(f,o,u);let p=r[d-0];i=(h-p)/(g||1),s&&(i=Math.floor(i)),p+=(h-p-i*(f-o))*l,a=i*(1-o),s&&(p=Math.round(p),a=Math.round(a));const v=Kr(f).map(m=>p+i*m);return n(d?v.reverse():v)}return e.domain=function(f){return arguments.length?(t(f),c()):t()},e.range=function(f){return arguments.length?(r=[+f[0],+f[1]],c()):r.slice()},e.rangeRound=function(f){return r=[+f[0],+f[1]],s=!0,c()},e.bandwidth=function(){return a},e.step=function(){return i},e.round=function(f){return arguments.length?(s=!!f,c()):s},e.padding=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),o=u,c()):o},e.paddingInner=function(f){return arguments.length?(o=Math.max(0,Math.min(1,f)),c()):o},e.paddingOuter=function(f){return arguments.length?(u=Math.max(0,Math.min(1,f)),c()):u},e.align=function(f){return arguments.length?(l=Math.max(0,Math.min(1,f)),c()):l},e.invertRange=function(f){if(f[0]==null||f[1]==null)return;const d=r[1]<r[0],h=d?n().reverse():n(),g=h.length-1;let p=+f[0],v=+f[1],m,y,b;if(!(p!==p||v!==v)&&(v<p&&(b=p,p=v,v=b),!(v<h[0]||p>r[1-d])))return m=Math.max(0,u0(h,p)-1),y=p===v?m:u0(h,v)-1,p-h[m]>a+1e-10&&++m,d&&(b=m,m=g-y,y=g-b),m>y?void 0:t().slice(m,y+1)},e.invert=function(f){const d=e.invertRange([f,f]);return d&&d[0]},e.copy=function(){return lE().domain(t()).range(r).round(s).paddingInner(o).paddingOuter(u).align(l)},c()}function yO(e){const t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,e.copy=function(){return yO(t())},e}function rne(){return yO(lE().paddingInner(1))}var ine=Array.prototype.map;function ane(e){return ine.call(e,cr)}const sne=Array.prototype.slice;function bO(){let e=[],t=[];function n(r){return r==null||r!==r?void 0:t[(Md(e,r)-1)%t.length]}return n.domain=function(r){return arguments.length?(e=ane(r),n):e.slice()},n.range=function(r){return arguments.length?(t=sne.call(r),n):t.slice()},n.tickFormat=function(r,i){return ZN(e[0],st(e),r??10,i)},n.copy=function(){return bO().domain(n.domain()).range(n.range())},n}const rv=new Map,wO=Symbol("vega_scale");function xO(e){return e[wO]=!0,e}function EO(e){return e&&e[wO]===!0}function one(e,t,n){const r=function(){const a=t();return a.invertRange||(a.invertRange=a.invert?tne(a):a.invertExtent?nne(a):void 0),a.type=e,xO(a)};return r.metadata=wa(be(n)),r}function ht(e,t,n){return arguments.length>1?(rv.set(e,one(e,t,n)),this):FO(e)?rv.get(e):void 0}ht(ene,JN),ht(Nc,QN,un),ht(Cs,iO,[un,Cs]),ht(lh,Jx,un),ht(ch,Ite,un),ht(ev,oO,un),ht(Hu,zte,[un,uE]),ht(ju,qte,[un,uE]),ht(Ma,tE,[un,pi]),ht(`${Ma}-${Nc}`,tE,[un,pi]),ht(`${Ma}-${Cs}`,dO,[un,pi,Cs]),ht(`${Ma}-${lh}`,nE,[un,pi]),ht(`${Ma}-${ch}`,Ute,[un,pi]),ht(`${Ma}-${ev}`,hO,[un,pi]),ht(`${Oc}-${Nc}`,gO,[un,pi]),ht(`${Oc}-${Cs}`,pO,[un,pi,Cs]),ht(`${Oc}-${lh}`,rE,[un,pi]),ht(`${Oc}-${ch}`,Vte,[un,pi]),ht(`${Oc}-${ev}`,vO,[un,pi]),ht(Ic,lO,[dh,Ic]),ht(tv,cO,dh),ht(nv,fO,dh),ht(oE,bO,[fh,dh]),ht(aE,Dx,fh),ht(mO,lE,fh),ht(sE,rne,fh);function FO(e){return rv.has(e)}function Gu(e,t){const n=rv.get(e);return n&&n.metadata[t]}function cE(e){return Gu(e,un)}function Bc(e){return Gu(e,fh)}function fE(e){return Gu(e,dh)}function SO(e){return Gu(e,Cs)}function une(e){return Gu(e,uE)}function CO(e){return Gu(e,pi)}function kO(e){return Gu(e,Ic)}const lne=["clamp","base","constant","exponent"];function cne(e,t){const n=t[0],r=st(t)-n;return function(i){return e(n+i*r)}}function dE(e,t,n){return Gx(AO(t||"rgb",n),e)}function fne(e,t){const n=new Array(t),r=t+1;for(let i=0;i<t;)n[i]=e(++i/r);return n}function _O(e,t,n){const r=n-t;let i,a,s;return!r||!Number.isFinite(r)?fr(.5):(i=(a=e.type).indexOf("-"),a=i<0?a:a.slice(i+1),s=ht(a)().domain([t,n]).range([0,1]),lne.forEach(o=>e[o]?s[o](e[o]()):0),s)}function AO(e,t){const n=Cte[dne(e)];return t!=null&&n&&n.gamma?n.gamma(t):n}function dne(e){return"interpolate"+e.toLowerCase().split("-").map(t=>t[0].toUpperCase()+t.slice(1)).join("")}const hne={blues:"cfe1f2bed8eca8cee58fc1de74b2d75ba3cf4592c63181bd206fb2125ca40a4a90",greens:"d3eecdc0e6baabdda594d3917bc77d60ba6c46ab5e329a512089430e7735036429",greys:"e2e2e2d4d4d4c4c4c4b1b1b19d9d9d8888887575756262624d4d4d3535351e1e1e",oranges:"fdd8b3fdc998fdb87bfda55efc9244f87f2cf06b18e4580bd14904b93d029f3303",purples:"e2e1efd4d4e8c4c5e0b4b3d6a3a0cc928ec3827cb97566ae684ea25c3696501f8c",reds:"fdc9b4fcb49afc9e80fc8767fa7051f6573fec3f2fdc2a25c81b1db21218970b13",blueGreen:"d5efedc1e8e0a7ddd18bd2be70c6a958ba9144ad77319c5d2089460e7736036429",bluePurple:"ccddecbad0e4a8c2dd9ab0d4919cc98d85be8b6db28a55a6873c99822287730f71",greenBlue:"d3eecec5e8c3b1e1bb9bd8bb82cec269c2ca51b2cd3c9fc7288abd1675b10b60a1",orangeRed:"fddcaffdcf9bfdc18afdad77fb9562f67d53ee6545e24932d32d1ebf130da70403",purpleBlue:"dbdaebc8cee4b1c3de97b7d87bacd15b9fc93a90c01e7fb70b70ab056199045281",purpleBlueGreen:"dbd8eac8cee4b0c3de93b7d872acd1549fc83892bb1c88a3097f8702736b016353",purpleRed:"dcc9e2d3b3d7ce9eccd186c0da6bb2e14da0e23189d91e6fc61159ab07498f023a",redPurple:"fccfccfcbec0faa9b8f98faff571a5ec539ddb3695c41b8aa908808d0179700174",yellowGreen:"e4f4acd1eca0b9e2949ed68880c97c62bb6e47aa5e3297502083440e723b036034",yellowOrangeBrown:"feeaa1fedd84fecc63feb746fca031f68921eb7215db5e0bc54c05ab3d038f3204",yellowOrangeRed:"fee087fed16ffebd59fea849fd903efc7335f9522bee3423de1b20ca0b22af0225",blueOrange:"134b852f78b35da2cb9dcae1d2e5eff2f0ebfce0bafbbf74e8932fc5690d994a07",brownBlueGreen:"704108a0651ac79548e3c78af3e6c6eef1eac9e9e48ed1c74da79e187a72025147",purpleGreen:"5b1667834792a67fb6c9aed3e6d6e8eff0efd9efd5aedda971bb75368e490e5e29",purpleOrange:"4114696647968f83b7b9b4d6dadbebf3eeeafce0bafbbf74e8932fc5690d994a07",redBlue:"8c0d25bf363adf745ef4ae91fbdbc9f2efeed2e5ef9dcae15da2cb2f78b3134b85",redGrey:"8c0d25bf363adf745ef4ae91fcdccbfaf4f1e2e2e2c0c0c0969696646464343434",yellowGreenBlue:"eff9bddbf1b4bde5b594d5b969c5be45b4c22c9ec02182b82163aa23479c1c3185",redYellowBlue:"a50026d4322cf16e43fcac64fedd90faf8c1dcf1ecabd6e875abd04a74b4313695",redYellowGreen:"a50026d4322cf16e43fcac63fedd8df9f7aed7ee8ea4d86e64bc6122964f006837",pinkYellowGreen:"8e0152c0267edd72adf0b3d6faddedf5f3efe1f2cab6de8780bb474f9125276419",spectral:"9e0142d13c4bf0704afcac63fedd8dfbf8b0e0f3a1a9dda269bda94288b55e4fa2",viridis:"440154470e61481a6c482575472f7d443a834144873d4e8a39568c35608d31688e2d708e2a788e27818e23888e21918d1f988b1fa08822a8842ab07f35b77943bf7154c56866cc5d7ad1518fd744a5db36bcdf27d2e21be9e51afde725",magma:"0000040404130b0924150e3720114b2c11603b0f704a107957157e651a80721f817f24828c29819a2e80a8327db6377ac43c75d1426fde4968e95462f1605df76f5cfa7f5efc8f65fe9f6dfeaf78febf84fece91fddea0fcedaffcfdbf",inferno:"0000040403130c0826170c3b240c4f330a5f420a68500d6c5d126e6b176e781c6d86216b932667a12b62ae305cbb3755c73e4cd24644dd513ae65c30ed6925f3771af8850ffb9506fca50afcb519fac62df6d645f2e661f3f484fcffa4",plasma:"0d088723069033059742039d5002a25d01a66a00a87801a88405a7900da49c179ea72198b12a90ba3488c33d80cb4779d35171da5a69e16462e76e5bed7953f2834cf68f44fa9a3dfca636fdb32ffec029fcce25f9dc24f5ea27f0f921",cividis:"00205100235800265d002961012b65042e670831690d346b11366c16396d1c3c6e213f6e26426e2c456e31476e374a6e3c4d6e42506e47536d4c566d51586e555b6e5a5e6e5e616e62646f66676f6a6a706e6d717270717573727976737c79747f7c75827f758682768985778c8877908b78938e789691789a94789e9778a19b78a59e77a9a177aea575b2a874b6ab73bbaf71c0b26fc5b66dc9b96acebd68d3c065d8c462ddc85fe2cb5ce7cf58ebd355f0d652f3da4ff7de4cfae249fce647",rainbow:"6e40aa883eb1a43db3bf3cafd83fa4ee4395fe4b83ff576eff6659ff7847ff8c38f3a130e2b72fcfcc36bee044aff05b8ff4576ff65b52f6673af27828ea8d1ddfa319d0b81cbecb23abd82f96e03d82e14c6edb5a5dd0664dbf6e40aa",sinebow:"ff4040fc582af47218e78d0bd5a703bfbf00a7d5038de70b72f41858fc2a40ff402afc5818f4720be78d03d5a700bfbf03a7d50b8de71872f42a58fc4040ff582afc7218f48d0be7a703d5bf00bfd503a7e70b8df41872fc2a58ff4040",turbo:"23171b32204a3e2a71453493493eae4b49c54a53d7485ee44569ee4074f53c7ff8378af93295f72e9ff42ba9ef28b3e926bce125c5d925cdcf27d5c629dcbc2de3b232e9a738ee9d3ff39347f68950f9805afc7765fd6e70fe667cfd5e88fc5795fb51a1f84badf545b9f140c5ec3cd0e637dae034e4d931ecd12ef4c92bfac029ffb626ffad24ffa223ff9821ff8d1fff821dff771cfd6c1af76118f05616e84b14df4111d5380fcb2f0dc0260ab61f07ac1805a313029b0f00950c00910b00",browns:"eedbbdecca96e9b97ae4a865dc9856d18954c7784cc0673fb85536ad44339f3632",tealBlues:"bce4d89dd3d181c3cb65b3c245a2b9368fae347da0306a932c5985",teals:"bbdfdfa2d4d58ac9c975bcbb61b0af4da5a43799982b8b8c1e7f7f127273006667",warmGreys:"dcd4d0cec5c1c0b8b4b3aaa7a59c9998908c8b827f7e7673726866665c5a59504e",goldGreen:"f4d166d5ca60b6c35c98bb597cb25760a6564b9c533f8f4f33834a257740146c36",goldOrange:"f4d166f8be5cf8aa4cf5983bf3852aef701be2621fd65322c54923b142239e3a26",goldRed:"f4d166f6be59f9aa51fc964ef6834bee734ae56249db5247cf4244c43141b71d3e",lightGreyRed:"efe9e6e1dad7d5cbc8c8bdb9bbaea9cd967ddc7b43e15f19df4011dc000b",lightGreyTeal:"e4eaead6dcddc8ced2b7c2c7a6b4bc64b0bf22a6c32295c11f85be1876bc",lightMulti:"e0f1f2c4e9d0b0de9fd0e181f6e072f6c053f3993ef77440ef4a3c",lightOrange:"f2e7daf7d5baf9c499fab184fa9c73f68967ef7860e8645bde515bd43d5b",lightTealBlue:"e3e9e0c0dccf9aceca7abfc859afc0389fb9328dad2f7ca0276b95255988",darkBlue:"3232322d46681a5c930074af008cbf05a7ce25c0dd38daed50f3faffffff",darkGold:"3c3c3c584b37725e348c7631ae8b2bcfa424ecc31ef9de30fff184ffffff",darkGreen:"3a3a3a215748006f4d048942489e4276b340a6c63dd2d836ffeb2cffffaa",darkMulti:"3737371f5287197d8c29a86995ce3fffe800ffffff",darkRed:"3434347036339e3c38cc4037e75d1eec8620eeab29f0ce32ffeb2c"},gne={accent:Hte,category10:Wte,category20:"1f77b4aec7e8ff7f0effbb782ca02c98df8ad62728ff98969467bdc5b0d58c564bc49c94e377c2f7b6d27f7f7fc7c7c7bcbd22dbdb8d17becf9edae5",category20b:"393b795254a36b6ecf9c9ede6379398ca252b5cf6bcedb9c8c6d31bd9e39e7ba52e7cb94843c39ad494ad6616be7969c7b4173a55194ce6dbdde9ed6",category20c:"3182bd6baed69ecae1c6dbefe6550dfd8d3cfdae6bfdd0a231a35474c476a1d99bc7e9c0756bb19e9ac8bcbddcdadaeb636363969696bdbdbdd9d9d9",dark2:jte,observable10:Gte,paired:Yte,pastel1:Xte,pastel2:Kte,set1:Zte,set2:Qte,set3:Jte,tableau10:"4c78a8f58518e4575672b7b254a24beeca3bb279a2ff9da69d755dbab0ac",tableau20:"4c78a89ecae9f58518ffbf7954a24b88d27ab79a20f2cf5b43989483bcb6e45756ff9d9879706ebab0acd67195fcbfd2b279a2d6a5c99e765fd8b5a5"};function TO(e){if(ee(e))return e;const t=e.length/6|0,n=new Array(t);for(let r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}function MO(e,t){for(const n in e)DO(n,t(e[n]))}const $O={};MO(gne,TO),MO(hne,e=>dE(TO(e)));function DO(e,t){return e=e&&e.toLowerCase(),arguments.length>1?($O[e]=t,this):$O[e]}const iv="symbol",pne="discrete",vne="gradient",mne=e=>ee(e)?e.map(t=>String(t)):String(e),yne=(e,t)=>e[1]-t[1],bne=(e,t)=>t[1]-e[1];function hE(e,t,n){let r;return yt(t)&&(e.bins&&(t=Math.max(t,e.bins.length)),n!=null&&(t=Math.min(t,Math.floor(o0(e.domain())/n||1)+1))),we(t)&&(r=t.step,t=t.interval),Ee(t)&&(t=e.type===Hu?Pd(t):e.type==ju?Nd(t):Q("Only time and utc scales accept interval strings."),r&&(t=t.every(r))),t}function RO(e,t,n){let r=e.range(),i=r[0],a=st(r),s=yne;if(i>a&&(r=a,a=i,i=r,s=bne),i=Math.floor(i),a=Math.ceil(a),t=t.map(o=>[o,e(o)]).filter(o=>i<=o[1]&&o[1]<=a).sort(s).map(o=>o[0]),n>0&&t.length>1){const o=[t[0],st(t)];for(;t.length>n&&t.length>=3;)t=t.filter((u,l)=>!(l%2));t.length<3&&(t=o)}return t}function gE(e,t){return e.bins?RO(e,e.bins,t):e.ticks?e.ticks(t):e.domain()}function PO(e,t,n,r,i,a){const s=t.type;let o=mne;if(s===Hu||i===Hu)o=e.timeFormat(r);else if(s===ju||i===ju)o=e.utcFormat(r);else if(SO(s)){const u=e.formatFloat(r);if(a||t.bins)o=u;else{const l=NO(t,n,!1);o=c=>l(c)?u(c):""}}else if(t.tickFormat){const u=t.domain();o=e.formatSpan(u[0],u[u.length-1],n,r)}else r&&(o=e.format(r));return o}function NO(e,t,n){const r=gE(e,t),i=e.base(),a=Math.log(i),s=Math.max(1,i*t/r.length),o=u=>{let l=u/Math.pow(i,Math.round(Math.log(u)/a));return l*i<i-.5&&(l*=i),l<=s};return n?r.filter(o):o}const pE={[Ic]:"quantiles",[tv]:"thresholds",[nv]:"domain"},OO={[Ic]:"quantiles",[tv]:"domain"};function IO(e,t){return e.bins?Ene(e.bins):e.type===Cs?NO(e,t,!0):pE[e.type]?xne(e[pE[e.type]]()):gE(e,t)}function wne(e,t,n){const r=t[OO[t.type]](),i=r.length;let a=i>1?r[1]-r[0]:r[0],s;for(s=1;s<i;++s)a=Math.min(a,r[s]-r[s-1]);return e.formatSpan(0,a,3*10,n)}function xne(e){const t=[-1/0].concat(e);return t.max=1/0,t}function Ene(e){const t=e.slice(0,-1);return t.max=st(e),t}const Fne=e=>pE[e.type]||e.bins;function BO(e,t,n,r,i,a,s){const o=OO[t.type]&&a!==Hu&&a!==ju?wne(e,t,i):PO(e,t,n,i,a,s);return r===iv&&Fne(t)?Sne(o):r===pne?Cne(o):kne(o)}const Sne=e=>(t,n,r)=>{const i=LO(r[n+1],LO(r.max,1/0)),a=zO(t,e),s=zO(i,e);return a&&s?a+" – "+s:s?"< "+s:"≥ "+a},LO=(e,t)=>e??t,Cne=e=>(t,n)=>n?e(t):null,kne=e=>t=>e(t),zO=(e,t)=>Number.isFinite(e)?t(e):null;function _ne(e){const t=e.domain(),n=t.length-1;let r=+t[0],i=+st(t),a=i-r;if(e.type===nv){const s=n?a/n:.1;r-=s,i+=s,a=i-r}return s=>(s-r)/a}function Ane(e,t,n,r){const i=r||t.type;return Ee(n)&&une(i)&&(n=n.replace(/%a/g,"%A").replace(/%b/g,"%B")),!n&&i===Hu?e.timeFormat("%A, %d %B %Y, %X"):!n&&i===ju?e.utcFormat("%A, %d %B %Y, %X UTC"):BO(e,t,5,null,n,r,!0)}function qO(e,t,n){n=n||{};const r=Math.max(3,n.maxlen||7),i=Ane(e,t,n.format,n.formatType);if(fE(t.type)){const a=IO(t).slice(1).map(i),s=a.length;return`${s} boundar${s===1?"y":"ies"}: ${a.join(", ")}`}else if(Bc(t.type)){const a=t.domain(),s=a.length,o=s>r?a.slice(0,r-2).map(i).join(", ")+", ending with "+a.slice(-1).map(i):a.map(i).join(", ");return`${s} value${s===1?"":"s"}: ${o}`}else{const a=t.domain();return`values from ${i(a[0])} to ${i(st(a))}`}}let Tne=0;const av="p_";function vE(e){return e&&e.gradient}function UO(e,t,n){const r=e.gradient;let i=e.id,a=r==="radial"?av:"";return i||(i=e.id="gradient_"+Tne++,r==="radial"?(e.x1=$a(e.x1,.5),e.y1=$a(e.y1,.5),e.r1=$a(e.r1,0),e.x2=$a(e.x2,.5),e.y2=$a(e.y2,.5),e.r2=$a(e.r2,.5),a=av):(e.x1=$a(e.x1,0),e.y1=$a(e.y1,0),e.x2=$a(e.x2,1),e.y2=$a(e.y2,0))),t[i]=e,"url("+(n||"")+"#"+a+i+")"}function $a(e,t){return e??t}function Mne(e,t){var n=[],r;return r={gradient:"linear",x1:e?e[0]:0,y1:e?e[1]:0,x2:t?t[0]:1,y2:t?t[1]:0,stops:n,stop:function(i,a){return n.push({offset:i,color:a}),r}}}const VO={basis:{curve:Fee},"basis-closed":{curve:See},"basis-open":{curve:Cee},bundle:{curve:kee,tension:"beta",value:.85},cardinal:{curve:_ee,tension:"tension",value:0},"cardinal-open":{curve:Tee,tension:"tension",value:0},"cardinal-closed":{curve:Aee,tension:"tension",value:0},"catmull-rom":{curve:Mee,tension:"alpha",value:.5},"catmull-rom-closed":{curve:$ee,tension:"alpha",value:.5},"catmull-rom-open":{curve:Dee,tension:"alpha",value:.5},linear:{curve:Cx},"linear-closed":{curve:Ree},monotone:{horizontal:Nee,vertical:Pee},natural:{curve:Oee},step:{curve:Iee},"step-after":{curve:Lee},"step-before":{curve:Bee}};function WO(e,t,n){var r=xe(VO,e)&&VO[e],i=null;return r&&(i=r.curve||r[t||"vertical"],r.tension&&n!=null&&(i=i[r.tension](n))),i}const $ne={m:2,l:2,h:1,v:1,z:0,c:6,s:4,q:4,t:2,a:7},Dne=/[mlhvzcsqta]([^mlhvzcsqta]+|$)/gi,Rne=/^[+-]?(([0-9]*\.[0-9]+)|([0-9]+\.)|([0-9]+))([eE][+-]?[0-9]+)?/,Pne=/^((\s+,?\s*)|(,\s*))/,Nne=/^[01]/;function mE(e){const t=[];return(e.match(Dne)||[]).forEach(r=>{let i=r[0];const a=i.toLowerCase(),s=$ne[a],o=One(a,s,r.slice(1).trim()),u=o.length;if(u<s||u&&u%s!==0)throw Error("Invalid SVG path, incorrect parameter count");if(t.push([i,...o.slice(0,s)]),u!==s){a==="m"&&(i=i==="M"?"L":"l");for(let l=s;l<u;l+=s)t.push([i,...o.slice(l,l+s)])}}),t}function One(e,t,n){const r=[];for(let i=0;t&&i<n.length;)for(let a=0;a<t;++a){const s=e==="a"&&(a===3||a===4)?Nne:Rne,o=n.slice(i).match(s);if(o===null)throw Error("Invalid SVG path, incorrect parameter type");i+=o[0].length,r.push(+o[0]);const u=n.slice(i).match(Pne);u!==null&&(i+=u[0].length)}return r}const Ro=Math.PI/180,Ine=1e-14,Yu=Math.PI/2,Da=Math.PI*2,Lc=Math.sqrt(3)/2;var yE={},bE={},HO=[].join;function Bne(e,t,n,r,i,a,s,o,u){const l=HO.call(arguments);if(yE[l])return yE[l];const c=s*Ro,f=Math.sin(c),d=Math.cos(c);n=Math.abs(n),r=Math.abs(r);const h=d*(o-e)*.5+f*(u-t)*.5,g=d*(u-t)*.5-f*(o-e)*.5;let p=h*h/(n*n)+g*g/(r*r);p>1&&(p=Math.sqrt(p),n*=p,r*=p);const v=d/n,m=f/n,y=-f/r,b=d/r,w=v*o+m*u,E=y*o+b*u,F=v*e+m*t,x=y*e+b*t;let S=1/((F-w)*(F-w)+(x-E)*(x-E))-.25;S<0&&(S=0);let _=Math.sqrt(S);a==i&&(_=-_);const k=.5*(w+F)-_*(x-E),T=.5*(E+x)+_*(F-w),A=Math.atan2(E-T,w-k);let M=Math.atan2(x-T,F-k)-A;M<0&&a===1?M+=Da:M>0&&a===0&&(M-=Da);const D=Math.ceil(Math.abs(M/(Yu+.001))),P=[];for(let N=0;N<D;++N){const O=A+N*M/D,q=A+(N+1)*M/D;P[N]=[k,T,O,q,n,r,f,d]}return yE[l]=P}function Lne(e){const t=HO.call(e);if(bE[t])return bE[t];var n=e[0],r=e[1],i=e[2],a=e[3],s=e[4],o=e[5],u=e[6],l=e[7];const c=l*s,f=-u*o,d=u*s,h=l*o,g=Math.cos(i),p=Math.sin(i),v=Math.cos(a),m=Math.sin(a),y=.5*(a-i),b=Math.sin(y*.5),w=8/3*b*b/Math.sin(y),E=n+g-w*p,F=r+p+w*g,x=n+v,C=r+m,S=x+w*m,_=C-w*v;return bE[t]=[c*E+f*F,d*E+h*F,c*S+f*_,d*S+h*_,c*x+f*C,d*x+h*C]}const vi=["l",0,0,0,0,0,0,0];function zne(e,t,n){const r=vi[0]=e[0];if(r==="a"||r==="A")vi[1]=t*e[1],vi[2]=n*e[2],vi[3]=e[3],vi[4]=e[4],vi[5]=e[5],vi[6]=t*e[6],vi[7]=n*e[7];else if(r==="h"||r==="H")vi[1]=t*e[1];else if(r==="v"||r==="V")vi[1]=n*e[1];else for(var i=1,a=e.length;i<a;++i)vi[i]=(i%2==1?t:n)*e[i];return vi}function sv(e,t,n,r,i,a){var s,o=null,u=0,l=0,c=0,f=0,d,h,g,p,v=0,m=0;n==null&&(n=0),r==null&&(r=0),i==null&&(i=1),a==null&&(a=i),e.beginPath&&e.beginPath();for(var y=0,b=t.length;y<b;++y){switch(s=t[y],(i!==1||a!==1)&&(s=zne(s,i,a)),s[0]){case"l":u+=s[1],l+=s[2],e.lineTo(u+n,l+r);break;case"L":u=s[1],l=s[2],e.lineTo(u+n,l+r);break;case"h":u+=s[1],e.lineTo(u+n,l+r);break;case"H":u=s[1],e.lineTo(u+n,l+r);break;case"v":l+=s[1],e.lineTo(u+n,l+r);break;case"V":l=s[1],e.lineTo(u+n,l+r);break;case"m":u+=s[1],l+=s[2],v=u,m=l,e.moveTo(u+n,l+r);break;case"M":u=s[1],l=s[2],v=u,m=l,e.moveTo(u+n,l+r);break;case"c":d=u+s[5],h=l+s[6],c=u+s[3],f=l+s[4],e.bezierCurveTo(u+s[1]+n,l+s[2]+r,c+n,f+r,d+n,h+r),u=d,l=h;break;case"C":u=s[5],l=s[6],c=s[3],f=s[4],e.bezierCurveTo(s[1]+n,s[2]+r,c+n,f+r,u+n,l+r);break;case"s":d=u+s[3],h=l+s[4],c=2*u-c,f=2*l-f,e.bezierCurveTo(c+n,f+r,u+s[1]+n,l+s[2]+r,d+n,h+r),c=u+s[1],f=l+s[2],u=d,l=h;break;case"S":d=s[3],h=s[4],c=2*u-c,f=2*l-f,e.bezierCurveTo(c+n,f+r,s[1]+n,s[2]+r,d+n,h+r),u=d,l=h,c=s[1],f=s[2];break;case"q":d=u+s[3],h=l+s[4],c=u+s[1],f=l+s[2],e.quadraticCurveTo(c+n,f+r,d+n,h+r),u=d,l=h;break;case"Q":d=s[3],h=s[4],e.quadraticCurveTo(s[1]+n,s[2]+r,d+n,h+r),u=d,l=h,c=s[1],f=s[2];break;case"t":d=u+s[1],h=l+s[2],o[0].match(/[QqTt]/)===null?(c=u,f=l):o[0]==="t"?(c=2*u-g,f=2*l-p):o[0]==="q"&&(c=2*u-c,f=2*l-f),g=c,p=f,e.quadraticCurveTo(c+n,f+r,d+n,h+r),u=d,l=h,c=u+s[1],f=l+s[2];break;case"T":d=s[1],h=s[2],c=2*u-c,f=2*l-f,e.quadraticCurveTo(c+n,f+r,d+n,h+r),u=d,l=h;break;case"a":jO(e,u+n,l+r,[s[1],s[2],s[3],s[4],s[5],s[6]+u+n,s[7]+l+r]),u+=s[6],l+=s[7];break;case"A":jO(e,u+n,l+r,[s[1],s[2],s[3],s[4],s[5],s[6]+n,s[7]+r]),u=s[6],l=s[7];break;case"z":case"Z":u=v,l=m,e.closePath();break}o=s}}function jO(e,t,n,r){const i=Bne(r[5],r[6],r[0],r[1],r[3],r[4],r[2],t,n);for(let a=0;a<i.length;++a){const s=Lne(i[a]);e.bezierCurveTo(s[0],s[1],s[2],s[3],s[4],s[5])}}const GO=.5773502691896257,YO={circle:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(n,0),e.arc(0,0,n,0,Da)}},cross:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/2.5;e.moveTo(-n,-r),e.lineTo(-n,r),e.lineTo(-r,r),e.lineTo(-r,n),e.lineTo(r,n),e.lineTo(r,r),e.lineTo(n,r),e.lineTo(n,-r),e.lineTo(r,-r),e.lineTo(r,-n),e.lineTo(-r,-n),e.lineTo(-r,-r),e.closePath()}},diamond:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.closePath()}},square:{draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},arrow:{draw:function(e,t){var n=Math.sqrt(t)/2,r=n/7,i=n/2.5,a=n/8;e.moveTo(-r,n),e.lineTo(r,n),e.lineTo(r,-a),e.lineTo(i,-a),e.lineTo(0,-n),e.lineTo(-i,-a),e.lineTo(-r,-a),e.closePath()}},wedge:{draw:function(e,t){var n=Math.sqrt(t)/2,r=Lc*n,i=r-n*GO,a=n/4;e.moveTo(0,-r-i),e.lineTo(-a,r-i),e.lineTo(a,r-i),e.closePath()}},triangle:{draw:function(e,t){var n=Math.sqrt(t)/2,r=Lc*n,i=r-n*GO;e.moveTo(0,-r-i),e.lineTo(-n,r-i),e.lineTo(n,r-i),e.closePath()}},"triangle-up":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Lc*n;e.moveTo(0,-r),e.lineTo(-n,r),e.lineTo(n,r),e.closePath()}},"triangle-down":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Lc*n;e.moveTo(0,r),e.lineTo(-n,-r),e.lineTo(n,-r),e.closePath()}},"triangle-right":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Lc*n;e.moveTo(r,0),e.lineTo(-r,-n),e.lineTo(-r,n),e.closePath()}},"triangle-left":{draw:function(e,t){var n=Math.sqrt(t)/2,r=Lc*n;e.moveTo(-r,0),e.lineTo(r,-n),e.lineTo(r,n),e.closePath()}},stroke:{draw:function(e,t){const n=Math.sqrt(t)/2;e.moveTo(-n,0),e.lineTo(n,0)}}};function qne(e){return xe(YO,e)?YO[e]:Une(e)}var wE={};function Une(e){if(!xe(wE,e)){const t=mE(e);wE[e]={draw:function(n,r){sv(n,t,0,0,Math.sqrt(r)/2)}}}return wE[e]}const Po=.448084975506;function Vne(e){return e.x}function Wne(e){return e.y}function Hne(e){return e.width}function jne(e){return e.height}function ks(e){return typeof e=="function"?e:()=>+e}function ov(e,t,n){return Math.max(t,Math.min(e,n))}function Gne(){var e=Vne,t=Wne,n=Hne,r=jne,i=ks(0),a=i,s=i,o=i,u=null;function l(c,f,d){var h,g=f??+e.call(this,c),p=d??+t.call(this,c),v=+n.call(this,c),m=+r.call(this,c),y=Math.min(v,m)/2,b=ov(+i.call(this,c),0,y),w=ov(+a.call(this,c),0,y),E=ov(+s.call(this,c),0,y),F=ov(+o.call(this,c),0,y);if(u||(u=h=Sx()),b<=0&&w<=0&&E<=0&&F<=0)u.rect(g,p,v,m);else{var x=g+v,C=p+m;u.moveTo(g+b,p),u.lineTo(x-w,p),u.bezierCurveTo(x-Po*w,p,x,p+Po*w,x,p+w),u.lineTo(x,C-F),u.bezierCurveTo(x,C-Po*F,x-Po*F,C,x-F,C),u.lineTo(g+E,C),u.bezierCurveTo(g+Po*E,C,g,C-Po*E,g,C-E),u.lineTo(g,p+b),u.bezierCurveTo(g,p+Po*b,g+Po*b,p,g+b,p),u.closePath()}if(h)return u=null,h+""||null}return l.x=function(c){return arguments.length?(e=ks(c),l):e},l.y=function(c){return arguments.length?(t=ks(c),l):t},l.width=function(c){return arguments.length?(n=ks(c),l):n},l.height=function(c){return arguments.length?(r=ks(c),l):r},l.cornerRadius=function(c,f,d,h){return arguments.length?(i=ks(c),a=f!=null?ks(f):i,o=d!=null?ks(d):i,s=h!=null?ks(h):a,l):i},l.context=function(c){return arguments.length?(u=c??null,l):u},l}function Yne(){var e,t,n,r,i=null,a,s,o,u;function l(f,d,h){const g=h/2;if(a){var p=o-d,v=f-s;if(p||v){var m=Math.hypot(p,v),y=(p/=m)*u,b=(v/=m)*u,w=Math.atan2(v,p);i.moveTo(s-y,o-b),i.lineTo(f-p*g,d-v*g),i.arc(f,d,g,w-Math.PI,w),i.lineTo(s+y,o+b),i.arc(s,o,u,w,w+Math.PI)}else i.arc(f,d,g,0,Da);i.closePath()}else a=1;s=f,o=d,u=g}function c(f){var d,h=f.length,g,p=!1,v;for(i==null&&(i=v=Sx()),d=0;d<=h;++d)!(d<h&&r(g=f[d],d,f))===p&&(p=!p)&&(a=0),p&&l(+e(g,d,f),+t(g,d,f),+n(g,d,f));if(v)return i=null,v+""||null}return c.x=function(f){return arguments.length?(e=f,c):e},c.y=function(f){return arguments.length?(t=f,c):t},c.size=function(f){return arguments.length?(n=f,c):n},c.defined=function(f){return arguments.length?(r=f,c):r},c.context=function(f){return arguments.length?(f==null?i=null:i=f,c):i},c}function hh(e,t){return e??t}const gh=e=>e.x||0,ph=e=>e.y||0,Xne=e=>e.width||0,Kne=e=>e.height||0,Zne=e=>(e.x||0)+(e.width||0),Qne=e=>(e.y||0)+(e.height||0),Jne=e=>e.startAngle||0,ere=e=>e.endAngle||0,tre=e=>e.padAngle||0,nre=e=>e.innerRadius||0,rre=e=>e.outerRadius||0,ire=e=>e.cornerRadius||0,are=e=>hh(e.cornerRadiusTopLeft,e.cornerRadius)||0,sre=e=>hh(e.cornerRadiusTopRight,e.cornerRadius)||0,ore=e=>hh(e.cornerRadiusBottomRight,e.cornerRadius)||0,ure=e=>hh(e.cornerRadiusBottomLeft,e.cornerRadius)||0,lre=e=>hh(e.size,64),cre=e=>e.size||1,uv=e=>e.defined!==!1,fre=e=>qne(e.shape||"circle"),dre=wee().startAngle(Jne).endAngle(ere).padAngle(tre).innerRadius(nre).outerRadius(rre).cornerRadius(ire),hre=XP().x(gh).y1(ph).y0(Qne).defined(uv),gre=XP().y(ph).x1(gh).x0(Zne).defined(uv),pre=YP().x(gh).y(ph).defined(uv),vre=Gne().x(gh).y(ph).width(Xne).height(Kne).cornerRadius(are,sre,ore,ure),mre=Eee().type(fre).size(lre),yre=Yne().x(gh).y(ph).defined(uv).size(cre);function xE(e){return e.cornerRadius||e.cornerRadiusTopLeft||e.cornerRadiusTopRight||e.cornerRadiusBottomRight||e.cornerRadiusBottomLeft}function bre(e,t){return dre.context(e)(t)}function wre(e,t){const n=t[0],r=n.interpolate||"linear";return(n.orient==="horizontal"?gre:hre).curve(WO(r,n.orient,n.tension)).context(e)(t)}function xre(e,t){const n=t[0],r=n.interpolate||"linear";return pre.curve(WO(r,n.orient,n.tension)).context(e)(t)}function zc(e,t,n,r){return vre.context(e)(t,n,r)}function Ere(e,t){return(t.mark.shape||t.shape).context(e)(t)}function Fre(e,t){return mre.context(e)(t)}function Sre(e,t){return yre.context(e)(t)}var Cre=1;function EE(e,t,n){var r=t.clip,i=e._defs,a=t.clip_id||(t.clip_id="clip"+Cre++),s=i.clipping[a]||(i.clipping[a]={id:a});return Ke(r)?s.path=r(null):xE(n)?s.path=zc(null,n,0,0):(s.width=n.width||0,s.height=n.height||0),"url(#"+a+")"}function ln(e){this.clear(),e&&this.union(e)}ln.prototype={clone(){return new ln(this)},clear(){return this.x1=+Number.MAX_VALUE,this.y1=+Number.MAX_VALUE,this.x2=-Number.MAX_VALUE,this.y2=-Number.MAX_VALUE,this},empty(){return this.x1===+Number.MAX_VALUE&&this.y1===+Number.MAX_VALUE&&this.x2===-Number.MAX_VALUE&&this.y2===-Number.MAX_VALUE},equals(e){return this.x1===e.x1&&this.y1===e.y1&&this.x2===e.x2&&this.y2===e.y2},set(e,t,n,r){return n<e?(this.x2=e,this.x1=n):(this.x1=e,this.x2=n),r<t?(this.y2=t,this.y1=r):(this.y1=t,this.y2=r),this},add(e,t){return e<this.x1&&(this.x1=e),t<this.y1&&(this.y1=t),e>this.x2&&(this.x2=e),t>this.y2&&(this.y2=t),this},expand(e){return this.x1-=e,this.y1-=e,this.x2+=e,this.y2+=e,this},round(){return this.x1=Math.floor(this.x1),this.y1=Math.floor(this.y1),this.x2=Math.ceil(this.x2),this.y2=Math.ceil(this.y2),this},scale(e){return this.x1*=e,this.y1*=e,this.x2*=e,this.y2*=e,this},translate(e,t){return this.x1+=e,this.x2+=e,this.y1+=t,this.y2+=t,this},rotate(e,t,n){const r=this.rotatedPoints(e,t,n);return this.clear().add(r[0],r[1]).add(r[2],r[3]).add(r[4],r[5]).add(r[6],r[7])},rotatedPoints(e,t,n){var{x1:r,y1:i,x2:a,y2:s}=this,o=Math.cos(e),u=Math.sin(e),l=t-t*o+n*u,c=n-t*u-n*o;return[o*r-u*i+l,u*r+o*i+c,o*r-u*s+l,u*r+o*s+c,o*a-u*i+l,u*a+o*i+c,o*a-u*s+l,u*a+o*s+c]},union(e){return e.x1<this.x1&&(this.x1=e.x1),e.y1<this.y1&&(this.y1=e.y1),e.x2>this.x2&&(this.x2=e.x2),e.y2>this.y2&&(this.y2=e.y2),this},intersect(e){return e.x1>this.x1&&(this.x1=e.x1),e.y1>this.y1&&(this.y1=e.y1),e.x2<this.x2&&(this.x2=e.x2),e.y2<this.y2&&(this.y2=e.y2),this},encloses(e){return e&&this.x1<=e.x1&&this.x2>=e.x2&&this.y1<=e.y1&&this.y2>=e.y2},alignsWith(e){return e&&(this.x1==e.x1||this.x2==e.x2||this.y1==e.y1||this.y2==e.y2)},intersects(e){return e&&!(this.x2<e.x1||this.x1>e.x2||this.y2<e.y1||this.y1>e.y2)},contains(e,t){return!(e<this.x1||e>this.x2||t<this.y1||t>this.y2)},width(){return this.x2-this.x1},height(){return this.y2-this.y1}};function FE(e){this.mark=e,this.bounds=this.bounds||new ln}function SE(e){FE.call(this,e),this.items=this.items||[]}ge(SE,FE);class kre{constructor(t){this._pending=0,this._loader=t||Nw()}pending(){return this._pending}sanitizeURL(t){const n=this;return XO(n),n._loader.sanitize(t,{context:"href"}).then(r=>(vh(n),r)).catch(()=>(vh(n),null))}loadImage(t){const n=this,r=zee();return XO(n),n._loader.sanitize(t,{context:"image"}).then(i=>{const a=i.href;if(!a||!r)throw{url:a};const s=new r,o=xe(i,"crossOrigin")?i.crossOrigin:"anonymous";return o!=null&&(s.crossOrigin=o),s.onload=()=>vh(n),s.onerror=()=>vh(n),s.src=a,s}).catch(i=>(vh(n),{complete:!1,width:0,height:0,src:i&&i.url||""}))}ready(){const t=this;return new Promise(n=>{function r(i){t.pending()?setTimeout(()=>{r(!0)},10):n(i)}r(!1)})}}function XO(e){e._pending+=1}function vh(e){e._pending-=1}function No(e,t,n){if(t.stroke&&t.opacity!==0&&t.strokeOpacity!==0){const r=t.strokeWidth!=null?+t.strokeWidth:1;e.expand(r+(n?_re(t,r):0))}return e}function _re(e,t){return e.strokeJoin&&e.strokeJoin!=="miter"?0:t}const Are=Da-1e-8;let lv,cv,fv,Xu,CE,dv,kE,_E;const Oo=(e,t)=>lv.add(e,t),hv=(e,t)=>Oo(cv=e,fv=t),KO=e=>Oo(e,lv.y1),ZO=e=>Oo(lv.x1,e),Ku=(e,t)=>CE*e+kE*t,Zu=(e,t)=>dv*e+_E*t,AE=(e,t)=>Oo(Ku(e,t),Zu(e,t)),TE=(e,t)=>hv(Ku(e,t),Zu(e,t));function gv(e,t){return lv=e,t?(Xu=t*Ro,CE=_E=Math.cos(Xu),dv=Math.sin(Xu),kE=-dv):(CE=_E=1,Xu=dv=kE=0),Tre}const Tre={beginPath(){},closePath(){},moveTo:TE,lineTo:TE,rect(e,t,n,r){Xu?(AE(e+n,t),AE(e+n,t+r),AE(e,t+r),TE(e,t)):(Oo(e+n,t+r),hv(e,t))},quadraticCurveTo(e,t,n,r){const i=Ku(e,t),a=Zu(e,t),s=Ku(n,r),o=Zu(n,r);QO(cv,i,s,KO),QO(fv,a,o,ZO),hv(s,o)},bezierCurveTo(e,t,n,r,i,a){const s=Ku(e,t),o=Zu(e,t),u=Ku(n,r),l=Zu(n,r),c=Ku(i,a),f=Zu(i,a);JO(cv,s,u,c,KO),JO(fv,o,l,f,ZO),hv(c,f)},arc(e,t,n,r,i,a){if(r+=Xu,i+=Xu,cv=n*Math.cos(i)+e,fv=n*Math.sin(i)+t,Math.abs(i-r)>Are)Oo(e-n,t-n),Oo(e+n,t+n);else{const s=l=>Oo(n*Math.cos(l)+e,n*Math.sin(l)+t);let o,u;if(s(r),s(i),i!==r)if(r=r%Da,r<0&&(r+=Da),i=i%Da,i<0&&(i+=Da),i<r&&(a=!a,o=r,r=i,i=o),a)for(i-=Da,o=r-r%Yu,u=0;u<4&&o>i;++u,o-=Yu)s(o);else for(o=r-r%Yu+Yu,u=0;u<4&&o<i;++u,o=o+Yu)s(o)}}};function QO(e,t,n,r){const i=(e-t)/(e+n-2*t);0<i&&i<1&&r(e+(t-e)*i)}function JO(e,t,n,r,i){const a=r-e+3*t-3*n,s=e+n-2*t,o=e-t;let u=0,l=0,c;Math.abs(a)>Ine?(c=s*s+o*a,c>=0&&(c=Math.sqrt(c),u=(-s+c)/a,l=(-s-c)/a)):u=.5*o/s,0<u&&u<1&&i(e5(u,e,t,n,r)),0<l&&l<1&&i(e5(l,e,t,n,r))}function e5(e,t,n,r,i){const a=1-e,s=a*a,o=e*e;return s*a*t+3*s*e*n+3*a*o*r+o*e*i}var Io=(Io=_o(1,1))?Io.getContext("2d"):null;const ME=new ln;function t5(e){return function(t,n){if(!Io)return!0;e(Io,t),ME.clear().union(t.bounds).intersect(n).round();const{x1:r,y1:i,x2:a,y2:s}=ME;for(let o=i;o<=s;++o)for(let u=r;u<=a;++u)if(Io.isPointInPath(u,o))return!0;return!1}}function n5(e,t){return t.contains(e.x||0,e.y||0)}function r5(e,t){const n=e.x||0,r=e.y||0,i=e.width||0,a=e.height||0;return t.intersects(ME.set(n,r,n+i,r+a))}function Mre(e,t){const n=e.x||0,r=e.y||0,i=e.x2!=null?e.x2:n,a=e.y2!=null?e.y2:r;return mh(t,n,r,i,a)}function mh(e,t,n,r,i){const{x1:a,y1:s,x2:o,y2:u}=e,l=r-t,c=i-n;let f=0,d=1,h,g,p,v;for(v=0;v<4;++v){if(v===0&&(h=-l,g=-(a-t)),v===1&&(h=l,g=o-t),v===2&&(h=-c,g=-(s-n)),v===3&&(h=c,g=u-n),Math.abs(h)<1e-10&&g<0)return!1;if(p=g/h,h<0){if(p>d)return!1;p>f&&(f=p)}else if(h>0){if(p<f)return!1;p<d&&(d=p)}}return!0}function qc(e,t){e.globalCompositeOperation=t.blend||"source-over"}function zi(e,t){return e??t}function i5(e,t){const n=t.length;for(let r=0;r<n;++r)e.addColorStop(t[r].offset,t[r].color);return e}function $re(e,t,n){const r=n.width(),i=n.height();let a;if(t.gradient==="radial")a=e.createRadialGradient(n.x1+zi(t.x1,.5)*r,n.y1+zi(t.y1,.5)*i,Math.max(r,i)*zi(t.r1,0),n.x1+zi(t.x2,.5)*r,n.y1+zi(t.y2,.5)*i,Math.max(r,i)*zi(t.r2,.5));else{const s=zi(t.x1,0),o=zi(t.y1,0),u=zi(t.x2,1),l=zi(t.y2,0);if(s===u||o===l||r===i)a=e.createLinearGradient(n.x1+s*r,n.y1+o*i,n.x1+u*r,n.y1+l*i);else{const c=_o(Math.ceil(r),Math.ceil(i)),f=c.getContext("2d");return f.scale(r,i),f.fillStyle=i5(f.createLinearGradient(s,o,u,l),t.stops),f.fillRect(0,0,r,i),e.createPattern(c,"no-repeat")}}return i5(a,t.stops)}function a5(e,t,n){return vE(n)?$re(e,n,t.bounds):n}function pv(e,t,n){return n*=t.fillOpacity==null?1:t.fillOpacity,n>0?(e.globalAlpha=n,e.fillStyle=a5(e,t,t.fill),!0):!1}var Dre=[];function Uc(e,t,n){var r=(r=t.strokeWidth)!=null?r:1;return r<=0?!1:(n*=t.strokeOpacity==null?1:t.strokeOpacity,n>0?(e.globalAlpha=n,e.strokeStyle=a5(e,t,t.stroke),e.lineWidth=r,e.lineCap=t.strokeCap||"butt",e.lineJoin=t.strokeJoin||"miter",e.miterLimit=t.strokeMiterLimit||10,e.setLineDash&&(e.setLineDash(t.strokeDash||Dre),e.lineDashOffset=t.strokeDashOffset||0),!0):!1)}function Rre(e,t){return e.zindex-t.zindex||e.index-t.index}function s5(e){if(!e.zdirty)return e.zitems;var t=e.items,n=[],r,i,a;for(i=0,a=t.length;i<a;++i)r=t[i],r.index=i,r.zindex&&n.push(r);return e.zdirty=!1,e.zitems=n.sort(Rre)}function Ra(e,t){var n=e.items,r,i;if(!n||!n.length)return;const a=s5(e);if(a&&a.length){for(r=0,i=n.length;r<i;++r)n[r].zindex||t(n[r]);n=a}for(r=0,i=n.length;r<i;++r)t(n[r])}function $E(e,t){var n=e.items,r,i;if(!n||!n.length)return null;const a=s5(e);for(a&&a.length&&(n=a),i=n.length;--i>=0;)if(r=t(n[i]))return r;if(n===a){for(n=e.items,i=n.length;--i>=0;)if(!n[i].zindex&&(r=t(n[i])))return r}return null}function DE(e){return function(t,n,r){Ra(n,i=>{(!r||r.intersects(i.bounds))&&o5(e,t,i,i)})}}function Pre(e){return function(t,n,r){n.items.length&&(!r||r.intersects(n.bounds))&&o5(e,t,n.items[0],n.items)}}function o5(e,t,n,r){var i=n.opacity==null?1:n.opacity;i!==0&&(e(t,r)||(qc(t,n),n.fill&&pv(t,n,i)&&t.fill(),n.stroke&&Uc(t,n,i)&&t.stroke()))}function vv(e){return e=e||Oi,function(t,n,r,i,a,s){return r*=t.pixelRatio,i*=t.pixelRatio,$E(n,o=>{const u=o.bounds;if(!(u&&!u.contains(a,s)||!u)&&e(t,o,r,i,a,s))return o})}}function yh(e,t){return function(n,r,i,a){var s=Array.isArray(r)?r[0]:r,o=t??s.fill,u=s.stroke&&n.isPointInStroke,l,c;return u&&(l=s.strokeWidth,c=s.strokeCap,n.lineWidth=l??1,n.lineCap=c??"butt"),e(n,r)?!1:o&&n.isPointInPath(i,a)||u&&n.isPointInStroke(i,a)}}function RE(e){return vv(yh(e))}function Qu(e,t){return"translate("+e+","+t+")"}function PE(e){return"rotate("+e+")"}function Nre(e,t){return"scale("+e+","+t+")"}function u5(e){return Qu(e.x||0,e.y||0)}function Ore(e){return Qu(e.x||0,e.y||0)+(e.angle?" "+PE(e.angle):"")}function Ire(e){return Qu(e.x||0,e.y||0)+(e.angle?" "+PE(e.angle):"")+(e.scaleX||e.scaleY?" "+Nre(e.scaleX||1,e.scaleY||1):"")}function NE(e,t,n){function r(s,o){s("transform",Ore(o)),s("d",t(null,o))}function i(s,o){return t(gv(s,o.angle),o),No(s,o).translate(o.x||0,o.y||0)}function a(s,o){var u=o.x||0,l=o.y||0,c=o.angle||0;s.translate(u,l),c&&s.rotate(c*=Ro),s.beginPath(),t(s,o),c&&s.rotate(-c),s.translate(-u,-l)}return{type:e,tag:"path",nested:!1,attr:r,bound:i,draw:DE(a),pick:RE(a),isect:n||t5(a)}}var Bre=NE("arc",bre);function Lre(e,t){for(var n=e[0].orient==="horizontal"?t[1]:t[0],r=e[0].orient==="horizontal"?"y":"x",i=e.length,a=1/0,s,o;--i>=0;)e[i].defined!==!1&&(o=Math.abs(e[i][r]-n),o<a&&(a=o,s=e[i]));return s}function zre(e,t){for(var n=Math.pow(e[0].strokeWidth||1,2),r=e.length,i,a,s;--r>=0;)if(e[r].defined!==!1&&(i=e[r].x-t[0],a=e[r].y-t[1],s=i*i+a*a,s<n))return e[r];return null}function qre(e,t){for(var n=e.length,r,i,a;--n>=0;)if(e[n].defined!==!1&&(r=e[n].x-t[0],i=e[n].y-t[1],a=r*r+i*i,r=e[n].size||1,a<r*r))return e[n];return null}function OE(e,t,n){function r(u,l){var c=l.mark.items;c.length&&u("d",t(null,c))}function i(u,l){var c=l.items;return c.length===0?u:(t(gv(u),c),No(u,c[0]))}function a(u,l){u.beginPath(),t(u,l)}const s=yh(a);function o(u,l,c,f,d,h){var g=l.items,p=l.bounds;return!g||!g.length||p&&!p.contains(d,h)?null:(c*=u.pixelRatio,f*=u.pixelRatio,s(u,g,c,f)?g[0]:null)}return{type:e,tag:"path",nested:!0,attr:r,bound:i,draw:Pre(a),pick:o,isect:n5,tip:n}}var Ure=OE("area",wre,Lre);function Vre(e,t){var n=t.clip;e.save(),Ke(n)?(e.beginPath(),n(e),e.clip()):l5(e,t.group)}function l5(e,t){e.beginPath(),xE(t)?zc(e,t,0,0):e.rect(0,0,t.width||0,t.height||0),e.clip()}function c5(e){const t=zi(e.strokeWidth,1);return e.strokeOffset!=null?e.strokeOffset:e.stroke&&t>.5&&t<1.5?.5-Math.abs(t-1):0}function Wre(e,t){e("transform",u5(t))}function f5(e,t){const n=c5(t);e("d",zc(null,t,n,n))}function Hre(e,t){e("class","background"),e("aria-hidden",!0),f5(e,t)}function jre(e,t){e("class","foreground"),e("aria-hidden",!0),t.strokeForeground?f5(e,t):e("d","")}function Gre(e,t,n){const r=t.clip?EE(n,t,t):null;e("clip-path",r)}function Yre(e,t){if(!t.clip&&t.items){const n=t.items,r=n.length;for(let i=0;i<r;++i)e.union(n[i].bounds)}return(t.clip||t.width||t.height)&&!t.noBound&&e.add(0,0).add(t.width||0,t.height||0),No(e,t),e.translate(t.x||0,t.y||0)}function bh(e,t,n,r){const i=c5(t);e.beginPath(),zc(e,t,(n||0)+i,(r||0)+i)}const Xre=yh(bh),Kre=yh(bh,!1),Zre=yh(bh,!0);function Qre(e,t,n,r){Ra(t,i=>{const a=i.x||0,s=i.y||0,o=i.strokeForeground,u=i.opacity==null?1:i.opacity;(i.stroke||i.fill)&&u&&(bh(e,i,a,s),qc(e,i),i.fill&&pv(e,i,u)&&e.fill(),i.stroke&&!o&&Uc(e,i,u)&&e.stroke()),e.save(),e.translate(a,s),i.clip&&l5(e,i),n&&n.translate(-a,-s),Ra(i,l=>{(l.marktype==="group"||r==null||r.includes(l.marktype))&&this.draw(e,l,n,r)}),n&&n.translate(a,s),e.restore(),o&&i.stroke&&u&&(bh(e,i,a,s),qc(e,i),Uc(e,i,u)&&e.stroke())})}function Jre(e,t,n,r,i,a){if(t.bounds&&!t.bounds.contains(i,a)||!t.items)return null;const s=n*e.pixelRatio,o=r*e.pixelRatio;return $E(t,u=>{let l,c,f;const d=u.bounds;if(d&&!d.contains(i,a))return;c=u.x||0,f=u.y||0;const h=c+(u.width||0),g=f+(u.height||0),p=u.clip;if(p&&(i<c||i>h||a<f||a>g))return;if(e.save(),e.translate(c,f),c=i-c,f=a-f,p&&xE(u)&&!Zre(e,u,s,o))return e.restore(),null;const v=u.strokeForeground,m=t.interactive!==!1;return m&&v&&u.stroke&&Kre(e,u,s,o)?(e.restore(),u):(l=$E(u,y=>eie(y,c,f)?this.pick(y,n,r,c,f):null),!l&&m&&(u.fill||!v&&u.stroke)&&Xre(e,u,s,o)&&(l=u),e.restore(),l||null)})}function eie(e,t,n){return(e.interactive!==!1||e.marktype==="group")&&e.bounds&&e.bounds.contains(t,n)}var tie={type:"group",tag:"g",nested:!1,attr:Wre,bound:Yre,draw:Qre,pick:Jre,isect:r5,content:Gre,background:Hre,foreground:jre},wh={xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"};function IE(e,t){var n=e.image;return(!n||e.url&&e.url!==n.url)&&(n={complete:!1,width:0,height:0},t.loadImage(e.url).then(r=>{e.image=r,e.image.url=e.url})),n}function BE(e,t){return e.width!=null?e.width:!t||!t.width?0:e.aspect!==!1&&e.height?e.height*t.width/t.height:t.width}function LE(e,t){return e.height!=null?e.height:!t||!t.height?0:e.aspect!==!1&&e.width?e.width*t.height/t.width:t.height}function mv(e,t){return e==="center"?t/2:e==="right"?t:0}function yv(e,t){return e==="middle"?t/2:e==="bottom"?t:0}function nie(e,t,n){const r=IE(t,n),i=BE(t,r),a=LE(t,r),s=(t.x||0)-mv(t.align,i),o=(t.y||0)-yv(t.baseline,a),u=!r.src&&r.toDataURL?r.toDataURL():r.src||"";e("href",u,wh["xmlns:xlink"],"xlink:href"),e("transform",Qu(s,o)),e("width",i),e("height",a),e("preserveAspectRatio",t.aspect===!1?"none":"xMidYMid")}function rie(e,t){const n=t.image,r=BE(t,n),i=LE(t,n),a=(t.x||0)-mv(t.align,r),s=(t.y||0)-yv(t.baseline,i);return e.set(a,s,a+r,s+i)}function iie(e,t,n){Ra(t,r=>{if(n&&!n.intersects(r.bounds))return;const i=IE(r,this);let a=BE(r,i),s=LE(r,i);if(a===0||s===0)return;let o=(r.x||0)-mv(r.align,a),u=(r.y||0)-yv(r.baseline,s),l,c,f,d;r.aspect!==!1&&(c=i.width/i.height,f=r.width/r.height,c===c&&f===f&&c!==f&&(f<c?(d=a/c,u+=(s-d)/2,s=d):(d=s*c,o+=(a-d)/2,a=d))),(i.complete||i.toDataURL)&&(qc(e,r),e.globalAlpha=(l=r.opacity)!=null?l:1,e.imageSmoothingEnabled=r.smooth!==!1,e.drawImage(i,o,u,a,s))})}var aie={type:"image",tag:"image",nested:!1,attr:nie,bound:rie,draw:iie,pick:vv(),isect:Oi,get:IE,xOffset:mv,yOffset:yv},sie=OE("line",xre,zre);function oie(e,t){var n=t.scaleX||1,r=t.scaleY||1;(n!==1||r!==1)&&e("vector-effect","non-scaling-stroke"),e("transform",Ire(t)),e("d",t.path)}function bv(e,t){var n=t.path;if(n==null)return!0;var r=t.x||0,i=t.y||0,a=t.scaleX||1,s=t.scaleY||1,o=(t.angle||0)*Ro,u=t.pathCache;(!u||u.path!==n)&&((t.pathCache=u=mE(n)).path=n),o&&e.rotate&&e.translate?(e.translate(r,i),e.rotate(o),sv(e,u,0,0,a,s),e.rotate(-o),e.translate(-r,-i)):sv(e,u,r,i,a,s)}function uie(e,t){return bv(gv(e,t.angle),t)?e.set(0,0,0,0):No(e,t,!0)}var lie={type:"path",tag:"path",nested:!1,attr:oie,bound:uie,draw:DE(bv),pick:RE(bv),isect:t5(bv)};function cie(e,t){e("d",zc(null,t))}function fie(e,t){var n,r;return No(e.set(n=t.x||0,r=t.y||0,n+t.width||0,r+t.height||0),t)}function d5(e,t){e.beginPath(),zc(e,t)}var die={type:"rect",tag:"path",nested:!1,attr:cie,bound:fie,draw:DE(d5),pick:RE(d5),isect:r5};function hie(e,t){e("transform",u5(t)),e("x2",t.x2!=null?t.x2-(t.x||0):0),e("y2",t.y2!=null?t.y2-(t.y||0):0)}function gie(e,t){var n,r;return No(e.set(n=t.x||0,r=t.y||0,t.x2!=null?t.x2:n,t.y2!=null?t.y2:r),t)}function h5(e,t,n){var r,i,a,s;return t.stroke&&Uc(e,t,n)?(r=t.x||0,i=t.y||0,a=t.x2!=null?t.x2:r,s=t.y2!=null?t.y2:i,e.beginPath(),e.moveTo(r,i),e.lineTo(a,s),!0):!1}function pie(e,t,n){Ra(t,r=>{if(!(n&&!n.intersects(r.bounds))){var i=r.opacity==null?1:r.opacity;i&&h5(e,r,i)&&(qc(e,r),e.stroke())}})}function vie(e,t,n,r){return e.isPointInStroke?h5(e,t,1)&&e.isPointInStroke(n,r):!1}var mie={type:"rule",tag:"line",nested:!1,attr:hie,bound:gie,draw:pie,pick:vv(vie),isect:Mre},yie=NE("shape",Ere),bie=NE("symbol",Fre,n5);const g5=xX();var mi={height:_s,measureWidth:zE,estimateWidth:wv,width:wv,canvas:p5};p5(!0);function p5(e){mi.width=e&&Io?zE:wv}function wv(e,t){return v5(Bo(e,t),_s(e))}function v5(e,t){return~~(.8*e.length*t)}function zE(e,t){return _s(e)<=0||!(t=Bo(e,t))?0:m5(t,qE(e))}function m5(e,t){const n=`(${t}) ${e}`;let r=g5.get(n);return r===void 0&&(Io.font=t,r=Io.measureText(e).width,g5.set(n,r)),r}function _s(e){return e.fontSize!=null?+e.fontSize||0:11}function Ju(e){return e.lineHeight!=null?e.lineHeight:_s(e)+2}function wie(e){return ee(e)?e.length>1?e:e[0]:e}function xh(e){return wie(e.lineBreak&&e.text&&!ee(e.text)?e.text.split(e.lineBreak):e.text)}function y5(e){const t=xh(e);return(ee(t)?t.length-1:0)*Ju(e)}function Bo(e,t){const n=t==null?"":(t+"").trim();return e.limit>0&&n.length?Eie(e,n):n}function xie(e){if(mi.width===zE){const t=qE(e);return n=>m5(n,t)}else if(mi.width===wv){const t=_s(e);return n=>v5(n,t)}else return t=>mi.width(e,t)}function Eie(e,t){var n=+e.limit,r=xie(e);if(r(t)<n)return t;var i=e.ellipsis||"…",a=e.dir==="rtl",s=0,o=t.length,u;if(n-=r(i),a){for(;s<o;)u=s+o>>>1,r(t.slice(u))>n?s=u+1:o=u;return i+t.slice(s)}else{for(;s<o;)u=1+(s+o>>>1),r(t.slice(0,u))<n?s=u:o=u-1;return t.slice(0,s)+i}}function xv(e,t){var n=e.font;return(t&&n?String(n).replace(/"/g,"'"):n)||"sans-serif"}function qE(e,t){return(e.fontStyle?e.fontStyle+" ":"")+(e.fontVariant?e.fontVariant+" ":"")+(e.fontWeight?e.fontWeight+" ":"")+_s(e)+"px "+xv(e,t)}function UE(e){var t=e.baseline,n=_s(e);return Math.round(t==="top"?.79*n:t==="middle"?.3*n:t==="bottom"?-.21*n:t==="line-top"?.29*n+.5*Ju(e):t==="line-bottom"?.29*n-.5*Ju(e):0)}const Fie={left:"start",center:"middle",right:"end"},Eh=new ln;function Ev(e){var t=e.x||0,n=e.y||0,r=e.radius||0,i;return r&&(i=(e.theta||0)-Yu,t+=r*Math.cos(i),n+=r*Math.sin(i)),Eh.x1=t,Eh.y1=n,Eh}function Sie(e,t){var n=t.dx||0,r=(t.dy||0)+UE(t),i=Ev(t),a=i.x1,s=i.y1,o=t.angle||0,u;e("text-anchor",Fie[t.align]||"start"),o?(u=Qu(a,s)+" "+PE(o),(n||r)&&(u+=" "+Qu(n,r))):u=Qu(a+n,s+r),e("transform",u)}function VE(e,t,n){var r=mi.height(t),i=t.align,a=Ev(t),s=a.x1,o=a.y1,u=t.dx||0,l=(t.dy||0)+UE(t)-Math.round(.8*r),c=xh(t),f;if(ee(c)?(r+=Ju(t)*(c.length-1),f=c.reduce((d,h)=>Math.max(d,mi.width(t,h)),0)):f=mi.width(t,c),i==="center"?u-=f/2:i==="right"&&(u-=f),e.set(u+=s,l+=o,u+f,l+r),t.angle&&!n)e.rotate(t.angle*Ro,s,o);else if(n===2)return e.rotatedPoints(t.angle*Ro,s,o);return e}function Cie(e,t,n){Ra(t,r=>{var i=r.opacity==null?1:r.opacity,a,s,o,u,l,c,f;if(!(n&&!n.intersects(r.bounds)||i===0||r.fontSize<=0||r.text==null||r.text.length===0)){if(e.font=qE(r),e.textAlign=r.align||"left",a=Ev(r),s=a.x1,o=a.y1,r.angle&&(e.save(),e.translate(s,o),e.rotate(r.angle*Ro),s=o=0),s+=r.dx||0,o+=(r.dy||0)+UE(r),c=xh(r),qc(e,r),ee(c))for(l=Ju(r),u=0;u<c.length;++u)f=Bo(r,c[u]),r.fill&&pv(e,r,i)&&e.fillText(f,s,o),r.stroke&&Uc(e,r,i)&&e.strokeText(f,s,o),o+=l;else f=Bo(r,c),r.fill&&pv(e,r,i)&&e.fillText(f,s,o),r.stroke&&Uc(e,r,i)&&e.strokeText(f,s,o);r.angle&&e.restore()}})}function kie(e,t,n,r,i,a){if(t.fontSize<=0)return!1;if(!t.angle)return!0;var s=Ev(t),o=s.x1,u=s.y1,l=VE(Eh,t,1),c=-t.angle*Ro,f=Math.cos(c),d=Math.sin(c),h=f*i-d*a+(o-f*o+d*u),g=d*i+f*a+(u-d*o-f*u);return l.contains(h,g)}function _ie(e,t){const n=VE(Eh,e,2);return mh(t,n[0],n[1],n[2],n[3])||mh(t,n[0],n[1],n[4],n[5])||mh(t,n[4],n[5],n[6],n[7])||mh(t,n[2],n[3],n[6],n[7])}var Aie={type:"text",tag:"text",nested:!1,attr:Sie,bound:VE,draw:Cie,pick:vv(kie),isect:_ie},Tie=OE("trail",Sre,qre),yi={arc:Bre,area:Ure,group:tie,image:aie,line:sie,path:lie,rect:die,rule:mie,shape:yie,symbol:bie,text:Aie,trail:Tie};function b5(e,t,n){var r=yi[e.mark.marktype],i=t||r.bound;return r.nested&&(e=e.mark),i(e.bounds||(e.bounds=new ln),e,n)}var w5={mark:null};function Mie(e,t,n){var r=yi[e.marktype],i=r.bound,a=e.items,s=a&&a.length,o,u,l,c;if(r.nested)return s?l=a[0]:(w5.mark=e,l=w5),c=b5(l,i,n),t=t&&t.union(c)||c,t;if(t=t||e.bounds&&e.bounds.clear()||new ln,s)for(o=0,u=a.length;o<u;++o)t.union(b5(a[o],i,n));return e.bounds=t}const $ie=["marktype","name","role","interactive","clip","items","zindex","x","y","width","height","align","baseline","fill","fillOpacity","opacity","blend","stroke","strokeOpacity","strokeWidth","strokeCap","strokeDash","strokeDashOffset","strokeForeground","strokeOffset","startAngle","endAngle","innerRadius","outerRadius","cornerRadius","padAngle","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","interpolate","tension","orient","defined","url","aspect","smooth","path","scaleX","scaleY","x2","y2","size","shape","text","angle","theta","radius","dir","dx","dy","ellipsis","limit","lineBreak","lineHeight","font","fontSize","fontWeight","fontStyle","fontVariant","description","aria","ariaRole","ariaRoleDescription"];function Die(e,t){return JSON.stringify(e,$ie,t)}function Rie(e){const t=typeof e=="string"?JSON.parse(e):e;return x5(t)}function x5(e){var t=e.marktype,n=e.items,r,i,a;if(n)for(i=0,a=n.length;i<a;++i)r=t?"mark":"group",n[i][r]=e,n[i].zindex&&(n[i][r].zdirty=!0),(t||r)==="group"&&x5(n[i]);return t&&Mie(e),e}class Pie{constructor(t){arguments.length?this.root=Rie(t):(this.root=E5({marktype:"group",name:"root",role:"frame"}),this.root.items=[new SE(this.root)])}toJSON(t){return Die(this.root,t||0)}mark(t,n,r){n=n||this.root.items[0];const i=E5(t,n);return n.items[r]=i,i.zindex&&(i.group.zdirty=!0),i}}function E5(e,t){const n={bounds:new ln,clip:!!e.clip,group:t,interactive:e.interactive!==!1,items:[],marktype:e.marktype,name:e.name||void 0,role:e.role||void 0,zindex:e.zindex||0};return e.aria!=null&&(n.aria=e.aria),e.description&&(n.description=e.description),n}function el(e,t,n){return!e&&typeof document<"u"&&document.createElement&&(e=document),e?n?e.createElementNS(n,t):e.createElement(t):null}function F5(e,t){t=t.toLowerCase();for(var n=e.childNodes,r=0,i=n.length;r<i;++r)if(n[r].tagName.toLowerCase()===t)return n[r]}function Fn(e,t,n,r){var i=e.childNodes[t],a;return(!i||i.tagName.toLowerCase()!==n.toLowerCase())&&(a=i||null,i=el(e.ownerDocument,n,r),e.insertBefore(i,a)),i}function qi(e,t){for(var n=e.childNodes,r=n.length;r>t;)e.removeChild(n[--r]);return e}function S5(e){return"mark-"+e.marktype+(e.role?" role-"+e.role:"")+(e.name?" "+e.name:"")}function WE(e,t){const n=t.getBoundingClientRect();return[e.clientX-n.left-(t.clientLeft||0),e.clientY-n.top-(t.clientTop||0)]}function Nie(e,t,n,r){var i=e&&e.mark,a,s;if(i&&(a=yi[i.marktype]).tip){for(s=WE(t,n),s[0]-=r[0],s[1]-=r[1];e=e.mark.group;)s[0]-=e.x||0,s[1]-=e.y||0;e=a.tip(i.items,s)}return e}class C5{constructor(t,n){this._active=null,this._handlers={},this._loader=t||Nw(),this._tooltip=n||Oie}initialize(t,n,r){return this._el=t,this._obj=r||null,this.origin(n)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}origin(t){return arguments.length?(this._origin=t||[0,0],this):this._origin.slice()}scene(t){return arguments.length?(this._scene=t,this):this._scene}on(){}off(){}_handlerIndex(t,n,r){for(let i=t?t.length:0;--i>=0;)if(t[i].type===n&&(!r||t[i].handler===r))return i;return-1}handlers(t){const n=this._handlers,r=[];if(t)r.push(...n[this.eventName(t)]);else for(const i in n)r.push(...n[i]);return r}eventName(t){const n=t.indexOf(".");return n<0?t:t.slice(0,n)}handleHref(t,n,r){this._loader.sanitize(r,{context:"href"}).then(i=>{const a=new MouseEvent(t.type,t),s=el(null,"a");for(const o in i)s.setAttribute(o,i[o]);s.dispatchEvent(a)}).catch(()=>{})}handleTooltip(t,n,r){if(n&&n.tooltip!=null){n=Nie(n,t,this.canvas(),this._origin);const i=r&&n&&n.tooltip||null;this._tooltip.call(this._obj,this,t,n,i)}}getItemBoundingClientRect(t){const n=this.canvas();if(!n)return;const r=n.getBoundingClientRect(),i=this._origin,a=t.bounds,s=a.width(),o=a.height();let u=a.x1+i[0]+r.left,l=a.y1+i[1]+r.top;for(;t.mark&&(t=t.mark.group);)u+=t.x||0,l+=t.y||0;return{x:u,y:l,width:s,height:o,left:u,top:l,right:u+s,bottom:l+o}}}function Oie(e,t,n,r){e.element().setAttribute("title",r||"")}class Fv{constructor(t){this._el=null,this._bgcolor=null,this._loader=new kre(t)}initialize(t,n,r,i,a){return this._el=t,this.resize(n,r,i,a)}element(){return this._el}canvas(){return this._el&&this._el.firstChild}background(t){return arguments.length===0?this._bgcolor:(this._bgcolor=t,this)}resize(t,n,r,i){return this._width=t,this._height=n,this._origin=r||[0,0],this._scale=i||1,this}dirty(){}render(t,n){const r=this;return r._call=function(){r._render(t,n)},r._call(),r._call=null,r}_render(){}renderAsync(t,n){const r=this.render(t,n);return this._ready?this._ready.then(()=>r):Promise.resolve(r)}_load(t,n){var r=this,i=r._loader[t](n);if(!r._ready){const a=r._call;r._ready=r._loader.ready().then(s=>{s&&a(),r._ready=null})}return i}sanitizeURL(t){return this._load("sanitizeURL",t)}loadImage(t){return this._load("loadImage",t)}}const Iie="keydown",Bie="keypress",Lie="keyup",k5="dragenter",Sv="dragleave",_5="dragover",HE="pointerdown",zie="pointerup",Cv="pointermove",kv="pointerout",A5="pointerover",jE="mousedown",qie="mouseup",T5="mousemove",_v="mouseout",M5="mouseover",Av="click",Uie="dblclick",Vie="wheel",$5="mousewheel",Tv="touchstart",Mv="touchmove",$v="touchend",Wie=[Iie,Bie,Lie,k5,Sv,_5,HE,zie,Cv,kv,A5,jE,qie,T5,_v,M5,Av,Uie,Vie,$5,Tv,Mv,$v],GE=Cv,Fh=_v,YE=Av;class Dv extends C5{constructor(t,n){super(t,n),this._down=null,this._touch=null,this._first=!0,this._events={},this.events=Wie,this.pointermove=R5([Cv,T5],[A5,M5],[kv,_v]),this.dragover=R5([_5],[k5],[Sv]),this.pointerout=P5([kv,_v]),this.dragleave=P5([Sv])}initialize(t,n,r){return this._canvas=t&&F5(t,"canvas"),[Av,jE,HE,Cv,kv,Sv].forEach(i=>D5(this,i)),super.initialize(t,n,r)}canvas(){return this._canvas}context(){return this._canvas.getContext("2d")}DOMMouseScroll(t){this.fire($5,t)}pointerdown(t){this._down=this._active,this.fire(HE,t)}mousedown(t){this._down=this._active,this.fire(jE,t)}click(t){this._down===this._active&&(this.fire(Av,t),this._down=null)}touchstart(t){this._touch=this.pickEvent(t.changedTouches[0]),this._first&&(this._active=this._touch,this._first=!1),this.fire(Tv,t,!0)}touchmove(t){this.fire(Mv,t,!0)}touchend(t){this.fire($v,t,!0),this._touch=null}fire(t,n,r){const i=r?this._touch:this._active,a=this._handlers[t];if(n.vegaType=t,t===YE&&i&&i.href?this.handleHref(n,i,i.href):(t===GE||t===Fh)&&this.handleTooltip(n,i,t!==Fh),a)for(let s=0,o=a.length;s<o;++s)a[s].handler.call(this._obj,n,i)}on(t,n){const r=this.eventName(t),i=this._handlers;return this._handlerIndex(i[r],t,n)<0&&(D5(this,t),(i[r]||(i[r]=[])).push({type:t,handler:n})),this}off(t,n){const r=this.eventName(t),i=this._handlers[r],a=this._handlerIndex(i,t,n);return a>=0&&i.splice(a,1),this}pickEvent(t){const n=WE(t,this._canvas),r=this._origin;return this.pick(this._scene,n[0],n[1],n[0]-r[0],n[1]-r[1])}pick(t,n,r,i,a){const s=this.context();return yi[t.marktype].pick.call(this,s,t,n,r,i,a)}}const Hie=e=>e===Tv||e===Mv||e===$v?[Tv,Mv,$v]:[e];function D5(e,t){Hie(t).forEach(n=>jie(e,n))}function jie(e,t){const n=e.canvas();n&&!e._events[t]&&(e._events[t]=1,n.addEventListener(t,e[t]?r=>e[t](r):r=>e.fire(t,r)))}function Sh(e,t,n){t.forEach(r=>e.fire(r,n))}function R5(e,t,n){return function(r){const i=this._active,a=this.pickEvent(r);a===i?Sh(this,e,r):((!i||!i.exit)&&Sh(this,n,r),this._active=a,Sh(this,t,r),Sh(this,e,r))}}function P5(e){return function(t){Sh(this,e,t),this._active=null}}function Gie(){return typeof window<"u"&&window.devicePixelRatio||1}function Yie(e,t,n,r,i,a){const s=typeof HTMLElement<"u"&&e instanceof HTMLElement&&e.parentNode!=null,o=e.getContext("2d"),u=s?Gie():i;e.width=t*u,e.height=n*u;for(const l in a)o[l]=a[l];return s&&u!==1&&(e.style.width=t+"px",e.style.height=n+"px"),o.pixelRatio=u,o.setTransform(u,0,0,u,u*r[0],u*r[1]),e}class XE extends Fv{constructor(t){super(t),this._options={},this._redraw=!1,this._dirty=new ln,this._tempb=new ln}initialize(t,n,r,i,a,s){return this._options=s||{},this._canvas=this._options.externalContext?null:_o(1,1,this._options.type),t&&this._canvas&&(qi(t,0).appendChild(this._canvas),this._canvas.setAttribute("class","marks")),super.initialize(t,n,r,i,a)}resize(t,n,r,i){if(super.resize(t,n,r,i),this._canvas)Yie(this._canvas,this._width,this._height,this._origin,this._scale,this._options.context);else{const a=this._options.externalContext;a||Q("CanvasRenderer is missing a valid canvas or context"),a.scale(this._scale,this._scale),a.translate(this._origin[0],this._origin[1])}return this._redraw=!0,this}canvas(){return this._canvas}context(){return this._options.externalContext||(this._canvas?this._canvas.getContext("2d"):null)}dirty(t){const n=this._tempb.clear().union(t.bounds);let r=t.mark.group;for(;r;)n.translate(r.x||0,r.y||0),r=r.mark.group;this._dirty.union(n)}_render(t,n){const r=this.context(),i=this._origin,a=this._width,s=this._height,o=this._dirty,u=Xie(i,a,s);r.save();const l=this._redraw||o.empty()?(this._redraw=!1,u.expand(1)):Kie(r,u.intersect(o),i);return this.clear(-i[0],-i[1],a,s),this.draw(r,t,l,n),r.restore(),o.clear(),this}draw(t,n,r,i){if(n.marktype!=="group"&&i!=null&&!i.includes(n.marktype))return;const a=yi[n.marktype];n.clip&&Vre(t,n),a.draw.call(this,t,n,r,i),n.clip&&t.restore()}clear(t,n,r,i){const a=this._options,s=this.context();a.type!=="pdf"&&!a.externalContext&&s.clearRect(t,n,r,i),this._bgcolor!=null&&(s.fillStyle=this._bgcolor,s.fillRect(t,n,r,i))}}const Xie=(e,t,n)=>new ln().set(0,0,t,n).translate(-e[0],-e[1]);function Kie(e,t,n){return t.expand(1).round(),e.pixelRatio%1&&t.scale(e.pixelRatio).round().scale(1/e.pixelRatio),t.translate(-(n[0]%1),-(n[1]%1)),e.beginPath(),e.rect(t.x1,t.y1,t.width(),t.height()),e.clip(),t}class Zie extends C5{constructor(t,n){super(t,n);const r=this;r._hrefHandler=KE(r,(i,a)=>{a&&a.href&&r.handleHref(i,a,a.href)}),r._tooltipHandler=KE(r,(i,a)=>{r.handleTooltip(i,a,i.type!==Fh)})}initialize(t,n,r){let i=this._svg;return i&&(i.removeEventListener(YE,this._hrefHandler),i.removeEventListener(GE,this._tooltipHandler),i.removeEventListener(Fh,this._tooltipHandler)),this._svg=i=t&&F5(t,"svg"),i&&(i.addEventListener(YE,this._hrefHandler),i.addEventListener(GE,this._tooltipHandler),i.addEventListener(Fh,this._tooltipHandler)),super.initialize(t,n,r)}canvas(){return this._svg}on(t,n){const r=this.eventName(t),i=this._handlers;if(this._handlerIndex(i[r],t,n)<0){const s={type:t,handler:n,listener:KE(this,n)};(i[r]||(i[r]=[])).push(s),this._svg&&this._svg.addEventListener(r,s.listener)}return this}off(t,n){const r=this.eventName(t),i=this._handlers[r],a=this._handlerIndex(i,t,n);return a>=0&&(this._svg&&this._svg.removeEventListener(r,i[a].listener),i.splice(a,1)),this}}const KE=(e,t)=>n=>{let r=n.target.__data__;r=Array.isArray(r)?r[0]:r,n.vegaType=n.type,t.call(e._obj,n,r)},N5="aria-hidden",ZE="aria-label",QE="role",JE="aria-roledescription",O5="graphics-object",eF="graphics-symbol",I5=(e,t,n)=>({[QE]:e,[JE]:t,[ZE]:n||void 0}),Qie=wa(["axis-domain","axis-grid","axis-label","axis-tick","axis-title","legend-band","legend-entry","legend-gradient","legend-label","legend-title","legend-symbol","title"]),B5={axis:{desc:"axis",caption:tae},legend:{desc:"legend",caption:nae},"title-text":{desc:"title",caption:e=>`Title text '${U5(e)}'`},"title-subtitle":{desc:"subtitle",caption:e=>`Subtitle text '${U5(e)}'`}},L5={ariaRole:QE,ariaRoleDescription:JE,description:ZE};function z5(e,t){const n=t.aria===!1;if(e(N5,n||void 0),n||t.description==null)for(const r in L5)e(L5[r],void 0);else{const r=t.mark.marktype;e(ZE,t.description),e(QE,t.ariaRole||(r==="group"?O5:eF)),e(JE,t.ariaRoleDescription||`${r} mark`)}}function q5(e){return e.aria===!1?{[N5]:!0}:Qie[e.role]?null:B5[e.role]?eae(e,B5[e.role]):Jie(e)}function Jie(e){const t=e.marktype,n=t==="group"||t==="text"||e.items.some(r=>r.description!=null&&r.aria!==!1);return I5(n?O5:eF,`${t} mark container`,e.description)}function eae(e,t){try{const n=e.items[0],r=t.caption||(()=>"");return I5(t.role||eF,t.desc,n.description||r(n))}catch{return null}}function U5(e){return be(e.text).join(" ")}function tae(e){const t=e.datum,n=e.orient,r=t.title?V5(e):null,i=e.context,a=i.scales[t.scale].value,s=i.dataflow.locale(),o=a.type;return`${n==="left"||n==="right"?"Y":"X"}-axis`+(r?` titled '${r}'`:"")+` for a ${Bc(o)?"discrete":o} scale with ${qO(s,a,e)}`}function nae(e){const t=e.datum,n=t.title?V5(e):null,r=`${t.type||""} legend`.trim(),i=t.scales,a=Object.keys(i),s=e.context,o=s.scales[i[a[0]]].value,u=s.dataflow.locale();return iae(r)+(n?` titled '${n}'`:"")+` for ${rae(a)} with ${qO(u,o,e)}`}function V5(e){try{return be(st(e.items).items[0].text).join(" ")}catch{return null}}function rae(e){return e=e.map(t=>t+(t==="fill"||t==="stroke"?" color":"")),e.length<2?e[0]:e.slice(0,-1).join(", ")+" and "+st(e)}function iae(e){return e.length?e[0].toUpperCase()+e.slice(1):e}const W5=e=>(e+"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),aae=e=>W5(e).replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;");function H5(){let e="",t="",n="";const r=[],i=()=>t=n="",a=u=>{t&&(e+=`${t}>${n}`,i()),r.push(u)},s=(u,l)=>(l!=null&&(t+=` ${u}="${aae(l)}"`),o),o={open(u){a(u),t="<"+u;for(var l=arguments.length,c=new Array(l>1?l-1:0),f=1;f<l;f++)c[f-1]=arguments[f];for(const d of c)for(const h in d)s(h,d[h]);return o},close(){const u=r.pop();return t?e+=t+(n?`>${n}</${u}>`:"/>"):e+=`</${u}>`,i(),o},attr:s,text:u=>(n+=W5(u),o),toString:()=>e};return o}const sae=e=>j5(H5(),e)+"";function j5(e,t){if(e.open(t.tagName),t.hasAttributes()){const n=t.attributes,r=n.length;for(let i=0;i<r;++i)e.attr(n[i].name,n[i].value)}if(t.hasChildNodes()){const n=t.childNodes;for(const r of n)r.nodeType===3?e.text(r.nodeValue):j5(e,r)}return e.close()}const Rv={fill:"fill",fillOpacity:"fill-opacity",stroke:"stroke",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",strokeCap:"stroke-linecap",strokeJoin:"stroke-linejoin",strokeDash:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeMiterLimit:"stroke-miterlimit",opacity:"opacity"},Pv={blend:"mix-blend-mode"},G5={fill:"none","stroke-miterlimit":10},Ch=0,Y5="http://www.w3.org/2000/xmlns/",cn=wh.xmlns;class X5 extends Fv{constructor(t){super(t),this._dirtyID=0,this._dirty=[],this._svg=null,this._root=null,this._defs=null}initialize(t,n,r,i,a){return this._defs={},this._clearDefs(),t&&(this._svg=Fn(t,0,"svg",cn),this._svg.setAttributeNS(Y5,"xmlns",cn),this._svg.setAttributeNS(Y5,"xmlns:xlink",wh["xmlns:xlink"]),this._svg.setAttribute("version",wh.version),this._svg.setAttribute("class","marks"),qi(t,1),this._root=Fn(this._svg,Ch,"g",cn),Lo(this._root,G5),qi(this._svg,Ch+1)),this.background(this._bgcolor),super.initialize(t,n,r,i,a)}background(t){return arguments.length&&this._svg&&this._svg.style.setProperty("background-color",t),super.background(...arguments)}resize(t,n,r,i){return super.resize(t,n,r,i),this._svg&&(Lo(this._svg,{width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}),this._root.setAttribute("transform",`translate(${this._origin})`)),this._dirty=[],this}canvas(){return this._svg}svg(){const t=this._svg,n=this._bgcolor;if(!t)return null;let r;n&&(t.removeAttribute("style"),r=Fn(t,Ch,"rect",cn),Lo(r,{width:this._width,height:this._height,fill:n}));const i=sae(t);return n&&(t.removeChild(r),this._svg.style.setProperty("background-color",n)),i}_render(t,n){return this._dirtyCheck()&&(this._dirtyAll&&this._clearDefs(),this.mark(this._root,t,void 0,n),qi(this._root,1)),this.defs(),this._dirty=[],++this._dirtyID,this}dirty(t){t.dirty!==this._dirtyID&&(t.dirty=this._dirtyID,this._dirty.push(t))}isDirty(t){return this._dirtyAll||!t._svg||!t._svg.ownerSVGElement||t.dirty===this._dirtyID}_dirtyCheck(){this._dirtyAll=!0;const t=this._dirty;if(!t.length||!this._dirtyID)return!0;const n=++this._dirtyID;let r,i,a,s,o,u,l;for(o=0,u=t.length;o<u;++o)if(r=t[o],i=r.mark,i.marktype!==a&&(a=i.marktype,s=yi[a]),i.zdirty&&i.dirty!==n&&(this._dirtyAll=!1,K5(r,n),i.items.forEach(c=>{c.dirty=n})),!i.zdirty){if(r.exit){s.nested&&i.items.length?(l=i.items[0],l._svg&&this._update(s,l._svg,l)):r._svg&&(l=r._svg.parentNode,l&&l.removeChild(r._svg)),r._svg=null;continue}r=s.nested?i.items[0]:r,r._update!==n&&(!r._svg||!r._svg.ownerSVGElement?(this._dirtyAll=!1,K5(r,n)):this._update(s,r._svg,r),r._update=n)}return!this._dirtyAll}mark(t,n,r,i){if(!this.isDirty(n))return n._svg;const a=this._svg,s=n.marktype,o=yi[s],u=n.interactive===!1?"none":null,l=o.tag==="g",c=Z5(n,t,r,"g",a);if(s!=="group"&&i!=null&&!i.includes(s))return qi(c,0),n._svg;c.setAttribute("class",S5(n));const f=q5(n);for(const p in f)pr(c,p,f[p]);l||pr(c,"pointer-events",u),pr(c,"clip-path",n.clip?EE(this,n,n.group):null);let d=null,h=0;const g=p=>{const v=this.isDirty(p),m=Z5(p,c,d,o.tag,a);v&&(this._update(o,m,p),l&&lae(this,m,p,i)),d=m,++h};return o.nested?n.items.length&&g(n.items[0]):Ra(n,g),qi(c,h),c}_update(t,n,r){As=n,Jn=n.__values__,z5(kh,r),t.attr(kh,r,this);const i=fae[t.type];i&&i.call(this,t,n,r),As&&this.style(As,r)}style(t,n){if(n!=null){for(const r in Rv){let i=r==="font"?xv(n):n[r];if(i===Jn[r])continue;const a=Rv[r];i==null?t.removeAttribute(a):(vE(i)&&(i=UO(i,this._defs.gradient,Q5())),t.setAttribute(a,i+"")),Jn[r]=i}for(const r in Pv)Nv(t,Pv[r],n[r])}}defs(){const t=this._svg,n=this._defs;let r=n.el,i=0;for(const a in n.gradient)r||(n.el=r=Fn(t,Ch+1,"defs",cn)),i=oae(r,n.gradient[a],i);for(const a in n.clipping)r||(n.el=r=Fn(t,Ch+1,"defs",cn)),i=uae(r,n.clipping[a],i);r&&(i===0?(t.removeChild(r),n.el=null):qi(r,i))}_clearDefs(){const t=this._defs;t.gradient={},t.clipping={}}}function K5(e,t){for(;e&&e.dirty!==t;e=e.mark.group)if(e.dirty=t,e.mark&&e.mark.dirty!==t)e.mark.dirty=t;else return}function oae(e,t,n){let r,i,a;if(t.gradient==="radial"){let s=Fn(e,n++,"pattern",cn);Lo(s,{id:av+t.id,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),s=Fn(s,0,"rect",cn),Lo(s,{width:1,height:1,fill:`url(${Q5()}#${t.id})`}),e=Fn(e,n++,"radialGradient",cn),Lo(e,{id:t.id,fx:t.x1,fy:t.y1,fr:t.r1,cx:t.x2,cy:t.y2,r:t.r2})}else e=Fn(e,n++,"linearGradient",cn),Lo(e,{id:t.id,x1:t.x1,x2:t.x2,y1:t.y1,y2:t.y2});for(r=0,i=t.stops.length;r<i;++r)a=Fn(e,r,"stop",cn),a.setAttribute("offset",t.stops[r].offset),a.setAttribute("stop-color",t.stops[r].color);return qi(e,r),n}function uae(e,t,n){let r;return e=Fn(e,n,"clipPath",cn),e.setAttribute("id",t.id),t.path?(r=Fn(e,0,"path",cn),r.setAttribute("d",t.path)):(r=Fn(e,0,"rect",cn),Lo(r,{x:0,y:0,width:t.width,height:t.height})),qi(e,1),n+1}function lae(e,t,n,r){t=t.lastChild.previousSibling;let i,a=0;Ra(n,s=>{i=e.mark(t,s,i,r),++a}),qi(t,1+a)}function Z5(e,t,n,r,i){let a=e._svg,s;if(!a&&(s=t.ownerDocument,a=el(s,r,cn),e._svg=a,e.mark&&(a.__data__=e,a.__values__={fill:"default"},r==="g"))){const o=el(s,"path",cn);a.appendChild(o),o.__data__=e;const u=el(s,"g",cn);a.appendChild(u),u.__data__=e;const l=el(s,"path",cn);a.appendChild(l),l.__data__=e,l.__values__={fill:"default"}}return(a.ownerSVGElement!==i||cae(a,n))&&t.insertBefore(a,n?n.nextSibling:t.firstChild),a}function cae(e,t){return e.parentNode&&e.parentNode.childNodes.length>1&&e.previousSibling!=t}let As=null,Jn=null;const fae={group(e,t,n){const r=As=t.childNodes[2];Jn=r.__values__,e.foreground(kh,n,this),Jn=t.__values__,As=t.childNodes[1],e.content(kh,n,this);const i=As=t.childNodes[0];e.background(kh,n,this);const a=n.mark.interactive===!1?"none":null;if(a!==Jn.events&&(pr(r,"pointer-events",a),pr(i,"pointer-events",a),Jn.events=a),n.strokeForeground&&n.stroke){const s=n.fill;pr(r,"display",null),this.style(i,n),pr(i,"stroke",null),s&&(n.fill=null),Jn=r.__values__,this.style(r,n),s&&(n.fill=s),As=null}else pr(r,"display","none")},image(e,t,n){n.smooth===!1?(Nv(t,"image-rendering","optimizeSpeed"),Nv(t,"image-rendering","pixelated")):Nv(t,"image-rendering",null)},text(e,t,n){const r=xh(n);let i,a,s,o;ee(r)?(a=r.map(u=>Bo(n,u)),i=a.join(`
`),i!==Jn.text&&(qi(t,0),s=t.ownerDocument,o=Ju(n),a.forEach((u,l)=>{const c=el(s,"tspan",cn);c.__data__=n,c.textContent=u,l&&(c.setAttribute("x",0),c.setAttribute("dy",o)),t.appendChild(c)}),Jn.text=i)):(a=Bo(n,r),a!==Jn.text&&(t.textContent=a,Jn.text=a)),pr(t,"font-family",xv(n)),pr(t,"font-size",_s(n)+"px"),pr(t,"font-style",n.fontStyle),pr(t,"font-variant",n.fontVariant),pr(t,"font-weight",n.fontWeight)}};function kh(e,t,n){t!==Jn[e]&&(n?dae(As,e,t,n):pr(As,e,t),Jn[e]=t)}function Nv(e,t,n){n!==Jn[t]&&(n==null?e.style.removeProperty(t):e.style.setProperty(t,n+""),Jn[t]=n)}function Lo(e,t){for(const n in t)pr(e,n,t[n])}function pr(e,t,n){n!=null?e.setAttribute(t,n):e.removeAttribute(t)}function dae(e,t,n,r){n!=null?e.setAttributeNS(r,t,n):e.removeAttributeNS(r,t)}function Q5(){let e;return typeof window>"u"?"":(e=window.location).hash?e.href.slice(0,-e.hash.length):e.href}class hae extends Fv{constructor(t){super(t),this._text=null,this._defs={gradient:{},clipping:{}}}svg(){return this._text}_render(t){const n=H5();n.open("svg",Ze({},wh,{class:"marks",width:this._width*this._scale,height:this._height*this._scale,viewBox:`0 0 ${this._width} ${this._height}`}));const r=this._bgcolor;return r&&r!=="transparent"&&r!=="none"&&n.open("rect",{width:this._width,height:this._height,fill:r}).close(),n.open("g",G5,{transform:"translate("+this._origin+")"}),this.mark(n,t),n.close(),this.defs(n),this._text=n.close()+"",this}mark(t,n){const r=yi[n.marktype],i=r.tag,a=[z5,r.attr];t.open("g",{class:S5(n),"clip-path":n.clip?EE(this,n,n.group):null},q5(n),{"pointer-events":i!=="g"&&n.interactive===!1?"none":null});const s=o=>{const u=this.href(o);if(u&&t.open("a",u),t.open(i,this.attr(n,o,a,i!=="g"?i:null)),i==="text"){const l=xh(o);if(ee(l)){const c={x:0,dy:Ju(o)};for(let f=0;f<l.length;++f)t.open("tspan",f?c:null).text(Bo(o,l[f])).close()}else t.text(Bo(o,l))}else if(i==="g"){const l=o.strokeForeground,c=o.fill,f=o.stroke;l&&f&&(o.stroke=null),t.open("path",this.attr(n,o,r.background,"bgrect")).close(),t.open("g",this.attr(n,o,r.content)),Ra(o,d=>this.mark(t,d)),t.close(),l&&f?(c&&(o.fill=null),o.stroke=f,t.open("path",this.attr(n,o,r.foreground,"bgrect")).close(),c&&(o.fill=c)):t.open("path",this.attr(n,o,r.foreground,"bgfore")).close()}t.close(),u&&t.close()};return r.nested?n.items&&n.items.length&&s(n.items[0]):Ra(n,s),t.close()}href(t){const n=t.href;let r;if(n){if(r=this._hrefs&&this._hrefs[n])return r;this.sanitizeURL(n).then(i=>{i["xlink:href"]=i.href,i.href=null,(this._hrefs||(this._hrefs={}))[n]=i})}return null}attr(t,n,r,i){const a={},s=(o,u,l,c)=>{a[c||o]=u};return Array.isArray(r)?r.forEach(o=>o(s,n,this)):r(s,n,this),i&&gae(a,n,t,i,this._defs),a}defs(t){const n=this._defs.gradient,r=this._defs.clipping;if(Object.keys(n).length+Object.keys(r).length!==0){t.open("defs");for(const a in n){const s=n[a],o=s.stops;s.gradient==="radial"?(t.open("pattern",{id:av+a,viewBox:"0,0,1,1",width:"100%",height:"100%",preserveAspectRatio:"xMidYMid slice"}),t.open("rect",{width:"1",height:"1",fill:"url(#"+a+")"}).close(),t.close(),t.open("radialGradient",{id:a,fx:s.x1,fy:s.y1,fr:s.r1,cx:s.x2,cy:s.y2,r:s.r2})):t.open("linearGradient",{id:a,x1:s.x1,x2:s.x2,y1:s.y1,y2:s.y2});for(let u=0;u<o.length;++u)t.open("stop",{offset:o[u].offset,"stop-color":o[u].color}).close();t.close()}for(const a in r){const s=r[a];t.open("clipPath",{id:a}),s.path?t.open("path",{d:s.path}).close():t.open("rect",{x:0,y:0,width:s.width,height:s.height}).close(),t.close()}t.close()}}}function gae(e,t,n,r,i){let a;if(t==null||(r==="bgrect"&&n.interactive===!1&&(e["pointer-events"]="none"),r==="bgfore"&&(n.interactive===!1&&(e["pointer-events"]="none"),e.display="none",t.fill!==null)))return e;r==="image"&&t.smooth===!1&&(a=["image-rendering: optimizeSpeed;","image-rendering: pixelated;"]),r==="text"&&(e["font-family"]=xv(t),e["font-size"]=_s(t)+"px",e["font-style"]=t.fontStyle,e["font-variant"]=t.fontVariant,e["font-weight"]=t.fontWeight);for(const s in Rv){let o=t[s];const u=Rv[s];o==="transparent"&&(u==="fill"||u==="stroke")||o!=null&&(vE(o)&&(o=UO(o,i.gradient,"")),e[u]=o)}for(const s in Pv){const o=t[s];o!=null&&(a=a||[],a.push(`${Pv[s]}: ${o};`))}return a&&(e.style=a.join(" ")),e}const tF={svgMarkTypes:["text"],svgOnTop:!0,debug:!1};class J5 extends Fv{constructor(t){super(t),this._svgRenderer=new X5(t),this._canvasRenderer=new XE(t)}initialize(t,n,r,i,a){this._root_el=Fn(t,0,"div");const s=Fn(this._root_el,0,"div"),o=Fn(this._root_el,1,"div");return this._root_el.style.position="relative",s.style.height="100%",o.style.position="absolute",o.style.top="0",o.style.left="0",o.style.height="100%",o.style.width="100%",this._svgEl=o,this._canvasEl=s,this._svgEl.style.pointerEvents="none",this._canvasRenderer.initialize(this._canvasEl,n,r,i,a),this._svgRenderer.initialize(this._svgEl,n,r,i,a),super.initialize(t,n,r,i,a)}dirty(t){return tF.svgMarkTypes.includes(t.mark.marktype)?this._svgRenderer.dirty(t):this._canvasRenderer.dirty(t),this}_render(t,n){const i=(n??["arc","area","image","line","path","rect","rule","shape","symbol","text","trail"]).filter(a=>!tF.svgMarkTypes.includes(a));this._svgRenderer.render(t,tF.svgMarkTypes),this._canvasRenderer.render(t,i)}resize(t,n,r,i){return super.resize(t,n,r,i),this._svgRenderer.resize(t,n,r,i),this._canvasRenderer.resize(t,n,r,i),this}background(t){return this._canvasRenderer.background(t),this}}class pae extends Dv{constructor(t,n){super(t,n)}initialize(t,n,r){const i=Fn(Fn(t,0,"div"),0,"div");return super.initialize(i,n,r)}}const eI="canvas",tI="hybrid",nI="png",rI="svg",iI="none",tl={Canvas:eI,PNG:nI,SVG:rI,Hybrid:tI,None:iI},nl={};nl[eI]=nl[nI]={renderer:XE,headless:XE,handler:Dv},nl[rI]={renderer:X5,headless:hae,handler:Zie},nl[tI]={renderer:J5,headless:J5,handler:pae},nl[iI]={};function nF(e,t){return e=String(e||"").toLowerCase(),arguments.length>1?(nl[e]=t,this):nl[e]}function vae(e,t,n){const r=[],i=new ln().union(t),a=e.marktype;return a?aI(e,i,n,r):a==="group"?sI(e,i,n,r):Q("Intersect scene must be mark node or group item.")}function aI(e,t,n,r){if(mae(e,t,n)){const i=e.items,a=e.marktype,s=i.length;let o=0;if(a==="group")for(;o<s;++o)sI(i[o],t,n,r);else for(const u=yi[a].isect;o<s;++o){const l=i[o];oI(l,t,u)&&r.push(l)}}return r}function mae(e,t,n){return e.bounds&&t.intersects(e.bounds)&&(e.marktype==="group"||e.interactive!==!1&&(!n||n(e)))}function sI(e,t,n,r){n&&n(e.mark)&&oI(e,t,yi.group.isect)&&r.push(e);const i=e.items,a=i&&i.length;if(a){const s=e.x||0,o=e.y||0;t.translate(-s,-o);for(let u=0;u<a;++u)aI(i[u],t,n,r);t.translate(s,o)}return r}function oI(e,t,n){const r=e.bounds;return t.encloses(r)||t.intersects(r)&&n(e,t)}const rF=new ln;function yae(e){const t=e.clip;if(Ke(t))t(gv(rF.clear()));else if(t)rF.set(0,0,e.group.width,e.group.height);else return;e.bounds.intersect(rF)}const Vc="top",Ui="left",Vi="right",zo="bottom",bae="top-left",wae="top-right",xae="bottom-left",Eae="bottom-right",iF="start",aF="middle",vr="end",Fae="x",Sae="y",Ov="group",sF="axis",oF="title",Cae="frame",kae="scope",uF="legend",uI="row-header",lI="row-footer",cI="row-title",fI="column-header",dI="column-footer",hI="column-title",_ae="padding",Aae="symbol",gI="fit",pI="fit-x",vI="fit-y",Tae="pad",lF="none",Iv="all",cF="each",fF="flush",qo="column",Uo="row";function mI(e){G.call(this,null,e)}ge(mI,G,{transform(e,t){const n=t.dataflow,r=e.mark,i=r.marktype,a=yi[i],s=a.bound;let o=r.bounds,u;if(a.nested)r.items.length&&n.dirty(r.items[0]),o=Bv(r,s),r.items.forEach(l=>{l.bounds.clear().union(o)});else if(i===Ov||e.modified())switch(t.visit(t.MOD,l=>n.dirty(l)),o.clear(),r.items.forEach(l=>o.union(Bv(l,s))),r.role){case sF:case uF:case oF:t.reflow()}else u=t.changed(t.REM),t.visit(t.ADD,l=>{o.union(Bv(l,s))}),t.visit(t.MOD,l=>{u=u||o.alignsWith(l.bounds),n.dirty(l),o.union(Bv(l,s))}),u&&(o.clear(),r.items.forEach(l=>o.union(l.bounds)));return yae(r),t.modifies("bounds")}});function Bv(e,t,n){return t(e.bounds.clear(),e,n)}const yI=":vega_identifier:";function dF(e){G.call(this,0,e)}dF.Definition={type:"Identifier",metadata:{modifies:!0},params:[{name:"as",type:"string",required:!0}]},ge(dF,G,{transform(e,t){const n=Mae(t.dataflow),r=e.as;let i=n.value;return t.visit(t.ADD,a=>a[r]=a[r]||++i),n.set(this.value=i),t}});function Mae(e){return e._signals[yI]||(e._signals[yI]=e.add(0))}function bI(e){G.call(this,null,e)}ge(bI,G,{transform(e,t){let n=this.value;n||(n=t.dataflow.scenegraph().mark(e.markdef,$ae(e),e.index),n.group.context=e.context,e.context.group||(e.context.group=n.group),n.source=this.source,n.clip=e.clip,n.interactive=e.interactive,this.value=n);const r=n.marktype===Ov?SE:FE;return t.visit(t.ADD,i=>r.call(i,n)),(e.modified("clip")||e.modified("interactive"))&&(n.clip=e.clip,n.interactive=!!e.interactive,n.zdirty=!0,t.reflow()),n.items=t.source,t}});function $ae(e){const t=e.groups,n=e.parent;return t&&t.size===1?t.get(Object.keys(t.object)[0]):t&&n?t.lookup(n):null}function wI(e){G.call(this,null,e)}const xI={parity:e=>e.filter((t,n)=>n%2?t.opacity=0:1),greedy:(e,t)=>{let n;return e.filter((r,i)=>!i||!EI(n.bounds,r.bounds,t)?(n=r,1):r.opacity=0)}},EI=(e,t,n)=>n>Math.max(t.x1-e.x2,e.x1-t.x2,t.y1-e.y2,e.y1-t.y2),FI=(e,t)=>{for(var n=1,r=e.length,i=e[0].bounds,a;n<r;i=a,++n)if(EI(i,a=e[n].bounds,t))return!0},Dae=e=>{const t=e.bounds;return t.width()>1&&t.height()>1},Rae=(e,t,n)=>{var r=e.range(),i=new ln;return t===Vc||t===zo?i.set(r[0],-1/0,r[1],1/0):i.set(-1/0,r[0],1/0,r[1]),i.expand(n||1),a=>i.encloses(a.bounds)},SI=e=>(e.forEach(t=>t.opacity=1),e),CI=(e,t)=>e.reflow(t.modified()).modifies("opacity");ge(wI,G,{transform(e,t){const n=xI[e.method]||xI.parity,r=e.separation||0;let i=t.materialize(t.SOURCE).source,a,s;if(!i||!i.length)return;if(!e.method)return e.modified("method")&&(SI(i),t=CI(t,e)),t;if(i=i.filter(Dae),!i.length)return;if(e.sort&&(i=i.slice().sort(e.sort)),a=SI(i),t=CI(t,e),a.length>=3&&FI(a,r)){do a=n(a,r);while(a.length>=3&&FI(a,r));a.length<3&&!st(i).opacity&&(a.length>1&&(st(a).opacity=0),st(i).opacity=1)}e.boundScale&&e.boundTolerance>=0&&(s=Rae(e.boundScale,e.boundOrient,+e.boundTolerance),i.forEach(u=>{s(u)||(u.opacity=0)}));const o=a[0].mark.bounds.clear();return i.forEach(u=>{u.opacity&&o.union(u.bounds)}),t}});function kI(e){G.call(this,null,e)}ge(kI,G,{transform(e,t){const n=t.dataflow;if(t.visit(t.ALL,r=>n.dirty(r)),t.fields&&t.fields.zindex){const r=t.source&&t.source[0];r&&(r.mark.zdirty=!0)}}});const er=new ln;function Wc(e,t,n){return e[t]===n?0:(e[t]=n,1)}function Pae(e){var t=e.items[0].orient;return t===Ui||t===Vi}function Nae(e){let t=+e.grid;return[e.ticks?t++:-1,e.labels?t++:-1,t+ +e.domain]}function Oae(e,t,n,r){var i=t.items[0],a=i.datum,s=i.translate!=null?i.translate:.5,o=i.orient,u=Nae(a),l=i.range,c=i.offset,f=i.position,d=i.minExtent,h=i.maxExtent,g=a.title&&i.items[u[2]].items[0],p=i.titlePadding,v=i.bounds,m=g&&y5(g),y=0,b=0,w,E;switch(er.clear().union(v),v.clear(),(w=u[0])>-1&&v.union(i.items[w].bounds),(w=u[1])>-1&&v.union(i.items[w].bounds),o){case Vc:y=f||0,b=-c,E=Math.max(d,Math.min(h,-v.y1)),v.add(0,-E).add(l,0),g&&Lv(e,g,E,p,m,0,-1,v);break;case Ui:y=-c,b=f||0,E=Math.max(d,Math.min(h,-v.x1)),v.add(-E,0).add(0,l),g&&Lv(e,g,E,p,m,1,-1,v);break;case Vi:y=n+c,b=f||0,E=Math.max(d,Math.min(h,v.x2)),v.add(0,0).add(E,l),g&&Lv(e,g,E,p,m,1,1,v);break;case zo:y=f||0,b=r+c,E=Math.max(d,Math.min(h,v.y2)),v.add(0,0).add(l,E),g&&Lv(e,g,E,p,0,0,1,v);break;default:y=i.x,b=i.y}return No(v.translate(y,b),i),Wc(i,"x",y+s)|Wc(i,"y",b+s)&&(i.bounds=er,e.dirty(i),i.bounds=v,e.dirty(i)),i.mark.bounds.clear().union(v)}function Lv(e,t,n,r,i,a,s,o){const u=t.bounds;if(t.auto){const l=s*(n+i+r);let c=0,f=0;e.dirty(t),a?c=(t.x||0)-(t.x=l):f=(t.y||0)-(t.y=l),t.mark.bounds.clear().union(u.translate(-c,-f)),e.dirty(t)}o.union(u)}const _I=(e,t)=>Math.floor(Math.min(e,t)),AI=(e,t)=>Math.ceil(Math.max(e,t));function Iae(e){var t=e.items,n=t.length,r=0,i,a;const s={marks:[],rowheaders:[],rowfooters:[],colheaders:[],colfooters:[],rowtitle:null,coltitle:null};for(;r<n;++r)if(i=t[r],a=i.items,i.marktype===Ov)switch(i.role){case sF:case uF:case oF:break;case uI:s.rowheaders.push(...a);break;case lI:s.rowfooters.push(...a);break;case fI:s.colheaders.push(...a);break;case dI:s.colfooters.push(...a);break;case cI:s.rowtitle=a[0];break;case hI:s.coltitle=a[0];break;default:s.marks.push(...a)}return s}function Bae(e){return new ln().set(0,0,e.width||0,e.height||0)}function Lae(e){const t=e.bounds.clone();return t.empty()?t.set(0,0,0,0):t.translate(-(e.x||0),-(e.y||0))}function It(e,t,n){const r=we(e)?e[t]:e;return r??(n!==void 0?n:0)}function TI(e){return e<0?Math.ceil(-e):0}function MI(e,t,n){var r=!n.nodirty,i=n.bounds===fF?Bae:Lae,a=er.set(0,0,0,0),s=It(n.align,qo),o=It(n.align,Uo),u=It(n.padding,qo),l=It(n.padding,Uo),c=n.columns||t.length,f=c<=0?1:Math.ceil(t.length/c),d=t.length,h=Array(d),g=Array(c),p=0,v=Array(d),m=Array(f),y=0,b=Array(d),w=Array(d),E=Array(d),F,x,C,S,_,k,T,A,$,M,D;for(x=0;x<c;++x)g[x]=0;for(x=0;x<f;++x)m[x]=0;for(x=0;x<d;++x)k=t[x],_=E[x]=i(k),k.x=k.x||0,b[x]=0,k.y=k.y||0,w[x]=0,C=x%c,S=~~(x/c),p=Math.max(p,T=Math.ceil(_.x2)),y=Math.max(y,A=Math.ceil(_.y2)),g[C]=Math.max(g[C],T),m[S]=Math.max(m[S],A),h[x]=u+TI(_.x1),v[x]=l+TI(_.y1),r&&e.dirty(t[x]);for(x=0;x<d;++x)x%c===0&&(h[x]=0),x<c&&(v[x]=0);if(s===cF)for(C=1;C<c;++C){for(D=0,x=C;x<d;x+=c)D<h[x]&&(D=h[x]);for(x=C;x<d;x+=c)h[x]=D+g[C-1]}else if(s===Iv){for(D=0,x=0;x<d;++x)x%c&&D<h[x]&&(D=h[x]);for(x=0;x<d;++x)x%c&&(h[x]=D+p)}else for(s=!1,C=1;C<c;++C)for(x=C;x<d;x+=c)h[x]+=g[C-1];if(o===cF)for(S=1;S<f;++S){for(D=0,x=S*c,F=x+c;x<F;++x)D<v[x]&&(D=v[x]);for(x=S*c;x<F;++x)v[x]=D+m[S-1]}else if(o===Iv){for(D=0,x=c;x<d;++x)D<v[x]&&(D=v[x]);for(x=c;x<d;++x)v[x]=D+y}else for(o=!1,S=1;S<f;++S)for(x=S*c,F=x+c;x<F;++x)v[x]+=m[S-1];for($=0,x=0;x<d;++x)$=h[x]+(x%c?$:0),b[x]+=$-t[x].x;for(C=0;C<c;++C)for(M=0,x=C;x<d;x+=c)M+=v[x],w[x]+=M-t[x].y;if(s&&It(n.center,qo)&&f>1)for(x=0;x<d;++x)_=s===Iv?p:g[x%c],$=_-E[x].x2-t[x].x-b[x],$>0&&(b[x]+=$/2);if(o&&It(n.center,Uo)&&c!==1)for(x=0;x<d;++x)_=o===Iv?y:m[~~(x/c)],M=_-E[x].y2-t[x].y-w[x],M>0&&(w[x]+=M/2);for(x=0;x<d;++x)a.union(E[x].translate(b[x],w[x]));switch($=It(n.anchor,Fae),M=It(n.anchor,Sae),It(n.anchor,qo)){case vr:$-=a.width();break;case aF:$-=a.width()/2}switch(It(n.anchor,Uo)){case vr:M-=a.height();break;case aF:M-=a.height()/2}for($=Math.round($),M=Math.round(M),a.clear(),x=0;x<d;++x)t[x].mark.bounds.clear();for(x=0;x<d;++x)k=t[x],k.x+=b[x]+=$,k.y+=w[x]+=M,a.union(k.mark.bounds.union(k.bounds.translate(b[x],w[x]))),r&&e.dirty(k);return a}function zae(e,t,n){var r=Iae(t),i=r.marks,a=n.bounds===fF?qae:Uae,s=n.offset,o=n.columns||i.length,u=o<=0?1:Math.ceil(i.length/o),l=u*o,c,f,d,h,g,p,v;const m=MI(e,i,n);m.empty()&&m.set(0,0,0,0),r.rowheaders&&(p=It(n.headerBand,Uo,null),c=zv(e,r.rowheaders,i,o,u,-It(s,"rowHeader"),_I,0,a,"x1",0,o,1,p)),r.colheaders&&(p=It(n.headerBand,qo,null),f=zv(e,r.colheaders,i,o,o,-It(s,"columnHeader"),_I,1,a,"y1",0,1,o,p)),r.rowfooters&&(p=It(n.footerBand,Uo,null),d=zv(e,r.rowfooters,i,o,u,It(s,"rowFooter"),AI,0,a,"x2",o-1,o,1,p)),r.colfooters&&(p=It(n.footerBand,qo,null),h=zv(e,r.colfooters,i,o,o,It(s,"columnFooter"),AI,1,a,"y2",l-o,1,o,p)),r.rowtitle&&(g=It(n.titleAnchor,Uo),v=It(s,"rowTitle"),v=g===vr?d+v:c-v,p=It(n.titleBand,Uo,.5),$I(e,r.rowtitle,v,0,m,p)),r.coltitle&&(g=It(n.titleAnchor,qo),v=It(s,"columnTitle"),v=g===vr?h+v:f-v,p=It(n.titleBand,qo,.5),$I(e,r.coltitle,v,1,m,p))}function qae(e,t){return t==="x1"?e.x||0:t==="y1"?e.y||0:t==="x2"?(e.x||0)+(e.width||0):t==="y2"?(e.y||0)+(e.height||0):void 0}function Uae(e,t){return e.bounds[t]}function zv(e,t,n,r,i,a,s,o,u,l,c,f,d,h){var g=n.length,p=0,v=0,m,y,b,w,E,F,x,C,S;if(!g)return p;for(m=c;m<g;m+=f)n[m]&&(p=s(p,u(n[m],l)));if(!t.length)return p;for(t.length>i&&(e.warn("Grid headers exceed limit: "+i),t=t.slice(0,i)),p+=a,y=0,w=t.length;y<w;++y)e.dirty(t[y]),t[y].mark.bounds.clear();for(m=c,y=0,w=t.length;y<w;++y,m+=f){for(F=t[y],E=F.mark.bounds,b=m;b>=0&&(x=n[b])==null;b-=d);o?(C=h==null?x.x:Math.round(x.bounds.x1+h*x.bounds.width()),S=p):(C=p,S=h==null?x.y:Math.round(x.bounds.y1+h*x.bounds.height())),E.union(F.bounds.translate(C-(F.x||0),S-(F.y||0))),F.x=C,F.y=S,e.dirty(F),v=s(v,E[l])}return v}function $I(e,t,n,r,i,a){if(t){e.dirty(t);var s=n,o=n;r?s=Math.round(i.x1+a*i.width()):o=Math.round(i.y1+a*i.height()),t.bounds.translate(s-(t.x||0),o-(t.y||0)),t.mark.bounds.clear().union(t.bounds),t.x=s,t.y=o,e.dirty(t)}}function Vae(e,t){const n=e[t]||{};return(r,i)=>n[r]!=null?n[r]:e[r]!=null?e[r]:i}function Wae(e,t){let n=-1/0;return e.forEach(r=>{r.offset!=null&&(n=Math.max(n,r.offset))}),n>-1/0?n:t}function Hae(e,t,n,r,i,a,s){const o=Vae(n,t),u=Wae(e,o("offset",0)),l=o("anchor",iF),c=l===vr?1:l===aF?.5:0,f={align:cF,bounds:o("bounds",fF),columns:o("direction")==="vertical"?1:e.length,padding:o("margin",8),center:o("center"),nodirty:!0};switch(t){case Ui:f.anchor={x:Math.floor(r.x1)-u,column:vr,y:c*(s||r.height()+2*r.y1),row:l};break;case Vi:f.anchor={x:Math.ceil(r.x2)+u,y:c*(s||r.height()+2*r.y1),row:l};break;case Vc:f.anchor={y:Math.floor(i.y1)-u,row:vr,x:c*(a||i.width()+2*i.x1),column:l};break;case zo:f.anchor={y:Math.ceil(i.y2)+u,x:c*(a||i.width()+2*i.x1),column:l};break;case bae:f.anchor={x:u,y:u};break;case wae:f.anchor={x:a-u,y:u,column:vr};break;case xae:f.anchor={x:u,y:s-u,row:vr};break;case Eae:f.anchor={x:a-u,y:s-u,column:vr,row:vr};break}return f}function jae(e,t){var n=t.items[0],r=n.datum,i=n.orient,a=n.bounds,s=n.x,o=n.y,u,l;return n._bounds?n._bounds.clear().union(a):n._bounds=a.clone(),a.clear(),Yae(e,n,n.items[0].items[0]),a=Gae(n,a),u=2*n.padding,l=2*n.padding,a.empty()||(u=Math.ceil(a.width()+u),l=Math.ceil(a.height()+l)),r.type===Aae&&Xae(n.items[0].items[0].items[0].items),i!==lF&&(n.x=s=0,n.y=o=0),n.width=u,n.height=l,No(a.set(s,o,s+u,o+l),n),n.mark.bounds.clear().union(a),n}function Gae(e,t){return e.items.forEach(n=>t.union(n.bounds)),t.x1=e.padding,t.y1=e.padding,t}function Yae(e,t,n){var r=t.padding,i=r-n.x,a=r-n.y;if(!t.datum.title)(i||a)&&_h(e,n,i,a);else{var s=t.items[1].items[0],o=s.anchor,u=t.titlePadding||0,l=r-s.x,c=r-s.y;switch(s.orient){case Ui:i+=Math.ceil(s.bounds.width())+u;break;case Vi:case zo:break;default:a+=s.bounds.height()+u}switch((i||a)&&_h(e,n,i,a),s.orient){case Ui:c+=Hc(t,n,s,o,1,1);break;case Vi:l+=Hc(t,n,s,vr,0,0)+u,c+=Hc(t,n,s,o,1,1);break;case zo:l+=Hc(t,n,s,o,0,0),c+=Hc(t,n,s,vr,-1,0,1)+u;break;default:l+=Hc(t,n,s,o,0,0)}(l||c)&&_h(e,s,l,c),(l=Math.round(s.bounds.x1-r))<0&&(_h(e,n,-l,0),_h(e,s,-l,0))}}function Hc(e,t,n,r,i,a,s){const o=e.datum.type!=="symbol",u=n.datum.vgrad,l=o&&(a||!u)&&!s?t.items[0]:t,c=l.bounds[i?"y2":"x2"]-e.padding,f=u&&a?c:0,d=u&&a?0:c,h=i<=0?0:y5(n);return Math.round(r===iF?f:r===vr?d-h:.5*(c-h))}function _h(e,t,n,r){t.x+=n,t.y+=r,t.bounds.translate(n,r),t.mark.bounds.translate(n,r),e.dirty(t)}function Xae(e){const t=e.reduce((n,r)=>(n[r.column]=Math.max(r.bounds.x2-r.x,n[r.column]||0),n),{});e.forEach(n=>{n.width=t[n.column],n.height=n.bounds.y2-n.y})}function Kae(e,t,n,r,i){var a=t.items[0],s=a.frame,o=a.orient,u=a.anchor,l=a.offset,c=a.padding,f=a.items[0].items[0],d=a.items[1]&&a.items[1].items[0],h=o===Ui||o===Vi?r:n,g=0,p=0,v=0,m=0,y=0,b;if(s!==Ov?o===Ui?(g=i.y2,h=i.y1):o===Vi?(g=i.y1,h=i.y2):(g=i.x1,h=i.x2):o===Ui&&(g=r,h=0),b=u===iF?g:u===vr?h:(g+h)/2,d&&d.text){switch(o){case Vc:case zo:y=f.bounds.height()+c;break;case Ui:m=f.bounds.width()+c;break;case Vi:m=-f.bounds.width()-c;break}er.clear().union(d.bounds),er.translate(m-(d.x||0),y-(d.y||0)),Wc(d,"x",m)|Wc(d,"y",y)&&(e.dirty(d),d.bounds.clear().union(er),d.mark.bounds.clear().union(er),e.dirty(d)),er.clear().union(d.bounds)}else er.clear();switch(er.union(f.bounds),o){case Vc:p=b,v=i.y1-er.height()-l;break;case Ui:p=i.x1-er.width()-l,v=b;break;case Vi:p=i.x2+er.width()+l,v=b;break;case zo:p=b,v=i.y2+l;break;default:p=a.x,v=a.y}return Wc(a,"x",p)|Wc(a,"y",v)&&(er.translate(p,v),e.dirty(a),a.bounds.clear().union(er),t.bounds.clear().union(er),e.dirty(a)),a.bounds}function DI(e){G.call(this,null,e)}ge(DI,G,{transform(e,t){const n=t.dataflow;return e.mark.items.forEach(r=>{e.layout&&zae(n,r,e.layout),Qae(n,r,e)}),Zae(e.mark.group)?t.reflow():t}});function Zae(e){return e&&e.mark.role!=="legend-entry"}function Qae(e,t,n){var r=t.items,i=Math.max(0,t.width||0),a=Math.max(0,t.height||0),s=new ln().set(0,0,i,a),o=s.clone(),u=s.clone(),l=[],c,f,d,h,g,p;for(g=0,p=r.length;g<p;++g)switch(f=r[g],f.role){case sF:h=Pae(f)?o:u,h.union(Oae(e,f,i,a));break;case oF:c=f;break;case uF:l.push(jae(e,f));break;case Cae:case kae:case uI:case lI:case cI:case fI:case dI:case hI:o.union(f.bounds),u.union(f.bounds);break;default:s.union(f.bounds)}if(l.length){const v={};l.forEach(m=>{d=m.orient||Vi,d!==lF&&(v[d]||(v[d]=[])).push(m)});for(const m in v){const y=v[m];MI(e,y,Hae(y,m,n.legends,o,u,i,a))}l.forEach(m=>{const y=m.bounds;if(y.equals(m._bounds)||(m.bounds=m._bounds,e.dirty(m),m.bounds=y,e.dirty(m)),n.autosize&&(n.autosize.type===gI||n.autosize.type===pI||n.autosize.type===vI))switch(m.orient){case Ui:case Vi:s.add(y.x1,0).add(y.x2,0);break;case Vc:case zo:s.add(0,y.y1).add(0,y.y2)}else s.union(y)})}s.union(o).union(u),c&&s.union(Kae(e,c,i,a,s)),t.clip&&s.set(0,0,t.width||0,t.height||0),Jae(e,t,s,n)}function Jae(e,t,n,r){const i=r.autosize||{},a=i.type;if(e._autosize<1||!a)return;let s=e._width,o=e._height,u=Math.max(0,t.width||0),l=Math.max(0,Math.ceil(-n.x1)),c=Math.max(0,t.height||0),f=Math.max(0,Math.ceil(-n.y1));const d=Math.max(0,Math.ceil(n.x2-u)),h=Math.max(0,Math.ceil(n.y2-c));if(i.contains===_ae){const g=e.padding();s-=g.left+g.right,o-=g.top+g.bottom}a===lF?(l=0,f=0,u=s,c=o):a===gI?(u=Math.max(0,s-l-d),c=Math.max(0,o-f-h)):a===pI?(u=Math.max(0,s-l-d),o=c+f+h):a===vI?(s=u+l+d,c=Math.max(0,o-f-h)):a===Tae&&(s=u+l+d,o=c+f+h),e._resizeView(s,o,u,c,[l,f],i.resize)}const ese=Object.freeze(Object.defineProperty({__proto__:null,bound:mI,identifier:dF,mark:bI,overlap:wI,render:kI,viewlayout:DI},Symbol.toStringTag,{value:"Module"}));function RI(e){G.call(this,null,e)}ge(RI,G,{transform(e,t){if(this.value&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.scale,s=e.count==null?e.values?e.values.length:10:e.count,o=hE(a,s,e.minstep),u=e.format||PO(n,a,o,e.formatSpecifier,e.formatType,!!e.values),l=e.values?RO(a,e.values,o):gE(a,o);return i&&(r.rem=i),i=l.map((c,f)=>vt({index:f/(l.length-1||1),value:c,label:u(c)})),e.extra&&i.length&&i.push(vt({index:-1,extra:{value:i[0].value},label:""})),r.source=i,r.add=i,this.value=i,r}});function PI(e){G.call(this,null,e)}function tse(){return vt({})}function nse(e){const t=_d().test(n=>n.exit);return t.lookup=n=>t.get(e(n)),t}ge(PI,G,{transform(e,t){var n=t.dataflow,r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=e.item||tse,a=e.key||Re,s=this.value;return ee(r.encode)&&(r.encode=null),s&&(e.modified("key")||t.modified(a))&&Q("DataJoin does not support modified key function or fields."),s||(t=t.addAll(),this.value=s=nse(a)),t.visit(t.ADD,o=>{const u=a(o);let l=s.get(u);l?l.exit?(s.empty--,r.add.push(l)):r.mod.push(l):(l=i(o),s.set(u,l),r.add.push(l)),l.datum=o,l.exit=!1}),t.visit(t.MOD,o=>{const u=a(o),l=s.get(u);l&&(l.datum=o,r.mod.push(l))}),t.visit(t.REM,o=>{const u=a(o),l=s.get(u);o===l.datum&&!l.exit&&(r.rem.push(l),l.exit=!0,++s.empty)}),t.changed(t.ADD_MOD)&&r.modifies("datum"),(t.clean()||e.clean&&s.empty>n.cleanThreshold)&&n.runAfter(s.clean),r}});function NI(e){G.call(this,null,e)}ge(NI,G,{transform(e,t){var n=t.fork(t.ADD_REM),r=e.mod||!1,i=e.encoders,a=t.encode;if(ee(a))if(n.changed()||a.every(f=>i[f]))a=a[0],n.encode=null;else return t.StopPropagation;var s=a==="enter",o=i.update||_u,u=i.enter||_u,l=i.exit||_u,c=(a&&!s?i[a]:o)||_u;if(t.changed(t.ADD)&&(t.visit(t.ADD,f=>{u(f,e),o(f,e)}),n.modifies(u.output),n.modifies(o.output),c!==_u&&c!==o&&(t.visit(t.ADD,f=>{c(f,e)}),n.modifies(c.output))),t.changed(t.REM)&&l!==_u&&(t.visit(t.REM,f=>{l(f,e)}),n.modifies(l.output)),s||c!==_u){const f=t.MOD|(e.modified()?t.REFLOW:0);s?(t.visit(f,d=>{const h=u(d,e)||r;(c(d,e)||h)&&n.mod.push(d)}),n.mod.length&&n.modifies(u.output)):t.visit(f,d=>{(c(d,e)||r)&&n.mod.push(d)}),n.mod.length&&n.modifies(c.output)}return n.changed()?n:t.StopPropagation}});function OI(e){G.call(this,[],e)}ge(OI,G,{transform(e,t){if(this.value!=null&&!e.modified())return t.StopPropagation;var n=t.dataflow.locale(),r=t.fork(t.NO_SOURCE|t.NO_FIELDS),i=this.value,a=e.type||iv,s=e.scale,o=+e.limit,u=hE(s,e.count==null?5:e.count,e.minstep),l=!!e.values||a===iv,c=e.format||BO(n,s,u,a,e.formatSpecifier,e.formatType,l),f=e.values||IO(s,u),d,h,g,p,v;return i&&(r.rem=i),a===iv?(o&&f.length>o?(t.dataflow.warn("Symbol legend count exceeds limit, filtering items."),i=f.slice(0,o-1),v=!0):i=f,Ke(g=e.size)?(!e.values&&s(i[0])===0&&(i=i.slice(1)),p=i.reduce((m,y)=>Math.max(m,g(y,e)),0)):g=fr(p=g||8),i=i.map((m,y)=>vt({index:y,label:c(m,y,i),value:m,offset:p,size:g(m,e)})),v&&(v=f[i.length],i.push(vt({index:i.length,label:`…${f.length-i.length} entries`,value:v,offset:p,size:g(v,e)})))):a===vne?(d=s.domain(),h=_O(s,d[0],st(d)),f.length<3&&!e.values&&d[0]!==st(d)&&(f=[d[0],st(d)]),i=f.map((m,y)=>vt({index:y,label:c(m,y,f),value:m,perc:h(m)}))):(g=f.length-1,h=_ne(s),i=f.map((m,y)=>vt({index:y,label:c(m,y,f),value:m,perc:y?h(m):0,perc2:y===g?1:h(f[y+1])}))),r.source=i,r.add=i,this.value=i,r}});const rse=e=>e.source.x,ise=e=>e.source.y,ase=e=>e.target.x,sse=e=>e.target.y;function hF(e){G.call(this,{},e)}hF.Definition={type:"LinkPath",metadata:{modifies:!0},params:[{name:"sourceX",type:"field",default:"source.x"},{name:"sourceY",type:"field",default:"source.y"},{name:"targetX",type:"field",default:"target.x"},{name:"targetY",type:"field",default:"target.y"},{name:"orient",type:"enum",default:"vertical",values:["horizontal","vertical","radial"]},{name:"shape",type:"enum",default:"line",values:["line","arc","curve","diagonal","orthogonal"]},{name:"require",type:"signal"},{name:"as",type:"string",default:"path"}]},ge(hF,G,{transform(e,t){var n=e.sourceX||rse,r=e.sourceY||ise,i=e.targetX||ase,a=e.targetY||sse,s=e.as||"path",o=e.orient||"vertical",u=e.shape||"line",l=zI.get(u+"-"+o)||zI.get(u);return l||Q("LinkPath unsupported type: "+e.shape+(e.orient?"-"+e.orient:"")),t.visit(t.SOURCE,c=>{c[s]=l(n(c),r(c),i(c),a(c))}),t.reflow(e.modified()).modifies(s)}});const II=(e,t,n,r)=>"M"+e+","+t+"L"+n+","+r,ose=(e,t,n,r)=>II(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),BI=(e,t,n,r)=>{var i=n-e,a=r-t,s=Math.hypot(i,a)/2,o=180*Math.atan2(a,i)/Math.PI;return"M"+e+","+t+"A"+s+","+s+" "+o+" 0 1 "+n+","+r},use=(e,t,n,r)=>BI(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),LI=(e,t,n,r)=>{const i=n-e,a=r-t,s=.2*(i+a),o=.2*(a-i);return"M"+e+","+t+"C"+(e+s)+","+(t+o)+" "+(n+o)+","+(r-s)+" "+n+","+r},zI=_d({line:II,"line-radial":ose,arc:BI,"arc-radial":use,curve:LI,"curve-radial":(e,t,n,r)=>LI(t*Math.cos(e),t*Math.sin(e),r*Math.cos(n),r*Math.sin(n)),"orthogonal-horizontal":(e,t,n,r)=>"M"+e+","+t+"V"+r+"H"+n,"orthogonal-vertical":(e,t,n,r)=>"M"+e+","+t+"H"+n+"V"+r,"orthogonal-radial":(e,t,n,r)=>{const i=Math.cos(e),a=Math.sin(e),s=Math.cos(n),o=Math.sin(n),u=Math.abs(n-e)>Math.PI?n<=e:n>e;return"M"+t*i+","+t*a+"A"+t+","+t+" 0 0,"+(u?1:0)+" "+t*s+","+t*o+"L"+r*s+","+r*o},"diagonal-horizontal":(e,t,n,r)=>{const i=(e+n)/2;return"M"+e+","+t+"C"+i+","+t+" "+i+","+r+" "+n+","+r},"diagonal-vertical":(e,t,n,r)=>{const i=(t+r)/2;return"M"+e+","+t+"C"+e+","+i+" "+n+","+i+" "+n+","+r},"diagonal-radial":(e,t,n,r)=>{const i=Math.cos(e),a=Math.sin(e),s=Math.cos(n),o=Math.sin(n),u=(t+r)/2;return"M"+t*i+","+t*a+"C"+u*i+","+u*a+" "+u*s+","+u*o+" "+r*s+","+r*o}});function gF(e){G.call(this,null,e)}gF.Definition={type:"Pie",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"startAngle",type:"number",default:0},{name:"endAngle",type:"number",default:6.283185307179586},{name:"sort",type:"boolean",default:!1},{name:"as",type:"string",array:!0,length:2,default:["startAngle","endAngle"]}]},ge(gF,G,{transform(e,t){var n=e.as||["startAngle","endAngle"],r=n[0],i=n[1],a=e.field||kd,s=e.startAngle||0,o=e.endAngle!=null?e.endAngle:2*Math.PI,u=t.source,l=u.map(a),c=l.length,f=s,d=(o-s)/DR(l),h=Kr(c),g,p,v;for(e.sort&&h.sort((m,y)=>l[m]-l[y]),g=0;g<c;++g)v=l[h[g]],p=u[h[g]],p[r]=f,p[i]=f+=v*d;return this.value=l,t.reflow(e.modified()).modifies(n)}});const lse=5;function cse(e){const t=e.type;return!e.bins&&(t===Nc||t===lh||t===ch)}function qI(e){return cE(e)&&e!==Ma}const fse=wa(["set","modified","clear","type","scheme","schemeExtent","schemeCount","domain","domainMin","domainMid","domainMax","domainRaw","domainImplicit","nice","zero","bins","range","rangeStep","round","reverse","interpolate","interpolateGamma"]);function UI(e){G.call(this,null,e),this.modified(!0)}ge(UI,G,{transform(e,t){var n=t.dataflow,r=this.value,i=dse(e);(!r||i!==r.type)&&(this.value=r=ht(i)());for(i in e)if(!fse[i]){if(i==="padding"&&qI(r.type))continue;Ke(r[i])?r[i](e[i]):n.warn("Unsupported scale property: "+i)}return yse(r,e,mse(r,e,gse(r,e,n))),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function dse(e){var t=e.type,n="",r;return t===Ma?Ma+"-"+Nc:(hse(e)&&(r=e.rawDomain?e.rawDomain.length:e.domain?e.domain.length+ +(e.domainMid!=null):0,n=r===2?Ma+"-":r===3?Oc+"-":""),(n+t||Nc).toLowerCase())}function hse(e){const t=e.type;return cE(t)&&t!==Hu&&t!==ju&&(e.scheme||e.range&&e.range.length&&e.range.every(Ee))}function gse(e,t,n){const r=pse(e,t.domainRaw,n);if(r>-1)return r;var i=t.domain,a=e.type,s=t.zero||t.zero===void 0&&cse(e),o,u;if(!i)return 0;if((s||t.domainMin!=null||t.domainMax!=null||t.domainMid!=null)&&(o=(i=i.slice()).length-1||1,s&&(i[0]>0&&(i[0]=0),i[o]<0&&(i[o]=0)),t.domainMin!=null&&(i[0]=t.domainMin),t.domainMax!=null&&(i[o]=t.domainMax),t.domainMid!=null)){u=t.domainMid;const l=u>i[o]?o+1:u<i[0]?0:o;l!==o&&n.warn("Scale domainMid exceeds domain min or max.",u),i.splice(l,0,u)}return qI(a)&&t.padding&&i[0]!==st(i)&&(i=vse(a,i,t.range,t.padding,t.exponent,t.constant)),e.domain(VI(a,i,n)),a===aE&&e.unknown(t.domainImplicit?$x:void 0),t.nice&&e.nice&&e.nice(t.nice!==!0&&hE(e,t.nice)||null),i.length}function pse(e,t,n){return t?(e.domain(VI(e.type,t,n)),t.length):-1}function vse(e,t,n,r,i,a){var s=Math.abs(st(n)-n[0]),o=s/(s-2*r),u=e===Cs?oR(t,null,o):e===ch?nw(t,null,o,.5):e===lh?nw(t,null,o,i||1):e===ev?uR(t,null,o,a||1):sR(t,null,o);return t=t.slice(),t[0]=u[0],t[t.length-1]=u[1],t}function VI(e,t,n){if(SO(e)){var r=Math.abs(t.reduce((i,a)=>i+(a<0?-1:a>0?1:0),0));r!==t.length&&n.warn("Log scale domain includes zero: "+he(t))}return t}function mse(e,t,n){let r=t.bins;if(r&&!ee(r)){const i=e.domain(),a=i[0],s=st(i),o=r.step;let u=r.start==null?a:r.start,l=r.stop==null?s:r.stop;o||Q("Scale bins parameter missing step property."),u<a&&(u=o*Math.ceil(a/o)),l>s&&(l=o*Math.floor(s/o)),r=Kr(u,l+o/2,o)}return r?e.bins=r:e.bins&&delete e.bins,e.type===oE&&(r?!t.domain&&!t.domainRaw&&(e.domain(r),n=r.length):e.bins=e.domain()),n}function yse(e,t,n){var r=e.type,i=t.round||!1,a=t.range;if(t.rangeStep!=null)a=bse(r,t,n);else if(t.scheme&&(a=wse(r,t,n),Ke(a))){if(e.interpolator)return e.interpolator(a);Q(`Scale type ${r} does not support interpolating color schemes.`)}if(a&&CO(r))return e.interpolator(dE(pF(a,t.reverse),t.interpolate,t.interpolateGamma));a&&t.interpolate&&e.interpolate?e.interpolate(AO(t.interpolate,t.interpolateGamma)):Ke(e.round)?e.round(i):Ke(e.rangeRound)&&e.interpolate(i?oh:$o),a&&e.range(pF(a,t.reverse))}function bse(e,t,n){e!==mO&&e!==sE&&Q("Only band and point scales support rangeStep.");var r=(t.paddingOuter!=null?t.paddingOuter:t.padding)||0,i=e===sE?1:(t.paddingInner!=null?t.paddingInner:t.padding)||0;return[0,t.rangeStep*iE(n,i,r)]}function wse(e,t,n){var r=t.schemeExtent,i,a;return ee(t.scheme)?a=dE(t.scheme,t.interpolate,t.interpolateGamma):(i=t.scheme.toLowerCase(),a=DO(i),a||Q(`Unrecognized scheme name: ${t.scheme}`)),n=e===nv?n+1:e===oE?n-1:e===Ic||e===tv?+t.schemeCount||lse:n,CO(e)?WI(a,r,t.reverse):Ke(a)?fne(WI(a,r),n):e===aE?a:a.slice(0,n)}function WI(e,t,n){return Ke(e)&&(t||n)?cne(e,pF(t||[0,1],n)):e}function pF(e,t){return t?e.slice().reverse():e}function HI(e){G.call(this,null,e)}ge(HI,G,{transform(e,t){const n=e.modified("sort")||t.changed(t.ADD)||t.modified(e.sort.fields)||t.modified("datum");return n&&t.source.sort(Nu(e.sort)),this.modified(n),t}});const jI="zero",GI="center",YI="normalize",XI=["y0","y1"];function vF(e){G.call(this,null,e)}vF.Definition={type:"Stack",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"groupby",type:"field",array:!0},{name:"sort",type:"compare"},{name:"offset",type:"enum",default:jI,values:[jI,GI,YI]},{name:"as",type:"string",array:!0,length:2,default:XI}]},ge(vF,G,{transform(e,t){var n=e.as||XI,r=n[0],i=n[1],a=Nu(e.sort),s=e.field||kd,o=e.offset===GI?xse:e.offset===YI?Ese:Fse,u,l,c,f;for(u=Sse(t.source,e.groupby,a,s),l=0,c=u.length,f=u.max;l<c;++l)o(u[l],f,s,r,i);return t.reflow(e.modified()).modifies(n)}});function xse(e,t,n,r,i){for(var a=(t-e.sum)/2,s=e.length,o=0,u;o<s;++o)u=e[o],u[r]=a,u[i]=a+=Math.abs(n(u))}function Ese(e,t,n,r,i){for(var a=1/e.sum,s=0,o=e.length,u=0,l=0,c;u<o;++u)c=e[u],c[r]=s,c[i]=s=a*(l+=Math.abs(n(c)))}function Fse(e,t,n,r,i){for(var a=0,s=0,o=e.length,u=0,l,c;u<o;++u)c=e[u],l=+n(c),l<0?(c[r]=s,c[i]=s+=l):(c[r]=a,c[i]=a+=l)}function Sse(e,t,n,r){var i=[],a=p=>p(c),s,o,u,l,c,f,d,h,g;if(t==null)i.push(e.slice());else for(s={},o=0,u=e.length;o<u;++o)c=e[o],f=t.map(a),d=s[f],d||(s[f]=d=[],i.push(d)),d.push(c);for(f=0,g=0,l=i.length;f<l;++f){for(d=i[f],o=0,h=0,u=d.length;o<u;++o)h+=Math.abs(r(d[o]));d.sum=h,h>g&&(g=h),n&&d.sort(n)}return i.max=g,i}const Cse=Object.freeze(Object.defineProperty({__proto__:null,axisticks:RI,datajoin:PI,encode:NI,legendentries:OI,linkpath:hF,pie:gF,scale:UI,sortitems:HI,stack:vF},Symbol.toStringTag,{value:"Module"}));var Pe=1e-6,qv=1e-12,tt=Math.PI,Yt=tt/2,Uv=tt/4,mr=tt*2,Zt=180/tt,et=tt/180,it=Math.abs,jc=Math.atan,bi=Math.atan2,Ne=Math.cos,Vv=Math.ceil,KI=Math.exp,mF=Math.hypot,Wv=Math.log,yF=Math.pow,$e=Math.sin,wi=Math.sign||function(e){return e>0?1:e<0?-1:0},yr=Math.sqrt,bF=Math.tan;function ZI(e){return e>1?0:e<-1?tt:Math.acos(e)}function Ir(e){return e>1?Yt:e<-1?-Yt:Math.asin(e)}function zn(){}function Hv(e,t){e&&JI.hasOwnProperty(e.type)&&JI[e.type](e,t)}var QI={Feature:function(e,t){Hv(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Hv(n[r].geometry,t)}},JI={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){wF(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)wF(n[r],t,0)},Polygon:function(e,t){eB(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)eB(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Hv(n[r],t)}};function wF(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function eB(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)wF(e[n],t,1);t.polygonEnd()}function Ts(e,t){e&&QI.hasOwnProperty(e.type)?QI[e.type](e,t):Hv(e,t)}var jv=new dr,Gv=new dr,tB,nB,xF,EF,FF,Pa={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){jv=new dr,Pa.lineStart=kse,Pa.lineEnd=_se},polygonEnd:function(){var e=+jv;Gv.add(e<0?mr+e:e),this.lineStart=this.lineEnd=this.point=zn},sphere:function(){Gv.add(mr)}};function kse(){Pa.point=Ase}function _se(){rB(tB,nB)}function Ase(e,t){Pa.point=rB,tB=e,nB=t,e*=et,t*=et,xF=e,EF=Ne(t=t/2+Uv),FF=$e(t)}function rB(e,t){e*=et,t*=et,t=t/2+Uv;var n=e-xF,r=n>=0?1:-1,i=r*n,a=Ne(t),s=$e(t),o=FF*s,u=EF*a+o*Ne(i),l=o*r*$e(i);jv.add(bi(l,u)),xF=e,EF=a,FF=s}function Tse(e){return Gv=new dr,Ts(e,Pa),Gv*2}function Yv(e){return[bi(e[1],e[0]),Ir(e[2])]}function rl(e){var t=e[0],n=e[1],r=Ne(n);return[r*Ne(t),r*$e(t),$e(n)]}function Xv(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Gc(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function SF(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Kv(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Zv(e){var t=yr(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var qt,Br,Xt,Jr,il,iB,aB,Yc,Ah,Vo,Ms,$s={point:CF,lineStart:oB,lineEnd:uB,polygonStart:function(){$s.point=lB,$s.lineStart=Mse,$s.lineEnd=$se,Ah=new dr,Pa.polygonStart()},polygonEnd:function(){Pa.polygonEnd(),$s.point=CF,$s.lineStart=oB,$s.lineEnd=uB,jv<0?(qt=-(Xt=180),Br=-(Jr=90)):Ah>Pe?Jr=90:Ah<-Pe&&(Br=-90),Ms[0]=qt,Ms[1]=Xt},sphere:function(){qt=-(Xt=180),Br=-(Jr=90)}};function CF(e,t){Vo.push(Ms=[qt=e,Xt=e]),t<Br&&(Br=t),t>Jr&&(Jr=t)}function sB(e,t){var n=rl([e*et,t*et]);if(Yc){var r=Gc(Yc,n),i=[r[1],-r[0],0],a=Gc(i,r);Zv(a),a=Yv(a);var s=e-il,o=s>0?1:-1,u=a[0]*Zt*o,l,c=it(s)>180;c^(o*il<u&&u<o*e)?(l=a[1]*Zt,l>Jr&&(Jr=l)):(u=(u+360)%360-180,c^(o*il<u&&u<o*e)?(l=-a[1]*Zt,l<Br&&(Br=l)):(t<Br&&(Br=t),t>Jr&&(Jr=t))),c?e<il?ei(qt,e)>ei(qt,Xt)&&(Xt=e):ei(e,Xt)>ei(qt,Xt)&&(qt=e):Xt>=qt?(e<qt&&(qt=e),e>Xt&&(Xt=e)):e>il?ei(qt,e)>ei(qt,Xt)&&(Xt=e):ei(e,Xt)>ei(qt,Xt)&&(qt=e)}else Vo.push(Ms=[qt=e,Xt=e]);t<Br&&(Br=t),t>Jr&&(Jr=t),Yc=n,il=e}function oB(){$s.point=sB}function uB(){Ms[0]=qt,Ms[1]=Xt,$s.point=CF,Yc=null}function lB(e,t){if(Yc){var n=e-il;Ah.add(it(n)>180?n+(n>0?360:-360):n)}else iB=e,aB=t;Pa.point(e,t),sB(e,t)}function Mse(){Pa.lineStart()}function $se(){lB(iB,aB),Pa.lineEnd(),it(Ah)>Pe&&(qt=-(Xt=180)),Ms[0]=qt,Ms[1]=Xt,Yc=null}function ei(e,t){return(t-=e)<0?t+360:t}function Dse(e,t){return e[0]-t[0]}function cB(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}function Rse(e){var t,n,r,i,a,s,o;if(Jr=Xt=-(qt=Br=1/0),Vo=[],Ts(e,$s),n=Vo.length){for(Vo.sort(Dse),t=1,r=Vo[0],a=[r];t<n;++t)i=Vo[t],cB(r,i[0])||cB(r,i[1])?(ei(r[0],i[1])>ei(r[0],r[1])&&(r[1]=i[1]),ei(i[0],r[1])>ei(r[0],r[1])&&(r[0]=i[0])):a.push(r=i);for(s=-1/0,n=a.length-1,t=0,r=a[n];t<=n;r=i,++t)i=a[t],(o=ei(r[1],i[0]))>s&&(s=o,qt=i[0],Xt=r[1])}return Vo=Ms=null,qt===1/0||Br===1/0?[[NaN,NaN],[NaN,NaN]]:[[qt,Br],[Xt,Jr]]}var Th,Qv,Jv,em,tm,nm,rm,im,kF,_F,AF,fB,dB,br,wr,xr,Wi={sphere:zn,point:TF,lineStart:hB,lineEnd:gB,polygonStart:function(){Wi.lineStart=Ose,Wi.lineEnd=Ise},polygonEnd:function(){Wi.lineStart=hB,Wi.lineEnd=gB}};function TF(e,t){e*=et,t*=et;var n=Ne(t);Mh(n*Ne(e),n*$e(e),$e(t))}function Mh(e,t,n){++Th,Jv+=(e-Jv)/Th,em+=(t-em)/Th,tm+=(n-tm)/Th}function hB(){Wi.point=Pse}function Pse(e,t){e*=et,t*=et;var n=Ne(t);br=n*Ne(e),wr=n*$e(e),xr=$e(t),Wi.point=Nse,Mh(br,wr,xr)}function Nse(e,t){e*=et,t*=et;var n=Ne(t),r=n*Ne(e),i=n*$e(e),a=$e(t),s=bi(yr((s=wr*a-xr*i)*s+(s=xr*r-br*a)*s+(s=br*i-wr*r)*s),br*r+wr*i+xr*a);Qv+=s,nm+=s*(br+(br=r)),rm+=s*(wr+(wr=i)),im+=s*(xr+(xr=a)),Mh(br,wr,xr)}function gB(){Wi.point=TF}function Ose(){Wi.point=Bse}function Ise(){pB(fB,dB),Wi.point=TF}function Bse(e,t){fB=e,dB=t,e*=et,t*=et,Wi.point=pB;var n=Ne(t);br=n*Ne(e),wr=n*$e(e),xr=$e(t),Mh(br,wr,xr)}function pB(e,t){e*=et,t*=et;var n=Ne(t),r=n*Ne(e),i=n*$e(e),a=$e(t),s=wr*a-xr*i,o=xr*r-br*a,u=br*i-wr*r,l=mF(s,o,u),c=Ir(l),f=l&&-c/l;kF.add(f*s),_F.add(f*o),AF.add(f*u),Qv+=c,nm+=c*(br+(br=r)),rm+=c*(wr+(wr=i)),im+=c*(xr+(xr=a)),Mh(br,wr,xr)}function Lse(e){Th=Qv=Jv=em=tm=nm=rm=im=0,kF=new dr,_F=new dr,AF=new dr,Ts(e,Wi);var t=+kF,n=+_F,r=+AF,i=mF(t,n,r);return i<qv&&(t=nm,n=rm,r=im,Qv<Pe&&(t=Jv,n=em,r=tm),i=mF(t,n,r),i<qv)?[NaN,NaN]:[bi(n,t)*Zt,Ir(r/i)*Zt]}function MF(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function $F(e,t){return it(e)>tt&&(e-=Math.round(e/mr)*mr),[e,t]}$F.invert=$F;function vB(e,t,n){return(e%=mr)?t||n?MF(yB(e),bB(t,n)):yB(e):t||n?bB(t,n):$F}function mB(e){return function(t,n){return t+=e,it(t)>tt&&(t-=Math.round(t/mr)*mr),[t,n]}}function yB(e){var t=mB(e);return t.invert=mB(-e),t}function bB(e,t){var n=Ne(e),r=$e(e),i=Ne(t),a=$e(t);function s(o,u){var l=Ne(u),c=Ne(o)*l,f=$e(o)*l,d=$e(u),h=d*n+c*r;return[bi(f*i-h*a,c*n-d*r),Ir(h*i+f*a)]}return s.invert=function(o,u){var l=Ne(u),c=Ne(o)*l,f=$e(o)*l,d=$e(u),h=d*i-f*a;return[bi(f*i+d*a,c*n+h*r),Ir(h*n-c*r)]},s}function zse(e){e=vB(e[0]*et,e[1]*et,e.length>2?e[2]*et:0);function t(n){return n=e(n[0]*et,n[1]*et),n[0]*=Zt,n[1]*=Zt,n}return t.invert=function(n){return n=e.invert(n[0]*et,n[1]*et),n[0]*=Zt,n[1]*=Zt,n},t}function qse(e,t,n,r,i,a){if(n){var s=Ne(t),o=$e(t),u=r*n;i==null?(i=t+r*mr,a=t-u/2):(i=wB(s,i),a=wB(s,a),(r>0?i<a:i>a)&&(i+=r*mr));for(var l,c=i;r>0?c>a:c<a;c-=u)l=Yv([s,-o*Ne(c),-o*$e(c)]),e.point(l[0],l[1])}}function wB(e,t){t=rl(t),t[0]-=e,Zv(t);var n=ZI(-t[1]);return((-t[2]<0?-n:n)+mr-Pe)%mr}function xB(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:zn,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function am(e,t){return it(e[0]-t[0])<Pe&&it(e[1]-t[1])<Pe}function sm(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function EB(e,t,n,r,i){var a=[],s=[],o,u;if(e.forEach(function(g){if(!((p=g.length-1)<=0)){var p,v=g[0],m=g[p],y;if(am(v,m)){if(!v[2]&&!m[2]){for(i.lineStart(),o=0;o<p;++o)i.point((v=g[o])[0],v[1]);i.lineEnd();return}m[0]+=2*Pe}a.push(y=new sm(v,g,null,!0)),s.push(y.o=new sm(v,null,y,!1)),a.push(y=new sm(m,g,null,!1)),s.push(y.o=new sm(m,null,y,!0))}}),!!a.length){for(s.sort(t),FB(a),FB(s),o=0,u=s.length;o<u;++o)s[o].e=n=!n;for(var l=a[0],c,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;c=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(o=0,u=c.length;o<u;++o)i.point((f=c[o])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(c=d.p.z,o=c.length-1;o>=0;--o)i.point((f=c[o])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,c=d.z,h=!h}while(!d.v);i.lineEnd()}}}function FB(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function DF(e){return it(e[0])<=tt?e[0]:wi(e[0])*((it(e[0])+tt)%mr-tt)}function Use(e,t){var n=DF(t),r=t[1],i=$e(r),a=[$e(n),-Ne(n),0],s=0,o=0,u=new dr;i===1?r=Yt+Pe:i===-1&&(r=-Yt-Pe);for(var l=0,c=e.length;l<c;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],g=DF(h),p=h[1]/2+Uv,v=$e(p),m=Ne(p),y=0;y<d;++y,g=w,v=F,m=x,h=b){var b=f[y],w=DF(b),E=b[1]/2+Uv,F=$e(E),x=Ne(E),C=w-g,S=C>=0?1:-1,_=S*C,k=_>tt,T=v*F;if(u.add(bi(T*S*$e(_),m*x+T*Ne(_))),s+=k?C+S*mr:C,k^g>=n^w>=n){var A=Gc(rl(h),rl(b));Zv(A);var $=Gc(a,A);Zv($);var M=(k^C>=0?-1:1)*Ir($[2]);(r>M||r===M&&(A[0]||A[1]))&&(o+=k^C>=0?1:-1)}}return(s<-Pe||s<Pe&&u<-qv)^o&1}function SB(e,t,n,r){return function(i){var a=t(i),s=xB(),o=t(s),u=!1,l,c,f,d={point:h,lineStart:p,lineEnd:v,polygonStart:function(){d.point=m,d.lineStart=y,d.lineEnd=b,c=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=p,d.lineEnd=v,c=$R(c);var w=Use(l,r);c.length?(u||(i.polygonStart(),u=!0),EB(c,Wse,w,n,i)):w&&(u||(i.polygonStart(),u=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),u&&(i.polygonEnd(),u=!1),c=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(w,E){e(w,E)&&i.point(w,E)}function g(w,E){a.point(w,E)}function p(){d.point=g,a.lineStart()}function v(){d.point=h,a.lineEnd()}function m(w,E){f.push([w,E]),o.point(w,E)}function y(){o.lineStart(),f=[]}function b(){m(f[0][0],f[0][1]),o.lineEnd();var w=o.clean(),E=s.result(),F,x=E.length,C,S,_;if(f.pop(),l.push(f),f=null,!!x){if(w&1){if(S=E[0],(C=S.length-1)>0){for(u||(i.polygonStart(),u=!0),i.lineStart(),F=0;F<C;++F)i.point((_=S[F])[0],_[1]);i.lineEnd()}return}x>1&&w&2&&E.push(E.pop().concat(E.shift())),c.push(E.filter(Vse))}}return d}}function Vse(e){return e.length>1}function Wse(e,t){return((e=e.x)[0]<0?e[1]-Yt-Pe:Yt-e[1])-((t=t.x)[0]<0?t[1]-Yt-Pe:Yt-t[1])}const CB=SB(function(){return!0},Hse,Gse,[-tt,-Yt]);function Hse(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,s){var o=a>0?tt:-tt,u=it(a-t);it(u-tt)<Pe?(e.point(t,n=(n+s)/2>0?Yt:-Yt),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(o,n),e.point(a,n),i=0):r!==o&&u>=tt&&(it(t-r)<Pe&&(t-=r*Pe),it(a-o)<Pe&&(a-=o*Pe),n=jse(t,n,a,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(o,n),i=0),e.point(t=a,n=s),r=o},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function jse(e,t,n,r){var i,a,s=$e(e-n);return it(s)>Pe?jc(($e(t)*(a=Ne(r))*$e(n)-$e(r)*(i=Ne(t))*$e(e))/(i*a*s)):(t+r)/2}function Gse(e,t,n,r){var i;if(e==null)i=n*Yt,r.point(-tt,i),r.point(0,i),r.point(tt,i),r.point(tt,0),r.point(tt,-i),r.point(0,-i),r.point(-tt,-i),r.point(-tt,0),r.point(-tt,i);else if(it(e[0]-t[0])>Pe){var a=e[0]<t[0]?tt:-tt;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(t[0],t[1])}function Yse(e){var t=Ne(e),n=2*et,r=t>0,i=it(t)>Pe;function a(c,f,d,h){qse(h,e,n,d,c,f)}function s(c,f){return Ne(c)*Ne(f)>t}function o(c){var f,d,h,g,p;return{lineStart:function(){g=h=!1,p=1},point:function(v,m){var y=[v,m],b,w=s(v,m),E=r?w?0:l(v,m):w?l(v+(v<0?tt:-tt),m):0;if(!f&&(g=h=w)&&c.lineStart(),w!==h&&(b=u(f,y),(!b||am(f,b)||am(y,b))&&(y[2]=1)),w!==h)p=0,w?(c.lineStart(),b=u(y,f),c.point(b[0],b[1])):(b=u(f,y),c.point(b[0],b[1],2),c.lineEnd()),f=b;else if(i&&f&&r^w){var F;!(E&d)&&(F=u(y,f,!0))&&(p=0,r?(c.lineStart(),c.point(F[0][0],F[0][1]),c.point(F[1][0],F[1][1]),c.lineEnd()):(c.point(F[1][0],F[1][1]),c.lineEnd(),c.lineStart(),c.point(F[0][0],F[0][1],3)))}w&&(!f||!am(f,y))&&c.point(y[0],y[1]),f=y,h=w,d=E},lineEnd:function(){h&&c.lineEnd(),f=null},clean:function(){return p|(g&&h)<<1}}}function u(c,f,d){var h=rl(c),g=rl(f),p=[1,0,0],v=Gc(h,g),m=Xv(v,v),y=v[0],b=m-y*y;if(!b)return!d&&c;var w=t*m/b,E=-t*y/b,F=Gc(p,v),x=Kv(p,w),C=Kv(v,E);SF(x,C);var S=F,_=Xv(x,S),k=Xv(S,S),T=_*_-k*(Xv(x,x)-1);if(!(T<0)){var A=yr(T),$=Kv(S,(-_-A)/k);if(SF($,x),$=Yv($),!d)return $;var M=c[0],D=f[0],P=c[1],N=f[1],O;D<M&&(O=M,M=D,D=O);var q=D-M,z=it(q-tt)<Pe,W=z||q<Pe;if(!z&&N<P&&(O=P,P=N,N=O),W?z?P+N>0^$[1]<(it($[0]-M)<Pe?P:N):P<=$[1]&&$[1]<=N:q>tt^(M<=$[0]&&$[0]<=D)){var Y=Kv(S,(-_+A)/k);return SF(Y,x),[$,Yv(Y)]}}}function l(c,f){var d=r?e:tt-e,h=0;return c<-d?h|=1:c>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return SB(s,o,a,r?[0,-e]:[-tt,e-tt])}function Xse(e,t,n,r,i,a){var s=e[0],o=e[1],u=t[0],l=t[1],c=0,f=1,d=u-s,h=l-o,g;if(g=n-s,!(!d&&g>0)){if(g/=d,d<0){if(g<c)return;g<f&&(f=g)}else if(d>0){if(g>f)return;g>c&&(c=g)}if(g=i-s,!(!d&&g<0)){if(g/=d,d<0){if(g>f)return;g>c&&(c=g)}else if(d>0){if(g<c)return;g<f&&(f=g)}if(g=r-o,!(!h&&g>0)){if(g/=h,h<0){if(g<c)return;g<f&&(f=g)}else if(h>0){if(g>f)return;g>c&&(c=g)}if(g=a-o,!(!h&&g<0)){if(g/=h,h<0){if(g>f)return;g>c&&(c=g)}else if(h>0){if(g<c)return;g<f&&(f=g)}return c>0&&(e[0]=s+c*d,e[1]=o+c*h),f<1&&(t[0]=s+f*d,t[1]=o+f*h),!0}}}}}var $h=1e9,om=-$h;function kB(e,t,n,r){function i(l,c){return e<=l&&l<=n&&t<=c&&c<=r}function a(l,c,f,d){var h=0,g=0;if(l==null||(h=s(l,f))!==(g=s(c,f))||u(l,c)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==g);else d.point(c[0],c[1])}function s(l,c){return it(l[0]-e)<Pe?c>0?0:3:it(l[0]-n)<Pe?c>0?2:1:it(l[1]-t)<Pe?c>0?1:0:c>0?3:2}function o(l,c){return u(l.x,c.x)}function u(l,c){var f=s(l,1),d=s(c,1);return f!==d?f-d:f===0?c[1]-l[1]:f===1?l[0]-c[0]:f===2?l[1]-c[1]:c[0]-l[0]}return function(l){var c=l,f=xB(),d,h,g,p,v,m,y,b,w,E,F,x={point:C,lineStart:T,lineEnd:A,polygonStart:_,polygonEnd:k};function C(M,D){i(M,D)&&c.point(M,D)}function S(){for(var M=0,D=0,P=h.length;D<P;++D)for(var N=h[D],O=1,q=N.length,z=N[0],W,Y,J=z[0],X=z[1];O<q;++O)W=J,Y=X,z=N[O],J=z[0],X=z[1],Y<=r?X>r&&(J-W)*(r-Y)>(X-Y)*(e-W)&&++M:X<=r&&(J-W)*(r-Y)<(X-Y)*(e-W)&&--M;return M}function _(){c=f,d=[],h=[],F=!0}function k(){var M=S(),D=F&&M,P=(d=$R(d)).length;(D||P)&&(l.polygonStart(),D&&(l.lineStart(),a(null,null,1,l),l.lineEnd()),P&&EB(d,o,M,a,l),l.polygonEnd()),c=l,d=h=g=null}function T(){x.point=$,h&&h.push(g=[]),E=!0,w=!1,y=b=NaN}function A(){d&&($(p,v),m&&w&&f.rejoin(),d.push(f.result())),x.point=C,w&&c.lineEnd()}function $(M,D){var P=i(M,D);if(h&&g.push([M,D]),E)p=M,v=D,m=P,E=!1,P&&(c.lineStart(),c.point(M,D));else if(P&&w)c.point(M,D);else{var N=[y=Math.max(om,Math.min($h,y)),b=Math.max(om,Math.min($h,b))],O=[M=Math.max(om,Math.min($h,M)),D=Math.max(om,Math.min($h,D))];Xse(N,O,e,t,n,r)?(w||(c.lineStart(),c.point(N[0],N[1])),c.point(O[0],O[1]),P||c.lineEnd(),F=!1):P&&(c.lineStart(),c.point(M,D),F=!1)}y=M,b=D,w=P}return x}}function _B(e,t,n){var r=Kr(e,t-Pe,n).concat(t);return function(i){return r.map(function(a){return[i,a]})}}function AB(e,t,n){var r=Kr(e,t-Pe,n).concat(t);return function(i){return r.map(function(a){return[a,i]})}}function Kse(){var e,t,n,r,i,a,s,o,u=10,l=u,c=90,f=360,d,h,g,p,v=2.5;function m(){return{type:"MultiLineString",coordinates:y()}}function y(){return Kr(Vv(r/c)*c,n,c).map(g).concat(Kr(Vv(o/f)*f,s,f).map(p)).concat(Kr(Vv(t/u)*u,e,u).filter(function(b){return it(b%c)>Pe}).map(d)).concat(Kr(Vv(a/l)*l,i,l).filter(function(b){return it(b%f)>Pe}).map(h))}return m.lines=function(){return y().map(function(b){return{type:"LineString",coordinates:b}})},m.outline=function(){return{type:"Polygon",coordinates:[g(r).concat(p(s).slice(1),g(n).reverse().slice(1),p(o).reverse().slice(1))]}},m.extent=function(b){return arguments.length?m.extentMajor(b).extentMinor(b):m.extentMinor()},m.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],o=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),o>s&&(b=o,o=s,s=b),m.precision(v)):[[r,o],[n,s]]},m.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],a=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),a>i&&(b=a,a=i,i=b),m.precision(v)):[[t,a],[e,i]]},m.step=function(b){return arguments.length?m.stepMajor(b).stepMinor(b):m.stepMinor()},m.stepMajor=function(b){return arguments.length?(c=+b[0],f=+b[1],m):[c,f]},m.stepMinor=function(b){return arguments.length?(u=+b[0],l=+b[1],m):[u,l]},m.precision=function(b){return arguments.length?(v=+b,d=_B(a,i,90),h=AB(t,e,v),g=_B(o,s,90),p=AB(r,n,v),m):v},m.extentMajor([[-180,-90+Pe],[180,90-Pe]]).extentMinor([[-180,-80-Pe],[180,80+Pe]])}const Dh=e=>e;var RF=new dr,PF=new dr,TB,MB,NF,OF,Wo={point:zn,lineStart:zn,lineEnd:zn,polygonStart:function(){Wo.lineStart=Zse,Wo.lineEnd=Jse},polygonEnd:function(){Wo.lineStart=Wo.lineEnd=Wo.point=zn,RF.add(it(PF)),PF=new dr},result:function(){var e=RF/2;return RF=new dr,e}};function Zse(){Wo.point=Qse}function Qse(e,t){Wo.point=$B,TB=NF=e,MB=OF=t}function $B(e,t){PF.add(OF*e-NF*t),NF=e,OF=t}function Jse(){$B(TB,MB)}const DB=Wo;var Xc=1/0,um=Xc,Rh=-Xc,lm=Rh,eoe={point:toe,lineStart:zn,lineEnd:zn,polygonStart:zn,polygonEnd:zn,result:function(){var e=[[Xc,um],[Rh,lm]];return Rh=lm=-(um=Xc=1/0),e}};function toe(e,t){e<Xc&&(Xc=e),e>Rh&&(Rh=e),t<um&&(um=t),t>lm&&(lm=t)}const cm=eoe;var IF=0,BF=0,Ph=0,fm=0,dm=0,Kc=0,LF=0,zF=0,Nh=0,RB,PB,Na,Oa,Hi={point:al,lineStart:NB,lineEnd:OB,polygonStart:function(){Hi.lineStart=ioe,Hi.lineEnd=aoe},polygonEnd:function(){Hi.point=al,Hi.lineStart=NB,Hi.lineEnd=OB},result:function(){var e=Nh?[LF/Nh,zF/Nh]:Kc?[fm/Kc,dm/Kc]:Ph?[IF/Ph,BF/Ph]:[NaN,NaN];return IF=BF=Ph=fm=dm=Kc=LF=zF=Nh=0,e}};function al(e,t){IF+=e,BF+=t,++Ph}function NB(){Hi.point=noe}function noe(e,t){Hi.point=roe,al(Na=e,Oa=t)}function roe(e,t){var n=e-Na,r=t-Oa,i=yr(n*n+r*r);fm+=i*(Na+e)/2,dm+=i*(Oa+t)/2,Kc+=i,al(Na=e,Oa=t)}function OB(){Hi.point=al}function ioe(){Hi.point=soe}function aoe(){IB(RB,PB)}function soe(e,t){Hi.point=IB,al(RB=Na=e,PB=Oa=t)}function IB(e,t){var n=e-Na,r=t-Oa,i=yr(n*n+r*r);fm+=i*(Na+e)/2,dm+=i*(Oa+t)/2,Kc+=i,i=Oa*e-Na*t,LF+=i*(Na+e),zF+=i*(Oa+t),Nh+=i*3,al(Na=e,Oa=t)}const BB=Hi;function LB(e){this._context=e}LB.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,mr);break}}},result:zn};var qF=new dr,UF,zB,qB,Oh,Ih,hm={point:zn,lineStart:function(){hm.point=ooe},lineEnd:function(){UF&&UB(zB,qB),hm.point=zn},polygonStart:function(){UF=!0},polygonEnd:function(){UF=null},result:function(){var e=+qF;return qF=new dr,e}};function ooe(e,t){hm.point=UB,zB=Oh=e,qB=Ih=t}function UB(e,t){Oh-=e,Ih-=t,qF.add(yr(Oh*Oh+Ih*Ih)),Oh=e,Ih=t}const VB=hm;let WB,gm,HB,jB;class GB{constructor(t){this._append=t==null?YB:uoe(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==HB||this._append!==gm){const r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,HB=r,gm=this._append,jB=this._,this._=i}this._+=jB;break}}}result(){const t=this._;return this._="",t.length?t:null}}function YB(e){let t=1;this._+=e[0];for(const n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function uoe(e){const t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return YB;if(t!==WB){const n=10**t;WB=t,gm=function(i){let a=1;this._+=i[0];for(const s=i.length;a<s;++a)this._+=Math.round(arguments[a]*n)/n+i[a]}}return gm}function XB(e,t){let n=3,r=4.5,i,a;function s(o){return o&&(typeof r=="function"&&a.pointRadius(+r.apply(this,arguments)),Ts(o,i(a))),a.result()}return s.area=function(o){return Ts(o,i(DB)),DB.result()},s.measure=function(o){return Ts(o,i(VB)),VB.result()},s.bounds=function(o){return Ts(o,i(cm)),cm.result()},s.centroid=function(o){return Ts(o,i(BB)),BB.result()},s.projection=function(o){return arguments.length?(i=o==null?(e=null,Dh):(e=o).stream,s):e},s.context=function(o){return arguments.length?(a=o==null?(t=null,new GB(n)):new LB(t=o),typeof r!="function"&&a.pointRadius(r),s):t},s.pointRadius=function(o){return arguments.length?(r=typeof o=="function"?o:(a.pointRadius(+o),+o),s):r},s.digits=function(o){if(!arguments.length)return n;if(o==null)n=null;else{const u=Math.floor(o);if(!(u>=0))throw new RangeError(`invalid digits: ${o}`);n=u}return t===null&&(a=new GB(n)),s},s.projection(e).digits(n).context(t)}function pm(e){return function(t){var n=new VF;for(var r in e)n[r]=e[r];return n.stream=t,n}}function VF(){}VF.prototype={constructor:VF,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function WF(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Ts(n,e.stream(cm)),t(cm.result()),r!=null&&e.clipExtent(r),e}function vm(e,t,n){return WF(e,function(r){var i=t[1][0]-t[0][0],a=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),o=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,u=+t[0][1]+(a-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([o,u])},n)}function HF(e,t,n){return vm(e,[[0,0],t],n)}function jF(e,t,n){return WF(e,function(r){var i=+t,a=i/(r[1][0]-r[0][0]),s=(i-a*(r[1][0]+r[0][0]))/2,o=-a*r[0][1];e.scale(150*a).translate([s,o])},n)}function GF(e,t,n){return WF(e,function(r){var i=+t,a=i/(r[1][1]-r[0][1]),s=-a*r[0][0],o=(i-a*(r[1][1]+r[0][1]))/2;e.scale(150*a).translate([s,o])},n)}var KB=16,loe=Ne(30*et);function ZB(e,t){return+t?foe(e,t):coe(e)}function coe(e){return pm({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function foe(e,t){function n(r,i,a,s,o,u,l,c,f,d,h,g,p,v){var m=l-r,y=c-i,b=m*m+y*y;if(b>4*t&&p--){var w=s+d,E=o+h,F=u+g,x=yr(w*w+E*E+F*F),C=Ir(F/=x),S=it(it(F)-1)<Pe||it(a-f)<Pe?(a+f)/2:bi(E,w),_=e(S,C),k=_[0],T=_[1],A=k-r,$=T-i,M=y*A-m*$;(M*M/b>t||it((m*A+y*$)/b-.5)>.3||s*d+o*h+u*g<loe)&&(n(r,i,a,s,o,u,k,T,S,w/=x,E/=x,F,p,v),v.point(k,T),n(k,T,S,w,E,F,l,c,f,d,h,g,p,v))}}return function(r){var i,a,s,o,u,l,c,f,d,h,g,p,v={point:m,lineStart:y,lineEnd:w,polygonStart:function(){r.polygonStart(),v.lineStart=E},polygonEnd:function(){r.polygonEnd(),v.lineStart=y}};function m(C,S){C=e(C,S),r.point(C[0],C[1])}function y(){f=NaN,v.point=b,r.lineStart()}function b(C,S){var _=rl([C,S]),k=e(C,S);n(f,d,c,h,g,p,f=k[0],d=k[1],c=C,h=_[0],g=_[1],p=_[2],KB,r),r.point(f,d)}function w(){v.point=m,r.lineEnd()}function E(){y(),v.point=F,v.lineEnd=x}function F(C,S){b(i=C,S),a=f,s=d,o=h,u=g,l=p,v.point=b}function x(){n(f,d,c,h,g,p,a,s,i,o,u,l,KB,r),v.lineEnd=w,w()}return v}}var doe=pm({point:function(e,t){this.stream.point(e*et,t*et)}});function hoe(e){return pm({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function goe(e,t,n,r,i){function a(s,o){return s*=r,o*=i,[t+e*s,n-e*o]}return a.invert=function(s,o){return[(s-t)/e*r,(n-o)/e*i]},a}function QB(e,t,n,r,i,a){if(!a)return goe(e,t,n,r,i);var s=Ne(a),o=$e(a),u=s*e,l=o*e,c=s/e,f=o/e,d=(o*n-s*t)/e,h=(o*t+s*n)/e;function g(p,v){return p*=r,v*=i,[u*p-l*v+t,n-l*p-u*v]}return g.invert=function(p,v){return[r*(c*p-f*v+d),i*(h-f*p-c*v)]},g}function Ia(e){return JB(function(){return e})()}function JB(e){var t,n=150,r=480,i=250,a=0,s=0,o=0,u=0,l=0,c,f=0,d=1,h=1,g=null,p=CB,v=null,m,y,b,w=Dh,E=.5,F,x,C,S,_;function k(M){return C(M[0]*et,M[1]*et)}function T(M){return M=C.invert(M[0],M[1]),M&&[M[0]*Zt,M[1]*Zt]}k.stream=function(M){return S&&_===M?S:S=doe(hoe(c)(p(F(w(_=M)))))},k.preclip=function(M){return arguments.length?(p=M,g=void 0,$()):p},k.postclip=function(M){return arguments.length?(w=M,v=m=y=b=null,$()):w},k.clipAngle=function(M){return arguments.length?(p=+M?Yse(g=M*et):(g=null,CB),$()):g*Zt},k.clipExtent=function(M){return arguments.length?(w=M==null?(v=m=y=b=null,Dh):kB(v=+M[0][0],m=+M[0][1],y=+M[1][0],b=+M[1][1]),$()):v==null?null:[[v,m],[y,b]]},k.scale=function(M){return arguments.length?(n=+M,A()):n},k.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],A()):[r,i]},k.center=function(M){return arguments.length?(a=M[0]%360*et,s=M[1]%360*et,A()):[a*Zt,s*Zt]},k.rotate=function(M){return arguments.length?(o=M[0]%360*et,u=M[1]%360*et,l=M.length>2?M[2]%360*et:0,A()):[o*Zt,u*Zt,l*Zt]},k.angle=function(M){return arguments.length?(f=M%360*et,A()):f*Zt},k.reflectX=function(M){return arguments.length?(d=M?-1:1,A()):d<0},k.reflectY=function(M){return arguments.length?(h=M?-1:1,A()):h<0},k.precision=function(M){return arguments.length?(F=ZB(x,E=M*M),$()):yr(E)},k.fitExtent=function(M,D){return vm(k,M,D)},k.fitSize=function(M,D){return HF(k,M,D)},k.fitWidth=function(M,D){return jF(k,M,D)},k.fitHeight=function(M,D){return GF(k,M,D)};function A(){var M=QB(n,0,0,d,h,f).apply(null,t(a,s)),D=QB(n,r-M[0],i-M[1],d,h,f);return c=vB(o,u,l),x=MF(t,D),C=MF(c,x),F=ZB(x,E),$()}function $(){return S=_=null,k}return function(){return t=e.apply(this,arguments),k.invert=t.invert&&T,A()}}function YF(e){var t=0,n=tt/3,r=JB(e),i=r(t,n);return i.parallels=function(a){return arguments.length?r(t=a[0]*et,n=a[1]*et):[t*Zt,n*Zt]},i}function poe(e){var t=Ne(e);function n(r,i){return[r*t,$e(i)/t]}return n.invert=function(r,i){return[r/t,Ir(i*t)]},n}function voe(e,t){var n=$e(e),r=(n+$e(t))/2;if(it(r)<Pe)return poe(e);var i=1+n*(2*r-n),a=yr(i)/r;function s(o,u){var l=yr(i-2*r*$e(u))/r;return[l*$e(o*=r),a-l*Ne(o)]}return s.invert=function(o,u){var l=a-u,c=bi(o,it(l))*wi(l);return l*r<0&&(c-=tt*wi(o)*wi(l)),[c/r,Ir((i-(o*o+l*l)*r*r)/(2*r))]},s}function mm(){return YF(voe).scale(155.424).center([0,33.6442])}function eL(){return mm().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function moe(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function yoe(){var e,t,n=eL(),r,i=mm().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a,s=mm().rotate([157,0]).center([-3,19.9]).parallels([8,18]),o,u,l={point:function(d,h){u=[d,h]}};function c(d){var h=d[0],g=d[1];return u=null,r.point(h,g),u||(a.point(h,g),u)||(o.point(h,g),u)}c.invert=function(d){var h=n.scale(),g=n.translate(),p=(d[0]-g[0])/h,v=(d[1]-g[1])/h;return(v>=.12&&v<.234&&p>=-.425&&p<-.214?i:v>=.166&&v<.234&&p>=-.214&&p<-.115?s:n).invert(d)},c.stream=function(d){return e&&t===d?e:e=moe([n.stream(t=d),i.stream(d),s.stream(d)])},c.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},c.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),c.translate(n.translate())):n.scale()},c.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),g=+d[0],p=+d[1];return r=n.translate(d).clipExtent([[g-.455*h,p-.238*h],[g+.455*h,p+.238*h]]).stream(l),a=i.translate([g-.307*h,p+.201*h]).clipExtent([[g-.425*h+Pe,p+.12*h+Pe],[g-.214*h-Pe,p+.234*h-Pe]]).stream(l),o=s.translate([g-.205*h,p+.212*h]).clipExtent([[g-.214*h+Pe,p+.166*h+Pe],[g-.115*h-Pe,p+.234*h-Pe]]).stream(l),f()},c.fitExtent=function(d,h){return vm(c,d,h)},c.fitSize=function(d,h){return HF(c,d,h)},c.fitWidth=function(d,h){return jF(c,d,h)},c.fitHeight=function(d,h){return GF(c,d,h)};function f(){return e=t=null,c}return c.scale(1070)}function tL(e){return function(t,n){var r=Ne(t),i=Ne(n),a=e(r*i);return a===1/0?[2,0]:[a*i*$e(t),a*$e(n)]}}function Bh(e){return function(t,n){var r=yr(t*t+n*n),i=e(r),a=$e(i),s=Ne(i);return[bi(t*a,r*s),Ir(r&&n*a/r)]}}var nL=tL(function(e){return yr(2/(1+e))});nL.invert=Bh(function(e){return 2*Ir(e/2)});function boe(){return Ia(nL).scale(124.75).clipAngle(180-.001)}var rL=tL(function(e){return(e=ZI(e))&&e/$e(e)});rL.invert=Bh(function(e){return e});function woe(){return Ia(rL).scale(79.4188).clipAngle(180-.001)}function ym(e,t){return[e,Wv(bF((Yt+t)/2))]}ym.invert=function(e,t){return[e,2*jc(KI(t))-Yt]};function xoe(){return iL(ym).scale(961/mr)}function iL(e){var t=Ia(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,s=null,o,u,l;t.scale=function(f){return arguments.length?(r(f),c()):r()},t.translate=function(f){return arguments.length?(i(f),c()):i()},t.center=function(f){return arguments.length?(n(f),c()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=o=u=l=null:(s=+f[0][0],o=+f[0][1],u=+f[1][0],l=+f[1][1]),c()):s==null?null:[[s,o],[u,l]]};function c(){var f=tt*r(),d=t(zse(t.rotate()).invert([0,0]));return a(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===ym?[[Math.max(d[0]-f,s),o],[Math.min(d[0]+f,u),l]]:[[s,Math.max(d[1]-f,o)],[u,Math.min(d[1]+f,l)]])}return c()}function bm(e){return bF((Yt+e)/2)}function Eoe(e,t){var n=Ne(e),r=e===t?$e(e):Wv(n/Ne(t))/Wv(bm(t)/bm(e)),i=n*yF(bm(e),r)/r;if(!r)return ym;function a(s,o){i>0?o<-Yt+Pe&&(o=-Yt+Pe):o>Yt-Pe&&(o=Yt-Pe);var u=i/yF(bm(o),r);return[u*$e(r*s),i-u*Ne(r*s)]}return a.invert=function(s,o){var u=i-o,l=wi(r)*yr(s*s+u*u),c=bi(s,it(u))*wi(u);return u*r<0&&(c-=tt*wi(s)*wi(u)),[c/r,2*jc(yF(i/l,1/r))-Yt]},a}function Foe(){return YF(Eoe).scale(109.5).parallels([30,30])}function wm(e,t){return[e,t]}wm.invert=wm;function Soe(){return Ia(wm).scale(152.63)}function Coe(e,t){var n=Ne(e),r=e===t?$e(e):(n-Ne(t))/(t-e),i=n/r+e;if(it(r)<Pe)return wm;function a(s,o){var u=i-o,l=r*s;return[u*$e(l),i-u*Ne(l)]}return a.invert=function(s,o){var u=i-o,l=bi(s,it(u))*wi(u);return u*r<0&&(l-=tt*wi(s)*wi(u)),[l/r,i-wi(r)*yr(s*s+u*u)]},a}function koe(){return YF(Coe).scale(131.154).center([0,13.9389])}var Lh=1.340264,zh=-.081106,qh=893e-6,Uh=.003796,xm=yr(3)/2,_oe=12;function aL(e,t){var n=Ir(xm*$e(t)),r=n*n,i=r*r*r;return[e*Ne(n)/(xm*(Lh+3*zh*r+i*(7*qh+9*Uh*r))),n*(Lh+zh*r+i*(qh+Uh*r))]}aL.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,a=0,s,o,u;a<_oe&&(o=n*(Lh+zh*r+i*(qh+Uh*r))-t,u=Lh+3*zh*r+i*(7*qh+9*Uh*r),n-=s=o/u,r=n*n,i=r*r*r,!(it(s)<qv));++a);return[xm*e*(Lh+3*zh*r+i*(7*qh+9*Uh*r))/Ne(n),Ir($e(n)/xm)]};function Aoe(){return Ia(aL).scale(177.158)}function sL(e,t){var n=Ne(t),r=Ne(e)*n;return[n*$e(e)/r,$e(t)/r]}sL.invert=Bh(jc);function Toe(){return Ia(sL).scale(144.049).clipAngle(60)}function Moe(){var e=1,t=0,n=0,r=1,i=1,a=0,s,o,u=null,l,c,f,d=1,h=1,g=pm({point:function(w,E){var F=b([w,E]);this.stream.point(F[0],F[1])}}),p=Dh,v,m;function y(){return d=e*r,h=e*i,v=m=null,b}function b(w){var E=w[0]*d,F=w[1]*h;if(a){var x=F*s-E*o;E=E*s+F*o,F=x}return[E+t,F+n]}return b.invert=function(w){var E=w[0]-t,F=w[1]-n;if(a){var x=F*s+E*o;E=E*s-F*o,F=x}return[E/d,F/h]},b.stream=function(w){return v&&m===w?v:v=g(p(m=w))},b.postclip=function(w){return arguments.length?(p=w,u=l=c=f=null,y()):p},b.clipExtent=function(w){return arguments.length?(p=w==null?(u=l=c=f=null,Dh):kB(u=+w[0][0],l=+w[0][1],c=+w[1][0],f=+w[1][1]),y()):u==null?null:[[u,l],[c,f]]},b.scale=function(w){return arguments.length?(e=+w,y()):e},b.translate=function(w){return arguments.length?(t=+w[0],n=+w[1],y()):[t,n]},b.angle=function(w){return arguments.length?(a=w%360*et,o=$e(a),s=Ne(a),y()):a*Zt},b.reflectX=function(w){return arguments.length?(r=w?-1:1,y()):r<0},b.reflectY=function(w){return arguments.length?(i=w?-1:1,y()):i<0},b.fitExtent=function(w,E){return vm(b,w,E)},b.fitSize=function(w,E){return HF(b,w,E)},b.fitWidth=function(w,E){return jF(b,w,E)},b.fitHeight=function(w,E){return GF(b,w,E)},b}function oL(e,t){var n=t*t,r=n*n;return[e*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),t*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}oL.invert=function(e,t){var n=t,r=25,i;do{var a=n*n,s=a*a;n-=i=(n*(1.007226+a*(.015085+s*(-.044475+.028874*a-.005916*s)))-t)/(1.007226+a*(.015085*3+s*(-.044475*7+.028874*9*a-.005916*11*s)))}while(it(i)>Pe&&--r>0);return[e/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]};function $oe(){return Ia(oL).scale(175.295)}function uL(e,t){return[Ne(t)*$e(e),$e(t)]}uL.invert=Bh(Ir);function Doe(){return Ia(uL).scale(249.5).clipAngle(90+Pe)}function lL(e,t){var n=Ne(t),r=1+Ne(e)*n;return[n*$e(e)/r,$e(t)/r]}lL.invert=Bh(function(e){return 2*jc(e)});function Roe(){return Ia(lL).scale(250).clipAngle(142)}function cL(e,t){return[Wv(bF((Yt+t)/2)),-e]}cL.invert=function(e,t){return[-t,2*jc(KI(e))-Yt]};function Poe(){var e=iL(cL),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}var Noe=Math.abs,XF=Math.cos,Em=Math.sin,Ooe=1e-6,fL=Math.PI,KF=fL/2,dL=Ioe(2);function hL(e){return e>1?KF:e<-1?-KF:Math.asin(e)}function Ioe(e){return e>0?Math.sqrt(e):0}function Boe(e,t){var n=e*Em(t),r=30,i;do t-=i=(t+Em(t)-n)/(1+XF(t));while(Noe(i)>Ooe&&--r>0);return t/2}function Loe(e,t,n){function r(i,a){return[e*i*XF(a=Boe(n,a)),t*Em(a)]}return r.invert=function(i,a){return a=hL(a/t),[i/(e*XF(a)),hL((2*a+Em(2*a))/n)]},r}var zoe=Loe(dL/KF,dL,fL);function qoe(){return Ia(zoe).scale(169.529)}const Uoe=XB(),ZF=["clipAngle","clipExtent","scale","translate","center","rotate","parallels","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function Voe(e,t){return function n(){const r=t();return r.type=e,r.path=XB().projection(r),r.copy=r.copy||function(){const i=n();return ZF.forEach(a=>{r[a]&&i[a](r[a]())}),i.path.pointRadius(r.path.pointRadius()),i},xO(r)}}function gL(e,t){if(!e||typeof e!="string")throw new Error("Projection type must be a name string.");return e=e.toLowerCase(),arguments.length>1?(Fm[e]=Voe(e,t),this):Fm[e]||null}function pL(e){return e&&e.path||Uoe}const Fm={albers:eL,albersusa:yoe,azimuthalequalarea:boe,azimuthalequidistant:woe,conicconformal:Foe,conicequalarea:mm,conicequidistant:koe,equalEarth:Aoe,equirectangular:Soe,gnomonic:Toe,identity:Moe,mercator:xoe,mollweide:qoe,naturalEarth1:$oe,orthographic:Doe,stereographic:Roe,transversemercator:Poe};for(const e in Fm)gL(e,Fm[e]);function Woe(){}const Ds=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function vL(){var e=1,t=1,n=o;function r(u,l){return l.map(c=>i(u,c))}function i(u,l){var c=[],f=[];return a(u,l,d=>{n(d,u,l),Hoe(d)>0?c.push([d]):f.push(d)}),f.forEach(d=>{for(var h=0,g=c.length,p;h<g;++h)if(joe((p=c[h])[0],d)!==-1){p.push(d);return}}),{type:"MultiPolygon",value:l,coordinates:c}}function a(u,l,c){var f=[],d=[],h,g,p,v,m,y;for(h=g=-1,v=u[0]>=l,Ds[v<<1].forEach(b);++h<e-1;)p=v,v=u[h+1]>=l,Ds[p|v<<1].forEach(b);for(Ds[v<<0].forEach(b);++g<t-1;){for(h=-1,v=u[g*e+e]>=l,m=u[g*e]>=l,Ds[v<<1|m<<2].forEach(b);++h<e-1;)p=v,v=u[g*e+e+h+1]>=l,y=m,m=u[g*e+h+1]>=l,Ds[p|v<<1|m<<2|y<<3].forEach(b);Ds[v|m<<3].forEach(b)}for(h=-1,m=u[g*e]>=l,Ds[m<<2].forEach(b);++h<e-1;)y=m,m=u[g*e+h+1]>=l,Ds[m<<2|y<<3].forEach(b);Ds[m<<3].forEach(b);function b(w){var E=[w[0][0]+h,w[0][1]+g],F=[w[1][0]+h,w[1][1]+g],x=s(E),C=s(F),S,_;(S=d[x])?(_=f[C])?(delete d[S.end],delete f[_.start],S===_?(S.ring.push(F),c(S.ring)):f[S.start]=d[_.end]={start:S.start,end:_.end,ring:S.ring.concat(_.ring)}):(delete d[S.end],S.ring.push(F),d[S.end=C]=S):(S=f[C])?(_=d[x])?(delete f[S.start],delete d[_.end],S===_?(S.ring.push(F),c(S.ring)):f[_.start]=d[S.end]={start:_.start,end:S.end,ring:_.ring.concat(S.ring)}):(delete f[S.start],S.ring.unshift(E),f[S.start=x]=S):f[x]=d[C]={start:x,end:C,ring:[E,F]}}}function s(u){return u[0]*2+u[1]*(e+1)*4}function o(u,l,c){u.forEach(f=>{var d=f[0],h=f[1],g=d|0,p=h|0,v,m=l[p*e+g];d>0&&d<e&&g===d&&(v=l[p*e+g-1],f[0]=d+(c-v)/(m-v)-.5),h>0&&h<t&&p===h&&(v=l[(p-1)*e+g],f[1]=h+(c-v)/(m-v)-.5)})}return r.contour=i,r.size=function(u){if(!arguments.length)return[e,t];var l=Math.floor(u[0]),c=Math.floor(u[1]);return l>=0&&c>=0||Q("invalid size"),e=l,t=c,r},r.smooth=function(u){return arguments.length?(n=u?o:Woe,r):n===o},r}function Hoe(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}function joe(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=Goe(e,t[n]))return i;return 0}function Goe(e,t){for(var n=t[0],r=t[1],i=-1,a=0,s=e.length,o=s-1;a<s;o=a++){var u=e[a],l=u[0],c=u[1],f=e[o],d=f[0],h=f[1];if(Yoe(u,f,t))return 0;c>r!=h>r&&n<(d-l)*(r-c)/(h-c)+l&&(i=-i)}return i}function Yoe(e,t,n){var r;return Xoe(e,t,n)&&Koe(e[r=+(e[0]===t[0])],n[r],t[r])}function Xoe(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function Koe(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function mL(e,t,n){return function(r){var i=gs(r),a=n?Math.min(i[0],0):i[0],s=i[1],o=s-a,u=t?xo(a,s,e):o/(e+1);return Kr(a+u,s,u)}}function QF(e){G.call(this,null,e)}QF.Definition={type:"Isocontour",metadata:{generates:!0},params:[{name:"field",type:"field"},{name:"thresholds",type:"number",array:!0},{name:"levels",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"zero",type:"boolean",default:!0},{name:"smooth",type:"boolean",default:!0},{name:"scale",type:"number",expr:!0},{name:"translate",type:"number",array:!0,expr:!0},{name:"as",type:"string",null:!0,default:"contour"}]},ge(QF,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=e.field||lr,a=vL().smooth(e.smooth!==!1),s=e.thresholds||Zoe(r,i,e),o=e.as===null?null:e.as||"contour",u=[];return r.forEach(l=>{const c=i(l),f=a.size([c.width,c.height])(c.values,ee(s)?s:s(c.values));Qoe(f,c,l,e),f.forEach(d=>{u.push(C0(l,vt(o!=null?{[o]:d}:d)))})}),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function Zoe(e,t,n){const r=mL(n.levels||10,n.nice,n.zero!==!1);return n.resolve!=="shared"?r:r(e.map(i=>Mu(t(i).values)))}function Qoe(e,t,n,r){let i=r.scale||t.scale,a=r.translate||t.translate;if(Ke(i)&&(i=i(n,r)),Ke(a)&&(a=a(n,r)),(i===1||i==null)&&!a)return;const s=(yt(i)?i:i[0])||1,o=(yt(i)?i:i[1])||1,u=a&&a[0]||0,l=a&&a[1]||0;e.forEach(yL(t,s,o,u,l))}function yL(e,t,n,r,i){const a=e.x1||0,s=e.y1||0,o=t*n<0;function u(f){f.forEach(l)}function l(f){o&&f.reverse(),f.forEach(c)}function c(f){f[0]=(f[0]-a)*t+r,f[1]=(f[1]-s)*n+i}return function(f){return f.coordinates.forEach(u),f}}function bL(e,t,n){const r=e>=0?e:G3(t,n);return Math.round((Math.sqrt(4*r*r+1)-1)/2)}function JF(e){return Ke(e)?e:fr(+e)}function wL(){var e=u=>u[0],t=u=>u[1],n=kd,r=[-1,-1],i=960,a=500,s=2;function o(u,l){const c=bL(r[0],u,e)>>s,f=bL(r[1],u,t)>>s,d=c?c+2:0,h=f?f+2:0,g=2*d+(i>>s),p=2*h+(a>>s),v=new Float32Array(g*p),m=new Float32Array(g*p);let y=v;u.forEach(w=>{const E=d+(+e(w)>>s),F=h+(+t(w)>>s);E>=0&&E<g&&F>=0&&F<p&&(v[E+F*g]+=+n(w))}),c>0&&f>0?(Zc(g,p,v,m,c),Qc(g,p,m,v,f),Zc(g,p,v,m,c),Qc(g,p,m,v,f),Zc(g,p,v,m,c),Qc(g,p,m,v,f)):c>0?(Zc(g,p,v,m,c),Zc(g,p,m,v,c),Zc(g,p,v,m,c),y=m):f>0&&(Qc(g,p,v,m,f),Qc(g,p,m,v,f),Qc(g,p,v,m,f),y=m);const b=l?Math.pow(2,-2*s):1/DR(y);for(let w=0,E=g*p;w<E;++w)y[w]*=b;return{values:y,scale:1<<s,width:g,height:p,x1:d,y1:h,x2:d+(i>>s),y2:h+(a>>s)}}return o.x=function(u){return arguments.length?(e=JF(u),o):e},o.y=function(u){return arguments.length?(t=JF(u),o):t},o.weight=function(u){return arguments.length?(n=JF(u),o):n},o.size=function(u){if(!arguments.length)return[i,a];var l=+u[0],c=+u[1];return l>=0&&c>=0||Q("invalid size"),i=l,a=c,o},o.cellSize=function(u){return arguments.length?((u=+u)>=1||Q("invalid cell size"),s=Math.floor(Math.log(u)/Math.LN2),o):1<<s},o.bandwidth=function(u){return arguments.length?(u=be(u),u.length===1&&(u=[+u[0],+u[0]]),u.length!==2&&Q("invalid bandwidth"),r=u,o):r},o}function Zc(e,t,n,r,i){const a=(i<<1)+1;for(let s=0;s<t;++s)for(let o=0,u=0;o<e+i;++o)o<e&&(u+=n[o+s*e]),o>=i&&(o>=a&&(u-=n[o-a+s*e]),r[o-i+s*e]=u/Math.min(o+1,e-1+a-o,a))}function Qc(e,t,n,r,i){const a=(i<<1)+1;for(let s=0;s<e;++s)for(let o=0,u=0;o<t+i;++o)o<t&&(u+=n[s+o*e]),o>=i&&(o>=a&&(u-=n[s+(o-a)*e]),r[s+(o-i)*e]=u/Math.min(o+1,t-1+a-o,a))}function eS(e){G.call(this,null,e)}eS.Definition={type:"KDE2D",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"weight",type:"field"},{name:"groupby",type:"field",array:!0},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number",array:!0,length:2},{name:"counts",type:"boolean",default:!1},{name:"as",type:"string",default:"grid"}]};const Joe=["x","y","weight","size","cellSize","bandwidth"];function xL(e,t){return Joe.forEach(n=>t[n]!=null?e[n](t[n]):0),e}ge(eS,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=t.materialize(t.SOURCE).source,i=eue(r,e.groupby),a=(e.groupby||[]).map(Kt),s=xL(wL(),e),o=e.as||"grid",u=[];function l(c,f){for(let d=0;d<a.length;++d)c[a[d]]=f[d];return c}return u=i.map(c=>vt(l({[o]:s(c,e.counts)},c.dims))),this.value&&(n.rem=this.value),this.value=n.source=n.add=u,n}});function eue(e,t){var n=[],r=c=>c(o),i,a,s,o,u,l;if(t==null)n.push(e);else for(i={},a=0,s=e.length;a<s;++a)o=e[a],u=t.map(r),l=i[u],l||(i[u]=l=[],l.dims=u,n.push(l)),l.push(o);return n}function tS(e){G.call(this,null,e)}tS.Definition={type:"Contour",metadata:{generates:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"values",type:"number",array:!0},{name:"x",type:"field"},{name:"y",type:"field"},{name:"weight",type:"field"},{name:"cellSize",type:"number"},{name:"bandwidth",type:"number"},{name:"count",type:"number"},{name:"nice",type:"boolean",default:!1},{name:"thresholds",type:"number",array:!0},{name:"smooth",type:"boolean",default:!0}]},ge(tS,G,{transform(e,t){if(this.value&&!t.changed()&&!e.modified())return t.StopPropagation;var n=t.fork(t.NO_SOURCE|t.NO_FIELDS),r=vL().smooth(e.smooth!==!1),i=e.values,a=e.thresholds||mL(e.count||10,e.nice,!!i),s=e.size,o,u;return i||(i=t.materialize(t.SOURCE).source,o=xL(wL(),e)(i,!0),u=yL(o,o.scale||1,o.scale||1,0,0),s=[o.width,o.height],i=o.values),a=ee(a)?a:a(i),i=r.size(s)(i,a),u&&i.forEach(u),this.value&&(n.rem=this.value),this.value=n.source=n.add=(i||[]).map(vt),n}});const nS="Feature",rS="FeatureCollection",tue="MultiPoint";function iS(e){G.call(this,null,e)}iS.Definition={type:"GeoJSON",metadata:{},params:[{name:"fields",type:"field",array:!0,length:2},{name:"geojson",type:"field"}]},ge(iS,G,{transform(e,t){var n=this._features,r=this._points,i=e.fields,a=i&&i[0],s=i&&i[1],o=e.geojson||!i&&lr,u=t.ADD,l;l=e.modified()||t.changed(t.REM)||t.modified(ur(o))||a&&t.modified(ur(a))||s&&t.modified(ur(s)),(!this.value||l)&&(u=t.SOURCE,this._features=n=[],this._points=r=[]),o&&t.visit(u,c=>n.push(o(c))),a&&s&&(t.visit(u,c=>{var f=a(c),d=s(c);f!=null&&d!=null&&(f=+f)===f&&(d=+d)===d&&r.push([f,d])}),n=n.concat({type:nS,geometry:{type:tue,coordinates:r}})),this.value={type:rS,features:n}}});function aS(e){G.call(this,null,e)}aS.Definition={type:"GeoPath",metadata:{modifies:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"path"}]},ge(aS,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.field||lr,a=e.as||"path",s=n.SOURCE;!r||e.modified()?(this.value=r=pL(e.projection),n.materialize().reflow()):s=i===lr||t.modified(i.fields)?n.ADD_MOD:n.ADD;const o=nue(r,e.pointRadius);return n.visit(s,u=>u[a]=r(i(u))),r.pointRadius(o),n.modifies(a)}});function nue(e,t){const n=e.pointRadius();return e.context(null),t!=null&&e.pointRadius(t),n}function sS(e){G.call(this,null,e)}sS.Definition={type:"GeoPoint",metadata:{modifies:!0},params:[{name:"projection",type:"projection",required:!0},{name:"fields",type:"field",array:!0,required:!0,length:2},{name:"as",type:"string",array:!0,length:2,default:["x","y"]}]},ge(sS,G,{transform(e,t){var n=e.projection,r=e.fields[0],i=e.fields[1],a=e.as||["x","y"],s=a[0],o=a[1],u;function l(c){const f=n([r(c),i(c)]);f?(c[s]=f[0],c[o]=f[1]):(c[s]=void 0,c[o]=void 0)}return e.modified()?t=t.materialize().reflow(!0).visit(t.SOURCE,l):(u=t.modified(r.fields)||t.modified(i.fields),t.visit(u?t.ADD_MOD:t.ADD,l)),t.modifies(a)}});function oS(e){G.call(this,null,e)}oS.Definition={type:"GeoShape",metadata:{modifies:!0,nomod:!0},params:[{name:"projection",type:"projection"},{name:"field",type:"field",default:"datum"},{name:"pointRadius",type:"number",expr:!0},{name:"as",type:"string",default:"shape"}]},ge(oS,G,{transform(e,t){var n=t.fork(t.ALL),r=this.value,i=e.as||"shape",a=n.ADD;return(!r||e.modified())&&(this.value=r=rue(pL(e.projection),e.field||Ni("datum"),e.pointRadius),n.materialize().reflow(),a=n.SOURCE),n.visit(a,s=>s[i]=r),n.modifies(i)}});function rue(e,t,n){const r=n==null?i=>e(t(i)):i=>{var a=e.pointRadius(),s=e.pointRadius(n)(t(i));return e.pointRadius(a),s};return r.context=i=>(e.context(i),r),r}function uS(e){G.call(this,[],e),this.generator=Kse()}uS.Definition={type:"Graticule",metadata:{changes:!0,generates:!0},params:[{name:"extent",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMajor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"extentMinor",type:"array",array:!0,length:2,content:{type:"number",array:!0,length:2}},{name:"step",type:"number",array:!0,length:2},{name:"stepMajor",type:"number",array:!0,length:2,default:[90,360]},{name:"stepMinor",type:"number",array:!0,length:2,default:[10,10]},{name:"precision",type:"number",default:2.5}]},ge(uS,G,{transform(e,t){var n=this.value,r=this.generator,i;if(!n.length||e.modified())for(const a in e)Ke(r[a])&&r[a](e[a]);return i=r(),n.length?t.mod.push(R3(n[0],i)):t.add.push(vt(i)),n[0]=i,t}});function lS(e){G.call(this,null,e)}lS.Definition={type:"heatmap",metadata:{modifies:!0},params:[{name:"field",type:"field"},{name:"color",type:"string",expr:!0},{name:"opacity",type:"number",expr:!0},{name:"resolve",type:"enum",values:["shared","independent"],default:"independent"},{name:"as",type:"string",default:"image"}]},ge(lS,G,{transform(e,t){if(!t.changed()&&!e.modified())return t.StopPropagation;var n=t.materialize(t.SOURCE).source,r=e.resolve==="shared",i=e.field||lr,a=aue(e.opacity,e),s=iue(e.color,e),o=e.as||"image",u={$x:0,$y:0,$value:0,$max:r?Mu(n.map(l=>Mu(i(l).values))):0};return n.forEach(l=>{const c=i(l),f=Ze({},l,u);r||(f.$max=Mu(c.values||[])),l[o]=sue(c,f,s.dep?s:fr(s(f)),a.dep?a:fr(a(f)))}),t.reflow(!0).modifies(o)}});function iue(e,t){let n;return Ke(e)?(n=r=>Mo(e(r,t)),n.dep=EL(e)):n=fr(Mo(e||"#888")),n}function aue(e,t){let n;return Ke(e)?(n=r=>e(r,t),n.dep=EL(e)):e?n=fr(e):(n=r=>r.$value/r.$max||0,n.dep=!0),n}function EL(e){if(!Ke(e))return!1;const t=wa(ur(e));return t.$x||t.$y||t.$value||t.$max}function sue(e,t,n,r){const i=e.width,a=e.height,s=e.x1||0,o=e.y1||0,u=e.x2||i,l=e.y2||a,c=e.values,f=c?v=>c[v]:ku,d=_o(u-s,l-o),h=d.getContext("2d"),g=h.getImageData(0,0,u-s,l-o),p=g.data;for(let v=o,m=0;v<l;++v){t.$y=v-o;for(let y=s,b=v*i;y<u;++y,m+=4){t.$x=y-s,t.$value=f(y+b);const w=n(t);p[m+0]=w.r,p[m+1]=w.g,p[m+2]=w.b,p[m+3]=~~(255*r(t))}}return h.putImageData(g,0,0),d}function FL(e){G.call(this,null,e),this.modified(!0)}ge(FL,G,{transform(e,t){let n=this.value;return!n||e.modified("type")?(this.value=n=uue(e.type),ZF.forEach(r=>{e[r]!=null&&SL(n,r,e[r])})):ZF.forEach(r=>{e.modified(r)&&SL(n,r,e[r])}),e.pointRadius!=null&&n.path.pointRadius(e.pointRadius),e.fit&&oue(n,e),t.fork(t.NO_SOURCE|t.NO_FIELDS)}});function oue(e,t){const n=lue(t.fit);t.extent?e.fitExtent(t.extent,n):t.size&&e.fitSize(t.size,n)}function uue(e){const t=gL((e||"mercator").toLowerCase());return t||Q("Unrecognized projection type: "+e),t()}function SL(e,t,n){Ke(e[t])&&e[t](n)}function lue(e){return e=be(e),e.length===1?e[0]:{type:rS,features:e.reduce((t,n)=>t.concat(cue(n)),[])}}function cue(e){return e.type===rS?e.features:be(e).filter(t=>t!=null).map(t=>t.type===nS?t:{type:nS,geometry:t})}const fue=Object.freeze(Object.defineProperty({__proto__:null,contour:tS,geojson:iS,geopath:aS,geopoint:sS,geoshape:oS,graticule:uS,heatmap:lS,isocontour:QF,kde2d:eS,projection:FL},Symbol.toStringTag,{value:"Module"}));function due(e,t){var n,r=1;e==null&&(e=0),t==null&&(t=0);function i(){var a,s=n.length,o,u=0,l=0;for(a=0;a<s;++a)o=n[a],u+=o.x,l+=o.y;for(u=(u/s-e)*r,l=(l/s-t)*r,a=0;a<s;++a)o=n[a],o.x-=u,o.y-=l}return i.initialize=function(a){n=a},i.x=function(a){return arguments.length?(e=+a,i):e},i.y=function(a){return arguments.length?(t=+a,i):t},i.strength=function(a){return arguments.length?(r=+a,i):r},i}function hue(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return CL(this.cover(t,n),t,n,e)}function CL(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,s={data:r},o=e._x0,u=e._y0,l=e._x1,c=e._y1,f,d,h,g,p,v,m,y;if(!a)return e._root=s,e;for(;a.length;)if((p=t>=(f=(o+l)/2))?o=f:l=f,(v=n>=(d=(u+c)/2))?u=d:c=d,i=a,!(a=a[m=v<<1|p]))return i[m]=s,e;if(h=+e._x.call(null,a.data),g=+e._y.call(null,a.data),t===h&&n===g)return s.next=a,i?i[m]=s:e._root=s,e;do i=i?i[m]=new Array(4):e._root=new Array(4),(p=t>=(f=(o+l)/2))?o=f:l=f,(v=n>=(d=(u+c)/2))?u=d:c=d;while((m=v<<1|p)===(y=(g>=d)<<1|h>=f));return i[y]=a,i[m]=s,e}function gue(e){var t,n,r=e.length,i,a,s=new Array(r),o=new Array(r),u=1/0,l=1/0,c=-1/0,f=-1/0;for(n=0;n<r;++n)isNaN(i=+this._x.call(null,t=e[n]))||isNaN(a=+this._y.call(null,t))||(s[n]=i,o[n]=a,i<u&&(u=i),i>c&&(c=i),a<l&&(l=a),a>f&&(f=a));if(u>c||l>f)return this;for(this.cover(u,l).cover(c,f),n=0;n<r;++n)CL(this,s[n],o[n],e[n]);return this}function pue(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var s=i-n||1,o=this._root,u,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,u=new Array(4),u[l]=o,o=u,s*=2,l){case 0:i=n+s,a=r+s;break;case 1:n=i-s,a=r+s;break;case 2:i=n+s,r=a-s;break;case 3:n=i-s,r=a-s;break}this._root&&this._root.length&&(this._root=o)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function vue(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function mue(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Er(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function yue(e,t,n){var r,i=this._x0,a=this._y0,s,o,u,l,c=this._x1,f=this._y1,d=[],h=this._root,g,p;for(h&&d.push(new Er(h,i,a,c,f)),n==null?n=1/0:(i=e-n,a=t-n,c=e+n,f=t+n,n*=n);g=d.pop();)if(!(!(h=g.node)||(s=g.x0)>c||(o=g.y0)>f||(u=g.x1)<i||(l=g.y1)<a))if(h.length){var v=(s+u)/2,m=(o+l)/2;d.push(new Er(h[3],v,m,u,l),new Er(h[2],s,m,v,l),new Er(h[1],v,o,u,m),new Er(h[0],s,o,v,m)),(p=(t>=m)<<1|e>=v)&&(g=d[d.length-1],d[d.length-1]=d[d.length-1-p],d[d.length-1-p]=g)}else{var y=e-+this._x.call(null,h.data),b=t-+this._y.call(null,h.data),w=y*y+b*b;if(w<n){var E=Math.sqrt(n=w);i=e-E,a=t-E,c=e+E,f=t+E,r=h.data}}return r}function bue(e){if(isNaN(c=+this._x.call(null,e))||isNaN(f=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,s=this._x0,o=this._y0,u=this._x1,l=this._y1,c,f,d,h,g,p,v,m;if(!n)return this;if(n.length)for(;;){if((g=c>=(d=(s+u)/2))?s=d:u=d,(p=f>=(h=(o+l)/2))?o=h:l=h,t=n,!(n=n[v=p<<1|g]))return this;if(!n.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(r=t,m=v)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[v]=a:delete t[v],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[m]=n:this._root=n),this):(this._root=a,this)}function wue(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function xue(){return this._root}function Eue(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Fue(e){var t=[],n,r=this._root,i,a,s,o,u;for(r&&t.push(new Er(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,s=n.y0,o=n.x1,u=n.y1)&&r.length){var l=(a+o)/2,c=(s+u)/2;(i=r[3])&&t.push(new Er(i,l,c,o,u)),(i=r[2])&&t.push(new Er(i,a,c,l,u)),(i=r[1])&&t.push(new Er(i,l,s,o,c)),(i=r[0])&&t.push(new Er(i,a,s,l,c))}return this}function Sue(e){var t=[],n=[],r;for(this._root&&t.push(new Er(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,s=r.x0,o=r.y0,u=r.x1,l=r.y1,c=(s+u)/2,f=(o+l)/2;(a=i[0])&&t.push(new Er(a,s,o,c,f)),(a=i[1])&&t.push(new Er(a,c,o,u,f)),(a=i[2])&&t.push(new Er(a,s,f,c,l)),(a=i[3])&&t.push(new Er(a,c,f,u,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Cue(e){return e[0]}function kue(e){return arguments.length?(this._x=e,this):this._x}function _ue(e){return e[1]}function Aue(e){return arguments.length?(this._y=e,this):this._y}function cS(e,t,n){var r=new fS(t??Cue,n??_ue,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function fS(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function kL(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Fr=cS.prototype=fS.prototype;Fr.copy=function(){var e=new fS(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=kL(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=new Array(4)}):t.target[i]=kL(r));return e},Fr.add=hue,Fr.addAll=gue,Fr.cover=pue,Fr.data=vue,Fr.extent=mue,Fr.find=yue,Fr.remove=bue,Fr.removeAll=wue,Fr.root=xue,Fr.size=Eue,Fr.visit=Fue,Fr.visitAfter=Sue,Fr.x=kue,Fr.y=Aue;function Sr(e){return function(){return e}}function Ho(e){return(e()-.5)*1e-6}function Tue(e){return e.x+e.vx}function Mue(e){return e.y+e.vy}function $ue(e){var t,n,r,i=1,a=1;typeof e!="function"&&(e=Sr(e==null?1:+e));function s(){for(var l,c=t.length,f,d,h,g,p,v,m=0;m<a;++m)for(f=cS(t,Tue,Mue).visitAfter(o),l=0;l<c;++l)d=t[l],p=n[d.index],v=p*p,h=d.x+d.vx,g=d.y+d.vy,f.visit(y);function y(b,w,E,F,x){var C=b.data,S=b.r,_=p+S;if(C){if(C.index>d.index){var k=h-C.x-C.vx,T=g-C.y-C.vy,A=k*k+T*T;A<_*_&&(k===0&&(k=Ho(r),A+=k*k),T===0&&(T=Ho(r),A+=T*T),A=(_-(A=Math.sqrt(A)))/A*i,d.vx+=(k*=A)*(_=(S*=S)/(v+S)),d.vy+=(T*=A)*_,C.vx-=k*(_=1-_),C.vy-=T*_)}return}return w>h+_||F<h-_||E>g+_||x<g-_}}function o(l){if(l.data)return l.r=n[l.data.index];for(var c=l.r=0;c<4;++c)l[c]&&l[c].r>l.r&&(l.r=l[c].r)}function u(){if(t){var l,c=t.length,f;for(n=new Array(c),l=0;l<c;++l)f=t[l],n[f.index]=+e(f,l,t)}}return s.initialize=function(l,c){t=l,r=c,u()},s.iterations=function(l){return arguments.length?(a=+l,s):a},s.strength=function(l){return arguments.length?(i=+l,s):i},s.radius=function(l){return arguments.length?(e=typeof l=="function"?l:Sr(+l),u(),s):e},s}function Due(e){return e.index}function _L(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function Rue(e){var t=Due,n=f,r,i=Sr(30),a,s,o,u,l,c=1;e==null&&(e=[]);function f(v){return 1/Math.min(o[v.source.index],o[v.target.index])}function d(v){for(var m=0,y=e.length;m<c;++m)for(var b=0,w,E,F,x,C,S,_;b<y;++b)w=e[b],E=w.source,F=w.target,x=F.x+F.vx-E.x-E.vx||Ho(l),C=F.y+F.vy-E.y-E.vy||Ho(l),S=Math.sqrt(x*x+C*C),S=(S-a[b])/S*v*r[b],x*=S,C*=S,F.vx-=x*(_=u[b]),F.vy-=C*_,E.vx+=x*(_=1-_),E.vy+=C*_}function h(){if(s){var v,m=s.length,y=e.length,b=new Map(s.map((E,F)=>[t(E,F,s),E])),w;for(v=0,o=new Array(m);v<y;++v)w=e[v],w.index=v,typeof w.source!="object"&&(w.source=_L(b,w.source)),typeof w.target!="object"&&(w.target=_L(b,w.target)),o[w.source.index]=(o[w.source.index]||0)+1,o[w.target.index]=(o[w.target.index]||0)+1;for(v=0,u=new Array(y);v<y;++v)w=e[v],u[v]=o[w.source.index]/(o[w.source.index]+o[w.target.index]);r=new Array(y),g(),a=new Array(y),p()}}function g(){if(s)for(var v=0,m=e.length;v<m;++v)r[v]=+n(e[v],v,e)}function p(){if(s)for(var v=0,m=e.length;v<m;++v)a[v]=+i(e[v],v,e)}return d.initialize=function(v,m){s=v,l=m,h()},d.links=function(v){return arguments.length?(e=v,h(),d):e},d.id=function(v){return arguments.length?(t=v,d):t},d.iterations=function(v){return arguments.length?(c=+v,d):c},d.strength=function(v){return arguments.length?(n=typeof v=="function"?v:Sr(+v),g(),d):n},d.distance=function(v){return arguments.length?(i=typeof v=="function"?v:Sr(+v),p(),d):i},d}var Pue={value:()=>{}};function AL(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Sm(n)}function Sm(e){this._=e}function Nue(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Sm.prototype=AL.prototype={constructor:Sm,on:function(e,t){var n=this._,r=Nue(e+"",n),i,a=-1,s=r.length;if(arguments.length<2){for(;++a<s;)if((i=(e=r[a]).type)&&(i=Oue(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<s;)if(i=(e=r[a]).type)n[i]=TL(n[i],e.name,t);else if(t==null)for(i in n)n[i]=TL(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Sm(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function Oue(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function TL(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Pue,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Jc=0,Vh=0,Wh=0,ML=1e3,Cm,Hh,km=0,sl=0,_m=0,jh=typeof performance=="object"&&performance.now?performance:Date,$L=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function dS(){return sl||($L(Iue),sl=jh.now()+_m)}function Iue(){sl=0}function Am(){this._call=this._time=this._next=null}Am.prototype=DL.prototype={constructor:Am,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?dS():+n)+(t==null?0:+t),!this._next&&Hh!==this&&(Hh?Hh._next=this:Cm=this,Hh=this),this._call=e,this._time=n,hS()},stop:function(){this._call&&(this._call=null,this._time=1/0,hS())}};function DL(e,t,n){var r=new Am;return r.restart(e,t,n),r}function Bue(){dS(),++Jc;for(var e=Cm,t;e;)(t=sl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jc}function RL(){sl=(km=jh.now())+_m,Jc=Vh=0;try{Bue()}finally{Jc=0,zue(),sl=0}}function Lue(){var e=jh.now(),t=e-km;t>ML&&(_m-=t,km=e)}function zue(){for(var e,t=Cm,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Cm=n);Hh=e,hS(r)}function hS(e){if(!Jc){Vh&&(Vh=clearTimeout(Vh));var t=e-sl;t>24?(e<1/0&&(Vh=setTimeout(RL,e-jh.now()-_m)),Wh&&(Wh=clearInterval(Wh))):(Wh||(km=jh.now(),Wh=setInterval(Lue,ML)),Jc=1,$L(RL))}}function que(e,t,n){var r=new Am,i=t;return t==null?(r.restart(e,t,n),r):(r._restart=r.restart,r.restart=function(a,s,o){s=+s,o=o==null?dS():+o,r._restart(function u(l){l+=i,r._restart(u,i+=s,o),a(l)},s,o)},r.restart(e,t,n),r)}const Uue=1664525,Vue=1013904223,PL=4294967296;function Wue(){let e=1;return()=>(e=(Uue*e+Vue)%PL)/PL}function Hue(e){return e.x}function jue(e){return e.y}var Gue=10,Yue=Math.PI*(3-Math.sqrt(5));function Xue(e){var t,n=1,r=.001,i=1-Math.pow(r,1/300),a=0,s=.6,o=new Map,u=DL(f),l=AL("tick","end"),c=Wue();e==null&&(e=[]);function f(){d(),l.call("tick",t),n<r&&(u.stop(),l.call("end",t))}function d(p){var v,m=e.length,y;p===void 0&&(p=1);for(var b=0;b<p;++b)for(n+=(a-n)*i,o.forEach(function(w){w(n)}),v=0;v<m;++v)y=e[v],y.fx==null?y.x+=y.vx*=s:(y.x=y.fx,y.vx=0),y.fy==null?y.y+=y.vy*=s:(y.y=y.fy,y.vy=0);return t}function h(){for(var p=0,v=e.length,m;p<v;++p){if(m=e[p],m.index=p,m.fx!=null&&(m.x=m.fx),m.fy!=null&&(m.y=m.fy),isNaN(m.x)||isNaN(m.y)){var y=Gue*Math.sqrt(.5+p),b=p*Yue;m.x=y*Math.cos(b),m.y=y*Math.sin(b)}(isNaN(m.vx)||isNaN(m.vy))&&(m.vx=m.vy=0)}}function g(p){return p.initialize&&p.initialize(e,c),p}return h(),t={tick:d,restart:function(){return u.restart(f),t},stop:function(){return u.stop(),t},nodes:function(p){return arguments.length?(e=p,h(),o.forEach(g),t):e},alpha:function(p){return arguments.length?(n=+p,t):n},alphaMin:function(p){return arguments.length?(r=+p,t):r},alphaDecay:function(p){return arguments.length?(i=+p,t):+i},alphaTarget:function(p){return arguments.length?(a=+p,t):a},velocityDecay:function(p){return arguments.length?(s=1-p,t):1-s},randomSource:function(p){return arguments.length?(c=p,o.forEach(g),t):c},force:function(p,v){return arguments.length>1?(v==null?o.delete(p):o.set(p,g(v)),t):o.get(p)},find:function(p,v,m){var y=0,b=e.length,w,E,F,x,C;for(m==null?m=1/0:m*=m,y=0;y<b;++y)x=e[y],w=p-x.x,E=v-x.y,F=w*w+E*E,F<m&&(C=x,m=F);return C},on:function(p,v){return arguments.length>1?(l.on(p,v),t):l.on(p)}}}function Kue(){var e,t,n,r,i=Sr(-30),a,s=1,o=1/0,u=.81;function l(h){var g,p=e.length,v=cS(e,Hue,jue).visitAfter(f);for(r=h,g=0;g<p;++g)t=e[g],v.visit(d)}function c(){if(e){var h,g=e.length,p;for(a=new Array(g),h=0;h<g;++h)p=e[h],a[p.index]=+i(p,h,e)}}function f(h){var g=0,p,v,m=0,y,b,w;if(h.length){for(y=b=w=0;w<4;++w)(p=h[w])&&(v=Math.abs(p.value))&&(g+=p.value,m+=v,y+=v*p.x,b+=v*p.y);h.x=y/m,h.y=b/m}else{p=h,p.x=p.data.x,p.y=p.data.y;do g+=a[p.data.index];while(p=p.next)}h.value=g}function d(h,g,p,v){if(!h.value)return!0;var m=h.x-t.x,y=h.y-t.y,b=v-g,w=m*m+y*y;if(b*b/u<w)return w<o&&(m===0&&(m=Ho(n),w+=m*m),y===0&&(y=Ho(n),w+=y*y),w<s&&(w=Math.sqrt(s*w)),t.vx+=m*h.value*r/w,t.vy+=y*h.value*r/w),!0;if(h.length||w>=o)return;(h.data!==t||h.next)&&(m===0&&(m=Ho(n),w+=m*m),y===0&&(y=Ho(n),w+=y*y),w<s&&(w=Math.sqrt(s*w)));do h.data!==t&&(b=a[h.data.index]*r/w,t.vx+=m*b,t.vy+=y*b);while(h=h.next)}return l.initialize=function(h,g){e=h,n=g,c()},l.strength=function(h){return arguments.length?(i=typeof h=="function"?h:Sr(+h),c(),l):i},l.distanceMin=function(h){return arguments.length?(s=h*h,l):Math.sqrt(s)},l.distanceMax=function(h){return arguments.length?(o=h*h,l):Math.sqrt(o)},l.theta=function(h){return arguments.length?(u=h*h,l):Math.sqrt(u)},l}function Zue(e){var t=Sr(.1),n,r,i;typeof e!="function"&&(e=Sr(e==null?0:+e));function a(o){for(var u=0,l=n.length,c;u<l;++u)c=n[u],c.vx+=(i[u]-c.x)*r[u]*o}function s(){if(n){var o,u=n.length;for(r=new Array(u),i=new Array(u),o=0;o<u;++o)r[o]=isNaN(i[o]=+e(n[o],o,n))?0:+t(n[o],o,n)}}return a.initialize=function(o){n=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:Sr(+o),s(),a):t},a.x=function(o){return arguments.length?(e=typeof o=="function"?o:Sr(+o),s(),a):e},a}function Que(e){var t=Sr(.1),n,r,i;typeof e!="function"&&(e=Sr(e==null?0:+e));function a(o){for(var u=0,l=n.length,c;u<l;++u)c=n[u],c.vy+=(i[u]-c.y)*r[u]*o}function s(){if(n){var o,u=n.length;for(r=new Array(u),i=new Array(u),o=0;o<u;++o)r[o]=isNaN(i[o]=+e(n[o],o,n))?0:+t(n[o],o,n)}}return a.initialize=function(o){n=o,s()},a.strength=function(o){return arguments.length?(t=typeof o=="function"?o:Sr(+o),s(),a):t},a.y=function(o){return arguments.length?(e=typeof o=="function"?o:Sr(+o),s(),a):e},a}const NL={center:due,collide:$ue,nbody:Kue,link:Rue,x:Zue,y:Que},Gh="forces",gS=["alpha","alphaMin","alphaTarget","velocityDecay","forces"],Jue=["static","iterations"],OL=["x","y","vx","vy"];function pS(e){G.call(this,null,e)}pS.Definition={type:"Force",metadata:{modifies:!0},params:[{name:"static",type:"boolean",default:!1},{name:"restart",type:"boolean",default:!1},{name:"iterations",type:"number",default:300},{name:"alpha",type:"number",default:1},{name:"alphaMin",type:"number",default:.001},{name:"alphaTarget",type:"number",default:0},{name:"velocityDecay",type:"number",default:.4},{name:"forces",type:"param",array:!0,params:[{key:{force:"center"},params:[{name:"x",type:"number",default:0},{name:"y",type:"number",default:0}]},{key:{force:"collide"},params:[{name:"radius",type:"number",expr:!0},{name:"strength",type:"number",default:.7},{name:"iterations",type:"number",default:1}]},{key:{force:"nbody"},params:[{name:"strength",type:"number",default:-30,expr:!0},{name:"theta",type:"number",default:.9},{name:"distanceMin",type:"number",default:1},{name:"distanceMax",type:"number"}]},{key:{force:"link"},params:[{name:"links",type:"data"},{name:"id",type:"field"},{name:"distance",type:"number",default:30,expr:!0},{name:"strength",type:"number",expr:!0},{name:"iterations",type:"number",default:1}]},{key:{force:"x"},params:[{name:"strength",type:"number",default:.1},{name:"x",type:"field"}]},{key:{force:"y"},params:[{name:"strength",type:"number",default:.1},{name:"y",type:"field"}]}]},{name:"as",type:"string",array:!0,modify:!1,default:OL}]},ge(pS,G,{transform(e,t){var n=this.value,r=t.changed(t.ADD_REM),i=e.modified(gS),a=e.iterations||300;if(n?(r&&(t.modifies("index"),n.nodes(t.source)),(i||t.changed(t.MOD))&&IL(n,e,0,t)):(this.value=n=tle(t.source,e),n.on("tick",ele(t.dataflow,this)),e.static||(r=!0,n.tick()),t.modifies("index")),i||r||e.modified(Jue)||t.changed()&&e.restart){if(n.alpha(Math.max(n.alpha(),e.alpha||1)).alphaDecay(1-Math.pow(n.alphaMin(),1/a)),e.static)for(n.stop();--a>=0;)n.tick();else if(n.stopped()&&n.restart(),!r)return t.StopPropagation}return this.finish(e,t)},finish(e,t){const n=t.dataflow;for(let o=this._argops,u=0,l=o.length,c;u<l;++u)if(c=o[u],!(c.name!==Gh||c.op._argval.force!=="link")){for(var r=c.op._argops,i=0,a=r.length,s;i<a;++i)if(r[i].name==="links"&&(s=r[i].op.source)){n.pulse(s,n.changeset().reflow());break}}return t.reflow(e.modified()).modifies(OL)}});function ele(e,t){return()=>e.touch(t).run()}function tle(e,t){const n=Xue(e),r=n.stop,i=n.restart;let a=!1;return n.stopped=()=>a,n.restart=()=>(a=!1,i()),n.stop=()=>(a=!0,r()),IL(n,t,!0).on("end",()=>a=!0)}function IL(e,t,n,r){var i=be(t.forces),a,s,o,u;for(a=0,s=gS.length;a<s;++a)o=gS[a],o!==Gh&&t.modified(o)&&e[o](t[o]);for(a=0,s=i.length;a<s;++a)u=Gh+a,o=n||t.modified(Gh,a)?rle(i[a]):r&&nle(i[a],r)?e.force(u):null,o&&e.force(u,o);for(s=e.numForces||0;a<s;++a)e.force(Gh+a,null);return e.numForces=i.length,e}function nle(e,t){var n,r;for(n in e)if(Ke(r=e[n])&&t.modified(ur(r)))return 1;return 0}function rle(e){var t,n;xe(NL,e.force)||Q("Unrecognized force: "+e.force),t=NL[e.force]();for(n in e)Ke(t[n])&&ile(t[n],e[n],e);return t}function ile(e,t,n){e(Ke(t)?r=>t(r,n):t)}const ale=Object.freeze(Object.defineProperty({__proto__:null,force:pS},Symbol.toStringTag,{value:"Module"}));function sle(e,t){return e.parent===t.parent?1:2}function ole(e){return e.reduce(ule,0)/e.length}function ule(e,t){return e+t.x}function lle(e){return 1+e.reduce(cle,0)}function cle(e,t){return Math.max(e,t.y)}function fle(e){for(var t;t=e.children;)e=t[0];return e}function dle(e){for(var t;t=e.children;)e=t[t.length-1];return e}function hle(){var e=sle,t=1,n=1,r=!1;function i(a){var s,o=0;a.eachAfter(function(d){var h=d.children;h?(d.x=ole(h),d.y=lle(h)):(d.x=s?o+=e(d,s):0,d.y=0,s=d)});var u=fle(a),l=dle(a),c=u.x-e(u,l)/2,f=l.x+e(l,u)/2;return a.eachAfter(r?function(d){d.x=(d.x-a.x)*t,d.y=(a.y-d.y)*n}:function(d){d.x=(d.x-c)/(f-c)*t,d.y=(1-(a.y?d.y/a.y:1))*n})}return i.separation=function(a){return arguments.length?(e=a,i):e},i.size=function(a){return arguments.length?(r=!1,t=+a[0],n=+a[1],i):r?null:[t,n]},i.nodeSize=function(a){return arguments.length?(r=!0,t=+a[0],n=+a[1],i):r?[t,n]:null},i}function gle(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function ple(){return this.eachAfter(gle)}function vle(e,t){let n=-1;for(const r of this)e.call(t,r,++n,this);return this}function mle(e,t){for(var n=this,r=[n],i,a,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function yle(e,t){for(var n=this,r=[n],i=[],a,s,o,u=-1;n=r.pop();)if(i.push(n),a=n.children)for(s=0,o=a.length;s<o;++s)r.push(a[s]);for(;n=i.pop();)e.call(t,n,++u,this);return this}function ble(e,t){let n=-1;for(const r of this)if(e.call(t,r,++n,this))return r}function wle(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function xle(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Ele(e){for(var t=this,n=Fle(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function Fle(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function Sle(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Cle(){return Array.from(this)}function kle(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function _le(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Ale(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function vS(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=$le)):t===void 0&&(t=Mle);for(var n=new ef(e),r,i=[n],a,s,o,u;r=i.pop();)if((s=t(r.data))&&(u=(s=Array.from(s)).length))for(r.children=s,o=u-1;o>=0;--o)i.push(a=s[o]=new ef(s[o])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(BL)}function Tle(){return vS(this).eachBefore(Dle)}function Mle(e){return e.children}function $le(e){return Array.isArray(e)?e[1]:null}function Dle(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function BL(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function ef(e){this.data=e,this.depth=this.height=0,this.parent=null}ef.prototype=vS.prototype={constructor:ef,count:ple,each:vle,eachAfter:yle,eachBefore:mle,find:ble,sum:wle,sort:xle,path:Ele,ancestors:Sle,descendants:Cle,leaves:kle,links:_le,copy:Tle,[Symbol.iterator]:Ale};function Tm(e){return e==null?null:LL(e)}function LL(e){if(typeof e!="function")throw new Error;return e}function ol(){return 0}function tf(e){return function(){return e}}const Rle=1664525,Ple=1013904223,zL=4294967296;function Nle(){let e=1;return()=>(e=(Rle*e+Ple)%zL)/zL}function Ole(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ile(e,t){let n=e.length,r,i;for(;n;)i=t()*n--|0,r=e[n],e[n]=e[i],e[i]=r;return e}function Ble(e,t){for(var n=0,r=(e=Ile(Array.from(e),t)).length,i=[],a,s;n<r;)a=e[n],s&&qL(s,a)?++n:(s=zle(i=Lle(i,a)),n=0);return s}function Lle(e,t){var n,r;if(mS(t,e))return[t];for(n=0;n<e.length;++n)if(Mm(t,e[n])&&mS(Yh(e[n],t),e))return[e[n],t];for(n=0;n<e.length-1;++n)for(r=n+1;r<e.length;++r)if(Mm(Yh(e[n],e[r]),t)&&Mm(Yh(e[n],t),e[r])&&Mm(Yh(e[r],t),e[n])&&mS(UL(e[n],e[r],t),e))return[e[n],e[r],t];throw new Error}function Mm(e,t){var n=e.r-t.r,r=t.x-e.x,i=t.y-e.y;return n<0||n*n<r*r+i*i}function qL(e,t){var n=e.r-t.r+Math.max(e.r,t.r,1)*1e-9,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function mS(e,t){for(var n=0;n<t.length;++n)if(!qL(e,t[n]))return!1;return!0}function zle(e){switch(e.length){case 1:return qle(e[0]);case 2:return Yh(e[0],e[1]);case 3:return UL(e[0],e[1],e[2])}}function qle(e){return{x:e.x,y:e.y,r:e.r}}function Yh(e,t){var n=e.x,r=e.y,i=e.r,a=t.x,s=t.y,o=t.r,u=a-n,l=s-r,c=o-i,f=Math.sqrt(u*u+l*l);return{x:(n+a+u/f*c)/2,y:(r+s+l/f*c)/2,r:(f+i+o)/2}}function UL(e,t,n){var r=e.x,i=e.y,a=e.r,s=t.x,o=t.y,u=t.r,l=n.x,c=n.y,f=n.r,d=r-s,h=r-l,g=i-o,p=i-c,v=u-a,m=f-a,y=r*r+i*i-a*a,b=y-s*s-o*o+u*u,w=y-l*l-c*c+f*f,E=h*g-d*p,F=(g*w-p*b)/(E*2)-r,x=(p*v-g*m)/E,C=(h*b-d*w)/(E*2)-i,S=(d*m-h*v)/E,_=x*x+S*S-1,k=2*(a+F*x+C*S),T=F*F+C*C-a*a,A=-(Math.abs(_)>1e-6?(k+Math.sqrt(k*k-4*_*T))/(2*_):T/k);return{x:r+F+x*A,y:i+C+S*A,r:A}}function VL(e,t,n){var r=e.x-t.x,i,a,s=e.y-t.y,o,u,l=r*r+s*s;l?(a=t.r+n.r,a*=a,u=e.r+n.r,u*=u,a>u?(i=(l+u-a)/(2*l),o=Math.sqrt(Math.max(0,u/l-i*i)),n.x=e.x-i*r-o*s,n.y=e.y-i*s+o*r):(i=(l+a-u)/(2*l),o=Math.sqrt(Math.max(0,a/l-i*i)),n.x=t.x+i*r-o*s,n.y=t.y+i*s+o*r)):(n.x=t.x+n.r,n.y=t.y)}function WL(e,t){var n=e.r+t.r-1e-6,r=t.x-e.x,i=t.y-e.y;return n>0&&n*n>r*r+i*i}function HL(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,a=(t.y*n.r+n.y*t.r)/r;return i*i+a*a}function $m(e){this._=e,this.next=null,this.previous=null}function Ule(e,t){if(!(a=(e=Ole(e)).length))return 0;var n,r,i,a,s,o,u,l,c,f,d;if(n=e[0],n.x=0,n.y=0,!(a>1))return n.r;if(r=e[1],n.x=-r.r,r.x=n.r,r.y=0,!(a>2))return n.r+r.r;VL(r,n,i=e[2]),n=new $m(n),r=new $m(r),i=new $m(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;e:for(u=3;u<a;++u){VL(n._,r._,i=e[u]),i=new $m(i),l=r.next,c=n.previous,f=r._.r,d=n._.r;do if(f<=d){if(WL(l._,i._)){r=l,n.next=r,r.previous=n,--u;continue e}f+=l._.r,l=l.next}else{if(WL(c._,i._)){n=c,n.next=r,r.previous=n,--u;continue e}d+=c._.r,c=c.previous}while(l!==c.next);for(i.previous=n,i.next=r,n.next=r.previous=r=i,s=HL(n);(i=i.next)!==r;)(o=HL(i))<s&&(n=i,s=o);r=n.next}for(n=[r._],i=r;(i=i.next)!==r;)n.push(i._);for(i=Ble(n,t),u=0;u<a;++u)n=e[u],n.x-=i.x,n.y-=i.y;return i.r}function Vle(e){return Math.sqrt(e.value)}function Wle(){var e=null,t=1,n=1,r=ol;function i(a){const s=Nle();return a.x=t/2,a.y=n/2,e?a.eachBefore(jL(e)).eachAfter(yS(r,.5,s)).eachBefore(GL(1)):a.eachBefore(jL(Vle)).eachAfter(yS(ol,1,s)).eachAfter(yS(r,a.r/Math.min(t,n),s)).eachBefore(GL(Math.min(t,n)/(2*a.r))),a}return i.radius=function(a){return arguments.length?(e=Tm(a),i):e},i.size=function(a){return arguments.length?(t=+a[0],n=+a[1],i):[t,n]},i.padding=function(a){return arguments.length?(r=typeof a=="function"?a:tf(+a),i):r},i}function jL(e){return function(t){t.children||(t.r=Math.max(0,+e(t)||0))}}function yS(e,t,n){return function(r){if(i=r.children){var i,a,s=i.length,o=e(r)*t||0,u;if(o)for(a=0;a<s;++a)i[a].r+=o;if(u=Ule(i,n),o)for(a=0;a<s;++a)i[a].r-=o;r.r=u+o}}}function GL(e){return function(t){var n=t.parent;t.r*=e,n&&(t.x=n.x+e*t.x,t.y=n.y+e*t.y)}}function YL(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function Xh(e,t,n,r,i){for(var a=e.children,s,o=-1,u=a.length,l=e.value&&(r-t)/e.value;++o<u;)s=a[o],s.y0=n,s.y1=i,s.x0=t,s.x1=t+=s.value*l}function Hle(){var e=1,t=1,n=0,r=!1;function i(s){var o=s.height+1;return s.x0=s.y0=n,s.x1=e,s.y1=t/o,s.eachBefore(a(t,o)),r&&s.eachBefore(YL),s}function a(s,o){return function(u){u.children&&Xh(u,u.x0,s*(u.depth+1)/o,u.x1,s*(u.depth+2)/o);var l=u.x0,c=u.y0,f=u.x1-n,d=u.y1-n;f<l&&(l=f=(l+f)/2),d<c&&(c=d=(c+d)/2),u.x0=l,u.y0=c,u.x1=f,u.y1=d}}return i.round=function(s){return arguments.length?(r=!!s,i):r},i.size=function(s){return arguments.length?(e=+s[0],t=+s[1],i):[e,t]},i.padding=function(s){return arguments.length?(n=+s,i):n},i}var jle={depth:-1},XL={},bS={};function Gle(e){return e.id}function Yle(e){return e.parentId}function KL(){var e=Gle,t=Yle,n;function r(i){var a=Array.from(i),s=e,o=t,u,l,c,f,d,h,g,p,v=new Map;if(n!=null){const m=a.map((w,E)=>Xle(n(w,E,i))),y=m.map(ZL),b=new Set(m).add("");for(const w of y)b.has(w)||(b.add(w),m.push(w),y.push(ZL(w)),a.push(bS));s=(w,E)=>m[E],o=(w,E)=>y[E]}for(c=0,u=a.length;c<u;++c)l=a[c],h=a[c]=new ef(l),(g=s(l,c,i))!=null&&(g+="")&&(p=h.id=g,v.set(p,v.has(p)?XL:h)),(g=o(l,c,i))!=null&&(g+="")&&(h.parent=g);for(c=0;c<u;++c)if(h=a[c],g=h.parent){if(d=v.get(g),!d)throw new Error("missing: "+g);if(d===XL)throw new Error("ambiguous: "+g);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===bS&&f.children.length===1;)f=f.children[0],--u;for(let m=a.length-1;m>=0&&(h=a[m],h.data===bS);--m)h.data=null}if(f.parent=jle,f.eachBefore(function(m){m.depth=m.parent.depth+1,--u}).eachBefore(BL),f.parent=null,u>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Tm(i),r):e},r.parentId=function(i){return arguments.length?(t=Tm(i),r):t},r.path=function(i){return arguments.length?(n=Tm(i),r):n},r}function Xle(e){e=`${e}`;let t=e.length;return wS(e,t-1)&&!wS(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function ZL(e){let t=e.length;if(t<2)return"";for(;--t>1&&!wS(e,t););return e.slice(0,t)}function wS(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function Kle(e,t){return e.parent===t.parent?1:2}function xS(e){var t=e.children;return t?t[0]:e.t}function ES(e){var t=e.children;return t?t[t.length-1]:e.t}function Zle(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Qle(e){for(var t=0,n=0,r=e.children,i=r.length,a;--i>=0;)a=r[i],a.z+=t,a.m+=t,t+=a.s+(n+=a.c)}function Jle(e,t,n){return e.a.parent===t.parent?e.a:n}function Dm(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Dm.prototype=Object.create(ef.prototype);function ece(e){for(var t=new Dm(e,0),n,r=[t],i,a,s,o;n=r.pop();)if(a=n._.children)for(n.children=new Array(o=a.length),s=o-1;s>=0;--s)r.push(i=n.children[s]=new Dm(a[s],s)),i.parent=n;return(t.parent=new Dm(null,0)).children=[t],t}function tce(){var e=Kle,t=1,n=1,r=null;function i(l){var c=ece(l);if(c.eachAfter(a),c.parent.m=-c.z,c.eachBefore(s),r)l.eachBefore(u);else{var f=l,d=l,h=l;l.eachBefore(function(y){y.x<f.x&&(f=y),y.x>d.x&&(d=y),y.depth>h.depth&&(h=y)});var g=f===d?1:e(f,d)/2,p=g-f.x,v=t/(d.x+g+p),m=n/(h.depth||1);l.eachBefore(function(y){y.x=(y.x+p)*v,y.y=y.depth*m})}return l}function a(l){var c=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(c){Qle(l);var h=(c[0].z+c[c.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=o(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function o(l,c,f){if(c){for(var d=l,h=l,g=c,p=d.parent.children[0],v=d.m,m=h.m,y=g.m,b=p.m,w;g=ES(g),d=xS(d),g&&d;)p=xS(p),h=ES(h),h.a=l,w=g.z+y-d.z-v+e(g._,d._),w>0&&(Zle(Jle(g,l,f),l,w),v+=w,m+=w),y+=g.m,v+=d.m,b+=p.m,m+=h.m;g&&!ES(h)&&(h.t=g,h.m+=y-m),d&&!xS(p)&&(p.t=d,p.m+=v-b,f=l)}return f}function u(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}function Rm(e,t,n,r,i){for(var a=e.children,s,o=-1,u=a.length,l=e.value&&(i-n)/e.value;++o<u;)s=a[o],s.x0=t,s.x1=r,s.y0=n,s.y1=n+=s.value*l}var QL=(1+Math.sqrt(5))/2;function JL(e,t,n,r,i,a){for(var s=[],o=t.children,u,l,c=0,f=0,d=o.length,h,g,p=t.value,v,m,y,b,w,E,F;c<d;){h=i-n,g=a-r;do v=o[f++].value;while(!v&&f<d);for(m=y=v,E=Math.max(g/h,h/g)/(p*e),F=v*v*E,w=Math.max(y/F,F/m);f<d;++f){if(v+=l=o[f].value,l<m&&(m=l),l>y&&(y=l),F=v*v*E,b=Math.max(y/F,F/m),b>w){v-=l;break}w=b}s.push(u={value:v,dice:h<g,children:o.slice(c,f)}),u.dice?Xh(u,n,r,i,p?r+=g*v/p:a):Rm(u,n,r,p?n+=h*v/p:i,a),p-=v,c=f}return s}const ez=function e(t){function n(r,i,a,s,o){JL(t,r,i,a,s,o)}return n.ratio=function(r){return e((r=+r)>1?r:1)},n}(QL);function nce(){var e=ez,t=!1,n=1,r=1,i=[0],a=ol,s=ol,o=ol,u=ol,l=ol;function c(d){return d.x0=d.y0=0,d.x1=n,d.y1=r,d.eachBefore(f),i=[0],t&&d.eachBefore(YL),d}function f(d){var h=i[d.depth],g=d.x0+h,p=d.y0+h,v=d.x1-h,m=d.y1-h;v<g&&(g=v=(g+v)/2),m<p&&(p=m=(p+m)/2),d.x0=g,d.y0=p,d.x1=v,d.y1=m,d.children&&(h=i[d.depth+1]=a(d)/2,g+=l(d)-h,p+=s(d)-h,v-=o(d)-h,m-=u(d)-h,v<g&&(g=v=(g+v)/2),m<p&&(p=m=(p+m)/2),e(d,g,p,v,m))}return c.round=function(d){return arguments.length?(t=!!d,c):t},c.size=function(d){return arguments.length?(n=+d[0],r=+d[1],c):[n,r]},c.tile=function(d){return arguments.length?(e=LL(d),c):e},c.padding=function(d){return arguments.length?c.paddingInner(d).paddingOuter(d):c.paddingInner()},c.paddingInner=function(d){return arguments.length?(a=typeof d=="function"?d:tf(+d),c):a},c.paddingOuter=function(d){return arguments.length?c.paddingTop(d).paddingRight(d).paddingBottom(d).paddingLeft(d):c.paddingTop()},c.paddingTop=function(d){return arguments.length?(s=typeof d=="function"?d:tf(+d),c):s},c.paddingRight=function(d){return arguments.length?(o=typeof d=="function"?d:tf(+d),c):o},c.paddingBottom=function(d){return arguments.length?(u=typeof d=="function"?d:tf(+d),c):u},c.paddingLeft=function(d){return arguments.length?(l=typeof d=="function"?d:tf(+d),c):l},c}function rce(e,t,n,r,i){var a=e.children,s,o=a.length,u,l=new Array(o+1);for(l[0]=u=s=0;s<o;++s)l[s+1]=u+=a[s].value;c(0,o,e.value,t,n,r,i);function c(f,d,h,g,p,v,m){if(f>=d-1){var y=a[f];y.x0=g,y.y0=p,y.x1=v,y.y1=m;return}for(var b=l[f],w=h/2+b,E=f+1,F=d-1;E<F;){var x=E+F>>>1;l[x]<w?E=x+1:F=x}w-l[E-1]<l[E]-w&&f+1<E&&--E;var C=l[E]-b,S=h-C;if(v-g>m-p){var _=h?(g*S+v*C)/h:v;c(f,E,C,g,p,_,m),c(E,d,S,_,p,v,m)}else{var k=h?(p*S+m*C)/h:m;c(f,E,C,g,p,v,k),c(E,d,S,g,k,v,m)}}}function ice(e,t,n,r,i){(e.depth&1?Rm:Xh)(e,t,n,r,i)}const ace=function e(t){function n(r,i,a,s,o){if((u=r._squarify)&&u.ratio===t)for(var u,l,c,f,d=-1,h,g=u.length,p=r.value;++d<g;){for(l=u[d],c=l.children,f=l.value=0,h=c.length;f<h;++f)l.value+=c[f].value;l.dice?Xh(l,i,a,s,p?a+=(o-a)*l.value/p:o):Rm(l,i,a,p?i+=(s-i)*l.value/p:s,o),p-=l.value}else r._squarify=u=JL(t,r,i,a,s,o),u.ratio=t}return n.ratio=function(r){return e((r=+r)>1?r:1)},n}(QL);function FS(e,t,n){const r={};return e.each(i=>{const a=i.data;n(a)&&(r[t(a)]=i)}),e.lookup=r,e}function SS(e){G.call(this,null,e)}SS.Definition={type:"Nest",metadata:{treesource:!0,changes:!0},params:[{name:"keys",type:"field",array:!0},{name:"generate",type:"boolean"}]};const sce=e=>e.values;ge(SS,G,{transform(e,t){t.source||Q("Nest transform requires an upstream data source.");var n=e.generate,r=e.modified(),i=t.clone(),a=this.value;return(!a||r||t.changed())&&(a&&a.each(s=>{s.children&&Ow(s.data)&&i.rem.push(s.data)}),this.value=a=vS({values:be(e.keys).reduce((s,o)=>(s.key(o),s),oce()).entries(i.source)},sce),n&&a.each(s=>{s.children&&(s=vt(s.data),i.add.push(s),i.source.push(s))}),FS(a,Re,Re)),i.source.root=a,i}});function oce(){const e=[],t={entries:i=>r(n(i,0),0),key:i=>(e.push(i),t)};function n(i,a){if(a>=e.length)return i;const s=i.length,o=e[a++],u={},l={};let c=-1,f,d,h;for(;++c<s;)f=o(d=i[c])+"",(h=u[f])?h.push(d):u[f]=[d];for(f in u)l[f]=n(u[f],a);return l}function r(i,a){if(++a>e.length)return i;const s=[];for(const o in i)s.push({key:o,values:r(i[o],a)});return s}return t}function Rs(e){G.call(this,null,e)}const uce=(e,t)=>e.parent===t.parent?1:2;ge(Rs,G,{transform(e,t){(!t.source||!t.source.root)&&Q(this.constructor.name+" transform requires a backing tree data source.");const n=this.layout(e.method),r=this.fields,i=t.source.root,a=e.as||r;e.field?i.sum(e.field):i.count(),e.sort&&i.sort(Nu(e.sort,s=>s.data)),lce(n,this.params,e),n.separation&&n.separation(e.separation!==!1?uce:kd);try{this.value=n(i)}catch(s){Q(s)}return i.each(s=>cce(s,r,a)),t.reflow(e.modified()).modifies(a).modifies("leaf")}});function lce(e,t,n){for(let r,i=0,a=t.length;i<a;++i)r=t[i],r in n&&e[r](n[r])}function cce(e,t,n){const r=e.data,i=t.length-1;for(let a=0;a<i;++a)r[n[a]]=e[t[a]];r[n[i]]=e.children?e.children.length:0}const CS=["x","y","r","depth","children"];function kS(e){Rs.call(this,e)}kS.Definition={type:"Pack",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"radius",type:"field",default:null},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:CS.length,default:CS}]},ge(kS,Rs,{layout:Wle,params:["radius","size","padding"],fields:CS});const _S=["x0","y0","x1","y1","depth","children"];function AS(e){Rs.call(this,e)}AS.Definition={type:"Partition",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"padding",type:"number",default:0},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:_S.length,default:_S}]},ge(AS,Rs,{layout:Hle,params:["size","round","padding"],fields:_S});function TS(e){G.call(this,null,e)}TS.Definition={type:"Stratify",metadata:{treesource:!0},params:[{name:"key",type:"field",required:!0},{name:"parentKey",type:"field",required:!0}]},ge(TS,G,{transform(e,t){t.source||Q("Stratify transform requires an upstream data source.");let n=this.value;const r=e.modified(),i=t.fork(t.ALL).materialize(t.SOURCE),a=!n||r||t.changed(t.ADD_REM)||t.modified(e.key.fields)||t.modified(e.parentKey.fields);return i.source=i.source.slice(),a&&(n=i.source.length?FS(KL().id(e.key).parentId(e.parentKey)(i.source),e.key,Oi):FS(KL()([{}]),e.key,e.key)),i.source.root=this.value=n,i}});const tz={tidy:tce,cluster:hle},MS=["x","y","depth","children"];function $S(e){Rs.call(this,e)}$S.Definition={type:"Tree",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"tidy",values:["tidy","cluster"]},{name:"size",type:"number",array:!0,length:2},{name:"nodeSize",type:"number",array:!0,length:2},{name:"separation",type:"boolean",default:!0},{name:"as",type:"string",array:!0,length:MS.length,default:MS}]},ge($S,Rs,{layout(e){const t=e||"tidy";if(xe(tz,t))return tz[t]();Q("Unrecognized Tree layout method: "+t)},params:["size","nodeSize"],fields:MS});function DS(e){G.call(this,[],e)}DS.Definition={type:"TreeLinks",metadata:{tree:!0,generates:!0,changes:!0},params:[]},ge(DS,G,{transform(e,t){const n=this.value,r=t.source&&t.source.root,i=t.fork(t.NO_SOURCE),a={};return r||Q("TreeLinks transform requires a tree data source."),t.changed(t.ADD_REM)?(i.rem=n,t.visit(t.SOURCE,s=>a[Re(s)]=1),r.each(s=>{const o=s.data,u=s.parent&&s.parent.data;u&&a[Re(o)]&&a[Re(u)]&&i.add.push(vt({source:u,target:o}))}),this.value=i.add):t.changed(t.MOD)&&(t.visit(t.MOD,s=>a[Re(s)]=1),n.forEach(s=>{(a[Re(s.source)]||a[Re(s.target)])&&i.mod.push(s)})),i}});const nz={binary:rce,dice:Xh,slice:Rm,slicedice:ice,squarify:ez,resquarify:ace},RS=["x0","y0","x1","y1","depth","children"];function PS(e){Rs.call(this,e)}PS.Definition={type:"Treemap",metadata:{tree:!0,modifies:!0},params:[{name:"field",type:"field"},{name:"sort",type:"compare"},{name:"method",type:"enum",default:"squarify",values:["squarify","resquarify","binary","dice","slice","slicedice"]},{name:"padding",type:"number",default:0},{name:"paddingInner",type:"number",default:0},{name:"paddingOuter",type:"number",default:0},{name:"paddingTop",type:"number",default:0},{name:"paddingRight",type:"number",default:0},{name:"paddingBottom",type:"number",default:0},{name:"paddingLeft",type:"number",default:0},{name:"ratio",type:"number",default:1.618033988749895},{name:"round",type:"boolean",default:!1},{name:"size",type:"number",array:!0,length:2},{name:"as",type:"string",array:!0,length:RS.length,default:RS}]},ge(PS,Rs,{layout(){const e=nce();return e.ratio=t=>{const n=e.tile();n.ratio&&e.tile(n.ratio(t))},e.method=t=>{xe(nz,t)?e.tile(nz[t]):Q("Unrecognized Treemap layout method: "+t)},e},params:["method","ratio","size","round","padding","paddingInner","paddingOuter","paddingTop","paddingRight","paddingBottom","paddingLeft"],fields:RS});const fce=Object.freeze(Object.defineProperty({__proto__:null,nest:SS,pack:kS,partition:AS,stratify:TS,tree:$S,treelinks:DS,treemap:PS},Symbol.toStringTag,{value:"Module"})),NS=4278190080;function dce(e,t){const n=e.bitmap();return(t||[]).forEach(r=>n.set(e(r.boundary[0]),e(r.boundary[3]))),[n,void 0]}function hce(e,t,n,r,i){const a=e.width,s=e.height,o=r||i,u=_o(a,s).getContext("2d"),l=_o(a,s).getContext("2d"),c=o&&_o(a,s).getContext("2d");n.forEach(C=>Pm(u,C,!1)),Pm(l,t,!1),o&&Pm(c,t,!0);const f=OS(u,a,s),d=OS(l,a,s),h=o&&OS(c,a,s),g=e.bitmap(),p=o&&e.bitmap();let v,m,y,b,w,E,F,x;for(m=0;m<s;++m)for(v=0;v<a;++v)w=m*a+v,E=f[w]&NS,x=d[w]&NS,F=o&&h[w]&NS,(E||F||x)&&(y=e(v),b=e(m),!i&&(E||x)&&g.set(y,b),o&&(E||F)&&p.set(y,b));return[g,p]}function OS(e,t,n){return new Uint32Array(e.getImageData(0,0,t,n).data.buffer)}function Pm(e,t,n){if(!t.length)return;const r=t[0].mark.marktype;r==="group"?t.forEach(i=>{i.items.forEach(a=>Pm(e,a.items,n))}):yi[r].draw(e,{items:n?t.map(gce):t})}function gce(e){const t=C0(e,{});return t.stroke&&t.strokeOpacity!==0||t.fill&&t.fillOpacity!==0?{...t,strokeOpacity:1,stroke:"#000",fillOpacity:0}:t}const Ps=5,Cr=31,Kh=32,jo=new Uint32Array(Kh+1),ji=new Uint32Array(Kh+1);ji[0]=0,jo[0]=~ji[0];for(let e=1;e<=Kh;++e)ji[e]=ji[e-1]<<1|1,jo[e]=~ji[e];function pce(e,t){const n=new Uint32Array(~~((e*t+Kh)/Kh));function r(a,s){n[a]|=s}function i(a,s){n[a]&=s}return{array:n,get:(a,s)=>{const o=s*e+a;return n[o>>>Ps]&1<<(o&Cr)},set:(a,s)=>{const o=s*e+a;r(o>>>Ps,1<<(o&Cr))},clear:(a,s)=>{const o=s*e+a;i(o>>>Ps,~(1<<(o&Cr)))},getRange:(a,s,o,u)=>{let l=u,c,f,d,h;for(;l>=s;--l)if(c=l*e+a,f=l*e+o,d=c>>>Ps,h=f>>>Ps,d===h){if(n[d]&jo[c&Cr]&ji[(f&Cr)+1])return!0}else{if(n[d]&jo[c&Cr]||n[h]&ji[(f&Cr)+1])return!0;for(let g=d+1;g<h;++g)if(n[g])return!0}return!1},setRange:(a,s,o,u)=>{let l,c,f,d,h;for(;s<=u;++s)if(l=s*e+a,c=s*e+o,f=l>>>Ps,d=c>>>Ps,f===d)r(f,jo[l&Cr]&ji[(c&Cr)+1]);else for(r(f,jo[l&Cr]),r(d,ji[(c&Cr)+1]),h=f+1;h<d;++h)r(h,4294967295)},clearRange:(a,s,o,u)=>{let l,c,f,d,h;for(;s<=u;++s)if(l=s*e+a,c=s*e+o,f=l>>>Ps,d=c>>>Ps,f===d)i(f,ji[l&Cr]|jo[(c&Cr)+1]);else for(i(f,ji[l&Cr]),i(d,jo[(c&Cr)+1]),h=f+1;h<d;++h)i(h,0)},outOfBounds:(a,s,o,u)=>a<0||s<0||u>=t||o>=e}}function vce(e,t,n){const r=Math.max(1,Math.sqrt(e*t/1e6)),i=~~((e+2*n+r)/r),a=~~((t+2*n+r)/r),s=o=>~~((o+n)/r);return s.invert=o=>o*r-n,s.bitmap=()=>pce(i,a),s.ratio=r,s.padding=n,s.width=e,s.height=t,s}function mce(e,t,n,r){const i=e.width,a=e.height;return function(s){const o=s.datum.datum.items[r].items,u=o.length,l=s.datum.fontSize,c=mi.width(s.datum,s.datum.text);let f=0,d,h,g,p,v,m,y;for(let b=0;b<u;++b)d=o[b].x,g=o[b].y,h=o[b].x2===void 0?d:o[b].x2,p=o[b].y2===void 0?g:o[b].y2,v=(d+h)/2,m=(g+p)/2,y=Math.abs(h-d+p-g),y>=f&&(f=y,s.x=v,s.y=m);return v=c/2,m=l/2,d=s.x-v,h=s.x+v,g=s.y-m,p=s.y+m,s.align="center",d<0&&h<=i?s.align="left":0<=d&&i<h&&(s.align="right"),s.baseline="middle",g<0&&p<=a?s.baseline="top":0<=g&&a<p&&(s.baseline="bottom"),!0}}function Nm(e,t,n,r,i,a){let s=n/2;return e-s<0||e+s>i||t-(s=r/2)<0||t+s>a}function Go(e,t,n,r,i,a,s,o){const u=i*a/(r*2),l=e(t-u),c=e(t+u),f=e(n-(a=a/2)),d=e(n+a);return s.outOfBounds(l,f,c,d)||s.getRange(l,f,c,d)||o&&o.getRange(l,f,c,d)}function yce(e,t,n,r){const i=e.width,a=e.height,s=t[0],o=t[1];function u(l,c,f,d,h){const g=e.invert(l),p=e.invert(c);let v=f,m=a,y;if(!Nm(g,p,d,h,i,a)&&!Go(e,g,p,h,d,v,s,o)&&!Go(e,g,p,h,d,h,s,null)){for(;m-v>=1;)y=(v+m)/2,Go(e,g,p,h,d,y,s,o)?m=y:v=y;if(v>f)return[g,p,v,!0]}}return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=mi.width(l.datum,l.datum.text);let g=n?d:0,p=!1,v=!1,m=0,y,b,w,E,F,x,C,S,_,k,T,A,$,M,D,P,N;for(let O=0;O<f;++O){for(y=c[O].x,w=c[O].y,b=c[O].x2===void 0?y:c[O].x2,E=c[O].y2===void 0?w:c[O].y2,y>b&&(N=y,y=b,b=N),w>E&&(N=w,w=E,E=N),_=e(y),T=e(b),k=~~((_+T)/2),A=e(w),M=e(E),$=~~((A+M)/2),C=k;C>=_;--C)for(S=$;S>=A;--S)P=u(C,S,g,h,d),P&&([l.x,l.y,g,p]=P);for(C=k;C<=T;++C)for(S=$;S<=M;++S)P=u(C,S,g,h,d),P&&([l.x,l.y,g,p]=P);!p&&!n&&(D=Math.abs(b-y+E-w),F=(y+b)/2,x=(w+E)/2,D>=m&&!Nm(F,x,h,d,i,a)&&!Go(e,F,x,d,h,d,s,null)&&(m=D,l.x=F,l.y=x,v=!0))}return p||v?(F=h/2,x=d/2,s.setRange(e(l.x-F),e(l.y-x),e(l.x+F),e(l.y+x)),l.align="center",l.baseline="middle",!0):!1}}const bce=[-1,-1,1,1],wce=[-1,1,-1,1];function xce(e,t,n,r){const i=e.width,a=e.height,s=t[0],o=t[1],u=e.bitmap();return function(l){const c=l.datum.datum.items[r].items,f=c.length,d=l.datum.fontSize,h=mi.width(l.datum,l.datum.text),g=[];let p=n?d:0,v=!1,m=!1,y=0,b,w,E,F,x,C,S,_,k,T,A,$;for(let M=0;M<f;++M){for(b=c[M].x,E=c[M].y,w=c[M].x2===void 0?b:c[M].x2,F=c[M].y2===void 0?E:c[M].y2,g.push([e((b+w)/2),e((E+F)/2)]);g.length;)if([S,_]=g.pop(),!(s.get(S,_)||o.get(S,_)||u.get(S,_))){u.set(S,_);for(let D=0;D<4;++D)x=S+bce[D],C=_+wce[D],u.outOfBounds(x,C,x,C)||g.push([x,C]);if(x=e.invert(S),C=e.invert(_),k=p,T=a,!Nm(x,C,h,d,i,a)&&!Go(e,x,C,d,h,k,s,o)&&!Go(e,x,C,d,h,d,s,null)){for(;T-k>=1;)A=(k+T)/2,Go(e,x,C,d,h,A,s,o)?T=A:k=A;k>p&&(l.x=x,l.y=C,p=k,v=!0)}}!v&&!n&&($=Math.abs(w-b+F-E),x=(b+w)/2,C=(E+F)/2,$>=y&&!Nm(x,C,h,d,i,a)&&!Go(e,x,C,d,h,d,s,null)&&(y=$,l.x=x,l.y=C,m=!0))}return v||m?(x=h/2,C=d/2,s.setRange(e(l.x-x),e(l.y-C),e(l.x+x),e(l.y+C)),l.align="center",l.baseline="middle",!0):!1}}const Ece=["right","center","left"],Fce=["bottom","middle","top"];function Sce(e,t,n,r){const i=e.width,a=e.height,s=t[0],o=t[1],u=r.length;return function(l){const c=l.boundary,f=l.datum.fontSize;if(c[2]<0||c[5]<0||c[0]>i||c[3]>a)return!1;let d=l.textWidth??0,h,g,p,v,m,y,b,w,E,F,x,C,S,_,k;for(let T=0;T<u;++T){if(h=(n[T]&3)-1,g=(n[T]>>>2&3)-1,p=h===0&&g===0||r[T]<0,v=h&&g?Math.SQRT1_2:1,m=r[T]<0?-1:1,y=c[1+h]+r[T]*h*v,x=c[4+g]+m*f*g/2+r[T]*g*v,w=x-f/2,E=x+f/2,C=e(y),_=e(w),k=e(E),!d)if(rz(C,C,_,k,s,o,y,y,w,E,c,p))d=mi.width(l.datum,l.datum.text);else continue;if(F=y+m*d*h/2,y=F-d/2,b=F+d/2,C=e(y),S=e(b),rz(C,S,_,k,s,o,y,b,w,E,c,p))return l.x=h?h*m<0?b:y:F,l.y=g?g*m<0?E:w:x,l.align=Ece[h*m+1],l.baseline=Fce[g*m+1],s.setRange(C,_,S,k),!0}return!1}}function rz(e,t,n,r,i,a,s,o,u,l,c,f){return!(i.outOfBounds(e,n,t,r)||(f&&a||i).getRange(e,n,t,r))}const IS=0,BS=4,LS=8,zS=0,qS=1,US=2,Cce={"top-left":IS+zS,top:IS+qS,"top-right":IS+US,left:BS+zS,middle:BS+qS,right:BS+US,"bottom-left":LS+zS,bottom:LS+qS,"bottom-right":LS+US},kce={naive:mce,"reduced-search":yce,floodfill:xce};function _ce(e,t,n,r,i,a,s,o,u,l,c){if(!e.length)return e;const f=Math.max(r.length,i.length),d=Ace(r,f),h=Tce(i,f),g=Mce(e[0].datum),p=g==="group"&&e[0].datum.items[u].marktype,v=p==="area",m=$ce(g,p,o,u),y=l===null||l===1/0,b=v&&c==="naive";let w=-1,E=-1;const F=e.map(_=>{const k=y?mi.width(_,_.text):void 0;return w=Math.max(w,k),E=Math.max(E,_.fontSize),{datum:_,opacity:0,x:void 0,y:void 0,align:void 0,baseline:void 0,boundary:m(_),textWidth:k}});l=l===null||l===1/0?Math.max(w,E)+Math.max(...r):l;const x=vce(t[0],t[1],l);let C;if(!b){n&&F.sort((T,A)=>n(T.datum,A.datum));let _=!1;for(let T=0;T<h.length&&!_;++T)_=h[T]===5||d[T]<0;const k=(g&&s||v)&&e.map(T=>T.datum);C=a.length||k?hce(x,k||[],a,_,v):dce(x,s&&F)}const S=v?kce[c](x,C,s,u):Sce(x,C,h,d);return F.forEach(_=>_.opacity=+S(_)),F}function Ace(e,t){const n=new Float64Array(t),r=e.length;for(let i=0;i<r;++i)n[i]=e[i]||0;for(let i=r;i<t;++i)n[i]=n[r-1];return n}function Tce(e,t){const n=new Int8Array(t),r=e.length;for(let i=0;i<r;++i)n[i]|=Cce[e[i]];for(let i=r;i<t;++i)n[i]=n[r-1];return n}function Mce(e){return e&&e.mark&&e.mark.marktype}function $ce(e,t,n,r){const i=a=>[a.x,a.x,a.x,a.y,a.y,a.y];return e?e==="line"||e==="area"?a=>i(a.datum):t==="line"?a=>{const s=a.datum.items[r].items;return i(s.length?s[n==="start"?0:s.length-1]:{x:NaN,y:NaN})}:a=>{const s=a.datum.bounds;return[s.x1,(s.x1+s.x2)/2,s.x2,s.y1,(s.y1+s.y2)/2,s.y2]}:i}const VS=["x","y","opacity","align","baseline"],iz=["top-left","left","bottom-left","top","bottom","top-right","right","bottom-right"];function WS(e){G.call(this,null,e)}WS.Definition={type:"Label",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2,required:!0},{name:"sort",type:"compare"},{name:"anchor",type:"string",array:!0,default:iz},{name:"offset",type:"number",array:!0,default:[1]},{name:"padding",type:"number",default:0,null:!0},{name:"lineAnchor",type:"string",values:["start","end"],default:"end"},{name:"markIndex",type:"number",default:0},{name:"avoidBaseMark",type:"boolean",default:!0},{name:"avoidMarks",type:"data",array:!0},{name:"method",type:"string",default:"naive"},{name:"as",type:"string",array:!0,length:VS.length,default:VS}]},ge(WS,G,{transform(e,t){function n(a){const s=e[a];return Ke(s)&&t.modified(s.fields)}const r=e.modified();if(!(r||t.changed(t.ADD_REM)||n("sort")))return;(!e.size||e.size.length!==2)&&Q("Size parameter should be specified as a [width, height] array.");const i=e.as||VS;return _ce(t.materialize(t.SOURCE).source||[],e.size,e.sort,be(e.offset==null?1:e.offset),be(e.anchor||iz),e.avoidMarks||[],e.avoidBaseMark!==!1,e.lineAnchor||"end",e.markIndex||0,e.padding===void 0?0:e.padding,e.method||"naive").forEach(a=>{const s=a.datum;s[i[0]]=a.x,s[i[1]]=a.y,s[i[2]]=a.opacity,s[i[3]]=a.align,s[i[4]]=a.baseline}),t.reflow(r).modifies(i)}});const Dce=Object.freeze(Object.defineProperty({__proto__:null,label:WS},Symbol.toStringTag,{value:"Module"}));function az(e,t){var n=[],r=function(c){return c(o)},i,a,s,o,u,l;if(t==null)n.push(e);else for(i={},a=0,s=e.length;a<s;++a)o=e[a],u=t.map(r),l=i[u],l||(i[u]=l=[],l.dims=u,n.push(l)),l.push(o);return n}function HS(e){G.call(this,null,e)}HS.Definition={type:"Loess",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"bandwidth",type:"number",default:.3},{name:"as",type:"string",array:!0}]},ge(HS,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=t.materialize(t.SOURCE).source,i=az(r,e.groupby),a=(e.groupby||[]).map(Kt),s=a.length,o=e.as||[Kt(e.x),Kt(e.y)],u=[];i.forEach(l=>{mJ(l,e.x,e.y,e.bandwidth||.3).forEach(c=>{const f={};for(let d=0;d<s;++d)f[a[d]]=l.dims[d];f[o[0]]=c[0],f[o[1]]=c[1],u.push(vt(f))})}),this.value&&(n.rem=this.value),this.value=n.add=n.source=u}return n}});const jS={constant:sP,linear:oP,log:fJ,exp:dJ,pow:hJ,quad:uP,poly:gJ},Rce=(e,t)=>e==="poly"?t:e==="quad"?2:1;function GS(e){G.call(this,null,e)}GS.Definition={type:"Regression",metadata:{generates:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"groupby",type:"field",array:!0},{name:"method",type:"string",default:"linear",values:Object.keys(jS)},{name:"order",type:"number",default:3},{name:"extent",type:"number",array:!0,length:2},{name:"params",type:"boolean",default:!1},{name:"as",type:"string",array:!0}]},ge(GS,G,{transform(e,t){const n=t.fork(t.NO_SOURCE|t.NO_FIELDS);if(!this.value||t.changed()||e.modified()){const r=t.materialize(t.SOURCE).source,i=az(r,e.groupby),a=(e.groupby||[]).map(Kt),s=e.method||"linear",o=e.order==null?3:e.order,u=Rce(s,o),l=e.as||[Kt(e.x),Kt(e.y)],c=jS[s],f=[];let d=e.extent;xe(jS,s)||Q("Invalid regression method: "+s),d!=null&&s==="log"&&d[0]<=0&&(t.dataflow.warn("Ignoring extent with values <= 0 for log regression."),d=null),i.forEach(h=>{if(h.length<=u){t.dataflow.warn("Skipping regression with more parameters than data points.");return}const p=c(h,e.x,e.y,o);if(e.params){f.push(vt({keys:h.dims,coef:p.coef,rSquared:p.rSquared}));return}const v=d||gs(h,e.x),m=y=>{const b={};for(let w=0;w<a.length;++w)b[a[w]]=h.dims[w];b[l[0]]=y[0],b[l[1]]=y[1],f.push(vt(b))};s==="linear"||s==="constant"?v.forEach(y=>m([y,p.predict(y)])):Hw(p.predict,v,25,200).forEach(m)}),this.value&&(n.rem=this.value),this.value=n.add=n.source=f}return n}});const Pce=Object.freeze(Object.defineProperty({__proto__:null,loess:HS,regression:GS},Symbol.toStringTag,{value:"Module"})),Ns=11102230246251565e-32,tr=134217729,Nce=(3+8*Ns)*Ns;function YS(e,t,n,r,i){let a,s,o,u,l=t[0],c=r[0],f=0,d=0;c>l==c>-l?(a=l,l=t[++f]):(a=c,c=r[++d]);let h=0;if(f<e&&d<n)for(c>l==c>-l?(s=l+a,o=a-(s-l),l=t[++f]):(s=c+a,o=a-(s-c),c=r[++d]),a=s,o!==0&&(i[h++]=o);f<e&&d<n;)c>l==c>-l?(s=a+l,u=s-a,o=a-(s-u)+(l-u),l=t[++f]):(s=a+c,u=s-a,o=a-(s-u)+(c-u),c=r[++d]),a=s,o!==0&&(i[h++]=o);for(;f<e;)s=a+l,u=s-a,o=a-(s-u)+(l-u),l=t[++f],a=s,o!==0&&(i[h++]=o);for(;d<n;)s=a+c,u=s-a,o=a-(s-u)+(c-u),c=r[++d],a=s,o!==0&&(i[h++]=o);return(a!==0||h===0)&&(i[h++]=a),h}function Oce(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function Zh(e){return new Float64Array(e)}const Ice=(3+16*Ns)*Ns,Bce=(2+12*Ns)*Ns,Lce=(9+64*Ns)*Ns*Ns,nf=Zh(4),sz=Zh(8),oz=Zh(12),uz=Zh(16),kr=Zh(4);function zce(e,t,n,r,i,a,s){let o,u,l,c,f,d,h,g,p,v,m,y,b,w,E,F,x,C;const S=e-i,_=n-i,k=t-a,T=r-a;w=S*T,d=tr*S,h=d-(d-S),g=S-h,d=tr*T,p=d-(d-T),v=T-p,E=g*v-(w-h*p-g*p-h*v),F=k*_,d=tr*k,h=d-(d-k),g=k-h,d=tr*_,p=d-(d-_),v=_-p,x=g*v-(F-h*p-g*p-h*v),m=E-x,f=E-m,nf[0]=E-(m+f)+(f-x),y=w+m,f=y-w,b=w-(y-f)+(m-f),m=b-F,f=b-m,nf[1]=b-(m+f)+(f-F),C=y+m,f=C-y,nf[2]=y-(C-f)+(m-f),nf[3]=C;let A=Oce(4,nf),$=Bce*s;if(A>=$||-A>=$||(f=e-S,o=e-(S+f)+(f-i),f=n-_,l=n-(_+f)+(f-i),f=t-k,u=t-(k+f)+(f-a),f=r-T,c=r-(T+f)+(f-a),o===0&&u===0&&l===0&&c===0)||($=Lce*s+Nce*Math.abs(A),A+=S*c+T*o-(k*l+_*u),A>=$||-A>=$))return A;w=o*T,d=tr*o,h=d-(d-o),g=o-h,d=tr*T,p=d-(d-T),v=T-p,E=g*v-(w-h*p-g*p-h*v),F=u*_,d=tr*u,h=d-(d-u),g=u-h,d=tr*_,p=d-(d-_),v=_-p,x=g*v-(F-h*p-g*p-h*v),m=E-x,f=E-m,kr[0]=E-(m+f)+(f-x),y=w+m,f=y-w,b=w-(y-f)+(m-f),m=b-F,f=b-m,kr[1]=b-(m+f)+(f-F),C=y+m,f=C-y,kr[2]=y-(C-f)+(m-f),kr[3]=C;const M=YS(4,nf,4,kr,sz);w=S*c,d=tr*S,h=d-(d-S),g=S-h,d=tr*c,p=d-(d-c),v=c-p,E=g*v-(w-h*p-g*p-h*v),F=k*l,d=tr*k,h=d-(d-k),g=k-h,d=tr*l,p=d-(d-l),v=l-p,x=g*v-(F-h*p-g*p-h*v),m=E-x,f=E-m,kr[0]=E-(m+f)+(f-x),y=w+m,f=y-w,b=w-(y-f)+(m-f),m=b-F,f=b-m,kr[1]=b-(m+f)+(f-F),C=y+m,f=C-y,kr[2]=y-(C-f)+(m-f),kr[3]=C;const D=YS(M,sz,4,kr,oz);w=o*c,d=tr*o,h=d-(d-o),g=o-h,d=tr*c,p=d-(d-c),v=c-p,E=g*v-(w-h*p-g*p-h*v),F=u*l,d=tr*u,h=d-(d-u),g=u-h,d=tr*l,p=d-(d-l),v=l-p,x=g*v-(F-h*p-g*p-h*v),m=E-x,f=E-m,kr[0]=E-(m+f)+(f-x),y=w+m,f=y-w,b=w-(y-f)+(m-f),m=b-F,f=b-m,kr[1]=b-(m+f)+(f-F),C=y+m,f=C-y,kr[2]=y-(C-f)+(m-f),kr[3]=C;const P=YS(D,oz,4,kr,uz);return uz[P-1]}function Om(e,t,n,r,i,a){const s=(t-a)*(n-i),o=(e-i)*(r-a),u=s-o,l=Math.abs(s+o);return Math.abs(u)>=Ice*l?u:-zce(e,t,n,r,i,a,l)}const lz=Math.pow(2,-52),Im=new Uint32Array(512);class Bm{static from(t,n=Hce,r=jce){const i=t.length,a=new Float64Array(i*2);for(let s=0;s<i;s++){const o=t[s];a[2*s]=n(o),a[2*s+1]=r(o)}return new Bm(a)}constructor(t){const n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;const r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){const{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:a}=this,s=t.length>>1;let o=1/0,u=1/0,l=-1/0,c=-1/0;for(let S=0;S<s;S++){const _=t[2*S],k=t[2*S+1];_<o&&(o=_),k<u&&(u=k),_>l&&(l=_),k>c&&(c=k),this._ids[S]=S}const f=(o+l)/2,d=(u+c)/2;let h,g,p;for(let S=0,_=1/0;S<s;S++){const k=XS(f,d,t[2*S],t[2*S+1]);k<_&&(h=S,_=k)}const v=t[2*h],m=t[2*h+1];for(let S=0,_=1/0;S<s;S++){if(S===h)continue;const k=XS(v,m,t[2*S],t[2*S+1]);k<_&&k>0&&(g=S,_=k)}let y=t[2*g],b=t[2*g+1],w=1/0;for(let S=0;S<s;S++){if(S===h||S===g)continue;const _=Vce(v,m,y,b,t[2*S],t[2*S+1]);_<w&&(p=S,w=_)}let E=t[2*p],F=t[2*p+1];if(w===1/0){for(let k=0;k<s;k++)this._dists[k]=t[2*k]-t[0]||t[2*k+1]-t[1];rf(this._ids,this._dists,0,s-1);const S=new Uint32Array(s);let _=0;for(let k=0,T=-1/0;k<s;k++){const A=this._ids[k],$=this._dists[A];$>T&&(S[_++]=A,T=$)}this.hull=S.subarray(0,_),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Om(v,m,y,b,E,F)<0){const S=g,_=y,k=b;g=p,y=E,b=F,p=S,E=_,F=k}const x=Wce(v,m,y,b,E,F);this._cx=x.x,this._cy=x.y;for(let S=0;S<s;S++)this._dists[S]=XS(t[2*S],t[2*S+1],x.x,x.y);rf(this._ids,this._dists,0,s-1),this._hullStart=h;let C=3;r[h]=n[p]=g,r[g]=n[h]=p,r[p]=n[g]=h,i[h]=0,i[g]=1,i[p]=2,a.fill(-1),a[this._hashKey(v,m)]=h,a[this._hashKey(y,b)]=g,a[this._hashKey(E,F)]=p,this.trianglesLen=0,this._addTriangle(h,g,p,-1,-1,-1);for(let S=0,_,k;S<this._ids.length;S++){const T=this._ids[S],A=t[2*T],$=t[2*T+1];if(S>0&&Math.abs(A-_)<=lz&&Math.abs($-k)<=lz||(_=A,k=$,T===h||T===g||T===p))continue;let M=0;for(let q=0,z=this._hashKey(A,$);q<this._hashSize&&(M=a[(z+q)%this._hashSize],!(M!==-1&&M!==r[M]));q++);M=n[M];let D=M,P;for(;P=r[D],Om(A,$,t[2*D],t[2*D+1],t[2*P],t[2*P+1])>=0;)if(D=P,D===M){D=-1;break}if(D===-1)continue;let N=this._addTriangle(D,T,r[D],-1,-1,i[D]);i[T]=this._legalize(N+2),i[D]=N,C++;let O=r[D];for(;P=r[O],Om(A,$,t[2*O],t[2*O+1],t[2*P],t[2*P+1])<0;)N=this._addTriangle(O,T,P,i[T],-1,i[O]),i[T]=this._legalize(N+2),r[O]=O,C--,O=P;if(D===M)for(;P=n[D],Om(A,$,t[2*P],t[2*P+1],t[2*D],t[2*D+1])<0;)N=this._addTriangle(P,T,D,-1,i[D],i[P]),this._legalize(N+2),i[P]=N,r[D]=D,C--,D=P;this._hullStart=n[T]=D,r[D]=n[O]=T,r[T]=O,a[this._hashKey(A,$)]=T,a[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(C);for(let S=0,_=this._hullStart;S<C;S++)this.hull[S]=_,_=r[_];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(qce(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:n,_halfedges:r,coords:i}=this;let a=0,s=0;for(;;){const o=r[t],u=t-t%3;if(s=u+(t+2)%3,o===-1){if(a===0)break;t=Im[--a];continue}const l=o-o%3,c=u+(t+1)%3,f=l+(o+2)%3,d=n[s],h=n[t],g=n[c],p=n[f];if(Uce(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*g],i[2*g+1],i[2*p],i[2*p+1])){n[t]=p,n[o]=d;const m=r[f];if(m===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,m),this._link(o,r[s]),this._link(s,f);const y=l+(o+1)%3;a<Im.length&&(Im[a++]=y)}else{if(a===0)break;t=Im[--a]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,a,s){const o=this.trianglesLen;return this._triangles[o]=t,this._triangles[o+1]=n,this._triangles[o+2]=r,this._link(o,i),this._link(o+1,a),this._link(o+2,s),this.trianglesLen+=3,o}}function qce(e,t){const n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function XS(e,t,n,r){const i=e-n,a=t-r;return i*i+a*a}function Uce(e,t,n,r,i,a,s,o){const u=e-s,l=t-o,c=n-s,f=r-o,d=i-s,h=a-o,g=u*u+l*l,p=c*c+f*f,v=d*d+h*h;return u*(f*v-p*h)-l*(c*v-p*d)+g*(c*h-f*d)<0}function Vce(e,t,n,r,i,a){const s=n-e,o=r-t,u=i-e,l=a-t,c=s*s+o*o,f=u*u+l*l,d=.5/(s*l-o*u),h=(l*c-o*f)*d,g=(s*f-u*c)*d;return h*h+g*g}function Wce(e,t,n,r,i,a){const s=n-e,o=r-t,u=i-e,l=a-t,c=s*s+o*o,f=u*u+l*l,d=.5/(s*l-o*u),h=e+(l*c-o*f)*d,g=t+(s*f-u*c)*d;return{x:h,y:g}}function rf(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const a=e[i],s=t[a];let o=i-1;for(;o>=n&&t[e[o]]>s;)e[o+1]=e[o--];e[o+1]=a}else{const i=n+r>>1;let a=n+1,s=r;Qh(e,i,a),t[e[n]]>t[e[r]]&&Qh(e,n,r),t[e[a]]>t[e[r]]&&Qh(e,a,r),t[e[n]]>t[e[a]]&&Qh(e,n,a);const o=e[a],u=t[o];for(;;){do a++;while(t[e[a]]<u);do s--;while(t[e[s]]>u);if(s<a)break;Qh(e,a,s)}e[n+1]=e[s],e[s]=o,r-a+1>=s-n?(rf(e,t,a,r),rf(e,t,n,s-1)):(rf(e,t,n,s-1),rf(e,t,a,r))}}function Qh(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function Hce(e){return e[0]}function jce(e){return e[1]}const cz=1e-6;class ul{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;const i=t+r,a=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${a}`:(Math.abs(this._x1-i)>cz||Math.abs(this._y1-a)>cz)&&(this._+="L"+i+","+a),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=a}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}}class KS{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}}let Gce=class{constructor(t,[n,r,i,a]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((a=+a)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=a,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this;let a,s;const o=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let p=0,v=0,m=r.length,y,b;p<m;p+=3,v+=2){const w=r[p]*2,E=r[p+1]*2,F=r[p+2]*2,x=t[w],C=t[w+1],S=t[E],_=t[E+1],k=t[F],T=t[F+1],A=S-x,$=_-C,M=k-x,D=T-C,P=(A*D-$*M)*2;if(Math.abs(P)<1e-9){if(a===void 0){a=s=0;for(const O of n)a+=t[O*2],s+=t[O*2+1];a/=n.length,s/=n.length}const N=1e9*Math.sign((a-x)*D-(s-C)*M);y=(x+k)/2-N*D,b=(C+T)/2+N*M}else{const N=1/P,O=A*A+$*$,q=M*M+D*D;y=x+(D*O-$*q)*N,b=C+(A*q-M*O)*N}o[v]=y,o[v+1]=b}let u=n[n.length-1],l,c=u*4,f,d=t[2*u],h,g=t[2*u+1];i.fill(0);for(let p=0;p<n.length;++p)u=n[p],l=c,f=d,h=g,c=u*4,d=t[2*u],g=t[2*u+1],i[l+2]=i[c]=h-g,i[l+3]=i[c+1]=d-f}render(t){const n=t==null?t=new ul:void 0,{delaunay:{halfedges:r,inedges:i,hull:a},circumcenters:s,vectors:o}=this;if(a.length<=1)return null;for(let c=0,f=r.length;c<f;++c){const d=r[c];if(d<c)continue;const h=Math.floor(c/3)*2,g=Math.floor(d/3)*2,p=s[h],v=s[h+1],m=s[g],y=s[g+1];this._renderSegment(p,v,m,y,t)}let u,l=a[a.length-1];for(let c=0;c<a.length;++c){u=l,l=a[c];const f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],g=u*4,p=this._project(d,h,o[g+2],o[g+3]);p&&this._renderSegment(d,h,p[0],p[1],t)}return n&&n.value()}renderBounds(t){const n=t==null?t=new ul:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){const r=n==null?n=new ul:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let a=i.length;for(;i[0]===i[a-2]&&i[1]===i[a-1]&&a>1;)a-=2;for(let s=2;s<a;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){const i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){const n=new KS;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,a){let s;const o=this._regioncode(t,n),u=this._regioncode(r,i);o===0&&u===0?(a.moveTo(t,n),a.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,o,u))&&(a.moveTo(s[0],s[1]),a.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){const n=this._clip(t);if(n)for(const r of this.delaunay.neighbors(t)){const i=this._clip(r);if(i){e:for(let a=0,s=n.length;a<s;a+=2)for(let o=0,u=i.length;o<u;o+=2)if(n[a]===i[o]&&n[a+1]===i[o+1]&&n[(a+2)%s]===i[(o+u-2)%u]&&n[(a+3)%s]===i[(o+u-1)%u]){yield r;break e}}}}_cell(t){const{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:a}}=this,s=r[t];if(s===-1)return null;const o=[];let u=s;do{const l=Math.floor(u/3);if(o.push(n[l*2],n[l*2+1]),u=u%3===2?u-2:u+1,a[u]!==t)break;u=i[u]}while(u!==s&&u!==-1);return o}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const n=this._cell(t);if(n===null)return null;const{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){const r=n.length;let i=null,a,s,o=n[r-2],u=n[r-1],l,c=this._regioncode(o,u),f,d=0;for(let h=0;h<r;h+=2)if(a=o,s=u,o=n[h],u=n[h+1],l=c,c=this._regioncode(o,u),l===0&&c===0)f=d,d=0,i?i.push(o,u):i=[o,u];else{let g,p,v,m,y;if(l===0){if((g=this._clipSegment(a,s,o,u,l,c))===null)continue;[p,v,m,y]=g}else{if((g=this._clipSegment(o,u,a,s,c,l))===null)continue;[m,y,p,v]=g,f=d,d=this._edgecode(p,v),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(p,v):i=[p,v]}f=d,d=this._edgecode(m,y),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,y):i=[m,y]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,a,s){const o=a<s;for(o&&([t,n,r,i,a,s]=[r,i,t,n,s,a]);;){if(a===0&&s===0)return o?[r,i,t,n]:[t,n,r,i];if(a&s)return null;let u,l,c=a||s;c&8?(u=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):c&4?(u=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):c&2?(l=n+(i-n)*(this.xmax-t)/(r-t),u=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),u=this.xmin),a?(t=u,n=l,a=this._regioncode(t,n)):(r=u,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,a,s){let o=Array.from(n),u;if((u=this._project(o[0],o[1],r,i))&&o.unshift(u[0],u[1]),(u=this._project(o[o.length-2],o[o.length-1],a,s))&&o.push(u[0],u[1]),o=this._clipFinite(t,o))for(let l=0,c=o.length,f,d=this._edgecode(o[c-2],o[c-1]);l<c;l+=2)f=d,d=this._edgecode(o[l],o[l+1]),f&&d&&(l=this._edge(t,f,d,o,l),c=o.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(o=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return o}_edge(t,n,r,i,a){for(;n!==r;){let s,o;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,o=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,o=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,o=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,o=this.ymin;break}(i[a]!==s||i[a+1]!==o)&&this.contains(t,s,o)&&(i.splice(a,0,s,o),a+=2)}return a}_project(t,n,r,i){let a=1/0,s,o,u;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<a&&(u=this.ymin,o=t+(a=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<a&&(u=this.ymax,o=t+(a=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<a&&(o=this.xmax,u=n+(a=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<a&&(o=this.xmin,u=n+(a=s)*i)}return[o,u]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){const r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};const Yce=2*Math.PI,af=Math.pow;function Xce(e){return e[0]}function Kce(e){return e[1]}function Zce(e){const{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){const i=2*t[r],a=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[a+1]-n[i+1])-(n[a]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function Qce(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}class ZS{static from(t,n=Xce,r=Kce,i){return new ZS("length"in t?Jce(t,n,r,i):Float64Array.from(efe(t,n,r,i)))}constructor(t){this._delaunator=new Bm(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&Zce(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);const u=this.collinear[0],l=this.collinear[this.collinear.length-1],c=[n[2*u],n[2*u+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(c[3]-c[1],c[2]-c[0]);for(let d=0,h=n.length/2;d<h;++d){const g=Qce(n[2*d],n[2*d+1],f);n[2*d]=g[0],n[2*d+1]=g[1]}this._delaunator=new Bm(n)}else delete this.collinear;const r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,a=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),o=this._hullIndex.fill(-1);for(let u=0,l=r.length;u<l;++u){const c=a[u%3===2?u-2:u+1];(r[u]===-1||s[c]===-1)&&(s[c]=u)}for(let u=0,l=i.length;u<l;++u)o[i[u]]=u;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Gce(this,t)}*neighbors(t){const{inedges:n,hull:r,_hullIndex:i,halfedges:a,triangles:s,collinear:o}=this;if(o){const f=o.indexOf(t);f>0&&(yield o[f-1]),f<o.length-1&&(yield o[f+1]);return}const u=n[t];if(u===-1)return;let l=u,c=-1;do{if(yield c=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=a[l],l===-1){const f=r[(i[t]+1)%r.length];f!==c&&(yield f);return}}while(l!==u)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;const i=r;let a;for(;(a=this._step(r,t,n))>=0&&a!==r&&a!==i;)r=a;return a}_step(t,n,r){const{inedges:i,hull:a,_hullIndex:s,halfedges:o,triangles:u,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let c=t,f=af(n-l[t*2],2)+af(r-l[t*2+1],2);const d=i[t];let h=d;do{let g=u[h];const p=af(n-l[g*2],2)+af(r-l[g*2+1],2);if(p<f&&(f=p,c=g),h=h%3===2?h-2:h+1,u[h]!==t)break;if(h=o[h],h===-1){if(h=a[(s[t]+1)%a.length],h!==g&&af(n-l[h*2],2)+af(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return c}render(t){const n=t==null?t=new ul:void 0,{points:r,halfedges:i,triangles:a}=this;for(let s=0,o=i.length;s<o;++s){const u=i[s];if(u<s)continue;const l=a[s]*2,c=a[u]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[c],r[c+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;const r=t==null?t=new ul:void 0,{points:i}=this;for(let a=0,s=i.length;a<s;a+=2){const o=i[a],u=i[a+1];t.moveTo(o+n,u),t.arc(o,u,n,0,Yce)}return r&&r.value()}renderHull(t){const n=t==null?t=new ul:void 0,{hull:r,points:i}=this,a=r[0]*2,s=r.length;t.moveTo(i[a],i[a+1]);for(let o=1;o<s;++o){const u=2*r[o];t.lineTo(i[u],i[u+1])}return t.closePath(),n&&n.value()}hullPolygon(){const t=new KS;return this.renderHull(t),t.value()}renderTriangle(t,n){const r=n==null?n=new ul:void 0,{points:i,triangles:a}=this,s=a[t*=3]*2,o=a[t+1]*2,u=a[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[o],i[o+1]),n.lineTo(i[u],i[u+1]),n.closePath(),r&&r.value()}*trianglePolygons(){const{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){const n=new KS;return this.renderTriangle(t,n),n.value()}}function Jce(e,t,n,r){const i=e.length,a=new Float64Array(i*2);for(let s=0;s<i;++s){const o=e[s];a[s*2]=t.call(r,o,s,e),a[s*2+1]=n.call(r,o,s,e)}return a}function*efe(e,t,n,r){let i=0;for(const a of e)yield t.call(r,a,i,e),yield n.call(r,a,i,e),++i}function QS(e){G.call(this,null,e)}QS.Definition={type:"Voronoi",metadata:{modifies:!0},params:[{name:"x",type:"field",required:!0},{name:"y",type:"field",required:!0},{name:"size",type:"number",array:!0,length:2},{name:"extent",type:"array",array:!0,length:2,default:[[-1e5,-1e5],[1e5,1e5]],content:{type:"number",array:!0,length:2}},{name:"as",type:"string",default:"path"}]};const tfe=[-1e5,-1e5,1e5,1e5];ge(QS,G,{transform(e,t){const n=e.as||"path",r=t.source;if(!r||!r.length)return t;let i=e.size;i=i?[0,0,i[0],i[1]]:(i=e.extent)?[i[0][0],i[0][1],i[1][0],i[1][1]]:tfe;const a=this.value=ZS.from(r,e.x,e.y).voronoi(i);for(let s=0,o=r.length;s<o;++s){const u=a.cellPolygon(s);r[s][n]=u&&!rfe(u)?nfe(u):null}return t.reflow(e.modified()).modifies(n)}});function nfe(e){const t=e[0][0],n=e[0][1];let r=e.length-1;for(;e[r][0]===t&&e[r][1]===n;--r);return"M"+e.slice(0,r+1).join("L")+"Z"}function rfe(e){return e.length===2&&e[0][0]===e[1][0]&&e[0][1]===e[1][1]}const ife=Object.freeze(Object.defineProperty({__proto__:null,voronoi:QS},Symbol.toStringTag,{value:"Module"}));var JS=Math.PI/180,Jh=64,Lm=2048;function afe(){var e=[256,256],t,n,r,i,a,s,o,u=fz,l=[],c=Math.random,f={};f.layout=function(){for(var g=d(_o()),p=ffe((e[0]>>5)*e[1]),v=null,m=l.length,y=-1,b=[],w=l.map(F=>({text:t(F),font:n(F),style:i(F),weight:a(F),rotate:s(F),size:~~(r(F)+1e-14),padding:o(F),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:F})).sort((F,x)=>x.size-F.size);++y<m;){var E=w[y];E.x=e[0]*(c()+.5)>>1,E.y=e[1]*(c()+.5)>>1,sfe(g,E,w,y),E.hasText&&h(p,E,v)&&(b.push(E),v?ufe(v,E):v=[{x:E.x+E.x0,y:E.y+E.y0},{x:E.x+E.x1,y:E.y+E.y1}],E.x-=e[0]>>1,E.y-=e[1]>>1)}return b};function d(g){g.width=g.height=1;var p=Math.sqrt(g.getContext("2d").getImageData(0,0,1,1).data.length>>2);g.width=(Jh<<5)/p,g.height=Lm/p;var v=g.getContext("2d");return v.fillStyle=v.strokeStyle="red",v.textAlign="center",{context:v,ratio:p}}function h(g,p,v){for(var m=p.x,y=p.y,b=Math.hypot(e[0],e[1]),w=u(e),E=c()<.5?1:-1,F=-E,x,C,S;(x=w(F+=E))&&(C=~~x[0],S=~~x[1],!(Math.min(Math.abs(C),Math.abs(S))>=b));)if(p.x=m+C,p.y=y+S,!(p.x+p.x0<0||p.y+p.y0<0||p.x+p.x1>e[0]||p.y+p.y1>e[1])&&(!v||!ofe(p,g,e[0]))&&(!v||lfe(p,v))){for(var _=p.sprite,k=p.width>>5,T=e[0]>>5,A=p.x-(k<<4),$=A&127,M=32-$,D=p.y1-p.y0,P=(p.y+p.y0)*T+(A>>5),N,O=0;O<D;O++){N=0;for(var q=0;q<=k;q++)g[P+q]|=N<<M|(q<k?(N=_[O*k+q])>>>$:0);P+=T}return p.sprite=null,!0}return!1}return f.words=function(g){return arguments.length?(l=g,f):l},f.size=function(g){return arguments.length?(e=[+g[0],+g[1]],f):e},f.font=function(g){return arguments.length?(n=ll(g),f):n},f.fontStyle=function(g){return arguments.length?(i=ll(g),f):i},f.fontWeight=function(g){return arguments.length?(a=ll(g),f):a},f.rotate=function(g){return arguments.length?(s=ll(g),f):s},f.text=function(g){return arguments.length?(t=ll(g),f):t},f.spiral=function(g){return arguments.length?(u=dfe[g]||g,f):u},f.fontSize=function(g){return arguments.length?(r=ll(g),f):r},f.padding=function(g){return arguments.length?(o=ll(g),f):o},f.random=function(g){return arguments.length?(c=g,f):c},f}function sfe(e,t,n,r){if(!t.sprite){var i=e.context,a=e.ratio;i.clearRect(0,0,(Jh<<5)/a,Lm/a);var s=0,o=0,u=0,l=n.length,c,f,d,h,g;for(--r;++r<l;){if(t=n[r],i.save(),i.font=t.style+" "+t.weight+" "+~~((t.size+1)/a)+"px "+t.font,c=i.measureText(t.text+"m").width*a,d=t.size<<1,t.rotate){var p=Math.sin(t.rotate*JS),v=Math.cos(t.rotate*JS),m=c*v,y=c*p,b=d*v,w=d*p;c=Math.max(Math.abs(m+w),Math.abs(m-w))+31>>5<<5,d=~~Math.max(Math.abs(y+b),Math.abs(y-b))}else c=c+31>>5<<5;if(d>u&&(u=d),s+c>=Jh<<5&&(s=0,o+=u,u=0),o+d>=Lm)break;i.translate((s+(c>>1))/a,(o+(d>>1))/a),t.rotate&&i.rotate(t.rotate*JS),i.fillText(t.text,0,0),t.padding&&(i.lineWidth=2*t.padding,i.strokeText(t.text,0,0)),i.restore(),t.width=c,t.height=d,t.xoff=s,t.yoff=o,t.x1=c>>1,t.y1=d>>1,t.x0=-t.x1,t.y0=-t.y1,t.hasText=!0,s+=c}for(var E=i.getImageData(0,0,(Jh<<5)/a,Lm/a).data,F=[];--r>=0;)if(t=n[r],!!t.hasText){for(c=t.width,f=c>>5,d=t.y1-t.y0,h=0;h<d*f;h++)F[h]=0;if(s=t.xoff,s==null)return;o=t.yoff;var x=0,C=-1;for(g=0;g<d;g++){for(h=0;h<c;h++){var S=f*g+(h>>5),_=E[(o+g)*(Jh<<5)+(s+h)<<2]?1<<31-h%32:0;F[S]|=_,x|=_}x?C=g:(t.y0++,d--,g--,o++)}t.y1=t.y0+C,t.sprite=F.slice(0,(t.y1-t.y0)*f)}}}function ofe(e,t,n){n>>=5;for(var r=e.sprite,i=e.width>>5,a=e.x-(i<<4),s=a&127,o=32-s,u=e.y1-e.y0,l=(e.y+e.y0)*n+(a>>5),c,f=0;f<u;f++){c=0;for(var d=0;d<=i;d++)if((c<<o|(d<i?(c=r[f*i+d])>>>s:0))&t[l+d])return!0;l+=n}return!1}function ufe(e,t){var n=e[0],r=e[1];t.x+t.x0<n.x&&(n.x=t.x+t.x0),t.y+t.y0<n.y&&(n.y=t.y+t.y0),t.x+t.x1>r.x&&(r.x=t.x+t.x1),t.y+t.y1>r.y&&(r.y=t.y+t.y1)}function lfe(e,t){return e.x+e.x1>t[0].x&&e.x+e.x0<t[1].x&&e.y+e.y1>t[0].y&&e.y+e.y0<t[1].y}function fz(e){var t=e[0]/e[1];return function(n){return[t*(n*=.1)*Math.cos(n),n*Math.sin(n)]}}function cfe(e){var t=4,n=t*e[0]/e[1],r=0,i=0;return function(a){var s=a<0?-1:1;switch(Math.sqrt(1+4*s*a)-s&3){case 0:r+=n;break;case 1:i+=t;break;case 2:r-=n;break;default:i-=t;break}return[r,i]}}function ffe(e){for(var t=[],n=-1;++n<e;)t[n]=0;return t}function ll(e){return typeof e=="function"?e:function(){return e}}var dfe={archimedean:fz,rectangular:cfe};const dz=["x","y","font","fontSize","fontStyle","fontWeight","angle"],hfe=["text","font","rotate","fontSize","fontStyle","fontWeight"];function eC(e){G.call(this,afe(),e)}eC.Definition={type:"Wordcloud",metadata:{modifies:!0},params:[{name:"size",type:"number",array:!0,length:2},{name:"font",type:"string",expr:!0,default:"sans-serif"},{name:"fontStyle",type:"string",expr:!0,default:"normal"},{name:"fontWeight",type:"string",expr:!0,default:"normal"},{name:"fontSize",type:"number",expr:!0,default:14},{name:"fontSizeRange",type:"number",array:"nullable",default:[10,50]},{name:"rotate",type:"number",expr:!0,default:0},{name:"text",type:"field"},{name:"spiral",type:"string",values:["archimedean","rectangular"]},{name:"padding",type:"number",expr:!0},{name:"as",type:"string",array:!0,length:7,default:dz}]},ge(eC,G,{transform(e,t){e.size&&!(e.size[0]&&e.size[1])&&Q("Wordcloud size dimensions must be non-zero.");function n(g){const p=e[g];return Ke(p)&&t.modified(p.fields)}const r=e.modified();if(!(r||t.changed(t.ADD_REM)||hfe.some(n)))return;const i=t.materialize(t.SOURCE).source,a=this.value,s=e.as||dz;let o=e.fontSize||14,u;if(Ke(o)?u=e.fontSizeRange:o=fr(o),u){const g=o,p=ht("sqrt")().domain(gs(i,g)).range(u);o=v=>p(g(v))}i.forEach(g=>{g[s[0]]=NaN,g[s[1]]=NaN,g[s[3]]=0});const l=a.words(i).text(e.text).size(e.size||[500,500]).padding(e.padding||1).spiral(e.spiral||"archimedean").rotate(e.rotate||0).font(e.font||"sans-serif").fontStyle(e.fontStyle||"normal").fontWeight(e.fontWeight||"normal").fontSize(o).random(Fs).layout(),c=a.size(),f=c[0]>>1,d=c[1]>>1,h=l.length;for(let g=0,p,v;g<h;++g)p=l[g],v=p.datum,v[s[0]]=p.x+f,v[s[1]]=p.y+d,v[s[2]]=p.font,v[s[3]]=p.size,v[s[4]]=p.style,v[s[5]]=p.weight,v[s[6]]=p.rotate;return t.reflow(r).modifies(s)}});const gfe=Object.freeze(Object.defineProperty({__proto__:null,wordcloud:eC},Symbol.toStringTag,{value:"Module"})),pfe=e=>new Uint8Array(e),vfe=e=>new Uint16Array(e),eg=e=>new Uint32Array(e);function mfe(){let e=8,t=[],n=eg(0),r=zm(0,e),i=zm(0,e);return{data:()=>t,seen:()=>n=yfe(n,t.length),add(a){for(let s=0,o=t.length,u=a.length,l;s<u;++s)l=a[s],l._index=o++,t.push(l)},remove(a,s){const o=t.length,u=Array(o-a),l=t;let c,f,d;for(f=0;!s[f]&&f<o;++f)u[f]=t[f],l[f]=f;for(d=f;f<o;++f)c=t[f],s[f]?l[f]=-1:(l[f]=d,r[d]=r[f],i[d]=i[f],u[d]=c,c._index=d++),r[f]=0;return t=u,l},size:()=>t.length,curr:()=>r,prev:()=>i,reset:a=>i[a]=r[a],all:()=>e<257?255:e<65537?65535:4294967295,set(a,s){r[a]|=s},clear(a,s){r[a]&=~s},resize(a,s){const o=r.length;(a>o||s>e)&&(e=Math.max(s,e),r=zm(a,e,r),i=zm(a,e))}}}function yfe(e,t,n){return e.length>=t?e:(n=n||new e.constructor(t),n.set(e),n)}function zm(e,t,n){const r=(t<257?pfe:t<65537?vfe:eg)(e);return n&&r.set(n),r}function hz(e,t,n){const r=1<<t;return{one:r,zero:~r,range:n.slice(),bisect:e.bisect,index:e.index,size:e.size,onAdd(i,a){const s=this,o=s.bisect(s.range,i.value),u=i.index,l=o[0],c=o[1],f=u.length;let d;for(d=0;d<l;++d)a[u[d]]|=r;for(d=c;d<f;++d)a[u[d]]|=r;return s}}}function gz(){let e=eg(0),t=[],n=0;function r(o,u,l){if(!u.length)return[];const c=n,f=u.length,d=eg(f);let h=Array(f),g,p,v;for(v=0;v<f;++v)h[v]=o(u[v]),d[v]=v;if(h=bfe(h,d),c)g=t,p=e,t=Array(c+f),e=eg(c+f),wfe(l,g,p,c,h,d,f,t,e);else{if(l>0)for(v=0;v<f;++v)d[v]+=l;t=h,e=d}return n=c+f,{index:d,value:h}}function i(o,u){const l=n;let c,f,d;for(f=0;!u[e[f]]&&f<l;++f);for(d=f;f<l;++f)u[c=e[f]]||(e[d]=c,t[d]=t[f],++d);n=l-o}function a(o){for(let u=0,l=n;u<l;++u)e[u]=o[e[u]]}function s(o,u){let l;return u?l=u.length:(u=t,l=n),[qX(u,o[0],0,l),u0(u,o[1],0,l)]}return{insert:r,remove:i,bisect:s,reindex:a,index:()=>e,size:()=>n}}function bfe(e,t){return e.sort.call(t,(n,r)=>{const i=e[n],a=e[r];return i<a?-1:i>a?1:0}),WX(e,t)}function wfe(e,t,n,r,i,a,s,o,u){let l=0,c=0,f;for(f=0;l<r&&c<s;++f)t[l]<i[c]?(o[f]=t[l],u[f]=n[l++]):(o[f]=i[c],u[f]=a[c++]+e);for(;l<r;++l,++f)o[f]=t[l],u[f]=n[l];for(;c<s;++c,++f)o[f]=i[c],u[f]=a[c]+e}function tC(e){G.call(this,mfe(),e),this._indices=null,this._dims=null}tC.Definition={type:"CrossFilter",metadata:{},params:[{name:"fields",type:"field",array:!0,required:!0},{name:"query",type:"array",array:!0,required:!0,content:{type:"number",array:!0,length:2}}]},ge(tC,G,{transform(e,t){if(this._dims){var n=e.modified("fields")||e.fields.some(r=>t.modified(r.fields));return n?this.reinit(e,t):this.eval(e,t)}else return this.init(e,t)},init(e,t){const n=e.fields,r=e.query,i=this._indices={},a=this._dims=[],s=r.length;let o=0,u,l;for(;o<s;++o)u=n[o].fname,l=i[u]||(i[u]=gz()),a.push(hz(l,o,r[o]));return this.eval(e,t)},reinit(e,t){const n=t.materialize().fork(),r=e.fields,i=e.query,a=this._indices,s=this._dims,o=this.value,u=o.curr(),l=o.prev(),c=o.all(),f=n.rem=n.add,d=n.mod,h=i.length,g={};let p,v,m,y,b,w,E,F,x;if(l.set(u),t.rem.length&&(b=this.remove(e,t,n)),t.add.length&&o.add(t.add),t.mod.length)for(w={},y=t.mod,E=0,F=y.length;E<F;++E)w[y[E]._index]=1;for(E=0;E<h;++E)x=r[E],(!s[E]||e.modified("fields",E)||t.modified(x.fields))&&(m=x.fname,(p=g[m])||(a[m]=v=gz(),g[m]=p=v.insert(x,t.source,0)),s[E]=hz(v,E,i[E]).onAdd(p,u));for(E=0,F=o.data().length;E<F;++E)b[E]||(l[E]!==u[E]?f.push(E):w[E]&&u[E]!==c&&d.push(E));return o.mask=(1<<h)-1,n},eval(e,t){const n=t.materialize().fork(),r=this._dims.length;let i=0;return t.rem.length&&(this.remove(e,t,n),i|=(1<<r)-1),e.modified("query")&&!e.modified("fields")&&(i|=this.update(e,t,n)),t.add.length&&(this.insert(e,t,n),i|=(1<<r)-1),t.mod.length&&(this.modify(t,n),i|=(1<<r)-1),this.value.mask=i,n},insert(e,t,n){const r=t.add,i=this.value,a=this._dims,s=this._indices,o=e.fields,u={},l=n.add,c=i.size()+r.length,f=a.length;let d=i.size(),h,g,p;i.resize(c,f),i.add(r);const v=i.curr(),m=i.prev(),y=i.all();for(h=0;h<f;++h)g=o[h].fname,p=u[g]||(u[g]=s[g].insert(o[h],r,d)),a[h].onAdd(p,v);for(;d<c;++d)m[d]=y,v[d]!==y&&l.push(d)},modify(e,t){const n=t.mod,r=this.value,i=r.curr(),a=r.all(),s=e.mod;let o,u,l;for(o=0,u=s.length;o<u;++o)l=s[o]._index,i[l]!==a&&n.push(l)},remove(e,t,n){const r=this._indices,i=this.value,a=i.curr(),s=i.prev(),o=i.all(),u={},l=n.rem,c=t.rem;let f,d,h,g;for(f=0,d=c.length;f<d;++f)h=c[f]._index,u[h]=1,s[h]=g=a[h],a[h]=o,g!==o&&l.push(h);for(h in r)r[h].remove(d,u);return this.reindex(t,d,u),u},reindex(e,t,n){const r=this._indices,i=this.value;e.runAfter(()=>{const a=i.remove(t,n);for(const s in r)r[s].reindex(a)})},update(e,t,n){const r=this._dims,i=e.query,a=t.stamp,s=r.length;let o=0,u,l;for(n.filters=0,l=0;l<s;++l)e.modified("query",l)&&(u=l,++o);if(o===1)o=r[u].one,this.incrementOne(r[u],i[u],n.add,n.rem);else for(l=0,o=0;l<s;++l)e.modified("query",l)&&(o|=r[l].one,this.incrementAll(r[l],i[l],a,n.add),n.rem=n.add);return o},incrementAll(e,t,n,r){const i=this.value,a=i.seen(),s=i.curr(),o=i.prev(),u=e.index(),l=e.bisect(e.range),c=e.bisect(t),f=c[0],d=c[1],h=l[0],g=l[1],p=e.one;let v,m,y;if(f<h)for(v=f,m=Math.min(h,d);v<m;++v)y=u[v],a[y]!==n&&(o[y]=s[y],a[y]=n,r.push(y)),s[y]^=p;else if(f>h)for(v=h,m=Math.min(f,g);v<m;++v)y=u[v],a[y]!==n&&(o[y]=s[y],a[y]=n,r.push(y)),s[y]^=p;if(d>g)for(v=Math.max(f,g),m=d;v<m;++v)y=u[v],a[y]!==n&&(o[y]=s[y],a[y]=n,r.push(y)),s[y]^=p;else if(d<g)for(v=Math.max(h,d),m=g;v<m;++v)y=u[v],a[y]!==n&&(o[y]=s[y],a[y]=n,r.push(y)),s[y]^=p;e.range=t.slice()},incrementOne(e,t,n,r){const i=this.value,a=i.curr(),s=e.index(),o=e.bisect(e.range),u=e.bisect(t),l=u[0],c=u[1],f=o[0],d=o[1],h=e.one;let g,p,v;if(l<f)for(g=l,p=Math.min(f,c);g<p;++g)v=s[g],a[v]^=h,n.push(v);else if(l>f)for(g=f,p=Math.min(l,d);g<p;++g)v=s[g],a[v]^=h,r.push(v);if(c>d)for(g=Math.max(l,d),p=c;g<p;++g)v=s[g],a[v]^=h,n.push(v);else if(c<d)for(g=Math.max(f,c),p=d;g<p;++g)v=s[g],a[v]^=h,r.push(v);e.range=t.slice()}});function nC(e){G.call(this,null,e)}nC.Definition={type:"ResolveFilter",metadata:{},params:[{name:"ignore",type:"number",required:!0,description:"A bit mask indicating which filters to ignore."},{name:"filter",type:"object",required:!0,description:"Per-tuple filter bitmaps from a CrossFilter transform."}]},ge(nC,G,{transform(e,t){const n=~(e.ignore||0),r=e.filter,i=r.mask;if(!(i&n))return t.StopPropagation;const a=t.fork(t.ALL),s=r.data(),o=r.curr(),u=r.prev(),l=c=>o[c]&n?null:s[c];return a.filter(a.MOD,l),i&i-1?(a.filter(a.ADD,c=>{const f=o[c]&n;return!f&&f^u[c]&n?s[c]:null}),a.filter(a.REM,c=>{const f=o[c]&n;return f&&!(f^(f^u[c]&n))?s[c]:null})):(a.filter(a.ADD,l),a.filter(a.REM,c=>(o[c]&n)===i?s[c]:null)),a.filter(a.SOURCE,c=>l(c._index))}});const xfe=Object.freeze(Object.defineProperty({__proto__:null,crossfilter:tC,resolvefilter:nC},Symbol.toStringTag,{value:"Module"})),Efe="RawCode",cl="Literal",Ffe="Property",Sfe="Identifier",Cfe="ArrayExpression",kfe="BinaryExpression",pz="CallExpression",_fe="ConditionalExpression",Afe="LogicalExpression",Tfe="MemberExpression",Mfe="ObjectExpression",$fe="UnaryExpression";function Gi(e){this.type=e}Gi.prototype.visit=function(e){let t,n,r;if(e(this))return 1;for(t=Dfe(this),n=0,r=t.length;n<r;++n)if(t[n].visit(e))return 1};function Dfe(e){switch(e.type){case Cfe:return e.elements;case kfe:case Afe:return[e.left,e.right];case pz:return[e.callee].concat(e.arguments);case _fe:return[e.test,e.consequent,e.alternate];case Tfe:return[e.object,e.property];case Mfe:return e.properties;case Ffe:return[e.key,e.value];case $fe:return[e.argument];case Sfe:case cl:case Efe:default:return[]}}var Ba,_e,Z,nr,bt,qm=1,tg=2,fl=3,Yo=4,Um=5,dl=6,Lr=7,ng=8,Rfe=9;Ba={},Ba[qm]="Boolean",Ba[tg]="<end>",Ba[fl]="Identifier",Ba[Yo]="Keyword",Ba[Um]="Null",Ba[dl]="Numeric",Ba[Lr]="Punctuator",Ba[ng]="String",Ba[Rfe]="RegularExpression";var Pfe="ArrayExpression",Nfe="BinaryExpression",Ofe="CallExpression",Ife="ConditionalExpression",vz="Identifier",Bfe="Literal",Lfe="LogicalExpression",zfe="MemberExpression",qfe="ObjectExpression",Ufe="Property",Vfe="UnaryExpression",Sn="Unexpected token %0",Wfe="Unexpected number",Hfe="Unexpected string",jfe="Unexpected identifier",Gfe="Unexpected reserved word",Yfe="Unexpected end of input",rC="Invalid regular expression",iC="Invalid regular expression: missing /",mz="Octal literals are not allowed in strict mode.",Xfe="Duplicate data property in object literal not allowed in strict mode",qn="ILLEGAL",rg="Disabled.",Kfe=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),Zfe=new RegExp("[\\xAA\\xB5\\xBA\\xC0-\\xD6\\xD8-\\xF6\\xF8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0300-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u0483-\\u0487\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0610-\\u061A\\u0620-\\u0669\\u066E-\\u06D3\\u06D5-\\u06DC\\u06DF-\\u06E8\\u06EA-\\u06FC\\u06FF\\u0710-\\u074A\\u074D-\\u07B1\\u07C0-\\u07F5\\u07FA\\u0800-\\u082D\\u0840-\\u085B\\u08A0-\\u08B2\\u08E4-\\u0963\\u0966-\\u096F\\u0971-\\u0983\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BC-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CE\\u09D7\\u09DC\\u09DD\\u09DF-\\u09E3\\u09E6-\\u09F1\\u0A01-\\u0A03\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A59-\\u0A5C\\u0A5E\\u0A66-\\u0A75\\u0A81-\\u0A83\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABC-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AD0\\u0AE0-\\u0AE3\\u0AE6-\\u0AEF\\u0B01-\\u0B03\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3C-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B56\\u0B57\\u0B5C\\u0B5D\\u0B5F-\\u0B63\\u0B66-\\u0B6F\\u0B71\\u0B82\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD0\\u0BD7\\u0BE6-\\u0BEF\\u0C00-\\u0C03\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C58\\u0C59\\u0C60-\\u0C63\\u0C66-\\u0C6F\\u0C81-\\u0C83\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBC-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CDE\\u0CE0-\\u0CE3\\u0CE6-\\u0CEF\\u0CF1\\u0CF2\\u0D01-\\u0D03\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D60-\\u0D63\\u0D66-\\u0D6F\\u0D7A-\\u0D7F\\u0D82\\u0D83\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DE6-\\u0DEF\\u0DF2\\u0DF3\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E50-\\u0E59\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB9\\u0EBB-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECD\\u0ED0-\\u0ED9\\u0EDC-\\u0EDF\\u0F00\\u0F18\\u0F19\\u0F20-\\u0F29\\u0F35\\u0F37\\u0F39\\u0F3E-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F84\\u0F86-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u1000-\\u1049\\u1050-\\u109D\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u135D-\\u135F\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1714\\u1720-\\u1734\\u1740-\\u1753\\u1760-\\u176C\\u176E-\\u1770\\u1772\\u1773\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u17E0-\\u17E9\\u180B-\\u180D\\u1810-\\u1819\\u1820-\\u1877\\u1880-\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1920-\\u192B\\u1930-\\u193B\\u1946-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19D0-\\u19D9\\u1A00-\\u1A1B\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1A7F-\\u1A89\\u1A90-\\u1A99\\u1AA7\\u1AB0-\\u1ABD\\u1B00-\\u1B4B\\u1B50-\\u1B59\\u1B6B-\\u1B73\\u1B80-\\u1BF3\\u1C00-\\u1C37\\u1C40-\\u1C49\\u1C4D-\\u1C7D\\u1CD0-\\u1CD2\\u1CD4-\\u1CF6\\u1CF8\\u1CF9\\u1D00-\\u1DF5\\u1DFC-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u200C\\u200D\\u203F\\u2040\\u2054\\u2071\\u207F\\u2090-\\u209C\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D7F-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2DE0-\\u2DFF\\u2E2F\\u3005-\\u3007\\u3021-\\u302F\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u3099\\u309A\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA62B\\uA640-\\uA66F\\uA674-\\uA67D\\uA67F-\\uA69D\\uA69F-\\uA6F1\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA827\\uA840-\\uA873\\uA880-\\uA8C4\\uA8D0-\\uA8D9\\uA8E0-\\uA8F7\\uA8FB\\uA900-\\uA92D\\uA930-\\uA953\\uA960-\\uA97C\\uA980-\\uA9C0\\uA9CF-\\uA9D9\\uA9E0-\\uA9FE\\uAA00-\\uAA36\\uAA40-\\uAA4D\\uAA50-\\uAA59\\uAA60-\\uAA76\\uAA7A-\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEF\\uAAF2-\\uAAF6\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABEA\\uABEC\\uABED\\uABF0-\\uABF9\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE00-\\uFE0F\\uFE20-\\uFE2D\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF10-\\uFF19\\uFF21-\\uFF3A\\uFF3F\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]");function Vm(e,t){if(!e)throw new Error("ASSERT: "+t)}function Os(e){return e>=48&&e<=57}function aC(e){return"0123456789abcdefABCDEF".includes(e)}function ig(e){return"01234567".includes(e)}function Qfe(e){return e===32||e===9||e===11||e===12||e===160||e>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].includes(e)}function ag(e){return e===10||e===13||e===8232||e===8233}function sg(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e===92||e>=128&&Kfe.test(String.fromCharCode(e))}function Wm(e){return e===36||e===95||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===92||e>=128&&Zfe.test(String.fromCharCode(e))}const Jfe={if:1,in:1,do:1,var:1,for:1,new:1,try:1,let:1,this:1,else:1,case:1,void:1,with:1,enum:1,while:1,break:1,catch:1,throw:1,const:1,yield:1,class:1,super:1,return:1,typeof:1,delete:1,switch:1,export:1,import:1,public:1,static:1,default:1,finally:1,extends:1,package:1,private:1,function:1,continue:1,debugger:1,interface:1,protected:1,instanceof:1,implements:1};function yz(){for(;Z<nr;){const e=_e.charCodeAt(Z);if(Qfe(e)||ag(e))++Z;else break}}function sC(e){var t,n,r,i=0;for(n=e==="u"?4:2,t=0;t<n;++t)Z<nr&&aC(_e[Z])?(r=_e[Z++],i=i*16+"0123456789abcdef".indexOf(r.toLowerCase())):dt({},Sn,qn);return String.fromCharCode(i)}function ede(){var e,t,n,r;for(e=_e[Z],t=0,e==="}"&&dt({},Sn,qn);Z<nr&&(e=_e[Z++],!!aC(e));)t=t*16+"0123456789abcdef".indexOf(e.toLowerCase());return(t>1114111||e!=="}")&&dt({},Sn,qn),t<=65535?String.fromCharCode(t):(n=(t-65536>>10)+55296,r=(t-65536&1023)+56320,String.fromCharCode(n,r))}function bz(){var e,t;for(e=_e.charCodeAt(Z++),t=String.fromCharCode(e),e===92&&(_e.charCodeAt(Z)!==117&&dt({},Sn,qn),++Z,e=sC("u"),(!e||e==="\\"||!sg(e.charCodeAt(0)))&&dt({},Sn,qn),t=e);Z<nr&&(e=_e.charCodeAt(Z),!!Wm(e));)++Z,t+=String.fromCharCode(e),e===92&&(t=t.substr(0,t.length-1),_e.charCodeAt(Z)!==117&&dt({},Sn,qn),++Z,e=sC("u"),(!e||e==="\\"||!Wm(e.charCodeAt(0)))&&dt({},Sn,qn),t+=e);return t}function tde(){var e,t;for(e=Z++;Z<nr;){if(t=_e.charCodeAt(Z),t===92)return Z=e,bz();if(Wm(t))++Z;else break}return _e.slice(e,Z)}function nde(){var e,t,n;return e=Z,t=_e.charCodeAt(Z)===92?bz():tde(),t.length===1?n=fl:Jfe.hasOwnProperty(t)?n=Yo:t==="null"?n=Um:t==="true"||t==="false"?n=qm:n=fl,{type:n,value:t,start:e,end:Z}}function oC(){var e=Z,t=_e.charCodeAt(Z),n,r=_e[Z],i,a,s;switch(t){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:return++Z,{type:Lr,value:String.fromCharCode(t),start:e,end:Z};default:if(n=_e.charCodeAt(Z+1),n===61)switch(t){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:return Z+=2,{type:Lr,value:String.fromCharCode(t)+String.fromCharCode(n),start:e,end:Z};case 33:case 61:return Z+=2,_e.charCodeAt(Z)===61&&++Z,{type:Lr,value:_e.slice(e,Z),start:e,end:Z}}}if(s=_e.substr(Z,4),s===">>>=")return Z+=4,{type:Lr,value:s,start:e,end:Z};if(a=s.substr(0,3),a===">>>"||a==="<<="||a===">>=")return Z+=3,{type:Lr,value:a,start:e,end:Z};if(i=a.substr(0,2),r===i[1]&&"+-<>&|".includes(r)||i==="=>")return Z+=2,{type:Lr,value:i,start:e,end:Z};if(i==="//"&&dt({},Sn,qn),"<>=!+-*%&|^/".includes(r))return++Z,{type:Lr,value:r,start:e,end:Z};dt({},Sn,qn)}function rde(e){let t="";for(;Z<nr&&aC(_e[Z]);)t+=_e[Z++];return t.length===0&&dt({},Sn,qn),sg(_e.charCodeAt(Z))&&dt({},Sn,qn),{type:dl,value:parseInt("0x"+t,16),start:e,end:Z}}function ide(e){let t="0"+_e[Z++];for(;Z<nr&&ig(_e[Z]);)t+=_e[Z++];return(sg(_e.charCodeAt(Z))||Os(_e.charCodeAt(Z)))&&dt({},Sn,qn),{type:dl,value:parseInt(t,8),octal:!0,start:e,end:Z}}function wz(){var e,t,n;if(n=_e[Z],Vm(Os(n.charCodeAt(0))||n===".","Numeric literal must start with a decimal digit or a decimal point"),t=Z,e="",n!=="."){if(e=_e[Z++],n=_e[Z],e==="0"){if(n==="x"||n==="X")return++Z,rde(t);if(ig(n))return ide(t);n&&Os(n.charCodeAt(0))&&dt({},Sn,qn)}for(;Os(_e.charCodeAt(Z));)e+=_e[Z++];n=_e[Z]}if(n==="."){for(e+=_e[Z++];Os(_e.charCodeAt(Z));)e+=_e[Z++];n=_e[Z]}if(n==="e"||n==="E")if(e+=_e[Z++],n=_e[Z],(n==="+"||n==="-")&&(e+=_e[Z++]),Os(_e.charCodeAt(Z)))for(;Os(_e.charCodeAt(Z));)e+=_e[Z++];else dt({},Sn,qn);return sg(_e.charCodeAt(Z))&&dt({},Sn,qn),{type:dl,value:parseFloat(e),start:t,end:Z}}function ade(){var e="",t,n,r,i,a=!1;for(t=_e[Z],Vm(t==="'"||t==='"',"String literal must starts with a quote"),n=Z,++Z;Z<nr;)if(r=_e[Z++],r===t){t="";break}else if(r==="\\")if(r=_e[Z++],!r||!ag(r.charCodeAt(0)))switch(r){case"u":case"x":_e[Z]==="{"?(++Z,e+=ede()):e+=sC(r);break;case"n":e+=`
`;break;case"r":e+="\r";break;case"t":e+="	";break;case"b":e+="\b";break;case"f":e+="\f";break;case"v":e+="\v";break;default:ig(r)?(i="01234567".indexOf(r),i!==0&&(a=!0),Z<nr&&ig(_e[Z])&&(a=!0,i=i*8+"01234567".indexOf(_e[Z++]),"0123".includes(r)&&Z<nr&&ig(_e[Z])&&(i=i*8+"01234567".indexOf(_e[Z++]))),e+=String.fromCharCode(i)):e+=r;break}else r==="\r"&&_e[Z]===`
`&&++Z;else{if(ag(r.charCodeAt(0)))break;e+=r}return t!==""&&dt({},Sn,qn),{type:ng,value:e,octal:a,start:n,end:Z}}function sde(e,t){let n=e;t.includes("u")&&(n=n.replace(/\\u\{([0-9a-fA-F]+)\}/g,(r,i)=>{if(parseInt(i,16)<=1114111)return"x";dt({},rC)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"));try{new RegExp(n)}catch{dt({},rC)}try{return new RegExp(e,t)}catch{return null}}function ode(){var e,t,n,r,i;for(e=_e[Z],Vm(e==="/","Regular expression literal must start with a slash"),t=_e[Z++],n=!1,r=!1;Z<nr;)if(e=_e[Z++],t+=e,e==="\\")e=_e[Z++],ag(e.charCodeAt(0))&&dt({},iC),t+=e;else if(ag(e.charCodeAt(0)))dt({},iC);else if(n)e==="]"&&(n=!1);else if(e==="/"){r=!0;break}else e==="["&&(n=!0);return r||dt({},iC),i=t.substr(1,t.length-2),{value:i,literal:t}}function ude(){var e,t,n;for(t="",n="";Z<nr&&(e=_e[Z],!!Wm(e.charCodeAt(0)));)++Z,e==="\\"&&Z<nr?dt({},Sn,qn):(n+=e,t+=e);return n.search(/[^gimuy]/g)>=0&&dt({},rC,n),{value:n,literal:t}}function lde(){var e,t,n,r;return bt=null,yz(),e=Z,t=ode(),n=ude(),r=sde(t.value,n.value),{literal:t.literal+n.literal,value:r,regex:{pattern:t.value,flags:n.value},start:e,end:Z}}function cde(e){return e.type===fl||e.type===Yo||e.type===qm||e.type===Um}function xz(){if(yz(),Z>=nr)return{type:tg,start:Z,end:Z};const e=_e.charCodeAt(Z);return sg(e)?nde():e===40||e===41||e===59?oC():e===39||e===34?ade():e===46?Os(_e.charCodeAt(Z+1))?wz():oC():Os(e)?wz():oC()}function zr(){const e=bt;return Z=e.end,bt=xz(),Z=e.end,e}function Ez(){const e=Z;bt=xz(),Z=e}function fde(e){const t=new Gi(Pfe);return t.elements=e,t}function Fz(e,t,n){const r=new Gi(e==="||"||e==="&&"?Lfe:Nfe);return r.operator=e,r.left=t,r.right=n,r}function dde(e,t){const n=new Gi(Ofe);return n.callee=e,n.arguments=t,n}function hde(e,t,n){const r=new Gi(Ife);return r.test=e,r.consequent=t,r.alternate=n,r}function uC(e){const t=new Gi(vz);return t.name=e,t}function og(e){const t=new Gi(Bfe);return t.value=e.value,t.raw=_e.slice(e.start,e.end),e.regex&&(t.raw==="//"&&(t.raw="/(?:)/"),t.regex=e.regex),t}function Sz(e,t,n){const r=new Gi(zfe);return r.computed=e==="[",r.object=t,r.property=n,r.computed||(n.member=!0),r}function gde(e){const t=new Gi(qfe);return t.properties=e,t}function Cz(e,t,n){const r=new Gi(Ufe);return r.key=t,r.value=n,r.kind=e,r}function pde(e,t){const n=new Gi(Vfe);return n.operator=e,n.argument=t,n.prefix=!0,n}function dt(e,t){var n,r=Array.prototype.slice.call(arguments,2),i=t.replace(/%(\d)/g,(a,s)=>(Vm(s<r.length,"Message reference must be in range"),r[s]));throw n=new Error(i),n.index=Z,n.description=i,n}function Hm(e){e.type===tg&&dt(e,Yfe),e.type===dl&&dt(e,Wfe),e.type===ng&&dt(e,Hfe),e.type===fl&&dt(e,jfe),e.type===Yo&&dt(e,Gfe),dt(e,Sn,e.value)}function rr(e){const t=zr();(t.type!==Lr||t.value!==e)&&Hm(t)}function Nt(e){return bt.type===Lr&&bt.value===e}function lC(e){return bt.type===Yo&&bt.value===e}function vde(){const e=[];for(Z=bt.start,rr("[");!Nt("]");)Nt(",")?(zr(),e.push(null)):(e.push(hl()),Nt("]")||rr(","));return zr(),fde(e)}function kz(){Z=bt.start;const e=zr();return e.type===ng||e.type===dl?(e.octal&&dt(e,mz),og(e)):uC(e.value)}function mde(){var e,t,n,r;if(Z=bt.start,e=bt,e.type===fl)return n=kz(),rr(":"),r=hl(),Cz("init",n,r);if(e.type===tg||e.type===Lr)Hm(e);else return t=kz(),rr(":"),r=hl(),Cz("init",t,r)}function yde(){var e=[],t,n,r,i={},a=String;for(Z=bt.start,rr("{");!Nt("}");)t=mde(),t.key.type===vz?n=t.key.name:n=a(t.key.value),r="$"+n,Object.prototype.hasOwnProperty.call(i,r)?dt({},Xfe):i[r]=!0,e.push(t),Nt("}")||rr(",");return rr("}"),gde(e)}function bde(){rr("(");const e=cC();return rr(")"),e}const wde={if:1};function xde(){var e,t,n;if(Nt("("))return bde();if(Nt("["))return vde();if(Nt("{"))return yde();if(e=bt.type,Z=bt.start,e===fl||wde[bt.value])n=uC(zr().value);else if(e===ng||e===dl)bt.octal&&dt(bt,mz),n=og(zr());else{if(e===Yo)throw new Error(rg);e===qm?(t=zr(),t.value=t.value==="true",n=og(t)):e===Um?(t=zr(),t.value=null,n=og(t)):Nt("/")||Nt("/=")?(n=og(lde()),Ez()):Hm(zr())}return n}function Ede(){const e=[];if(rr("("),!Nt(")"))for(;Z<nr&&(e.push(hl()),!Nt(")"));)rr(",");return rr(")"),e}function Fde(){Z=bt.start;const e=zr();return cde(e)||Hm(e),uC(e.value)}function Sde(){return rr("."),Fde()}function Cde(){rr("[");const e=cC();return rr("]"),e}function kde(){var e,t,n;for(e=xde();;)if(Nt("."))n=Sde(),e=Sz(".",e,n);else if(Nt("("))t=Ede(),e=dde(e,t);else if(Nt("["))n=Cde(),e=Sz("[",e,n);else break;return e}function _z(){const e=kde();if(bt.type===Lr&&(Nt("++")||Nt("--")))throw new Error(rg);return e}function jm(){var e,t;if(bt.type!==Lr&&bt.type!==Yo)t=_z();else{if(Nt("++")||Nt("--"))throw new Error(rg);if(Nt("+")||Nt("-")||Nt("~")||Nt("!"))e=zr(),t=jm(),t=pde(e.value,t);else{if(lC("delete")||lC("void")||lC("typeof"))throw new Error(rg);t=_z()}}return t}function Az(e){let t=0;if(e.type!==Lr&&e.type!==Yo)return 0;switch(e.value){case"||":t=1;break;case"&&":t=2;break;case"|":t=3;break;case"^":t=4;break;case"&":t=5;break;case"==":case"!=":case"===":case"!==":t=6;break;case"<":case">":case"<=":case">=":case"instanceof":case"in":t=7;break;case"<<":case">>":case">>>":t=8;break;case"+":case"-":t=9;break;case"*":case"/":case"%":t=11;break}return t}function _de(){var e,t,n,r,i,a,s,o,u,l;if(e=bt,u=jm(),r=bt,i=Az(r),i===0)return u;for(r.prec=i,zr(),t=[e,bt],s=jm(),a=[u,r,s];(i=Az(bt))>0;){for(;a.length>2&&i<=a[a.length-2].prec;)s=a.pop(),o=a.pop().value,u=a.pop(),t.pop(),n=Fz(o,u,s),a.push(n);r=zr(),r.prec=i,a.push(r),t.push(bt),n=jm(),a.push(n)}for(l=a.length-1,n=a[l],t.pop();l>1;)t.pop(),n=Fz(a[l-1].value,a[l-2],n),l-=2;return n}function hl(){var e,t,n;return e=_de(),Nt("?")&&(zr(),t=hl(),rr(":"),n=hl(),e=hde(e,t,n)),e}function cC(){const e=hl();if(Nt(","))throw new Error(rg);return e}function Tz(e){_e=e,Z=0,nr=_e.length,bt=null,Ez();const t=cC();if(bt.type!==tg)throw new Error("Unexpect token after expression.");return t}var Mz={NaN:"NaN",E:"Math.E",LN2:"Math.LN2",LN10:"Math.LN10",LOG2E:"Math.LOG2E",LOG10E:"Math.LOG10E",PI:"Math.PI",SQRT1_2:"Math.SQRT1_2",SQRT2:"Math.SQRT2",MIN_VALUE:"Number.MIN_VALUE",MAX_VALUE:"Number.MAX_VALUE"};function $z(e){function t(s,o,u,l){let c=e(o[0]);return u&&(c=u+"("+c+")",u.lastIndexOf("new ",0)===0&&(c="("+c+")")),c+"."+s+(l<0?"":l===0?"()":"("+o.slice(1).map(e).join(",")+")")}function n(s,o,u){return l=>t(s,l,o,u)}const r="new Date",i="String",a="RegExp";return{isNaN:"Number.isNaN",isFinite:"Number.isFinite",abs:"Math.abs",acos:"Math.acos",asin:"Math.asin",atan:"Math.atan",atan2:"Math.atan2",ceil:"Math.ceil",cos:"Math.cos",exp:"Math.exp",floor:"Math.floor",hypot:"Math.hypot",log:"Math.log",max:"Math.max",min:"Math.min",pow:"Math.pow",random:"Math.random",round:"Math.round",sin:"Math.sin",sqrt:"Math.sqrt",tan:"Math.tan",clamp:function(s){s.length<3&&Q("Missing arguments to clamp function."),s.length>3&&Q("Too many arguments to clamp function.");const o=s.map(e);return"Math.max("+o[1]+", Math.min("+o[2]+","+o[0]+"))"},now:"Date.now",utc:"Date.UTC",datetime:r,date:n("getDate",r,0),day:n("getDay",r,0),year:n("getFullYear",r,0),month:n("getMonth",r,0),hours:n("getHours",r,0),minutes:n("getMinutes",r,0),seconds:n("getSeconds",r,0),milliseconds:n("getMilliseconds",r,0),time:n("getTime",r,0),timezoneoffset:n("getTimezoneOffset",r,0),utcdate:n("getUTCDate",r,0),utcday:n("getUTCDay",r,0),utcyear:n("getUTCFullYear",r,0),utcmonth:n("getUTCMonth",r,0),utchours:n("getUTCHours",r,0),utcminutes:n("getUTCMinutes",r,0),utcseconds:n("getUTCSeconds",r,0),utcmilliseconds:n("getUTCMilliseconds",r,0),length:n("length",null,-1),parseFloat:"parseFloat",parseInt:"parseInt",upper:n("toUpperCase",i,0),lower:n("toLowerCase",i,0),substring:n("substring",i),split:n("split",i),trim:n("trim",i,0),btoa:"btoa",atob:"atob",regexp:a,test:n("test",a),if:function(s){s.length<3&&Q("Missing arguments to if function."),s.length>3&&Q("Too many arguments to if function.");const o=s.map(e);return"("+o[0]+"?"+o[1]+":"+o[2]+")"}}}function Ade(e){const t=e&&e.length-1;return t&&(e[0]==='"'&&e[t]==='"'||e[0]==="'"&&e[t]==="'")?e.slice(1,-1):e}function Tde(e){e=e||{};const t=e.allowed?wa(e.allowed):{},n=e.forbidden?wa(e.forbidden):{},r=e.constants||Mz,i=(e.functions||$z)(f),a=e.globalvar,s=e.fieldvar,o=Ke(a)?a:g=>`${a}["${g}"]`;let u={},l={},c=0;function f(g){if(Ee(g))return g;const p=d[g.type];return p==null&&Q("Unsupported type: "+g.type),p(g)}const d={Literal:g=>g.raw,Identifier:g=>{const p=g.name;return c>0?p:xe(n,p)?Q("Illegal identifier: "+p):xe(r,p)?r[p]:xe(t,p)?p:(u[p]=1,o(p))},MemberExpression:g=>{const p=!g.computed,v=f(g.object);p&&(c+=1);const m=f(g.property);return v===s&&(l[Ade(m)]=1),p&&(c-=1),v+(p?"."+m:"["+m+"]")},CallExpression:g=>{g.callee.type!=="Identifier"&&Q("Illegal callee type: "+g.callee.type);const p=g.callee.name,v=g.arguments,m=xe(i,p)&&i[p];return m||Q("Unrecognized function: "+p),Ke(m)?m(v):m+"("+v.map(f).join(",")+")"},ArrayExpression:g=>"["+g.elements.map(f).join(",")+"]",BinaryExpression:g=>"("+f(g.left)+" "+g.operator+" "+f(g.right)+")",UnaryExpression:g=>"("+g.operator+f(g.argument)+")",ConditionalExpression:g=>"("+f(g.test)+"?"+f(g.consequent)+":"+f(g.alternate)+")",LogicalExpression:g=>"("+f(g.left)+g.operator+f(g.right)+")",ObjectExpression:g=>"{"+g.properties.map(f).join(",")+"}",Property:g=>{c+=1;const p=f(g.key);return c-=1,p+":"+f(g.value)}};function h(g){const p={code:f(g),globals:Object.keys(u),fields:Object.keys(l)};return u={},l={},p}return h.functions=i,h.constants=r,h}const Dz=Symbol("vega_selection_getter");function Rz(e){return(!e.getter||!e.getter[Dz])&&(e.getter=Ni(e.field),e.getter[Dz]=!0),e.getter}const fC="intersect",Pz="union",Mde="vlMulti",$de="vlPoint",Nz="or",Dde="and",La="_vgsid_",ug=Ni(La),Rde="E",Pde="R",Nde="R-E",Ode="R-LE",Ide="R-RE",Bde="E-LT",Lde="E-LTE",zde="E-GT",qde="E-GTE",Ude="E-VALID",Vde="E-ONE",Gm="index:unit";function Oz(e,t){for(var n=t.fields,r=t.values,i=n.length,a=0,s,o;a<i;++a)if(o=n[a],s=Rz(o)(e),Au(s)&&(s=cr(s)),Au(r[a])&&(r[a]=cr(r[a])),ee(r[a])&&Au(r[a][0])&&(r[a]=r[a].map(cr)),o.type===Rde){if(ee(r[a])?!r[a].includes(s):s!==r[a])return!1}else if(o.type===Pde){if(!Ad(s,r[a]))return!1}else if(o.type===Ide){if(!Ad(s,r[a],!0,!1))return!1}else if(o.type===Nde){if(!Ad(s,r[a],!1,!1))return!1}else if(o.type===Ode){if(!Ad(s,r[a],!1,!0))return!1}else if(o.type===Bde){if(s>=r[a])return!1}else if(o.type===Lde){if(s>r[a])return!1}else if(o.type===zde){if(s<=r[a])return!1}else if(o.type===qde){if(s<r[a])return!1}else if(o.type===Ude){if(s===null||isNaN(s))return!1}else if(o.type===Vde&&r[a].indexOf(s)===-1)return!1;return!0}function Wde(e,t,n){for(var r=this.context.data[e],i=r?r.values.value:[],a=r?r[Gm]&&r[Gm].value:void 0,s=n===fC,o=i.length,u=0,l,c,f,d,h;u<o;++u)if(l=i[u],a&&s){if(c=c||{},f=c[d=l.unit]||0,f===-1)continue;if(h=Oz(t,l),c[d]=h?-1:++f,h&&a.size===1)return!0;if(!h&&f===a.get(d).count)return!1}else if(h=Oz(t,l),s^h)return h;return o&&s}const Iz=yc(ug),Hde=Iz.left,jde=Iz.right;function Gde(e,t,n){const r=this.context.data[e],i=r?r.values.value:[],a=r?r[Gm]&&r[Gm].value:void 0,s=n===fC,o=ug(t),u=Hde(i,o);if(u===i.length||ug(i[u])!==o)return!1;if(a&&s){if(a.size===1)return!0;if(jde(i,o)-u<a.size)return!1}return!0}function Yde(e,t){return e.map(n=>Ze(t.fields?{values:t.fields.map(r=>Rz(r)(n.datum))}:{[La]:ug(n.datum)},t))}function Xde(e,t,n,r){for(var i=this.context.data[e],a=i?i.values.value:[],s={},o={},u={},l,c,f,d,h,g,p,v,m,y,b=a.length,w=0,E,F;w<b;++w)if(l=a[w],d=l.unit,c=l.fields,f=l.values,c&&f){for(E=0,F=c.length;E<F;++E)h=c[E],p=s[h.field]||(s[h.field]={}),v=p[d]||(p[d]=[]),u[h.field]=m=h.type.charAt(0),y=dC[`${m}_union`],p[d]=y(v,be(f[E]));n&&(v=o[d]||(o[d]=[]),v.push(be(f).reduce((x,C,S)=>(x[c[S].field]=C,x),{})))}else h=La,g=ug(l),p=s[h]||(s[h]={}),v=p[d]||(p[d]=[]),v.push(g),n&&(v=o[d]||(o[d]=[]),v.push({[La]:g}));if(t=t||Pz,s[La]?s[La]=dC[`${La}_${t}`](...Object.values(s[La])):Object.keys(s).forEach(x=>{s[x]=Object.keys(s[x]).map(C=>s[x][C]).reduce((C,S)=>C===void 0?S:dC[`${u[x]}_${t}`](C,S))}),a=Object.keys(o),n&&a.length){const x=r?$de:Mde;s[x]=t===Pz?{[Nz]:a.reduce((C,S)=>(C.push(...o[S]),C),[])}:{[Dde]:a.map(C=>({[Nz]:o[C]}))}}return s}var dC={[`${La}_union`]:JX,[`${La}_intersect`]:ZX,E_union:function(e,t){if(!e.length)return t;for(var n=0,r=t.length;n<r;++n)e.includes(t[n])||e.push(t[n]);return e},E_intersect:function(e,t){return e.length?e.filter(n=>t.includes(n)):t},R_union:function(e,t){var n=cr(t[0]),r=cr(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?(e[0]>n&&(e[0]=n),e[1]<r&&(e[1]=r),e):[n,r]},R_intersect:function(e,t){var n=cr(t[0]),r=cr(t[1]);return n>r&&(n=t[1],r=t[0]),e.length?r<e[0]||e[1]<n?[]:(e[0]<n&&(e[0]=n),e[1]>r&&(e[1]=r),e):[n,r]}};const Kde=":",Zde="@";function hC(e,t,n,r){t[0].type!==cl&&Q("First argument to selection functions must be a string literal.");const i=t[0].value,a=t.length>=2&&st(t).value,s="unit",o=Zde+s,u=Kde+i;a===fC&&!xe(r,o)&&(r[o]=n.getData(i).indataRef(n,s)),xe(r,u)||(r[u]=n.getData(i).tuplesRef())}function Bz(e){const t=this.context.data[e];return t?t.values.value:[]}function Qde(e,t,n){const r=this.context.data[e]["index:"+t],i=r?r.value.get(n):void 0;return i&&i.count}function Jde(e,t){const n=this.context.dataflow,r=this.context.data[e],i=r.input;return n.pulse(i,n.changeset().remove(Oi).insert(t)),1}function ehe(e,t,n){if(e){const r=this.context.dataflow,i=e.mark.source;r.pulse(i,r.changeset().encode(e,t))}return n!==void 0?n:e}const lg=e=>function(t,n){const r=this.context.dataflow.locale();return t===null?"null":r[e](n)(t)},the=lg("format"),Lz=lg("timeFormat"),nhe=lg("utcFormat"),rhe=lg("timeParse"),ihe=lg("utcParse"),Ym=new Date(2e3,0,1);function Xm(e,t,n){return!Number.isInteger(e)||!Number.isInteger(t)?"":(Ym.setYear(2e3),Ym.setMonth(e),Ym.setDate(t),Lz.call(this,Ym,n))}function ahe(e){return Xm.call(this,e,1,"%B")}function she(e){return Xm.call(this,e,1,"%b")}function ohe(e){return Xm.call(this,0,2+e,"%A")}function uhe(e){return Xm.call(this,0,2+e,"%a")}const lhe=":",che="@",gC="%",zz="$";function pC(e,t,n,r){t[0].type!==cl&&Q("First argument to data functions must be a string literal.");const i=t[0].value,a=lhe+i;if(!xe(a,r))try{r[a]=n.getData(i).tuplesRef()}catch{}}function fhe(e,t,n,r){t[0].type!==cl&&Q("First argument to indata must be a string literal."),t[1].type!==cl&&Q("Second argument to indata must be a string literal.");const i=t[0].value,a=t[1].value,s=che+a;xe(s,r)||(r[s]=n.getData(i).indataRef(n,a))}function _r(e,t,n,r){if(t[0].type===cl)qz(n,r,t[0].value);else for(e in n.scales)qz(n,r,e)}function qz(e,t,n){const r=gC+n;if(!xe(t,r))try{t[r]=e.scaleRef(n)}catch{}}function za(e,t){if(Ee(e)){const n=t.scales[e];return n&&EO(n.value)?n.value:void 0}else if(Ke(e))return EO(e)?e:void 0}function dhe(e,t,n){t.__bandwidth=i=>i&&i.bandwidth?i.bandwidth():0,n._bandwidth=_r,n._range=_r,n._scale=_r;const r=i=>"_["+(i.type===cl?he(gC+i.value):he(gC)+"+"+e(i))+"]";return{_bandwidth:i=>`this.__bandwidth(${r(i[0])})`,_range:i=>`${r(i[0])}.range()`,_scale:i=>`${r(i[0])}(${e(i[1])})`}}function vC(e,t){return function(n,r,i){if(n){const a=za(n,(i||this).context);return a&&a.path[e](r)}else return t(r)}}const hhe=vC("area",Tse),ghe=vC("bounds",Rse),phe=vC("centroid",Lse);function vhe(e,t){const n=za(e,(t||this).context);return n&&n.scale()}function mhe(e){const t=this.context.group;let n=!1;if(t)for(;e;){if(e===t){n=!0;break}e=e.mark.group}return n}function mC(e,t,n){try{e[t].apply(e,["EXPRESSION"].concat([].slice.call(n)))}catch(r){e.warn(r)}return n[n.length-1]}function yhe(){return mC(this.context.dataflow,"warn",arguments)}function bhe(){return mC(this.context.dataflow,"info",arguments)}function whe(){return mC(this.context.dataflow,"debug",arguments)}function yC(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}function bC(e){const t=Mo(e),n=yC(t.r),r=yC(t.g),i=yC(t.b);return .2126*n+.7152*r+.0722*i}function xhe(e,t){const n=bC(e),r=bC(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function Ehe(){const e=[].slice.call(arguments);return e.unshift({}),Ze(...e)}function Uz(e,t){return e===t||e!==e&&t!==t?!0:ee(e)?ee(t)&&e.length===t.length?Fhe(e,t):!1:we(e)&&we(t)?Vz(e,t):!1}function Fhe(e,t){for(let n=0,r=e.length;n<r;++n)if(!Uz(e[n],t[n]))return!1;return!0}function Vz(e,t){for(const n in e)if(!Uz(e[n],t[n]))return!1;return!0}function Wz(e){return t=>Vz(e,t)}function She(e,t,n,r,i,a){const s=this.context.dataflow,o=this.context.data[e],u=o.input,l=s.stamp();let c=o.changes,f,d;if(s._trigger===!1||!(u.value.length||t||r))return 0;if((!c||c.stamp<l)&&(o.changes=c=s.changeset(),c.stamp=l,s.runAfter(()=>{o.modified=!0,s.pulse(u,c).run()},!0,1)),n&&(f=n===!0?Oi:ee(n)||Ow(n)?n:Wz(n),c.remove(f)),t&&c.insert(t),r&&(f=Wz(r),u.value.some(f)?c.remove(f):c.insert(r)),i)for(d in a)c.modify(i,d,a[d]);return 1}function Che(e){const t=e.touches,n=t[0].clientX-t[1].clientX,r=t[0].clientY-t[1].clientY;return Math.hypot(n,r)}function khe(e){const t=e.touches;return Math.atan2(t[0].clientY-t[1].clientY,t[0].clientX-t[1].clientX)}const Hz={};function _he(e,t){const n=Hz[t]||(Hz[t]=Ni(t));return ee(e)?e.map(n):n(e)}function Km(e){return ee(e)||ArrayBuffer.isView(e)?e:null}function wC(e){return Km(e)||(Ee(e)?e:null)}function Ahe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Km(e).join(...n)}function The(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return wC(e).indexOf(...n)}function Mhe(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return wC(e).lastIndexOf(...n)}function $he(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return wC(e).slice(...n)}function Dhe(e,t,n){return Ke(n)&&Q("Function argument passed to replace."),!Ee(t)&&!fR(t)&&Q("Please pass a string or RegExp argument to replace."),String(e).replace(t,n)}function Rhe(e){return Km(e).slice().reverse()}function Phe(e){return Km(e).slice().sort(i0)}function Nhe(e,t,n){return iE(e||0,t||0,n||0)}function Ohe(e,t){const n=za(e,(t||this).context);return n&&n.bandwidth?n.bandwidth():0}function Ihe(e,t){const n=za(e,(t||this).context);return n?n.copy():void 0}function Bhe(e,t){const n=za(e,(t||this).context);return n?n.domain():[]}function Lhe(e,t,n){const r=za(e,(n||this).context);return r?ee(t)?(r.invertRange||r.invert)(t):(r.invert||r.invertExtent)(t):void 0}function zhe(e,t){const n=za(e,(t||this).context);return n&&n.range?n.range():[]}function qhe(e,t,n){const r=za(e,(n||this).context);return r?r(t):void 0}function Uhe(e,t,n,r,i){e=za(e,(i||this).context);const a=Mne(t,n);let s=e.domain(),o=s[0],u=st(s),l=lr;return u-o?l=_O(e,o,u):e=(e.interpolator?ht("sequential")().interpolator(e.interpolator()):ht("linear")().interpolate(e.interpolate()).range(e.range())).domain([o=0,u=1]),e.ticks&&(s=e.ticks(+r||15),o!==s[0]&&s.unshift(o),u!==st(s)&&s.push(u)),s.forEach(c=>a.stop(l(c),e(c))),a}function Vhe(e,t,n){const r=za(e,(n||this).context);return function(i){return r?r.path.context(i)(t):""}}function Whe(e){let t=null;return function(n){return n?sv(n,t=t||mE(e)):e}}const jz=e=>e.data;function Gz(e,t){const n=Bz.call(t,e);return n.root&&n.root.lookup||{}}function Hhe(e,t,n){const r=Gz(e,this),i=r[t],a=r[n];return i&&a?i.path(a).map(jz):void 0}function jhe(e,t){const n=Gz(e,this)[t];return n?n.ancestors().map(jz):void 0}const Yz=()=>typeof window<"u"&&window||null;function Ghe(){const e=Yz();return e?e.screen:{}}function Yhe(){const e=Yz();return e?[e.innerWidth,e.innerHeight]:[void 0,void 0]}function Xhe(){const e=this.context.dataflow,t=e.container&&e.container();return t?[t.clientWidth,t.clientHeight]:[void 0,void 0]}function Xz(e,t,n){if(!e)return[];const[r,i]=e,a=new ln().set(r[0],r[1],i[0],i[1]),s=n||this.context.dataflow.scenegraph().root;return vae(s,a,Khe(t))}function Khe(e){let t=null;if(e){const n=be(e.marktype),r=be(e.markname);t=i=>(!n.length||n.some(a=>i.marktype===a))&&(!r.length||r.some(a=>i.name===a))}return t}function Zhe(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:5;e=be(e);const i=e[e.length-1];return i===void 0||Math.hypot(i[0]-t,i[1]-n)>r?[...e,[t,n]]:e}function Qhe(e){return be(e).reduce((t,n,r)=>{let[i,a]=n;return t+=r==0?`M ${i},${a} `:r===e.length-1?" Z":`L ${i},${a} `},"")}function Jhe(e,t,n){const{x:r,y:i,mark:a}=n,s=new ln().set(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,Number.MIN_SAFE_INTEGER,Number.MIN_SAFE_INTEGER);for(const[u,l]of t)u<s.x1&&(s.x1=u),u>s.x2&&(s.x2=u),l<s.y1&&(s.y1=l),l>s.y2&&(s.y2=l);return s.translate(r,i),Xz([[s.x1,s.y1],[s.x2,s.y2]],e,a).filter(u=>ege(u.x,u.y,t))}function ege(e,t,n){let r=0;for(let i=0,a=n.length-1;i<n.length;a=i++){const[s,o]=n[a],[u,l]=n[i];l>t!=o>t&&e<(s-u)*(t-l)/(o-l)+u&&r++}return r&1}const cg={random(){return Fs()},cumulativeNormal:Vw,cumulativeLogNormal:eP,cumulativeUniform:iP,densityNormal:X3,densityLogNormal:J3,densityUniform:rP,quantileNormal:Ww,quantileLogNormal:tP,quantileUniform:aP,sampleNormal:Uw,sampleLogNormal:Q3,sampleUniform:nP,isArray:ee,isBoolean:mc,isDate:Au,isDefined(e){return e!==void 0},isNumber:yt,isObject:we,isRegExp:fR,isString:Ee,isTuple:Ow,isValid(e){return e!=null&&e===e},toBoolean:hR,toDate(e){return gR(e)},toNumber:cr,toString:pR,indexof:The,join:Ahe,lastindexof:Mhe,replace:Dhe,reverse:Rhe,sort:Phe,slice:$he,flush:mX,lerp:bX,merge:Ehe,pad:FX,peek:st,pluck:_he,span:o0,inrange:Ad,truncate:CX,rgb:Mo,lab:H0,hcl:j0,hsl:U0,luminance:bC,contrast:xhe,sequence:Kr,format:the,utcFormat:nhe,utcParse:ihe,utcOffset:IK,utcSequence:LK,timeFormat:Lz,timeParse:rhe,timeOffset:OK,timeSequence:BK,timeUnitSpecifier:wK,monthFormat:ahe,monthAbbrevFormat:she,dayFormat:ohe,dayAbbrevFormat:uhe,quarter:lX,utcquarter:cX,week:EK,utcweek:CK,dayofyear:xK,utcdayofyear:SK,warn:yhe,info:bhe,debug:whe,extent(e){return gs(e)},inScope:mhe,intersect:Xz,clampRange:fX,pinchDistance:Che,pinchAngle:khe,screen:Ghe,containerSize:Xhe,windowSize:Yhe,bandspace:Nhe,setdata:Jde,pathShape:Whe,panLinear:aX,panLog:sX,panPow:oX,panSymlog:uX,zoomLinear:sR,zoomLog:oR,zoomPow:nw,zoomSymlog:uR,encode:ehe,modify:She,lassoAppend:Zhe,lassoPath:Qhe,intersectLasso:Jhe},tge=["view","item","group","xy","x","y"],nge="event.vega.",Kz="this.",xC={},Zz={forbidden:["_"],allowed:["datum","event","item"],fieldvar:"datum",globalvar:e=>`_[${he(zz+e)}]`,functions:rge,constants:Mz,visitors:xC},EC=Tde(Zz);function rge(e){const t=$z(e);tge.forEach(n=>t[n]=nge+n);for(const n in cg)t[n]=Kz+n;return Ze(t,dhe(e,cg,xC)),t}function Jt(e,t,n){return arguments.length===1?cg[e]:(cg[e]=t,n&&(xC[e]=n),EC&&(EC.functions[e]=Kz+e),this)}Jt("bandwidth",Ohe,_r),Jt("copy",Ihe,_r),Jt("domain",Bhe,_r),Jt("range",zhe,_r),Jt("invert",Lhe,_r),Jt("scale",qhe,_r),Jt("gradient",Uhe,_r),Jt("geoArea",hhe,_r),Jt("geoBounds",ghe,_r),Jt("geoCentroid",phe,_r),Jt("geoShape",Vhe,_r),Jt("geoScale",vhe,_r),Jt("indata",Qde,fhe),Jt("data",Bz,pC),Jt("treePath",Hhe,pC),Jt("treeAncestors",jhe,pC),Jt("vlSelectionTest",Wde,hC),Jt("vlSelectionIdTest",Gde,hC),Jt("vlSelectionResolve",Xde,hC),Jt("vlSelectionTuples",Yde);function qa(e,t){const n={};let r;try{e=Ee(e)?e:he(e)+"",r=Tz(e)}catch{Q("Expression parse error: "+e)}r.visit(a=>{if(a.type!==pz)return;const s=a.callee.name,o=Zz.visitors[s];o&&o(s,a.arguments,t,n)});const i=EC(r);return i.globals.forEach(a=>{const s=zz+a;!xe(n,s)&&t.getSignal(a)&&(n[s]=t.signalRef(a))}),{$expr:Ze({code:i.code},t.options.ast?{ast:r}:null),$fields:i.fields,$params:n}}function ige(e){const t=this,n=e.operators||[];return e.background&&(t.background=e.background),e.eventConfig&&(t.eventConfig=e.eventConfig),e.locale&&(t.locale=e.locale),n.forEach(r=>t.parseOperator(r)),n.forEach(r=>t.parseOperatorParameters(r)),(e.streams||[]).forEach(r=>t.parseStream(r)),(e.updates||[]).forEach(r=>t.parseUpdate(r)),t.resolve()}const age=wa(["rule"]),Qz=wa(["group","image","rect"]);function sge(e,t){let n="";return age[t]||(e.x2&&(e.x?(Qz[t]&&(n+="if(o.x>o.x2)$=o.x,o.x=o.x2,o.x2=$;"),n+="o.width=o.x2-o.x;"):n+="o.x=o.x2-(o.width||0);"),e.xc&&(n+="o.x=o.xc-(o.width||0)/2;"),e.y2&&(e.y?(Qz[t]&&(n+="if(o.y>o.y2)$=o.y,o.y=o.y2,o.y2=$;"),n+="o.height=o.y2-o.y;"):n+="o.y=o.y2-(o.height||0);"),e.yc&&(n+="o.y=o.yc-(o.height||0)/2;")),n}function FC(e){return(e+"").toLowerCase()}function oge(e){return FC(e)==="operator"}function uge(e){return FC(e)==="collect"}function fg(e,t,n){n.endsWith(";")||(n="return("+n+");");const r=Function(...t.concat(n));return e&&e.functions?r.bind(e.functions):r}function lge(e,t,n,r){return`((u = ${e}) < (v = ${t}) || u == null) && v != null ? ${n}
  : (u > v || v == null) && u != null ? ${r}
  : ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? ${n}
  : v !== v && u === u ? ${r} : `}var cge={operator:(e,t)=>fg(e,["_"],t.code),parameter:(e,t)=>fg(e,["datum","_"],t.code),event:(e,t)=>fg(e,["event"],t.code),handler:(e,t)=>{const n=`var datum=event.item&&event.item.datum;return ${t.code};`;return fg(e,["_","event"],n)},encode:(e,t)=>{const{marktype:n,channels:r}=t;let i="var o=item,datum=o.datum,m=0,$;";for(const a in r){const s="o["+he(a)+"]";i+=`$=${r[a].code};if(${s}!==$)${s}=$,m=1;`}return i+=sge(r,n),i+="return m;",fg(e,["item","_"],i)},codegen:{get(e){const t=`[${e.map(he).join("][")}]`,n=Function("_",`return _${t};`);return n.path=t,n},comparator(e,t){let n;const r=(a,s)=>{const o=t[s];let u,l;return a.path?(u=`a${a.path}`,l=`b${a.path}`):((n=n||{})["f"+s]=a,u=`this.f${s}(a)`,l=`this.f${s}(b)`),lge(u,l,-o,o)},i=Function("a","b","var u, v; return "+e.map(r).join("")+"0;");return n?i.bind(n):i}}};function fge(e){const t=this;oge(e.type)||!e.type?t.operator(e,e.update?t.operatorExpression(e.update):null):t.transform(e,e.type)}function dge(e){const t=this;if(e.params){const n=t.get(e.id);n||Q("Invalid operator id: "+e.id),t.dataflow.connect(n,n.parameters(t.parseParameters(e.params),e.react,e.initonly))}}function hge(e,t){t=t||{};const n=this;for(const r in e){const i=e[r];t[r]=ee(i)?i.map(a=>Jz(a,n,t)):Jz(i,n,t)}return t}function Jz(e,t,n){if(!e||!we(e))return e;for(let r=0,i=e4.length,a;r<i;++r)if(a=e4[r],xe(e,a.key))return a.parse(e,t,n);return e}var e4=[{key:"$ref",parse:gge},{key:"$key",parse:vge},{key:"$expr",parse:pge},{key:"$field",parse:mge},{key:"$encode",parse:bge},{key:"$compare",parse:yge},{key:"$context",parse:wge},{key:"$subflow",parse:xge},{key:"$tupleid",parse:Ege}];function gge(e,t){return t.get(e.$ref)||Q("Operator not defined: "+e.$ref)}function pge(e,t,n){e.$params&&t.parseParameters(e.$params,n);const r="e:"+e.$expr.code;return t.fn[r]||(t.fn[r]=Xr(t.parameterExpression(e.$expr),e.$fields))}function vge(e,t){const n="k:"+e.$key+"_"+!!e.$flat;return t.fn[n]||(t.fn[n]=dR(e.$key,e.$flat,t.expr.codegen))}function mge(e,t){if(!e.$field)return null;const n="f:"+e.$field+"_"+e.$name;return t.fn[n]||(t.fn[n]=Ni(e.$field,e.$name,t.expr.codegen))}function yge(e,t){const n="c:"+e.$compare+"_"+e.$order,r=be(e.$compare).map(i=>i&&i.$tupleid?Re:i);return t.fn[n]||(t.fn[n]=lR(r,e.$order,t.expr.codegen))}function bge(e,t){const n=e.$encode,r={};for(const i in n){const a=n[i];r[i]=Xr(t.encodeExpression(a.$expr),a.$fields),r[i].output=a.$output}return r}function wge(e,t){return t}function xge(e,t){const n=e.$subflow;return function(r,i,a){const s=t.fork().parse(n),o=s.get(n.operators[0].id),u=s.signals.parent;return u&&u.set(a),o.detachSubflow=()=>t.detach(s),o}}function Ege(){return Re}function Fge(e){var t=this,n=e.filter!=null?t.eventExpression(e.filter):void 0,r=e.stream!=null?t.get(e.stream):void 0,i;e.source?r=t.events(e.source,e.type,n):e.merge&&(i=e.merge.map(a=>t.get(a)),r=i[0].merge.apply(i[0],i.slice(1))),e.between&&(i=e.between.map(a=>t.get(a)),r=r.between(i[0],i[1])),e.filter&&(r=r.filter(n)),e.throttle!=null&&(r=r.throttle(+e.throttle)),e.debounce!=null&&(r=r.debounce(+e.debounce)),r==null&&Q("Invalid stream definition: "+JSON.stringify(e)),e.consume&&r.consume(!0),t.stream(e,r)}function Sge(e){var t=this,n=we(n=e.source)?n.$ref:n,r=t.get(n),i=null,a=e.update,s=void 0;r||Q("Source not defined: "+e.source),i=e.target&&e.target.$expr?t.eventExpression(e.target.$expr):t.get(e.target),a&&a.$expr&&(a.$params&&(s=t.parseParameters(a.$params)),a=t.handlerExpression(a.$expr)),t.update(e,r,i,a,s)}const Cge={skip:!0};function kge(e){var t=this,n={};if(e.signals){var r=n.signals={};Object.keys(t.signals).forEach(a=>{const s=t.signals[a];e.signals(a,s)&&(r[a]=s.value)})}if(e.data){var i=n.data={};Object.keys(t.data).forEach(a=>{const s=t.data[a];e.data(a,s)&&(i[a]=s.input.value)})}return t.subcontext&&e.recurse!==!1&&(n.subcontext=t.subcontext.map(a=>a.getState(e))),n}function _ge(e){var t=this,n=t.dataflow,r=e.data,i=e.signals;Object.keys(i||{}).forEach(a=>{n.update(t.signals[a],i[a],Cge)}),Object.keys(r||{}).forEach(a=>{n.pulse(t.data[a].input,n.changeset().remove(Oi).insert(r[a]))}),(e.subcontext||[]).forEach((a,s)=>{const o=t.subcontext[s];o&&o.setState(a)})}function Age(e,t,n,r){return new t4(e,t,n,r)}function t4(e,t,n,r){this.dataflow=e,this.transforms=t,this.events=e.events.bind(e),this.expr=r||cge,this.signals={},this.scales={},this.nodes={},this.data={},this.fn={},n&&(this.functions=Object.create(n),this.functions.context=this)}function n4(e){this.dataflow=e.dataflow,this.transforms=e.transforms,this.events=e.events,this.expr=e.expr,this.signals=Object.create(e.signals),this.scales=Object.create(e.scales),this.nodes=Object.create(e.nodes),this.data=Object.create(e.data),this.fn=Object.create(e.fn),e.functions&&(this.functions=Object.create(e.functions),this.functions.context=this)}t4.prototype=n4.prototype={fork(){const e=new n4(this);return(this.subcontext||(this.subcontext=[])).push(e),e},detach(e){this.subcontext=this.subcontext.filter(n=>n!==e);const t=Object.keys(e.nodes);for(const n of t)e.nodes[n]._targets=null;for(const n of t)e.nodes[n].detach();e.nodes=null},get(e){return this.nodes[e]},set(e,t){return this.nodes[e]=t},add(e,t){const n=this,r=n.dataflow,i=e.value;if(n.set(e.id,t),uge(e.type)&&i&&(i.$ingest?r.ingest(t,i.$ingest,i.$format):i.$request?r.preload(t,i.$request,i.$format):r.pulse(t,r.changeset().insert(i))),e.root&&(n.root=t),e.parent){let a=n.get(e.parent.$ref);a?(r.connect(a,[t]),t.targets().add(a)):(n.unresolved=n.unresolved||[]).push(()=>{a=n.get(e.parent.$ref),r.connect(a,[t]),t.targets().add(a)})}if(e.signal&&(n.signals[e.signal]=t),e.scale&&(n.scales[e.scale]=t),e.data)for(const a in e.data){const s=n.data[a]||(n.data[a]={});e.data[a].forEach(o=>s[o]=t)}},resolve(){return(this.unresolved||[]).forEach(e=>e()),delete this.unresolved,this},operator(e,t){this.add(e,this.dataflow.add(e.value,t))},transform(e,t){this.add(e,this.dataflow.add(this.transforms[FC(t)]))},stream(e,t){this.set(e.id,t)},update(e,t,n,r,i){this.dataflow.on(t,n,r,i,e.options)},operatorExpression(e){return this.expr.operator(this,e)},parameterExpression(e){return this.expr.parameter(this,e)},eventExpression(e){return this.expr.event(this,e)},handlerExpression(e){return this.expr.handler(this,e)},encodeExpression(e){return this.expr.encode(this,e)},parse:ige,parseOperator:fge,parseOperatorParameters:dge,parseParameters:hge,parseStream:Fge,parseUpdate:Sge,getState:kge,setState:_ge};function Tge(e){const t=e.container();t&&(t.setAttribute("role","graphics-document"),t.setAttribute("aria-roleDescription","visualization"),r4(t,e.description()))}function r4(e,t){e&&(t==null?e.removeAttribute("aria-label"):e.setAttribute("aria-label",t))}function Mge(e){e.add(null,t=>(e._background=t.bg,e._resize=1,t.bg),{bg:e._signals.background})}const SC="default";function $ge(e){const t=e._signals.cursor||(e._signals.cursor=e.add({user:SC,item:null}));e.on(e.events("view","pointermove"),t,(n,r)=>{const i=t.value,a=i?Ee(i)?i:i.user:SC,s=r.item&&r.item.cursor||null;return i&&a===i.user&&s==i.item?i:{user:a,item:s}}),e.add(null,function(n){let r=n.cursor,i=this.value;return Ee(r)||(i=r.item,r=r.user),CC(e,r&&r!==SC?r:i||r),i},{cursor:t})}function CC(e,t){const n=e.globalCursor()?typeof document<"u"&&document.body:e.container();if(n)return t==null?n.style.removeProperty("cursor"):n.style.cursor=t}function Zm(e,t){var n=e._runtime.data;return xe(n,t)||Q("Unrecognized data set: "+t),n[t]}function Dge(e,t){return arguments.length<2?Zm(this,e).values.value:Qm.call(this,e,_c().remove(Oi).insert(t))}function Qm(e,t){P3(t)||Q("Second argument to changes must be a changeset.");const n=Zm(this,e);return n.modified=!0,this.pulse(n.input,t)}function Rge(e,t){return Qm.call(this,e,_c().insert(t))}function Pge(e,t){return Qm.call(this,e,_c().remove(t))}function i4(e){var t=e.padding();return Math.max(0,e._viewWidth+t.left+t.right)}function a4(e){var t=e.padding();return Math.max(0,e._viewHeight+t.top+t.bottom)}function Jm(e){var t=e.padding(),n=e._origin;return[t.left+n[0],t.top+n[1]]}function Nge(e){var t=Jm(e),n=i4(e),r=a4(e);e._renderer.background(e.background()),e._renderer.resize(n,r,t),e._handler.origin(t),e._resizeListeners.forEach(i=>{try{i(n,r)}catch(a){e.error(a)}})}function Oge(e,t,n){var r=e._renderer,i=r&&r.canvas(),a,s,o;return i&&(o=Jm(e),s=t.changedTouches?t.changedTouches[0]:t,a=WE(s,i),a[0]-=o[0],a[1]-=o[1]),t.dataflow=e,t.item=n,t.vega=Ige(e,n,a),t}function Ige(e,t,n){const r=t?t.mark.marktype==="group"?t:t.mark.group:null;function i(s){var o=r,u;if(s){for(u=t;u;u=u.mark.group)if(u.mark.name===s){o=u;break}}return o&&o.mark&&o.mark.interactive?o:{}}function a(s){if(!s)return n;Ee(s)&&(s=i(s));const o=n.slice();for(;s;)o[0]-=s.x||0,o[1]-=s.y||0,s=s.mark&&s.mark.group;return o}return{view:fr(e),item:fr(t||{}),group:i,xy:a,x:s=>a(s)[0],y:s=>a(s)[1]}}const s4="view",Bge="timer",Lge="window",zge={trap:!1};function qge(e){const t=Ze({defaults:{}},e),n=(r,i)=>{i.forEach(a=>{ee(r[a])&&(r[a]=wa(r[a]))})};return n(t.defaults,["prevent","allow"]),n(t,["view","window","selector"]),t}function o4(e,t,n,r){e._eventListeners.push({type:n,sources:be(t),handler:r})}function Uge(e,t){var n=e._eventConfig.defaults,r=n.prevent,i=n.allow;return r===!1||i===!0?!1:r===!0||i===!1?!0:r?r[t]:i?!i[t]:e.preventDefault()}function ey(e,t,n){const r=e._eventConfig&&e._eventConfig[t];return r===!1||we(r)&&!r[n]?(e.warn(`Blocked ${t} ${n} event listener.`),!1):!0}function Vge(e,t,n){var r=this,i=new Lw(n),a=function(l,c){r.runAsync(null,()=>{e===s4&&Uge(r,t)&&l.preventDefault(),i.receive(Oge(r,l,c))})},s;if(e===Bge)ey(r,"timer",t)&&r.timer(a,t);else if(e===s4)ey(r,"view",t)&&r.addEventListener(t,a,zge);else if(e===Lge?ey(r,"window",t)&&typeof window<"u"&&(s=[window]):typeof document<"u"&&ey(r,"selector",t)&&(s=Array.from(document.querySelectorAll(e))),!s)r.warn("Can not resolve event source: "+e);else{for(var o=0,u=s.length;o<u;++o)s[o].addEventListener(t,a);o4(r,s,t,a)}return i}function u4(e){return e.item}function l4(e){return e.item.mark.source}function c4(e){return function(t,n){return n.vega.view().changeset().encode(n.item,e)}}function Wge(e,t){return e=[e||"hover"],t=[t||"update",e[0]],this.on(this.events("view","pointerover",u4),l4,c4(e)),this.on(this.events("view","pointerout",u4),l4,c4(t)),this}function Hge(){var e=this._tooltip,t=this._timers,n=this._handler.handlers(),r=this._eventListeners,i,a,s,o,u;for(i=t.length;--i>=0;)t[i].stop();for(i=r.length;--i>=0;)for(s=r[i],a=s.sources.length;--a>=0;)s.sources[a].removeEventListener(s.type,s.handler);for(e&&e.call(this,this._handler,null,null,null),i=n.length;--i>=0;)u=n[i].type,o=n[i].handler,this._handler.off(u,o);return this}function ti(e,t,n){const r=document.createElement(e);for(const i in t)r.setAttribute(i,t[i]);return n!=null&&(r.textContent=n),r}const jge="vega-bind",Gge="vega-bind-name",Yge="vega-bind-radio";function Xge(e,t,n){if(!t)return;const r=n.param;let i=n.state;return i||(i=n.state={elements:null,active:!1,set:null,update:s=>{s!=e.signal(r.signal)&&e.runAsync(null,()=>{i.source=!0,e.signal(r.signal,s)})}},r.debounce&&(i.update=cR(r.debounce,i.update))),(r.input==null&&r.element?Kge:Qge)(i,t,r,e),i.active||(e.on(e._signals[r.signal],null,()=>{i.source?i.source=!1:i.set(e.signal(r.signal))}),i.active=!0),i}function Kge(e,t,n,r){const i=n.event||"input",a=()=>e.update(t.value);r.signal(n.signal,t.value),t.addEventListener(i,a),o4(r,t,i,a),e.set=s=>{t.value=s,t.dispatchEvent(Zge(i))}}function Zge(e){return typeof Event<"u"?new Event(e):{type:e}}function Qge(e,t,n,r){const i=r.signal(n.signal),a=ti("div",{class:jge}),s=n.input==="radio"?a:a.appendChild(ti("label"));s.appendChild(ti("span",{class:Gge},n.name||n.signal)),t.appendChild(a);let o=Jge;switch(n.input){case"checkbox":o=epe;break;case"select":o=tpe;break;case"radio":o=npe;break;case"range":o=rpe;break}o(e,s,n,i)}function Jge(e,t,n,r){const i=ti("input");for(const a in n)a!=="signal"&&a!=="element"&&i.setAttribute(a==="input"?"type":a,n[a]);i.setAttribute("name",n.signal),i.value=r,t.appendChild(i),i.addEventListener("input",()=>e.update(i.value)),e.elements=[i],e.set=a=>i.value=a}function epe(e,t,n,r){const i={type:"checkbox",name:n.signal};r&&(i.checked=!0);const a=ti("input",i);t.appendChild(a),a.addEventListener("change",()=>e.update(a.checked)),e.elements=[a],e.set=s=>a.checked=!!s||null}function tpe(e,t,n,r){const i=ti("select",{name:n.signal}),a=n.labels||[];n.options.forEach((s,o)=>{const u={value:s};ty(s,r)&&(u.selected=!0),i.appendChild(ti("option",u,(a[o]||s)+""))}),t.appendChild(i),i.addEventListener("change",()=>{e.update(n.options[i.selectedIndex])}),e.elements=[i],e.set=s=>{for(let o=0,u=n.options.length;o<u;++o)if(ty(n.options[o],s)){i.selectedIndex=o;return}}}function npe(e,t,n,r){const i=ti("span",{class:Yge}),a=n.labels||[];t.appendChild(i),e.elements=n.options.map((s,o)=>{const u={type:"radio",name:n.signal,value:s};ty(s,r)&&(u.checked=!0);const l=ti("input",u);l.addEventListener("change",()=>e.update(s));const c=ti("label",{},(a[o]||s)+"");return c.prepend(l),i.appendChild(c),l}),e.set=s=>{const o=e.elements,u=o.length;for(let l=0;l<u;++l)ty(o[l].value,s)&&(o[l].checked=!0)}}function rpe(e,t,n,r){r=r!==void 0?r:(+n.max+ +n.min)/2;const i=n.max!=null?n.max:Math.max(100,+r)||100,a=n.min||Math.min(0,i,+r)||0,s=n.step||xo(a,i,100),o=ti("input",{type:"range",name:n.signal,min:a,max:i,step:s});o.value=r;const u=ti("span",{},+r);t.appendChild(o),t.appendChild(u);const l=()=>{u.textContent=o.value,e.update(+o.value)};o.addEventListener("input",l),o.addEventListener("change",l),e.elements=[o],e.set=c=>{o.value=c,u.textContent=c}}function ty(e,t){return e===t||e+""==t+""}function f4(e,t,n,r,i,a){return t=t||new r(e.loader()),t.initialize(n,i4(e),a4(e),Jm(e),i,a).background(e.background())}function kC(e,t){return t?function(){try{t.apply(this,arguments)}catch(n){e.error(n)}}:null}function ipe(e,t,n,r){const i=new r(e.loader(),kC(e,e.tooltip())).scene(e.scenegraph().root).initialize(n,Jm(e),e);return t&&t.handlers().forEach(a=>{i.on(a.type,a.handler)}),i}function ape(e,t){const n=this,r=n._renderType,i=n._eventConfig.bind,a=nF(r);e=n._el=e?_C(n,e,!0):null,Tge(n),a||n.error("Unrecognized renderer type: "+r);const s=a.handler||Dv,o=e?a.renderer:a.headless;return n._renderer=o?f4(n,n._renderer,e,o):null,n._handler=ipe(n,n._handler,e,s),n._redraw=!0,e&&i!=="none"&&(t=t?n._elBind=_C(n,t,!0):e.appendChild(ti("form",{class:"vega-bindings"})),n._bind.forEach(u=>{u.param.element&&i!=="container"&&(u.element=_C(n,u.param.element,!!u.param.input))}),n._bind.forEach(u=>{Xge(n,u.element||t,u)})),n}function _C(e,t,n){if(typeof t=="string")if(typeof document<"u"){if(t=document.querySelector(t),!t)return e.error("Signal bind element not found: "+t),null}else return e.error("DOM document instance not found."),null;if(t&&n)try{t.textContent=""}catch(r){t=null,e.error(r)}return t}const dg=e=>+e||0,spe=e=>({top:e,bottom:e,left:e,right:e});function d4(e){return we(e)?{top:dg(e.top),bottom:dg(e.bottom),left:dg(e.left),right:dg(e.right)}:spe(dg(e))}async function AC(e,t,n,r){const i=nF(t),a=i&&i.headless;return a||Q("Unrecognized renderer type: "+t),await e.runAsync(),f4(e,null,null,a,n,r).renderAsync(e._scenegraph.root)}async function ope(e,t){e!==tl.Canvas&&e!==tl.SVG&&e!==tl.PNG&&Q("Unrecognized image type: "+e);const n=await AC(this,e,t);return e===tl.SVG?upe(n.svg(),"image/svg+xml"):n.canvas().toDataURL("image/png")}function upe(e,t){const n=new Blob([e],{type:t});return window.URL.createObjectURL(n)}async function lpe(e,t){return(await AC(this,tl.Canvas,e,t)).canvas()}async function cpe(e){return(await AC(this,tl.SVG,e)).svg()}function fpe(e,t,n){return Age(e,Kd,cg,n).parse(t)}function dpe(e){var t=this._runtime.scales;return xe(t,e)||Q("Unrecognized scale or projection: "+e),t[e].value}var h4="width",g4="height",TC="padding",p4={skip:!0};function v4(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===TC?r.left+r.right:0)}function m4(e,t){var n=e.autosize(),r=e.padding();return t-(n&&n.contains===TC?r.top+r.bottom:0)}function hpe(e){var t=e._signals,n=t[h4],r=t[g4],i=t[TC];function a(){e._autosize=e._resize=1}e._resizeWidth=e.add(null,o=>{e._width=o.size,e._viewWidth=v4(e,o.size),a()},{size:n}),e._resizeHeight=e.add(null,o=>{e._height=o.size,e._viewHeight=m4(e,o.size),a()},{size:r});const s=e.add(null,a,{pad:i});e._resizeWidth.rank=n.rank+1,e._resizeHeight.rank=r.rank+1,s.rank=i.rank+1}function gpe(e,t,n,r,i,a){this.runAfter(s=>{let o=0;s._autosize=0,s.width()!==n&&(o=1,s.signal(h4,n,p4),s._resizeWidth.skip(!0)),s.height()!==r&&(o=1,s.signal(g4,r,p4),s._resizeHeight.skip(!0)),s._viewWidth!==e&&(s._resize=1,s._viewWidth=e),s._viewHeight!==t&&(s._resize=1,s._viewHeight=t),(s._origin[0]!==i[0]||s._origin[1]!==i[1])&&(s._resize=1,s._origin=i),o&&s.run("enter"),a&&s.runAfter(u=>u.resize())},!1,1)}function ppe(e){return this._runtime.getState(e||{data:vpe,signals:mpe,recurse:!0})}function vpe(e,t){return t.modified&&ee(t.input.value)&&!e.startsWith("_:vega:_")}function mpe(e,t){return!(e==="parent"||t instanceof Kd.proxy)}function ype(e){return this.runAsync(null,t=>{t._trigger=!1,t._runtime.setState(e)},t=>{t._trigger=!0}),this}function bpe(e,t){function n(r){e({timestamp:Date.now(),elapsed:r})}this._timers.push(que(n,t))}function wpe(e,t,n,r){const i=e.element();i&&i.setAttribute("title",xpe(r))}function xpe(e){return e==null?"":ee(e)?y4(e):we(e)&&!Au(e)?Epe(e):e+""}function Epe(e){return Object.keys(e).map(t=>{const n=e[t];return t+": "+(ee(n)?y4(n):b4(n))}).join(`
`)}function y4(e){return"["+e.map(b4).join(", ")+"]"}function b4(e){return ee(e)?"[…]":we(e)&&!Au(e)?"{…}":e}function Fpe(){if(this.renderer()==="canvas"&&this._renderer._canvas){let e=null;const t=()=>{e!=null&&e();const n=matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`);n.addEventListener("change",t),e=()=>{n.removeEventListener("change",t)},this._renderer._canvas.getContext("2d").pixelRatio=window.devicePixelRatio||1,this._redraw=!0,this._resize=1,this.resize().runAsync()};t()}}function w4(e,t){const n=this;if(t=t||{},Yd.call(n),t.loader&&n.loader(t.loader),t.logger&&n.logger(t.logger),t.logLevel!=null&&n.logLevel(t.logLevel),t.locale||e.locale){const a=Ze({},e.locale,t.locale);n.locale(YZ(a.number,a.time))}n._el=null,n._elBind=null,n._renderType=t.renderer||tl.Canvas,n._scenegraph=new Pie;const r=n._scenegraph.root;n._renderer=null,n._tooltip=t.tooltip||wpe,n._redraw=!0,n._handler=new Dv().scene(r),n._globalCursor=!1,n._preventDefault=!1,n._timers=[],n._eventListeners=[],n._resizeListeners=[],n._eventConfig=qge(e.eventConfig),n.globalCursor(n._eventConfig.globalCursor);const i=fpe(n,e,t.expr);n._runtime=i,n._signals=i.signals,n._bind=(e.bindings||[]).map(a=>({state:null,param:Ze({},a)})),i.root&&i.root.set(r),r.source=i.data.root.input,n.pulse(i.data.root.input,n.changeset().insert(r.items)),n._width=n.width(),n._height=n.height(),n._viewWidth=v4(n,n._width),n._viewHeight=m4(n,n._height),n._origin=[0,0],n._resize=0,n._autosize=1,hpe(n),Mge(n),$ge(n),n.description(e.description),t.hover&&n.hover(),t.container&&n.initialize(t.container,t.bind),t.watchPixelRatio&&n._watchPixelRatio()}function ny(e,t){return xe(e._signals,t)?e._signals[t]:Q("Unrecognized signal name: "+he(t))}function x4(e,t){const n=(e._targets||[]).filter(r=>r._update&&r._update.handler===t);return n.length?n[0]:null}function E4(e,t,n,r){let i=x4(n,r);return i||(i=kC(e,()=>r(t,n.value)),i.handler=r,e.on(n,null,i)),e}function F4(e,t,n){const r=x4(t,n);return r&&t._targets.remove(r),e}ge(w4,Yd,{async evaluate(e,t,n){if(await Yd.prototype.evaluate.call(this,e,t),this._redraw||this._resize)try{this._renderer&&(this._resize&&(this._resize=0,Nge(this)),await this._renderer.renderAsync(this._scenegraph.root)),this._redraw=!1}catch(r){this.error(r)}return n&&S0(this,n),this},dirty(e){this._redraw=!0,this._renderer&&this._renderer.dirty(e)},description(e){if(arguments.length){const t=e!=null?e+"":null;return t!==this._desc&&r4(this._el,this._desc=t),this}return this._desc},container(){return this._el},scenegraph(){return this._scenegraph},origin(){return this._origin.slice()},signal(e,t,n){const r=ny(this,e);return arguments.length===1?r.value:this.update(r,t,n)},width(e){return arguments.length?this.signal("width",e):this.signal("width")},height(e){return arguments.length?this.signal("height",e):this.signal("height")},padding(e){return arguments.length?this.signal("padding",d4(e)):d4(this.signal("padding"))},autosize(e){return arguments.length?this.signal("autosize",e):this.signal("autosize")},background(e){return arguments.length?this.signal("background",e):this.signal("background")},renderer(e){return arguments.length?(nF(e)||Q("Unrecognized renderer type: "+e),e!==this._renderType&&(this._renderType=e,this._resetRenderer()),this):this._renderType},tooltip(e){return arguments.length?(e!==this._tooltip&&(this._tooltip=e,this._resetRenderer()),this):this._tooltip},loader(e){return arguments.length?(e!==this._loader&&(Yd.prototype.loader.call(this,e),this._resetRenderer()),this):this._loader},resize(){return this._autosize=1,this.touch(ny(this,"autosize"))},_resetRenderer(){this._renderer&&(this._renderer=null,this.initialize(this._el,this._elBind))},_resizeView:gpe,addEventListener(e,t,n){let r=t;return n&&n.trap===!1||(r=kC(this,t),r.raw=t),this._handler.on(e,r),this},removeEventListener(e,t){for(var n=this._handler.handlers(e),r=n.length,i,a;--r>=0;)if(a=n[r].type,i=n[r].handler,e===a&&(t===i||t===i.raw)){this._handler.off(a,i);break}return this},addResizeListener(e){const t=this._resizeListeners;return t.includes(e)||t.push(e),this},removeResizeListener(e){var t=this._resizeListeners,n=t.indexOf(e);return n>=0&&t.splice(n,1),this},addSignalListener(e,t){return E4(this,e,ny(this,e),t)},removeSignalListener(e,t){return F4(this,ny(this,e),t)},addDataListener(e,t){return E4(this,e,Zm(this,e).values,t)},removeDataListener(e,t){return F4(this,Zm(this,e).values,t)},globalCursor(e){if(arguments.length){if(this._globalCursor!==!!e){const t=CC(this,null);this._globalCursor=!!e,t&&CC(this,t)}return this}else return this._globalCursor},preventDefault(e){return arguments.length?(this._preventDefault=e,this):this._preventDefault},timer:bpe,events:Vge,finalize:Hge,hover:Wge,data:Dge,change:Qm,insert:Rge,remove:Pge,scale:dpe,initialize:ape,toImageURL:ope,toCanvas:lpe,toSVG:cpe,getState:ppe,setState:ype,_watchPixelRatio:Fpe});const Spe="view",ry="[",iy="]",S4="{",C4="}",Cpe=":",k4=",",kpe="@",_pe=">",Ape=/[[\]{}]/,Tpe={"*":1,arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1};let _4,A4;function gl(e,t,n){return _4=t||Spe,A4=n||Tpe,T4(e.trim()).map(MC)}function Mpe(e){return A4[e]}function hg(e,t,n,r,i){const a=e.length;let s=0,o;for(;t<a;++t){if(o=e[t],!s&&o===n)return t;i&&i.includes(o)?--s:r&&r.includes(o)&&++s}return t}function T4(e){const t=[],n=e.length;let r=0,i=0;for(;i<n;)i=hg(e,i,k4,ry+S4,iy+C4),t.push(e.substring(r,i).trim()),r=++i;if(t.length===0)throw"Empty event selector: "+e;return t}function MC(e){return e[0]==="["?$pe(e):Dpe(e)}function $pe(e){const t=e.length;let n=1,r;if(n=hg(e,n,iy,ry,iy),n===t)throw"Empty between selector: "+e;if(r=T4(e.substring(1,n)),r.length!==2)throw"Between selector must have two elements: "+e;if(e=e.slice(n+1).trim(),e[0]!==_pe)throw"Expected '>' after between selector: "+e;r=r.map(MC);const i=MC(e.slice(1).trim());return i.between?{between:r,stream:i}:(i.between=r,i)}function Dpe(e){const t={source:_4},n=[];let r=[0,0],i=0,a=0,s=e.length,o=0,u,l;if(e[s-1]===C4){if(o=e.lastIndexOf(S4),o>=0){try{r=Rpe(e.substring(o+1,s-1))}catch{throw"Invalid throttle specification: "+e}e=e.slice(0,o).trim(),s=e.length}else throw"Unmatched right brace: "+e;o=0}if(!s)throw e;if(e[0]===kpe&&(i=++o),u=hg(e,o,Cpe),u<s&&(n.push(e.substring(a,u).trim()),a=o=++u),o=hg(e,o,ry),o===s)n.push(e.substring(a,s).trim());else if(n.push(e.substring(a,o).trim()),l=[],a=++o,a===s)throw"Unmatched left bracket: "+e;for(;o<s;){if(o=hg(e,o,iy),o===s)throw"Unmatched left bracket: "+e;if(l.push(e.substring(a,o).trim()),o<s-1&&e[++o]!==ry)throw"Expected left bracket: "+e;a=++o}if(!(s=n.length)||Ape.test(n[s-1]))throw"Invalid event selector: "+e;return s>1?(t.type=n[1],i?t.markname=n[0].slice(1):Mpe(n[0])?t.marktype=n[0]:t.source=n[0]):t.type=n[0],t.type.slice(-1)==="!"&&(t.consume=!0,t.type=t.type.slice(0,-1)),l!=null&&(t.filter=l),r[0]&&(t.throttle=r[0]),r[1]&&(t.debounce=r[1]),t}function Rpe(e){const t=e.split(k4);if(!e.length||t.length>2)throw e;return t.map(n=>{const r=+n;if(r!==r)throw e;return r})}function Ppe(e){return we(e)?e:{type:e||"pad"}}const gg=e=>+e||0,Npe=e=>({top:e,bottom:e,left:e,right:e});function Ope(e){return we(e)?e.signal?e:{top:gg(e.top),bottom:gg(e.bottom),left:gg(e.left),right:gg(e.right)}:Npe(gg(e))}const Cn=e=>we(e)&&!ee(e)?Ze({},e):{value:e};function M4(e,t,n,r){return n!=null?(we(n)&&!ee(n)||ee(n)&&n.length&&we(n[0])?e.update[t]=n:e[r||"enter"][t]={value:n},1):0}function Un(e,t,n){for(const r in t)M4(e,r,t[r]);for(const r in n)M4(e,r,n[r],"update")}function sf(e,t,n){for(const r in t)n&&xe(n,r)||(e[r]=Ze(e[r]||{},t[r]));return e}function of(e,t){return t&&(t.enter&&t.enter[e]||t.update&&t.update[e])}const $C="mark",DC="frame",RC="scope",Ipe="axis",Bpe="axis-domain",Lpe="axis-grid",zpe="axis-label",qpe="axis-tick",Upe="axis-title",Vpe="legend",Wpe="legend-band",Hpe="legend-entry",jpe="legend-gradient",$4="legend-label",Gpe="legend-symbol",Ype="legend-title",Xpe="title",Kpe="title-text",Zpe="title-subtitle";function Qpe(e,t,n,r,i){const a={},s={};let o,u,l,c;u="lineBreak",t==="text"&&i[u]!=null&&!of(u,e)&&PC(a,u,i[u]),(n=="legend"||String(n).startsWith("axis"))&&(n=null),c=n===DC?i.group:n===$C?Ze({},i.mark,i[t]):null;for(u in c)l=of(u,e)||(u==="fill"||u==="stroke")&&(of("fill",e)||of("stroke",e)),l||PC(a,u,c[u]);be(r).forEach(f=>{const d=i.style&&i.style[f];for(const h in d)of(h,e)||PC(a,h,d[h])}),e=Ze({},e);for(u in a)c=a[u],c.signal?(o=o||{})[u]=c:s[u]=c;return e.enter=Ze(s,e.enter),o&&(e.update=Ze(o,e.update)),e}function PC(e,t,n){e[t]=n&&n.signal?{signal:n.signal}:{value:n}}const D4=e=>Ee(e)?he(e):e.signal?`(${e.signal})`:R4(e);function ay(e){if(e.gradient!=null)return e0e(e);let t=e.signal?`(${e.signal})`:e.color?Jpe(e.color):e.field!=null?R4(e.field):e.value!==void 0?he(e.value):void 0;return e.scale!=null&&(t=t0e(e,t)),t===void 0&&(t=null),e.exponent!=null&&(t=`pow(${t},${oy(e.exponent)})`),e.mult!=null&&(t+=`*${oy(e.mult)}`),e.offset!=null&&(t+=`+${oy(e.offset)}`),e.round&&(t=`round(${t})`),t}const sy=(e,t,n,r)=>`(${e}(${[t,n,r].map(ay).join(",")})+'')`;function Jpe(e){return e.c?sy("hcl",e.h,e.c,e.l):e.h||e.s?sy("hsl",e.h,e.s,e.l):e.l||e.a?sy("lab",e.l,e.a,e.b):e.r||e.g||e.b?sy("rgb",e.r,e.g,e.b):null}function e0e(e){const t=[e.start,e.stop,e.count].map(n=>n==null?null:he(n));for(;t.length&&st(t)==null;)t.pop();return t.unshift(D4(e.gradient)),`gradient(${t.join(",")})`}function oy(e){return we(e)?"("+ay(e)+")":e}function R4(e){return P4(we(e)?e:{datum:e})}function P4(e){let t,n,r;if(e.signal)t="datum",r=e.signal;else if(e.group||e.parent){for(n=Math.max(1,e.level||1),t="item";n-- >0;)t+=".mark.group";e.parent?(r=e.parent,t+=".datum"):r=e.group}else e.datum?(t="datum",r=e.datum):Q("Invalid field reference: "+he(e));return e.signal||(r=Ee(r)?hs(r).map(he).join("]["):P4(r)),t+"["+r+"]"}function t0e(e,t){const n=D4(e.scale);return e.range!=null?t=`lerp(_range(${n}), ${+e.range})`:(t!==void 0&&(t=`_scale(${n}, ${t})`),e.band&&(t=(t?t+"+":"")+`_bandwidth(${n})`+(+e.band==1?"":"*"+oy(e.band)),e.extra&&(t=`(datum.extra ? _scale(${n}, datum.extra.value) : ${t})`)),t==null&&(t="0")),t}function n0e(e){let t="";return e.forEach(n=>{const r=ay(n);t+=n.test?`(${n.test})?${r}:`:r}),st(t)===":"&&(t+="null"),t}function N4(e,t,n,r,i,a){const s={};a=a||{},a.encoders={$encode:s},e=Qpe(e,t,n,r,i.config);for(const o in e)s[o]=r0e(e[o],t,a,i);return a}function r0e(e,t,n,r){const i={},a={};for(const s in e)e[s]!=null&&(i[s]=a0e(i0e(e[s]),r,n,a));return{$expr:{marktype:t,channels:i},$fields:Object.keys(a),$output:Object.keys(e)}}function i0e(e){return ee(e)?n0e(e):ay(e)}function a0e(e,t,n,r){const i=qa(e,t);return i.$fields.forEach(a=>r[a]=1),Ze(n,i.$params),i.$expr}const s0e="outer",o0e=["value","update","init","react","bind"];function O4(e,t){Q(e+' for "outer" push: '+he(t))}function I4(e,t){const n=e.name;if(e.push===s0e)t.signals[n]||O4("No prior signal definition",n),o0e.forEach(r=>{e[r]!==void 0&&O4("Invalid property ",r)});else{const r=t.addSignal(n,e.value);e.react===!1&&(r.react=!1),e.bind&&t.addBinding(n,e.bind)}}function NC(e,t,n,r){this.id=-1,this.type=e,this.value=t,this.params=n,r&&(this.parent=r)}function uy(e,t,n,r){return new NC(e,t,n,r)}function ly(e,t){return uy("operator",e,t)}function De(e){const t={$ref:e.id};return e.id<0&&(e.refs=e.refs||[]).push(t),t}function pg(e,t){return t?{$field:e,$name:t}:{$field:e}}const OC=pg("key");function B4(e,t){return{$compare:e,$order:t}}function u0e(e,t){const n={$key:e};return t&&(n.$flat=!0),n}const l0e="ascending",c0e="descending";function f0e(e){return we(e)?(e.order===c0e?"-":"+")+cy(e.op,e.field):""}function cy(e,t){return(e&&e.signal?"$"+e.signal:e||"")+(e&&t?"_":"")+(t&&t.signal?"$"+t.signal:t||"")}const IC="scope",BC="view";function fn(e){return e&&e.signal}function d0e(e){return e&&e.expr}function fy(e){if(fn(e))return!0;if(we(e)){for(const t in e)if(fy(e[t]))return!0}return!1}function Yi(e,t){return e??t}function pl(e){return e&&e.signal||e}const L4="timer";function vg(e,t){return(e.merge?g0e:e.stream?p0e:e.type?v0e:Q("Invalid stream specification: "+he(e)))(e,t)}function h0e(e){return e===IC?BC:e||BC}function g0e(e,t){const n=e.merge.map(i=>vg(i,t)),r=LC({merge:n},e,t);return t.addStream(r).id}function p0e(e,t){const n=vg(e.stream,t),r=LC({stream:n},e,t);return t.addStream(r).id}function v0e(e,t){let n;e.type===L4?(n=t.event(L4,e.throttle),e={between:e.between,filter:e.filter}):n=t.event(h0e(e.source),e.type);const r=LC({stream:n},e,t);return Object.keys(r).length===1?n:t.addStream(r).id}function LC(e,t,n){let r=t.between;return r&&(r.length!==2&&Q('Stream "between" parameter must have 2 entries: '+he(t)),e.between=[vg(r[0],n),vg(r[1],n)]),r=t.filter?[].concat(t.filter):[],(t.marktype||t.markname||t.markrole)&&r.push(m0e(t.marktype,t.markname,t.markrole)),t.source===IC&&r.push("inScope(event.item)"),r.length&&(e.filter=qa("("+r.join(")&&(")+")",n).$expr),(r=t.throttle)!=null&&(e.throttle=+r),(r=t.debounce)!=null&&(e.debounce=+r),t.consume&&(e.consume=!0),e}function m0e(e,t,n){const r="event.item";return r+(e&&e!=="*"?"&&"+r+".mark.marktype==='"+e+"'":"")+(n?"&&"+r+".mark.role==='"+n+"'":"")+(t?"&&"+r+".mark.name==='"+t+"'":"")}const y0e={code:"_.$value",ast:{type:"Identifier",value:"value"}};function b0e(e,t,n){const r=e.encode,i={target:n};let a=e.events,s=e.update,o=[];a||Q("Signal update missing events specification."),Ee(a)&&(a=gl(a,t.isSubscope()?IC:BC)),a=be(a).filter(u=>u.signal||u.scale?(o.push(u),0):1),o.length>1&&(o=[x0e(o)]),a.length&&o.push(a.length>1?{merge:a}:a[0]),r!=null&&(s&&Q("Signal encode and update are mutually exclusive."),s="encode(item(),"+he(r)+")"),i.update=Ee(s)?qa(s,t):s.expr!=null?qa(s.expr,t):s.value!=null?s.value:s.signal!=null?{$expr:y0e,$params:{$value:t.signalRef(s.signal)}}:Q("Invalid signal update specification."),e.force&&(i.options={force:!0}),o.forEach(u=>t.addUpdate(Ze(w0e(u,t),i)))}function w0e(e,t){return{source:e.signal?t.signalRef(e.signal):e.scale?t.scaleRef(e.scale):vg(e,t)}}function x0e(e){return{signal:"["+e.map(t=>t.scale?'scale("'+t.scale+'")':t.signal)+"]"}}function E0e(e,t){const n=t.getSignal(e.name);let r=e.update;e.init&&(r?Q("Signals can not include both init and update expressions."):(r=e.init,n.initonly=!0)),r&&(r=qa(r,t),n.update=r.$expr,n.params=r.$params),e.on&&e.on.forEach(i=>b0e(i,t,n.id))}const Ft=e=>(t,n,r)=>uy(e,n,t||void 0,r),z4=Ft("aggregate"),F0e=Ft("axisticks"),q4=Ft("bound"),Xi=Ft("collect"),U4=Ft("compare"),S0e=Ft("datajoin"),V4=Ft("encode"),C0e=Ft("expression"),k0e=Ft("facet"),_0e=Ft("field"),A0e=Ft("key"),T0e=Ft("legendentries"),M0e=Ft("load"),$0e=Ft("mark"),D0e=Ft("multiextent"),R0e=Ft("multivalues"),P0e=Ft("overlap"),N0e=Ft("params"),W4=Ft("prefacet"),O0e=Ft("projection"),I0e=Ft("proxy"),B0e=Ft("relay"),H4=Ft("render"),L0e=Ft("scale"),vl=Ft("sieve"),z0e=Ft("sortitems"),j4=Ft("viewlayout"),q0e=Ft("values");let U0e=0;const G4={min:"min",max:"max",count:"sum"};function V0e(e,t){const n=e.type||"linear";FO(n)||Q("Unrecognized scale type: "+he(n)),t.addScale(e.name,{type:n,domain:void 0})}function W0e(e,t){const n=t.getScale(e.name).params;let r;n.domain=Y4(e.domain,e,t),e.range!=null&&(n.range=K4(e,t,n)),e.interpolate!=null&&eve(e.interpolate,n),e.nice!=null&&(n.nice=J0e(e.nice,t)),e.bins!=null&&(n.bins=Q0e(e.bins,t));for(r in e)xe(n,r)||r==="name"||(n[r]=xi(e[r],t))}function xi(e,t){return we(e)?e.signal?t.signalRef(e.signal):Q("Unsupported object: "+he(e)):e}function dy(e,t){return e.signal?t.signalRef(e.signal):e.map(n=>xi(n,t))}function hy(e){Q("Can not find data set: "+he(e))}function Y4(e,t,n){if(!e){(t.domainMin!=null||t.domainMax!=null)&&Q("No scale domain defined for domainMin/domainMax to override.");return}return e.signal?n.signalRef(e.signal):(ee(e)?H0e:e.fields?G0e:j0e)(e,t,n)}function H0e(e,t,n){return e.map(r=>xi(r,n))}function j0e(e,t,n){const r=n.getData(e.data);return r||hy(e.data),Bc(t.type)?r.valuesRef(n,e.field,X4(e.sort,!1)):kO(t.type)?r.domainRef(n,e.field):r.extentRef(n,e.field)}function G0e(e,t,n){const r=e.data,i=e.fields.reduce((a,s)=>(s=Ee(s)?{data:r,field:s}:ee(s)||s.signal?Y0e(s,n):s,a.push(s),a),[]);return(Bc(t.type)?X0e:kO(t.type)?K0e:Z0e)(e,n,i)}function Y0e(e,t){const n="_:vega:_"+U0e++,r=Xi({});if(ee(e))r.value={$ingest:e};else if(e.signal){const i="setdata("+he(n)+","+e.signal+")";r.params.input=t.signalRef(i)}return t.addDataPipeline(n,[r,vl({})]),{data:n,field:"data"}}function X0e(e,t,n){const r=X4(e.sort,!0);let i,a;const s=n.map(l=>{const c=t.getData(l.data);return c||hy(l.data),c.countsRef(t,l.field,r)}),o={groupby:OC,pulse:s};r&&(i=r.op||"count",a=r.field?cy(i,r.field):"count",o.ops=[G4[i]],o.fields=[t.fieldRef(a)],o.as=[a]),i=t.add(z4(o));const u=t.add(Xi({pulse:De(i)}));return a=t.add(q0e({field:OC,sort:t.sortRef(r),pulse:De(u)})),De(a)}function X4(e,t){return e&&(!e.field&&!e.op?we(e)?e.field="key":e={field:"key"}:!e.field&&e.op!=="count"?Q("No field provided for sort aggregate op: "+e.op):t&&e.field&&e.op&&!G4[e.op]&&Q("Multiple domain scales can not be sorted using "+e.op)),e}function K0e(e,t,n){const r=n.map(i=>{const a=t.getData(i.data);return a||hy(i.data),a.domainRef(t,i.field)});return De(t.add(R0e({values:r})))}function Z0e(e,t,n){const r=n.map(i=>{const a=t.getData(i.data);return a||hy(i.data),a.extentRef(t,i.field)});return De(t.add(D0e({extents:r})))}function Q0e(e,t){return e.signal||ee(e)?dy(e,t):t.objectProperty(e)}function J0e(e,t){return e.signal?t.signalRef(e.signal):we(e)?{interval:xi(e.interval),step:xi(e.step)}:xi(e)}function eve(e,t){t.interpolate=xi(e.type||e),e.gamma!=null&&(t.interpolateGamma=xi(e.gamma))}function K4(e,t,n){const r=t.config.range;let i=e.range;if(i.signal)return t.signalRef(i.signal);if(Ee(i)){if(r&&xe(r,i))return e=Ze({},e,{range:r[i]}),K4(e,t,n);i==="width"?i=[0,{signal:"width"}]:i==="height"?i=Bc(e.type)?[0,{signal:"height"}]:[{signal:"height"},0]:Q("Unrecognized scale range value: "+he(i))}else if(i.scheme){n.scheme=ee(i.scheme)?dy(i.scheme,t):xi(i.scheme,t),i.extent&&(n.schemeExtent=dy(i.extent,t)),i.count&&(n.schemeCount=xi(i.count,t));return}else if(i.step){n.rangeStep=xi(i.step,t);return}else{if(Bc(e.type)&&!ee(i))return Y4(i,e,t);ee(i)||Q("Unsupported range type: "+he(i))}return i.map(a=>(ee(a)?dy:xi)(a,t))}function tve(e,t){const n=t.config.projection||{},r={};for(const i in e)i!=="name"&&(r[i]=zC(e[i],i,t));for(const i in n)r[i]==null&&(r[i]=zC(n[i],i,t));t.addProjection(e.name,r)}function zC(e,t,n){return ee(e)?e.map(r=>zC(r,t,n)):we(e)?e.signal?n.signalRef(e.signal):t==="fit"?e:Q("Unsupported parameter object: "+he(e)):e}const Ki="top",uf="left",lf="right",Xo="bottom",Z4="center",nve="vertical",rve="start",ive="middle",ave="end",qC="index",UC="label",sve="offset",cf="perc",ove="perc2",Ei="value",mg="guide-label",VC="guide-title",uve="group-title",lve="group-subtitle",Q4="symbol",gy="gradient",WC="discrete",HC="size",jC=[HC,"shape","fill","stroke","strokeWidth","strokeDash","opacity"],yg={name:1,style:1,interactive:1},ot={value:0},Fi={value:1},py="group",J4="rect",GC="rule",cve="symbol",ml="text";function bg(e){return e.type=py,e.interactive=e.interactive||!1,e}function qr(e,t){const n=(r,i)=>Yi(e[r],Yi(t[r],i));return n.isVertical=r=>nve===Yi(e.direction,t.direction||(r?t.symbolDirection:t.gradientDirection)),n.gradientLength=()=>Yi(e.gradientLength,t.gradientLength||t.gradientWidth),n.gradientThickness=()=>Yi(e.gradientThickness,t.gradientThickness||t.gradientHeight),n.entryColumns=()=>Yi(e.columns,Yi(t.columns,+n.isVertical(!0))),n}function e6(e,t){const n=t&&(t.update&&t.update[e]||t.enter&&t.enter[e]);return n&&n.signal?n:n?n.value:null}function fve(e,t,n){const r=t.config.style[n];return r&&r[e]}function vy(e,t,n){return`item.anchor === '${rve}' ? ${e} : item.anchor === '${ave}' ? ${t} : ${n}`}const YC=vy(he(uf),he(lf),he(Z4));function dve(e){const t=e("tickBand");let n=e("tickOffset"),r,i;return t?t.signal?(r={signal:`(${t.signal}) === 'extent' ? 1 : 0.5`},i={signal:`(${t.signal}) === 'extent'`},we(n)||(n={signal:`(${t.signal}) === 'extent' ? 0 : ${n}`})):t==="extent"?(r=1,i=!0,n=0):(r=.5,i=!1):(r=e("bandPosition"),i=e("tickExtra")),{extra:i,band:r,offset:n}}function t6(e,t){return t?e?we(e)?Object.assign({},e,{offset:t6(e.offset,t)}):{value:e,offset:t}:t:e}function ni(e,t){return t?(e.name=t.name,e.style=t.style||e.style,e.interactive=!!t.interactive,e.encode=sf(e.encode,t,yg)):e.interactive=!1,e}function hve(e,t,n,r){const i=qr(e,n),a=i.isVertical(),s=i.gradientThickness(),o=i.gradientLength();let u,l,c,f,d;a?(l=[0,1],c=[0,0],f=s,d=o):(l=[0,0],c=[1,0],f=o,d=s);const h={enter:u={opacity:ot,x:ot,y:ot,width:Cn(f),height:Cn(d)},update:Ze({},u,{opacity:Fi,fill:{gradient:t,start:l,stop:c}}),exit:{opacity:ot}};return Un(h,{stroke:i("gradientStrokeColor"),strokeWidth:i("gradientStrokeWidth")},{opacity:i("gradientOpacity")}),ni({type:J4,role:jpe,encode:h},r)}function gve(e,t,n,r,i){const a=qr(e,n),s=a.isVertical(),o=a.gradientThickness(),u=a.gradientLength();let l,c,f,d,h="";s?(l="y",f="y2",c="x",d="width",h="1-"):(l="x",f="x2",c="y",d="height");const g={opacity:ot,fill:{scale:t,field:Ei}};g[l]={signal:h+"datum."+cf,mult:u},g[c]=ot,g[f]={signal:h+"datum."+ove,mult:u},g[d]=Cn(o);const p={enter:g,update:Ze({},g,{opacity:Fi}),exit:{opacity:ot}};return Un(p,{stroke:a("gradientStrokeColor"),strokeWidth:a("gradientStrokeWidth")},{opacity:a("gradientOpacity")}),ni({type:J4,role:Wpe,key:Ei,from:i,encode:p},r)}const pve=`datum.${cf}<=0?"${uf}":datum.${cf}>=1?"${lf}":"${Z4}"`,vve=`datum.${cf}<=0?"${Xo}":datum.${cf}>=1?"${Ki}":"${ive}"`;function n6(e,t,n,r){const i=qr(e,t),a=i.isVertical(),s=Cn(i.gradientThickness()),o=i.gradientLength();let u=i("labelOverlap"),l,c,f,d,h="";const g={enter:l={opacity:ot},update:c={opacity:Fi,text:{field:UC}},exit:{opacity:ot}};return Un(g,{fill:i("labelColor"),fillOpacity:i("labelOpacity"),font:i("labelFont"),fontSize:i("labelFontSize"),fontStyle:i("labelFontStyle"),fontWeight:i("labelFontWeight"),limit:Yi(e.labelLimit,t.gradientLabelLimit)}),a?(l.align={value:"left"},l.baseline=c.baseline={signal:vve},f="y",d="x",h="1-"):(l.align=c.align={signal:pve},l.baseline={value:"top"},f="x",d="y"),l[f]=c[f]={signal:h+"datum."+cf,mult:o},l[d]=c[d]=s,s.offset=Yi(e.labelOffset,t.gradientLabelOffset)||0,u=u?{separation:i("labelSeparation"),method:u,order:"datum."+qC}:void 0,ni({type:ml,role:$4,style:mg,key:Ei,from:r,encode:g,overlap:u},n)}function mve(e,t,n,r,i){const a=qr(e,t),s=n.entries,o=!!(s&&s.interactive),u=s?s.name:void 0,l=a("clipHeight"),c=a("symbolOffset"),f={data:"value"},d=`(${i}) ? datum.${sve} : datum.${HC}`,h=l?Cn(l):{field:HC},g=`datum.${qC}`,p=`max(1, ${i})`;let v,m,y,b,w;h.mult=.5,v={enter:m={opacity:ot,x:{signal:d,mult:.5,offset:c},y:h},update:y={opacity:Fi,x:m.x,y:m.y},exit:{opacity:ot}};let E=null,F=null;e.fill||(E=t.symbolBaseFillColor,F=t.symbolBaseStrokeColor),Un(v,{fill:a("symbolFillColor",E),shape:a("symbolType"),size:a("symbolSize"),stroke:a("symbolStrokeColor",F),strokeDash:a("symbolDash"),strokeDashOffset:a("symbolDashOffset"),strokeWidth:a("symbolStrokeWidth")},{opacity:a("symbolOpacity")}),jC.forEach(_=>{e[_]&&(y[_]=m[_]={scale:e[_],field:Ei})});const x=ni({type:cve,role:Gpe,key:Ei,from:f,clip:l?!0:void 0,encode:v},n.symbols),C=Cn(c);C.offset=a("labelOffset"),v={enter:m={opacity:ot,x:{signal:d,offset:C},y:h},update:y={opacity:Fi,text:{field:UC},x:m.x,y:m.y},exit:{opacity:ot}},Un(v,{align:a("labelAlign"),baseline:a("labelBaseline"),fill:a("labelColor"),fillOpacity:a("labelOpacity"),font:a("labelFont"),fontSize:a("labelFontSize"),fontStyle:a("labelFontStyle"),fontWeight:a("labelFontWeight"),limit:a("labelLimit")});const S=ni({type:ml,role:$4,style:mg,key:Ei,from:f,encode:v},n.labels);return v={enter:{noBound:{value:!l},width:ot,height:l?Cn(l):ot,opacity:ot},exit:{opacity:ot},update:y={opacity:Fi,row:{signal:null},column:{signal:null}}},a.isVertical(!0)?(b=`ceil(item.mark.items.length / ${p})`,y.row.signal=`${g}%${b}`,y.column.signal=`floor(${g} / ${b})`,w={field:["row",g]}):(y.row.signal=`floor(${g} / ${p})`,y.column.signal=`${g} % ${p}`,w={field:g}),y.column.signal=`(${i})?${y.column.signal}:${g}`,r={facet:{data:r,name:"value",groupby:qC}},bg({role:RC,from:r,encode:sf(v,s,yg),marks:[x,S],name:u,interactive:o,sort:w})}function yve(e,t){const n=qr(e,t);return{align:n("gridAlign"),columns:n.entryColumns(),center:{row:!0,column:!1},padding:{row:n("rowPadding"),column:n("columnPadding")}}}const XC='item.orient === "left"',KC='item.orient === "right"',my=`(${XC} || ${KC})`,bve=`datum.vgrad && ${my}`,wve=vy('"top"','"bottom"','"middle"'),xve=vy('"right"','"left"','"center"'),Eve=`datum.vgrad && ${KC} ? (${xve}) : (${my} && !(datum.vgrad && ${XC})) ? "left" : ${YC}`,Fve=`item._anchor || (${my} ? "middle" : "start")`,Sve=`${bve} ? (${XC} ? -90 : 90) : 0`,Cve=`${my} ? (datum.vgrad ? (${KC} ? "bottom" : "top") : ${wve}) : "top"`;function kve(e,t,n,r){const i=qr(e,t),a={enter:{opacity:ot},update:{opacity:Fi,x:{field:{group:"padding"}},y:{field:{group:"padding"}}},exit:{opacity:ot}};return Un(a,{orient:i("titleOrient"),_anchor:i("titleAnchor"),anchor:{signal:Fve},angle:{signal:Sve},align:{signal:Eve},baseline:{signal:Cve},text:e.title,fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),baseline:i("titleBaseline")}),ni({type:ml,role:Ype,style:VC,from:r,encode:a},n)}function _ve(e,t){let n;return we(e)&&(e.signal?n=e.signal:e.path?n="pathShape("+r6(e.path)+")":e.sphere&&(n="geoShape("+r6(e.sphere)+', {type: "Sphere"})')),n?t.signalRef(n):!!e}function r6(e){return we(e)&&e.signal?e.signal:he(e)}function i6(e){const t=e.role||"";return t.startsWith("axis")||t.startsWith("legend")||t.startsWith("title")?t:e.type===py?RC:t||$C}function Ave(e){return{marktype:e.type,name:e.name||void 0,role:e.role||i6(e),zindex:+e.zindex||void 0,aria:e.aria,description:e.description}}function Tve(e,t){return e&&e.signal?t.signalRef(e.signal):e!==!1}function ZC(e,t){const n=eJ(e.type);n||Q("Unrecognized transform type: "+he(e.type));const r=uy(n.type.toLowerCase(),null,a6(n,e,t));return e.signal&&t.addSignal(e.signal,t.proxy(r)),r.metadata=n.metadata||{},r}function a6(e,t,n){const r={},i=e.params.length;for(let a=0;a<i;++a){const s=e.params[a];r[s.name]=Mve(s,t,n)}return r}function Mve(e,t,n){const r=e.type,i=t[e.name];if(r==="index")return $ve(e,t,n);if(i===void 0){e.required&&Q("Missing required "+he(t.type)+" parameter: "+he(e.name));return}else{if(r==="param")return Dve(e,t,n);if(r==="projection")return n.projectionRef(t[e.name])}return e.array&&!fn(i)?i.map(a=>s6(e,a,n)):s6(e,i,n)}function s6(e,t,n){const r=e.type;if(fn(t))return u6(r)?Q("Expression references can not be signals."):QC(r)?n.fieldRef(t):l6(r)?n.compareRef(t):n.signalRef(t.signal);{const i=e.expr||QC(r);return i&&Rve(t)?n.exprRef(t.expr,t.as):i&&Pve(t)?pg(t.field,t.as):u6(r)?qa(t,n):Nve(r)?De(n.getData(t).values):QC(r)?pg(t):l6(r)?n.compareRef(t):t}}function $ve(e,t,n){return Ee(t.from)||Q('Lookup "from" parameter must be a string literal.'),n.getData(t.from).lookupRef(n,t.key)}function Dve(e,t,n){const r=t[e.name];return e.array?(ee(r)||Q("Expected an array of sub-parameters. Instead: "+he(r)),r.map(i=>o6(e,i,n))):o6(e,r,n)}function o6(e,t,n){const r=e.params.length;let i;for(let s=0;s<r;++s){i=e.params[s];for(const o in i.key)if(i.key[o]!==t[o]){i=null;break}if(i)break}i||Q("Unsupported parameter: "+he(t));const a=Ze(a6(i,t,n),i.key);return De(n.add(N0e(a)))}const Rve=e=>e&&e.expr,Pve=e=>e&&e.field,Nve=e=>e==="data",u6=e=>e==="expr",QC=e=>e==="field",l6=e=>e==="compare";function Ove(e,t,n){let r,i,a,s,o;return e?(r=e.facet)&&(t||Q("Only group marks can be faceted."),r.field!=null?s=o=yy(r,n):(e.data?o=De(n.getData(e.data).aggregate):(a=ZC(Ze({type:"aggregate",groupby:be(r.groupby)},r.aggregate),n),a.params.key=n.keyRef(r.groupby),a.params.pulse=yy(r,n),s=o=De(n.add(a))),i=n.keyRef(r.groupby,!0))):s=De(n.add(Xi(null,[{}]))),s||(s=yy(e,n)),{key:i,pulse:s,parent:o}}function yy(e,t){return e.$ref?e:e.data&&e.data.$ref?e.data:De(t.getData(e.data).output)}function yl(e,t,n,r,i){this.scope=e,this.input=t,this.output=n,this.values=r,this.aggregate=i,this.index={}}yl.fromEntries=function(e,t){const n=t.length,r=t[n-1],i=t[n-2];let a=t[0],s=null,o=1;for(a&&a.type==="load"&&(a=t[1]),e.add(t[0]);o<n;++o)t[o].params.pulse=De(t[o-1]),e.add(t[o]),t[o].type==="aggregate"&&(s=t[o]);return new yl(e,a,i,r,s)};function c6(e){return Ee(e)?e:null}function f6(e,t,n){const r=cy(n.op,n.field);let i;if(t.ops){for(let a=0,s=t.as.length;a<s;++a)if(t.as[a]===r)return}else t.ops=["count"],t.fields=[null],t.as=["count"];n.op&&(t.ops.push((i=n.op.signal)?e.signalRef(i):n.op),t.fields.push(e.fieldRef(n.field)),t.as.push(r))}function wg(e,t,n,r,i,a,s){const o=t[n]||(t[n]={}),u=f0e(a);let l=c6(i),c,f;if(l!=null&&(e=t.scope,l=l+(u?"|"+u:""),c=o[l]),!c){const d=a?{field:OC,pulse:t.countsRef(e,i,a)}:{field:e.fieldRef(i),pulse:De(t.output)};u&&(d.sort=e.sortRef(a)),f=e.add(uy(r,void 0,d)),s&&(t.index[i]=f),c=De(f),l!=null&&(o[l]=c)}return c}yl.prototype={countsRef(e,t,n){const r=this,i=r.counts||(r.counts={}),a=c6(t);let s,o,u;return a!=null&&(e=r.scope,s=i[a]),s?n&&n.field&&f6(e,s.agg.params,n):(u={groupby:e.fieldRef(t,"key"),pulse:De(r.output)},n&&n.field&&f6(e,u,n),o=e.add(z4(u)),s=e.add(Xi({pulse:De(o)})),s={agg:o,ref:De(s)},a!=null&&(i[a]=s)),s.ref},tuplesRef(){return De(this.values)},extentRef(e,t){return wg(e,this,"extent","extent",t,!1)},domainRef(e,t){return wg(e,this,"domain","values",t,!1)},valuesRef(e,t,n){return wg(e,this,"vals","values",t,n||!0)},lookupRef(e,t){return wg(e,this,"lookup","tupleindex",t,!1)},indataRef(e,t){return wg(e,this,"indata","tupleindex",t,!0,!0)}};function Ive(e,t,n){const r=e.from.facet,i=r.name,a=yy(r,t);let s;r.name||Q("Facet must have a name: "+he(r)),r.data||Q("Facet must reference a data set: "+he(r)),r.field?s=t.add(W4({field:t.fieldRef(r.field),pulse:a})):r.groupby?s=t.add(k0e({key:t.keyRef(r.groupby),group:De(t.proxy(n.parent)),pulse:a})):Q("Facet must specify groupby or field: "+he(r));const o=t.fork(),u=o.add(Xi()),l=o.add(vl({pulse:De(u)}));o.addData(i,new yl(o,u,u,l)),o.addSignal("parent",null),s.params.subflow={$subflow:o.parse(e).toRuntime()}}function Bve(e,t,n){const r=t.add(W4({pulse:n.pulse})),i=t.fork();i.add(vl()),i.addSignal("parent",null),r.params.subflow={$subflow:i.parse(e).toRuntime()}}function d6(e,t,n){const r=e.remove,i=e.insert,a=e.toggle,s=e.modify,o=e.values,u=t.add(ly()),l="if("+e.trigger+',modify("'+n+'",'+[i,r,a,s,o].map(f=>f??"null").join(",")+"),0)",c=qa(l,t);u.update=c.$expr,u.params=c.$params}function by(e,t){const n=i6(e),r=e.type===py,i=e.from&&e.from.facet,a=e.overlap;let s=e.layout||n===RC||n===DC,o,u,l,c,f,d,h;const g=n===$C||s||i,p=Ove(e.from,r,t);u=t.add(S0e({key:p.key||(e.key?pg(e.key):void 0),pulse:p.pulse,clean:!r}));const v=De(u);u=l=t.add(Xi({pulse:v})),u=t.add($0e({markdef:Ave(e),interactive:Tve(e.interactive,t),clip:_ve(e.clip,t),context:{$context:!0},groups:t.lookup(),parent:t.signals.parent?t.signalRef("parent"):null,index:t.markpath(),pulse:De(u)}));const m=De(u);u=c=t.add(V4(N4(e.encode,e.type,n,e.style,t,{mod:!1,pulse:m}))),u.params.parent=t.encode(),e.transform&&e.transform.forEach(F=>{const x=ZC(F,t),C=x.metadata;(C.generates||C.changes)&&Q("Mark transforms should not generate new data."),C.nomod||(c.params.mod=!0),x.params.pulse=De(u),t.add(u=x)}),e.sort&&(u=t.add(z0e({sort:t.compareRef(e.sort),pulse:De(u)})));const y=De(u);(i||s)&&(s=t.add(j4({layout:t.objectProperty(e.layout),legends:t.legends,mark:m,pulse:y})),d=De(s));const b=t.add(q4({mark:m,pulse:d||y}));h=De(b),r&&(g&&(o=t.operators,o.pop(),s&&o.pop()),t.pushState(y,d||h,v),i?Ive(e,t,p):g?Bve(e,t,p):t.parse(e),t.popState(),g&&(s&&o.push(s),o.push(b))),a&&(h=Lve(a,h,t));const w=t.add(H4({pulse:h})),E=t.add(vl({pulse:De(w)},void 0,t.parent()));e.name!=null&&(f=e.name,t.addData(f,new yl(t,l,w,E)),e.on&&e.on.forEach(F=>{(F.insert||F.remove||F.toggle)&&Q("Marks only support modify triggers."),d6(F,t,f)}))}function Lve(e,t,n){const r=e.method,i=e.bound,a=e.separation,s={separation:fn(a)?n.signalRef(a.signal):a,method:fn(r)?n.signalRef(r.signal):r,pulse:t};if(e.order&&(s.sort=n.compareRef({field:e.order})),i){const o=i.tolerance;s.boundTolerance=fn(o)?n.signalRef(o.signal):+o,s.boundScale=n.scaleRef(i.scale),s.boundOrient=i.orient}return De(n.add(P0e(s)))}function zve(e,t){const n=t.config.legend,r=e.encode||{},i=qr(e,n),a=r.legend||{},s=a.name||void 0,o=a.interactive,u=a.style,l={};let c=0,f,d,h;jC.forEach(b=>e[b]?(l[b]=e[b],c=c||e[b]):0),c||Q("Missing valid scale for legend.");const g=qve(e,t.scaleType(c)),p={title:e.title!=null,scales:l,type:g,vgrad:g!=="symbol"&&i.isVertical()},v=De(t.add(Xi(null,[p]))),m={enter:{x:{value:0},y:{value:0}}},y=De(t.add(T0e(d={type:g,scale:t.scaleRef(c),count:t.objectProperty(i("tickCount")),limit:t.property(i("symbolLimit")),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)})));return g===gy?(h=[hve(e,c,n,r.gradient),n6(e,n,r.labels,y)],d.count=d.count||t.signalRef(`max(2,2*floor((${pl(i.gradientLength())})/100))`)):g===WC?h=[gve(e,c,n,r.gradient,y),n6(e,n,r.labels,y)]:(f=yve(e,n),h=[mve(e,n,r,y,pl(f.columns))],d.size=Wve(e,t,h[0].marks)),h=[bg({role:Hpe,from:v,encode:m,marks:h,layout:f,interactive:o})],p.title&&h.push(kve(e,n,r.title,v)),by(bg({role:Vpe,from:v,encode:sf(Vve(i,e,n),a,yg),marks:h,aria:i("aria"),description:i("description"),zindex:i("zindex"),name:s,interactive:o,style:u}),t)}function qve(e,t){let n=e.type||Q4;return!e.type&&Uve(e)===1&&(e.fill||e.stroke)&&(n=cE(t)?gy:fE(t)?WC:Q4),n!==gy?n:fE(t)?WC:gy}function Uve(e){return jC.reduce((t,n)=>t+(e[n]?1:0),0)}function Vve(e,t,n){const r={enter:{},update:{}};return Un(r,{orient:e("orient"),offset:e("offset"),padding:e("padding"),titlePadding:e("titlePadding"),cornerRadius:e("cornerRadius"),fill:e("fillColor"),stroke:e("strokeColor"),strokeWidth:n.strokeWidth,strokeDash:n.strokeDash,x:e("legendX"),y:e("legendY"),format:t.format,formatType:t.formatType}),r}function Wve(e,t,n){const r=pl(h6("size",e,n)),i=pl(h6("strokeWidth",e,n)),a=pl(Hve(n[1].encode,t,mg));return qa(`max(ceil(sqrt(${r})+${i}),${a})`,t)}function h6(e,t,n){return t[e]?`scale("${t[e]}",datum)`:e6(e,n[0].encode)}function Hve(e,t,n){return e6("fontSize",e)||fve("fontSize",t,n)}const jve=`item.orient==="${uf}"?-90:item.orient==="${lf}"?90:0`;function Gve(e,t){e=Ee(e)?{text:e}:e;const n=qr(e,t.config.title),r=e.encode||{},i=r.group||{},a=i.name||void 0,s=i.interactive,o=i.style,u=[],l={},c=De(t.add(Xi(null,[l])));return u.push(Kve(e,n,Yve(e),c)),e.subtitle&&u.push(Zve(e,n,r.subtitle,c)),by(bg({role:Xpe,from:c,encode:Xve(n,i),marks:u,aria:n("aria"),description:n("description"),zindex:n("zindex"),name:a,interactive:s,style:o}),t)}function Yve(e){const t=e.encode;return t&&t.title||Ze({name:e.name,interactive:e.interactive,style:e.style},t)}function Xve(e,t){const n={enter:{},update:{}};return Un(n,{orient:e("orient"),anchor:e("anchor"),align:{signal:YC},angle:{signal:jve},limit:e("limit"),frame:e("frame"),offset:e("offset")||0,padding:e("subtitlePadding")}),sf(n,t,yg)}function Kve(e,t,n,r){const i={value:0},a=e.text,s={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return Un(s,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("color"),font:t("font"),fontSize:t("fontSize"),fontStyle:t("fontStyle"),fontWeight:t("fontWeight"),lineHeight:t("lineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),ni({type:ml,role:Kpe,style:uve,from:r,encode:s},n)}function Zve(e,t,n,r){const i={value:0},a=e.subtitle,s={enter:{opacity:i},update:{opacity:{value:1}},exit:{opacity:i}};return Un(s,{text:a,align:{signal:"item.mark.group.align"},angle:{signal:"item.mark.group.angle"},limit:{signal:"item.mark.group.limit"},baseline:"top",dx:t("dx"),dy:t("dy"),fill:t("subtitleColor"),font:t("subtitleFont"),fontSize:t("subtitleFontSize"),fontStyle:t("subtitleFontStyle"),fontWeight:t("subtitleFontWeight"),lineHeight:t("subtitleLineHeight")},{align:t("align"),angle:t("angle"),baseline:t("baseline")}),ni({type:ml,role:Zpe,style:lve,from:r,encode:s},n)}function Qve(e,t){const n=[];e.transform&&e.transform.forEach(r=>{n.push(ZC(r,t))}),e.on&&e.on.forEach(r=>{d6(r,t,e.name)}),t.addDataPipeline(e.name,Jve(e,t,n))}function Jve(e,t,n){const r=[];let i=null,a=!1,s=!1,o,u,l,c,f;for(e.values?fn(e.values)||fy(e.format)?(r.push(g6(t,e)),r.push(i=bl())):r.push(i=bl({$ingest:e.values,$format:e.format})):e.url?fy(e.url)||fy(e.format)?(r.push(g6(t,e)),r.push(i=bl())):r.push(i=bl({$request:e.url,$format:e.format})):e.source&&(i=o=be(e.source).map(d=>De(t.getData(d).output)),r.push(null)),u=0,l=n.length;u<l;++u)c=n[u],f=c.metadata,!i&&!f.source&&r.push(i=bl()),r.push(c),f.generates&&(s=!0),f.modifies&&!s&&(a=!0),f.source?i=c:f.changes&&(i=null);return o&&(l=o.length-1,r[0]=B0e({derive:a,pulse:l?o:o[0]}),(a||l)&&r.splice(1,0,bl())),i||r.push(bl()),r.push(vl({})),r}function bl(e){const t=Xi({},e);return t.metadata={source:!0},t}function g6(e,t){return M0e({url:t.url?e.property(t.url):void 0,async:t.async?e.property(t.async):void 0,values:t.values?e.property(t.values):void 0,format:e.objectProperty(t.format)})}const p6=e=>e===Xo||e===Ki,wy=(e,t,n)=>fn(e)?rme(e.signal,t,n):e===uf||e===Ki?t:n,kn=(e,t,n)=>fn(e)?tme(e.signal,t,n):p6(e)?t:n,Zi=(e,t,n)=>fn(e)?nme(e.signal,t,n):p6(e)?n:t,v6=(e,t,n)=>fn(e)?ime(e.signal,t,n):e===Ki?{value:t}:{value:n},eme=(e,t,n)=>fn(e)?ame(e.signal,t,n):e===lf?{value:t}:{value:n},tme=(e,t,n)=>m6(`${e} === '${Ki}' || ${e} === '${Xo}'`,t,n),nme=(e,t,n)=>m6(`${e} !== '${Ki}' && ${e} !== '${Xo}'`,t,n),rme=(e,t,n)=>JC(`${e} === '${uf}' || ${e} === '${Ki}'`,t,n),ime=(e,t,n)=>JC(`${e} === '${Ki}'`,t,n),ame=(e,t,n)=>JC(`${e} === '${lf}'`,t,n),m6=(e,t,n)=>(t=t!=null?Cn(t):t,n=n!=null?Cn(n):n,y6(t)&&y6(n)?(t=t?t.signal||he(t.value):null,n=n?n.signal||he(n.value):null,{signal:`${e} ? (${t}) : (${n})`}):[Ze({test:e},t)].concat(n||[])),y6=e=>e==null||Object.keys(e).length===1,JC=(e,t,n)=>({signal:`${e} ? (${ff(t)}) : (${ff(n)})`}),sme=(e,t,n,r,i)=>({signal:(r!=null?`${e} === '${uf}' ? (${ff(r)}) : `:"")+(n!=null?`${e} === '${Xo}' ? (${ff(n)}) : `:"")+(i!=null?`${e} === '${lf}' ? (${ff(i)}) : `:"")+(t!=null?`${e} === '${Ki}' ? (${ff(t)}) : `:"")+"(null)"}),ff=e=>fn(e)?e.signal:e==null?null:he(e),ome=(e,t)=>t===0?0:fn(e)?{signal:`(${e.signal}) * ${t}`}:{value:e*t},df=(e,t)=>{const n=e.signal;return n&&n.endsWith("(null)")?{signal:n.slice(0,-6)+t.signal}:e};function hf(e,t,n,r){let i;if(t&&xe(t,e))return t[e];if(xe(n,e))return n[e];if(e.startsWith("title")){switch(e){case"titleColor":i="fill";break;case"titleFont":case"titleFontSize":case"titleFontWeight":i=e[5].toLowerCase()+e.slice(6)}return r[VC][i]}else if(e.startsWith("label")){switch(e){case"labelColor":i="fill";break;case"labelFont":case"labelFontSize":i=e[5].toLowerCase()+e.slice(6)}return r[mg][i]}return null}function b6(e){const t={};for(const n of e)if(n)for(const r in n)t[r]=1;return Object.keys(t)}function ume(e,t){var n=t.config,r=n.style,i=n.axis,a=t.scaleType(e.scale)==="band"&&n.axisBand,s=e.orient,o,u,l;if(fn(s)){const f=b6([n.axisX,n.axisY]),d=b6([n.axisTop,n.axisBottom,n.axisLeft,n.axisRight]);o={};for(l of f)o[l]=kn(s,hf(l,n.axisX,i,r),hf(l,n.axisY,i,r));u={};for(l of d)u[l]=sme(s.signal,hf(l,n.axisTop,i,r),hf(l,n.axisBottom,i,r),hf(l,n.axisLeft,i,r),hf(l,n.axisRight,i,r))}else o=s===Ki||s===Xo?n.axisX:n.axisY,u=n["axis"+s[0].toUpperCase()+s.slice(1)];return o||u||a?Ze({},i,o,u,a):i}function lme(e,t,n,r){const i=qr(e,t),a=e.orient;let s,o;const u={enter:s={opacity:ot},update:o={opacity:Fi},exit:{opacity:ot}};Un(u,{stroke:i("domainColor"),strokeCap:i("domainCap"),strokeDash:i("domainDash"),strokeDashOffset:i("domainDashOffset"),strokeWidth:i("domainWidth"),strokeOpacity:i("domainOpacity")});const l=w6(e,0),c=w6(e,1);return s.x=o.x=kn(a,l,ot),s.x2=o.x2=kn(a,c),s.y=o.y=Zi(a,l,ot),s.y2=o.y2=Zi(a,c),ni({type:GC,role:Bpe,from:r,encode:u},n)}function w6(e,t){return{scale:e.scale,range:t}}function cme(e,t,n,r,i){const a=qr(e,t),s=e.orient,o=e.gridScale,u=wy(s,1,-1),l=fme(e.offset,u);let c,f,d;const h={enter:c={opacity:ot},update:d={opacity:Fi},exit:f={opacity:ot}};Un(h,{stroke:a("gridColor"),strokeCap:a("gridCap"),strokeDash:a("gridDash"),strokeDashOffset:a("gridDashOffset"),strokeOpacity:a("gridOpacity"),strokeWidth:a("gridWidth")});const g={scale:e.scale,field:Ei,band:i.band,extra:i.extra,offset:i.offset,round:a("tickRound")},p=kn(s,{signal:"height"},{signal:"width"}),v=o?{scale:o,range:0,mult:u,offset:l}:{value:0,offset:l},m=o?{scale:o,range:1,mult:u,offset:l}:Ze(p,{mult:u,offset:l});return c.x=d.x=kn(s,g,v),c.y=d.y=Zi(s,g,v),c.x2=d.x2=Zi(s,m),c.y2=d.y2=kn(s,m),f.x=kn(s,g),f.y=Zi(s,g),ni({type:GC,role:Lpe,key:Ei,from:r,encode:h},n)}function fme(e,t){if(t!==1)if(!we(e))e=fn(t)?{signal:`(${t.signal}) * (${e||0})`}:t*(e||0);else{let n=e=Ze({},e);for(;n.mult!=null;)if(we(n.mult))n=n.mult=Ze({},n.mult);else return n.mult=fn(t)?{signal:`(${n.mult}) * (${t.signal})`}:n.mult*t,e;n.mult=t}return e}function dme(e,t,n,r,i,a){const s=qr(e,t),o=e.orient,u=wy(o,-1,1);let l,c,f;const d={enter:l={opacity:ot},update:f={opacity:Fi},exit:c={opacity:ot}};Un(d,{stroke:s("tickColor"),strokeCap:s("tickCap"),strokeDash:s("tickDash"),strokeDashOffset:s("tickDashOffset"),strokeOpacity:s("tickOpacity"),strokeWidth:s("tickWidth")});const h=Cn(i);h.mult=u;const g={scale:e.scale,field:Ei,band:a.band,extra:a.extra,offset:a.offset,round:s("tickRound")};return f.y=l.y=kn(o,ot,g),f.y2=l.y2=kn(o,h),c.x=kn(o,g),f.x=l.x=Zi(o,ot,g),f.x2=l.x2=Zi(o,h),c.y=Zi(o,g),ni({type:GC,role:qpe,key:Ei,from:r,encode:d},n)}function ek(e,t,n,r,i){return{signal:'flush(range("'+e+'"), scale("'+e+'", datum.value), '+t+","+n+","+r+","+i+")"}}function hme(e,t,n,r,i,a){const s=qr(e,t),o=e.orient,u=e.scale,l=wy(o,-1,1),c=pl(s("labelFlush")),f=pl(s("labelFlushOffset")),d=s("labelAlign"),h=s("labelBaseline");let g=c===0||!!c,p;const v=Cn(i);v.mult=l,v.offset=Cn(s("labelPadding")||0),v.offset.mult=l;const m={scale:u,field:Ei,band:.5,offset:t6(a.offset,s("labelOffset"))},y=kn(o,g?ek(u,c,'"left"','"right"','"center"'):{value:"center"},eme(o,"left","right")),b=kn(o,v6(o,"bottom","top"),g?ek(u,c,'"top"','"bottom"','"middle"'):{value:"middle"}),w=ek(u,c,`-(${f})`,f,0);g=g&&f;const E={opacity:ot,x:kn(o,m,v),y:Zi(o,m,v)},F={enter:E,update:p={opacity:Fi,text:{field:UC},x:E.x,y:E.y,align:y,baseline:b},exit:{opacity:ot,x:E.x,y:E.y}};Un(F,{dx:!d&&g?kn(o,w):null,dy:!h&&g?Zi(o,w):null}),Un(F,{angle:s("labelAngle"),fill:s("labelColor"),fillOpacity:s("labelOpacity"),font:s("labelFont"),fontSize:s("labelFontSize"),fontWeight:s("labelFontWeight"),fontStyle:s("labelFontStyle"),limit:s("labelLimit"),lineHeight:s("labelLineHeight")},{align:d,baseline:h});const x=s("labelBound");let C=s("labelOverlap");return C=C||x?{separation:s("labelSeparation"),method:C,order:"datum.index",bound:x?{scale:u,orient:o,tolerance:x}:null}:void 0,p.align!==y&&(p.align=df(p.align,y)),p.baseline!==b&&(p.baseline=df(p.baseline,b)),ni({type:ml,role:zpe,style:mg,key:Ei,from:r,encode:F,overlap:C},n)}function gme(e,t,n,r){const i=qr(e,t),a=e.orient,s=wy(a,-1,1);let o,u;const l={enter:o={opacity:ot,anchor:Cn(i("titleAnchor",null)),align:{signal:YC}},update:u=Ze({},o,{opacity:Fi,text:Cn(e.title)}),exit:{opacity:ot}},c={signal:`lerp(range("${e.scale}"), ${vy(0,1,.5)})`};return u.x=kn(a,c),u.y=Zi(a,c),o.angle=kn(a,ot,ome(s,90)),o.baseline=kn(a,v6(a,Xo,Ki),{value:Xo}),u.angle=o.angle,u.baseline=o.baseline,Un(l,{fill:i("titleColor"),fillOpacity:i("titleOpacity"),font:i("titleFont"),fontSize:i("titleFontSize"),fontStyle:i("titleFontStyle"),fontWeight:i("titleFontWeight"),limit:i("titleLimit"),lineHeight:i("titleLineHeight")},{align:i("titleAlign"),angle:i("titleAngle"),baseline:i("titleBaseline")}),pme(i,a,l,n),l.update.align=df(l.update.align,o.align),l.update.angle=df(l.update.angle,o.angle),l.update.baseline=df(l.update.baseline,o.baseline),ni({type:ml,role:Upe,style:VC,from:r,encode:l},n)}function pme(e,t,n,r){const i=(o,u)=>o!=null?(n.update[u]=df(Cn(o),n.update[u]),!1):!of(u,r),a=i(e("titleX"),"x"),s=i(e("titleY"),"y");n.enter.auto=s===a?Cn(s):kn(t,Cn(s),Cn(a))}function vme(e,t){const n=ume(e,t),r=e.encode||{},i=r.axis||{},a=i.name||void 0,s=i.interactive,o=i.style,u=qr(e,n),l=dve(u),c={scale:e.scale,ticks:!!u("ticks"),labels:!!u("labels"),grid:!!u("grid"),domain:!!u("domain"),title:e.title!=null},f=De(t.add(Xi({},[c]))),d=De(t.add(F0e({scale:t.scaleRef(e.scale),extra:t.property(l.extra),count:t.objectProperty(e.tickCount),values:t.objectProperty(e.values),minstep:t.property(e.tickMinStep),formatType:t.property(e.formatType),formatSpecifier:t.property(e.format)}))),h=[];let g;return c.grid&&h.push(cme(e,n,r.grid,d,l)),c.ticks&&(g=u("tickSize"),h.push(dme(e,n,r.ticks,d,g,l))),c.labels&&(g=c.ticks?g:0,h.push(hme(e,n,r.labels,d,g,l))),c.domain&&h.push(lme(e,n,r.domain,f)),c.title&&h.push(gme(e,n,r.title,f)),by(bg({role:Ipe,from:f,encode:sf(mme(u,e),i,yg),marks:h,aria:u("aria"),description:u("description"),zindex:u("zindex"),name:a,interactive:s,style:o}),t)}function mme(e,t){const n={enter:{},update:{}};return Un(n,{orient:e("orient"),offset:e("offset")||0,position:Yi(t.position,0),titlePadding:e("titlePadding"),minExtent:e("minExtent"),maxExtent:e("maxExtent"),range:{signal:`abs(span(range("${t.scale}")))`},translate:e("translate"),format:t.format,formatType:t.formatType}),n}function x6(e,t,n){const r=be(e.signals),i=be(e.scales);return n||r.forEach(a=>I4(a,t)),be(e.projections).forEach(a=>tve(a,t)),i.forEach(a=>V0e(a,t)),be(e.data).forEach(a=>Qve(a,t)),i.forEach(a=>W0e(a,t)),(n||r).forEach(a=>E0e(a,t)),be(e.axes).forEach(a=>vme(a,t)),be(e.marks).forEach(a=>by(a,t)),be(e.legends).forEach(a=>zve(a,t)),e.title&&Gve(e.title,t),t.parseLambdas(),t}const yme=e=>sf({enter:{x:{value:0},y:{value:0}},update:{width:{signal:"width"},height:{signal:"height"}}},e);function bme(e,t){const n=t.config,r=De(t.root=t.add(ly())),i=wme(e,n);i.forEach(l=>I4(l,t)),t.description=e.description||n.description,t.eventConfig=n.events,t.legends=t.objectProperty(n.legend&&n.legend.layout),t.locale=n.locale;const a=t.add(Xi()),s=t.add(V4(N4(yme(e.encode),py,DC,e.style,t,{pulse:De(a)}))),o=t.add(j4({layout:t.objectProperty(e.layout),legends:t.legends,autosize:t.signalRef("autosize"),mark:r,pulse:De(s)}));t.operators.pop(),t.pushState(De(s),De(o),null),x6(e,t,i),t.operators.push(o);let u=t.add(q4({mark:r,pulse:De(o)}));return u=t.add(H4({pulse:De(u)})),u=t.add(vl({pulse:De(u)})),t.addData("root",new yl(t,a,a,u)),t}function xg(e,t){return t&&t.signal?{name:e,update:t.signal}:{name:e,value:t}}function wme(e,t){const n=s=>Yi(e[s],t[s]),r=[xg("background",n("background")),xg("autosize",Ppe(n("autosize"))),xg("padding",Ope(n("padding"))),xg("width",n("width")||0),xg("height",n("height")||0)],i=r.reduce((s,o)=>(s[o.name]=o,s),{}),a={};return be(e.signals).forEach(s=>{xe(i,s.name)?s=Ze(i[s.name],s):r.push(s),a[s.name]=s}),be(t.signals).forEach(s=>{!xe(a,s.name)&&!xe(i,s.name)&&r.push(s)}),r}function E6(e,t){this.config=e||{},this.options=t||{},this.bindings=[],this.field={},this.signals={},this.lambdas={},this.scales={},this.events={},this.data={},this.streams=[],this.updates=[],this.operators=[],this.eventConfig=null,this.locale=null,this._id=0,this._subid=0,this._nextsub=[0],this._parent=[],this._encode=[],this._lookup=[],this._markpath=[]}function F6(e){this.config=e.config,this.options=e.options,this.legends=e.legends,this.field=Object.create(e.field),this.signals=Object.create(e.signals),this.lambdas=Object.create(e.lambdas),this.scales=Object.create(e.scales),this.events=Object.create(e.events),this.data=Object.create(e.data),this.streams=[],this.updates=[],this.operators=[],this._id=0,this._subid=++e._nextsub[0],this._nextsub=e._nextsub,this._parent=e._parent.slice(),this._encode=e._encode.slice(),this._lookup=e._lookup.slice(),this._markpath=e._markpath}E6.prototype=F6.prototype={parse(e){return x6(e,this)},fork(){return new F6(this)},isSubscope(){return this._subid>0},toRuntime(){return this.finish(),{description:this.description,operators:this.operators,streams:this.streams,updates:this.updates,bindings:this.bindings,eventConfig:this.eventConfig,locale:this.locale}},id(){return(this._subid?this._subid+":":0)+this._id++},add(e){return this.operators.push(e),e.id=this.id(),e.refs&&(e.refs.forEach(t=>{t.$ref=e.id}),e.refs=null),e},proxy(e){const t=e instanceof NC?De(e):e;return this.add(I0e({value:t}))},addStream(e){return this.streams.push(e),e.id=this.id(),e},addUpdate(e){return this.updates.push(e),e},finish(){let e,t;this.root&&(this.root.root=!0);for(e in this.signals)this.signals[e].signal=e;for(e in this.scales)this.scales[e].scale=e;function n(r,i,a){let s,o;r&&(s=r.data||(r.data={}),o=s[i]||(s[i]=[]),o.push(a))}for(e in this.data){t=this.data[e],n(t.input,e,"input"),n(t.output,e,"output"),n(t.values,e,"values");for(const r in t.index)n(t.index[r],e,"index:"+r)}return this},pushState(e,t,n){this._encode.push(De(this.add(vl({pulse:e})))),this._parent.push(t),this._lookup.push(n?De(this.proxy(n)):null),this._markpath.push(-1)},popState(){this._encode.pop(),this._parent.pop(),this._lookup.pop(),this._markpath.pop()},parent(){return st(this._parent)},encode(){return st(this._encode)},lookup(){return st(this._lookup)},markpath(){const e=this._markpath;return++e[e.length-1]},fieldRef(e,t){if(Ee(e))return pg(e,t);e.signal||Q("Unsupported field reference: "+he(e));const n=e.signal;let r=this.field[n];if(!r){const i={name:this.signalRef(n)};t&&(i.as=t),this.field[n]=r=De(this.add(_0e(i)))}return r},compareRef(e){let t=!1;const n=a=>fn(a)?(t=!0,this.signalRef(a.signal)):d0e(a)?(t=!0,this.exprRef(a.expr)):a,r=be(e.field).map(n),i=be(e.order).map(n);return t?De(this.add(U4({fields:r,orders:i}))):B4(r,i)},keyRef(e,t){let n=!1;const r=a=>fn(a)?(n=!0,De(i[a.signal])):a,i=this.signals;return e=be(e).map(r),n?De(this.add(A0e({fields:e,flat:t}))):u0e(e,t)},sortRef(e){if(!e)return e;const t=cy(e.op,e.field),n=e.order||l0e;return n.signal?De(this.add(U4({fields:t,orders:this.signalRef(n.signal)}))):B4(t,n)},event(e,t){const n=e+":"+t;if(!this.events[n]){const r=this.id();this.streams.push({id:r,source:e,type:t}),this.events[n]=r}return this.events[n]},hasOwnSignal(e){return xe(this.signals,e)},addSignal(e,t){this.hasOwnSignal(e)&&Q("Duplicate signal name: "+he(e));const n=t instanceof NC?t:this.add(ly(t));return this.signals[e]=n},getSignal(e){return this.signals[e]||Q("Unrecognized signal name: "+he(e)),this.signals[e]},signalRef(e){return this.signals[e]?De(this.signals[e]):(xe(this.lambdas,e)||(this.lambdas[e]=this.add(ly(null))),De(this.lambdas[e]))},parseLambdas(){const e=Object.keys(this.lambdas);for(let t=0,n=e.length;t<n;++t){const r=e[t],i=qa(r,this),a=this.lambdas[r];a.params=i.$params,a.update=i.$expr}},property(e){return e&&e.signal?this.signalRef(e.signal):e},objectProperty(e){return!e||!we(e)?e:this.signalRef(e.signal||tk(e))},exprRef(e,t){const n={expr:qa(e,this)};return t&&(n.expr.$name=t),De(this.add(C0e(n)))},addBinding(e,t){this.bindings||Q("Nested signals do not support binding: "+he(e)),this.bindings.push(Ze({signal:e},t))},addScaleProj(e,t){xe(this.scales,e)&&Q("Duplicate scale or projection name: "+he(e)),this.scales[e]=this.add(t)},addScale(e,t){this.addScaleProj(e,L0e(t))},addProjection(e,t){this.addScaleProj(e,O0e(t))},getScale(e){return this.scales[e]||Q("Unrecognized scale name: "+he(e)),this.scales[e]},scaleRef(e){return De(this.getScale(e))},scaleType(e){return this.getScale(e).params.type},projectionRef(e){return this.scaleRef(e)},projectionType(e){return this.scaleType(e)},addData(e,t){return xe(this.data,e)&&Q("Duplicate data set name: "+he(e)),this.data[e]=t},getData(e){return this.data[e]||Q("Undefined data set name: "+he(e)),this.data[e]},addDataPipeline(e,t){return xe(this.data,e)&&Q("Duplicate data set name: "+he(e)),this.addData(e,yl.fromEntries(this,t))}};function tk(e){return(ee(e)?xme:Eme)(e)}function xme(e){const t=e.length;let n="[";for(let r=0;r<t;++r){const i=e[r];n+=(r>0?",":"")+(we(i)?i.signal||tk(i):he(i))}return n+"]"}function Eme(e){let t="{",n=0,r,i;for(r in e)i=e[r],t+=(++n>1?",":"")+he(r)+":"+(we(i)?i.signal||tk(i):he(i));return t+"}"}function Fme(){const e="sans-serif",r="#4c78a8",i="#000",a="#888",s="#ddd";return{description:"Vega visualization",padding:0,autosize:"pad",background:null,events:{defaults:{allow:["wheel"]}},group:null,mark:null,arc:{fill:r},area:{fill:r},image:null,line:{stroke:r,strokeWidth:2},path:{stroke:r},rect:{fill:r},rule:{stroke:i},shape:{stroke:r},symbol:{fill:r,size:64},text:{fill:i,font:e,fontSize:11},trail:{fill:r,size:2},style:{"guide-label":{fill:i,font:e,fontSize:10},"guide-title":{fill:i,font:e,fontSize:11,fontWeight:"bold"},"group-title":{fill:i,font:e,fontSize:13,fontWeight:"bold"},"group-subtitle":{fill:i,font:e,fontSize:12},point:{size:30,strokeWidth:2,shape:"circle"},circle:{size:30,strokeWidth:2},square:{size:30,strokeWidth:2,shape:"square"},cell:{fill:"transparent",stroke:s},view:{fill:"transparent"}},title:{orient:"top",anchor:"middle",offset:4,subtitlePadding:3},axis:{minExtent:0,maxExtent:200,bandPosition:.5,domain:!0,domainWidth:1,domainColor:a,grid:!1,gridWidth:1,gridColor:s,labels:!0,labelAngle:0,labelLimit:180,labelOffset:0,labelPadding:2,ticks:!0,tickColor:a,tickOffset:0,tickRound:!0,tickSize:5,tickWidth:1,titlePadding:4},axisBand:{tickOffset:-.5},projection:{type:"mercator"},legend:{orient:"right",padding:0,gridAlign:"each",columnPadding:10,rowPadding:2,symbolDirection:"vertical",gradientDirection:"vertical",gradientLength:200,gradientThickness:16,gradientStrokeColor:s,gradientStrokeWidth:0,gradientLabelOffset:2,labelAlign:"left",labelBaseline:"middle",labelLimit:160,labelOffset:4,labelOverlap:!0,symbolLimit:30,symbolType:"circle",symbolSize:100,symbolOffset:0,symbolStrokeWidth:1.5,symbolBaseFillColor:"transparent",symbolBaseStrokeColor:a,titleLimit:180,titleOrient:"top",titlePadding:5,layout:{offset:18,direction:"horizontal",left:{direction:"vertical"},right:{direction:"vertical"}}},range:{category:{scheme:"tableau10"},ordinal:{scheme:"blues"},heatmap:{scheme:"yellowgreenblue"},ramp:{scheme:"blues"},diverging:{scheme:"blueorange",extent:[1,0]},symbol:["circle","square","triangle-up","cross","diamond","triangle-right","triangle-down","triangle-left"]}}}function Sme(e,t,n){return we(e)||Q("Input Vega specification must be an object."),t=tw(Fme(),t,e.config),bme(e,new E6(t,n)).toRuntime()}Ze(Kd,lee,ese,Cse,fue,ale,Dce,fce,Pce,ife,gfe,xfe);function nk(e){return le(e,"or")}function rk(e){return le(e,"and")}function ik(e){return le(e,"not")}function xy(e,t){if(ik(e))xy(e.not,t);else if(rk(e))for(const n of e.and)xy(n,t);else if(nk(e))for(const n of e.or)xy(n,t);else t(e)}function gf(e,t){return ik(e)?{not:gf(e.not,t)}:rk(e)?{and:e.and.map(n=>gf(n,t))}:nk(e)?{or:e.or.map(n=>gf(n,t))}:t(e)}const qe=structuredClone;function Cme(e){throw new Error(e)}function Eg(e,t){const n={};for(const r of t)xe(e,r)&&(n[r]=e[r]);return n}function Si(e,t){const n={...e};for(const r of t)delete n[r];return n}Set.prototype.toJSON=function(){return`Set(${[...this].map(e=>wt(e)).join(",")})`};function at(e){if(yt(e))return e;const t=Ee(e)?e:wt(e);if(t.length<250)return t;let n=0;for(let r=0;r<t.length;r++){const i=t.charCodeAt(r);n=(n<<5)-n+i,n=n&n}return n}function S6(e){return e===!1||e===null}function rt(e,t){return e.includes(t)}function Fg(e,t){let n=0;for(const[r,i]of e.entries())if(t(i,r,n++))return!0;return!1}function C6(e,t){let n=0;for(const[r,i]of e.entries())if(!t(i,r,n++))return!1;return!0}function kme(e,...t){for(const n of t)_me(e,n??{});return e}function _me(e,t){for(const n of ue(t))e0(e,n,t[n],!0)}function Is(e,t){const n=[],r={};let i;for(const a of e)i=t(a),!(i in r)&&(r[i]=1,n.push(a));return n}function Ame(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function k6(e,t){for(const n of e)if(t.has(n))return!0;return!1}function _6(e){const t=new Set;for(const n of e){const i=hs(n).map((s,o)=>o===0?s:`[${s}]`),a=i.map((s,o)=>i.slice(0,o+1).join(""));for(const s of a)t.add(s)}return t}function A6(e,t){return e===void 0||t===void 0?!0:k6(_6(e),_6(t))}function Mt(e){return ue(e).length===0}const ue=Object.keys,dn=Object.values,wl=Object.entries;function Ey(e){return e===!0||e===!1}function Ut(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function Fy(e,t){return ik(e)?`!(${Fy(e.not,t)})`:rk(e)?`(${e.and.map(n=>Fy(n,t)).join(") && (")})`:nk(e)?`(${e.or.map(n=>Fy(n,t)).join(") || (")})`:t(e)}function ak(e,t){if(t.length===0)return!0;const n=t.shift();return n in e&&ak(e[n],t)&&delete e[n],Mt(e)}function Sy(e){return e.charAt(0).toUpperCase()+e.substr(1)}function T6(e,t="datum"){const n=hs(e),r=[];for(let i=1;i<=n.length;i++){const a=`[${n.slice(0,i).map(he).join("][")}]`;r.push(`${t}${a}`)}return r.join(" && ")}function Tme(e,t="datum"){return`${t}[${he(hs(e).join("."))}]`}function St(e){return`datum['${e.replaceAll("'","\\'")}']`}function Mme(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function Qi(e){return`${hs(e).map(Mme).join("\\.")}`}function pf(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function Sg(e){return`${hs(e).join(".")}`}function Cg(e){return e?hs(e).length:0}function en(...e){return e.find(t=>t!==void 0)}let $me=42;function Dme(e){const t=++$me;return e?String(e)+t:t}function Rme(e){return Pme(e)?e:`__${e}`}function Pme(e){return e.startsWith("__")}function Cy(e){if(e!==void 0)return(e%360+360)%360}function sk(e){return yt(e)?!0:!isNaN(e)&&!isNaN(parseFloat(e))}const M6=Object.getPrototypeOf(structuredClone({}));function Ci(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor.name!==t.constructor.name)return!1;let n,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Ci(e[r],t[r]))return!1;return!0}if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const a of e.entries())if(!t.has(a[0]))return!1;for(const a of e.entries())if(!Ci(a[1],t.get(a[0])))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const a of e.entries())if(!t.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&e.valueOf!==M6.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&e.toString!==M6.toString)return e.toString()===t.toString();const i=Object.keys(e);if(n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const a=i[r];if(!Ci(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function wt(e){const t=[];return function n(r){if(r!=null&&r.toJSON&&typeof r.toJSON=="function"&&(r=r.toJSON()),r===void 0)return;if(typeof r=="number")return isFinite(r)?`${r}`:"null";if(typeof r!="object")return JSON.stringify(r);let i,a;if(Array.isArray(r)){for(a="[",i=0;i<r.length;i++)i&&(a+=","),a+=n(r[i])||"null";return`${a}]`}if(r===null)return"null";if(t.includes(r))throw new TypeError("Converting circular structure to JSON");const s=t.push(r)-1,o=Object.keys(r).sort();for(a="",i=0;i<o.length;i++){const u=o[i],l=n(r[u]);l&&(a&&(a+=","),a+=`${JSON.stringify(u)}:${l}`)}return t.splice(s,1),`{${a}}`}(e)}function le(e,t){return we(e)&&xe(e,t)&&e[t]!==void 0}const Bs="row",Ls="column",ky="facet",Bt="x",_n="y",Ji="x2",Ua="y2",Ko="xOffset",vf="yOffset",ea="radius",zs="radius2",ki="theta",qs="theta2",ta="latitude",na="longitude",ra="latitude2",_i="longitude2",Zo="time",Ur="color",Va="fill",Wa="stroke",Vr="shape",Us="size",xl="angle",Vs="opacity",Qo="fillOpacity",Jo="strokeOpacity",eu="strokeWidth",tu="strokeDash",kg="text",mf="order",_g="detail",_y="key",El="tooltip",Ay="href",Ty="url",My="description",Nme={x:1,y:1,x2:1,y2:1},$6={theta:1,theta2:1,radius:1,radius2:1};function D6(e){return xe($6,e)}const ok={longitude:1,longitude2:1,latitude:1,latitude2:1};function R6(e){switch(e){case ta:return"y";case ra:return"y2";case na:return"x";case _i:return"x2"}}function P6(e){return xe(ok,e)}const Ome=ue(ok),uk={...Nme,...$6,...ok,xOffset:1,yOffset:1,color:1,fill:1,stroke:1,time:1,opacity:1,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeDash:1,size:1,angle:1,shape:1,order:1,text:1,detail:1,key:1,tooltip:1,href:1,url:1,description:1};function yf(e){return e===Ur||e===Va||e===Wa}const N6={row:1,column:1,facet:1},Ai=ue(N6),lk={...uk,...N6},Ime=ue(lk),{order:VSe,detail:WSe,tooltip:HSe,...Bme}=lk,{row:jSe,column:GSe,facet:YSe,...Lme}=Bme;function zme(e){return xe(Lme,e)}function O6(e){return xe(lk,e)}const qme=[Ji,Ua,ra,_i,qs,zs];function I6(e){return Fl(e)!==e}function Fl(e){switch(e){case Ji:return Bt;case Ua:return _n;case ra:return ta;case _i:return na;case qs:return ki;case zs:return ea}return e}function nu(e){if(D6(e))switch(e){case ki:return"startAngle";case qs:return"endAngle";case ea:return"outerRadius";case zs:return"innerRadius"}return e}function Ha(e){switch(e){case Bt:return Ji;case _n:return Ua;case ta:return ra;case na:return _i;case ki:return qs;case ea:return zs}}function Wr(e){switch(e){case Bt:case Ji:return"width";case _n:case Ua:return"height"}}function B6(e){switch(e){case Bt:return"xOffset";case _n:return"yOffset";case Ji:return"x2Offset";case Ua:return"y2Offset";case ki:return"thetaOffset";case ea:return"radiusOffset";case qs:return"theta2Offset";case zs:return"radius2Offset"}}function ck(e){switch(e){case Bt:return"xOffset";case _n:return"yOffset"}}function Ume(e){switch(e){case"xOffset":return"x";case"yOffset":return"y"}}const Vme=ue(uk),{x:XSe,y:KSe,x2:ZSe,y2:QSe,xOffset:JSe,yOffset:eCe,latitude:tCe,longitude:nCe,latitude2:rCe,longitude2:iCe,theta:aCe,theta2:sCe,radius:oCe,radius2:uCe,...fk}=uk,Wme=ue(fk),dk={x:1,y:1},Ws=ue(dk);function Qt(e){return xe(dk,e)}const hk={theta:1,radius:1},Hme=ue(hk);function $y(e){return e==="width"?Bt:_n}const L6={xOffset:1,yOffset:1};function Ag(e){return xe(L6,e)}const jme={time:1};function gk(e){return e in jme}const{text:lCe,tooltip:cCe,href:fCe,url:dCe,description:hCe,detail:gCe,key:pCe,order:vCe,...z6}=fk,Gme=ue(z6);function Yme(e){return xe(fk,e)}function Xme(e){switch(e){case Ur:case Va:case Wa:case Us:case Vr:case Vs:case eu:case tu:return!0;case Qo:case Jo:case xl:case Zo:return!1}}const q6={...dk,...hk,...L6,...z6},pk=ue(q6);function ja(e){return xe(q6,e)}function Kme(e,t){return Qme(e)[t]}const U6={arc:"always",area:"always",bar:"always",circle:"always",geoshape:"always",image:"always",line:"always",rule:"always",point:"always",rect:"always",square:"always",trail:"always",text:"always",tick:"always"},{geoshape:mCe,...Zme}=U6;function Qme(e){switch(e){case Ur:case Va:case Wa:case My:case _g:case _y:case El:case Ay:case mf:case Vs:case Qo:case Jo:case eu:case ky:case Bs:case Ls:return U6;case Bt:case _n:case Ko:case vf:case ta:case na:case Zo:return Zme;case Ji:case Ua:case ra:case _i:return{area:"always",bar:"always",image:"always",rect:"always",rule:"always",circle:"binned",point:"binned",square:"binned",tick:"binned",line:"binned",trail:"binned"};case Us:return{point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",text:"always",line:"always",trail:"always"};case tu:return{line:"always",point:"always",tick:"always",rule:"always",circle:"always",square:"always",bar:"always",geoshape:"always"};case Vr:return{point:"always",geoshape:"always"};case kg:return{text:"always"};case xl:return{point:"always",square:"always",text:"always"};case Ty:return{image:"always"};case ki:return{text:"always",arc:"always"};case ea:return{text:"always",arc:"always"};case qs:case zs:return{arc:"always"}}}function vk(e){switch(e){case Bt:case _n:case ki:case ea:case Ko:case vf:case Us:case xl:case eu:case Vs:case Qo:case Jo:case Zo:case Ji:case Ua:case qs:case zs:return;case ky:case Bs:case Ls:case Vr:case tu:case kg:case El:case Ay:case Ty:case My:return"discrete";case Ur:case Va:case Wa:return"flexible";case ta:case na:case ra:case _i:case _g:case _y:case mf:return}}const Jme={argmax:1,argmin:1,average:1,count:1,distinct:1,exponential:1,exponentialb:1,product:1,max:1,mean:1,median:1,min:1,missing:1,q1:1,q3:1,ci0:1,ci1:1,stderr:1,stdev:1,stdevp:1,sum:1,valid:1,values:1,variance:1,variancep:1},eye={count:1,min:1,max:1};function Hs(e){return le(e,"argmin")}function ru(e){return le(e,"argmax")}function mk(e){return Ee(e)&&xe(Jme,e)}const tye=new Set(["count","valid","missing","distinct"]);function Dy(e){return Ee(e)&&tye.has(e)}function nye(e){return Ee(e)&&rt(["min","max"],e)}const rye=new Set(["count","sum","distinct","valid","missing"]),iye=new Set(["mean","average","median","q1","q3","min","max"]);function V6(e){return mc(e)&&(e=Zy(e,void 0)),`bin${ue(e).map(t=>Ry(e[t])?Ut(`_${t}_${wl(e[t])}`):Ut(`_${t}_${e[t]}`)).join("")}`}function $t(e){return e===!0||Sl(e)&&!e.binned}function Vn(e){return e==="binned"||Sl(e)&&e.binned===!0}function Sl(e){return we(e)}function Ry(e){return le(e,"param")}function W6(e){switch(e){case Bs:case Ls:case Us:case Ur:case Va:case Wa:case eu:case Vs:case Qo:case Jo:case Vr:return 6;case tu:return 4;default:return 10}}function Tg(e){return le(e,"expr")}function Wn(e,{level:t}={level:0}){const n=ue(e||{}),r={};for(const i of n)r[i]=t===0?ri(e[i]):Wn(e[i],{level:t-1});return r}function H6(e){const{anchor:t,frame:n,offset:r,orient:i,angle:a,limit:s,color:o,subtitleColor:u,subtitleFont:l,subtitleFontSize:c,subtitleFontStyle:f,subtitleFontWeight:d,subtitleLineHeight:h,subtitlePadding:g,...p}=e,v={...p,...o?{fill:o}:{}},m={...t?{anchor:t}:{},...n?{frame:n}:{},...r?{offset:r}:{},...i?{orient:i}:{},...a!==void 0?{angle:a}:{},...s!==void 0?{limit:s}:{}},y={...u?{subtitleColor:u}:{},...l?{subtitleFont:l}:{},...c?{subtitleFontSize:c}:{},...f?{subtitleFontStyle:f}:{},...d?{subtitleFontWeight:d}:{},...h?{subtitleLineHeight:h}:{},...g?{subtitlePadding:g}:{}},b=Eg(e,["align","baseline","dx","dy","limit"]);return{titleMarkConfig:v,subtitleMarkConfig:b,nonMarkTitleProperties:m,subtitle:y}}function iu(e){return Ee(e)||ee(e)&&Ee(e[0])}function Ae(e){return le(e,"signal")}function Cl(e){return le(e,"step")}function aye(e){return ee(e)?!1:le(e,"fields")&&!le(e,"data")}function sye(e){return ee(e)?!1:le(e,"fields")&&le(e,"data")}function js(e){return ee(e)?!1:le(e,"field")&&le(e,"data")}const oye=ue({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),uye={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},yk=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function j6(e){const t=ee(e.condition)?e.condition.map(G6):G6(e.condition);return{...ri(e),condition:t}}function ri(e){if(Tg(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function G6(e){if(Tg(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Ot(e){if(Tg(e)){const{expr:t,...n}=e;return{signal:t,...n}}return Ae(e)?e:e!==void 0?{value:e}:void 0}function lye(e){return Ae(e)?e.signal:he(e)}function Y6(e){return Ae(e)?e.signal:he(e.value)}function ia(e){return Ae(e)?e.signal:e==null?null:he(e)}function cye(e,t,n){for(const r of n){const i=Ga(r,t.markDef,t.config);i!==void 0&&(e[r]=Ot(i))}return e}function X6(e){return[].concat(e.type,e.style??[])}function Ct(e,t,n,r={}){const{vgChannel:i,ignoreVgConfig:a}=r;return i&&le(t,i)?t[i]:t[e]!==void 0?t[e]:a&&(!i||i===e)?void 0:Ga(e,t,n,r)}function Ga(e,t,n,{vgChannel:r}={}){const i=bk(e,t,n.style);return en(r?i:void 0,i,r?n[t.type][r]:void 0,n[t.type][e],r?n.mark[r]:n.mark[e])}function bk(e,t,n){return K6(e,X6(t),n)}function K6(e,t,n){t=be(t);let r;for(const i of t){const a=n[i];le(a,e)&&(r=a[e])}return r}function Z6(e,t){return be(e).reduce((n,r)=>(n.field.push(pe(r,t)),n.order.push(r.sort??"ascending"),n),{field:[],order:[]})}function Q6(e,t){const n=[...e];return t.forEach(r=>{for(const i of n)if(Ci(i,r))return;n.push(r)}),n}function J6(e,t){return Ci(e,t)||!t?e:e?[...be(e),...be(t)].join(", "):t}function e8(e,t){const n=e.value,r=t.value;if(n==null||r===null)return{explicit:e.explicit,value:null};if((iu(n)||Ae(n))&&(iu(r)||Ae(r)))return{explicit:e.explicit,value:J6(n,r)};if(iu(n)||Ae(n))return{explicit:e.explicit,value:n};if(iu(r)||Ae(r))return{explicit:e.explicit,value:r};if(!iu(n)&&!Ae(n)&&!iu(r)&&!Ae(r))return{explicit:e.explicit,value:Q6(n,r)};throw new Error("It should never reach here")}function wk(e){return`Invalid specification ${wt(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const fye='Autosize "fit" only works for single views and layered views.';function t8(e){return`${e=="width"?"Width":"Height"} "container" only works for single views and layered views.`}function n8(e){const t=e=="width"?"Width":"Height",n=e=="width"?"x":"y";return`${t} "container" only works well with autosize "fit" or "fit-${n}".`}function r8(e){return e?`Dropping "fit-${e}" because spec has discrete ${Wr(e)}.`:'Dropping "fit" because spec has discrete size.'}function xk(e){return`Unknown field for ${e}. Cannot calculate view size.`}function i8(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function dye(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function hye(e){return`The "nearest" transform is not supported for ${e} marks.`}function a8(e){return`Selection not supported for ${e} yet.`}function gye(e){return`Cannot find a selection named "${e}".`}const pye="Scale bindings are currently only supported for scales with unbinned, continuous domains.",vye="Sequntial scales are deprecated. The available quantitative scale type values are linear, log, pow, sqrt, symlog, time and utc",mye="Legend bindings are only supported for selections over an individual field or encoding channel.";function yye(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}function bye(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}const wye="The same selection must be used to override scale domains in a layered view.",xye='Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.';function Eye(e){return`Unknown repeated value "${e}".`}function s8(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}const Fye="Multiple timer selections in one unit spec are not supported. Ignoring all but the first.",Ek="Animation involving facet, layer, or concat is currently unsupported.";function Sye(e){return`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${he(e)}.`}function Cye(e,t,n,r){return`${e.length?"Multiple ":"No "}matching ${he(t)} encoding found for selection ${he(n.param)}. Using "field": ${he(r)}.`}const kye="Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).";function _ye(e){return`Unrecognized parse "${e}".`}function o8(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}const Aye="Attempt to add the same child twice.";function Tye(e){return`Ignoring an invalid transform: ${wt(e)}.`}const Mye='If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.';function u8(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function $ye(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${wt(t)} is overridden by a child projection ${wt(n)}.`}const Dye="Arc marks uses theta channel rather than angle, replacing angle with theta.";function Rye(e){return`${e}Offset dropped because ${e} is continuous`}function Pye(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${wt(n)}}.`}function l8(e){return`Invalid field type "${e}".`}function Nye(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}function Oye(e){return`Invalid aggregation operator "${e}".`}function c8(e,t){const{fill:n,stroke:r}=t;return`Dropping color ${e} as the plot also has ${n&&r?"fill and stroke":n?"fill":"stroke"}.`}function Iye(e){return`Position range does not support relative band size for ${e}.`}function Fk(e,t){return`Dropping ${wt(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}const Bye="Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.";function Py(e,t,n){return`${e} dropped as it is incompatible with "${t}".`}function Lye(e){return`${e}-encoding is dropped as ${e} is not a valid encoding channel.`}function zye(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function qye(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function Uye(e){return`Facet encoding dropped as ${e.join(" and ")} ${e.length>1?"are":"is"} also specified.`}function Sk(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${t==="ordinal"?"order":"magnitude"}.`}function Vye(e){return`The ${e} for range marks cannot be an expression`}function Wye(e,t){return`Line mark is for continuous lines and thus cannot be used with ${e&&t?"x2 and y2":e?"x2":"y2"}. We will use the rule mark (line segments) instead.`}function Hye(e,t){return`Specified orient "${e}" overridden with "${t}".`}function jye(e){return`Cannot use the scale property "${e}" with non-color channel.`}function Gye(e){return`Cannot use the relative band size with ${e} scale.`}function Yye(e){return`Using unaggregated domain with raw field has no effect (${wt(e)}).`}function Xye(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function Kye(e){return`Unaggregated domain is currently unsupported for log scale (${wt(e)}).`}function Zye(e){return`Cannot apply size to non-oriented mark "${e}".`}function Qye(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}function Jye(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}function f8(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function d8(e){return`The step for "${e}" is dropped because the ${e==="width"?"x":"y"} is continuous.`}function e1e(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${wt(n)} and ${wt(r)}). Using ${wt(n)}.`}function t1e(e,t,n,r){return`Conflicting ${t.toString()} property "${e.toString()}" (${wt(n)} and ${wt(r)}). Using the union of the two domains.`}function n1e(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}function r1e(e){return`Dropping sort property ${wt(e)} as unioned domains only support boolean or op "count", "min", and "max".`}const h8="Domains that should be unioned has conflicting sort properties. Sort will be set to true.",i1e="Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.",a1e="Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.",s1e="Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.";function o1e(e){return`Cannot stack "${e}" if there is already "${e}2".`}function u1e(e){return`Stack is applied to a non-linear scale (${e}).`}function l1e(e){return`Stacking is applied even though the aggregate function is non-summative ("${e}").`}function Ny(e,t){return`Invalid ${e}: ${wt(t)}.`}function c1e(e){return`Dropping day from datetime ${wt(e)} as day cannot be combined with other units.`}function f1e(e,t){return`${t?"extent ":""}${t&&e?"and ":""}${e?"center ":""}${t&&e?"are ":"is "}not needed when data are aggregated.`}function d1e(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}function h1e(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}function g8(e){return`1D error band does not support ${e}.`}function p8(e){return`Channel ${e} is required for "binned" bin.`}function g1e(e){return`Channel ${e} should not be used with "binned" bin.`}function p1e(e){return`Domain for ${e} is required for threshold scale.`}const v8=eR(JD);let kl=v8;function v1e(e){return kl=e,kl}function m1e(){return kl=v8,kl}function Ck(...e){kl.error(...e)}function ce(...e){kl.warn(...e)}function y1e(...e){kl.debug(...e)}function _l(e){if(e&&we(e)){for(const t of _k)if(le(e,t))return!0}return!1}const m8=["january","february","march","april","may","june","july","august","september","october","november","december"],b1e=m8.map(e=>e.substr(0,3)),y8=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],w1e=y8.map(e=>e.substr(0,3));function x1e(e){if(sk(e)&&(e=+e),yt(e))return e>4&&ce(Ny("quarter",e)),e-1;throw new Error(Ny("quarter",e))}function E1e(e){if(sk(e)&&(e=+e),yt(e))return e-1;{const t=e.toLowerCase(),n=m8.indexOf(t);if(n!==-1)return n;const r=t.substr(0,3),i=b1e.indexOf(r);if(i!==-1)return i;throw new Error(Ny("month",e))}}function F1e(e){if(sk(e)&&(e=+e),yt(e))return e%7;{const t=e.toLowerCase(),n=y8.indexOf(t);if(n!==-1)return n;const r=t.substr(0,3),i=w1e.indexOf(r);if(i!==-1)return i;throw new Error(Ny("day",e))}}function kk(e,t){const n=[];if(t&&e.day!==void 0&&ue(e).length>1&&(ce(c1e(e)),e=qe(e),delete e.day),e.year!==void 0?n.push(e.year):n.push(2012),e.month!==void 0){const r=t?E1e(e.month):e.month;n.push(r)}else if(e.quarter!==void 0){const r=t?x1e(e.quarter):e.quarter;n.push(yt(r)?r*3:`${r}*3`)}else n.push(0);if(e.date!==void 0)n.push(e.date);else if(e.day!==void 0){const r=t?F1e(e.day):e.day;n.push(yt(r)?r+1:`${r}+1`)}else n.push(1);for(const r of["hours","minutes","seconds","milliseconds"]){const i=e[r];n.push(typeof i>"u"?0:i)}return n}function Al(e){const n=kk(e,!0).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function S1e(e){const n=kk(e,!1).join(", ");return e.utc?`utc(${n})`:`datetime(${n})`}function C1e(e){const t=kk(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}const b8={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},_k=ue(b8);function k1e(e){return xe(b8,e)}function Tl(e){return we(e)?e.binned:w8(e)}function w8(e){return e==null?void 0:e.startsWith("binned")}function Ak(e){return e.startsWith("utc")}function _1e(e){return e.substring(3)}const A1e={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Oy(e){return _k.filter(t=>E8(e,t))}function x8(e){const t=Oy(e);return t[t.length-1]}function E8(e,t){const n=e.indexOf(t);return!(n<0||n>0&&t==="seconds"&&e.charAt(n-1)==="i"||e.length>n+3&&t==="day"&&e.charAt(n+3)==="o"||n>0&&t==="year"&&e.charAt(n-1)==="f")}function T1e(e,t,{end:n}={end:!1}){const r=T6(t),i=Ak(e)?"utc":"";function a(u){return u==="quarter"?`(${i}quarter(${r})-1)`:`${i}${u}(${r})`}let s;const o={};for(const u of _k)E8(e,u)&&(o[u]=a(u),s=u);return n&&(o[s]+="+1"),S1e(o)}function F8(e){if(!e)return;const t=Oy(e);return`timeUnitSpecifier(${wt(t)}, ${wt(A1e)})`}function M1e(e,t,n){if(!e)return;const r=F8(e);return`${n||Ak(e)?"utc":"time"}Format(${t}, ${r})`}function An(e){if(!e)return;let t;return Ee(e)?w8(e)?t={unit:e.substring(6),binned:!0}:t={unit:e}:we(e)&&(t={...e,...e.unit?{unit:e.unit}:{}}),Ak(t.unit)&&(t.utc=!0,t.unit=_1e(t.unit)),t}function $1e(e){const{utc:t,...n}=An(e);return n.unit?(t?"utc":"")+ue(n).map(r=>Ut(`${r==="unit"?"":`_${r}_`}${n[r]}`)).join(""):`${t?"utc":""}timeunit${ue(n).map(r=>Ut(`_${r}_${n[r]}`)).join("")}`}function S8(e,t=n=>n){const n=An(e),r=x8(n.unit);if(r&&r!=="day"){const i={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:a,part:s}=C8(r,n.step),o={...i,[s]:+i[s]+a};return`${t(Al(o))} - ${t(Al(i))}`}}const D1e={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function R1e(e){return xe(D1e,e)}function C8(e,t=1){if(R1e(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:t*3};case"week":return{part:"date",step:t*7}}}function P1e(e){return le(e,"param")}function Tk(e){return!!(e!=null&&e.field)&&e.equal!==void 0}function Mk(e){return!!(e!=null&&e.field)&&e.lt!==void 0}function $k(e){return!!(e!=null&&e.field)&&e.lte!==void 0}function Dk(e){return!!(e!=null&&e.field)&&e.gt!==void 0}function Rk(e){return!!(e!=null&&e.field)&&e.gte!==void 0}function Pk(e){if(e!=null&&e.field){if(ee(e.range)&&e.range.length===2)return!0;if(Ae(e.range))return!0}return!1}function Nk(e){return!!(e!=null&&e.field)&&(ee(e.oneOf)||ee(e.in))}function N1e(e){return!!(e!=null&&e.field)&&e.valid!==void 0}function k8(e){return Nk(e)||Tk(e)||Pk(e)||Mk(e)||Dk(e)||$k(e)||Rk(e)}function Ya(e,t){return Qy(e,{timeUnit:t,wrapTime:!0})}function O1e(e,t){return e.map(n=>Ya(n,t))}function _8(e,t=!0){const{field:n}=e,r=An(e.timeUnit),{unit:i,binned:a}=r||{},s=pe(e,{expr:"datum"}),o=i?`time(${a?s:T1e(i,n)})`:s;if(Tk(e))return`${o}===${Ya(e.equal,i)}`;if(Mk(e)){const u=e.lt;return`${o}<${Ya(u,i)}`}else if(Dk(e)){const u=e.gt;return`${o}>${Ya(u,i)}`}else if($k(e)){const u=e.lte;return`${o}<=${Ya(u,i)}`}else if(Rk(e)){const u=e.gte;return`${o}>=${Ya(u,i)}`}else{if(Nk(e))return`indexof([${O1e(e.oneOf,i).join(",")}], ${o}) !== -1`;if(N1e(e))return Iy(o,e.valid);if(Pk(e)){const{range:u}=Wn(e),l=Ae(u)?{signal:`${u.signal}[0]`}:u[0],c=Ae(u)?{signal:`${u.signal}[1]`}:u[1];if(l!==null&&c!==null&&t)return`inrange(${o}, [${Ya(l,i)}, ${Ya(c,i)}])`;const f=[];return l!==null&&f.push(`${o} >= ${Ya(l,i)}`),c!==null&&f.push(`${o} <= ${Ya(c,i)}`),f.length>0?f.join(" && "):"true"}}throw new Error(`Invalid field predicate: ${wt(e)}`)}function Iy(e,t=!0){return t?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function I1e(e){return k8(e)&&e.timeUnit?{...e,timeUnit:An(e.timeUnit)}:e}const Mg={quantitative:"quantitative",ordinal:"ordinal",temporal:"temporal",nominal:"nominal",geojson:"geojson"};function B1e(e){return e==="quantitative"||e==="temporal"}function A8(e){return e==="ordinal"||e==="nominal"}const Ml=Mg.quantitative,Ok=Mg.ordinal,bf=Mg.temporal,Ik=Mg.nominal,wf=Mg.geojson;function L1e(e){if(e)switch(e=e.toLowerCase(),e){case"q":case Ml:return"quantitative";case"t":case bf:return"temporal";case"o":case Ok:return"ordinal";case"n":case Ik:return"nominal";case wf:return"geojson"}}const Hn={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",TIME:"time",UTC:"utc",POINT:"point",BAND:"band"},Bk={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function z1e(e,t){const n=Bk[e],r=Bk[t];return n===r||n==="ordinal-position"&&r==="time"||r==="ordinal-position"&&n==="time"}const q1e={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function T8(e){return q1e[e]}const M8=new Set(["linear","log","pow","sqrt","symlog"]),$8=new Set([...M8,"time","utc"]);function D8(e){return M8.has(e)}const R8=new Set(["quantile","quantize","threshold"]),U1e=new Set([...$8,...R8,"sequential","identity"]),V1e=new Set(["ordinal","bin-ordinal","point","band"]);function Tn(e){return V1e.has(e)}function aa(e){return U1e.has(e)}function Xa(e){return $8.has(e)}function xf(e){return R8.has(e)}const W1e={pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,tickBandPaddingInner:.25,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:4,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0,framesPerSecond:2,animationDuration:5};function H1e(e){return!Ee(e)&&le(e,"name")}function P8(e){return le(e,"param")}function j1e(e){return le(e,"unionWith")}function G1e(e){return we(e)&&"field"in e}const Y1e={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},{type:bCe,domain:wCe,range:xCe,rangeMax:ECe,rangeMin:FCe,scheme:SCe,...X1e}=Y1e,K1e=ue(X1e);function Lk(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return Xa(e)||e==="band"||e==="point";case"padding":case"rangeMin":case"rangeMax":return Xa(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return e==="band";case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return Xa(e);case"nice":return Xa(e)||e==="quantize"||e==="threshold";case"exponent":return e==="pow";case"base":return e==="log";case"constant":return e==="symlog";case"zero":return aa(e)&&!rt(["log","time","utc","threshold","quantile"],e)}}function N8(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return yf(e)?void 0:jye(t);case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}function Z1e(e,t){return rt([Ok,Ik],t)?e===void 0||Tn(e):t===bf?rt([Hn.TIME,Hn.UTC,void 0],e):t===Ml?D8(e)||xf(e)||e===void 0:!0}function Q1e(e,t,n=!1){if(!ja(e))return!1;switch(e){case Bt:case _n:case Ko:case vf:case ki:case ea:return Xa(t)||t==="band"?!0:t==="point"?!n:!1;case Zo:return rt(["linear","band"],t);case Us:case eu:case Vs:case Qo:case Jo:case xl:return Xa(t)||xf(t)||rt(["band","point","ordinal"],t);case Ur:case Va:case Wa:return t!=="band";case tu:case Vr:return t==="ordinal"||xf(t)}}function J1e(e){return we(e)&&"value"in e}const Ar={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},O8=Ar.arc,By=Ar.area,Ly=Ar.bar,ebe=Ar.image,zy=Ar.line,qy=Ar.point,tbe=Ar.rect,Uy=Ar.rule,I8=Ar.text,zk=Ar.tick,nbe=Ar.trail,qk=Ar.circle,Uk=Ar.square,B8=Ar.geoshape;function au(e){return["line","area","trail"].includes(e)}function $g(e){return["rect","bar","image","arc","tick"].includes(e)}const rbe=new Set(ue(Ar));function Ka(e){return le(e,"type")}const ibe=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit"],abe=["fill","fillOpacity"],sbe=[...ibe,...abe],L8=ue({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),Vk=["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],obe={area:["line","point"],bar:Vk,rect:Vk,line:["point"],tick:["bandSize","thickness",...Vk]},ube={color:"#4c78a8",invalid:"break-paths-show-path-domains",timeUnitBandSize:1},z8=ue({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function $l(e){return le(e,"band")}const lbe={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},Wk={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},cbe={...Wk,binSpacing:1},fbe={...Wk,thickness:1};function dbe(e){return Ka(e)?e.type:e}function q8(e,{isPath:t}){return e===void 0||e==="break-paths-show-path-domains"?t?"break-paths-show-domains":"filter":e===null?"show":e}function Hk({markDef:e,config:t,scaleChannel:n,scaleType:r,isCountAggregate:i}){var o,u;if(!r||!aa(r)||i)return"always-valid";const a=q8(Ct("invalid",e,t),{isPath:au(e.type)});return((u=(o=t.scale)==null?void 0:o.invalid)==null?void 0:u[n])!==void 0?"show":a}function hbe(e){return e==="break-paths-filter-domains"||e==="break-paths-show-domains"}function U8({scaleName:e,scale:t,mode:n}){const r=`domain('${e}')`;if(!t||!e)return;const i=`${r}[0]`,a=`peek(${r})`,s=t.domainHasZero();return s==="definitely"?{scale:e,value:0}:s==="maybe"?{signal:`scale('${e}', inrange(0, ${r}) ? 0 : ${n==="zeroOrMin"?i:a})`}:{signal:`scale('${e}', ${n==="zeroOrMin"?i:a})`}}function V8({scaleChannel:e,channelDef:t,scale:n,scaleName:r,markDef:i,config:a}){var c;const s=n==null?void 0:n.get("type"),o=ua(t),u=Dy(o==null?void 0:o.aggregate),l=Hk({scaleChannel:e,markDef:i,config:a,scaleType:s,isCountAggregate:u});if(o&&l==="show"){const f=((c=a.scale.invalid)==null?void 0:c[e])??"zero-or-min";return{test:Iy(pe(o,{expr:"datum"}),!1),...gbe(f,n,r)}}}function gbe(e,t,n){if(J1e(e)){const{value:r}=e;return Ae(r)?{signal:r.signal}:{value:r}}return U8({scale:t,scaleName:n,mode:"zeroOrMin"})}function jk(e){const{channel:t,channelDef:n,markDef:r,scale:i,scaleName:a,config:s}=e,o=Fl(t),u=Gk(e),l=V8({scaleChannel:o,channelDef:n,scale:i,scaleName:a,markDef:r,config:s});return l!==void 0?[l,u]:u}function pbe(e){const{datum:t}=e;return _l(t)?Al(t):`${wt(t)}`}function Dl(e,t,n,r){const i={};if(t&&(i.scale=t),Za(e)){const{datum:a}=e;_l(a)?i.signal=Al(a):Ae(a)?i.signal=a.signal:Tg(a)?i.signal=a.expr:i.value=a}else i.field=pe(e,n);if(r){const{offset:a,band:s}=r;a&&(i.offset=a),s&&(i.band=s)}return i}function Vy({scaleName:e,fieldOrDatumDef:t,fieldOrDatumDef2:n,offset:r,startSuffix:i,endSuffix:a="end",bandPosition:s=.5}){const o=!Ae(s)&&0<s&&s<1?"datum":void 0,u=pe(t,{expr:o,suffix:i}),l=n!==void 0?pe(n,{expr:o}):pe(t,{suffix:a,expr:o}),c={};if(s===0||s===1){c.scale=e;const f=s===0?u:l;c.field=f}else{const f=Ae(s)?`(1-${s.signal}) * ${u} + ${s.signal} * ${l}`:`${1-s} * ${u} + ${s} * ${l}`;c.signal=`scale("${e}", ${f})`}return r&&(c.offset=r),c}function vbe({scaleName:e,fieldDef:t}){const n=pe(t,{expr:"datum"}),r=pe(t,{expr:"datum",suffix:"end"});return`abs(scale("${e}", ${r}) - scale("${e}", ${n}))`}function Gk({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:a,scale:s,stack:o,offset:u,defaultRef:l,bandPosition:c}){if(t){if(He(t)){const f=s==null?void 0:s.get("type");if(Tr(t)){c??(c=su({fieldDef:t,fieldDef2:n,markDef:r,config:i}));const{bin:d,timeUnit:h,type:g}=t;if($t(d)||c&&h&&g===bf)return o!=null&&o.impute?Dl(t,a,{binSuffix:"mid"},{offset:u}):c&&!Tn(f)?Vy({scaleName:a,fieldOrDatumDef:t,bandPosition:c,offset:u}):Dl(t,a,Ig(t,e)?{binSuffix:"range"}:{},{offset:u});if(Vn(d)){if(fe(n))return Vy({scaleName:a,fieldOrDatumDef:t,fieldOrDatumDef2:n,bandPosition:c,offset:u});ce(p8(e===Bt?Ji:Ua))}}return Dl(t,a,Tn(f)?{binSuffix:"range"}:{},{offset:u,band:f==="band"?c??t.bandPosition??.5:void 0})}else if(oa(t)){const f=t.value,d=u?{offset:u}:{};return{...Dg(e,f),...d}}}return Ke(l)&&(l=l()),l&&{...l,...u?{offset:u}:{}}}function Dg(e,t){return rt(["x","x2"],e)&&t==="width"?{field:{group:"width"}}:rt(["y","y2"],e)&&t==="height"?{field:{group:"height"}}:Ot(t)}function Rl(e){return e&&e!=="number"&&e!=="time"}function W8(e,t,n){return`${e}(${t}${n?`, ${wt(n)}`:""})`}const mbe=" – ";function Yk({fieldOrDatumDef:e,format:t,formatType:n,expr:r,normalizeStack:i,config:a}){var u,l;if(Rl(n))return sa({fieldOrDatumDef:e,format:t,formatType:n,expr:r,config:a});const s=H8(e,r,i),o=Ef(e);if(t===void 0&&n===void 0&&a.customFormatTypes){if(o==="quantitative"){if(i&&a.normalizedNumberFormatType)return sa({fieldOrDatumDef:e,format:a.normalizedNumberFormat,formatType:a.normalizedNumberFormatType,expr:r,config:a});if(a.numberFormatType)return sa({fieldOrDatumDef:e,format:a.numberFormat,formatType:a.numberFormatType,expr:r,config:a})}if(o==="temporal"&&a.timeFormatType&&fe(e)&&e.timeUnit===void 0)return sa({fieldOrDatumDef:e,format:a.timeFormat,formatType:a.timeFormatType,expr:r,config:a})}if(kf(e)){const c=bbe({field:s,timeUnit:fe(e)?(u=An(e.timeUnit))==null?void 0:u.unit:void 0,format:t,formatType:a.timeFormatType,rawTimeFormat:a.timeFormat,isUTCScale:Pl(e)&&((l=e.scale)==null?void 0:l.type)===Hn.UTC});return c?{signal:c}:void 0}if(t=Xk({type:o,specifiedFormat:t,config:a,normalizeStack:i}),fe(e)&&$t(e.bin)){const c=pe(e,{expr:r,binSuffix:"end"});return{signal:Rg(s,c,t,n,a)}}else return t||Ef(e)==="quantitative"?{signal:`${Y8(s,t)}`}:{signal:`isValid(${s}) ? ${s} : ""+${s}`}}function H8(e,t,n){return fe(e)?n?`${pe(e,{expr:t,suffix:"end"})}-${pe(e,{expr:t,suffix:"start"})}`:pe(e,{expr:t}):pbe(e)}function sa({fieldOrDatumDef:e,format:t,formatType:n,expr:r,normalizeStack:i,config:a,field:s}){if(s??(s=H8(e,r,i)),s!=="datum.value"&&fe(e)&&$t(e.bin)){const o=pe(e,{expr:r,binSuffix:"end"});return{signal:Rg(s,o,t,n,a)}}return{signal:W8(n,s,t)}}function j8(e,t,n,r,i,a){var s;if(!(Ee(r)&&Rl(r))&&!(n===void 0&&r===void 0&&i.customFormatTypes&&Ef(e)==="quantitative"&&(i.normalizedNumberFormatType&&Ff(e)&&e.stack==="normalize"||i.numberFormatType))){if(Ff(e)&&e.stack==="normalize"&&i.normalizedNumberFormat)return Xk({type:"quantitative",config:i,normalizeStack:!0});if(kf(e)){const o=fe(e)?(s=An(e.timeUnit))==null?void 0:s.unit:void 0;return o===void 0&&i.customFormatTypes&&i.timeFormatType?void 0:ybe({specifiedFormat:n,timeUnit:o,config:i,omitTimeFormatConfig:a})}return Xk({type:t,specifiedFormat:n,config:i})}}function G8(e,t,n){var r;if(e&&(Ae(e)||e==="number"||e==="time"))return e;if(kf(t)&&n!=="time"&&n!=="utc")return fe(t)&&((r=An(t==null?void 0:t.timeUnit))!=null&&r.utc)?"utc":"time"}function Xk({type:e,specifiedFormat:t,config:n,normalizeStack:r}){if(Ee(t))return t;if(e===Ml)return r?n.normalizedNumberFormat:n.numberFormat}function ybe({specifiedFormat:e,timeUnit:t,config:n,omitTimeFormatConfig:r}){return e||(t?{signal:F8(t)}:r?void 0:n.timeFormat)}function Y8(e,t){return`format(${e}, "${t||""}")`}function X8(e,t,n,r){return Rl(n)?W8(n,e,t):Y8(e,(Ee(t)?t:void 0)??r.numberFormat)}function Rg(e,t,n,r,i){if(n===void 0&&r===void 0&&i.customFormatTypes&&i.numberFormatType)return Rg(e,t,i.numberFormat,i.numberFormatType,i);const a=X8(e,n,r,i),s=X8(t,n,r,i);return`${Iy(e,!1)} ? "null" : ${a} + "${mbe}" + ${s}`}function bbe({field:e,timeUnit:t,format:n,formatType:r,rawTimeFormat:i,isUTCScale:a}){return!t||n?!t&&r?`${r}(${e}, ${wt(n)})`:(n=Ee(n)?n:i,`${a?"utc":"time"}Format(${e}, ${wt(n)})`):M1e(t,e,a)}const Wy="min",wbe={x:1,y:1,color:1,fill:1,stroke:1,strokeWidth:1,size:1,shape:1,fillOpacity:1,strokeOpacity:1,opacity:1,text:1};function K8(e){return xe(wbe,e)}function xbe(e){return le(e,"encoding")}function Gs(e){return e&&(e.op==="count"||le(e,"field"))}function Z8(e){return e&&ee(e)}function Pg(e){return le(e,"row")||le(e,"column")}function Kk(e){return le(e,"header")}function Hy(e){return le(e,"facet")}function Ebe(e){return le(e,"param")}function Fbe(e){return!Ee(e)&&le(e,"repeat")}function Q8(e){const{field:t,timeUnit:n,bin:r,aggregate:i}=e;return{...n?{timeUnit:n}:{},...r?{bin:r}:{},...i?{aggregate:i}:{},field:t}}function Zk(e){return le(e,"sort")}function su({fieldDef:e,fieldDef2:t,markDef:n,config:r}){if(He(e)&&e.bandPosition!==void 0)return e.bandPosition;if(fe(e)){const{timeUnit:i,bin:a}=e;if(i&&!t)return Ga("timeUnitBandPosition",n,r);if($t(a))return .5}}function J8({channel:e,fieldDef:t,fieldDef2:n,markDef:r,config:i,scaleType:a,useVlSizeChannel:s}){var l,c,f;const o=Wr(e),u=Ct(s?"size":o,r,i,{vgChannel:o});if(u!==void 0)return u;if(fe(t)){const{timeUnit:d,bin:h}=t;if(d&&!n)return{band:Ga("timeUnitBandSize",r,i)};if($t(h)&&!Tn(a))return{band:1}}if($g(r.type))return a?Tn(a)?((l=i[r.type])==null?void 0:l.discreteBandSize)||{band:1}:(c=i[r.type])==null?void 0:c.continuousBandSize:(f=i[r.type])==null?void 0:f.discreteBandSize}function e9(e,t,n,r){return $t(e.bin)||e.timeUnit&&Tr(e)&&e.type==="temporal"?su({fieldDef:e,fieldDef2:t,markDef:n,config:r})!==void 0:!1}function t9(e){return le(e,"sort")&&!le(e,"field")}function Ng(e){return le(e,"condition")}function jy(e){const t=e==null?void 0:e.condition;return!!t&&!ee(t)&&fe(t)}function Og(e){const t=e==null?void 0:e.condition;return!!t&&!ee(t)&&He(t)}function Sbe(e){const t=e==null?void 0:e.condition;return!!t&&(ee(t)||oa(t))}function fe(e){return le(e,"field")||(e==null?void 0:e.aggregate)==="count"}function Ef(e){return e==null?void 0:e.type}function Za(e){return le(e,"datum")}function ou(e){return Tr(e)&&!Yy(e)||Gy(e)}function n9(e){return Tr(e)&&e.type==="quantitative"&&!e.bin||Gy(e)}function Gy(e){return Za(e)&&yt(e.datum)}function He(e){return fe(e)||Za(e)}function Tr(e){return e&&(le(e,"field")||e.aggregate==="count")&&le(e,"type")}function oa(e){return le(e,"value")}function Pl(e){return le(e,"scale")||le(e,"sort")}function Ff(e){return le(e,"axis")||le(e,"stack")||le(e,"impute")}function r9(e){return le(e,"legend")}function i9(e){return le(e,"format")||le(e,"formatType")}function Cbe(e){return Si(e,["legend","axis","header","scale"])}function kbe(e){return le(e,"op")}function pe(e,t={}){let n=e.field;const r=t.prefix;let i=t.suffix,a="";if(Abe(e))n=Rme("count");else{let s;if(!t.nofn)if(kbe(e))s=e.op;else{const{bin:o,aggregate:u,timeUnit:l}=e;$t(o)?(s=V6(o),i=(t.binSuffix??"")+(t.suffix??"")):u?ru(u)?(a=`["${n}"]`,n=`argmax_${u.argmax}`):Hs(u)?(a=`["${n}"]`,n=`argmin_${u.argmin}`):s=String(u):l&&!Tl(l)&&(s=$1e(l),i=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}s&&(n=n?`${s}_${n}`:s)}return i&&(n=`${n}_${i}`),r&&(n=`${r}_${n}`),t.forAs?Sg(n):t.expr?Tme(n,t.expr)+a:Qi(n)+a}function Yy(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return fe(e)&&!!e.bin;case"temporal":return!1}throw new Error(l8(e.type))}function _be(e){var t;return Pl(e)&&xf((t=e.scale)==null?void 0:t.type)}function Abe(e){return e.aggregate==="count"}function Tbe(e,t){var s;const{field:n,bin:r,timeUnit:i,aggregate:a}=e;if(a==="count")return t.countTitle;if($t(r))return`${n} (binned)`;if(i&&!Tl(i)){const o=(s=An(i))==null?void 0:s.unit;if(o)return`${n} (${Oy(o).join("-")})`}else if(a)return ru(a)?`${n} for max ${a.argmax}`:Hs(a)?`${n} for min ${a.argmin}`:`${Sy(a)} of ${n}`;return n}function Mbe(e){const{aggregate:t,bin:n,timeUnit:r,field:i}=e;if(ru(t))return`${i} for argmax(${t.argmax})`;if(Hs(t))return`${i} for argmin(${t.argmin})`;const a=r&&!Tl(r)?An(r):void 0,s=t||(a==null?void 0:a.unit)||(a==null?void 0:a.maxbins)&&"timeunit"||$t(n)&&"bin";return s?`${s.toUpperCase()}(${i})`:i}const a9=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return Mbe(e);default:return Tbe(e,t)}};let s9=a9;function o9(e){s9=e}function $be(){o9(a9)}function Sf(e,t,{allowDisabling:n,includeDefault:r=!0}){var o;const i=(o=Qk(e))==null?void 0:o.title;if(!fe(e))return i??e.title;const a=e,s=r?Jk(a,t):void 0;return n?en(i,a.title,s):i??a.title??s}function Qk(e){if(Ff(e)&&e.axis)return e.axis;if(r9(e)&&e.legend)return e.legend;if(Kk(e)&&e.header)return e.header}function Jk(e,t){return s9(e,t)}function Xy(e){if(i9(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}else{const t=Qk(e)??{},{format:n,formatType:r}=t;return{format:n,formatType:r}}}function Dbe(e,t){var a;switch(t){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Zk(e)&&ee(e.sort))return"ordinal";const{aggregate:n,bin:r,timeUnit:i}=e;if(i)return"temporal";if(r||n&&!ru(n)&&!Hs(n))return"quantitative";if(Pl(e)&&((a=e.scale)!=null&&a.type))switch(Bk[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}function ua(e){if(fe(e))return e;if(jy(e))return e.condition}function hn(e){if(He(e))return e;if(Og(e))return e.condition}function u9(e,t,n,r={}){if(Ee(e)||yt(e)||mc(e)){const i=Ee(e)?"string":yt(e)?"number":"boolean";return ce(Pye(t,i,e)),{value:e}}return He(e)?Ky(e,t,n,r):Og(e)?{...e,condition:Ky(e.condition,t,n,r)}:e}function Ky(e,t,n,r){if(i9(e)){const{format:i,formatType:a,...s}=e;if(Rl(a)&&!n.customFormatTypes)return ce(u8(t)),Ky(s,t,n,r)}else{const i=Ff(e)?"axis":r9(e)?"legend":Kk(e)?"header":null;if(i&&e[i]){const{format:a,formatType:s,...o}=e[i];if(Rl(s)&&!n.customFormatTypes)return ce(u8(t)),Ky({...e,[i]:o},t,n,r)}}return fe(e)?e_(e,t,r):Rbe(e)}function Rbe(e){let t=e.type;if(t)return e;const{datum:n}=e;return t=yt(n)?"quantitative":Ee(n)?"nominal":_l(n)?"temporal":void 0,{...e,type:t}}function e_(e,t,{compositeMark:n=!1}={}){const{aggregate:r,timeUnit:i,bin:a,field:s}=e,o={...e};if(!n&&r&&!mk(r)&&!ru(r)&&!Hs(r)&&(ce(Oye(r)),delete o.aggregate),i&&(o.timeUnit=An(i)),s&&(o.field=`${s}`),$t(a)&&(o.bin=Zy(a,t)),Vn(a)&&!Qt(t)&&ce(g1e(t)),Tr(o)){const{type:u}=o,l=L1e(u);u!==l&&(o.type=l),u!=="quantitative"&&Dy(r)&&(ce(Nye(u,r)),o.type="quantitative")}else if(!I6(t)){const u=Dbe(o,t);o.type=u}if(Tr(o)){const{compatible:u,warning:l}=Pbe(o,t)||{};u===!1&&ce(l)}if(Zk(o)&&Ee(o.sort)){const{sort:u}=o;if(K8(u))return{...o,sort:{encoding:u}};const l=u.substring(1);if(u.charAt(0)==="-"&&K8(l))return{...o,sort:{encoding:l,order:"descending"}}}if(Kk(o)){const{header:u}=o;if(u){const{orient:l,...c}=u;if(l)return{...o,header:{...c,labelOrient:u.labelOrient||l,titleOrient:u.titleOrient||l}}}}return o}function Zy(e,t){return mc(e)?{maxbins:W6(t)}:e==="binned"?{binned:!0}:!e.maxbins&&!e.step?{...e,maxbins:W6(t)}:e}const Cf={compatible:!0};function Pbe(e,t){const n=e.type;if(n==="geojson"&&t!=="shape")return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Bs:case Ls:case ky:return Yy(e)?Cf:{compatible:!1,warning:zye(t)};case Bt:case _n:case Ko:case vf:case Ur:case Va:case Wa:case kg:case _g:case _y:case El:case Ay:case Ty:case xl:case ki:case ea:case My:return Cf;case na:case _i:case ta:case ra:return n!==Ml?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:Cf;case Vs:case Qo:case Jo:case eu:case Us:case qs:case zs:case Ji:case Ua:case Zo:return n==="nominal"&&!e.sort?{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`}:Cf;case Vr:case tu:return!Yy(e)&&!_be(e)?{compatible:!1,warning:qye(t)}:Cf;case mf:return e.type==="nominal"&&!("sort"in e)?{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}:Cf}}function kf(e){const{formatType:t}=Xy(e);return t==="time"||!t&&Nbe(e)}function Nbe(e){return e&&(e.type==="temporal"||fe(e)&&!!e.timeUnit)}function Qy(e,{timeUnit:t,type:n,wrapTime:r,undefinedIfExprNotRequired:i}){var u;const a=t&&((u=An(t))==null?void 0:u.unit);let s=a||n==="temporal",o;return Tg(e)?o=e.expr:Ae(e)?o=e.signal:_l(e)?(s=!0,o=Al(e)):(Ee(e)||yt(e))&&s&&(o=`datetime(${wt(e)})`,k1e(a)&&(yt(e)&&e<1e4||Ee(e)&&isNaN(Date.parse(e)))&&(o=Al({[a]:e}))),o?r&&s?`time(${o})`:o:i?void 0:wt(e)}function l9(e,t){const{type:n}=e;return t.map(r=>{const i=fe(e)&&!Tl(e.timeUnit)?e.timeUnit:void 0,a=Qy(r,{timeUnit:i,type:n,undefinedIfExprNotRequired:!0});return a!==void 0?{signal:a}:r})}function Ig(e,t){return $t(e.bin)?ja(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const c9={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Bg(e){return e==null?void 0:e.condition}const f9=["domain","grid","labels","ticks","title"],Obe={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},d9={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},Ibe={...d9,style:1,labelExpr:1,encoding:1};function h9(e){return xe(Ibe,e)}const g9=ue({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function Ys(e){return le(e,"mark")}class Jy{constructor(t,n){re(this,"name");re(this,"run");this.name=t,this.run=n}hasMatchingType(t){return Ys(t)?dbe(t.mark)===this.name:!1}}function Nl(e,t){const n=e==null?void 0:e[t];return n?ee(n)?Fg(n,r=>!!r.field):fe(n)||jy(n):!1}function p9(e,t){const n=e==null?void 0:e[t];return n?ee(n)?Fg(n,r=>!!r.field):fe(n)||Za(n)||Og(n):!1}function v9(e,t){if(Qt(t)){const n=e[t];if((fe(n)||Za(n))&&(A8(n.type)||fe(n)&&n.timeUnit)){const r=ck(t);return p9(e,r)}}return!1}function m9(e){return Fg(Ime,t=>{if(Nl(e,t)){const n=e[t];if(ee(n))return Fg(n,r=>!!r.aggregate);{const r=ua(n);return r&&!!r.aggregate}}return!1})}function y9(e,t){const n=[],r=[],i=[],a=[],s={};return t_(e,(o,u)=>{if(fe(o)){const{field:l,aggregate:c,bin:f,timeUnit:d,...h}=o;if(c||d||f){const g=Qk(o),p=g==null?void 0:g.title;let v=pe(o,{forAs:!0});const m={...p?[]:{title:Sf(o,t,{allowDisabling:!0})},...h,field:v};if(c){let y;if(ru(c)?(y="argmax",v=pe({op:"argmax",field:c.argmax},{forAs:!0}),m.field=`${v}.${l}`):Hs(c)?(y="argmin",v=pe({op:"argmin",field:c.argmin},{forAs:!0}),m.field=`${v}.${l}`):c!=="boxplot"&&c!=="errorbar"&&c!=="errorband"&&(y=c),y){const b={op:y,as:v};l&&(b.field=l),a.push(b)}}else if(n.push(v),Tr(o)&&$t(f)){if(r.push({bin:f,field:l,as:v}),n.push(pe(o,{binSuffix:"end"})),Ig(o,u)&&n.push(pe(o,{binSuffix:"range"})),Qt(u)){const y={field:`${v}_end`};s[`${u}2`]=y}m.bin="binned",I6(u)||(m.type=Ml)}else if(d&&!Tl(d)){i.push({timeUnit:d,field:l,as:v});const y=Tr(o)&&o.type!==bf&&"time";y&&(u===kg||u===El?m.formatType=y:Yme(u)?m.legend={formatType:y,...m.legend}:Qt(u)&&(m.axis={formatType:y,...m.axis}))}s[u]=m}else n.push(l),s[u]=e[u]}else s[u]=e[u]}),{bins:r,timeUnits:i,aggregate:a,groupby:n,encoding:s}}function Bbe(e,t,n){const r=Kme(t,n);if(r){if(r==="binned"){const i=e[t===Ji?Bt:_n];return!!(fe(i)&&fe(e[t])&&Vn(i.bin))}}else return!1;return!0}function Lbe(e,t,n,r){const i={};for(const a of ue(e))O6(a)||ce(Lye(a));for(let a of Vme){if(!e[a])continue;const s=e[a];if(Ag(a)){const o=Ume(a),u=i[o];if(fe(u)&&B1e(u.type)&&fe(s)&&!u.timeUnit){ce(Rye(o));continue}}if(a==="angle"&&t==="arc"&&!e.theta&&(ce(Dye),a=ki),!Bbe(e,a,t)){ce(Py(a,t));continue}if(a===Us&&t==="line"){const o=ua(e[a]);if(o!=null&&o.aggregate){ce(Bye);continue}}if(a===Ur&&(n?"fill"in e:"stroke"in e)){ce(c8("encoding",{fill:"fill"in e,stroke:"stroke"in e}));continue}if(a===_g||a===mf&&!ee(s)&&!oa(s)||a===El&&ee(s)){if(s){if(a===mf){const o=e[a];if(t9(o)){i[a]=o;continue}}i[a]=be(s).reduce((o,u)=>(fe(u)?o.push(e_(u,a)):ce(Fk(u,a)),o),[])}}else{if(a===El&&s===null)i[a]=null;else if(!fe(s)&&!Za(s)&&!oa(s)&&!Ng(s)&&!Ae(s)){ce(Fk(s,a));continue}i[a]=u9(s,a,r)}}return i}function e1(e,t){const n={};for(const r of ue(e)){const i=u9(e[r],r,t,{compositeMark:!0});n[r]=i}return n}function zbe(e){const t=[];for(const n of ue(e))if(Nl(e,n)){const r=e[n],i=be(r);for(const a of i)fe(a)?t.push(a):jy(a)&&t.push(a.condition)}return t}function t_(e,t,n){if(e)for(const r of ue(e)){const i=e[r];if(ee(i))for(const a of i)t.call(n,a,r);else t.call(n,i,r)}}function qbe(e,t,n,r){return e?ue(e).reduce((i,a)=>{const s=e[a];return ee(s)?s.reduce((o,u)=>t.call(r,o,u,a),i):t.call(r,i,s,a)},n):n}function b9(e,t){return ue(t).reduce((n,r)=>{switch(r){case Bt:case _n:case Ay:case My:case Ty:case Ji:case Ua:case Ko:case vf:case ki:case qs:case ea:case zs:case Zo:case ta:case na:case ra:case _i:case kg:case Vr:case xl:case El:return n;case mf:if(e==="line"||e==="trail")return n;case _g:case _y:{const i=t[r];if(ee(i)||fe(i))for(const a of be(i))a.aggregate||n.push(pe(a,{}));return n}case Us:if(e==="trail")return n;case Ur:case Va:case Wa:case Vs:case Qo:case Jo:case tu:case eu:{const i=ua(t[r]);return i&&!i.aggregate&&n.push(pe(i,{})),n}}},[])}function Ube(e){const{tooltip:t,...n}=e;if(!t)return{filteredEncoding:n};let r,i;if(ee(t)){for(const a of t)a.aggregate?(r||(r=[]),r.push(a)):(i||(i=[]),i.push(a));r&&(n.tooltip=r)}else t.aggregate?n.tooltip=t:i=t;return ee(i)&&i.length===1&&(i=i[0]),{customTooltipWithoutAggregatedField:i,filteredEncoding:n}}function n_(e,t,n,r=!0){if("tooltip"in n)return{tooltip:n.tooltip};const i=e.map(({fieldPrefix:s,titlePrefix:o})=>{const u=r?` of ${r_(t)}`:"";return{field:s+t.field,type:t.type,title:Ae(o)?{signal:`${o}"${escape(u)}"`}:o+u}}),a=zbe(n).map(Cbe);return{tooltip:[...i,...Is(a,at)]}}function r_(e){const{title:t,field:n}=e;return en(t,n)}function i_(e,t,n,r,i){const{scale:a,axis:s}=n;return({partName:o,mark:u,positionPrefix:l,endPositionPrefix:c=void 0,extraEncoding:f={}})=>{const d=r_(n);return w9(e,o,i,{mark:u,encoding:{[t]:{field:`${l}_${n.field}`,type:n.type,...d!==void 0?{title:d}:{},...a!==void 0?{scale:a}:{},...s!==void 0?{axis:s}:{}},...Ee(c)?{[`${t}2`]:{field:`${c}_${n.field}`}}:{},...r,...f}})}}function w9(e,t,n,r){const{clip:i,color:a,opacity:s}=e,o=e.type;return e[t]||e[t]===void 0&&n[t]?[{...r,mark:{...n[t],...i?{clip:i}:{},...a?{color:a}:{},...s?{opacity:s}:{},...Ka(r.mark)?r.mark:{type:r.mark},style:`${o}-${String(t)}`,...mc(e[t])?{}:e[t]}}]:[]}function x9(e,t,n){const{encoding:r}=e,i=t==="vertical"?"y":"x",a=r[i],s=r[`${i}2`],o=r[`${i}Error`],u=r[`${i}Error2`];return{continuousAxisChannelDef:t1(a,n),continuousAxisChannelDef2:t1(s,n),continuousAxisChannelDefError:t1(o,n),continuousAxisChannelDefError2:t1(u,n),continuousAxis:i}}function t1(e,t){if(e!=null&&e.aggregate){const{aggregate:n,...r}=e;return n!==t&&ce(h1e(n,t)),r}else return e}function E9(e,t){const{mark:n,encoding:r}=e,{x:i,y:a}=r;if(Ka(n)&&n.orient)return n.orient;if(ou(i)){if(ou(a)){const s=fe(i)&&i.aggregate,o=fe(a)&&a.aggregate;if(!s&&o===t)return"vertical";if(!o&&s===t)return"horizontal";if(s===t&&o===t)throw new Error("Both x and y cannot have aggregate");return kf(a)&&!kf(i)?"horizontal":"vertical"}return"horizontal"}else{if(ou(a))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}}const n1="boxplot",Vbe=["box","median","outliers","rule","ticks"],Wbe=new Jy(n1,S9);function F9(e){return yt(e)?"tukey":e}function S9(e,{config:t}){e={...e,encoding:e1(e.encoding,t)};const{mark:n,encoding:r,params:i,projection:a,...s}=e,o=Ka(n)?n:{type:n};i&&ce(a8("boxplot"));const u=o.extent??t.boxplot.extent,l=Ct("size",o,t),c=o.invalid,f=F9(u),{bins:d,timeUnits:h,transform:g,continuousAxisChannelDef:p,continuousAxis:v,groupby:m,aggregate:y,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:E,customTooltipWithoutAggregatedField:F}=Hbe(e,u,t),x=Sg(p.field),{color:C,size:S,..._}=b,k=Qe=>i_(o,v,p,Qe,t.boxplot),T=k(_),A=k(b),$=(we(t.boxplot.box)?t.boxplot.box.color:t.mark.color)||"#4c78a8",M=k({..._,...S?{size:S}:{},color:{condition:{test:`${St(`lower_box_${p.field}`)} >= ${St(`upper_box_${p.field}`)}`,...C||{value:$}}}}),D=n_([{fieldPrefix:f==="min-max"?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:f==="min-max"?"lower_whisker_":"min_",titlePrefix:"Min"}],p,b),P={type:"tick",color:"black",opacity:1,orient:w,invalid:c,aria:!1},N=f==="min-max"?D:n_([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],p,b),O=[...T({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:N}),...T({partName:"rule",mark:{type:"rule",invalid:c,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:N}),...T({partName:"ticks",mark:P,positionPrefix:"lower_whisker",extraEncoding:N}),...T({partName:"ticks",mark:P,positionPrefix:"upper_whisker",extraEncoding:N})],q=[...f!=="tukey"?O:[],...A({partName:"box",mark:{type:"bar",...l?{size:l}:{},orient:E,invalid:c,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:D}),...M({partName:"median",mark:{type:"tick",invalid:c,...we(t.boxplot.median)&&t.boxplot.median.color?{color:t.boxplot.median.color}:{},...l?{size:l}:{},orient:w,aria:!1},positionPrefix:"mid_box",extraEncoding:D})];if(f==="min-max")return{...s,transform:(s.transform??[]).concat(g),layer:q};const z=St(`lower_box_${p.field}`),W=St(`upper_box_${p.field}`),Y=`(${W} - ${z})`,J=`${z} - ${u} * ${Y}`,X=`${W} + ${u} * ${Y}`,te=St(p.field),ie={joinaggregate:C9(p.field),groupby:m},se={transform:[{filter:`(${J} <= ${te}) && (${te} <= ${X})`},{aggregate:[{op:"min",field:p.field,as:`lower_whisker_${x}`},{op:"max",field:p.field,as:`upper_whisker_${x}`},{op:"min",field:`lower_box_${p.field}`,as:`lower_box_${x}`},{op:"max",field:`upper_box_${p.field}`,as:`upper_box_${x}`},...y],groupby:m}],layer:O},{tooltip:B,...I}=_,{scale:U,axis:L}=p,ae=r_(p),de=w9(o,"outliers",t.boxplot,{transform:[{filter:`(${te} < ${J}) || (${te} > ${X})`}],mark:"point",encoding:{[v]:{field:p.field,type:p.type,...ae!==void 0?{title:ae}:{},...U!==void 0?{scale:U}:{},...L!==void 0?{axis:L}:{}},...I,...C?{color:C}:{},...F?{tooltip:F}:{}}})[0];let Ce;const Ye=[...d,...h,ie];return de?Ce={transform:Ye,layer:[de,se]}:(Ce=se,Ce.transform.unshift(...Ye)),{...s,layer:[Ce,{transform:g,layer:q}]}}function C9(e){const t=Sg(e);return[{op:"q1",field:e,as:`lower_box_${t}`},{op:"q3",field:e,as:`upper_box_${t}`}]}function Hbe(e,t,n){const r=E9(e,n1),{continuousAxisChannelDef:i,continuousAxis:a}=x9(e,r,n1),s=i.field,o=Sg(s),u=F9(t),l=[...C9(s),{op:"median",field:s,as:`mid_box_${o}`},{op:"min",field:s,as:(u==="min-max"?"lower_whisker_":"min_")+o},{op:"max",field:s,as:(u==="min-max"?"upper_whisker_":"max_")+o}],c=u==="min-max"||u==="tukey"?[]:[{calculate:`${St(`upper_box_${o}`)} - ${St(`lower_box_${o}`)}`,as:`iqr_${o}`},{calculate:`min(${St(`upper_box_${o}`)} + ${St(`iqr_${o}`)} * ${t}, ${St(`max_${o}`)})`,as:`upper_whisker_${o}`},{calculate:`max(${St(`lower_box_${o}`)} - ${St(`iqr_${o}`)} * ${t}, ${St(`min_${o}`)})`,as:`lower_whisker_${o}`}],{[a]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:h,filteredEncoding:g}=Ube(d),{bins:p,timeUnits:v,aggregate:m,groupby:y,encoding:b}=y9(g,n),w=r==="vertical"?"horizontal":"vertical",E=r,F=[...p,...v,{aggregate:[...m,...l],groupby:y},...c];return{bins:p,timeUnits:v,transform:F,groupby:y,aggregate:m,continuousAxisChannelDef:i,continuousAxis:a,encodingWithoutContinuousAxis:b,ticksOrient:w,boxOrient:E,customTooltipWithoutAggregatedField:h}}const a_="errorbar",jbe=["ticks","rule"],Gbe=new Jy(a_,k9);function k9(e,{config:t}){e={...e,encoding:e1(e.encoding,t)};const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,ticksOrient:s,markDef:o,outerSpec:u,tooltipEncoding:l}=_9(e,a_,t);delete a.size;const c=i_(o,i,r,a,t.errorbar),f=o.thickness,d=o.size,h={type:"tick",orient:s,aria:!1,...f!==void 0?{thickness:f}:{},...d!==void 0?{size:d}:{}},g=[...c({partName:"ticks",mark:h,positionPrefix:"lower",extraEncoding:l}),...c({partName:"ticks",mark:h,positionPrefix:"upper",extraEncoding:l}),...c({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...f!==void 0?{size:f}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:l})];return{...u,transform:n,...g.length>1?{layer:g}:{...g[0]}}}function Ybe(e,t){const{encoding:n}=e;if(Xbe(n))return{orient:E9(e,t),inputType:"raw"};const r=Kbe(n),i=Zbe(n),a=n.x,s=n.y;if(r){if(i)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const o=n.x2,u=n.y2;if(He(o)&&He(u))throw new Error(`${t} cannot have both x2 and y2`);if(He(o)){if(ou(a))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}else if(He(u)){if(ou(s))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}else{const o=n.xError,u=n.xError2,l=n.yError,c=n.yError2;if(He(u)&&!He(o))throw new Error(`${t} cannot have xError2 without xError`);if(He(c)&&!He(l))throw new Error(`${t} cannot have yError2 without yError`);if(He(o)&&He(l))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(He(o)){if(ou(a))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}else if(He(l)){if(ou(s))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function Xbe(e){return(He(e.x)||He(e.y))&&!He(e.x2)&&!He(e.y2)&&!He(e.xError)&&!He(e.xError2)&&!He(e.yError)&&!He(e.yError2)}function Kbe(e){return He(e.x2)||He(e.y2)}function Zbe(e){return He(e.xError)||He(e.xError2)||He(e.yError)||He(e.yError2)}function _9(e,t,n){const{mark:r,encoding:i,params:a,projection:s,...o}=e,u=Ka(r)?r:{type:r};a&&ce(a8(t));const{orient:l,inputType:c}=Ybe(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:h,continuousAxisChannelDefError2:g,continuousAxis:p}=x9(e,l,t),{errorBarSpecificAggregate:v,postAggregateCalculates:m,tooltipSummary:y,tooltipTitleWithFieldName:b}=Qbe(u,f,d,h,g,c,t,n),{[p]:w,[p==="x"?"x2":"y2"]:E,[p==="x"?"xError":"yError"]:F,[p==="x"?"xError2":"yError2"]:x,...C}=i,{bins:S,timeUnits:_,aggregate:k,groupby:T,encoding:A}=y9(C,n),$=[...k,...v],M=c!=="raw"?[]:T,D=n_(y,f,A,b);return{transform:[...o.transform??[],...S,..._,...$.length===0?[]:[{aggregate:$,groupby:M}],...m],groupby:M,continuousAxisChannelDef:f,continuousAxis:p,encodingWithoutContinuousAxis:A,ticksOrient:l==="vertical"?"horizontal":"vertical",markDef:u,outerSpec:o,tooltipEncoding:D}}function Qbe(e,t,n,r,i,a,s,o){let u=[],l=[];const c=t.field;let f,d=!1;if(a==="raw"){const h=e.center?e.center:e.extent?e.extent==="iqr"?"median":"mean":o.errorbar.center,g=e.extent?e.extent:h==="mean"?"stderr":"iqr";if(h==="median"!=(g==="iqr")&&ce(d1e(h,g,s)),g==="stderr"||g==="stdev")u=[{op:g,field:c,as:`extent_${c}`},{op:h,field:c,as:`center_${c}`}],l=[{calculate:`${St(`center_${c}`)} + ${St(`extent_${c}`)}`,as:`upper_${c}`},{calculate:`${St(`center_${c}`)} - ${St(`extent_${c}`)}`,as:`lower_${c}`}],f=[{fieldPrefix:"center_",titlePrefix:Sy(h)},{fieldPrefix:"upper_",titlePrefix:A9(h,g,"+")},{fieldPrefix:"lower_",titlePrefix:A9(h,g,"-")}],d=!0;else{let p,v,m;g==="ci"?(p="mean",v="ci0",m="ci1"):(p="median",v="q1",m="q3"),u=[{op:v,field:c,as:`lower_${c}`},{op:m,field:c,as:`upper_${c}`},{op:p,field:c,as:`center_${c}`}],f=[{fieldPrefix:"upper_",titlePrefix:Sf({field:c,aggregate:m,type:"quantitative"},o,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:Sf({field:c,aggregate:v,type:"quantitative"},o,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:Sf({field:c,aggregate:p,type:"quantitative"},o,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&ce(f1e(e.center,e.extent)),a==="aggregated-upper-lower"?(f=[],l=[{calculate:St(n.field),as:`upper_${c}`},{calculate:St(c),as:`lower_${c}`}]):a==="aggregated-error"&&(f=[{fieldPrefix:"",titlePrefix:c}],l=[{calculate:`${St(c)} + ${St(r.field)}`,as:`upper_${c}`}],i?l.push({calculate:`${St(c)} + ${St(i.field)}`,as:`lower_${c}`}):l.push({calculate:`${St(c)} - ${St(r.field)}`,as:`lower_${c}`}));for(const h of l)f.push({fieldPrefix:h.as.substring(0,6),titlePrefix:pf(pf(h.calculate,"datum['",""),"']","")})}return{postAggregateCalculates:l,errorBarSpecificAggregate:u,tooltipSummary:f,tooltipTitleWithFieldName:d}}function A9(e,t,n){return`${Sy(e)} ${n} ${t}`}const s_="errorband",Jbe=["band","borders"],e2e=new Jy(s_,T9);function T9(e,{config:t}){e={...e,encoding:e1(e.encoding,t)};const{transform:n,continuousAxisChannelDef:r,continuousAxis:i,encodingWithoutContinuousAxis:a,markDef:s,outerSpec:o,tooltipEncoding:u}=_9(e,s_,t),l=s,c=i_(l,i,r,a,t.errorband),f=e.encoding.x!==void 0&&e.encoding.y!==void 0;let d={type:f?"area":"rect"},h={type:f?"line":"rule"};const g={...l.interpolate?{interpolate:l.interpolate}:{},...l.tension&&l.interpolate?{tension:l.tension}:{}};return f?(d={...d,...g,ariaRoleDescription:"errorband"},h={...h,...g,aria:!1}):l.interpolate?ce(g8("interpolate")):l.tension&&ce(g8("tension")),{...o,transform:n,layer:[...c({partName:"band",mark:d,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"lower",extraEncoding:u}),...c({partName:"borders",mark:h,positionPrefix:"upper",extraEncoding:u})]}}const M9={};function o_(e,t,n){const r=new Jy(e,t);M9[e]={normalizer:r,parts:n}}function t2e(){return ue(M9)}o_(n1,S9,Vbe),o_(a_,k9,jbe),o_(s_,T9,Jbe);const n2e=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],$9={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},D9={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},r2e=ue($9),i2e=ue(D9),R9=ue({header:1,headerRow:1,headerColumn:1,headerFacet:1}),P9=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],a2e={gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},s2e={aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1},la="_vgsid_",o2e={point:{on:"click",fields:[la],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function u_(e){return e==="legend"||!!(e!=null&&e.legend)}function l_(e){return u_(e)&&we(e)}function c_(e){return!!(e!=null&&e.select)}function N9(e){const t=[];for(const n of e||[]){if(c_(n))continue;const{expr:r,bind:i,...a}=n;if(i&&r){const s={...a,bind:i,init:r};t.push(s)}else{const s={...a,...r?{update:r}:{},...i?{bind:i}:{}};t.push(s)}}return t}function u2e(e){return r1(e)||d_(e)||f_(e)}function f_(e){return le(e,"concat")}function r1(e){return le(e,"vconcat")}function d_(e){return le(e,"hconcat")}function O9({step:e,offsetIsDiscrete:t}){return t?e.for??"offset":"position"}function Qa(e){return le(e,"step")}function I9(e){return le(e,"view")||le(e,"width")||le(e,"height")}const B9=20,l2e=ue({align:1,bounds:1,center:1,columns:1,spacing:1});function c2e(e,t,n){const r=n[t],i={},{spacing:a,columns:s}=r;a!==void 0&&(i.spacing=a),s!==void 0&&(Hy(e)&&!Pg(e.facet)||f_(e))&&(i.columns=s),r1(e)&&(i.columns=1);for(const o of l2e)if(e[o]!==void 0)if(o==="spacing"){const u=e[o];i[o]=yt(u)?u:{row:u.row??a,column:u.column??a}}else i[o]=e[o];return i}function h_(e,t){return e[t]??e[t==="width"?"continuousWidth":"continuousHeight"]}function g_(e,t){const n=i1(e,t);return Qa(n)?n.step:L9}function i1(e,t){const n=e[t]??e[t==="width"?"discreteWidth":"discreteHeight"];return en(n,{step:e.step})}const L9=20,f2e={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:300,continuousHeight:300,step:L9},mark:ube,arc:{},area:{},bar:cbe,circle:{},geoshape:{},image:{},line:{},point:{},rect:Wk,rule:{color:"black"},square:{},text:{color:"black"},tick:fbe,trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:W1e,projection:{},legend:a2e,header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:o2e,style:{},title:{},facet:{spacing:B9},concat:{spacing:B9},normalizedNumberFormat:".0%"},Xs=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],z9={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},q9={blue:Xs[0],orange:Xs[1],red:Xs[2],teal:Xs[3],green:Xs[4],yellow:Xs[5],purple:Xs[6],pink:Xs[7],brown:Xs[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function d2e(e={}){return{signals:[{name:"color",value:we(e)?{...q9,...e}:q9}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}function h2e(e){return{signals:[{name:"fontSize",value:we(e)?{...z9,...e}:z9}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}function g2e(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}function U9(e){const t=ue(e||{}),n={};for(const r of t){const i=e[r];n[r]=Bg(i)?j6(i):ri(i)}return n}function p2e(e){const t=ue(e),n={};for(const r of t)n[r]=U9(e[r]);return n}const v2e=[...z8,...g9,...R9,"background","padding","legend","lineBreak","scale","style","title","view"];function V9(e={}){const{color:t,font:n,fontSize:r,selection:i,...a}=e,s=tw({},qe(f2e),n?g2e(n):{},t?d2e(t):{},r?h2e(r):{},a||{});i&&e0(s,"selection",i,!0);const o=Si(s,v2e);for(const u of["background","lineBreak","padding"])s[u]&&(o[u]=ri(s[u]));for(const u of z8)s[u]&&(o[u]=Wn(s[u]));for(const u of g9)s[u]&&(o[u]=U9(s[u]));for(const u of R9)s[u]&&(o[u]=Wn(s[u]));if(s.legend&&(o.legend=Wn(s.legend)),s.scale){const{invalid:u,...l}=s.scale,c=Wn(u,{level:1});o.scale={...Wn(l),...ue(c).length>0?{invalid:c}:{}}}return s.style&&(o.style=p2e(s.style)),s.title&&(o.title=Wn(s.title)),s.view&&(o.view=Wn(s.view)),o}const m2e=new Set(["view",...rbe]),y2e=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],b2e={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],...obe};function w2e(e){e=qe(e);for(const t of y2e)delete e[t];if(e.axis)for(const t in e.axis)Bg(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of n2e)delete e.legend[t];if(e.mark){for(const t of L8)delete e.mark[t];e.mark.tooltip&&we(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(N9(e.params)),delete e.params);for(const t of m2e){for(const r of L8)delete e[t][r];const n=b2e[t];if(n)for(const r of n)delete e[t][r];E2e(e,t)}for(const t of t2e())delete e[t];x2e(e);for(const t in e)we(e[t])&&Mt(e[t])&&delete e[t];return Mt(e)?void 0:e}function x2e(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:r}=H6(e.title);Mt(t)||(e.style["group-title"]={...e.style["group-title"],...t}),Mt(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n}),Mt(r)?delete e.title:e.title=r}function E2e(e,t,n,r){const i=e[t];t==="view"&&(n="cell");const a={...i,...e.style[n??t]};Mt(a)||(e.style[n??t]=a),delete e[t]}function a1(e){return le(e,"layer")}function F2e(e){return le(e,"repeat")}function S2e(e){return!ee(e.repeat)&&le(e.repeat,"layer")}class p_{map(t,n){return Hy(t)?this.mapFacet(t,n):F2e(t)?this.mapRepeat(t,n):d_(t)?this.mapHConcat(t,n):r1(t)?this.mapVConcat(t,n):f_(t)?this.mapConcat(t,n):this.mapLayerOrUnit(t,n)}mapLayerOrUnit(t,n){if(a1(t))return this.mapLayer(t,n);if(Ys(t))return this.mapUnit(t,n);throw new Error(wk(t))}mapLayer(t,n){return{...t,layer:t.layer.map(r=>this.mapLayerOrUnit(r,n))}}mapHConcat(t,n){return{...t,hconcat:t.hconcat.map(r=>this.map(r,n))}}mapVConcat(t,n){return{...t,vconcat:t.vconcat.map(r=>this.map(r,n))}}mapConcat(t,n){const{concat:r,...i}=t;return{...i,concat:r.map(a=>this.map(a,n))}}mapFacet(t,n){return{...t,spec:this.map(t.spec,n)}}mapRepeat(t,n){return{...t,spec:this.map(t.spec,n)}}}const C2e={zero:1,center:1,normalize:1};function k2e(e){return xe(C2e,e)}const _2e=new Set([O8,Ly,By,Uy,qy,qk,Uk,zy,I8,zk]),A2e=new Set([Ly,By,O8]);function _f(e){return fe(e)&&Ef(e)==="quantitative"&&!e.bin}function W9(e,t,{orient:n,type:r}){const i=t==="x"?"y":"radius",a=t==="x"&&["bar","area"].includes(r),s=e[t],o=e[i];if(fe(s)&&fe(o))if(_f(s)&&_f(o)){if(s.stack)return t;if(o.stack)return i;const u=fe(s)&&!!s.aggregate,l=fe(o)&&!!o.aggregate;if(u!==l)return u?t:i;if(a){if(n==="vertical")return i;if(n==="horizontal")return t}}else{if(_f(s))return t;if(_f(o))return i}else{if(_f(s))return a&&n==="vertical"?void 0:t;if(_f(o))return a&&n==="horizontal"?void 0:i}}function T2e(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}function H9(e,t){var p,v;const n=Ka(e)?e:{type:e},r=n.type;if(!_2e.has(r))return null;const i=W9(t,"x",n)||W9(t,"theta",n);if(!i)return null;const a=t[i],s=fe(a)?pe(a,{}):void 0,o=T2e(i),u=[],l=new Set;if(t[o]){const m=t[o],y=fe(m)?pe(m,{}):void 0;y&&y!==s&&(u.push(o),l.add(y))}const c=o==="x"?"xOffset":"yOffset",f=t[c],d=fe(f)?pe(f,{}):void 0;d&&d!==s&&(u.push(c),l.add(d));const h=Wme.reduce((m,y)=>{if(y!=="tooltip"&&Nl(t,y)){const b=t[y];for(const w of be(b)){const E=ua(w);if(E.aggregate)continue;const F=pe(E,{});(!F||!l.has(F))&&m.push({channel:y,fieldDef:E})}}return m},[]);let g;return a.stack!==void 0?mc(a.stack)?g=a.stack?"zero":null:g=a.stack:A2e.has(r)&&(g="zero"),!g||!k2e(g)||m9(t)&&h.length===0?null:((p=a==null?void 0:a.scale)!=null&&p.type&&((v=a==null?void 0:a.scale)==null?void 0:v.type)!==Hn.LINEAR&&a!=null&&a.stack&&ce(u1e(a.scale.type)),He(t[Ha(i)])?(a.stack!==void 0&&ce(o1e(i)),null):(fe(a)&&a.aggregate&&!rye.has(a.aggregate)&&ce(l1e(a.aggregate)),{groupbyChannels:u,groupbyFields:l,fieldChannel:i,impute:a.impute===null?!1:au(r),stackBy:h,offset:g}))}function j9(e,t,n){const r=Wn(e),i=Ct("orient",r,n);if(r.orient=R2e(r.type,t,i),i!==void 0&&i!==r.orient&&ce(Hye(r.orient,i)),r.type==="bar"&&r.orient){const u=Ct("cornerRadiusEnd",r,n);if(u!==void 0){const l=r.orient==="horizontal"&&t.x2||r.orient==="vertical"&&t.y2?["cornerRadius"]:lbe[r.orient];for(const c of l)r[c]=u;r.cornerRadiusEnd!==void 0&&delete r.cornerRadiusEnd}}const a=Ct("opacity",r,n),s=Ct("fillOpacity",r,n);return a===void 0&&s===void 0&&(r.opacity=$2e(r.type,t)),Ct("cursor",r,n)===void 0&&(r.cursor=M2e(r,t,n)),r}function M2e(e,t,n){return t.href||e.href||Ct("href",e,n)?"pointer":e.cursor}function $2e(e,t){if(rt([qy,zk,qk,Uk],e)&&!m9(t))return .7}function D2e(e,t,{graticule:n}){if(n)return!1;const r=Ga("filled",e,t),i=e.type;return en(r,i!==qy&&i!==zy&&i!==Uy)}function R2e(e,t,n){switch(e){case qy:case qk:case Uk:case I8:case tbe:case ebe:return}const{x:r,y:i,x2:a,y2:s}=t;switch(e){case Ly:if(fe(r)&&(Vn(r.bin)||fe(i)&&i.aggregate&&!r.aggregate))return"vertical";if(fe(i)&&(Vn(i.bin)||fe(r)&&r.aggregate&&!i.aggregate))return"horizontal";if(s||a){if(n)return n;if(!a)return(fe(r)&&r.type===Ml&&!$t(r.bin)||Gy(r))&&fe(i)&&Vn(i.bin)?"horizontal":"vertical";if(!s)return(fe(i)&&i.type===Ml&&!$t(i.bin)||Gy(i))&&fe(r)&&Vn(r.bin)?"vertical":"horizontal"}case Uy:if(a&&!(fe(r)&&Vn(r.bin))&&s&&!(fe(i)&&Vn(i.bin)))return;case By:if(s)return fe(i)&&Vn(i.bin)?"horizontal":"vertical";if(a)return fe(r)&&Vn(r.bin)?"vertical":"horizontal";if(e===Uy){if(r&&!i)return"vertical";if(i&&!r)return"horizontal"}case zy:case zk:{const o=n9(r),u=n9(i);if(n)return n;if(o&&!u)return e!=="tick"?"horizontal":"vertical";if(!o&&u)return e!=="tick"?"vertical":"horizontal";if(o&&u)return"vertical";{const l=Tr(r)&&r.type===bf,c=Tr(i)&&i.type===bf;if(l&&!c)return"vertical";if(!l&&c)return"horizontal"}return}}return"vertical"}function P2e(e){const{point:t,line:n,...r}=e;return ue(r).length>1?r:r.type}function N2e(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:Si(e[t],["point","line"])});return e}function v_(e,t={},n){return e.point==="transparent"?{opacity:0}:e.point?we(e.point)?e.point:{}:e.point!==void 0?null:t.point||n.shape?we(t.point)?t.point:{}:void 0}function G9(e,t={}){return e.line?e.line===!0?{}:e.line:e.line!==void 0?null:t.line?t.line===!0?{}:t.line:void 0}class O2e{constructor(){re(this,"name","path-overlay")}hasMatchingType(t,n){if(Ys(t)){const{mark:r,encoding:i}=t,a=Ka(r)?r:{type:r};switch(a.type){case"line":case"rule":case"trail":return!!v_(a,n[a.type],i);case"area":return!!v_(a,n[a.type],i)||!!G9(a,n[a.type])}}return!1}run(t,n,r){const{config:i}=n,{params:a,projection:s,mark:o,name:u,encoding:l,...c}=t,f=e1(l,i),d=Ka(o)?o:{type:o},h=v_(d,i[d.type],f),g=d.type==="area"&&G9(d,i[d.type]),p=[{name:u,...a?{params:a}:{},mark:P2e({...d.type==="area"&&d.opacity===void 0&&d.fillOpacity===void 0?{opacity:.7}:{},...d}),encoding:Si(f,["shape"])}],v=H9(j9(d,f,i),f);let m=f;if(v){const{fieldChannel:y,offset:b}=v;m={...f,[y]:{...f[y],...b?{stack:b}:{}}}}return m=Si(m,["y2","x2"]),g&&p.push({...s?{projection:s}:{},mark:{type:"line",...Eg(d,["clip","interpolate","tension","tooltip"]),...g},encoding:m}),h&&p.push({...s?{projection:s}:{},mark:{type:"point",opacity:1,filled:!0,...Eg(d,["clip","tooltip"]),...h},encoding:m}),r({...c,layer:p},{...n,config:N2e(i)})}}function I2e(e,t){return t?Pg(e)?Z9(e,t):Y9(e,t):e}function m_(e,t){return t?Z9(e,t):e}function y_(e,t,n){const r=t[e];if(Fbe(r)){if(r.repeat in n)return{...t,[e]:n[r.repeat]};ce(Eye(r.repeat));return}return t}function Y9(e,t){if(e=y_("field",e,t),e!==void 0){if(e===null)return null;if(Zk(e)&&Gs(e.sort)){const n=y_("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function X9(e,t){if(fe(e))return Y9(e,t);{const n=y_("datum",e,t);return n!==e&&!n.type&&(n.type="nominal"),n}}function K9(e,t){if(He(e)){const n=X9(e,t);if(n)return n;if(Ng(e))return{condition:e.condition}}else{if(Og(e)){const n=X9(e.condition,t);if(n)return{...e,condition:n};{const{condition:r,...i}=e;return i}}return e}}function Z9(e,t){const n={};for(const r in e)if(le(e,r)){const i=e[r];if(ee(i))n[r]=i.map(a=>K9(a,t)).filter(a=>a);else{const a=K9(i,t);a!==void 0&&(n[r]=a)}}return n}class B2e{constructor(){re(this,"name","RuleForRangedLine")}hasMatchingType(t){if(Ys(t)){const{encoding:n,mark:r}=t;if(r==="line"||Ka(r)&&r.type==="line")for(const i of qme){const a=Fl(i),s=n[a];if(n[i]&&(fe(s)&&!Vn(s.bin)||Za(s)))return!0}}return!1}run(t,n,r){const{encoding:i,mark:a}=t;return ce(Wye(!!i.x2,!!i.y2)),r({...t,mark:we(a)?{...a,type:"rule"}:"rule"},n)}}class L2e extends p_{constructor(){super(...arguments);re(this,"nonFacetUnitNormalizers",[Wbe,Gbe,e2e,new O2e,new B2e])}map(n,r){if(Ys(n)){const i=Nl(n.encoding,Bs),a=Nl(n.encoding,Ls),s=Nl(n.encoding,ky);if(i||a||s)return this.mapFacetedUnit(n,r)}return super.map(n,r)}mapUnit(n,r){const{parentEncoding:i,parentProjection:a}=r,s=m_(n.encoding,r.repeater),o={...n,...n.name?{name:[r.repeaterPrefix,n.name].filter(l=>l).join("_")}:{},...s?{encoding:s}:{}};if(i||a)return this.mapUnitWithParentEncodingOrProjection(o,r);const u=this.mapLayerOrUnit.bind(this);for(const l of this.nonFacetUnitNormalizers)if(l.hasMatchingType(o,r.config))return l.run(o,r,u);return o}mapRepeat(n,r){return S2e(n)?this.mapLayerRepeat(n,r):this.mapNonLayerRepeat(n,r)}mapLayerRepeat(n,r){const{repeat:i,spec:a,...s}=n,{row:o,column:u,layer:l}=i,{repeater:c={},repeaterPrefix:f=""}=r;return o||u?this.mapRepeat({...n,repeat:{...o?{row:o}:{},...u?{column:u}:{}},spec:{repeat:{layer:l},spec:a}},r):{...s,layer:l.map(d=>{const h={...c,layer:d},g=`${(a.name?`${a.name}_`:"")+f}child__layer_${Ut(d)}`,p=this.mapLayerOrUnit(a,{...r,repeater:h,repeaterPrefix:g});return p.name=g,p})}}mapNonLayerRepeat(n,r){const{repeat:i,spec:a,data:s,...o}=n;!ee(i)&&n.columns&&(n=Si(n,["columns"]),ce(s8("repeat")));const u=[],{repeater:l={},repeaterPrefix:c=""}=r,f=!ee(i)&&i.row||[l?l.row:null],d=!ee(i)&&i.column||[l?l.column:null],h=ee(i)&&i||[l?l.repeat:null];for(const p of h)for(const v of f)for(const m of d){const y={repeat:p,row:v,column:m,layer:l.layer},b=`${(a.name?`${a.name}_`:"")+c}child__${ee(i)?`${Ut(p)}`:(i.row?`row_${Ut(v)}`:"")+(i.column?`column_${Ut(m)}`:"")}`,w=this.map(a,{...r,repeater:y,repeaterPrefix:b});w.name=b,u.push(Si(w,["data"]))}const g=ee(i)?n.columns:i.column?i.column.length:1;return{data:a.data??s,align:"all",...o,columns:g,concat:u}}mapFacet(n,r){const{facet:i}=n;return Pg(i)&&n.columns&&(n=Si(n,["columns"]),ce(s8("facet"))),super.mapFacet(n,r)}mapUnitWithParentEncodingOrProjection(n,r){const{encoding:i,projection:a}=n,{parentEncoding:s,parentProjection:o,config:u}=r,l=J9({parentProjection:o,projection:a}),c=Q9({parentEncoding:s,encoding:m_(i,r.repeater)});return this.mapUnit({...n,...l?{projection:l}:{},...c?{encoding:c}:{}},{config:u})}mapFacetedUnit(n,r){const{row:i,column:a,facet:s,...o}=n.encoding,{mark:u,width:l,projection:c,height:f,view:d,params:h,encoding:g,...p}=n,{facetMapping:v,layout:m}=this.getFacetMappingAndLayout({row:i,column:a,facet:s},r),y=m_(o,r.repeater);return this.mapFacet({...p,...m,facet:v,spec:{...l?{width:l}:{},...f?{height:f}:{},...d?{view:d}:{},...c?{projection:c}:{},mark:u,encoding:y,...h?{params:h}:{}}},r)}getFacetMappingAndLayout(n,r){const{row:i,column:a,facet:s}=n;if(i||a){s&&ce(Uye([...i?[Bs]:[],...a?[Ls]:[]]));const o={},u={};for(const l of[Bs,Ls]){const c=n[l];if(c){const{align:f,center:d,spacing:h,columns:g,...p}=c;o[l]=p;for(const v of["align","center","spacing"])c[v]!==void 0&&(u[v]??(u[v]={}),u[v][l]=c[v])}}return{facetMapping:o,layout:u}}else{const{align:o,center:u,spacing:l,columns:c,...f}=s;return{facetMapping:I2e(f,r.repeater),layout:{...o?{align:o}:{},...u?{center:u}:{},...l?{spacing:l}:{},...c?{columns:c}:{}}}}}mapLayer(n,{parentEncoding:r,parentProjection:i,...a}){const{encoding:s,projection:o,...u}=n,l={...a,parentEncoding:Q9({parentEncoding:r,encoding:s,layer:!0}),parentProjection:J9({parentProjection:i,projection:o})};return super.mapLayer({...u,...n.name?{name:[l.repeaterPrefix,n.name].filter(c=>c).join("_")}:{}},l)}}function Q9({parentEncoding:e,encoding:t={},layer:n}){let r={};if(e){const i=new Set([...ue(e),...ue(t)]);for(const a of i){const s=t[a],o=e[a];if(He(s)){const u={...o,...s};r[a]=u}else Og(s)?r[a]={...s,condition:{...o,...s.condition}}:s||s===null?r[a]=s:(n||oa(o)||Ae(o)||He(o)||ee(o))&&(r[a]=o)}}else r=t;return!r||Mt(r)?void 0:r}function J9(e){const{parentProjection:t,projection:n}=e;return t&&n&&ce($ye({parentProjection:t,projection:n})),n??t}function b_(e){return le(e,"filter")}function z2e(e){return le(e,"stop")}function e7(e){return le(e,"lookup")}function q2e(e){return le(e,"data")}function U2e(e){return le(e,"param")}function V2e(e){return le(e,"pivot")}function W2e(e){return le(e,"density")}function H2e(e){return le(e,"quantile")}function j2e(e){return le(e,"regression")}function G2e(e){return le(e,"loess")}function Y2e(e){return le(e,"sample")}function X2e(e){return le(e,"window")}function K2e(e){return le(e,"joinaggregate")}function Z2e(e){return le(e,"flatten")}function Q2e(e){return le(e,"calculate")}function t7(e){return le(e,"bin")}function J2e(e){return le(e,"impute")}function ewe(e){return le(e,"timeUnit")}function twe(e){return le(e,"aggregate")}function nwe(e){return le(e,"stack")}function rwe(e){return le(e,"fold")}function iwe(e){return le(e,"extent")&&!le(e,"density")&&!le(e,"regression")}function awe(e){return e.map(t=>b_(t)?{filter:gf(t.filter,I1e)}:t)}class swe extends p_{map(t,n){return n.emptySelections??(n.emptySelections={}),n.selectionPredicates??(n.selectionPredicates={}),t=n7(t,n),super.map(t,n)}mapLayerOrUnit(t,n){if(t=n7(t,n),t.encoding){const r={};for(const[i,a]of wl(t.encoding))r[i]=r7(a,n);t={...t,encoding:r}}return super.mapLayerOrUnit(t,n)}mapUnit(t,n){const{selection:r,...i}=t;return r?{...i,params:wl(r).map(([a,s])=>{const{init:o,bind:u,empty:l,...c}=s;c.type==="single"?(c.type="point",c.toggle=!1):c.type==="multi"&&(c.type="point"),n.emptySelections[a]=l!=="none";for(const f of dn(n.selectionPredicates[a]??{}))f.empty=l!=="none";return{name:a,value:o,select:c,bind:u}})}:t}}function n7(e,t){const{transform:n,...r}=e;if(n){const i=n.map(a=>{if(b_(a))return{filter:w_(a,t)};if(t7(a)&&Sl(a.bin))return{...a,bin:i7(a.bin)};if(e7(a)){const{selection:s,...o}=a.from;return s?{...a,from:{param:s,...o}}:a}return a});return{...r,transform:i}}return e}function r7(e,t){var r,i;const n=qe(e);if(fe(n)&&Sl(n.bin)&&(n.bin=i7(n.bin)),Pl(n)&&((i=(r=n.scale)==null?void 0:r.domain)!=null&&i.selection)){const{selection:a,...s}=n.scale.domain;n.scale.domain={...s,...a?{param:a}:{}}}if(Ng(n))if(ee(n.condition))n.condition=n.condition.map(a=>{const{selection:s,param:o,test:u,...l}=a;return o?a:{...l,test:w_(a,t)}});else{const{selection:a,param:s,test:o,...u}=r7(n.condition,t);n.condition=s?n.condition:{...u,test:w_(n.condition,t)}}return n}function i7(e){const t=e.extent;if(t!=null&&t.selection){const{selection:n,...r}=t;return{...e,extent:{...r,param:n}}}return e}function w_(e,t){const n=r=>gf(r,i=>{var o;const a=t.emptySelections[i]??!0,s={param:i,empty:a};return(o=t.selectionPredicates)[i]??(o[i]=[]),t.selectionPredicates[i].push(s),s});return e.selection?n(e.selection):gf(e.test||e.filter,r=>r.selection?n(r.selection):r)}class x_ extends p_{map(t,n){const r=n.selections??[];if(t.params&&!Ys(t)){const i=[];for(const a of t.params)c_(a)?r.push(a):i.push(a);t.params=i}return n.selections=r,super.map(t,n)}mapUnit(t,n){const r=n.selections;if(!r||!r.length)return t;const i=(n.path??[]).concat(t.name),a=[];for(const s of r)if(!s.views||!s.views.length)a.push(s);else for(const o of s.views)(Ee(o)&&(o===t.name||i.includes(o))||ee(o)&&o.map(u=>i.indexOf(u)).every((u,l,c)=>u!==-1&&(l===0||u>c[l-1])))&&a.push(s);return a.length&&(t.params=a),t}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=x_.prototype[e];x_.prototype[e]=function(n,r){return t.call(this,n,owe(n,r))}}function owe(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function uwe(e,t){t===void 0&&(t=V9(e.config));const n=dwe(e,t),{width:r,height:i}=e,a=hwe(n,{width:r,height:i,autosize:e.autosize},t);return{...n,...a?{autosize:a}:{}}}const lwe=new L2e,cwe=new swe,fwe=new x_;function dwe(e,t={}){const n={config:t};return fwe.map(lwe.map(cwe.map(e,n),n),n)}function a7(e){return Ee(e)?{type:e}:e??{}}function hwe(e,t,n){let{width:r,height:i}=t;const a=Ys(e)||a1(e),s={};a?r=="container"&&i=="container"?(s.type="fit",s.contains="padding"):r=="container"?(s.type="fit-x",s.contains="padding"):i=="container"&&(s.type="fit-y",s.contains="padding"):(r=="container"&&(ce(t8("width")),r=void 0),i=="container"&&(ce(t8("height")),i=void 0));const o={type:"pad",...s,...n?a7(n.autosize):{},...a7(e.autosize)};if(o.type==="fit"&&!a&&(ce(fye),o.type="pad"),r=="container"&&!(o.type=="fit"||o.type=="fit-x")&&ce(n8("width")),i=="container"&&!(o.type=="fit"||o.type=="fit-y")&&ce(n8("height")),!Ci(o,{type:"pad"}))return o}function gwe(e){return["fit","fit-x","fit-y"].includes(e)}function pwe(e){return e?`fit-${$y(e)}`:"fit"}const vwe=["background","padding"];function s7(e,t){const n={};for(const r of vwe)e&&e[r]!==void 0&&(n[r]=ri(e[r]));return t&&(n.params=e.params),n}class Ks{constructor(t={},n={}){re(this,"explicit");re(this,"implicit");this.explicit=t,this.implicit=n}clone(){return new Ks(qe(this.explicit),qe(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(t){return en(this.explicit[t],this.implicit[t])}getWithExplicit(t){return this.explicit[t]!==void 0?{explicit:!0,value:this.explicit[t]}:this.implicit[t]!==void 0?{explicit:!1,value:this.implicit[t]}:{explicit:!1,value:void 0}}setWithExplicit(t,{value:n,explicit:r}){n!==void 0&&this.set(t,n,r)}set(t,n,r){return delete this[r?"implicit":"explicit"][t],this[r?"explicit":"implicit"][t]=n,this}copyKeyFromSplit(t,{explicit:n,implicit:r}){n[t]!==void 0?this.set(t,n[t],!0):r[t]!==void 0&&this.set(t,r[t],!1)}copyKeyFromObject(t,n){n[t]!==void 0&&this.set(t,n[t],!0)}copyAll(t){for(const n of ue(t.combine())){const r=t.getWithExplicit(n);this.setWithExplicit(n,r)}}}function Ja(e){return{explicit:!0,value:e}}function ii(e){return{explicit:!1,value:e}}function o7(e){return(t,n,r,i)=>{const a=e(t.value,n.value);return a>0?t:a<0?n:s1(t,n,r,i)}}function s1(e,t,n,r){return e.explicit&&t.explicit&&ce(e1e(n,r,e.value,t.value)),e}function uu(e,t,n,r,i=s1){return e===void 0||e.value===void 0?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:Ci(e.value,t.value)?e:i(e,t,n,r)}class mwe extends Ks{constructor(n={},r={},i=!1){super(n,r);re(this,"explicit");re(this,"implicit");re(this,"parseNothing");this.explicit=n,this.implicit=r,this.parseNothing=i}clone(){const n=super.clone();return n.parseNothing=this.parseNothing,n}}function Af(e){return le(e,"url")}function Lg(e){return le(e,"values")}function u7(e){return le(e,"name")&&!Af(e)&&!Lg(e)&&!lu(e)}function lu(e){return e&&(l7(e)||c7(e)||E_(e))}function l7(e){return le(e,"sequence")}function c7(e){return le(e,"sphere")}function E_(e){return le(e,"graticule")}var Vt;(function(e){e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e[e.PreFilterInvalid=5]="PreFilterInvalid",e[e.PostFilterInvalid=6]="PostFilterInvalid"})(Vt||(Vt={}));function f7({invalid:e,isPath:t}){switch(q8(e,{isPath:t})){case"filter":return{marks:"exclude-invalid-values",scales:"exclude-invalid-values"};case"break-paths-show-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"include-invalid-values"};case"break-paths-filter-domains":return{marks:t?"include-invalid-values":"exclude-invalid-values",scales:"exclude-invalid-values"};case"show":return{marks:"include-invalid-values",scales:"include-invalid-values"}}}function ywe(e){const{marks:t,scales:n}=f7(e);return t===n?Vt.Main:n==="include-invalid-values"?Vt.PreFilterInvalid:Vt.PostFilterInvalid}class xt{constructor(t,n){re(this,"debugName");re(this,"_children",[]);re(this,"_parent",null);re(this,"_hash");this.debugName=n,t&&(this.parent=t)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(t){this._parent=t,t&&t.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(t,n){if(this._children.includes(t)){ce(Aye);return}n!==void 0?this._children.splice(n,0,t):this._children.push(t)}removeChild(t){const n=this._children.indexOf(t);return this._children.splice(n,1),n}remove(){let t=this._parent.removeChild(this);for(const n of this._children)n._parent=this._parent,this._parent.addChild(n,t++)}insertAsParentOf(t){const n=t.parent;n.removeChild(this),this.parent=n,t.parent=this}swapWithParent(){const t=this._parent,n=t.parent;for(const i of this._children)i.parent=t;this._children=[],t.removeChild(this);const r=t.parent.removeChild(t);this._parent=n,n.addChild(this,r),t.parent=this}}class Hr extends xt{constructor(n,r,i,a){super(n,r);re(this,"type");re(this,"refCounts");re(this,"_source");re(this,"_name");this.type=i,this.refCounts=a,this._source=this._name=r,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}clone(){const n=new this.constructor;return n.debugName=`clone_${this.debugName}`,n._source=this._source,n._name=`clone_${this._name}`,n.type=this.type,n.refCounts=this.refCounts,n.refCounts[n._name]=0,n}dependentFields(){return new Set}producedFields(){return new Set}hash(){return this._hash===void 0&&(this._hash=`Output ${Dme()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(n){this._source=n}}function F_(e){return e.as!==void 0}function d7(e){return`${e}_end`}class es extends xt{constructor(n,r){super(n);re(this,"timeUnits");this.timeUnits=r}clone(){return new es(null,qe(this.timeUnits))}static makeFromEncoding(n,r){const i=r.reduceFieldDef((a,s,o)=>{const{field:u,timeUnit:l}=s;if(l){let c;if(Tl(l)){if(Wt(r)){const{mark:f,markDef:d,config:h}=r,g=su({fieldDef:s,markDef:d,config:h});($g(f)||g)&&(c={timeUnit:An(l),field:u})}}else c={as:pe(s,{forAs:!0}),field:u,timeUnit:l};if(Wt(r)){const{mark:f,markDef:d,config:h}=r,g=su({fieldDef:s,markDef:d,config:h});$g(f)&&Qt(o)&&g!==.5&&(c.rectBandPosition=g)}c&&(a[at(c)]=c)}return a},{});return Mt(i)?null:new es(n,i)}static makeFromTransform(n,r){const{timeUnit:i,...a}={...r},s=An(i),o={...a,timeUnit:s};return new es(n,{[at(o)]:o})}merge(n){this.timeUnits={...this.timeUnits};for(const r in n.timeUnits)this.timeUnits[r]||(this.timeUnits[r]=n.timeUnits[r]);for(const r of n.children)n.removeChild(r),r.parent=this;n.remove()}removeFormulas(n){const r={};for(const[i,a]of wl(this.timeUnits)){const s=F_(a)?a.as:`${a.field}_end`;n.has(s)||(r[i]=a)}this.timeUnits=r}producedFields(){return new Set(dn(this.timeUnits).map(n=>F_(n)?n.as:d7(n.field)))}dependentFields(){return new Set(dn(this.timeUnits).map(n=>n.field))}hash(){return`TimeUnit ${at(this.timeUnits)}`}assemble(){const n=[];for(const r of dn(this.timeUnits)){const{rectBandPosition:i}=r,a=An(r.timeUnit);if(F_(r)){const{field:s,as:o}=r,{unit:u,utc:l,...c}=a,f=[o,`${o}_end`];n.push({field:Qi(s),type:"timeunit",...u?{units:Oy(u)}:{},...l?{timezone:"utc"}:{},...c,as:f}),n.push(...g7(f,i,a))}else if(r){const{field:s}=r,o=s.replaceAll("\\.","."),u=h7({timeUnit:a,field:o}),l=d7(o);n.push({type:"formula",expr:u,as:l}),n.push(...g7([o,l],i,a))}}return n}}const o1="offsetted_rect_start",u1="offsetted_rect_end";function h7({timeUnit:e,field:t,reverse:n}){const{unit:r,utc:i}=e,a=x8(r),{part:s,step:o}=C8(a,e.step);return`${i?"utcOffset":"timeOffset"}('${s}', ${St(t)}, ${n?-o:o})`}function g7([e,t],n,r){if(n!==void 0&&n!==.5){const i=St(e),a=St(t);return[{type:"formula",expr:p7([h7({timeUnit:r,field:e,reverse:!0}),i],n+.5),as:`${e}_${o1}`},{type:"formula",expr:p7([i,a],n+.5),as:`${e}_${u1}`}]}return[]}function p7([e,t],n){return`${1-n} * ${e} + ${n} * ${t}`}const zg="_tuple_fields";class bwe{constructor(...t){re(this,"hasChannel");re(this,"hasField");re(this,"hasSelectionId");re(this,"timeUnit");re(this,"items");this.items=t,this.hasChannel={},this.hasField={},this.hasSelectionId=!1}}const wwe={defined:()=>!0,parse:(e,t,n)=>{const r=t.name,i=t.project??(t.project=new bwe),a={},s={},o=new Set,u=(g,p)=>{const v=p==="visual"?g.channel:g.field;let m=Ut(`${r}_${v}`);for(let y=1;o.has(m);y++)m=Ut(`${r}_${v}_${y}`);return o.add(m),{[p]:m}},l=t.type,c=e.config.selection[l],f=n.value!==void 0?be(n.value):null;let{fields:d,encodings:h}=we(n.select)?n.select:{};if(!d&&!h&&f){for(const g of f)if(we(g))for(const p of ue(g))zme(p)?(h||(h=[])).push(p):l==="interval"?(ce(xye),h=c.encodings):(d??(d=[])).push(p)}!d&&!h&&(h=c.encodings,"fields"in c&&(d=c.fields));for(const g of h??[]){const p=e.fieldDef(g);if(p){let v=p.field;if(p.aggregate){ce(dye(g,p.aggregate));continue}else if(!v){ce(i8(g));continue}if(p.timeUnit&&!Tl(p.timeUnit)){v=e.vgField(g);const m={timeUnit:p.timeUnit,as:v,field:p.field};s[at(m)]=m}if(!a[v]){const m=l==="interval"&&ja(g)&&aa(e.getScaleComponent(g).get("type"))?"R":p.bin?"R-RE":"E",y={field:v,channel:g,type:m,index:i.items.length};y.signals={...u(y,"data"),...u(y,"visual")},i.items.push(a[v]=y),i.hasField[v]=a[v],i.hasSelectionId=i.hasSelectionId||v===la,P6(g)?(y.geoChannel=g,y.channel=R6(g),i.hasChannel[y.channel]=a[v]):i.hasChannel[g]=a[v]}}else ce(i8(g))}for(const g of d??[]){if(i.hasField[g])continue;const p={type:"E",field:g,index:i.items.length};p.signals={...u(p,"data")},i.items.push(p),i.hasField[g]=p,i.hasSelectionId=i.hasSelectionId||g===la}f&&(t.init=f.map(g=>i.items.map(p=>we(g)?g[p.geoChannel||p.channel]!==void 0?g[p.geoChannel||p.channel]:g[p.field]:g))),Mt(s)||(i.timeUnit=new es(null,s))},signals:(e,t,n)=>{const r=t.name+zg;return n.filter(a=>a.name===r).length>0||t.project.hasSelectionId?n:n.concat({name:r,value:t.project.items.map(b7)})}},v7="_curr",l1="anim_value",Tf="anim_clock",S_="eased_anim_clock",m7="min_extent",y7="max_range_extent",C_="last_tick_at",k_="is_playing",xwe=1/60*1e3,Ewe=(e,t)=>[{name:S_,update:Tf},{name:`${e}_domain`,init:`domain('${t}')`},{name:m7,init:`extent(${e}_domain)[0]`},{name:y7,init:`extent(range('${t}'))[1]`},{name:l1,update:`invert('${t}', ${S_})`}],Fwe={defined:e=>e.type==="point",topLevelSignals:(e,t,n)=>(ts(t)&&(n=n.concat([{name:Tf,init:"0",on:[{events:{type:"timer",throttle:xwe},update:`${k_} ? (${Tf} + (now() - ${C_}) > ${y7} ? 0 : ${Tf} + (now() - ${C_})) : ${Tf}`}]},{name:C_,init:"now()",on:[{events:[{signal:Tf},{signal:k_}],update:"now()"}]},{name:k_,init:"true"}])),n),signals:(e,t,n)=>{const r=t.name,i=r+zg,a=t.project,s="(item().isVoronoi ? datum.datum : datum)",o=dn(e.component.selection??{}).reduce((c,f)=>f.type==="interval"?c.concat(f.name+Mf):c,[]).map(c=>`indexof(item().mark.name, '${c}') < 0`).join(" && "),u=`datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${o?` && ${o}`:""}`;let l=`unit: ${Bl(e)}, `;if(t.project.hasSelectionId)l+=`${la}: ${s}[${he(la)}]`;else if(ts(t))l+=`fields: ${i}, values: [${l1} ? ${l1} : ${m7}]`;else{const c=a.items.map(f=>{const d=e.fieldDef(f.channel);return d!=null&&d.bin?`[${s}[${he(e.vgField(f.channel,{}))}], ${s}[${he(e.vgField(f.channel,{binSuffix:"end"}))}]]`:`${s}[${he(f.field)}]`}).join(", ");l+=`fields: ${i}, values: [${c}]`}if(ts(t))return n.concat(Ewe(t.name,e.scaleName(Zo)),[{name:r+Js,on:[{events:[{signal:S_},{signal:l1}],update:`{${l}}`,force:!0}]}]);{const c=t.events;return n.concat([{name:r+Js,on:c?[{events:c,update:`${u} ? {${l}} : null`,force:!0}]:[]}])}}};function b7(e){const{signals:t,hasLegend:n,index:r,...i}=e;return i.field=Qi(i.field),i}function Ol(e,t=!0,n=lr){if(ee(e)){const r=e.map(i=>Ol(i,t,n));return t?`[${r.join(", ")}]`:r}else if(_l(e))return n(t?Al(e):C1e(e));return t?n(wt(e)):e}function Swe(e,t){for(const n of dn(e.component.selection??{})){const r=n.name;let i=`${r}${Js}, ${n.resolve==="global"?"true":`{unit: ${Bl(e)}}`}`;for(const a of g1)a.defined(n)&&(a.signals&&(t=a.signals(e,n,t)),a.modifyExpr&&(i=a.modifyExpr(e,n,i)));t.push({name:r+Zwe,on:[{events:{signal:n.name+Js},update:`modify(${he(n.name+Il)}, ${i})`}]})}return __(t)}function Cwe(e,t){if(e.component.selection&&ue(e.component.selection).length){const n=he(e.getName("cell"));t.unshift({name:"facet",value:{},on:[{events:gl("pointermove","scope"),update:`isTuple(facet) ? facet : group(${n}).datum`}]})}return __(t)}function kwe(e,t){let n=!1;for(const r of dn(e.component.selection??{})){const i=r.name,a=he(i+Il);if(t.filter(o=>o.name===i).length===0){const o=r.resolve==="global"?"union":r.resolve,u=r.type==="point"?", true, true)":")";t.push({name:r.name,update:`${W7}(${a}, ${he(o)}${u}`})}n=!0;for(const o of g1)o.defined(r)&&o.topLevelSignals&&(t=o.topLevelSignals(e,r,t))}return n&&t.filter(i=>i.name==="unit").length===0&&t.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]}),__(t)}function _we(e,t){const n=[],r=[],i=Bl(e,{escape:!1});for(const a of dn(e.component.selection??{})){const s={name:a.name+Il};if(a.project.hasSelectionId&&(s.transform=[{type:"collect",sort:{field:la}}]),a.init){const u=a.project.items.map(b7);s.values=a.project.hasSelectionId?a.init.map(l=>({unit:i,[la]:Ol(l,!1)[0]})):a.init.map(l=>({unit:i,fields:u,values:Ol(l,!1)}))}if([...n,...t].filter(u=>u.name===a.name+Il).length||n.push(s),ts(a)&&t.length){const u=e.lookupDataSource(e.getDataName(Vt.Main)),l=t.find(f=>f.name===u),c=l.transform.find(f=>f.type==="filter"&&f.expr.includes("vlSelectionTest"));if(c){l.transform=l.transform.filter(d=>d!==c);const f={name:l.name+v7,source:l.name,transform:[c]};r.push(f)}}}return n.concat(t,r)}function w7(e,t){for(const n of dn(e.component.selection??{}))for(const r of g1)r.defined(n)&&r.marks&&(t=r.marks(e,n,t));return t}function Awe(e,t){for(const n of e.children)Wt(n)&&(t=w7(n,t));return t}function Twe(e,t,n,r){const i=X7(e,t.param,t);return{signal:aa(n.get("type"))&&ee(r)&&r[0]>r[1]?`isValid(${i}) && reverse(${i})`:i}}function __(e){return e.map(t=>(t.on&&!t.on.length&&delete t.on,t))}const Zs={defined:e=>e.type==="interval"&&e.resolve==="global"&&e.bind&&e.bind==="scales",parse:(e,t)=>{const n=t.scales=[];for(const r of t.project.items){const i=r.channel;if(!ja(i))continue;const a=e.getScaleComponent(i),s=a?a.get("type"):void 0;if(s=="sequential"&&ce(vye),!a||!aa(s)){ce(pye);continue}a.set("selectionExtent",{param:t.name,field:r.field},!0),n.push(r)}},topLevelSignals:(e,t,n)=>{const r=t.scales.filter(s=>n.filter(o=>o.name===s.signals.data).length===0);if(!e.parent||T_(e)||r.length===0)return n;const i=n.find(s=>s.name===t.name);let a=i.update;if(a.includes(W7))i.update=`{${r.map(s=>`${he(Qi(s.field))}: ${s.signals.data}`).join(", ")}}`;else{for(const s of r){const o=`${he(Qi(s.field))}: ${s.signals.data}`;a.includes(o)||(a=`${a.substring(0,a.length-1)}, ${o}}`)}i.update=a}return n.concat(r.map(s=>({name:s.signals.data})))},signals:(e,t,n)=>{if(e.parent&&!T_(e))for(const r of t.scales){const i=n.find(a=>a.name===r.signals.data);i.push="outer",delete i.value,delete i.update}return n}};function A_(e,t){return`domain(${he(e.scaleName(t))})`}function T_(e){return e.parent&&zf(e.parent)&&(!e.parent.parent||T_(e.parent.parent))}const Mf="_brush",x7="_scale_trigger",qg="geo_interval_init_tick",E7="_init",Mwe="_center",$we={defined:e=>e.type==="interval",parse:(e,t,n)=>{var r;if(e.hasProjection){const i={...we(n.select)?n.select:{}};i.fields=[la],i.encodings||(i.encodings=n.value?ue(n.value):[na,ta]),n.select={type:"interval",...i}}if(t.translate&&!Zs.defined(t)){const i=`!event.item || event.item.mark.name !== ${he(t.name+Mf)}`;for(const a of t.events){if(!a.between){ce(`${a} is not an ordered event stream for interval selections.`);continue}const s=be((r=a.between[0]).filter??(r.filter=[]));s.includes(i)||s.push(i)}}},signals:(e,t,n)=>{const r=t.name,i=r+Js,a=dn(t.project.hasChannel).filter(o=>o.channel===Bt||o.channel===_n),s=t.init?t.init[0]:null;if(n.push(...a.reduce((o,u)=>o.concat(Dwe(e,t,u,s==null?void 0:s[u.index])),[])),e.hasProjection){const o=he(e.projectionName()),u=e.projectionName()+Mwe,{x:l,y:c}=t.project.hasChannel,f=l==null?void 0:l.signals.visual,d=c==null?void 0:c.signals.visual,h=l?s==null?void 0:s[l.index]:`${u}[0]`,g=c?s==null?void 0:s[c.index]:`${u}[1]`,p=E=>e.getSizeSignalRef(E).signal,v=`[[${f?`${f}[0]`:"0"}, ${d?`${d}[0]`:"0"}],[${f?`${f}[1]`:p("width")}, ${d?`${d}[1]`:p("height")}]]`;s&&(n.unshift({name:r+E7,init:`[scale(${o}, [${l?h[0]:h}, ${c?g[0]:g}]), scale(${o}, [${l?h[1]:h}, ${c?g[1]:g}])]`}),(!l||!c)&&(n.find(F=>F.name===u)||n.unshift({name:u,update:`invert(${o}, [${p("width")}/2, ${p("height")}/2])`})));const m=`intersect(${v}, {markname: ${he(e.getName("marks"))}}, unit.mark)`,y=`{unit: ${Bl(e)}}`,b=`vlSelectionTuples(${m}, ${y})`,w=a.map(E=>E.signals.visual);return n.concat({name:i,on:[{events:[...w.length?[{signal:w.join(" || ")}]:[],...s?[{signal:qg}]:[]],update:b}]})}else{if(!Zs.defined(t)){const l=r+x7,c=a.map(f=>{const d=f.channel,{data:h,visual:g}=f.signals,p=he(e.scaleName(d)),v=e.getScaleComponent(d).get("type"),m=aa(v)?"+":"";return`(!isArray(${h}) || (${m}invert(${p}, ${g})[0] === ${m}${h}[0] && ${m}invert(${p}, ${g})[1] === ${m}${h}[1]))`});c.length&&n.push({name:l,value:{},on:[{events:a.map(f=>({scale:e.scaleName(f.channel)})),update:`${c.join(" && ")} ? ${l} : {}`}]})}const o=a.map(l=>l.signals.data),u=`unit: ${Bl(e)}, fields: ${r+zg}, values`;return n.concat({name:i,...s?{init:`{${u}: ${Ol(s)}}`}:{},...o.length?{on:[{events:[{signal:o.join(" || ")}],update:`${o.join(" && ")} ? {${u}: [${o}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>(Wt(e)&&e.hasProjection&&t.init&&(n.filter(i=>i.name===qg).length||n.unshift({name:qg,value:null,on:[{events:"timer{1}",update:`${qg} === null ? {} : ${qg}`}]})),n),marks:(e,t,n)=>{const r=t.name,{x:i,y:a}=t.project.hasChannel,s=i==null?void 0:i.signals.visual,o=a==null?void 0:a.signals.visual,u=`data(${he(t.name+Il)})`;if(Zs.defined(t)||!i&&!a)return n;const l={x:i!==void 0?{signal:`${s}[0]`}:{value:0},y:a!==void 0?{signal:`${o}[0]`}:{value:0},x2:i!==void 0?{signal:`${s}[1]`}:{field:{group:"width"}},y2:a!==void 0?{signal:`${o}[1]`}:{field:{group:"height"}}};if(t.resolve==="global")for(const v of ue(l))l[v]=[{test:`${u}.length && ${u}[0].unit === ${Bl(e)}`,...l[v]},{value:0}];const{fill:c,fillOpacity:f,cursor:d,...h}=t.mark,g=ue(h).reduce((v,m)=>(v[m]=[{test:[i!==void 0&&`${s}[0] !== ${s}[1]`,a!==void 0&&`${o}[0] !== ${o}[1]`].filter(y=>y).join(" && "),value:h[m]},{value:null}],v),{}),p=d??(t.translate?"move":null);return[{name:`${r+Mf}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:c},fillOpacity:{value:f}},update:l}},...n,{name:r+Mf,type:"rect",clip:!0,encode:{enter:{...p?{cursor:{value:p}}:{},fill:{value:"transparent"}},update:{...l,...g}}}]}};function Dwe(e,t,n,r){const i=!e.hasProjection,a=n.channel,s=n.signals.visual,o=he(i?e.scaleName(a):e.projectionName()),u=d=>`scale(${o}, ${d})`,l=e.getSizeSignalRef(a===Bt?"width":"height").signal,c=`${a}(unit)`,f=t.events.reduce((d,h)=>[...d,{events:h.between[0],update:`[${c}, ${c}]`},{events:h,update:`[${s}[0], clamp(${c}, 0, ${l})]`}],[]);if(i){const d=n.signals.data,h=Zs.defined(t),g=e.getScaleComponent(a),p=g?g.get("type"):void 0,v=r?{init:Ol(r,!0,u)}:{value:[]};return f.push({events:{signal:t.name+x7},update:aa(p)?`[${u(`${d}[0]`)}, ${u(`${d}[1]`)}]`:"[0, 0]"}),h?[{name:d,on:[]}]:[{name:s,...v,on:f},{name:d,...r?{init:Ol(r)}:{},on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${o}, ${s})`}]}]}else{const d=a===Bt?0:1,h=t.name+E7,g=r?{init:`[${h}[0][${d}], ${h}[1][${d}]]`}:{value:[]};return[{name:s,...g,on:f}]}}function $f({model:e,channelDef:t,vgChannel:n,invalidValueRef:r,mainRefFn:i}){const a=Ng(t)&&t.condition;let s=[];a&&(s=be(a).map(l=>{const c=i(l);if(Ebe(l)){const{param:f,empty:d}=l;return{test:Y7(e,{param:f,empty:d}),...c}}else return{test:p1(e,l.test),...c}})),r!==void 0&&s.push(r);const o=i(t);return o!==void 0&&s.push(o),s.length>1||s.length===1&&s[0].test?{[n]:s}:s.length===1?{[n]:s[0]}:{}}function M_(e,t="text"){const n=e.encoding[t];return $f({model:e,channelDef:n,vgChannel:t,mainRefFn:r=>c1(r,e.config),invalidValueRef:void 0})}function c1(e,t,n="datum"){if(e){if(oa(e))return Ot(e.value);if(He(e)){const{format:r,formatType:i}=Xy(e);return Yk({fieldOrDatumDef:e,format:r,formatType:i,expr:n,config:t})}}}function F7(e,t={}){const{encoding:n,markDef:r,config:i,stack:a}=e,s=n.tooltip;if(ee(s))return{tooltip:C7({tooltip:s},a,i,t)};{const o=t.reactiveGeom?"datum.datum":"datum";return $f({model:e,channelDef:s,vgChannel:"tooltip",mainRefFn:l=>{const c=c1(l,i,o);if(c)return c;if(l===null)return;let f=Ct("tooltip",r,i);if(f===!0&&(f={content:"encoding"}),Ee(f))return{value:f};if(we(f))return Ae(f)?f:f.content==="encoding"?C7(n,a,i,t):{signal:o}},invalidValueRef:void 0})}}function S7(e,t,n,{reactiveGeom:r}={}){const i={...n,...n.tooltipFormat},a=new Set,s=r?"datum.datum":"datum",o=[];function u(c,f){const d=Fl(f),h=Tr(c)?c:{...c,type:e[d].type},g=h.title||Jk(h,i),p=be(g).join(", ").replaceAll(/"/g,'\\"');let v;if(Qt(f)){const m=f==="x"?"x2":"y2",y=ua(e[m]);if(Vn(h.bin)&&y){const b=pe(h,{expr:s}),w=pe(y,{expr:s}),{format:E,formatType:F}=Xy(h);v=Rg(b,w,E,F,i),a.add(m)}}if((Qt(f)||f===ki||f===ea)&&t&&t.fieldChannel===f&&t.offset==="normalize"){const{format:m,formatType:y}=Xy(h);v=Yk({fieldOrDatumDef:h,format:m,formatType:y,expr:s,config:i,normalizeStack:!0}).signal}v??(v=c1(h,i,s).signal),o.push({channel:f,key:p,value:v})}t_(e,(c,f)=>{fe(c)?u(c,f):jy(c)&&u(c.condition,f)});const l={};for(const{channel:c,key:f,value:d}of o)!a.has(c)&&!l[f]&&(l[f]=d);return l}function C7(e,t,n,{reactiveGeom:r}={}){const i=S7(e,t,n,{reactiveGeom:r}),a=wl(i).map(([s,o])=>`"${s}": ${o}`);return a.length>0?{signal:`{${a.join(", ")}}`}:void 0}function Rwe(e){const{markDef:t,config:n}=e,r=Ct("aria",t,n);return r===!1?{}:{...r?{aria:r}:{},...Pwe(e),...Nwe(e)}}function Pwe(e){const{mark:t,markDef:n,config:r}=e;if(r.aria===!1)return{};const i=Ct("ariaRoleDescription",n,r);return i!=null?{ariaRoleDescription:{value:i}}:xe(uye,t)?{}:{ariaRoleDescription:{value:t}}}function Nwe(e){const{encoding:t,markDef:n,config:r,stack:i}=e,a=t.description;if(a)return $f({model:e,channelDef:a,vgChannel:"description",mainRefFn:u=>c1(u,e.config),invalidValueRef:void 0});const s=Ct("description",n,r);if(s!=null)return{description:Ot(s)};if(r.aria===!1)return{};const o=S7(t,i,r);if(!Mt(o))return{description:{signal:wl(o).map(([u,l],c)=>`"${c>0?"; ":""}${u}: " + (${l})`).join(" + ")}}}function jn(e,t,n={}){const{markDef:r,encoding:i,config:a}=t,{vgChannel:s}=n;let{defaultRef:o,defaultValue:u}=n;const l=i[e];o===void 0&&(u??(u=Ct(e,r,a,{vgChannel:s,ignoreVgConfig:!Ng(l)})),u!==void 0&&(o=Ot(u)));const c={markDef:r,config:a,scaleName:t.scaleName(e),scale:t.getScaleComponent(e)},f=V8({...c,scaleChannel:e,channelDef:l});return $f({model:t,channelDef:l,vgChannel:s??e,invalidValueRef:f,mainRefFn:h=>Gk({...c,channel:e,channelDef:h,stack:null,defaultRef:o})})}function k7(e,t={filled:void 0}){const{markDef:n,encoding:r,config:i}=e,{type:a}=n,s=t.filled??Ct("filled",n,i),o=rt(["bar","point","circle","square","geoshape"],a)?"transparent":void 0,u=Ct(s===!0?"color":void 0,n,i,{vgChannel:"fill"})??i.mark[s===!0&&"color"]??o,l=Ct(s===!1?"color":void 0,n,i,{vgChannel:"stroke"})??i.mark[s===!1&&"color"],c=s?"fill":"stroke",f={...u?{fill:Ot(u)}:{},...l?{stroke:Ot(l)}:{}};return n.color&&(s?n.fill:n.stroke)&&ce(c8("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...jn("color",e,{vgChannel:c,defaultValue:s?u:l}),...jn("fill",e,{defaultValue:r.fill?u:void 0}),...jn("stroke",e,{defaultValue:r.stroke?l:void 0})}}function Owe(e){const{encoding:t,mark:n}=e,r=t.order;return!au(n)&&oa(r)?$f({model:e,channelDef:r,vgChannel:"zindex",mainRefFn:i=>Ot(i.value),invalidValueRef:void 0}):{}}function Df({channel:e,markDef:t,encoding:n={},model:r,bandPosition:i}){const a=`${e}Offset`,s=t[a],o=n[a];if((a==="xOffset"||a==="yOffset")&&o)return{offsetType:"encoding",offset:Gk({channel:a,channelDef:o,markDef:t,config:r==null?void 0:r.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:Ot(s),bandPosition:i})};const u=t[a];return u?{offsetType:"visual",offset:u}:{}}function Mr(e,t,{defaultPos:n,vgChannel:r}){const{encoding:i,markDef:a,config:s,stack:o}=t,u=i[e],l=i[Ha(e)],c=t.scaleName(e),f=t.getScaleComponent(e),{offset:d,offsetType:h}=Df({channel:e,markDef:a,encoding:i,model:t,bandPosition:.5}),g=$_({model:t,defaultPos:n,channel:e,scaleName:c,scale:f}),p=!u&&Qt(e)&&(i.latitude||i.longitude)?{field:t.getName(e)}:Iwe({channel:e,channelDef:u,channel2Def:l,markDef:a,config:s,scaleName:c,scale:f,stack:o,offset:d,defaultRef:g,bandPosition:h==="encoding"?0:void 0});return p?{[r||e]:p}:void 0}function Iwe(e){const{channel:t,channelDef:n,scaleName:r,stack:i,offset:a,markDef:s}=e;if(He(n)&&i&&t===i.fieldChannel){if(fe(n)){let o=n.bandPosition;if(o===void 0&&s.type==="text"&&(t==="radius"||t==="theta")&&(o=.5),o!==void 0)return Vy({scaleName:r,fieldOrDatumDef:n,startSuffix:"start",bandPosition:o,offset:a})}return Dl(n,r,{suffix:"end"},{offset:a})}return jk(e)}function $_({model:e,defaultPos:t,channel:n,scaleName:r,scale:i}){const{markDef:a,config:s}=e;return()=>{const o=Fl(n),u=nu(n),l=Ct(n,a,s,{vgChannel:u});if(l!==void 0)return Dg(n,l);switch(t){case"zeroOrMin":return _7({scaleName:r,scale:i,mode:"zeroOrMin",mainChannel:o,config:s});case"zeroOrMax":return _7({scaleName:r,scale:i,mode:{zeroOrMax:{widthSignal:e.width.signal,heightSignal:e.height.signal}},mainChannel:o,config:s});case"mid":return{...e[Wr(n)],mult:.5}}}}function _7({mainChannel:e,config:t,...n}){const r=U8(n),{mode:i}=n;if(r)return r;switch(e){case"radius":{if(i==="zeroOrMin")return{value:0};const{widthSignal:a,heightSignal:s}=i.zeroOrMax;return{signal:`min(${a},${s})/2`}}case"theta":return i==="zeroOrMin"?{value:0}:{signal:"2*PI"};case"x":return i==="zeroOrMin"?{value:0}:{field:{group:"width"}};case"y":return i==="zeroOrMin"?{field:{group:"height"}}:{value:0}}}const Bwe={left:"x",center:"xc",right:"x2"},Lwe={top:"y",middle:"yc",bottom:"y2"};function A7(e,t,n,r="middle"){if(e==="radius"||e==="theta")return nu(e);const i=e==="x"?"align":"baseline",a=Ct(i,t,n);let s;return Ae(a)?(ce(Vye(i)),s=void 0):s=a,e==="x"?Bwe[s||(r==="top"?"left":"center")]:Lwe[s||r]}function f1(e,t,{defaultPos:n,defaultPos2:r,range:i}){return i?T7(e,t,{defaultPos:n,defaultPos2:r}):Mr(e,t,{defaultPos:n})}function T7(e,t,{defaultPos:n,defaultPos2:r}){const{markDef:i,config:a}=t,s=Ha(e),o=Wr(e),u=zwe(t,r,s),l=u[o]?A7(e,i,a):nu(e);return{...Mr(e,t,{defaultPos:n,vgChannel:l}),...u}}function zwe(e,t,n){const{encoding:r,mark:i,markDef:a,stack:s,config:o}=e,u=Fl(n),l=Wr(n),c=nu(n),f=r[u],d=e.scaleName(u),h=e.getScaleComponent(u),{offset:g}=n in r||n in a?Df({channel:n,markDef:a,encoding:r,model:e}):Df({channel:u,markDef:a,encoding:r,model:e});if(!f&&(n==="x2"||n==="y2")&&(r.latitude||r.longitude)){const v=Wr(n),m=e.markDef[v];return m!=null?{[v]:{value:m}}:{[c]:{field:e.getName(n)}}}const p=qwe({channel:n,channelDef:f,channel2Def:r[n],markDef:a,config:o,scaleName:d,scale:h,stack:s,offset:g,defaultRef:void 0});return p!==void 0?{[c]:p}:d1(n,a)||d1(n,{[n]:bk(n,a,o.style),[l]:bk(l,a,o.style)})||d1(n,o[i])||d1(n,o.mark)||{[c]:$_({model:e,defaultPos:t,channel:n,scaleName:d,scale:h})()}}function qwe({channel:e,channelDef:t,channel2Def:n,markDef:r,config:i,scaleName:a,scale:s,stack:o,offset:u,defaultRef:l}){return He(t)&&o&&e.charAt(0)===o.fieldChannel.charAt(0)?Dl(t,a,{suffix:"start"},{offset:u}):jk({channel:e,channelDef:n,scaleName:a,scale:s,stack:o,markDef:r,config:i,offset:u,defaultRef:l})}function d1(e,t){const n=Wr(e),r=nu(e);if(t[r]!==void 0)return{[r]:Dg(e,t[r])};if(t[e]!==void 0)return{[r]:Dg(e,t[e])};if(t[n]){const i=t[n];if($l(i))ce(Iye(n));else return{[n]:Dg(e,i)}}}function Qs(e,t){const{config:n,encoding:r,markDef:i}=e,a=i.type,s=Ha(t),o=Wr(t),u=r[t],l=r[s],c=e.getScaleComponent(t),f=c?c.get("type"):void 0,d=i.orient,h=r[o]??r.size??Ct("size",i,n,{vgChannel:o}),g=B6(t),p=a==="bar"&&(t==="x"?d==="vertical":d==="horizontal")||a==="tick"&&(t==="y"?d==="vertical":d==="horizontal");return fe(u)&&($t(u.bin)||Vn(u.bin)||u.timeUnit&&!l)&&!(h&&!$l(h))&&!r[g]&&!Tn(f)?Wwe({fieldDef:u,fieldDef2:l,channel:t,model:e}):(He(u)&&Tn(f)||p)&&!l?Vwe(u,t,e):T7(t,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"})}function Uwe(e,t,n,r,i,a,s){if($l(i))if(n){const u=n.get("type");if(u==="band"){let l=`bandwidth('${t}')`;i.band!==1&&(l=`${i.band} * ${l}`);const c=Ga("minBandSize",{type:s},r);return{signal:c?`max(${ia(c)}, ${l})`:l}}else i.band!==1&&(ce(Gye(u)),i=void 0)}else return{mult:i.band,field:{group:e}};else{if(Ae(i))return i;if(i)return{value:i}}if(n){const u=n.get("range");if(Cl(u)&&yt(u.step))return{value:u.step-2}}if(!a){const{bandPaddingInner:u,barBandPaddingInner:l,rectBandPaddingInner:c,tickBandPaddingInner:f}=r.scale,d=en(u,s==="tick"?f:s==="bar"?l:c);if(Ae(d))return{signal:`(1 - (${d.signal})) * ${e}`};if(yt(d))return{signal:`${1-d} * ${e}`}}return{value:g_(r.view,e)-2}}function Vwe(e,t,n){var S,_;const{markDef:r,encoding:i,config:a,stack:s}=n,o=r.orient,u=n.scaleName(t),l=n.getScaleComponent(t),c=Wr(t),f=Ha(t),d=B6(t),h=n.scaleName(d),g=n.getScaleComponent(ck(t)),p=r.type==="tick"||o==="horizontal"&&t==="y"||o==="vertical"&&t==="x";let v;(i.size||r.size)&&(p?v=jn("size",n,{vgChannel:c,defaultRef:Ot(r.size)}):ce(Zye(r.type)));const m=!!v,y=J8({channel:t,fieldDef:e,markDef:r,config:a,scaleType:(S=l||g)==null?void 0:S.get("type"),useVlSizeChannel:p});v=v||{[c]:Uwe(c,h||u,g||l,a,y,!!e,r.type)};const b=((_=l||g)==null?void 0:_.get("type"))==="band"&&$l(y)&&!m?"top":"middle",w=A7(t,r,a,b),E=w==="xc"||w==="yc",{offset:F,offsetType:x}=Df({channel:t,markDef:r,encoding:i,model:n,bandPosition:E?.5:0}),C=jk({channel:t,channelDef:e,markDef:r,config:a,scaleName:u,scale:l,stack:s,offset:F,defaultRef:$_({model:n,defaultPos:"mid",channel:t,scaleName:u,scale:l}),bandPosition:E?x==="encoding"?0:.5:Ae(y)?{signal:`(1-${y})/2`}:$l(y)?(1-y.band)/2:0});if(c)return{[w]:C,...v};{const k=nu(f),T=v[c],A=F?{...T,offset:F}:T;return{[w]:C,[k]:ee(C)?[C[0],{...C[1],offset:A}]:{...C,offset:A}}}}function M7(e,t,n,r,i,a,s){if(D6(e))return 0;const o=e==="x"||e==="y2",u=o?-t/2:t/2;if(Ae(n)||Ae(i)||Ae(r)||a){const l=ia(n),c=ia(i),f=ia(r),d=ia(a),g=a?`(${s} < ${d} ? ${o?"":"-"}0.5 * (${d} - (${s})) : ${u})`:u,p=f?`${f} + `:"",v=l?`(${l} ? -1 : 1) * `:"",m=c?`(${c} + ${g})`:g;return{signal:p+v+m}}else return i=i||0,r+(n?-i-u:+i+u)}function Wwe({fieldDef:e,fieldDef2:t,channel:n,model:r}){var _;const{config:i,markDef:a,encoding:s}=r,o=r.getScaleComponent(n),u=r.scaleName(n),l=o?o.get("type"):void 0,c=o.get("reverse"),f=J8({channel:n,fieldDef:e,markDef:a,config:i,scaleType:l}),d=(_=r.component.axes[n])==null?void 0:_[0],h=(d==null?void 0:d.get("translate"))??.5,g=Qt(n)?Ct("binSpacing",a,i)??0:0,p=Ha(n),v=nu(n),m=nu(p),y=Ga("minBandSize",a,i),{offset:b}=Df({channel:n,markDef:a,encoding:s,model:r,bandPosition:0}),{offset:w}=Df({channel:p,markDef:a,encoding:s,model:r,bandPosition:0}),E=vbe({fieldDef:e,scaleName:u}),F=M7(n,g,c,h,b,y,E),x=M7(p,g,c,h,w??b,y,E),C=Ae(f)?{signal:`(1-${f.signal})/2`}:$l(f)?(1-f.band)/2:.5,S=su({fieldDef:e,fieldDef2:t,markDef:a,config:i});if($t(e.bin)||e.timeUnit){const k=e.timeUnit&&S!==.5;return{[m]:$7({fieldDef:e,scaleName:u,bandPosition:C,offset:x,useRectOffsetField:k}),[v]:$7({fieldDef:e,scaleName:u,bandPosition:Ae(C)?{signal:`1-${C.signal}`}:1-C,offset:F,useRectOffsetField:k})}}else if(Vn(e.bin)){const k=Dl(e,u,{},{offset:x});if(fe(t))return{[m]:k,[v]:Dl(t,u,{},{offset:F})};if(Sl(e.bin)&&e.bin.step)return{[m]:k,[v]:{signal:`scale("${u}", ${pe(e,{expr:"datum"})} + ${e.bin.step})`,offset:F}}}ce(p8(p))}function $7({fieldDef:e,scaleName:t,bandPosition:n,offset:r,useRectOffsetField:i}){return Vy({scaleName:t,fieldOrDatumDef:e,bandPosition:n,offset:r,...i?{startSuffix:o1,endSuffix:u1}:{}})}const Hwe=new Set(["aria","width","height"]);function Ti(e,t){const{fill:n=void 0,stroke:r=void 0}=t.color==="include"?k7(e):{};return{...jwe(e.markDef,t),...D7("fill",n),...D7("stroke",r),...jn("opacity",e),...jn("fillOpacity",e),...jn("strokeOpacity",e),...jn("strokeWidth",e),...jn("strokeDash",e),...Owe(e),...F7(e),...M_(e,"href"),...Rwe(e)}}function D7(e,t){return t?{[e]:t}:{}}function jwe(e,t){return oye.reduce((n,r)=>(!Hwe.has(r)&&le(e,r)&&t[r]!=="ignore"&&(n[r]=Ot(e[r])),n),{})}function D_(e){const{config:t,markDef:n}=e,r=new Set;if(e.forEachFieldDef((i,a)=>{var l;let s;if(!ja(a)||!(s=e.getScaleType(a)))return;const o=Dy(i.aggregate),u=Hk({scaleChannel:a,markDef:n,config:t,scaleType:s,isCountAggregate:o});if(hbe(u)){const c=e.vgField(a,{expr:"datum",binSuffix:(l=e.stack)!=null&&l.impute?"mid":void 0});c&&r.add(c)}}),r.size>0)return{defined:{signal:[...r].map(a=>Iy(a,!0)).join(" && ")}}}function R7(e,t){if(t!==void 0)return{[e]:Ot(t)}}const R_="voronoi",P7={defined:e=>e.type==="point"&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(R_)},marks:(e,t,n)=>{const{x:r,y:i}=t.project.hasChannel,a=e.mark;if(au(a))return ce(hye(a)),n;const s={name:e.getName(R_),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...F7(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:r||!i?"datum.datum.x || 0":"0"},y:{expr:i||!r?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let o=0,u=!1;return n.forEach((l,c)=>{const f=l.name??"";f===e.component.mark[0].name?o=c:f.includes(R_)&&(u=!0)}),u||n.splice(o+1,0,s),n}},N7={defined:e=>e.type==="point"&&e.resolve==="global"&&e.bind&&e.bind!=="scales"&&!u_(e.bind),parse:(e,t,n)=>H7(t,n),topLevelSignals:(e,t,n)=>{var u;const r=t.name,i=t.project,a=t.bind,s=(u=t.init)==null?void 0:u[0],o=P7.defined(t)?"(item().isVoronoi ? datum.datum : datum)":"datum";return i.items.forEach((l,c)=>{const f=Ut(`${r}_${l.field}`);n.filter(h=>h.name===f).length||n.unshift({name:f,...s?{init:Ol(s[c])}:{value:null},on:t.events?[{events:t.events,update:`datum && item().mark.marktype !== 'group' ? ${o}[${he(l.field)}] : null`}]:[],bind:a[l.field]??a[l.channel]??a})}),n},signals:(e,t,n)=>{const r=t.name,i=t.project,a=n.find(l=>l.name===r+Js),s=r+zg,o=i.items.map(l=>Ut(`${r}_${l.field}`)),u=o.map(l=>`${l} !== null`).join(" && ");return o.length&&(a.update=`${u} ? {fields: ${s}, values: [${o.join(", ")}]} : null`),delete a.value,delete a.on,n}},h1="_toggle",O7={defined:e=>e.type==="point"&&!ts(e)&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+h1,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Js,r=t.name+h1;return`${r} ? null : ${n}, ${t.resolve==="global"?`${r} ? null : true, `:`${r} ? null : {unit: ${Bl(e)}}, `}${r} ? ${n} : null`}},Gwe={defined:e=>e.clear!==void 0&&e.clear!==!1&&!ts(e),parse:(e,t)=>{t.clear&&(t.clear=Ee(t.clear)?gl(t.clear,"view"):t.clear)},topLevelSignals:(e,t,n)=>{if(N7.defined(t))for(const r of t.project.items){const i=n.findIndex(a=>a.name===Ut(`${t.name}_${r.field}`));i!==-1&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function r(i,a){i!==-1&&n[i].on&&n[i].on.push({events:t.clear,update:a})}if(t.type==="interval")for(const i of t.project.items){const a=n.findIndex(s=>s.name===i.signals.visual);if(r(a,"[0, 0]"),a===-1){const s=n.findIndex(o=>o.name===i.signals.data);r(s,"null")}}else{let i=n.findIndex(a=>a.name===t.name+Js);r(i,"null"),O7.defined(t)&&(i=n.findIndex(a=>a.name===t.name+h1),r(i,"false"))}return n}},I7={defined:e=>{const t=e.resolve==="global"&&e.bind&&u_(e.bind),n=e.project.items.length===1&&e.project.items[0].field!==la;return t&&!n&&ce(mye),t&&n},parse:(e,t,n)=>{const r=qe(n);if(r.select=Ee(r.select)?{type:r.select,toggle:t.toggle}:{...r.select,toggle:t.toggle},H7(t,r),we(n.select)&&(n.select.on||n.select.clear)){const s='event.item && indexof(event.item.mark.role, "legend") < 0';for(const o of t.events)o.filter=be(o.filter??[]),o.filter.includes(s)||o.filter.push(s)}const i=l_(t.bind)?t.bind.legend:"click",a=Ee(i)?gl(i,"view"):be(i);t.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const r=t.name,i=l_(t.bind)&&t.bind.legend,a=s=>o=>{const u=qe(o);return u.markname=s,u};for(const s of t.project.items){if(!s.hasLegend)continue;const o=`${Ut(s.field)}_legend`,u=`${r}_${o}`;if(n.filter(c=>c.name===u).length===0){const c=i.merge.map(a(`${o}_symbols`)).concat(i.merge.map(a(`${o}_labels`))).concat(i.merge.map(a(`${o}_entries`)));n.unshift({name:u,...t.init?{}:{value:null},on:[{events:c,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:i.merge,update:`!event.item || !datum ? null : ${u}`,force:!0}]})}}return n},signals:(e,t,n)=>{const r=t.name,i=t.project,a=n.find(d=>d.name===r+Js),s=r+zg,o=i.items.filter(d=>d.hasLegend).map(d=>Ut(`${r}_${Ut(d.field)}_legend`)),l=`${o.map(d=>`${d} !== null`).join(" && ")} ? {fields: ${s}, values: [${o.join(", ")}]} : null`;t.events&&o.length>0?a.on.push({events:o.map(d=>({signal:d})),update:l}):o.length>0&&(a.update=l,delete a.value,delete a.on);const c=n.find(d=>d.name===r+h1),f=l_(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:f}):c.on[0].events=f),n}};function Ywe(e,t,n){var i;const r=(i=e.fieldDef(t))==null?void 0:i.field;for(const a of dn(e.component.selection??{})){const s=a.project.hasField[r]??a.project.hasChannel[t];if(s&&I7.defined(a)){const o=n.get("selections")??[];o.push(a.name),n.set("selections",o,!1),s.hasLegend=!0}}}const B7="_translate_anchor",L7="_translate_delta",Xwe={defined:e=>e.type==="interval"&&e.translate,signals:(e,t,n)=>{const r=t.name,i=Zs.defined(t),a=r+B7,{x:s,y:o}=t.project.hasChannel;let u=gl(t.translate,"scope");return i||(u=u.map(l=>(l.between[0].markname=r+Mf,l))),n.push({name:a,value:{},on:[{events:u.map(l=>l.between[0]),update:`{x: x(unit), y: y(unit)${s!==void 0?`, extent_x: ${i?A_(e,Bt):`slice(${s.signals.visual})`}`:""}${o!==void 0?`, extent_y: ${i?A_(e,_n):`slice(${o.signals.visual})`}`:""}}`}]},{name:r+L7,value:{},on:[{events:u,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),s!==void 0&&z7(e,t,s,"width",n),o!==void 0&&z7(e,t,o,"height",n),n}};function z7(e,t,n,r,i){const a=t.name,s=a+B7,o=a+L7,u=n.channel,l=Zs.defined(t),c=i.find(E=>E.name===n.signals[l?"data":"visual"]),f=e.getSizeSignalRef(r).signal,d=e.getScaleComponent(u),h=d==null?void 0:d.get("type"),g=d==null?void 0:d.get("reverse"),p=l?u===Bt?g?"":"-":g?"-":"":"",v=`${s}.extent_${u}`,m=`${p}${o}.${u} / ${l?`${f}`:`span(${v})`}`,y=!l||!d?"panLinear":h==="log"?"panLog":h==="symlog"?"panSymlog":h==="pow"?"panPow":"panLinear",b=l?h==="pow"?`, ${d.get("exponent")??1}`:h==="symlog"?`, ${d.get("constant")??1}`:"":"",w=`${y}(${v}, ${m}${b})`;c.on.push({events:{signal:o},update:l?w:`clampRange(${w}, 0, ${f})`})}const q7="_zoom_anchor",U7="_zoom_delta",Kwe={defined:e=>e.type==="interval"&&e.zoom,signals:(e,t,n)=>{const r=t.name,i=Zs.defined(t),a=r+U7,{x:s,y:o}=t.project.hasChannel,u=he(e.scaleName(Bt)),l=he(e.scaleName(_n));let c=gl(t.zoom,"scope");return i||(c=c.map(f=>(f.markname=r+Mf,f))),n.push({name:r+q7,on:[{events:c,update:i?`{${[u?`x: invert(${u}, x(unit))`:"",l?`y: invert(${l}, y(unit))`:""].filter(f=>f).join(", ")}}`:"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:c,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),s!==void 0&&V7(e,t,s,"width",n),o!==void 0&&V7(e,t,o,"height",n),n}};function V7(e,t,n,r,i){const a=t.name,s=n.channel,o=Zs.defined(t),u=i.find(y=>y.name===n.signals[o?"data":"visual"]),l=e.getSizeSignalRef(r).signal,c=e.getScaleComponent(s),f=c==null?void 0:c.get("type"),d=o?A_(e,s):u.name,h=a+U7,g=`${a}${q7}.${s}`,p=!o||!c?"zoomLinear":f==="log"?"zoomLog":f==="symlog"?"zoomSymlog":f==="pow"?"zoomPow":"zoomLinear",v=o?f==="pow"?`, ${c.get("exponent")??1}`:f==="symlog"?`, ${c.get("constant")??1}`:"":"",m=`${p}(${d}, ${g}, ${h}${v})`;u.on.push({events:{signal:h},update:o?m:`clampRange(${m}, 0, ${l})`})}const Il="_store",Js="_tuple",Zwe="_modify",W7="vlSelectionResolve",g1=[Fwe,$we,wwe,O7,N7,Zs,I7,Gwe,Xwe,Kwe,P7];function Qwe(e){let t=e.parent;for(;t&&!ai(t);)t=t.parent;return t}function Bl(e,{escape:t}={escape:!0}){let n=t?he(e.name):e.name;const r=Qwe(e);if(r){const{facet:i}=r;for(const a of Ai)i[a]&&(n+=` + '__facet_${a}_' + (facet[${he(r.vgField(a))}])`)}return n}function P_(e){return dn(e.component.selection??{}).reduce((t,n)=>t||n.project.hasSelectionId,!1)}function H7(e,t){(Ee(t.select)||!t.select.on)&&delete e.events,(Ee(t.select)||!t.select.clear)&&delete e.clear,(Ee(t.select)||!t.select.toggle)&&delete e.toggle}function ts(e){var t;return(t=e.events)==null?void 0:t.find(n=>"type"in n&&n.type==="timer")}function N_(e){const t=[];return e.type==="Identifier"?[e.name]:e.type==="Literal"?[e.value]:(e.type==="MemberExpression"&&(t.push(...N_(e.object)),t.push(...N_(e.property))),t)}function j7(e){return e.object.type==="MemberExpression"?j7(e.object):e.object.name==="datum"}function G7(e){const t=Tz(e),n=new Set;return t.visit(r=>{r.type==="MemberExpression"&&j7(r)&&n.add(N_(r).slice(1).join("."))}),n}class Rf extends xt{constructor(n,r,i){super(n);re(this,"model");re(this,"filter");re(this,"expr");re(this,"_dependentFields");this.model=r,this.filter=i,this.expr=p1(this.model,this.filter,this),this._dependentFields=G7(this.expr)}clone(){return new Rf(null,this.model,qe(this.filter))}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Jwe(e,t){const n={},r=e.config.selection;if(!t||!t.length)return n;let i=0;for(const a of t){const s=Ut(a.name),o=a.select,u=Ee(o)?o:o.type,l=we(o)?qe(o):{type:u},c=r[u];for(const h in c)h==="fields"||h==="encodings"||(h==="mark"&&(l.mark={...c.mark,...l.mark}),(l[h]===void 0||l[h]===!0)&&(l[h]=qe(c[h]??l[h])));const f=n[s]={...l,name:s,type:u,init:a.value,bind:a.bind,events:Ee(l.on)?gl(l.on,"scope"):be(qe(l.on))};if(ts(f)&&(i++,i>1)){delete n[s];continue}const d=qe(a);for(const h of g1)h.defined(f)&&h.parse&&h.parse(e,f,d)}return i>1&&ce(Fye),n}function Y7(e,t,n,r="datum"){const i=Ee(t)?t:t.param,a=Ut(i),s=he(a+Il);let o;try{o=e.getSelectionComponent(a,i)}catch{return`!!${a}`}if(o.project.timeUnit){const d=n??e.component.data.raw,h=o.project.timeUnit.clone();d.parent?h.insertAsParentOf(d):d.parent=h}const u=o.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest(",l=o.resolve==="global"?")":`, ${he(o.resolve)})`,c=`${u}${s}, ${r}${l}`,f=`length(data(${s}))`;return t.empty===!1?`${f} && ${c}`:`!${f} || ${c}`}function X7(e,t,n){const r=Ut(t),i=n.encoding;let a=n.field,s;try{s=e.getSelectionComponent(r,t)}catch{return r}if(!i&&!a)a=s.project.items[0].field,s.project.items.length>1&&ce(Sye(a));else if(i&&!a){const o=s.project.items.filter(u=>u.channel===i);!o.length||o.length>1?(a=s.project.items[0].field,ce(Cye(o,i,n,a))):a=o[0].field}return`${s.name}[${he(Qi(a))}]`}function exe(e,t){for(const[n,r]of wl(e.component.selection??{})){const i=e.getName(`lookup_${n}`);e.component.data.outputNodes[i]=r.materialized=new Hr(new Rf(t,e,{param:n}),i,Vt.Lookup,e.component.data.outputNodeRefCounts)}}function p1(e,t,n){return Fy(t,r=>Ee(r)?r:P1e(r)?Y7(e,r,n):_8(r))}function txe(e,t){if(e)return ee(e)&&!iu(e)?e.map(n=>Jk(n,t)).join(", "):e}function O_(e,t,n,r){var i,a;e.encode??(e.encode={}),(i=e.encode)[t]??(i[t]={}),(a=e.encode[t]).update??(a.update={}),e.encode[t].update[n]=r}function Ug(e,t,n,r={header:!1}){var f,d;const{disable:i,orient:a,scale:s,labelExpr:o,title:u,zindex:l,...c}=e.combine();if(!i){for(const h in c){const g=h,p=Obe[g],v=c[g];if(p&&p!==t&&p!=="both")delete c[g];else if(Bg(v)){const{condition:m,...y}=v,b=be(m),w=c9[g];if(w){const{vgProp:E,part:F}=w,x=[...b.map(C=>{const{test:S,..._}=C;return{test:p1(null,S),..._}}),y];O_(c,F,E,x),delete c[g]}else if(w===null){const E={signal:b.map(F=>{const{test:x,...C}=F;return`${p1(null,x)} ? ${Y6(C)} : `}).join("")+Y6(y)};c[g]=E}}else if(Ae(v)){const m=c9[g];if(m){const{vgProp:y,part:b}=m;O_(c,b,y,v),delete c[g]}}rt(["labelAlign","labelBaseline"],g)&&c[g]===null&&delete c[g]}if(t==="grid"){if(!c.grid)return;if(c.encode){const{grid:h}=c.encode;c.encode={...h?{grid:h}:{}},Mt(c.encode)&&delete c.encode}return{scale:s,orient:a,...c,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:en(l,0)}}else{if(!r.header&&e.mainExtracted)return;if(o!==void 0){let g=o;(d=(f=c.encode)==null?void 0:f.labels)!=null&&d.update&&Ae(c.encode.labels.update.text)&&(g=pf(o,"datum.label",c.encode.labels.update.text.signal)),O_(c,"labels","text",{signal:g})}if(c.labelAlign===null&&delete c.labelAlign,c.encode){for(const g of f9)e.hasAxisPart(g)||delete c.encode[g];Mt(c.encode)&&delete c.encode}const h=txe(u,n);return{scale:s,orient:a,grid:!1,...h?{title:h}:{},...c,...n.aria===!1?{aria:!1}:{},zindex:en(l,0)}}}}function K7(e){const{axes:t}=e.component,n=[];for(const r of Ws)if(t[r]){for(const i of t[r])if(!i.get("disable")&&!i.get("gridScale")){const a=r==="x"?"height":"width",s=e.getSizeSignalRef(a).signal;a!==s&&n.push({name:a,update:s})}}return n}function nxe(e,t){const{x:n=[],y:r=[]}=e;return[...n.map(i=>Ug(i,"grid",t)),...r.map(i=>Ug(i,"grid",t)),...n.map(i=>Ug(i,"main",t)),...r.map(i=>Ug(i,"main",t))].filter(i=>i)}function Z7(e,t,n,r){return Object.assign.apply(null,[{},...e.map(i=>{if(i==="axisOrient"){const a=n==="x"?"bottom":"left",s=t[n==="x"?"axisBottom":"axisLeft"]||{},o=t[n==="x"?"axisTop":"axisRight"]||{},u=new Set([...ue(s),...ue(o)]),l={};for(const c of u.values())l[c]={signal:`${r.signal} === "${a}" ? ${ia(s[c])} : ${ia(o[c])}`};return l}return t[i]})])}function rxe(e,t,n,r){const i=t==="band"?["axisDiscrete","axisBand"]:t==="point"?["axisDiscrete","axisPoint"]:D8(t)?["axisQuantitative"]:t==="time"||t==="utc"?["axisTemporal"]:[],a=e==="x"?"axisX":"axisY",s=Ae(n)?"axisOrient":`axis${Sy(n)}`,o=[...i,...i.map(l=>a+l.substr(4))],u=["axis",s,a];return{vlOnlyAxisConfig:Z7(o,r,e,n),vgAxisConfig:Z7(u,r,e,n),axisConfigStyle:ixe([...u,...o],r)}}function ixe(e,t){var r;const n=[{}];for(const i of e){let a=(r=t[i])==null?void 0:r.style;if(a){a=be(a);for(const s of a)n.push(t.style[s])}}return Object.assign.apply(null,n)}function I_(e,t,n,r={}){var a;const i=K6(e,n,t);if(i!==void 0)return{configFrom:"style",configValue:i};for(const s of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(((a=r[s])==null?void 0:a[e])!==void 0)return{configFrom:s,configValue:r[s][e]};return{}}const Q7={scale:({model:e,channel:t})=>e.scaleName(t),format:({format:e})=>e,formatType:({formatType:e})=>e,grid:({fieldOrDatumDef:e,axis:t,scaleType:n})=>t.grid??axe(n,e),gridScale:({model:e,channel:t})=>sxe(e,t),labelAlign:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelAlign||eq(t,n,r),labelAngle:({labelAngle:e})=>e,labelBaseline:({axis:e,labelAngle:t,orient:n,channel:r})=>e.labelBaseline||J7(t,n,r),labelFlush:({axis:e,fieldOrDatumDef:t,channel:n})=>e.labelFlush??uxe(t.type,n),labelOverlap:({axis:e,fieldOrDatumDef:t,scaleType:n})=>e.labelOverlap??lxe(t.type,n,fe(t)&&!!t.timeUnit,fe(t)?t.sort:void 0),orient:({orient:e})=>e,tickCount:({channel:e,model:t,axis:n,fieldOrDatumDef:r,scaleType:i})=>{const a=e==="x"?"width":e==="y"?"height":void 0,s=a?t.getSizeSignalRef(a):void 0;return n.tickCount??fxe({fieldOrDatumDef:r,scaleType:i,size:s,values:n.values})},tickMinStep:({axis:e,format:t,fieldOrDatumDef:n})=>e.tickMinStep??dxe({format:t,fieldOrDatumDef:n}),title:({axis:e,model:t,channel:n})=>{if(e.title!==void 0)return e.title;const r=tq(t,n);if(r!==void 0)return r;const i=t.typedFieldDef(n),a=n==="x"?"x2":"y2",s=t.fieldDef(a);return Q6(i?[Q8(i)]:[],fe(s)?[Q8(s)]:[])},values:({axis:e,fieldOrDatumDef:t})=>hxe(e,t),zindex:({axis:e,fieldOrDatumDef:t,mark:n})=>e.zindex??gxe(n,t)};function axe(e,t){return!Tn(e)&&fe(t)&&!$t(t==null?void 0:t.bin)&&!Vn(t==null?void 0:t.bin)}function sxe(e,t){const n=t==="x"?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n)}function oxe(e,t,n,r,i){const a=t==null?void 0:t.labelAngle;if(a!==void 0)return Ae(a)?a:Cy(a);{const{configValue:s}=I_("labelAngle",r,t==null?void 0:t.style,i);return s!==void 0?Cy(s):n===Bt&&rt([Ik,Ok],e.type)&&!(fe(e)&&e.timeUnit)?270:void 0}}function B_(e){return`(((${e.signal} % 360) + 360) % 360)`}function J7(e,t,n,r){if(e!==void 0)if(n==="x"){if(Ae(e)){const i=B_(e),a=Ae(t)?`(${t.signal} === "top")`:t==="top";return{signal:`(45 < ${i} && ${i} < 135) || (225 < ${i} && ${i} < 315) ? "middle" :(${i} <= 45 || 315 <= ${i}) === ${a} ? "bottom" : "top"`}}if(45<e&&e<135||225<e&&e<315)return"middle";if(Ae(t)){const i=e<=45||315<=e?"===":"!==";return{signal:`${t.signal} ${i} "top" ? "bottom" : "top"`}}return(e<=45||315<=e)==(t==="top")?"bottom":"top"}else{if(Ae(e)){const i=B_(e),a=Ae(t)?`(${t.signal} === "left")`:t==="left";return{signal:`${i} <= 45 || 315 <= ${i} || (135 <= ${i} && ${i} <= 225) ? ${r?'"middle"':"null"} : (45 <= ${i} && ${i} <= 135) === ${a} ? "top" : "bottom"`}}if(e<=45||315<=e||135<=e&&e<=225)return r?"middle":null;if(Ae(t)){const i=45<=e&&e<=135?"===":"!==";return{signal:`${t.signal} ${i} "left" ? "top" : "bottom"`}}return(45<=e&&e<=135)==(t==="left")?"top":"bottom"}}function eq(e,t,n){if(e===void 0)return;const r=n==="x",i=r?0:90,a=r?"bottom":"left";if(Ae(e)){const s=B_(e),o=Ae(t)?`(${t.signal} === "${a}")`:t===a;return{signal:`(${i?`(${s} + 90)`:s} % 180 === 0) ? ${r?null:'"center"'} :(${i} < ${s} && ${s} < ${180+i}) === ${o} ? "left" : "right"`}}if((e+i)%180===0)return r?null:"center";if(Ae(t)){const s=i<e&&e<180+i?"===":"!==";return{signal:`${`${t.signal} ${s} "${a}"`} ? "left" : "right"`}}return(i<e&&e<180+i)==(t===a)?"left":"right"}function uxe(e,t){if(t==="x"&&rt(["quantitative","temporal"],e))return!0}function lxe(e,t,n,r){if(n&&!we(r)||e!=="nominal"&&e!=="ordinal")return t==="log"||t==="symlog"?"greedy":!0}function cxe(e){return e==="x"?"bottom":"left"}function fxe({fieldOrDatumDef:e,scaleType:t,size:n,values:r}){var i;if(!r&&!Tn(t)&&t!=="log"){if(fe(e)){if($t(e.bin))return{signal:`ceil(${n.signal}/10)`};if(e.timeUnit&&rt(["month","hours","day","quarter"],(i=An(e.timeUnit))==null?void 0:i.unit))return}return{signal:`ceil(${n.signal}/40)`}}}function dxe({format:e,fieldOrDatumDef:t}){if(e==="d")return 1;if(fe(t)){const{timeUnit:n}=t;if(n){const r=S8(n);if(r)return{signal:r}}}}function tq(e,t){const n=t==="x"?"x2":"y2",r=e.fieldDef(t),i=e.fieldDef(n),a=r?r.title:void 0,s=i?i.title:void 0;if(a&&s)return J6(a,s);if(a)return a;if(s)return s;if(a!==void 0)return a;if(s!==void 0)return s}function hxe(e,t){const n=e.values;if(ee(n))return l9(t,n);if(Ae(n))return n}function gxe(e,t){return e==="rect"&&Yy(t)?1:0}class Pf extends xt{constructor(n,r){super(n);re(this,"transform");re(this,"_dependentFields");this.transform=r,this._dependentFields=G7(this.transform.calculate)}clone(){return new Pf(null,qe(this.transform))}static parseAllForSortIndex(n,r){return r.forEachFieldDef((i,a)=>{if(Pl(i)&&Z8(i.sort)){const{field:s,timeUnit:o}=i,u=i.sort,l=u.map((c,f)=>`${_8({field:s,timeUnit:o,equal:c})} ? ${f} : `).join("")+u.length;n=new Pf(n,{calculate:l,as:Nf(i,a,{forAs:!0})})}}),n}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${at(this.transform)}`}}function Nf(e,t,n){return pe(e,{prefix:t,suffix:"sort_index",...n})}function v1(e,t){return rt(["top","bottom"],t)?"column":rt(["left","right"],t)||e==="row"?"row":"column"}function Of(e,t,n,r){const i=r==="row"?n.headerRow:r==="column"?n.headerColumn:n.headerFacet;return en((t||{})[e],i[e],n.header[e])}function m1(e,t,n,r){const i={};for(const a of e){const s=Of(a,t||{},n,r);s!==void 0&&(i[a]=s)}return i}const L_=["row","column"],z_=["header","footer"];function pxe(e,t){const n=e.component.layoutHeaders[t].title,r=e.config?e.config:void 0,i=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:a,titleAngle:s,titleOrient:o}=m1(["titleAnchor","titleAngle","titleOrient"],i.header,r,t),u=v1(t,o),l=Cy(s);return{name:`${t}-title`,type:"group",role:`${u}-title`,title:{text:n,...t==="row"?{orient:"left"}:{},style:"guide-title",...rq(l,u),...nq(u,l,a),...iq(r,i,t,r2e,$9)}}}function nq(e,t,n="middle"){switch(n){case"start":return{align:"left"};case"end":return{align:"right"}}const r=eq(t,e==="row"?"left":"top",e==="row"?"y":"x");return r?{align:r}:{}}function rq(e,t){const n=J7(e,t==="row"?"left":"top",t==="row"?"y":"x",!0);return n?{baseline:n}:{}}function vxe(e,t){const n=e.component.layoutHeaders[t],r=[];for(const i of z_)if(n[i])for(const a of n[i]){const s=yxe(e,t,i,n,a);s!=null&&r.push(s)}return r}function mxe(e,t){const{sort:n}=e;return Gs(n)?{field:pe(n,{expr:"datum"}),order:n.order??"ascending"}:ee(n)?{field:Nf(e,t,{expr:"datum"}),order:"ascending"}:{field:pe(e,{expr:"datum"}),order:n??"ascending"}}function q_(e,t,n){const{format:r,formatType:i,labelAngle:a,labelAnchor:s,labelOrient:o,labelExpr:u}=m1(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),l=Yk({fieldOrDatumDef:e,format:r,formatType:i,expr:"parent",config:n}).signal,c=v1(t,o);return{text:{signal:u?pf(pf(u,"datum.label",l),"datum.value",pe(e,{expr:"parent"})):l},...t==="row"?{orient:"left"}:{},style:"guide-label",frame:"group",...rq(a,c),...nq(c,a,s),...iq(n,e,t,i2e,D9)}}function yxe(e,t,n,r,i){if(i){let a=null;const{facetFieldDef:s}=r,o=e.config?e.config:void 0;if(s&&i.labels){const{labelOrient:f}=m1(["labelOrient"],s.header,o,t);(t==="row"&&!rt(["top","bottom"],f)||t==="column"&&!rt(["left","right"],f))&&(a=q_(s,t,o))}const u=ai(e)&&!Pg(e.facet),l=i.axes,c=(l==null?void 0:l.length)>0;if(a||c){const f=t==="row"?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...r.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:mxe(s,t)}:{},...c&&u?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...a?{title:a}:{},...i.sizeSignal?{encode:{update:{[f]:i.sizeSignal}}}:{},...c?{axes:l}:{}}}}return null}const bxe={column:{start:0,end:1},row:{start:1,end:0}};function wxe(e,t){return bxe[t][e]}function xxe(e,t){const n={};for(const r of Ai){const i=e[r];if(i!=null&&i.facetFieldDef){const{titleAnchor:a,titleOrient:s}=m1(["titleAnchor","titleOrient"],i.facetFieldDef.header,t,r),o=v1(r,s),u=wxe(a,o);u!==void 0&&(n[o]=u)}}return Mt(n)?void 0:n}function iq(e,t,n,r,i){const a={};for(const s of r){if(!i[s])continue;const o=Of(s,t==null?void 0:t.header,e,n);o!==void 0&&(a[i[s]]=o)}return a}function U_(e){return[...y1(e,"width"),...y1(e,"height"),...y1(e,"childWidth"),...y1(e,"childHeight")]}function y1(e,t){const n=t==="width"?"x":"y",r=e.component.layoutSize.get(t);if(!r||r==="merged")return[];const i=e.getSizeSignalRef(t).signal;if(r==="step"){const a=e.getScaleComponent(n);if(a){const s=a.get("type"),o=a.get("range");if(Tn(s)&&Cl(o)){const u=e.scaleName(n);return ai(e.parent)&&e.parent.component.resolve.scale[n]==="independent"?[aq(u,o)]:[aq(u,o),{name:i,update:sq(u,a,`domain('${u}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}else if(r=="container"){const a=i.endsWith("width"),s=a?"containerSize()[0]":"containerSize()[1]",o=h_(e.config.view,a?"width":"height"),u=`isFinite(${s}) ? ${s} : ${o}`;return[{name:i,init:u,on:[{update:u,events:"window:resize"}]}]}else return[{name:i,value:r}]}function aq(e,t){const n=`${e}_step`;return Ae(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function sq(e,t,n){const r=t.get("type"),i=t.get("padding"),a=en(t.get("paddingOuter"),i);let s=t.get("paddingInner");return s=r==="band"?s!==void 0?s:i:1,`bandspace(${n}, ${ia(s)}, ${ia(a)}) * ${e}_step`}function oq(e){return e==="childWidth"?"width":e==="childHeight"?"height":e}function uq(e,t){return ue(e).reduce((n,r)=>({...n,...$f({model:t,channelDef:e[r],vgChannel:r,mainRefFn:i=>Ot(i.value),invalidValueRef:void 0})}),{})}function lq(e,t){if(ai(t))return e==="theta"?"independent":"shared";if(zf(t))return"shared";if(iA(t))return Qt(e)||e==="theta"||e==="radius"?"independent":"shared";throw new Error("invalid model type for resolve")}function V_(e,t){const n=e.scale[t],r=Qt(t)?"axis":"legend";return n==="independent"?(e[r][t]==="shared"&&ce(n1e(t)),"independent"):e[r][t]||"shared"}const Exe={...s2e,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1},cq=ue(Exe);class Fxe extends Ks{}const fq={symbols:Sxe,gradient:Cxe,labels:kxe,entries:_xe};function Sxe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i,legendType:a}){if(a!=="symbol")return;const{markDef:s,encoding:o,config:u,mark:l}=n,c=s.filled&&l!=="trail";let f={...cye({},n,sbe),...k7(n,{filled:c})};const d=i.get("symbolOpacity")??u.legend.symbolOpacity,h=i.get("symbolFillColor")??u.legend.symbolFillColor,g=i.get("symbolStrokeColor")??u.legend.symbolStrokeColor,p=d===void 0?dq(o.opacity)??s.opacity:void 0;if(f.fill){if(r==="fill"||c&&r===Ur)delete f.fill;else if(le(f.fill,"field"))h?delete f.fill:(f.fill=Ot(u.legend.symbolBaseFillColor??"black"),f.fillOpacity=Ot(p??1));else if(ee(f.fill)){const v=W_(o.fill??o.color)??s.fill??(c&&s.color);v&&(f.fill=Ot(v))}}if(f.stroke){if(r==="stroke"||!c&&r===Ur)delete f.stroke;else if(le(f.stroke,"field")||g)delete f.stroke;else if(ee(f.stroke)){const v=en(W_(o.stroke||o.color),s.stroke,c?s.color:void 0);v&&(f.stroke={value:v})}}if(r!==Vs){const v=fe(t)&&gq(n,i,t);v?f.opacity=[{test:v,...Ot(p??1)},Ot(u.legend.unselectedOpacity)]:p&&(f.opacity=Ot(p))}return f={...f,...e},Mt(f)?void 0:f}function Cxe(e,{model:t,legendType:n,legendCmpt:r}){if(n!=="gradient")return;const{config:i,markDef:a,encoding:s}=t;let o={};const l=(r.get("gradientOpacity")??i.legend.gradientOpacity)===void 0?dq(s.opacity)||a.opacity:void 0;return l&&(o.opacity=Ot(l)),o={...o,...e},Mt(o)?void 0:o}function kxe(e,{fieldOrDatumDef:t,model:n,channel:r,legendCmpt:i}){const a=n.legend(r)||{},s=n.config,o=fe(t)?gq(n,i,t):void 0,u=o?[{test:o,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:l,formatType:c}=a;let f;Rl(c)?f=sa({fieldOrDatumDef:t,field:"datum.value",format:l,formatType:c,config:s}):l===void 0&&c===void 0&&s.customFormatTypes&&(t.type==="quantitative"&&s.numberFormatType?f=sa({fieldOrDatumDef:t,field:"datum.value",format:s.numberFormat,formatType:s.numberFormatType,config:s}):t.type==="temporal"&&s.timeFormatType&&fe(t)&&t.timeUnit===void 0&&(f=sa({fieldOrDatumDef:t,field:"datum.value",format:s.timeFormat,formatType:s.timeFormatType,config:s})));const d={...u?{opacity:u}:{},...f?{text:f}:{},...e};return Mt(d)?void 0:d}function _xe(e,{legendCmpt:t}){const n=t.get("selections");return n!=null&&n.length?{...e,fill:{value:"transparent"}}:e}function dq(e){return hq(e,(t,n)=>Math.max(t,n.value))}function W_(e){return hq(e,(t,n)=>en(t,n.value))}function hq(e,t){if(Sbe(e))return be(e.condition).reduce(t,e.value);if(oa(e))return e.value}function gq(e,t,n){const r=t.get("selections");if(!(r!=null&&r.length))return;const i=he(n.field);return r.map(a=>`(!length(data(${he(Ut(a)+Il)})) || (${a}[${i}] && indexof(${a}[${i}], datum.value) >= 0))`).join(" || ")}const pq={direction:({direction:e})=>e,format:({fieldOrDatumDef:e,legend:t,config:n})=>{const{format:r,formatType:i}=t;return j8(e,e.type,r,i,n,!1)},formatType:({legend:e,fieldOrDatumDef:t,scaleType:n})=>{const{formatType:r}=e;return G8(r,t,n)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??Pxe(e)},labelOverlap:({legend:e,legendConfig:t,scaleType:n})=>e.labelOverlap??t.labelOverlap??Nxe(n),symbolType:({legend:e,markDef:t,channel:n,encoding:r})=>e.symbolType??Txe(t.type,n,r.shape,t.shape),title:({fieldOrDatumDef:e,config:t})=>Sf(e,t,{allowDisabling:!0}),type:({legendType:e,scaleType:t,channel:n})=>{if(yf(n)&&Xa(t)){if(e==="gradient")return}else if(e==="symbol")return;return e},values:({fieldOrDatumDef:e,legend:t})=>Axe(t,e)};function Axe(e,t){const n=e.values;if(ee(n))return l9(t,n);if(Ae(n))return n}function Txe(e,t,n,r){if(t!=="shape"){const i=W_(n)??r;if(i)return i}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}function Mxe(e){const{legend:t}=e;return en(t.type,$xe(e))}function $xe({channel:e,timeUnit:t,scaleType:n}){if(yf(e)){if(rt(["quarter","month","day"],t))return"symbol";if(Xa(n))return"gradient"}return"symbol"}function Dxe({legendConfig:e,legendType:t,orient:n,legend:r}){return r.direction??e[t?"gradientDirection":"symbolDirection"]??Rxe(n,t)}function Rxe(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return t==="gradient"?"horizontal":void 0}}function Pxe({legendConfig:e,model:t,direction:n,orient:r,scaleType:i}){const{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:s,gradientVerticalMaxLength:o,gradientVerticalMinLength:u}=e;if(Xa(i))return n==="horizontal"?r==="top"||r==="bottom"?vq(t,"width",s,a):s:vq(t,"height",u,o)}function vq(e,t,n,r){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${r})`}}function Nxe(e){if(rt(["quantile","threshold","log","symlog"],e))return"greedy"}function mq(e){const t=Wt(e)?Oxe(e):zxe(e);return e.component.legends=t,t}function Oxe(e){const{encoding:t}=e,n={};for(const r of[Ur,...P9]){const i=hn(t[r]);!i||!e.getScaleComponent(r)||r===Vr&&fe(i)&&i.type===wf||(n[r]=Lxe(e,r))}return n}function Ixe(e,t){const n=e.scaleName(t);if(e.mark==="trail"){if(t==="color")return{stroke:n};if(t==="size")return{strokeWidth:n}}return t==="color"?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}function Bxe(e,t,n,r){switch(t){case"disable":return n!==void 0;case"values":return!!(n!=null&&n.values);case"title":if(t==="title"&&e===(r==null?void 0:r.title))return!0}return e===(n||{})[t]}function Lxe(e,t){var w;let n=e.legend(t);const{markDef:r,encoding:i,config:a}=e,s=a.legend,o=new Fxe({},Ixe(e,t));Ywe(e,t,o);const u=n!==void 0?!n:s.disable;if(o.set("disable",u,n!==void 0),u)return o;n=n||{};const l=e.getScaleComponent(t).get("type"),c=hn(i[t]),f=fe(c)?(w=An(c.timeUnit))==null?void 0:w.unit:void 0,d=n.orient||a.legend.orient||"right",h=Mxe({legend:n,channel:t,timeUnit:f,scaleType:l}),g=Dxe({legend:n,legendType:h,orient:d,legendConfig:s}),p={legend:n,channel:t,model:e,markDef:r,encoding:i,fieldOrDatumDef:c,legendConfig:s,config:a,scaleType:l,orient:d,legendType:h,direction:g};for(const E of cq){if(h==="gradient"&&E.startsWith("symbol")||h==="symbol"&&E.startsWith("gradient"))continue;const F=E in pq?pq[E](p):n[E];if(F!==void 0){const x=Bxe(F,E,n,e.fieldDef(t));(x||a.legend[E]===void 0)&&o.set(E,F,x)}}const v=(n==null?void 0:n.encoding)??{},m=o.get("selections"),y={},b={fieldOrDatumDef:c,model:e,channel:t,legendCmpt:o,legendType:h};for(const E of["labels","legend","title","symbols","gradient","entries"]){const F=uq(v[E]??{},e),x=E in fq?fq[E](F,b):F;x!==void 0&&!Mt(x)&&(y[E]={...m!=null&&m.length&&fe(c)?{name:`${Ut(c.field)}_legend_${E}`}:{},...m!=null&&m.length?{interactive:!!m}:{},update:x})}return Mt(y)||o.set("encode",y,!!(n!=null&&n.encoding)),o}function zxe(e){const{legends:t,resolve:n}=e.component;for(const r of e.children){mq(r);for(const i of ue(r.component.legends))n.legend[i]=V_(e.component.resolve,i),n.legend[i]==="shared"&&(t[i]=yq(t[i],r.component.legends[i]),t[i]||(n.legend[i]="independent",delete t[i]))}for(const r of ue(t))for(const i of e.children)i.component.legends[r]&&n.legend[r]==="shared"&&delete i.component.legends[r];return t}function yq(e,t){var a,s,o,u;if(!e)return t.clone();const n=e.getWithExplicit("orient"),r=t.getWithExplicit("orient");if(n.explicit&&r.explicit&&n.value!==r.value)return;let i=!1;for(const l of cq){const c=uu(e.getWithExplicit(l),t.getWithExplicit(l),l,"legend",(f,d)=>{switch(l){case"symbolType":return qxe(f,d);case"title":return e8(f,d);case"type":return i=!0,ii("symbol")}return s1(f,d,l,"legend")});e.setWithExplicit(l,c)}return i&&((s=(a=e.implicit)==null?void 0:a.encode)!=null&&s.gradient&&ak(e.implicit,["encode","gradient"]),(u=(o=e.explicit)==null?void 0:o.encode)!=null&&u.gradient&&ak(e.explicit,["encode","gradient"])),e}function qxe(e,t){return t.value==="circle"?t:e}function Uxe(e,t,n,r){var i,a;e.encode??(e.encode={}),(i=e.encode)[t]??(i[t]={}),(a=e.encode[t]).update??(a.update={}),e.encode[t].update[n]=r}function bq(e){const t=e.component.legends,n={};for(const i of ue(t)){const a=e.getScaleComponent(i),s=wt(a.get("domains"));if(n[s])for(const o of n[s])yq(o,t[i])||n[s].push(t[i]);else n[s]=[t[i].clone()]}return dn(n).flat().map(i=>Vxe(i,e.config)).filter(i=>i!==void 0)}function Vxe(e,t){var s,o,u;const{disable:n,labelExpr:r,selections:i,...a}=e.combine();if(!n){if(t.aria===!1&&a.aria==null&&(a.aria=!1),(s=a.encode)!=null&&s.symbols){const l=a.encode.symbols.update;l.fill&&l.fill.value!=="transparent"&&!l.stroke&&!a.stroke&&(l.stroke={value:"transparent"});for(const c of P9)a[c]&&delete l[c]}if(a.title||delete a.title,r!==void 0){let l=r;(u=(o=a.encode)==null?void 0:o.labels)!=null&&u.update&&Ae(a.encode.labels.update.text)&&(l=pf(r,"datum.label",a.encode.labels.update.text.signal)),Uxe(a,"labels","text",{signal:l})}return a}}function Wxe(e){return zf(e)||iA(e)?Hxe(e):wq(e)}function Hxe(e){return e.children.reduce((t,n)=>t.concat(n.assembleProjections()),wq(e))}function wq(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:r}=n;if(t.data){const i={signal:`[${t.size.map(s=>s.signal).join(", ")}]`},a=t.data.reduce((s,o)=>{const u=Ae(o)?o.signal:`data('${e.lookupDataSource(o)}')`;return rt(s,u)||s.push(u),s},[]);if(a.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:r,size:i,fit:{signal:a.length>1?`[${a.join(", ")}]`:a[0]},...n}]}else return[{name:r,translate:{signal:"[width / 2, height / 2]"},...n}]}const jxe=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class xq extends Ks{constructor(n,r,i,a){super({...r},{name:n});re(this,"specifiedProjection");re(this,"size");re(this,"data");re(this,"merged",!1);this.specifiedProjection=r,this.size=i,this.data=a}get isFit(){return!!this.data}}function Eq(e){e.component.projection=Wt(e)?Gxe(e):Kxe(e)}function Gxe(e){if(e.hasProjection){const t=Wn(e.specifiedProjection),n=!(t&&(t.scale!=null||t.translate!=null)),r=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,i=n?Yxe(e):void 0,a=new xq(e.projectionName(!0),{...Wn(e.config.projection),...t},r,i);return a.get("type")||a.set("type","equalEarth",!1),a}}function Yxe(e){const t=[],{encoding:n}=e;for(const r of[[na,ta],[_i,ra]])(hn(n[r[0]])||hn(n[r[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});return e.channelHasField(Vr)&&e.typedFieldDef(Vr).type===wf&&t.push({signal:e.getName(`geojson_${t.length}`)}),t.length===0&&t.push(e.requestDataName(Vt.Main)),t}function Xxe(e,t){const n=C6(jxe,i=>!!(!xe(e.explicit,i)&&!xe(t.explicit,i)||xe(e.explicit,i)&&xe(t.explicit,i)&&Ci(e.get(i),t.get(i))));if(Ci(e.size,t.size)){if(n)return e;if(Ci(e.explicit,{}))return t;if(Ci(t.explicit,{}))return e}return null}function Kxe(e){if(e.children.length===0)return;let t;for(const r of e.children)Eq(r);const n=C6(e.children,r=>{const i=r.component.projection;if(i)if(t){const a=Xxe(t,i);return a&&(t=a),!!a}else return t=i,!0;else return!0});if(t&&n){const r=e.projectionName(!0),i=new xq(r,t.specifiedProjection,t.size,qe(t.data));for(const a of e.children){const s=a.component.projection;s&&(s.isFit&&i.data.push(...a.component.projection.data),a.renameProjection(s.get("name"),r),s.merged=!0)}return i}}function Zxe(e,t,n,r){if(Ig(t,n)){const i=Wt(e)?e.axis(n)??e.legend(n)??{}:{},a=pe(t,{expr:"datum"}),s=pe(t,{expr:"datum",binSuffix:"end"});return{formulaAs:pe(t,{binSuffix:"range",forAs:!0}),formula:Rg(a,s,i.format,i.formatType,r)}}return{}}function Fq(e,t){return`${V6(e)}_${t}`}function Qxe(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}function H_(e,t,n){const r=Zy(n,void 0)??{},i=Fq(r,t);return e.getName(`${i}_bins`)}function Jxe(e){return"as"in e}function Sq(e,t,n){let r,i;Jxe(e)?r=Ee(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:r=[pe(e,{forAs:!0}),pe(e,{binSuffix:"end",forAs:!0})];const a={...Zy(t,void 0)},s=Fq(a,e.field),{signal:o,extentSignal:u}=Qxe(n,s);if(Ry(a.extent)){const c=a.extent;i=X7(n,c.param,c),delete a.extent}const l={bin:a,field:e.field,as:[r],...o?{signal:o}:{},...u?{extentSignal:u}:{},...i?{span:i}:{}};return{key:s,binComponent:l}}class ns extends xt{constructor(n,r){super(n);re(this,"bins");this.bins=r}clone(){return new ns(null,qe(this.bins))}static makeFromEncoding(n,r){const i=r.reduceFieldDef((a,s,o)=>{if(Tr(s)&&$t(s.bin)){const{key:u,binComponent:l}=Sq(s,s.bin,r);a[u]={...l,...a[u],...Zxe(r,s,o,r.config)}}return a},{});return Mt(i)?null:new ns(n,i)}static makeFromTransform(n,r,i){const{key:a,binComponent:s}=Sq(r,r.bin,i);return new ns(n,{[a]:s})}merge(n,r){for(const i of ue(n.bins))i in this.bins?(r(n.bins[i].signal,this.bins[i].signal),this.bins[i].as=Is([...this.bins[i].as,...n.bins[i].as],at)):this.bins[i]=n.bins[i];for(const i of n.children)n.removeChild(i),i.parent=this;n.remove()}producedFields(){return new Set(dn(this.bins).map(n=>n.as).flat(2))}dependentFields(){return new Set(dn(this.bins).map(n=>n.field))}hash(){return`Bin ${at(this.bins)}`}assemble(){return dn(this.bins).flatMap(n=>{const r=[],[i,...a]=n.as,{extent:s,...o}=n.bin,u={type:"bin",field:Qi(n.field),as:i,signal:n.signal,...Ry(s)?{extent:null}:{extent:s},...n.span?{span:{signal:`span(${n.span})`}}:{},...o};!s&&n.extentSignal&&(r.push({type:"extent",field:Qi(n.field),signal:n.extentSignal}),u.extent={signal:n.extentSignal}),r.push(u);for(const l of a)for(let c=0;c<2;c++)r.push({type:"formula",expr:pe({field:i[c]},{expr:"datum"}),as:l[c]});return n.formula&&r.push({type:"formula",expr:n.formula,as:n.formulaAs}),r})}}function eEe(e,t,n,r){var a;const i=Wt(r)?r.encoding[Ha(t)]:void 0;if(Tr(n)&&Wt(r)&&e9(n,i,r.markDef,r.config)){e.add(pe(n,{})),e.add(pe(n,{suffix:"end"}));const{mark:s,markDef:o,config:u}=r,l=su({fieldDef:n,markDef:o,config:u});$g(s)&&l!==.5&&Qt(t)&&(e.add(pe(n,{suffix:o1})),e.add(pe(n,{suffix:u1}))),n.bin&&Ig(n,t)&&e.add(pe(n,{binSuffix:"range"}))}else if(P6(t)){const s=R6(t);e.add(r.getName(s))}else e.add(pe(n));return Pl(n)&&G1e((a=n.scale)==null?void 0:a.range)&&e.add(n.scale.range.field),e}function tEe(e,t){for(const n of ue(t)){const r=t[n];for(const i of ue(r))n in e?e[n][i]=new Set([...e[n][i]??[],...r[i]]):e[n]={[i]:r[i]}}}class ca extends xt{constructor(n,r,i){super(n);re(this,"dimensions");re(this,"measures");this.dimensions=r,this.measures=i}clone(){return new ca(null,new Set(this.dimensions),qe(this.measures))}get groupBy(){return this.dimensions}static makeFromEncoding(n,r){let i=!1;r.forEachFieldDef(o=>{o.aggregate&&(i=!0)});const a={},s=new Set;return!i||(r.forEachFieldDef((o,u)=>{const{aggregate:l,field:c}=o;if(l)if(l==="count")a["*"]??(a["*"]={}),a["*"].count=new Set([pe(o,{forAs:!0})]);else{if(Hs(l)||ru(l)){const f=Hs(l)?"argmin":"argmax",d=l[f];a[d]??(a[d]={}),a[d][f]=new Set([pe({op:f,field:d},{forAs:!0})])}else a[c]??(a[c]={}),a[c][l]=new Set([pe(o,{forAs:!0})]);ja(u)&&r.scaleDomain(u)==="unaggregated"&&(a[c]??(a[c]={}),a[c].min=new Set([pe({field:c,aggregate:"min"},{forAs:!0})]),a[c].max=new Set([pe({field:c,aggregate:"max"},{forAs:!0})]))}else eEe(s,u,o,r)}),s.size+ue(a).length===0)?null:new ca(n,s,a)}static makeFromTransform(n,r){var s;const i=new Set,a={};for(const o of r.aggregate){const{op:u,field:l,as:c}=o;u&&(u==="count"?(a["*"]??(a["*"]={}),a["*"].count=new Set([c||pe(o,{forAs:!0})])):(a[l]??(a[l]={}),(s=a[l])[u]??(s[u]=new Set),a[l][u].add(c||pe(o,{forAs:!0}))))}for(const o of r.groupby??[])i.add(o);return i.size+ue(a).length===0?null:new ca(n,i,a)}merge(n){return Ame(this.dimensions,n.dimensions)?(tEe(this.measures,n.measures),!0):(y1e("different dimensions, cannot merge"),!1)}addDimensions(n){n.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...ue(this.measures)])}producedFields(){const n=new Set;for(const r of ue(this.measures))for(const i of ue(this.measures[r])){const a=this.measures[r][i];a.size===0?n.add(`${i}_${r}`):a.forEach(n.add,n)}return n}hash(){return`Aggregate ${at({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const n=[],r=[],i=[];for(const s of ue(this.measures))for(const o of ue(this.measures[s]))for(const u of this.measures[s][o])i.push(u),n.push(o),r.push(s==="*"?null:Qi(s));return{type:"aggregate",groupby:[...this.dimensions].map(Qi),ops:n,fields:r,as:i}}}class If extends xt{constructor(n,r,i,a){super(n);re(this,"model");re(this,"name");re(this,"data");re(this,"column");re(this,"row");re(this,"facet");re(this,"childModel");this.model=r,this.name=i,this.data=a;for(const s of Ai){const o=r.facet[s];if(o){const{bin:u,sort:l}=o;this[s]={name:r.getName(`${s}_domain`),fields:[pe(o),...$t(u)?[pe(o,{binSuffix:"end"})]:[]],...Gs(l)?{sortField:l}:ee(l)?{sortIndexField:Nf(o,s)}:{}}}}this.childModel=r.child}hash(){let n="Facet";for(const r of Ai)this[r]&&(n+=` ${r.charAt(0)}:${at(this[r])}`);return n}get fields(){var r;const n=[];for(const i of Ai)(r=this[i])!=null&&r.fields&&n.push(...this[i].fields);return n}dependentFields(){const n=new Set(this.fields);for(const r of Ai)this[r]&&(this[r].sortField&&n.add(this[r].sortField.field),this[r].sortIndexField&&n.add(this[r].sortIndexField));return n}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const n={};for(const r of Ws){const i=this.childModel.component.scales[r];if(i&&!i.merged){const a=i.get("type"),s=i.get("range");if(Tn(a)&&Cl(s)){const o=w1(this.childModel,r),u=nA(o);u?n[r]=u:ce(xk(r))}}}return n}assembleRowColumnHeaderData(n,r,i){const a={row:"y",column:"x",facet:void 0}[n],s=[],o=[],u=[];a&&i&&i[a]&&(r?(s.push(`distinct_${i[a]}`),o.push("max")):(s.push(i[a]),o.push("distinct")),u.push(`distinct_${i[a]}`));const{sortField:l,sortIndexField:c}=this[n];if(l){const{op:f=Wy,field:d}=l;s.push(d),o.push(f),u.push(pe(l,{forAs:!0}))}else c&&(s.push(c),o.push("max"),u.push(c));return{name:this[n].name,source:r??this.data,transform:[{type:"aggregate",groupby:this[n].fields,...s.length?{fields:s,ops:o,as:u}:{}}]}}assembleFacetHeaderData(n){var l,c;const{columns:r}=this.model.layout,{layoutHeaders:i}=this.model.component,a=[],s={};for(const f of L_){for(const d of z_){const h=((l=i[f])==null?void 0:l[d])??[];for(const g of h)if(((c=g.axes)==null?void 0:c.length)>0){s[f]=!0;break}}if(s[f]){const d=`length(data("${this.facet.name}"))`,h=f==="row"?r?{signal:`ceil(${d} / ${r})`}:1:r?{signal:`min(${d}, ${r})`}:{signal:d};a.push({name:`${this.facet.name}_${f}`,transform:[{type:"sequence",start:0,stop:h}]})}}const{row:o,column:u}=s;return(o||u)&&a.unshift(this.assembleRowColumnHeaderData("facet",null,n)),a}assemble(){const n=[];let r=null;const i=this.getChildIndependentFieldsWithStep(),{column:a,row:s,facet:o}=this;if(a&&s&&(i.x||i.y)){r=`cross_${this.column.name}_${this.row.name}`;const u=[].concat(i.x??[],i.y??[]),l=u.map(()=>"distinct");n.push({name:r,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:u,ops:l}]})}for(const u of[Ls,Bs])this[u]&&n.push(this.assembleRowColumnHeaderData(u,r,i));if(o){const u=this.assembleFacetHeaderData(i);u&&n.push(...u)}return n}}function Cq(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function nEe(e,t){const n=T6(e);if(t==="number")return`toNumber(${n})`;if(t==="boolean")return`toBoolean(${n})`;if(t==="string")return`toString(${n})`;if(t==="date")return`toDate(${n})`;if(t==="flatten")return n;if(t.startsWith("date:")){const r=Cq(t.slice(5,t.length));return`timeParse(${n},'${r}')`}else if(t.startsWith("utc:")){const r=Cq(t.slice(4,t.length));return`utcParse(${n},'${r}')`}else return ce(_ye(t)),null}function rEe(e){const t={};return xy(e.filter,n=>{if(k8(n)){let r=null;Tk(n)?r=ri(n.equal):$k(n)?r=ri(n.lte):Mk(n)?r=ri(n.lt):Dk(n)?r=ri(n.gt):Rk(n)?r=ri(n.gte):Pk(n)?r=n.range[0]:Nk(n)&&(r=(n.oneOf??n.in)[0]),r&&(_l(r)?t[n.field]="date":yt(r)?t[n.field]="number":Ee(r)&&(t[n.field]="string")),n.timeUnit&&(t[n.field]="date")}}),t}function iEe(e){const t={};function n(r){kf(r)?t[r.field]="date":r.type==="quantitative"&&nye(r.aggregate)?t[r.field]="number":Cg(r.field)>1?r.field in t||(t[r.field]="flatten"):Pl(r)&&Gs(r.sort)&&Cg(r.sort.field)>1&&(r.sort.field in t||(t[r.sort.field]="flatten"))}if((Wt(e)||ai(e))&&e.forEachFieldDef((r,i)=>{if(Tr(r))n(r);else{const a=Fl(i),s=e.fieldDef(a);n({...r,type:s.type})}}),Wt(e)){const{mark:r,markDef:i,encoding:a}=e;if(au(r)&&!e.encoding.order){const s=i.orient==="horizontal"?"y":"x",o=a[s];fe(o)&&o.type==="quantitative"&&!(o.field in t)&&(t[o.field]="number")}}return t}function aEe(e){const t={};if(Wt(e)&&e.component.selection)for(const n of ue(e.component.selection)){const r=e.component.selection[n];for(const i of r.project.items)!i.channel&&Cg(i.field)>1&&(t[i.field]="flatten")}return t}class ir extends xt{constructor(n,r){super(n);re(this,"_parse");this._parse=r}clone(){return new ir(null,qe(this._parse))}hash(){return`Parse ${at(this._parse)}`}static makeExplicit(n,r,i){var o;let a={};const s=r.data;return!lu(s)&&((o=s==null?void 0:s.format)!=null&&o.parse)&&(a=s.format.parse),this.makeWithAncestors(n,a,{},i)}static makeWithAncestors(n,r,i,a){for(const u of ue(i)){const l=a.getWithExplicit(u);l.value!==void 0&&(l.explicit||l.value===i[u]||l.value==="derived"||i[u]==="flatten"?delete i[u]:ce(o8(u,i[u],l.value)))}for(const u of ue(r)){const l=a.get(u);l!==void 0&&(l===r[u]?delete r[u]:ce(o8(u,r[u],l)))}const s=new Ks(r,i);a.copyAll(s);const o={};for(const u of ue(s.combine())){const l=s.get(u);l!==null&&(o[u]=l)}return ue(o).length===0||a.parseNothing?null:new ir(n,o)}get parse(){return this._parse}merge(n){this._parse={...this._parse,...n.parse},n.remove()}assembleFormatParse(){const n={};for(const r of ue(this._parse)){const i=this._parse[r];Cg(r)===1&&(n[r]=i)}return n}producedFields(){return new Set(ue(this._parse))}dependentFields(){return new Set(ue(this._parse))}assembleTransforms(n=!1){return ue(this._parse).filter(r=>n?Cg(r)>1:!0).map(r=>{const i=nEe(r,this._parse[r]);return i?{type:"formula",expr:i,as:Sg(r)}:null}).filter(r=>r!==null)}}class cu extends xt{clone(){return new cu(null)}constructor(t){super(t)}dependentFields(){return new Set}producedFields(){return new Set([la])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:la}}}class Vg extends xt{constructor(n,r){super(n);re(this,"params");this.params=r}clone(){return new Vg(null,this.params)}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${at(this.params)}`}assemble(){return{type:"graticule",...this.params===!0?{}:this.params}}}class Wg extends xt{constructor(n,r){super(n);re(this,"params");this.params=r}clone(){return new Wg(null,this.params)}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${at(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class Ll extends xt{constructor(n){super(null);re(this,"_data");re(this,"_name");re(this,"_generator");n??(n={name:"source"});let r;if(lu(n)||(r=n.format?{...Si(n.format,["parse"])}:{}),Lg(n))this._data={values:n.values};else if(Af(n)){if(this._data={url:n.url},!r.type){let i=/(?:\.([^.]+))?$/.exec(n.url)[1];rt(["json","csv","tsv","dsv","topojson"],i)||(i="json"),r.type=i}}else c7(n)?this._data={values:[{type:"Sphere"}]}:(u7(n)||lu(n))&&(this._data={});this._generator=lu(n),n.name&&(this._name=n.name),r&&!Mt(r)&&(this._data.format=r)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(n){this._name=n}set parent(n){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}function j_(e){return e instanceof Ll||e instanceof Vg||e instanceof Wg}class G_{constructor(){dU(this,Vf,void 0);mA(this,Vf,!1)}setModified(){mA(this,Vf,!0)}get modifiedFlag(){return fU(this,Vf)}}Vf=new WeakMap;class zl extends G_{getNodeDepths(t,n,r){r.set(t,n);for(const i of t.children)this.getNodeDepths(i,n+1,r);return r}optimize(t){const r=[...this.getNodeDepths(t,0,new Map).entries()].sort((i,a)=>a[1]-i[1]);for(const i of r)this.run(i[0]);return this.modifiedFlag}}class Y_ extends G_{optimize(t){this.run(t);for(const n of t.children)this.optimize(n);return this.modifiedFlag}}class sEe extends Y_{mergeNodes(t,n){const r=n.shift();for(const i of n)t.removeChild(i),i.parent=r,i.remove()}run(t){const n=t.children.map(i=>i.hash()),r={};for(let i=0;i<n.length;i++)r[n[i]]===void 0?r[n[i]]=[t.children[i]]:r[n[i]].push(t.children[i]);for(const i of ue(r))r[i].length>1&&(this.setModified(),this.mergeNodes(t,r[i]))}}class oEe extends Y_{constructor(n){super();re(this,"requiresSelectionId");this.requiresSelectionId=n&&P_(n)}run(n){n instanceof cu&&(this.requiresSelectionId&&(j_(n.parent)||n.parent instanceof ca||n.parent instanceof ir)||(this.setModified(),n.remove()))}}class uEe extends G_{optimize(t){return this.run(t,new Set),this.modifiedFlag}run(t,n){let r=new Set;t instanceof es&&(r=t.producedFields(),k6(r,n)&&(this.setModified(),t.removeFormulas(n),t.producedFields.length===0&&t.remove()));for(const i of t.children)this.run(i,new Set([...n,...r]))}}class lEe extends Y_{constructor(){super()}run(t){t instanceof Hr&&!t.isRequired()&&(this.setModified(),t.remove())}}class cEe extends zl{run(t){if(!j_(t)&&!(t.numChildren()>1)){for(const n of t.children)if(n instanceof ir)if(t instanceof ir)this.setModified(),t.merge(n);else{if(A6(t.producedFields(),n.dependentFields()))continue;this.setModified(),n.swapWithParent()}}}}class fEe extends zl{run(t){const n=[...t.children],r=t.children.filter(i=>i instanceof ir);if(t.numChildren()>1&&r.length>=1){const i={},a=new Set;for(const s of r){const o=s.parse;for(const u of ue(o))u in i?i[u]!==o[u]&&a.add(u):i[u]=o[u]}for(const s of a)delete i[s];if(!Mt(i)){this.setModified();const s=new ir(t,i);for(const o of n){if(o instanceof ir)for(const u of ue(i))delete o.parse[u];t.removeChild(o),o.parent=s,o instanceof ir&&ue(o.parse).length===0&&o.remove()}}}}}class dEe extends zl{run(t){t instanceof Hr||t.numChildren()>0||t instanceof If||t instanceof Ll||(this.setModified(),t.remove())}}class hEe extends zl{run(t){const n=t.children.filter(i=>i instanceof es),r=n.pop();for(const i of n)this.setModified(),r.merge(i)}}class gEe extends zl{run(t){const n=t.children.filter(i=>i instanceof ca),r={};for(const i of n){const a=at(i.groupBy);a in r||(r[a]=[]),r[a].push(i)}for(const i of ue(r)){const a=r[i];if(a.length>1){const s=a.pop();for(const o of a)s.merge(o)&&(t.removeChild(o),o.parent=s,o.remove(),this.setModified())}}}}class pEe extends zl{constructor(n){super();re(this,"model");this.model=n}run(n){const r=!(j_(n)||n instanceof Rf||n instanceof ir||n instanceof cu),i=[],a=[];for(const s of n.children)s instanceof ns&&(r&&!A6(n.producedFields(),s.dependentFields())?i.push(s):a.push(s));if(i.length>0){const s=i.pop();for(const o of i)s.merge(o,this.model.renameSignal.bind(this.model));this.setModified(),n instanceof ns?n.merge(s,this.model.renameSignal.bind(this.model)):s.swapWithParent()}if(a.length>1){const s=a.pop();for(const o of a)s.merge(o,this.model.renameSignal.bind(this.model));this.setModified()}}}class vEe extends zl{run(t){const n=[...t.children];if(!Fg(n,s=>s instanceof Hr)||t.numChildren()<=1)return;const i=[];let a;for(const s of n)if(s instanceof Hr){let o=s;for(;o.numChildren()===1;){const[u]=o.children;if(u instanceof Hr)o=u;else break}i.push(...o.children),a?(t.removeChild(s),s.parent=a.parent,a.parent.removeChild(a),a.parent=o,this.setModified()):a=o}else i.push(s);if(i.length){this.setModified();for(const s of i)s.parent.removeChild(s),s.parent=a}}}class ql extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r}clone(){return new ql(null,qe(this.transform))}addDimensions(n){this.transform.groupby=Is(this.transform.groupby.concat(n),r=>r)}dependentFields(){const n=new Set;return this.transform.groupby&&this.transform.groupby.forEach(n.add,n),this.transform.joinaggregate.map(r=>r.field).filter(r=>r!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(n){return n.as??pe(n)}hash(){return`JoinAggregateTransform ${at(this.transform)}`}assemble(){const n=[],r=[],i=[];for(const s of this.transform.joinaggregate)r.push(s.op),i.push(this.getDefaultName(s)),n.push(s.field===void 0?null:s.field);const a=this.transform.groupby;return{type:"joinaggregate",as:i,ops:r,fields:n,...a!==void 0?{groupby:a}:{}}}}class Bf extends xt{constructor(n,r){super(n);re(this,"filter");this.filter=r}clone(){return new Bf(null,{...this.filter})}static make(n,r,i){const{config:a,markDef:s}=r,{marks:o,scales:u}=i;if(o==="include-invalid-values"&&u==="include-invalid-values")return null;const l=r.reduceFieldDef((c,f,d)=>{const h=ja(d)&&r.getScaleComponent(d);if(h){const g=h.get("type"),{aggregate:p}=f,v=Hk({scaleChannel:d,markDef:s,config:a,scaleType:g,isCountAggregate:Dy(p)});v!=="show"&&v!=="always-valid"&&(c[f.field]=f)}return c},{});return ue(l).length?new Bf(n,l):null}dependentFields(){return new Set(ue(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${at(this.filter)}`}assemble(){const n=ue(this.filter).reduce((r,i)=>{const a=this.filter[i],s=pe(a,{expr:"datum"});return a!==null&&(a.type==="temporal"?r.push(`(isDate(${s}) || (${X_(s)}))`):a.type==="quantitative"&&r.push(X_(s))),r},[]);return n.length>0?{type:"filter",expr:n.join(" && ")}:null}}function X_(e){return`isValid(${e}) && isFinite(+${e})`}function mEe(e){return e.stack.stackBy.reduce((t,n)=>{const r=n.fieldDef,i=pe(r);return i&&t.push(i),t},[])}function yEe(e){return ee(e)&&e.every(t=>Ee(t))&&e.length>1}class eo extends xt{constructor(n,r){super(n);re(this,"_stack");this._stack=r}clone(){return new eo(null,qe(this._stack))}static makeFromTransform(n,r){const{stack:i,groupby:a,as:s,offset:o="zero"}=r,u=[],l=[];if(r.sort!==void 0)for(const d of r.sort)u.push(d.field),l.push(en(d.order,"ascending"));const c={field:u,order:l};let f;return yEe(s)?f=s:Ee(s)?f=[s,`${s}_end`]:f=[`${r.stack}_start`,`${r.stack}_end`],new eo(n,{dimensionFieldDefs:[],stackField:i,groupby:a,offset:o,sort:c,facetby:[],as:f})}static makeFromEncoding(n,r){const i=r.stack,{encoding:a}=r;if(!i)return null;const{groupbyChannels:s,fieldChannel:o,offset:u,impute:l}=i,c=s.map(g=>{const p=a[g];return ua(p)}).filter(g=>!!g),f=mEe(r),d=r.encoding.order;let h;if(ee(d)||fe(d))h=Z6(d);else{const g=t9(d)?d.sort:o==="y"?"descending":"ascending";h=f.reduce((p,v)=>(p.field.includes(v)||(p.field.push(v),p.order.push(g)),p),{field:[],order:[]})}return new eo(n,{dimensionFieldDefs:c,stackField:r.vgField(o),facetby:[],stackby:f,sort:h,offset:u,impute:l,as:[r.vgField(o,{suffix:"start",forAs:!0}),r.vgField(o,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(n){this._stack.facetby.push(...n)}dependentFields(){const n=new Set;return n.add(this._stack.stackField),this.getGroupbyFields().forEach(n.add,n),this._stack.facetby.forEach(n.add,n),this._stack.sort.field.forEach(n.add,n),n}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${at(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:n,impute:r,groupby:i}=this._stack;return n.length>0?n.map(a=>a.bin?r?[pe(a,{binSuffix:"mid"})]:[pe(a,{}),pe(a,{binSuffix:"end"})]:[pe(a)]).flat():i??[]}assemble(){const n=[],{facetby:r,dimensionFieldDefs:i,stackField:a,stackby:s,sort:o,offset:u,impute:l,as:c}=this._stack;if(l)for(const f of i){const{bandPosition:d=.5,bin:h}=f;if(h){const g=pe(f,{expr:"datum"}),p=pe(f,{expr:"datum",binSuffix:"end"});n.push({type:"formula",expr:`${X_(g)} ? ${d}*${g}+${1-d}*${p} : ${g}`,as:pe(f,{binSuffix:"mid",forAs:!0})})}n.push({type:"impute",field:a,groupby:[...s,...r],key:pe(f,{binSuffix:"mid"}),method:"value",value:0})}return n.push({type:"stack",groupby:[...this.getGroupbyFields(),...r],field:a,sort:o,as:c,offset:u}),n}}class Lf extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r}clone(){return new Lf(null,qe(this.transform))}addDimensions(n){this.transform.groupby=Is(this.transform.groupby.concat(n),r=>r)}dependentFields(){const n=new Set;return(this.transform.groupby??[]).forEach(n.add,n),(this.transform.sort??[]).forEach(r=>n.add(r.field)),this.transform.window.map(r=>r.field).filter(r=>r!==void 0).forEach(n.add,n),n}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(n){return n.as??pe(n)}hash(){return`WindowTransform ${at(this.transform)}`}assemble(){const n=[],r=[],i=[],a=[];for(const d of this.transform.window)r.push(d.op),i.push(this.getDefaultName(d)),a.push(d.param===void 0?null:d.param),n.push(d.field===void 0?null:d.field);const s=this.transform.frame,o=this.transform.groupby;if(s&&s[0]===null&&s[1]===null&&r.every(d=>mk(d)))return{type:"joinaggregate",as:i,ops:r,fields:n,...o!==void 0?{groupby:o}:{}};const u=[],l=[];if(this.transform.sort!==void 0)for(const d of this.transform.sort)u.push(d.field),l.push(d.order??"ascending");const c={field:u,order:l},f=this.transform.ignorePeers;return{type:"window",params:a,as:i,ops:r,fields:n,sort:c,...f!==void 0?{ignorePeers:f}:{},...o!==void 0?{groupby:o}:{},...s!==void 0?{frame:s}:{}}}}function bEe(e){function t(n){if(!(n instanceof If)){const r=n.clone();if(r instanceof Hr){const i=Z_+r.getSource();r.setSource(i),e.model.component.data.outputNodes[i]=r}else(r instanceof ca||r instanceof eo||r instanceof Lf||r instanceof ql)&&r.addDimensions(e.fields);for(const i of n.children.flatMap(t))i.parent=r;return[r]}return n.children.flatMap(t)}return t}function K_(e){if(e instanceof If)if(e.numChildren()===1&&!(e.children[0]instanceof Hr)){const t=e.children[0];(t instanceof ca||t instanceof eo||t instanceof Lf||t instanceof ql)&&t.addDimensions(e.fields),t.swapWithParent(),K_(e)}else{const t=e.model.component.data.main;kq(t);const n=bEe(e),r=e.children.map(n).flat();for(const i of r)i.parent=t}else e.children.map(K_)}function kq(e){if(e instanceof Hr&&e.type===Vt.Main&&e.numChildren()===1){const t=e.children[0];t instanceof If||(t.swapWithParent(),kq(e))}}const Z_="scale_",b1=5;function Q_(e){for(const t of e){for(const n of t.children)if(n.parent!==t)return!1;if(!Q_(t.children))return!1}return!0}function fa(e,t){let n=!1;for(const r of t)n=e.optimize(r)||n;return n}function _q(e,t,n){let r=e.sources,i=!1;return i=fa(new lEe,r)||i,i=fa(new oEe(t),r)||i,r=r.filter(a=>a.numChildren()>0),i=fa(new dEe,r)||i,r=r.filter(a=>a.numChildren()>0),n||(i=fa(new cEe,r)||i,i=fa(new pEe(t),r)||i,i=fa(new uEe,r)||i,i=fa(new fEe,r)||i,i=fa(new gEe,r)||i,i=fa(new hEe,r)||i,i=fa(new sEe,r)||i,i=fa(new vEe,r)||i),e.sources=r,i}function wEe(e,t){Q_(e.sources);let n=0,r=0;for(let i=0;i<b1&&_q(e,t,!0);i++)n++;e.sources.map(K_);for(let i=0;i<b1&&_q(e,t,!1);i++)r++;Q_(e.sources),Math.max(n,r)===b1&&ce(`Maximum optimization runs(${b1}) reached.`)}class Mn{constructor(t){re(this,"signal");Object.defineProperty(this,"signal",{enumerable:!0,get:t})}static fromName(t,n){return new Mn(()=>t(n))}}function Aq(e){Wt(e)?xEe(e):EEe(e)}function xEe(e){const t=e.component.scales;for(const n of ue(t)){const r=SEe(e,n);if(t[n].setWithExplicit("domains",r),kEe(e,n),e.component.data.isFaceted){let a=e;for(;!ai(a)&&a.parent;)a=a.parent;if(a.component.resolve.scale[n]==="shared")for(const o of r.value)js(o)&&(o.data=Z_+o.data.replace(Z_,""))}}}function EEe(e){for(const n of e.children)Aq(n);const t=e.component.scales;for(const n of ue(t)){let r,i=null;for(const a of e.children){const s=a.component.scales[n];if(s){r===void 0?r=s.getWithExplicit("domains"):r=uu(r,s.getWithExplicit("domains"),"domains","scale",tA);const o=s.get("selectionExtent");i&&o&&i.param!==o.param&&ce(wye),i=o}}t[n].setWithExplicit("domains",r),i&&t[n].set("selectionExtent",i,!0)}}function FEe(e,t,n,r){if(e==="unaggregated"){const{valid:i,reason:a}=Tq(t,n);if(!i){ce(a);return}}else if(e===void 0&&r.useUnaggregatedDomain){const{valid:i}=Tq(t,n);if(i)return"unaggregated"}return e}function SEe(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:r}=e,i=FEe(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return i!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:i}),t==="x"&&hn(r.x2)?hn(r.x)?uu(fu(n,i,e,"x"),fu(n,i,e,"x2"),"domain","scale",tA):fu(n,i,e,"x2"):t==="y"&&hn(r.y2)?hn(r.y)?uu(fu(n,i,e,"y"),fu(n,i,e,"y2"),"domain","scale",tA):fu(n,i,e,"y2"):fu(n,i,e,t)}function CEe(e,t,n){return e.map(r=>({signal:`{data: ${Qy(r,{timeUnit:n,type:t})}}`}))}function J_(e,t,n){var i;const r=(i=An(n))==null?void 0:i.unit;return t==="temporal"||r?CEe(e,t,r):[e]}function fu(e,t,n,r){const{encoding:i,markDef:a,mark:s,config:o,stack:u}=n,l=hn(i[r]),{type:c}=l,f=l.timeUnit,d=ywe({invalid:Ga("invalid",a,o),isPath:au(s)});if(j1e(t)){const p=fu(e,void 0,n,r),v=J_(t.unionWith,c,f);return Ja([...v,...p.value])}else{if(Ae(t))return Ja([t]);if(t&&t!=="unaggregated"&&!P8(t))return Ja(J_(t,c,f))}if(u&&r===u.fieldChannel){if(u.offset==="normalize")return ii([[0,1]]);const p=n.requestDataName(d);return ii([{data:p,field:n.vgField(r,{suffix:"start"})},{data:p,field:n.vgField(r,{suffix:"end"})}])}const h=ja(r)&&fe(l)?_Ee(n,r,e):void 0;if(Za(l)){const p=J_([l.datum],c,f);return ii(p)}const g=l;if(t==="unaggregated"){const{field:p}=l;return ii([{data:n.requestDataName(d),field:pe({field:p,aggregate:"min"})},{data:n.requestDataName(d),field:pe({field:p,aggregate:"max"})}])}else if($t(g.bin)){if(Tn(e))return ii(e==="bin-ordinal"?[]:[{data:Ey(h)?n.requestDataName(d):n.requestDataName(Vt.Raw),field:n.vgField(r,Ig(g,r)?{binSuffix:"range"}:{}),sort:h===!0||!we(h)?{field:n.vgField(r,{}),op:"min"}:h}]);{const{bin:p}=g;if($t(p)){const v=H_(n,g.field,p);return ii([new Mn(()=>{const m=n.getSignalName(v);return`[${m}.start, ${m}.stop]`})])}else return ii([{data:n.requestDataName(d),field:n.vgField(r,{})}])}}else if(g.timeUnit&&rt(["time","utc"],e)){const p=i[Ha(r)];if(e9(g,p,a,o)){const v=n.requestDataName(d),m=su({fieldDef:g,fieldDef2:p,markDef:a,config:o}),y=$g(s)&&m!==.5&&Qt(r);return ii([{data:v,field:n.vgField(r,y?{suffix:o1}:{})},{data:v,field:n.vgField(r,{suffix:y?u1:"end"})}])}}return ii(h?[{data:Ey(h)?n.requestDataName(d):n.requestDataName(Vt.Raw),field:n.vgField(r),sort:h}]:[{data:n.requestDataName(d),field:n.vgField(r)}])}function eA(e,t){const{op:n,field:r,order:i}=e;return{op:n??(t?"sum":Wy),...r?{field:Qi(r)}:{},...i?{order:i}:{}}}function kEe(e,t){var o;const n=e.component.scales[t],r=e.specifiedScales[t].domain,i=(o=e.fieldDef(t))==null?void 0:o.bin,a=P8(r)?r:void 0,s=Sl(i)&&Ry(i.extent)?i.extent:void 0;(a||s)&&n.set("selectionExtent",a??s,!0)}function _Ee(e,t,n){if(!Tn(n))return;const r=e.fieldDef(t),i=r.sort;if(Z8(i))return{op:"min",field:Nf(r,t),order:"ascending"};const{stack:a}=e,s=a?new Set([...a.groupbyFields,...a.stackBy.map(o=>o.fieldDef.field)]):void 0;if(Gs(i)){const o=a&&!s.has(i.field);return eA(i,o)}else if(xbe(i)){const{encoding:o,order:u}=i,l=e.fieldDef(o),{aggregate:c,field:f}=l,d=a&&!s.has(f);if(Hs(c)||ru(c))return eA({field:pe(l),order:u},d);if(mk(c)||!c)return eA({op:c,field:f,order:u},d)}else{if(i==="descending")return{op:"min",field:e.vgField(t),order:"descending"};if(rt(["ascending",void 0],i))return!0}}function Tq(e,t){const{aggregate:n,type:r}=e;return n?Ee(n)&&!iye.has(n)?{valid:!1,reason:Xye(n)}:r==="quantitative"&&t==="log"?{valid:!1,reason:Kye(e)}:{valid:!0}:{valid:!1,reason:Yye(e)}}function tA(e,t,n,r){return e.explicit&&t.explicit&&ce(t1e(n,r,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function AEe(e){const t=Is(e.map(s=>{if(js(s)){const{sort:o,...u}=s;return u}return s}),at),n=Is(e.map(s=>{if(js(s)){const o=s.sort;return o!==void 0&&!Ey(o)&&("op"in o&&o.op==="count"&&delete o.field,o.order==="ascending"&&delete o.order),o}}).filter(s=>s!==void 0),at);if(t.length===0)return;if(t.length===1){const s=e[0];if(js(s)&&n.length>0){let o=n[0];if(n.length>1){ce(h8);const u=n.filter(l=>we(l)&&"op"in l&&l.op!=="min");n.every(l=>we(l)&&"op"in l)&&u.length===1?o=u[0]:o=!0}else if(we(o)&&"field"in o){const u=o.field;s.field===u&&(o=o.order?{order:o.order}:!0)}return{...s,sort:o}}return s}const r=Is(n.map(s=>Ey(s)||!("op"in s)||Ee(s.op)&&xe(eye,s.op)?s:(ce(r1e(s)),!0)),at);let i;r.length===1?i=r[0]:r.length>1&&(ce(h8),i=!0);const a=Is(e.map(s=>js(s)?s.data:null),s=>s);return a.length===1&&a[0]!==null?{data:a[0],fields:t.map(o=>o.field),...i?{sort:i}:{}}:{fields:t,...i?{sort:i}:{}}}function nA(e){if(js(e)&&Ee(e.field))return e.field;if(aye(e)){let t;for(const n of e.fields)if(js(n)&&Ee(n.field)){if(!t)t=n.field;else if(t!==n.field)return ce(i1e),t}return ce(a1e),t}else if(sye(e)){ce(s1e);const t=e.fields[0];return Ee(t)?t:void 0}}function w1(e,t){const r=e.component.scales[t].get("domains").map(i=>(js(i)&&(i.data=e.lookupDataSource(i.data)),i));return AEe(r)}function Mq(e){return zf(e)||iA(e)?e.children.reduce((t,n)=>t.concat(Mq(n)),$q(e)):$q(e)}function $q(e){return ue(e.component.scales).reduce((t,n)=>{const r=e.component.scales[n];if(r.merged)return t;const i=r.combine(),{name:a,type:s,selectionExtent:o,domains:u,range:l,reverse:c,...f}=i,d=TEe(i.range,a,n,e),h=w1(e,n),g=o?Twe(e,o,r,h):null;return t.push({name:a,type:s,...h?{domain:h}:{},...g?{domainRaw:g}:{},range:d,...c!==void 0?{reverse:c}:{},...f}),t},[])}function TEe(e,t,n,r){if(Qt(n)){if(Cl(e))return{step:{signal:`${t}_step`}}}else if(we(e)&&js(e))return{...e,data:r.lookupDataSource(e.data)};return e}class Dq extends Ks{constructor(n,r){super({},{name:n});re(this,"merged",!1);this.setWithExplicit("type",r)}domainHasZero(){const n=this.get("type");if(rt([Hn.LOG,Hn.TIME,Hn.UTC],n))return"definitely-not";const r=this.get("zero");if(r===!0||r===void 0&&rt([Hn.LINEAR,Hn.SQRT,Hn.POW],n))return"definitely";const i=this.get("domains");if(i.length>0){let a=!1,s=!1,o=!1;for(const u of i){if(ee(u)){const l=u[0],c=u[u.length-1];if(yt(l)&&yt(c))if(l<=0&&c>=0){a=!0;continue}else{s=!0;continue}}o=!0}if(a)return"definitely";if(s&&!o)return"definitely-not"}return"maybe"}}const MEe=["range","scheme"];function $Ee(e){const t=e.component.scales;for(const n of pk){const r=t[n];if(!r)continue;const i=DEe(n,e);r.setWithExplicit("range",i)}}function Rq(e,t){const n=e.fieldDef(t);if(n!=null&&n.bin){const{bin:r,field:i}=n,a=Wr(t),s=e.getName(a);if(we(r)&&r.binned&&r.step!==void 0)return new Mn(()=>{const o=e.scaleName(t),u=`(domain("${o}")[1] - domain("${o}")[0]) / ${r.step}`;return`${e.getSignalName(s)} / (${u})`});if($t(r)){const o=H_(e,i,r);return new Mn(()=>{const u=e.getSignalName(o),l=`(${u}.stop - ${u}.start) / ${u}.step`;return`${e.getSignalName(s)} / (${l})`})}}}function DEe(e,t){const n=t.specifiedScales[e],{size:r}=t,a=t.getScaleComponent(e).get("type");for(const f of MEe)if(n[f]!==void 0){const d=Lk(a,f),h=N8(e,f);if(!d)ce(f8(a,f,e));else if(h)ce(h);else switch(f){case"range":{const g=n.range;if(ee(g)){if(Qt(e))return Ja(g.map(p=>{if(p==="width"||p==="height"){const v=t.getName(p),m=t.getSignalName.bind(t);return Mn.fromName(m,v)}return p}))}else if(we(g))return Ja({data:t.requestDataName(Vt.Main),field:g.field,sort:{op:"min",field:t.vgField(e)}});return Ja(g)}case"scheme":return Ja(REe(n[f]))}}const s=e===Bt||e==="xOffset"?"width":"height",o=r[s];if(Qa(o)){if(Qt(e))if(Tn(a)){const f=Nq(o,t,e);if(f)return Ja({step:f})}else ce(d8(s));else if(Ag(e)){const f=e===Ko?"x":"y";if(t.getScaleComponent(f).get("type")==="band"){const g=Oq(o,a);if(g)return Ja(g)}}}const{rangeMin:u,rangeMax:l}=n,c=PEe(e,t);return(u!==void 0||l!==void 0)&&Lk(a,"rangeMin")&&ee(c)&&c.length===2?Ja([u??c[0],l??c[1]]):ii(c)}function REe(e){return H1e(e)?{scheme:e.name,...Si(e,["name"])}:{scheme:e}}function Pq(e,t,n,{center:r}={}){const i=Wr(e),a=t.getName(i),s=t.getSignalName.bind(t);return e===_n&&aa(n)?r?[Mn.fromName(o=>`${s(o)}/2`,a),Mn.fromName(o=>`-${s(o)}/2`,a)]:[Mn.fromName(s,a),0]:r?[Mn.fromName(o=>`-${s(o)}/2`,a),Mn.fromName(o=>`${s(o)}/2`,a)]:[0,Mn.fromName(s,a)]}function PEe(e,t){const{size:n,config:r,mark:i,encoding:a}=t,{type:s}=hn(a[e]),u=t.getScaleComponent(e).get("type"),{domain:l,domainMid:c}=t.specifiedScales[e];switch(e){case Bt:case _n:{if(rt(["point","band"],u)){const f=Iq(e,n,r.view);if(Qa(f))return{step:Nq(f,t,e)}}return Pq(e,t,u)}case Ko:case vf:return NEe(e,t,u);case Us:{const f=BEe(i,r),d=LEe(i,n,t,r);return xf(u)?IEe(f,d,OEe(u,r,l,e)):[f,d]}case ki:return[0,Math.PI*2];case xl:return[0,360];case ea:return[0,new Mn(()=>{const f=t.getSignalName(ai(t.parent)?"child_width":"width"),d=t.getSignalName(ai(t.parent)?"child_height":"height");return`min(${f},${d})/2`})];case Zo:return{step:1e3/r.scale.framesPerSecond};case eu:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case tu:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case Vr:return"symbol";case Ur:case Va:case Wa:return u==="ordinal"?s==="nominal"?"category":"ordinal":c!==void 0?"diverging":i==="rect"||i==="geoshape"?"heatmap":"ramp";case Vs:case Qo:case Jo:return[r.scale.minOpacity,r.scale.maxOpacity]}}function Nq(e,t,n){const{encoding:r}=t,i=t.getScaleComponent(n),a=ck(n),s=r[a];if(O9({step:e,offsetIsDiscrete:He(s)&&A8(s.type)})==="offset"&&p9(r,a)){const u=t.getScaleComponent(a);let c=`domain('${t.scaleName(a)}').length`;if(u.get("type")==="band"){const d=u.get("paddingInner")??u.get("padding")??0,h=u.get("paddingOuter")??u.get("padding")??0;c=`bandspace(${c}, ${d}, ${h})`}const f=i.get("paddingInner")??i.get("padding");return{signal:`${e.step} * ${c} / (1-${lye(f)})`}}else return e.step}function Oq(e,t){if(O9({step:e,offsetIsDiscrete:Tn(t)})==="offset")return{step:e.step}}function NEe(e,t,n){const r=e===Ko?"x":"y",i=t.getScaleComponent(r);if(!i)return Pq(r,t,n,{center:!0});const a=i.get("type"),s=t.scaleName(r),{markDef:o,config:u}=t;if(a==="band"){const l=Iq(r,t.size,t.config.view);if(Qa(l)){const c=Oq(l,n);if(c)return c}return[0,{signal:`bandwidth('${s}')`}]}else{const l=t.encoding[r];if(fe(l)&&l.timeUnit){const c=S8(l.timeUnit,g=>`scale('${s}', ${g})`),f=t.config.scale.bandWithNestedOffsetPaddingInner,d=su({fieldDef:l,markDef:o,config:u})-.5,h=d!==0?` + ${d}`:"";if(f){const g=Ae(f)?`${f.signal}/2${h}`:`${f/2+d}`,p=Ae(f)?`(1 - ${f.signal}/2)${h}`:`${1-f/2+d}`;return[{signal:`${g} * (${c})`},{signal:`${p} * (${c})`}]}return[0,{signal:c}]}return Cme(`Cannot use ${e} scale if ${r} scale is not discrete.`)}}function Iq(e,t,n){const r=e===Bt?"width":"height",i=t[r];return i||i1(n,r)}function OEe(e,t,n,r){switch(e){case"quantile":return t.scale.quantileCount;case"quantize":return t.scale.quantizeCount;case"threshold":return n!==void 0&&ee(n)?n.length+1:(ce(p1e(r)),3)}}function IEe(e,t,n){const r=()=>{const i=ia(t),a=ia(e),s=`(${i} - ${a}) / (${n} - 1)`;return`sequence(${a}, ${i} + ${s}, ${s})`};return Ae(t)?new Mn(r):{signal:r()}}function BEe(e,t){switch(e){case"bar":case"tick":return t.scale.minBandSize;case"line":case"trail":case"rule":return t.scale.minStrokeWidth;case"text":return t.scale.minFontSize;case"point":case"square":case"circle":return t.scale.minSize}throw new Error(Py("size",e))}const Bq=.95;function LEe(e,t,n,r){const i={x:Rq(n,"x"),y:Rq(n,"y")};switch(e){case"bar":case"tick":{if(r.scale.maxBandSize!==void 0)return r.scale.maxBandSize;const a=Lq(t,i,r.view);return yt(a)?a-1:new Mn(()=>`${a.signal} - 1`)}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const a=Lq(t,i,r.view);return yt(a)?Math.pow(Bq*a,2):new Mn(()=>`pow(${Bq} * ${a.signal}, 2)`)}}throw new Error(Py("size",e))}function Lq(e,t,n){const r=Qa(e.width)?e.width.step:g_(n,"width"),i=Qa(e.height)?e.height.step:g_(n,"height");return t.x||t.y?new Mn(()=>`min(${[t.x?t.x.signal:r,t.y?t.y.signal:i].join(", ")})`):Math.min(r,i)}function zq(e,t){Wt(e)?zEe(e,t):Vq(e,t)}function zEe(e,t){const n=e.component.scales,{config:r,encoding:i,markDef:a,specifiedScales:s}=e;for(const o of ue(n)){const u=s[o],l=n[o],c=e.getScaleComponent(o),f=hn(i[o]),d=u[t],h=c.get("type"),g=c.get("padding"),p=c.get("paddingInner"),v=Lk(h,t),m=N8(o,t);if(d!==void 0&&(v?m&&ce(m):ce(f8(h,t,o))),v&&m===void 0)if(d!==void 0){const y=f.timeUnit,b=f.type;switch(t){case"domainMax":case"domainMin":_l(u[t])||b==="temporal"||y?l.set(t,{signal:Qy(u[t],{type:b,timeUnit:y})},!0):l.set(t,u[t],!0);break;default:l.copyKeyFromObject(t,u)}}else{const y=le(qq,t)?qq[t]({model:e,channel:o,fieldOrDatumDef:f,scaleType:h,scalePadding:g,scalePaddingInner:p,domain:u.domain,domainMin:u.domainMin,domainMax:u.domainMax,markDef:a,config:r,hasNestedOffsetScale:v9(i,o),hasSecondaryRangeChannel:!!i[Ha(o)]}):r.scale[t];y!==void 0&&l.set(t,y,!1)}}}const qq={bins:({model:e,fieldOrDatumDef:t})=>fe(t)?qEe(e,t):void 0,interpolate:({channel:e,fieldOrDatumDef:t})=>UEe(e,t.type),nice:({scaleType:e,channel:t,domain:n,domainMin:r,domainMax:i,fieldOrDatumDef:a})=>VEe(e,t,n,r,i,a),padding:({channel:e,scaleType:t,fieldOrDatumDef:n,markDef:r,config:i})=>WEe(e,t,i.scale,n,r,i.bar),paddingInner:({scalePadding:e,channel:t,markDef:n,scaleType:r,config:i,hasNestedOffsetScale:a})=>HEe(e,t,n.type,r,i.scale,a),paddingOuter:({scalePadding:e,channel:t,scaleType:n,scalePaddingInner:r,config:i,hasNestedOffsetScale:a})=>jEe(e,t,n,r,i.scale,a),reverse:({fieldOrDatumDef:e,scaleType:t,channel:n,config:r})=>{const i=fe(e)?e.sort:void 0;return GEe(t,i,n,r.scale)},zero:({channel:e,fieldOrDatumDef:t,domain:n,markDef:r,scaleType:i,config:a,hasSecondaryRangeChannel:s})=>YEe(e,t,n,r,i,a.scale,s)};function Uq(e){Wt(e)?$Ee(e):Vq(e,"range")}function Vq(e,t){const n=e.component.scales;for(const r of e.children)t==="range"?Uq(r):zq(r,t);for(const r of ue(n)){let i;for(const a of e.children){const s=a.component.scales[r];if(s){const o=s.getWithExplicit(t);i=uu(i,o,t,"scale",o7((u,l)=>{switch(t){case"range":return u.step&&l.step?u.step-l.step:0}return 0}))}}n[r].setWithExplicit(t,i)}}function qEe(e,t){const n=t.bin;if($t(n)){const r=H_(e,t.field,n);return new Mn(()=>e.getSignalName(r))}else if(Vn(n)&&Sl(n)&&n.step!==void 0)return{step:n.step}}function UEe(e,t){if(rt([Ur,Va,Wa],e)&&t!=="nominal")return"hcl"}function VEe(e,t,n,r,i,a){var s;if(!((s=ua(a))!=null&&s.bin||ee(n)||i!=null||r!=null||rt([Hn.TIME,Hn.UTC],e)))return Qt(t)?!0:void 0}function WEe(e,t,n,r,i,a){if(Qt(e)){if(Xa(t)){if(n.continuousPadding!==void 0)return n.continuousPadding;const{type:s,orient:o}=i;if(s==="bar"&&!(fe(r)&&(r.bin||r.timeUnit))&&(o==="vertical"&&e==="x"||o==="horizontal"&&e==="y"))return a.continuousBandSize}if(t===Hn.POINT)return n.pointPadding}}function HEe(e,t,n,r,i,a=!1){if(e===void 0){if(Qt(t)){const{bandPaddingInner:s,barBandPaddingInner:o,rectBandPaddingInner:u,tickBandPaddingInner:l,bandWithNestedOffsetPaddingInner:c}=i;return a?c:en(s,n==="bar"?o:n==="tick"?l:u)}else if(Ag(t)&&r===Hn.BAND)return i.offsetBandPaddingInner}}function jEe(e,t,n,r,i,a=!1){if(e===void 0){if(Qt(t)){const{bandPaddingOuter:s,bandWithNestedOffsetPaddingOuter:o}=i;if(a)return o;if(n===Hn.BAND)return en(s,Ae(r)?{signal:`${r.signal}/2`}:r/2)}else if(Ag(t)){if(n===Hn.POINT)return .5;if(n===Hn.BAND)return i.offsetBandPaddingOuter}}}function GEe(e,t,n,r){if(n==="x"&&r.xReverse!==void 0)return aa(e)&&t==="descending"?Ae(r.xReverse)?{signal:`!${r.xReverse.signal}`}:!r.xReverse:r.xReverse;if(aa(e)&&t==="descending")return!0}function YEe(e,t,n,r,i,a,s){if(!!n&&n!=="unaggregated"&&aa(i)){if(ee(n)){const u=n[0],l=n[n.length-1];if(yt(u)&&u<=0&&yt(l)&&l>=0)return!0}return!1}if(e==="size"&&t.type==="quantitative"&&!xf(i))return!0;if(!(fe(t)&&t.bin)&&rt([...Ws,...Hme],e)){const{orient:u,type:l}=r;return rt(["bar","area","line","trail"],l)&&(u==="horizontal"&&e==="y"||u==="vertical"&&e==="x")?!1:rt(["bar","area"],l)&&!s?!0:a==null?void 0:a.zero}return!1}function XEe(e,t,n,r,i=!1){const a=KEe(t,n,r,i),{type:s}=e;return ja(t)?s!==void 0?Q1e(t,s)?fe(n)&&!Z1e(s,n.type)?(ce(Jye(s,a)),a):s:(ce(Qye(t,s,a)),a):a:null}function KEe(e,t,n,r){var i;switch(t.type){case"nominal":case"ordinal":{if(yf(e)||vk(e)==="discrete")return e==="shape"&&t.type==="ordinal"&&ce(Sk(e,"ordinal")),"ordinal";if(gk(e))return"band";if(Qt(e)||Ag(e)){if(rt(["rect","bar","image","rule","tick"],n.type)||r)return"band"}else if(n.type==="arc"&&e in hk)return"band";const a=n[Wr(e)];return $l(a)||Ff(t)&&((i=t.axis)!=null&&i.tickBand)?"band":"point"}case"temporal":return yf(e)?"time":vk(e)==="discrete"?(ce(Sk(e,"temporal")),"ordinal"):fe(t)&&t.timeUnit&&An(t.timeUnit).utc?"utc":gk(e)?"band":"time";case"quantitative":return yf(e)?fe(t)&&$t(t.bin)?"bin-ordinal":"linear":vk(e)==="discrete"?(ce(Sk(e,"quantitative")),"ordinal"):gk(e)?"band":"linear";case"geojson":return}throw new Error(l8(t.type))}function ZEe(e,{ignoreRange:t}={}){Wq(e),Aq(e);for(const n of K1e)zq(e,n);t||Uq(e)}function Wq(e){Wt(e)?e.component.scales=QEe(e):e.component.scales=eFe(e)}function QEe(e){const{encoding:t,mark:n,markDef:r}=e,i={};for(const a of pk){const s=hn(t[a]);if(s&&n===B8&&a===Vr&&s.type===wf)continue;let o=s&&s.scale;if(s&&o!==null&&o!==!1){o??(o={});const u=v9(t,a),l=XEe(o,a,s,r,u);i[a]=new Dq(e.scaleName(`${a}`,!0),{value:l,explicit:o.type===l})}}return i}const JEe=o7((e,t)=>T8(e)-T8(t));function eFe(e){var i;const t=e.component.scales={},n={},r=e.component.resolve;for(const a of e.children){Wq(a);for(const s of ue(a.component.scales))if((i=r.scale)[s]??(i[s]=lq(s,e)),r.scale[s]==="shared"){const o=n[s],u=a.component.scales[s].getWithExplicit("type");o?z1e(o.value,u.value)?n[s]=uu(o,u,"type","scale",JEe):(r.scale[s]="independent",delete n[s]):n[s]=u}}for(const a of ue(n)){const s=e.scaleName(a,!0),o=n[a];t[a]=new Dq(s,o);for(const u of e.children){const l=u.component.scales[a];l&&(u.renameScale(l.get("name"),s),l.merged=!0)}}return t}class rA{constructor(){re(this,"nameMap");this.nameMap={}}rename(t,n){this.nameMap[t]=n}has(t){return this.nameMap[t]!==void 0}get(t){for(;this.nameMap[t]&&t!==this.nameMap[t];)t=this.nameMap[t];return t}}function Wt(e){return(e==null?void 0:e.type)==="unit"}function ai(e){return(e==null?void 0:e.type)==="facet"}function iA(e){return(e==null?void 0:e.type)==="concat"}function zf(e){return(e==null?void 0:e.type)==="layer"}class aA{constructor(t,n,r,i,a,s,o){re(this,"type");re(this,"parent");re(this,"config");re(this,"name");re(this,"size");re(this,"title");re(this,"description");re(this,"data");re(this,"transforms");re(this,"layout");re(this,"scaleNameMap");re(this,"projectionNameMap");re(this,"signalNameMap");re(this,"component");re(this,"view");this.type=n,this.parent=r,this.config=a,this.parent=r,this.config=a,this.view=Wn(o),this.name=t.name??i,this.title=iu(t.title)?{text:t.title}:t.title?Wn(t.title):void 0,this.scaleNameMap=r?r.scaleNameMap:new rA,this.projectionNameMap=r?r.projectionNameMap:new rA,this.signalNameMap=r?r.signalNameMap:new rA,this.data=t.data,this.description=t.description,this.transforms=awe(t.transform??[]),this.layout=n==="layer"||n==="unit"?{}:c2e(t,n,a),this.component={data:{sources:r?r.component.data.sources:[],outputNodes:r?r.component.data.outputNodes:{},outputNodeRefCounts:r?r.component.data.outputNodeRefCounts:{},isFaceted:Hy(t)||(r==null?void 0:r.component.data.isFaceted)&&t.data===void 0},layoutSize:new Ks,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...s?qe(s):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){ZEe(this)}parseProjection(){Eq(this)}renameTopLevelLayoutSizeSignal(){this.getName("width")!=="width"&&this.renameSignal(this.getName("width"),"width"),this.getName("height")!=="height"&&this.renameSignal(this.getName("height"),"height")}parseLegends(){mq(this)}assembleEncodeFromView(t){const{style:n,...r}=t,i={};for(const a of ue(r)){const s=r[a];s!==void 0&&(i[a]=Ot(s))}return i}assembleGroupEncodeEntry(t){let n={};return this.view&&(n=this.assembleEncodeFromView(this.view)),!t&&(this.description&&(n.description=Ot(this.description)),this.type==="unit"||this.type==="layer")?{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...n}:Mt(n)?void 0:n}assembleLayout(){if(!this.layout)return;const{spacing:t,...n}=this.layout,{component:r,config:i}=this,a=xxe(r.layoutHeaders,i);return{padding:t,...this.assembleDefaultLayout(),...n,...a?{titleBand:a}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:t}=this.component;let n=[];for(const r of Ai)t[r].title&&n.push(pxe(this,r));for(const r of L_)n=n.concat(vxe(this,r));return n}assembleAxes(){return nxe(this.component.axes,this.config)}assembleLegends(){return bq(this)}assembleProjections(){return Wxe(this)}assembleTitle(){const{encoding:t,...n}=this.title??{},r={...H6(this.config.title).nonMarkTitleProperties,...n,...t?{encode:{update:t}}:{}};if(r.text)return rt(["unit","layer"],this.type)?rt(["middle",void 0],r.anchor)&&(r.frame??(r.frame="group")):r.anchor??(r.anchor="start"),Mt(r)?void 0:r}assembleGroup(t=[]){const n={};t=t.concat(this.assembleSignals()),t.length>0&&(n.signals=t);const r=this.assembleLayout();r&&(n.layout=r),n.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||ai(this.parent)?Mq(this):[];i.length>0&&(n.scales=i);const a=this.assembleAxes();a.length>0&&(n.axes=a);const s=this.assembleLegends();return s.length>0&&(n.legends=s),n}getName(t){return Ut((this.name?`${this.name}_`:"")+t)}getDataName(t){return this.getName(Vt[t].toLowerCase())}requestDataName(t){const n=this.getDataName(t),r=this.component.data.outputNodeRefCounts;return r[n]=(r[n]||0)+1,n}getSizeSignalRef(t){if(ai(this.parent)){const n=oq(t),r=$y(n),i=this.component.scales[r];if(i&&!i.merged){const a=i.get("type"),s=i.get("range");if(Tn(a)&&Cl(s)){const o=i.get("name"),u=w1(this,r),l=nA(u);if(l){const c=pe({aggregate:"distinct",field:l},{expr:"datum"});return{signal:sq(o,i,c)}}else return ce(xk(r)),null}}}return{signal:this.signalNameMap.get(this.getName(t))}}lookupDataSource(t){const n=this.component.data.outputNodes[t];return n?n.getSource():t}getSignalName(t){return this.signalNameMap.get(t)}renameSignal(t,n){this.signalNameMap.rename(t,n)}renameScale(t,n){this.scaleNameMap.rename(t,n)}renameProjection(t,n){this.projectionNameMap.rename(t,n)}scaleName(t,n){if(n)return this.getName(t);if(O6(t)&&ja(t)&&this.component.scales[t]||this.scaleNameMap.has(this.getName(t)))return this.scaleNameMap.get(this.getName(t))}projectionName(t){if(t)return this.getName("projection");if(this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection")))return this.projectionNameMap.get(this.getName("projection"))}getScaleComponent(t){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const n=this.component.scales[t];return n&&!n.merged?n:this.parent?this.parent.getScaleComponent(t):void 0}getScaleType(t){const n=this.getScaleComponent(t);return n?n.get("type"):void 0}getSelectionComponent(t,n){let r=this.component.selection[t];if(!r&&this.parent&&(r=this.parent.getSelectionComponent(t,n)),!r)throw new Error(gye(n));return r}hasAxisOrientSignalRef(){var t,n;return((t=this.component.axes.x)==null?void 0:t.some(r=>r.hasOrientSignalRef()))||((n=this.component.axes.y)==null?void 0:n.some(r=>r.hasOrientSignalRef()))}}class Hq extends aA{vgField(t,n={}){const r=this.fieldDef(t);if(r)return pe(r,n)}reduceFieldDef(t,n){return qbe(this.getMapping(),(r,i,a)=>{const s=ua(i);return s?t(r,s,a):r},n)}forEachFieldDef(t,n){t_(this.getMapping(),(r,i)=>{const a=ua(r);a&&t(a,i)},n)}}class x1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"value",i[1]??"density"];const a=this.transform.resolve??"shared";this.transform.resolve=a}clone(){return new x1(null,qe(this.transform))}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${at(this.transform)}`}assemble(){const{density:n,...r}=this.transform,i={type:"kde",field:n,...r};return i.resolve=this.transform.resolve,i}}class E1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r)}clone(){return new E1(null,qe(this.transform))}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${at(this.transform)}`}assemble(){const{extent:n,param:r}=this.transform;return{type:"extent",field:n,signal:r}}}class F1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r);const{flatten:i,as:a=[]}=this.transform;this.transform.as=i.map((s,o)=>a[o]??s)}clone(){return new F1(this.parent,qe(this.transform))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${at(this.transform)}`}assemble(){const{flatten:n,as:r}=this.transform;return{type:"flatten",fields:n,as:r}}}class S1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"key",i[1]??"value"]}clone(){return new S1(null,qe(this.transform))}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${at(this.transform)}`}assemble(){const{fold:n,as:r}=this.transform;return{type:"fold",fields:n,as:r}}}class qf extends xt{constructor(n,r,i,a){super(n);re(this,"fields");re(this,"geojson");re(this,"signal");this.fields=r,this.geojson=i,this.signal=a}clone(){return new qf(null,qe(this.fields),this.geojson,this.signal)}static parseAll(n,r){if(r.component.projection&&!r.component.projection.isFit)return n;let i=0;for(const a of[[na,ta],[_i,ra]]){const s=a.map(o=>{const u=hn(r.encoding[o]);return fe(u)?u.field:Za(u)?{expr:`${u.datum}`}:oa(u)?{expr:`${u.value}`}:void 0});(s[0]||s[1])&&(n=new qf(n,s,null,r.getName(`geojson_${i++}`)))}if(r.channelHasField(Vr)){const a=r.typedFieldDef(Vr);a.type===wf&&(n=new qf(n,null,a.field,r.getName(`geojson_${i++}`)))}return n}dependentFields(){const n=(this.fields??[]).filter(Ee);return new Set([...this.geojson?[this.geojson]:[],...n])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${at(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Hg extends xt{constructor(n,r,i,a){super(n);re(this,"projection");re(this,"fields");re(this,"as");this.projection=r,this.fields=i,this.as=a}clone(){return new Hg(null,this.projection,qe(this.fields),qe(this.as))}static parseAll(n,r){if(!r.projectionName())return n;for(const i of[[na,ta],[_i,ra]]){const a=i.map(o=>{const u=hn(r.encoding[o]);return fe(u)?u.field:Za(u)?{expr:`${u.datum}`}:oa(u)?{expr:`${u.value}`}:void 0}),s=i[0]===_i?"2":"";(a[0]||a[1])&&(n=new Hg(n,r.projectionName(),a,[r.getName(`x${s}`),r.getName(`y${s}`)]))}return n}dependentFields(){return new Set(this.fields.filter(Ee))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${at(this.fields)} ${at(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Ul extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r}clone(){return new Ul(null,qe(this.transform))}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(n){const{start:r=0,stop:i,step:a}=n;return{signal:`sequence(${[r,i,...a?[a]:[]].join(",")})`}}static makeFromTransform(n,r){return new Ul(n,r)}static makeFromEncoding(n,r){const i=r.encoding,a=i.x,s=i.y;if(fe(a)&&fe(s)){const o=a.impute?a:s.impute?s:void 0;if(o===void 0)return;const u=a.impute?s:s.impute?a:void 0,{method:l,value:c,frame:f,keyvals:d}=o.impute,h=b9(r.mark,i);return new Ul(n,{impute:o.field,key:u.field,...l?{method:l}:{},...c!==void 0?{value:c}:{},...f?{frame:f}:{},...d!==void 0?{keyvals:d}:{},...h.length?{groupby:h}:{}})}return null}hash(){return`Impute ${at(this.transform)}`}assemble(){const{impute:n,key:r,keyvals:i,method:a,groupby:s,value:o,frame:u=[null,null]}=this.transform,l={type:"impute",field:n,key:r,...i?{keyvals:z2e(i)?this.processSequence(i):i}:{},method:"value",...s?{groupby:s}:{},value:!a||a==="value"?o:null};if(a&&a!=="value"){const c={type:"window",as:[`imputed_${n}_value`],ops:[a],fields:[n],frame:u,ignorePeers:!1,...s?{groupby:s}:{}},f={type:"formula",expr:`datum.${n} === null ? datum.imputed_${n}_value : datum.${n}`,as:n};return[l,c,f]}else return[l]}}class C1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??r.on,i[1]??r.loess]}clone(){return new C1(null,qe(this.transform))}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${at(this.transform)}`}assemble(){const{loess:n,on:r,...i}=this.transform;return{type:"loess",x:r,y:n,...i}}}class jg extends xt{constructor(n,r,i){super(n);re(this,"transform");re(this,"secondary");this.transform=r,this.secondary=i}clone(){return new jg(null,qe(this.transform),this.secondary)}static make(n,r,i,a){const s=r.component.data.sources,{from:o}=i;let u=null;if(q2e(o)){let l=Xq(o.data,s);l||(l=new Ll(o.data),s.push(l));const c=r.getName(`lookup_${a}`);u=new Hr(l,c,Vt.Lookup,r.component.data.outputNodeRefCounts),r.component.data.outputNodes[c]=u}else if(U2e(o)){const l=o.param;i={as:l,...i};let c;try{c=r.getSelectionComponent(Ut(l),l)}catch{throw new Error(yye(l))}if(u=c.materialized,!u)throw new Error(bye(l))}return new jg(n,i,u.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?be(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${at({transform:this.transform,secondary:this.secondary})}`}assemble(){let n;if(this.transform.from.fields)n={values:this.transform.from.fields,...this.transform.as?{as:be(this.transform.as)}:{}};else{let r=this.transform.as;Ee(r)||(ce(Mye),r="_lookup"),n={as:[r]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...n,...this.transform.default?{default:this.transform.default}:{}}}}class k1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??"prob",i[1]??"value"]}clone(){return new k1(null,qe(this.transform))}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${at(this.transform)}`}assemble(){const{quantile:n,...r}=this.transform;return{type:"quantile",field:n,...r}}}class _1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r,this.transform=qe(r);const i=this.transform.as??[void 0,void 0];this.transform.as=[i[0]??r.on,i[1]??r.regression]}clone(){return new _1(null,qe(this.transform))}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${at(this.transform)}`}assemble(){const{regression:n,on:r,...i}=this.transform;return{type:"regression",x:r,y:n,...i}}}class A1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r}clone(){return new A1(null,qe(this.transform))}addDimensions(n){this.transform.groupby=Is((this.transform.groupby??[]).concat(n),r=>r)}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${at(this.transform)}`}assemble(){const{pivot:n,value:r,groupby:i,limit:a,op:s}=this.transform;return{type:"pivot",field:n,value:r,...a!==void 0?{limit:a}:{},...s!==void 0?{op:s}:{},...i!==void 0?{groupby:i}:{}}}}class T1 extends xt{constructor(n,r){super(n);re(this,"transform");this.transform=r}clone(){return new T1(null,qe(this.transform))}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${at(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function jq(e){let t=0;function n(r,i){if(r instanceof Ll&&!r.isGenerator&&!Af(r.data)&&(e.push(i),i={name:null,source:i.name,transform:[]}),r instanceof ir&&(r.parent instanceof Ll&&!i.source?(i.format={...i.format,parse:r.assembleFormatParse()},i.transform.push(...r.assembleTransforms(!0))):i.transform.push(...r.assembleTransforms())),r instanceof If){i.name||(i.name=`data_${t++}`),!i.source||i.transform.length>0?(e.push(i),r.data=i.name):r.data=i.source,e.push(...r.assemble());return}switch((r instanceof Vg||r instanceof Wg||r instanceof Bf||r instanceof Rf||r instanceof Pf||r instanceof Hg||r instanceof ca||r instanceof jg||r instanceof Lf||r instanceof ql||r instanceof S1||r instanceof F1||r instanceof x1||r instanceof C1||r instanceof k1||r instanceof _1||r instanceof cu||r instanceof T1||r instanceof A1||r instanceof E1)&&i.transform.push(r.assemble()),(r instanceof ns||r instanceof es||r instanceof Ul||r instanceof eo||r instanceof qf)&&i.transform.push(...r.assemble()),r instanceof Hr&&(i.source&&i.transform.length===0?r.setSource(i.source):r.parent instanceof Hr?r.setSource(i.name):(i.name||(i.name=`data_${t++}`),r.setSource(i.name),r.numChildren()===1&&(e.push(i),i={name:null,source:i.name,transform:[]}))),r.numChildren()){case 0:r instanceof Hr&&(!i.source||i.transform.length>0)&&e.push(i);break;case 1:n(r.children[0],i);break;default:{i.name||(i.name=`data_${t++}`);let a=i.name;!i.source||i.transform.length>0?e.push(i):a=i.source;for(const s of r.children)n(s,{name:null,source:a,transform:[]});break}}}return n}function tFe(e){const t=[],n=jq(t);for(const r of e.children)n(r,{source:e.name,name:null,transform:[]});return t}function nFe(e,t){const n=[],r=jq(n);let i=0;for(const s of e.sources){s.hasName()||(s.dataName=`source_${i++}`);const o=s.assemble();r(s,o)}for(const s of n)s.transform.length===0&&delete s.transform;let a=0;for(const[s,o]of n.entries())(o.transform??[]).length===0&&!o.source&&n.splice(a++,0,n.splice(s,1)[0]);for(const s of n)for(const o of s.transform??[])o.type==="lookup"&&(o.from=e.outputNodes[o.from].getSource());for(const s of n)s.name in t&&(s.values=t[s.name]);return n}function rFe(e){return e==="top"||e==="left"||Ae(e)?"header":"footer"}function iFe(e){for(const t of Ai)aFe(e,t);Yq(e,"x"),Yq(e,"y")}function aFe(e,t){var s;const{facet:n,config:r,child:i,component:a}=e;if(e.channelHasField(t)){const o=n[t],u=Of("title",null,r,t);let l=Sf(o,r,{allowDisabling:!0,includeDefault:u===void 0||!!u});i.component.layoutHeaders[t].title&&(l=ee(l)?l.join(", "):l,l+=` / ${i.component.layoutHeaders[t].title}`,i.component.layoutHeaders[t].title=null);const c=Of("labelOrient",o.header,r,t),f=o.header!==null?en((s=o.header)==null?void 0:s.labels,r.header.labels,!0):!1,d=rt(["bottom","right"],c)?"footer":"header";a.layoutHeaders[t]={title:o.header!==null?l:null,facetFieldDef:o,[d]:t==="facet"?[]:[Gq(e,t,f)]}}}function Gq(e,t,n){const r=t==="row"?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(r)?e.child.getSizeSignalRef(r):void 0,axes:[]}}function Yq(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:r,resolve:i}=e.component;if(i.axis[t]=V_(i,t),i.axis[t]==="shared"){const a=t==="x"?"column":"row",s=r[a];for(const o of n.component.axes[t]){const u=rFe(o.get("orient"));s[u]??(s[u]=[Gq(e,a,!1)]);const l=Ug(o,"main",e.config,{header:!0});l&&s[u][0].axes.push(l),o.mainExtracted=!0}}}}function sFe(e){sA(e),M1(e,"width"),M1(e,"height")}function oFe(e){sA(e);const t=e.layout.columns===1?"width":"childWidth",n=e.layout.columns===void 0?"height":"childHeight";M1(e,t),M1(e,n)}function sA(e){for(const t of e.children)t.parseLayoutSize()}function M1(e,t){const n=oq(t),r=$y(n),i=e.component.resolve,a=e.component.layoutSize;let s;for(const o of e.children){const u=o.component.layoutSize.getWithExplicit(n),l=i.scale[r]??lq(r,e);if(l==="independent"&&u.value==="step"){s=void 0;break}if(s){if(l==="independent"&&s.value!==u.value){s=void 0;break}s=uu(s,u,n,"")}else s=u}if(s){for(const o of e.children)e.renameSignal(o.getName(n),e.getName(t)),o.component.layoutSize.set(n,"merged",!1);a.setWithExplicit(t,s)}else a.setWithExplicit(t,{explicit:!1,value:void 0})}function uFe(e){const{size:t,component:n}=e;for(const r of Ws){const i=Wr(r);if(t[i]){const a=t[i];n.layoutSize.set(i,Qa(a)?"step":a,!0)}else{const a=lFe(e,i);n.layoutSize.set(i,a,!1)}}}function lFe(e,t){const n=t==="width"?"x":"y",r=e.config,i=e.getScaleComponent(n);if(i){const a=i.get("type"),s=i.get("range");if(Tn(a)){const o=i1(r.view,t);return Cl(s)||Qa(o)?"step":o}else return h_(r.view,t)}else{if(e.hasProjection||e.mark==="arc")return h_(r.view,t);{const a=i1(r.view,t);return Qa(a)?a.step:a}}}function oA(e,t,n){return pe(t,{suffix:`by_${pe(e)}`,...n})}class Gg extends Hq{constructor(n,r,i,a){super(n,"facet",r,i,a,n.resolve);re(this,"facet");re(this,"child");re(this,"children");this.child=dA(n.spec,this,this.getName("child"),void 0,a),this.children=[this.child],this.facet=this.initFacet(n.facet)}initFacet(n){if(!Pg(n))return{facet:this.initFacetFieldDef(n,"facet")};const r=ue(n),i={};for(const a of r){if(![Bs,Ls].includes(a)){ce(Py(a,"facet"));break}const s=n[a];if(s.field===void 0){ce(Fk(s,a));break}i[a]=this.initFacetFieldDef(s,a)}return i}initFacetFieldDef(n,r){const i=e_(n,r);return i.header?i.header=Wn(i.header):i.header===null&&(i.header=null),i}channelHasField(n){return le(this.facet,n)}fieldDef(n){return this.facet[n]}parseData(){this.component.data=$1(this),this.child.parseData()}parseLayoutSize(){sA(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection,dn(this.component.selection).some(n=>ts(n))&&Ck(Ek)}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),iFe(this)}assembleSelectionTopLevelSignals(n){return this.child.assembleSelectionTopLevelSignals(n)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(n){return this.child.assembleSelectionData(n)}getHeaderLayoutMixins(){const n={};for(const r of Ai)for(const i of z_){const a=this.component.layoutHeaders[r],s=a[i],{facetFieldDef:o}=a;if(o){const u=Of("titleOrient",o.header,this.config,r);if(["right","bottom"].includes(u)){const l=v1(r,u);n.titleAnchor??(n.titleAnchor={}),n.titleAnchor[l]="end"}}if(s!=null&&s[0]){const u=r==="row"?"height":"width",l=i==="header"?"headerBand":"footerBand";r!=="facet"&&!this.child.component.layoutSize.get(u)&&(n[l]??(n[l]={}),n[l][r]=.5),a.title&&(n.offset??(n.offset={}),n.offset[r==="row"?"rowTitle":"columnTitle"]=10)}}return n}assembleDefaultLayout(){const{column:n,row:r}=this.facet,i=n?this.columnDistinctSignal():r?1:void 0;let a="all";return(!r&&this.component.resolve.scale.x==="independent"||!n&&this.component.resolve.scale.y==="independent")&&(a="none"),{...this.getHeaderLayoutMixins(),...i?{columns:i}:{},bounds:"full",align:a}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Gg))return{signal:`length(data('${this.getName("column_domain")}'))`}}assembleGroupStyle(){}assembleGroup(n){return this.parent&&this.parent instanceof Gg?{...this.channelHasField("column")?{encode:{update:{columns:{field:pe(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(n)}:super.assembleGroup(n)}getCardinalityAggregateForChild(){const n=[],r=[],i=[];if(this.child instanceof Gg){if(this.child.channelHasField("column")){const a=pe(this.child.facet.column);n.push(a),r.push("distinct"),i.push(`distinct_${a}`)}}else for(const a of Ws){const s=this.child.component.scales[a];if(s&&!s.merged){const o=s.get("type"),u=s.get("range");if(Tn(o)&&Cl(u)){const l=w1(this.child,a),c=nA(l);c?(n.push(c),r.push("distinct"),i.push(`distinct_${c}`)):ce(xk(a))}}}return{fields:n,ops:r,as:i}}assembleFacet(){const{name:n,data:r}=this.component.data.facetRoot,{row:i,column:a}=this.facet,{fields:s,ops:o,as:u}=this.getCardinalityAggregateForChild(),l=[];for(const f of Ai){const d=this.facet[f];if(d){l.push(pe(d));const{bin:h,sort:g}=d;if($t(h)&&l.push(pe(d,{binSuffix:"end"})),Gs(g)){const{field:p,op:v=Wy}=g,m=oA(d,g);i&&a?(s.push(m),o.push("max"),u.push(m)):(s.push(p),o.push(v),u.push(m))}else if(ee(g)){const p=Nf(d,f);s.push(p),o.push("max"),u.push(p)}}}const c=!!i&&!!a;return{name:n,data:r,groupby:l,...c||s.length>0?{aggregate:{...c?{cross:c}:{},...s.length?{fields:s,ops:o,as:u}:{}}}:{}}}facetSortFields(n){const{facet:r}=this,i=r[n];return i?Gs(i.sort)?[oA(i,i.sort,{expr:"datum"})]:ee(i.sort)?[Nf(i,n,{expr:"datum"})]:[pe(i,{expr:"datum"})]:[]}facetSortOrder(n){const{facet:r}=this,i=r[n];if(i){const{sort:a}=i;return[(Gs(a)?a.order:!ee(a)&&a)||"ascending"]}return[]}assembleLabelTitle(){var a;const{facet:n,config:r}=this;if(n.facet)return q_(n.facet,"facet",r);const i={row:["top","bottom"],column:["left","right"]};for(const s of L_)if(n[s]){const o=Of("labelOrient",(a=n[s])==null?void 0:a.header,r,s);if(i[s].includes(o))return q_(n[s],s,r)}}assembleMarks(){const{child:n}=this,r=this.component.data.facetRoot,i=tFe(r),a=n.assembleGroupEncodeEntry(!1),s=this.assembleLabelTitle()||n.assembleTitle(),o=n.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...s?{title:s}:{},...o?{style:o}:{},from:{facet:this.assembleFacet()},sort:{field:Ai.map(l=>this.facetSortFields(l)).flat(),order:Ai.map(l=>this.facetSortOrder(l)).flat()},...i.length>0?{data:i}:{},...a?{encode:{update:a}}:{},...n.assembleGroup(Cwe(this,[]))}]}getMapping(){return this.facet}}function cFe(e,t){const{row:n,column:r}=t;if(n&&r){let i=null;for(const a of[n,r])if(Gs(a.sort)){const{field:s,op:o=Wy}=a.sort;e=i=new ql(e,{joinaggregate:[{op:o,field:s,as:oA(a,a.sort,{forAs:!0})}],groupby:[pe(a)]})}return i}return null}function Xq(e,t){var n,r,i,a;for(const s of t){const o=s.data;if(e.name&&s.hasName()&&e.name!==s.dataName)continue;const u=(n=e.format)==null?void 0:n.mesh,l=(r=o.format)==null?void 0:r.feature;if(u&&l)continue;const c=(i=e.format)==null?void 0:i.feature;if((c||l)&&c!==l)continue;const f=(a=o.format)==null?void 0:a.mesh;if(!((u||f)&&u!==f)){if(Lg(e)&&Lg(o)){if(Ci(e.values,o.values))return s}else if(Af(e)&&Af(o)){if(e.url===o.url)return s}else if(u7(e)&&e.name===s.dataName)return s}}return null}function fFe(e,t){if(e.data||!e.parent){if(e.data===null){const r=new Ll({values:[]});return t.push(r),r}const n=Xq(e.data,t);if(n)return lu(e.data)||(n.data.format=kme({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const r=new Ll(e.data);return t.push(r),r}}else return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}function dFe(e,t,n){let r=0;for(const i of t.transforms){let a,s;if(Q2e(i))s=e=new Pf(e,i),a="derived";else if(b_(i)){const o=rEe(i);s=e=ir.makeWithAncestors(e,{},o,n)??e,e=new Rf(e,t,i.filter)}else if(t7(i))s=e=ns.makeFromTransform(e,i,t),a="number";else if(ewe(i))a="date",n.getWithExplicit(i.field).value===void 0&&(e=new ir(e,{[i.field]:a}),n.set(i.field,a,!1)),s=e=es.makeFromTransform(e,i);else if(twe(i))s=e=ca.makeFromTransform(e,i),a="number",P_(t)&&(e=new cu(e));else if(e7(i))s=e=jg.make(e,t,i,r++),a="derived";else if(X2e(i))s=e=new Lf(e,i),a="number";else if(K2e(i))s=e=new ql(e,i),a="number";else if(nwe(i))s=e=eo.makeFromTransform(e,i),a="derived";else if(rwe(i))s=e=new S1(e,i),a="derived";else if(iwe(i))s=e=new E1(e,i),a="derived";else if(Z2e(i))s=e=new F1(e,i),a="derived";else if(V2e(i))s=e=new A1(e,i),a="derived";else if(Y2e(i))e=new T1(e,i);else if(J2e(i))s=e=Ul.makeFromTransform(e,i),a="derived";else if(W2e(i))s=e=new x1(e,i),a="derived";else if(H2e(i))s=e=new k1(e,i),a="derived";else if(j2e(i))s=e=new _1(e,i),a="derived";else if(G2e(i))s=e=new C1(e,i),a="derived";else{ce(Tye(i));continue}if(s&&a!==void 0)for(const o of s.producedFields()??[])n.set(o,a,!1)}return e}function $1(e){var v;let t=fFe(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:r}=e.component.data,i=e.data,s=!(i&&(lu(i)||Af(i)||Lg(i)))&&e.parent?e.parent.component.data.ancestorParse.clone():new mwe;lu(i)?(l7(i)?t=new Wg(t,i.sequence):E_(i)&&(t=new Vg(t,i.graticule)),s.parseNothing=!0):((v=i==null?void 0:i.format)==null?void 0:v.parse)===null&&(s.parseNothing=!0),t=ir.makeExplicit(t,e,s)??t,t=new cu(t);const o=e.parent&&zf(e.parent);(Wt(e)||ai(e))&&o&&(t=ns.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=dFe(t,e,s));const u=aEe(e),l=iEe(e);t=ir.makeWithAncestors(t,{},{...u,...l},s)??t,Wt(e)&&(t=qf.parseAll(t,e),t=Hg.parseAll(t,e)),(Wt(e)||ai(e))&&(o||(t=ns.makeFromEncoding(t,e)??t),t=es.makeFromEncoding(t,e)??t,t=Pf.parseAllForSortIndex(t,e));const c=t=D1(Vt.Raw,e,t);if(Wt(e)){const m=ca.makeFromEncoding(t,e);m&&(t=m,P_(e)&&(t=new cu(t))),t=Ul.makeFromEncoding(t,e)??t,t=eo.makeFromEncoding(t,e)??t}let f,d;if(Wt(e)){const{markDef:m,mark:y,config:b}=e,w=Ct("invalid",m,b),{marks:E,scales:F}=d=f7({invalid:w,isPath:au(y)});E!==F&&F==="include-invalid-values"&&(f=t=D1(Vt.PreFilterInvalid,e,t)),E==="exclude-invalid-values"&&(t=Bf.make(t,e,d)??t)}const h=t=D1(Vt.Main,e,t);let g;if(Wt(e)&&d){const{marks:m,scales:y}=d;m==="include-invalid-values"&&y==="exclude-invalid-values"&&(t=Bf.make(t,e,d)??t,g=t=D1(Vt.PostFilterInvalid,e,t))}Wt(e)&&exe(e,h);let p=null;if(ai(e)){const m=e.getName("facet");t=cFe(t,e.facet)??t,p=new If(t,e,m,h.getSource()),n[m]=p}return{...e.component.data,outputNodes:n,outputNodeRefCounts:r,raw:c,main:h,facetRoot:p,ancestorParse:s,preFilterInvalid:f,postFilterInvalid:g}}function D1(e,t,n){const{outputNodes:r,outputNodeRefCounts:i}=t.component.data,a=t.getDataName(e),s=new Hr(n,a,e,i);return r[a]=s,s}class hFe extends aA{constructor(n,r,i,a){var s,o,u,l;super(n,"concat",r,i,a,n.resolve);re(this,"children");(((o=(s=n.resolve)==null?void 0:s.axis)==null?void 0:o.x)==="shared"||((l=(u=n.resolve)==null?void 0:u.axis)==null?void 0:l.y)==="shared")&&ce(kye),this.children=this.getChildren(n).map((c,f)=>dA(c,this,this.getName(`concat_${f}`),void 0,a))}parseData(){this.component.data=$1(this);for(const n of this.children)n.parseData()}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const r of ue(n.component.selection))this.component.selection[r]=n.component.selection[r]}dn(this.component.selection).some(n=>ts(n))&&Ck(Ek)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){for(const n of this.children)n.parseAxesAndHeaders()}getChildren(n){return r1(n)?n.vconcat:d_(n)?n.hconcat:n.concat}parseLayoutSize(){oFe(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(n){return this.children.reduce((r,i)=>i.assembleSelectionTopLevelSignals(r),n)}assembleSignals(){return this.children.forEach(n=>n.assembleSignals()),[]}assembleLayoutSignals(){const n=U_(this);for(const r of this.children)n.push(...r.assembleLayoutSignals());return n}assembleSelectionData(n){return this.children.reduce((r,i)=>i.assembleSelectionData(r),n)}assembleMarks(){return this.children.map(n=>{const r=n.assembleTitle(),i=n.assembleGroupStyle(),a=n.assembleGroupEncodeEntry(!1);return{type:"group",name:n.getName("group"),...r?{title:r}:{},...i?{style:i}:{},...a?{encode:{update:a}}:{},...n.assembleGroup()}})}assembleGroupStyle(){}assembleDefaultLayout(){const n=this.layout.columns;return{...n!=null?{columns:n}:{},bounds:"full",align:"each"}}}function gFe(e){return e===!1||e===null}const pFe={disable:1,gridScale:1,scale:1,...d9,labelExpr:1,encode:1},Kq=ue(pFe);class uA extends Ks{constructor(n={},r={},i=!1){super();re(this,"explicit");re(this,"implicit");re(this,"mainExtracted");this.explicit=n,this.implicit=r,this.mainExtracted=i}clone(){return new uA(qe(this.explicit),qe(this.implicit),this.mainExtracted)}hasAxisPart(n){return n==="axis"?!0:n==="grid"||n==="title"?!!this.get(n):!gFe(this.get(n))}hasOrientSignalRef(){return Ae(this.explicit.orient)}}function vFe(e,t,n){const{encoding:r,config:i}=e,a=hn(r[t])??hn(r[Ha(t)]),s=e.axis(t)||{},{format:o,formatType:u}=s;if(Rl(u))return{text:sa({fieldOrDatumDef:a,field:"datum.value",format:o,formatType:u,config:i}),...n};if(o===void 0&&u===void 0&&i.customFormatTypes){if(Ef(a)==="quantitative"){if(Ff(a)&&a.stack==="normalize"&&i.normalizedNumberFormatType)return{text:sa({fieldOrDatumDef:a,field:"datum.value",format:i.normalizedNumberFormat,formatType:i.normalizedNumberFormatType,config:i}),...n};if(i.numberFormatType)return{text:sa({fieldOrDatumDef:a,field:"datum.value",format:i.numberFormat,formatType:i.numberFormatType,config:i}),...n}}if(Ef(a)==="temporal"&&i.timeFormatType&&fe(a)&&!a.timeUnit)return{text:sa({fieldOrDatumDef:a,field:"datum.value",format:i.timeFormat,formatType:i.timeFormatType,config:i}),...n}}return n}function mFe(e){return Ws.reduce((t,n)=>(e.component.scales[n]&&(t[n]=[SFe(n,e)]),t),{})}const yFe={bottom:"top",top:"bottom",left:"right",right:"left"};function bFe(e){const{axes:t,resolve:n}=e.component,r={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const a of ue(i.component.axes))n.axis[a]=V_(e.component.resolve,a),n.axis[a]==="shared"&&(t[a]=wFe(t[a],i.component.axes[a]),t[a]||(n.axis[a]="independent",delete t[a]))}for(const i of Ws){for(const a of e.children)if(a.component.axes[i]){if(n.axis[i]==="independent"){t[i]=(t[i]??[]).concat(a.component.axes[i]);for(const s of a.component.axes[i]){const{value:o,explicit:u}=s.getWithExplicit("orient");if(!Ae(o)){if(r[o]>0&&!u){const l=yFe[o];r[o]>r[l]&&s.set("orient",l,!1)}r[o]++}}}delete a.component.axes[i]}if(n.axis[i]==="independent"&&t[i]&&t[i].length>1)for(const[a,s]of(t[i]||[]).entries())a>0&&s.get("grid")&&!s.explicit.grid&&(s.implicit.grid=!1)}}function wFe(e,t){if(e){if(e.length!==t.length)return;const n=e.length;for(let r=0;r<n;r++){const i=e[r],a=t[r];if(!!i!=!!a)return;if(i&&a){const s=i.getWithExplicit("orient"),o=a.getWithExplicit("orient");if(s.explicit&&o.explicit&&s.value!==o.value)return;e[r]=xFe(i,a)}}}else return t.map(n=>n.clone());return e}function xFe(e,t){for(const n of Kq){const r=uu(e.getWithExplicit(n),t.getWithExplicit(n),n,"axis",(i,a)=>{switch(n){case"title":return e8(i,a);case"gridScale":return{explicit:i.explicit,value:en(i.value,a.value)}}return s1(i,a,n,"axis")});e.setWithExplicit(n,r)}return e}function EFe(e,t,n,r,i){if(t==="disable")return n!==void 0;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(Ae(n.labelAngle)?n.labelAngle:Cy(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===tq(r,i))return!0}return e===n[t]}const FFe=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function SFe(e,t){var m,y;let n=t.axis(e);const r=new uA,i=hn(t.encoding[e]),{mark:a,config:s}=t,o=(n==null?void 0:n.orient)||((m=s[e==="x"?"axisX":"axisY"])==null?void 0:m.orient)||((y=s.axis)==null?void 0:y.orient)||cxe(e),u=t.getScaleComponent(e).get("type"),l=rxe(e,u,o,t.config),c=n!==void 0?!n:I_("disable",s.style,n==null?void 0:n.style,l).configValue;if(r.set("disable",c,n!==void 0),c)return r;n=n||{};const f=oxe(i,n,e,s.style,l),d=G8(n.formatType,i,u),h=j8(i,i.type,n.format,n.formatType,s,!0),g={fieldOrDatumDef:i,axis:n,channel:e,model:t,scaleType:u,orient:o,labelAngle:f,format:h,formatType:d,mark:a,config:s};for(const b of Kq){const w=b in Q7?Q7[b](g):h9(b)?n[b]:void 0,E=w!==void 0,F=EFe(w,b,n,t,e);if(E&&F)r.set(b,w,F);else{const{configValue:x=void 0,configFrom:C=void 0}=h9(b)&&b!=="values"?I_(b,s.style,n.style,l):{},S=x!==void 0;E&&!S?r.set(b,w,F):(C!=="vgAxisConfig"||FFe.has(b)&&S||Bg(x)||Ae(x))&&r.set(b,x,!1)}}const p=n.encoding??{},v=f9.reduce((b,w)=>{if(!r.hasAxisPart(w))return b;const E=uq(p[w]??{},t),F=w==="labels"?vFe(t,e,E):E;return F!==void 0&&!Mt(F)&&(b[w]={update:F}),b},{});return Mt(v)||r.set("encode",v,!!n.encoding||n.labelAngle!==void 0),r}function CFe({encoding:e,size:t}){for(const n of Ws){const r=Wr(n);Qa(t[r])&&ou(e[n])&&(delete t[r],ce(d8(r)))}return t}const kFe={vgMark:"arc",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Mr("x",e,{defaultPos:"mid"}),...Mr("y",e,{defaultPos:"mid"}),...Qs(e,"radius"),...Qs(e,"theta")})},_Fe={vgMark:"area",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...f1("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="horizontal"}),...f1("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:e.markDef.orient==="vertical"}),...D_(e)})},AFe={vgMark:"rect",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Qs(e,"x"),...Qs(e,"y")})},TFe={vgMark:"shape",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&fe(n)&&n.type===wf?{field:pe(n,{expr:"datum"})}:{}}]}},MFe={vgMark:"image",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...Qs(e,"x"),...Qs(e,"y"),...M_(e,"url")})},$Fe={vgMark:"line",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Mr("x",e,{defaultPos:"mid"}),...Mr("y",e,{defaultPos:"mid"}),...jn("size",e,{vgChannel:"strokeWidth"}),...D_(e)})},DFe={vgMark:"trail",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Mr("x",e,{defaultPos:"mid"}),...Mr("y",e,{defaultPos:"mid"}),...jn("size",e),...D_(e)})};function lA(e,t){const{config:n}=e;return{...Ti(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Mr("x",e,{defaultPos:"mid"}),...Mr("y",e,{defaultPos:"mid"}),...jn("size",e),...jn("angle",e),...RFe(e,n,t)}}function RFe(e,t,n){return n?{shape:{value:n}}:jn("shape",e)}const PFe={vgMark:"symbol",encodeEntry:e=>lA(e)},NFe={vgMark:"symbol",encodeEntry:e=>lA(e,"circle")},OFe={vgMark:"symbol",encodeEntry:e=>lA(e,"square")},IFe={vgMark:"rect",encodeEntry:e=>({...Ti(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Qs(e,"x"),...Qs(e,"y")})},BFe={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return!e.encoding.x&&!e.encoding.y&&!e.encoding.latitude&&!e.encoding.longitude?{}:{...Ti(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...f1("x",e,{defaultPos:n==="horizontal"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="vertical"}),...f1("y",e,{defaultPos:n==="vertical"?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:n!=="horizontal"}),...jn("size",e,{vgChannel:"strokeWidth"})}}},LFe={vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...Ti(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Mr("x",e,{defaultPos:"mid"}),...Mr("y",e,{defaultPos:"mid"}),...M_(e),...jn("size",e,{vgChannel:"fontSize"}),...jn("angle",e),...R7("align",zFe(e.markDef,n,t)),...R7("baseline",qFe(e.markDef,n,t)),...Mr("radius",e,{defaultPos:null}),...Mr("theta",e,{defaultPos:null})}}};function zFe(e,t,n){if(Ct("align",e,n)===void 0)return"center"}function qFe(e,t,n){if(Ct("baseline",e,n)===void 0)return"middle"}const R1={arc:kFe,area:_Fe,bar:AFe,circle:NFe,geoshape:TFe,image:MFe,line:$Fe,point:PFe,rect:IFe,rule:BFe,square:OFe,text:LFe,tick:{vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,r=n.orient,i=r==="horizontal"?"x":"y",a=r==="horizontal"?"y":"x",s=r==="horizontal"?"height":"width";return{...Ti(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Qs(e,i),...Mr(a,e,{defaultPos:"mid",vgChannel:a==="y"?"yc":"xc"}),[s]:Ot(Ct("thickness",n,t))}}},trail:DFe};function UFe(e){if(rt([zy,By,nbe],e.mark)){const t=b9(e.mark,e.encoding);if(t.length>0)return VFe(e,t)}else if(e.mark===Ly){const t=yk.some(n=>Ct(n,e.markDef,e.config));if(e.stack&&!e.fieldDef("size")&&t)return WFe(e)}return cA(e)}const Zq="faceted_path_";function VFe(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:Zq+e.requestDataName(Vt.Main),data:e.requestDataName(Vt.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:cA(e,{fromPrefix:Zq})}]}const Qq="stack_group_";function WFe(e){var l;const[t]=cA(e,{fromPrefix:Qq}),n=e.scaleName(e.stack.fieldChannel),r=(c={})=>e.vgField(e.stack.fieldChannel,c),i=(c,f)=>{const d=[r({prefix:"min",suffix:"start",expr:f}),r({prefix:"max",suffix:"start",expr:f}),r({prefix:"min",suffix:"end",expr:f}),r({prefix:"max",suffix:"end",expr:f})];return`${c}(${d.map(h=>`scale('${n}',${h})`).join(",")})`};let a,s;e.stack.fieldChannel==="x"?(a={...Eg(t.encode.update,["y","yc","y2","height",...yk]),x:{signal:i("min","datum")},x2:{signal:i("max","datum")},clip:{value:!0}},s={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...Si(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(a={...Eg(t.encode.update,["x","xc","x2","width"]),y:{signal:i("min","datum")},y2:{signal:i("max","datum")},clip:{value:!0}},s={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...Si(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const c of yk){const f=Ga(c,e.markDef,e.config);t.encode.update[c]?(a[c]=t.encode.update[c],delete t.encode.update[c]):f&&(a[c]=Ot(f)),f&&(t.encode.update[c]={value:0})}const o=[];if(((l=e.stack.groupbyChannels)==null?void 0:l.length)>0)for(const c of e.stack.groupbyChannels){const f=e.fieldDef(c),d=pe(f);d&&o.push(d),(f!=null&&f.bin||f!=null&&f.timeUnit)&&o.push(pe(f,{binSuffix:"end"}))}return a=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce((c,f)=>{if(t.encode.update[f])return{...c,[f]:t.encode.update[f]};{const d=Ga(f,e.markDef,e.config);return d!==void 0?{...c,[f]:Ot(d)}:c}},a),a.stroke&&(a.strokeForeground={value:!0},a.strokeOffset={value:0}),[{type:"group",from:{facet:{data:e.requestDataName(Vt.Main),name:Qq+e.requestDataName(Vt.Main),groupby:o,aggregate:{fields:[r({suffix:"start"}),r({suffix:"start"}),r({suffix:"end"}),r({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:a},marks:[{type:"group",encode:{update:s},marks:[t]}]}]}function HFe(e){const{encoding:t,stack:n,mark:r,markDef:i,config:a}=e,s=t.order;if(!(!ee(s)&&oa(s)&&S6(s.value)||!s&&S6(Ct("order",i,a)))){if((ee(s)||fe(s))&&!n)return Z6(s,{expr:"datum"});if(au(r)){const o=i.orient==="horizontal"?"y":"x",u=t[o];if(fe(u))return{field:o}}}}function cA(e,t={fromPrefix:""}){const{mark:n,markDef:r,encoding:i,config:a}=e,s=en(r.clip,jFe(e),GFe(e)),o=X6(r),u=i.key,l=HFe(e),c=YFe(e),f=Ct("aria",r,a),d=R1[n].postEncodingTransform?R1[n].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:R1[n].vgMark,...s?{clip:s}:{},...o?{style:o}:{},...u?{key:u.field}:{},...l?{sort:l}:{},...c||{},...f===!1?{aria:f}:{},from:{data:t.fromPrefix+e.requestDataName(Vt.Main)},encode:{update:R1[n].encodeEntry(e)},...d?{transform:d}:{}}]}function jFe(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return t!=null&&t.get("selectionExtent")||n!=null&&n.get("selectionExtent")?!0:void 0}function GFe(e){const t=e.component.projection;return t&&!t.isFit?!0:void 0}function YFe(e){if(!e.component.selection)return null;const t=ue(e.component.selection).length;let n=t,r=e.parent;for(;r&&n===0;)n=ue(r.component.selection).length,r=r.parent;return n?{interactive:t>0||e.mark==="geoshape"||!!e.encoding.tooltip||!!e.markDef.tooltip}:null}class Jq extends Hq{constructor(n,r,i,a={},s){super(n,"unit",r,i,s,void 0,I9(n)?n.view:void 0);re(this,"markDef");re(this,"encoding");re(this,"specifiedScales",{});re(this,"stack");re(this,"specifiedAxes",{});re(this,"specifiedLegends",{});re(this,"specifiedProjection",{});re(this,"selection",[]);re(this,"children",[]);re(this,"correctDataNames",n=>{var r,i,a;return(r=n.from)!=null&&r.data&&(n.from.data=this.lookupDataSource(n.from.data),"time"in this.encoding&&(n.from.data=n.from.data+v7)),(a=(i=n.from)==null?void 0:i.facet)!=null&&a.data&&(n.from.facet.data=this.lookupDataSource(n.from.facet.data)),n});const o=Ka(n.mark)?{...n.mark}:{type:n.mark},u=o.type;o.filled===void 0&&(o.filled=D2e(o,s,{graticule:n.data&&E_(n.data)}));const l=this.encoding=Lbe(n.encoding||{},u,o.filled,s);this.markDef=j9(o,l,s),this.size=CFe({encoding:l,size:I9(n)?{...a,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}}:a}),this.stack=H9(this.markDef,l),this.specifiedScales=this.initScales(u,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegends(l),this.specifiedProjection=n.projection,this.selection=(n.params??[]).filter(c=>c_(c))}get hasProjection(){const{encoding:n}=this,r=this.mark===B8,i=n&&Ome.some(a=>He(n[a]));return r||i}scaleDomain(n){const r=this.specifiedScales[n];return r?r.domain:void 0}axis(n){return this.specifiedAxes[n]}legend(n){return this.specifiedLegends[n]}initScales(n,r){return pk.reduce((i,a)=>{const s=hn(r[a]);return s&&(i[a]=this.initScale(s.scale??{})),i},{})}initScale(n){const{domain:r,range:i}=n,a=Wn(n);return ee(r)&&(a.domain=r.map(ri)),ee(i)&&(a.range=i.map(ri)),a}initAxes(n){return Ws.reduce((r,i)=>{const a=n[i];if(He(a)||i===Bt&&He(n.x2)||i===_n&&He(n.y2)){const s=He(a)?a.axis:void 0;r[i]=s&&this.initAxis({...s})}return r},{})}initAxis(n){const r=ue(n),i={};for(const a of r){const s=n[a];i[a]=Bg(s)?j6(s):ri(s)}return i}initLegends(n){return Gme.reduce((r,i)=>{const a=hn(n[i]);if(a&&Xme(i)){const s=a.legend;r[i]=s&&Wn(s)}return r},{})}parseData(){this.component.data=$1(this)}parseLayoutSize(){uFe(this)}parseSelections(){this.component.selection=Jwe(this,this.selection)}parseMarkGroup(){this.component.mark=UFe(this)}parseAxesAndHeaders(){this.component.axes=mFe(this)}assembleSelectionTopLevelSignals(n){return kwe(this,n)}assembleSignals(){return[...K7(this),...Swe(this,[])]}assembleSelectionData(n){return _we(this,n)}assembleLayout(){return null}assembleLayoutSignals(){return U_(this)}assembleMarks(){let n=this.component.mark??[];return(!this.parent||!zf(this.parent))&&(n=w7(this,n)),n.map(this.correctDataNames)}assembleGroupStyle(){const{style:n}=this.view||{};return n!==void 0?n:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(n){return Nl(this.encoding,n)}fieldDef(n){const r=this.encoding[n];return ua(r)}typedFieldDef(n){const r=this.fieldDef(n);return Tr(r)?r:null}}class fA extends aA{constructor(n,r,i,a,s){super(n,"layer",r,i,s,n.resolve,n.view);re(this,"children");const o={...a,...n.width?{width:n.width}:{},...n.height?{height:n.height}:{}};this.children=n.layer.map((u,l)=>{if(a1(u))return new fA(u,this,this.getName(`layer_${l}`),o,s);if(Ys(u))return new Jq(u,this,this.getName(`layer_${l}`),o,s);throw new Error(wk(u))})}parseData(){this.component.data=$1(this);for(const n of this.children)n.parseData()}parseLayoutSize(){sFe(this)}parseSelections(){this.component.selection={};for(const n of this.children){n.parseSelections();for(const r of ue(n.component.selection))this.component.selection[r]=n.component.selection[r]}dn(this.component.selection).some(n=>ts(n))&&Ck(Ek)}parseMarkGroup(){for(const n of this.children)n.parseMarkGroup()}parseAxesAndHeaders(){bFe(this)}assembleSelectionTopLevelSignals(n){return this.children.reduce((r,i)=>i.assembleSelectionTopLevelSignals(r),n)}assembleSignals(){return this.children.reduce((n,r)=>n.concat(r.assembleSignals()),K7(this))}assembleLayoutSignals(){return this.children.reduce((n,r)=>n.concat(r.assembleLayoutSignals()),U_(this))}assembleSelectionData(n){return this.children.reduce((r,i)=>i.assembleSelectionData(r),n)}assembleGroupStyle(){const n=new Set;for(const i of this.children)for(const a of be(i.assembleGroupStyle()))n.add(a);const r=Array.from(n);return r.length>1?r:r.length===1?r[0]:void 0}assembleTitle(){let n=super.assembleTitle();if(n)return n;for(const r of this.children)if(n=r.assembleTitle(),n)return n}assembleLayout(){return null}assembleMarks(){return Awe(this,this.children.flatMap(n=>n.assembleMarks()))}assembleLegends(){return this.children.reduce((n,r)=>n.concat(r.assembleLegends()),bq(this))}}function dA(e,t,n,r,i){if(Hy(e))return new Gg(e,t,n,i);if(a1(e))return new fA(e,t,n,r,i);if(Ys(e))return new Jq(e,t,n,r,i);if(u2e(e))return new hFe(e,t,n,i);throw new Error(wk(e))}function XFe(e,t={}){t.logger&&v1e(t.logger),t.fieldTitle&&o9(t.fieldTitle);try{const n=V9(tw(t.config,e.config)),r=uwe(e,n),i=dA(r,null,"",void 0,n);return i.parse(),wEe(i.component.data,i),{spec:ZFe(i,KFe(e,r.autosize,n,i),e.datasets,e.usermeta),normalized:r}}finally{t.logger&&m1e(),t.fieldTitle&&$be()}}function KFe(e,t,n,r){const i=r.component.layoutSize.get("width"),a=r.component.layoutSize.get("height");if(t===void 0?(t={type:"pad"},r.hasAxisOrientSignalRef()&&(t.resize=!0)):Ee(t)&&(t={type:t}),i&&a&&gwe(t.type)){if(i==="step"&&a==="step")ce(r8()),t.type="pad";else if(i==="step"||a==="step"){const s=i==="step"?"width":"height";ce(r8($y(s)));const o=s==="width"?"height":"width";t.type=pwe(o)}}return{...ue(t).length===1&&t.type?t.type==="pad"?{}:{autosize:t.type}:{autosize:t},...s7(n,!1),...s7(e,!0)}}function ZFe(e,t,n={},r){const i=e.config?w2e(e.config):void 0,a=nFe(e.component.data,n),s=e.assembleSelectionData(a),o=e.assembleProjections(),u=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let f=e.assembleLayoutSignals();f=f.filter(g=>(g.name==="width"||g.name==="height")&&g.value!==void 0?(t[g.name]=+g.value,!1):!0);const{params:d,...h}=t;return{$schema:"https://vega.github.io/schema/vega/v6.json",...e.description?{description:e.description}:{},...h,...u?{title:u}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:s,...o.length>0?{projections:o}:{},...e.assembleGroup([...f,...e.assembleSelectionTopLevelSignals([]),...N9(d)]),...i?{config:i}:{},...r?{usermeta:r}:{}}}function eU(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void eU(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function QFe(e){var t="",n,r;try{r=1,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/vegaWidget.pug",t=t+'<div class="g-item-vega">',r=2,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/vegaWidget.pug",t=t+'<div class="g-item-vega-header">',r=3,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/vegaWidget.pug",t=t+'<i class="icon-chart-bar"></i>',r=4,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/vegaWidget.pug",t=t+" Vega</div>",r=5,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/vegaWidget.pug",t=t+'<div class="g-item-vega-container">',r=6,n="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/vegaWidget.pug",t=t+'<div class="g-item-vega-vis"></div></div></div>'}catch(i){eU(i,n,r)}return t}const RCe="",hA=girder.$,JFe=girder._,{restRequest:eSe}=girder.rest,tSe=girder.views.View,{AccessType:nSe}=girder.constants;var rSe=tSe.extend({initialize:function(e){this.item=e.item,this.accessLevel=e.accessLevel,this.item.on("change",function(){this.render()},this),this.render()},render:function(){var e=this.item.get("meta");return this.accessLevel>=nSe.READ&&e&&e.vega?(hA(QFe()).insertBefore("#g-app-body-container .g-item-metadata"),eSe({url:`item/${this.item.id}/download`}).done(JFe.bind(function(t){const n=t.split(`
`).slice(1).map(o=>{const[u,l]=o.split(",");return{x:parseFloat(u),y:parseFloat(l)}}),i={...JSON.parse(e.vega),data:{values:n}};let a=Sme(XFe(i).spec);new w4(a).initialize(hA(".g-item-vega-vis")[0]).renderer("svg").run()},this))):hA(".g-item-vega").remove(),this}});function du(e,t,n,r){if(t===!1||t==null||!t&&(e==="class"||e==="style"))return"";if(t===!0)return" "+(r?e:e+'="'+e+'"');var i=typeof t;return i!=="object"&&i!=="function"||typeof t.toJSON!="function"||(t=t.toJSON()),typeof t=="string"||(t=JSON.stringify(t),n||t.indexOf('"')===-1)?(n&&(t=Yg(t))," "+e+'="'+t+'"'):" "+e+"='"+t.replace(/'/g,"&#39;")+"'"}function Yg(e){var t=""+e,n=iSe.exec(t);if(!n)return e;var r,i,a,s="";for(r=n.index,i=0;r<t.length;r++){switch(t.charCodeAt(r)){case 34:a="&quot;";break;case 38:a="&amp;";break;case 60:a="&lt;";break;case 62:a="&gt;";break;default:continue}i!==r&&(s+=t.substring(i,r)),i=r+1,s+=a}return i!==r?s+t.substring(i,r):s}var iSe=/["&<>]/;function tU(e,t,n,r){if(!(e instanceof Error))throw e;if(!(typeof window>"u"&&t||r))throw e.message+=" on line "+n,e;var i,a,s,o;try{r=r||require("fs").readFileSync(t,{encoding:"utf8"}),i=3,a=r.split(`
`),s=Math.max(n-i,0),o=Math.min(a.length,n+i)}catch(u){return e.message+=" - could not read from "+t+" ("+u.message+")",void tU(e,null,n)}i=a.slice(s,o).map(function(u,l){var c=l+s+1;return(c==n?"  > ":"    ")+c+"| "+u}).join(`
`),e.path=t;try{e.message=(t||"Pug")+":"+n+`
`+i+`

`+e.message}catch{}throw e}function aSe(e){var t="",n,r,i;try{var a=e||{};(function(s,o,u){i=1,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<div class="g-item-rel-sims g-info list-entry">',i=2,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<i class="icon-link-ext"></i>',i=3,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+"Related Data",i=4,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",(function(){var l=s;if(typeof l.length=="number")for(var c=0,f=l.length;c<f;c++){var d=l[c];i=5,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<li class="g-sim-list-entry">',i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+"<a"+(' class="g-item-list-link g-right-border"'+du("g-item-cid",d.cid,!0,!1)+du("href",`#folder/${d._id}`,!0,!1))+">",i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+Yg((n=d.name)==null?"":n)+"</a></li>"}else{var f=0;for(var c in l){f++;var d=l[c];i=5,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<li class="g-sim-list-entry">',i=6,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+"<a"+(' class="g-item-list-link g-right-border"'+du("g-item-cid",d.cid,!0,!1)+du("href",`#folder/${d._id}`,!0,!1))+">",i=7,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+Yg((n=d.name)==null?"":n)+"</a></li>"}}}).call(this),i=8,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",(function(){var l=o;if(typeof l.length=="number")for(var c=0,f=l.length;c<f;c++){var d=l[c];i=9,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",d._id!=u.model.id&&(i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<li class="g-sim-list-entry">',i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+"<a"+(' class="g-item-list-link g-right-border"'+du("g-item-cid",d.cid,!0,!1)+du("href",`#item/${d._id}`,!0,!1))+">",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+Yg((n=d.name)==null?"":n)+"</a></li>")}else{var f=0;for(var c in l){f++;var d=l[c];i=9,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",d._id!=u.model.id&&(i=10,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<li class="g-sim-list-entry">',i=11,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+"<a"+(' class="g-item-list-link g-right-border"'+du("g-item-cid",d.cid,!0,!1)+du("href",`#item/${d._id}`,!0,!1))+">",i=12,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+Yg((n=d.name)==null?"":n)+"</a></li>")}}}).call(this),t=t+"</div>",i=13,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<div class="g-item-analyze-in-wt g-info list-entry">',i=14,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<i class="icon-eye">',i=15,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+'<a class="g-item-list-link" id="ainwt" href="#" style="font-style: normal;">',i=16,r="/home/runner/work/girder-sem-viewer/girder-sem-viewer/girder_sem_viewer/web_client/templates/relatedDataWidget.pug",t=t+"Analyze in WholeTale</a></i></div>"}).call(this,"folders"in a?a.folders:typeof folders<"u"?folders:void 0,"items"in a?a.items:typeof items<"u"?items:void 0,"parentView"in a?a.parentView:typeof parentView<"u"?parentView:void 0)}catch(s){tU(s,r,i)}return t}const PCe="",{restRequest:sSe}=girder.rest,nU=girder.views.body.ItemView,{wrap:rU}=girder.utilities.PluginUtils;rU(nU,"initialize",function(e,...t){if(e.apply(this,t),this._dataRequest=null,this.model.attributes.meta&&this.model.attributes.meta.jhu_id){const n=this.model.attributes.meta.jhu_id,r={baseParentId:this.model.attributes.baseParentId,baseParentType:this.model.attributes.baseParentType};this._dataRequest=sSe({url:"resource/search",data:{q:n,mode:"jhuId",types:JSON.stringify(["item","folder"]),filters:JSON.stringify(r),limit:10}})}}),rU(nU,"render",function(e){return this.once("g:rendered",function(){this._dataRequest!==null&&this._dataRequest.done(t=>{girder.$(".g-item-info").append(aSe({items:t.item,folders:t.folder,parentView:this}));const n=t.item.map(u=>({itemId:u._id,mountPath:`/${u.name}`,_modelType:"item"})),r=t.folder.map(u=>({itemId:u._id,mountPath:`/${u.name}`,_modelType:"folder"})),i=n.concat(r),a=window.location.hostname.split(".")[0],s=window.location.origin.replace(a,"dashboard")+"/mine",o=new URLSearchParams;o.set("name","My Tale"),o.set("asTale",!1),o.set("dataSet",JSON.stringify(i)),document.querySelector("#ainwt").href=`${s}?${o.toString()}`})},this),this.model.getAccessLevel(t=>{e.call(this),this.vegaWidget=new rSe({item:this.model,accessLevel:t,parentView:this})}),this});const NCe="",oSe=girder.models.FileModel,uSe=girder.models.FolderModel,lSe=girder.views.widgets.HierarchyWidget,Uf=girder.views.widgets.UploadWidget,{getCurrentUser:cSe}=girder.auth,{AccessType:iU}=girder.constants,{formatSize:P1}=girder.misc,{wrap:Vl}=girder.utilities.PluginUtils,{restRequest:fSe}=girder.rest,aU=girder.$,gA=girder._;function N1(e){const t=e.webkitRelativePath.split("/");return t.length>1?t.slice(0,-1).join("/")+"/":""}function dSe(e){const t=Array.from(e),n=new Map;return t.sort((r,i)=>{const a=N1(r),s=N1(i);return a.localeCompare(s)}),t.forEach(r=>{const i=N1(r);n.has(i)||n.set(i,[]),n.get(i).push(r)}),Array.from(n.values())}Vl(Uf,"initialize",function(e,t){return e.call(this,t),this.onlyFiles=gA.has(t,"onlyFiles")?t.onlyFiles:!1,this.onlyFolders=gA.has(t,"onlyFolders")?t.onlyFolders:!1,this}),Vl(Uf,"render",function(e){if(this.parentType=this.parent.attributes._modelType,e.call(this),this.parentType!=="item"&&!this.onlyFiles){var t='<div class="g-upload-folder"><i class="icon-folder-open"></i>Select a folder to upload</div>';t+='<div class="form-group hide"><input type="file" id="folderInput" webkitdirectory multiple></div>',this.$(".g-drop-zone").after(t)}return(this.parentType==="user"||this.parentType==="collection"||this.onlyFolders)&&this.$(".g-drop-zone").addClass("hide"),this}),Vl(Uf,"events",function(e){return this.events["submit #g-upload-form"]=function(t){t.preventDefault(),this.$(".g-upload-folder").addClass("hide"),this.startUpload()},this.events["click .g-resume-upload"]=function(){this.$(".g-upload-error-message").html(""),this.currentFile.resumeUpload()},this.events["click .g-restart-upload"]=function(){this.$(".g-upload-error-message").html(""),this.uploadNextFile()},this.events["change #g-files"]=function(){var t=this.$("#g-files")[0].files;t.length&&(this.files=t,this.filesChanged())},this.events["click .g-drop-zone"]=function(){this.$("#g-files").click()},this.events["dragenter .g-drop-zone"]=function(t){t.stopPropagation(),t.preventDefault(),t.originalEvent.dataTransfer.dropEffect="copy",this.$(".g-drop-zone").addClass("g-dropzone-show").html('<i class="icon-bullseye"/> Drop files here')},this.events["dragleave .g-drop-zone"]=function(t){t.stopPropagation(),t.preventDefault(),this.$(".g-drop-zone").removeClass("g-dropzone-show").html('<i class="icon-docs"/> Browse or drop files')},this.events["dragover .g-drop-zone"]=function(t){var n=t.originalEvent.dataTransfer;if(n){var r=n.effectAllowed;n.dropEffect=r==="move"||r==="linkMove"?"move":"copy",t.preventDefault()}},this.events["drop .g-drop-zone"]="filesDropped",this.events["click .g-upload-folder"]=function(){this.$("#folderInput").click()},this.events["change #folderInput"]=function(){var t=this.$("#folderInput")[0].files;t.length>0&&(this.files=t,this.filesChanged())},this.events}),Vl(Uf,"uploadNextFile",function(e){const t=dSe(this.files);t.length===1&&t[0][0].webkitRelativePath===""?e.call(this):(this.totalFiles=this.files.length,this.groupedFiles=t,this.currentDirIndex=0,this.uploadNextFileRecursive())}),Vl(Uf,"uploadNextFileRecursive",function(e){this.files=this.groupedFiles[this.currentDirIndex],this._currentDirFileIndex=0,this._currentDirTotalFiles=this.files.length;const t=N1(this.files[0]).slice(0,-1);if(this.currentDirIndex>=this.groupedFiles.length){this.modal&&this.$el.modal("hide"),this.trigger("g:uploadFinished",{files:[].concat(...this.groupedFiles),totalFiles:this.totalFiles,folder:t});return}var n=this;fSe({url:"folder/recursive",method:"POST",data:{parentId:this.parent.id,parentType:this.parentType,path:t}}).done(function(r){var i=new uSe;i.set(r),n._uploadNext(i)})}),Vl(Uf,"_uploadNext",function(e,t){if(!(this._currentDirFileIndex>=this._currentDirTotalFiles)){this.currentFile=new oSe,this.currentFile.on("g:upload.complete",function(){this.files[this._currentDirFileIndex].id=this.currentFile.id,this._currentDirFileIndex+=1,this._currentDirFileIndex<this._currentDirTotalFiles?this._uploadNext(t):(this.currentDirIndex+=1,this.currentDirIndex<this.groupedFiles.length?this.uploadNextFileRecursive():(this.modal&&this.$el.modal("hide"),this.trigger("g:uploadFinished",{files:[].concat(...this.groupedFiles),totalFiles:this.totalFiles})))},this).on("g:upload.chunkSent",function(r){this.overallProgress+=r.bytes},this).on("g:upload.progress",function(r){var i=r.startByte+r.loaded;this.$(".g-progress-current>.progress-bar").css("width",Math.ceil(100*i/r.total)+"%"),this.$(".g-progress-overall>.progress-bar").css("width",Math.ceil(100*(this.overallProgress+r.loaded)/this.totalSize)+"%"),this.$(".g-current-progress-message").html('<i class="icon-doc-text"/>'+(this.currentIndex+1)+" of "+this.files.length+" - <b>"+r.file.name+"</b>: "+P1(i)+" / "+P1(r.total)),this.$(".g-overall-progress-message").html("Overall progress: "+P1(this.overallProgress+r.loaded)+" / "+P1(this.totalSize))},this).on("g:upload.error",function(r){var i=r.message+' <a class="g-resume-upload">Click here to resume the upload</a>';aU(".g-upload-error-message").html(i)},this).on("g:upload.errorStarting",function(r){var i=r.message+' <a class="g-restart-upload">Click here to restart the upload</a>';aU(".g-upload-error-message").html(i)},this);var n=this.otherParams;gA.isFunction(this.otherParams)&&(n=this.otherParams(this)),this.currentFile.upload(t,this.files[this._currentDirFileIndex],null,n)}}),Vl(lSe,"render",function(e){const t=this.parentModel.getAccessLevel(),n=cSe(),r=this.parentModel.resourceName,i=`<button
                      class="g-upload-here-button btn btn-sm btn-success"
                      title="Upload here">
                      <i class="icon-upload"></i>
                    </button>`;e.call(this);const a=this.$(".g-folder-header-buttons");n&&r==="collection"&&t>=iU.WRITE&&a.length>0&&this.$(".g-collection-info-button").after(i),n&&r==="user"&&t>=iU.WRITE&&a.prepend(i)});const{wrap:hSe}=girder.utilities.PluginUtils,gSe=girder.views.body.ItemView,pSe=girder.views.widgets.SearchFieldWidget;hSe(gSe,"render",function(e){return this.once("g:rendered",()=>{(this.model.attributes.name.endsWith(".tif")||this.model.attributes.name.endsWith(".tiff"))&&new vU({parentView:this,item:this.model}).render().$el.insertAfter(this.$(".g-item-info")),this.model.attributes.meta&&this.model.attributes.meta.graphml&&new zY({parentView:this,graphId:this.model.attributes.meta.graphml}).render().$el.insertAfter(this.$(".g-item-info"))}),e.call(this)}),pSe.addMode("jhuId",["item","folder"],"Search by JHU ID","You are searching for all data collected for a specific JHU ID. (e.g. F138-R2C7)")});
//# sourceMappingURL=girder-plugin-sem-viewer.umd.cjs.map
