mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 02:41:09 +00:00
2 lines
83 KiB
JavaScript
2 lines
83 KiB
JavaScript
import{r as Gn,c as C,d as Zn,p as Wn,b as lt,t as Kn,z as Qn,e as ce,S as $t,E as Jn,F as jn,h as st,i as R,j as pt,o as ti,f as ei,m as ni,u as ii,k as ri,a as si,l as oi}from"./Frame-Cpo70DD7.js";import{L as ai,F as ui}from"./LayersPanel-BajTPlsd.js";function Se(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function pn(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Et(){}var Ft=.7,Ut=1/Ft,mt="\\s*([+-]?\\d+)\\s*",St="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Q="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",li=/^#([0-9a-f]{3,8})$/,ci=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),hi=new RegExp(`^rgb\\(${Q},${Q},${Q}\\)$`),fi=new RegExp(`^rgba\\(${mt},${mt},${mt},${St}\\)$`),di=new RegExp(`^rgba\\(${Q},${Q},${Q},${St}\\)$`),pi=new RegExp(`^hsl\\(${St},${Q},${Q}\\)$`),gi=new RegExp(`^hsla\\(${St},${Q},${Q},${St}\\)$`),Be={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};Se(Et,ht,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Le,formatHex:Le,formatHex8:mi,formatHsl:xi,formatRgb:qe,toString:qe});function Le(){return this.rgb().formatHex()}function mi(){return this.rgb().formatHex8()}function xi(){return gn(this).formatHsl()}function qe(){return this.rgb().formatRgb()}function ht(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=li.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?He(e):n===3?new H(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Vt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Vt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ci.exec(t))?new H(e[1],e[2],e[3],1):(e=hi.exec(t))?new H(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fi.exec(t))?Vt(e[1],e[2],e[3],e[4]):(e=di.exec(t))?Vt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=pi.exec(t))?Ue(e[1],e[2]/100,e[3]/100,1):(e=gi.exec(t))?Ue(e[1],e[2]/100,e[3]/100,e[4]):Be.hasOwnProperty(t)?He(Be[t]):t==="transparent"?new H(NaN,NaN,NaN,0):null}function He(t){return new H(t>>16&255,t>>8&255,t&255,1)}function Vt(t,e,n,i){return i<=0&&(t=e=n=NaN),new H(t,e,n,i)}function yi(t){return t instanceof Et||(t=ht(t)),t?(t=t.rgb(),new H(t.r,t.g,t.b,t.opacity)):new H}function he(t,e,n,i){return arguments.length===1?yi(t):new H(t,e,n,i??1)}function H(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Se(H,he,pn(Et,{brighter(t){return t=t==null?Ut:Math.pow(Ut,t),new H(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Ft:Math.pow(Ft,t),new H(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new H(ct(this.r),ct(this.g),ct(this.b),Yt(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:Xe,formatHex:Xe,formatHex8:wi,formatRgb:Oe,toString:Oe}));function Xe(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}`}function wi(){return`#${ut(this.r)}${ut(this.g)}${ut(this.b)}${ut((isNaN(this.opacity)?1:this.opacity)*255)}`}function Oe(){const t=Yt(this.opacity);return`${t===1?"rgb(":"rgba("}${ct(this.r)}, ${ct(this.g)}, ${ct(this.b)}${t===1?")":`, ${t})`}`}function Yt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function ct(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function ut(t){return t=ct(t),(t<16?"0":"")+t.toString(16)}function Ue(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Z(t,e,n,i)}function gn(t){if(t instanceof Z)return new Z(t.h,t.s,t.l,t.opacity);if(t instanceof Et||(t=ht(t)),!t)return new Z;if(t instanceof Z)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,r=Math.min(e,n,i),s=Math.max(e,n,i),o=NaN,u=s-r,l=(s+r)/2;return u?(e===s?o=(n-i)/u+(n<i)*6:n===s?o=(i-e)/u+2:o=(e-n)/u+4,u/=l<.5?s+r:2-s-r,o*=60):u=l>0&&l<1?0:o,new Z(o,u,l,t.opacity)}function _i(t,e,n,i){return arguments.length===1?gn(t):new Z(t,e,n,i??1)}function Z(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Se(Z,_i,pn(Et,{brighter(t){return t=t==null?Ut:Math.pow(Ut,t),new Z(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Ft:Math.pow(Ft,t),new Z(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,r=2*n-i;return new H(se(t>=240?t-240:t+120,r,i),se(t,r,i),se(t<120?t+240:t-120,r,i),this.opacity)},clamp(){return new Z(Ye(this.h),Nt(this.s),Nt(this.l),Yt(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 t=Yt(this.opacity);return`${t===1?"hsl(":"hsla("}${Ye(this.h)}, ${Nt(this.s)*100}%, ${Nt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function Ye(t){return t=(t||0)%360,t<0?t+360:t}function Nt(t){return Math.max(0,Math.min(1,t||0))}function se(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Te=t=>()=>t;function vi(t,e){return function(n){return t+n*e}}function bi(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function Mi(t){return(t=+t)==1?mn:function(e,n){return n-e?bi(e,n,t):Te(isNaN(e)?n:e)}}function mn(t,e){var n=e-t;return n?vi(t,n):Te(isNaN(t)?e:t)}const Gt=function t(e){var n=Mi(e);function i(r,s){var o=n((r=he(r)).r,(s=he(s)).r),u=n(r.g,s.g),l=n(r.b,s.b),a=mn(r.opacity,s.opacity);return function(c){return r.r=o(c),r.g=u(c),r.b=l(c),r.opacity=a(c),r+""}}return i.gamma=t,i}(1);function ki(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),r;return function(s){for(r=0;r<n;++r)i[r]=t[r]*(1-s)+e[r]*s;return i}}function $i(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Fi(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,r=new Array(i),s=new Array(n),o;for(o=0;o<i;++o)r[o]=Ee(t[o],e[o]);for(;o<n;++o)s[o]=e[o];return function(u){for(o=0;o<i;++o)s[o]=r[o](u);return s}}function Si(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function G(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Ti(t,e){var n={},i={},r;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(r in e)r in t?n[r]=Ee(t[r],e[r]):i[r]=e[r];return function(s){for(r in n)i[r]=n[r](s);return i}}var fe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,oe=new RegExp(fe.source,"g");function Ei(t){return function(){return t}}function Ai(t){return function(e){return t(e)+""}}function xn(t,e){var n=fe.lastIndex=oe.lastIndex=0,i,r,s,o=-1,u=[],l=[];for(t=t+"",e=e+"";(i=fe.exec(t))&&(r=oe.exec(e));)(s=r.index)>n&&(s=e.slice(n,s),u[o]?u[o]+=s:u[++o]=s),(i=i[0])===(r=r[0])?u[o]?u[o]+=r:u[++o]=r:(u[++o]=null,l.push({i:o,x:G(i,r)})),n=oe.lastIndex;return n<e.length&&(s=e.slice(n),u[o]?u[o]+=s:u[++o]=s),u.length<2?l[0]?Ai(l[0].x):Ei(e):(e=l.length,function(a){for(var c=0,f;c<e;++c)u[(f=l[c]).i]=f.x(a);return u.join("")})}function Ee(t,e){var n=typeof e,i;return e==null||n==="boolean"?Te(e):(n==="number"?G:n==="string"?(i=ht(e))?(e=i,Gt):xn:e instanceof ht?Gt:e instanceof Date?Si:$i(e)?ki:Array.isArray(e)?Fi:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Ti:G)(t,e)}function Vi(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Ge=180/Math.PI,de={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yn(t,e,n,i,r,s){var o,u,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*i)&&(n-=t*l,i-=e*l),(u=Math.sqrt(n*n+i*i))&&(n/=u,i/=u,l/=u),t*i<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:r,translateY:s,rotate:Math.atan2(e,t)*Ge,skewX:Math.atan(l)*Ge,scaleX:o,scaleY:u}}var zt;function Ni(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?de:yn(e.a,e.b,e.c,e.d,e.e,e.f)}function zi(t){return t==null||(zt||(zt=document.createElementNS("http://www.w3.org/2000/svg","g")),zt.setAttribute("transform",t),!(t=zt.transform.baseVal.consolidate()))?de:(t=t.matrix,yn(t.a,t.b,t.c,t.d,t.e,t.f))}function wn(t,e,n,i){function r(a){return a.length?a.pop()+" ":""}function s(a,c,f,h,d,g){if(a!==f||c!==h){var y=d.push("translate(",null,e,null,n);g.push({i:y-4,x:G(a,f)},{i:y-2,x:G(c,h)})}else(f||h)&&d.push("translate("+f+e+h+n)}function o(a,c,f,h){a!==c?(a-c>180?c+=360:c-a>180&&(a+=360),h.push({i:f.push(r(f)+"rotate(",null,i)-2,x:G(a,c)})):c&&f.push(r(f)+"rotate("+c+i)}function u(a,c,f,h){a!==c?h.push({i:f.push(r(f)+"skewX(",null,i)-2,x:G(a,c)}):c&&f.push(r(f)+"skewX("+c+i)}function l(a,c,f,h,d,g){if(a!==f||c!==h){var y=d.push(r(d)+"scale(",null,",",null,")");g.push({i:y-4,x:G(a,f)},{i:y-2,x:G(c,h)})}else(f!==1||h!==1)&&d.push(r(d)+"scale("+f+","+h+")")}return function(a,c){var f=[],h=[];return a=t(a),c=t(c),s(a.translateX,a.translateY,c.translateX,c.translateY,f,h),o(a.rotate,c.rotate,f,h),u(a.skewX,c.skewX,f,h),l(a.scaleX,a.scaleY,c.scaleX,c.scaleY,f,h),a=c=null,function(d){for(var g=-1,y=h.length,$;++g<y;)f[($=h[g]).i]=$.x(d);return f.join("")}}}var Pi=wn(Ni,"px, ","px)","deg)"),Ci=wn(zi,", ",")",")"),Ii=1e-12;function Ze(t){return((t=Math.exp(t))+1/t)/2}function Di(t){return((t=Math.exp(t))-1/t)/2}function Ri(t){return((t=Math.exp(2*t))-1)/(t+1)}const Bi=function t(e,n,i){function r(s,o){var u=s[0],l=s[1],a=s[2],c=o[0],f=o[1],h=o[2],d=c-u,g=f-l,y=d*d+g*g,$,x;if(y<Ii)x=Math.log(h/a)/e,$=function(z){return[u+z*d,l+z*g,a*Math.exp(e*z*x)]};else{var b=Math.sqrt(y),T=(h*h-a*a+i*y)/(2*a*n*b),V=(h*h-a*a-i*y)/(2*h*n*b),F=Math.log(Math.sqrt(T*T+1)-T),P=Math.log(Math.sqrt(V*V+1)-V);x=(P-F)/e,$=function(z){var q=z*x,I=Ze(F),B=a/(n*b)*(I*Ri(e*q+F)-Di(F));return[u+B*d,l+B*g,a*I/Ze(e*q+F)]}}return $.duration=x*1e3*e/Math.SQRT2,$}return r.rho=function(s){var o=Math.max(.001,+s),u=o*o,l=u*u;return t(o,u,l)},r}(Math.SQRT2,2,4);function rt(t,e){this.x=t,this.y=e}rt.prototype={clone(){return new rt(this.x,this.y)},add(t){return this.clone()._add(t)},sub(t){return this.clone()._sub(t)},multByPoint(t){return this.clone()._multByPoint(t)},divByPoint(t){return this.clone()._divByPoint(t)},mult(t){return this.clone()._mult(t)},div(t){return this.clone()._div(t)},rotate(t){return this.clone()._rotate(t)},rotateAround(t,e){return this.clone()._rotateAround(t,e)},matMult(t){return this.clone()._matMult(t)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(t){return this.x===t.x&&this.y===t.y},dist(t){return Math.sqrt(this.distSqr(t))},distSqr(t){const e=t.x-this.x,n=t.y-this.y;return e*e+n*n},angle(){return Math.atan2(this.y,this.x)},angleTo(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith(t){return this.angleWithSep(t.x,t.y)},angleWithSep(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult(t){const e=t[0]*this.x+t[1]*this.y,n=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=n,this},_add(t){return this.x+=t.x,this.y+=t.y,this},_sub(t){return this.x-=t.x,this.y-=t.y,this},_mult(t){return this.x*=t,this.y*=t,this},_div(t){return this.x/=t,this.y/=t,this},_multByPoint(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint(t){return this.x/=t.x,this.y/=t.y,this},_unit(){return this._div(this.mag()),this},_perp(){const t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){const e=Math.cos(t),n=Math.sin(t),i=e*this.x-n*this.y,r=n*this.x+e*this.y;return this.x=i,this.y=r,this},_rotateAround(t,e){const n=Math.cos(t),i=Math.sin(t),r=e.x+n*(this.x-e.x)-i*(this.y-e.y),s=e.y+i*(this.x-e.x)+n*(this.y-e.y);return this.x=r,this.y=s,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:rt};rt.convert=function(t){if(t instanceof rt)return t;if(Array.isArray(t))return new rt(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new rt(+t.x,+t.y);throw new Error("Expected [x, y] or {x, y} point format")};class _n{constructor(e,n,i,r,s){this.properties={},this.extent=i,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=r,this._values=s,e.readFields(Li,this,n)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const n=e.readVarint()+e.pos,i=[];let r,s=1,o=0,u=0,l=0;for(;e.pos<n;){if(o<=0){const a=e.readVarint();s=a&7,o=a>>3}if(o--,s===1||s===2)u+=e.readSVarint(),l+=e.readSVarint(),s===1&&(r&&i.push(r),r=[]),r&&r.push(new rt(u,l));else if(s===7)r&&r.push(r[0].clone());else throw new Error(`unknown command ${s}`)}return r&&i.push(r),i}bbox(){const e=this._pbf;e.pos=this._geometry;const n=e.readVarint()+e.pos;let i=1,r=0,s=0,o=0,u=1/0,l=-1/0,a=1/0,c=-1/0;for(;e.pos<n;){if(r<=0){const f=e.readVarint();i=f&7,r=f>>3}if(r--,i===1||i===2)s+=e.readSVarint(),o+=e.readSVarint(),s<u&&(u=s),s>l&&(l=s),o<a&&(a=o),o>c&&(c=o);else if(i!==7)throw new Error(`unknown command ${i}`)}return[u,a,l,c]}toGeoJSON(e,n,i){const r=this.extent*Math.pow(2,i),s=this.extent*e,o=this.extent*n,u=this.loadGeometry();function l(h){return[(h.x+s)*360/r-180,360/Math.PI*Math.atan(Math.exp((1-(h.y+o)*2/r)*Math.PI))-90]}function a(h){return h.map(l)}let c;if(this.type===1){const h=[];for(const g of u)h.push(g[0]);const d=a(h);c=h.length===1?{type:"Point",coordinates:d[0]}:{type:"MultiPoint",coordinates:d}}else if(this.type===2){const h=u.map(a);c=h.length===1?{type:"LineString",coordinates:h[0]}:{type:"MultiLineString",coordinates:h}}else if(this.type===3){const h=Hi(u),d=[];for(const g of h)d.push(g.map(a));c=d.length===1?{type:"Polygon",coordinates:d[0]}:{type:"MultiPolygon",coordinates:d}}else throw new Error("unknown feature type");const f={type:"Feature",geometry:c,properties:this.properties};return this.id!=null&&(f.id=this.id),f}}_n.types=["Unknown","Point","LineString","Polygon"];function Li(t,e,n){t===1?e.id=n.readVarint():t===2?qi(n,e):t===3?e.type=n.readVarint():t===4&&(e._geometry=n.pos)}function qi(t,e){const n=t.readVarint()+t.pos;for(;t.pos<n;){const i=e._keys[t.readVarint()],r=e._values[t.readVarint()];e.properties[i]=r}}function Hi(t){const e=t.length;if(e<=1)return[t];const n=[];let i,r;for(let s=0;s<e;s++){const o=Xi(t[s]);o!==0&&(r===void 0&&(r=o<0),r===o<0?(i&&n.push(i),i=[t[s]]):i&&i.push(t[s]))}return i&&n.push(i),n}function Xi(t){let e=0;for(let n=0,i=t.length,r=i-1,s,o;n<i;r=n++)s=t[n],o=t[r],e+=(o.x-s.x)*(s.y+o.y);return e}class Oi{constructor(e,n){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(Ui,this,n),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const n=this._pbf.readVarint()+this._pbf.pos;return new _n(this._pbf,n,this.extent,this._keys,this._values)}}function Ui(t,e,n){t===15?e.version=n.readVarint():t===1?e.name=n.readString():t===5?e.extent=n.readVarint():t===2?e._features.push(n.pos):t===3?e._keys.push(n.readString()):t===4&&e._values.push(Yi(n))}function Yi(t){let e=null;const n=t.readVarint()+t.pos;for(;t.pos<n;){const i=t.readVarint()>>3;e=i===1?t.readString():i===2?t.readFloat():i===3?t.readDouble():i===4?t.readVarint64():i===5?t.readVarint():i===6?t.readSVarint():i===7?t.readBoolean():null}if(e==null)throw new Error("unknown feature value");return e}class Gi{constructor(e,n){this.layers=e.readFields(Zi,{},n)}}function Zi(t,e,n){if(t===3){const i=new Oi(n,n.readVarint()+n.pos);i.length&&(e[i.name]=i)}}function Wi(t){return t}var ae=1,Bt=2,pe=3,Pt=4,We=1e-6;function Ki(t){return"translate("+t+",0)"}function Qi(t){return"translate(0,"+t+")"}function Ji(t){return e=>+t(e)}function ji(t,e){return e=Math.max(0,t.bandwidth()-e*2)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function tr(){return!this.__axis}function vn(t,e){var n=[],i=null,r=null,s=6,o=6,u=3,l=typeof window<"u"&&window.devicePixelRatio>1?0:.5,a=t===ae||t===Pt?-1:1,c=t===Pt||t===Bt?"x":"y",f=t===ae||t===pe?Ki:Qi;function h(d){var g=i??(e.ticks?e.ticks.apply(e,n):e.domain()),y=r??(e.tickFormat?e.tickFormat.apply(e,n):Wi),$=Math.max(s,0)+u,x=e.range(),b=+x[0]+l,T=+x[x.length-1]+l,V=(e.bandwidth?ji:Ji)(e.copy(),l),F=d.selection?d.selection():d,P=F.selectAll(".domain").data([null]),z=F.selectAll(".tick").data(g,e).order(),q=z.exit(),I=z.enter().append("g").attr("class","tick"),B=z.select("line"),v=z.select("text");P=P.merge(P.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),z=z.merge(I),B=B.merge(I.append("line").attr("stroke","currentColor").attr(c+"2",a*s)),v=v.merge(I.append("text").attr("fill","currentColor").attr(c,a*$).attr("dy",t===ae?"0em":t===pe?"0.71em":"0.32em")),d!==F&&(P=P.transition(d),z=z.transition(d),B=B.transition(d),v=v.transition(d),q=q.transition(d).attr("opacity",We).attr("transform",function(S){return isFinite(S=V(S))?f(S+l):this.getAttribute("transform")}),I.attr("opacity",We).attr("transform",function(S){var A=this.parentNode.__axis;return f((A&&isFinite(A=A(S))?A:V(S))+l)})),q.remove(),P.attr("d",t===Pt||t===Bt?o?"M"+a*o+","+b+"H"+l+"V"+T+"H"+a*o:"M"+l+","+b+"V"+T:o?"M"+b+","+a*o+"V"+l+"H"+T+"V"+a*o:"M"+b+","+l+"H"+T),z.attr("opacity",1).attr("transform",function(S){return f(V(S)+l)}),B.attr(c+"2",a*s),v.attr(c,a*$).text(y),F.filter(tr).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",t===Bt?"start":t===Pt?"end":"middle"),F.each(function(){this.__axis=V})}return h.scale=function(d){return arguments.length?(e=d,h):e},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),h):n.slice()},h.tickValues=function(d){return arguments.length?(i=d==null?null:Array.from(d),h):i&&i.slice()},h.tickFormat=function(d){return arguments.length?(r=d,h):r},h.tickSize=function(d){return arguments.length?(s=o=+d,h):s},h.tickSizeInner=function(d){return arguments.length?(s=+d,h):s},h.tickSizeOuter=function(d){return arguments.length?(o=+d,h):o},h.tickPadding=function(d){return arguments.length?(u=+d,h):u},h.offset=function(d){return arguments.length?(l=+d,h):l},h}function er(t){return vn(Bt,t)}function nr(t){return vn(pe,t)}const ge=Math.PI,me=2*ge,at=1e-6,ir=me-at;function bn(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function rr(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return bn;const n=10**e;return function(i){this._+=i[0];for(let r=1,s=i.length;r<s;++r)this._+=Math.round(arguments[r]*n)/n+i[r]}}class Mn{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?bn:rr(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,i,r){this._append`Q${+e},${+n},${this._x1=+i},${this._y1=+r}`}bezierCurveTo(e,n,i,r,s,o){this._append`C${+e},${+n},${+i},${+r},${this._x1=+s},${this._y1=+o}`}arcTo(e,n,i,r,s){if(e=+e,n=+n,i=+i,r=+r,s=+s,s<0)throw new Error(`negative radius: ${s}`);let o=this._x1,u=this._y1,l=i-e,a=r-n,c=o-e,f=u-n,h=c*c+f*f;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(h>at)if(!(Math.abs(f*l-a*c)>at)||!s)this._append`L${this._x1=e},${this._y1=n}`;else{let d=i-o,g=r-u,y=l*l+a*a,$=d*d+g*g,x=Math.sqrt(y),b=Math.sqrt(h),T=s*Math.tan((ge-Math.acos((y+h-$)/(2*x*b)))/2),V=T/b,F=T/x;Math.abs(V-1)>at&&this._append`L${e+V*c},${n+V*f}`,this._append`A${s},${s},0,0,${+(f*d>c*g)},${this._x1=e+F*l},${this._y1=n+F*a}`}}arc(e,n,i,r,s,o){if(e=+e,n=+n,i=+i,o=!!o,i<0)throw new Error(`negative radius: ${i}`);let u=i*Math.cos(r),l=i*Math.sin(r),a=e+u,c=n+l,f=1^o,h=o?r-s:s-r;this._x1===null?this._append`M${a},${c}`:(Math.abs(this._x1-a)>at||Math.abs(this._y1-c)>at)&&this._append`L${a},${c}`,i&&(h<0&&(h=h%me+me),h>ir?this._append`A${i},${i},0,1,${f},${e-u},${n-l}A${i},${i},0,1,${f},${this._x1=a},${this._y1=c}`:h>at&&this._append`A${i},${i},0,${+(h>=ge)},${f},${this._x1=e+i*Math.cos(s)},${this._y1=n+i*Math.sin(s)}`)}rect(e,n,i,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${i=+i}v${+r}h${-i}Z`}toString(){return this._}}function kn(){return new Mn}kn.prototype=Mn.prototype;function Lt(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function sr(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function $n(t){let e,n,i;t.length!==2?(e=Lt,n=(u,l)=>Lt(t(u),l),i=(u,l)=>t(u)-l):(e=t===Lt||t===sr?t:or,n=t,i=t);function r(u,l,a=0,c=u.length){if(a<c){if(e(l,l)!==0)return c;do{const f=a+c>>>1;n(u[f],l)<0?a=f+1:c=f}while(a<c)}return a}function s(u,l,a=0,c=u.length){if(a<c){if(e(l,l)!==0)return c;do{const f=a+c>>>1;n(u[f],l)<=0?a=f+1:c=f}while(a<c)}return a}function o(u,l,a=0,c=u.length){const f=r(u,l,a,c-1);return f>a&&i(u[f-1],l)>-i(u[f],l)?f-1:f}return{left:r,center:o,right:s}}function or(){return 0}function ar(t){return t===null?NaN:+t}const ur=$n(Lt),lr=ur.right;$n(ar).center;const cr=Math.sqrt(50),hr=Math.sqrt(10),fr=Math.sqrt(2);function Zt(t,e,n){const i=(e-t)/Math.max(0,n),r=Math.floor(Math.log10(i)),s=i/Math.pow(10,r),o=s>=cr?10:s>=hr?5:s>=fr?2:1;let u,l,a;return r<0?(a=Math.pow(10,-r)/o,u=Math.round(t*a),l=Math.round(e*a),u/a<t&&++u,l/a>e&&--l,a=-a):(a=Math.pow(10,r)*o,u=Math.round(t/a),l=Math.round(e/a),u*a<t&&++u,l*a>e&&--l),l<u&&.5<=n&&n<2?Zt(t,e,n*2):[u,l,a]}function dr(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const i=e<t,[r,s,o]=i?Zt(e,t,n):Zt(t,e,n);if(!(s>=r))return[];const u=s-r+1,l=new Array(u);if(i)if(o<0)for(let a=0;a<u;++a)l[a]=(s-a)/-o;else for(let a=0;a<u;++a)l[a]=(s-a)*o;else if(o<0)for(let a=0;a<u;++a)l[a]=(r+a)/-o;else for(let a=0;a<u;++a)l[a]=(r+a)*o;return l}function xe(t,e,n){return e=+e,t=+t,n=+n,Zt(t,e,n)[2]}function pr(t,e,n){e=+e,t=+t,n=+n;const i=e<t,r=i?xe(e,t,n):xe(t,e,n);return(i?-1:1)*(r<0?1/-r:r)}function gr(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function mr(t){return function(){return t}}function xr(t){return+t}var Ke=[0,1];function gt(t){return t}function ye(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:mr(isNaN(e)?NaN:.5)}function yr(t,e){var n;return t>e&&(n=t,t=e,e=n),function(i){return Math.max(t,Math.min(e,i))}}function wr(t,e,n){var i=t[0],r=t[1],s=e[0],o=e[1];return r<i?(i=ye(r,i),s=n(o,s)):(i=ye(i,r),s=n(s,o)),function(u){return s(i(u))}}function _r(t,e,n){var i=Math.min(t.length,e.length)-1,r=new Array(i),s=new Array(i),o=-1;for(t[i]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<i;)r[o]=ye(t[o],t[o+1]),s[o]=n(e[o],e[o+1]);return function(u){var l=lr(t,u,1,i)-1;return s[l](r[l](u))}}function vr(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function br(){var t=Ke,e=Ke,n=Ee,i,r,s,o=gt,u,l,a;function c(){var h=Math.min(t.length,e.length);return o!==gt&&(o=yr(t[0],t[h-1])),u=h>2?_r:wr,l=a=null,f}function f(h){return h==null||isNaN(h=+h)?s:(l||(l=u(t.map(i),e,n)))(i(o(h)))}return f.invert=function(h){return o(r((a||(a=u(e,t.map(i),G)))(h)))},f.domain=function(h){return arguments.length?(t=Array.from(h,xr),c()):t.slice()},f.range=function(h){return arguments.length?(e=Array.from(h),c()):e.slice()},f.rangeRound=function(h){return e=Array.from(h),n=Vi,c()},f.clamp=function(h){return arguments.length?(o=h?!0:gt,c()):o!==gt},f.interpolate=function(h){return arguments.length?(n=h,c()):n},f.unknown=function(h){return arguments.length?(s=h,f):s},function(h,d){return i=h,r=d,c()}}function Mr(){return br()(gt,gt)}function kr(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Wt(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,i=t.slice(0,n);return[i.length>1?i[0]+i.slice(2):i,+t.slice(n+1)]}function xt(t){return t=Wt(Math.abs(t)),t?t[1]:NaN}function $r(t,e){return function(n,i){for(var r=n.length,s=[],o=0,u=t[0],l=0;r>0&&u>0&&(l+u+1>i&&(u=Math.max(1,i-l)),s.push(n.substring(r-=u,r+u)),!((l+=u+1)>i));)u=t[o=(o+1)%t.length];return s.reverse().join(e)}}function Fr(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Sr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Kt(t){if(!(e=Sr.exec(t)))throw new Error("invalid format: "+t);var e;return new Ae({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Kt.prototype=Ae.prototype;function Ae(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Ae.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 Tr(t){t:for(var e=t.length,n=1,i=-1,r;n<e;++n)switch(t[n]){case".":i=r=n;break;case"0":i===0&&(i=n),r=n;break;default:if(!+t[n])break t;i>0&&(i=0);break}return i>0?t.slice(0,i)+t.slice(r+1):t}var Fn;function Er(t,e){var n=Wt(t,e);if(!n)return t+"";var i=n[0],r=n[1],s=r-(Fn=Math.max(-8,Math.min(8,Math.floor(r/3)))*3)+1,o=i.length;return s===o?i:s>o?i+new Array(s-o+1).join("0"):s>0?i.slice(0,s)+"."+i.slice(s):"0."+new Array(1-s).join("0")+Wt(t,Math.max(0,e+s-1))[0]}function Qe(t,e){var n=Wt(t,e);if(!n)return t+"";var i=n[0],r=n[1];return r<0?"0."+new Array(-r).join("0")+i:i.length>r+1?i.slice(0,r+1)+"."+i.slice(r+1):i+new Array(r-i.length+2).join("0")}const Je={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:kr,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Qe(t*100,e),r:Qe,s:Er,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function je(t){return t}var tn=Array.prototype.map,en=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Ar(t){var e=t.grouping===void 0||t.thousands===void 0?je:$r(tn.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",i=t.currency===void 0?"":t.currency[1]+"",r=t.decimal===void 0?".":t.decimal+"",s=t.numerals===void 0?je:Fr(tn.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",u=t.minus===void 0?"−":t.minus+"",l=t.nan===void 0?"NaN":t.nan+"";function a(f){f=Kt(f);var h=f.fill,d=f.align,g=f.sign,y=f.symbol,$=f.zero,x=f.width,b=f.comma,T=f.precision,V=f.trim,F=f.type;F==="n"?(b=!0,F="g"):Je[F]||(T===void 0&&(T=12),V=!0,F="g"),($||h==="0"&&d==="=")&&($=!0,h="0",d="=");var P=y==="$"?n:y==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",z=y==="$"?i:/[%p]/.test(F)?o:"",q=Je[F],I=/[defgprs%]/.test(F);T=T===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,T)):Math.max(0,Math.min(20,T));function B(v){var S=P,A=z,p,w,m;if(F==="c")A=q(v)+A,v="";else{v=+v;var _=v<0||1/v<0;if(v=isNaN(v)?l:q(Math.abs(v),T),V&&(v=Tr(v)),_&&+v==0&&g!=="+"&&(_=!1),S=(_?g==="("?g:u:g==="-"||g==="("?"":g)+S,A=(F==="s"?en[8+Fn/3]:"")+A+(_&&g==="("?")":""),I){for(p=-1,w=v.length;++p<w;)if(m=v.charCodeAt(p),48>m||m>57){A=(m===46?r+v.slice(p+1):v.slice(p))+A,v=v.slice(0,p);break}}}b&&!$&&(v=e(v,1/0));var k=S.length+v.length+A.length,M=k<x?new Array(x-k+1).join(h):"";switch(b&&$&&(v=e(M+v,M.length?x-A.length:1/0),M=""),d){case"<":v=S+v+A+M;break;case"=":v=S+M+v+A;break;case"^":v=M.slice(0,k=M.length>>1)+S+v+A+M.slice(k);break;default:v=M+S+v+A;break}return s(v)}return B.toString=function(){return f+""},B}function c(f,h){var d=a((f=Kt(f),f.type="f",f)),g=Math.max(-8,Math.min(8,Math.floor(xt(h)/3)))*3,y=Math.pow(10,-g),$=en[8+g/3];return function(x){return d(y*x)+$}}return{format:a,formatPrefix:c}}var Ct,Sn,Tn;Vr({thousands:",",grouping:[3],currency:["$",""]});function Vr(t){return Ct=Ar(t),Sn=Ct.format,Tn=Ct.formatPrefix,Ct}function Nr(t){return Math.max(0,-xt(Math.abs(t)))}function zr(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(xt(e)/3)))*3-xt(Math.abs(t)))}function Pr(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,xt(e)-xt(t))+1}function Cr(t,e,n,i){var r=pr(t,e,n),s;switch(i=Kt(i??",f"),i.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return i.precision==null&&!isNaN(s=zr(r,o))&&(i.precision=s),Tn(i,o)}case"":case"e":case"g":case"p":case"r":{i.precision==null&&!isNaN(s=Pr(r,Math.max(Math.abs(t),Math.abs(e))))&&(i.precision=s-(i.type==="e"));break}case"f":case"%":{i.precision==null&&!isNaN(s=Nr(r))&&(i.precision=s-(i.type==="%")*2);break}}return Sn(i)}function Ir(t){var e=t.domain;return t.ticks=function(n){var i=e();return dr(i[0],i[i.length-1],n??10)},t.tickFormat=function(n,i){var r=e();return Cr(r[0],r[r.length-1],n??10,i)},t.nice=function(n){n==null&&(n=10);var i=e(),r=0,s=i.length-1,o=i[r],u=i[s],l,a,c=10;for(u<o&&(a=o,o=u,u=a,a=r,r=s,s=a);c-- >0;){if(a=xe(o,u,n),a===l)return i[r]=o,i[s]=u,e(i);if(a>0)o=Math.floor(o/a)*a,u=Math.ceil(u/a)*a;else if(a<0)o=Math.ceil(o*a)/a,u=Math.floor(u*a)/a;else break;l=a}return t},t}function we(){var t=Mr();return t.copy=function(){return vr(t,we())},gr.apply(t,arguments),Ir(t)}var _e="http://www.w3.org/1999/xhtml";const nn={svg:"http://www.w3.org/2000/svg",xhtml:_e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ee(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),nn.hasOwnProperty(e)?{space:nn[e],local:t}:t}function Dr(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===_e&&e.documentElement.namespaceURI===_e?e.createElement(t):e.createElementNS(n,t)}}function Rr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ve(t){var e=ee(t);return(e.local?Rr:Dr)(e)}function Br(){}function Ne(t){return t==null?Br:function(){return this.querySelector(t)}}function Lr(t){typeof t!="function"&&(t=Ne(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s=e[r],o=s.length,u=i[r]=new Array(o),l,a,c=0;c<o;++c)(l=s[c])&&(a=t.call(l,l.__data__,c,s))&&("__data__"in l&&(a.__data__=l.__data__),u[c]=a);return new X(i,this._parents)}function qr(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Hr(){return[]}function En(t){return t==null?Hr:function(){return this.querySelectorAll(t)}}function Xr(t){return function(){return qr(t.apply(this,arguments))}}function Or(t){typeof t=="function"?t=Xr(t):t=En(t);for(var e=this._groups,n=e.length,i=[],r=[],s=0;s<n;++s)for(var o=e[s],u=o.length,l,a=0;a<u;++a)(l=o[a])&&(i.push(t.call(l,l.__data__,a,o)),r.push(l));return new X(i,r)}function An(t){return function(){return this.matches(t)}}function Vn(t){return function(e){return e.matches(t)}}var Ur=Array.prototype.find;function Yr(t){return function(){return Ur.call(this.children,t)}}function Gr(){return this.firstElementChild}function Zr(t){return this.select(t==null?Gr:Yr(typeof t=="function"?t:Vn(t)))}var Wr=Array.prototype.filter;function Kr(){return Array.from(this.children)}function Qr(t){return function(){return Wr.call(this.children,t)}}function Jr(t){return this.selectAll(t==null?Kr:Qr(typeof t=="function"?t:Vn(t)))}function jr(t){typeof t!="function"&&(t=An(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s=e[r],o=s.length,u=i[r]=[],l,a=0;a<o;++a)(l=s[a])&&t.call(l,l.__data__,a,s)&&u.push(l);return new X(i,this._parents)}function Nn(t){return new Array(t.length)}function ts(){return new X(this._enter||this._groups.map(Nn),this._parents)}function Qt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Qt.prototype={constructor:Qt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function es(t){return function(){return t}}function ns(t,e,n,i,r,s){for(var o=0,u,l=e.length,a=s.length;o<a;++o)(u=e[o])?(u.__data__=s[o],i[o]=u):n[o]=new Qt(t,s[o]);for(;o<l;++o)(u=e[o])&&(r[o]=u)}function is(t,e,n,i,r,s,o){var u,l,a=new Map,c=e.length,f=s.length,h=new Array(c),d;for(u=0;u<c;++u)(l=e[u])&&(h[u]=d=o.call(l,l.__data__,u,e)+"",a.has(d)?r[u]=l:a.set(d,l));for(u=0;u<f;++u)d=o.call(t,s[u],u,s)+"",(l=a.get(d))?(i[u]=l,l.__data__=s[u],a.delete(d)):n[u]=new Qt(t,s[u]);for(u=0;u<c;++u)(l=e[u])&&a.get(h[u])===l&&(r[u]=l)}function rs(t){return t.__data__}function ss(t,e){if(!arguments.length)return Array.from(this,rs);var n=e?is:ns,i=this._parents,r=this._groups;typeof t!="function"&&(t=es(t));for(var s=r.length,o=new Array(s),u=new Array(s),l=new Array(s),a=0;a<s;++a){var c=i[a],f=r[a],h=f.length,d=os(t.call(c,c&&c.__data__,a,i)),g=d.length,y=u[a]=new Array(g),$=o[a]=new Array(g),x=l[a]=new Array(h);n(c,f,y,$,x,d,e);for(var b=0,T=0,V,F;b<g;++b)if(V=y[b]){for(b>=T&&(T=b+1);!(F=$[T])&&++T<g;);V._next=F||null}}return o=new X(o,i),o._enter=u,o._exit=l,o}function os(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function as(){return new X(this._exit||this._groups.map(Nn),this._parents)}function us(t,e,n){var i=this.enter(),r=this,s=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?s.remove():n(s),i&&r?i.merge(r).order():r}function ls(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,s=i.length,o=Math.min(r,s),u=new Array(r),l=0;l<o;++l)for(var a=n[l],c=i[l],f=a.length,h=u[l]=new Array(f),d,g=0;g<f;++g)(d=a[g]||c[g])&&(h[g]=d);for(;l<r;++l)u[l]=n[l];return new X(u,this._parents)}function cs(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,s=i[r],o;--r>=0;)(o=i[r])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function hs(t){t||(t=fs);function e(f,h){return f&&h?t(f.__data__,h.__data__):!f-!h}for(var n=this._groups,i=n.length,r=new Array(i),s=0;s<i;++s){for(var o=n[s],u=o.length,l=r[s]=new Array(u),a,c=0;c<u;++c)(a=o[c])&&(l[c]=a);l.sort(e)}return new X(r,this._parents).order()}function fs(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ds(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ps(){return Array.from(this)}function gs(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length;r<s;++r){var o=i[r];if(o)return o}return null}function ms(){let t=0;for(const e of this)++t;return t}function xs(){return!this.node()}function ys(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],s=0,o=r.length,u;s<o;++s)(u=r[s])&&t.call(u,u.__data__,s,r);return this}function ws(t){return function(){this.removeAttribute(t)}}function _s(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vs(t,e){return function(){this.setAttribute(t,e)}}function bs(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ms(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ks(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function $s(t,e){var n=ee(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?_s:ws:typeof e=="function"?n.local?ks:Ms:n.local?bs:vs)(n,e))}function zn(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Fs(t){return function(){this.style.removeProperty(t)}}function Ss(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ts(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Es(t,e,n){return arguments.length>1?this.each((e==null?Fs:typeof e=="function"?Ts:Ss)(t,e,n??"")):yt(this.node(),t)}function yt(t,e){return t.style.getPropertyValue(e)||zn(t).getComputedStyle(t,null).getPropertyValue(e)}function As(t){return function(){delete this[t]}}function Vs(t,e){return function(){this[t]=e}}function Ns(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function zs(t,e){return arguments.length>1?this.each((e==null?As:typeof e=="function"?Ns:Vs)(t,e)):this.node()[t]}function Pn(t){return t.trim().split(/^|\s+/)}function ze(t){return t.classList||new Cn(t)}function Cn(t){this._node=t,this._names=Pn(t.getAttribute("class")||"")}Cn.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function In(t,e){for(var n=ze(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function Dn(t,e){for(var n=ze(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Ps(t){return function(){In(this,t)}}function Cs(t){return function(){Dn(this,t)}}function Is(t,e){return function(){(e.apply(this,arguments)?In:Dn)(this,t)}}function Ds(t,e){var n=Pn(t+"");if(arguments.length<2){for(var i=ze(this.node()),r=-1,s=n.length;++r<s;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Is:e?Ps:Cs)(n,e))}function Rs(){this.textContent=""}function Bs(t){return function(){this.textContent=t}}function Ls(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function qs(t){return arguments.length?this.each(t==null?Rs:(typeof t=="function"?Ls:Bs)(t)):this.node().textContent}function Hs(){this.innerHTML=""}function Xs(t){return function(){this.innerHTML=t}}function Os(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Us(t){return arguments.length?this.each(t==null?Hs:(typeof t=="function"?Os:Xs)(t)):this.node().innerHTML}function Ys(){this.nextSibling&&this.parentNode.appendChild(this)}function Gs(){return this.each(Ys)}function Zs(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ws(){return this.each(Zs)}function Ks(t){var e=typeof t=="function"?t:Ve(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Qs(){return null}function Js(t,e){var n=typeof t=="function"?t:Ve(t),i=e==null?Qs:typeof e=="function"?e:Ne(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function js(){var t=this.parentNode;t&&t.removeChild(this)}function to(){return this.each(js)}function eo(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function no(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function io(t){return this.select(t?no:eo)}function ro(t){return arguments.length?this.property("__data__",t):this.node().__data__}function so(t){return function(e){t.call(this,e,this.__data__)}}function oo(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function ao(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,s;n<r;++n)s=e[n],(!t.type||s.type===t.type)&&s.name===t.name?this.removeEventListener(s.type,s.listener,s.options):e[++i]=s;++i?e.length=i:delete this.__on}}}function uo(t,e,n){return function(){var i=this.__on,r,s=so(e);if(i){for(var o=0,u=i.length;o<u;++o)if((r=i[o]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),r.value=e;return}}this.addEventListener(t.type,s,n),r={type:t.type,name:t.name,value:e,listener:s,options:n},i?i.push(r):this.__on=[r]}}function lo(t,e,n){var i=oo(t+""),r,s=i.length,o;if(arguments.length<2){var u=this.node().__on;if(u){for(var l=0,a=u.length,c;l<a;++l)for(r=0,c=u[l];r<s;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value}return}for(u=e?uo:ao,r=0;r<s;++r)this.each(u(i[r],e,n));return this}function Rn(t,e,n){var i=zn(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function co(t,e){return function(){return Rn(this,t,e)}}function ho(t,e){return function(){return Rn(this,t,e.apply(this,arguments))}}function fo(t,e){return this.each((typeof e=="function"?ho:co)(t,e))}function*po(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,s=i.length,o;r<s;++r)(o=i[r])&&(yield o)}var Bn=[null];function X(t,e){this._groups=t,this._parents=e}function At(){return new X([[document.documentElement]],Bn)}function go(){return this}X.prototype=At.prototype={constructor:X,select:Lr,selectAll:Or,selectChild:Zr,selectChildren:Jr,filter:jr,data:ss,enter:ts,exit:as,join:us,merge:ls,selection:go,order:cs,sort:hs,call:ds,nodes:ps,node:gs,size:ms,empty:xs,each:ys,attr:$s,style:Es,property:zs,classed:Ds,text:qs,html:Us,raise:Gs,lower:Ws,append:Ks,insert:Js,remove:to,clone:io,datum:ro,on:lo,dispatch:fo,[Symbol.iterator]:po};function O(t){return typeof t=="string"?new X([[document.querySelector(t)]],[document.documentElement]):new X([[t]],Bn)}function mo(t){return O(Ve(t).call(document.documentElement))}function xo(t){let e;for(;e=t.sourceEvent;)t=e;return t}function ot(t,e){if(t=xo(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}var yo={value:()=>{}};function Pe(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new qt(n)}function qt(t){this._=t}function wo(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}qt.prototype=Pe.prototype={constructor:qt,on:function(t,e){var n=this._,i=wo(t+"",n),r,s=-1,o=i.length;if(arguments.length<2){for(;++s<o;)if((r=(t=i[s]).type)&&(r=_o(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<o;)if(r=(t=i[s]).type)n[r]=rn(n[r],t.name,e);else if(e==null)for(r in n)n[r]=rn(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new qt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,s;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],i=0,r=s.length;i<r;++i)s[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)}};function _o(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function rn(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=yo,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}const ve={capture:!0,passive:!1};function be(t){t.preventDefault(),t.stopImmediatePropagation()}function vo(t){var e=t.document.documentElement,n=O(t).on("dragstart.drag",be,ve);"onselectstart"in e?n.on("selectstart.drag",be,ve):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function bo(t,e){var n=t.document.documentElement,i=O(t).on("dragstart.drag",null);e&&(i.on("click.drag",be,ve),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var wt=0,Mt=0,_t=0,Ln=1e3,Jt,kt,jt=0,ft=0,ne=0,Tt=typeof performance=="object"&&performance.now?performance:Date,qn=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Ce(){return ft||(qn(Mo),ft=Tt.now()+ne)}function Mo(){ft=0}function te(){this._call=this._time=this._next=null}te.prototype=Hn.prototype={constructor:te,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Ce():+n)+(e==null?0:+e),!this._next&&kt!==this&&(kt?kt._next=this:Jt=this,kt=this),this._call=t,this._time=n,Me()},stop:function(){this._call&&(this._call=null,this._time=1/0,Me())}};function Hn(t,e,n){var i=new te;return i.restart(t,e,n),i}function ko(){Ce(),++wt;for(var t=Jt,e;t;)(e=ft-t._time)>=0&&t._call.call(void 0,e),t=t._next;--wt}function sn(){ft=(jt=Tt.now())+ne,wt=Mt=0;try{ko()}finally{wt=0,Fo(),ft=0}}function $o(){var t=Tt.now(),e=t-jt;e>Ln&&(ne-=e,jt=t)}function Fo(){for(var t,e=Jt,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Jt=n);kt=t,Me(i)}function Me(t){if(!wt){Mt&&(Mt=clearTimeout(Mt));var e=t-ft;e>24?(t<1/0&&(Mt=setTimeout(sn,t-Tt.now()-ne)),_t&&(_t=clearInterval(_t))):(_t||(jt=Tt.now(),_t=setInterval($o,Ln)),wt=1,qn(sn))}}function on(t,e,n){var i=new te;return e=e==null?0:+e,i.restart(r=>{i.stop(),t(r+e)},e,n),i}var So=Pe("start","end","cancel","interrupt"),To=[],Xn=0,an=1,ke=2,Ht=3,un=4,$e=5,Xt=6;function ie(t,e,n,i,r,s){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Eo(t,n,{name:e,index:i,group:r,on:So,tween:To,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:Xn})}function Ie(t,e){var n=W(t,e);if(n.state>Xn)throw new Error("too late; already scheduled");return n}function J(t,e){var n=W(t,e);if(n.state>Ht)throw new Error("too late; already running");return n}function W(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Eo(t,e,n){var i=t.__transition,r;i[e]=n,n.timer=Hn(s,0,n.time);function s(a){n.state=an,n.timer.restart(o,n.delay,n.time),n.delay<=a&&o(a-n.delay)}function o(a){var c,f,h,d;if(n.state!==an)return l();for(c in i)if(d=i[c],d.name===n.name){if(d.state===Ht)return on(o);d.state===un?(d.state=Xt,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete i[c]):+c<e&&(d.state=Xt,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete i[c])}if(on(function(){n.state===Ht&&(n.state=un,n.timer.restart(u,n.delay,n.time),u(a))}),n.state=ke,n.on.call("start",t,t.__data__,n.index,n.group),n.state===ke){for(n.state=Ht,r=new Array(h=n.tween.length),c=0,f=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++f]=d);r.length=f+1}}function u(a){for(var c=a<n.duration?n.ease.call(null,a/n.duration):(n.timer.restart(l),n.state=$e,1),f=-1,h=r.length;++f<h;)r[f].call(t,c);n.state===$e&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Xt,n.timer.stop(),delete i[e];for(var a in i)return;delete t.__transition}}function Ot(t,e){var n=t.__transition,i,r,s=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((i=n[o]).name!==e){s=!1;continue}r=i.state>ke&&i.state<$e,i.state=Xt,i.timer.stop(),i.on.call(r?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[o]}s&&delete t.__transition}}function Ao(t){return this.each(function(){Ot(this,t)})}function Vo(t,e){var n,i;return function(){var r=J(this,t),s=r.tween;if(s!==n){i=n=s;for(var o=0,u=i.length;o<u;++o)if(i[o].name===e){i=i.slice(),i.splice(o,1);break}}r.tween=i}}function No(t,e,n){var i,r;if(typeof n!="function")throw new Error;return function(){var s=J(this,t),o=s.tween;if(o!==i){r=(i=o).slice();for(var u={name:e,value:n},l=0,a=r.length;l<a;++l)if(r[l].name===e){r[l]=u;break}l===a&&r.push(u)}s.tween=r}}function zo(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=W(this.node(),n).tween,r=0,s=i.length,o;r<s;++r)if((o=i[r]).name===t)return o.value;return null}return this.each((e==null?Vo:No)(n,t,e))}function De(t,e,n){var i=t._id;return t.each(function(){var r=J(this,i);(r.value||(r.value={}))[e]=n.apply(this,arguments)}),function(r){return W(r,i).value[e]}}function On(t,e){var n;return(typeof e=="number"?G:e instanceof ht?Gt:(n=ht(e))?(e=n,Gt):xn)(t,e)}function Po(t){return function(){this.removeAttribute(t)}}function Co(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Io(t,e,n){var i,r=n+"",s;return function(){var o=this.getAttribute(t);return o===r?null:o===i?s:s=e(i=o,n)}}function Do(t,e,n){var i,r=n+"",s;return function(){var o=this.getAttributeNS(t.space,t.local);return o===r?null:o===i?s:s=e(i=o,n)}}function Ro(t,e,n){var i,r,s;return function(){var o,u=n(this),l;return u==null?void this.removeAttribute(t):(o=this.getAttribute(t),l=u+"",o===l?null:o===i&&l===r?s:(r=l,s=e(i=o,u)))}}function Bo(t,e,n){var i,r,s;return function(){var o,u=n(this),l;return u==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),l=u+"",o===l?null:o===i&&l===r?s:(r=l,s=e(i=o,u)))}}function Lo(t,e){var n=ee(t),i=n==="transform"?Ci:On;return this.attrTween(t,typeof e=="function"?(n.local?Bo:Ro)(n,i,De(this,"attr."+t,e)):e==null?(n.local?Co:Po)(n):(n.local?Do:Io)(n,i,e))}function qo(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Ho(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Xo(t,e){var n,i;function r(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&Ho(t,s)),n}return r._value=e,r}function Oo(t,e){var n,i;function r(){var s=e.apply(this,arguments);return s!==i&&(n=(i=s)&&qo(t,s)),n}return r._value=e,r}function Uo(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=ee(t);return this.tween(n,(i.local?Xo:Oo)(i,e))}function Yo(t,e){return function(){Ie(this,t).delay=+e.apply(this,arguments)}}function Go(t,e){return e=+e,function(){Ie(this,t).delay=e}}function Zo(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Yo:Go)(e,t)):W(this.node(),e).delay}function Wo(t,e){return function(){J(this,t).duration=+e.apply(this,arguments)}}function Ko(t,e){return e=+e,function(){J(this,t).duration=e}}function Qo(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Wo:Ko)(e,t)):W(this.node(),e).duration}function Jo(t,e){if(typeof e!="function")throw new Error;return function(){J(this,t).ease=e}}function jo(t){var e=this._id;return arguments.length?this.each(Jo(e,t)):W(this.node(),e).ease}function ta(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;J(this,t).ease=n}}function ea(t){if(typeof t!="function")throw new Error;return this.each(ta(this._id,t))}function na(t){typeof t!="function"&&(t=An(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var s=e[r],o=s.length,u=i[r]=[],l,a=0;a<o;++a)(l=s[a])&&t.call(l,l.__data__,a,s)&&u.push(l);return new it(i,this._parents,this._name,this._id)}function ia(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,r=n.length,s=Math.min(i,r),o=new Array(i),u=0;u<s;++u)for(var l=e[u],a=n[u],c=l.length,f=o[u]=new Array(c),h,d=0;d<c;++d)(h=l[d]||a[d])&&(f[d]=h);for(;u<i;++u)o[u]=e[u];return new it(o,this._parents,this._name,this._id)}function ra(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function sa(t,e,n){var i,r,s=ra(e)?Ie:J;return function(){var o=s(this,t),u=o.on;u!==i&&(r=(i=u).copy()).on(e,n),o.on=r}}function oa(t,e){var n=this._id;return arguments.length<2?W(this.node(),n).on.on(t):this.each(sa(n,t,e))}function aa(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function ua(){return this.on("end.remove",aa(this._id))}function la(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ne(t));for(var i=this._groups,r=i.length,s=new Array(r),o=0;o<r;++o)for(var u=i[o],l=u.length,a=s[o]=new Array(l),c,f,h=0;h<l;++h)(c=u[h])&&(f=t.call(c,c.__data__,h,u))&&("__data__"in c&&(f.__data__=c.__data__),a[h]=f,ie(a[h],e,n,h,a,W(c,n)));return new it(s,this._parents,e,n)}function ca(t){var e=this._name,n=this._id;typeof t!="function"&&(t=En(t));for(var i=this._groups,r=i.length,s=[],o=[],u=0;u<r;++u)for(var l=i[u],a=l.length,c,f=0;f<a;++f)if(c=l[f]){for(var h=t.call(c,c.__data__,f,l),d,g=W(c,n),y=0,$=h.length;y<$;++y)(d=h[y])&&ie(d,e,n,y,h,g);s.push(h),o.push(c)}return new it(s,o,e,n)}var ha=At.prototype.constructor;function fa(){return new ha(this._groups,this._parents)}function da(t,e){var n,i,r;return function(){var s=yt(this,t),o=(this.style.removeProperty(t),yt(this,t));return s===o?null:s===n&&o===i?r:r=e(n=s,i=o)}}function Un(t){return function(){this.style.removeProperty(t)}}function pa(t,e,n){var i,r=n+"",s;return function(){var o=yt(this,t);return o===r?null:o===i?s:s=e(i=o,n)}}function ga(t,e,n){var i,r,s;return function(){var o=yt(this,t),u=n(this),l=u+"";return u==null&&(l=u=(this.style.removeProperty(t),yt(this,t))),o===l?null:o===i&&l===r?s:(r=l,s=e(i=o,u))}}function ma(t,e){var n,i,r,s="style."+e,o="end."+s,u;return function(){var l=J(this,t),a=l.on,c=l.value[s]==null?u||(u=Un(e)):void 0;(a!==n||r!==c)&&(i=(n=a).copy()).on(o,r=c),l.on=i}}function xa(t,e,n){var i=(t+="")=="transform"?Pi:On;return e==null?this.styleTween(t,da(t,i)).on("end.style."+t,Un(t)):typeof e=="function"?this.styleTween(t,ga(t,i,De(this,"style."+t,e))).each(ma(this._id,t)):this.styleTween(t,pa(t,i,e),n).on("end.style."+t,null)}function ya(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function wa(t,e,n){var i,r;function s(){var o=e.apply(this,arguments);return o!==r&&(i=(r=o)&&ya(t,o,n)),i}return s._value=e,s}function _a(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,wa(t,e,n??""))}function va(t){return function(){this.textContent=t}}function ba(t){return function(){var e=t(this);this.textContent=e??""}}function Ma(t){return this.tween("text",typeof t=="function"?ba(De(this,"text",t)):va(t==null?"":t+""))}function ka(t){return function(e){this.textContent=t.call(this,e)}}function $a(t){var e,n;function i(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&ka(r)),e}return i._value=t,i}function Fa(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,$a(t))}function Sa(){for(var t=this._name,e=this._id,n=Yn(),i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],u=o.length,l,a=0;a<u;++a)if(l=o[a]){var c=W(l,e);ie(l,t,n,a,o,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new it(i,this._parents,t,n)}function Ta(){var t,e,n=this,i=n._id,r=n.size();return new Promise(function(s,o){var u={value:o},l={value:function(){--r===0&&s()}};n.each(function(){var a=J(this,i),c=a.on;c!==t&&(e=(t=c).copy(),e._.cancel.push(u),e._.interrupt.push(u),e._.end.push(l)),a.on=e}),r===0&&s()})}var Ea=0;function it(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Yn(){return++Ea}var et=At.prototype;it.prototype={constructor:it,select:la,selectAll:ca,selectChild:et.selectChild,selectChildren:et.selectChildren,filter:na,merge:ia,selection:fa,transition:Sa,call:et.call,nodes:et.nodes,node:et.node,size:et.size,empty:et.empty,each:et.each,on:oa,attr:Lo,attrTween:Uo,style:xa,styleTween:_a,text:Ma,textTween:Fa,remove:ua,tween:zo,delay:Zo,duration:Qo,ease:jo,easeVarying:ea,end:Ta,[Symbol.iterator]:et[Symbol.iterator]};function Aa(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Va={time:null,delay:0,duration:250,ease:Aa};function Na(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function za(t){var e,n;t instanceof it?(e=t._id,t=t._name):(e=Yn(),(n=Va).time=Ce(),t=t==null?null:t+"");for(var i=this._groups,r=i.length,s=0;s<r;++s)for(var o=i[s],u=o.length,l,a=0;a<u;++a)(l=o[a])&&ie(l,t,e,a,o,n||Na(l,e));return new it(i,this._parents,t,e)}At.prototype.interrupt=Ao;At.prototype.transition=za;const It=t=>()=>t;function Pa(t,{sourceEvent:e,target:n,transform:i,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:r}})}function nt(t,e,n){this.k=t,this.x=e,this.y=n}nt.prototype={constructor:nt,scale:function(t){return t===1?this:new nt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new nt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Re=new nt(1,0,0);nt.prototype;function ue(t){t.stopImmediatePropagation()}function vt(t){t.preventDefault(),t.stopImmediatePropagation()}function Ca(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ia(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function ln(){return this.__zoom||Re}function Da(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Ra(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ba(t,e,n){var i=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(r>i?(i+r)/2:Math.min(0,i)||Math.max(0,r),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function La(){var t=Ca,e=Ia,n=Ba,i=Da,r=Ra,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],u=250,l=Bi,a=Pe("start","zoom","end"),c,f,h,d=500,g=150,y=0,$=10;function x(p){p.property("__zoom",ln).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",v).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",A).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}x.transform=function(p,w,m,_){var k=p.selection?p.selection():p;k.property("__zoom",ln),p!==k?F(p,w,m,_):k.interrupt().each(function(){P(this,arguments).event(_).start().zoom(null,typeof w=="function"?w.apply(this,arguments):w).end()})},x.scaleBy=function(p,w,m,_){x.scaleTo(p,function(){var k=this.__zoom.k,M=typeof w=="function"?w.apply(this,arguments):w;return k*M},m,_)},x.scaleTo=function(p,w,m,_){x.transform(p,function(){var k=e.apply(this,arguments),M=this.__zoom,E=m==null?V(k):typeof m=="function"?m.apply(this,arguments):m,N=M.invert(E),D=typeof w=="function"?w.apply(this,arguments):w;return n(T(b(M,D),E,N),k,o)},m,_)},x.translateBy=function(p,w,m,_){x.transform(p,function(){return n(this.__zoom.translate(typeof w=="function"?w.apply(this,arguments):w,typeof m=="function"?m.apply(this,arguments):m),e.apply(this,arguments),o)},null,_)},x.translateTo=function(p,w,m,_,k){x.transform(p,function(){var M=e.apply(this,arguments),E=this.__zoom,N=_==null?V(M):typeof _=="function"?_.apply(this,arguments):_;return n(Re.translate(N[0],N[1]).scale(E.k).translate(typeof w=="function"?-w.apply(this,arguments):-w,typeof m=="function"?-m.apply(this,arguments):-m),M,o)},_,k)};function b(p,w){return w=Math.max(s[0],Math.min(s[1],w)),w===p.k?p:new nt(w,p.x,p.y)}function T(p,w,m){var _=w[0]-m[0]*p.k,k=w[1]-m[1]*p.k;return _===p.x&&k===p.y?p:new nt(p.k,_,k)}function V(p){return[(+p[0][0]+ +p[1][0])/2,(+p[0][1]+ +p[1][1])/2]}function F(p,w,m,_){p.on("start.zoom",function(){P(this,arguments).event(_).start()}).on("interrupt.zoom end.zoom",function(){P(this,arguments).event(_).end()}).tween("zoom",function(){var k=this,M=arguments,E=P(k,M).event(_),N=e.apply(k,M),D=m==null?V(N):typeof m=="function"?m.apply(k,M):m,K=Math.max(N[1][0]-N[0][0],N[1][1]-N[0][1]),L=k.__zoom,U=typeof w=="function"?w.apply(k,M):w,j=l(L.invert(D).concat(K/L.k),U.invert(D).concat(K/U.k));return function(Y){if(Y===1)Y=U;else{var tt=j(Y),re=K/tt[2];Y=new nt(re,D[0]-tt[0]*re,D[1]-tt[1]*re)}E.zoom(null,Y)}})}function P(p,w,m){return!m&&p.__zooming||new z(p,w)}function z(p,w){this.that=p,this.args=w,this.active=0,this.sourceEvent=null,this.extent=e.apply(p,w),this.taps=0}z.prototype={event:function(p){return p&&(this.sourceEvent=p),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(p,w){return this.mouse&&p!=="mouse"&&(this.mouse[1]=w.invert(this.mouse[0])),this.touch0&&p!=="touch"&&(this.touch0[1]=w.invert(this.touch0[0])),this.touch1&&p!=="touch"&&(this.touch1[1]=w.invert(this.touch1[0])),this.that.__zoom=w,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(p){var w=O(this.that).datum();a.call(p,this.that,new Pa(p,{sourceEvent:this.sourceEvent,target:x,transform:this.that.__zoom,dispatch:a}),w)}};function q(p,...w){if(!t.apply(this,arguments))return;var m=P(this,w).event(p),_=this.__zoom,k=Math.max(s[0],Math.min(s[1],_.k*Math.pow(2,i.apply(this,arguments)))),M=ot(p);if(m.wheel)(m.mouse[0][0]!==M[0]||m.mouse[0][1]!==M[1])&&(m.mouse[1]=_.invert(m.mouse[0]=M)),clearTimeout(m.wheel);else{if(_.k===k)return;m.mouse=[M,_.invert(M)],Ot(this),m.start()}vt(p),m.wheel=setTimeout(E,g),m.zoom("mouse",n(T(b(_,k),m.mouse[0],m.mouse[1]),m.extent,o));function E(){m.wheel=null,m.end()}}function I(p,...w){if(h||!t.apply(this,arguments))return;var m=p.currentTarget,_=P(this,w,!0).event(p),k=O(p.view).on("mousemove.zoom",D,!0).on("mouseup.zoom",K,!0),M=ot(p,m),E=p.clientX,N=p.clientY;vo(p.view),ue(p),_.mouse=[M,this.__zoom.invert(M)],Ot(this),_.start();function D(L){if(vt(L),!_.moved){var U=L.clientX-E,j=L.clientY-N;_.moved=U*U+j*j>y}_.event(L).zoom("mouse",n(T(_.that.__zoom,_.mouse[0]=ot(L,m),_.mouse[1]),_.extent,o))}function K(L){k.on("mousemove.zoom mouseup.zoom",null),bo(L.view,_.moved),vt(L),_.event(L).end()}}function B(p,...w){if(t.apply(this,arguments)){var m=this.__zoom,_=ot(p.changedTouches?p.changedTouches[0]:p,this),k=m.invert(_),M=m.k*(p.shiftKey?.5:2),E=n(T(b(m,M),_,k),e.apply(this,w),o);vt(p),u>0?O(this).transition().duration(u).call(F,E,_,p):O(this).call(x.transform,E,_,p)}}function v(p,...w){if(t.apply(this,arguments)){var m=p.touches,_=m.length,k=P(this,w,p.changedTouches.length===_).event(p),M,E,N,D;for(ue(p),E=0;E<_;++E)N=m[E],D=ot(N,this),D=[D,this.__zoom.invert(D),N.identifier],k.touch0?!k.touch1&&k.touch0[2]!==D[2]&&(k.touch1=D,k.taps=0):(k.touch0=D,M=!0,k.taps=1+!!c);c&&(c=clearTimeout(c)),M&&(k.taps<2&&(f=D[0],c=setTimeout(function(){c=null},d)),Ot(this),k.start())}}function S(p,...w){if(this.__zooming){var m=P(this,w).event(p),_=p.changedTouches,k=_.length,M,E,N,D;for(vt(p),M=0;M<k;++M)E=_[M],N=ot(E,this),m.touch0&&m.touch0[2]===E.identifier?m.touch0[0]=N:m.touch1&&m.touch1[2]===E.identifier&&(m.touch1[0]=N);if(E=m.that.__zoom,m.touch1){var K=m.touch0[0],L=m.touch0[1],U=m.touch1[0],j=m.touch1[1],Y=(Y=U[0]-K[0])*Y+(Y=U[1]-K[1])*Y,tt=(tt=j[0]-L[0])*tt+(tt=j[1]-L[1])*tt;E=b(E,Math.sqrt(Y/tt)),N=[(K[0]+U[0])/2,(K[1]+U[1])/2],D=[(L[0]+j[0])/2,(L[1]+j[1])/2]}else if(m.touch0)N=m.touch0[0],D=m.touch0[1];else return;m.zoom("touch",n(T(E,N,D),m.extent,o))}}function A(p,...w){if(this.__zooming){var m=P(this,w).event(p),_=p.changedTouches,k=_.length,M,E;for(ue(p),h&&clearTimeout(h),h=setTimeout(function(){h=null},d),M=0;M<k;++M)E=_[M],m.touch0&&m.touch0[2]===E.identifier?delete m.touch0:m.touch1&&m.touch1[2]===E.identifier&&delete m.touch1;if(m.touch1&&!m.touch0&&(m.touch0=m.touch1,delete m.touch1),m.touch0)m.touch0[1]=this.__zoom.invert(m.touch0[0]);else if(m.end(),m.taps===2&&(E=ot(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<$)){var N=O(this).on("dblclick.zoom");N&&N.apply(this,arguments)}}}return x.wheelDelta=function(p){return arguments.length?(i=typeof p=="function"?p:It(+p),x):i},x.filter=function(p){return arguments.length?(t=typeof p=="function"?p:It(!!p),x):t},x.touchable=function(p){return arguments.length?(r=typeof p=="function"?p:It(!!p),x):r},x.extent=function(p){return arguments.length?(e=typeof p=="function"?p:It([[+p[0][0],+p[0][1]],[+p[1][0],+p[1][1]]]),x):e},x.scaleExtent=function(p){return arguments.length?(s[0]=+p[0],s[1]=+p[1],x):[s[0],s[1]]},x.translateExtent=function(p){return arguments.length?(o[0][0]=+p[0][0],o[1][0]=+p[1][0],o[0][1]=+p[0][1],o[1][1]=+p[1][1],x):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},x.constrain=function(p){return arguments.length?(n=p,x):n},x.duration=function(p){return arguments.length?(u=+p,x):u},x.interpolate=function(p){return arguments.length?(l=p,x):l},x.on=function(){var p=a.on.apply(a,arguments);return p===a?x:p},x.clickDistance=function(p){return arguments.length?(y=(p=+p)*p,x):Math.sqrt(y)},x.tapDistance=function(p){return arguments.length?($=+p,x):$},x}const Fe=65536*65536,cn=1/Fe,qa=12,hn=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),le=0,Dt=1,bt=2,Rt=5;class Ha{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,n,i=this.length){for(;this.pos<i;){const r=this.readVarint(),s=r>>3,o=this.pos;this.type=r&7,e(s,n,this),this.pos===o&&this.skip(r)}return n}readMessage(e,n){return this.readFields(e,n,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*Fe;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*Fe;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const n=this.buf;let i,r;return r=n[this.pos++],i=r&127,r<128||(r=n[this.pos++],i|=(r&127)<<7,r<128)||(r=n[this.pos++],i|=(r&127)<<14,r<128)||(r=n[this.pos++],i|=(r&127)<<21,r<128)?i:(r=n[this.pos],i|=(r&15)<<28,Xa(i,e,this))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2===1?(e+1)/-2:e/2}readBoolean(){return!!this.readVarint()}readString(){const e=this.readVarint()+this.pos,n=this.pos;return this.pos=e,e-n>=qa&&hn?hn.decode(this.buf.subarray(n,e)):nu(this.buf,n,e)}readBytes(){const e=this.readVarint()+this.pos,n=this.buf.subarray(this.pos,e);return this.pos=e,n}readPackedVarint(e=[],n){const i=this.readPackedEnd();for(;this.pos<i;)e.push(this.readVarint(n));return e}readPackedSVarint(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const n=this.readPackedEnd();for(;this.pos<n;)e.push(this.readSFixed64());return e}readPackedEnd(){return this.type===bt?this.readVarint()+this.pos:this.pos+1}skip(e){const n=e&7;if(n===le)for(;this.buf[this.pos++]>127;);else if(n===bt)this.pos=this.readVarint()+this.pos;else if(n===Rt)this.pos+=4;else if(n===Dt)this.pos+=8;else throw new Error(`Unimplemented type: ${n}`)}writeTag(e,n){this.writeVarint(e<<3|n)}realloc(e){let n=this.length||16;for(;n<this.pos+e;)n*=2;if(n!==this.length){const i=new Uint8Array(n);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=n}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*cn),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,e&-1,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*cn),!0),this.pos+=8}writeVarint(e){if(e=+e||0,e>268435455||e<0){Oa(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))}writeSVarint(e){this.writeVarint(e<0?-e*2-1:e*2)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(e.length*4),this.pos++;const n=this.pos;this.pos=iu(this.buf,e,this.pos);const i=this.pos-n;i>=128&&fn(n,i,this),this.pos=n-1,this.writeVarint(i),this.pos+=i}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const n=e.length;this.writeVarint(n),this.realloc(n);for(let i=0;i<n;i++)this.buf[this.pos++]=e[i]}writeRawMessage(e,n){this.pos++;const i=this.pos;e(n,this);const r=this.pos-i;r>=128&&fn(i,r,this),this.pos=i-1,this.writeVarint(r),this.pos+=r}writeMessage(e,n,i){this.writeTag(e,bt),this.writeRawMessage(n,i)}writePackedVarint(e,n){n.length&&this.writeMessage(e,Ga,n)}writePackedSVarint(e,n){n.length&&this.writeMessage(e,Za,n)}writePackedBoolean(e,n){n.length&&this.writeMessage(e,Qa,n)}writePackedFloat(e,n){n.length&&this.writeMessage(e,Wa,n)}writePackedDouble(e,n){n.length&&this.writeMessage(e,Ka,n)}writePackedFixed32(e,n){n.length&&this.writeMessage(e,Ja,n)}writePackedSFixed32(e,n){n.length&&this.writeMessage(e,ja,n)}writePackedFixed64(e,n){n.length&&this.writeMessage(e,tu,n)}writePackedSFixed64(e,n){n.length&&this.writeMessage(e,eu,n)}writeBytesField(e,n){this.writeTag(e,bt),this.writeBytes(n)}writeFixed32Field(e,n){this.writeTag(e,Rt),this.writeFixed32(n)}writeSFixed32Field(e,n){this.writeTag(e,Rt),this.writeSFixed32(n)}writeFixed64Field(e,n){this.writeTag(e,Dt),this.writeFixed64(n)}writeSFixed64Field(e,n){this.writeTag(e,Dt),this.writeSFixed64(n)}writeVarintField(e,n){this.writeTag(e,le),this.writeVarint(n)}writeSVarintField(e,n){this.writeTag(e,le),this.writeSVarint(n)}writeStringField(e,n){this.writeTag(e,bt),this.writeString(n)}writeFloatField(e,n){this.writeTag(e,Rt),this.writeFloat(n)}writeDoubleField(e,n){this.writeTag(e,Dt),this.writeDouble(n)}writeBooleanField(e,n){this.writeVarintField(e,+n)}}function Xa(t,e,n){const i=n.buf;let r,s;if(s=i[n.pos++],r=(s&112)>>4,s<128||(s=i[n.pos++],r|=(s&127)<<3,s<128)||(s=i[n.pos++],r|=(s&127)<<10,s<128)||(s=i[n.pos++],r|=(s&127)<<17,s<128)||(s=i[n.pos++],r|=(s&127)<<24,s<128)||(s=i[n.pos++],r|=(s&1)<<31,s<128))return dt(t,r,e);throw new Error("Expected varint not more than 10 bytes")}function dt(t,e,n){return n?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Oa(t,e){let n,i;if(t>=0?(n=t%4294967296|0,i=t/4294967296|0):(n=~(-t%4294967296),i=~(-t/4294967296),n^4294967295?n=n+1|0:(n=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),Ua(n,i,e),Ya(i,e)}function Ua(t,e,n){n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos++]=t&127|128,t>>>=7,n.buf[n.pos]=t&127}function Ya(t,e){const n=(t&7)<<4;e.buf[e.pos++]|=n|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=t&127)))))}function fn(t,e,n){const i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));n.realloc(i);for(let r=n.pos-1;r>=t;r--)n.buf[r+i]=n.buf[r]}function Ga(t,e){for(let n=0;n<t.length;n++)e.writeVarint(t[n])}function Za(t,e){for(let n=0;n<t.length;n++)e.writeSVarint(t[n])}function Wa(t,e){for(let n=0;n<t.length;n++)e.writeFloat(t[n])}function Ka(t,e){for(let n=0;n<t.length;n++)e.writeDouble(t[n])}function Qa(t,e){for(let n=0;n<t.length;n++)e.writeBoolean(t[n])}function Ja(t,e){for(let n=0;n<t.length;n++)e.writeFixed32(t[n])}function ja(t,e){for(let n=0;n<t.length;n++)e.writeSFixed32(t[n])}function tu(t,e){for(let n=0;n<t.length;n++)e.writeFixed64(t[n])}function eu(t,e){for(let n=0;n<t.length;n++)e.writeSFixed64(t[n])}function nu(t,e,n){let i="",r=e;for(;r<n;){const s=t[r];let o=null,u=s>239?4:s>223?3:s>191?2:1;if(r+u>n)break;let l,a,c;u===1?s<128&&(o=s):u===2?(l=t[r+1],(l&192)===128&&(o=(s&31)<<6|l&63,o<=127&&(o=null))):u===3?(l=t[r+1],a=t[r+2],(l&192)===128&&(a&192)===128&&(o=(s&15)<<12|(l&63)<<6|a&63,(o<=2047||o>=55296&&o<=57343)&&(o=null))):u===4&&(l=t[r+1],a=t[r+2],c=t[r+3],(l&192)===128&&(a&192)===128&&(c&192)===128&&(o=(s&15)<<18|(l&63)<<12|(a&63)<<6|c&63,(o<=65535||o>=1114112)&&(o=null))),o===null?(o=65533,u=1):o>65535&&(o-=65536,i+=String.fromCharCode(o>>>10&1023|55296),o=56320|o&1023),i+=String.fromCharCode(o),r+=u}return i}function iu(t,e,n){for(let i=0,r,s;i<e.length;i++){if(r=e.charCodeAt(i),r>55295&&r<57344)if(s)if(r<56320){t[n++]=239,t[n++]=191,t[n++]=189,s=r;continue}else r=s-55296<<10|r-56320|65536,s=null;else{r>56319||i+1===e.length?(t[n++]=239,t[n++]=191,t[n++]=189):s=r;continue}else s&&(t[n++]=239,t[n++]=191,t[n++]=189,s=null);r<128?t[n++]=r:(r<2048?t[n++]=r>>6|192:(r<65536?t[n++]=r>>12|224:(t[n++]=r>>18|240,t[n++]=r>>12&63|128),t[n++]=r>>6&63|128),t[n++]=r&63|128)}return n}var ru=st('<div class="h-full w-full relative"><div class="absolute top-2 right-2"></div><div class="h-full cursor-crosshair">'),su=st('<div class="absolute bottom-2 right-2"><div class="app-bg rounded p-2 app-border">'),ou=st("<button type=button>"),au=st('<div class="absolute top-8 left-0 z-[999] w-full flex justify-center"><div class="grid grid-cols-3 grid-rows-3 gap-1 w-16 h-16"><div>'),uu=st('<div class="w-full absolute top-8 left-0 flex justify-center"><div class="grid grid-cols-2 grid-rows-2 gap-1 w-16 h-16 z-[999]">'),lu=st('<div class="flex flex-col h-full w-full"><div class="p-2 space-y-2 md:space-y-0 md:space-x-2 flex flex-col md:flex-row justify-start"><form class="flex flex-row justify-between md:space-x-4"><label for=z>Z</label><input id=z type=number class="app-border w-20"><label for=x>X</label><input id=x type=number class="app-border w-20"><label for=y>Y</label><input id=y type=number class="app-border w-20"><button type=submit class="btn-primary rounded px-4 md:mr-8 pointer-cursor">load</button></form><div class="flex flex-row justify-between space-x-4"><span class=relative><button type=button class="rounded btn-secondary px-4 cursor-pointer">neighbors</button></span><span class=relative><button type=button class="rounded btn-secondary px-4 cursor-pointer">children</button></span><span class=relative><button type=button class="rounded px-4">parent'),cu=st("<div class=p-4>Enter a tile z/x/y"),hu=st('<div class="flex flex-1 w-full h-full overflow-hidden">');function fu(t,e){const n=new Gi(new Ha(new Uint8Array(t))),i=[];let r=0;for(const[s,o]of Object.entries(n.layers)){o.extent>r&&(r=o.extent);const u=[];for(let l=0;l<o.length;l++){const a=o.feature(l),c=kn(),f=a.loadGeometry();if(a.type===1)for(const h of f)for(const d of h)c.rect(d.x-15,d.y-15,30,30);else for(const h of f){c.moveTo(h[0].x,h[0].y);for(let d=1;d<h.length;d++)c.lineTo(h[d].x,h[d].y);a.type===3&&c.closePath()}u.push({path:c.toString(),type:a.type,id:a.id,properties:a.properties,layerName:s,color:oi(e.indexOf(s))})}u.sort((l,a)=>l.type>a.type?-1:1),i.push({name:s,features:u})}return i}function du(t){const e={};if(!t||t instanceof ArrayBuffer)return e;for(const n of t)e[n.name]=n.features.length;return e}function pu(t){let e,n,i,r;const[s,o]=lt([]),[u,l]=lt(),[a,c]=lt(!1);ti(()=>{if(!e)return;const d=e.clientHeight,g=e.clientWidth,y=we().domain([-1e3,5096]).range([-1e3,5096]),$=we().domain([-1e3,5096]).range([-1e3,5096]),x=nr(y).ticks((g+2)/(d+2)*10).tickSize(d).tickPadding(8-d),b=er($).ticks((g+2)/(d+2)*10).tickSize(g).tickPadding(8-g);n=mo("svg").attr("width",g).attr("height",d),r=n.append("g");const T=n.append("g").attr("class","axis axis--x").call(x),V=n.append("g").attr("class","axis axis--y").call(b);function F({transform:I}){r.attr("transform",I.toString()),T.call(x.scale(I.rescaleX(y))),V.call(b.scale(I.rescaleY($)))}function P(I){return I.preventDefault(),(!I.ctrlKey||I.type==="wheel")&&!I.button}i=La().scaleExtent([.01,20]).translateExtent([[-1e3,-1e3],[5096,5096]]).filter(P).on("zoom",F),Object.assign(n.call(i).node(),{}),n.call(i.transform,Re.translate(g/2,d/2).scale(d/4096*.75).translate(-4096/2,-4096/2)),new ResizeObserver(()=>{n.attr("width",e.clientWidth),n.attr("height",e.clientHeight)}).observe(e);const q=n.node();q&&e.appendChild(q)});const f=ei(()=>({zxy:t.zxy(),tileset:t.tileset()})),[h]=ni(f,async d=>{const g=d.tileset,y=d.zxy;if(await g.isVector()){const $=await g.getZxy(y[0],y[1],y[2]);if(!$)return;const x=await t.tileset().getVectorLayers();return fu($,x)}return await g.getZxy(y[0],y[1],y[2])});return ce(async()=>{const d=t.tileset();if(await d.isVector()){const g=await d.getVectorLayers();o(g.map(y=>({id:y,visible:!0})))}}),ce(async()=>{r.selectAll("*").remove(),r.append("rect").attr("width",4096).attr("height",4096).attr("x",0).attr("y",0).attr("fill","none").attr("class","tile-border").attr("strokeWidth","1");const d=h();if(d)if(Array.isArray(d)){const g=s(),y=d.filter(x=>g.find(b=>b.id===x.name&&b.visible));r.selectAll("g").data(y).join("g").selectAll("path").data(x=>x.features).join("path").attr("d",x=>x.path).style("opacity",.3).attr("fill",x=>x.type===3||x.type===1?x.color:"none").attr("stroke",x=>x.type===2?x.color:"none").attr("stroke-width",6).on("mouseover",function(x,b){a()||(b.type===2?O(this).attr("stroke","white"):O(this).attr("fill","white"),l({layerName:b.layerName,properties:b.properties,type:b.type,id:b.id}))}).on("mouseout",function(x,b){a()||(b.type===2?O(this).attr("stroke",b.color):O(this).attr("fill",b.color))}).on("mousedown",()=>{c(!a())})}else{const g=new Blob([d],{type:"image/webp"}),y=URL.createObjectURL(g);r.append("image").attr("href",y).attr("width",4096).attr("height",4096)}}),(()=>{var d=ru(),g=d.firstChild,y=g.nextSibling;R(g,C(ai,{layerVisibility:s,setLayerVisibility:o,get layerFeatureCounts(){return du(h())}})),R(d,C($t,{get when(){return u()},children:x=>(()=>{var b=su(),T=b.firstChild;return R(T,C(ui,{get features(){return[x()]}})),pt(()=>T.classList.toggle("app-well",!!a())),b})()}),y);var $=e;return typeof $=="function"?ii($,y):e=y,d})()}function gu(t){const[e,n]=lt(!1),[i,r]=lt(!1),s=(f,h,d)=>{const g=t.zxy();if(g){if(f===0)return[g[0],g[1]+h,g[2]+d];if(f===1)return[g[0]+1,g[1]*2+h,g[2]*2+d];if(f===-1)return[g[0]-1,Math.floor(g[1]/2),Math.floor(g[2]/2)]}},o=(f,h,d)=>{const g=s(f,h,d);g&&t.setZxy(g)},u=(f,h,d)=>{const g=s(f,h,d);if(g){if(g[0]<0||g[1]<0||g[2]<0)return!1;const y=2**g[0]-1;return g[1]<=y&&g[2]<=y}return!1},l=f=>{f.preventDefault();const h=f.currentTarget,d=h.elements.namedItem("z"),g=h.elements.namedItem("x"),y=h.elements.namedItem("y");t.setZxy([+d.value,+g.value,+y.value])},a=f=>(()=>{var h=ou();return h.$$click=()=>o(...f.navTo),pt(d=>{var g={border:u(...f.navTo),"hover:bg-purple":u(...f.navTo),"cursor-pointer":u(...f.navTo)},y=!u(...f.navTo);return d.e=ri(h,g,d.e),y!==d.t&&(h.disabled=d.t=y),d},{e:void 0,t:void 0}),h})(),c=(f,h)=>f?f[h]:"";return(()=>{var f=lu(),h=f.firstChild,d=h.firstChild,g=d.firstChild,y=g.nextSibling,$=y.nextSibling,x=$.nextSibling,b=x.nextSibling,T=b.nextSibling,V=d.nextSibling,F=V.firstChild,P=F.firstChild,z=F.nextSibling,q=z.firstChild,I=z.nextSibling,B=I.firstChild;return d.addEventListener("submit",l),P.$$click=()=>n(!e()),R(F,C($t,{get when(){return e()},get children(){var v=au(),S=v.firstChild,A=S.firstChild;return R(S,C(a,{navTo:[0,-1,-1]}),A),R(S,C(a,{navTo:[0,0,-1]}),A),R(S,C(a,{navTo:[0,1,-1]}),A),R(S,C(a,{navTo:[0,-1,0]}),A),R(S,C(a,{navTo:[0,1,0]}),null),R(S,C(a,{navTo:[0,-1,1]}),null),R(S,C(a,{navTo:[0,0,1]}),null),R(S,C(a,{navTo:[0,1,1]}),null),v}}),null),q.$$click=()=>r(!i()),R(z,C($t,{get when(){return i()},get children(){var v=uu(),S=v.firstChild;return R(S,C(a,{navTo:[1,0,0]}),null),R(S,C(a,{navTo:[1,1,0]}),null),R(S,C(a,{navTo:[1,0,1]}),null),R(S,C(a,{navTo:[1,1,1]}),null),v}}),null),B.$$click=()=>o(-1,0,0),R(f,C($t,{get when(){return t.zxy()},get fallback(){return cu()},children:v=>(()=>{var S=hu();return R(S,C(pu,{zxy:v,get tileset(){return t.tileset}})),S})()}),null),pt(v=>{var S=!!u(-1,0,0),A=!u(-1,0,0);return S!==v.e&&B.classList.toggle("btn-secondary",v.e=S),A!==v.t&&(B.disabled=v.t=A),v},{e:void 0,t:void 0}),pt(()=>y.value=c(t.zxy(),0)),pt(()=>x.value=c(t.zxy(),1)),pt(()=>T.value=c(t.zxy(),2)),f})()}function mu(){const t=Wn(location.hash),[e,n]=lt(t.url?Kn(decodeURIComponent(t.url)):void 0),[i,r]=lt(t.zxy?Qn(t.zxy):void 0);return ce(()=>{const s=e(),o=i(),u=s?.getStateUrl();location.hash=si(location.hash,{url:u?encodeURIComponent(u):void 0,zxy:o?o.join("/"):void 0})}),C(jn,{tileset:e,setTileset:n,page:"tile",get children(){return C($t,{get when(){return e()},get fallback(){return C(Jn,{setTileset:n})},children:s=>C(gu,{tileset:s,zxy:i,setZxy:r})})}})}const dn=document.getElementById("root");dn&&Gn(()=>C(mu,{}),dn);Zn(["click"]);
|