From a96f83303478bfcc51ffa977e1cbeb2d4df8d7f6 Mon Sep 17 00:00:00 2001 From: Allen Downey Date: Mon, 2 Nov 2026 16:37:49 -0500 Subject: [PATCH 1/4] Redraw a figure in JupyterLab when its output is updated The mime renderer's renderModel returned early whenever it already had a graph, so update_display_data (for example IPython's DisplayHandle.update) never changed the figure. Redraw when the figure in the new model differs from the one drawn; keep returning early when it's the same, as when createGraph stores the PNG in the model. Co-Authored-By: Claude Opus 5.5 --- js/src/mimeExtension.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/src/mimeExtension.ts b/js/src/mimeExtension.ts index b49d0de86df..ddee3a57d0b 100644 --- a/js/src/mimeExtension.ts +++ b/js/src/mimeExtension.ts @@ -54,8 +54,16 @@ export class RenderedPlotly extends Widget implements IRenderMime.IRenderer { */ renderModel(model: IRenderMime.IMimeModel): Promise { if (this.hasGraphElement()) { - // We already have a graph, don't overwrite it - return Promise.resolve(); + // We already have a graph. Redraw it only if the figure has changed, + // as it does when a kernel sends update_display_data. (createGraph + // stores a PNG of the figure in the model, which calls renderModel + // again with the same figure.) + const previous = this._model?.data[this._mimeType]; + if (JSON.stringify(previous) === JSON.stringify(model.data[this._mimeType])) { + return Promise.resolve(); + } + this._model = model; + return this.createGraph(model); } // Save off reference to model so that we can regenerate the plot later From ae2f1968130464adbffac85a2ef63acfaadae720 Mon Sep 17 00:00:00 2001 From: Allen Downey Date: Mon, 2 Nov 2026 17:39:09 -0500 Subject: [PATCH 2/4] Changelog entry for #5865 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1632f922032..ee01fe41702 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add support for converting matplotlib reference lines (`axhline`, `axvline`, and horizontal/vertical `axline`) as well as axes-coordinate lines into Plotly layout shapes in `mpl_to_plotly`, including support for date axes [[#5719](https://github.com/plotly/plotly.py/pull/5719)], with thanks to @robertoffmoura for the contribution! ### Fixed +- Fix figures in JupyterLab not redrawing when their output is updated with `update_display_data` (for example `DisplayHandle.update`), which also kept animations in other kernels on their first frame [[#5865](https://github.com/plotly/plotly.py/pull/5865)] - Fix `mpl_to_plotly` tick marker mirroring, axis positioning, and trace visibility for twinned and overlaid subplots (such as `twinx` and `twiny`) [[#5310](https://github.com/plotly/plotly.py/pull/5310)], with thanks to @robertoffmoura for the contribution! - Fix `mpl_to_plotly` losing matplotlib axis line colors by exporting the color of each axis's displayed spine to the plotly x and y axis `linecolor` [[#5311](https://github.com/plotly/plotly.py/pull/5311)], with thanks to @robertoffmoura for the contribution! - Fix concurrent first access to lazily initialized graph object properties, which could raise `ValueError("Invalid value")` [[#5691](https://github.com/plotly/plotly.py/pull/5691)], with thanks to @hb1915 for the contribution! From ff25b1d94c42fd2db5c5965f095332e43aec5fee Mon Sep 17 00:00:00 2001 From: Adrian Borrmann Date: Fri, 6 Nov 2026 15:34:32 -0600 Subject: [PATCH 3/4] Rebuild JupyterLab extension artifacts --- js/lib/mimeExtension.js | 2 +- plotly/labextension/package.json | 2 +- .../static/{0.03957c7088ad5ed0.js => 0.d6f08baae2d5090c.js} | 2 +- ...ntry.1dda3c8f6e5cd2a3.js => remoteEntry.954b872b457cd897.js} | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename plotly/labextension/static/{0.03957c7088ad5ed0.js => 0.d6f08baae2d5090c.js} (99%) rename plotly/labextension/static/{remoteEntry.1dda3c8f6e5cd2a3.js => remoteEntry.954b872b457cd897.js} (99%) diff --git a/js/lib/mimeExtension.js b/js/lib/mimeExtension.js index be3303328f0..a5b3139d1e4 100644 --- a/js/lib/mimeExtension.js +++ b/js/lib/mimeExtension.js @@ -3523,7 +3523,7 @@ precision highp float; in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Yo("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;in vec3 v_view_direction;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,(angle_to_globe_center-horizon_angle)*u_camera_to_center_distance*u_device_pixel_ratio,u_sky_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")},OM="#define PROJECTION_MERCATOR",NM="mercator",M2=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return NM}get shaderDefine(){return OM}get shaderPreludeCode(){return rd.projectionMercator}get vertexShaderPreludeCode(){return rd.projectionMercator.vertexSource}get subdivisionGranularity(){return wb.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(e,r,t,i,a){if(this._cachedMesh)return this._cachedMesh;let o=new sp;o.emplaceBack(0,0),o.emplaceBack(Bi,0),o.emplaceBack(0,Bi),o.emplaceBack(Bi,Bi);let s=e.createVertexBuffer(o,i0.members),l=Ks.simpleSegment(0,0,4,2),n=new ed;n.emplaceBack(1,0,2),n.emplaceBack(1,2,3);let u=e.createIndexBuffer(n);return this._cachedMesh=new Um(s,u,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}},S2=class sU{constructor(r=0,t=0,i=0,a=0){if(isNaN(r)||r<0||isNaN(t)||t<0||isNaN(i)||i<0||isNaN(a)||a<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=t,this.left=i,this.right=a}interpolate(r,t,i){return t.top!=null&&r.top!=null&&(this.top=Zs.number(r.top,t.top,i)),t.bottom!=null&&r.bottom!=null&&(this.bottom=Zs.number(r.bottom,t.bottom,i)),t.left!=null&&r.left!=null&&(this.left=Zs.number(r.left,t.left,i)),t.right!=null&&r.right!=null&&(this.right=Zs.number(r.right,t.right,i)),this}getCenter(r,t){let i=to((this.left+r-this.right)/2,0,r),a=to((this.top+t-this.bottom)/2,0,t);return new Wr(i,a)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new sU(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}},E2=class{constructor(e,r){var t;this.applyConstrain=(i,a)=>this._constrainOverride===null?this._callbacks.defaultConstrain(i,a):this._constrainOverride(i,a),this._callbacks=e,this._tileSize=512,this._renderWorldCopies=r?.renderWorldCopies===void 0||!!r?.renderWorldCopies,this._minZoom=r?.minZoom||0,this._maxZoom=r?.maxZoom||22,this._minPitch=r?.minPitch===void 0||r?.minPitch===null?0:r?.minPitch,this._maxPitch=r?.maxPitch===void 0||r?.maxPitch===null?60:r?.maxPitch,this._constrainOverride=(t=r?.constrainOverride)!=null?t:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new An(0,0),this._elevation=0,this._zoom=0,this._tileZoom=hz(this._zoom),this._scale=Vc(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new S2,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,r,t){this._constrainOverride=e.constrainOverride,this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=hz(this._zoom),this._scale=Vc(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new S2(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!t&&e.autoCalculateNearFarZ,r&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){if(this._minZoom===e)return;this._minZoom=e;let r=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=r}get maxZoom(){return this._maxZoom}setMaxZoom(e){if(this._maxZoom===e)return;this._maxZoom=e;let r=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=r}get minPitch(){return this._minPitch}setMinPitch(e){if(this._minPitch===e)return;this._minPitch=e;let r=this._unmodified;this.setPitch(Math.max(this.pitch,e)),this._unmodified=r}get maxPitch(){return this._maxPitch}setMaxPitch(e){if(this._maxPitch===e)return;this._maxPitch=e;let r=this._unmodified;this.setPitch(Math.min(this.pitch,e)),this._unmodified=r}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get constrainOverride(){return this._constrainOverride}setConstrainOverride(e){e===void 0&&(e=null),this._constrainOverride!==e&&(this._constrainOverride=e,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Wr(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){let r=ch(e,-180,180)*Math.PI/180;this._bearingInRadians!==r&&(this._unmodified=!1,this._bearingInRadians=r,this._calcMatrices(),this._rotationMatrix=D5(),Hae(this._rotationMatrix,this._rotationMatrix,-this._bearingInRadians))}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){let r=to(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){let r=e/180*Math.PI;this._rollInRadians!==r&&(this._unmodified=!1,this._rollInRadians=r,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return Ad(this._fovInRadians)}setFov(e){e=to(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=rl(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){let r=this.applyConstrain(this._center,e).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=Vc(r),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(e){(e.lat!==this._center.lat||e.lng!==this._center.lng)&&(this._unmodified=!1,this._center=e,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,r){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=r,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,r,t){this._unmodified=!1,this._edgeInsets.interpolate(e,r,t),this.constrainInternal(),this._calcMatrices()}resize(e,r,t=!0){this._width=e,this._height=r,t&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var e,r;return((e=this._latRange)==null?void 0:e.length)!==2||((r=this._lngRange)==null?void 0:r.length)!==2?null:new bh([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-Wh,Wh])}getCameraQueryGeometry(e,r){if(r.length===1)return[r[0],e];{let{minX:t,minY:i,maxX:a,maxY:o}=gh.fromPoints(r).extend(e);return[new Wr(t,i),new Wr(a,i),new Wr(a,o),new Wr(t,o),new Wr(t,i)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let e=this._unmodified,{center:r,zoom:t}=this.applyConstrain(this.center,this.zoom);this.setCenter(r),this.setZoom(t),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=q0(1,this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=Hh(new Float64Array(16));Xu(e,e,[this._width/2,-this._height/2,1]),Ol(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=Hh(new Float64Array(16)),Xu(e,e,[1,-1,1]),Ol(e,e,[-1,-1,0]),Xu(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e;let r=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(r)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,r,t,i){let a=t===void 0?this.bearing:t,o=i=i===void 0?this.pitch:i,{distanceToCenter:s,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,o),{x:n,y:u}=N6(o,a),c=Qo.fromLngLat(e,r),f=QL(1,c.y),h,d,p=0;do{if(p+=1,p>10)break;d=s/f;let g=n*d,m=u*d;h=new Qo(c.x+g,c.y+m),f=1/h.meterInMercatorCoordinateUnits()}while(Math.abs(s-d*f)>1e-12);return{center:h.toLngLat(),elevation:l,zoom:Ku(this.height/2/Math.tan(this.fovInRadians/2)/d/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e===0)return;let r=1/this.worldSize,t=q0(1,this.center.lat)*this.worldSize,i=Qo.fromLngLat(this.center,this.elevation),a=i.x/r,o=i.y/r,s=i.z/r,l=this.pitch,n=this.bearing,{x:u,y:c,z:f}=N6(l,n),h=this.cameraToCenterDistance,d=a+h*-u,p=o+h*-c,g=s+h*f,{distanceToCenter:m,clampedElevation:y}=this._distanceToCenterFromAltElevationPitch(g/t,e,l),_=m*t,v=d+u*_,x=p+c*_,S=new Qo(v*r,x*r,0).toLngLat(),M=q0(1,S.lat),C=Ku(this.height/2/Math.tan(this.fovInRadians/2)/m/M/this.tileSize);this._elevation=y,this._center=S,this.setZoom(C)}_distanceToCenterFromAltElevationPitch(e,r,t){let i=-Math.cos(rl(t)),a=e-r,o,s=r;return i*a>=0||Math.abs(i)<.1?(o=1e4,s=e+o*i):o=-a/i,{distanceToCenter:o,clampedElevation:s}}getCameraPoint(){let e=this.pitchInRadians,r=Math.tan(e)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Wr(r*Math.sin(this.rollInRadians),r*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];let r=e.canonical.z>=0?1<i}allowWorldCopies(){return!0}prepareNextFrame(){}},YB=ul([{name:"a_pos3d",type:"Int16",components:3}]),XB=class extends Nl{constructor(e){super(),this._lastTilesetChange=hs(),this.tileManager=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(e,r){this.tileManager.update(e,r),this._renderableTilesKeys=[];let t={},i=!1;for(let a of Bm(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))t[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),$h(a.terrainRttPosMatrix32f,0,Bi,Bi,0,0,1),this._tiles[a.key]=new DM(a,this.tileSize),this._lastTilesetChange=hs(),i=!0);for(let a in this._tiles)t[a]||(this._tiles[a].releaseRTT(this.tileManager.map.painter),delete this._tiles[a],i=!0);return i}releaseRTT(e){for(let r in this._tiles){let t=this._tiles[r];(t.tileID.equals(e)||t.tileID.isChildOf(e)||e.isChildOf(t.tileID))&&t.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let e in this._tiles)this._tiles[e].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,r){return r?this._getTerrainCoordsForTileRanges(e,r):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){let r={};for(let t of this._renderableTilesKeys){let i=this._tiles[t].tileID,a=e.clone(),o=L0();if(i.canonical.equals(e.canonical))$h(o,0,Bi,Bi,0,0,1);else if(i.canonical.isChildOf(e.canonical)){let s=i.canonical.z-e.canonical.z,l=i.canonical.x-(i.canonical.x>>s<>s<>s;$h(o,0,u,u,0,0,1),Ol(o,o,[-l*u,-n*u,0])}else if(e.canonical.isChildOf(i.canonical)){let s=e.canonical.z-i.canonical.z,l=e.canonical.x-(e.canonical.x>>s<>s<>s;$h(o,0,Bi,Bi,0,0,1),Ol(o,o,[l*u,n*u,0]),Xu(o,o,[1/2**s,1/2**s,0])}else continue;a.terrainRttPosMatrix32f=new Float32Array(o),r[t]=a}return r}_getTerrainCoordsForTileRanges(e,r){let t={};for(let i of this._renderableTilesKeys){let a=this._tiles[i].tileID;if(!this._isWithinTileRanges(a,r))continue;let o=e.clone(),s=L0();if(a.canonical.z===e.canonical.z){let l=e.canonical.x-a.canonical.x+e.wrap*(1<e.canonical.z){let l=a.canonical.z-e.canonical.z,n=a.canonical.x-(a.canonical.x>>l<>l<>l),f=e.canonical.y-(a.canonical.y>>l),h=Bi>>l;$h(s,0,h,h,0,0,1),Ol(s,s,[-n*h+c*Bi,-u*h+f*Bi,0])}else{let l=e.canonical.z-a.canonical.z,n=e.canonical.x-(e.canonical.x>>l<>l<>l)-a.canonical.x,f=(e.canonical.y>>l)-a.canonical.y,h=Bi<a.maxzoom&&(o=a.maxzoom),o=a.minzoom&&!s?.dem;)s=this.findTileInCaches(e.scaledTo(o--).key);return s}findTileInCaches(e){let r=this.tileManager.getTileByID(e);return r||(r=this.tileManager._outOfViewCache.getByKey(e),r)}anyTilesAfterTime(e=hs()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,r){let t=r[e.canonical.z];return!!t&&(e.wrap>t.minWrap||e.wrap=t.minTileXWrapped&&e.canonical.x<=t.maxTileXWrapped&&e.canonical.y>=t.minTileY&&e.canonical.y<=t.maxTileY)}},jM=Bi*(1-1e-12),ZB=class{constructor(e,r,t,i="auto"){this._meshCache={},this.painter=e,this.tileManager=new XB(r),this.options=t,this.exaggeration=typeof t.exaggeration=="number"?t.exaggeration:1,this._terrainSkirtLength=i,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){this._fbo&&(this._fbo=(this._fbo.destroy(),null)),this._fboDepthTexture&&(this._fboDepthTexture=(this._fboDepthTexture.destroy(),null)),this._emptyDemTexture&&(this._emptyDemTexture=(this._emptyDemTexture.destroy(),null)),this._emptyDepthTexture&&(this._emptyDepthTexture=(this._emptyDepthTexture.destroy(),null));for(let e in this._meshCache)this._meshCache[e].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(e,r,t,i=Bi){let a=e.normalizeCoordinates(r,t,i);if(!a)return 0;let o=this.getElevationSampler(a.tileID);return o?o(a.x,a.y,i):0}getElevationForLngLatZoom(e,r){if(!zF(r,e.wrap()))return 0;let{tileID:t,mercatorX:i,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(e,r);return this.getElevation(t,i%Bi,a%Bi,Bi)}getElevationForLngLat(e,r){let t=this.getCoverageIndex();if(t){let o=Qo.fromLngLat(e),s=tM(t,this.exaggeration,o.x,o.y);if(s.demLoaded)return s.elevation}let i=Bm(r,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let o of i)o.canonical.z>a&&(a=Math.min(o.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(e,a)}getElevation(e,r,t,i=Bi){return this.getDEMElevation(e,r,t,i)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return this._coverageIndex===void 0&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let e=[],r=new Map,t=0,i=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:o,wrap:s}=a.tileID;e.includes(o.z)||e.push(o.z);let l=this.getElevationSampler(a.tileID);r.set(`${s}/${o.z}/${o.x}/${o.y}`,l);let{minElevation:n,maxElevation:u}=this.getMinMaxElevation(a.tileID);t=Math.min(t,n??0),i=Math.max(i,u??0)}return r.size===0?null:(e.sort((a,o)=>o-a),{zooms:e,samplerPerTile:r,minElevation:t-10,maxElevation:i+10})}getElevationSampler(e){let r=e.key,t=this._elevationSamplerCache.get(r);if(t)return t;let i=this.tileManager.getSourceTile(e,!0),a=i?.dem;if(!i||!a)return null;let o=this._getDEMTileMatrix(e,i),s=o[0]*a.dim,l=o[5]*a.dim,n=o[12]*a.dim,u=o[13]*a.dim,c=(f,h,d)=>{let p=d===8192?1:Bi/d;return a.sampleBilinear(f*p*s+n,h*p*l+u)};return this._elevationSamplerCache.set(r,c),c}_getDEMTileMatrix(e,r){let t=`${r.tileID.key}/${e.key}`,i=this._demMatrixCache.get(t);if(i)return i;let a=this.tileManager.getSource().maxzoom,o=e.canonical.z-r.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=a?o=e.canonical.z-a:To("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let s=e.canonical.x-(e.canonical.x>>o<>o<0,i=t&&e.canonical.y===0,a=t&&e.canonical.y===(1<{i=to(+i,this.minZoom,this.maxZoom);let a={center:new An(t.lng,t.lat),zoom:i},o=this._helper._lngRange;!this._helper._renderWorldCopies&&o===null&&(o=[-179.9999999999,180-1e-10]);let s=this.tileSize*Vc(a.zoom),l=0,n=s,u=0,c=s,f=0,h=0,{x:d,y:p}=this.size;if(this._helper._latRange){let x=this._helper._latRange;l=um(x[1])*s,n=um(x[0])*s,n-ln&&(_=n-x)}if(o){let x=(u+c)/2,S=g;this._helper._renderWorldCopies&&(S=ch(g,x-s/2,x+s/2));let M=d/2;S-Mc&&(y=c-M)}if(y!==void 0||_!==void 0){let x=new Wr(y??g,_??m);a.center=sg(s,x).wrap()}return a},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new E2({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},r),this._coveringTilesDetailsProvider=new WB}clone(){let r=new lU;return r.apply(this,!1),r}apply(r,t,i){this._helper.apply(r,t,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(r){let t=[new zg(0,r)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new Wr(0,0)),a=this.screenPointToMercatorCoordinate(new Wr(this._helper._width,0)),o=this.screenPointToMercatorCoordinate(new Wr(this._helper._width,this._helper._height)),s=this.screenPointToMercatorCoordinate(new Wr(0,this._helper._height)),l=Math.floor(Math.min(i.x,a.x,o.x,s.x)),n=Math.floor(Math.max(i.x,a.x,o.x,s.x));for(let u=l-1;u<=n+1;u++)u!==0&&t.push(new zg(u,r))}return t}getCameraFrustum(){return T2.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(r){let t=this.screenPointToLocation(this.centerPoint,r),i=r?r.getElevationForLngLat(t,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(r,t,i=this.elevation){let a=i-this.elevation,o=this.screenPointToMercatorCoordinateAtZ(t,a),s=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),l=Qo.fromLngLat(r),n=new Qo(l.x-(o.x-s.x),l.y-(o.y-s.y));this.setCenter(n?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(r,t){return t?this.coordinatePoint(Qo.fromLngLat(r),t.getElevationForLngLat(r,this),this._pixelMatrix3D):this.coordinatePoint(Qo.fromLngLat(r))}screenPointToLocation(r,t){var i;return(i=this.screenPointToMercatorCoordinate(r,t))==null?void 0:i.toLngLat()}screenPointToLocationAtElevation(r,t){var i;return(i=this.screenPointToMercatorCoordinateAtZ(r,t-this.elevation))==null?void 0:i.toLngLat()}screenPointToMercatorCoordinate(r,t){if(t){let i=this.screenTerrainPointToMercatorCoordinate(r,t);if(i!=null)return i}return this.screenPointToMercatorCoordinateAtZ(r)}screenTerrainPointToMercatorCoordinate(r,t){let i=t.getCoverageIndex();if(!i)return null;let{near:a,far:o}=this.getRaySegmentFromPixel(r),s=this.worldSize,l=o[0]-a[0],n=o[1]-a[1],u=o[2]-a[2],c={index:i,exaggeration:t.exaggeration,near:a,dx:l,dy:n,dz:u,worldSize:s},f=0,h=1;if(u===0){if(a[2]>i.maxElevation||a[2]h)return null}let d=Math.hypot(l,n),p=to(Math.ceil(d*(h-f)/4),1,512),g=0,m=!i2(c,0);for(let y=0;y<=p;y++){let _=f+(h-f)*y/p;if(!m)m=!i2(c,_);else if(i2(c,_)){let{lo:v,hi:x}=pz(c,i2,g,_,.001/d),S=r2(c,v),M=r2(c,x),C=a[2]+v*u-S.elevation,w=a[2]+x*u-M.elevation,k=S.covered&&C>w?to(v+C*(x-v)/(C-w),v,x):x;return new Qo((a[0]+k*l)/s,(a[1]+k*n)/s,r2(c,k).elevation)}g=_}return null}getRaySegmentFromPixel(r){let t=[r.x,r.y,0,1],i=[r.x,r.y,1,1];pu(t,t,this._pixelMatrixInverse),pu(i,i,this._pixelMatrixInverse);let a=t[3],o=i[3],s=this.elevation;return{near:[t[0]/a,t[1]/a,t[2]/a+s],far:[i[0]/o,i[1]/o,i[2]/o+s]}}screenPointToMercatorCoordinateAtZ(r,t){let i=t||0,{near:a,far:o}=this.getRaySegmentFromPixel(r),s=a[2]===o[2]?0:(i+this.elevation-a[2])/(o[2]-a[2]);return new Qo(Zs.number(a[0],o[0],s)/this.worldSize,Zs.number(a[1],o[1],s)/this.worldSize,i)}coordinatePoint(r,t=0,i=this._pixelMatrix){let a=[r.x*this.worldSize,r.y*this.worldSize,t,1];return pu(a,a,i),new Wr(a[0]/a[3],a[1]/a[3])}getBounds(){let r=Math.max(0,this._helper._height/2-lg(this));return new bh().extend(this.screenPointToLocation(new Wr(0,r))).extend(this.screenPointToLocation(new Wr(this._helper._width,r))).extend(this.screenPointToLocation(new Wr(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new Wr(0,this._helper._height)))}isPointOnMapSurface(r,t){return t?this.screenTerrainPointToMercatorCoordinate(r,t)!=null:r.y>this.height/2-lg(this)}calculatePosMatrix(r,t=!1,i=!1){var a;let o=(a=r.key)!=null?a:cm(r.wrap,r.canonical.z,r.canonical.z,r.canonical.x,r.canonical.y),s=t?this._alignedPosMatrixCache:this._posMatrixCache;if(s.has(o)){let u=s.get(o);return i?u.f32:u.f64}let l=O6(r,this.worldSize);$v(l,t?this._alignedProjMatrix:this._viewProjMatrix,l);let n={f64:l,f32:new Float32Array(l)};return s.set(o,n),i?n.f32:n.f64}calculateFogMatrix(r){let t=r.key,i=this._fogMatrixCacheF32;if(i.has(t))return i.get(t);let a=O6(r,this.worldSize);return $v(a,this._fogMatrix,a),i.set(t,new Float32Array(a)),i.get(t)}calculateCenterFromCameraLngLatAlt(r,t,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(r,t,i,a)}calculateCameraOptionsFromTo(r,t,i,a){let o=Qo.fromLngLat(r,t),s=Qo.fromLngLat(i,a),l=s.x-o.x,n=s.y-o.y,u=s.z-o.z,c=Math.hypot(l,n,u);if(c===0)throw Error("Can't calculate camera options with same From and To");let f=Math.hypot(l,n),h=Ku(this.cameraToCenterDistance/c/this.tileSize),d=Ad(Math.atan2(l,-n)),p=Ad(Math.acos(f/c));return p=u<0?90-p:90+p,{center:s.toLngLat(),elevation:a,zoom:h,pitch:p,bearing:d}}_calculateNearFarZIfNeeded(r,t,i){if(!this._helper.autoCalculateNearFarZ)return;let a=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),o=r-a*this._helper._pixelPerMeter/Math.cos(t),s=a<0?o:r,l=Math.PI/2+this.pitchInRadians,n=rl(this.fov)*(Math.abs(Math.cos(rl(this.roll)))*this.height+Math.abs(Math.sin(rl(this.roll)))*this.width)/this.height*(.5+i.y/this.height),u=Math.sin(n)*s/Math.sin(to(Math.PI-l-n,.01,Math.PI-.01)),c=lg(this),f=Math.atan(c/this._helper.cameraToCenterDistance),h=rl(90-Jp),d=f>h?2*f*(.5+i.y/(c*2)):h,p=Math.sin(d)*s/Math.sin(to(Math.PI-l-d,.01,Math.PI-.01)),g=Math.min(u,p);this._helper._farZ=(Math.cos(Math.PI/2-t)*g+s)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){let r=this.centerOffset,t=Md(this.worldSize,this.center),i=t.x,a=t.y,o=rl(Math.min(this.pitch,Jp)),s=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(o));this._calculateNearFarZIfNeeded(s,o,r);let l;l=new Float64Array(16),Mx(l,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),Kne(this._invProjMatrix,l),l[8]=-r.x*2/this._helper._width,l[9]=r.y*2/this._helper._height,this._projectionMatrix=O4(l),Xu(l,l,[1,-1,1]),Ol(l,l,[0,0,-this._helper.cameraToCenterDistance]),zp(l,l,-this.rollInRadians),Wv(l,l,this.pitchInRadians),zp(l,l,-this.bearingInRadians),Ol(l,l,[-i,-a,0]),this._mercatorMatrix=Xu([],l,[this.worldSize,this.worldSize,this.worldSize]),Xu(l,l,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=$v(new Float64Array(16),this.clipSpaceToPixelsMatrix,l),Ol(l,l,[0,0,-this.elevation]),this._viewProjMatrix=l,this._invViewProjMatrix=E_([],l);let n=[0,0,-1,1];pu(n,n,this._invViewProjMatrix),this._cameraPosition=[n[0]/n[3],n[1]/n[3],n[2]/n[3]],this._fogMatrix=new Float64Array(16),Mx(this._fogMatrix,this.fovInRadians,this.width/this.height,s,this._helper._farZ),this._fogMatrix[8]=-r.x*2/this.width,this._fogMatrix[9]=r.y*2/this.height,Xu(this._fogMatrix,this._fogMatrix,[1,-1,1]),Ol(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),zp(this._fogMatrix,this._fogMatrix,-this.rollInRadians),Wv(this._fogMatrix,this._fogMatrix,this.pitchInRadians),zp(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),Ol(this._fogMatrix,this._fogMatrix,[-i,-a,0]),Xu(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),Ol(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=$v(new Float64Array(16),this.clipSpaceToPixelsMatrix,l);let u=this._helper._width%2/2,c=this._helper._height%2/2,f=Math.cos(this.bearingInRadians),h=Math.sin(-this.bearingInRadians),d=i-Math.round(i)+f*u+h*c,p=a-Math.round(a)+f*c+h*u,g=new Float64Array(l);if(Ol(g,g,[d>.5?d-1:d,p>.5?p-1:p,0]),this._alignedProjMatrix=g,l=E_(new Float64Array(16),this._pixelMatrix),!l)throw Error("failed to invert matrix");this._pixelMatrixInverse=l,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let r=this.screenPointToMercatorCoordinate(new Wr(0,0)),t=[r.x*this.worldSize,r.y*this.worldSize,0,1];return pu(t,t,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let r=q0(1,this.center.lat)*this.worldSize,t=this._helper.cameraToCenterDistance/r;return tF(this.center,this.elevation,this.pitch,this.bearing,t).toLngLat()}lngLatToCameraDepth(r,t){let i=Qo.fromLngLat(r),a=[i.x*this.worldSize,i.y*this.worldSize,t,1];return pu(a,a,this._viewProjMatrix),a[2]/a[3]}getProjectionData(r){let{overscaledTileID:t,aligned:i,applyTerrainMatrix:a}=r,o=this._helper.getMercatorTileCoordinates(t),s=t?this.calculatePosMatrix(t,i,!0):null,l;return l=t?.terrainRttPosMatrix32f&&a?t.terrainRttPosMatrix32f:s||_9(),{mainMatrix:l,tileMercatorCoords:o,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:l,clipAntimeridian:!1}}isLocationOccluded(r){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(r,t,i){return 1}transformLightDirection(r){return N4(r)}getRayDirectionFromPixel(r){throw Error("Not implemented.")}projectTileCoordinates(r,t,i,a){let o=this.calculatePosMatrix(i),s;a==null?(s=[r,t,0,1],JA(s,s,o)):(s=[r,t,a,1],pu(s,s,o));let l=s[3];return{point:new Wr(s[0]/l,s[1]/l),signedDistanceFromCamera:l,isOccluded:!1}}populateCache(r){for(let t of r)this.calculatePosMatrix(t)}getProjectionDataForCustomLayer(r=!0){let t=new Cu(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:t,applyGlobeMatrix:r}),a=O6(t,this.worldSize);$v(a,this._viewProjMatrix,a);let o=[Bi,Bi,this.worldSize/this._helper.pixelsPerMeter],s=L0();return Xu(s,a,o),ar(Ot({},i),{tileMercatorCoords:[0,0,1,1],fallbackMatrix:s,mainMatrix:s})}getFastPathSimpleProjectionMatrix(r){return this.calculatePosMatrix(r)}},Jg=class{get useGlobeControls(){return!1}handlePanInertia(e,r){let t=e.mag(),i=Math.abs(lg(r));return{easingOffset:e.mult(Math.min(i*.75/t,1)),easingCenter:r.center}}handleMapControlsRollPitchBearingZoom(e,r){e.bearingDelta&&r.setBearing(r.bearing+e.bearingDelta),e.pitchDelta&&r.setPitch(r.pitch+e.pitchDelta),e.rollDelta&&r.setRoll(r.roll+e.rollDelta),e.zoomDelta&&r.setZoom(r.zoom+e.zoomDelta)}handleMapControlsPan(e,r,t){e.around.distSqr(r.centerPoint)<.01||r.setLocationAtPoint(t,e.around,e.aroundElevation)}cameraForBoxAndBearing(e,r,t,i,a){return gz(e,r,t,i,a)}handleJumpToCenterZoom(e,r){let t=r.zoom===void 0?e.zoom:+r.zoom;e.zoom!==t&&e.setZoom(+r.zoom),r.center!==void 0&&e.setCenter(An.convert(r.center))}handleEaseTo(e,r){let t=e.zoom,i=e.padding,a={roll:e.roll,pitch:e.pitch,bearing:e.bearing},o={roll:r.roll===void 0?e.roll:r.roll,pitch:r.pitch===void 0?e.pitch:r.pitch,bearing:r.bearing===void 0?e.bearing:r.bearing},s=r.zoom!==void 0,l=!e.isPaddingEqual(r.padding),n=!1,u=s?+r.zoom:e.zoom,c=e.centerPoint.add(r.offsetAsPoint),f=e.screenPointToLocation(c),{center:h,zoom:d}=e.applyConstrain(An.convert(r.center||f),u??t);t2(e,h);let p=Md(e.worldSize,f),g=Md(e.worldSize,h).sub(p),m=Vc(d-t);return n=d!==t,{easeFunc:y=>{if(n&&e.setZoom(Zs.number(t,d,y)),w9(a,o)||mz({startEulerAngles:a,endEulerAngles:o,tr:e,k:y,useSlerp:a.roll!=o.roll}),l&&(e.interpolatePadding(i,r.padding,y),c=e.centerPoint.add(r.offsetAsPoint)),r.around)e.setLocationAtPoint(r.around,r.aroundPoint);else{let _=Vc(e.zoom-t),v=(d>t?Math.min(2,m):Math.max(.5,m))**(1-y),x=sg(e.worldSize,p.add(g.mult(y*v)).mult(_));e.setLocationAtPoint(e.renderWorldCopies?x.wrap():x,c)}},isZooming:n,elevationCenter:h}}handleFlyTo(e,r){let t=r.zoom!==void 0,i=e.zoom,a=e.applyConstrain(An.convert(r.center||r.locationAtOffset),t?+r.zoom:i),o=a.center,s=a.zoom;t2(e,o);let l=e.worldSize,n=Md(l,r.locationAtOffset),u=Md(l,o).sub(n),c=u.mag(),f=Vc(s-i),h=r.minZoom===void 0?e.minZoom:+r.minZoom,d=Math.max(h,e.minZoom),p=Math.min(d,i,s),g=e.applyConstrain(o,p).zoom;return{easeFunc:(m,y,_,v)=>{e.setZoom(m===1?s:i+Ku(y));let x=m===1?o:sg(l,n.add(u.mult(_)));e.setLocationAtPoint(e.renderWorldCopies?x.wrap():x,v)},scaleOfZoom:f,targetCenter:o,scaleOfMinZoom:Vc(g-i),pixelPathLength:c}}},JB=()=>KB||(KB=new vu({type:new Ha(mi.projection.type,"type")})),k2=new wb({fill:new Fd(128,2),line:new Fd(512,0),tile:new Fd(128,32),stencil:new Fd(128,1),circle:3}),qM=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return rd.projectionGlobe}get vertexShaderPreludeCode(){return rd.projectionMercator.vertexSource}get subdivisionGranularity(){return k2}get useGlobeControls(){return!0}destroy(){}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,r,t,i,a){let o=(a==="stencil"?k2.stencil:k2.tile).getGranularityForZoomLevel(r.z),s=r.y===0&&i,l=r.y===(1<0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(e,r,t,i,a){return this.currentProjection.getMeshFromTileID(e,r,t,i,a)}setProjection(e){this._transitionable.setValue("type",e?.type||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}},C2=Math.PI*.98,QB=class{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;let e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,r,t,i){let a=`${e.z}_${e.x}_${e.y}_${i?.terrain?"t":""}_${Math.round(t)}`,o=this._cache.get(a);if(o)return o;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let l=this._boundingVolumeFactory(e,r,t,i);return this._cache.set(a,l),this._hadAnyChanges=!0,l}},D2=class uE{constructor(r,t,i,a){this.min=i,this.max=a,this.points=r,this.planes=t}static fromAabb(r,t){let i=[];for(let a=0;a<8;a++)i.push([(a>>0&1)==1?t[0]:r[0],(a>>1&1)==1?t[1]:r[1],(a>>2&1)==1?t[2]:r[2]]);return new uE(i,[[-1,0,0,t[0]],[1,0,0,-r[0]],[0,-1,0,t[1]],[0,1,0,-r[1]],[0,0,-1,t[2]],[0,0,1,-r[2]]],r,t)}static fromCenterSizeAngles(r,t,i){let a=q4([],i[0],i[1],i[2]),o=j4([],[t[0],0,0],a),s=j4([],[0,t[1],0],a),l=j4([],[0,0,t[2]],a),n=[...r],u=[...r];for(let f=0;f<8;f++)for(let h=0;h<3;h++){let d=r[h]+o[h]*((f>>0&1)==1?1:-1)+s[h]*((f>>1&1)==1?1:-1)+l[h]*((f>>2&1)==1?1:-1);n[h]=Math.min(n[h],d),u[h]=Math.max(u[h],d)}let c=[];for(let f=0;f<8;f++){let h=[...r];lh(h,h,Ws([],o,(f>>0&1)==1?1:-1)),lh(h,h,Ws([],s,(f>>1&1)==1?1:-1)),lh(h,h,Ws([],l,(f>>2&1)==1?1:-1)),c.push(h)}return new uE(c,[[...o,-Kl(o,c[0])],[...s,-Kl(s,c[0])],[...l,-Kl(l,c[0])],[-o[0],-o[1],-o[2],-Kl(o,c[7])],[-s[0],-s[1],-s[2],-Kl(s,c[7])],[-l[0],-l[1],-l[2],-Kl(l,c[7])]],n,u)}intersectsFrustum(r){let t=!0,i=this.points.length,a=this.planes.length,o=r.planes.length,s=r.points.length;for(let l=0;l=0&&u++}if(u===0)return 0;u=0&&u++}if(u===0)return 0}return 1}intersectsPlane(r){let t=this.points.length,i=0;for(let a=0;a=0&&i++}return i===t?2:i===0?0:1}},eO=class{constructor(){this._boundingVolumeCache=new QB(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,r,t,i){let a=1<4}allowWorldCopies(){return!1}getTileBoundingVolume(e,r,t,i){return this._boundingVolumeCache.getTileBoundingVolume(e,r,t,i)}_computeTileBoundingVolume(e,r,t,i){var a,o;let s=Math.min(0,t),l=Math.max(0,t);if(i?.terrain){let n=new Cu(e.z,r,e.z,e.x,e.y),u=i.terrain.getMinMaxElevation(n);s=(a=u.minElevation)!=null?a:s,l=Math.max((o=u.maxElevation)!=null?o:l,l)}if(s/=mc,l/=mc,s+=1,l+=1,e.z<=0)return D2.fromAabb([-l,-l,-l],[l,l,l]);if(e.z===1)return D2.fromAabb([e.x===0?-l:0,e.y===0?0:-l,-l],[e.x===0?0:l,e.y===0?l:0,l]);{let n=[r0(0,0,e.x,e.y,e.z),r0(Bi,0,e.x,e.y,e.z),r0(Bi,Bi,e.x,e.y,e.z),r0(0,Bi,e.x,e.y,e.z)],u=[];for(let A of n)u.push(Ws([],A,l));if(l!==s)for(let A of n)u.push(Ws([],A,s));e.y===0&&u.push([0,1,0]),e.y===(1<=(1<{let a=to(t.lat,-Wh,Wh),o=to(+i,this.minZoom+Lu(0,a),this.maxZoom);return{center:new An(t.lng,a),zoom:o}},this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new E2({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},r),this._coveringTilesDetailsProvider=new eO}clone(){let r=new uU;return r.apply(this,!1),r}apply(r,t){this._helper.apply(r,t)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let r=fs();return r[0]=this._cameraPosition[0],r[1]=this._cameraPosition[1],r[2]=this._cameraPosition[2],r}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(r){let{overscaledTileID:t,applyGlobeMatrix:i}=r,a=this._helper.getMercatorTileCoordinates(t);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:a,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:t?.canonical.z===0}}_computeClippingPlane(r){let t=this.pitchInRadians,i=this.cameraToCenterDistance/r,a=Math.sin(t)*i,o=Math.cos(t)*i+1,s=1/Math.sqrt(a*a+o*o)*1,l=-a,n=o,u=Math.sqrt(l*l+n*n);l/=u,n/=u;let c=[0,l,n];U4(c,c,[0,0,0],-this.bearingInRadians),O1(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),Yv(c,c,[0,0,0],this.center.lng*Math.PI/180);let f=1/ap(c);return Ws(c,c,f),[...c,-s*f]}isLocationOccluded(r){return!this.isSurfacePointVisible(ru(r))}transformLightDirection(r){let t=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,a=Math.cos(i),o=[Math.sin(t)*a,Math.sin(i),Math.cos(t)*a],s=[o[2],0,-o[0]],l=[0,0,0];uf(l,s,o),qc(s,s),qc(l,l);let n=[s[0]*r[0]+l[0]*r[1]+o[0]*r[2],s[1]*r[0]+l[1]*r[1]+o[1]*r[2],s[2]*r[0]+l[2]*r[1]+o[2]*r[2]],u=[0,0,0];return qc(u,n),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(r,t,i){let a=eF(r,t,i.canonical),o=ooe(a.x,a.y);return this.getCircleRadiusCorrection()/Math.cos(o[1])}projectTileCoordinates(r,t,i,a){let o=i.canonical,s=r0(r,t,o.x,o.y,o.z),l=1+(a??0)/mc,n=s[0]*l,u=s[1]*l,c=s[2]*l,f=[n,u,c,1];pu(f,f,this._globeViewProjMatrixF64);let h;if(l<=1){let d=this._cachedClippingPlane;h=d[0]*s[0]+d[1]*s[1]+d[2]*s[2]+d[3]<0}else h=this._isLineOfSightBlocked(n,u,c);return{point:new Wr(f[0]/f[3],f[1]/f[3]),signedDistanceFromCamera:f[3],isOccluded:h}}_isLineOfSightBlocked(r,t,i){let a=this._cameraPosition,o=r-a[0],s=t-a[1],l=i-a[2],n=o*o+s*s+l*l;if(n===0)return!1;let u=to(-(a[0]*o+a[1]*s+a[2]*l)/n,0,1),c=a[0]+u*o,f=a[1]+u*s,h=a[2]+u*l;return c*c+f*f+h*h<1}_calcMatrices(){let r=Nm(this.worldSize,this.center.lat),t=L0();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+r*2),Mx(t,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;t[8]=-i.x*2/this._helper._width,t[9]=i.y*2/this._helper._height,this._projectionMatrix=O4(t),this._globeProjMatrixInverted=L0(),E_(this._globeProjMatrixInverted,t),Ol(t,t,[0,0,-this.cameraToCenterDistance]),zp(t,t,this.rollInRadians),Wv(t,t,-this.pitchInRadians),zp(t,t,this.bearingInRadians),Ol(t,t,[0,0,-r]);let a=fs();a[0]=r,a[1]=r,a[2]=r,Wv(t,t,this.center.lat*Math.PI/180),c9(t,t,-this.center.lng*Math.PI/180),Xu(t,t,a),this._globeViewProjMatrixF64=t,this._globeViewProjMatrix32f=new Float32Array(t),this._globeViewProjMatrixF64Inverted=L0(),E_(this._globeViewProjMatrixF64Inverted,t);let o=fs();this._cameraPosition=fs(),this._cameraPosition[2]=this.cameraToCenterDistance/r,U4(this._cameraPosition,this._cameraPosition,o,-this.rollInRadians),O1(this._cameraPosition,this._cameraPosition,o,this.pitchInRadians),U4(this._cameraPosition,this._cameraPosition,o,-this.bearingInRadians),lh(this._cameraPosition,this._cameraPosition,[0,0,1]),O1(this._cameraPosition,this._cameraPosition,o,-this.center.lat*Math.PI/180),Yv(this._cameraPosition,this._cameraPosition,o,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(r);let s=O4(this._globeViewProjMatrixF64Inverted);Xu(s,s,[1,1,-1]),this._cachedFrustum=T2.fromInvProjectionMatrix(s,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(r){To("calculateFogMatrix is not supported on globe projection.");let t=L0();return Hh(t),t}getVisibleUnwrappedCoordinates(r){return[new zg(0,r)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(r){if(r){To("terrain is not fully supported on vertical perspective projection.");return}this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(ap(this._cameraPosition)-1)*mc}getCameraLngLat(){let r=fs();return qc(r,this._cameraPosition),qg(r)}lngLatToCameraDepth(r,t){let i=ru(r);Ws(i,i,1+t/mc);let a=Bp();return pu(a,[i[0],i[1],i[2],1],this._globeViewProjMatrixF64),a[2]/a[3]}populateCache(r){}getBounds(){let r=this.width*.5,t=this.height*.5,i=[new Wr(0,0),new Wr(r,0),new Wr(this.width,0),new Wr(this.width,t),new Wr(this.width,this.height),new Wr(r,this.height),new Wr(0,this.height),new Wr(0,t)],a=[];for(let f of i)a.push(this.unprojectScreenPoint(f));let o=0,s=0,l=0,n=0,u=this.center;for(let f of a){let h=Df(u.lng,f.lng),d=Df(u.lat,f.lat);ho&&(o=h),dl&&(l=d)}let c=[u.lng+s,u.lat+n,u.lng+o,u.lat+l];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new bh(c)}calculateCenterFromCameraLngLatAlt(r,t,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(r,t,i,a)}calculateCameraOptionsFromTo(r,t,i,a){let o=An.convert(i),s=ru(An.convert(r));Ws(s,s,1+t/mc);let l=ru(o),n=Ws(fs(),l,1+a/mc),u=d9(fs(),s,l),c=ap(u);if(c=-_&&g<=_,x=y>=-_&&y<=_,S,M;if(v&&x){let A=this.center.lng*Math.PI/180,b=this.center.lat*Math.PI/180,E=F_(h,A),T=F_(g,b),F=F_(d,A),D=F_(y,b);E+T=0}isSurfacePointOnScreen(r){if(!this.isSurfacePointVisible(r))return!1;let t=Bp();return pu(t,[...r,1],this._globeViewProjMatrixF64),t[0]/=t[3],t[1]/=t[3],t[2]/=t[3],t[0]>-1&&t[0]<1&&t[1]>-1&&t[1]<1&&t[2]>-1&&t[2]<1}unprojectScreenPoint(r){let t=this._cameraPosition,i=this.getRayDirectionFromPixel(r),a=n2(t,i);if(a){let c=fs();lh(c,t,[i[0]*a.tMin,i[1]*a.tMin,i[2]*a.tMin]);let f=fs();return qc(f,c),qg(f)}let o=this._cachedClippingPlane,s=o[0]*i[0]+o[1]*i[1]+o[2]*i[2],l=-G4(o,t)/s,n=fs();if(l>0)lh(n,t,[i[0]*l,i[1]*l,i[2]*l]);else{let c=fs();lh(c,t,[i[0]*2,i[1]*2,i[2]*2]);let f=G4(this._cachedClippingPlane,c);Sd(n,c,[this._cachedClippingPlane[0]*f,this._cachedClippingPlane[1]*f,this._cachedClippingPlane[2]*f])}let u=hoe(o);return qg(doe(u.center,u.radius,n))}getProjectionDataForCustomLayer(r=!0){let t=this.getProjectionData({overscaledTileID:new Cu(0,0,0,0,0),applyGlobeMatrix:r});return t.tileMercatorCoords=[0,0,1,1],t}getFastPathSimpleProjectionMatrix(r){}},$M=class cU{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(r){this._helper.setMinZoom(r)}setMaxZoom(r){this._helper.setMaxZoom(r)}setMinPitch(r){this._helper.setMinPitch(r)}setMaxPitch(r){this._helper.setMaxPitch(r)}setRenderWorldCopies(r){this._helper.setRenderWorldCopies(r)}setBearing(r){this._helper.setBearing(r)}setPitch(r){this._helper.setPitch(r)}setRoll(r){this._helper.setRoll(r)}setFov(r){this._helper.setFov(r)}setZoom(r){this._helper.setZoom(r)}setCenter(r){this._helper.setCenter(r)}setElevation(r){this._helper.setElevation(r)}setMinElevationForCurrentTile(r){this._helper.setMinElevationForCurrentTile(r)}setPadding(r){this._helper.setPadding(r)}interpolatePadding(r,t,i){this._helper.interpolatePadding(r,t,i)}isPaddingEqual(r){return this._helper.isPaddingEqual(r)}resize(r,t,i=!0){this._helper.resize(r,t,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(r){this._helper.setMaxBounds(r)}setConstrainOverride(r){this._helper.setConstrainOverride(r)}overrideNearFarZ(r,t){this._helper.overrideNearFarZ(r,t)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(r){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),r)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(r){this._globeness=r,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(r){this._globeness=1,this.defaultConstrain=(t,i)=>this.currentTransform.defaultConstrain(t,i),this.applyConstrain=(t,i)=>this._helper.applyConstrain(t,i),this._helper=new E2({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,i)=>this.defaultConstrain(t,i)},r),this._globeness=1,this._mercatorTransform=new Kg,this._verticalPerspectiveTransform=new HM}clone(){let r=new cU;return r._globeness=this._globeness,r.apply(this,!1),r}apply(r,t){this._helper.apply(r,t),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(r){let t=this._mercatorTransform.getProjectionData(r),i=this._verticalPerspectiveTransform.getProjectionData(r);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:t.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:r.applyGlobeMatrix?this._globeness:0,fallbackMatrix:t.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(r){return this.currentTransform.isLocationOccluded(r)}transformLightDirection(r){return this.currentTransform.transformLightDirection(r)}getPixelScale(){return Xv(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return Xv(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(r,t,i){let a=this._mercatorTransform.getPitchedTextCorrection(r,t,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(r,t,i);return Xv(a,o,this._globeness)}projectTileCoordinates(r,t,i,a){return this.currentTransform.projectTileCoordinates(r,t,i,a)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(r){return this.currentTransform.calculateFogMatrix(r)}getVisibleUnwrappedCoordinates(r){return this.currentTransform.getVisibleUnwrappedCoordinates(r)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(r){this.currentTransform.recalculateZoomAndCenter(r)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}lngLatToCameraDepth(r,t){return this.currentTransform.lngLatToCameraDepth(r,t)}populateCache(r){this._mercatorTransform.populateCache(r),this._verticalPerspectiveTransform.populateCache(r)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(r,t,i,a){return this._helper.calculateCenterFromCameraLngLatAlt(r,t,i,a)}calculateCameraOptionsFromTo(r,t,i,a){return this.currentTransform.calculateCameraOptionsFromTo(r,t,i,a)}setLocationAtPoint(r,t,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(r,t,i),this.apply(this._mercatorTransform,!1);return}this._verticalPerspectiveTransform.setLocationAtPoint(r,t,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(r,t){return this.currentTransform.locationToScreenPoint(r,t)}screenPointToMercatorCoordinate(r,t){return this.currentTransform.screenPointToMercatorCoordinate(r,t)}screenTerrainPointToMercatorCoordinate(r,t){return this.currentTransform.screenTerrainPointToMercatorCoordinate(r,t)}screenPointToLocation(r,t){return this.currentTransform.screenPointToLocation(r,t)}screenPointToLocationAtElevation(r,t){return this.currentTransform.screenPointToLocationAtElevation(r,t)}isPointOnMapSurface(r,t){return this.currentTransform.isPointOnMapSurface(r,t)}getRayDirectionFromPixel(r){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(r)}getProjectionDataForCustomLayer(r=!0){let t=this._mercatorTransform.getProjectionDataForCustomLayer(r);if(!this.isGlobeRendering)return t;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(r);return i.fallbackMatrix=t.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(r){return this.currentTransform.getFastPathSimpleProjectionMatrix(r)}},WM=class wp{get useGlobeControls(){return!0}handlePanInertia(r,t){let i=voe(r,t);return Math.abs(i.lng-t.center.lng)>180&&(i.lng=t.center.lng+179.5*Math.sign(i.lng-t.center.lng)),{easingCenter:i,easingOffset:new Wr(0,0)}}handleMapControlsRollPitchBearingZoom(r,t){let i=r.around,a=t.screenPointToLocation(i);r.bearingDelta&&t.setBearing(t.bearing+r.bearingDelta),r.pitchDelta&&t.setPitch(t.pitch+r.pitchDelta),r.rollDelta&&t.setRoll(t.roll+r.rollDelta);let o=t.zoom;r.zoomDelta&&t.setZoom(t.zoom+r.zoomDelta);let s=t.zoom-o;if(s===0)return;let l=Df(t.center.lng,a.lng),n=l/(Math.abs(l/180)+1),u=Df(t.center.lat,a.lat),c=t.getRayDirectionFromPixel(i),f=t.cameraPosition,h=Kl(f,c)*-1,d=fs();lh(d,f,[c[0]*h,c[1]*h,c[2]*h]);let p=ap(d),g=p-1,m=Math.exp(-Math.max(g-.3,0)*.5),y=P_(p,.95,.999,0,1),_=Nm(t.worldSize,t.center.lat)/Math.min(t.width,t.height),v=P_(_,.9,.5,1,.25),x=Math.min(m,Xv(1,v,y)),S=(1-Vc(-s))*x,M=t.center.lat,C=t.zoom,w=new An(t.center.lng+n*S,to(t.center.lat+u*S,-Wh,Wh));t.setLocationAtPoint(a,i);let k=t.center,A=P_(Math.abs(l),45,85,0,1),b=Math.max(A,y)**.25,E=Df(k.lng,w.lng),T=Df(k.lat,w.lat);t.setCenter(new An(k.lng+E*b,k.lat+T*b).wrap()),t.setZoom(C+Lu(M,t.center.lat))}handleMapControlsPan(r,t,i){r.panDelta&&coe(t,i,t.isPointOnMapSurface(r.around)?r.around:t.centerPoint,r.panDelta)}cameraForBoxAndBearing(r,t,i,a,o){let s=gz(r,t,i,a,o),l=t.left/o.width*2-1,n=(o.width-t.right)/o.width*2-1,u=t.top/o.height*-2+1,c=(o.height-t.bottom)/o.height*-2+1,f=Df(i.getWest(),i.getEast())<0,h=f?i.getEast():i.getWest(),d=f?i.getWest():i.getEast(),p=Math.max(i.getNorth(),i.getSouth()),g=Math.min(i.getNorth(),i.getSouth()),m=h+Df(h,d)*.5,y=p+Df(p,g)*.5,_=o.clone();_.setCenter(s.center),_.setBearing(s.bearing),_.setPitch(0),_.setRoll(0),_.setZoom(s.zoom);let v=_.modelViewProjectionMatrix,x=[ru(i.getNorthWest()),ru(i.getNorthEast()),ru(i.getSouthWest()),ru(i.getSouthEast()),ru(new An(d,y)),ru(new An(h,y)),ru(new An(m,p)),ru(new An(m,g))],S=ru(s.center),M=1/0;for(let C of x)l<0&&(M=wp.getLesserNonNegativeNonNull(M,wp.solveVectorScale(C,S,v,"x",l))),n>0&&(M=wp.getLesserNonNegativeNonNull(M,wp.solveVectorScale(C,S,v,"x",n))),u>0&&(M=wp.getLesserNonNegativeNonNull(M,wp.solveVectorScale(C,S,v,"y",u))),c<0&&(M=wp.getLesserNonNegativeNonNull(M,wp.solveVectorScale(C,S,v,"y",c)));if(!Number.isFinite(M)||M===0){vz();return}return s.zoom=Math.min(_.zoom+Ku(M),r.maxZoom),s}handleJumpToCenterZoom(r,t){let i=r.center.lat,a=r.applyConstrain(t.center?An.convert(t.center):r.center,r.zoom).center;r.setCenter(a.wrap());let o=t.zoom===void 0?r.zoom+Lu(i,a.lat):+t.zoom;r.zoom!==o&&r.setZoom(o)}handleEaseTo(r,t){let i=r.zoom,a=r.center,o=r.padding,s={roll:r.roll,pitch:r.pitch,bearing:r.bearing},l={roll:t.roll===void 0?r.roll:t.roll,pitch:t.pitch===void 0?r.pitch:t.pitch,bearing:t.bearing===void 0?r.bearing:t.bearing},n=t.zoom!==void 0,u=!r.isPaddingEqual(t.padding),c=!1,f=t.center?An.convert(t.center):a,h=r.applyConstrain(f,i).center;t2(r,h);let d=r.clone();d.setCenter(h),d.setZoom(n?+t.zoom:i+Lu(a.lat,f.lat)),d.setBearing(t.bearing);let p=new Wr(to(r.centerPoint.x+t.offsetAsPoint.x,0,r.width),to(r.centerPoint.y+t.offsetAsPoint.y,0,r.height));d.setLocationAtPoint(h,p);let g=(t.offset&&t.offsetAsPoint.mag())>0?d.center:h,m=n?+t.zoom:i+Lu(a.lat,g.lat),y=i+Lu(a.lat,0),_=m+Lu(g.lat,0),v=Df(a.lng,g.lng),x=Df(a.lat,g.lat),S=Vc(_-y);return c=m!==i,{easeFunc:M=>{if(w9(s,l)||mz({startEulerAngles:s,endEulerAngles:l,tr:r,k:M,useSlerp:s.roll!=l.roll}),u&&r.interpolatePadding(o,t.padding,M),t.around)To("Easing around a point is not supported under globe projection."),r.setLocationAtPoint(t.around,t.aroundPoint);else{let C=M*(_>y?Math.min(2,S):Math.max(.5,S))**(1-M),w=bz(a,v,x,C);r.setCenter(w.wrap())}if(c){let C=Zs.number(y,_,M)+Lu(0,r.center.lat);r.setZoom(C)}},isZooming:c,elevationCenter:g}}handleFlyTo(r,t){let i=t.zoom!==void 0,a=r.center,o=r.zoom,s=r.padding,l=!r.isPaddingEqual(t.padding),n=r.applyConstrain(An.convert(t.center||t.locationAtOffset),o).center,u=i?+t.zoom:r.zoom+Lu(r.center.lat,n.lat),c=r.clone();c.setCenter(n),c.setZoom(u),c.setBearing(t.bearing);let f=new Wr(to(r.centerPoint.x+t.offsetAsPoint.x,0,r.width),to(r.centerPoint.y+t.offsetAsPoint.y,0,r.height));c.setLocationAtPoint(n,f);let h=c.center;t2(r,h);let d=noe(r,a,h),p=o+Lu(a.lat,0),g=u+Lu(h.lat,0),m=Vc(g-p),y=typeof t.minZoom=="number"?+t.minZoom:r.minZoom,_=Math.max(y,r.minZoom)+Lu(h.lat,0),v=Math.min(_,p,g)+Lu(0,h.lat),x=r.applyConstrain(h,v).zoom+Lu(h.lat,0),S=Vc(x-p),M=Df(a.lng,h.lng),C=Df(a.lat,h.lat);return{easeFunc:(w,k,A,b)=>{let E=bz(a,M,C,A);l&&r.interpolatePadding(s,t.padding,w);let T=w===1?h:E;r.setCenter(T.wrap());let F=p+Ku(k);r.setZoom(w===1?u:F+Lu(0,T.lat))},scaleOfZoom:m,targetCenter:h,scaleOfMinZoom:S,pixelPathLength:d}}static solveVectorScale(r,t,i,a,o){let s=o,l=a==="x"?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],n=[i[3],i[7],i[11],i[15]],u=r[0]*l[0]+r[1]*l[1]+r[2]*l[2],c=r[0]*n[0]+r[1]*n[1]+r[2]*n[2],f=t[0]*l[0]+t[1]*l[1]+t[2]*l[2],h=t[0]*n[0]+t[1]*n[1]+t[2]*n[2],d=(f+l[3]-s*h-s*n[3])/(f-u-s*h+s*c);return f+s*c===u+s*h||n[3]*(u-f)+l[3]*(h-c)+u*h===f*c?null:d}static getLesserNonNegativeNonNull(r,t){return t!==null&&t>=0&&t{for(let o in this.tileManagers){let s=this.tileManagers[o].getSource().type;(s==="vector"||s==="geojson")&&this.tileManagers[o].reload()}},this.map=e,this.dispatcher=new bM(VA(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(o,s)=>this.getGlyphs(o,s)),this.dispatcher.registerMessageHandler("GI",(o,s)=>this.getImages(o,s)),this.dispatcher.registerMessageHandler("GDA",(o,s)=>this.getDashes(o,s)),this.imageManager=new Kz,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(e._missingStyleImageResolver),this.patternAtlas=new Jz(this.imageManager);let a=((t=e._container)==null?void 0:t.lang)||typeof document<"u"&&((i=document.documentElement)==null?void 0:i.lang)||void 0;this.glyphManager=new nB(e._requestManager,r.localIdeographFontFamily,a),this.lineAtlas=new hB(256,512),this.crossTileSymbolIndex=new zM,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",X4()),jg().on(x2,this._rtlPluginLoaded),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;let s=this.tileManagers[o.sourceId];if(!s)return;let l=s.getSource();if(l?.vectorLayerIds)for(let n in this._layers){let u=this._layers[n];u.source===l.id&&this._validateLayer(u)}})}_setInitialValues(){var e;this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new jx,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new(((e=this.crossTileSymbolIndex)==null?void 0:e.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(e,r){var t,i,a;this._checkLoaded();let o=r===null?(a=(i=(t=this.stylesheet.state)==null?void 0:t[e])==null?void 0:i.default)!=null?a:null:r;if(Td(o,this._globalState[e]))return this;this._globalState[e]=o,this._applyGlobalStateChanges([e])}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();let r=[];for(let t in e)Td(this._globalState[t],e[t].default)||(r.push(t),this._globalState[t]=e[t].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(e){if(e.length===0)return;let r=new Set,t={};for(let i of e){t[i]=this._globalState[i];for(let a in this._layers){let o=this._layers[a],s=o.getLayoutAffectingGlobalStateRefs(),l=o.getPaintAffectingGlobalStateRefs(),n=o.getVisibilityAffectingGlobalStateRefs();if(s.has(i)&&r.add(o.source),l.has(i))for(let{name:u,value:c}of l.get(i))this._updatePaintProperty(o,u,c);n?.has(i)&&(o.recalculateVisibility(),this._updateLayer(o))}}this.dispatcher.broadcast("UGS",t);for(let i in this.tileManagers)r.has(i)&&(this._reloadSource(i),this._changed=!0)}loadURL(e){return Xr(this,arguments,function*(r,t={},i){this.fire(new Nf("dataloading")),t.validate=typeof t.validate!="boolean"||t.validate,this._loadStyleRequest=new AbortController;let a=this._loadStyleRequest;try{let o=yield this.map._requestManager.transformRequest(r,"Style");Y4(a.signal);let s=yield vg(o,a);this._loadStyleRequest===a&&(this._loadStyleRequest=null),this._load(s.data,t,i)}catch(o){this._loadStyleRequest===a&&(this._loadStyleRequest=null),o&&!a.signal.aborted&&this.fire(new Ln(Zu(o)))}})}loadJSON(e,r={},t){this.fire(new Nf("dataloading")),this._frameRequest=new AbortController,yc.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,r.validate=r.validate!==!1,this._load(e,r,t)}).catch(()=>{})}loadEmpty(){this.fire(new Nf("dataloading")),this._load(tO,{validate:!1})}_load(e,r,t){var i,a,o;let s=r.transformStyle?r.transformStyle(t,e):e;if(!(r.validate&&AL(this,s))){s=Ot({},s),this._loaded=!0,this.stylesheet=s;for(let l in s.sources)this.addSource(l,s.sources[l],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this.glyphManager.setFontFaces(s["font-faces"]),this._createLayers(),this.light=new lB((i=this.stylesheet.light)!=null?i:{},this._globalState),this._setProjectionInternal(((a=this.stylesheet.projection)==null?void 0:a.type)||"mercator"),this.sky=new fB(this.stylesheet.sky,this._globalState),this.map.setTerrain((o=this.stylesheet.terrain)!=null?o:null,{validate:!1}),this.fire(new Nf("data")),this.fire(new h2)}}_createLayers(){var e,r,t;let i=L5(this.stylesheet.layers);this.setGlobalState((e=this.stylesheet.state)!=null?e:null),this.dispatcher.broadcast("SL",i),this._order=i.map(a=>a.id),this._layers={},this._serializedLayers=null;for(let a of i){let o=$6(a,this._globalState);if(o.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=o,Gx(o)&&this.tileManagers[o.source]){let s=(t=(r=a.paint)==null?void 0:r["raster-fade-duration"])!=null?t:o.paint.get("raster-fade-duration");this.tileManagers[o.source].setRasterFadeDuration(s)}}}_loadSprite(e,r=!1,t=void 0){return Xr(this,null,function*(){this.imageManager.setLoaded(!1);let i=new AbortController;this._spriteRequest=i;let a;try{let o=yield rne(e,this.map._requestManager,this.map.getPixelRatio(),i);if(!o)return;for(let s in o){let{loaded:l,removed:n}=this.imageManager.setSpriteImages(s,o[s]);this._markImagesChanged(n),r&&this._markImagesChanged(l)}}catch(o){a=o,i.signal.aborted||this.fire(new Ln(a))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new Nf("data")),t?.(a)}})}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new Nf("data"))}_validateLayer(e){let r=this.tileManagers[e.source];if(!r)return;let t=e.sourceLayer;if(!t)return;let i=r.getSource();(i.type==="geojson"||i.vectorLayerIds&&!i.vectorLayerIds.includes(t))&&this.fire(new Ln(Error(`Source layer "${t}" does not exist on source "${i.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.tileManagers)if(!this.tileManagers[e].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(e,r=!1){let t=this._serializedAllLayers();if(!e||e.length===0)return Object.values(r?cf(t):t);let i=[];for(let a of e)if(t[a]){let o=r?cf(t[a]):t[a];i.push(o)}return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let r=Object.keys(this._layers);for(let t of r){let i=this._layers[t];i.type!=="custom"&&(e[t]=i.serialize())}return e}hasTransitions(){var e,r,t;if((e=this.light)!=null&&e.hasTransition()||(r=this.sky)!=null&&r.hasTransition()||(t=this.projection)!=null&&t.hasTransition())return!0;for(let i in this.tileManagers)if(this.tileManagers[i].hasTransition())return!0;for(let i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(e){if(!this._loaded)return;let r=this._changed;if(r){this._imagesListDirty&&(this._imagesListDirty=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1));let a=Object.keys(this._updatedLayers),o=Object.keys(this._removedLayers);(a.length||o.length)&&this._updateWorkerLayers(a,o);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw Error(`Invalid action ${l}`)}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this._resetUpdates()}let t={};for(let a in this.tileManagers){let o=this.tileManagers[a];t[a]=o.used,o.used=!1}let i=this.imageManager.listImages();for(let a of this._order){let o=this._layers[a];o.recalculate(e,i),!o.isHidden(e.zoom)&&o.source&&(this.tileManagers[o.source].used=!0)}for(let a in t){let o=this.tileManagers[a];!!t[a]!=!!o.used&&o.fire(new zs("data",{sourceDataType:"visibility",sourceId:a}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,r&&this.fire(new Nf("data"))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let r in this.tileManagers)this.tileManagers[r].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.tileManagers)this.tileManagers[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,r){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,r={}){var t;this._checkLoaded();let i=this.serialize();if(e=r.transformStyle?r.transformStyle(i,e):e,((t=r.validate)!=null?t:!0)&&AL(this,e))return!1;e=cf(e),e.layers=L5(e.layers);let a=ene(i,e),o=this._getOperationsToPerform(a);if(o.unimplemented.length>0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(o.operations.length===0)return!1;for(let s of o.operations)s();return this.stylesheet=e,this._serializedLayers=null,this.fire(new h2({style:this})),!0}_getOperationsToPerform(e){let r=[],t=[];for(let i of e)switch(i.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":r.push(()=>this.addLayer.apply(this,i.args));break;case"removeLayer":r.push(()=>this.removeLayer.apply(this,i.args));break;case"setPaintProperty":r.push(()=>this.setPaintProperty.apply(this,i.args));break;case"setLayoutProperty":r.push(()=>this.setLayoutProperty.apply(this,i.args));break;case"setFilter":r.push(()=>this.setFilter.apply(this,i.args));break;case"addSource":r.push(()=>this.addSource.apply(this,i.args));break;case"removeSource":r.push(()=>this.removeSource.apply(this,i.args));break;case"setLayerZoomRange":r.push(()=>this.setLayerZoomRange.apply(this,i.args));break;case"setLight":r.push(()=>this.setLight.apply(this,i.args));break;case"setGeoJSONSourceData":r.push(()=>this.setGeoJSONSourceData.apply(this,i.args));break;case"setGlyphs":r.push(()=>this.setGlyphs.apply(this,i.args));break;case"setFontFaces":r.push(()=>this.setFontFaces.apply(this,i.args));break;case"setSprite":r.push(()=>this.setSprite.apply(this,i.args));break;case"setTerrain":r.push(()=>this.map.setTerrain.apply(this,i.args));break;case"setSky":r.push(()=>this.setSky.apply(this,i.args));break;case"setProjection":this.setProjection.apply(this,i.args);break;case"setGlobalState":r.push(()=>this.setGlobalState.apply(this,i.args));break;case"setTransition":r.push(()=>{});break;default:t.push(i.command)}return{operations:r,unimplemented:t}}addImage(e,r){if(this.getImage(e)){this.fire(new Ln(Error(`An image named "${e}" already exists.`)));return}this.imageManager.addImage(e,r),this._afterImageUpdated(e)}updateImage(e,r){this.imageManager.updateImage(e,r)}getImage(e){return this.imageManager.getImage(e)}setMissingImageResolver(e){this.imageManager.setMissingImageResolver(e)}removeImage(e){if(!this.getImage(e)){this.fire(new Ln(Error(`An image named "${e}" does not exist.`)));return}this.imageManager.removeImage(e),this._afterImageUpdated(e)}_markImagesChanged(e){for(let r of e)this._changedImages[r]=!0}_afterImageUpdated(e){this._changedImages[e]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new Nf("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,r,t={}){var i;if(this._checkLoaded(),this.tileManagers[e]!==void 0)throw Error(`Source "${e}" already exists.`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(PT.has(r.type)&&this._validate(Hc.source,`sources.${e}`,r,null,t))return;(i=this.map)!=null&&i._collectResourceTiming&&(r.collectResourceTiming=!0);let a=this.tileManagers[e]=new A2(e,r,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:e})),a.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);for(let t in this._layers)if(this._layers[t].source===e)return this.fire(new Ln(Error(`Source "${e}" cannot be removed while layer "${t}" is using it.`)));let r=this.tileManagers[e];delete this.tileManagers[e],delete this._updatedSources[e],r.fire(new zs("data",{sourceDataType:"metadata",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,r){if(this._checkLoaded(),this.tileManagers[e]===void 0)throw Error(`There is no source with this ID=${e}`);let t=this.tileManagers[e].getSource();if(t.type!=="geojson")throw Error(`geojsonSource.type is ${t.type}, which is !== 'geojson`);t.setData(r),this._changed=!0}getSource(e){var r;return(r=this.tileManagers[e])==null?void 0:r.getSource()}addLayer(e,r,t={}){this._checkLoaded();let i=e.id;if(this.getLayer(i)){this.fire(new Ln(Error(`Layer "${i}" already exists on this map.`)));return}let a;if(e.type==="custom"){if(w6(this,vre(e)))return;a=$6(e,this._globalState)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(i,e.source),e=cf(e),e=yn(e,{source:i})),this._validate(Hc.layer,`layers.${i}`,e,{arrayIndex:-1},t))return;a=$6(e,this._globalState),this._validateLayer(a),a.setEventedParent(this,{layer:{id:i}})}let o=r?this._order.indexOf(r):this._order.length;if(r&&o===-1){this.fire(new Ln(Error(`Cannot add layer "${i}" before non-existing layer "${r}".`)));return}if(this._order.splice(o,0,i),this._layerOrderChanged=!0,this._layers[i]=a,this._removedLayers[i]&&a.source&&a.type!=="custom"){let s=this._removedLayers[i];delete this._removedLayers[i],s.type===a.type?(this._updatedSources[a.source]="reload",this.tileManagers[a.source].pause()):this._updatedSources[a.source]="clear"}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,r){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new Ln(Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));return}if(e===r)return;if(r&&!this._order.includes(r)){this.fire(new Ln(Error(`Cannot move layer "${e}" before non-existing layer "${r}".`)));return}let t=this._order.indexOf(e);this._order.splice(t,1);let i=r?this._order.indexOf(r):this._order.length;this._order.splice(i,0,e),this._layerOrderChanged=!0}removeLayer(e){var r;this._checkLoaded();let t=this._layers[e];if(!t){this.fire(new Ln(Error(`Cannot remove non-existing layer "${e}".`)));return}t.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=t,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],t.type==="symbol"&&t.source&&((r=this.tileManagers[t.source])==null||r.resetMaxContentElevation()),t.onRemove&&t.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,r,t){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new Ln(Error(`Cannot set the zoom range of non-existing layer "${e}".`)));return}(i.minzoom!==r||i.maxzoom!==t)&&(r!=null&&(i.minzoom=r),t!=null&&(i.maxzoom=t),this._updateLayer(i))}setFilter(e,r,t={}){this._checkLoaded();let i=this.getLayer(e);if(!i){this.fire(new Ln(Error(`Cannot filter non-existing layer "${e}".`)));return}if(!Td(i.filter,r)){if(r==null){i.setFilter(void 0),this._updateLayer(i);return}this._validate(Hc.filter,`layers.${i.id}.filter`,r,null,t)||(i.setFilter(cf(r)),this._updateLayer(i))}}getFilter(e){return cf(this.getLayer(e).filter)}setLayoutProperty(e,r,t,i={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new Ln(Error(`Cannot style non-existing layer "${e}".`)));return}Td(a.getLayoutProperty(r),t)||(a.setLayoutProperty(r,t,i),this._updateLayer(a))}getLayoutProperty(e,r){let t=this.getLayer(e);if(!t){this.fire(new Ln(Error(`Cannot get style of non-existing layer "${e}".`)));return}return t.getLayoutProperty(r)}setPaintProperty(e,r,t,i={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new Ln(Error(`Cannot style non-existing layer "${e}".`)));return}Td(a.getPaintProperty(r),t)||this._updatePaintProperty(a,r,t,i)}_updatePaintProperty(e,r,t,i={}){e.setPaintProperty(r,t,i)&&this._updateLayer(e),Gx(e)&&r==="raster-fade-duration"&&this.tileManagers[e.source].setRasterFadeDuration(t),this._changed=!0,this._updatedPaintProps[e.id]=!0,e.type==="symbol"&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(e,r){return this.getLayer(e).getPaintProperty(r)}setFeatureState(e,r){this._checkLoaded();let t=e.source,i=e.sourceLayer,a=this.tileManagers[t];if(a===void 0){this.fire(new Ln(Error(`The source '${t}' does not exist in the map's style.`)));return}let o=a.getSource().type;if(o==="geojson"&&i){this.fire(new Ln(Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(o==="vector"&&!i){this.fire(new Ln(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(e.id===void 0){this.fire(new Ln(Error("The feature id parameter must be provided.")));return}let s=["__proto__","constructor","prototype"];if(r&&Object.keys(r).some(l=>s.includes(l))){this.fire(new Ln(Error(`The feature state should not include one of the following keys: ${s}`)));return}a.setFeatureState(i,e.id,r)}removeFeatureState(e,r){this._checkLoaded();let t=e.source,i=this.tileManagers[t];if(i===void 0){this.fire(new Ln(Error(`The source '${t}' does not exist in the map's style.`)));return}let a=i.getSource().type,o=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!o){this.fire(new Ln(Error("The sourceLayer parameter must be provided for vector source types.")));return}if(r&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new Ln(Error("A feature id is required to remove its specific state property.")));return}i.removeFeatureState(o,e.id,r)}getFeatureState(e){this._checkLoaded();let r=e.source,t=e.sourceLayer,i=this.tileManagers[r];if(i===void 0){this.fire(new Ln(Error(`The source '${r}' does not exist in the map's style.`)));return}if(i.getSource().type==="vector"&&!t){this.fire(new Ln(Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new Ln(Error("The feature id parameter must be provided."))),i.getFeatureState(t,e.id)}getTransition(){var e;return yn({duration:300,delay:0},(e=this.stylesheet)==null?void 0:e.transition)}serialize(){if(!this._loaded)return;let e=$4(this.tileManagers,a=>a.serialize()),r=this._serializeByIds(this._order,!0),t=this.map.getTerrain()||void 0,i=this.stylesheet;return b9({version:i.version,name:i.name,metadata:i.metadata,light:i.light,sky:i.sky,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,"font-faces":i["font-faces"],transition:i.transition,projection:i.projection,state:i.state,sources:e,layers:r,terrain:t},a=>a!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.tileManagers[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.tileManagers[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let r=o=>this._layers[o].type==="fill-extrusion",t={},i=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(r(s)){t[s]=o;for(let l of e){let n=l[s];if(n)for(let u of n)i.push(u)}}}i.sort((o,s)=>s.intersectionZ-o.intersectionZ);let a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(r(s))for(let l=i.length-1;l>=0;l--){let n=i[l].feature;if(t[n.layer.id]this.map.terrain.getElevation(u,c,f):void 0));return this.placement&&a.push(mne(this._layers,o,this.tileManagers,e,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,r){r?.filter&&this._validate(Hc.filter,"querySourceFeatures.filter",r.filter,null,r);let t=this.tileManagers[e];return t?gne(t,r?ar(Ot({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(e,r={}){this._checkLoaded();let t=this.light.getLight(),i=!1;for(let o in e)if(!Td(e[o],t[o])){i=!0;break}if(!i)return;let a={now:hs(),transition:yn({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}getProjection(){var e;return(e=this.stylesheet)==null?void 0:e.projection}setProjection(e){this._checkLoaded();let r=e??{type:"mercator"};if(this.stylesheet.projection=e,this.projection){if(this.projection.name===r.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(r.type)}getSky(){var e;return(e=this.stylesheet)==null?void 0:e.sky}setSky(e,r={}){this._checkLoaded();let t=this.getSky(),i=!1;if(!e&&!t)return;if(e&&!t)i=!0;else if(!e&&t)i=!0;else for(let o in e)if(!Td(e[o],t[o])){i=!0;break}if(!i)return;let a={now:hs(),transition:yn({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,r),this.sky.updateTransitions(a)}_setProjectionInternal(e){var r;let t=moe(e,(r=this.map._camera)==null?void 0:r.transform.constrainOverride,this._globalState);this.projection=t.projection,this.map.migrateProjection(t.transform,t.cameraHelper);for(let i in this.tileManagers)this.tileManagers[i].reload()}_validate(e,r,t,i,a={}){return a.validate!==!1&&Q1(this,e,Ot({key:r,style:this.serialize(),value:t},i),a)}_remove(e=!0){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),jg().off(x2,this._rtlPluginLoaded);for(let r in this._layers)this._layers[r].setEventedParent(null);for(let r in this.tileManagers){let t=this.tileManagers[r];t.setEventedParent(null),t.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.tileManagers[e].clearTiles()}_reloadSource(e){this.tileManagers[e].resume(),this.tileManagers[e].reload()}_updateSources(e){for(let r in this.tileManagers)this.tileManagers[r].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.tileManagers)this._reloadSource(e)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(e,r,t){var i;let a=this.pauseablePlacement;return!a||this._symbolPlacementTriggered||this._placedProjectionTransition!==((i=this.projection)==null?void 0:i.transitionState)||a._showCollisionBoxes!==r||a.placement.collisionGroups.crossSourceCollisions!==t||a.placement.transform.renderWorldCopies!==e.renderWorldCopies||!RK(a.placement.transform.modelViewProjectionMatrix,e.modelViewProjectionMatrix)}_updatePlacement(e,r,t,i,a=!1){var o,s;let l=!1,n=!1,u={};for(let h of this._order){let d=this._layers[h];if(d.type!=="symbol")continue;if(!u[d.source]){let g=this.tileManagers[d.source];u[d.source]=g.getRenderableIds(!0).map(m=>g.getTileByID(m)).sort((m,y)=>y.tileID.overscaledZ-m.tileID.overscaledZ||(m.tileID.isLessThan(y.tileID)?-1:1))}let p=this.crossTileSymbolIndex.addLayer(d,u[d.source],e.center.lng);l||(l=p)}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||(a=this._layerOrderChanged||t===0);let c=l||this._placementInputsChanged(e,r,i),f=((o=this.pauseablePlacement)==null?void 0:o.isDone())&&!this.placement.stillRecent(hs(),e.zoom);if((a||!this.pauseablePlacement||f&&(c||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=(s=this.projection)==null?void 0:s.transitionState,this.pauseablePlacement=new IB(e,this.map.terrain,this._order,a,r,t,i,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?c&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,u),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(hs()),n=!0),l&&this.pauseablePlacement.placement.setStale()),n||l)for(let h of this._order){let d=this._layers[h];d.type==="symbol"&&this.placement.updateLayerOpacities(d,u[d.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(hs())}_releaseSymbolFadeTiles(){for(let e in this.tileManagers)this.tileManagers[e].releaseSymbolFadeTiles()}getImages(e,r){return Xr(this,null,function*(){let t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();let i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,r.icons),t})}getGlyphs(e,r){return Xr(this,null,function*(){let t=yield this.glyphManager.getGlyphs(r.stacks),i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,r={}){this._checkLoaded(),!(e&&this._validate(Hc.glyphs,"glyphs",e,null,r))&&(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(e){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=e,this.glyphManager.setFontFaces(e)}getDashes(e,r){return Xr(this,null,function*(){let t={};for(let[i,a]of Object.entries(r.dashes))t[i]=this.lineAtlas.getDash(a.dasharray,a.round);return t})}addSprite(e,r,t={},i){this._checkLoaded();let a=[{id:e,url:r}],o=[...Xb(this.stylesheet.sprite),...a];this._validate(Hc.sprite,"sprite",o,null,t)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,i))}removeSprite(e){this._checkLoaded();let r=Xb(this.stylesheet.sprite);if(!r.find(i=>i.id===e)){this.fire(new Ln(Error(`Sprite "${e}" doesn't exists on this map.`)));return}let t=this.imageManager.removeSpriteImages(e);this._markImagesChanged(t),r.splice(r.findIndex(i=>i.id===e),1),this.stylesheet.sprite=r.length>0?r:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new Nf("data"))}getSprite(){return Xb(this.stylesheet.sprite)}setSprite(e,r={},t){this._checkLoaded(),!(e&&this._validate(Hc.sprite,"sprite",e,null,r))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,t):(this._unloadSprite(),t&&t(null)))}destroy(){this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null));for(let e in this.tileManagers){let r=this.tileManagers[e];r.setEventedParent(null),r.onRemove(this.map)}this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy();for(let e in this._layers){let r=this._layers[e];r.setEventedParent(null),r.onRemove&&r.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}},rO=ul([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),iO=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,r,t,i,a,o,s,l,n){this.context=e;let u=this.boundPaintVertexBuffers.length!==i.length;for(let c=0;!u&&c({u_depth:new En(e,r.u_depth),u_terrain:new En(e,r.u_terrain)}),nO=(e,r)=>({u_texture:new En(e,r.u_texture),u_ele_delta:new Xa(e,r.u_ele_delta),u_fog_matrix:new vh(e,r.u_fog_matrix),u_fog_color:new lp(e,r.u_fog_color),u_fog_ground_blend:new Xa(e,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new Xa(e,r.u_fog_ground_blend_opacity),u_horizon_color:new lp(e,r.u_horizon_color),u_horizon_fog_blend:new Xa(e,r.u_horizon_fog_blend),u_is_globe_mode:new Xa(e,r.u_is_globe_mode)}),oO=(e,r)=>({u_ele_delta:new Xa(e,r.u_ele_delta)}),sO=(e,r,t,i,a)=>({u_texture:0,u_ele_delta:e,u_fog_matrix:r,u_fog_color:t?t.properties.get("fog-color"):ro.white,u_fog_ground_blend:t?t.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:t?t.calculateFogBlendOpacity(i):0,u_horizon_color:t?t.properties.get("horizon-color"):ro.white,u_horizon_fog_blend:t?t.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),lO=e=>({u_ele_delta:e}),Qg={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2},uO={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]},F2=class{constructor(e,r,t){this.context=e,this.binding=r,this.contentWords=t.contentWords;let i=e.gl;this.buffer=i.createBuffer(),i.bindBuffer(i.UNIFORM_BUFFER,this.buffer),i.bufferData(i.UNIFORM_BUFFER,t.sizeWords*4,i.DYNAMIC_DRAW),i.bindBufferBase(i.UNIFORM_BUFFER,r,this.buffer),this.uploaded=new Float32Array(t.sizeWords),this.pending=new Float32Array(t.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let e=this.context.gl,r=!this.hasData;if(!r){let t=this.pendingWords,i=this.uploadedWords;for(let a=0;a=0&&(this.attributes[k]={location:A,isInteger:w.has(k)})}u.deleteShader(M),u.deleteShader(S);for(let k of y)if(k&&!C[k]){let A=u.getUniformLocation(this.program,k);A&&(C[k]=A)}this.fixedUniforms=i(e,C),this.terrainUniforms=aO(e,C),this.binderUniforms=t?t.getUniforms(e,C):[]}draw(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p,g,m,y,_){var v;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(t),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(o),l){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,l.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,l.texture);for(let M in this.terrainUniforms)this.terrainUniforms[M].set(l[M]);boe(e.terrainUniformBuffer,l)}if(n&&_oe(e.projectionUniformBuffer,n),s)for(let M in this.fixedUniforms)this.fixedUniforms[M].set(s[M]);g&&g.setUniforms(e,this.binderUniforms,d,{zoom:p});let S=0;switch(r){case x.LINES:S=2;break;case x.TRIANGLES:S=3;break;case x.LINE_STRIP:S=1}for(let M of h.get())M.vaos||(M.vaos={}),(v=M.vaos)[u]||(v[u]=new iO),M.vaos[u].bind(e,this,c,g?g.getPaintVertexBuffers():[],f,M.vertexOffset,m,y,_),x.drawElements(r,M.primitiveLength*S,x.UNSIGNED_SHORT,M.primitiveOffset*S*2)}},fO=(e,r)=>({u_lightpos:new vc(e,r.u_lightpos),u_lightpos_globe:new vc(e,r.u_lightpos_globe),u_lightintensity:new Xa(e,r.u_lightintensity),u_lightcolor:new vc(e,r.u_lightcolor),u_vertical_gradient:new Xa(e,r.u_vertical_gradient),u_opacity:new Xa(e,r.u_opacity),u_fill_translate:new mo(e,r.u_fill_translate)}),hO=(e,r)=>({u_lightpos:new vc(e,r.u_lightpos),u_lightpos_globe:new vc(e,r.u_lightpos_globe),u_lightintensity:new Xa(e,r.u_lightintensity),u_lightcolor:new vc(e,r.u_lightcolor),u_vertical_gradient:new Xa(e,r.u_vertical_gradient),u_height_factor:new Xa(e,r.u_height_factor),u_opacity:new Xa(e,r.u_opacity),u_fill_translate:new mo(e,r.u_fill_translate),u_image:new En(e,r.u_image),u_texsize:new mo(e,r.u_texsize),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade)}),KM=(e,r,t,i)=>{let a=e.style.light,o=a.getCartesianPosition(),s=u9();a.properties.get("anchor")==="viewport"&&CK(s,e.transform.bearingInRadians),jK(o,o,s);let l=e.transform.transformLightDirection(o),n=a.properties.get("color");return{u_lightpos:o,u_lightpos_globe:l,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[n.r,n.g,n.b],u_vertical_gradient:+r,u_opacity:t,u_fill_translate:i}},dO=(e,r,t,i,a,o,s)=>yn(KM(e,r,t,i),Mz(o,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),pO=(e,r)=>({u_fill_translate:new mo(e,r.u_fill_translate)}),vO=(e,r)=>({u_image:new En(e,r.u_image),u_texsize:new mo(e,r.u_texsize),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade),u_sdf_pattern:new En(e,r.u_sdf_pattern),u_fill_translate:new mo(e,r.u_fill_translate)}),mO=(e,r)=>({u_fill_translate:new mo(e,r.u_fill_translate)}),gO=(e,r)=>({u_image:new En(e,r.u_image),u_texsize:new mo(e,r.u_texsize),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade),u_sdf_pattern:new En(e,r.u_sdf_pattern),u_fill_translate:new mo(e,r.u_fill_translate)}),JM=(e,r,t,i,a)=>yn(Mz(r,e,t),{u_fill_translate:i,u_sdf_pattern:+!!a}),yO=e=>({u_fill_translate:e}),_O=e=>({u_fill_translate:e}),xO=(e,r,t,i,a)=>JM(e,r,t,i,a),bO=(e,r)=>({u_scale_with_map:new En(e,r.u_scale_with_map),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_extrude_scale:new mo(e,r.u_extrude_scale),u_globe_extrude_scale:new Xa(e,r.u_globe_extrude_scale),u_translate:new mo(e,r.u_translate)}),wO=(e,r,t,i,a)=>{let o=e.transform,s,l,n=0;if(t.paint.get("circle-pitch-alignment")==="map"){let u=Cf(r,1,o.zoom);s=!0,l=[u,u],n=u/(Bi*2**r.tileID.overscaledZ)*2*Math.PI*a}else s=!1,l=o.pixelsToGLUnits;return{u_scale_with_map:+(t.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+s,u_extrude_scale:l,u_globe_extrude_scale:n,u_translate:i}},TO=(e,r)=>({u_color:new lp(e,r.u_color),u_overlay:new En(e,r.u_overlay),u_overlay_scale:new Xa(e,r.u_overlay_scale)}),QM=(e,r=1)=>({u_color:e,u_overlay:0,u_overlay_scale:r}),AO=(e,r)=>({u_extrude_scale:new Xa(e,r.u_extrude_scale),u_intensity:new Xa(e,r.u_intensity),u_globe_extrude_scale:new Xa(e,r.u_globe_extrude_scale)}),MO=(e,r)=>({u_matrix:new vh(e,r.u_matrix),u_image:new En(e,r.u_image),u_color_ramp:new En(e,r.u_color_ramp),u_opacity:new Xa(e,r.u_opacity)}),eS=(e,r,t,i)=>{let a=Cf(e,1,r)/(Bi*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:Cf(e,1,r),u_intensity:t,u_globe_extrude_scale:a}},tS=(e,r,t,i)=>{let a=Rp();return $h(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:t,u_color_ramp:i,u_opacity:r.paint.get("heatmap-opacity")}},SO=(e,r)=>({u_image:new En(e,r.u_image),u_latrange:new mo(e,r.u_latrange),u_exaggeration:new Xa(e,r.u_exaggeration),u_altitudes:new eA(e,r.u_altitudes),u_azimuths:new eA(e,r.u_azimuths),u_accent:new lp(e,r.u_accent),u_method:new En(e,r.u_method),u_shadows:new QT(e,r.u_shadows),u_highlights:new QT(e,r.u_highlights)}),EO=(e,r)=>({u_matrix:new vh(e,r.u_matrix),u_image:new En(e,r.u_image),u_dimension:new mo(e,r.u_dimension),u_zoom:new Xa(e,r.u_zoom),u_unpack:new Sm(e,r.u_unpack)}),kO=(e,r,t)=>{let i=t.paint.get("hillshade-accent-color"),a;switch(t.paint.get("hillshade-method")){case"basic":a=4;break;case"combined":a=1;break;case"igor":a=2;break;case"multidirectional":a=3;break;default:a=0}let o=t.getIlluminationProperties();for(let s=0;s{let t=r.stride,i=Rp();return $h(i,0,Bi,-Bi,0,0,1),Ol(i,i,[0,-Bi,0]),{u_matrix:i,u_image:1,u_dimension:[t,t],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}},DO=(e,r)=>({u_image:new En(e,r.u_image),u_unpack:new Sm(e,r.u_unpack),u_dimension:new mo(e,r.u_dimension),u_elevation_stops:new En(e,r.u_elevation_stops),u_color_stops:new En(e,r.u_color_stops),u_color_ramp_size:new En(e,r.u_color_ramp_size),u_opacity:new Xa(e,r.u_opacity)}),LO=(e,r,t=0)=>({u_image:0,u_unpack:r.getUnpackVector(),u_dimension:[r.stride,r.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:t,u_opacity:e.paint.get("color-relief-opacity")}),FO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio)}),PO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_image_height:new Xa(e,r.u_image_height)}),IO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_texsize:new mo(e,r.u_texsize),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade)}),RO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_mix:new Xa(e,r.u_mix),u_tileratio:new Xa(e,r.u_tileratio),u_crossfade_from:new Xa(e,r.u_crossfade_from),u_crossfade_to:new Xa(e,r.u_crossfade_to),u_lineatlas_width:new Xa(e,r.u_lineatlas_width),u_lineatlas_height:new Xa(e,r.u_lineatlas_height)}),zO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_image_height:new Xa(e,r.u_image_height),u_tileratio:new Xa(e,r.u_tileratio),u_crossfade_from:new Xa(e,r.u_crossfade_from),u_crossfade_to:new Xa(e,r.u_crossfade_to),u_image_dash:new En(e,r.u_image_dash),u_mix:new Xa(e,r.u_mix),u_lineatlas_width:new Xa(e,r.u_lineatlas_width),u_lineatlas_height:new Xa(e,r.u_lineatlas_height)}),ty=(e,r,t,i)=>{let a=e.transform;return{u_translation:Sz(e,r,t),u_ratio:i/Cf(r,1,a.zoom)}},BO=(e,r,t,i,a)=>yn(ty(e,r,t,i),{u_image:0,u_image_height:a}),OO=(e,r,t,i,a)=>{let o=e.transform,s=oM(r,o);return{u_translation:Sz(e,r,t),u_texsize:r.imageAtlasTexture.size,u_ratio:i/Cf(r,1,o.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},NO=(e,r,t,i,a)=>{let o=e.transform,s=oM(r,o);return yn(ty(e,r,t,i),{u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},jO=(e,r,t,i,a,o)=>{let s=e.transform,l=oM(r,s);return yn(ty(e,r,t,i),{u_image:0,u_image_height:o,u_tileratio:l,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},UO=(e,r)=>({u_image:new En(e,r.u_image),u_opacity:new Xa(e,r.u_opacity)}),qO=(e,r)=>({u_image:r,u_opacity:e}),VO=(e,r)=>({u_is_size_zoom_constant:new En(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new En(e,r.u_is_size_feature_constant),u_size_t:new Xa(e,r.u_size_t),u_size:new Xa(e,r.u_size),u_rotate_symbol:new En(e,r.u_rotate_symbol),u_label_plane_matrix:new vh(e,r.u_label_plane_matrix),u_coord_matrix:new vh(e,r.u_coord_matrix),u_is_text:new En(e,r.u_is_text),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_is_along_line:new En(e,r.u_is_along_line),u_is_variable_anchor:new En(e,r.u_is_variable_anchor),u_texsize:new mo(e,r.u_texsize),u_texture:new En(e,r.u_texture),u_translation:new mo(e,r.u_translation),u_pitched_scale:new Xa(e,r.u_pitched_scale),u_is_offset:new En(e,r.u_is_offset),u_height_anchor_ground:new En(e,r.u_height_anchor_ground)}),GO=(e,r)=>({u_is_size_zoom_constant:new En(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new En(e,r.u_is_size_feature_constant),u_size_t:new Xa(e,r.u_size_t),u_size:new Xa(e,r.u_size),u_rotate_symbol:new En(e,r.u_rotate_symbol),u_label_plane_matrix:new vh(e,r.u_label_plane_matrix),u_coord_matrix:new vh(e,r.u_coord_matrix),u_is_text:new En(e,r.u_is_text),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_is_along_line:new En(e,r.u_is_along_line),u_is_variable_anchor:new En(e,r.u_is_variable_anchor),u_texsize:new mo(e,r.u_texsize),u_texture:new En(e,r.u_texture),u_gamma_scale:new Xa(e,r.u_gamma_scale),u_is_halo:new En(e,r.u_is_halo),u_is_plain:new En(e,r.u_is_plain),u_translation:new mo(e,r.u_translation),u_pitched_scale:new Xa(e,r.u_pitched_scale),u_is_offset:new En(e,r.u_is_offset),u_height_anchor_ground:new En(e,r.u_height_anchor_ground)}),HO=(e,r)=>({u_is_size_zoom_constant:new En(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new En(e,r.u_is_size_feature_constant),u_size_t:new Xa(e,r.u_size_t),u_size:new Xa(e,r.u_size),u_rotate_symbol:new En(e,r.u_rotate_symbol),u_label_plane_matrix:new vh(e,r.u_label_plane_matrix),u_coord_matrix:new vh(e,r.u_coord_matrix),u_is_text:new En(e,r.u_is_text),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_is_along_line:new En(e,r.u_is_along_line),u_is_variable_anchor:new En(e,r.u_is_variable_anchor),u_texsize:new mo(e,r.u_texsize),u_texsize_icon:new mo(e,r.u_texsize_icon),u_texture:new En(e,r.u_texture),u_texture_icon:new En(e,r.u_texture_icon),u_gamma_scale:new Xa(e,r.u_gamma_scale),u_is_halo:new En(e,r.u_is_halo),u_translation:new mo(e,r.u_translation),u_pitched_scale:new Xa(e,r.u_pitched_scale),u_is_offset:new En(e,r.u_is_offset),u_height_anchor_ground:new En(e,r.u_height_anchor_ground)}),rS=(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p)=>({u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_rotate_symbol:+t,u_label_plane_matrix:l,u_coord_matrix:n,u_is_text:+c,u_pitch_with_map:+i,u_is_along_line:a,u_is_variable_anchor:o,u_texsize:f,u_texture:0,u_translation:u,u_pitched_scale:h,u_is_offset:d,u_height_anchor_ground:+p}),iS=(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p,g)=>{let m=s.transform;return yn(rS(e,r,t,i,a,o,s,l,n,u,c,f,d,p,g),{u_gamma_scale:i?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_is_halo:+!!h,u_is_plain:1})},$O=(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p)=>yn(iS(e,r,t,i,a,o,s,l,n,u,!0,c,!0,h,d,p),{u_texsize_icon:f,u_texture_icon:1}),WO=(e,r)=>({u_opacity:new Xa(e,r.u_opacity),u_color:new lp(e,r.u_color)}),YO=(e,r)=>({u_opacity:new Xa(e,r.u_opacity),u_image:new En(e,r.u_image),u_pattern_tl_a:new mo(e,r.u_pattern_tl_a),u_pattern_br_a:new mo(e,r.u_pattern_br_a),u_pattern_tl_b:new mo(e,r.u_pattern_tl_b),u_pattern_br_b:new mo(e,r.u_pattern_br_b),u_texsize:new mo(e,r.u_texsize),u_mix:new Xa(e,r.u_mix),u_pattern_size_a:new mo(e,r.u_pattern_size_a),u_pattern_size_b:new mo(e,r.u_pattern_size_b),u_scale_a:new Xa(e,r.u_scale_a),u_scale_b:new Xa(e,r.u_scale_b),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new Xa(e,r.u_tile_units_to_pixels)}),XO=(e,r)=>({u_opacity:e,u_color:r}),ZO=(e,r,t,i,a)=>yn(Toe(t,a,r,i),{u_opacity:e}),KO=(e,r)=>({u_sun_pos:new vc(e,r.u_sun_pos),u_atmosphere_blend:new Xa(e,r.u_atmosphere_blend),u_globe_position:new vc(e,r.u_globe_position),u_globe_radius:new Xa(e,r.u_globe_radius),u_inv_proj_matrix:new vh(e,r.u_inv_proj_matrix)}),JO=(e,r,t,i,a)=>({u_sun_pos:e,u_atmosphere_blend:r,u_globe_position:t,u_globe_radius:i,u_inv_proj_matrix:a}),QO=(e,r)=>({u_sky_color:new lp(e,r.u_sky_color),u_horizon_color:new lp(e,r.u_horizon_color),u_horizon:new mo(e,r.u_horizon),u_horizon_normal:new mo(e,r.u_horizon_normal),u_sky_horizon_blend:new Xa(e,r.u_sky_horizon_blend),u_sky_blend:new Xa(e,r.u_sky_blend),u_inv_proj_matrix:new vh(e,r.u_inv_proj_matrix),u_globe_position:new vc(e,r.u_globe_position),u_globe_radius:new Xa(e,r.u_globe_radius)}),eN=(e,r,t)=>{let i=Math.cos(r.rollInRadians),a=Math.sin(r.rollInRadians),o=lg(r),s=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(r.width/2-o*a)*t,(r.height/2+o*i)*t],u_horizon_normal:[-a,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*r.height/2*t,u_sky_blend:s,u_inv_proj_matrix:r.inverseProjectionMatrix,u_globe_position:_z(r),u_globe_radius:Nm(r.worldSize,r.center.lat)}},ry=(e,r)=>({}),tN={fillExtrusion:fO,fillExtrusionPattern:hO,fill:pO,fillPattern:vO,fillOutline:mO,fillOutlinePattern:gO,circle:bO,collisionBox:ry,collisionCircle:ry,debug:TO,depth:ry,clippingMask:ry,heatmap:AO,heatmapTexture:MO,hillshade:SO,hillshadePrepare:EO,colorRelief:DO,line:FO,lineGradient:PO,linePattern:IO,lineSDF:RO,lineGradientSDF:zO,layerOpacity:UO,raster:pB,symbolIcon:VO,symbolSDF:GO,symbolTextAndIcon:HO,background:WO,backgroundPattern:YO,terrain:nO,terrainDepth:oO,atmosphere:KO,sky:QO},rN=class{constructor(e,r,t){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!t,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let r=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},aS={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},iN=class{constructor(e,r,t,i){this.length=r.length,this.attributes=t,this.itemSize=r.bytesPerElement,this.dynamicDraw=i,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,r){for(let t of this.attributes){let i=r.attributes[t.name];i!==void 0&&e.enableVertexAttribArray(i.location)}}setVertexAttribPointers(e,r,t){for(let i of this.attributes){let a=r.attributes[i.name];if(a!==void 0){let o=i.offset+this.itemSize*(t||0);a.isInteger?e.vertexAttribIPointer(a.location,i.components,e[aS[i.type]],this.itemSize,o):e.vertexAttribPointer(a.location,i.components,e[aS[i.type]],!1,this.itemSize,o)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},os=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},aN=class extends os{getDefault(){return ro.transparent}set(e){let r=this.current;(e.r!==r.r||e.g!==r.g||e.b!==r.b||e.a!==r.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},nN=class extends os{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},oN=class extends os{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},sN=class extends os{getDefault(){return[!0,!0,!0,!0]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},lN=class extends os{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},uN=class extends os{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},cN=class extends os{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let r=this.current;(e.func!==r.func||e.ref!==r.ref||e.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},fN=class extends os{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},hN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=e,this.dirty=!1}},dN=class extends os{getDefault(){return[0,1]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},pN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=e,this.dirty=!1}},vN=class extends os{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},mN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.BLEND):r.disable(r.BLEND),this.current=e,this.dirty=!1}},gN=class extends os{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},yN=class extends os{getDefault(){return ro.transparent}set(e){let r=this.current;(e.r!==r.r||e.g!==r.g||e.b!==r.b||e.a!==r.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},_N=class extends os{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},xN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=e,this.dirty=!1}},bN=class extends os{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},wN=class extends os{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},TN=class extends os{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},AN=class extends os{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},MN=class extends os{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},SN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},EN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},kN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,e),this.current=e,this.dirty=!1}},CN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},DN=class extends os{getDefault(){return null}set(e){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},LN=class extends os{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},FN=class extends os{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},PN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},IN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},P2=class extends os{constructor(e,r){super(e),this.context=e,this.parent=r}getDefault(){return null}},RN=class extends P2{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},zN=class extends P2{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},BN=class extends P2{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},ON=class{constructor(e,r,t,i,a){this.context=e,this.width=r,this.height=t;let o=e.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new RN(e,s),i)this.depthAttachment=a?new BN(e,s):new zN(e,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,r=this.colorAttachment.get();if(r&&e.deleteTexture(r),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}},nS=aM([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),pf=nS.offsets,cl=class{constructor(e,r,t){this.blendFunction=e,this.blendColor=r,this.mask=t}},cl.Replace=[1,0],cl.disabled=new cl(cl.Replace,ro.transparent,[!1,!1,!1,!1]),cl.unblended=new cl(cl.Replace,ro.transparent,[!0,!0,!0,!0]),cl.alphaBlended=new cl([1,771],ro.transparent,[!0,!0,!0,!0]),NN=class{constructor(e){this.gl=e,this.clearColor=new aN(this),this.clearDepth=new nN(this),this.clearStencil=new oN(this),this.colorMask=new sN(this),this.depthMask=new lN(this),this.stencilMask=new uN(this),this.stencilFunc=new cN(this),this.stencilOp=new fN(this),this.stencilTest=new hN(this),this.depthRange=new dN(this),this.depthTest=new pN(this),this.depthFunc=new vN(this),this.blend=new mN(this),this.blendFunc=new gN(this),this.blendColor=new yN(this),this.blendEquation=new _N(this),this.cullFace=new xN(this),this.cullFaceSide=new bN(this),this.frontFace=new wN(this),this.program=new TN(this),this.activeTexture=new AN(this),this.viewport=new MN(this),this.bindFramebuffer=new SN(this),this.bindRenderbuffer=new EN(this),this.bindTexture=new kN(this),this.bindVertexBuffer=new CN(this),this.bindElementBuffer=new DN(this),this.bindVertexArray=new LN(this),this.pixelStoreUnpack=new FN(this),this.pixelStoreUnpackPremultiplyAlpha=new PN(this),this.pixelStoreUnpackFlipY=new IN(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=yoe(this),this.terrainUniformBuffer=xoe(this),this.frameUniformBuffer=Moe(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,r){return new rN(this,e,r)}createVertexBuffer(e,r,t){return new iN(this,e,r,t)}createRenderbuffer(e,r,t){let i=this.gl,a=i.createRenderbuffer();return this.bindRenderbuffer.set(a),i.renderbufferStorage(i.RENDERBUFFER,e,r,t),this.bindRenderbuffer.set(null),a}createFramebuffer(e,r,t,i){return new ON(this,e,r,t,i)}clear({color:e,depth:r,stencil:t}){let i=this.gl,a=0;e&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),r!==void 0&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),t!==void 0&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(t),this.stencilMask.set(255)),i.clear(a)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Td(e.blendFunction,cl.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},Lo=class{constructor(e,r,t){this.func=e,this.mask=r,this.range=t}},Lo.ReadOnly=!1,Lo.ReadWrite=!0,Lo.disabled=new Lo(519,Lo.ReadOnly,[0,1]),I2=7680,es=class{constructor(e,r,t,i,a,o){this.test=e,this.ref=r,this.mask=t,this.fail=i,this.depthFail=a,this.pass=o}},es.disabled=new es({func:519,mask:0},0,0,I2,I2,I2),oS=1029,R2=2305,Ko=class{constructor(e,r,t){this.enable=e,this.mode=r,this.frontFace=t}},Ko.disabled=new Ko(!1,oS,R2),Ko.backCCW=new Ko(!0,oS,R2),Ko.frontCCW=new Ko(!0,1028,R2),jN=Hh(new Float32Array(16)),B2=0,O2=[new Wr(0,0),new Wr(Bi,0),new Wr(Bi,Bi),new Wr(0,Bi)],UN=new ro(1,0,0,1),qN=new ro(0,1,0,1),VN=new ro(0,0,1,1),GN=new ro(1,0,1,1),HN=new ro(0,1,1,1),$N={symbol:koe,circle:Ioe,heatmap:Roe,line:$oe,fill:Woe,fillExtrusion:Yoe,hillshade:Xoe,colorRelief:Koe,raster:Joe,background:rse,sky:hse,atmosphere:pse,custom:use,debug:nse,debugPadding:ise,terrainDepth:cse},WN=(N2=class{constructor(e,r){this.drawFunctions=$N,this.context=new NN(e),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Hh(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=A2.maxOverzooming+A2.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new zM}resize(e,r,t){if(this.width=Math.floor(e*t),this.height=Math.floor(r*t),this.pixelRatio=t,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style._order)this.style._layers[i].resize()}setup(){let e=this.context,r=new sp;r.emplaceBack(0,0),r.emplaceBack(Bi,0),r.emplaceBack(0,Bi),r.emplaceBack(Bi,Bi),this.tileExtentBuffer=e.createVertexBuffer(r,i0.members),this.tileExtentSegments=Ks.simpleSegment(0,0,4,2);let t=new sp;t.emplaceBack(0,0),t.emplaceBack(Bi,0),t.emplaceBack(0,Bi),t.emplaceBack(Bi,Bi),this.debugBuffer=e.createVertexBuffer(t,i0.members),this.debugSegments=Ks.simpleSegment(0,0,4,5);let i=new fI;i.emplaceBack(0,0,0,0),i.emplaceBack(Bi,0,Bi,0),i.emplaceBack(0,Bi,0,Bi),i.emplaceBack(Bi,Bi,Bi,Bi),this.rasterBoundsBuffer=e.createVertexBuffer(i,rO.members),this.rasterBoundsSegments=Ks.simpleSegment(0,0,4,2);let a=new sp;a.emplaceBack(0,0),a.emplaceBack(Bi,0),a.emplaceBack(0,Bi),a.emplaceBack(Bi,Bi),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(a,i0.members),this.rasterBoundsSegmentsPosOnly=Ks.simpleSegment(0,0,4,5);let o=new sp;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,i0.members),this.viewportSegments=Ks.simpleSegment(0,0,4,2);let s=new TI;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let l=new ed;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let n=this.context.gl;this.stencilClearMode=new es({func:n.ALWAYS,mask:0},0,255,n.ZERO,n.ZERO,n.ZERO),this.tileExtentMesh=new Um(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let t=Rp();$h(t,0,this.width,this.height,0,0,1),Xu(t,t,[r.drawingBufferWidth,r.drawingBufferHeight,0]);let i={mainMatrix:t,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:t,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(e,r.TRIANGLES,Lo.disabled,this.stencilClearMode,cl.disabled,Ko.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,r,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!r?.length)return;this.currentStencilSource=e.source,this.nextStencilID+r.length>256&&this.clearStencil();let i=this.context;i.setColorMode(cl.disabled),i.setDepthMode(Lo.disabled);let a={};for(let o of r)a[o.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,r,t,!0),this._renderTileMasks(a,r,t,!1),this._tileClippingMaskIDs=a}_renderTileMasks(e,r,t,i){let a=this.context,o=a.gl,s=this.style.projection,l=this.transform,n=this.useProgram("clippingMask");for(let u of r){let c=e[u.key],f=this.getTerrainDataForTile(u,t),h=s.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),d=l.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!t,applyTerrainMatrix:!0});n.draw(a,o.TRIANGLES,Lo.disabled,new es({func:o.ALWAYS,mask:0},c,255,o.KEEP,o.KEEP,o.REPLACE),cl.disabled,t?Ko.disabled:Ko.backCCW,null,f,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}getTerrainDataForTile(e,r){var t,i;return r&&((t=this.style.projection)==null?void 0:t.name)==="mercator"?null:((i=this.style.map.terrain)==null?void 0:i.getTerrainData(e))||null}_renderTilesDepthBuffer(){var e;let r=this.context,t=r.gl,i=this.style.projection,a=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D(),l=Bm(a,{tileSize:a.tileSize});for(let n of l){let u=(e=this.style.map.terrain)==null?void 0:e.getTerrainData(n),c=i.getMeshFromTileID(this.context,n.canonical,!0,!0,"raster"),f=a.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(r,t.TRIANGLES,s,es.disabled,cl.disabled,Ko.backCCW,null,u,f,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,r=this.context.gl;return new es({func:r.NOTEQUAL,mask:255},e,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(e){let r=this.context.gl;return new es({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let r=this.context.gl,t=e.sort((o,s)=>s.overscaledZ-o.overscaledZ),i=t[t.length-1].overscaledZ,a=t[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let o={};for(let s=0;ss.overscaledZ-o.overscaledZ),i=t[t.length-1].overscaledZ,a=t[0].overscaledZ-i+1;if(this.clearStencil(),a>1){let o={},s={};for(let l=0;l=0;a.currentLayer--){let f=this.style._layers[o[a.currentLayer]];if(f.isHidden(this.transform.zoom))continue;let h=s[f.source],d=l[f.source];this.renderTileClippingMasks(f,d,!1),this.renderLayer(this,h,f,d,a)}a.currentPass="translucent";let c=!1;for(a.currentLayer=0;a.currentLayer0?r.pop():null}acquireRTT(e){let r=this.context.gl,t=this._rttObjectRecyclePool.pop();if(t)return t.size!==e&&(t.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),t.size=e),t;let i=new jl(this.context,{width:e,height:e,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return i.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:i,size:e}}bindRTT(e){let r=this.context.gl,t=e.size;if(!this._rttSharedFbo){let i=this.context.createFramebuffer(t,t,!0,!0),a=this.context.createRenderbuffer(r.DEPTH_STENCIL,t,t);i.depthAttachment.set(a),this._rttSharedFbo={fbo:i,depthRenderbuffer:a,size:t}}this._rttSharedFbo.size!==t&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,t),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=t,this._rttSharedFbo.fbo.height=t,this._rttSharedFbo.size=t),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let r=this.patternAtlas.getPattern(e.from.toString()),t=this.patternAtlas.getPattern(e.to.toString());return!r||!t}useProgram(e,r,t=!1,i=[]){var a;this.cache||(this.cache={});let o=!!this.style.map.terrain,s=this.style.projection,l=t?rd.projectionMercator:s.shaderPreludeCode,n=t?OM:s.shaderDefine,u=`/${t?NM:s.shaderVariantName}`,c=r?r.cacheKey:"",f=this._showOverdrawInspector?"/overdraw":"",h=o?"/terrain":"",d=i?`/${i.join("/")}`:"",p=e+c+u+f+h+d;return(a=this.cache)[p]||(a[p]=new cO(this.context,rd[e],r,tN[e],this._showOverdrawInspector,o,l,n,i)),this.cache[p]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new jl(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){var e,r,t;if(this._tileTextures){for(let i in this._tileTextures){let a=this._tileTextures[i];if(a)for(let o of a)o.destroy()}this._tileTextures={}}for(let i of this._rttObjectRecyclePool)i.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let i=this.context.gl;i.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),i.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if((e=this.layerOpacityFbo)==null||e.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((r=this.tileExtentMesh.vertexBuffer)==null||r.destroy()),this.tileExtentMesh&&((t=this.tileExtentMesh.indexBuffer)==null||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let i in this.cache){let a=this.cache[i];a?.program&&this.context.gl.deleteProgram(a.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:r}=this.context.gl;return this.width!==e||this.height!==r}},N2.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,N2),sS=class extends Error{constructor(e,r){var t;super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=(t=r?.statusMessage)!=null?t:null}},lS=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{var r;let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):((r=[...t.keys()][0])!=null?r:"").split("/")},this._onHashChange=()=>{let r=this._getCurrentHash();if(!this._isValidHash(r))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(r[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:t,pitch:+(r[4]||0)}),!0},this._updateHashUnthrottled=()=>{let r=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,r)},this._removeHash=()=>{let r=this._getHashParams();if(this._hashName)r.delete(this._hashName);else{let o=Array.from(r.keys());o.length>0&&r.delete(o[0])}let t=decodeURIComponent(r.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=t?`#${t}`:"",a=window.location.href.replace(/(#.+)?$/,i);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=qz(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let r=this._map.getCenter(),t=Math.round(this._map.getZoom()*100)/100,i=10**Math.ceil((t*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(r.lng*i)/i,o=Math.round(r.lat*i)/i,s=this._map.getBearing(),l=this._map.getPitch(),n="";if(n+=e?`/${a}/${o}/${t}`:`${t}/${o}/${a}`,(s||l)&&(n+=`/${Math.round(s*10)/10}`),l&&(n+=`/${Math.round(l)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,n),`#${decodeURIComponent(u.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${n}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return!1;try{new An(+e[2],+e[1])}catch{return!1}let r=+e[0],t=+(e[3]||0),i=+(e[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&t>=-180&&t<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}},$m={linearity:.3,easing:H4(0,0,.3,1)},YN=yn({deceleration:2500,maxSpeed:1400},$m),XN=yn({deceleration:20,maxSpeed:1400},$m),ZN=yn({deceleration:1e3,maxSpeed:360},$m),KN=yn({deceleration:1e3,maxSpeed:90},$m),JN=yn({deceleration:1e3,maxSpeed:360},$m),QN=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:hs(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,r=hs();for(;e.length>0&&r-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,r=hs()-60,t=Math.max(0,e.length-2);for(;t>0&&e[t-1].time>=r;)t--;return e.slice(t)}_onMoveEnd(e){this._drainInertiaBuffer();let r=this._getVelocityEntries();if(r.length<2){this.clear();return}let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new Wr(0,0),pinchAround:void 0,around:void 0};for(let{settings:o}of r)o.around&&(t.around=o.around),o.pinchAround&&(t.pinchAround=o.pinchAround);for(let{settings:o}of r.slice(1))t.zoom+=o.zoomDelta||0,t.bearing+=o.bearingDelta||0,t.pitch+=o.pitchDelta||0,t.roll+=o.rollDelta||0,o.panDelta&&t.pan._add(o.panDelta);if(!t.pan.mag()&&!t.zoom&&!t.bearing&&!t.pitch&&!t.roll){this.clear();return}let i=hs()-r[0].time,a={};if(t.pan.mag()){let o=Gg(t.pan.mag(),i,yn({},YN,e||{})),s=t.pan.mult(o.amount/t.pan.mag()),l=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);a.center=l.easingCenter,a.offset=l.easingOffset,Vg(a,o)}if(t.zoom){let o=Gg(t.zoom,i,XN);a.zoom=Lf(this._map.getZoom()+o.amount,this._map.getZoomSnap(),o.amount),Vg(a,o)}if(t.bearing){let o=Gg(t.bearing,i,ZN);a.bearing=this._map.getBearing()+to(o.amount,-179,179),Vg(a,o)}if(t.pitch){let o=Gg(t.pitch,i,KN);a.pitch=this._map.getPitch()+o.amount,Vg(a,o)}if(t.roll){let o=Gg(t.roll,i,JN);a.roll=this._map.getRoll()+to(o.amount,-179,179),Vg(a,o)}if(a.zoom||a.bearing){let o=t.pinchAround===void 0?t.around:t.pinchAround;a.around=o?this._map.unproject(o):this._map.getCenter()}return this.clear(),yn(a,{noMoveStart:!0})}},e8=class{constructor(e,r){this._map=e,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new gM(this._map,e))}mousedown(e,r){return this._mousedownPos=r,this._firePreventable(new df(e.type,this._map,e))}mouseup(e){this._map.fire(new df(e.type,this._map,e))}click(e,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new df(e.type,this._map,e))}dblclick(e){return this._firePreventable(new df(e.type,this._map,e))}mouseover(e){this._map.fire(new df(e.type,this._map,e))}mouseout(e){this._map.fire(new df(e.type,this._map,e))}touchstart(e){return this._firePreventable(new jm(e.type,this._map,e))}touchmove(e){this._map.fire(new jm(e.type,this._map,e))}touchend(e){this._map.fire(new jm(e.type,this._map,e))}touchcancel(e){this._map.fire(new jm(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},t8=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new df(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new df("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new df(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},uS=class{constructor(e,r,t){this._map=e,this._tr=t,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=r.clickTolerance||1,r.boxZoom&&typeof r.boxZoom=="object"&&(this._boxZoomEnd=r.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,r){this.isEnabled()&&e.shiftKey&&e.button===0&&($n.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(e,r){if(!this._active)return;let t=r;if(this._lastPos.equals(t)||!this._box&&t.dist(this._startPos)a.fitScreenCoordinates(t,i,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),$n.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,r){return this._map.fire(new d2(e,{originalEvent:r}))}},r8=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,r,t){(this.centroid||t.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),t.length===this.numTouches&&(this.centroid=mse(r),this.touches=fM(t,r)))}touchmove(e,r,t){if(this.aborted||!this.centroid)return;let i=fM(t,r);for(let a in this.touches){let o=this.touches[a],s=i[a];(!s||s.dist(o)>30)&&(this.aborted=!0)}}touchend(e,r,t){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),t.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},j2=class{constructor(e){this.singleTap=new r8(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,r,t){this.singleTap.touchstart(e,r,t)}touchmove(e,r,t){this.singleTap.touchmove(e,r,t)}touchend(e,r,t){let i=this.singleTap.touchend(e,r,t);if(i){let a=e.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(i)<30;if((!a||!o)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},i8=class{constructor(e,r){this._tr=r,this._zoomIn=new j2({numTouches:1,numTaps:2}),this._zoomOut=new j2({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,r,t){this._zoomIn.touchstart(e,r,t),this._zoomOut.touchstart(e,r,t)}touchmove(e,r,t){this._zoomIn.touchmove(e,r,t),this._zoomOut.touchmove(e,r,t)}touchend(e,r,t){let i=this._zoomIn.touchend(e,r,t),a=this._zoomOut.touchend(e,r,t),o=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:Lf(o.zoom+1,s.getZoomSnap()),around:o.unproject(i)},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:Lf(o.zoom-1,s.getZoomSnap()),around:o.unproject(a)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Wm=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let r=this._moveFunction(...e);if(r.bearingDelta||r.pitchDelta||r.rollDelta||r.around||r.panDelta)return this._active=!0,r}dragStart(e,r){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(r)?r[0]:r,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,r){if(!this.isEnabled())return;let t=this._lastPoint;if(!t)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(r)?r[0]:r;if(!(!this._moved&&i.dist(t)!0}),r=new n8){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=r}_executeRelevantHandler(e,r,t){if(e instanceof MouseEvent)return r(e);if(typeof TouchEvent<"u"&&e instanceof TouchEvent)return t(e)}startMove(e){this._executeRelevantHandler(e,r=>{this.mouseMoveStateManager.startMove(r)},r=>{this.oneFingerTouchMoveStateManager.startMove(r)})}endMove(e){this._executeRelevantHandler(e,r=>{this.mouseMoveStateManager.endMove(r)},r=>{this.oneFingerTouchMoveStateManager.endMove(r)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,r=>this.mouseMoveStateManager.isValidStartEvent(r),r=>this.oneFingerTouchMoveStateManager.isValidStartEvent(r))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,r=>this.mouseMoveStateManager.isValidMoveEvent(r),r=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(r))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,r=>this.mouseMoveStateManager.isValidEndEvent(r),r=>this.oneFingerTouchMoveStateManager.isValidEndEvent(r))}},iy=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=r=>{r.preventDefault()}},s8=class{constructor(e,r){this._clickTolerance=e.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Wr(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,r,t){return this._calculateTransform(e,r,t)}touchmove(e,r,t){if(this._active){if(this._shouldBePrevented(t.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,r,t)}}touchend(e,r,t){this._calculateTransform(e,r,t),this._active&&this._shouldBePrevented(t.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,r,t){t.length>0&&(this._active=!0);let i=fM(t,r),a=new Wr(0,0),o=new Wr(0,0),s=0;for(let n in i){let u=i[n],c=this._touches[n];c&&(a._add(u),o._add(u.sub(c)),s++,i[n]=u)}if(this._touches=i,this._shouldBePrevented(s)||!o.mag())return;let l=o.div(s);if(this._sum._add(l),!(this._sum.mag()=2,a=r.mag()>=2;if(!i&&!a)return;if(!i||!a)return this._firstMove===void 0&&(this._firstMove=t),t-this._firstMove<100&&void 0;let o=e.y>0==r.y>0;return hM(e)&&hM(r)&&o}},l8={panStep:100,bearingStep:15,pitchStep:10},pS=class{constructor(e,r){this._tr=r;let t=l8;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let r=0,t=0,i=0,a=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:e.shiftKey?t=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?t=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(t=0,i=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:wse,zoom:r?Lf(l.zoom+r*(e.shiftKey?2:1),s.getZoomSnap()):l.zoom,bearing:l.bearing+t*this._bearingStep,pitch:l.pitch+i*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:l.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}},vS=4.000244140625,mS=class{constructor(e,r,t){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=t,this._triggerRenderFrame=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let r=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,t=hs(),i=t-(this._lastWheelEventTime||0);this._lastWheelEventTime=t,r!==0&&r%vS==0?this._type="wheel":r!==0&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=$n.mousePos(this._map.getCanvas(),e),t=this._tr;this._aroundPoint=this._aroundCenter?t.transform.locationToScreenPoint(An.convert(t.center)):r,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>vS?this._wheelZoomRate:this._defaultZoomRate,l=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let n=typeof this._targetZoom=="number"?Vc(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),Ku(n*l)).zoom,c=this._map.getZoomSnap();if(this._type==="wheel"&&c>0){let f=Lf(e.zoom,c);this._targetZoom=Lf(u,c,u-f)}else this._targetZoom=u;this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,t=this._startZoom,i=this._easing,a=!1,o;if(this._type==="wheel"&&t&&i){let s=hs()-this._lastWheelEventTime,l=Math.min((s+5)/200,1),n=i(l);o=Zs.number(t,r,n),l<1?this._needsRerender=!0:a=!0}else o=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let r=Sx;if(this._prevEase){let t=this._prevEase,i=(hs()-t.start)/t.duration,a=t.easing(i+.01)-t.easing(i),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=H4(o,s,.25,1)}return this._prevEase={start:hs(),duration:e,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},gS=class{constructor(e,r){this._clickZoom=e,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},u8=class{constructor(e,r){this._tr=r,this.reset()}reset(){this._active=!1}dblclick(e,r){return e.preventDefault(),{cameraAnimation:t=>{t.easeTo({duration:300,zoom:Lf(this._tr.zoom+(e.shiftKey?-1:1),t.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},c8=class{constructor(){this._tap=new j2({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,r,t){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,r,t);else{let i=r[0],a=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(i)<30;!a||!o?this.reset():t.length>0&&(this._swipePoint=i,this._swipeTouch=t[0].identifier)}}touchmove(e,r,t){if(!this._tapTime)this._tap.touchmove(e,r,t);else if(this._swipePoint){if(t[0].identifier!==this._swipeTouch)return;let i=r[0],a=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,r,t){if(this._tapTime)this._swipePoint&&t.length===0&&this.reset();else{let i=this._tap.touchend(e,r,t);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},yS=class{constructor(e,r,t){this._el=e,this._mousePan=r,this._touchPan=t}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},_S=class{constructor(e,r,t,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=r,this._mousePitch=t,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},xS=class{constructor(e,r,t,i){this._el=e,this._touchZoom=r,this._touchRotate=t,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},bS=class{constructor(e,r){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=r,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=$n.create("div","maplibregl-cooperative-gesture-screen",e);let r=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(r=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let t=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=r,this._container.appendChild(i);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=t,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,r){this._enabled&&(this._map.fire(new iu("cooperativegestureprevented",{gestureType:e,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},f8=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(Wr.convert(e),this._camera.terrain)}},ay=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,h8=class extends hf{},d8=class{get _ownerDocument(){var e;return((e=this._el)==null?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,r;return((r=(e=this._el)==null?void 0:e.ownerDocument)==null?void 0:r.defaultView)||window}constructor(e,r,t){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,o)=>{if(a.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let s=a.type==="renderFrame"?void 0:a,l={needsRenderFrame:!1},n={},u={};for(let{handlerName:h,handler:d,allowed:p}of this._handlers){if(!d.isEnabled())continue;let g;if(this._blockedByActive(u,p,h))d.reset();else if(d[o||a.type]){if(hJ(a,o||a.type)){let m=$n.mousePos(this._map.getCanvas(),a);g=d[o||a.type](a,m)}else if(fJ(a,o||a.type)){let m=a.touches,y=this._getMapTouches(m),_=$n.touchPos(this._map.getCanvas(),y);g=d[o||a.type](a,_,y)}else dJ(o||a.type)||(g=d[o||a.type](a));this.mergeHandlerResult(l,n,g,h,s),g?.needsRenderFrame&&this._triggerRenderFrame()}(g||d.isActive())&&(u[h]=d)}let c={};for(let h in this._previousActiveHandlers)u[h]||(c[h]=s);this._previousActiveHandlers=u,(Object.keys(c).length||dM(l))&&(this._changes.push([l,n,c]),this._triggerRenderFrame()),(Object.keys(u).length||dM(l))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:f}=l;f&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],f(this._map))},this._map=e,this._camera=r,this._transformProvider=new f8(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new QN(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[a,o,s]of this._listeners)a.addEventListener(o,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(let[e,r,t]of this._listeners)e.removeEventListener(r,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,t)}_addDefaultHandlers(e){let r=this._map,t=r.getCanvasContainer();this._add("mapEvent",new e8(r,e));let i=r.boxZoom=new uS(r,e,this._transformProvider);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let a=r.cooperativeGestures=new bS(r,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let o=new i8(r,this._transformProvider),s=new u8(r,this._transformProvider);r.doubleClickZoom=new gS(s,o),this._add("tapZoom",o),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&r.doubleClickZoom.enable();let l=new c8;this._add("tapDragZoom",l);let n=r.touchPitch=new dS(r);this._add("touchPitch",n),e.interactive&&e.touchPitch&&r.touchPitch.enable(e.touchPitch);let u=()=>r.project(r.getCenter()),c=_se(e,u),f=xse(e),h=bse(e,u);r.dragRotate=new _S(e,c,f,h),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",f,["mouseRotate","mouseRoll"]),this._add("mouseRoll",h,["mousePitch"]),e.interactive&&e.dragRotate&&r.dragRotate.enable();let d=yse(e),p=new s8(e,r);r.dragPan=new yS(t,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&r.dragPan.enable(e.dragPan);let g=new hS,m=new fS;r.touchZoomRotate=new xS(t,m,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&r.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new t8(r));let y=r.scrollZoom=new mS(r,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",y,["mousePan"]),e.interactive&&e.scrollZoom&&r.scrollZoom.enable(e.scrollZoom);let _=r.keyboard=new pS(r,this._transformProvider);this._add("keyboard",_),e.interactive&&e.keyboard&&r.keyboard.enable()}_add(e,r,t){this._handlers.push({handlerName:e,handler:r,allowed:t}),this._handlersById[e]=r}stop(e){if(!this._updatingCamera){for(let{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ay(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,r,t){for(let i in e)if(i!==t&&!r?.includes(i))return!0;return!1}_getMapTouches(e){let r=[];for(let t of e){let i=t.target;this._el.contains(i)&&r.push(t)}return r}mergeHandlerResult(e,r,t,i,a){if(!t)return;yn(e,t);let o={handlerName:i,originalEvent:t.originalEvent||a};t.zoomDelta!==void 0&&(r.zoom=o),t.panDelta!==void 0&&(r.drag=o),t.rollDelta!==void 0&&(r.roll=o),t.pitchDelta!==void 0&&(r.pitch=o),t.bearingDelta!==void 0&&(r.rotate=o)}_applyChanges(){let e={},r={},t={};for(let[i,a,o]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new Wr(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),yn(r,a),yn(t,o);this._updateMapTransform(e,r,t),this._changes=[]}_updateMapTransform(e,r,t){let i=this._map,a=this._camera.getTransformForUpdate(),o=i.terrain;if(!dM(e)&&!(o&&this._terrainMovement)){this._fireEvents(r,t,!0);return}this._camera.stop(!0);let{panDelta:s,zoomDelta:l,bearingDelta:n,pitchDelta:u,rollDelta:c}=e,{around:f,aroundOnSurface:h}=this._resolveAround(e,o,a),d=o?this._terrainGestureElevation(o,f,h,a,r):void 0,p={panDelta:s,zoomDelta:l,rollDelta:c,pitchDelta:u,bearingDelta:n,around:f,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(f)&&(f=a.centerPoint);let g=this._computePreZoomAroundLoc(a,f,s,d);this._handleMapControls({terrain:o,tr:a,deltasForHelper:p,preZoomAroundLoc:g,combinedEventsInProgress:r,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(r,t,!0)}_resolveAround(e,r,t){let i=e.pinchAround===void 0?e.around:e.pinchAround;return i||(i=this._camera.transform.centerPoint),r&&!t.isPointOnMapSurface(i)?{around:t.centerPoint,aroundOnSurface:!1}:{around:i,aroundOnSurface:!0}}_terrainGestureElevation(e,r,t,i,a){if(!t)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let s=i.screenTerrainPointToMercatorCoordinate(r,e);this._terrainGestureAnchorElevation=s?s.z:null}if(this._terrainGestureAnchorElevation===null)return;let o=this._terrainGestureAnchorElevation;if(!(r.distSqr(i.centerPoint)<.01)&&!(o-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)))return o}_computePreZoomAroundLoc(e,r,t,i){if(r.distSqr(e.centerPoint)<.01)return e.center;let a=t?r.sub(t):r;return i===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,i)}_handleMapControls({terrain:e,tr:r,deltasForHelper:t,preZoomAroundLoc:i,combinedEventsInProgress:a,panDelta:o}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(t,r),!e){s.handleMapControlsPan(t,r,i);return}if(s.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),s.handleMapControlsPan(t,r,i);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(t,r,i);return}if(t.aroundElevation===void 0&&a.drag&&this._terrainMovement&&o){r.setCenter(r.screenPointToLocation(r.centerPoint.sub(o)));return}s.handleMapControlsPan(t,r,i)}_fireEvents(e,r,t){let i=ay(this._eventsInProgress),a=ay(e),o={};for(let c in e){let{originalEvent:f}=e[c];this._eventsInProgress[c]||(o[`${c}start`]=f),this._eventsInProgress[c]=e[c]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let c in o)this._fireEvent(c,o[c]);a&&this._fireEvent("move",a.originalEvent);for(let c in e){let{originalEvent:f}=e[c];this._fireEvent(c,f)}let s={},l;for(let c in this._eventsInProgress){let{handlerName:f,originalEvent:h}=this._eventsInProgress[c];this._handlersById[f].isActive()||(delete this._eventsInProgress[c],l=r[f]||h,s[`${c}end`]=l)}for(let c in s)this._fireEvent(c,s[c]);let n=ay(this._eventsInProgress),u=(i||a)&&!n;if(u&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let c=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&c.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(c)}if(t&&u){this._updatingCamera=!0;let c=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),f=h=>h!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new h8("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},p8=class extends Nl{constructor(e){var r,t,i;super(),this._renderFrameCallback=()=>{let a=Math.min((hs()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new Kg,this.cameraHelper=new Jg,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=(r=e.centerClampedToGround)!=null?r:!0,this.transformCameraUpdate=(t=e.transformCameraUpdate)!=null?t:null,this._stopHandlers=(i=e.stopHandlers)!=null?i:(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,r){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=r,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new An(this.transform.center.lng,this.transform.center.lat)}setCenter(e,r){return this.jumpTo({center:e},r)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,r){return this.jumpTo({elevation:e},r),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,r,t){return e=Wr.convert(e).mult(-1),this.panTo(this.transform.center,yn({offset:e},r),t)}panTo(e,r,t){return this.easeTo(yn({center:e},r),t)}getZoom(){return this.transform.zoom}setZoom(e,r){return this.jumpTo({zoom:e},r),this}zoomTo(e,r,t){return this.easeTo(yn({zoom:e},r),t)}zoomIn(e,r){return this.zoomTo(Lf(this.getZoom()+1,this._zoomSnap),e,r),this}zoomOut(e,r){return this.zoomTo(Lf(this.getZoom()-1,this._zoomSnap),e,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,r){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new kn("movestart",r)).fire(new kn("move",r)).fire(new kn("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,r){return this.jumpTo({bearing:e},r),this}getPadding(){return this.transform.padding}setPadding(e,r){return this.jumpTo({padding:e},r),this}rotateTo(e,r,t){return this.easeTo(yn({bearing:e},r),t)}resetNorth(e,r){return this.rotateTo(0,yn({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(yn({bearing:0,pitch:0,roll:0,duration:1e3},e),r),this}snapToNorth(e,r){return Math.abs(this.getBearing()){p.easeFunc(g),this.terrain&&!e.freezeElevation&&this._updateElevation(g),this.applyUpdatedTransform(t),this._fireMoveEvents(r)},g=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r,g)},e),this}_prepareEase(e,r,t={}){this._moving=!0,!r&&!t.moving&&this.fire(new kn("movestart",e)),this._zooming&&!t.zooming&&this.fire(new kn("zoomstart",e)),this._rotating&&!t.rotating&&this.fire(new kn("rotatestart",e)),this._pitching&&!t.pitching&&this.fire(new kn("pitchstart",e)),this._rolling&&!t.rolling&&this.fire(new kn("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&r!==this._elevationTarget){let t=this._elevationTarget-this._elevationStart,i=(r-(t*e+this._elevationStart))/(1-e);this._elevationStart+=e*(t-i),this._elevationTarget=r}this.transform.setElevation(Zs.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let r=e.getCameraLngLat(),t=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(r,e.zoom):0;if(tthis._elevateCameraIfInsideTerrain(i)),this.transformCameraUpdate&&r.push(i=>this.transformCameraUpdate(i)),!r.length)return;let t=e.clone();for(let i of r){let a=t.clone(),{center:o,zoom:s,roll:l,pitch:n,bearing:u,elevation:c}=i(a);o&&a.setCenter(o),c!==void 0&&a.setElevation(c),s!==void 0&&a.setZoom(s),l!==void 0&&a.setRoll(l),n!==void 0&&a.setPitch(n),u!==void 0&&a.setBearing(u),t.apply(a,!1)}this.transform.apply(t,!1)}_fireMoveEvents(e){this.fire(new kn("move",e)),this._zooming&&this.fire(new kn("zoom",e)),this._rotating&&this.fire(new kn("rotate",e)),this._pitching&&this.fire(new kn("pitch",e)),this._rolling&&this.fire(new kn("roll",e))}_afterEase(e,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let t=this._zooming,i=this._rotating,a=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,t&&this.fire(new kn("zoomend",e)),i&&this.fire(new kn("rotateend",e)),a&&this.fire(new kn("pitchend",e)),o&&this.fire(new kn("rollend",e)),this.fire(new kn("moveend",e))}flyTo(e,r){if(!e.essential&&yc.prefersReducedMotion){let T=N1(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(T,r)}this.stop(),e=yn({offset:[0,0],speed:1.2,curve:1.42,easing:Sx},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=Lf(e.zoom,this._zoomSnap));let t=this.getTransformForUpdate(),i=t.bearing,a=t.pitch,o=t.roll,s=t.padding,l=e.bearing===void 0?i:this._normalizeBearing(e.bearing,i),n=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?o:this._normalizeBearing(e.roll,o),c=e.padding===void 0?t.padding:e.padding,f=Wr.convert(e.offset),h=t.centerPoint.add(f),d=t.screenPointToLocation(h),p=this.cameraHelper.handleFlyTo(t,{bearing:l,pitch:n,roll:u,padding:c,locationAtOffset:d,offsetAsPoint:f,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),g=e.curve,m=Math.max(t.width,t.height),y=m/p.scaleOfZoom,_=p.pixelPathLength,v=m/p.scaleOfMinZoom;g=Math.min(g,Math.sqrt(v/_*2));let x=g*g;function S(T){let F=(y*y-m*m+(T?-1:1)*x*x*_*_)/(2*(T?y:m)*x*_);return Math.log(Math.sqrt(F*F+1)-F)}function M(T){return(Math.exp(T)-Math.exp(-T))/2}function C(T){return(Math.exp(T)+Math.exp(-T))/2}function w(T){return M(T)/C(T)}let k=S(!1),A=function(T){return C(k)/C(k+g*T)},b=function(T){return m*((C(k)*w(k+g*T)-M(k))/x)/_},E=(S(!0)-k)/g;if(Math.abs(_)<2e-6||!isFinite(E)){if(Math.abs(m-y)<1e-6)return this.easeTo(e,r);let T=y0,A=F=>Math.exp(T*g*F)}if(e.duration!==void 0)e.duration=+e.duration;else{let T=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/g;e.duration=1e3*E/T}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==l,this._pitching=n!==a,this._rolling=u!==o,this._padding=!t.isPaddingEqual(c),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(p.targetCenter),this._ease(T=>{let F=T*E,D=1/A(F),R=b(F);this._rotating&&t.setBearing(Zs.number(i,l,T)),this._pitching&&t.setPitch(Zs.number(a,n,T)),this._rolling&&t.setRoll(Zs.number(o,u,T)),this._padding&&(t.interpolatePadding(s,c,T),h=t.centerPoint.add(f)),p.easeFunc(T,D,R,h),this.terrain&&!e.freezeElevation&&this._updateElevation(T),this.applyUpdatedTransform(t),this._fireMoveEvents(r)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,r)}return e||this._stopHandlers(),this}_ease(e,r,t){t.animate===!1||t.duration===0?(e(1),r()):(this._easeStart=hs(),this._easeOptions=t,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=ch(e,-180,180);let t=Math.abs(e-r);return Math.abs(e-360-r)MapLibre'},TS=class{constructor(e=wS){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=r=>{r&&(r.type==="terrain"||r.dataType==="style"||r.dataType==="source"&&(r.sourceDataType==="metadata"||r.sourceDataType==="visibility"))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=$n.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=$n.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=$n.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,r){let t=this._map._getUIString(`AttributionControl.${r}`);e.title=t,e.setAttribute("aria-label",t)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i=="string"?i:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style.tileManagers;for(let i in r){let a=r[i];if(a.used||a.usedForTerrain){let o=a.getSource();o.attribution&&!e.includes(o.attribution)&&e.push(o.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,a)=>i.length-a.length),e=e.filter((i,a)=>{for(let o=a+1;o{let r=this._container.children;if(r.length){let t=r[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var r;this._map=e,this._compact=(r=this.options)==null?void 0:r.compact,this._container=$n.create("div","maplibregl-ctrl");let t=$n.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},v8=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let r=++this._id;return this._queue.push({callback:e,id:r,cancelled:!1}),r}remove(e){let r=this._currentlyRunning,t=r?this._queue.concat(r):this._queue;for(let i of t)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let r=this._currentlyRunning=this._queue;this._queue=[];let t=!1,i;for(let a of r)if(!a.cancelled){try{a.callback(e)}catch(o){t||(t=!0,i=o)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,t)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},MS=["none","zoom","sourceTiles","visibleLayers","revision"],m8=class{constructor(e,r,t,i){this._tileKeys=e.map(a=>a.key).sort().join(),this._revision=r,this._zoom=t,this._visibleLayerIds=i}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}},av={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},g8=class{constructor(e,r){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=r,this.rttSize=r.tileManager.tileSize*r.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,r){let t=r!==this._lastPrepareZoom;this._lastPrepareZoom=r,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(l=>!e._layers[l].isHidden(r));let i=this._renderableLayerIds.join(),a=new Set;for(let l of this._renderableLayerIds){let n=e._layers[l],u=n.source;u&&av[n.type]&&a.add(u)}this._coordsAscending={},this._rttFingerprints={};for(let l of a){let n=e.tileManagers[l];if(!n)continue;this._coordsAscending[l]={};let u=this._coordsAscending[l],c=n.getSource(),f=c instanceof rv?c.terrainTileRanges:null;for(let p of n.getVisibleCoordinates()){let g=this.terrain.tileManager.getTerrainCoords(p,f);for(let m in g)u[m]||(u[m]=[]),u[m].push(g[m])}this._rttFingerprints[l]={};let h=this._rttFingerprints[l],d=n.getState().revision;for(let p in u)h[p]=new m8(u[p],d,r,i)}this.needsFollowUpFrame=!1;let o=t||this.painter.options.moving,s=!1;for(let l of this._renderableTiles){let n=this._textureDifference(l);n!=="none"&&(n==="zoom"&&o||n==="visibleLayers"&&t?this.needsFollowUpFrame=!0:n==="zoom"||n==="sourceTiles"?(s?this.needsFollowUpFrame=!0:l.releaseRTT(this.painter),s=!0):l.releaseRTT(this.painter))}}_textureDifference(e){let r="none";for(let t in this._rttFingerprints){let i=this._rttFingerprints[t][e.tileID.key];if(!i)continue;let a=i.difference(e.rttFingerprint[t]);MS.indexOf(a)>MS.indexOf(r)&&(r=a)}return r}renderLayer(e,r){if(e.isHidden(this.painter.transform.zoom))return!1;let t=ar(Ot({},r),{isRenderingToTexture:!0}),i=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(av[i]&&((!this._prevType||!av[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(av[this._prevType]||av[i]&&o){this._prevType=i;let s=this._stacks.length-1,l=this._stacks[s]||[];for(let n of this._renderableTiles){if(this._rttTiles.push(n),n.getRTT(s))continue;let u=n.acquireRTT(a,s,this.rttSize);a.bindRTT(u),a.context.clear({color:ro.transparent,stencil:0}),a.currentStencilSource=void 0;for(let c of l){let f=a.style._layers[c],h=f.source?this._coordsAscending[f.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(f,h,!0),a.renderLayer(a,a.style.tileManagers[f.source],f,h,t),f.source&&(n.rttFingerprint[f.source]=this._rttFingerprints[f.source][n.tileID.key])}u.texture.generateMipmap()}return fse(this.painter,this.terrain,this._rttTiles,t),this._rttTiles=[],av[i]}return!1}},y8={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},_8=vM,SS={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:wS,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:ff.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20},ES=class extends Nl{get _ownerWindow(){var e,r;return((r=(e=this._container)==null?void 0:e.ownerDocument)==null?void 0:r.defaultView)||window}constructor(e){var r,t,i;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new v8,this._controls=[],this._mapId=x9(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=l=>{if(l.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new Wg("webglcontextlost",{originalEvent:l}));return}for(let n of Object.values(this.style._layers))if(n.type==="custom"&&console.warn(`Custom layer with id '${n.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),n._listeners)for(let[u]of Object.entries(n._listeners))console.warn(`Custom layer with id '${n.id}' had event listeners for event '${u}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new Wg("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let n in this._lostContextStyle.images){let u=this._lostContextStyle.images[n];u.isWebGLImage&&this.style.imageManager.updateImage(n,u,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(n){this.fire(new Ln(n));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new Wg("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let a=ar(Ot(Ot({},SS),e),{canvasContextAttributes:Ot(Ot({},SS.canvasContextAttributes),e.canvasContextAttributes)});if(a.minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new p8({minZoom:a.minZoom,maxZoom:a.maxZoom,minPitch:a.minPitch,maxPitch:a.maxPitch,bearingSnap:a.bearingSnap,zoomSnap:a.zoomSnap,renderWorldCopies:a.renderWorldCopies,centerClampedToGround:a.centerClampedToGround,terrain:this.terrain,transformConstrain:a.transformConstrain,requestRenderFrame:l=>this._requestRenderFrame(l),cancelRenderFrame:l=>this._cancelRenderFrame(l),transformCameraUpdate:a.transformCameraUpdate,stopHandlers:()=>{var l;return(l=this._handlers)==null?void 0:l.stop(!1)}}),this._camera.setEventedParent(this),this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Ot({},a.canvasContextAttributes),this._trackResize=a.trackResize===!0,this._terrainSkirtLength=a.terrainSkirtLength,this._refreshExpiredTiles=a.refreshExpiredTiles===!0,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions===!0,this._collectResourceTiming=a.collectResourceTiming===!0,this._locale=Ot(Ot({},y8),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=a.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(a.anisotropicFilterPitch),a.reduceMotion!==void 0&&(yc.prefersReducedMotion=a.reduceMotion),this._requestManager=new Zz(a.transformRequest),this._container=this._resolveContainer(a.container),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer();try{this._setupPainter()}catch(l){throw this._cleanupContainer(),l}this._imageQueueHandle=td.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new d8(this,this._camera,a),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let o=typeof a.hash=="string"&&a.hash||void 0;this._hash=a.hash?new lS(o).addTo(this):void 0,(r=this._hash)!=null&&r._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,yn({},a.fitBoundsOptions,{duration:0}))));let s=typeof a.style=="string"||((i=(t=a.style)==null?void 0:t.projection)==null?void 0:i.type)!=="globe";this.resize(null,s),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new TS(typeof a.attributionControl=="boolean"?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new AS,a.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this._camera.transform.unmodified){let l=N1(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(l.dataType==="style"?new Nf("styledata",l):new zs("sourcedata",l))}),this.on("dataloading",l=>{this.fire(l.dataType==="style"?new Nf("styledataloading",l):new zs("sourcedataloading",l))}),this.on("dataabort",l=>{this.fire(new zs("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,r){return this.style.setGlobalStateProperty(e,r),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,r){if(r===void 0&&(r=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new Ln(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let t=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[r];return r.includes("bottom")?i.insertBefore(t,i.firstChild):i.appendChild(t),this}removeControl(e){if(!e?.onRemove)return this.fire(new Ln(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return Bm(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new An(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,r){return this._camera.setCenter(e,r),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,r){return this._camera.setCenterElevation(e,r),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,r,t){return this._camera.panBy(e,r,t),this}panTo(e,r,t){return this._camera.panTo(e,r,t),this}getZoom(){return this._camera.transform.zoom}setZoom(e,r){return this._camera.setZoom(e,r),this}zoomTo(e,r,t){return this._camera.zoomTo(e,r,t),this}zoomIn(e,r){return this._camera.zoomIn(e,r),this}zoomOut(e,r){return this._camera.zoomOut(e,r),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,r){return this._camera.setVerticalFieldOfView(e,r),this}getBearing(){return this._camera.transform.bearing}setBearing(e,r){return this._camera.setBearing(e,r),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,r){return this._camera.setPadding(e,r),this}rotateTo(e,r,t){return this._camera.rotateTo(e,r,t),this}resetNorth(e,r){return this._camera.resetNorth(e,r),this}resetNorthPitch(e,r){return this._camera.resetNorthPitch(e,r),this}snapToNorth(e,r){return this._camera.snapToNorth(e,r),this}getPitch(){return this._camera.transform.pitch}setPitch(e,r){return this._camera.setPitch(e,r),this}getRoll(){return this._camera.transform.roll}setRoll(e,r){return this._camera.setRoll(e,r),this}cameraForBounds(e,r){return this._camera.cameraForBounds(e,r)}fitBounds(e,r,t){return this._camera.fitBounds(e,r,t),this}fitScreenCoordinates(e,r,t,i,a){return this._camera.fitScreenCoordinates(e,r,t,i,a),this}jumpTo(e,r){return this._camera.jumpTo(e,r),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,r,t,i,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,r,t,i,a)}easeTo(e,r){return this._camera.easeTo(e,r),this}flyTo(e,r){return this._camera.flyTo(e,r),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(An.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,r,t,i){return i==null&&this.terrain&&(i=this.terrain.getElevationForLngLat(t,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,r,t,i??0)}resize(e,r=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(r);let t=!this._camera._moving;return t&&(this.stop(),this.fire(new kn("movestart",e)).fire(new kn("move",e))),this.fire(new iu("resize",e)),t&&this.fire(new kn("moveend",e)),this}_resizeInternal(e=!0){let[r,t]=this._containerDimensions(),i=this._getClampedPixelRatio(r,t);if(this._resizeCanvas(r,t,i),this.painter.resize(r,t,i),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let o=this._getClampedPixelRatio(r,t);this._resizeCanvas(r,t,o),this.painter.resize(r,t,o)}this._resizeTransform(e)}_resizeTransform(e=!0){var r;let[t,i]=this._containerDimensions();this._camera.transform.resize(t,i,e),(r=this._camera._requestedCameraState)==null||r.resize(t,i,e)}_getClampedPixelRatio(e,r){let{0:t,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),o=e*a,s=r*a,l=o>t?t/o:1,n=s>i?i/s:1,u=Math.min(l,n);return u<1&&To("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*a}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(bh.convert(e)),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let r=this._camera.transform.zoom,t=this._camera.getTransformForUpdate();return t.setMinZoom(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.zoom&&this.fire(new kn("zoomstart")).fire(new kn("zoom")).fire(new kn("zoomend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let r=this._camera.transform;return e?r.applyConstrain(r.center,r.minZoom).zoom:r.minZoom}setMaxZoom(e){if(e??(e=22),e>=this._camera.transform.minZoom){let r=this._camera.transform.zoom,t=this._camera.getTransformForUpdate();return t.setMaxZoom(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.zoom&&this.fire(new kn("zoomstart")).fire(new kn("zoom")).fire(new kn("zoomend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(e=0),e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let r=this._camera.transform.pitch,t=this._camera.getTransformForUpdate();return t.setMinPitch(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.pitch&&this.fire(new kn("pitchstart")).fire(new kn("pitch")).fire(new kn("pitchend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(e=60),e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let r=this._camera.transform.pitch,t=this._camera.getTransformForUpdate();return t.setMaxPitch(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.pitch&&this.fire(new kn("pitchstart")).fire(new kn("pitch")).fire(new kn("pitchend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??(e=20),e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(An.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(Wr.convert(e),this.terrain)}isMoving(){var e;return this._camera.isMoving()||((e=this._handlers)==null?void 0:e.isMoving())||!1}isZooming(){var e;return this._camera.isZooming()||((e=this._handlers)==null?void 0:e.isZooming())||!1}isRotating(){var e;return this._camera.isRotating()||((e=this._handlers)==null?void 0:e.isRotating())||!1}_createDelegatedListener(e,r,t){if(e==="mouseenter"||e==="mouseover"){let i=!1;return{layers:r,listener:t,delegates:{mousemove:a=>{let o=r.filter(l=>this.getLayer(l)),s=o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length?i||(i=!0,t.call(this,new df(e,this,a.originalEvent,{features:s}))):i=!1},mouseout:()=>{i=!1}}}}if(e==="mouseleave"||e==="mouseout"){let i=!1;return{layers:r,listener:t,delegates:{mousemove:a=>{let o=r.filter(s=>this.getLayer(s));(o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o})).length?i=!0:i&&(i=!1,t.call(this,new df(e,this,a.originalEvent)))},mouseout:a=>{i&&(i=!1,t.call(this,new df(e,this,a.originalEvent)))}}}}{let i=a=>{let o=r.filter(l=>this.getLayer(l)),s=o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length&&(a.features=s,t.call(this,a),delete a.features)};return{layers:r,listener:t,delegates:{[e]:i}}}}_saveDelegatedListener(e,r){var t;this._delegatedListeners||(this._delegatedListeners={}),(t=this._delegatedListeners)[e]||(t[e]=[]),this._delegatedListeners[e].push(r)}_removeDelegatedListener(e,r,t){var i;if(!((i=this._delegatedListeners)!=null&&i[e]))return;let a=this._delegatedListeners[e];for(let o=0;or.includes(l))){for(let l in s.delegates)this.off(l,s.delegates[l]);a.splice(o,1);return}}}on(e,r,t){if(t===void 0)return super.on(e,r);let i=typeof r=="string"?[r]:r,a=this._createDelegatedListener(e,i,t);this._saveDelegatedListener(e,a);for(let o in a.delegates)this.on(o,a.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,t)}}}once(e,r,t){if(t===void 0)return super.once(e,r);let i=typeof r=="string"?[r]:r,a=this._createDelegatedListener(e,i,t);for(let o in a.delegates){let s=a.delegates[o];a.delegates[o]=(...l)=>{this._removeDelegatedListener(e,i,t),s(...l)}}this._saveDelegatedListener(e,a);for(let o in a.delegates)this.once(o,a.delegates[o]);return this}off(e,r,t){if(t===void 0)return super.off(e,r);let i=typeof r=="string"?[r]:r;return this._removeDelegatedListener(e,i,t),this}queryRenderedFeatures(e,r){if(!this.style)return[];let t,i=e instanceof Wr||Array.isArray(e),a=i?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(r||(r=(i?{}:e)||{}),a instanceof Wr||typeof a[0]=="number")t=[Wr.convert(a)];else{let o=Wr.convert(a[0]),s=Wr.convert(a[1]);t=[o,new Wr(s.x,o.y),s,new Wr(o.x,s.y),o]}return this.style.queryRenderedFeatures(t,r,this._camera.transform)}querySourceFeatures(e,r){return this.style.querySourceFeatures(e,r)}setStyle(e,r){return r=yn({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),this._styleUrl=typeof e=="string"?e:null,r.diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let r=this._locale[e];if(r==null)throw Error(`Missing UI string '${e}'`);return r}_updateStyle(e,r){var t,i,a;if((t=this._diffStyleRequest)==null||t.abort(),this._diffStyleRequest=null,r.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,r));return}let o=this.style&&r.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new L2(this,r||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(a=(i=this.style)==null?void 0:i.projection)==null||a.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,r,o):this.style.loadJSON(e,r,o),this}_lazyInitEmptyStyle(){this.style||(this.style=new L2(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){return Xr(this,null,function*(){var t;if((t=this._diffStyleRequest)==null||t.abort(),typeof e=="string"){let i=e;this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let o=yield this._requestManager.transformRequest(i,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let s=yield vg(o,a);this._diffStyleRequest=null,this._updateDiff(s.data,r)}catch(o){this._diffStyleRequest=null,jp(o)||this.fire(new Ln(Zu(o)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,r))})}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(t){To(`Unable to perform style diff: ${Zu(t).message}. Rebuilding the style from scratch.`),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){To("There is no style added to the map.");return}return this.style.loaded()}addSource(e,r){return this._lazyInitEmptyStyle(),this.style.addSource(e,r),this._update(!0)}isSourceLoaded(e){var r;let t=(r=this.style)==null?void 0:r.tileManagers[e];if(t===void 0){this.fire(new Ln(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,r={}){if(this.style._checkLoaded(),e&&Q1(this,Hc.terrain,{value:e},r))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);else{let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&t.reload();for(let i in this.style._layers){let a=this.style._layers[i];a.type==="hillshade"&&a.source===e.source&&To("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&To("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new ZB(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new g8(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new yM({terrain:e})),this}_handleTerrainDataEvent(e,r){var t;if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let i=e.sourceId===r;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if(((t=e.source)==null?void 0:t.type)==="image"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){var e,r;return(r=(e=this.terrain)==null?void 0:e.options)!=null?r:null}areTilesLoaded(){var e;let r=(e=this.style)==null?void 0:e.tileManagers;for(let t of Object.values(r))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){var r;return(r=this.style)==null?void 0:r.getSource(e)}setSourceTileLodParams(e,r,t){if(t){let i=this.getSource(t);if(!i)throw Error(`There is no source with ID "${t}", cannot set LOD parameters`);i.calculateTileZoom=HA(Math.max(1,e),Math.max(1,r))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=HA(Math.max(1,e),Math.max(1,r));return this._update(!0),this}refreshTiles(e,r){let t=this.style.tileManagers[e];if(!t)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);r===void 0?t.reload(!0):t.refreshTiles(r.map(i=>new Rg(i.z,i.x,i.y)))}addImage(e,r,t={}){var i;this._lazyInitEmptyStyle();let a=this._createStyleImage(r,t);return a?(this.style.addImage(e,a),(i=a.userImage)!=null&&i.onAdd&&a.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){var r;return this._missingStyleImageResolver=e,(r=this.style)==null||r.setMissingImageResolver(e),this}_createStyleImage(e,r={}){let{pixelRatio:t=1,sdf:i=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:n}=r;if(e instanceof HTMLImageElement||P0(e)){let{width:u,height:c,data:f}=yc.getImageData(e);return{data:new Rs({width:u,height:c},f),pixelRatio:t,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:n,sdf:i,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new Ln(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:u,height:c,data:f}=e,h=e,d=ux(h.data);return{data:d?new Rs({width:u,height:c}):new Rs({width:u,height:c},new Uint8Array(f)),pixelRatio:t,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:n,sdf:i,version:0,isWebGLImage:d,userImage:h}}}updateImage(e,r){let t=this.style.getImage(e);if(!t)return this.fire(new Ln(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:a,data:o}=r instanceof HTMLImageElement||P0(r)?yc.getImageData(r):r;if(i===void 0||a===void 0)return this.fire(new Ln(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(i!==t.data.width||a!==t.data.height)return this.fire(new Ln(Error("The width and height of the updated image must be that same as the previous version of the image")));if(t.isWebGLImage=ux(o),t.isWebGLImage)t.userImage=r;else{let s=!(r instanceof HTMLImageElement||P0(r));t.data.replace(o,s)}return this.style.updateImage(e,t),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Ln(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return Xr(this,null,function*(){let r=yield td.getImage(yield this._requestManager.transformRequest(e,"Image"),new AbortController);if(!r.data)throw Error(`Could not load image ${e}: the response is empty`);return r})}listImages(){var e,r;return(r=(e=this.style)==null?void 0:e.listImages())!=null?r:[]}addLayer(e,r){return this._lazyInitEmptyStyle(),this.style.addLayer(e,r),this._update(!0)}moveLayer(e,r){return this.style.moveLayer(e,r),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){var r;return(r=this.style)==null?void 0:r.getLayer(e)}getLayersOrder(){var e,r;return(r=(e=this.style)==null?void 0:e.getLayersOrder())!=null?r:[]}setLayerZoomRange(e,r,t){return this.style.setLayerZoomRange(e,r,t),this._update(!0)}setFilter(e,r,t={}){var i;return(i=this.style)==null||i.setFilter(e,r,t),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,r,t,i={}){var a;return(a=this.style)==null||a.setPaintProperty(e,r,t,i),this._update(!0)}getPaintProperty(e,r){return this.style.getPaintProperty(e,r)}setLayoutProperty(e,r,t,i={}){return this.style.setLayoutProperty(e,r,t,i),this._update(!0)}getLayoutProperty(e,r){return this.style.getLayoutProperty(e,r)}setGlyphs(e,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,r,t={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,r,t,i=>{i||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,r,t=>{t||this._update(!0)}),this}setLight(e,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,r),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,r){return this.style.setFeatureState(e,r),this._update()}removeFeatureState(e,r){return this.style.removeFeatureState(e,r),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,r=0;return this._container&&(e=this._container.clientWidth||400,r=this._container.clientHeight||300),[e,r]}_shouldHandleInitialResize(){var e;if(!((e=this._container)!=null&&e.clientWidth)||!this._container.clientHeight)return!1;let[r,t]=this._containerDimensions();return r!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){var e;let r=!1,t=qz(a=>{this._trackResize&&!this._removed&&(this.resize(a),this.redraw())},50),i=(e=this._ownerWindow.ResizeObserver)!=null?e:ResizeObserver;this._resizeObserver=new i(a=>{!r&&(r=!0,!this._shouldHandleInitialResize())||t(a)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e=="string"){let r=document.getElementById(e);if(!r)throw Error(`Container '${e}' not found.`);return r}if(e instanceof HTMLElement||e&&typeof e=="object"&&e.nodeType===1)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let r=this._canvasContainer=$n.create("div","maplibregl-canvas-container",e);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=$n.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let t=this._containerDimensions(),i=this._getClampedPixelRatio(t[0],t[1]);this._resizeCanvas(t[0],t[1],i);let a=this._controlContainer=$n.create("div","maplibregl-control-container",e),o=this._controlPositions={};for(let s of["top-left","top-right","bottom-left","bottom-right"])o[s]=$n.create("div",`maplibregl-ctrl-${s} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,r,t){this._canvas.width=Math.floor(t*e),this._canvas.height=Math.floor(t*r),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let e=ar(Ot({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),r=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{r=i},{once:!0});let t=this._canvas.getContext("webgl2",e);if(!t)throw new sS(e,r);this.painter=new WN(t,this._camera.transform)}migrateProjection(e,r){this._camera.migrateProjection(e,r),this.painter.transform=e,this.fire(new _M({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var r;return(r=this.style)!=null&&r._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var r,t,i,a,o;let s=this._idleTriggered?this._fadeDuration:0,l=((r=this.style.projection)==null?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let f=this._camera.transform.zoom,h=hs();this.style.zoomHistory.update(f,h);let d=new ns(f,{now:h,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),p=d.crossFadingFactor();(p!==1||p!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=p),this.style.update(d)}let u=((t=this.style.projection)==null?void 0:t.transitionState)>0!==l;this._camera.transform.setTransitionState((i=this.style.projection)==null?void 0:i.transitionState),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=(a=this.style)==null?void 0:a._updatePlacement(this._camera.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new iu("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new iu("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let c=this._sourcesDirty||this._styleDirty||this._placementDirty||((o=this.painter.renderToTexture)==null?void 0:o.needsFollowUpFrame);return c||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new iu("idle")),this._loaded&&!this._fullyLoaded&&!c&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var e,r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),(e=this._diffStyleRequest)==null||e.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),td.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new iu("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,yc.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(r){if(!jp(r))throw r}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return _8}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},x8={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0},b8=class{constructor(e){this._updateZoomButtons=()=>{let r=this._map.getZoom(),t=r===this._map.getMaxZoom(),i=r===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let r=this._map.getPitch(),t=this._map.getRoll(),i=this._map.getBearing(),a=1/Math.cos(rl(r))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${a}) rotateZ(${-t}deg) rotateX(${r}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${a}) rotateX(${r}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-i-t}deg)`;return}this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(r,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);r.title=i,r.setAttribute("aria-label",i)},this.options=yn({},x8,e),this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),$n.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),$n.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=$n.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new w8(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,r){let t=$n.create("button",e,this._container);return t.type="button",t.addEventListener("click",r),t}},w8=class{constructor(e,r,t=!1){this.mousedown=a=>{this.startMove(a,$n.mousePos(this.element,a)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=a=>{this.move(a,$n.mousePos(this.element,a))},this.mouseup=a=>{this._rotatePitchHandler.dragEnd(a),this.offTemp()},this.touchstart=a=>{a.targetTouches.length===1?(this._startPos=this._lastPos=$n.touchPos(this.element,a.targetTouches)[0],this.startMove(a,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=a=>{a.targetTouches.length===1?(this._lastPos=$n.touchPos(this.element,a.targetTouches)[0],this.move(a,this._lastPos)):this.reset()},this.touchend=a=>{a.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;let i=new o8;this._rotatePitchHandler=new Wm({clickTolerance:3,move:(a,o)=>{let s=r.getBoundingClientRect(),l=new Wr((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:T9(new Wr(a.x,o.y),o,l),pitchDelta:t?(o.y-a.y)*-.5:void 0}},moveStateManager:i,enable:!0,assignEvents:()=>{}}),this.map=e,r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchcancel",this.reset)}startMove(e,r){this._rotatePitchHandler.dragStart(e,r),$n.disableDrag()}move(e,r){let t=this.map,{bearingDelta:i,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,r)||{};i&&t.setBearing(t.getBearing()+i),a&&t.setPitch(t.getPitch()+a)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){$n.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}},q2={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},kS={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},CS="#3FB1CE",a0=class extends hf{},LS=class extends hf{},V2=class extends Nl{constructor(e){if(super(),this._onClick=r=>{this.fire(new LS("click",{originalEvent:r}))},this._onKeyPress=r=>{(r.code==="Space"||r.code==="Enter")&&this.togglePopup()},this._onKeyDown=r=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||r.composedPath()[0]!==this._element||r.altKey||r.ctrlKey||r.metaKey)return;let t=kS[r.key];if(!t)return;r.preventDefault(),r.stopPropagation();let i=r.shiftKey?10:1,a=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new Wr(a.x+t[0]*i,a.y+t[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new a0("dragstart"))),this.fire(new a0("drag"))},this._onKeyUp=r=>{kS[r.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=r=>{let t=r.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=r=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();(r?.type==="terrain"||r?.type==="render"&&!t)&&this._map.once("render",this._update),this._lngLat=Hz(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!r||r.type==="moveend")&&(this._pos=this._pos.round()),this._element.style.transform=`${q2[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${i}`,yc.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(r?.type==="moveend")}).catch(()=>{})},this._onMove=r=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=r.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a0("dragstart"))),this.fire(new a0("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a0("dragend")),this._state="inactive"},this._addDragHandler=r=>{this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(this._pos).add(this._offset),this._pointerdownPos=r.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e?.anchor||"center",this._color=e?.color||CS,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=Wr.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=$n.create("div");let r=Ase().cloneNode(!0);r.setAttributeNS(null,"height",`${41*this._scale}px`),r.setAttributeNS(null,"width",`${27*this._scale}px`),Mse(r).setAttributeNS(null,"fill",this._color),this._element.appendChild(r),this._offset=Wr.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",r=>{r.preventDefault()}),this._element.addEventListener("mousedown",r=>{r.preventDefault()}),$z(this._element,this._anchor,"marker"),e?.className)for(let r of e.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=An.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let r=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,(24.6+r)*-1],"bottom-right":[-r,(24.6+r)*-1],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new a0("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(e=!1){var r,t;let i=(r=this._map)==null?void 0:r.terrain,a=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!i||a){let p=a?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==p&&(this._element.style.opacity=p,this._element.classList.toggle("maplibregl-marker-covered",a));return}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,s=o.terrain.depthAtPoint(this._pos),l=o.terrain.getElevationForLngLat(this._lngLat,o._camera.transform),n=o._camera.transform.lngLatToCameraDepth(this._lngLat,l),u=.006;if(n-su;(t=this._popup)!=null&&t.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",d)}getOffset(){return this._offset}setOffset(e){return this._offset=Wr.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&(this._tabIndexManaged=(this._element.getAttribute("tabindex")==="0"&&this._element.removeAttribute("tabindex"),!1))}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,r){return(this._opacity===void 0||e===void 0&&r===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=String(e)),r!==void 0&&(this._opacityWhenCovered=String(r)),this._map&&this._updateOpacity(!0),this}},T8={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ny=0,Xm=!1,n0=class extends hf{},G2=class extends hf{},FS=class extends hf{},A8=class extends Nl{constructor(e){super(),this._onSuccess=r=>{if(this._map){if(this._isOutOfMapMaxBounds(r)){this._setErrorState(),this.fire(new G2("outofmaxbounds",r)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(r),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new G2("geolocate",r)),this._finish()}},this._updateCamera=r=>{let t=new An(r.coords.longitude,r.coords.latitude),i=r.coords.accuracy,a=this._map.getBearing(),o=yn({bearing:a},this.options.fitBoundsOptions),s=bh.fromLngLat(t,i);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=r=>{if(r){let t=new An(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=r.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=r=>{if(this._map){if(r.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&Xm)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new FS("error",r)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=r=>{if(!this._map)return;let t=r?.[0]instanceof ResizeObserverEntry;!r.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!t&&!this._map.isZooming()&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new n0("trackuserlocationend")),this.fire(new n0("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",r=>{r.preventDefault()}),this._geolocateButton=$n.create("button","maplibregl-ctrl-geolocate",this._container),$n.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=r=>{if(this._map){if(r===!1){To("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=$n.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new V2({element:this._dotElement}),this._circleElement=$n.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new V2({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=yn({},T8,e)}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),Tse().then(r=>this._finishSetupUI(r)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,ny=0,Xm=!1}_isOutOfMapMaxBounds(e){let r=this._map.getMaxBounds(),t=e.coords;return r&&(t.longituder.getEast()||t.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":break;case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!e)return;let r=this._map.project(e),t=this._map.unproject([r.x+100,r.y]),i=e.distanceTo(t)/100,a=2*this._accuracy/i;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return To("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new n0("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ny--,Xm=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new n0("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new n0("trackuserlocationstart")),this.fire(new n0("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ny++;let e;ny>1?(e={maximumAge:6e5,timeout:0},Xm=!0):(e=this.options.positionOptions,Xm=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},M8={maxWidth:100,unit:"metric"},S8=class{constructor(e){this._onMove=()=>{Wz(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,Wz(this._map,this._container,this.options)},this.options=Ot(Ot({},M8),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},H2=class extends hf{},E8=class extends Nl{constructor(e={}){var r;super(),this._onFullscreenChange=()=>{var t;let i=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;(t=i?.shadowRoot)!=null&&t.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(r=e.pseudo)!=null?r:!1,e?.container&&(e.container instanceof HTMLElement?this._container=e.container:To("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=$n.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);$n.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new H2("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new H2("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},k8=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=$n.create("button","maplibregl-ctrl-terrain",this._container),$n.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},C8=class{constructor(){this._toggleProjection=()=>{var e;let r=(e=this._map.getProjection())==null?void 0:e.type;r==="mercator"||!r?this._map.setProjection({type:"globe"}):this._map.setProjection({type:"mercator"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((e=this._map.getProjection())==null?void 0:e.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=$n.create("button","maplibregl-ctrl-globe",this._container),$n.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},D8={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},L8=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),$2=class extends hf{},F8=class extends Nl{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new $2("close"))),this),this._update=r=>{let t=this._lngLat||this._trackPointer;if(!this._map||!t||!this._content)return;if(!this._container){if(this._container=$n.create("div","maplibregl-popup",this._map.getContainer()),this._tip=$n.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let n of this.options.className.split(" "))this._container.classList.add(n);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Hz(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer);let i;if(r&&"point"in r&&r.point&&(i=r.point),this._trackPointer&&!i)return;let a=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map._camera.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor,s=Yz(this.options.offset);if(!o){let n=this._container.offsetWidth,u=this._container.offsetHeight,c=kse(this.options.padding),f;f=a.y+s.bottom.ythis._map._camera.transform.height-u-c.bottom?["bottom"]:[],a.xthis._map._camera.transform.width-n/2-c.right&&f.push("right"),o=f.length===0?"bottom":f.join("-")}let l=a.add(s[o]);this.options.subpixelPositioning||(l=l.round()),this._container.style.transform=`${q2[o]} translate(${l.x}px,${l.y}px)`,$z(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=yn(Object.create(D8),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new $2("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=An.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let r=document.createDocumentFragment(),t=document.createElement("body"),i;for(t.innerHTML=e;i=t.firstChild,i;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=$n.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=$n.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(L8);e&&e.focus()}},P8=vM}}),jse=de({"build/maplibre_worker.js"(e,r){"use strict";r.exports='var t1=Object.defineProperty,e1=Object.defineProperties;var r1=Object.getOwnPropertyDescriptors;var nh=Object.getOwnPropertySymbols;var i1=Object.prototype.hasOwnProperty,n1=Object.prototype.propertyIsEnumerable;var ah=(t,e,r)=>e in t?t1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,je=(t,e)=>{for(var r in e||(e={}))i1.call(e,r)&&ah(t,r,e[r]);if(nh)for(var r of nh(e))n1.call(e,r)&&ah(t,r,e[r]);return t},Si=(t,e)=>e1(t,r1(e));var rt=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())});var a1=Object.create,ep=Object.defineProperty,s1=Object.getOwnPropertyDescriptor,o1=Object.getOwnPropertyNames,l1=Object.getPrototypeOf,rp=Object.prototype.hasOwnProperty,fl=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),u1=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=o1(e),a=0,s=n.length,o;ae[l]).bind(null,o),enumerable:!(i=s1(e,o))||i.enumerable});return t},h1=(t,e,r)=>(r=t==null?{}:a1(l1(t)),u1(e||!t||!t.__esModule||!rp.call(t,"default")?ep(r,"default",{value:t,enumerable:!0}):r,t));function B(t,e){this.x=t,this.y=e}B.prototype={clone(){return new B(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){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},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){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(t){if(t instanceof B)return t;if(Array.isArray(t))return new B(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new B(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};function c1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Nn;function p1(){return Nn!=null||(Nn=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Nn}var Un;function f1(){if(Un==null&&(Un=!1,p1())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){Un=!0;break}}}return Un||!1}var pe=typeof Float32Array<"u"?Float32Array:Array;Math.PI/180,180/Math.PI;function d1(){var t=new pe(9);return pe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function ip(){var t=new pe(3);return pe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function y1(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function sh(t,e,r){var i=new pe(3);return i[0]=t,i[1]=e,i[2]=r,i}function m1(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function g1(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ks(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var x1=y1;(function(){var t=ip();return function(e,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function w1(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=v1();return function(e,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function _1(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var lh=b1;(function(){var t=ip(),e=sh(1,0,0),r=sh(0,1,0);return function(i,n,a){var s=g1(n,a);return s<-.999999?(ks(t,e,n),x1(t)<1e-6&&ks(t,r,n),m1(t,t),D1(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(ks(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,lh(i,i))}})(),(function(){var t=oh(),e=oh();return function(r,i,n,a,s,o){return Ts(t,i,s,o),Ts(e,n,a,o),Ts(r,t,e,2*o*(1-o)),r}})(),(function(){var t=d1();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],lh(e,_1(e,t))}})();function A1(){var t=new pe(2);return pe!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=A1();return function(e,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function E1(t,e,r,i){return c1(t,e,r,i)}var d5=E1(.25,.1,.25,1);function Ji(t,e,r){return Math.min(r,Math.max(e,t))}function F1(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Gt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function k1(t){return Math.log(t)/Math.LN2%1==0}function Ia(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function T1(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function He(t){return Array.isArray(t)?t.map(He):typeof t=="object"&&t?Ia(t,He):t}var uh={};function Bt(t){uh[t]||(typeof console<"u"&&console.warn(t),uh[t]=!0)}function Ke(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}function Ca(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function I1(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}function C1(t,e,r,i,n){return rt(this,null,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(t,{timestamp:0});try{let s=a==null?void 0:a.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(yield a.copyTo(l,I1(t,e,r,i,n)),o)for(let u=0;u{t.removeEventListener(e,r,i)}}}function ch(t){return t*Math.PI/180}var ph="AbortError",dl=class extends Error{constructor(t=ph){super(t instanceof Error?t.message:t),this.name=ph,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function yl(t){return t instanceof Error&&t.name==="AbortError"}function B1(t){if(t.aborted)throw new dl(t.reason)}var ml={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function P1(t){return ml.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function sp(t,e){ml.REGISTERED_PROTOCOLS[t]=e}function op(t){delete ml.REGISTERED_PROTOCOLS[t]}var fh="global-dispatcher",ya=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function lp(){var t;if(mr(self))return(t=self.worker)==null?void 0:t.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch(e){}return window.location.href}var z1=t=>{var e;return t.startsWith("file:")||((e=lp())==null?void 0:e.startsWith("file:"))&&!/^\\w+:/.test(t)};function L1(t,e){return rt(this,null,function*(){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:lp(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=yield fetch(r)}catch(s){throw yl(s)?s:new ya(0,Ki(s).message,t.url,new Blob)}if(!i.ok){let s=yield i.blob();throw new ya(i.status,i.statusText,t.url,s)}let n;n=t.type==="arrayBuffer"||t.type==="image"?i.arrayBuffer():t.type==="json"?i.json():i.text();let a=yield n;return B1(e.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}})}function V1(t,e){return new Promise((r,i)=>{var a;let n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(n.responseType="arraybuffer");for(let s in t.headers)n.setRequestHeader(s,t.headers[s]);t.type==="json"&&(n.responseType="text",(a=t.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=t.credentials==="include",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let s=n.response;if(t.type==="json")try{s=JSON.parse(n.response)}catch(o){i(o);return}r({data:s,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let s=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new ya(n.status,n.statusText,t.url,s))}},e.signal.addEventListener("abort",()=>{n.abort(),i(new dl(e.signal.reason))}),n.send(t.body)})}var Ma=function(t,e){return rt(this,null,function*(){var r,i;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=P1(t.url);if(n){let a=yield n(t,e);return!a.data&&t.type==="arrayBuffer"?Gt(a,{data:new ArrayBuffer(0)}):a}if(mr(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:fh},e)}if(!z1(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return L1(t,e);if(mr(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:fh},e)}return V1(t,e)})},up=(t,e)=>Ma(Gt(t,{type:"json"}),e),hp=(t,e)=>Ma(Gt(t,{type:"arrayBuffer"}),e);function dh(t,e,r){var i;(i=r[t])!=null&&i.includes(e)||(r[t]||(r[t]=[]),r[t].push(e))}function Is(t,e,r){if(r!=null&&r[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var cp=class{constructor(t,e={}){Gt(this,e),this.type=t}},ma=class extends cp{constructor(t,e={}){super("error",Gt({error:t},e))}},O1=class{on(t,e){return this._listeners||(this._listeners={}),dh(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Is(t,e,this._listeners),Is(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),dh(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){var n,a,s,o,l,u;let r=typeof t=="string"?new cp(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let h=(s=(a=(n=this._listeners)==null?void 0:n[i])==null?void 0:a.slice())!=null?s:[];for(let f of h)f.call(this,r);let c=(u=(l=(o=this._oneTimeListeners)==null?void 0:o[i])==null?void 0:l.slice())!=null?u:[];for(let f of c)Is(i,f,this._oneTimeListeners),f.call(this,r);let p=this._eventedParent;p&&(Gt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(r))}else r instanceof ma&&console.error(r.error);return this}listens(t){var e,r,i,n,a;return!!((r=(e=this._listeners)==null?void 0:e[t])!=null&&r.length||(n=(i=this._oneTimeListeners)==null?void 0:i[t])!=null&&n.length||(a=this._eventedParent)!=null&&a.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},pp={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},w=pp,fp=["type","source","source-layer","minzoom","maxzoom","filter","layout"],E=class{constructor(t,e,r,i,n="error"){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},dn={kind:"null"},I={kind:"number"},Y={kind:"string"},tt={kind:"boolean"},ce={kind:"color"},Ba={kind:"projectionDefinition"},fr={kind:"object"},Z={kind:"value"},R1={kind:"error"},Pa={kind:"collator"},yn={kind:"formatted"},za={kind:"padding"},Qi={kind:"colorArray"},La={kind:"numberArray"},mn={kind:"resolvedImage"},Va={kind:"variableAnchorOffsetCollection"};function Ut(t,e){return{kind:"array",itemType:t,N:e}}function yt(t){if(t.kind==="array"){let e=yt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}var $1=[dn,I,Y,tt,ce,Ba,yn,fr,Ut(Z),za,La,Qi,mn,Va];function tn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of $1)if(!tn(r,e))return null}}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function gl(t,e){return e.some(r=>r.kind===t.kind)}function dr(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Ge(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var dp=.96422,yp=.82521,mp=4/29,Ks=6/29,gp=3*Ks*Ks,N1=Math.PI/180,U1=180/Math.PI;function xp(t){return t%=360,t<0&&(t+=360),t}function vp([t,e,r,i]){t=Cs(t),e=Cs(e),r=Cs(r);let n,a,s=Ms((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Ms((.4360747*t+.3850649*e+.1430804*r)/dp),a=Ms((.0139322*t+.0971045*e+.7141733*r)/yp));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Cs(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ms(t){return t>.008856451679035631?t**(1/3):t/gp+mp}function bp([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*Ps(n),a=dp*Ps(a),s=yp*Ps(s),[Bs(3.1338561*a-1.6168667*n-.4906146*s),Bs(-.9787684*a+1.9161415*n+.033454*s),Bs(.0719453*a-.2289914*n+1.4052427*s),i]}function Bs(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Ps(t){return t>Ks?t*t*t:gp*(t-mp)}function q1(t){let[e,r,i,n]=vp(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?xp(Math.atan2(i,r)*U1):NaN,a,e,n]}function j1([t,e,r,i]){return t=isNaN(t)?0:t*N1,bp([r,Math.cos(t)*e,Math.sin(t)*e,i])}function G1([t,e,r,i]){t=xp(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var X1=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ji(t,e){return X1(t,e)?t[e]:void 0}function Y1(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=ji(W1,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+i)||"ff")]}if(t.startsWith("rgb")){let i=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||" ",h||" ",f].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[s,u,p].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let v=[Rr(+a/x,0,1),Rr(+l/x,0,1),Rr(+c/x,0,1),d?yh(+d,y):1];if(mh(v))return v}}return}}let r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||" ",o||" ",u].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){let f=[+n,Rr(+s,0,100),Rr(+l,0,100),h?yh(+h,c):1];if(mh(f))return G1(f)}}}function qn(t){return parseInt(t.padEnd(2,t),16)/255}function yh(t,e){return Rr(e?t/100:t,0,1)}function Rr(t,e,r){return Math.min(Math.max(e,t),r)}function mh(t){return!t.some(Number.isNaN)}var W1={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],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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],rebeccapurple:[102,51,153],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]};function Je(t,e,r){return t+r*(e-t)}function ti(t,e,r){return t.map((i,n)=>Je(i,e[n],r))}function Z1(t){return t==="rgb"||t==="hcl"||t==="lab"}var Pt,gt=(Pt=class{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,r,i,n]))}static parse(e){if(e instanceof Pt)return e;if(typeof e!="string")return;let r=Y1(e);if(r)return new Pt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter("hcl",q1(this.rgb))}get lab(){return this.overwriteGetter("lab",vp(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(",")},${n})`}static interpolate(e,r,i,n="rgb"){switch(n){case"rgb":{let[a,s,o,l]=ti(e.rgb,r.rgb,i);return new Pt(a,s,o,l,!1)}case"hcl":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u180&&(v+=360),f=a+i*v}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=j1([f,d!=null?d:Je(s,h,i),Je(o,c,i),Je(l,p,i)]);return new Pt(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=bp(ti(e.lab,r.lab,i));return new Pt(a,s,o,l,!1)}}}},Pt.black=new Pt(0,0,0,1),Pt.white=new Pt(1,1,1,1),Pt.transparent=new Pt(0,0,0,0),Pt.red=new Pt(1,0,0,1),Pt),H1=["bottom","center","top"],Js=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},ze=class la{constructor(e){this.sections=e}static fromString(e){return new la([new Js(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof la?e:la.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Ae=class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Li(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Li(ti(e.values,r.values,i))}},Se=class Vi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vi)return e;if(typeof e=="number")return new Vi([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new Vi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Vi(ti(e.values,r.values,i))}},oe=class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(typeof e=="string"){let i=gt.parse(e);return i?new Oi([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!="string")return;let n=gt.parse(i);if(!n)return;r.push(n)}return new Oi(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n="rgb"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?i===void 0||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[t,e,r,i]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function ei(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Dr||t instanceof gt||t instanceof xl||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e)return!0;if(Array.isArray(t)){for(let e of t)if(!ei(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!ei(t[e]))return!1;return!0}return!1}function _t(t){if(t===null)return dn;if(typeof t=="string")return Y;if(typeof t=="boolean")return tt;if(typeof t=="number")return I;if(t instanceof gt)return ce;if(t instanceof Dr)return Ba;if(t instanceof xl)return Pa;if(t instanceof ze)return yn;if(t instanceof Ae)return za;if(t instanceof Se)return La;if(t instanceof oe)return Qi;if(t instanceof De)return Va;if(t instanceof _e)return mn;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=_t(i);if(!r)r=n;else{if(r===n)continue;r=Z;break}}return Ut(r||Z,e)}return fr}function Gi(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof gt||t instanceof Dr||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e?t.toString():JSON.stringify(t)}var ri=class _p{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i),a=r.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new _p(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},J1=["Unknown","Point","LineString","Polygon"],Ap=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?J1[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=gt.parse(t),this._parseColorCache.set(t,e)),e}};function Oa(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||ee)a=s-1;else throw new ft("Input is not a number.",r);return 0}var vl=class Sp{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let s=1;s=o)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new Sp(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[Oa(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Q1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var be=class Qs{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name==="exponential")a=zs(r,e.base,i,n);else if(e.name==="linear")a=zs(r,1,i,n);else if(e.name==="cubic-bezier"){let s=e.controlPoints;a=Q1(s[0],s[1],s[2],s[3])(zs(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,I),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Qi?l=ce:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u=h)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!Ge(l,I)&&!Ge(l,Ba)&&!Ge(l,ce)&&!Ge(l,za)&&!Ge(l,La)&&!Ge(l,Qi)&&!Ge(l,Va)&&!Ge(l,Ut(I))?r.error(`Type ${yt(l)} is not interpolatable.`):new Qs(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=Oa(r,n,this.key),o=r[s],l=r[s+1],u=Qs.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Je(h,c,u);case"color":return gt.interpolate(h,c,u);case"padding":return Ae.interpolate(h,c,u);case"colorArray":return oe.interpolate(h,c,u);case"numberArray":return Se.interpolate(h,c,u);case"variableAnchorOffsetCollection":return De.interpolate(h,c,u,this.key);case"array":return ti(h,c,u);case"projectionDefinition":return Dr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"hcl");case"colorArray":return oe.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"lab");case"colorArray":return oe.interpolate(h,c,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function zs(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var gr={color:gt.interpolate,number:Je,padding:Ae.interpolate,numberArray:Se.interpolate,colorArray:oe.interpolate,variableAnchorOffsetCollection:De.interpolate,array:ti},Ep=class Fp{constructor(e){this.type=yn,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return r.error("First argument must be an image or text section.");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o=="object"&&!Array.isArray(o)){a=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,I),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,Ut(Y)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,ce),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!H1.includes(o["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${o["vertical-align"]}\' instead.`);if(c=r.parse(o["vertical-align"],1,Y),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,Z);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Fp(n)}evaluate(e){return new ze(this.sections.map(r=>{let i=r.content.evaluate(e);return _t(i)===mn?new Js("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Js(Gi(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function kp(t,e,r=0,i=t.length-1,n=t0){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);kp(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(ki(t,r,e),n(t[i],a)>0&&ki(t,r,i);s0;)o--}n(t[r],a)===0?ki(t,r,o):(o++,ki(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function ki(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function t0(t,e){return te)}function Ra(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=r0(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a2){let u=e[1];if(typeof u!="string"||!(u in jn)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);o=jn[u],i++}else o=Z;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],i++}n=Ut(o,l)}else{if(!jn[a])throw Error(`Types doesn\'t contain name = ${a}`);n=jn[a]}let s=[];for(;ie.outputDefined())}},gh={"to-boolean":tt,"to-color":ce,"to-number":I,"to-string":Y},jr=class Ip{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[0];if(!gh[i])throw Error(`Can\'t parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return r.error("Expected one argument.");let n=gh[i],a=[];for(let s=1;s4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Dp(r[0],r[1],r[2],r[3]),!i))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ft(i||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(e);let n=Ae.parse(r);if(n)return n}throw new ft(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=Se.parse(r);if(n)return n}throw new ft(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=oe.parse(r);if(n)return n}throw new ft(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(e);let n=De.parse(r);if(n)return n}throw new ft(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"number":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new ft(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return ze.fromString(Gi(this.args[0].evaluate(e)));case"resolvedImage":return _e.fromString(Gi(this.args[0].evaluate(e)));case"projectionDefinition":{let r=this.args[0].evaluate(e);if(Dr.parse(r))return r;throw new ft(`Could not parse projectionDefinition from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}default:return Gi(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Cp=class Mp{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a=i.length)throw new ft(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new ft(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},n0=class Lp{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=tt}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);return!i||!n?null:gl(i.type,[tt,Y,I,dn,Z])?new Lp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);if(!dr(i,["string","array"]))throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},a0=class to{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=I}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);if(!i||!n)return null;if(!gl(i.type,[tt,Y,I,dn,Z]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new to(i,n,r.key,a):null}return new to(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),dr(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(dr(i,["array"]))return i.indexOf(r,n);throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},s0=class Vp{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let i,n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let a={},s=[];for(let u=2;u2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d=="number"&&Math.floor(d)!==d)return p.error("Numeric branch labels must be integer values.");if(!i)i=_t(d);else if(p.checkSubtype(i,_t(d)))return null;if(a[String(d)]!==void 0)return p.error("Branch labels must be unique.");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(e[1],1,Z);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!=="value"&&r.concat(1).checkSubtype(i,o.type)?null:new Vp(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(_t(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},o0=class Op{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let n=[];for(let s=1;sr.outputDefined())&&this.otherwise.outputDefined()}},l0=class eo{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,I);if(!i||!n)return null;if(!gl(i.type,[Ut(Z),Y,Z]))return r.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new eo(i.type,i,n,r.key,a):null}return new eo(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),dr(r,["string"]))return[...r].slice(i,n).join("");if(dr(r,["array"]))return r.slice(i,n);throw new ft(`Expected first argument to be of type array or string, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Rp=class ro{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=null,n=r.expectedType;n&&n.kind!=="value"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>tn(n,s.type))?new ro(Z,a):new ro(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof _e&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function xh(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function u0(t,e,r){return e===r}function h0(t,e,r){return e!==r}function c0(t,e,r){return er}function f0(t,e,r){return e<=r}function d0(t,e,r){return e>=r}function $p(t,e,r,i){return i.compare(e,r)===0}function y0(t,e,r,i){return!$p(t,e,r,i)}function m0(t,e,r,i){return i.compare(e,r)<0}function g0(t,e,r,i){return i.compare(e,r)>0}function x0(t,e,r,i){return i.compare(e,r)<=0}function v0(t,e,r,i){return i.compare(e,r)>=0}function li(t,e,r){let i=t!=="=="&&t!=="!=";return class Np{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=tt,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let o=a[0],l=s.parse(a[1],1,Z);if(!l)return null;if(!xh(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type \'${yt(l.type)}\'.`);let u=s.parse(a[2],2,Z);if(!u)return null;if(!xh(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type \'${yt(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types \'${yt(l.type)}\' and \'${yt(u.type)}\'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ie(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ie(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Pa),!h)return null}return new Np(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new ft(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!=="string"||u.kind!=="string")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var b0=li("==",u0,$p),w0=li("!=",h0,y0),D0=li("<",c0,m0),_0=li(">",p0,g0),A0=li("<=",f0,x0),S0=li(">=",d0,v0),Up=class qp{constructor(e,r,i){this.type=Pa,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return r.error("Collator options argument must be an object.");let n=r.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,tt);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,tt);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,Y),!s)?null:new qp(n,a,s)}evaluate(e){return new xl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},E0=class jp{constructor(e,r,i,n,a,s){this.type=Y,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=r.parse(n.locale,1,Y),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,Y),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,Y),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=r.parse(n["min-fraction-digits"],1,I),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,I),!u)?null:new jp(i,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},F0=class Gp{constructor(e){this.type=mn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let i=r.parse(e[1],1,Y);return i?new Gp(i):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),i=_e.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},k0=class Xp{constructor(e,r){this.input=e,this.key=r,this.type=I}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Xp(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ft(`Expected value to be of type string or array, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},we=8192;function T0(t,e){let r=I0(t[0]),i=M0(t[1]),n=2**e.z;return[Math.round(r*n*we),Math.round(i*n*we)]}function bl(t,e){let r=2**e.z,i=(t[0]/we+e.x)/r,n=(t[1]/we+e.y)/r;return[C0(i),B0(n)]}function I0(t){return(180+t)/360}function C0(t){return t*360-180}function M0(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function B0(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function gn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function en(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function P0(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function z0(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function $a(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return R0([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(vh(t,e,r,i)&&vh(r,i,t,e))}function L0(t,e,r){for(let i of r)for(let n=0;n0&&c<0||h<0&&c>0}function wl(t,e,r){let i=[];for(let n=0;nr[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}gn(e,t)}function $0(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function bh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Zp(u,e,r,n),s.push(u)}return s}function wh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){$0(e);for(let o of s)for(let l of o)Zp(l,e,r,n)}return s}function N0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!ui(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!V0(o,a))return!1}return!0}function U0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!Yp(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!O0(o,a))return!1}return!0}var Dl=class ha{constructor(e,r){this.type=tt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s==="Polygon"&&n.push(o),s==="MultiPolygon"&&n.push(...o)}if(n.length)return new ha(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new ha(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new ha(i,i)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return N0(e,this.geometries);if(e.geometryType()==="LineString")return U0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Hp=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}},Dh=Math.PI/180,_l=class{constructor(t){let e=Dh*6378.137*1e3,r=Math.cos(t*Dh),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f180;)t-=360;return t}};function Kp(t,e){return e[0]-t[0]}function ga(t){return t[1]-t[0]+1}function Le(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];let r=ga(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function no(t,e){if(!Le(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)gn(r,t[i]);return r}function ao(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)gn(e,i);return e}function _h(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Al(t,e,r){if(!_h(t)||!_h(e))return NaN;let i=0,n=0;return t[2]e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]=i)return i;if(en(n,a)){if(Ah(t,e))return 0}else if(Ah(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(ga(u)<=h){if(!Le(u,t.length))return NaN;if(e){let c=X0(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=G0(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=io(u,e);Sh(s,a,i,t,o,c[0]),Sh(s,a,i,t,o,c[1])}}return a}function va(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new Hp([[0,[0,t.length-1],[0,r.length-1]]],Kp);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(ga(u)<=c&&ga(h)<=p){if(!Le(u,t.length)&&Le(h,r.length))return NaN;let f;if(e&&i)f=q0(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=hr(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=hr(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=j0(t,u,r,h,n),s=Math.min(s,f)}else{let f=io(u,e),d=io(h,i);Gn(o,s,n,t,r,f[0],d[0]),Gn(o,s,n,t,r,f[0],d[1]),Gn(o,s,n,t,r,f[1],d[0]),Gn(o,s,n,t,r,f[1],d[1])}}return s}function W0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function Z0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function H0(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Ra(r,0).map(s=>s.map(o=>o.map(l=>bl([l.x,l.y],t.canonical)))),n=new _l(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case"Point":a=Math.min(a,xa([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,xa(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,Y0(o,s.coordinates,n,a))}if(a===0)return a}return a}function Ls(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var El=class ca{constructor(e,r){this.type=I,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new ca(i,i.features.map(n=>Ls(n.geometry)).flat());if(i.type==="Feature")return new ca(i,Ls(i.geometry));if("type"in i&&"coordinates"in i)return new ca(i,Ls(i))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W0(e,this.geometries);if(e.geometryType()==="LineString")return Z0(e,this.geometries);if(e.geometryType()==="Polygon")return H0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},K0=class Jp{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=Z;break}this.type=Ut(r!=null?r:Z,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`\'semiliteral\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,Z));return new Jp(a)}return new ri(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},Fl=class Qp{constructor(e){this.key=e,this.type=Z}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error("Global state property must be defined."):typeof i=="string"?new Qp(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){var i,n;let r=(i=e.globals)==null?void 0:i.globalState;return!r||Object.keys(r).length===0?null:(n=ji(r,this.key))!=null?n:null}eachChild(){}outputDefined(){return!1}},Yr={"==":b0,"!=":w0,">":_0,"<":D0,">=":S0,"<=":A0,array:Ie,at:i0,boolean:Ie,case:o0,coalesce:Rp,collator:Up,format:Ep,image:F0,in:n0,"index-of":a0,interpolate:be,"interpolate-hcl":be,"interpolate-lab":be,length:k0,let:Cp,literal:ri,match:s0,number:Ie,"number-format":E0,object:Ie,semiliteral:K0,slice:l0,step:vl,string:Ie,"to-boolean":jr,"to-color":jr,"to-number":jr,"to-string":jr,var:Bp,within:Dl,distance:El,"global-state":Fl},ve=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},J0=class tf{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new tf(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},ef=class rf{constructor(e,r,i=[],n,a=new J0,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);let i=this.key;function n(a,s,o){return o==="assert"?new Ie(s,[a],i):o==="coerce"?new jr(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let a=e[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=n(o,l,r.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=n(o,l,r.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof ri)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new Ap;try{o=new ri(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return e===void 0?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e=="number"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new rf(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join("")}`;this.errors.push(new ve(i,e))}checkSubtype(e,r){let i=tn(e,r);return i&&this.error(i),i}},_r=class Ri{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Ri.definitions[i];if(!n)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new ef(r.registry,ba,r.path,null,r.scope);let c=[],p=!1;for(let f=1;ftm(c)).join(" | "),h=[];for(let c=1;c>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function sr(t){return{type:t}}_r.register(Yr,{error:[R1,[Y],(t,[e],r)=>{throw new ft(e.evaluate(t),r)}],typeof:[Y,[Z],(t,[e])=>yt(_t(e.evaluate(t)))],"to-rgba":[Ut(I,4),[ce],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[ce,[I,I,I],Eh],rgba:[ce,[I,I,I,I],Eh],has:{type:tt,overloads:[[[Y],(t,[e])=>Fh(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Fh(e.evaluate(t),r.evaluate(t))]]},get:{type:Z,overloads:[[[Y],(t,[e])=>Vs(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Vs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Z,[Y],(t,[e])=>Vs(e.evaluate(t),t.featureState||{})],properties:[fr,[],t=>t.properties()],"geometry-type":[Y,[],t=>t.geometryType()],id:[Z,[],t=>t.id()],zoom:[I,[],t=>t.globals.zoom],"heatmap-density":[I,[],t=>t.globals.heatmapDensity||0],elevation:[I,[],t=>t.globals.elevation||0],"line-progress":[I,[],t=>t.globals.lineProgress||0],accumulated:[Z,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[I,sr(I),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],"*":[I,sr(I),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],"-":{type:I,overloads:[[[I,I],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[I],(t,[e])=>-e.evaluate(t)]]},"/":[I,[I,I],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[I,[I,I],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[I,[I],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[I,[I],(t,[e])=>Math.log(e.evaluate(t))],log2:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[I,[I],(t,[e])=>Math.sin(e.evaluate(t))],cos:[I,[I],(t,[e])=>Math.cos(e.evaluate(t))],tan:[I,[I],(t,[e])=>Math.tan(e.evaluate(t))],asin:[I,[I],(t,[e])=>Math.asin(e.evaluate(t))],acos:[I,[I],(t,[e])=>Math.acos(e.evaluate(t))],atan:[I,[I],(t,[e])=>Math.atan(e.evaluate(t))],min:[I,sr(I),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[I,sr(I),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[I,[I],(t,[e])=>Math.abs(e.evaluate(t))],round:[I,[I],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[I,[I],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[I,[I],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[tt,[Y,Z],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[tt,[Z],(t,[e])=>t.id()===e.value],"filter-type-==":[tt,[Y],(t,[e])=>t.geometryType()===e.value],"filter-<":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i{let r=t.id(),i=e.value;return typeof r==typeof i&&r":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[tt,[Z],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[tt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[tt,[Ut(Y)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[tt,[Ut(Z)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[tt,[Y,Ut(Z)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[tt,[Y,Ut(Z)],(t,[e,r])=>Q0(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[tt,[tt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[tt,[Y],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Y,[Y],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Y,[Y],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Y,sr(Z),(t,e)=>e.map(r=>Gi(r.evaluate(t))).join("")],split:[Ut(Y),[Y,Y],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[Y,[Ut(Y),Y],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[Y,[Pa],(t,[e])=>e.evaluate(t).resolvedLocale()]});function tm(t){return Array.isArray(t)?`(${t.map(yt).join(", ")})`:`(${yt(t.type)}...)`}function ba(t){if(t instanceof Bp)return ba(t.boundExpression);if(t instanceof _r&&t.name==="error"||t instanceof Up||t instanceof Dl||t instanceof El||t instanceof Fl)return!1;let e=t instanceof jr||t instanceof Ie,r=!0;return t.eachChild(i=>{r&&(r=e?ba(i):i instanceof ri)}),r?Na(t)&&Ua(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Na(t){if(t instanceof _r&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Dl||t instanceof El)return!1;let e=!0;return t.eachChild(r=>{e&&!Na(r)&&(e=!1)}),e}function rn(t){if(t instanceof _r&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!rn(r)&&(e=!1)}),e}function Ua(t,e){if(t instanceof _r&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!Ua(i,e)&&(r=!1)}),r}function ii(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function nf(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function kl(t){return!!t.expression&&t.expression.interpolated}var Tl=/^(.*)-transition$/;function nn(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function Q(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function qa(t){return typeof t=="object"&&!!t&&!Array.isArray(t)&&_t(t)===fr}function em(t){return t}function rm(t){switch(t.type){case"color":return gt.parse;case"padding":return Ae.parse;case"numberArray":return Se.parse;case"colorArray":return oe.parse;default:return null}}function im(t){switch(t){case"exponential":return sf;case"interval":return am;case"categorical":return nm;case"identity":return sm;default:throw Error(`Unknown function type "${t}"`)}}function af(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",i=r||t.property!==void 0,n=r||!i,a=t.type||(kl(e)?"exponential":"interval"),s=rm(e);if(s&&(t=nn({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!Z1(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o=im(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;dd[0]),evaluate({zoom:d},y){return sf({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a==="exponential"?{name:"exponential",base:t.base===void 0?1:t.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:be.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?xn(t.default,e.default):o(t,e,p,l,u)}}}function xn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function nm(t,e,r,i,n){return xn(typeof r===n?i[r]:void 0,t.default,e.default)}function am(t,e,r){if(Q(r)!=="number")return xn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=Oa(t.stops.map(a=>a[0]),r,"");return t.stops[n][1]}function sf(t,e,r){let i=t.base===void 0?1:t.base;if(Q(r)!=="number")return xn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=Oa(t.stops.map(h=>h[0]),r,""),s=om(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=gr[e.type]||em;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function sm(t,e,r){switch(e.type){case"color":r=gt.parse(r);break;case"formatted":r=ze.fromString(r.toString());break;case"resolvedImage":r=_e.fromString(r.toString());break;case"padding":r=Ae.parse(r);break;case"colorArray":r=oe.parse(r);break;case"numberArray":r=Se.parse(r);break;default:Q(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return xn(r,t.default,e.default)}function om(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function so(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}var Il=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new Ap,this._defaultValue=r?pf(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ft(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(", ")}, but found ${JSON.stringify(s)} instead.`,"");return s}catch(s){let o=s instanceof ft?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(of(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function of(t,e,r,i){return`${t}${e}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function lf(t){if(!t)throw Error(\'rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".\')}function ja(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Yr}function er(t,e,r,i){lf(e);let n=new ef(Yr,ba,[],r?hm(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?so(new Il(a,e,r,i)):Nr(n.errors)}var an=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},wa=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?be.interpolationFactor(this.interpolationType,t,e,r):0}};function lm(t){return t._styleExpression!==void 0}function uf(t,e,r,i){let n=er(t,e,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Na(a);if(!s&&!ii(r))return Nr([new ve("","data expressions not supported")]);let o=Ua(a,["zoom"]);if(!o&&!nf(r))return Nr([new ve("","zoom expressions not supported")]);let l=pa(a);if(!l&&!o)return Nr([new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(l instanceof ve)return Nr([l]);if(l instanceof be&&!kl(r))return Nr([new ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!l)return so(s?new an("constant",n.value,i):new an("source",n.value,i));let u=l instanceof be?l.interpolation:void 0;return so(s?new wa("camera",n.value,l.labels,u,i):new wa("composite",n.value,l.labels,u,i))}var hf=class cf{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,lf(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=pf(i),this._warningHistory={};let n=af(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<"u"&&console.warn(of(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new cf(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function um(t,e,r,i){if(qa(t))return new hf(t,e,r);if(ja(t)){let n=uf(t,e,r,i);if(n.result==="error")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return n.value}{let n=t;return r.type==="color"&&typeof t=="string"?n=gt.parse(t):r.type==="padding"&&(typeof t=="number"||Array.isArray(t))?n=Ae.parse(t):r.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?n=Se.parse(t):r.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?n=oe.parse(t):r.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?n=De.parse(t):r.type==="projectionDefinition"&&typeof t=="string"&&(n=Dr.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function pa(t){let e=null;if(t instanceof Cp)e=pa(t.result);else if(t instanceof Rp){for(let r of t.args)if(e=pa(r),e)break}else(t instanceof vl||t instanceof be)&&t.input instanceof _r&&t.input.name==="zoom"&&(e=t);return e instanceof ve||t.eachChild(r=>{let i=pa(r);i instanceof ve?e=i:!e&&i?e=new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&i&&e!==i&&(e=new ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function vn(t,e=new Set){return t instanceof Fl&&e.add(t.key),t.eachChild(r=>{vn(r,e)}),e}function hm(t){let e={color:ce,string:Y,number:I,enum:Y,boolean:tt,formatted:yn,padding:za,numberArray:La,colorArray:Qi,projectionDefinition:Ba,resolvedImage:mn,variableAnchorOffsetCollection:Va};return t.type==="array"?Ut(e[t.value]||Z,t.length):e[t.type]}function pf(t){if(t.type==="color"&&qa(t.default))return new gt(0,0,0,0);switch(t.type){case"color":return gt.parse(t.default)||null;case"padding":return Ae.parse(t.default)||null;case"numberArray":return Se.parse(t.default)||null;case"colorArray":return oe.parse(t.default)||null;case"variableAnchorOffsetCollection":return De.parse(t.default)||null;case"projectionDefinition":return Dr.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ni(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=t!=null?t:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:e}}function cm(t){let e=!1;for(let r of t){let i=ff(r);if(i==="expression")return"expression";i==="legacy"&&(e=!0)}return e?"legacy":"neutral"}function ff(t){if(typeof t=="boolean")return"neutral";if(!Array.isArray(t)||t.length===0)return"legacy";switch(t[0]){case"has":return t.length<2||t[1]==="$id"||t[1]==="$type"?"legacy":t.length===2?"neutral":"expression";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return cm(t.slice(1));default:return"expression"}}function Cl(t){return ff(t)!=="legacy"}function kh(t){return t==="$type"?["geometry-type"]:t==="$id"?["id"]:["get",t]}function pm(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return t.length!==3||typeof t[1]!="string"?null:[t[0],kh(t[1]),t[2]];case"in":case"!in":{if(t.length<2||typeof t[1]!="string")return null;let e=["in",kh(t[1]),["literal",t.slice(2)]];return t[0]==="!in"?["!",e]:e}case"has":case"!has":{if(t.length!==2||typeof t[1]!="string"||t[1]==="$type"||t[1]==="$id")return null;let e=["has",t[1]];return t[0]==="!has"?["!",e]:e}default:return null}}function df(t){if((t[0]==="<"||t[0]==="<="||t[0]===">"||t[0]===">=")&&t[1]==="$type")return`"$type" cannot be use with operator "${t[0]}"`;let e=pm(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Os(t,e,r){let i=r[t];return Array.isArray(i)?Cl(i)?Ml(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Ml(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case"all":case"any":case"none":for(let r=1;r"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${e}${i}: ${df(r.legacyFilter)}`)}var dm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ai(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cl(t)?fm(t,e):t=Da(t);let i=er(t,e,dm,r);if(i.result==="error")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:yf(t),getGlobalStateRefs:()=>vn(i.value.expression)}}function ym(t,e){return te)}function yf(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Rs(t[1],t[2],e):e==="any"?mm(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Da)):e==="none"?["all"].concat(t.slice(1).map(Da).map(Xn)):e==="in"?Th(t[1],t.slice(2)):e==="!in"?Xn(Th(t[1],t.slice(2))):e==="has"?Ih(t[1]):e!=="!has"||Xn(Ih(t[1]))}function Rs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function mm(t){return["any"].concat(t.map(Da))}function Th(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(ym)]]:["filter-in-small",t,["literal",e]]}}function Ih(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Xn(t){return["!",t]}function mf(t){let e=t.key,r=t.value;return r?[new E(e,r,"constants have been deprecated as of v8")]:[]}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function xr(t){if(Array.isArray(t))return t.map(xr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=xr(t[r]);return e}return Dt(t)}function te(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=Q(r);if(u!=="object")return[new E(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=ji(i,c)||i["*"],f;if(ji(n,c))f=n[c];else if(ji(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new E(e,r[h],`unknown property "${h}"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new E(e,r,`missing required property "${h}"`));return l}function Bl(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(Q(e)!=="array")return[new E(s,e,`array expected, ${Q(e)} found`)];if(r.length&&e.length!==r.length)return[new E(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),Q(r.value)==="object"&&(l=r.value);let u=[];for(let h=0;hi.maximum?[new E(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new E(e,r,`number expected, ${n} found`)]}function gf(t){let e=t.valueSpec,r=Dt(t.value.type),i,n={},a,s,o=r!=="categorical"&&t.value.property===void 0,l=!o,u=Q(t.value.stops)==="array"&&Q(t.value.stops[0])==="array"&&Q(t.value.stops[0][0])==="object",h=te({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r==="identity"&&o&&h.push(new E(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&h.push(new E(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!kl(t.valueSpec)&&h.push(new E(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ii(t.valueSpec)?h.push(new E(t.key,t.value,"property functions not supported")):o&&!nf(t.valueSpec)&&h.push(new E(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&h.push(new E(t.key,t.value,\'"property" property is required\')),h;function c(y){if(r==="identity")return[new E(y.key,y.value,\'identity function may not have a "stops" property\')];let m=[],g=y.value;return m=m.concat(Bl({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),Q(g)==="array"&&g.length===0&&m.push(new E(y.key,g,"array must have at least one stop")),m}function p(y){let m=[],g=y.value,x=y.key;if(Q(g)!=="array")return[new E(x,g,`array expected, ${Q(g)} found`)];if(g.length!==2)return[new E(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(Q(g[0])!=="object")return[new E(x,g,`object expected, ${Q(g[0])} found`)];if(g[0].zoom===void 0)return[new E(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new E(x,g,"object stop key must have value")];if(s&&s>Dt(g[0].zoom))return[new E(x,g[0].zoom,"stop zoom values must appear in ascending order")];Dt(g[0].zoom)!==s&&(s=Dt(g[0].zoom),a=void 0,n={}),m=m.concat(te({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Ga,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return ja(xr(g[1]))?m.concat([new E(`${x}[1]`,g[1],"expressions are not allowed in function stops.")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=Q(y.value),x=Dt(y.value),v=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new E(y.key,v,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new E(y.key,v,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let b=`number expected, ${g} found`;return ii(e)&&r===void 0&&(b+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new E(y.key,v,b)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new E(y.key,v,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&xnew E(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new E(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ua(r,["zoom","feature-state"]))return[new E(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Na(r))return[new E(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gm(t){let e=t.value,r=t.key,i=Q(e);return i==="boolean"?[]:[new E(r,e,`boolean expected, ${i} found`)]}function oo(t){let e=t.key,r=t.value,i=Q(r);return i==="string"?gt.parse(String(r))?[]:[new E(e,r,`color expected, "${r}" found`)]:[new E(e,r,`color expected, ${i} found`)]}function sn(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function xm(t,e){let r=t;for(let i of e)r=r[i];return r}function vm(t,e){let r=Ml(e);return r?[new E(`${t.key}${r.path.map(i=>`[${i}]`).join("")}`,xm(t.value,r.path),df(r.legacyFilter),null,"warning")]:[]}function Pl(t){let e=xr(t.value);return Cl(e)?[...vm(t,e),...si(nn({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:xf(t)}function xf(t){let e=t.value,r=t.key;if(Q(e)!=="array")return[new E(r,e,`array expected, ${Q(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new E(r,e,"filter array must have at least 1 element")];switch(a=a.concat(sn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Dt(e[1])==="$type"&&a.push(new E(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new E(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Q(e[1]),n!=="string"&&a.push(new E(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s{c in r&&e.push(new E(i,r[c],`"${c}" is prohibited for ref layers`))});let h;n.layers.forEach(c=>{Dt(c.id)===o&&(h=c)}),h?h.ref?e.push(new E(i,r.ref,"ref cannot reference another ref layer")):s=Dt(h.type):e.push(new E(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)e.push(new E(i,r,\'missing required property "source"\'));else{let h=n.sources&&n.sources[r.source],c=h&&Dt(h.type);h?c==="vector"&&s==="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster source`)):c!=="raster-dem"&&s==="hillshade"||c!=="raster-dem"&&s==="color-relief"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster-dem source`)):c==="raster"&&s!=="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a vector source`)):c==="vector"&&!r["source-layer"]?e.push(new E(i,r,`layer "${r.id}" must specify a "source-layer"`)):c==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?e.push(new E(i,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):s==="line"&&r.paint&&r.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&e.push(new E(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new E(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&((l=r.paint)!=null&&l.resampling)&&((u=r.paint)!=null&&u["raster-resampling"])&&e.push(new E(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),e=e.concat(te({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Pl,layout(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return wf(nn({layerType:s},c))}}})},paint(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return bf(nn({layerType:s},c))}}})}}})),e}function tr(t){let e=t.value,r=t.key,i=Q(e);return i==="string"?[]:[new E(r,e,`string expected, ${i} found`)]}function bm(t){var c;let e=(c=t.sourceName)!=null?c:"",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=Q(r);if(r===void 0)return s;if(o!=="object")return s.push(new E("source_raster_dem",r,`object expected, ${o} found`)),s;let l=Dt(r.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let p in r)!l&&u.includes(p)?s.push(new E(p,r[p],`In "${e}": "${p}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):n[p]?s=s.concat(t.validateSpec({key:p,value:r[p],valueSpec:n[p],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new E(p,r[p],`unknown property "${p}"`));return s}var Ch={promoteId:wm};function _f(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new E(r,e,\'"type" is required\')];let s=Dt(e.type),o;switch(s){case"vector":case"raster":return o=te({key:r,value:e,valueSpec:i[`source_${s.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Ch,validateSpec:a}),o;case"raster-dem":return o=bm({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=te({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Ch}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...si({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:"cluster-map"})),o.push(...si({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return te({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return te({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new E(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function wm({key:t,value:e}){if(Q(e)==="string")return tr({key:t,value:e});{let r=[];for(let i in e)r.push(...tr({key:`${t}.${i}`,value:e[i]}));return r}}function Af(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("light",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(Tl);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)])}return a}function Sf(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=Q(e);if(e===void 0)return[];if(a!=="object")return[new E("sky",e,`object expected, ${a} found`)];let s=[];for(let o in e){let l=o.match(Tl);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,style:n,styleSpec:r})):i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new E(o,e[o],`unknown property "${o}"`)])}return s}function Ef(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("terrain",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)]);return a}function Dm(t){return tr(t).length===0?[]:si(t)}function _m(t){return tr(t).length===0?[]:si(t)}function Am(t){let e=t.key,r=t.value;if(Q(r)==="array"){if(r.length<1||r.length>4)return[new E(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a[new E(t,e,\'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"\')],n=r.match(Mm);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>Mh||u>Mh?[new E(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new E(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function Tf(t){var o,l;let e=(o=t.key)!=null?o:"font-faces",r=t.value,i=t.validateSpec,n=(l=t.styleSpec)!=null?l:pp,a=t.style;if(!lo(r))return[new E(e,r,`object expected, ${Q(r)} found`)];let s=[];for(let u in r){let h=r[u],c=Q(h);if(c==="string")s.push(...tr({key:`${e}.${u}`,value:h}));else if(c==="array"){let p={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[f,d]of h.entries()){let y=`${e}.${u}[${f}]`;s.push(...te({key:y,value:d,valueSpec:p,styleSpec:n,style:a,validateSpec:i}));let m=lo(d)?d["unicode-range"]:void 0;if(Q(m)==="array")for(let[g,x]of m.entries())s.push(...Bm(`${y}.unicode-range[${g}]`,x))}}else s.push(new E(`${e}.${u}`,h,`string or array expected, ${c} found`))}return s}var Bh={"*"(){return[]},array:Bl,boolean:gm,number:Ga,color:oo,constants:mf,enum:sn,filter:Pl,function:gf,layer:Df,object:te,source:_f,light:Af,sky:Sf,terrain:Ef,projection:km,projectionDefinition:Tm,string:tr,formatted:Dm,resolvedImage:_m,padding:Am,numberArray:Sm,colorArray:Em,variableAnchorOffsetCollection:Fm,sprite:Ff,state:kf,fontFaces:Tf};function Xi(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Xi,r.expression&&qa(Dt(e))?gf(t):r.expression&&ja(xr(e))?si(t):r.type&&Bh[r.type]?Bh[r.type](t):te(nn({},t,{valueSpec:r.type?i[r.type]:r}))}function If(t){let e=t.value,r=t.key,i=tr(t);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{range}" token\'))),i}function Qt(t,e=w){let r=[];return r=r.concat(Xi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xi,objectElementValidators:{glyphs:If,"*"(){return[]}}})),t.constants&&(r=r.concat(mf({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Xi}))),Cf(r)}Qt.source=ie(re(_f)),Qt.sprite=ie(re(Ff)),Qt.glyphs=ie(re(If)),Qt.fontFaces=ie(re(Tf)),Qt.light=ie(re(Af)),Qt.sky=ie(re(Sf)),Qt.terrain=ie(re(Ef)),Qt.state=ie(re(kf)),Qt.layer=ie(re(Df)),Qt.filter=ie(re(Pl)),Qt.paintProperty=ie(re(bf)),Qt.layoutProperty=ie(re(wf));function re(t){return function(e){return t(Object.assign({},e,{validateSpec:Xi}))}}function Cf(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function ie(t){return function(...e){return Cf(t.apply(this,e))}}var Pm={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"},zm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){var t;return(t=this._literalValue)!=null?t:this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none"){this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=er(t,this._rootKey,Pm,this._globalState);if(e.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=vn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Lm(t,e,r){return new zm(t,e,r)}var Ph=Qt,y5=new Set(Object.keys(w).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function Vm(t,e){let r=!1;for(let i of e){if(i.severity==="warning"){Bt(i.message);continue}t.fire(new ma(Error(i.message))),r=!0}return r}function Om(t,e,r,i){return(i==null?void 0:i.validate)!==!1&&Vm(t,e(je({styleSpec:w},r)))}var uo=class Mf{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if((!l||l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;sr?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}},$m="-transition",Xa=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=um(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},ho=class{constructor(t,e,r){this.property=t,this.value=new Xa(t,void 0,e,r)}transitioned(t,e){return new Lh(this.property,this.value,e,Gt({},t.transition,this.transition),t.now)}untransitioned(){return new Lh(this.property,this.value,null,{},0)}},Nm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return He(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Xa(this._values[t].property,e===null?void 0:He(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return He(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=He(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${$m}`]=i)}return t}transitioned(t,e){let r=new Vh(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Vh(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Lh=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(ii.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Lf=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new st(Math.floor(e.zoom-1),e)),t.expression.evaluate(new st(Math.floor(e.zoom),e)),t.expression.evaluate(new st(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Wa=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},Xt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Xa(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new ho(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",N),C("DataConstantProperty",V),C("CrossFadedDataDrivenProperty",on),C("CrossFadedProperty",Lf),C("ColorRampProperty",Wa);var Rh=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",$s=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",de=class extends O1{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Lm(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=ai(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Um(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new Nm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=ai(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if(t==="visibility")return this.visibility;if((e=this._transitionablePaint)!=null&&e.hasProperty(t))throw Error(t+Rh);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var e;let t=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let i=this._transitionablePaint._values[r].value;for(let n of i.getGlobalStateRefs()){let a=(e=t.get(n))!=null?e:[];a.push({name:r,value:i.value}),t.set(n,a)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){var i;if(t==="visibility"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if((i=this._transitionablePaint)!=null&&i.hasProperty(t)){this.fire(new ma(Error(t+Rh)));return}e!=null&&this._validate(Ph.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,r;if(t.endsWith("-transition")){let i=t.slice(0,-11);if(i==="visibility"||(e=this._unevaluatedLayout)!=null&&e.hasProperty(i))throw Error(t+$s);return this._transitionablePaint.getTransition(i)}if(t==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(t))throw Error(t+$s);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){var i;if(t==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(t))return this.fire(new ma(Error(t+$s))),!1;if(e!=null&&this._validate(Ph.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let n=this._transitionablePaint._values[t],a=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let l=this._transitionablePaint._values[t].value;return l.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(t,o,l)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){var e,r;let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)==null?void 0:e.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),T1(t,(i,n)=>i!==void 0&&!(n==="layout"&&!Object.keys(i).length)&&!(n==="paint"&&!Object.keys(i).length))}_validate(t,e,r,i,n={}){return Om(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof se&&ii(e.property.specification)&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}},qm,jm=()=>qm||(qm=new Xt({"raster-opacity":new V(w.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new V(w.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new V(w.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new V(w.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new V(w.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new V(w.paint_raster["raster-contrast"],"raster-contrast"),resampling:new V(w.paint_raster.resampling,"resampling"),"raster-resampling":new V(w.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new V(w.paint_raster["raster-fade-duration"],"raster-fade-duration")})),Gm={get paint(){return jm()}};var Xm=class extends de{constructor(t,e){super(t,Gm,e)}},Ym={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},bn=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},xt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function At(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Wm(n.type),s=r=$h(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:$h(r,Math.max(i,e)),alignment:e}}function Wm(t){return Ym[t].BYTES_PER_ELEMENT}function $h(t,e){return Math.ceil(t/e)*e}var ln=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};ln.prototype.bytesPerElement=4,C("StructArrayLayout2i4",ln);var co=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};co.prototype.bytesPerElement=6,C("StructArrayLayout3i6",co);var Nh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Nh.prototype.bytesPerElement=8,C("StructArrayLayout4i8",Nh);var po=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};po.prototype.bytesPerElement=12,C("StructArrayLayout2i4i12",po);var fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};fo.prototype.bytesPerElement=8,C("StructArrayLayout2i4ub8",fo);var un=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};un.prototype.bytesPerElement=8,C("StructArrayLayout2f8",un);var yo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};yo.prototype.bytesPerElement=20,C("StructArrayLayout10ui20",yo);var mo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};mo.prototype.bytesPerElement=16,C("StructArrayLayout8ui16",mo);var go=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};go.prototype.bytesPerElement=28,C("StructArrayLayout4i4ui4i1f28",go);var xo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};xo.prototype.bytesPerElement=12,C("StructArrayLayout3f12",xo);var vo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};vo.prototype.bytesPerElement=4,C("StructArrayLayout1ul4",vo);var bo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};bo.prototype.bytesPerElement=20,C("StructArrayLayout6i1ul2ui20",bo);var wo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};wo.prototype.bytesPerElement=12,C("StructArrayLayout2i2i2i12",wo);var Uh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};Uh.prototype.bytesPerElement=16,C("StructArrayLayout2f1f2i16",Uh);var Do=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};Do.prototype.bytesPerElement=16,C("StructArrayLayout2ub2f2i16",Do);var _o=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};_o.prototype.bytesPerElement=6,C("StructArrayLayout3ui6",_o);var Ao=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let v=t*26,b=t*13,D=t*52;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=i,this.uint16[v+3]=n,this.uint32[b+2]=a,this.uint32[b+3]=s,this.uint32[b+4]=o,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[b+7]=c,this.float32[b+8]=p,this.uint8[D+36]=f,this.uint8[D+37]=d,this.uint8[D+38]=y,this.uint32[b+10]=m,this.int16[v+22]=g,this.float32[b+12]=x,t}};Ao.prototype.bytesPerElement=52,C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ao);var So=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P){let L=this.length;return this.resize(L+1),this.emplace(L,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P,L){let F=t*34,$=t*17;return this.int16[F+0]=e,this.int16[F+1]=r,this.int16[F+2]=i,this.int16[F+3]=n,this.int16[F+4]=a,this.int16[F+5]=s,this.int16[F+6]=o,this.int16[F+7]=l,this.uint16[F+8]=u,this.uint16[F+9]=h,this.uint16[F+10]=c,this.uint16[F+11]=p,this.uint16[F+12]=f,this.uint16[F+13]=d,this.uint16[F+14]=y,this.uint16[F+15]=m,this.uint16[F+16]=g,this.uint16[F+17]=x,this.uint16[F+18]=v,this.uint16[F+19]=b,this.uint16[F+20]=D,this.uint16[F+21]=A,this.uint16[F+22]=_,this.uint32[$+12]=S,this.float32[$+13]=k,this.float32[$+14]=z,this.uint16[F+30]=O,this.uint16[F+31]=P,this.float32[$+16]=L,t}};So.prototype.bytesPerElement=68,C("StructArrayLayout8i15ui1ul2f2ui1f68",So);var _a=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};_a.prototype.bytesPerElement=4,C("StructArrayLayout1f4",_a);var Eo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};Eo.prototype.bytesPerElement=12,C("StructArrayLayout1ui2f12",Eo);var Fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};Fo.prototype.bytesPerElement=8,C("StructArrayLayout1ul2ui8",Fo);var ko=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};ko.prototype.bytesPerElement=4,C("StructArrayLayout2ui4",ko);var qh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};qh.prototype.bytesPerElement=2,C("StructArrayLayout1ui2",qh);var To=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};To.prototype.bytesPerElement=16,C("StructArrayLayout4f16",To);var Vf=class extends bn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new B(this.anchorPointX,this.anchorPointY)}};Vf.prototype.size=20;var Ll=class extends bo{get(t){return new Vf(this,t)}};C("CollisionBoxArray",Ll);var Of=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Of.prototype.size=52;var Rf=class extends Ao{get(t){return new Of(this,t)}};C("PlacedSymbolArray",Rf);var $f=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};$f.prototype.size=68;var Nf=class extends So{get(t){return new $f(this,t)}};C("SymbolInstanceArray",Nf);var Uf=class extends _a{getoffsetX(t){return this.float32[t*1+0]}};C("GlyphOffsetArray",Uf);var qf=class extends co{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};C("SymbolLineVertexArray",qf);var jf=class extends bn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};jf.prototype.size=12;var Gf=class extends Eo{get(t){return new jf(this,t)}};C("TextAnchorOffsetArray",Gf);var Xf=class extends bn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Xf.prototype.size=8;var Yf=class extends Fo{get(t){return new Xf(this,t)}};C("FeatureIndexArray",Yf);var Zm=class extends ln{};var Hm=class extends ln{},Km=class extends ln{},Jm=class extends po{},Qm=class extends fo{},tg=class extends un{},Vr=class extends yo{},jh=class extends mo{},eg=class extends go{},rg=class extends xo{},ig=class extends vo{},Gh=class extends wo{};var ng=class extends Do{};var wn=class extends _o{},Io=class extends ko{};var Co=At([{name:"a_pos",components:2,type:"Int16"}],4),ag=Co.members;Co.size,Co.alignment;var ee=class Ur{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Ur.MAX_VERTEX_ARRAY_LENGTH&&Bt(`Max vertices per segment is ${Ur.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${Ur.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Ur.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new Ur([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};ee.MAX_VERTEX_ARRAY_LENGTH=2**16-1,C("SegmentVector",ee);function Xh(t,e){return t=Ji(Math.floor(t),0,255),e=Ji(Math.floor(e),0,255),256*t+e}var sg=At([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),og=At([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),lg=fl(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),ug=fl(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),Mo=h1(fl(((t,e)=>{var r=lg(),i=ug();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),Wf=class Zf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Yh(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=Yh(e),i=0,n=this.ids.length-1;for(;i>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Bo(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Zf;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Yh(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Mo.default)(String(t))}function Bo(t,e,r,i){for(;r>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]n);if(a>=s)break;Yn(t,a,s),Yn(e,3*a,3*s),Yn(e,3*a+1,3*s+1),Yn(e,3*a+2,3*s+2)}s-r`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new cg(t,e):new Ol(t,e)}},ur=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i==="u_pattern_to"?n=this.patternTo:i==="u_pattern_from"?n=this.patternFrom:i==="u_dasharray_to"?n=this.dashTo:i==="u_dasharray_from"?n=this.dashFrom:i==="u_pixel_ratio_to"?n=this.pixelRatioTo:i==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new hg(t,e):new Ol(t,e)}},ke=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new st(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type==="color"){let i=Po(r);for(let n=t;n`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new st(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new st(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(this.zoom,n),r,i),s=this.expression.evaluate(new st(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=Po(r),a=Po(i);for(let s=t;s`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof ke||r instanceof he)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof Ye){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof $i||r instanceof ur||r instanceof he)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof $i||n instanceof ur||n instanceof he){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof Ye){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ke||r instanceof he)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof ke||r instanceof he||r instanceof Ye)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ke||e instanceof he||e instanceof Ye)&&e.destroy()}}},vr=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Jf(i,e,r);this.needsUpload=!1,this._featureMap=new Wf,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function pg(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function fg(t){return{"line-pattern":{source:Vr,composite:Vr},"fill-pattern":{source:Vr,composite:Vr},"fill-extrusion-pattern":{source:Vr,composite:Vr},"line-dasharray":{source:jh,composite:jh}}[t]}function Wh(t,e,r){var n;let i={color:{source:un,composite:To},number:{source:_a,composite:un}};return((n=fg(t))==null?void 0:n[r])||i[e][r]}C("ConstantBinder",$i),C("CrossFadedConstantBinder",ur),C("SourceExpressionBinder",ke),C("CrossFadedPatternBinder",Hf),C("CrossFadedDasharrayBinder",Kf),C("CompositeExpressionBinder",he),C("ProgramConfiguration",Jf,{omit:["_buffers"]}),C("ProgramConfigurationSet",vr);var zo=2**14-1,Zh=-zo-1;function Ar(t){let e=mt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Ji(a,Zh,zo),n.y=Ji(s,Zh,zo),(an.x+1||sn.y+1)&&Bt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function hi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ar(t):[]}}var Hh=-32768;function dg(t,e,r,i,n){t.emplaceBack(Hh+e*8+i,Hh+r*8+n)}var Rl=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Hm,this.indexArray=new wn,this.segments=new ee,this.programConfigurations=new vr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),o||(o=c.paint.get("circle-pitch-alignment")==="map")}let l=o?e.subdivisionGranularity.circle:1,u=new st(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=hi(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Ar(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ag),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f=3){for(let n of i)if(oi(t,n))return!0}if(gg(t,i,r))return!0}return!1}function gg(t,e,r){if(t.length>1){if($l(t,e))return!0;for(let i of e)if(Lo(i,t,r))return!0}for(let i of t)if(Lo(i,e,r))return!0;return!1}function $l(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function Kh(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;oe.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function oi(t,e){let r=!1;for(let i=0,n=t.length-1;ie.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function vg(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(e,r),new B(e,n),new B(i,n),new B(i,r)];if(t.length>2){for(let s of a)if(oi(t,s))return!0}for(let s=0;sn.x&&e.x>n.x||t.yn.y&&e.y>n.y)return!1;let a=Ke(t,e,r[0]);return a!==Ke(t,e,r[1])||a!==Ke(t,e,r[2])||a!==Ke(t,e,r[3])}function Wr(t,e,r){let i=e.paint.get(t).value;return i.kind==="constant"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ha(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ka(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=B.convert(e)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function wg(t){let e=[];for(let r=0;rNl(n,e,r,i))}var kg,Tg=()=>kg||(kg=new Xt({"circle-sort-key":new N(w.layout_circle["circle-sort-key"],"circle-sort-key")})),Ig,Cg=()=>Ig||(Ig=new Xt({"circle-radius":new N(w.paint_circle["circle-radius"],"circle-radius"),"circle-color":new N(w.paint_circle["circle-color"],"circle-color"),"circle-blur":new N(w.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new N(w.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new V(w.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new V(w.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new V(w.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new V(w.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new N(w.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new N(w.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new N(w.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})),Mg={get paint(){return Cg()},get layout(){return Tg()}};var Bg=class extends de{constructor(t,e){super(t,Mg,e)}createBucket(t){return new Rl(t)}queryRadius(t){let e=t;return Wr("circle-radius",this,e)+Wr("circle-stroke-width",this,e)+Ha(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ka(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),h=this.paint.get("circle-pitch-scale"),c=this.paint.get("circle-pitch-alignment"),p,f;return c==="map"?(p=l,f=u*a):(p=Fg(l,n,s,o),f=u),ed({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},rd=class extends Rl{};C("HeatmapBucket",rd,{omit:["layers"]});var Pg,zg=()=>Pg||(Pg=new Xt({"heatmap-radius":new N(w.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new N(w.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new V(w.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Wa(w.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new V(w.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})),Lg={get paint(){return zg()}};function Ul(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function id(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Ul({},{width:e,height:r},i);ql(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function ql(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,o=e.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s$g||($g=new Xt({"hillshade-illumination-direction":new V(w.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new V(w.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new V(w.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new V(w.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new V(w.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new V(w.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new V(w.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new V(w.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new V(w.paint_hillshade.resampling,"resampling")})),Ug={get paint(){return Ng()}};var qg=class extends de{constructor(t,e){super(t,Ug,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(ch);return{directionRadians:t.map(ch),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},jg,Gg=()=>jg||(jg=new Xt({"color-relief-opacity":new V(w["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Wa(w["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new V(w["paint_color-relief"].resampling,"resampling")})),Xg={get paint(){return Gg()}};function Wn(t){return"data"in t}var Jh=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){var u;let{width:i,height:n}=t,a=(((u=this.size)==null?void 0:u[0])!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!(e!=null&&e.useMipmap),a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&(e==null?void 0:e.premultiply)!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let h=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,h,o.RGBA8,i,n),Wn(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:c}=t;l&&c&&(c=Ns(c)),c&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,c)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:h,y:c}=r||{x:0,y:0};Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,h,c,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,h,c,o))}this.useMipmap&&!(Wn(t)&&t.data===null)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=Ns(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=Ns(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Pe,jl=(Pe=class{constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){Bt(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),Pe.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;hthis.max&&(this.max=f),f=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+2)*this.stride+i+2)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-2||e>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(e+2)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return sd(e,this.getUnpackVector())}getPixels(){return new Zt({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-2;break;case 1:a=n+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;ph&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Ro(a,s,o,l,u),s}function od(t,e,r,i,n){let a=null;if(n===fx(t,e,r,i)>0)for(let s=e;s=e;s-=i)a=ec(s/i|0,t[s],t[s+1],a);return a&&cn(a,a.next)&&(fn(a),a=a.next),a}function br(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(hn.size===0||!hn.has(i))&&(cn(i,i.next)||Ft(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),Oo=!0,fn(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function Ro(t,e,r,i,n){n&&ox(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(Ft(o,t,l)<0&&(n?Kg(t,r,i,n):Hg(t))){e.push(o.i,t.i,l.i),fn(t),t=l,a=l;continue}if(t=l,t===a){if(Oo=!1,t=br(t),Oo){a=t;continue}if(!s){t=Jg(t,e),a=t,s=!0;continue}Qg(t,e,r,i,n);break}}}function Hg(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&Ea(n,o,a,l,s,u,d.x,d.y)&&Ft(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Kg(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=qo(f,d,e,r,i),x=qo(y,m,e,r,i),v=t.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&Ea(o,h,l,c,u,p,v.x,v.y)&&Ft(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=t.nextZ;for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&Ea(o,h,l,c,u,p,b.x,b.y)&&Ft(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Jg(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;ud(n,r,r.next,a,!1)&&pn(n,a)&&pn(a,n)&&(e.push(n.i,r.i,a.i),fn(r),fn(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?br(r):r}function Qg(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&hx(a,s)){let o=hd(a,s);a=br(a,a.next),o=br(o,o.next),Ro(a,e,r,i,n),Ro(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var $o=!1;function tx(t,e,r,i){let n=[];for(let a=0,s=e.length;as&&(s=r.x),r.yo&&(o=r.y),h.xs&&(s=h.x),h.yo&&(o=h.y),r=h}while(++l<16&&r!==e);Uo[i]=r;let u=i*4;wt[u]=n,wt[u+1]=a,wt[u+2]=s,wt[u+3]=o}while(r!==e)}function nx(t,e){let r=t.z*4;e.xwt[r+2]&&(wt[r+2]=e.x),e.y>wt[r+3]&&(wt[r+3]=e.y)}function Qh(t){let e=Uo[t];for(;e.prev.next!==e;)e=e.next;return Uo[t]=e,e}function tc(t){let e=No[t];for(;e.prev.next!==e;)e=e.next;return No[t]=e,e}function ax(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(cn(t,r))return r;for(let p=0,f=0;pwt[f+3]||wt[f]>i||wt[f+2]<=a)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r){if(cn(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.xi||wt[f+3]h)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&Ea(ni)&&(ys.x||r.x===s.x&&sx(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function sx(t,e){return Ft(t.prev,t,e.prev)<0&&Ft(e.next,t,t.next)<0}var ae=[],Ti=[],or=new Uint32Array,Ii=new Uint32Array,Ci=new Uint32Array(256);function ox(t,e,r,i){let n=t,a=0;do n.z=qo(n.x,n.y,e,r,i),ae[a++]=n,n=n.next;while(n!==t);lx(a);let s=null;for(let o=0;o=0&&ae[n].z>i;)ae[n+1]=ae[n],n--;ae[n+1]=r}return}or.length>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=Ci[o];Ci[o]=s,s+=l}for(let o=0;o>>a&255]++;i[u]=e[o],n[u]=l}}function qo(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function ux(t){let e=t,r=t;do(e.x=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function hx(t,e){let r=cn(t,e)&&Ft(t.prev,t,t.next)>0&&Ft(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||pn(t,e)&&pn(e,t)&&(Ft(t.prev,t,e.prev)!==0||Ft(t,e.prev,e)!==0))&&!cx(t,e)&&(r||px(t,e))}function Ft(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function cn(t,e){return t.x===e.x&&t.y===e.y}function ud(t,e,r,i,n=!0){let a=Ft(t,e,r),s=Ft(t,e,i),o=Ft(r,i,t),l=Ft(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Hn(t,r,e)||s===0&&Hn(t,i,e)||o===0&&Hn(r,t,i)||l===0&&Hn(r,e,i)):!1}function Hn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function cx(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.xa&&o.y>a||s.y=0&&Ft(t,t.prev,e)>=0:Ft(t,e,t.prev)<0||Ft(t,t.next,e)<0}function px(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function hd(t,e){let r=jo(t.i,t.x,t.y),i=jo(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function ec(t,e,r,i){let n=jo(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function fn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),$o&&nx(t.prev,t.next)}function jo(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function fx(t,e,r,i){let n=0;for(let a=e,s=r-i;at)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return gx(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i=1||b<=0)||m&&(ln)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&v>0){let _=o+f*v,S=l+d*v;a.push(this._vertexToIndex(_,S))}let D=o+f*Math.max(v,0),A=o+f*Math.min(b,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,D,A),!m&&b<1){let _=o+f*b,S=l+d*b;a.push(this._vertexToIndex(_,S))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,A,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,b=o=1||m<=0){let _=e-a,S=r-s,k=(l-s)/S,z=(u-s)/S,O=a+_*Math.min(k,z);x=Math.floor(Math.min(O,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(O,o)/this._granularityCellSize)-1,b=o0?u:l;if(b)for(let _=x;_<=v;_++){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}else for(let _=v;_>=x;_--){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}}_generateOutline(t){let e=[];for(let r of t){let i=cr(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;sn==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=mt,a=t.length;for(let s=2;s=2&&((s=this._canonical)==null?void 0:s.z)===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(o=>this._removeLinesOutsideTileX(o))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,O=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,P=Math.abs(_-z),L=Math.abs(S-O),F=Math.abs(_-y),$=Math.abs(S-m),U=g?P/D:1/0,T=x?L/A:1/0;if((F<=P||!g)&&($<=L||!x))break;if(U0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function xx(t,e,r){if(e.length===0)throw Error("Subdivision vertex ring is empty.");let i=0,n=t[e[0]*2];for(let l=1;l=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(hp)x=!1;else{let v=g-y,b=-(m-d),D=y((p-d)*v+(f-y)*b)*D&&(x=!0)}if(x){let v=e[l],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),s--,s<0&&(s=a-1)}else{let v=e[u],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),o++,o>=a&&(o=0)}if(l===u)break}}function pd(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(uee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let v=Zi(s,i,a,o,p,y,u),b=Zi(s,i,a,o,f,m,u),D=Zi(s,i,a,o,d,g,u);r.emplaceBack(h+v-l,h+b-l,h+D-l),u.primitiveLength++}}function bx(t,e,r,i,n,a){let s=[];for(let c=0;cee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Zi(s,i,a,o,f,y,u),v=Zi(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+v-l),u.primitiveLength++}}var fd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Km,this.indexArray=new wn,this.indexArray2=new Io,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.segments2=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=Gl("fill",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:e,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let r in e.patterns){let i=e.patterns[r];this.recordSdfPattern(r,t[i.min]),this.recordSdfPattern(r,t[i.mid]),this.recordSdfPattern(r,t[i.max])}for(let e of this.layers){let r=e.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(e.id,t[r.from.toString()]),this.recordSdfPattern(e.id,t[r.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let r=e.sdf===!0,i=this.sdfPatterns[t];i===void 0?this.sdfPatterns[t]=r:i!==r&&Bt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t}"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wg),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Ra(e,500)){let o=cd(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;pd((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};C("FillBucket",fd,{omit:["layers","patternFeatures"]});var wx,Dx=()=>wx||(wx=new Xt({"fill-sort-key":new N(w.layout_fill["fill-sort-key"],"fill-sort-key")})),_x,Ax=()=>_x||(_x=new Xt({"fill-antialias":new V(w.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new N(w.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new V(w.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new N(w.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new N(w.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new V(w.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new V(w.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new on(w.paint_fill["fill-pattern"],"fill-pattern")})),Sx={get paint(){return Ax()},get layout(){return Dx()}};var Ex=class extends de{constructor(t,e){super(t,Sx,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new fd(t)}queryRadius(){return Ha(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Qf(Ka(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},Go=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fx=At([{name:"a_centroid",components:2,type:"Int16"}],4),kx=Go.members;Go.size,Go.alignment;var Fa=class Xo{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new Xo;return r.extend(e(new B(this.minX,this.minY))),r.extend(e(new B(this.maxX,this.minY))),r.extend(e(new B(this.minX,this.maxY))),r.extend(e(new B(this.maxX,this.maxY))),r}static fromPoints(e){let r=new Xo;for(let i of e)r.extend(i);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}},g5=Fa.fromPoints([new B(0,0),new B(mt,mt)]);function Yo(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function rc(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Dn=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),no&&(o=n),au&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:"LineString",coordinates:c[0]}:{type:"MultiLineString",coordinates:c}}else if(this.type===3){let c=dd(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};Dn.types=["Unknown","Point","LineString","Polygon"];function dd(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new Dn(this._pbf,e,this.extent,this._keys,this._values)}};function Cx(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ui(F1(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return yd*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof Ui)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ui(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e)return new Ui(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}},md=2*Math.PI*yd;function gd(t){return md*Math.cos(t*Math.PI/180)}function Mx(t){return(180+t)/360}function Bx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Px(t,e){return t/gd(e)}function zx(t){return t*360-180}function Wo(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Lx(t,e){return t*gd(Wo(e))}function Vx(t){return 1/Math.cos(t*Math.PI/180)}var Yl=class xd{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=ic.convert(e);return new xd(Mx(i.lng),Bx(i.lat),Px(r,i.lat))}toLngLat(){return new ic(zx(this.x),Wo(this.y))}toAltitude(){return Lx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/md*Vx(Wo(this.y))}};function Ox(t,e,r){let i=1/(1<Nx(n,i))}function $x(t,e){let r=Rx(mt/2,mt/2,e),i=Yl.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function qx(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var js=8192;function Mi(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*js)*2+s,n*js*2,a*js*2,Math.round(o))}var vd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Jm,this.centroidVertexArray=new Zm,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=Aa("fill-extrusion",this.layers,e);let i=new st(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=hi(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Ar(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?nc(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Gl("fill-extrusion",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures({options:t,canonical:e,patternPositions:r}){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Fx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?nc(e,o,i):e;for(let u of Ra(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y{Mi(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;iee.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function jx(t,e){for(let r=0;rGx||(Gx=new Xt({"fill-extrusion-rounded-corner-distance":new V(w["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})),Yx,Wx=()=>Yx||(Yx=new Xt({"fill-extrusion-opacity":new V(w["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new N(w["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new V(w["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new V(w["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new on(w["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new N(w["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new N(w["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new V(w["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})),Zx={get paint(){return Wx()},get layout(){return Xx()}};var Hx=class extends de{constructor(t,e){super(t,Zx,e)}createBucket(t){return new vd(t)}queryRadius(){return Ha(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ka(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=Qx(o,s,0),c=Jx(i,u,l,s),p=c[0],f=c[1];return Kx(p,f,h)}};function Bi(t,e){return t.x*e.x+t.y*e.y}function ac(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;pn){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);di&&(o-e>3&&Zo(t,e,o,i),t[o+2]=n,r-o>3&&Zo(t,o,r,i))}function t2(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function Mt(t,e,r,i){let n={type:e,geom:r},a={id:t!=null?t:null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":Pi(a,n.geom);break;case"LineString":Pi(a,n.geom.points);break;case"Polygon":Pi(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)Pi(a,s.points);break;case"MultiPolygon":for(let s of n.geom)Pi(a,s[0].points)}return a}function Wl(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Pi(t,e){for(let r=0;r1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(e.geometry.type==="GeometryCollection"){r2(t,e,e.geometry,r,i,n+1);return}if(!((o=e.geometry.coordinates)!=null&&o.length))return;let a=e2(e,r,i),s=(r.tolerance/((1<0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&Zo(e.points,0,o,r),e.points[o+2]=1,Wl(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function Kl(t,e,r,i){for(let n=0;n1?1:r}function u2(t){return{type:"FeatureCollection",features:t.map(e=>ka(e))}}function ka(t){let e={type:"Feature",geometry:h2(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function h2(t){let{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:bd(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:Kn(r)};case"LineString":return{type:e,coordinates:Kn(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map(i=>Kn(i.points))};case"MultiPolygon":return{type:e,coordinates:r.map(i=>i.map(n=>Kn(n.points)))}}}function Kn(t){let e=[];for(let r=0;r=r&&s=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c=i))switch(u.type){case"Point":case"MultiPoint":c2(u,l,r,i,n);continue;case"LineString":p2(u,l,r,i,n,o);continue;case"MultiLineString":f2(u,l,r,i,n);continue;case"Polygon":d2(u,l,r,i,n);continue;case"MultiPolygon":y2(u,l,r,i,n);continue}}return l.length?l:null}function c2(t,e,r,i,n){let a=[];if(m2(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";e.push(Mt(t.id,s,a,t.tags))}function p2(t,e,r,i,n,a){let s=[];if(_d(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(Mt(t.id,"LineString",o,t.tags));return}if(s.length>1){e.push(Mt(t.id,"MultiLineString",s,t.tags));return}e.push(Mt(t.id,"LineString",s[0],t.tags))}}function f2(t,e,r,i,n){let a=[];if(Jl(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(Mt(t.id,"LineString",a[0],t.tags));return}e.push(Mt(t.id,"MultiLineString",a,t.tags))}}function d2(t,e,r,i,n){let a=[];Jl(t.geometry,a,r,i,n,!0),a.length&&e.push(Mt(t.id,"Polygon",a,t.tags))}function y2(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];Jl(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(Mt(t.id,"MultiPolygon",a,t.tags))}function m2(t,e,r,i,n){for(let a=0;a=r&&s<=i&&Kr(e,t[a],t[a+1],t[a+2])}}function _d(t,e,r,i,n,a,s){let o=sc(t),l=n===0?g2:x2,u=t.start,h,c;for(let g=0;gr&&(c=l(o,x,v,D,A,r),s&&(o.start=u+h*c)):_>i?S=r&&(c=l(o,x,v,D,A,r),k=!0),S>i&&_<=i&&(c=l(o,x,v,D,A,i),k=!0),!a&&k&&(s&&(o.end=u+h*c),e.push(o),o=sc(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&Kr(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&Kr(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Wl(o),e.push(o))}function sc(t){return{points:[],size:t.size,start:t.start,end:t.end}}function Jl(t,e,r,i,n,a){for(let s of t)_d(s,e,r,i,n,a,!1)}function Kr(t,e,r,i){t.push(e,r,i)}function g2(t,e,r,i,n,a){let s=(a-e)/(i-e);return Kr(t.points,a,r+(n-r)*s,1),s}function x2(t,e,r,i,n,a){let s=(a-r)/(n-r);return Kr(t.points,e+(i-e)*s,a,1),s}function Ql(t,e){let r=e.buffer/e.extent,i=t,n=Te(t,1,-1-r,r,0,-1,2,e),a=Te(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=Te(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=oc(n,1).concat(i)),a&&(i=i.concat(oc(a,-1)))),i}function oc(t,e){let r=[];for(let i of t)switch(i.type){case"Point":case"MultiPoint":{let n=v2(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"LineString":{let n=Gs(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(Gs(a,e));r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(Gs(o,e));n.push(s)}r.push(Mt(i.id,i.type,n,i.tags));continue}}return r}function v2(t,e){let r=[];for(let i=0;io.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=Zl({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=Ql(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=w2(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function w2(t,e,r){var a,s;let i=!!e.newGeometry,n=e.removeAllProperties||((a=e.removeProperties)==null?void 0:a.length)>0||((s=e.addOrUpdateProperties)==null?void 0:s.length)>0;if(i){let o=t[0],l=Zl({type:"FeatureCollection",features:[{type:"Feature",id:o.id,geometry:e.newGeometry,properties:n?lc(o.tags,e):o.tags}]},r);return l=Ql(l,r),l}if(n){let o=[];for(let l of t){let u=je({},l);u.tags=lc(u.tags,e),o.push(u)}return o}return t}function lc(t,e){if(e.removeAllProperties)return{};let r=je({},t||{});if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function D2(t,e){var r,i;return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map((r=t.add)==null?void 0:r.map(n=>[e.promoteId?n.properties[e.promoteId]:n.id,n])),update:new Map((i=t.update)==null?void 0:i.map(n=>[n.id,n]))}:{remove:new Set,add:new Map,update:new Map}}var uc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],dt=new Uint32Array(96),_2=class Ad{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=uc[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new Ad(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=uc.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ho(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=[];for(;l>0;){let h=dt[--l],c=dt[--l],p=dt[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(dt[l++]=p,dt[l++]=f-1,dt[l++]=1-h),(h===0?i>=d:n>=y)&&(dt[l++]=f+1,dt[l++]=c,dt[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=dt[--l],p=dt[--l],f=dt[--l];if(p-f<=o){for(let g=f;g<=p;g++)hc(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];hc(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(dt[l++]=f,dt[l++]=d-1,dt[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(dt[l++]=d+1,dt[l++]=p,dt[l++]=1-c)}return u}};function Ho(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;Sd(t,e,s,i,n,a),Ho(t,e,r,i,s-1,1-a),Ho(t,e,r,s+1,n,1-a)}function Sd(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Sd(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(zi(t,e,i,r),e[2*n+a]>s&&zi(t,e,i,n);os;)l--}e[2*i+a]===s?zi(t,e,i,l):(l++,zi(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function zi(t,e,r,i){Xs(t,r,i),Xs(e,2*r,2*i),Xs(e,2*r+1,2*i+1)}function Xs(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function hc(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var Ko={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},A2=class{constructor(t){this.options=Object.assign(Object.create(Ko),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[Zr(i),Hr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type==="Point"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(Ko),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>ka(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(Zr(r),Hr(a),Zr(n),Hr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?S2(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?E2(a,p,this.clusterProps):ka(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||(e=10),r||(r=0);let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o!=null&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n1,u,h,c;if(l)u=tu(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;he&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,v=-1,b=((h/u|0)<<5)+(e+1)+this.points.length;for(let D of f){let A=D*u;if(o[A+2]<=e)continue;o[A+2]=e;let _=o[A+5];m+=o[A]*_,g+=o[A+1]*_,o[A+4]=b,n&&(x||(x=this.map(o,h,!0),v=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=b,l.push(m/y,g/y,1/0,b,-1,y),n&&l.push(v)}else{for(let m=0;m1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function S2(t,e,r){return{id:t[e+3],type:"Point",tags:tu(t,e,r),geometry:[t[e],t[e+1]]}}function E2(t,e,r){return{type:"Feature",id:t[e+3],properties:tu(t,e,r),geometry:{type:"Point",coordinates:[wd(t[e]),Dd(t[e+1])]}}}function tu(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var Ed="geojsonvt_clip_start",Fd="geojsonvt_clip_end";function cc(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;ls)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&M2(o,a),t.push(o)}function M2(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i0===e)for(let i=0,n=t.length;i1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=cc(t,i,n,a,r);s.source=t;let o=Jn(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Jn(o,l,u)];return!(h!=null&&h.source)||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:pc(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<1&&console.time("creation"),p=this.tiles[c]=cc(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let _=`z${e}`;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let _=n-e;if(r!==a>>_||i!==s>>_)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,v=null,b=null,D=Te(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=Te(t,h,r+d,r+m,0,p.minX,p.maxX,l);D&&(g=Te(D,h,i-f,i+y,1,p.minY,p.maxY,l),x=Te(D,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(v=Te(A,h,i-f,i+y,1,p.minY,p.maxY,l),b=Te(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(v||[],e+1,r*2+1,i*2),o.push(b||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<=f||s=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX=d&&g.minY1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Jn(t,e,r){return((1<24)throw Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw Error("promoteId and generateId cannot be used together.");let i=Zl(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),i=Ql(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new A2(e.clusterOptions):new z2(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=b2(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(ka(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return u2(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},Jo=At([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),V2=Jo.members;Jo.size,Jo.alignment;var Qo=At([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),O2=Qo.members;Qo.size,Qo.alignment;var R2=Math.cos(75/2*(Math.PI/180)),Id=1/2,fc=2**14/Id,Cd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Qm,this.layoutVertexArray2=new tg,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("line",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(Aa("line",this.layers,e)?Gl("line",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures({options:t,canonical:e,patternPositions:r,dashPositions:i}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,O2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,V2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties[Ed],end:+t.properties[Fd]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(t,{}),u=o.get("line-cap").evaluate(t,{}),h=o.get("line-miter-limit").evaluate(t,{}),c=o.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=cr(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c0;if(k&&v>c){let L=d.dist(y);if(L>2*p){let F=d.sub(d.sub(y)._mult(p/L)._round());this.updateDistance(y,F),this.addCurrentVertex(F,g,0,0,f),y=F}}let O=y&&m,P=O?r:u?"butt":i;if(O&&P==="round"&&(_n&&(P="bevel"),P==="bevel"&&(_>2&&(P="flipbevel"),_100)b=x.mult(-1);else{let L=_*g.add(x).mag()/g.sub(x).mag();b._perp()._mult(L*(z?-1:1))}this.addCurrentVertex(d,b,0,0,f),this.addCurrentVertex(d,b.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let L=-Math.sqrt(_*_-1),F=z?L:0,$=z?0:L;if(y&&this.addCurrentVertex(d,g,F,$,f),P==="fakeround"){let U=Math.round(S*180/Math.PI/20);for(let T=1;T2*p){let F=d.add(m.sub(d)._mult(p/L)._round());this.updateDistance(d,F),this.addCurrentVertex(F,x,0,0,f),d=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>fc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(fc-1):this.scaledDistance)*Id;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};C("LineBucket",Cd,{omit:["layers","patternFeatures"]});var $2,N2=()=>$2||($2=new Xt({"line-cap":new N(w.layout_line["line-cap"],"line-cap"),"line-join":new N(w.layout_line["line-join"],"line-join"),"line-miter-limit":new N(w.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new N(w.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new N(w.layout_line["line-sort-key"],"line-sort-key")})),U2,q2=()=>U2||(U2=new Xt({"line-opacity":new N(w.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new V(w.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new N(w.paint_line["line-color"],"line-color"),"line-translate":new V(w.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new V(w.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new N(w.paint_line["line-width"],"line-width"),"line-gap-width":new N(w.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new N(w.paint_line["line-offset"],"line-offset"),"line-blur":new N(w.paint_line["line-blur"],"line-blur"),"line-dasharray":new on(w.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new on(w.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Wa(w.paint_line["line-gradient"],"line-gradient")})),dc={get paint(){return q2()},get layout(){return N2()}},j2=class extends N{possiblyEvaluate(t,e){return e=new st(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Gt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Qn;var G2=class extends de{constructor(t,e){super(t,dc,e),this.gradientVersion=0,Qn||(Qn=new j2(dc.paint.properties["line-width"].specification,"line-floorwidth"),Qn.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=lm(e)?e._styleExpression.expression instanceof vl:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Qn.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Cd(t)}queryRadius(t){let e=t,r=yc(Wr("line-width",this,e),Wr("line-gap-width",this,e)),i=Wr("line-offset",this,e);return r/2+Math.abs(i)+Ha(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ka(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*yc(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(i=Dg(i,l*a)),mg(s,i,o)}isTileClipped(){return!0}};function yc(t,e){return e>0?e+2*t:t}var X2=At([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),Y2=At([{name:"a_projected_pos",components:3,type:"Float32"}],4);At([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var W2=At([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);At([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var mc=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x5=At([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);At([{name:"triangle",components:3,type:"Uint16"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Float32",name:"offsetX"}]),At([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),At([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var wr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(wr.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,e){return rt(this,null,function*(){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(yield e(r),yield Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};function Z2(t){return/[\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u077F\\u07C0-\\u07FA\\u07FD-\\u07FF\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\u1800\\u1801\\u1804\\u1806-\\u1819\\u1820-\\u1878\\u1880-\\u18AA\\uA840-\\uA877\\uFB50-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF80-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDD00-\\uDD27\\uDD30-\\uDD39\\uDE60-\\uDE7E\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDEFF\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB]|\\uD805[\\uDE60-\\uDE6C]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9C-\\uDC9F]|\\uD83A[\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function H2(t){return/[\\u0591-\\u05C7\\u05D0-\\u05EA\\u05EF-\\u05F4\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u07B1\\u07C0-\\u07FA\\u07FD-\\u082D\\u0830-\\u083E\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\uFB1D-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC57-\\uDC9E\\uDCA7-\\uDCAF\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDCFB-\\uDD1B\\uDD1F-\\uDD39\\uDD3F-\\uDD59\\uDD80-\\uDDB7\\uDDBC-\\uDDCF\\uDDD2-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE38-\\uDE3A\\uDE3F-\\uDE48\\uDE50-\\uDE58\\uDE60-\\uDE9F\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF00-\\uDF35\\uDF39-\\uDF55\\uDF58-\\uDF72\\uDF78-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDCFA-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD65\\uDD69-\\uDD85\\uDD8E\\uDD8F\\uDE60-\\uDE7E\\uDE80-\\uDEA9\\uDEAB-\\uDEAD\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDF27\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB\\uDFE0-\\uDFF6]|\\uD83A[\\uDC00-\\uDCC4\\uDCC7-\\uDCD6\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function K2(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function Qa(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1401-\\u167F\\u18B0-\\u18FF\\u2065\\u20DD-\\u20E0\\u20E2-\\u20E4\\u2B97\\u2BF0-\\u2BFF\\u2E50\\u2E51\\u2E80-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u30FB\\u30FD-\\uA4CF\\uA960-\\uA97F\\uAC00-\\uD7FF\\uF900-\\uFAFF\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7\\uFFF0-\\uFFF8]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|[\\uD80C-\\uD810\\uD81C-\\uD822\\uD83C\\uD83D\\uD840-\\uD87E\\uD880-\\uD8BE][\\uDC00-\\uDFFF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFFF]|\\uD823[\\uDC00-\\uDDFF]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFF]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83E[\\uDD00-\\uDEFF]|[\\uD87F\\uD8BF][\\uDC00-\\uDFFD]/gim.test(String.fromCodePoint(t))}function J2(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function Q2(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function gc(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u103F\\u1050-\\u108F\\u109A-\\u109F\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19DE\\u19DF\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1AA0-\\u1AAD\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9EF\\uA9FA-\\uA9FE\\uAA60-\\uAAC2\\uAADB-\\uAADF]|\\uD805[\\uDF00-\\uDF1A\\uDF1D-\\uDF2B\\uDF3A\\uDF3B\\uDF3F-\\uDF46]/gim.test(String.fromCodePoint(t))}function tv(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||new RegExp("^\\\\p{gc=Mc}","u").test(e)}var ev={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},rv={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},iv={\\u0644\\u0622:[65269,65270],\\u0644\\u0623:[65271,65272],\\u0644\\u0625:[65273,65274],\\u0644\\u0627:[65275,65276]},xc=1604,nv=/[\\u0600-\\u06ff\\u0750-\\u077f\\u0870-\\u089f\\u08a0-\\u08ff\\ufb50-\\ufdff\\ufe70-\\ufeff]/;function av(t,e,r){let i=0;for(let n of t.split(";")){let[a,s]=n.split(",").map(l=>parseInt(l,36)),o=i+a;for(let l=o;l{let r=e.codePointAt(0);return{codePoint:r,type:sv(r),form:null}})}function cv(t){let e=t.filter(r=>r.type!=="T");for(let r=0;r0&&ov(e[r-1].type),a=r+1String.fromCodePoint(dv(r))).join("")}function mv(t,e,r){var n;let i=e.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?t=t.toLocaleUpperCase():i==="lowercase"&&(t=t.toLocaleLowerCase()),((n=wr.applyArabicShaping)!=null?n:yv)(t)}function gv(t,e,r){for(let i of t.sections)i.text=mv(i.text,e,r);return t}function xv(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;uu.geometry)}var Bd=typeof Intl<"u"&&"Segmenter"in Intl,ta,ea;function tl(t){if(!Bd||!Q2(t))return[...t];ta!=null||(ta=new Intl.Segmenter(void 0,{granularity:"grapheme"}));let e=[];for(let{segment:r}of ta.segment(t)){let i=e.length-1;i>=0&&tv(e[i],r)?e[i]+=r:e.push(r)}return e}function vv(t){let e=new Set;if(Bd){ea!=null||(ea=new Intl.Segmenter(void 0,{granularity:"word"}));for(let{index:i}of ea.segment(t))e.add(i);return e}let r=0;for(let i of t.split(new RegExp("\\\\b|(?=\\\\p{Ideo})","u")))e.add(r),r+=i.length;return e}function Pd(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}function ru(t){return/\\s/u.test(String.fromCodePoint(t))}function el(t){for(let e of t)if(Qa(e.codePointAt(0)))return!0;return!1}function bv(t){for(let e of t)if(!wv(e.codePointAt(0)))return!1;return!0}function wv(t){return!Z2(t)}function vc(t){return!(Qa(t)||J2(t))}function zd(t){return new RegExp("\\\\p{sc=Arab}","u").test(String.fromCodePoint(t))}function Ld(t){return H2(t)}function Vd(t){for(let e of t)if(Ld(e.codePointAt(0)))return!0;return!1}var Gr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u22EF":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Dv(t){let e="",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!vc(s.value.codePointAt(0))||Gr[s.value])&&(r.premature||!vc(r.value.codePointAt(0))||Gr[r.value])&&Gr[n.value]?e+=Gr[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var _v={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Av={40:!0};function bc(t,e,r,i,n,a){if("fontStack"in e){let s=r[e.fontStack],o=s==null?void 0:s[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s==null?void 0:s[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function wc(t,e,r,i){let n=(t-e)**2;return i?tr&&Dc(e[i-1]);)i--;this.text=e.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(""),n=this.sectionIndex.slice(e,r);return new rl(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n0?i[i.length-1]:"",a=tl(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=K2(y),x=gc(y)&&gc(m);(_v[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&Av[m]||x&&(h!=null?h:h=vv(this.text)).has(p))&&s.push(_c(f,c,o,s,Sv(y,m,g&&l),!1))}ru(d.codePointAt(0))||(c+=bc(d,this.getSection(f),i,n,e,a)),p+=d.length}return Od(_c(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=bc(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}};function Ev(){return(function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(e).forEach(function(R,J){r[R]=1<1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function d(R,J){var W=0,M=new Map,ut=J&&new Map,X;return R.split(",").forEach(function G(K){if(K.indexOf("+")!==-1)for(var Nt=+K;Nt--;)G(X);else{X=K;var vt=K.split(">"),nt=vt[0],Tt=vt[1];nt=String.fromCodePoint(W+=parseInt(nt,36)),Tt=String.fromCodePoint(W+=parseInt(Tt,36)),M.set(nt,Tt),J&&ut.set(Tt,nt)}}),{map:M,reverseMap:ut}}var y,m,g;function x(){if(!y){var R=d(f.pairs,!0),J=R.map,W=R.reverseMap;y=J,m=W,g=d(f.canonical,!1).map}}function v(R){return x(),y.get(R)||null}function b(R){return x(),m.get(R)||null}function D(R){return x(),g.get(R)||null}var A=r.L,_=r.R,S=r.EN,k=r.ES,z=r.ET,O=r.AN,P=r.CS,L=r.B,F=r.S,$=r.ON,U=r.BN,T=r.NSM,q=r.AL,at=r.LRO,ot=r.RLO,pt=r.LRE,Et=r.RLE,qt=r.PDF,Ht=r.LRI,Ve=r.RLI,ye=r.FSI,Kt=r.PDI;function Oe(R,J){for(var W=125,M=new Uint32Array(R.length),ut=0;ut0)Fe--;else if(rs>0){for(Ne=0;!lt[lt.length-1]._isolate;)lt.pop();var is=lt[lt.length-1]._isolInitIndex;is!=null&&(Nt.set(is,zt),Nt.set(zt,is)),lt.pop(),rs--}bt=lt[lt.length-1],K[zt]=bt._level,bt._override&&G(zt,bt._override)}else Lt&qt?(Fe===0&&(Ne>0?Ne--:!bt._isolate&<.length>1&&(lt.pop(),bt=lt[lt.length-1])),K[zt]=bt._level):Lt&L&&(K[zt]=nt.level);else K[zt]=bt._level,bt._override&&Lt!==U&&G(zt,bt._override)}for(var Cr=[],me=null,ar=nt.start;ar<=nt.end;ar++){var ns=M[ar];if(!(ns&o)){var Bu=K[ar],Pu=ns&n,Wy=ns===Kt;me&&Bu===me._level?(me._end=ar,me._endsWithIsolInit=Pu):Cr.push(me={_start:ar,_end:ar,_level:Bu,_startsWithPDI:Wy,_endsWithIsolInit:Pu})}}for(var as=[],Sn=0;Sn=0;kn--)if(!(M[kn]&o)){Vu=K[kn];break}var us=Mr[Mr.length-1],Hy=K[us],Ou=nt.level;if(!(M[us]&n)){for(var Tn=us+1;Tn<=nt.end;Tn++)if(!(M[Tn]&o)){Ou=K[Tn];break}}as.push({_seqIndices:Mr,_sosType:Math.max(Vu,Zy)%2?_:A,_eosType:Math.max(Ou,Hy)%2?_:A})}}for(var hs=0;hs=0;Cn--)if(!(M[j[Cn]]&o)){ps=M[j[Cn]];break}G(Ru,ps&(n|Kt)?$:ps)}}if(X.get(S))for(var Mn=0;Mn=-1;Bn--){var Nu=Bn===-1?yi:M[j[Bn]];if(Nu&a){Nu===q&&G($u,O);break}}}if(X.get(q))for(var fs=0;fs=0&&(Pr=M[j[ms]],Pr&o);ms--);for(var gs=mi+1;gs=0&&M[j[Pn]]&(z|o);Pn--)G(j[Pn],S);for(ge++;ge=0&&M[j[zn]]&o;zn--)G(j[zn],$);for(var Ln=gi+1;Ln=0;bi--){var bs=zr[bi].char;if(bs===Yu||bs===b(D(vi))||v(D(bs))===vi){Vn.push([zr[bi].seqIndex,Lr]),zr.length=bi;break}}}Vn.sort(function(Yt,ue){return Yt[0]-ue[0]});for(var ws=0;ws=0;As--){var Ju=j[As];if(M[Ju]&Xu){var Qu=M[Ju]&xi?_:A;xe=Qu===Br?Br:Qu;break}}}if(xe){if(M[j[On]]=M[j[Ds]]=xe,xe!==Br){for(var wi=On+1;wi=0;_i--)if(M[j[_i]]&o)th=_i;else{Es=M[j[_i]]&xi?_:A;break}for(var eh=Ky,Ai=Ue+1;Ai=0&&c(R[$n])&l;$n--)K[$n]=nt.level}}return{levels:K,paragraphs:vt};function rh(Yt,ue){for(var Wt=Yt;Wt=K&&c(R[nt])&l;nt--)vt[nt]=G.level;for(var Tt=G.level,di=1/0,nr=0;nrTt&&(Tt=Re),Re=di;$e--)for(var lt=0;lt=$e){for(var bt=lt;lt+1=$e;)lt++;lt>bt&&X.push([bt+K,lt+K])}}}),X}function Tr(R,J,W,M){var ut=Ir(R,J,W,M),X=[].concat(R);return ut.forEach(function(G,K){X[K]=(J.levels[G]&1?kt(R[G]):null)||R[G]}),X.join("")}function Ir(R,J,W,M){for(var ut=ir(R,J,W,M),X=[],G=0;G=0;i--){let n=nu.getBidiCharTypeName(t[i].text[0]);Tv.has(n)?(t[i].level=e,r=!0):r&&kv.has(n)?t[i].level=e:r=!1}}function Mv(t,e){let r=e,i=1/0;for(let{level:a}of t)a>r&&(r=a),(a|1)=i;a--)for(let s=0;s=a;)o++;for(let l=s,u=o;le>=n.start&&e<=n.end))==null?void 0:r.level)!=null?i:0}function zv(t,e,r,i,n){let a=Iv(t,e,i,n);Cv(a,r);let s="",o=[];for(let l of Mv(a,r)){if(Fv.test(l.text))continue;let u=Bv(l);s+=u,o.push(...Array(u.length).fill(l.index))}return{text:s,sourceIndices:o}}function Lv(t,e){let r=e.filter(a=>a>0&&aa-s),n=[];for(let a=0;a+1n.start))).map(([n,a])=>zv(t,r,Pv(i,n),n,a))}function Vv(t,e){return Rd(t,e).map(r=>r.text)}function Ov(t,e,r){return Rd(t,r).map(i=>[i.text,i.sourceIndices.map(n=>{var a;return(a=e[n])!=null?a:0})])}var il=4294967296,Ac=1/il,Sc=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),au=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*il;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*il;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,$v(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Sc?Sc.decode(this.buf.subarray(e,t)):tb(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},Rv=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Uv(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=eb(this.buf,t,this.pos);let r=this.pos-e;r>=128&&Ec(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&Ec(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Gv,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Xv,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Zv,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Yv,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Wv,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Hv,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Kv,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Jv,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Qv,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function $v(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return Nv(t,n,e);throw Error("Expected varint not more than 10 bytes")}function Nv(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Uv(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),qv(r,i,e),jv(i,e)}function qv(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function jv(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((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 Ec(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Gv(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;sa){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function Xv(t,e){for(let r=0;r239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function eb(t,e,r){for(let i=0,n,a;i55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(a=(t[r++]=239,t[r++]=191,t[r++]=189,null));n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function rb(t){return typeof(t==null?void 0:t.renderWithWebGL)=="function"}function su(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o=r;a--)e.push(a);r=i+1}else{for(let a=r;at.toCodeUnitIndex(a)),i=wr.isParsed()?wr:null;if(t.sections.length===1)return i?i.processBidirectionalText(t.toString(),r).map(a=>kc(a,t.sections,[...a].map(()=>0))):Vv(t.toString(),r).map(a=>nl([...a],t.sections,[...a].map(()=>0)));let n=sb(t);return i?i.processStyledBidirectionalText(t.text,n,r).map(([a,s])=>kc(a,t.sections,s)):Ov(t.text,n,r).map(([a,s])=>{let o=[...a];return nl(o,t.sections,Ud(o).map(l=>{var u;return(u=s[l])!=null?u:0}))})}function nl(t,e,r){var a;let i=new iu(t.join(""),e,[]),n=0;for(let s of i.graphemes())i.sectionIndex.push((a=r[n])!=null?a:0),n+=[...s].length;return i}function Ud(t){let e=[],r=0;for(let i of t)e.push(r),r+=i.length;return e}function kc(t,e,r){let i=[...t],n=Ud(i),a=ab(i);return nl(a.map(s=>i[s]),e,a.map(s=>{var o;return(o=r[n[s]])!=null?o:0}))}function ra(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=iu.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m=y.determineLineBreaks(u,a,e,i,f),g=Vd(y.text)?ob(y,m):nb(y,m),x=[],v={positionedLines:x,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return mb(v,e,r,i,g,s,o,l,c,u,p,d),!ib(x)&&v}function qd(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function lb(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function jd(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function ub(t,e,r,i){var a;if(t!=null&&t.rect)return t;let n=(a=e[r.fontStack])==null?void 0:a[i];return n?{rect:null,metrics:n.metrics}:null}function hb(t,e,r){return!(t===1||!e&&!Qa(r)||e&&(ru(r)||zd(r)))}function da(t){return new RegExp("\\\\p{Nd}","u").test(String.fromCodePoint(t))}function Gd(t){return new RegExp("\\\\p{Lu}","u").test(String.fromCodePoint(t))}function cb(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function pb(t){let e=t.some(da)&&t.every(i=>da(i)||cb(i)),r=t.length<=3&&t.every(i=>Gd(i)||da(i));return e||r}function fb(t){return(da(t)||Gd(t))&&!zd(t)}function db(t,e){let r=!1;for(let i=0;ia.codePointAt(0)),i=r.map(Qa),n=a=>!i[a]&&!ru(r[a])&&!("imageName"in t.getSection(a));for(let a=0;au){let p=Math.ceil(i/u);r*=p/n,n=p}return{x1:e,y1:r,x2:e+i,y2:r+n}}function Tc(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var Ic=32640;function Cc(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new st(t+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=Db(r.zoomStops,t);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=_b(r),n=r.evaluate(new st(t+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function Db(t,e){let r=0;for(;rt.evaluate(new st(e===-1/0?t.zoomStops[1]-1:e)))}var Jr=class Yd extends B{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new Yd(this.x,this.y,this.angle,this.segment)}};C("Anchor",Jr);function Wd(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;oi;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function Zd(t){let e=0;for(let r=0;ru){let d=(u-l)/f,y=new Jr(gr.number(c.x,p.x,d),gr.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||Wd(t,y,o,s,e)?y:void 0}l+=f}}function Sb(t,e,r,i,n,a,s,o,l){let u=Hd(i,a,s),h=Kd(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c=0&&b=0&&D=0&&p+u<=h){let A=new Jr(b,D,x,d);A._round(),(!i||Wd(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=Jd(t,c/2,r,i,n,a,s,!0,l)),f}function Eb(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l=i&&h.x>=i)&&(u.x>=i?u=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function Qd(t,e,r,i,n,a){let s=Mc(t,e,r,n,0);return s=Mc(s,e,i,a,1),s}function Mc(t,e,r,i,n){switch(e){case 1:return Fb(t,r,i,n);case 2:return Bc(t,r,i,n,!1);case 3:return Bc(t,r,i,n,!0)}return[]}function Fb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function kb(t,e,r,i,n){let a=i===0?Tb:Ib,s=[],o=[];for(let h=0;he&&s.push(a(c,p,e)):f>r?d=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new B(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Bc(t,e,r,i,n){let a=[];for(let s of t){let o=kb(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function Tb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new B(r,t.y+(e.y-t.y)*i)}function Ib(t,e,r){let i=(r-t.y)/(e.y-t.y);return new B(t.x+(e.x-t.x)*i,r)}function Pc(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(F,$)=>F+$[1]-$[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,v=0,b=d,D=0,A=y,_=0,S=m;if(a.content&&i){let F=a.content,$=F[2]-F[0],U=F[3]-F[1];(a.textFitWidth||a.textFitHeight)&&(u=Xd(t)),g=ia(h,0,F[0]),v=ia(c,0,F[1]),x=ia(h,F[0],F[2]),b=ia(c,F[1],F[3]),D=F[0]-g,_=F[1]-v,A=$-x,S=U-b}let k=u.x1,z=u.y1,O=u.x2-k,P=u.y2-z,L=(F,$,U,T)=>{let q=na(F.stretch-g,x,O,k),at=aa(F.fixed-D,A,F.stretch,f),ot=na($.stretch-v,b,P,z),pt=aa($.fixed-_,S,$.stretch,d),Et=na(U.stretch-g,x,O,k),qt=aa(U.fixed-D,A,U.stretch,f),Ht=na(T.stretch-v,b,P,z),Ve=aa(T.fixed-_,S,T.stretch,d),ye=new B(q,ot),Kt=new B(Et,ot),Oe=new B(Et,Ht),kr=new B(q,Ht),rr=new B(at/s,pt/s),fi=new B(qt/s,Ve/s),kt=e*Math.PI/180;if(kt){let R=Math.sin(kt),J=Math.cos(kt),W=[J,-R,R,J];ye._matMult(W),Kt._matMult(W),kr._matMult(W),Oe._matMult(W)}let Ee=F.stretch+F.fixed,ir=U.stretch+U.fixed,Tr=$.stretch+$.fixed,Ir=T.stretch+T.fixed;return{tl:ye,tr:Kt,bl:kr,br:Oe,tex:{x:a.paddedRect.x+1+Ee,y:a.paddedRect.y+1+Tr,w:ir-Ee,h:Ir-Tr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rr,pixelOffsetBR:fi,minFontScaleX:A/s/O,minFontScaleY:S/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let F=zc(h,y,f),$=zc(c,m,d);for(let U=0;U0&&(d=Math.max(10,d),this.circleDiameter=d)}else{let c=(h=a.image)!=null&&h.content&&(a.image.textFitWidth||a.image.textFitHeight)?Xd(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-o[0],c.y2=c.y2*s+o[2],c.x1=c.x1*s-o[3],c.x2=c.x2*s+o[1];let p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),u){let f=new B(c.x1,c.y1),d=new B(c.x2,c.y1),y=new B(c.x1,c.y2),m=new B(c.x2,c.y2),g=u*Math.PI/180;f._rotate(g),d._rotate(g),y._rotate(g),m._rotate(g),c.x1=Math.min(f.x,d.x,y.x,m.x),c.x2=Math.max(f.x,d.x,y.x,m.x),c.y1=Math.min(f.y,d.y,y.y,m.y),c.y2=Math.max(f.y,d.y,y.y,m.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,r,i,n)}this.boxEndIndex=t.length}},Mb=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}};function Bb(t,e=1){let r=Fa.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Mb([],Pb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new B(s,o);for(let p=s;pc.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new qr(p.p.x-n,p.p.y-n,n,t)),a.push(new qr(p.p.x+n,p.p.y-n,n,t)),a.push(new qr(p.p.x-n,p.p.y+n,n,t)),a.push(new qr(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Pb(t,e){return e.max-t.max}var qr=class{constructor(t,e,r,i){this.p=new B(t,e),this.h=r,this.d=zb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function zb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;at.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,td(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Lb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;ap*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new De(l)}let a=i.get("text-variable-anchor");if(a){let o;o=t._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(e,{},r).map(u=>u*24):[i.get("text-radial-offset").evaluate(e,{},r)*24,lu];let l=[];for(let u of a)l.push(u,ty(u,o));return new De(l)}return null}function Ob(t){var h,c;t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=mt/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new st(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new st(p),t.canonical),n["text-size"].possiblyEvaluate(new st(f),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new st(p),t.canonical),n["icon-size"].possiblyEvaluate(new st(f),t.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let p of t.bucket.features){let f=i.get("text-font").evaluate(p,{},t.canonical).join(","),d=u.evaluate(p,{},t.canonical),y=a.layoutTextSize.evaluate(p,{},t.canonical),m=a.layoutIconSize.evaluate(p,{},t.canonical),g={horizontal:{},vertical:void 0},x=p.text,v=[0,0];if(x){let _=x.toString(),S=i.get("text-letter-spacing").evaluate(p,{},t.canonical)*24,k=bv(_)?S:0,z=i.get("text-anchor").evaluate(p,{},t.canonical),O=ey(r,p,t.canonical);if(!O){let $=i.get("text-radial-offset").evaluate(p,{},t.canonical);v=$?ty(z,[$*24,lu]):i.get("text-offset").evaluate(p,{},t.canonical).map(U=>U*24)}let P=o?"center":i.get("text-justify").evaluate(p,{},t.canonical),L=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(p,{},t.canonical)*24:1/0,F=()=>{t.bucket.allowVerticalPlacement&&el(_)&&(g.vertical=ra(x,t.glyphMap,t.glyphPositions,t.imagePositions,f,L,s,z,"left",k,v,2,!0,y,d))};if(!o&&O){let $=new Set;if(P==="auto")for(let T=0;T{T.x<0||T.x>=8192||T.y<0||T.y>=8192||Nb(t,T,U,r,i,n,L,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[D,D,D,D],S,l,v,A,k,d,e,a,u,h,s)};if(z==="line")for(let U of Eb(e.geometry,0,0,mt,mt)){let T=cr(U,F),q=Sb(T,b,_,r.vertical||y,i,24,x,t.overscaling,mt);for(let at of q){let ot=y;(!ot||!Ub(t,ot.text,O,at))&&$(T,at)}}else if(z==="line-center"){for(let U of e.geometry)if(U.length>1){let T=cr(U,F),q=Ab(T,_,r.vertical||y,i,24,x);q&&$(T,q)}}else if(e.type==="Polygon")for(let U of Ra(e.geometry,0)){let T=Bb(U,16);$(cr(U[0],F,!0),new Jr(T.x,T.y,0))}else if(e.type==="LineString")for(let U of e.geometry){let T=cr(U,F);$(T,new Jr(T[0].x,T[0].y,0))}else if(e.type==="Point")for(let U of e.geometry)for(let T of U)$([T],new Jr(T.x,T.y,0))}function $b(t,e){let r=t.length,i=e==null?void 0:e.values;if((i==null?void 0:i.length)>0)for(let n=0;n32640&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let v of c)p[v]=t.text.placedSymbolArray.length-1;return m.length*4}function ry(t){for(let e in t)return t[e];return null}function Nb(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S){let k=t.addToLineVertexArray(e,r),z=o.layout.get("symbol-height-offset").evaluate(b,{},_);z>t.maxHeightOffset&&(t.maxHeightOffset=z);let O,P,L,F,$=0,U=0,T=0,q=0,at=-1,ot=-1,pt={},Et=(0,Mo.default)("");if(t.allowVerticalPlacement&&i.vertical){let J=o.layout.get("text-rotate").evaluate(b,{},_)+90,W=i.vertical;L=new sa(l,e,u,h,c,W,p,f,d,J),s&&(F=new sa(l,e,u,h,c,s,m,g,d,J))}if(n){let J=o.layout.get("icon-rotate").evaluate(b,{}),W=o.layout.get("icon-text-fit")!=="none",M=Pc(n,J,A,W),ut=s?Pc(s,J,A,W):void 0;P=new sa(l,e,u,h,c,n,m,g,!1,J),$=M.length*4;let X=t.iconSizeData,G=null;X.kind==="source"?(G=[128*o.layout.get("icon-size").evaluate(b,{})],G[0]>32640&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):X.kind==="composite"&&(G=[128*D.compositeIconSizes[0].evaluate(b,{},_),128*D.compositeIconSizes[1].evaluate(b,{},_)],(G[0]>32640||G[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,M,G,v,x,b,0,e,k.lineStartIndex,k.lineLength,-1,_,z),at=t.icon.placedSymbolArray.length-1,ut&&(U=ut.length*4,t.addSymbols(t.icon,ut,G,v,x,b,2,e,k.lineStartIndex,k.lineLength,-1,_,z),ot=t.icon.placedSymbolArray.length-1)}let qt=Object.keys(i.horizontal);for(let J of qt){let W=i.horizontal[J];O||(O=(Et=(0,Mo.default)(W.text),new sa(l,e,u,h,c,W,p,f,d,o.layout.get("text-rotate").evaluate(b,{},_))));let M=W.positionedLines.length===1;if(T+=Vc(t,e,W,a,o,d,b,y,z,k,i.vertical?1:3,M?qt:[J],pt,at,D,_),M)break}i.vertical&&(q+=Vc(t,e,i.vertical,a,o,d,b,y,z,k,2,["vertical"],pt,ot,D,_));let Ht=O?O.boxStartIndex:t.collisionBoxArray.length,Ve=O?O.boxEndIndex:t.collisionBoxArray.length,ye=L?L.boxStartIndex:t.collisionBoxArray.length,Kt=L?L.boxEndIndex:t.collisionBoxArray.length,Oe=P?P.boxStartIndex:t.collisionBoxArray.length,kr=P?P.boxEndIndex:t.collisionBoxArray.length,rr=F?F.boxStartIndex:t.collisionBoxArray.length,fi=F?F.boxEndIndex:t.collisionBoxArray.length,kt=-1,Ee=(J,W)=>J!=null&&J.circleDiameter?Math.max(J.circleDiameter,W):W;kt=Ee(O,kt),kt=Ee(L,kt),kt=Ee(P,kt),kt=Ee(F,kt);let ir=+(kt>-1);ir&&(kt*=S/24),t.glyphOffsetArray.length>=t.maxGlyphs&&Bt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),b.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);let Tr=ey(o,b,_),[Ir,R]=$b(t.textAnchorOffsets,Tr);t.symbolInstances.emplaceBack(e.x,e.y,pt.right>=0?pt.right:-1,pt.center>=0?pt.center:-1,pt.left>=0?pt.left:-1,pt.vertical||-1,at,ot,Et,Ht,Ve,ye,Kt,Oe,kr,rr,fi,u,T,q,$,U,ir,0,p,kt,Ir,R,z)}function Ub(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cc(this.zoom,e["text-size"]),this.iconSizeData=Cc(this.zoom,e["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=Oc(r,"text-overlap","text-allow-overlap")!=="never"||Oc(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>Nd[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new al(new vr(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new al(new vr(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new Uf,this.lineVertexArray=new qf,this.symbolInstances=new Nf,this.textAnchorOffsets=new Gf}calculateGlyphDependencies(t,e,r,i,n){var l;let a=(i||this.allowVerticalPlacement)&&n,s=iu.fromFeature(t,r),o=s.graphemes();for(let u=0;u0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new st(this.zoom);for(let{feature:m,id:g,index:x,sourceLayerIndex:v}of t){let b=i._featureFilter.needGeometry,D=hi(m,b);if(!i._featureFilter.filter(d,D,r))continue;b||(D.geometry=Ar(m));let A;if(l){let z=i.getValueAndResolveTokens("text-field",D,r,f),O=ze.factory(z);this.hasRTLText||(this.hasRTLText=Gb(O)),A=gv(O,i,D)}let _;if(u){let z=i.getValueAndResolveTokens("icon-image",D,r,f);_=z instanceof _e?z:_e.fromString(z)}if(!A&&!_)continue;let S=this.sortFeaturesByKey?h.evaluate(D,{},r):void 0,k={id:g,text:A,icon:_,index:x,sourceLayerIndex:v,geometry:D.geometry,properties:m.properties,type:Dn.types[m.type],sortKey:S};if(this.features.push(k),_&&(c[_.name]=!0),A){let z=a.evaluate(D,{},r).join(","),O=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=(y=this.writingModes)==null?void 0:y.includes(2);let P=el(A.toString());this.calculateGlyphDependencies(A,p,z,O,P);for(let L of A.sections)L.image&&(c[L.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=xv(this.features)),this.sortFeaturesByKey&&this.features.sort((m,g)=>m.sortKey-g.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}addFeatures({options:t,canonical:e,glyphMap:r,glyphPositions:i,iconMap:n,iconPositions:a,showCollisionBoxes:s}){Ob({bucket:this,glyphMap:r,glyphPositions:i,imageMap:n,imagePositions:a,showCollisionBoxes:s,canonical:e,subdivisionGranularity:t.subdivisionGranularity})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;ni[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(r==null?void 0:r.sortKey)===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",iy,{omit:["layers","collisionBoxArray","features","compareText"]});function Xb(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):"")}var Yb,Wb=()=>Yb||(Yb=new Xt({"symbol-placement":new V(w.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new V(w.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new V(w.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new N(w.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new V(w.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new V(w.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new V(w.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new V(w.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new V(w.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new N(w.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new N(w.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new V(w.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new V(w.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new N(w.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new N(w.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new N(w.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new V(w.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new N(w.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new N(w.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new V(w.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new V(w.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new V(w.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new N(w.layout_symbol["text-field"],"text-field"),"text-font":new N(w.layout_symbol["text-font"],"text-font"),"text-size":new N(w.layout_symbol["text-size"],"text-size"),"text-max-width":new N(w.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new V(w.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new N(w.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new N(w.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new N(w.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new V(w.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new N(w.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new N(w.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new V(w.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new V(w.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new N(w.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new V(w.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new V(w.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new N(w.layout_symbol["text-transform"],"text-transform"),"text-offset":new N(w.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new V(w.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new V(w.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new V(w.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new V(w.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new N(w.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new V(w.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})),Zb,Hb=()=>Zb||(Zb=new Xt({"icon-opacity":new N(w.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new N(w.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new N(w.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new N(w.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new N(w.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new V(w.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new V(w.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new N(w.paint_symbol["text-opacity"],"text-opacity"),"text-color":new N(w.paint_symbol["text-color"],"text-color",{runtimeType:ce,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new N(w.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new N(w.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new N(w.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new V(w.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new V(w.paint_symbol["text-translate-anchor"],"text-translate-anchor")})),Ys={get paint(){return Hb()},get layout(){return Wb()}},ny=class{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:dn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e!=null&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};C("FormatSectionOverride",ny,{omit:["defaultValue"]});var Kb=class ol extends de{constructor(e,r){super(e,Ys,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new se(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!ja(s.value)&&a?Xb(r.properties,a):a}createBucket(e){return new iy(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Ys.paint.overridableProperties){if(!ol.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Il(new ny(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new an("source",i):new wa("composite",i,r.value.zoomStops),this.paint._values[e]=new se(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:ol.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=Ys.paint.properties[r],a=!1,s=o=>{var l;for(let u of o)if((l=n.overrides)!=null&&l.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof ze)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof ri&&_t(u.value)===yn){let h=u.value;s(h.sections)}else u instanceof Ep?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Jb(t,e,r,i=1){var a;let n=(a=t.get("icon-padding").evaluate(e,{},r))==null?void 0:a.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Qb,tw=()=>Qb||(Qb=new Xt({"background-color":new V(w.paint_background["background-color"],"background-color"),"background-pattern":new Lf(w.paint_background["background-pattern"],"background-pattern"),"background-opacity":new V(w.paint_background["background-opacity"],"background-opacity")})),ew={get paint(){return tw()}};var rw=class extends de{constructor(t,e){super(t,ew,e)}};var iw=class extends de{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function ay(t,e){if(t.type==="custom")return new iw(t,e);switch(t.type){case"background":return new rw(t,e);case"circle":return new Bg(t,e);case"color-relief":return new Yg(t,e);case"fill":return new Ex(t,e);case"fill-extrusion":return new Hx(t,e);case"heatmap":return new Rg(t,e);case"hillshade":return new qg(t,e);case"line":return new G2(t,e);case"raster":return new Xm(t,e);case"symbol":return new Kb(t,e)}}var nw=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,(t=this._channel)==null||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},aw={once:!0},sy=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new nw(()=>this.process()),this.subscription=hh(this.target,"message",r=>this.receive(r),!1),this.globalScope=mr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?hh(e.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new dl(e.signal.reason))},aw):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),r(l)},reject:l=>{a==null||a.unsubscribe(),i(l)}};let s=[],o=Si(je({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Yi(t.data,s)});this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=["file://","resource://android","null"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if((a||s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(mr(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){return rt(this,null,function*(){if(e.type===""){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Ki(Wi(e.error))):n.resolve(Wi(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Wi(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=yield this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Ki(n))}})}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Yi(e):null,data:Yi(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function sw(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var oy=class{constructor(t,e,r){if(!sw(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Hi(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=lw(this.x,this.y,this.z),n=uw(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new B((t.x*e-this.x)*mt,(t.y*e-this.y)*mt)}toString(){return`${this.z}/${this.x}/${this.y}`}},ow=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Hi(t,e.z,e.z,e.x,e.y)}},uu=class ne{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new oy(i,+n,+a),this.key=Hi(r,e,i,n,a)}clone(){return new ne(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new ne(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ne(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Hi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Hi(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ne(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new ne(r,this.wrap,r,i,n),new ne(r,this.wrap,r,i+1,n),new ne(r,this.wrap,r,i,n+1),new ne(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrape.wrap?!1:this.overscaledZe.overscaledZ?!1:this.canonical.xe.canonical.x?!1:this.canonical.y=0&&e=0&&r=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new ne(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Hi(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<0;n--){let a=1<pw(n,a,r),t.layers[i])}function pw(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s>31}function yw(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(Zs(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},gw=class{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]=="string"&&t.properties[a].startsWith("__$json__:")&&(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=dd(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}},Sr=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){var e;return((e=this.nullabilityBuffer)==null?void 0:e.get(t))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},ts=class extends Sr{},pu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},fu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},uy=class extends Sr{constructor(t,e,r,i){super(t,e,i),this.delta=r}},du=class extends uy{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},yu=class extends Sr{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},xw=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){var t;return(t=this._propertyVectors)!=null?t:[]}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r>>32-t;var ul=mu,py=65536;function gu(t,e){return t-t%e}function vw(t){return gu(t+31,32)}function bw(t){if(!Number.isFinite(t)||t<=0)return py;let e=gu(Math.floor(t),256);return e===0?256:e}function ww(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function Dw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function _w(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function Aw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function Sw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function Ew(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function Fw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function kw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function Tw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function Iw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function Cw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function Mw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function Bw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,v=t[e+14]>>>0,b=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=v>>>0&65535,r[n++]=v>>>16&65535,r[n++]=b>>>0&65535,r[n]=b>>>16&65535}function Pw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function zw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function Lw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function Vw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function Ow(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function Rw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function $w(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function Nw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function Uw(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function qw(t,e,r,i,n){let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<>>0)}}var hl=bw(py),jw=3*hl/256+hl|0;function fy(){let t=new Uint8Array(jw);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Gw(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:fy()}}function Xw(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function Yw(t,e,r,i){i.byteContainer.length>>2;if(n.byteOffset&3)for(let o=0;o>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u>>(u<<3)&255}return n}function Ww(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=vw(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length>>5)|0,r.exceptionSizes[a]=s}return e}function Zw(t,e,r,i,n){switch(n){case 1:Pw(t,e,r,i);break;case 2:zw(t,e,r,i);break;case 3:Lw(t,e,r,i);break;case 4:Vw(t,e,r,i);break;case 5:Ow(t,e,r,i);break;case 6:Rw(t,e,r,i);break;case 7:$w(t,e,r,i);break;case 8:Nw(t,e,r,i);break;case 16:Uw(t,e,r,i);break;default:qw(t,e,r,i,n)}return e+(n<<3)|0}function Hw(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function Kw(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function Jw(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=Kw(n,a,s,r,i,l);if(s=c,h===1){let m=1<y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m0&&(c=Jw(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function t3(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=Yw(t,p,h,a),y=h,m=Ww(t,f,a);return a.dataPointers.fill(0),Qw(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function e3(t,e,r,i,n,a){let s=i+gu(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(hl,s-o);l=t3(t,e,l,o,u,a),o=o+u|0}return l}function r3(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function i3(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r!=null?r:fy();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=e3(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return r3(t,i,o,a,n,l),a}function n3(t,e,r,i,n){switch(n){case 2:Dw(t,e,r,i);return;case 3:_w(t,e,r,i);return;case 4:Aw(t,e,r,i);return;case 5:Sw(t,e,r,i);return;case 6:Ew(t,e,r,i);return;case 7:Fw(t,e,r,i);return;case 8:kw(t,e,r,i);return;case 9:Tw(t,e,r,i);return;case 10:Iw(t,e,r,i);return;case 11:Cw(t,e,r,i);return;case 12:Mw(t,e,r,i);return;case 16:Bw(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=ul[n-h]>>>0,f=(c|(l&p)<t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length0){let o=t.byteOffset+e;if(o&3)for(let l=0;l=64)throw Error("Varint too long")}return e.set(n),r}function o3(t,e,r){let i=new Float64Array(r);for(let n=0;n>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error("Expected varint not more than 10 bytes")}function h3(t,e,r,i){return c3(t,e,r,i,Gw(r>>>2))}function c3(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=Xw(n,s);a3(t,a,r,o);let l=i3(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function et(t){return t>>>1^-(t&1)}function Ot(t){return t>>BigInt(1)^-(t&BigInt(1))}function We(t){return t%2==1?(t+1)/-2:t/2}function p3(t){let e=new Int32Array(t.length);for(let r=0;r=4)for(;i=4)for(;i=4)for(;r=4)for(let i=t[0];r=4)for(;i=4)for(;l>>0;for(let r=1;r>>0;return e}function jc(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,Ot(t[0]));for(let r=1;r>>0,e[1]=et(t[1])>>>0;for(let r=2;r>>0,e[r+1]=e[r-1]+et(t[r+1])>>>0;return e}function F3(t,e,r,i){let n=yy(t,e,r,i);return new Uint32Array(n)}function k3(t){return t[1]}function T3(t){return et(t[1])}function I3(t){if(t.length===2){let e=et(t[1]);return[e,e]}return[et(t[2]),et(t[3])]}function C3(t){return t[1]}function M3(t){return Ot(t[1])}function B3(t){if(t.length===2){let e=Ot(t[1]);return[e,e]}return[Ot(t[2]),Ot(t[3])]}var St;(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(St||(St={}));var jt;(function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"})(jt||(jt={}));var Me;(function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"})(Me||(Me={}));var Ct;(function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"})(Ct||(Ct={}));var P3=[St.PRESENT,St.DATA,St.OFFSET,St.LENGTH],Gc=[H.NONE,H.DELTA,H.COMPONENTWISE_DELTA,H.RLE,H.MORTON],z3=[le.NONE,le.FAST_PFOR,le.VARINT],L3=[jt.NONE,jt.SINGLE,jt.SHARED,jt.VERTEX,jt.MORTON,jt.FSST],V3=[Me.VERTEX,Me.INDEX,Me.STRING,Me.KEY],O3=[Ct.VAR_BINARY,Ct.GEOMETRIES,Ct.PARTS,Ct.RINGS,Ct.TRIANGLES,Ct.SYMBOL,Ct.DICTIONARY];function ct(t,e){let r=N3(t,e);return r.logicalLevelTechnique1===H.MORTON?R3(r,t,e):(H.RLE===r.logicalLevelTechnique1||H.RLE===r.logicalLevelTechnique2)&&le.NONE!==r.physicalLevelTechnique?$3(r,t,e):r}function R3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function $3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function N3(t,e){let r=t[e.get()],i=P3[r>>4],n={};switch(i){case St.DATA:n={dictionaryType:L3[r&15]};break;case St.OFFSET:n={offsetType:V3[r&15]};break;case St.LENGTH:n={lengthType:O3[r&15]}}e.increment();let a=t[e.get()],s=Gc[a>>5],o=Gc[a>>2&7],l=z3[a&3];e.increment();let u=$t(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var ht;(function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ht||(ht={}));var fe=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<>r&1}size(){return this._size}getBuffer(){return this.values}};function Er(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u=12?X3.decode(t.subarray(e,r)):Y3(t,e,r)}function Y3(t,e,r){let i="",n=e;for(;n239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Ta(t,e,r,i,n){return J3(pi(t,e,r),r,i,n)}function Vt(t,e,r,i,n){return Q3(pi(t,e,r),r,i,n)}function Ze(t,e,r){return e6(pi(t,e,r),r)}function pi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.FAST_PFOR:return h3(t,r.numValues,r.byteLength,e);case le.VARINT:return $t(t,e,r.numValues);case le.NONE:return j3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function _n(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.VARINT:return xu(t,e,r.numValues);case le.NONE:return G3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function W3(t,e,r){let i=pi(t,e,r);return i.length===1?et(i[0]):T3(i)}function wu(t,e,r){let i=pi(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?et(i[0]):i[0]:k3(i)}function vy(t,e,r){return I3(pi(t,e,r))}function by(t,e,r){return B3(xu(t,e,r.numValues))}function wy(t,e,r,i){return _y(_n(t,e,r),r,i)}function Du(t,e,r,i){return Ay(_n(t,e,r),r,i)}function Z3(t,e,r,i){let n=H3(t,e,r,!1);return i?Er(n,i,0):n}function H3(t,e,r,i){if(r.physicalLevelTechnique===le.VARINT)return t6(o3(t,e,r.numValues),r,i);let n=_n(t,e,r),a=i?_y(n,r):Ay(n,r);return Float64Array.from(a,Number)}function K3(t,e,r){let i=_n(t,e,r);return i.length===1?Ot(i[0]):M3(i)}function Dy(t,e,r){let i=_n(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?Ot(i[0]):i[0]:C3(i)}function J3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;if(!i)return A3(t,a.runs,a.numRleValues);t=cl(t,a.runs,a.numRleValues),n=Nc(t)}else n=Nc(t);break;case H.RLE:n=m3(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=new Int32Array(t);break;case H.COMPONENTWISE_DELTA:if(r&&!i)return yy(t,r.scale,r.min,r.max);n=b3(t);break;case H.NONE:n=p3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function Q3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;n=qc(cl(t,a.runs,a.numRleValues))}else n=qc(t);break;case H.RLE:n=cl(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=t;break;case H.COMPONENTWISE_DELTA:n=r&&!i?F3(t,r.scale,r.min,r.max):E3(t);break;case H.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function _y(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;if(!r)return S3(t,n.runs,n.numRleValues);t=pl(t,n.runs,n.numRleValues),i=Uc(t)}else i=Uc(t);break;case H.RLE:i=g3(t,e.runs,e.numRleValues);break;case H.NONE:i=f3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function Ay(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;i=jc(pl(t,n.runs,n.numRleValues))}else i=jc(t);break;case H.RLE:i=pl(t,e.runs,e.numRleValues);break;case H.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function t6(t,e,r){switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let i=e;t=dy(t,i.runs,i.numRleValues)}return y3(t),t;case H.RLE:return i6(t,e,r);case H.NONE:return r&&d3(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function e6(t,e){if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.NONE)return w3(t);if(e.logicalLevelTechnique1===H.RLE&&e.logicalLevelTechnique2===H.NONE){let r=e;return _3(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===H.NONE&&e.logicalLevelTechnique2===H.NONE){v3(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.RLE){let r=e,i=D3(t,r.runs,r.numRleValues);return vu(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function es(t,e,r,i,n="int32"){let a=t.logicalLevelTechnique1;if(a===H.RLE)return t.runs===1?ht.CONST:ht.FLAT;if(a!==H.DELTA||t.logicalLevelTechnique2!==H.RLE)return t.numValues===1?ht.CONST:ht.FLAT;let s=e instanceof fe?e.size():e,o=t;if(o.numRleValues!==s)return ht.FLAT;if(o.runs===1)return ht.SEQUENCE;if(o.runs!==2)return t.numValues===1?ht.CONST:ht.FLAT;let l=i.get();if(t.physicalLevelTechnique===le.VARINT)return r6(r,i,n)?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT}function r6(t,e,r){let i=new cy(e.get());if(r==="int64"){let a=xu(t,i,4);return a[2]===BigInt(2)&&a[3]===BigInt(2)}let n=$t(t,i,4);return n[2]===2&&n[3]===2}function i6(t,e,r){return r?x3(t,e.runs,e.numRleValues):dy(t,e.runs,e.numRleValues)}var Sy=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},Ey=class extends uy{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function _u(t,e,r){return{x:Xc(t,e)-r,y:Xc(t>>1,e)-r}}function Xc(t,e){let r=0;for(let i=0;i>i;return r}var Rt;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(Rt||(Rt={}));var n6;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"})(n6||(n6={}));var Fr;(function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"})(Fr||(Fr={}));function a6(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g[D]),r+=v,i+=v}break;case Rt.LINESTRING:{let v;y?(v=p[i]-p[i-1],i++):v=c[r]-c[r-1],r++;let b;d?(b=Or(m,s,v,!1),s+=v*2):(b=lr(t.vertexBufferType,m,f,o,v,!1,l),o+=v),e[a++]=[b],h&&n++}break;case Rt.POLYGON:{let v=c[r]-c[r-1];r++;let b=Array(v-1),D,A=p[i]-p[i-1];if(i++,d){D=Or(m,s,A,!0),s+=A*2;for(let _=0;_r?e[a++]:1);return i}function Zc(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l0;)n[a++]=t[u++]}}return n}var By=class extends Au{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s!=null?s:e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){var n,a,s;(s=this.decodedDictionary)!=null||(this.decodedDictionary=(n=this.sharedDictionaryCache)==null?void 0:n.decodedDictionary,(a=this.decodedDictionary)!=null||(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return bu(this.decodedDictionary,r,i)}decodeDictionary(){var t;return(t=this.symbolLengthBuffer)!=null||(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),v6(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=ct(t,e);m=new fe(ci(t,x.numValues,x.byteLength,e),x.numValues)}let g=Vt(t,e,ct(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new By(y,g,n,a,s,o,m,c)}else h[p++]=new Qr(y,g,n,a,m)}return h}var Kc=class extends Sr{constructor(t,e,r){super(t,new Uint8Array,r!=null?r:e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},Be;(function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"})(Be||(Be={}));var pr;(function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"})(pr||(pr={}));function A6(t,e,r,i){let n=S6(r);if(i===0)return n.map(h=>new Kc(h,[]));let a=E6(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h{var i;return t.name+((i=r.name)!=null?i:"")})}function E6(t,e,r){let i=t[e.get()];e.add(1);let n=Vt(t,e,ct(t,e)),a=r-1,s=[];i&Be.STRING&&(a-=F6(t,e,s)),a-=k6(t,e,i,s),a-=T6(t,e,i,s);let o,l=0;if(i&Be.PRESENCE){let h=I6(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=Vt(t,e,ct(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function F6(t,e,r){let i=t[e.get()];e.add(1);let n=Py("",t,e,i);if(n)for(let a=0;aa.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;xs.length)throw Error("Map value stream underflow while decoding feature payload");let b=M6(s,y,v,l);f[x]=b.value,y=b.nextIndex}let m=0;for(let x=i;x=r)throw Error("Unexpected end of map value stream");let n=t[e];if(n===pr.FALSE)return{value:!1,nextIndex:e+1};if(n===pr.TRUE)return{value:!0,nextIndex:e+1};if(n===pr.START_MAP){let a=Jc(t,e,r);return{value:zy(t,e+2,a,i).value,nextIndex:a}}if(n===pr.START_LIST){let a=Jc(t,e,r),s=[],o=e+2;for(;o=r)throw Error("Missing length for nested map/list payload");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function Ly(t,e){let r=t-pr.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function Xr(t,e){for(let r of e)t.push(r)}function B6(t,e,r,i,n,a){var s;return r.type==="scalarType"?a&&!a.has(r.name)?(my(i,t,e),null):P6(i,t,e,n,r.scalarType,r):((s=r.complexType)==null?void 0:s.physicalType)===Qe.MAP?A6(t,e,r,i):i===0?null:_6(t,e,r,a)}function P6(t,e,r,i,n,a){var l;let s;if(t===0)return null;if(a.nullable){let u=ct(e,r),h=u.numValues,c=r.get(),p=ci(e,h,u.byteLength,r);r.set(c+u.byteLength),s=new fe(p,u.numValues)}let o=s!=null?s:i;switch(n.physicalType){case it.UINT_32:case it.INT_32:return R6(e,r,a,n,o);case it.STRING:{let u=a.nullable?t-1:t;return(l=Py(a.name,e,r,u,s))!=null?l:null}case it.BOOLEAN:return z6(e,r,a,i,o);case it.UINT_64:case it.INT_64:return O6(e,r,a,o,n);case it.FLOAT:return L6(e,r,a,o);case it.DOUBLE:return V6(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function z6(t,e,r,i,n){let a=ct(t,e),s=a.numValues,o=e.get(),l=An(n)?n:void 0,u=ci(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new fe(u,s);return new m6(r.name,h,n)}function L6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=gy(t,e,n.numValues,a);return new g6(r.name,s,i)}function V6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=xy(t,e,n.numValues,a);return new fu(r.name,s,i)}function O6(t,e,r,i,n){let a=ct(t,e),s=es(a,i,t,e,"int64"),o=n.physicalType===it.INT_64;if(s===ht.FLAT){let u=An(i)?i:void 0,h=o?wy(t,e,a,u):Du(t,e,a,u);return new Sy(r.name,h,i)}if(s===ht.SEQUENCE){let u=by(t,e,a);return new Ey(r.name,u[0],u[1],a.numRleValues,o)}let l=o?K3(t,e,a):Dy(t,e,a);return new My(r.name,l,i,o)}function R6(t,e,r,i,n){let a=ct(t,e),s=es(a,n,t,e),o=i.physicalType===it.INT_32;if(s===ht.FLAT){let u=An(n)?n:void 0,h=o?Ta(t,e,a,void 0,u):Vt(t,e,a,void 0,u);return new pu(r.name,h,n)}if(s===ht.SEQUENCE){let u=vy(t,e,a);return new du(r.name,u[0],u[1],a.numRleValues,o)}let l=o?W3(t,e,a):wu(t,e,a);return new yu(r.name,l,n,o)}function An(t){return t instanceof fe}var It={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function Vy(t){switch(t){case It.ID:case It.ID|It.ID_NULLABLE:case It.ID|It.ID_LONG:case It.ID|It.ID_LONG|It.ID_NULLABLE:return{nullable:(t&It.ID_NULLABLE)!==0,columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:(t&It.ID_LONG)!==0,type:"logicalType",logicalType:hy.ID}};case It.GEOMETRY:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.GEOMETRY,children:[]}};case It.STRUCT:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.STRUCT,children:[]}};case It.MAP:return{nullable:!0,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.MAP,children:[]}};default:return j6(t)}}function $6(t){return t>=It.SCALAR_BASE}function Oy(t){return t===It.STRUCT||t===It.MAP}function N6(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case it.BOOLEAN:case it.INT_8:case it.UINT_8:case it.INT_32:case it.UINT_32:case it.INT_64:case it.UINT_64:case it.FLOAT:case it.DOUBLE:return!1;case it.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case Qe.GEOMETRY:case Qe.STRUCT:case Qe.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function U6(t){var e;return t.type==="scalarType"&&((e=t.scalarType)==null?void 0:e.type)==="logicalType"&&t.scalarType.logicalType===hy.ID}function q6(t){var e;return t.type==="complexType"&&((e=t.complexType)==null?void 0:e.type)==="physicalType"&&t.complexType.physicalType===Qe.GEOMETRY}function j6(t){let e;switch(t){case 10:case 11:e=it.BOOLEAN;break;case 12:case 13:e=it.INT_8;break;case 14:case 15:e=it.UINT_8;break;case 16:case 17:e=it.INT_32;break;case 18:case 19:e=it.UINT_32;break;case 20:case 21:e=it.INT_64;break;case 22:case 23:e=it.UINT_64;break;case 24:case 25:e=it.FLOAT;break;case 26:case 27:e=it.DOUBLE;break;case 28:case 29:e=it.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}var G6=new TextDecoder,Qc="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Eu(t,e){let r=$t(t,e,1)[0];if(r===0)return"";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),G6.decode(a)}function X6(t){let e=t.name,r=t.nullable;return t.type==="scalarType"?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:r}:{type:"complexField",complexField:t.complexType,name:e,nullable:r}}function Ry(t,e){let r=$t(t,e,1)[0]>>>0,i=r>=It.SCALAR_BASE?Vy(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n=Si(je({},i),{name:Eu(t,e)});if(n.type==="complexType"&&Oy(r)){let a=n.complexType,s=$t(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o>>0,i=Vy(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Qc}`);let n;if($6(r))n=Eu(t,e);else if(r>>0,o=a.complexType;o.children=Array(s);for(let l=0;l>>0,a=$t(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=$t(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=W6(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(U6(m)){let x=null;if(m.nullable){let b=ct(t,i),D=i.get(),A=ci(t,b.numValues,b.byteLength,i);i.set(D+b.byteLength),x=new fe(A,b.numValues)}let v=ct(t,i);d=x?x.size():v.decompressedCount,c=H6(t,m,i,g,v,x!=null?x:d,r)}else if(q6(m)){let x=$t(t,i,1)[0];if(d===0){let v=i.get();d=ct(t,i).decompressedCount,i.set(v)}e&&(e.scale=e.extent/u),p=f6(t,x,i,d,e)}else{let x=N6(m)?$t(t,i,1)[0]:1;if(x===0)continue;let v=B6(t,i,m,x,d,void 0);if(v)if(Array.isArray(v))for(let b of v)f.push(b);else f.push(v)}}let y=new xw(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function H6(t,e,r,i,n,a,s=!1){var h;let o=(h=e.scalarType)!=null&&h.longID?it.UINT_64:it.UINT_32,l=typeof a=="number"?void 0:a,u=es(n,a,t,r,o===it.UINT_64?"int64":"int32");if(o===it.UINT_32)switch(u){case ht.FLAT:return new pu(i,Vt(t,r,n,void 0,l),a);case ht.SEQUENCE:{let c=vy(t,r,n);return new du(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new yu(i,wu(t,r,n),a,!1)}switch(u){case ht.FLAT:return s?new fu(i,Z3(t,r,n,l),a):new Sy(i,Du(t,r,n,l),a);case ht.SEQUENCE:{let c=by(t,r,n);return new Ey(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new My(i,Dy(t,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var K6=class{constructor(t,e){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},(r=this._featureData.geometry)==null?void 0:r.type){case Rt.POINT:case Rt.MULTIPOINT:this.type=1;break;case Rt.LINESTRING:case Rt.MULTILINESTRING:this.type=2;break;case Rt.POLYGON:case Rt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new B(i.x,i.y));t.push(r)}return t}},J6=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new K6(this.features[t],this.extent)}},Fu=class{constructor(t){this.layers={};let e=Z6(new Uint8Array(t));this.layers=e.reduce((r,i)=>Si(je({},r),{[i.name]:new J6(i)}),{})}},ku=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new uo(mt,16,0),this.grid3D=new uo(mt,16,0),this.featureIndexArray=new Yf,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){return this.vtLayers||(this.encoding==="mlt"?this.vtLayers=new Fu(this.rawTileData).layers:this.vtLayers=new Xl(new au(this.rawTileData)).layers,this.sourceLayerCoder=new cu(this.vtLayers?Object.keys(this.vtLayers).sort():[ll])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=mt/t.tileSize/t.scale,s=ai(n.filter,"queryRenderedFeatures filter",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=Fa.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Fa.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>vg(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(t5);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,v,b)=>(g||(g=Ar(x)),v.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:b,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=hi(f,!0);if(!n.filter(new st(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new st(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=Gt({},l[y]);x.paint=tp(x.paint,m.paint,f,g,s),x.layout=tp(x.layout,m.layout,f,g,s);let v=!h||h(f,m,g);if(!v)continue;let b=new gw(f,this.z,this.x,this.y,d);b.layer=x;let D=t[y];D===void 0&&(D=t[y]=[]),D.push({featureIndex:i,feature:b,intersectionZ:v})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=ai(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){var i;let r=t.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[n],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=t.properties)!=null&&i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};C("FeatureIndex",ku,{omit:["rawTileData","sourceLayerCoder"]});function Q6(t){return typeof t=="object"&&!!t&&"evaluate"in t}function tp(t,e,r,i,n){return Ia(t,(a,s)=>{let o=e instanceof Ya?e.get(s):null;return Q6(o)?o.evaluate(r,i,void 0,n):o})}function t5(t,e){return e-t}var $y=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function Tu(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n="[";for(let a of t)n+=`${Tu(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i="{";for(let n=0;nthis._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||(l=this.familiesBySource[o]={});let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||(h=l[u]=[]),h.push(a)}}},qy=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=su(r),a=new Ja({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Ja.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};C("GlyphAtlas",qy);var jy=class{constructor(t){this.tileID=new uu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,e,r,i,n){return rt(this,null,function*(){this.data=t,this.collisionBoxArray=new Ll;let a=new cu(Object.keys(t.layers).sort()),s=new ku(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let S in u){let k=t.layers[S];if(!k)continue;k.version===1&&Bt(`Vector tile source "${this.source}" layer "${S}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let z=a.encode(S),O=[];for(let P=0;PF.id)))}}let h=Ia(l.glyphDependencies,S=>Object.keys(S));for(let S of this.inFlightDependencies)S==null||S.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let S=new AbortController;this.inFlightDependencies.push(S),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},S)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let S=new AbortController;this.inFlightDependencies.push(S),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},S)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let S=new AbortController;this.inFlightDependencies.push(S),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},S)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let S=new AbortController;this.inFlightDependencies.push(S),g=i.sendAsync({type:"GDA",data:{dashes:m}},S)}let[x,v,b,D]=yield Promise.all([c,f,y,g]),A=new qy(x),_=new ou(v,b);for(let S in o){let k=o[S];k.hasDependencies&&(Ny(k.layers,this.zoom,r),k.addFeatures({options:l,canonical:this.tileID.canonical,glyphMap:x,glyphPositions:A.positions,iconMap:v,iconPositions:_.iconPositions,patternMap:b,patternPositions:_.patternPositions,dashPositions:D,showCollisionBoxes:this.showCollisionBoxes}))}return{buckets:Object.values(o).filter(S=>!S.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:_,dashPositions:D,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?A.positions:null}})}};function Ny(t,e,r){let i=new st(e);for(let n of t)n.recalculate(i,r)}var Gy=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e!=null&&e.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Xy=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},n5=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new B(e.x,e.y)))}},a5=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},s5=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function o5(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l0&&l.addLayer(d)}let h={vectorTile:l,rawData:hu(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}},u5=class{constructor(){this.loaded={}}loadTile(t){return rt(this,null,function*(){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+4,u=i.height+4,h=Ca(i)?new Zt({width:l,height:u},yield ap(i,-2,-2,l,u)):i,c=new jl(e,h,r,n,a,s,o);return this.loaded||(this.loaded={}),this.loaded[e]=c,c})}removeTile(t){let e=this.loaded,r=t.uid;e!=null&&e[r]&&delete e[r]}},h5=class{constructor(t,e,r,i=c5){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Gy,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new ly(n.features,{version:2,extent:mt});return{vectorTile:a,rawData:hu(a,np).buffer}}loadTile(t){return rt(this,null,function*(){let{uid:e}=t,r=new jy(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),yield this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}})}_parseWorkerTile(t,e){return rt(this,null,function*(){let r=this.tileState.getParsing(t.uid),i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Gt({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(t.uid)}return i})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}loadData(t){return rt(this,null,function*(){var r;(r=this._pendingRequest)==null||r.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let i={};return t.request&&(i.data=t.data),this._finishRequestTiming(e,t,i),i}catch(i){if(delete this._pendingRequest,!yl(i))throw i;return{abandoned:!0}}})}_startRequestTiming(t){var e;if((e=t.request)!=null&&e.collectResourceTiming)return new Xy(t.request.url)}_finishRequestTiming(t,e,r){let i=t==null?void 0:t.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return yield this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}loadAndProcessGeoJSON(t,e){return rt(this,null,function*(){var r;if(t.request&&(t.data=(yield up(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){(r=this._geoJSONIndex)!=null||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Yy(t)),this._geoJSONIndex==null)throw Error(`Input data given to \'${t.source}\' is not a valid GeoJSON object.`)})}_filterGeoJSON(t,e,r){if(t.type!=="FeatureCollection")return t;let i=this._getFilterPredicate(e,r);return i?{type:"FeatureCollection",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!="boolean"&&!(t!=null&&t.length))return;let r=er(t,`sources.${e}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}removeSource(t){return rt(this,null,function*(){var e;(e=this._pendingRequest)==null||e.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function c5(t,e){let r=Gt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Yy(e)});return new Td(t,r)}function Yy({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=er(h,`sources.${r}.clusterProperties.${l}[1]`),p=er(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}function Uy(t){return rt(this,null,function*(){if(t.endsWith(".mjs")){yield import(t);return}let e=yield fetch(t,{credentials:"same-origin"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=yield e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{yield import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)})}var p5=class{constructor(t){this.self=t,this.actor=new sy(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=sp,this.self.removeProtocol=op,this.self.registerRTLTextPlugin=e=>{wr.setMethods(e)},this.self.makeRequest=Ma,this.actor.registerMessageHandler("LDT",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",(e,r)=>rt(this,null,function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",(e,r)=>rt(this,null,function*(){var n,a;if(!((a=(n=this.workerSources[e])==null?void 0:n[r.type])!=null&&a[r.source]))return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)})),this.actor.registerMessageHandler("RM",e=>rt(this,null,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)})),this.actor.registerMessageHandler("SR",(e,r)=>rt(this,null,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler("IS",(e,r)=>rt(this,null,function*(){yield Uy(r)})),this.actor.registerMessageHandler("SI",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler("UL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))})),this.actor.registerMessageHandler("UGS",(e,r)=>rt(this,null,function*(){let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]})),this.actor.registerMessageHandler("SL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).replace(r,this._getGlobalState(e))}))}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}_setImages(t,e){return rt(this,null,function*(){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}})}_syncRTLPluginState(t,e){return rt(this,null,function*(){return yield wr.syncState(e,Uy)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i5),e}_getWorkerSource(t,e,r){var i,n;if((i=this.workerSources)[t]||(i[t]={}),(n=this.workerSources[t])[e]||(n[e]={}),!this.workerSources[t][e][r]){let a={sendAsync:(s,o)=>(s.targetMapId=t,this.actor.sendAsync(s,o))};switch(e){case"vector":this.workerSources[t][e][r]=new l5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new h5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){var r,i;return(r=this.demWorkerSources)[t]||(r[t]={}),(i=this.demWorkerSources[t])[e]||(i[e]=new u5),this.demWorkerSources[t][e]}};mr(self)&&(self.worker=new p5(self));export{p5 as default};\n/*! Bundled license information:\n\nmaplibre-gl/dist/maplibre-gl-shared.mjs:\nmaplibre-gl/dist/maplibre-gl-worker.mjs:\n (**\n * MapLibre GL JS\n * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt\n *)\n*/\n'}}),Use=de({"src/plots/map/layers.js"(e,r){"use strict";var t=Qt(),i=Zo().sanitizeHTML,a=s9(),o=D0();function s(f,h){this.subplot=f,this.uid=f.uid+"-"+h,this.index=h,this.idSource="source-"+this.uid,this.idLayer=o.layoutLayerPrefix+this.uid,this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}var l=s.prototype;l.update=function(h){this.visible?this.needsNewImage(h)?this.updateImage(h):this.needsNewSource(h)?(this.removeLayer(),this.updateSource(h),this.updateLayer(h)):this.needsNewLayer(h)?this.updateLayer(h):this.updateStyle(h):(this.updateSource(h),this.updateLayer(h)),this.visible=n(h)},l.needsNewImage=function(f){var h=this.subplot.map;return h.getSource(this.idSource)&&this.sourceType==="image"&&f.sourcetype==="image"&&(this.source!==f.source||JSON.stringify(this.coordinates)!==JSON.stringify(f.coordinates))},l.needsNewSource=function(f){return this.sourceType!==f.sourcetype||JSON.stringify(this.source)!==JSON.stringify(f.source)||this.layerType!==f.type},l.needsNewLayer=function(f){return this.layerType!==f.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(f){var h=this.subplot.map;h.getSource(this.idSource).updateImage({url:f.source,coordinates:f.coordinates});var d=this.findFollowingMapLayerId(this.lookupBelow());d!==null&&this.subplot.map.moveLayer(this.idLayer,d)},l.updateSource=function(f){var h=this.subplot.map;if(h.getSource(this.idSource)&&h.removeSource(this.idSource),this.sourceType=f.sourcetype,this.source=f.source,!!n(f)){var d=c(f);h.addSource(this.idSource,d)}},l.findFollowingMapLayerId=function(f){if(f==="traces")for(var h=this.subplot.getMapLayers(),d=0;d0){for(var d=0;d0}function u(f){var h={},d={};switch(f.type){case"circle":t.extendFlat(d,{"circle-radius":f.circle.radius,"circle-color":f.color,"circle-opacity":f.opacity});break;case"line":t.extendFlat(d,{"line-width":f.line.width,"line-color":f.color,"line-opacity":f.opacity,"line-dasharray":f.line.dash});break;case"fill":t.extendFlat(d,{"fill-color":f.color,"fill-outline-color":f.fill.outlinecolor,"fill-opacity":f.opacity});break;case"symbol":var p=f.symbol,g=a(p.textposition,p.iconsize);t.extendFlat(h,{"icon-image":p.icon,"icon-size":p.iconsize/10,"text-field":p.text,"text-size":p.textfont.size,"text-anchor":g.anchor,"text-offset":g.offset,"symbol-placement":p.placement}),t.extendFlat(d,{"icon-color":f.color,"text-color":p.textfont.color,"text-opacity":f.opacity});break;case"raster":t.extendFlat(d,{"raster-fade-duration":0,"raster-opacity":f.opacity});break}return{layout:h,paint:d}}function c(f){var h=f.sourcetype,d=f.source,p={type:h},g;return h==="geojson"?g="data":h==="vector"?g=typeof d=="string"?"url":"tiles":h==="raster"?(g="tiles",p.tileSize=256):h==="image"&&(g="url",p.coordinates=f.coordinates),p[g]=d,f.sourceattribution&&(p.attribution=i(f.sourceattribution)),p}r.exports=function(h,d,p){var g=new s(h,d);return g.update(p),g}}}),qse=de({"src/plots/map/map.js"(e,r){"use strict";var t=(Nse(),ti(C5)),i=jse(),a=!1,o=()=>{a||(a=!0,t.setWorkerUrl(URL.createObjectURL(new Blob([i],{type:"text/javascript"}))))},s=Qt(),l=Fp(),n=Ma(),u=nn(),c=Uc(),f=$s(),h=Xd(),d=h.drawMode,p=h.selectMode,g=Zl().prepSelect,m=Zl().clearOutline,y=Zl().clearSelectionsCache,_=Zl().selectOnClick,v=D0(),x=Use();function S(E,T){this.id=T,this.gd=E;var F=E._fullLayout,D=E._context;this.container=F._glcontainer.node(),this.isStatic=D.staticPlot,this.uid=F._uid+"-"+this.id,this.div=null,this.xaxis=null,this.yaxis=null,this.createFramework(F),this.map=null,this.styleObj=null,this.traceHash={},this.layerList=[],this.belowLookup={},this.dragging=!1,this.wheeling=!1}var M=S.prototype;M.plot=function(E,T,F){var D=this,R;D.map?R=new Promise(function(P,z){D.updateMap(E,T,P,z)}):R=new Promise(function(P,z){D.createMap(E,T,P,z)}),F.push(R)},M.createMap=function(E,T,F,D){var R=this,P=T[R.id],z=R.styleObj=A(P.style),I=P.bounds,L=I?[[I.west,I.south],[I.east,I.north]]:null;let B={container:R.div,style:z.style,center:b(P.center),zoom:P.zoom,bearing:P.bearing,pitch:P.pitch,maxBounds:L,interactive:!R.isStatic,canvasContextAttributes:{preserveDrawingBuffer:R.isStatic},doubleClickZoom:!1,boxZoom:!1,attributionControl:!1},O=P._fitBounds;O&&(B.bounds=[[O.west,O.south],[O.east,O.north]],B.fitBoundsOptions={padding:v.fitBoundsPadding}),o();let G=R.map=new t.Map(B).addControl(new t.AttributionControl({compact:!0})),W={};G.setMissingStyleImageResolver(Z=>(!W[Z]&&/^[a-zA-Z0-9-]+$/.test(Z)&&(W[Z]=new Promise(J=>{let N=new Image(15,15);N.onload=()=>{G.addImage(Z,N,{sdf:!0}),J()},N.onerror=()=>J(),N.crossOrigin="Anonymous",N.src=`https://cdn.jsdelivr.net/npm/@mapbox/maki@8.2.0/icons/${Z}.svg`})),W[Z])),G.setTransformRequest(function(Z){return Z=Z.replace("https://fonts.openmaptiles.org/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold"),Z=Z.replace("https://tiles.basemaps.cartocdn.com/fonts/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold"),Z=Z.replace("https://fonts.openmaptiles.org/Open Sans Regular,Arial Unicode MS Regular","https://fonts.openmaptiles.org/Klokantech Noto Sans Regular"),{url:Z}}),G._canvas.style.left="0px",G._canvas.style.top="0px",R.rejectOnError(D),R.isStatic||R.initFx(E,T);var X=[];X.push(new Promise(function(Z){G.once("load",Z)})),X=X.concat(l.fetchTraceGeoData(E)),Promise.all(X).then(function(){O&&C(R,P),w(R,P),R.fillBelowLookup(E,T),R.updateData(E),R.updateLayout(T),R.resolveOnRender(F)}).catch(D)},M.updateMap=function(E,T,F,D){var R=this,P=R.map,z=T[this.id];R.rejectOnError(D);var I=[],L=A(z.style);JSON.stringify(R.styleObj)!==JSON.stringify(L)&&(R.styleObj=L,P.setStyle(L.style),R.traceHash={},I.push(new Promise(function(B){P.once("styledata",B)}))),I=I.concat(l.fetchTraceGeoData(E)),Promise.all(I).then(function(){R.fillBelowLookup(E,T),R.updateData(E);let B=z._fitBounds;B&&(P.fitBounds([[B.west,B.south],[B.east,B.north]],{padding:v.fitBoundsPadding,animate:!1}),C(R,z),w(R,z)),R.updateLayout(T),R.resolveOnRender(F)}).catch(D)};function C(E,T){let{center:F,zoom:D}=E.getView();T._input.center=T.center=F,T._input.zoom=T.zoom=D,T._input._fitView={center:Ot({},F),zoom:D}}function w(E,T){let F=E.getView();E.viewInitial={center:s.extendFlat({},F.center),bearing:T.bearing,pitch:T.pitch,zoom:F.zoom}}M.fillBelowLookup=function(E,T){var F=T[this.id],D=F.layers,R,P,z=this.belowLookup={},I=!1;for(R=0;R1)for(R=0;RT.project(D).x,_subplot:T},T.yaxis={_id:"y",c2p:D=>T.project(D).y,_subplot:T},T.updateFramework(E),T.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},u.setConvert(T.mockAxis,E)},M.initFx=function(E,T){var F=this,D=F.gd,R=F.map;R.on("moveend",function(I){if(F.map){var L=D._fullLayout;if(I.originalEvent||F.wheeling){var B=L[F.id];n.call("_storeDirectGUIEdit",D.layout,L._preGUI,F.getViewEdits(B));var O=F.getView();B._input.center=B.center=O.center,B._input.zoom=B.zoom=O.zoom,B._input.bearing=B.bearing=O.bearing,B._input.pitch=B.pitch=O.pitch,D.emit("plotly_relayout",F.getViewEditsWithDerived(O))}I.originalEvent&&I.originalEvent.type==="mouseup"?F.dragging=!1:F.wheeling&&(F.wheeling=!1),L&&L._rehover&&L._rehover()}}),R.on("wheel",function(){F.wheeling=!0}),R.on("mousemove",function(I){var L=F.div.getBoundingClientRect(),B=[I.originalEvent.offsetX,I.originalEvent.offsetY];I.target.getBoundingClientRect=function(){return L},F.xaxis.p2c=function(){return R.unproject(B).lng},F.yaxis.p2c=function(){return R.unproject(B).lat},D._fullLayout._rehover=function(){D._fullLayout._hoversubplot===F.id&&D._fullLayout[F.id]&&f.hover(D,I,F.id)},f.hover(D,I,F.id),D._fullLayout._hoversubplot=F.id});function P(){f.loneUnhover(T._hoverlayer)}R.on("dragstart",function(){F.dragging=!0,P()}),R.on("zoomstart",P),R.on("mouseout",function(){D._fullLayout._hoversubplot=null});function z(){var I=F.getView();D.emit("plotly_relayouting",F.getViewEditsWithDerived(I))}R.on("drag",z),R.on("zoom",z),R.on("dblclick",function(){var I=D._fullLayout[F.id];n.call("_storeDirectGUIEdit",D.layout,D._fullLayout._preGUI,F.getViewEdits(I));var L=F.viewInitial;R.setCenter(b(L.center)),R.setZoom(L.zoom),R.setBearing(L.bearing),R.setPitch(L.pitch);var B=F.getView();I._input.center=I.center=B.center,I._input.zoom=I.zoom=B.zoom,I._input.bearing=I.bearing=B.bearing,I._input.pitch=I.pitch=B.pitch,D.emit("plotly_doubleclick",null),D.emit("plotly_relayout",F.getViewEditsWithDerived(B))}),F.clearOutline=function(){y(F.dragOptions),m(F.dragOptions.gd)},F.onClickInPanFn=function(I){return function(L){var B=D._fullLayout.clickmode;B.indexOf("select")>-1&&_(L.originalEvent,D,[F.xaxis],[F.yaxis],F.id,I),B.indexOf("event")>-1&&f.click(D,L.originalEvent)}}},M.updateFx=function(E){var T=this,F=T.map,D=T.gd;if(T.isStatic)return;function R(L){var B=T.map.unproject(L);return[B.lng,B.lat]}var P=E.dragmode,z;z=function(L,B){if(B.isRect){var O=L.range={};O[T.id]=[R([B.xmin,B.ymin]),R([B.xmax,B.ymax])]}else{var G=L.lassoPoints={};G[T.id]=B.map(R)}};var I=T.dragOptions;T.dragOptions=s.extendDeep(I||{},{dragmode:E.dragmode,element:T.div,gd:D,plotinfo:{id:T.id,domain:E[T.id].domain,xaxis:T.xaxis,yaxis:T.yaxis,fillRangeItems:z},xaxes:[T.xaxis],yaxes:[T.yaxis],subplot:T.id}),F.off("click",T.onClickInPanHandler),p(P)||d(P)?(F.dragPan.disable(),F.on("zoomstart",T.clearOutline),T.dragOptions.prepFn=function(L,B,O){g(L,B,O,T.dragOptions,P)},c.init(T.dragOptions)):(F.dragPan.enable(),F.off("zoomstart",T.clearOutline),T.div.onmousedown=null,T.div.ontouchstart=null,T.div.removeEventListener("touchstart",T.div._ontouchstart),T.onClickInPanHandler=T.onClickInPanFn(T.dragOptions),F.on("click",T.onClickInPanHandler))},M.updateFramework=function(E){var T=E[this.id].domain,F=E._size,D=this.div.style;D.width=F.w*(T.x[1]-T.x[0])+"px",D.height=F.h*(T.y[1]-T.y[0])+"px",D.left=F.l+T.x[0]*F.w+"px",D.top=F.t+(1-T.y[1])*F.h+"px",this.xaxis._offset=F.l+T.x[0]*F.w,this.xaxis._length=F.w*(T.x[1]-T.x[0]),this.yaxis._offset=F.t+(1-T.y[1])*F.h,this.yaxis._length=F.h*(T.y[1]-T.y[0])},M.updateLayers=function(E){var T=E[this.id],F=T.layers,D=this.layerList,R;if(F.length!==D.length){for(R=0;RVse});function Vse(e,r){let t=[];for(let n of e){if(n.subplot!==r||n.visible!==!0)continue;if(n.type==="choroplethmap")return null;let{lat:u,lon:c}=n;if(!c||!u)continue;let f=Math.min(c.length,u.length);for(let h=0;hA/2){var b=M.split("|").join("
");w.text(b).attr("data-unformatted",b).call(n.convertToTspans,f),k=l.bBox(w.node())}w.attr("transform",t(-3,-k.height+8)),C.insert("rect",".static-attribution").attr({x:-k.width-6,y:-k.height-3,width:k.width+6,height:k.height+3,fill:"rgba(255, 255, 255, 0.75)"});var E=1;k.width+6>A&&(E=A/(k.width+6));var T=[p.l+p.w*y.x[1],p.t+p.h*(1-y.y[0])];C.attr("transform",t(T[0],T[1])+i(E))}},e.updateFx=function(f){for(var h=f._fullLayout,d=h._subplots[c],p=0;p=0;u--)l.removeLayer(n[u][1])},s.dispose=function(){var l=this.subplot.map;this._removeLayers(),l.removeSource(this.sourceId)},r.exports=function(n,u){var c=u[0].trace,f=new o(n,c.uid),h=f.sourceId,d=t(u),p=f.below=n.belowLookup["trace-"+c.uid];return n.map.addSource(h,{type:"geojson",data:d.geojson}),f._addLayers(d,p),u[0].trace._glTrace=f,f}}}),Zse=de({"src/traces/choroplethmap/index.js"(e,r){"use strict";r.exports={attributes:z8(),supplyDefaults:Yse(),colorbar:b1(),calc:h7(),plot:Xse(),hoverPoints:d7(),eventData:p7(),selectPoints:v7(),styleOnSelect:function(t,i){if(i){var a=i[0].trace;a._glTrace.updateOnSelect(i)}},getBelow:function(t,i){for(var a=i.getMapLayers(),o=a.length-2;o>=0;o--){var s=a[o].id;if(typeof s=="string"&&s.indexOf("water")===0){for(var l=o+1;l0?+y[g]:0),p.push({type:"Feature",geometry:{type:"Point",coordinates:S},properties:M})}}var w=o.extractOpts(c),k=w.reversescale?o.flipScale(w.colorscale):w.colorscale,A=k[0][1],b=a.opacity(A)<1?A:a.addOpacity(A,0),E=["interpolate",["linear"],["heatmap-density"],0,b];for(g=1;g=0;n--)s.removeLayer(l[n][1])},o.dispose=function(){var s=this.subplot.map;this._removeLayers(),s.removeSource(this.sourceId)},r.exports=function(l,n){var u=n[0].trace,c=new a(l,u.uid),f=c.sourceId,h=t(n),d=c.below=l.belowLookup["trace-"+u.uid];return l.map.addSource(f,{type:"geojson",data:h.geojson}),c._addLayers(h,d),c}}}),rle=de({"src/traces/densitymap/hover.js"(e,r){"use strict";var t=nn(),i=z4().hoverPoints,a=z4().getExtraText;r.exports=function(s,l,n){var u=i(s,l,n);if(u){var c=u[0],f=c.cd,h=f[0].trace,d=f[c.index];if(delete c.color,"z"in d){var p=c.subplot.mockAxis;c.z=d.z,c.zLabel=t.tickText(p,p.c2l(d.z),"hover").text}return c.extraText=a(h,d,f[0].t.labels),[c]}}}}),ile=de({"src/traces/densitymap/event_data.js"(e,r){"use strict";r.exports=function(i,a){return i.lon=a.lon,i.lat=a.lat,i.z=a.z,i}}}),ale=de({"src/traces/densitymap/index.js"(e,r){"use strict";r.exports={attributes:O8(),supplyDefaults:Jse(),colorbar:b1(),formatLabels:o9(),calc:Qse(),plot:tle(),hoverPoints:rle(),eventData:ile(),getBelow:function(t,i){for(var a=i.getMapLayers(),o=0;ox[F%x.length];v("color",_.label.map((F,D)=>a.addOpacity(S(D),.8))),v("customdata");var M=f.link||{},C=l.newContainer(h,"link");function w(F,D){return t.coerce(M,C,i.link,F,D)}w("label"),w("arrowlen"),w("source"),w("target"),w("value"),w("line.color"),w("line.width"),w("hoverinfo",f.hoverinfo),s(M,C,w,m),w("hovertemplate"),w("sort");var k=a.luminosity(p.paper_bgcolor)<.333,A=k?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)",b=w("color",A);function E(F){if(!a.isValid(F))return F;let D=a.opacity(F);return D<=.8?a.addOpacity(F,D+.2):k?a.brighten(F,10):a.adjustLightness(F,-10)}w("hovercolor",Array.isArray(b)?b.map(E):E(b)),w("customdata"),n(M,C,{name:"colorscales",handleItemDefaults:u}),o(h,p,g),g("orientation"),g("direction"),g("valueformat"),g("valuesuffix");let T=_.x.length&&_.y.length?"freeform":void 0;g("arrangement",T),t.coerceFont(g,"textfont",p.font,{autoShadowDflt:!0}),h._length=null};function u(c,f){function h(d,p){return t.coerce(c,f,i.link.colorscales,d,p)}h("label"),h("cmin"),h("cmax"),h("colorscale")}}}),j8=de({"node_modules/strongly-connected-components/scc.js"(e,r){"use strict";r.exports=t;function t(i){for(var a=i.length,o=new Array(a),s=new Array(a),l=new Array(a),n=new Array(a),u=new Array(a),c=new Array(a),f=0;f0;){v=S[S.length-1];var M=i[v];if(n[v]=0&&c[v].push(u[w])}n[v]=C}else{if(s[v]===o[v]){for(var k=[],A=[],b=0,C=x.length-1;C>=0;--C){var E=x[C];if(l[E]=!1,k.push(E),A.push(c[E]),b+=c[E].length,u[E]=d.length,E===v){x.length=C;break}}d.push(k);for(var T=new Array(b),C=0;Cw&&(w=h.source[x]),h.target[x]>w&&(w=h.target[x]);var k=w+1;c.node._count=k;var A,b=c.node.groups,E={};for(x=0;x0&&s(z,k)&&s(I,k)&&!(E.hasOwnProperty(z)&&E.hasOwnProperty(I)&&E[z]===E[I])){E.hasOwnProperty(I)&&(I=E[I]),E.hasOwnProperty(z)&&(z=E[z]),z=+z,I=+I,y[z]=y[I]=!0;var L="";h.label&&h.label[x]&&(L=h.label[x]);var B=null;L&&_.hasOwnProperty(L)&&(B=_[L]),d.push({pointNumber:x,label:L,color:p?h.color[x]:h.color,hovercolor:g?h.hovercolor[x]:h.hovercolor,customdata:m?h.customdata[x]:h.customdata,concentrationscale:B,source:z,target:I,value:+P}),R.source.push(z),R.target.push(I)}}var O=k+b.length,G=o(f.color),W=o(f.customdata),X=[];for(x=0;xk-1,childrenNodes:[],pointNumber:x,label:Z,color:G?f.color[x]:f.color,customdata:W?f.customdata[x]:f.customdata})}var J=!1;return u(O,R.source,R.target)&&(J=!0),{circular:J,links:d,nodes:X,groups:b,groupLookup:E}}function u(c,f,h){for(var d=i.init2dArray(c,0),p=0;p1})}r.exports=function(f,h){var d=n(h);return a({circular:d.circular,_nodes:d.nodes,_links:d.links,_groups:d.groups,_groupLookup:d.groupLookup})}}}),lle=de({"node_modules/d3-quadtree/dist/d3-quadtree.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e):(t=t||self,i(t.d3=t.d3||{}))})(e,function(t){"use strict";function i(k){var A=+this._x.call(null,k),b=+this._y.call(null,k);return a(this.cover(A,b),A,b,k)}function a(k,A,b,E){if(isNaN(A)||isNaN(b))return k;var T,F=k._root,D={data:E},R=k._x0,P=k._y0,z=k._x1,I=k._y1,L,B,O,G,W,X,Z,J;if(!F)return k._root=D,k;for(;F.length;)if((W=A>=(L=(R+z)/2))?R=L:z=L,(X=b>=(B=(P+I)/2))?P=B:I=B,T=F,!(F=F[Z=X<<1|W]))return T[Z]=D,k;if(O=+k._x.call(null,F.data),G=+k._y.call(null,F.data),A===O&&b===G)return D.next=F,T?T[Z]=D:k._root=D,k;do T=T?T[Z]=new Array(4):k._root=new Array(4),(W=A>=(L=(R+z)/2))?R=L:z=L,(X=b>=(B=(P+I)/2))?P=B:I=B;while((Z=X<<1|W)===(J=(G>=B)<<1|O>=L));return T[J]=F,T[Z]=D,k}function o(k){var A,b,E=k.length,T,F,D=new Array(E),R=new Array(E),P=1/0,z=1/0,I=-1/0,L=-1/0;for(b=0;bI&&(I=T),FL&&(L=F));if(P>I||z>L)return this;for(this.cover(P,z).cover(I,L),b=0;bk||k>=T||E>A||A>=F;)switch(z=(AI||(R=G.y0)>L||(P=G.x1)=Z)<<1|k>=X)&&(G=B[B.length-1],B[B.length-1]=B[B.length-1-W],B[B.length-1-W]=G)}else{var J=k-+this._x.call(null,O.data),N=A-+this._y.call(null,O.data),H=J*J+N*N;if(H=(B=(D+P)/2))?D=B:P=B,(W=L>=(O=(R+z)/2))?R=O:z=O,A=b,!(b=b[X=W<<1|G]))return this;if(!b.length)break;(A[X+1&3]||A[X+2&3]||A[X+3&3])&&(E=A,Z=X)}for(;b.data!==k;)if(T=b,!(b=b.next))return this;return(F=b.next)&&delete b.next,T?(F?T.next=F:delete T.next,this):A?(F?A[X]=F:delete A[X],(b=A[0]||A[1]||A[2]||A[3])&&b===(A[3]||A[2]||A[1]||A[0])&&!b.length&&(E?E[Z]=b:this._root=b),this):(this._root=F,this)}function h(k){for(var A=0,b=k.length;A=y.length)return v!=null&&w.sort(v),x!=null?x(w):w;for(var E=-1,T=w.length,F=y[k++],D,R,P=o(),z,I=A();++Ey.length)return w;var A,b=_[k-1];return x!=null&&k>=y.length?A=w.entries():(A=[],w.each(function(E,T){A.push({key:T,values:C(E,k)})})),b!=null?A.sort(function(E,T){return b(E.key,T.key)}):A}return S={object:function(w){return M(w,0,l,n)},map:function(w){return M(w,0,u,c)},entries:function(w){return C(M(w,0,u,c),0)},key:function(w){return y.push(w),S},sortKeys:function(w){return _[y.length-1]=w,S},sortValues:function(w){return v=w,S},rollup:function(w){return x=w,S}}}function l(){return{}}function n(y,_,v){y[_]=v}function u(){return o()}function c(y,_,v){y.set(_,v)}function f(){}var h=o.prototype;f.prototype=d.prototype={constructor:f,has:h.has,add:function(y){return y+="",this[i+y]=y,this},remove:h.remove,clear:h.clear,values:h.keys,size:h.size,empty:h.empty,each:h.each};function d(y,_){var v=new f;if(y instanceof f)y.each(function(M){v.add(M)});else if(y){var x=-1,S=y.length;if(_==null)for(;++x=0&&(h=f.slice(d+1),f=f.slice(0,d)),f&&!c.hasOwnProperty(f))throw new Error("unknown type: "+f);return{type:f,name:h}})}o.prototype=a.prototype={constructor:o,on:function(u,c){var f=this._,h=s(u+"",f),d,p=-1,g=h.length;if(arguments.length<2){for(;++p0)for(var f=new Array(d),h=0,d,p;h=0&&k._call.call(null,A),k=k._next;--i}function v(){c=(u=h.now())+f,i=a=0;try{_()}finally{i=0,S(),c=0}}function x(){var k=h.now(),A=k-u;A>s&&(f-=A,u=k)}function S(){for(var k,A=l,b,E=1/0;A;)A._call?(E>A._time&&(E=A._time),k=A,A=A._next):(b=A._next,A._next=null,A=k?k._next=b:l=b);n=k,M(E)}function M(k){if(!i){a&&(a=clearTimeout(a));var A=k-c;A>24?(k<1/0&&(a=setTimeout(v,k-h.now()-f)),o&&(o=clearInterval(o))):(o||(u=h.now(),o=setInterval(x,s)),i=1,d(v))}}function C(k,A,b){var E=new m;return A=A==null?0:+A,E.restart(function(T){E.stop(),k(T+A)},A,b),E}function w(k,A,b){var E=new m,T=A;return A==null?(E.restart(k,A,b),E):(A=+A,b=b==null?p():+b,E.restart(function F(D){D+=T,E.restart(F,T+=A,b),k(D)},A,b),E)}t.interval=w,t.now=p,t.timeout=C,t.timer=y,t.timerFlush=_,Object.defineProperty(t,"__esModule",{value:!0})})}}),fle=de({"node_modules/d3-force/dist/d3-force.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e,lle(),U8(),ule(),cle()):i(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3)})(e,(function(t,i,a,o,s){"use strict";function l(k,A){var b;k==null&&(k=0),A==null&&(A=0);function E(){var T,F=b.length,D,R=0,P=0;for(T=0;TL.index){var Y=B-V.x-V.vx,K=O-V.y-V.vy,te=Y*Y+K*K;teB+q||$O+q||UP.r&&(P.r=P[z].r)}function R(){if(A){var P,z=A.length,I;for(b=new Array(z),P=0;P1?(W==null?R.remove(G):R.set(G,O(W)),A):R.get(G)},find:function(G,W,X){var Z=0,J=k.length,N,H,$,U,V;for(X==null?X=1/0:X*=X,Z=0;Z1?(z.on(G,W),A):z.on(G)}}}function S(){var k,A,b,E=n(-30),T,F=1,D=1/0,R=.81;function P(B){var O,G=k.length,W=i.quadtree(k,m,y).visitAfter(I);for(b=B,O=0;O=D)return;(B.data!==A||B.next)&&(X===0&&(X=u(),N+=X*X),Z===0&&(Z=u(),N+=Z*Z),Nyt?1:gt>=yt?0:NaN}function a(gt){let yt=gt,kt=gt;gt.length===1&&(yt=(mr,br)=>gt(mr)-br,kt=o(gt));function Lt(mr,br,Er,Tr){for(Er==null&&(Er=0),Tr==null&&(Tr=mr.length);Er>>1;kt(mr[Ur],br)<0?Er=Ur+1:Tr=Ur}return Er}function Ct(mr,br,Er,Tr){for(Er==null&&(Er=0),Tr==null&&(Tr=mr.length);Er>>1;kt(mr[Ur],br)>0?Tr=Ur:Er=Ur+1}return Er}function $t(mr,br,Er,Tr){Er==null&&(Er=0),Tr==null&&(Tr=mr.length);let Ur=Lt(mr,br,Er,Tr-1);return Ur>Er&&yt(mr[Ur-1],br)>-yt(mr[Ur],br)?Ur-1:Ur}return{left:Lt,center:$t,right:Ct}}function o(gt){return(yt,kt)=>i(gt(yt),kt)}function s(gt){return gt===null?NaN:+gt}function*l(gt,yt){if(yt===void 0)for(let kt of gt)kt!=null&&(kt=+kt)>=kt&&(yield kt);else{let kt=-1;for(let Lt of gt)(Lt=yt(Lt,++kt,gt))!=null&&(Lt=+Lt)>=Lt&&(yield Lt)}}let n=a(i),u=n.right,c=n.left,f=a(s).center;function h(gt,yt){let kt=0;if(yt===void 0)for(let Lt of gt)Lt!=null&&(Lt=+Lt)>=Lt&&++kt;else{let Lt=-1;for(let Ct of gt)(Ct=yt(Ct,++Lt,gt))!=null&&(Ct=+Ct)>=Ct&&++kt}return kt}function d(gt){return gt.length|0}function p(gt){return!(gt>0)}function g(gt){return typeof gt!="object"||"length"in gt?gt:Array.from(gt)}function m(gt){return yt=>gt(...yt)}function y(...gt){let yt=typeof gt[gt.length-1]=="function"&&m(gt.pop());gt=gt.map(g);let kt=gt.map(d),Lt=gt.length-1,Ct=new Array(Lt+1).fill(0),$t=[];if(Lt<0||kt.some(p))return $t;for(;;){$t.push(Ct.map((br,Er)=>gt[Er][br]));let mr=Lt;for(;++Ct[mr]===kt[mr];){if(mr===0)return yt?$t.map(yt):$t;Ct[mr--]=0}}}function _(gt,yt){var kt=0,Lt=0;return Float64Array.from(gt,yt===void 0?Ct=>kt+=+Ct||0:Ct=>kt+=+yt(Ct,Lt++,gt)||0)}function v(gt,yt){return ytgt?1:yt>=gt?0:NaN}function x(gt,yt){let kt=0,Lt,Ct=0,$t=0;if(yt===void 0)for(let mr of gt)mr!=null&&(mr=+mr)>=mr&&(Lt=mr-Ct,Ct+=Lt/++kt,$t+=Lt*(mr-Ct));else{let mr=-1;for(let br of gt)(br=yt(br,++mr,gt))!=null&&(br=+br)>=br&&(Lt=br-Ct,Ct+=Lt/++kt,$t+=Lt*(br-Ct))}if(kt>1)return $t/(kt-1)}function S(gt,yt){let kt=x(gt,yt);return kt&&Math.sqrt(kt)}function M(gt,yt){let kt,Lt;if(yt===void 0)for(let Ct of gt)Ct!=null&&(kt===void 0?Ct>=Ct&&(kt=Lt=Ct):(kt>Ct&&(kt=Ct),Lt=$t&&(kt=Lt=$t):(kt>$t&&(kt=$t),Lt<$t&&(Lt=$t)))}return[kt,Lt]}class C{constructor(){this._partials=new Float64Array(32),this._n=0}add(yt){let kt=this._partials,Lt=0;for(let Ct=0;Ct0){for(mr=yt[--kt];kt>0&&(Lt=mr,Ct=yt[--kt],mr=Lt+Ct,$t=Ct-(mr-Lt),!$t););kt>0&&($t<0&&yt[kt-1]<0||$t>0&&yt[kt-1]>0)&&(Ct=$t*2,Lt=mr+Ct,Ct==Lt-mr&&(mr=Lt))}return mr}}function w(gt,yt){let kt=new C;if(yt===void 0)for(let Lt of gt)(Lt=+Lt)&&kt.add(Lt);else{let Lt=-1;for(let Ct of gt)(Ct=+yt(Ct,++Lt,gt))&&kt.add(Ct)}return+kt}function k(gt,yt){let kt=new C,Lt=-1;return Float64Array.from(gt,yt===void 0?Ct=>kt.add(+Ct||0):Ct=>kt.add(+yt(Ct,++Lt,gt)||0))}class A extends Map{constructor(yt,kt=D){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:kt}}),yt!=null)for(let[Lt,Ct]of yt)this.set(Lt,Ct)}get(yt){return super.get(E(this,yt))}has(yt){return super.has(E(this,yt))}set(yt,kt){return super.set(T(this,yt),kt)}delete(yt){return super.delete(F(this,yt))}}class b extends Set{constructor(yt,kt=D){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:kt}}),yt!=null)for(let Lt of yt)this.add(Lt)}has(yt){return super.has(E(this,yt))}add(yt){return super.add(T(this,yt))}delete(yt){return super.delete(F(this,yt))}}function E({_intern:gt,_key:yt},kt){let Lt=yt(kt);return gt.has(Lt)?gt.get(Lt):kt}function T({_intern:gt,_key:yt},kt){let Lt=yt(kt);return gt.has(Lt)?gt.get(Lt):(gt.set(Lt,kt),kt)}function F({_intern:gt,_key:yt},kt){let Lt=yt(kt);return gt.has(Lt)&&(kt=gt.get(kt),gt.delete(Lt)),kt}function D(gt){return gt!==null&&typeof gt=="object"?gt.valueOf():gt}function R(gt){return gt}function P(gt,...yt){return W(gt,R,R,yt)}function z(gt,...yt){return W(gt,Array.from,R,yt)}function I(gt,yt,...kt){return W(gt,R,yt,kt)}function L(gt,yt,...kt){return W(gt,Array.from,yt,kt)}function B(gt,...yt){return W(gt,R,G,yt)}function O(gt,...yt){return W(gt,Array.from,G,yt)}function G(gt){if(gt.length!==1)throw new Error("duplicate key");return gt[0]}function W(gt,yt,kt,Lt){return(function Ct($t,mr){if(mr>=Lt.length)return kt($t);let br=new A,Er=Lt[mr++],Tr=-1;for(let Ur of $t){let Ai=Er(Ur,++Tr,$t),oi=br.get(Ai);oi?oi.push(Ur):br.set(Ai,[Ur])}for(let[Ur,Ai]of br)br.set(Ur,Ct(Ai,mr));return yt(br)})(gt,0)}function X(gt,yt){return Array.from(yt,kt=>gt[kt])}function Z(gt,...yt){if(typeof gt[Symbol.iterator]!="function")throw new TypeError("values is not iterable");gt=Array.from(gt);let[kt=i]=yt;if(kt.length===1||yt.length>1){let Lt=Uint32Array.from(gt,(Ct,$t)=>$t);return yt.length>1?(yt=yt.map(Ct=>gt.map(Ct)),Lt.sort((Ct,$t)=>{for(let mr of yt){let br=i(mr[Ct],mr[$t]);if(br)return br}})):(kt=gt.map(kt),Lt.sort((Ct,$t)=>i(kt[Ct],kt[$t]))),X(gt,Lt)}return gt.sort(kt)}function J(gt,yt,kt){return(yt.length===1?Z(I(gt,yt,kt),(([Lt,Ct],[$t,mr])=>i(Ct,mr)||i(Lt,$t))):Z(P(gt,kt),(([Lt,Ct],[$t,mr])=>yt(Ct,mr)||i(Lt,$t)))).map(([Lt])=>Lt)}var N=Array.prototype,H=N.slice;function $(gt){return function(){return gt}}var U=Math.sqrt(50),V=Math.sqrt(10),j=Math.sqrt(2);function q(gt,yt,kt){var Lt,Ct=-1,$t,mr,br;if(yt=+yt,gt=+gt,kt=+kt,gt===yt&&kt>0)return[gt];if((Lt=yt0){let Er=Math.round(gt/br),Tr=Math.round(yt/br);for(Er*bryt&&--Tr,mr=new Array($t=Tr-Er+1);++Ct<$t;)mr[Ct]=(Er+Ct)*br}else{br=-br;let Er=Math.round(gt*br),Tr=Math.round(yt*br);for(Er/bryt&&--Tr,mr=new Array($t=Tr-Er+1);++Ct<$t;)mr[Ct]=(Er+Ct)/br}return Lt&&mr.reverse(),mr}function Y(gt,yt,kt){var Lt=(yt-gt)/Math.max(0,kt),Ct=Math.floor(Math.log(Lt)/Math.LN10),$t=Lt/Math.pow(10,Ct);return Ct>=0?($t>=U?10:$t>=V?5:$t>=j?2:1)*Math.pow(10,Ct):-Math.pow(10,-Ct)/($t>=U?10:$t>=V?5:$t>=j?2:1)}function K(gt,yt,kt){var Lt=Math.abs(yt-gt)/Math.max(0,kt),Ct=Math.pow(10,Math.floor(Math.log(Lt)/Math.LN10)),$t=Lt/Ct;return $t>=U?Ct*=10:$t>=V?Ct*=5:$t>=j&&(Ct*=2),yt0?(gt=Math.floor(gt/Ct)*Ct,yt=Math.ceil(yt/Ct)*Ct):Ct<0&&(gt=Math.ceil(gt*Ct)/Ct,yt=Math.floor(yt*Ct)/Ct),Lt=Ct}}function ne(gt){return Math.ceil(Math.log(h(gt))/Math.LN2)+1}function se(){var gt=R,yt=M,kt=ne;function Lt(Ct){Array.isArray(Ct)||(Ct=Array.from(Ct));var $t,mr=Ct.length,br,Er=new Array(mr);for($t=0;$t=Ai)if(ja>=Ai&&yt===M){let pa=Y(Ur,Ai,ya);isFinite(pa)&&(pa>0?Ai=(Math.floor(Ai/pa)+1)*pa:pa<0&&(Ai=(Math.ceil(Ai*-pa)+1)/-pa))}else oi.pop()}for(var Qr=oi.length;oi[0]<=Ur;)oi.shift(),--Qr;for(;oi[Qr-1]>Ai;)oi.pop(),--Qr;var ea=new Array(Qr+1),$i;for($t=0;$t<=Qr;++$t)$i=ea[$t]=[],$i.x0=$t>0?oi[$t-1]:Ur,$i.x1=$t=Lt)&&(kt=Lt);else{let Lt=-1;for(let Ct of gt)(Ct=yt(Ct,++Lt,gt))!=null&&(kt=Ct)&&(kt=Ct)}return kt}function ce(gt,yt){let kt;if(yt===void 0)for(let Lt of gt)Lt!=null&&(kt>Lt||kt===void 0&&Lt>=Lt)&&(kt=Lt);else{let Lt=-1;for(let Ct of gt)(Ct=yt(Ct,++Lt,gt))!=null&&(kt>Ct||kt===void 0&&Ct>=Ct)&&(kt=Ct)}return kt}function pe(gt,yt,kt=0,Lt=gt.length-1,Ct=i){for(;Lt>kt;){if(Lt-kt>600){let Er=Lt-kt+1,Tr=yt-kt+1,Ur=Math.log(Er),Ai=.5*Math.exp(2*Ur/3),oi=.5*Math.sqrt(Ur*Ai*(Er-Ai)/Er)*(Tr-Er/2<0?-1:1),Qr=Math.max(kt,Math.floor(yt-Tr*Ai/Er+oi)),ea=Math.min(Lt,Math.floor(yt+(Er-Tr)*Ai/Er+oi));pe(gt,yt,Qr,ea,Ct)}let $t=gt[yt],mr=kt,br=Lt;for(xe(gt,kt,yt),Ct(gt[Lt],$t)>0&&xe(gt,kt,Lt);mr0;)--br}Ct(gt[kt],$t)===0?xe(gt,kt,br):(++br,xe(gt,br,Lt)),br<=yt&&(kt=br+1),yt<=br&&(Lt=br-1)}return gt}function xe(gt,yt,kt){let Lt=gt[yt];gt[yt]=gt[kt],gt[kt]=Lt}function ye(gt,yt,kt){if(gt=Float64Array.from(l(gt,kt)),!!(Lt=gt.length)){if((yt=+yt)<=0||Lt<2)return ce(gt);if(yt>=1)return le(gt);var Lt,Ct=(Lt-1)*yt,$t=Math.floor(Ct),mr=le(pe(gt,$t).subarray(0,$t+1)),br=ce(gt.subarray($t+1));return mr+(br-mr)*(Ct-$t)}}function fe(gt,yt,kt=s){if(Lt=gt.length){if((yt=+yt)<=0||Lt<2)return+kt(gt[0],0,gt);if(yt>=1)return+kt(gt[Lt-1],Lt-1,gt);var Lt,Ct=(Lt-1)*yt,$t=Math.floor(Ct),mr=+kt(gt[$t],$t,gt),br=+kt(gt[$t+1],$t+1,gt);return mr+(br-mr)*(Ct-$t)}}function ae(gt,yt,kt){return Math.ceil((kt-yt)/(2*(ye(gt,.75)-ye(gt,.25))*Math.pow(h(gt),-1/3)))}function ee(gt,yt,kt){return Math.ceil((kt-yt)/(3.5*S(gt)*Math.pow(h(gt),-1/3)))}function ie(gt,yt){let kt,Lt=-1,Ct=-1;if(yt===void 0)for(let $t of gt)++Ct,$t!=null&&(kt<$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);else for(let $t of gt)($t=yt($t,++Ct,gt))!=null&&(kt<$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);return Lt}function Q(gt,yt){let kt=0,Lt=0;if(yt===void 0)for(let Ct of gt)Ct!=null&&(Ct=+Ct)>=Ct&&(++kt,Lt+=Ct);else{let Ct=-1;for(let $t of gt)($t=yt($t,++Ct,gt))!=null&&($t=+$t)>=$t&&(++kt,Lt+=$t)}if(kt)return Lt/kt}function ue(gt,yt){return ye(gt,.5,yt)}function*ge(gt){for(let yt of gt)yield*Ia(yt)}function Me(gt){return Array.from(ge(gt))}function Te(gt,yt){let kt,Lt=-1,Ct=-1;if(yt===void 0)for(let $t of gt)++Ct,$t!=null&&(kt>$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);else for(let $t of gt)($t=yt($t,++Ct,gt))!=null&&(kt>$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);return Lt}function je(gt,yt=Ve){let kt=[],Lt,Ct=!1;for(let $t of gt)Ct&&kt.push(yt(Lt,$t)),Lt=$t,Ct=!0;return kt}function Ve(gt,yt){return[gt,yt]}function Ze(gt,yt,kt){gt=+gt,yt=+yt,kt=(Ct=arguments.length)<2?(yt=gt,gt=0,1):Ct<3?1:+kt;for(var Lt=-1,Ct=Math.max(0,Math.ceil((yt-gt)/kt))|0,$t=new Array(Ct);++Lt0:i(mr,mr)===0)&&(kt=$t,Ct=mr,Lt=!0)}}else for(let Ct of gt)(Lt?yt(Ct,kt)>0:yt(Ct,Ct)===0)&&(kt=Ct,Lt=!0);return kt}function Pt(gt,yt=i){if(yt.length===1)return ie(gt,yt);let kt,Lt=-1,Ct=-1;for(let $t of gt)++Ct,(Lt<0?yt($t,$t)===0:yt($t,kt)>0)&&(kt=$t,Lt=Ct);return Lt}function mt(gt,yt){let kt=vt(gt,yt);return kt<0?void 0:kt}var Mt=lt(Math.random);function lt(gt){return function(kt,Lt=0,Ct=kt.length){let $t=Ct-(Lt=+Lt);for(;$t;){let mr=gt()*$t--|0,br=kt[$t+Lt];kt[$t+Lt]=kt[mr+Lt],kt[mr+Lt]=br}return kt}}function qe(gt,yt){let kt=0;if(yt===void 0)for(let Lt of gt)(Lt=+Lt)&&(kt+=Lt);else{let Lt=-1;for(let Ct of gt)(Ct=+yt(Ct,++Lt,gt))&&(kt+=Ct)}return kt}function Ye(gt){if(!($t=gt.length))return[];for(var yt=-1,kt=ce(gt,me),Lt=new Array(kt);++ytyt(kt,Lt,gt))}function Je(gt,yt,kt){if(typeof yt!="function")throw new TypeError("reducer is not a function");let Lt=gt[Symbol.iterator](),Ct,$t,mr=-1;if(arguments.length<3){if({done:Ct,value:kt}=Lt.next(),Ct)return;++mr}for(;{done:Ct,value:$t}=Lt.next(),!Ct;)kt=yt(kt,$t,++mr,gt);return kt}function Ue(gt){if(typeof gt[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(gt).reverse()}function at(gt,...yt){gt=new Set(gt);for(let kt of yt)for(let Lt of kt)gt.delete(Lt);return gt}function rt(gt,yt){let kt=yt[Symbol.iterator](),Lt=new Set;for(let Ct of gt){if(Lt.has(Ct))return!1;let $t,mr;for(;({value:$t,done:mr}=kt.next())&&!mr;){if(Object.is(Ct,$t))return!1;Lt.add($t)}}return!0}function ft(gt){return gt instanceof Set?gt:new Set(gt)}function At(gt,...yt){gt=new Set(gt),yt=yt.map(ft);e:for(let kt of gt)for(let Lt of yt)if(!Lt.has(kt)){gt.delete(kt);continue e}return gt}function ht(gt,yt){let kt=gt[Symbol.iterator](),Lt=new Set;for(let Ct of yt){if(Lt.has(Ct))continue;let $t,mr;for(;{value:$t,done:mr}=kt.next();){if(mr)return!1;if(Lt.add($t),Object.is(Ct,$t))break}}return!0}function Gt(gt,yt){return ht(yt,gt)}function fr(...gt){let yt=new Set;for(let kt of gt)for(let Lt of kt)yt.add(Lt);return yt}t.Adder=C,t.InternMap=A,t.InternSet=b,t.ascending=i,t.bin=se,t.bisect=u,t.bisectCenter=f,t.bisectLeft=c,t.bisectRight=u,t.bisector=a,t.count=h,t.cross=y,t.cumsum=_,t.descending=v,t.deviation=S,t.difference=at,t.disjoint=rt,t.every=Ae,t.extent=M,t.fcumsum=k,t.filter=Ee,t.fsum=w,t.greatest=xt,t.greatestIndex=Pt,t.group=P,t.groupSort=J,t.groups=z,t.histogram=se,t.index=B,t.indexes=O,t.intersection=At,t.least=Ke,t.leastIndex=vt,t.map=De,t.max=le,t.maxIndex=ie,t.mean=Q,t.median=ue,t.merge=Me,t.min=ce,t.minIndex=Te,t.nice=te,t.pairs=je,t.permute=X,t.quantile=ye,t.quantileSorted=fe,t.quickselect=pe,t.range=Ze,t.reduce=Je,t.reverse=Ue,t.rollup=I,t.rollups=L,t.scan=mt,t.shuffle=Mt,t.shuffler=lt,t.some=ke,t.sort=Z,t.subset=Gt,t.sum=qe,t.superset=ht,t.thresholdFreedmanDiaconis=ae,t.thresholdScott=ee,t.thresholdSturges=ne,t.tickIncrement=Y,t.tickStep=K,t.ticks=q,t.transpose=Ye,t.union=fr,t.variance=x,t.zip=_e,Object.defineProperty(t,"__esModule",{value:!0})}))}}),dle=de({"node_modules/d3-path/dist/d3-path.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e):(t=t||self,i(t.d3=t.d3||{}))})(e,function(t){"use strict";var i=Math.PI,a=2*i,o=1e-6,s=a-o;function l(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function n(){return new l}l.prototype=n.prototype={constructor:l,moveTo:function(u,c){this._+="M"+(this._x0=this._x1=+u)+","+(this._y0=this._y1=+c)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(u,c){this._+="L"+(this._x1=+u)+","+(this._y1=+c)},quadraticCurveTo:function(u,c,f,h){this._+="Q"+ +u+","+ +c+","+(this._x1=+f)+","+(this._y1=+h)},bezierCurveTo:function(u,c,f,h,d,p){this._+="C"+ +u+","+ +c+","+ +f+","+ +h+","+(this._x1=+d)+","+(this._y1=+p)},arcTo:function(u,c,f,h,d){u=+u,c=+c,f=+f,h=+h,d=+d;var p=this._x1,g=this._y1,m=f-u,y=h-c,_=p-u,v=g-c,x=_*_+v*v;if(d<0)throw new Error("negative radius: "+d);if(this._x1===null)this._+="M"+(this._x1=u)+","+(this._y1=c);else if(x>o)if(!(Math.abs(v*m-y*_)>o)||!d)this._+="L"+(this._x1=u)+","+(this._y1=c);else{var S=f-p,M=h-g,C=m*m+y*y,w=S*S+M*M,k=Math.sqrt(C),A=Math.sqrt(x),b=d*Math.tan((i-Math.acos((C+x-w)/(2*k*A)))/2),E=b/A,T=b/k;Math.abs(E-1)>o&&(this._+="L"+(u+E*_)+","+(c+E*v)),this._+="A"+d+","+d+",0,0,"+ +(v*S>_*M)+","+(this._x1=u+T*m)+","+(this._y1=c+T*y)}},arc:function(u,c,f,h,d,p){u=+u,c=+c,f=+f,p=!!p;var g=f*Math.cos(h),m=f*Math.sin(h),y=u+g,_=c+m,v=1^p,x=p?h-d:d-h;if(f<0)throw new Error("negative radius: "+f);this._x1===null?this._+="M"+y+","+_:(Math.abs(this._x1-y)>o||Math.abs(this._y1-_)>o)&&(this._+="L"+y+","+_),f&&(x<0&&(x=x%a+a),x>s?this._+="A"+f+","+f+",0,1,"+v+","+(u-g)+","+(c-m)+"A"+f+","+f+",0,1,"+v+","+(this._x1=y)+","+(this._y1=_):x>o&&(this._+="A"+f+","+f+",0,"+ +(x>=i)+","+v+","+(this._x1=u+f*Math.cos(d))+","+(this._y1=c+f*Math.sin(d))))},rect:function(u,c,f,h){this._+="M"+(this._x0=this._x1=+u)+","+(this._y0=this._y1=+c)+"h"+ +f+"v"+ +h+"h"+-f+"Z"},toString:function(){return this._}},t.path=n,Object.defineProperty(t,"__esModule",{value:!0})})}}),q8=de({"node_modules/d3-shape/dist/d3-shape.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e,dle()):(t=t||self,i(t.d3=t.d3||{},t.d3))})(e,function(t,i){"use strict";function a(ze){return function(){return ze}}var o=Math.abs,s=Math.atan2,l=Math.cos,n=Math.max,u=Math.min,c=Math.sin,f=Math.sqrt,h=1e-12,d=Math.PI,p=d/2,g=2*d;function m(ze){return ze>1?0:ze<-1?d:Math.acos(ze)}function y(ze){return ze>=1?p:ze<=-1?-p:Math.asin(ze)}function _(ze){return ze.innerRadius}function v(ze){return ze.outerRadius}function x(ze){return ze.startAngle}function S(ze){return ze.endAngle}function M(ze){return ze&&ze.padAngle}function C(ze,tt,ct,wt,Nt,It,Zt,qt){var vr=ct-ze,Br=wt-tt,Pr=Zt-Nt,Mi=qt-It,gi=Mi*vr-Pr*Br;if(!(gi*giln*ln+on*on&&(tn=Kn,Mn=zn),{cx:tn,cy:Mn,x01:-Pr,y01:-Mi,x11:tn*(Nt/pn-1),y11:Mn*(Nt/pn-1)}}function k(){var ze=_,tt=v,ct=a(0),wt=null,Nt=x,It=S,Zt=M,qt=null;function vr(){var Br,Pr,Mi=+ze.apply(this,arguments),gi=+tt.apply(this,arguments),ba=Nt.apply(this,arguments)-p,Hi=It.apply(this,arguments)-p,Za=o(Hi-ba),oa=Hi>ba;if(qt||(qt=Br=i.path()),gih))qt.moveTo(0,0);else if(Za>g-h)qt.moveTo(gi*l(ba),gi*c(ba)),qt.arc(0,0,gi,ba,Hi,!oa),Mi>h&&(qt.moveTo(Mi*l(Hi),Mi*c(Hi)),qt.arc(0,0,Mi,Hi,ba,oa));else{var Cn=ba,_n=Hi,Li=ba,In=Hi,pn=Za,Ka=Za,Rn=Zt.apply(this,arguments)/2,tn=Rn>h&&(wt?+wt.apply(this,arguments):f(Mi*Mi+gi*gi)),Mn=u(o(gi-Mi)/2,+ct.apply(this,arguments)),Kn=Mn,zn=Mn,ua,Ea;if(tn>h){var ln=y(tn/Mi*c(Rn)),on=y(tn/gi*c(Rn));(pn-=ln*2)>h?(ln*=oa?1:-1,Li+=ln,In-=ln):(pn=0,Li=In=(ba+Hi)/2),(Ka-=on*2)>h?(on*=oa?1:-1,Cn+=on,_n-=on):(Ka=0,Cn=_n=(ba+Hi)/2)}var ao=gi*l(Cn),ho=gi*c(Cn),Jn=Mi*l(In),lo=Mi*c(In);if(Mn>h){var Fo=gi*l(_n),uo=gi*c(_n),Qn=Mi*l(Li),jo=Mi*c(Li),Yn;if(Zah?zn>h?(ua=w(Qn,jo,ao,ho,gi,zn,oa),Ea=w(Fo,uo,Jn,lo,gi,zn,oa),qt.moveTo(ua.cx+ua.x01,ua.cy+ua.y01),znh)||!(pn>h)?qt.lineTo(Jn,lo):Kn>h?(ua=w(Jn,lo,Fo,uo,Mi,-Kn,oa),Ea=w(ao,ho,Qn,jo,Mi,-Kn,oa),qt.lineTo(ua.cx+ua.x01,ua.cy+ua.y01),Kn=gi;--ba)qt.point(_n[ba],Li[ba]);qt.lineEnd(),qt.areaEnd()}oa&&(_n[Mi]=+ze(Za,Mi,Pr),Li[Mi]=+ct(Za,Mi,Pr),qt.point(tt?+tt(Za,Mi,Pr):_n[Mi],wt?+wt(Za,Mi,Pr):Li[Mi]))}if(Cn)return qt=null,Cn+""||null}function Br(){return F().defined(Nt).curve(Zt).context(It)}return vr.x=function(Pr){return arguments.length?(ze=typeof Pr=="function"?Pr:a(+Pr),tt=null,vr):ze},vr.x0=function(Pr){return arguments.length?(ze=typeof Pr=="function"?Pr:a(+Pr),vr):ze},vr.x1=function(Pr){return arguments.length?(tt=Pr==null?null:typeof Pr=="function"?Pr:a(+Pr),vr):tt},vr.y=function(Pr){return arguments.length?(ct=typeof Pr=="function"?Pr:a(+Pr),wt=null,vr):ct},vr.y0=function(Pr){return arguments.length?(ct=typeof Pr=="function"?Pr:a(+Pr),vr):ct},vr.y1=function(Pr){return arguments.length?(wt=Pr==null?null:typeof Pr=="function"?Pr:a(+Pr),vr):wt},vr.lineX0=vr.lineY0=function(){return Br().x(ze).y(ct)},vr.lineY1=function(){return Br().x(ze).y(wt)},vr.lineX1=function(){return Br().x(tt).y(ct)},vr.defined=function(Pr){return arguments.length?(Nt=typeof Pr=="function"?Pr:a(!!Pr),vr):Nt},vr.curve=function(Pr){return arguments.length?(Zt=Pr,It!=null&&(qt=Zt(It)),vr):Zt},vr.context=function(Pr){return arguments.length?(Pr==null?It=qt=null:qt=Zt(It=Pr),vr):It},vr}function R(ze,tt){return ttze?1:tt>=ze?0:NaN}function P(ze){return ze}function z(){var ze=P,tt=R,ct=null,wt=a(0),Nt=a(g),It=a(0);function Zt(qt){var vr,Br=qt.length,Pr,Mi,gi=0,ba=new Array(Br),Hi=new Array(Br),Za=+wt.apply(this,arguments),oa=Math.min(g,Math.max(-g,Nt.apply(this,arguments)-Za)),Cn,_n=Math.min(Math.abs(oa)/Br,It.apply(this,arguments)),Li=_n*(oa<0?-1:1),In;for(vr=0;vr0&&(gi+=In);for(tt!=null?ba.sort(function(pn,Ka){return tt(Hi[pn],Hi[Ka])}):ct!=null&&ba.sort(function(pn,Ka){return ct(qt[pn],qt[Ka])}),vr=0,Mi=gi?(oa-Br*Li)/gi:0;vr0?In*Mi:0)+Li,Hi[Pr]={data:qt[Pr],index:vr,value:In,startAngle:Za,endAngle:Cn,padAngle:_n};return Hi}return Zt.value=function(qt){return arguments.length?(ze=typeof qt=="function"?qt:a(+qt),Zt):ze},Zt.sortValues=function(qt){return arguments.length?(tt=qt,ct=null,Zt):tt},Zt.sort=function(qt){return arguments.length?(ct=qt,tt=null,Zt):ct},Zt.startAngle=function(qt){return arguments.length?(wt=typeof qt=="function"?qt:a(+qt),Zt):wt},Zt.endAngle=function(qt){return arguments.length?(Nt=typeof qt=="function"?qt:a(+qt),Zt):Nt},Zt.padAngle=function(qt){return arguments.length?(It=typeof qt=="function"?qt:a(+qt),Zt):It},Zt}var I=B(b);function L(ze){this._curve=ze}L.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(ze,tt){this._curve.point(tt*Math.sin(ze),tt*-Math.cos(ze))}};function B(ze){function tt(ct){return new L(ze(ct))}return tt._curve=ze,tt}function O(ze){var tt=ze.curve;return ze.angle=ze.x,delete ze.x,ze.radius=ze.y,delete ze.y,ze.curve=function(ct){return arguments.length?tt(B(ct)):tt()._curve},ze}function G(){return O(F().curve(I))}function W(){var ze=D().curve(I),tt=ze.curve,ct=ze.lineX0,wt=ze.lineX1,Nt=ze.lineY0,It=ze.lineY1;return ze.angle=ze.x,delete ze.x,ze.startAngle=ze.x0,delete ze.x0,ze.endAngle=ze.x1,delete ze.x1,ze.radius=ze.y,delete ze.y,ze.innerRadius=ze.y0,delete ze.y0,ze.outerRadius=ze.y1,delete ze.y1,ze.lineStartAngle=function(){return O(ct())},delete ze.lineX0,ze.lineEndAngle=function(){return O(wt())},delete ze.lineX1,ze.lineInnerRadius=function(){return O(Nt())},delete ze.lineY0,ze.lineOuterRadius=function(){return O(It())},delete ze.lineY1,ze.curve=function(Zt){return arguments.length?tt(B(Zt)):tt()._curve},ze}function X(ze,tt){return[(tt=+tt)*Math.cos(ze-=Math.PI/2),tt*Math.sin(ze)]}var Z=Array.prototype.slice;function J(ze){return ze.source}function N(ze){return ze.target}function H(ze){var tt=J,ct=N,wt=E,Nt=T,It=null;function Zt(){var qt,vr=Z.call(arguments),Br=tt.apply(this,vr),Pr=ct.apply(this,vr);if(It||(It=qt=i.path()),ze(It,+wt.apply(this,(vr[0]=Br,vr)),+Nt.apply(this,vr),+wt.apply(this,(vr[0]=Pr,vr)),+Nt.apply(this,vr)),qt)return It=null,qt+""||null}return Zt.source=function(qt){return arguments.length?(tt=qt,Zt):tt},Zt.target=function(qt){return arguments.length?(ct=qt,Zt):ct},Zt.x=function(qt){return arguments.length?(wt=typeof qt=="function"?qt:a(+qt),Zt):wt},Zt.y=function(qt){return arguments.length?(Nt=typeof qt=="function"?qt:a(+qt),Zt):Nt},Zt.context=function(qt){return arguments.length?(It=qt??null,Zt):It},Zt}function $(ze,tt,ct,wt,Nt){ze.moveTo(tt,ct),ze.bezierCurveTo(tt=(tt+wt)/2,ct,tt,Nt,wt,Nt)}function U(ze,tt,ct,wt,Nt){ze.moveTo(tt,ct),ze.bezierCurveTo(tt,ct=(ct+Nt)/2,wt,ct,wt,Nt)}function V(ze,tt,ct,wt,Nt){var It=X(tt,ct),Zt=X(tt,ct=(ct+Nt)/2),qt=X(wt,ct),vr=X(wt,Nt);ze.moveTo(It[0],It[1]),ze.bezierCurveTo(Zt[0],Zt[1],qt[0],qt[1],vr[0],vr[1])}function j(){return H($)}function q(){return H(U)}function Y(){var ze=H(V);return ze.angle=ze.x,delete ze.x,ze.radius=ze.y,delete ze.y,ze}var K={draw:function(ze,tt){var ct=Math.sqrt(tt/d);ze.moveTo(ct,0),ze.arc(0,0,ct,0,g)}},te={draw:function(ze,tt){var ct=Math.sqrt(tt/5)/2;ze.moveTo(-3*ct,-ct),ze.lineTo(-ct,-ct),ze.lineTo(-ct,-3*ct),ze.lineTo(ct,-3*ct),ze.lineTo(ct,-ct),ze.lineTo(3*ct,-ct),ze.lineTo(3*ct,ct),ze.lineTo(ct,ct),ze.lineTo(ct,3*ct),ze.lineTo(-ct,3*ct),ze.lineTo(-ct,ct),ze.lineTo(-3*ct,ct),ze.closePath()}},ne=Math.sqrt(1/3),se=ne*2,le={draw:function(ze,tt){var ct=Math.sqrt(tt/se),wt=ct*ne;ze.moveTo(0,-ct),ze.lineTo(wt,0),ze.lineTo(0,ct),ze.lineTo(-wt,0),ze.closePath()}},ce=.8908130915292852,pe=Math.sin(d/10)/Math.sin(7*d/10),xe=Math.sin(g/10)*pe,ye=-Math.cos(g/10)*pe,fe={draw:function(ze,tt){var ct=Math.sqrt(tt*ce),wt=xe*ct,Nt=ye*ct;ze.moveTo(0,-ct),ze.lineTo(wt,Nt);for(var It=1;It<5;++It){var Zt=g*It/5,qt=Math.cos(Zt),vr=Math.sin(Zt);ze.lineTo(vr*ct,-qt*ct),ze.lineTo(qt*wt-vr*Nt,vr*wt+qt*Nt)}ze.closePath()}},ae={draw:function(ze,tt){var ct=Math.sqrt(tt),wt=-ct/2;ze.rect(wt,wt,ct,ct)}},ee=Math.sqrt(3),ie={draw:function(ze,tt){var ct=-Math.sqrt(tt/(ee*3));ze.moveTo(0,ct*2),ze.lineTo(-ee*ct,-ct),ze.lineTo(ee*ct,-ct),ze.closePath()}},Q=-.5,ue=Math.sqrt(3)/2,ge=1/Math.sqrt(12),Me=(ge/2+1)*3,Te={draw:function(ze,tt){var ct=Math.sqrt(tt/Me),wt=ct/2,Nt=ct*ge,It=wt,Zt=ct*ge+ct,qt=-It,vr=Zt;ze.moveTo(wt,Nt),ze.lineTo(It,Zt),ze.lineTo(qt,vr),ze.lineTo(Q*wt-ue*Nt,ue*wt+Q*Nt),ze.lineTo(Q*It-ue*Zt,ue*It+Q*Zt),ze.lineTo(Q*qt-ue*vr,ue*qt+Q*vr),ze.lineTo(Q*wt+ue*Nt,Q*Nt-ue*wt),ze.lineTo(Q*It+ue*Zt,Q*Zt-ue*It),ze.lineTo(Q*qt+ue*vr,Q*vr-ue*qt),ze.closePath()}},je=[K,te,le,ae,fe,ie,Te];function Ve(){var ze=a(K),tt=a(64),ct=null;function wt(){var Nt;if(ct||(ct=Nt=i.path()),ze.apply(this,arguments).draw(ct,+tt.apply(this,arguments)),Nt)return ct=null,Nt+""||null}return wt.type=function(Nt){return arguments.length?(ze=typeof Nt=="function"?Nt:a(Nt),wt):ze},wt.size=function(Nt){return arguments.length?(tt=typeof Nt=="function"?Nt:a(+Nt),wt):tt},wt.context=function(Nt){return arguments.length?(ct=Nt??null,wt):ct},wt}function Ze(){}function Ke(ze,tt,ct){ze._context.bezierCurveTo((2*ze._x0+ze._x1)/3,(2*ze._y0+ze._y1)/3,(ze._x0+2*ze._x1)/3,(ze._y0+2*ze._y1)/3,(ze._x0+4*ze._x1+tt)/6,(ze._y0+4*ze._y1+ct)/6)}function vt(ze){this._context=ze}vt.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:Ke(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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);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:Ke(this,ze,tt);break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt}};function xt(ze){return new vt(ze)}function Pt(ze){this._context=ze}Pt.prototype={areaStart:Ze,areaEnd:Ze,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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._x2=ze,this._y2=tt;break;case 1:this._point=2,this._x3=ze,this._y3=tt;break;case 2:this._point=3,this._x4=ze,this._y4=tt,this._context.moveTo((this._x0+4*this._x1+ze)/6,(this._y0+4*this._y1+tt)/6);break;default:Ke(this,ze,tt);break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt}};function mt(ze){return new Pt(ze)}function Mt(ze){this._context=ze}Mt.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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var ct=(this._x0+4*this._x1+ze)/6,wt=(this._y0+4*this._y1+tt)/6;this._line?this._context.lineTo(ct,wt):this._context.moveTo(ct,wt);break;case 3:this._point=4;default:Ke(this,ze,tt);break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt}};function lt(ze){return new Mt(ze)}function qe(ze,tt){this._basis=new vt(ze),this._beta=tt}qe.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var ze=this._x,tt=this._y,ct=ze.length-1;if(ct>0)for(var wt=ze[0],Nt=tt[0],It=ze[ct]-wt,Zt=tt[ct]-Nt,qt=-1,vr;++qt<=ct;)vr=qt/ct,this._basis.point(this._beta*ze[qt]+(1-this._beta)*(wt+vr*It),this._beta*tt[qt]+(1-this._beta)*(Nt+vr*Zt));this._x=this._y=null,this._basis.lineEnd()},point:function(ze,tt){this._x.push(+ze),this._y.push(+tt)}};var Ye=(function ze(tt){function ct(wt){return tt===1?new vt(wt):new qe(wt,tt)}return ct.beta=function(wt){return ze(+wt)},ct})(.85);function me(ze,tt,ct){ze._context.bezierCurveTo(ze._x1+ze._k*(ze._x2-ze._x0),ze._y1+ze._k*(ze._y2-ze._y0),ze._x2+ze._k*(ze._x1-tt),ze._y2+ze._k*(ze._y1-ct),ze._x2,ze._y2)}function _e(ze,tt){this._context=ze,this._k=(1-tt)/6}_e.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:me(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2,this._x1=ze,this._y1=tt;break;case 2:this._point=3;default:me(this,ze,tt);break}this._x0=this._x1,this._x1=this._x2,this._x2=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Ae=(function ze(tt){function ct(wt){return new _e(wt,tt)}return ct.tension=function(wt){return ze(+wt)},ct})(0);function ke(ze,tt){this._context=ze,this._k=(1-tt)/6}ke.prototype={areaStart:Ze,areaEnd:Ze,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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._x3=ze,this._y3=tt;break;case 1:this._point=2,this._context.moveTo(this._x4=ze,this._y4=tt);break;case 2:this._point=3,this._x5=ze,this._y5=tt;break;default:me(this,ze,tt);break}this._x0=this._x1,this._x1=this._x2,this._x2=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Ee=(function ze(tt){function ct(wt){return new ke(wt,tt)}return ct.tension=function(wt){return ze(+wt)},ct})(0);function De(ze,tt){this._context=ze,this._k=(1-tt)/6}De.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(ze,tt){switch(ze=+ze,tt=+tt,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:me(this,ze,tt);break}this._x0=this._x1,this._x1=this._x2,this._x2=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Je=(function ze(tt){function ct(wt){return new De(wt,tt)}return ct.tension=function(wt){return ze(+wt)},ct})(0);function Ue(ze,tt,ct){var wt=ze._x1,Nt=ze._y1,It=ze._x2,Zt=ze._y2;if(ze._l01_a>h){var qt=2*ze._l01_2a+3*ze._l01_a*ze._l12_a+ze._l12_2a,vr=3*ze._l01_a*(ze._l01_a+ze._l12_a);wt=(wt*qt-ze._x0*ze._l12_2a+ze._x2*ze._l01_2a)/vr,Nt=(Nt*qt-ze._y0*ze._l12_2a+ze._y2*ze._l01_2a)/vr}if(ze._l23_a>h){var Br=2*ze._l23_2a+3*ze._l23_a*ze._l12_a+ze._l12_2a,Pr=3*ze._l23_a*(ze._l23_a+ze._l12_a);It=(It*Br+ze._x1*ze._l23_2a-tt*ze._l12_2a)/Pr,Zt=(Zt*Br+ze._y1*ze._l23_2a-ct*ze._l12_2a)/Pr}ze._context.bezierCurveTo(wt,Nt,It,Zt,ze._x2,ze._y2)}function at(ze,tt){this._context=ze,this._alpha=tt}at.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(ze,tt){if(ze=+ze,tt=+tt,this._point){var ct=this._x2-ze,wt=this._y2-tt;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(ct*ct+wt*wt,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2;break;case 2:this._point=3;default:Ue(this,ze,tt);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=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var rt=(function ze(tt){function ct(wt){return tt?new at(wt,tt):new _e(wt,0)}return ct.alpha=function(wt){return ze(+wt)},ct})(.5);function ft(ze,tt){this._context=ze,this._alpha=tt}ft.prototype={areaStart:Ze,areaEnd:Ze,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(ze,tt){if(ze=+ze,tt=+tt,this._point){var ct=this._x2-ze,wt=this._y2-tt;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(ct*ct+wt*wt,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=ze,this._y3=tt;break;case 1:this._point=2,this._context.moveTo(this._x4=ze,this._y4=tt);break;case 2:this._point=3,this._x5=ze,this._y5=tt;break;default:Ue(this,ze,tt);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=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var At=(function ze(tt){function ct(wt){return tt?new ft(wt,tt):new ke(wt,0)}return ct.alpha=function(wt){return ze(+wt)},ct})(.5);function ht(ze,tt){this._context=ze,this._alpha=tt}ht.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(ze,tt){if(ze=+ze,tt=+tt,this._point){var ct=this._x2-ze,wt=this._y2-tt;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(ct*ct+wt*wt,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:Ue(this,ze,tt);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=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Gt=(function ze(tt){function ct(wt){return tt?new ht(wt,tt):new De(wt,0)}return ct.alpha=function(wt){return ze(+wt)},ct})(.5);function fr(ze){this._context=ze}fr.prototype={areaStart:Ze,areaEnd:Ze,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(ze,tt){ze=+ze,tt=+tt,this._point?this._context.lineTo(ze,tt):(this._point=1,this._context.moveTo(ze,tt))}};function gt(ze){return new fr(ze)}function yt(ze){return ze<0?-1:1}function kt(ze,tt,ct){var wt=ze._x1-ze._x0,Nt=tt-ze._x1,It=(ze._y1-ze._y0)/(wt||Nt<0&&-0),Zt=(ct-ze._y1)/(Nt||wt<0&&-0),qt=(It*Nt+Zt*wt)/(wt+Nt);return(yt(It)+yt(Zt))*Math.min(Math.abs(It),Math.abs(Zt),.5*Math.abs(qt))||0}function Lt(ze,tt){var ct=ze._x1-ze._x0;return ct?(3*(ze._y1-ze._y0)/ct-tt)/2:tt}function Ct(ze,tt,ct){var wt=ze._x0,Nt=ze._y0,It=ze._x1,Zt=ze._y1,qt=(It-wt)/3;ze._context.bezierCurveTo(wt+qt,Nt+qt*tt,It-qt,Zt-qt*ct,It,Zt)}function $t(ze){this._context=ze}$t.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:Ct(this,this._t0,Lt(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(ze,tt){var ct=NaN;if(ze=+ze,tt=+tt,!(ze===this._x1&&tt===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2;break;case 2:this._point=3,Ct(this,Lt(this,ct=kt(this,ze,tt)),ct);break;default:Ct(this,this._t0,ct=kt(this,ze,tt));break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt,this._t0=ct}}};function mr(ze){this._context=new br(ze)}(mr.prototype=Object.create($t.prototype)).point=function(ze,tt){$t.prototype.point.call(this,tt,ze)};function br(ze){this._context=ze}br.prototype={moveTo:function(ze,tt){this._context.moveTo(tt,ze)},closePath:function(){this._context.closePath()},lineTo:function(ze,tt){this._context.lineTo(tt,ze)},bezierCurveTo:function(ze,tt,ct,wt,Nt,It){this._context.bezierCurveTo(tt,ze,wt,ct,It,Nt)}};function Er(ze){return new $t(ze)}function Tr(ze){return new mr(ze)}function Ur(ze){this._context=ze}Ur.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var ze=this._x,tt=this._y,ct=ze.length;if(ct)if(this._line?this._context.lineTo(ze[0],tt[0]):this._context.moveTo(ze[0],tt[0]),ct===2)this._context.lineTo(ze[1],tt[1]);else for(var wt=Ai(ze),Nt=Ai(tt),It=0,Zt=1;Zt=0;--tt)Nt[tt]=(Zt[tt]-Nt[tt+1])/It[tt];for(It[ct-1]=(ze[ct]+Nt[ct-1])/2,tt=0;tt=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,tt),this._context.lineTo(ze,tt);else{var ct=this._x*(1-this._t)+ze*this._t;this._context.lineTo(ct,this._y),this._context.lineTo(ct,tt)}break}}this._x=ze,this._y=tt}};function ea(ze){return new Qr(ze,.5)}function $i(ze){return new Qr(ze,0)}function ja(ze){return new Qr(ze,1)}function ya(ze,tt){if((Zt=ze.length)>1)for(var ct=1,wt,Nt,It=ze[tt[0]],Zt,qt=It.length;ct=0;)ct[tt]=tt;return ct}function xi(ze,tt){return ze[tt]}function bi(){var ze=a([]),tt=pa,ct=ya,wt=xi;function Nt(It){var Zt=ze.apply(this,arguments),qt,vr=It.length,Br=Zt.length,Pr=new Array(Br),Mi;for(qt=0;qt0){for(var ct,wt,Nt=0,It=ze[0].length,Zt;Nt0)for(var ct,wt=0,Nt,It,Zt,qt,vr,Br=ze[tt[0]].length;wt0?(Nt[0]=Zt,Nt[1]=Zt+=It):It<0?(Nt[1]=qt,Nt[0]=qt+=It):(Nt[0]=0,Nt[1]=It)}function pi(ze,tt){if((Nt=ze.length)>0){for(var ct=0,wt=ze[tt[0]],Nt,It=wt.length;ct0)||!((It=(Nt=ze[tt[0]]).length)>0))){for(var ct=0,wt=1,Nt,It,Zt;wtIt&&(It=Nt,ct=tt);return ct}function Et(ze){var tt=ze.map(St);return pa(ze).sort(function(ct,wt){return tt[ct]-tt[wt]})}function St(ze){for(var tt=0,ct=-1,wt=ze.length,Nt;++ct[D(xe,ye,le),xe]));for(let[xe,ye]of ce.entries()){ye.index=xe;let{source:fe,target:ae}=ye;typeof fe!="object"&&(fe=ye.source=_(pe,fe)),typeof ae!="object"&&(ae=ye.target=_(pe,ae)),fe.sourceLinks.push(ye),ae.targetLinks.push(ye)}if(z!=null)for(let{sourceLinks:xe,targetLinks:ye}of le)xe.sort(z),ye.sort(z)}function X({nodes:le}){for(let ce of le)ce.value=ce.fixedValue===void 0?Math.max(i.sum(ce.sourceLinks,p),i.sum(ce.targetLinks,p)):ce.fixedValue}function Z({nodes:le}){let ce=le.length,pe=new Set(le),xe=new Set,ye=0;for(;pe.size;){for(let fe of pe){fe.depth=ye;for(let{target:ae}of fe.sourceLinks)xe.add(ae)}if(++ye>ce)throw new Error("circular link");pe=xe,xe=new Set}}function J({nodes:le}){let ce=le.length,pe=new Set(le),xe=new Set,ye=0;for(;pe.size;){for(let fe of pe){fe.height=ye;for(let{source:ae}of fe.targetLinks)xe.add(ae)}if(++ye>ce)throw new Error("circular link");pe=xe,xe=new Set}}function N({nodes:le}){let ce=i.max(le,ye=>ye.depth)+1,pe=(A-w-E)/(ce-1),xe=new Array(ce);for(let ye of le){let fe=Math.max(0,Math.min(ce-1,Math.floor(R.call(null,ye,ce))));ye.layer=fe,ye.x0=w+fe*pe,ye.x1=ye.x0+E,xe[fe]?xe[fe].push(ye):xe[fe]=[ye]}if(P)for(let ye of xe)ye.sort(P);return xe}function H(le){let ce=i.min(le,pe=>(b-k-(pe.length-1)*F)/i.sum(pe,p));for(let pe of le){let xe=k;for(let ye of pe){ye.y0=xe,ye.y1=xe+ye.value*ce,xe=ye.y1+F;for(let fe of ye.sourceLinks)fe.width=fe.value*ce}xe=(b-xe+F)/(pe.length+1);for(let ye=0;yepe.length)-1)),H(ce);for(let pe=0;pe0))continue;let Q=(ee/ie-ae.y0)*ce;ae.y0+=Q,ae.y1+=Q,K(ae)}P===void 0&&fe.sort(d),j(fe,pe)}}function V(le,ce,pe){for(let xe=le.length,ye=xe-2;ye>=0;--ye){let fe=le[ye];for(let ae of fe){let ee=0,ie=0;for(let{target:ue,value:ge}of ae.sourceLinks){let Me=ge*(ue.layer-ae.layer);ee+=se(ae,ue)*Me,ie+=Me}if(!(ie>0))continue;let Q=(ee/ie-ae.y0)*ce;ae.y0+=Q,ae.y1+=Q,K(ae)}P===void 0&&fe.sort(d),j(fe,pe)}}function j(le,ce){let pe=le.length>>1,xe=le[pe];Y(le,xe.y0-F,pe-1,ce),q(le,xe.y1+F,pe+1,ce),Y(le,b,le.length-1,ce),q(le,k,0,ce)}function q(le,ce,pe,xe){for(;pe1e-6&&(ye.y0+=fe,ye.y1+=fe),ce=ye.y1+F}}function Y(le,ce,pe,xe){for(;pe>=0;--pe){let ye=le[pe],fe=(ye.y1-ce)*xe;fe>1e-6&&(ye.y0-=fe,ye.y1-=fe),ce=ye.y0-F}}function K({sourceLinks:le,targetLinks:ce}){if(z===void 0){for(let{source:{sourceLinks:pe}}of ce)pe.sort(h);for(let{target:{targetLinks:pe}}of le)pe.sort(f)}}function te(le){if(z===void 0)for(let{sourceLinks:ce,targetLinks:pe}of le)ce.sort(h),pe.sort(f)}function ne(le,ce){let pe=le.y0-(le.sourceLinks.length-1)*F/2;for(let{target:xe,width:ye}of le.sourceLinks){if(xe===ce)break;pe+=ye+F}for(let{source:xe,width:ye}of ce.targetLinks){if(xe===le)break;pe-=ye}return pe}function se(le,ce){let pe=ce.y0-(ce.targetLinks.length-1)*F/2;for(let{source:xe,width:ye}of ce.targetLinks){if(xe===le)break;pe+=ye+F}for(let{target:xe,width:ye}of le.sourceLinks){if(xe===ce)break;pe-=ye}return pe}return G}function S(w){return[w.source.x1,w.y0]}function M(w){return[w.target.x0,w.y1]}function C(){return a.linkHorizontal().source(S).target(M)}t.sankey=x,t.sankeyCenter=u,t.sankeyJustify=n,t.sankeyLeft=s,t.sankeyLinkHorizontal=C,t.sankeyRight=l,Object.defineProperty(t,"__esModule",{value:!0})})}}),vle=de({"node_modules/@plotly/d3-sankey-circular/node_modules/d3-array/dist/d3-array.js"(e,r){(function(t,i){i(typeof e=="object"&&typeof r<"u"?e:t.d3=t.d3||{})})(e,(function(t){"use strict";function i($,U){return $U?1:$>=U?0:NaN}function a($){return $.length===1&&($=o($)),{left:function(U,V,j,q){for(j==null&&(j=0),q==null&&(q=U.length);j>>1;$(U[Y],V)<0?j=Y+1:q=Y}return j},right:function(U,V,j,q){for(j==null&&(j=0),q==null&&(q=U.length);j>>1;$(U[Y],V)>0?q=Y:j=Y+1}return j}}}function o($){return function(U,V){return i($(U),V)}}var s=a(i),l=s.right,n=s.left;function u($,U){U==null&&(U=c);for(var V=0,j=$.length-1,q=$[0],Y=new Array(j<0?0:j);V$?1:U>=$?0:NaN}function d($){return $===null?NaN:+$}function p($,U){var V=$.length,j=0,q=-1,Y=0,K,te,ne=0;if(U==null)for(;++q1)return ne/(j-1)}function g($,U){var V=p($,U);return V&&Math.sqrt(V)}function m($,U){var V=$.length,j=-1,q,Y,K;if(U==null){for(;++j=q)for(Y=K=q;++jq&&(Y=q),K=q)for(Y=K=q;++jq&&(Y=q),K0)return[$];if((j=U<$)&&(Y=$,$=U,U=Y),(te=b($,U,V))===0||!isFinite(te))return[];if(te>0)for($=Math.ceil($/te),U=Math.floor(U/te),K=new Array(Y=Math.ceil(U-$+1));++q=0?(Y>=C?10:Y>=w?5:Y>=k?2:1)*Math.pow(10,q):-Math.pow(10,-q)/(Y>=C?10:Y>=w?5:Y>=k?2:1)}function E($,U,V){var j=Math.abs(U-$)/Math.max(0,V),q=Math.pow(10,Math.floor(Math.log(j)/Math.LN10)),Y=j/q;return Y>=C?q*=10:Y>=w?q*=5:Y>=k&&(q*=2),U<$?-q:q}function T($){return Math.ceil(Math.log($.length)/Math.LN2)+1}function F(){var $=S,U=m,V=T;function j(q){var Y,K=q.length,te,ne=new Array(K);for(Y=0;Yce;)pe.pop(),--xe;var ye=new Array(xe+1),fe;for(Y=0;Y<=xe;++Y)fe=ye[Y]=[],fe.x0=Y>0?pe[Y-1]:le,fe.x1=Y=1)return+V($[j-1],j-1,$);var j,q=(j-1)*U,Y=Math.floor(q),K=+V($[Y],Y,$),te=+V($[Y+1],Y+1,$);return K+(te-K)*(q-Y)}}function R($,U,V){return $=v.call($,d).sort(i),Math.ceil((V-U)/(2*(D($,.75)-D($,.25))*Math.pow($.length,-1/3)))}function P($,U,V){return Math.ceil((V-U)/(3.5*g($)*Math.pow($.length,-1/3)))}function z($,U){var V=$.length,j=-1,q,Y;if(U==null){for(;++j=q)for(Y=q;++jY&&(Y=q)}else for(;++j=q)for(Y=q;++jY&&(Y=q);return Y}function I($,U){var V=$.length,j=V,q=-1,Y,K=0;if(U==null)for(;++q=0;)for(K=$[U],V=K.length;--V>=0;)Y[--q]=K[V];return Y}function O($,U){var V=$.length,j=-1,q,Y;if(U==null){for(;++j=q)for(Y=q;++jq&&(Y=q)}else for(;++j=q)for(Y=q;++jq&&(Y=q);return Y}function G($,U){for(var V=U.length,j=new Array(V);V--;)j[V]=$[U[V]];return j}function W($,U){if(V=$.length){var V,j=0,q=0,Y,K=$[q];for(U==null&&(U=i);++j=M})}function m(M){g(M);for(var C=a,w=t(C),k=w.components.filter(function(R){return R.length>1}),A=1/0,b,E=0;E"u"?"undefined":d(_e))!=="object"&&(_e=Ye.source=w(qe,_e)),(typeof Ae>"u"?"undefined":d(Ae))!=="object"&&(Ae=Ye.target=w(qe,Ae)),_e.sourceLinks.push(Ye),Ae.targetLinks.push(Ye)}),lt}function Ke(lt){lt.nodes.forEach(function(qe){qe.partOfCycle=!1,qe.value=Math.max(i.sum(qe.sourceLinks,y),i.sum(qe.targetLinks,y)),qe.sourceLinks.forEach(function(Ye){Ye.circular&&(qe.partOfCycle=!0,qe.circularLinkType=Ye.circularLinkType)}),qe.targetLinks.forEach(function(Ye){Ye.circular&&(qe.partOfCycle=!0,qe.circularLinkType=Ye.circularLinkType)})})}function vt(lt){var qe=0,Ye=0,me=0,_e=0,Ae=i.max(lt.nodes,function(ke){return ke.column});return lt.links.forEach(function(ke){ke.circular&&(ke.circularLinkType=="top"?qe=qe+ke.width:Ye=Ye+ke.width,ke.target.column==0&&(_e=_e+ke.width),ke.source.column==Ae&&(me=me+ke.width))}),qe=qe>0?qe+A+b:qe,Ye=Ye>0?Ye+A+b:Ye,me=me>0?me+A+b:me,_e=_e>0?_e+A+b:_e,{top:qe,bottom:Ye,left:_e,right:me}}function xt(lt,qe){var Ye=i.max(lt.nodes,function(Je){return Je.column}),me=xe-ce,_e=ye-pe,Ae=me+qe.right+qe.left,ke=_e+qe.top+qe.bottom,Ee=me/Ae,De=_e/ke;return ce=ce*Ee+qe.left,xe=qe.right==0?xe:xe*Ee,pe=pe*De+qe.top,ye=ye*De,lt.nodes.forEach(function(Je){Je.x0=ce+Je.column*((xe-ce-fe)/Ye),Je.x1=Je.x0+fe}),De}function Pt(lt){var qe,Ye,me;for(qe=lt.nodes,Ye=[],me=0;qe.length;++me,qe=Ye,Ye=[])qe.forEach(function(_e){_e.depth=me,_e.sourceLinks.forEach(function(Ae){Ye.indexOf(Ae.target)<0&&!Ae.circular&&Ye.push(Ae.target)})});for(qe=lt.nodes,Ye=[],me=0;qe.length;++me,qe=Ye,Ye=[])qe.forEach(function(_e){_e.height=me,_e.targetLinks.forEach(function(Ae){Ye.indexOf(Ae.source)<0&&!Ae.circular&&Ye.push(Ae.source)})});lt.nodes.forEach(function(_e){_e.column=Math.floor(ie.call(null,_e,me))})}function mt(lt,qe,Ye){var me=a.nest().key(function(Je){return Je.column}).sortKeys(i.ascending).entries(lt.nodes).map(function(Je){return Je.values});ke(Ye),De();for(var _e=1,Ae=qe;Ae>0;--Ae)Ee(_e*=.99,Ye),De();function ke(Je){if(Te){var Ue=1/0;me.forEach(function(At){var ht=ye*Te/(At.length+1);Ue=ht0))if(At==0&&ft==1)Gt=ht.y1-ht.y0,ht.y0=ye/2-Gt/2,ht.y1=ye/2+Gt/2;else if(At==at-1&&ft==1)Gt=ht.y1-ht.y0,ht.y0=ye/2-Gt/2,ht.y1=ye/2+Gt/2;else{var fr=0,gt=i.mean(ht.sourceLinks,x),yt=i.mean(ht.targetLinks,v);gt&&yt?fr=(gt+yt)/2:fr=gt||yt;var kt=(fr-_(ht))*Je;ht.y0+=kt,ht.y1+=kt}})})}function De(){me.forEach(function(Je){var Ue,at,rt=pe,ft=Je.length,At;for(Je.sort(m),At=0;At0&&(Ue.y0+=at,Ue.y1+=at),rt=Ue.y1+ae;if(at=rt-ae-ye,at>0)for(rt=Ue.y0-=at,Ue.y1-=at,At=ft-2;At>=0;--At)Ue=Je[At],at=Ue.y1+ae-rt,at>0&&(Ue.y0-=at,Ue.y1-=at),rt=Ue.y0})}}function Mt(lt){lt.nodes.forEach(function(qe){qe.sourceLinks.sort(g),qe.targetLinks.sort(p)}),lt.nodes.forEach(function(qe){var Ye=qe.y0,me=Ye,_e=qe.y1,Ae=_e;qe.sourceLinks.forEach(function(ke){ke.circular?(ke.y0=_e-ke.width/2,_e=_e-ke.width):(ke.y0=Ye+ke.width/2,Ye+=ke.width)}),qe.targetLinks.forEach(function(ke){ke.circular?(ke.y1=Ae-ke.width/2,Ae=Ae-ke.width):(ke.y1=me+ke.width/2,me+=ke.width)})})}return Ve}function F(ce,pe,xe){var ye=0;if(xe===null){for(var fe=[],ae=0;aepe.source.column)}function z(ce,pe){var xe=0;ce.sourceLinks.forEach(function(fe){xe=fe.circular&&!se(fe,pe)?xe+1:xe});var ye=0;return ce.targetLinks.forEach(function(fe){ye=fe.circular&&!se(fe,pe)?ye+1:ye}),xe+ye}function I(ce){var pe=ce.source.sourceLinks,xe=0;pe.forEach(function(ae){xe=ae.circular?xe+1:xe});var ye=ce.target.targetLinks,fe=0;return ye.forEach(function(ae){fe=ae.circular?fe+1:fe}),!(xe>1||fe>1)}function L(ce,pe,xe){return ce.sort(G),ce.forEach(function(ye,fe){var ae=0;if(se(ye,xe)&&I(ye))ye.circularPathData.verticalBuffer=ae+ye.width/2;else{var ee=0;for(ee;eeae?ie:ae}ye.circularPathData.verticalBuffer=ae+ye.width/2}}),ce}function B(ce,pe,xe,ye){var fe=5,ae=i.min(ce.links,function(Q){return Q.source.y0});ce.links.forEach(function(Q){Q.circular&&(Q.circularPathData={})});var ee=ce.links.filter(function(Q){return Q.circularLinkType=="top"});L(ee,pe,ye);var ie=ce.links.filter(function(Q){return Q.circularLinkType=="bottom"});L(ie,pe,ye),ce.links.forEach(function(Q){if(Q.circular){if(Q.circularPathData.arcRadius=Q.width+b,Q.circularPathData.leftNodeBuffer=fe,Q.circularPathData.rightNodeBuffer=fe,Q.circularPathData.sourceWidth=Q.source.x1-Q.source.x0,Q.circularPathData.sourceX=Q.source.x0+Q.circularPathData.sourceWidth,Q.circularPathData.targetX=Q.target.x0,Q.circularPathData.sourceY=Q.y0,Q.circularPathData.targetY=Q.y1,se(Q,ye)&&I(Q))Q.circularPathData.leftSmallArcRadius=b+Q.width/2,Q.circularPathData.leftLargeArcRadius=b+Q.width/2,Q.circularPathData.rightSmallArcRadius=b+Q.width/2,Q.circularPathData.rightLargeArcRadius=b+Q.width/2,Q.circularLinkType=="bottom"?(Q.circularPathData.verticalFullExtent=Q.source.y1+A+Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.rightLargeArcRadius):(Q.circularPathData.verticalFullExtent=Q.source.y0-A-Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.rightLargeArcRadius);else{var ue=Q.source.column,ge=Q.circularLinkType,Me=ce.links.filter(function(Ve){return Ve.source.column==ue&&Ve.circularLinkType==ge});Q.circularLinkType=="bottom"?Me.sort(X):Me.sort(W);var Te=0;Me.forEach(function(Ve,Ze){Ve.circularLinkID==Q.circularLinkID&&(Q.circularPathData.leftSmallArcRadius=b+Q.width/2+Te,Q.circularPathData.leftLargeArcRadius=b+Q.width/2+Ze*pe+Te),Te=Te+Ve.width}),ue=Q.target.column,Me=ce.links.filter(function(Ve){return Ve.target.column==ue&&Ve.circularLinkType==ge}),Q.circularLinkType=="bottom"?Me.sort(J):Me.sort(Z),Te=0,Me.forEach(function(Ve,Ze){Ve.circularLinkID==Q.circularLinkID&&(Q.circularPathData.rightSmallArcRadius=b+Q.width/2+Te,Q.circularPathData.rightLargeArcRadius=b+Q.width/2+Ze*pe+Te),Te=Te+Ve.width}),Q.circularLinkType=="bottom"?(Q.circularPathData.verticalFullExtent=Math.max(xe,Q.source.y1,Q.target.y1)+A+Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.rightLargeArcRadius):(Q.circularPathData.verticalFullExtent=ae-A-Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.rightLargeArcRadius)}Q.circularPathData.leftInnerExtent=Q.circularPathData.sourceX+Q.circularPathData.leftNodeBuffer,Q.circularPathData.rightInnerExtent=Q.circularPathData.targetX-Q.circularPathData.rightNodeBuffer,Q.circularPathData.leftFullExtent=Q.circularPathData.sourceX+Q.circularPathData.leftLargeArcRadius+Q.circularPathData.leftNodeBuffer,Q.circularPathData.rightFullExtent=Q.circularPathData.targetX-Q.circularPathData.rightLargeArcRadius-Q.circularPathData.rightNodeBuffer}if(Q.circular)Q.path=O(Q);else{var je=o.linkHorizontal().source(function(Ve){var Ze=Ve.source.x0+(Ve.source.x1-Ve.source.x0),Ke=Ve.y0;return[Ze,Ke]}).target(function(Ve){var Ze=Ve.target.x0,Ke=Ve.y1;return[Ze,Ke]});Q.path=je(Q)}})}function O(ce){var pe="";return ce.circularLinkType=="top"?pe="M"+ce.circularPathData.sourceX+" "+ce.circularPathData.sourceY+" L"+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.sourceY+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftSmallArcRadius+" 0 0 0 "+ce.circularPathData.leftFullExtent+" "+(ce.circularPathData.sourceY-ce.circularPathData.leftSmallArcRadius)+" L"+ce.circularPathData.leftFullExtent+" "+ce.circularPathData.verticalLeftInnerExtent+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftLargeArcRadius+" 0 0 0 "+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.verticalFullExtent+" L"+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.verticalFullExtent+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightLargeArcRadius+" 0 0 0 "+ce.circularPathData.rightFullExtent+" "+ce.circularPathData.verticalRightInnerExtent+" L"+ce.circularPathData.rightFullExtent+" "+(ce.circularPathData.targetY-ce.circularPathData.rightSmallArcRadius)+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightSmallArcRadius+" 0 0 0 "+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.targetY+" L"+ce.circularPathData.targetX+" "+ce.circularPathData.targetY:pe="M"+ce.circularPathData.sourceX+" "+ce.circularPathData.sourceY+" L"+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.sourceY+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftSmallArcRadius+" 0 0 1 "+ce.circularPathData.leftFullExtent+" "+(ce.circularPathData.sourceY+ce.circularPathData.leftSmallArcRadius)+" L"+ce.circularPathData.leftFullExtent+" "+ce.circularPathData.verticalLeftInnerExtent+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftLargeArcRadius+" 0 0 1 "+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.verticalFullExtent+" L"+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.verticalFullExtent+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightLargeArcRadius+" 0 0 1 "+ce.circularPathData.rightFullExtent+" "+ce.circularPathData.verticalRightInnerExtent+" L"+ce.circularPathData.rightFullExtent+" "+(ce.circularPathData.targetY+ce.circularPathData.rightSmallArcRadius)+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightSmallArcRadius+" 0 0 1 "+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.targetY+" L"+ce.circularPathData.targetX+" "+ce.circularPathData.targetY,pe}function G(ce,pe){return N(ce)==N(pe)?ce.circularLinkType=="bottom"?X(ce,pe):W(ce,pe):N(pe)-N(ce)}function W(ce,pe){return ce.y0-pe.y0}function X(ce,pe){return pe.y0-ce.y0}function Z(ce,pe){return ce.y1-pe.y1}function J(ce,pe){return pe.y1-ce.y1}function N(ce){return ce.target.column-ce.source.column}function H(ce){return ce.target.x0-ce.source.x1}function $(ce,pe){var xe=R(ce),ye=H(pe)/Math.tan(xe),fe=ne(ce)=="up"?ce.y1+ye:ce.y1-ye;return fe}function U(ce,pe){var xe=R(ce),ye=H(pe)/Math.tan(xe),fe=ne(ce)=="up"?ce.y1-ye:ce.y1+ye;return fe}function V(ce,pe,xe,ye){ce.links.forEach(function(fe){if(!fe.circular&&fe.target.column-fe.source.column>1){var ae=fe.source.column+1,ee=fe.target.column-1,ie=1,Q=ee-ae+1;for(ie=1;ae<=ee;ae++,ie++)ce.nodes.forEach(function(ue){if(ue.column==ae){var ge=ie/(Q+1),Me=Math.pow(1-ge,3),Te=3*ge*Math.pow(1-ge,2),je=3*Math.pow(ge,2)*(1-ge),Ve=Math.pow(ge,3),Ze=Me*fe.y0+Te*fe.y0+je*fe.y1+Ve*fe.y1,Ke=Ze-fe.width/2,vt=Ze+fe.width/2,xt;Ke>ue.y0&&Keue.y0&&vtue.y1&&q(Pt,xt,pe,xe)})):Keue.y1&&(xt=vt-ue.y0+10,ue=q(ue,xt,pe,xe),ce.nodes.forEach(function(Pt){k(Pt,ye)==k(ue,ye)||Pt.column!=ue.column||Pt.y0ue.y1&&q(Pt,xt,pe,xe)}))}})}})}function j(ce,pe){return ce.y0>pe.y0&&ce.y0pe.y0&&ce.y1pe.y1}function q(ce,pe,xe,ye){return ce.y0+pe>=xe&&ce.y1+pe<=ye&&(ce.y0=ce.y0+pe,ce.y1=ce.y1+pe,ce.targetLinks.forEach(function(fe){fe.y1=fe.y1+pe}),ce.sourceLinks.forEach(function(fe){fe.y0=fe.y0+pe})),ce}function Y(ce,pe,xe,ye){ce.nodes.forEach(function(fe){ye&&fe.y+(fe.y1-fe.y0)>pe&&(fe.y=fe.y-(fe.y+(fe.y1-fe.y0)-pe));var ae=ce.links.filter(function(Q){return k(Q.source,xe)==k(fe,xe)}),ee=ae.length;ee>1&&ae.sort(function(Q,ue){if(!Q.circular&&!ue.circular){if(Q.target.column==ue.target.column)return Q.y1-ue.y1;if(te(Q,ue)){if(Q.target.column>ue.target.column){var ge=U(ue,Q);return Q.y1-ge}if(ue.target.column>Q.target.column){var Me=U(Q,ue);return Me-ue.y1}}else return Q.y1-ue.y1}if(Q.circular&&!ue.circular)return Q.circularLinkType=="top"?-1:1;if(ue.circular&&!Q.circular)return ue.circularLinkType=="top"?1:-1;if(Q.circular&&ue.circular)return Q.circularLinkType===ue.circularLinkType&&Q.circularLinkType=="top"?Q.target.column===ue.target.column?Q.target.y1-ue.target.y1:ue.target.column-Q.target.column:Q.circularLinkType===ue.circularLinkType&&Q.circularLinkType=="bottom"?Q.target.column===ue.target.column?ue.target.y1-Q.target.y1:Q.target.column-ue.target.column:Q.circularLinkType=="top"?-1:1});var ie=fe.y0;ae.forEach(function(Q){Q.y0=ie+Q.width/2,ie=ie+Q.width}),ae.forEach(function(Q,ue){if(Q.circularLinkType=="bottom"){var ge=ue+1,Me=0;for(ge;ge1&&fe.sort(function(ie,Q){if(!ie.circular&&!Q.circular){if(ie.source.column==Q.source.column)return ie.y0-Q.y0;if(te(ie,Q)){if(Q.source.column0?"up":"down"}function se(ce,pe){return k(ce.source,pe)==k(ce.target,pe)}function le(ce,pe,xe){var ye=ce.nodes,fe=ce.links,ae=!1,ee=!1;if(fe.forEach(function(Te){Te.circularLinkType=="top"?ae=!0:Te.circularLinkType=="bottom"&&(ee=!0)}),ae==!1||ee==!1){var ie=i.min(ye,function(Te){return Te.y0}),Q=i.max(ye,function(Te){return Te.y1}),ue=Q-ie,ge=xe-pe,Me=ge/ue;ye.forEach(function(Te){var je=(Te.y1-Te.y0)*Me;Te.y0=(Te.y0-ie)*Me,Te.y1=Te.y0+je}),fe.forEach(function(Te){Te.y0=(Te.y0-ie)*Me,Te.y1=(Te.y1-ie)*Me,Te.width=Te.width*Me})}}t.sankeyCircular=T,t.sankeyCenter=f,t.sankeyLeft=n,t.sankeyRight=u,t.sankeyJustify=c,Object.defineProperty(t,"__esModule",{value:!0})}))}}),V8=de({"src/traces/sankey/constants.js"(e,r){"use strict";r.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeLabel:"node-label"}}}}),yle=de({"src/traces/sankey/render.js"(e,r){"use strict";var t=fle(),i=(jv(),ti(M0)).interpolateNumber,a=Yr(),o=ple(),s=gle(),l=V8(),n=ta(),u=hn(),c=Qt(),f=c.strTranslate,h=c.strRotate,d=ip(),p=d.keyFun,g=d.repeat,m=d.unwrap,y=Zo(),_=Ma(),v=Bl(),x=v.CAP_SHIFT,S=v.LINE_SPACING,M=3;function C(H,$,U){var V=m($),j=V.trace,q=j.domain,Y=j.orientation==="h",K=j.direction==="reversed",te=j.node.pad,ne=j.node.thickness,se={justify:o.sankeyJustify,left:o.sankeyLeft,right:o.sankeyRight,center:o.sankeyCenter}[j.node.align],le=H.width*(q.x[1]-q.x[0]),ce=H.height*(q.y[1]-q.y[0]),pe=V._nodes,xe=V._links,ye=V.circular,fe;ye?fe=s.sankeyCircular().circularLinkGap(0):fe=o.sankey(),fe.iterations(l.sankeyIterations).size(Y?[le,ce]:[ce,le]).nodeWidth(ne).nodePadding(te).nodeId(function(mt){return mt.pointNumber}).nodeAlign(se).nodes(pe).links(xe);function ae(mt){j[mt].sort==="input"&&(ye?c.warn(`Circular Sankey diagrams do not support the "input" ${mt}.sort mode; falling back to the default sort.`):fe[`${mt}Sort`](null))}ae("link"),ae("node");var ee=fe();fe.nodePadding()=Ye||(qe=Ye-lt.y0,qe>1e-6&&(lt.y0+=qe,lt.y1+=qe)),Ye=lt.y1+te})}function Ke(mt){var Mt=mt.map(function(ke,Ee){return{x0:ke.x0,index:Ee}}).sort(function(ke,Ee){return ke.x0-Ee.x0}),lt=[],qe=-1,Ye,me=-1/0,_e;for(ie=0;ieme+ne&&(qe+=1,Ye=Ae.x0),me=Ae.x0,lt[qe]||(lt[qe]=[]),lt[qe].push(Ae),_e=Ye-Ae.x0,Ae.x0+=_e,Ae.x1+=_e}return lt}if(j.node.x.length&&j.node.y.length){for(ie=0;ie0?" L "+j.targetX+" "+j.targetY:"")+"Z"):(U="M "+(j.targetX-$)+" "+(j.targetY-V)+" L "+(j.rightInnerExtent-$)+" "+(j.targetY-V)+" A "+(j.rightLargeArcRadius+V)+" "+(j.rightSmallArcRadius+V)+" 0 0 0 "+(j.rightFullExtent-V-$)+" "+(j.targetY+j.rightSmallArcRadius)+" L "+(j.rightFullExtent-V-$)+" "+j.verticalRightInnerExtent,q&&Y?U+=" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.rightInnerExtent-V-$)+" "+(j.verticalFullExtent+V)+" L "+(j.rightFullExtent+V-$-(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent+V)+" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.leftFullExtent+V)+" "+j.verticalLeftInnerExtent:q?U+=" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.rightFullExtent-$-V-(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" L "+(j.leftFullExtent+V+(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.leftFullExtent+V)+" "+j.verticalLeftInnerExtent:U+=" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.rightInnerExtent-$)+" "+(j.verticalFullExtent+V)+" L "+j.leftInnerExtent+" "+(j.verticalFullExtent+V)+" A "+(j.leftLargeArcRadius+V)+" "+(j.leftLargeArcRadius+V)+" 0 0 0 "+(j.leftFullExtent+V)+" "+j.verticalLeftInnerExtent,U+=" L "+(j.leftFullExtent+V)+" "+(j.sourceY+j.leftSmallArcRadius)+" A "+(j.leftLargeArcRadius+V)+" "+(j.leftSmallArcRadius+V)+" 0 0 0 "+j.leftInnerExtent+" "+(j.sourceY-V)+" L "+j.sourceX+" "+(j.sourceY-V)+" L "+j.sourceX+" "+(j.sourceY+V)+" L "+j.leftInnerExtent+" "+(j.sourceY+V)+" A "+(j.leftLargeArcRadius-V)+" "+(j.leftSmallArcRadius-V)+" 0 0 1 "+(j.leftFullExtent-V)+" "+(j.sourceY+j.leftSmallArcRadius)+" L "+(j.leftFullExtent-V)+" "+j.verticalLeftInnerExtent,q&&Y?U+=" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.leftFullExtent-V-(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" L "+(j.rightFullExtent+V-$+(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.rightFullExtent+V-$)+" "+j.verticalRightInnerExtent:q?U+=" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.leftFullExtent+V)+" "+(j.verticalFullExtent+V)+" L "+(j.rightFullExtent-$-V)+" "+(j.verticalFullExtent+V)+" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.rightFullExtent+V-$)+" "+j.verticalRightInnerExtent:U+=" A "+(j.leftLargeArcRadius-V)+" "+(j.leftLargeArcRadius-V)+" 0 0 1 "+j.leftInnerExtent+" "+(j.verticalFullExtent-V)+" L "+(j.rightInnerExtent-$)+" "+(j.verticalFullExtent-V)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightLargeArcRadius-V)+" 0 0 1 "+(j.rightFullExtent+V-$)+" "+j.verticalRightInnerExtent,U+=" L "+(j.rightFullExtent+V-$)+" "+(j.targetY+j.rightSmallArcRadius)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.rightInnerExtent-$)+" "+(j.targetY+V)+" L "+(j.targetX-$)+" "+(j.targetY+V)+($>0?" L "+j.targetX+" "+j.targetY:"")+"Z"),U}function A(){var H=.5;function $(U){var V=U.linkArrowLength;if(U.link.circular)return k(U.link,V);var j=Math.abs((U.link.target.x0-U.link.source.x1)/2);V>j&&(V=j);var q=U.link.source.x1,Y=U.link.target.x0-V,K=i(q,Y),te=K(H),ne=K(1-H),se=U.link.y0-U.link.width/2,le=U.link.y0+U.link.width/2,ce=U.link.y1-U.link.width/2,pe=U.link.y1+U.link.width/2,xe="M"+q+","+se,ye="C"+te+","+se+" "+ne+","+ce+" "+Y+","+ce,fe="C"+ne+","+pe+" "+te+","+le+" "+q+","+le,ae=V>0?"L"+(Y+V)+","+(ce+U.link.width/2):"";return ae+="L"+Y+","+pe,xe+ye+ae+fe+"Z"}return $}function b(H,$){var U=l.nodePadAcross,V=H.nodePad/2;$.dx=$.x1-$.x0,$.dy=$.y1-$.y0;var j=$.dx,q=Math.max(.5,$.dy),Y="node_"+$.pointNumber;return $.group&&(Y=c.randstr()),$.trace=H.trace,$.curveNumber=H.trace.index,{index:$.pointNumber,key:Y,partOfGroup:$.partOfGroup||!1,group:$.group,traceId:H.key,trace:H.trace,node:$,nodePad:H.nodePad,nodeLineColor:H.nodeLineColor,nodeLineWidth:H.nodeLineWidth,textFont:H.textFont,size:H.horizontal?H.height:H.width,visibleWidth:Math.ceil(j),visibleHeight:q,zoneX:-U,zoneY:-V,zoneWidth:j+2*U,zoneHeight:q+2*V,labelY:H.horizontal?$.dy/2+1:$.dx/2+1,left:$.originalLayer===1,sizeAcross:H.width,forceLayouts:H.forceLayouts,horizontal:H.horizontal,reversed:H.reversed,rgb:n.rgb($.color),alpha:n.parse($.color).alpha,valueFormat:H.valueFormat,valueSuffix:H.valueSuffix,sankey:H.sankey,graph:H.graph,arrangement:H.arrangement,uniqueNodeLabelPathId:[H.guid,H.key,Y].join("_"),interactionState:H.interactionState,figure:H}}function E(H){H.attr("transform",function($){return f($.node.x0.toFixed(3),$.node.y0.toFixed(3))})}function T(H){H.call(E)}function F(H,$){H.call(T),$.attr("d",A())}function D(H){H.attr("width",function($){return $.node.x1-$.node.x0}).attr("height",function($){return $.visibleHeight})}function R(H){return H.link.width>1||H.linkLineWidth>0}function P(H){return H.horizontal?H.reversed?f(H.translateX+H.width,H.translateY)+"matrix(-1 0 0 1 0 0)":f(H.translateX,H.translateY)+"matrix(1 0 0 1 0 0)":H.reversed?f(H.translateX,H.translateY+H.height)+"matrix(0 -1 1 0 0 0)":f(H.translateX,H.translateY)+"matrix(0 1 1 0 0 0)"}function z(H,$,U){H.on(".basic",null).on("mouseover.basic",function(V){!V.interactionState.dragInProgress&&!V.partOfGroup&&(U.hover(this,V,$),V.interactionState.hovered=[this,V])}).on("mousemove.basic",function(V){!V.interactionState.dragInProgress&&!V.partOfGroup&&(U.follow(this,V),V.interactionState.hovered=[this,V])}).on("mouseout.basic",function(V){!V.interactionState.dragInProgress&&!V.partOfGroup&&(U.unhover(this,V,$),V.interactionState.hovered=!1)}).on("click.basic",function(V){V.interactionState.hovered&&(U.unhover(this,V,$),V.interactionState.hovered=!1),!V.interactionState.dragInProgress&&!V.partOfGroup&&U.select(this,V,$)})}function I(H,$,U,V){var j=a.behavior.drag().origin(function(q){return{x:q.node.x0+q.visibleWidth/2,y:q.node.y0+q.visibleHeight/2}}).on("dragstart",function(q){if(q.arrangement!=="fixed"&&(c.ensureSingle(V._fullLayout._infolayer,"g","dragcover",function(K){V._fullLayout._dragCover=K}),c.raiseToTop(this),q.interactionState.dragInProgress=q.node,X(q.node),q.interactionState.hovered&&(U.nodeEvents.unhover.apply(0,q.interactionState.hovered),q.interactionState.hovered=!1),q.arrangement==="snap")){var Y=q.traceId+"|"+q.key;q.forceLayouts[Y]?q.forceLayouts[Y].alpha(1):L(H,Y,q,V),B(H,$,q,Y,V)}}).on("drag",function(q){if(q.arrangement!=="fixed"){var Y=a.event.x,K=a.event.y;q.arrangement==="snap"?(q.node.x0=Y-q.visibleWidth/2,q.node.x1=Y+q.visibleWidth/2,q.node.y0=K-q.visibleHeight/2,q.node.y1=K+q.visibleHeight/2):(q.arrangement==="freeform"&&(q.node.x0=Y-q.visibleWidth/2,q.node.x1=Y+q.visibleWidth/2),K=Math.max(0,Math.min(q.size-q.visibleHeight/2,K)),q.node.y0=K-q.visibleHeight/2,q.node.y1=K+q.visibleHeight/2),X(q.node),q.arrangement!=="snap"&&(q.sankey.update(q.graph),F(H.filter(Z(q)),$))}}).on("dragend",function(q){if(q.arrangement!=="fixed"){q.interactionState.dragInProgress=!1;for(var Y=0;Y0)window.requestAnimationFrame(q);else{var te=U.node.originalX;U.node.x0=te-U.visibleWidth/2,U.node.x1=te+U.visibleWidth/2,G(U,j)}})}function O(H,$,U,V){return function(){for(var q=0,Y=0;Y0&&V.forceLayouts[$].alpha(0)}}function G(H,$){for(var U=[],V=[],j=0;jR(fe)?n.rgb(fe.linkLineColor):fe.rgb).style("stroke-opacity",fe=>R(fe)?n.opacity(fe.linkLineColor):fe.alpha).style("fill",fe=>fe.rgb).style("fill-opacity",fe=>fe.alpha).style("stroke-width",fe=>R(fe)?fe.linkLineWidth:1).attr("d",A()),le.style("opacity",function(){return H._context.staticPlot||Y||K?1:0}).transition().ease(l.ease).duration(l.duration).style("opacity",1),le.exit().transition().ease(l.ease).duration(l.duration).style("opacity",0).remove();var ce=ne.selectAll("."+l.cn.sankeyNodeSet).data(g,p);ce.enter().append("g").classed(l.cn.sankeyNodeSet,!0),ce.style("cursor",function(fe){switch(fe.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var pe=ce.selectAll("."+l.cn.sankeyNode).data(function(fe){var ae=fe.graph.nodes;return W(ae),ae.map(b.bind(null,fe))},p);pe.enter().append("g").classed(l.cn.sankeyNode,!0).call(E).style("opacity",function(fe){return(H._context.staticPlot||Y)&&!fe.partOfGroup?1:0}),pe.call(z,ne,j.nodeEvents).call(I,le,j,H),pe.transition().ease(l.ease).duration(l.duration).call(E).style("opacity",function(fe){return fe.partOfGroup?0:1}),pe.exit().transition().ease(l.ease).duration(l.duration).style("opacity",0).remove();var xe=pe.selectAll("."+l.cn.nodeRect).data(g);xe.enter().append("rect").classed(l.cn.nodeRect,!0).call(D),xe.style("stroke-width",function(fe){return fe.nodeLineWidth}).style("stroke",function(fe){return n.rgb(fe.nodeLineColor)}).style("stroke-opacity",function(fe){return n.opacity(fe.nodeLineColor)}).style("fill",fe=>fe.rgb).style("fill-opacity",fe=>fe.alpha),xe.transition().ease(l.ease).duration(l.duration).call(D);var ye=pe.selectAll("."+l.cn.nodeLabel).data(g);ye.enter().append("text").classed(l.cn.nodeLabel,!0).style("cursor","default"),ye.attr("data-notex",1).text(function(fe){return fe.node.label}).each(function(fe){var ae=a.select(this);u.font(ae,fe.textFont),y.convertToTspans(ae,H)}).attr("text-anchor",function(fe){return fe.horizontal&&fe.left!==fe.reversed?"end":"start"}).attr("transform",function(fe){var ae=a.select(this),ee=y.lineCount(ae),ie=fe.textFont.size*((ee-1)*S-x),Q=fe.nodeLineWidth/2+M;if(!fe.horizontal){var Me=fe.reversed?(fe.visibleWidth+ie)/2:(fe.visibleWidth-ie)/2,ue=fe.reversed?h(90):"scale(-1,1)"+h(90);return f(Me,Q)+ue}var ge=Q,Me=(fe.visibleHeight-ie)/2;return fe.left?ge=-ge:ge+=fe.visibleWidth,f(ge,Me)+(fe.reversed?"scale(-1,1)":"")}),ye.transition().ease(l.ease).duration(l.duration)}}}),G8=de({"src/traces/sankey/plot.js"(e,r){"use strict";var t=Yr(),i=Qt(),a=i.numberFormat,o=yle(),s=$s(),l=ta(),n=V8().cn,u=i._;function c(S){return S!==""}function f(S,M){return S.filter(function(C){return C.key===M.traceId})}function h(S,M){t.select(S).select("path").style("fill-opacity",M),t.select(S).select("rect").style("fill-opacity",M)}function d(S){t.select(S).select("text.name").style("fill","black")}function p(S){return function(M){return S.node.sourceLinks.indexOf(M.link)!==-1||S.node.targetLinks.indexOf(M.link)!==-1}}function g(S){return function(M){return M.node.sourceLinks.indexOf(S.link)!==-1||M.node.targetLinks.indexOf(S.link)!==-1}}function m(S,M,C){M&&C&&f(C,M).selectAll("."+n.sankeyLink).filter(p(M)).call(_.bind(0,M,C,!1))}function y(S,M,C){M&&C&&f(C,M).selectAll("."+n.sankeyLink).filter(p(M)).call(v.bind(0,M,C,!1))}function _(S,M,C,w){w.style("fill",function(k){if(!k.link.concentrationscale)return k.hoverRgb}).style("fill-opacity",function(k){if(!k.link.concentrationscale)return k.hoverAlpha}),w.each(function(k){var A=k.link.label;A!==""&&f(M,S).selectAll("."+n.sankeyLink).filter(function(b){return b.link.label===A}).style("fill",function(b){if(!b.link.concentrationscale)return b.hoverRgb}).style("fill-opacity",function(b){if(!b.link.concentrationscale)return b.hoverAlpha})}),C&&f(M,S).selectAll("."+n.sankeyNode).filter(g(S)).call(m)}function v(S,M,C,w){w.style("fill",function(k){return k.rgb}).style("fill-opacity",function(k){return k.alpha}),w.each(function(k){var A=k.link.label;A!==""&&f(M,S).selectAll("."+n.sankeyLink).filter(function(b){return b.link.label===A}).style("fill",b=>b.rgb).style("fill-opacity",b=>b.alpha)}),C&&f(M,S).selectAll(n.sankeyNode).filter(g(S)).call(y)}function x(S,M){var C=S.hoverlabel||{},w=i.nestedProperty(C,M).get();return Array.isArray(w)?!1:w}r.exports=function(M,C){for(var w=M._fullLayout,k=w._paper,A=w._size,b=0;b"),color:x(N,"bgcolor")||l.addOpacity(j.color,1),borderColor:x(N,"bordercolor"),fontFamily:x(N,"font.family"),fontSize:x(N,"font.size"),fontColor:x(N,"font.color"),fontWeight:x(N,"font.weight"),fontStyle:x(N,"font.style"),fontVariant:x(N,"font.variant"),fontTextcase:x(N,"font.textcase"),fontLineposition:x(N,"font.lineposition"),fontShadow:x(N,"font.shadow"),nameLength:x(N,"namelength"),textAlign:x(N,"align"),idealAlign:t.event.x"),color:x(N,"bgcolor")||J.rgb,borderColor:x(N,"bordercolor"),fontFamily:x(N,"font.family"),fontSize:x(N,"font.size"),fontColor:x(N,"font.color"),fontWeight:x(N,"font.weight"),fontStyle:x(N,"font.style"),fontVariant:x(N,"font.variant"),fontTextcase:x(N,"font.textcase"),fontLineposition:x(N,"font.lineposition"),fontShadow:x(N,"font.shadow"),nameLength:x(N,"namelength"),textAlign:x(N,"align"),idealAlign:"left",hovertemplate:N.hovertemplate,hovertemplateLabels:Y,eventData:[J.node]},{container:w._hoverlayer.node(),outerContainer:w._paper.node(),gd:M});h(ne,.85),d(ne)}}},X=function(Z,J,N){M._fullLayout.hovermode!==!1&&(t.select(Z).call(y,J,N),J.node.trace.node.hoverinfo!=="skip"&&(J.node.fullData=J.node.trace,M.emit("plotly_unhover",{event:t.event,points:[J.node]})),s.loneUnhover(w._hoverlayer.node()))};o(M,k,C,{width:A.w,height:A.h,margin:{t:A.t,r:A.r,b:A.b,l:A.l}},{linkEvents:{hover:F,follow:L,unhover:B,select:T},nodeEvents:{hover:G,follow:W,unhover:X,select:O}})}}}),_le=de({"src/traces/sankey/base_plot.js"(e){"use strict";var r=Ps().overrideAll,t=$u().getModuleCalcData,i=G8(),a=La(),o=md(),s=Uc(),l=Zl().prepSelect,n=Qt(),u=Ma(),c="sankey";e.name=c,e.baseLayoutAttrOverrides=r({hoverlabel:a.hoverlabel},"plot","nested"),e.plot=function(h){var d=t(h.calcdata,c)[0];i(h,d),e.updateFx(h)},e.clean=function(h,d,p,g){var m=g._has&&g._has(c),y=d._has&&d._has(c);m&&!y&&(g._paperdiv.selectAll(".sankey").remove(),g._paperdiv.selectAll(".bgsankey").remove())},e.updateFx=function(h){for(var d=0;d0}r.exports=function(P,z,I,L){var B=P._fullLayout,O;S(I)&&L&&(O=L()),o.makeTraceGroups(B._indicatorlayer,z,"trace").each(function(G){var W=G[0],X=W.trace,Z=t.select(this),J=X._hasGauge,N=X._isAngular,H=X._isBullet,$=X.domain,U={w:B._size.w*($.x[1]-$.x[0]),h:B._size.h*($.y[1]-$.y[0]),l:B._size.l+B._size.w*$.x[0],r:B._size.r+B._size.w*(1-$.x[1]),t:B._size.t+B._size.h*(1-$.y[1]),b:B._size.b+B._size.h*$.y[0]},V=U.l+U.w/2,j=U.t+U.h/2,q=Math.min(U.w/2,U.h),Y=f.innerRadius*q,K,te,ne,se=X.align||"center";if(te=j,!J)K=U.l+v[se]*U.w,ne=function(Q){return E(Q,U.w,U.h)};else if(N&&(K=V,te=j+q/2,ne=function(Q){return T(Q,.9*Y)}),H){var le=f.bulletPadding,ce=1-f.bulletNumberDomainSize+le;K=U.l+(ce+(1-ce)*v[se])*U.w,ne=function(Q){return E(Q,(f.bulletNumberDomainSize-le)*U.w,U.h)}}w(P,Z,G,{numbersX:K,numbersY:te,numbersScaler:ne,transitionOpts:I,onComplete:O});var pe,xe;J&&(pe={range:X.gauge.axis.range,color:X.gauge.bgcolor,line:{color:X.gauge.bordercolor,width:0},thickness:1},xe={range:X.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:X.gauge.bordercolor,width:X.gauge.borderwidth},thickness:1});var ye=Z.selectAll("g.angular").data(N?G:[]);ye.exit().remove();var fe=Z.selectAll("g.angularaxis").data(N?G:[]);fe.exit().remove(),N&&C(P,Z,G,{radius:q,innerRadius:Y,gauge:ye,layer:fe,size:U,gaugeBg:pe,gaugeOutline:xe,transitionOpts:I,onComplete:O});var ae=Z.selectAll("g.bullet").data(H?G:[]);ae.exit().remove();var ee=Z.selectAll("g.bulletaxis").data(H?G:[]);ee.exit().remove(),H&&M(P,Z,G,{gauge:ae,layer:ee,size:U,gaugeBg:pe,gaugeOutline:xe,transitionOpts:I,onComplete:O});var ie=Z.selectAll("text.title").data(G);ie.exit().remove(),ie.enter().append("text").classed("title",!0),ie.attr("text-anchor",function(){return H?_.right:_[X.title.align]}).text(X.title.text).call(c.font,X.title.font).call(h.convertToTspans,P),ie.attr("transform",function(){var Q=U.l+U.w*v[X.title.align],ue,ge=f.titlePadding,Me=c.bBox(ie.node());if(J){if(N)if(X.gauge.axis.visible){var Te=c.bBox(fe.node());ue=Te.top-ge-Me.bottom}else ue=U.t+U.h/2-q/2-Me.bottom-ge;H&&(ue=te-(Me.top+Me.bottom)/2,Q=U.l-f.bulletPadding*U.w)}else ue=X._numbersTop-ge-Me.bottom;return l(Q,ue)})})};function M(R,P,z,I){var L=z[0].trace,B=I.gauge,O=I.layer,G=I.gaugeBg,W=I.gaugeOutline,X=I.size,Z=L.domain,J=I.transitionOpts,N=I.onComplete,H,$,U,V,j;B.enter().append("g").classed("bullet",!0),B.attr("transform",l(X.l,X.t)),O.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),O.selectAll("g.xbulletaxistick,path,text").remove();var q=X.h,Y=L.gauge.bar.thickness*q,K=Z.x[0],te=Z.x[0]+(Z.x[1]-Z.x[0])*(L._hasNumber||L._hasDelta?1-f.bulletNumberDomainSize:1);H=b(R,L.gauge.axis),H._id="xbulletaxis",H.domain=[K,te],H.setScale(),$=d.calcTicks(H),U=d.makeTransTickFn(H),V=d.getTickSigns(H)[2],j=X.t+X.h,H.visible&&(d.drawTicks(R,H,{vals:H.ticks==="inside"?d.clipEnds(H,$):$,layer:O,path:d.makeTickPath(H,j,V),transFn:U}),d.drawLabels(R,H,{vals:$,layer:O,transFn:U,labelFns:d.makeLabelFns(H,j)}));function ne(fe){fe.attr("width",function(ae){return Math.max(0,H.c2p(ae.range[1])-H.c2p(ae.range[0]))}).attr("x",function(ae){return H.c2p(ae.range[0])}).attr("y",function(ae){return .5*(1-ae.thickness)*q}).attr("height",function(ae){return ae.thickness*q})}var se=[G].concat(L.gauge.steps),le=B.selectAll("g.bg-bullet").data(se);le.enter().append("g").classed("bg-bullet",!0).append("rect"),le.select("rect").call(ne).call(k),le.exit().remove();var ce=B.selectAll("g.value-bullet").data([L.gauge.bar]);ce.enter().append("g").classed("value-bullet",!0).append("rect"),ce.select("rect").attr("height",Y).attr("y",(q-Y)/2).call(k),S(J)?ce.select("rect").transition().duration(J.duration).ease(J.easing).each("end",function(){N&&N()}).each("interrupt",function(){N&&N()}).attr("width",Math.max(0,H.c2p(Math.min(L.gauge.axis.range[1],z[0].y)))):ce.select("rect").attr("width",typeof z[0].y=="number"?Math.max(0,H.c2p(Math.min(L.gauge.axis.range[1],z[0].y))):0),ce.exit().remove();var pe=z.filter(function(){return L.gauge.threshold.value||L.gauge.threshold.value===0}),xe=B.selectAll("g.threshold-bullet").data(pe);xe.enter().append("g").classed("threshold-bullet",!0).append("line"),xe.select("line").attr("x1",H.c2p(L.gauge.threshold.value)).attr("x2",H.c2p(L.gauge.threshold.value)).attr("y1",(1-L.gauge.threshold.thickness)/2*q).attr("y2",(1-(1-L.gauge.threshold.thickness)/2)*q).call(y.stroke,L.gauge.threshold.line.color).style("stroke-width",L.gauge.threshold.line.width),xe.exit().remove();var ye=B.selectAll("g.gauge-outline").data([W]);ye.enter().append("g").classed("gauge-outline",!0).append("rect"),ye.select("rect").call(ne).call(k),ye.exit().remove()}function C(R,P,z,I){var L=z[0].trace,B=I.size,O=I.radius,G=I.innerRadius,W=I.gaugeBg,X=I.gaugeOutline,Z=[B.l+B.w/2,B.t+B.h/2+O/2],J=I.gauge,N=I.layer,H=I.transitionOpts,$=I.onComplete,U=Math.PI/2;function V(je){var Ve=L.gauge.axis.range[0],Ze=L.gauge.axis.range[1],Ke=(je-Ve)/(Ze-Ve)*Math.PI-U;return Ke<-U?-U:Ke>U?U:Ke}function j(je){return t.svg.arc().innerRadius((G+O)/2-je/2*(O-G)).outerRadius((G+O)/2+je/2*(O-G)).startAngle(-U)}function q(je){je.attr("d",function(Ve){return j(Ve.thickness).startAngle(V(Ve.range[0])).endAngle(V(Ve.range[1]))()})}var Y,K,te,ne;J.enter().append("g").classed("angular",!0),J.attr("transform",l(Z[0],Z[1])),N.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),N.selectAll("g.xangularaxistick,path,text").remove(),Y=b(R,L.gauge.axis),Y.type="linear",Y.range=L.gauge.axis.range,Y._id="xangularaxis",Y.ticklabeloverflow="allow",Y.setScale();var se=function(je){return(Y.range[0]-je.x)/(Y.range[1]-Y.range[0])*Math.PI+Math.PI},le={},ce=d.makeLabelFns(Y,0),pe=ce.labelStandoff;le.xFn=function(je){var Ve=se(je);return Math.cos(Ve)*pe},le.yFn=function(je){var Ve=se(je),Ze=Math.sin(Ve)>0?.2:1;return-Math.sin(Ve)*(pe+je.fontSize*Ze)+Math.abs(Math.cos(Ve))*(je.fontSize*u)},le.anchorFn=function(je){var Ve=se(je),Ze=Math.cos(Ve);return Math.abs(Ze)<.1?"middle":Ze>0?"start":"end"},le.heightFn=function(je,Ve,Ze){var Ke=se(je);return-.5*(1+Math.sin(Ke))*Ze};var xe=function(je){return l(Z[0]+O*Math.cos(je),Z[1]-O*Math.sin(je))};te=function(je){return xe(se(je))};var ye=function(je){var Ve=se(je);return xe(Ve)+"rotate("+-n(Ve)+")"};if(K=d.calcTicks(Y),ne=d.getTickSigns(Y)[2],Y.visible){ne=Y.ticks==="inside"?-1:1;var fe=(Y.linewidth||1)/2;d.drawTicks(R,Y,{vals:K,layer:N,path:"M"+ne*fe+",0h"+ne*Y.ticklen,transFn:ye}),d.drawLabels(R,Y,{vals:K,layer:N,transFn:te,labelFns:le})}var ae=[W].concat(L.gauge.steps),ee=J.selectAll("g.bg-arc").data(ae);ee.enter().append("g").classed("bg-arc",!0).append("path"),ee.select("path").call(q).call(k),ee.exit().remove();var ie=j(L.gauge.bar.thickness),Q=J.selectAll("g.value-arc").data([L.gauge.bar]);Q.enter().append("g").classed("value-arc",!0).append("path");var ue=Q.select("path");S(H)?(ue.transition().duration(H.duration).ease(H.easing).each("end",function(){$&&$()}).each("interrupt",function(){$&&$()}).attrTween("d",A(ie,V(z[0].lastY),V(z[0].y))),L._lastValue=z[0].y):ue.attr("d",typeof z[0].y=="number"?ie.endAngle(V(z[0].y)):"M0,0Z"),ue.call(k),Q.exit().remove(),ae=[];var ge=L.gauge.threshold.value;(ge||ge===0)&&ae.push({range:[ge,ge],color:L.gauge.threshold.color,line:{color:L.gauge.threshold.line.color,width:L.gauge.threshold.line.width},thickness:L.gauge.threshold.thickness});var Me=J.selectAll("g.threshold-arc").data(ae);Me.enter().append("g").classed("threshold-arc",!0).append("path"),Me.select("path").call(q).call(k),Me.exit().remove();var Te=J.selectAll("g.gauge-outline").data([X]);Te.enter().append("g").classed("gauge-outline",!0).append("path"),Te.select("path").call(q).call(k),Te.exit().remove()}function w(R,P,z,I){var L=z[0].trace,B=I.numbersX,O=I.numbersY,G=L.align||"center",W=_[G],X=I.transitionOpts,Z=I.onComplete,J=o.ensureSingle(P,"g","numbers"),N,H,$,U=[];L._hasNumber&&U.push("number"),L._hasDelta&&(U.push("delta"),L.delta.position==="left"&&U.reverse());var V=J.selectAll("text").data(U);V.enter().append("text"),V.attr("text-anchor",function(){return W}).attr("class",function(xe){return xe}).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),V.exit().remove();function j(xe,ye,fe,ae){if(xe.match("s")&&fe>=0!=ae>=0&&!ye(fe).slice(-1).match(x)&&!ye(ae).slice(-1).match(x)){var ee=xe.slice().replace("s","f").replace(/\d+/,function(Q){return parseInt(Q)-1}),ie=b(R,{tickformat:ee});return function(Q){return Math.abs(Q)<1?d.tickText(ie,Q).text:ye(Q)}}else return ye}function q(){var xe=b(R,{tickformat:L.number.valueformat},L._range);xe.setScale(),d.prepTicks(xe);var ye=function(Q){return d.tickText(xe,Q).text},fe=L.number.suffix,ae=L.number.prefix,ee=J.select("text.number");function ie(){var Q=typeof z[0].y=="number"?ae+ye(z[0].y)+fe:"-";ee.text(Q).call(c.font,L.number.font).call(h.convertToTspans,R)}return S(X)?ee.transition().duration(X.duration).ease(X.easing).each("end",function(){ie(),Z&&Z()}).each("interrupt",function(){ie(),Z&&Z()}).attrTween("text",function(){var Q=t.select(this),ue=a(z[0].lastY,z[0].y);L._lastValue=z[0].y;var ge=j(L.number.valueformat,ye,z[0].lastY,z[0].y);return function(Me){Q.text(ae+ge(ue(Me))+fe)}}):ie(),N=F(ae+ye(z[0].y)+fe,L.number.font,W,R),ee}function Y(){var xe=b(R,{tickformat:L.delta.valueformat},L._range);xe.setScale(),d.prepTicks(xe);var ye=function(Me){return d.tickText(xe,Me).text},fe=L.delta.suffix,ae=L.delta.prefix,ee=function(Me){var Te=L.delta.relative?Me.relativeDelta:Me.delta;return Te},ie=function(Me,Te){return Me===0||typeof Me!="number"||isNaN(Me)?"-":(Me>0?L.delta.increasing.symbol:L.delta.decreasing.symbol)+ae+Te(Me)+fe},Q=function(Me){return Me.delta>=0?L.delta.increasing.color:L.delta.decreasing.color};L._deltaLastValue===void 0&&(L._deltaLastValue=ee(z[0]));var ue=J.select("text.delta");ue.call(c.font,L.delta.font).call(y.fill,Q({delta:L._deltaLastValue}));function ge(){ue.text(ie(ee(z[0]),ye)).call(y.fill,Q(z[0])).call(h.convertToTspans,R)}return S(X)?ue.transition().duration(X.duration).ease(X.easing).tween("text",function(){var Me=t.select(this),Te=ee(z[0]),je=L._deltaLastValue,Ve=j(L.delta.valueformat,ye,je,Te),Ze=a(je,Te);return L._deltaLastValue=Te,function(Ke){Me.text(ie(Ze(Ke),Ve)),Me.call(y.fill,Q({delta:Ze(Ke)}))}}).each("end",function(){ge(),Z&&Z()}).each("interrupt",function(){ge(),Z&&Z()}):ge(),H=F(ie(ee(z[0]),ye),L.delta.font,W,R),ue}var K=L.mode+L.align,te;if(L._hasDelta&&(te=Y(),K+=L.delta.position+L.delta.font.size+L.delta.font.family+L.delta.valueformat,K+=L.delta.increasing.symbol+L.delta.decreasing.symbol,$=H),L._hasNumber&&(q(),K+=L.number.font.size+L.number.font.family+L.number.valueformat+L.number.suffix+L.number.prefix,$=N),L._hasDelta&&L._hasNumber){var ne=[(N.left+N.right)/2,(N.top+N.bottom)/2],se=[(H.left+H.right)/2,(H.top+H.bottom)/2],le,ce,pe=.75*L.delta.font.size;L.delta.position==="left"&&(le=D(L,"deltaPos",0,-1*(N.width*v[L.align]+H.width*(1-v[L.align])+pe),K,Math.min),ce=ne[1]-se[1],$={width:N.width+H.width+pe,height:Math.max(N.height,H.height),left:H.left+le,right:N.right,top:Math.min(N.top,H.top+ce),bottom:Math.max(N.bottom,H.bottom+ce)}),L.delta.position==="right"&&(le=D(L,"deltaPos",0,N.width*(1-v[L.align])+H.width*v[L.align]+pe,K,Math.max),ce=ne[1]-se[1],$={width:N.width+H.width+pe,height:Math.max(N.height,H.height),left:N.left,right:H.right+le,top:Math.min(N.top,H.top+ce),bottom:Math.max(N.bottom,H.bottom+ce)}),L.delta.position==="bottom"&&(le=null,ce=H.height,$={width:Math.max(N.width,H.width),height:N.height+H.height,left:Math.min(N.left,H.left),right:Math.max(N.right,H.right),top:N.bottom-N.height,bottom:N.bottom+H.height}),L.delta.position==="top"&&(le=null,ce=N.top,$={width:Math.max(N.width,H.width),height:N.height+H.height,left:Math.min(N.left,H.left),right:Math.max(N.right,H.right),top:N.bottom-N.height-H.height,bottom:N.bottom}),te.attr({dx:le,dy:ce})}(L._hasNumber||L._hasDelta)&&J.attr("transform",function(){var xe=I.numbersScaler($);K+=xe[2];var ye=D(L,"numbersScale",1,xe[0],K,Math.min),fe;L._scaleNumbers||(ye=1),L._isAngular?fe=O-ye*$.bottom:fe=O-ye*($.top+$.bottom)/2,L._numbersTop=ye*$.top+fe;var ae=$[G];G==="center"&&(ae=($.left+$.right)/2);var ee=B-ye*ae;return ee=D(L,"numbersTranslate",0,ee,K,Math.max),l(ee,fe)+s(ye)})}function k(R){R.each(function(P){y.stroke(t.select(this),P.line.color)}).each(function(P){y.fill(t.select(this),P.color)}).style("stroke-width",function(P){return P.line.width})}function A(R,P,z){return function(){var I=i(P,z);return function(L){return R.endAngle(I(L))()}}}function b(R,P,z){var I=R._fullLayout,L=o.extendFlat({type:"linear",ticks:"outside",range:z,showline:!0},P),B={type:"linear",_id:"x"+P._id},O={letter:"x",font:I.font,noAutotickangles:!0,noHover:!0,noTickson:!0};function G(W,X){return o.coerce(L,B,m,W,X)}return p(L,B,G,O,I),g(L,B,G,O),B}function E(R,P,z){var I=Math.min(P/R.width,z/R.height);return[I,R,P+"x"+z]}function T(R,P){var z=Math.sqrt(R.width/2*(R.width/2)+R.height*R.height),I=P/z;return[I,R,P]}function F(R,P,z,I){var L=document.createElementNS("http://www.w3.org/2000/svg","text"),B=t.select(L);return B.text(R).attr("x",0).attr("y",0).attr("text-anchor",z).attr("data-unformatted",R).call(h.convertToTspans,I).call(c.font,P),c.bBox(B.node())}function D(R,P,z,I,L,B){var O="_cache"+P;R[O]&&R[O].key===L||(R[O]={key:L,value:z});var G=o.aggNums(B,null,[R[O].value,I],2);return R[O].value=G,G}}}),Ele=de({"src/traces/indicator/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"indicator",basePlotModule:Tle(),categories:["svg","noOpacity","noHover"],animatable:!0,attributes:H8(),supplyDefaults:Ale().supplyDefaults,calc:Mle().calc,plot:Sle(),meta:{}}}}),kle=de({"lib/indicator.js"(e,r){"use strict";r.exports=Ele()}}),W8=de({"src/traces/table/attributes.js"(e,r){"use strict";var t=g0(),i=fn().extendFlat,a=Ps().overrideAll,o=us(),s=Is().attributes,l=Ns().descriptionOnlyNumbers,n=r.exports=a({domain:s({name:"table",trace:!0}),columnwidth:{valType:"number",arrayOk:!0,dflt:null},columnorder:{valType:"data_array"},header:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:28},align:i({},t.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:i({},o({arrayOk:!0}))},cells:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:20},align:i({},t.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:i({},o({arrayOk:!0}))}},"calc","from-root")}}),Cle=de({"src/traces/table/defaults.js"(e,r){"use strict";var t=Qt(),i=W8(),a=Is().defaults;function o(s,l){for(var n=s.columnorder||[],u=s.header.values.length,c=n.slice(0,u),f=c.slice().sort(function(p,g){return p-g}),h=c.map(function(p){return f.indexOf(p)}),d=h.length;d",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}}}),Lle=de({"src/traces/table/data_preparation_helper.js"(e,r){"use strict";var t=Y8(),i=fn().extendFlat,a=da(),o=Do().isTypedArray,s=Do().isArrayOrTypedArray;r.exports=function(m,y){var _=u(y.cells.values),v=function(W){return W.slice(y.header.values.length,W.length)},x=u(y.header.values);x.length&&!x[0].length&&(x[0]=[""],x=u(x));var S=x.concat(v(_).map(function(){return c((x[0]||[""]).length)})),M=y.domain,C=Math.floor(m._fullLayout._size.w*(M.x[1]-M.x[0])),w=Math.floor(m._fullLayout._size.h*(M.y[1]-M.y[0])),k=y.header.values.length?S[0].map(function(){return y.header.height}):[t.emptyHeaderHeight],A=_.length?_[0].map(function(){return y.cells.height}):[],b=k.reduce(n,0),E=w-b,T=E+t.uplift,F=d(A,T),D=d(k,b),R=h(D,[]),P=h(F,R),z={},I=y.columnorder;s(I)&&(I=Array.from(I)),I=I.concat(v(_.map(function(W,X){return X})));var L=S.map(function(W,X){var Z=s(y.columnwidth)?y.columnwidth[Math.min(X,y.columnwidth.length-1)]:y.columnwidth;return a(Z)?Number(Z):1}),B=L.reduce(n,0);L=L.map(function(W){return W/B*C});var O=Math.max(l(y.header.line.width),l(y.cells.line.width)),G={key:y.uid+m._context.staticPlot,translateX:M.x[0]*m._fullLayout._size.w,translateY:m._fullLayout._size.h*(1-M.y[1]),size:m._fullLayout._size,width:C,maxLineWidth:O,height:w,columnOrder:I,groupHeight:w,rowBlocks:P,headerRowBlocks:R,scrollY:0,cells:i({},y.cells,{values:_}),headerCells:i({},y.header,{values:S}),gdColumns:S.map(function(W){return W[0]}),gdColumnsOriginalOrder:S.map(function(W){return W[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:S.map(function(W,X){var Z=z[W];z[W]=(Z||0)+1;var J=W+"__"+z[W];return{key:J,label:W,specIndex:X,xIndex:I[X],xScale:f,x:void 0,calcdata:void 0,columnWidth:L[X]}})};return G.columns.forEach(function(W){W.calcdata=G,W.x=f(W)}),G};function l(g){if(s(g)){for(var m=0,y=0;y=m||w===g.length-1)&&(y[v]=S,S.key=C++,S.firstRowIndex=M,S.lastRowIndex=w,S=p(),v+=x,M=w+1,x=0);return y}function p(){return{firstRowIndex:null,lastRowIndex:null,rows:[]}}}}),Fle=de({"src/traces/table/data_split_helpers.js"(e){"use strict";var r=fn().extendFlat;e.splitToPanels=function(i){var a=[0,0],o=r({},i,{key:"header",type:"header",page:0,prevPages:a,currentRepaint:[null,null],dragHandle:!0,values:i.calcdata.headerCells.values[i.specIndex],rowBlocks:i.calcdata.headerRowBlocks,calcdata:r({},i.calcdata,{cells:i.calcdata.headerCells})}),s=r({},i,{key:"cells1",type:"cells",page:0,prevPages:a,currentRepaint:[null,null],dragHandle:!1,values:i.calcdata.cells.values[i.specIndex],rowBlocks:i.calcdata.rowBlocks}),l=r({},i,{key:"cells2",type:"cells",page:1,prevPages:a,currentRepaint:[null,null],dragHandle:!1,values:i.calcdata.cells.values[i.specIndex],rowBlocks:i.calcdata.rowBlocks});return[s,l,o]},e.splitToCells=function(i){var a=t(i);return(i.values||[]).slice(a[0],a[1]).map(function(o,s){var l=typeof o=="string"&&o.match(/[<$&> ]/)?"_keybuster_"+Math.random():"";return{keyWithinBlock:s+l,key:a[0]+s,column:i,calcdata:i.calcdata,page:i.page,rowBlocks:i.rowBlocks,value:o}})};function t(i){var a=i.rowBlocks[i.page],o=a?a.rows[0].rowIndex:0,s=a?o+a.rows.length:0;return[o,s]}}}),X8=de({"src/traces/table/plot.js"(e,r){"use strict";var t=Y8(),i=Yr(),a=Qt(),o=a.numberFormat,s=ip(),l=hn(),n=Zo(),u=Qt().raiseToTop,c=Qt().strTranslate,f=Qt().cancelTransition,h=Lle(),d=Fle(),p=ta();r.exports=function(K,te){var ne=!K._context.staticPlot,se=K._fullLayout._paper.selectAll("."+t.cn.table).data(te.map(function(Te){var je=s.unwrap(Te),Ve=je.trace;return h(K,Ve)}),s.keyFun);se.exit().remove(),se.enter().append("g").classed(t.cn.table,!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","all"),se.attr("width",function(Te){return Te.width+Te.size.l+Te.size.r}).attr("height",function(Te){return Te.height+Te.size.t+Te.size.b}).attr("transform",function(Te){return c(Te.translateX,Te.translateY)});var le=se.selectAll("."+t.cn.tableControlView).data(s.repeat,s.keyFun),ce=le.enter().append("g").classed(t.cn.tableControlView,!0).style("box-sizing","content-box");if(ne){var pe="onwheel"in document?"wheel":"mousewheel";ce.on("mousemove",function(Te){le.filter(function(je){return Te===je}).call(v,K)}).on(pe,function(Te){if(!Te.scrollbarState.wheeling){Te.scrollbarState.wheeling=!0;var je=Te.scrollY+i.event.deltaY,Ve=W(K,le,null,je)(Te);Ve||(i.event.stopPropagation(),i.event.preventDefault()),Te.scrollbarState.wheeling=!1}}).call(v,K,!0)}le.attr("transform",function(Te){return c(Te.size.l,Te.size.t)});var xe=le.selectAll("."+t.cn.scrollBackground).data(s.repeat,s.keyFun);xe.enter().append("rect").classed(t.cn.scrollBackground,!0).attr("fill","none"),xe.attr("width",function(Te){return Te.width}).attr("height",function(Te){return Te.height}),le.each(function(Te){l.setClipUrl(i.select(this),m(K,Te),K)});var ye=le.selectAll("."+t.cn.yColumn).data(function(Te){return Te.columns},s.keyFun);ye.enter().append("g").classed(t.cn.yColumn,!0),ye.exit().remove(),ye.attr("transform",function(Te){return c(Te.x,0)}),ne&&ye.call(i.behavior.drag().origin(function(Te){var je=i.select(this);return z(je,Te,-t.uplift),u(this),Te.calcdata.columnDragInProgress=!0,v(le.filter(function(Ve){return Te.calcdata.key===Ve.key}),K),Te}).on("drag",function(Te){var je=i.select(this),Ve=function(vt){return(Te===vt?i.event.x:vt.x)+vt.columnWidth/2};Te.x=Math.max(-t.overdrag,Math.min(Te.calcdata.width+t.overdrag-Te.columnWidth,i.event.x));var Ze=_(ye).filter(function(vt){return vt.calcdata.key===Te.calcdata.key}),Ke=Ze.sort(function(vt,xt){return Ve(vt)-Ve(xt)});Ke.forEach(function(vt,xt){vt.xIndex=xt,vt.x=Te===vt?vt.x:vt.xScale(vt)}),ye.filter(function(vt){return Te!==vt}).transition().ease(t.transitionEase).duration(t.transitionDuration).attr("transform",function(vt){return c(vt.x,0)}),je.call(f).attr("transform",c(Te.x,-t.uplift))}).on("dragend",function(Te){var je=i.select(this),Ve=Te.calcdata;Te.x=Te.xScale(Te),Te.calcdata.columnDragInProgress=!1,z(je,Te,0),R(K,Ve,Ve.columns.map(function(Ze){return Ze.xIndex}))})),ye.each(function(Te){l.setClipUrl(i.select(this),y(K,Te),K)});var fe=ye.selectAll("."+t.cn.columnBlock).data(d.splitToPanels,s.keyFun);fe.enter().append("g").classed(t.cn.columnBlock,!0).attr("id",function(Te){return Te.key}),fe.style("cursor",function(Te){return Te.dragHandle?"ew-resize":Te.calcdata.scrollbarState.barWiggleRoom?"ns-resize":"default"});var ae=fe.filter(L),ee=fe.filter(I);ne&&ee.call(i.behavior.drag().origin(function(Te){return i.event.stopPropagation(),Te}).on("drag",W(K,le,-1)).on("dragend",function(){})),x(K,le,ae,fe),x(K,le,ee,fe);var ie=le.selectAll("."+t.cn.scrollAreaClip).data(s.repeat,s.keyFun);ie.enter().append("clipPath").classed(t.cn.scrollAreaClip,!0).attr("id",function(Te){return m(K,Te)});var Q=ie.selectAll("."+t.cn.scrollAreaClipRect).data(s.repeat,s.keyFun);Q.enter().append("rect").classed(t.cn.scrollAreaClipRect,!0).attr("x",-t.overdrag).attr("y",-t.uplift).attr("fill","none"),Q.attr("width",function(Te){return Te.width+2*t.overdrag}).attr("height",function(Te){return Te.height+t.uplift});var ue=ye.selectAll("."+t.cn.columnBoundary).data(s.repeat,s.keyFun);ue.enter().append("g").classed(t.cn.columnBoundary,!0);var ge=ye.selectAll("."+t.cn.columnBoundaryClippath).data(s.repeat,s.keyFun);ge.enter().append("clipPath").classed(t.cn.columnBoundaryClippath,!0),ge.attr("id",function(Te){return y(K,Te)});var Me=ge.selectAll("."+t.cn.columnBoundaryRect).data(s.repeat,s.keyFun);Me.enter().append("rect").classed(t.cn.columnBoundaryRect,!0).attr("fill","none"),Me.attr("width",function(Te){return Te.columnWidth+2*g(Te)}).attr("height",function(Te){return Te.calcdata.height+2*g(Te)+t.uplift}).attr("x",function(Te){return-g(Te)}).attr("y",function(Te){return-g(Te)}),G(null,ee,le)};function g(Y){return Math.ceil(Y.calcdata.maxLineWidth/2)}function m(Y,K){return"clip"+Y._fullLayout._uid+"_scrollAreaBottomClip_"+K.key}function y(Y,K){return"clip"+Y._fullLayout._uid+"_columnBoundaryClippath_"+K.calcdata.key+"_"+K.specIndex}function _(Y){return[].concat.apply([],Y.map(function(K){return K})).map(function(K){return K.__data__})}function v(Y,K,te){function ne(ye){var fe=ye.rowBlocks;return $(fe,fe.length-1)+(fe.length?U(fe[fe.length-1],1/0):1)}var se=Y.selectAll("."+t.cn.scrollbarKit).data(s.repeat,s.keyFun);se.enter().append("g").classed(t.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),se.each(function(ye){var fe=ye.scrollbarState;fe.totalHeight=ne(ye),fe.scrollableAreaHeight=ye.groupHeight-B(ye),fe.currentlyVisibleHeight=Math.min(fe.totalHeight,fe.scrollableAreaHeight),fe.ratio=fe.currentlyVisibleHeight/fe.totalHeight,fe.barLength=Math.max(fe.ratio*fe.currentlyVisibleHeight,t.goldenRatio*t.scrollbarWidth),fe.barWiggleRoom=fe.currentlyVisibleHeight-fe.barLength,fe.wiggleRoom=Math.max(0,fe.totalHeight-fe.scrollableAreaHeight),fe.topY=fe.barWiggleRoom===0?0:ye.scrollY/fe.wiggleRoom*fe.barWiggleRoom,fe.bottomY=fe.topY+fe.barLength,fe.dragMultiplier=fe.wiggleRoom/fe.barWiggleRoom}).attr("transform",function(ye){var fe=ye.width+t.scrollbarWidth/2+t.scrollbarOffset;return c(fe,B(ye))});var le=se.selectAll("."+t.cn.scrollbar).data(s.repeat,s.keyFun);le.enter().append("g").classed(t.cn.scrollbar,!0);var ce=le.selectAll("."+t.cn.scrollbarSlider).data(s.repeat,s.keyFun);ce.enter().append("g").classed(t.cn.scrollbarSlider,!0),ce.attr("transform",function(ye){return c(0,ye.scrollbarState.topY||0)});var pe=ce.selectAll("."+t.cn.scrollbarGlyph).data(s.repeat,s.keyFun);pe.enter().append("line").classed(t.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",t.scrollbarWidth).attr("stroke-linecap","round").attr("y1",t.scrollbarWidth/2),pe.attr("y2",function(ye){return ye.scrollbarState.barLength-t.scrollbarWidth/2}).attr("stroke-opacity",function(ye){return ye.columnDragInProgress||!ye.scrollbarState.barWiggleRoom||te?0:.4}),pe.transition().delay(0).duration(0),pe.transition().delay(t.scrollbarHideDelay).duration(t.scrollbarHideDuration).attr("stroke-opacity",0);var xe=le.selectAll("."+t.cn.scrollbarCaptureZone).data(s.repeat,s.keyFun);xe.enter().append("line").classed(t.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",t.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(ye){var fe=i.event.y,ae=this.getBoundingClientRect(),ee=ye.scrollbarState,ie=fe-ae.top,Q=i.scale.linear().domain([0,ee.scrollableAreaHeight]).range([0,ee.totalHeight]).clamp(!0);ee.topY<=ie&&ie<=ee.bottomY||W(K,Y,null,Q(ie-ee.barLength/2))(ye)}).call(i.behavior.drag().origin(function(ye){return i.event.stopPropagation(),ye.scrollbarState.scrollbarScrollInProgress=!0,ye}).on("drag",W(K,Y)).on("dragend",function(){})),xe.attr("y2",function(ye){return ye.scrollbarState.scrollableAreaHeight}),K._context.staticPlot&&(pe.remove(),xe.remove())}function x(Y,K,te,ne){var se=S(te),le=M(se);A(le);var ce=C(le);E(ce);var pe=k(le),xe=w(pe);b(xe),T(xe,K,ne,Y),H(le)}function S(Y){var K=Y.selectAll("."+t.cn.columnCells).data(s.repeat,s.keyFun);return K.enter().append("g").classed(t.cn.columnCells,!0),K.exit().remove(),K}function M(Y){var K=Y.selectAll("."+t.cn.columnCell).data(d.splitToCells,function(te){return te.keyWithinBlock});return K.enter().append("g").classed(t.cn.columnCell,!0),K.exit().remove(),K}function C(Y){var K=Y.selectAll("."+t.cn.cellRect).data(s.repeat,function(te){return te.keyWithinBlock});return K.enter().append("rect").classed(t.cn.cellRect,!0),K}function w(Y){var K=Y.selectAll("."+t.cn.cellText).data(s.repeat,function(te){return te.keyWithinBlock});return K.enter().append("text").classed(t.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){i.event.stopPropagation()}),K}function k(Y){var K=Y.selectAll("."+t.cn.cellTextHolder).data(s.repeat,function(te){return te.keyWithinBlock});return K.enter().append("g").classed(t.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),K}function A(Y){Y.each(function(K,te){var ne=K.calcdata.cells.font,se=K.column.specIndex,le={size:P(ne.size,se,te),color:P(ne.color,se,te),family:P(ne.family,se,te),weight:P(ne.weight,se,te),style:P(ne.style,se,te),variant:P(ne.variant,se,te),textcase:P(ne.textcase,se,te),lineposition:P(ne.lineposition,se,te),shadow:P(ne.shadow,se,te)};K.rowNumber=K.key,K.align=P(K.calcdata.cells.align,se,te),K.cellBorderWidth=P(K.calcdata.cells.line.width,se,te),K.font=le})}function b(Y){Y.each(function(K){l.font(i.select(this),K.font)})}function E(Y){Y.attr("width",function(K){return K.column.columnWidth}).attr("stroke-width",function(K){return K.cellBorderWidth}).each(function(K){var te=i.select(this);p.stroke(te,P(K.calcdata.cells.line.color,K.column.specIndex,K.rowNumber)),p.fill(te,P(K.calcdata.cells.fill.color,K.column.specIndex,K.rowNumber))})}function T(Y,K,te,ne){Y.text(function(se){var le=se.column.specIndex,ce=se.rowNumber,pe=se.value,xe=typeof pe=="string",ye=xe&&pe.match(/
/i),fe=!xe||ye;se.mayHaveMarkup=xe&&pe.match(/[<&>]/);var ae=F(pe);se.latex=ae;var ee=ae?"":P(se.calcdata.cells.prefix,le,ce)||"",ie=ae?"":P(se.calcdata.cells.suffix,le,ce)||"",Q=ae?null:P(se.calcdata.cells.format,le,ce)||null,ue=ee+(Q?o(Q)(se.value):se.value)+ie,ge;se.wrappingNeeded=!se.wrapped&&!fe&&!ae&&(ge=D(ue)),se.cellHeightMayIncrease=ye||ae||se.mayHaveMarkup||(ge===void 0?D(ue):ge),se.needsConvertToTspans=se.mayHaveMarkup||se.wrappingNeeded||se.latex;var Me;if(se.wrappingNeeded){var Te=t.wrapSplitCharacter===" "?ue.replace(/se&&ne.push(le),se+=xe}return ne}function G(Y,K,te){var ne=_(K)[0];if(ne!==void 0){var se=ne.rowBlocks,le=ne.calcdata,ce=$(se,se.length),pe=ne.calcdata.groupHeight-B(ne),xe=le.scrollY=Math.max(0,Math.min(ce-pe,le.scrollY)),ye=O(se,xe,pe);ye.length===1&&(ye[0]===se.length-1?ye.unshift(ye[0]-1):ye.push(ye[0]+1)),ye[0]%2&&ye.reverse(),K.each(function(fe,ae){fe.page=ye[ae],fe.scrollY=xe}),K.attr("transform",function(fe){var ae=$(fe.rowBlocks,fe.page)-fe.scrollY;return c(0,ae)}),Y&&(X(Y,te,K,ye,ne.prevPages,ne,0),X(Y,te,K,ye,ne.prevPages,ne,1),v(te,Y))}}function W(Y,K,te,ne){return function(le){var ce=le.calcdata?le.calcdata:le,pe=K.filter(function(ae){return ce.key===ae.key}),xe=te||ce.scrollbarState.dragMultiplier,ye=ce.scrollY;ce.scrollY=ne===void 0?ce.scrollY+xe*i.event.dy:ne;var fe=pe.selectAll("."+t.cn.yColumn).selectAll("."+t.cn.columnBlock).filter(I);return G(Y,fe,pe),ce.scrollY===ye}}function X(Y,K,te,ne,se,le,ce){var pe=ne[ce]!==se[ce];pe&&(clearTimeout(le.currentRepaint[ce]),le.currentRepaint[ce]=setTimeout(function(){var xe=te.filter(function(ye,fe){return fe===ce&&ne[fe]!==se[fe]});x(Y,K,xe,te),se[ce]=ne[ce]}))}function Z(Y,K,te,ne){return function(){var le=i.select(K.parentNode);le.each(function(ce){var pe=ce.fragments;le.selectAll("tspan.line").each(function(ue,ge){pe[ge].width=this.getComputedTextLength()});var xe=pe[pe.length-1].width,ye=pe.slice(0,-1),fe=[],ae,ee,ie=0,Q=ce.column.columnWidth-2*t.cellPad;for(ce.value="";ye.length;)ae=ye.shift(),ee=ae.width+xe,ie+ee>Q&&(ce.value+=fe.join(t.wrapSpacer)+t.lineBreaker,fe=[],ie=0),fe.push(ae.text),ie+=ee;ie&&(ce.value+=fe.join(t.wrapSpacer)),ce.wrapped=!0}),le.selectAll("tspan.line").remove(),T(le.select("."+t.cn.cellText),te,Y,ne),i.select(K.parentNode.parentNode).call(H)}}function J(Y,K,te,ne,se){return function(){if(!se.settledY){var ce=i.select(K.parentNode),pe=j(se),xe=se.key-pe.firstRowIndex,ye=pe.rows[xe].rowHeight,fe=se.cellHeightMayIncrease?K.parentNode.getBoundingClientRect().height+2*t.cellPad:ye,ae=Math.max(fe,ye),ee=ae-pe.rows[xe].rowHeight;ee&&(pe.rows[xe].rowHeight=ae,Y.selectAll("."+t.cn.columnCell).call(H),G(null,Y.filter(I),0),v(te,ne,!0)),ce.attr("transform",function(){var ie=this,Q=ie.parentNode,ue=Q.getBoundingClientRect(),ge=i.select(ie.parentNode).select("."+t.cn.cellRect).node().getBoundingClientRect(),Me=ie.transform.baseVal.consolidate(),Te=ge.top-ue.top+(Me?Me.matrix.f:t.cellPad);return c(N(se,i.select(ie.parentNode).select("."+t.cn.cellTextHolder).node().getBoundingClientRect().width),Te)}),se.settledY=!0}}}function N(Y,K){switch(Y.align){case"left":return t.cellPad;case"right":return Y.column.columnWidth-(K||0)-t.cellPad;case"center":return(Y.column.columnWidth-(K||0))/2;default:return t.cellPad}}function H(Y){Y.attr("transform",function(K){var te=K.rowBlocks[0].auxiliaryBlocks.reduce(function(ce,pe){return ce+U(pe,1/0)},0),ne=j(K),se=U(ne,K.key),le=se+te;return c(0,le)}).selectAll("."+t.cn.cellRect).attr("height",function(K){return q(j(K),K.key).rowHeight})}function $(Y,K){for(var te=0,ne=K-1;ne>=0;ne--)te+=V(Y[ne]);return te}function U(Y,K){for(var te=0,ne=0;neo.length&&(a=a.slice(0,o.length)):a=[],l=0;l90&&(m-=180,f=-f),{angle:m,flip:f,p:i.c2p(s,a,o),offsetMultplier:h}}}}),qle=de({"src/traces/carpet/plot.js"(e,r){"use strict";var t=Yr(),i=hn(),a=Z8(),o=K8(),s=Ule(),l=Zo(),n=Qt(),u=n.strRotate,c=n.strTranslate,f=Bl();r.exports=function(x,S,M,C){var w=x._context.staticPlot,k=S.xaxis,A=S.yaxis,b=x._fullLayout,E=b._clips;n.makeTraceGroups(C,M,"trace").each(function(T){var F=t.select(this),D=T[0],R=D.trace,P=R.aaxis,z=R.baxis,I=n.ensureSingle(F,"g","minorlayer"),L=n.ensureSingle(F,"g","majorlayer"),B=n.ensureSingle(F,"g","boundarylayer"),O=n.ensureSingle(F,"g","labellayer");F.style("opacity",R.opacity),d(k,A,L,P,"a",P._gridlines,!0,w),d(k,A,L,z,"b",z._gridlines,!0,w),d(k,A,I,P,"a",P._minorgridlines,!0,w),d(k,A,I,z,"b",z._minorgridlines,!0,w),d(k,A,B,P,"a-boundary",P._boundarylines,w),d(k,A,B,z,"b-boundary",z._boundarylines,w);var G=p(x,k,A,R,D,O,P._labels,"a-label"),W=p(x,k,A,R,D,O,z._labels,"b-label");g(x,O,R,D,k,A,G,W),h(R,D,E,k,A)})};function h(v,x,S,M,C){var w,k,A,b,E=S.select("#"+v._clipPathId);E.size()||(E=S.append("clipPath").classed("carpetclip",!0));var T=n.ensureSingle(E,"path","carpetboundary"),F=x.clipsegments,D=[];for(b=0;b0?"start":"end","data-notex":1}).call(i.font,F.font).text(F.text).call(l.convertToTspans,v),L=i.bBox(this);I.attr("transform",c(R.p[0],R.p[1])+u(R.angle)+c(F.axis.labelpadding*z,L.height*.3)),E=Math.max(E,L.width+F.axis.labelpadding)}),b.exit().remove(),T.maxExtent=E,T}function g(v,x,S,M,C,w,k,A){var b,E,T,F,D=n.aggNums(Math.min,null,S.a),R=n.aggNums(Math.max,null,S.a),P=n.aggNums(Math.min,null,S.b),z=n.aggNums(Math.max,null,S.b);b=.5*(D+R),E=P,T=S.ab2xy(b,E,!0),F=S.dxyda_rough(b,E),k.angle===void 0&&n.extendFlat(k,s(S,C,w,T,S.dxydb_rough(b,E))),_(v,x,S,M,T,F,S.aaxis,C,w,k,"a-title"),b=D,E=.5*(P+z),T=S.ab2xy(b,E,!0),F=S.dxydb_rough(b,E),A.angle===void 0&&n.extendFlat(A,s(S,C,w,T,S.dxyda_rough(b,E))),_(v,x,S,M,T,F,S.baxis,C,w,A,"b-title")}var m=f.LINE_SPACING,y=(1-f.MID_SHIFT)/m+1;function _(v,x,S,M,C,w,k,A,b,E,T){var F=[];k.title.text&&F.push(k.title.text);var D=x.selectAll("text."+T).data(F),R=E.maxExtent;D.enter().append("text").classed(T,!0),D.each(function(){var P=s(S,A,b,C,w);["start","both"].indexOf(k.showticklabels)===-1&&(R=0);var z=k.title.font.size;R+=z+k.title.offset;var I=E.angle+(E.flip<0?180:0),L=(I-P.angle+450)%360,B=L>90&&L<270,O=t.select(this);O.text(k.title.text).call(l.convertToTspans,v),B&&(R=(-l.lineCount(O)+y)*m*z-R),O.attr("transform",c(P.p[0],P.p[1])+u(P.angle)+c(0,R)).attr("text-anchor","middle").call(i.font,k.title.font)}),D.exit().remove()}}}),Vle=de({"src/traces/carpet/cheater_basis.js"(e,r){"use strict";var t=Qt().isArrayOrTypedArray;r.exports=function(i,a,o){var s,l,n,u,c,f,h=[],d=t(i)?i.length:i,p=t(a)?a.length:a,g=t(i)?i:null,m=t(a)?a:null;g&&(n=(g.length-1)/(g[g.length-1]-g[0])/(d-1)),m&&(u=(m.length-1)/(m[m.length-1]-m[0])/(p-1));var y,_=1/0,v=-1/0;for(l=0;l=10)return null;for(var s=1/0,l=-1/0,n=a.length,u=0;u0&&(U=o.dxydi([],G-1,X,0,Z),Y.push(J[0]+U[0]/3),K.push(J[1]+U[1]/3),V=o.dxydi([],G-1,X,1,Z),Y.push($[0]-V[0]/3),K.push($[1]-V[1]/3)),Y.push($[0]),K.push($[1]),J=$;else for(G=o.a2i(O),N=Math.floor(Math.max(0,Math.min(P-2,G))),H=G-N,te.length=P,te.crossLength=z,te.xy=function(ne){return o.evalxy([],G,ne)},te.dxy=function(ne,se){return o.dxydj([],N,ne,H,se)},W=0;W0&&(j=o.dxydj([],N,W-1,H,0),Y.push(J[0]+j[0]/3),K.push(J[1]+j[1]/3),q=o.dxydj([],N,W-1,H,1),Y.push($[0]-q[0]/3),K.push($[1]-q[1]/3)),Y.push($[0]),K.push($[1]),J=$;return te.axisLetter=s,te.axis=C,te.crossAxis=E,te.value=O,te.constvar=l,te.index=g,te.x=Y,te.y=K,te.smoothing=E.smoothing,te}function B(O){var G,W,X,Z,J,N=[],H=[],$={};if($.length=M.length,$.crossLength=b.length,s==="b")for(X=Math.max(0,Math.min(z-2,O)),J=Math.min(1,Math.max(0,O-X)),$.xy=function(U){return o.evalxy([],U,O)},$.dxy=function(U,V){return o.dxydi([],U,X,V,J)},G=0;GM.length-1)&&w.push(i(B(u),{color:C.gridcolor,width:C.gridwidth,dash:C.griddash}));for(g=d;gM.length-1)&&!(_<0||_>M.length-1))for(v=M[c],x=M[_],n=0;nM[M.length-1])&&k.push(i(L(y),{color:C.minorgridcolor,width:C.minorgridwidth,dash:C.minorgriddash})));C.startline&&A.push(i(B(0),{color:C.startlinecolor,width:C.startlinewidth})),C.endline&&A.push(i(B(M.length-1),{color:C.endlinecolor,width:C.endlinewidth}))}else{for(f=5e-15,h=[Math.floor((M[M.length-1]-C.tick0)/C.dtick*(1+f)),Math.ceil((M[0]-C.tick0)/C.dtick/(1+f))].sort(function(O,G){return O-G}),d=h[0],p=h[1],g=d;g<=p;g++)m=C.tick0+C.dtick*g,w.push(i(L(m),{color:C.gridcolor,width:C.gridwidth,dash:C.griddash}));for(g=d-1;gM[M.length-1])&&k.push(i(L(y),{color:C.minorgridcolor,width:C.minorgridwidth,dash:C.minorgriddash}));C.startline&&A.push(i(L(M[0]),{color:C.startlinecolor,width:C.startlinewidth})),C.endline&&A.push(i(L(M[M.length-1]),{color:C.endlinecolor,width:C.endlinewidth}))}}}}),$le=de({"src/traces/carpet/calc_labels.js"(e,r){"use strict";var t=nn(),i=fn().extendFlat;r.exports=function(o,s){var l,n,u,c,f,h=s._labels=[],d=s._gridlines;for(l=0;l=0;l--)n[d-l]=i[p][l],u[d-l]=a[p][l];for(c.push({x:n,y:u,bicubic:f}),l=p,n=[],u=[];l>=0;l--)n[p-l]=i[l][0],u[p-l]=a[l][0];return c.push({x:n,y:u,bicubic:h}),c}}}),Yle=de({"src/traces/carpet/smooth_fill_2d_array.js"(e,r){"use strict";var t=Qt();r.exports=function(a,o,s){var l,n,u,c=[],f=[],h=a[0].length,d=a.length;function p(W,X){var Z=0,J,N=0;return W>0&&(J=a[X][W-1])!==void 0&&(N++,Z+=J),W0&&(J=a[X-1][W])!==void 0&&(N++,Z+=J),X0&&n0&&lb);return t.log("Smoother converged to",E,"after",F,"iterations"),a}}}),Xle=de({"src/traces/carpet/constants.js"(e,r){"use strict";r.exports={RELATIVE_CULL_TOLERANCE:1e-6}}}),Zle=de({"src/traces/carpet/catmull_rom.js"(e,r){"use strict";var t=.5;r.exports=function(a,o,s,l){var n=a[0]-o[0],u=a[1]-o[1],c=s[0]-o[0],f=s[1]-o[1],h=Math.pow(n*n+u*u,t/2),d=Math.pow(c*c+f*f,t/2),p=(d*d*n-h*h*c)*l,g=(d*d*u-h*h*f)*l,m=d*(h+d)*3,y=h*(h+d)*3;return[[o[0]+(m&&p/m),o[1]+(m&&g/m)],[o[0]-(y&&p/y),o[1]-(y&&g/y)]]}}}),Kle=de({"src/traces/carpet/compute_control_points.js"(e,r){"use strict";var t=Zle(),i=Qt().ensureArray;function a(o,s,l){var n=-.5*l[0]+1.5*s[0],u=-.5*l[1]+1.5*s[1];return[(2*n+o[0])/3,(2*u+o[1])/3]}r.exports=function(s,l,n,u,c,f){var h,d,p,g,m,y,_,v,x,S,M=n[0].length,C=n.length,w=c?3*M-2:M,k=f?3*C-2:C;for(s=i(s,k),l=i(l,k),p=0;pm&&w_&&ky||k<_||k>v},u.setScale=function(){var w=u._x,k=u._y,A=a(u._xctrl,u._yctrl,w,k,p.smoothing,g.smoothing);u._xctrl=A[0],u._yctrl=A[1],u.evalxy=o([u._xctrl,u._yctrl],h,d,p.smoothing,g.smoothing),u.dxydi=s([u._xctrl,u._yctrl],p.smoothing,g.smoothing),u.dxydj=l([u._xctrl,u._yctrl],p.smoothing,g.smoothing)},u.i2a=function(w){var k=Math.max(0,Math.floor(w[0]),h-2),A=w[0]-k;return(1-A)*c[k]+A*c[k+1]},u.j2b=function(w){var k=Math.max(0,Math.floor(w[1]),h-2),A=w[1]-k;return(1-A)*f[k]+A*f[k+1]},u.ij2ab=function(w){return[u.i2a(w[0]),u.j2b(w[1])]},u.a2i=function(w){var k=Math.max(0,Math.min(i(w,c),h-2)),A=c[k],b=c[k+1];return Math.max(0,Math.min(h-1,k+(w-A)/(b-A)))},u.b2j=function(w){var k=Math.max(0,Math.min(i(w,f),d-2)),A=f[k],b=f[k+1];return Math.max(0,Math.min(d-1,k+(w-A)/(b-A)))},u.ab2ij=function(w){return[u.a2i(w[0]),u.b2j(w[1])]},u.i2c=function(w,k){return u.evalxy([],w,k)},u.ab2xy=function(w,k,A){if(!A&&(wc[h-1]|kf[d-1]))return[!1,!1];var b=u.a2i(w),E=u.b2j(k),T=u.evalxy([],b,E);if(A){var F=0,D=0,R=[],P,z,I,L;wc[h-1]?(P=h-2,z=1,F=(w-c[h-1])/(c[h-1]-c[h-2])):(P=Math.max(0,Math.min(h-2,Math.floor(b))),z=b-P),kf[d-1]?(I=d-2,L=1,D=(k-f[d-1])/(f[d-1]-f[d-2])):(I=Math.max(0,Math.min(d-2,Math.floor(E))),L=E-I),F&&(u.dxydi(R,P,I,z,L),T[0]+=R[0]*F,T[1]+=R[1]*F),D&&(u.dxydj(R,P,I,z,L),T[0]+=R[0]*D,T[1]+=R[1]*D)}return T},u.c2p=function(w,k,A){return[k.c2p(w[0]),A.c2p(w[1])]},u.p2x=function(w,k,A){return[k.p2c(w[0]),A.p2c(w[1])]},u.dadi=function(w){var k=Math.max(0,Math.min(c.length-2,w));return c[k+1]-c[k]},u.dbdj=function(w){var k=Math.max(0,Math.min(f.length-2,w));return f[k+1]-f[k]},u.dxyda=function(w,k,A,b){var E=u.dxydi(null,w,k,A,b),T=u.dadi(w,A);return[E[0]/T,E[1]/T]},u.dxydb=function(w,k,A,b){var E=u.dxydj(null,w,k,A,b),T=u.dbdj(k,b);return[E[0]/T,E[1]/T]},u.dxyda_rough=function(w,k,A){var b=x*(A||.1),E=u.ab2xy(w+b,k,!0),T=u.ab2xy(w-b,k,!0);return[(E[0]-T[0])*.5/b,(E[1]-T[1])*.5/b]},u.dxydb_rough=function(w,k,A){var b=S*(A||.1),E=u.ab2xy(w,k+b,!0),T=u.ab2xy(w,k-b,!0);return[(E[0]-T[0])*.5/b,(E[1]-T[1])*.5/b]},u.dpdx=function(w){return w._m},u.dpdy=function(w){return w._m}}}}),rue=de({"src/traces/carpet/calc.js"(e,r){"use strict";var t=nn(),i=Qt().isArray1D,a=Vle(),o=Gle(),s=Hle(),l=$le(),n=Wle(),u=t3(),c=Yle(),f=e3(),h=tue();r.exports=function(p,g){var m=t.getFromId(p,g.xaxis),y=t.getFromId(p,g.yaxis),_=g.aaxis,v=g.baxis,x=g.x,S=g.y,M=[];x&&i(x)&&M.push("x"),S&&i(S)&&M.push("y"),M.length&&f(g,_,v,"a","b",M);var C=g._a=g._a||g.a,w=g._b=g._b||g.b;x=g._x||g.x,S=g._y||g.y;var k={};if(g._cheater){var A=_.cheatertype==="index"?C.length:C,b=v.cheatertype==="index"?w.length:w;x=a(A,b,g.cheaterslope)}g._x=x=u(x),g._y=S=u(S),c(x,C,w),c(S,C,w),h(g),g.setScale();var E=o(x),T=o(S),F=.5*(E[1]-E[0]),D=.5*(E[1]+E[0]),R=.5*(T[1]-T[0]),P=.5*(T[1]+T[0]),z=1.3;return E=[D-F*z,D+F*z],T=[P-R*z,P+R*z],g._extremes[m._id]=t.findExtremes(m,E,{padded:!0}),g._extremes[y._id]=t.findExtremes(y,T,{padded:!0}),s(g,"a","b"),s(g,"b","a"),l(g,_),l(g,v),k.clipsegments=n(g._xctrl,g._yctrl,_,v),k.x=x,k.y=S,k.a=C,k.b=w,[k]}}}),iue=de({"src/traces/carpet/index.js"(e,r){"use strict";r.exports={attributes:IS(),supplyDefaults:jle(),plot:qle(),calc:rue(),animatable:!0,isContainer:!0,moduleType:"trace",name:"carpet",basePlotModule:ml(),categories:["cartesian","svg","carpet","carpetAxis","notLegendIsolatable","noMultiCategory","noHover","noSortingByValue"],meta:{}}}}),aue=de({"lib/carpet.js"(e,r){"use strict";r.exports=iue()}}),J8=de({"src/traces/scattercarpet/attributes.js"(e,r){"use strict";var t=Kd(),i=tl(),a=ri(),{hovertemplateAttrs:o,texttemplateAttrs:s,templatefallbackAttrs:l}=Vo(),n=cs(),u=fn().extendFlat,c=i.marker,f=i.line,h=c.line;r.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:u({},i.mode,{dflt:"markers"}),text:u({},i.text,{}),texttemplate:s({editType:"plot"},{keys:["a","b","text"]}),texttemplatefallback:l({editType:"plot"}),hovertext:u({},i.hovertext,{}),line:{color:f.color,width:f.width,dash:f.dash,backoff:f.backoff,shape:u({},f.shape,{values:["linear","spline"]}),smoothing:f.smoothing,editType:"calc"},connectgaps:i.connectgaps,fill:u({},i.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:t(),marker:u({symbol:c.symbol,opacity:c.opacity,maxdisplayed:c.maxdisplayed,angle:c.angle,angleref:c.angleref,standoff:c.standoff,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,line:u({width:h.width,dash:h.dash,editType:"calc"},n("marker.line")),gradient:c.gradient,editType:"calc"},n("marker")),textfont:i.textfont,textposition:i.textposition,selected:i.selected,unselected:i.unselected,hoverinfo:u({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:i.hoveron,hovertemplate:o(),hovertemplatefallback:l(),zorder:i.zorder}}}),nue=de({"src/traces/scattercarpet/defaults.js"(e,r){"use strict";var t=Qt(),i=Zd(),a=bs(),o=Nh(),s=yd(),l=p1(),n=_d(),u=Jd(),c=J8();r.exports=function(h,d,p,g){function m(C,w){return t.coerce(h,d,c,C,w)}m("carpet"),d.xaxis="x",d.yaxis="y";var y=m("a"),_=m("b"),v=Math.min(y.length,_.length);if(!v){d.visible=!1;return}d._length=v,m("text"),m("texttemplate"),m("texttemplatefallback"),m("hovertext");var x=v0?k=C.labelprefix.replace(/ = $/,""):k=C._hovertitle,v.push(k+": "+w.toFixed(3)+C.labelsuffix)}if(!m.hovertemplate){var S=g.hi||m.hoverinfo,M=S.split("+");M.indexOf("all")!==-1&&(M=["a","b","text"]),M.indexOf("a")!==-1&&x(y.aaxis,g.a),M.indexOf("b")!==-1&&x(y.baxis,g.b),v.push("y: "+c.yLabel),M.indexOf("text")!==-1&&i(g,m,v),c.extraText=v.join("
")}return u}}}),cue=de({"src/traces/scattercarpet/event_data.js"(e,r){"use strict";r.exports=function(i,a,o,s,l){var n=s[l];return i.a=n.a,i.b=n.b,i.y=n.y,i}}}),fue=de({"src/traces/scattercarpet/index.js"(e,r){"use strict";r.exports={attributes:J8(),supplyDefaults:nue(),colorbar:Yu(),formatLabels:oue(),calc:sue(),plot:lue(),style:lf().style,styleOnSelect:lf().styleOnSelect,hoverPoints:uue(),selectPoints:Mv(),eventData:cue(),moduleType:"trace",name:"scattercarpet",basePlotModule:ml(),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}}}),hue=de({"lib/scattercarpet.js"(e,r){"use strict";r.exports=fue()}}),Q8=de({"src/traces/contourcarpet/attributes.js"(e,r){"use strict";var t=x1(),i=Vy(),a=cs(),o=fn().extendFlat,s=i.contours;r.exports=o({carpet:{valType:"string",editType:"calc"},z:t.z,a:t.x,a0:t.x0,da:t.dx,b:t.y,b0:t.y0,db:t.dy,text:t.text,hovertext:t.hovertext,transpose:t.transpose,atype:t.xtype,btype:t.ytype,fillcolor:i.fillcolor,autocontour:i.autocontour,ncontours:i.ncontours,contours:{type:s.type,start:s.start,end:s.end,size:s.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:s.showlines,showlabels:s.showlabels,labelfont:s.labelfont,labelformat:s.labelformat,operation:s.operation,value:s.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:i.line.color,width:i.line.width,dash:i.line.dash,smoothing:i.line.smoothing,editType:"plot"},zorder:i.zorder},a("",{cLetter:"z",autoColorDflt:!1}))}}),ej=de({"src/traces/contourcarpet/defaults.js"(e,r){"use strict";var t=Qt(),i=Qw(),a=Q8(),o=Hk(),s=d3(),l=p3();r.exports=function(u,c,f,h){function d(y,_){return t.coerce(u,c,a,y,_)}function p(y){return t.coerce2(u,c,a,y)}if(d("carpet"),u.a&&u.b){var g=i(u,c,d,h,"a","b");if(!g){c.visible=!1;return}d("text");var m=d("contours.type")==="constraint";m?o(u,c,d,h,f,{hasHover:!1}):(s(u,c,d,p),l(u,c,d,h,{hasHover:!1}))}else c._defaultColor=f,c._length=null;d("zorder")}}}),due=de({"src/traces/contourcarpet/calc.js"(e,r){"use strict";var t=hc(),i=Qt(),a=e3(),o=t3(),s=r3(),l=i3(),n=Ck(),u=ej(),c=RS(),f=zk();r.exports=function(p,g){var m=g._carpetTrace=c(p,g);if(!(!m||!m.visible||m.visible==="legendonly")){if(!g.a||!g.b){var y=p.data[m.index],_=p.data[g.index];_.a||(_.a=y.a),_.b||(_.b=y.b),u(_,g,g._defaultColor,p._fullLayout)}var v=h(p,g);return f(g,g._z),v}};function h(d,p){var g=p._carpetTrace,m=g.aaxis,y=g.baxis,_,v,x,S,M,C,w;m._minDtick=0,y._minDtick=0,i.isArray1D(p.z)&&a(p,m,y,"a","b",["z"]),_=p._a=p._a||p.a,S=p._b=p._b||p.b,_=_?m.makeCalcdata(p,"_a"):[],S=S?y.makeCalcdata(p,"_b"):[],v=p.a0||0,x=p.da||1,M=p.b0||0,C=p.db||1,w=p._z=o(p._z||p.z,p.transpose),p._emptypoints=l(w),s(w,p._emptypoints);var k=i.maxRowLength(w),A=p.xtype==="scaled"?"":_,b=n(p,A,v,x,k,m),E=p.ytype==="scaled"?"":S,T=n(p,E,M,C,w.length,y),F={a:b,b:T,z:w};return p.contours.type==="levels"&&p.contours.coloring!=="none"&&t(d,p,{vals:w,containerStr:"",cLetter:"z"}),[F]}}}),pue=de({"src/traces/carpet/axis_aligned_line.js"(e,r){"use strict";var t=Qt().isArrayOrTypedArray;r.exports=function(i,a,o,s){var l,n,u,c,f,h,d,p,g,m,y,_,v,x=t(o)?"a":"b",S=x==="a"?i.aaxis:i.baxis,M=S.smoothing,C=x==="a"?i.a2i:i.b2j,w=x==="a"?o:s,k=x==="a"?s:o,A=x==="a"?a.a.length:a.b.length,b=x==="a"?a.b.length:a.a.length,E=Math.floor(x==="a"?i.b2j(k):i.a2i(k)),T=x==="a"?function(X){return i.evalxy([],X,E)}:function(X){return i.evalxy([],E,X)};M&&(u=Math.max(0,Math.min(b-2,E)),c=E-u,n=x==="a"?function(X,Z){return i.dxydi([],X,u,Z,c)}:function(X,Z){return i.dxydj([],u,X,c,Z)});var F=C(w[0]),D=C(w[1]),R=F0?Math.floor:Math.ceil,I=R>0?Math.ceil:Math.floor,L=R>0?Math.min:Math.max,B=R>0?Math.max:Math.min,O=z(F+P),G=I(D-P);d=T(F);var W=[[d]];for(l=O;l*R=0;te--)q=B.clipsegments[te],Y=i([],q.x,F.c2p),K=i([],q.y,D.c2p),Y.reverse(),K.reverse(),ne.push(a(Y,K,q.bicubic));var se="M"+ne.join("L")+"Z";M(P,B.clipsegments,F,D,Z,N),C(I,P,F,D,j,$,H,L,B,N,se),y(P,X,A,z,W,b,L),o.setClipUrl(P,L._clipPathId,A)})};function m(k,A){var b,E,T,F,D,R,P,z,I;for(b=0;bX&&(E.max=X),E.len=E.max-E.min}function v(k,A,b){var E=k.getPointAtLength(A),T=k.getPointAtLength(b),F=T.x-E.x,D=T.y-E.y,R=Math.sqrt(F*F+D*D);return[F/R,D/R]}function x(k){var A=Math.sqrt(k[0]*k[0]+k[1]*k[1]);return[k[0]/A,k[1]/A]}function S(k,A){var b=Math.abs(k[0]*A[0]+k[1]*A[1]),E=Math.sqrt(1-b*b);return E/b}function M(k,A,b,E,T,F){var D,R,P,z,I=s.ensureSingle(k,"g","contourbg"),L=I.selectAll("path").data(F==="fill"&&!T?[0]:[]);L.enter().append("path"),L.exit().remove();var B=[];for(z=0;z=0&&(O=Y,W=X):Math.abs(B[1]-O[1])=0&&(O=Y,W=X):s.log("endpt to newendpt is not vert. or horz.",B,O,Y)}if(W>=0)break;z+=j(B,O),B=O}if(W===A.edgepaths.length){s.log("unclosed perimeter path");break}P=W,L=I.indexOf(P)===-1,L&&(P=I[0],z+=j(B,O)+"Z",B=null)}for(P=0;Pw):C=R>T,w=R;var P=m(T,F,D,R);P.pos=E,P.yc=(T+R)/2,P.i=b,P.dir=C?"increasing":"decreasing",P.x=P.pos,P.y=[D,F],k&&(P.orig_p=d[b]),S&&(P.tx=h.text[b]),M&&(P.htx=h.hovertext[b]),A.push(P)}else A.push({pos:E,empty:!0})}return h._extremes[g._id]=a.findExtremes(g,t.concat(v,_),{padded:!0}),A.length&&(A[0].t={labels:{open:i(f,"open:")+" ",high:i(f,"high:")+" ",low:i(f,"low:")+" ",close:i(f,"close:")+" "}}),A}function c(f,h,d){var p=d._minDiff;if(!p){var g=f._fullData,m=[];p=1/0;var y;for(y=0;y"+x.labels[E]+t.hoverLabelText(_,T,v.yhoverformat)):(D=i.extendFlat({},M),D.y0=D.y1=F,D.yLabelVal=T,D.yLabel=x.labels[E]+t.hoverLabelText(_,T,v.yhoverformat),D.name="",S.push(D),A[T]=D)}return S}function h(d,p,g,m){var y=d.cd,_=d.ya,v=y[0].trace,x=y[0].t,S=c(d,p,g,m);if(!S)return[];var M=S.index,C=y[M],w=S.index=C.i,k=C.dir;function A(P){return x.labels[P]+t.hoverLabelText(_,v[P][w],v.yhoverformat)}var b=C.hi||v.hoverinfo||"",E=b.split("+"),T=b==="all",F=T||E.indexOf("y")!==-1,D=T||E.indexOf("text")!==-1,R=F?[A("open"),A("high"),A("low"),A("close")+" "+n[k]]:[];return D&&s(C,v,R),S.extraText=R.join("
"),S.y0=S.y1=_.c2p(C.yc,!0),[S]}r.exports={hoverPoints:u,hoverSplit:f,hoverOnPoints:h}}}),aj=de({"src/traces/ohlc/select.js"(e,r){"use strict";r.exports=function(i,a){var o=i.cd,s=i.xaxis,l=i.yaxis,n=[],u,c=o[0].t.bPos||0;if(a===!1)for(u=0;up?function(v){return v<=0}:function(v){return v>=0};c.c2g=function(v){var x=c.c2l(v)-d;return(_(x)?x:0)+y},c.g2c=function(v){return c.l2c(v+d-y)},c.g2p=function(v){return v*m},c.c2p=function(v){return c.g2p(c.c2g(v))}}}function l(c,f){return f==="degrees"?a(c):c}function n(c,f){return f==="degrees"?o(c):c}function u(c,f){var h=c.type;if(h==="linear"){var d=c.d2c,p=c.c2d;c.d2c=function(g,m){return l(d(g),m)},c.c2d=function(g,m){return p(n(g,m))}}c.makeCalcdata=function(g,m){var y=g[m],_=g._length,v,x,S=function(A){return c.d2c(A,g.thetaunit)};if(y)for(v=new Array(_),x=0;x<_;x++)v[x]=S(y[x]);else{var M=m+"0",C="d"+m,w=M in g?S(g[M]):0,k=g[C]?S(g[C]):(c.period||2*Math.PI)/_;for(v=new Array(_),x=0;x<_;x++)v[x]=w+x*k}return v},c.setGeometry=function(){var g=f.sector,m=g.map(a),y={clockwise:-1,counterclockwise:1}[c.direction],_=a(c.rotation),v=function(b){return y*b+_},x=function(b){return(b-_)/y},S,M,C,w;switch(h){case"linear":M=S=t.identity,w=a,C=o,c.range=t.isFullCircle(m)?[g[0],g[0]+360]:m.map(x).map(o);break;case"category":var k=c._categories.length,A=c.period?Math.max(c.period,k):k;A===0&&(A=1),M=w=function(b){return b*2*Math.PI/A},S=C=function(b){return b*A/Math.PI/2},c.range=[0,A];break}c.c2g=function(b){return v(M(b))},c.g2c=function(b){return S(x(b))},c.t2g=function(b){return v(w(b))},c.g2t=function(b){return C(x(b))}}}}}),BS=de({"src/plots/polar/constants.js"(e,r){"use strict";r.exports={attr:"subplot",name:"polar",axisNames:["angularaxis","radialaxis"],axisName2dataArray:{angularaxis:"theta",radialaxis:"r"},layerNames:["draglayer","plotbg","backplot","angular-grid","radial-grid","frontplot","angular-line","radial-line","angular-axis","radial-axis"],radialDragBoxSize:50,angularDragBoxSize:30,cornerLen:25,cornerHalfWidth:2,MINDRAG:8,MINZOOM:20,OFFEDGE:20}}}),OS=de({"src/plots/polar/helpers.js"(e,r){"use strict";var t=Qt(),i=Fy().tester,a=t.findIndexOfMin,o=t.isAngleInsideSector,s=t.angleDelta,l=t.angleDist;function n(x,S,M,C,w){if(!o(S,C))return!1;var k,A;M[0]0?A:1/0},C=a(S,M),w=t.mod(C+1,S.length);return[S[C],S[w]]}function m(x){return Math.abs(x)>1e-10?x:0}function y(x,S,M){S=S||0,M=M||0;for(var C=x.length,w=new Array(C),k=0;k0?1:0}function i(n){var u=n[0],c=n[1];if(!isFinite(u)||!isFinite(c))return[1,0];var f=(u+1)*(u+1)+c*c;return[(u*u+c*c-1)/f,2*c/f]}function a(n,u){var c=u[0],f=u[1];return[c*n.radius+n.cx,-f*n.radius+n.cy]}function o(n,u){return u*n.radius}function s(n,u,c,f){var h=a(n,i([c,u])),d=h[0],p=h[1],g=a(n,i([f,u])),m=g[0],y=g[1];if(u===0)return["M"+d+","+p,"L"+m+","+y].join(" ");var _=o(n,1/Math.abs(u));return["M"+d+","+p,"A"+_+","+_+" 0 0,"+(u<0?1:0)+" "+m+","+y].join(" ")}function l(n,u,c,f){var h=o(n,1/(u+1)),d=a(n,i([u,c])),p=d[0],g=d[1],m=a(n,i([u,f])),y=m[0],_=m[1];if(t(c)!==t(f)){var v=a(n,i([u,0])),x=v[0],S=v[1];return["M"+p+","+g,"A"+h+","+h+" 0 0,"+(0pe?(xe=Y,ye=Y*pe,ee=(K-ye)/$.h/2,fe=[j[0],j[1]],ae=[q[0]+ee,q[1]-ee]):(xe=K/pe,ye=K,ee=(Y-xe)/$.w/2,fe=[j[0]+ee,j[1]-ee],ae=[q[0],q[1]]),N.xLength2=xe,N.yLength2=ye,N.xDomain2=fe,N.yDomain2=ae;var ie=N.xOffset2=$.l+$.w*fe[0],Q=N.yOffset2=$.t+$.h*(1-ae[1]),ue=N.radius=xe/se,ge=N.innerRadius=N.getHole(J)*ue,Me=N.cx=ie-ue*ne[0],Te=N.cy=Q+ue*ne[3],je=N.cxx=Me-ie,Ve=N.cyy=Te-Q,Ze=U.side,Ke;Ze==="counterclockwise"?(Ke=Ze,Ze="top"):Ze==="clockwise"&&(Ke=Ze,Ze="bottom"),N.radialAxis=N.mockAxis(Z,J,U,{_id:"x",side:Ze,_trueSide:Ke,domain:[ge/$.w,ue/$.w]}),N.angularAxis=N.mockAxis(Z,J,V,{side:"right",domain:[0,Math.PI],autorange:!1}),N.doAutoRange(Z,J),N.updateAngularAxis(Z,J),N.updateRadialAxis(Z,J),N.updateRadialAxisTitle(Z,J),N.xaxis=N.mockCartesianAxis(Z,J,{_id:"x",domain:fe}),N.yaxis=N.mockCartesianAxis(Z,J,{_id:"y",domain:ae});var vt=N.pathSubplot();N.clipPaths.forTraces.select("path").attr("d",vt).attr("transform",s(je,Ve)),H.frontplot.attr("transform",s(ie,Q)).call(n.setClipUrl,N._hasClipOnAxisFalse?null:N.clipIds.forTraces,N.gd),H.bg.attr("d",vt).attr("transform",s(Me,Te)).call(l.fill,J.bgcolor)},B.mockAxis=function(Z,J,N,H){var $=a.extendFlat({},N,H);return h($,J,Z),$},B.mockCartesianAxis=function(Z,J,N){var H=this,$=H.isSmith,U=N._id,V=a.extendFlat({type:"linear"},N);f(V,Z);var j={x:[0,2],y:[1,3]};return V.setRange=function(){var q=H.sectorBBox,Y=j[U],K=H.radialAxis._rl,te=(K[1]-K[0])/(1-H.getHole(J));V.range=[q[Y[0]]*te,q[Y[1]]*te]},V.isPtWithinRange=U==="x"&&!$?function(q){return H.isPtInside(q)}:function(){return!0},V.setRange(),V.setScale(),V},B.doAutoRange=function(Z,J){var N=this,H=N.gd,$=N.radialAxis,U=N.getRadial(J);d(H,$);var V=$.range;if(U.range=V.slice(),U._input.range=V.slice(),$._rl=[$.r2l(V[0],null,"gregorian"),$.r2l(V[1],null,"gregorian")],$.minallowed!==void 0){var j=$.r2l($.minallowed);$._rl[0]>$._rl[1]?$._rl[1]=Math.max($._rl[1],j):$._rl[0]=Math.max($._rl[0],j)}if($.maxallowed!==void 0){var q=$.r2l($.maxallowed);$._rl[0]<$._rl[1]?$._rl[1]=Math.min($._rl[1],q):$._rl[0]=Math.min($._rl[0],q)}},B.updateRadialAxis=function(Z,J){var N=this,H=N.gd,$=N.layers,U=N.radius,V=N.innerRadius,j=N.cx,q=N.cy,Y=N.getRadial(J),K=P(N.getSector(J)[0],360),te=N.radialAxis,ne=V90&&K<=270&&(te.tickangle=180);var le=se?function(ue){var ge=D(N,E([ue.x,0]));return s(ge[0]-j,ge[1]-q)}:function(ue){return s(te.l2p(ue.x)+V,0)},ce=se?function(ue){return F(N,ue.x,-1/0,1/0)}:function(ue){return N.pathArc(te.r2p(ue.x)+V)},pe=O(Y);if(N.radialTickLayout!==pe&&($["radial-axis"].selectAll(".xtick").remove(),N.radialTickLayout=pe),ne){te.setScale();var xe=0,ye=se?(te.tickvals||[]).filter(function(ue){return ue>=0}).map(function(ue){return c.tickText(te,ue,!0,!1)}):c.calcTicks(te),fe=se?ye:c.clipEnds(te,ye),ae=c.getTickSigns(te)[2];se&&((te.ticks==="top"&&te.side==="bottom"||te.ticks==="bottom"&&te.side==="top")&&(ae=-ae),te.ticks==="top"&&te.side==="top"&&(xe=-te.ticklen),te.ticks==="bottom"&&te.side==="bottom"&&(xe=te.ticklen)),c.drawTicks(H,te,{vals:ye,layer:$["radial-axis"],path:c.makeTickPath(te,0,ae),transFn:le,crisp:!1}),c.drawGrid(H,te,{vals:fe,layer:$["radial-grid"],path:ce,transFn:a.noop,crisp:!1}),c.drawLabels(H,te,{vals:ye,layer:$["radial-axis"],transFn:le,labelFns:c.makeLabelFns(te,xe)})}var ee=N.radialAxisAngle=N.vangles?I(W(z(Y.angle),N.vangles)):Y.angle,ie=s(j,q),Q=ie+o(-ee);X($["radial-axis"],ne&&(Y.showticklabels||Y.ticks),{transform:Q}),X($["radial-grid"],ne&&Y.showgrid,{transform:se?"":ie}),X($["radial-line"].select("line"),ne&&Y.showline,{x1:se?-U:V,y1:0,x2:U,y2:0,transform:Q}).attr("stroke-width",Y.linewidth).call(l.stroke,Y.linecolor)},B.updateRadialAxisTitle=function(Z,J,N){if(!this.isSmith){var H=this,$=H.gd,U=H.radius,V=H.cx,j=H.cy,q=H.getRadial(J),Y=H.id+"title",K=0;if(q.title){var te=n.bBox(H.layers["radial-axis"].node()).height,ne=q.title.font.size,se=q.side;K=se==="top"?ne:se==="counterclockwise"?-(te+ne*.4):te+ne*.8}var le=N!==void 0?N:H.radialAxisAngle,ce=z(le),pe=Math.cos(ce),xe=Math.sin(ce),ye=V+U/2*pe+K*xe,fe=j-U/2*xe+K*pe;H.layers["radial-axis-title"]=y.draw($,Y,{propContainer:q,propName:H.id+".radialaxis.title.text",placeholder:R($,"Click to enter radial axis title"),attributes:{x:ye,y:fe,"text-anchor":"middle"},transform:{rotate:-le}})}},B.updateAngularAxis=function(Z,J){var N=this,H=N.gd,$=N.layers,U=N.radius,V=N.innerRadius,j=N.cx,q=N.cy,Y=N.getAngular(J),K=N.angularAxis,te=N.isSmith;te||(N.fillViewInitialKey("angularaxis.rotation",Y.rotation),K.setGeometry(),K.setScale());var ne=te?function(ge){var Me=D(N,E([0,ge.x]));return Math.atan2(Me[0]-j,Me[1]-q)-Math.PI/2}:function(ge){return K.t2g(ge.x)};K.type==="linear"&&K.thetaunit==="radians"&&(K.tick0=I(K.tick0),K.dtick=I(K.dtick));var se=function(ge){return s(j+U*Math.cos(ge),q-U*Math.sin(ge))},le=te?function(ge){var Me=D(N,E([0,ge.x]));return s(Me[0],Me[1])}:function(ge){return se(ne(ge))},ce=te?function(ge){var Me=D(N,E([0,ge.x])),Te=Math.atan2(Me[0]-j,Me[1]-q)-Math.PI/2;return s(Me[0],Me[1])+o(-I(Te))}:function(ge){var Me=ne(ge);return se(Me)+o(-I(Me))},pe=te?function(ge){return T(N,ge.x,0,1/0)}:function(ge){var Me=ne(ge),Te=Math.cos(Me),je=Math.sin(Me);return"M"+[j+V*Te,q-V*je]+"L"+[j+U*Te,q-U*je]},xe=c.makeLabelFns(K,0),ye=xe.labelStandoff,fe={};fe.xFn=function(ge){var Me=ne(ge);return Math.cos(Me)*ye},fe.yFn=function(ge){var Me=ne(ge),Te=Math.sin(Me)>0?.2:1;return-Math.sin(Me)*(ye+ge.fontSize*Te)+Math.abs(Math.cos(Me))*(ge.fontSize*w)},fe.anchorFn=function(ge){var Me=ne(ge),Te=Math.cos(Me);return Math.abs(Te)<.1?"middle":Te>0?"start":"end"},fe.heightFn=function(ge,Me,Te){var je=ne(ge);return-.5*(1+Math.sin(je))*Te};var ae=O(Y);N.angularTickLayout!==ae&&($["angular-axis"].selectAll("."+K._id+"tick").remove(),N.angularTickLayout=ae);var ee=te?[1/0].concat(K.tickvals||[]).map(function(ge){return c.tickText(K,ge,!0,!1)}):c.calcTicks(K);te&&(ee[0].text="\u221E",ee[0].fontSize*=1.75);var ie;if(J.gridshape==="linear"?(ie=ee.map(ne),a.angleDelta(ie[0],ie[1])<0&&(ie=ie.slice().reverse())):ie=null,N.vangles=ie,K.type==="category"&&(ee=ee.filter(function(ge){return a.isAngleInsideSector(ne(ge),N.sectorInRad)})),K.visible){var Q=K.ticks==="inside"?-1:1,ue=(K.linewidth||1)/2;c.drawTicks(H,K,{vals:ee,layer:$["angular-axis"],path:"M"+Q*ue+",0h"+Q*K.ticklen,transFn:ce,crisp:!1}),c.drawGrid(H,K,{vals:ee,layer:$["angular-grid"],path:pe,transFn:a.noop,crisp:!1}),c.drawLabels(H,K,{vals:ee,layer:$["angular-axis"],repositionOnUpdate:!0,transFn:le,labelFns:fe})}X($["angular-line"].select("path"),Y.showline,{d:N.pathSubplot(),transform:s(j,q)}).attr("stroke-width",Y.linewidth).call(l.stroke,Y.linecolor)},B.updateFx=function(Z,J){if(!this.gd._context.staticPlot){var N=!this.isSmith;N&&(this.updateAngularDrag(Z),this.updateRadialDrag(Z,J,0),this.updateRadialDrag(Z,J,1)),this.updateHoverAndMainDrag(Z)}},B.updateHoverAndMainDrag=function(Z){var J=this,N=J.isSmith,H=J.gd,$=J.layers,U=Z._zoomlayer,V=k.MINZOOM,j=k.OFFEDGE,q=J.radius,Y=J.innerRadius,K=J.cx,te=J.cy,ne=J.cxx,se=J.cyy,le=J.sectorInRad,ce=J.vangles,pe=J.radialAxis,xe=A.clampTiny,ye=A.findXYatLength,fe=A.findEnclosingVertexAngles,ae=k.cornerHalfWidth,ee=k.cornerLen/2,ie,Q,ue=p.makeDragger($,"path","maindrag",Z.dragmode===!1?"none":"crosshair");t.select(ue).attr("d",J.pathSubplot()).attr("transform",s(K,te)),ue.onmousemove=function(ft){m.hover(H,ft,J.id),H._fullLayout._lasthover=ue,H._fullLayout._hoversubplot=J.id},ue.onmouseout=function(ft){H._dragging||g.unhover(H,ft)};var ge={element:ue,gd:H,subplot:J.id,plotinfo:{id:J.id,xaxis:J.xaxis,yaxis:J.yaxis},xaxes:[J.xaxis],yaxes:[J.yaxis]},Me,Te,je,Ve,Ze,Ke,vt,xt,Pt;function mt(ft,At){return Math.sqrt(ft*ft+At*At)}function Mt(ft,At){return mt(ft-ne,At-se)}function lt(ft,At){return Math.atan2(se-At,ft-ne)}function qe(ft,At){return[ft*Math.cos(At),ft*Math.sin(-At)]}function Ye(ft,At){if(ft===0)return J.pathSector(2*ae);var ht=ee/ft,Gt=At-ht,fr=At+ht,gt=Math.max(0,Math.min(ft,q)),yt=gt-ae,kt=gt+ae;return"M"+qe(yt,Gt)+"A"+[yt,yt]+" 0,0,0 "+qe(yt,fr)+"L"+qe(kt,fr)+"A"+[kt,kt]+" 0,0,1 "+qe(kt,Gt)+"Z"}function me(ft,At,ht){if(ft===0)return J.pathSector(2*ae);var Gt=qe(ft,At),fr=qe(ft,ht),gt=xe((Gt[0]+fr[0])/2),yt=xe((Gt[1]+fr[1])/2),kt,Lt;if(gt&&yt){var Ct=yt/gt,$t=-1/Ct,mr=ye(ae,Ct,gt,yt);kt=ye(ee,$t,mr[0][0],mr[0][1]),Lt=ye(ee,$t,mr[1][0],mr[1][1])}else{var br,Er;yt?(br=ee,Er=ae):(br=ae,Er=ee),kt=[[gt-br,yt-Er],[gt+br,yt-Er]],Lt=[[gt-br,yt+Er],[gt+br,yt+Er]]}return"M"+kt.join("L")+"L"+Lt.reverse().join("L")+"Z"}function _e(){je=null,Ve=null,Ze=J.pathSubplot(),Ke=!1;var ft=H._fullLayout[J.id];vt=l.luminosity(ft.bgcolor),xt=p.makeZoombox(U,vt,K,te,Ze),xt.attr("fill-rule","evenodd"),Pt=p.makeCorners(U,K,te),x(H)}function Ae(ft,At){return At=Math.max(Math.min(At,q),Y),ftV?(ft-1&&ft===1&&v(At,H,[J.xaxis],[J.yaxis],J.id,ge),ht.indexOf("event")>-1&&m.click(H,At,J.id)}ge.prepFn=function(ft,At,ht){var Gt=H._fullLayout.dragmode,fr=ue.getBoundingClientRect();H._fullLayout._calcInverseTransform(H);var gt=H._fullLayout._invTransform;ie=H._fullLayout._invScaleX,Q=H._fullLayout._invScaleY;var yt=a.apply3DTransform(gt)(At-fr.left,ht-fr.top);if(Me=yt[0],Te=yt[1],ce){var kt=A.findPolygonOffset(q,le[0],le[1],ce);Me+=ne+kt[0],Te+=se+kt[1]}switch(Gt){case"zoom":ge.clickFn=rt,N||(ce?ge.moveFn=Je:ge.moveFn=Ee,ge.doneFn=Ue,_e(ft,At,ht));break;case"select":case"lasso":_(ft,At,ht,ge,Gt);break}},g.init(ge)},B.updateRadialDrag=function(Z,J,N){var H=this,$=H.gd,U=H.layers,V=H.radius,j=H.innerRadius,q=H.cx,Y=H.cy,K=H.radialAxis,te=k.radialDragBoxSize,ne=te/2;if(!K.visible)return;var se=z(H.radialAxisAngle),le=K._rl,ce=le[0],pe=le[1],xe=le[N],ye=.75*(le[1]-le[0])/(1-H.getHole(J))/V,fe,ae,ee;N?(fe=q+(V+ne)*Math.cos(se),ae=Y-(V+ne)*Math.sin(se),ee="radialdrag"):(fe=q+(j-ne)*Math.cos(se),ae=Y-(j-ne)*Math.sin(se),ee="radialdrag-inner");var ie=p.makeRectDragger(U,ee,"crosshair",-ne,-ne,te,te),Q={element:ie,gd:$};Z.dragmode===!1&&(Q.dragmode=!1),X(t.select(ie),K.visible&&j0!=(N?Me>ce:Me=90||$>90&&U>=450?se=1:j<=0&&Y<=0?se=0:se=Math.max(j,Y),$<=180&&U>=180||$>180&&U>=540?K=-1:V>=0&&q>=0?K=0:K=Math.min(V,q),$<=270&&U>=270||$>270&&U>=630?te=-1:j>=0&&Y>=0?te=0:te=Math.min(j,Y),U>=360?ne=1:V<=0&&q<=0?ne=0:ne=Math.max(V,q),[K,te,ne,se]}function W(Z,J){var N=function($){return a.angleDist(Z,$)},H=a.findIndexOfMin(J,N);return J[H]}function X(Z,J,N){return J?(Z.attr("display",null),Z.attr(N)):Z&&Z.attr("display","none"),Z}}}),uj=de({"src/plots/polar/layout_attributes.js"(e,r){"use strict";var t=Jo(),i=Mu(),a=Is().attributes,o=Qt().extendFlat,s=Ps().overrideAll,l=s({color:i.color,showline:o({},i.showline,{dflt:!0}),linecolor:i.linecolor,linewidth:i.linewidth,showgrid:o({},i.showgrid,{dflt:!0}),gridcolor:i.gridcolor,gridwidth:i.gridwidth,griddash:i.griddash},"plot","from-root"),n=s({tickmode:i.minor.tickmode,nticks:i.nticks,tick0:i.tick0,dtick:i.dtick,tickvals:i.tickvals,ticktext:i.ticktext,ticks:i.ticks,ticklen:i.ticklen,tickwidth:i.tickwidth,tickcolor:i.tickcolor,ticklabelstep:i.ticklabelstep,showticklabels:i.showticklabels,labelalias:i.labelalias,minorloglabels:i.minorloglabels,showtickprefix:i.showtickprefix,tickprefix:i.tickprefix,showticksuffix:i.showticksuffix,ticksuffix:i.ticksuffix,showexponent:i.showexponent,exponentformat:i.exponentformat,minexponent:i.minexponent,separatethousands:i.separatethousands,tickfont:i.tickfont,tickangle:i.tickangle,tickformat:i.tickformat,tickformatstops:i.tickformatstops,layer:i.layer},"plot","from-root"),u={visible:o({},i.visible,{dflt:!0}),type:o({},i.type,{values:["-","linear","log","date","category"]}),autotypenumbers:i.autotypenumbers,autorangeoptions:{minallowed:i.autorangeoptions.minallowed,maxallowed:i.autorangeoptions.maxallowed,clipmin:i.autorangeoptions.clipmin,clipmax:i.autorangeoptions.clipmax,include:i.autorangeoptions.include,editType:"plot"},autorange:o({},i.autorange,{editType:"plot"}),rangemode:{valType:"enumerated",values:["tozero","nonnegative","normal"],dflt:"tozero",editType:"calc"},minallowed:o({},i.minallowed,{editType:"plot"}),maxallowed:o({},i.maxallowed,{editType:"plot"}),range:o({},i.range,{items:[{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}}],editType:"plot"}),categoryorder:i.categoryorder,categoryarray:i.categoryarray,angle:{valType:"angle",editType:"plot"},autotickangles:i.autotickangles,side:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"clockwise",editType:"plot"},title:{text:o({},i.title.text,{editType:"plot",dflt:""}),font:o({},i.title.font,{editType:"plot"}),editType:"plot"},hoverformat:i.hoverformat,uirevision:{valType:"any",editType:"none"},editType:"calc"};o(u,l,n);var c={visible:o({},i.visible,{dflt:!0}),type:{valType:"enumerated",values:["-","linear","category"],dflt:"-",editType:"calc",_noTemplating:!0},autotypenumbers:i.autotypenumbers,categoryorder:i.categoryorder,categoryarray:i.categoryarray,thetaunit:{valType:"enumerated",values:["radians","degrees"],dflt:"degrees",editType:"calc"},period:{valType:"number",editType:"calc",min:0},direction:{valType:"enumerated",values:["counterclockwise","clockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"angle",editType:"calc"},hoverformat:i.hoverformat,uirevision:{valType:"any",editType:"none"},editType:"calc"};o(c,l,n),r.exports={domain:a({name:"polar",editType:"plot"}),sector:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],dflt:[0,360],editType:"plot"},hole:{valType:"number",min:0,max:1,dflt:0,editType:"plot"},bgcolor:{valType:"color",editType:"plot",dflt:t.background},radialaxis:u,angularaxis:c,gridshape:{valType:"enumerated",values:["circular","linear"],dflt:"circular",editType:"plot"},uirevision:{valType:"any",editType:"none"},editType:"calc"}}}),Eue=de({"src/plots/polar/layout_defaults.js"(e,r){"use strict";var t=Qt(),i=ta(),a=Ro(),o=Ev(),s=$u().getSubplotData,l=_v(),n=f1(),u=h0(),c=d0(),f=Ow(),h=Ry(),d=LE(),p=h1(),g=uj(),m=oj(),y=BS(),_=y.axisNames;function v(S,M,C,w){var k=C("bgcolor");w.bgColor=i.combine(k,w.paper_bgcolor);var A=C("sector");C("hole");var b=s(w.fullData,y.name,w.id),E=w.layoutOut,T;function F(ne,se){return C(T+"."+ne,se)}for(var D=0;D<_.length;D++){T=_[D],t.isPlainObject(S[T])||(S[T]={});var R=S[T],P=a.newContainer(M,T);P._id=P._name=T,P._attr=w.id+"."+T,P._traceIndices=b.map(function(ne){return ne.index});var z=y.axisName2dataArray[T],I=x(R,P,F,b,z,w);f(R,P,F,{axData:b,dataAttr:z});var L=F("visible");switch(m(P,M,E),F("uirevision",M.uirevision),P._m=1,T){case"radialaxis":F("minallowed"),F("maxallowed");var B=F("range"),O=P.getAutorangeDflt(B),G=F("autorange",O),W;B&&(B[0]===null&&B[1]===null||(B[0]===null||B[1]===null)&&(G==="reversed"||G===!0)||B[0]!==null&&(G==="min"||G==="max reversed")||B[1]!==null&&(G==="max"||G==="min reversed"))&&(B=void 0,delete P.range,P.autorange=!0,W=!0),W||(O=P.getAutorangeDflt(B),G=F("autorange",O)),R.autorange=G,G&&(d(F,G,B),(I==="linear"||I==="-")&&F("rangemode"),P.isReversed()&&(P._m=-1)),P.cleanRange("range",{dfltRange:[0,1]});break;case"angularaxis":if(I==="date"){t.log("Polar plots do not support date angular axes yet.");for(var X=0;X")}}r.exports={hoverPoints:i,makeHoverPointText:a}}}),Due=de({"src/traces/scatterpolar/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:NS(),categories:["polar","symbols","showLegend","scatter-like"],attributes:W2(),supplyDefaults:jS().supplyDefaults,colorbar:Yu(),formatLabels:US(),calc:kue(),plot:Cue(),style:lf().style,styleOnSelect:lf().styleOnSelect,hoverPoints:qS().hoverPoints,selectPoints:Mv(),meta:{}}}}),Lue=de({"lib/scatterpolar.js"(e,r){"use strict";r.exports=Due()}}),cj=de({"src/traces/scatterpolargl/attributes.js"(e,r){"use strict";var t=W2(),{cliponaxis:i,hoveron:a}=t,o=Lr(t,["cliponaxis","hoveron"]),{connectgaps:s,line:{color:l,dash:n,width:u},fill:c,fillcolor:f,marker:h,textfont:d,textposition:p}=__();r.exports=ar(Ot({},o),{connectgaps:s,fill:c,fillcolor:f,line:{color:l,dash:n,editType:"calc",width:u},marker:h,textfont:d,textposition:p})}}),Fue=de({"src/traces/scatterpolargl/defaults.js"(e,r){"use strict";var t=Qt(),i=bs(),a=jS().handleRThetaDefaults,o=Nh(),s=yd(),l=_d(),n=Jd(),u=Zd().PTS_LINESONLY,c=cj();r.exports=function(h,d,p,g){function m(_,v){return t.coerce(h,d,c,_,v)}var y=a(h,d,g,m);if(!y){d.visible=!1;return}m("thetaunit"),m("mode",y=n&&(w.marker.cluster=x.tree),w.marker&&(w.markerSel.positions=w.markerUnsel.positions=w.marker.positions=E),w.line&&E.length>1&&l.extendFlat(w.line,s.linePositions(f,v,E)),w.text&&(l.extendFlat(w.text,{positions:E},s.textPosition(f,v,w.text,w.marker)),l.extendFlat(w.textSel,{positions:E},s.textPosition(f,v,w.text,w.markerSel)),l.extendFlat(w.textUnsel,{positions:E},s.textPosition(f,v,w.text,w.markerUnsel))),w.fill&&!m.fill2d&&(m.fill2d=!0),w.marker&&!m.scatter2d&&(m.scatter2d=!0),w.line&&!m.line2d&&(m.line2d=!0),w.text&&!m.glText&&(m.glText=!0),m.lineOptions.push(w.line),m.fillOptions.push(w.fill),m.markerOptions.push(w.marker),m.markerSelectedOptions.push(w.markerSel),m.markerUnselectedOptions.push(w.markerUnsel),m.textOptions.push(w.text),m.textSelectedOptions.push(w.textSel),m.textUnselectedOptions.push(w.textUnsel),m.selectBatch.push([]),m.unselectBatch.push([]),x.x=T,x.y=F,x.rawx=T,x.rawy=F,x.r=M,x.theta=C,x.positions=E,x._scene=m,x.index=m.count,m.count++}}),a(f,h,d)}},r.exports.reglPrecompiled=u}}),Oue=de({"src/traces/scatterpolargl/index.js"(e,r){"use strict";var t=zue();t.plot=Bue(),r.exports=t}}),Nue=de({"lib/scatterpolargl.js"(e,r){"use strict";r.exports=Oue()}}),fj=de({"src/traces/barpolar/attributes.js"(e,r){"use strict";var{hovertemplateAttrs:t,templatefallbackAttrs:i}=Vo(),a=fn().extendFlat,o=W2(),s=ep();r.exports={r:o.r,theta:o.theta,r0:o.r0,dr:o.dr,theta0:o.theta0,dtheta:o.dtheta,thetaunit:o.thetaunit,base:a({},s.base,{}),offset:a({},s.offset,{}),width:a({},s.width,{}),text:a({},s.text,{}),hovertext:a({},s.hovertext,{}),marker:l(),hoverinfo:o.hoverinfo,hovertemplate:t(),hovertemplatefallback:i(),selected:s.selected,unselected:s.unselected};function l(){var n=a({},s.marker);return delete n.cornerradius,n}}}),hj=de({"src/traces/barpolar/layout_attributes.js"(e,r){"use strict";r.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}}}),jue=de({"src/traces/barpolar/defaults.js"(e,r){"use strict";var t=Qt(),i=jS().handleRThetaDefaults,a=Ww(),o=fj();r.exports=function(l,n,u,c){function f(d,p){return t.coerce(l,n,o,d,p)}var h=i(l,n,c,f);if(!h){n.visible=!1;return}f("thetaunit"),f("base"),f("offset"),f("width"),f("text"),f("hovertext"),f("hovertemplate"),f("hovertemplatefallback"),a(l,n,f,u,c),t.coerceSelectionMarkerOpacity(n,f)}}}),Uue=de({"src/traces/barpolar/layout_defaults.js"(e,r){"use strict";var t=Qt(),i=hj();r.exports=function(a,o,s){var l={},n;function u(h,d){return t.coerce(a[n]||{},o[n],i,h,d)}for(var c=0;c0?(g=d,m=p):(g=p,m=d);var y=s.findEnclosingVertexAngles(g,n.vangles)[0],_=s.findEnclosingVertexAngles(m,n.vangles)[1],v=[y,(g+m)/2,_];return s.pathPolygonAnnulus(f,h,g,m,v,u,c)}:function(f,h,d,p){return a.pathAnnulus(f,h,d,p,u,c)}}}}),Vue=de({"src/traces/barpolar/hover.js"(e,r){"use strict";var t=$s(),i=Qt(),a=y1().getTraceColor,o=i.fillText,s=qS().makeHoverPointText,l=OS().isPtInsidePolygon;r.exports=function(u,c,f){var h=u.cd,d=h[0].trace,p=u.subplot,g=p.radialAxis,m=p.angularAxis,y=p.vangles,_=y?l:i.isPtInsideSector,v=u.maxHoverDistance,x=m._period||2*Math.PI,S=Math.abs(g.g2p(Math.sqrt(c*c+f*f))),M=Math.atan2(f,c);g.range[0]>g.range[1]&&(M+=Math.PI);var C=function(b){return _(S,M,[b.rp0,b.rp1],[b.thetag0,b.thetag1],y)?v+Math.min(1,Math.abs(b.thetag1-b.thetag0)/x)-1+(b.rp1-S)/(b.rp1-b.rp0)-1:1/0};if(t.getClosest(h,C,u),u.index!==!1){var w=u.index,k=h[w];u.x0=u.x1=k.ct[0],u.y0=u.y1=k.ct[1];var A=i.extendFlat({},k,{r:k.s,theta:k.p});return o(k,d,u),s(A,d,p,u),u.hovertemplate=d.hovertemplate,u.color=a(d,k),u.xLabelVal=u.yLabelVal=void 0,k.s<0&&(u.idealAlign="left"),[u]}}}}),Gue=de({"src/traces/barpolar/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"barpolar",basePlotModule:NS(),categories:["polar","bar","showLegend"],attributes:fj(),layoutAttributes:hj(),supplyDefaults:jue(),supplyLayoutDefaults:Uue(),calc:dj().calc,crossTraceCalc:dj().crossTraceCalc,plot:que(),colorbar:Yu(),formatLabels:US(),style:qh().style,styleOnSelect:qh().styleOnSelect,hoverPoints:Vue(),selectPoints:_1(),meta:{}}}}),Hue=de({"lib/barpolar.js"(e,r){"use strict";r.exports=Gue()}}),pj=de({"src/plots/smith/constants.js"(e,r){"use strict";r.exports={attr:"subplot",name:"smith",axisNames:["realaxis","imaginaryaxis"],axisName2dataArray:{imaginaryaxis:"imag",realaxis:"real"}}}}),vj=de({"src/plots/smith/layout_attributes.js"(e,r){"use strict";var t=Jo(),i=Mu(),a=Is().attributes,o=Qt().extendFlat,s=Ps().overrideAll,l=s({color:i.color,showline:o({},i.showline,{dflt:!0}),linecolor:i.linecolor,linewidth:i.linewidth,showgrid:o({},i.showgrid,{dflt:!0}),gridcolor:i.gridcolor,gridwidth:i.gridwidth,griddash:i.griddash},"plot","from-root"),n=s({ticklen:i.ticklen,tickwidth:o({},i.tickwidth,{dflt:2}),tickcolor:i.tickcolor,showticklabels:i.showticklabels,labelalias:i.labelalias,showtickprefix:i.showtickprefix,tickprefix:i.tickprefix,showticksuffix:i.showticksuffix,ticksuffix:i.ticksuffix,tickfont:i.tickfont,tickformat:i.tickformat,hoverformat:i.hoverformat,layer:i.layer},"plot","from-root"),u=o({visible:o({},i.visible,{dflt:!0}),tickvals:{dflt:[.2,.5,1,2,5],valType:"data_array",editType:"plot"},tickangle:o({},i.tickangle,{dflt:90}),ticks:{valType:"enumerated",values:["top","bottom",""],editType:"ticks"},side:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},editType:"calc"},l,n),c=o({visible:o({},i.visible,{dflt:!0}),tickvals:{valType:"data_array",editType:"plot"},ticks:i.ticks,editType:"calc"},l,n);r.exports={domain:a({name:"smith",editType:"plot"}),bgcolor:{valType:"color",editType:"plot",dflt:t.background},realaxis:u,imaginaryaxis:c,editType:"calc"}}}),$ue=de({"src/plots/smith/layout_defaults.js"(e,r){"use strict";var t=Qt(),i=ta(),a=Ro(),o=Ev(),s=$u().getSubplotData,l=d0(),n=h0(),u=Ry(),c=Yd(),f=vj(),h=pj(),d=h.axisNames,p=m(function(y){return t.isTypedArray(y)&&(y=Array.from(y)),y.slice().reverse().map(function(_){return-_}).concat([0]).concat(y)},String);function g(y,_,v,x){var S=v("bgcolor");x.bgColor=i.combine(S,x.paper_bgcolor);var M=s(x.fullData,h.name,x.id),C=x.layoutOut,w;function k(O,G){return v(w+"."+O,G)}for(var A=0;A")}}r.exports={hoverPoints:i,makeHoverPointText:a}}}),Que=de({"src/traces/scattersmith/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"scattersmith",basePlotModule:Wue(),categories:["smith","symbols","showLegend","scatter-like"],attributes:mj(),supplyDefaults:Yue(),colorbar:Yu(),formatLabels:Xue(),calc:Zue(),plot:Kue(),style:lf().style,styleOnSelect:lf().styleOnSelect,hoverPoints:Jue().hoverPoints,selectPoints:Mv(),meta:{}}}}),ece=de({"lib/scattersmith.js"(e,r){"use strict";r.exports=Que()}}),gj=de({"src/traces/quiver/attributes.js"(e,r){"use strict";var t=ri(),i=Vo().hovertemplateAttrs,a=Ns().axisHoverFormat,o=fn().extendFlat,s=cs(),l=fu().dash,n=g0(),u=tl(),c={x:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},x0:u.x0,dx:u.dx,y:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},y0:u.y0,dy:u.dy,u:{valType:"data_array",editType:"calc",anim:!0},v:{valType:"data_array",editType:"calc",anim:!0},arrowref:{valType:"enumerated",values:["paper","data"],dflt:"data",editType:"calc"},lengthmode:{valType:"enumerated",values:["scaled","raw"],editType:"calc",dflt:"scaled"},lengthfactor:{valType:"number",min:0,editType:"calc",dflt:1},anchor:{valType:"enumerated",values:["tip","tail","center"],dflt:"tail",editType:"calc"},xhoverformat:a("x"),yhoverformat:a("y"),uhoverformat:a("u","noDate"),vhoverformat:a("v","noDate"),hoverinfo:o({},t.hoverinfo,{flags:["x","y","u","v","text","name"],dflt:"all"}),hovertemplate:i({},{keys:["x","y","u","v","text","name"]}),text:u.text,textposition:u.textposition,textfont:u.textfont,marker:o({arrowsize:o({},n.arrowsize,{editType:"calc"}),line:{width:{valType:"number",min:0,dflt:2,editType:"style"},dash:l,editType:"style"},editType:"calc"},s("marker",{showScaleDflt:!0,editTypeOverride:"calc"})),selected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},unselected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"}};r.exports=c}}),tce=de({"src/traces/quiver/defaults.js"(e,r){"use strict";var t=Qt(),i=gj(),a=wv(),o=Wu().hasColorscale,s=hu();r.exports=function(n,u,c,f){function h(S,M){return t.coerce(n,u,i,S,M)}var d=a(n,u,f,h);if(!d){u.visible=!1;return}var p=h("u"),g=h("v");if(!t.isArrayOrTypedArray(p)||p.length===0){u.u=new Array(d);for(var m=0;mR&&(R=p[W]),g[W]z&&(z=g[W]),NL&&(L=N),HO&&(O=H);var $=Math.sqrt(N*N+H*H);if($>v&&(v=$),$<_&&(_=$),C){var U=M[W];X.mc=U,a(U)&&(US&&(S=U))}}else X.x=o,X.y=o}if(f._maxNorm=v,b==="scaled"||E==="paper"){let le=R-D,ce=z-P;var V;le===0&&ce===0?V=1:V=(le+ce+Math.sqrt((le-ce)*(le-ce)+4*G*le*ce))/(2*(G-1)),V*=n,f._scaleFactor=V/f._maxNorm}else f._scaleFactor=1;f._scaleFactor*=f.lengthfactor;let j=new Array(m),q=new Array(m),Y=new Array(m),K=new Array(m);for(var te,ne,W=0;Wg.i&&isFinite(m[g.i]))y=m[g.i];else{var _=h.u&&h.u[g.i]||0,v=h.v&&h.v[g.i]||0;y=Math.sqrt(_*_+v*v)}return g.mcc=p(y),g.mcc})}function n(f){var h=t.select(f).selectAll("g.trace.quiver");h.each(function(d){c(f,d,t.select(this))})}function u(f,h,d){c(f,h,d)}function c(f,h,d){var p=h[0].trace,g=p.marker||{},m=g.line||{},y=i.isArrayOrTypedArray(g.color)?void 0:g.color,_=p._hasColorscale;if(d)if(p.selectedpoints){var v=(p.selected||{}).marker||{},x=(p.unselected||{}).marker||{},S=v.line||{},M=x.line||{};d.selectAll("path.js-line").each(function(w){var k=t.select(this),A=!w.selected,b=A?x.color:v.color,E=A?M.width!==void 0?M.width:m.width:S.width!==void 0?S.width:m.width;b?(a.lineGroupStyle(k,E,b,m.dash),k.style("stroke-opacity",1)):(a.lineGroupStyle(k,E,y,m.dash),_&&l(k,p),k.style("stroke-opacity",A?s:1))}),a.selectedTextStyle(d.selectAll("text"),p)}else{var C=d.selectAll("path.js-line");C.call(a.lineGroupStyle,m.width,y,m.dash),_&&l(C,p),C.style("stroke-opacity",1),a.textPointStyle(d.selectAll("text"),p,f)}}r.exports={style:n,styleOnSelect:u,colorscaleStroke:l}}}),ace=de({"src/traces/quiver/plot.js"(e,r){"use strict";var t=Yr(),i=Qt(),a=hn(),o=VS().colorscaleStroke,s=Math.PI/12,l=5.8,n=1.5,u=.7;r.exports=function(h,d,p,g,m,y){var _,v,x=!m,S=!!m&&m.duration>0;if(_=g.selectAll("g.trace").data(p,function(C){return C[0].trace.uid}),_.enter().append("g").attr("class",function(C){return"trace quiver trace"+C[0].trace.uid}).style("stroke-miterlimit",2),_.order(),S){y&&(v=y());var M=t.transition().duration(m.duration).ease(m.easing).each("end",function(){v&&v()}).each("interrupt",function(){v&&v()});M.each(function(){g.selectAll("g.trace").each(function(C,w){c(h,w,d,C,p,this,m)})})}else _.each(function(C,w){c(h,w,d,C,p,this,m)});x&&_.exit().remove()};function c(f,h,d,p,g,m,y){var _=p[0].trace,v=d.xaxis,x=d.yaxis;p[0][d.isRangePlot?"nodeRangePlot3":"node3"]=t.select(m);var S=t.select(m).selectAll("g.lines").data([p]);S.enter().append("g").classed("lines",!0),a.setClipUrl(S,d.layerClipId,f);var M=S.selectAll("path.js-line").data(p);M.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke"),M.exit().remove();let{anchor:C,maxNorm:w=0,arrowref:k}=_,A=k==="paper"?_._scaleFactor*Math.sqrt(Math.abs(v._m*x._m)):_._scaleFactor,b=_.marker.arrowsize;M.each(function(z){let I=t.select(this);if(z.x===void 0||z.y===void 0){I.attr("d",null);return}let L=(k==="paper"?z._u*Math.sign(v._m):t.round(v._m*z._u))*A,B=(k==="paper"?z._v*Math.sign(x._m):t.round(x._m*z._v))*A,O=(_._input.marker||{}).arrowsize!==void 0;var G,W,X,Z;C==="tip"?(G=v.c2p(z.x)-L,X=x.c2p(z.y)-B,W=v.c2p(z.x),Z=x.c2p(z.y)):C==="center"?(G=v.c2p(z.x)-L/2,X=x.c2p(z.y)-B/2,W=v.c2p(z.x)+L/2,Z=x.c2p(z.y)+B/2):(G=v.c2p(z.x),X=x.c2p(z.y),W=v.c2p(z.x)+L,Z=x.c2p(z.y)+B),z._px0=G,z._py0=X,z._px1=W,z._py1=Z;var J=_.marker.line.width;O||(J=Math.max(J,n));let N=Math.sqrt((W-G)*(W-G)+(Z-X)*(Z-X)),H=u*N,$=Math.min(l*b*J,H),U=Math.atan2(Z-X,W-G),V=W-$*Math.cos(U-s),j=Z-$*Math.sin(U-s),q=W-$*Math.cos(U+s),Y=Z-$*Math.sin(U+s),K="M"+G+","+X+"L"+W+","+Z+"L"+V+","+j+"L"+W+","+Z+"L"+q+","+Y;I.attr("d",K)});var E=_.marker||{},T=E.line||{},F=i.isArrayOrTypedArray(E.color)?void 0:E.color;a.lineGroupStyle(M,T.width,F,T.dash),_._hasColorscale&&o(M,_);var D=t.select(m).selectAll("g.text").data([p]);D.enter().append("g").classed("text",!0),a.setClipUrl(D,d.layerClipId,f);var R=D.selectAll("g.textpoint").data(p);if(R.enter().append("g").classed("textpoint",!0).append("text"),R.exit().remove(),R.each(function(z){var I=t.select(this),L=a.translatePoint(z,I.select("text"),v,x);L||I.remove()}),R.selectAll("text").call(a.textPointStyle,_,f).each(function(z){var I=v.c2p(z.x),L=x.c2p(z.y);t.select(this).selectAll("tspan.line").each(function(){t.select(this).attr({x:I,y:L})})}),y&&y.duration>0){var P=t.transition().duration(y.duration).ease(y.easing);M.transition(P).style("opacity",1)}}}}),nce=de({"src/traces/quiver/hover.js"(e,r){"use strict";var t=Qt(),i=$s(),a=m1();function o(s,l,n,u,c,f){let h=c-n,d=f-u,p=h*h+d*d;if(!p)return Math.sqrt((s-n)*(s-n)+(l-u)*(l-u));var g=((s-n)*h+(l-u)*d)/p;g=Math.max(0,Math.min(1,g));let m=n+g*h,y=u+g*d;return Math.sqrt((s-m)*(s-m)+(l-y)*(l-y))}r.exports=function(l,n,u,c){var f=l.cd,h=f[0].trace,d=l.xa,p=l.ya,g=d.c2p(n),m=p.c2p(u),y=function(k){return k._px0===void 0?1/0:o(g,m,k._px0,k._py0,k._px1,k._py1)};if(i.getClosest(f,y,l),l.index!==!1){var _=f[l.index],v=d.c2p(_.x,!0),x=p.c2p(_.y,!0),S=Math.sqrt((g-v)*(g-v)+(m-x)*(m-x));l.index=_.i;var M=h.u?h.u[_.i]:0,C=h.v?h.v[_.i]:0,w="u: "+M+", v: "+C;return t.extendFlat(l,{color:a(h,_),x0:v-3,x1:v+3,xLabelVal:_.x,y0:x-3,y1:x+3,yLabelVal:_.y,uLabelVal:M,vLabelVal:C,extraText:w,spikeDistance:S,hovertemplate:h.hovertemplate}),t.fillText(_,h,l),[l]}}}}),oce=de({"src/traces/quiver/format_labels.js"(e,r){"use strict";var t=nn(),i=Qt();r.exports=function(o,s,l){var n={},u={_fullLayout:l},c=t.getFromTrace(u,s,"x"),f=t.getFromTrace(u,s,"y"),h=o.x,d=o.y;n.xLabel=t.tickText(c,c.c2l(h),!0).text,n.yLabel=t.tickText(f,f.c2l(d),!0).text;var p=s.u?s.u[o.i]:0,g=s.v?s.v[o.i]:0,m=s.uhoverformat,y=s.vhoverformat;return n.uLabel=m?i.numberFormat(m)(p):String(p),n.vLabel=y?i.numberFormat(y)(g):String(g),n}}}),sce=de({"src/traces/quiver/event_data.js"(e,r){"use strict";r.exports=function(i,a,o,s,l){return i.x=a.x,i.y=a.y,i.u=o.u?o.u[l]:void 0,i.v=o.v?o.v[l]:void 0,i}}}),lce=de({"src/traces/quiver/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"quiver",basePlotModule:ml(),categories:["cartesian","svg","showLegend","scatter-like","zoomScale"],attributes:gj(),supplyDefaults:tce(),calc:rce(),crossTraceCalc:ice(),plot:ace(),style:VS().style,styleOnSelect:VS().styleOnSelect,hoverPoints:nce(),formatLabels:oce(),eventData:sce(),selectPoints:Mv(),colorbar:Yu(),animatable:!0,meta:{}}}}),uce=de({"lib/quiver.js"(e,r){"use strict";r.exports=lce()}}),_c=de({"node_modules/world-calendars/dist/main.js"(e,r){var t=du();function i(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}t(i.prototype,{instance:function(u,c){u=(u||"gregorian").toLowerCase(),c=c||"";var f=this._localCals[u+"-"+c];if(!f&&this.calendars[u]&&(f=new this.calendars[u](c),this._localCals[u+"-"+c]=f),!f)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,u);return f},newDate:function(u,c,f,h,d){return h=(u!=null&&u.year?u.calendar():typeof h=="string"?this.instance(h,d):h)||this.instance(),h.newDate(u,c,f)},substituteDigits:function(u){return function(c){return(c+"").replace(/[0-9]/g,function(f){return u[f]})}},substituteChineseDigits:function(u,c){return function(f){for(var h="",d=0;f>0;){var p=f%10;h=(p===0?"":u[p]+c[d])+h,d++,f=Math.floor(f/10)}return h.indexOf(u[1]+c[1])===0&&(h=h.substr(1)),h||u[0]}}});function a(u,c,f,h){if(this._calendar=u,this._year=c,this._month=f,this._day=h,this._calendar._validateLevel===0&&!this._calendar.isValid(this._year,this._month,this._day))throw(n.local.invalidDate||n.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(u,c){return u=""+u,"000000".substring(0,c-u.length)+u}t(a.prototype,{newDate:function(u,c,f){return this._calendar.newDate(u??this,c,f)},year:function(u){return arguments.length===0?this._year:this.set(u,"y")},month:function(u){return arguments.length===0?this._month:this.set(u,"m")},day:function(u){return arguments.length===0?this._day:this.set(u,"d")},date:function(u,c,f){if(!this._calendar.isValid(u,c,f))throw(n.local.invalidDate||n.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=u,this._month=c,this._day=f,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(u,c){return this._calendar.add(this,u,c)},set:function(u,c){return this._calendar.set(this,u,c)},compareTo:function(u){if(this._calendar.name!==u._calendar.name)throw(n.local.differentCalendars||n.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,u._calendar.local.name);var c=this._year!==u._year?this._year-u._year:this._month!==u._month?this.monthOfYear()-u.monthOfYear():this._day-u._day;return c===0?0:c<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(u){return this._calendar.fromJD(u)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(u){return this._calendar.fromJSDate(u)},toString:function(){return(this.year()<0?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}});function s(){this.shortYearCutoff="+10"}t(s.prototype,{_validateLevel:0,newDate:function(u,c,f){return u==null?this.today():(u.year&&(this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate),f=u.day(),c=u.month(),u=u.year()),new a(this,u,c,f))},today:function(){return this.fromJSDate(new Date)},epoch:function(u){var c=this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return c.year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(u){var c=this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return(c.year()<0?"-":"")+o(Math.abs(c.year()),4)},monthsInYear:function(u){return this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear),12},monthOfYear:function(u,c){var f=this._validate(u,c,this.minDay,n.local.invalidMonth||n.regionalOptions[""].invalidMonth);return(f.month()+this.monthsInYear(f)-this.firstMonth)%this.monthsInYear(f)+this.minMonth},fromMonthOfYear:function(u,c){var f=(c+this.firstMonth-2*this.minMonth)%this.monthsInYear(u)+this.minMonth;return this._validate(u,f,this.minDay,n.local.invalidMonth||n.regionalOptions[""].invalidMonth),f},daysInYear:function(u){var c=this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return this.leapYear(c)?366:365},dayOfYear:function(u,c,f){var h=this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate);return h.toJD()-this.newDate(h.year(),this.fromMonthOfYear(h.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(u,c,f){var h=this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(h))+2)%this.daysInWeek()},extraInfo:function(u,c,f){return this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate),{}},add:function(u,c,f){return this._validate(u,this.minMonth,this.minDay,n.local.invalidDate||n.regionalOptions[""].invalidDate),this._correctAdd(u,this._add(u,c,f),c,f)},_add:function(u,c,f){if(this._validateLevel++,f==="d"||f==="w"){var h=u.toJD()+c*(f==="w"?this.daysInWeek():1),d=u.calendar().fromJD(h);return this._validateLevel--,[d.year(),d.month(),d.day()]}try{var p=u.year()+(f==="y"?c:0),g=u.monthOfYear()+(f==="m"?c:0),d=u.day(),m=function(v){for(;gx-1+v.minMonth;)p++,g-=x,x=v.monthsInYear(p)};f==="y"?(u.month()!==this.fromMonthOfYear(p,g)&&(g=this.newDate(p,u.month(),this.minDay).monthOfYear()),g=Math.min(g,this.monthsInYear(p)),d=Math.min(d,this.daysInMonth(p,this.fromMonthOfYear(p,g)))):f==="m"&&(m(this),d=Math.min(d,this.daysInMonth(p,this.fromMonthOfYear(p,g))));var y=[p,this.fromMonthOfYear(p,g),d];return this._validateLevel--,y}catch(_){throw this._validateLevel--,_}},_correctAdd:function(u,c,f,h){if(!this.hasYearZero&&(h==="y"||h==="m")&&(c[0]===0||u.year()>0!=c[0]>0)){var d={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[h],p=f<0?-1:1;c=this._add(u,f*d[0]+p*d[1],d[2])}return u.date(c[0],c[1],c[2])},set:function(u,c,f){this._validate(u,this.minMonth,this.minDay,n.local.invalidDate||n.regionalOptions[""].invalidDate);var h=f==="y"?c:u.year(),d=f==="m"?c:u.month(),p=f==="d"?c:u.day();return(f==="y"||f==="m")&&(p=Math.min(p,this.daysInMonth(h,d))),u.date(h,d,p)},isValid:function(u,c,f){this._validateLevel++;var h=this.hasYearZero||u!==0;if(h){var d=this.newDate(u,c,this.minDay);h=c>=this.minMonth&&c-this.minMonth=this.minDay&&f-this.minDay13.5?13:1),_=d-(y>2.5?4716:4715);return _<=0&&_--,this.newDate(_,y,m)},toJSDate:function(u,c,f){var h=this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate),d=new Date(h.year(),h.month()-1,h.day());return d.setHours(0),d.setMinutes(0),d.setSeconds(0),d.setMilliseconds(0),d.setHours(d.getHours()>12?d.getHours()+2:0),d},fromJSDate:function(u){return this.newDate(u.getFullYear(),u.getMonth()+1,u.getDate())}});var n=r.exports=new i;n.cdate=a,n.baseCalendar=s,n.calendars.gregorian=l}}),cce=de({"node_modules/world-calendars/dist/plus.js"(){var e=du(),r=_c();e(r.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),r.local=r.regionalOptions[""],e(r.cdate.prototype,{formatDate:function(t,i){return typeof t!="string"&&(i=t,t=""),this._calendar.formatDate(t||"",this,i)}}),e(r.baseCalendar.prototype,{UNIX_EPOCH:r.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:1440*60,TICKS_EPOCH:r.instance().jdEpoch,TICKS_PER_DAY:1440*60*1e7,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,i,a){if(typeof t!="string"&&(a=i,i=t,t=""),!i)return"";if(i.calendar()!==this)throw r.local.invalidFormat||r.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat,a=a||{};for(var o=a.dayNamesShort||this.local.dayNamesShort,s=a.dayNames||this.local.dayNames,l=a.monthNumbers||this.local.monthNumbers,n=a.monthNamesShort||this.local.monthNamesShort,u=a.monthNames||this.local.monthNames,c=a.calculateWeek||this.local.calculateWeek,f=function(M,C){for(var w=1;S+w1},h=function(M,C,w,k){var A=""+C;if(f(M,k))for(;A.length1},x=function(F,D){var R=v(F,D),P=[2,3,R?4:2,R?4:2,10,11,20]["oyYJ@!".indexOf(F)+1],z=new RegExp("^-?\\d{1,"+P+"}"),I=i.substring(A).match(z);if(!I)throw(r.local.missingNumberAt||r.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=I[0].length,parseInt(I[0],10)},S=this,M=function(){if(typeof u=="function"){v("m");var F=u.call(S,i.substring(A));return A+=F.length,F}return x("m")},C=function(F,D,R,P){for(var z=v(F,P)?R:D,I=0;I-1){p=1,g=m;for(var T=this.daysInMonth(d,p);g>T;T=this.daysInMonth(d,p))p++,g-=T}return h>-1?this.fromJD(h):this.newDate(d,p,g)},determineDate:function(t,i,a,o,s){a&&typeof a!="object"&&(s=o,o=a,a=null),typeof o!="string"&&(s=o,o="");var l=this,n=function(u){try{return l.parseDate(o,u,s)}catch{}u=u.toLowerCase();for(var c=(u.match(/^c/)&&a?a.newDate():null)||l.today(),f=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,h=f.exec(u);h;)c.add(parseInt(h[1],10),h[2]||"d"),h=f.exec(u);return c};return i=i?i.newDate():null,t=t==null?i:typeof t=="string"?n(t):typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?i:l.today().add(t,"d"):l.newDate(t),t}})}}),fce=de({"node_modules/world-calendars/dist/calendars/chinese.js"(){var e=_c(),r=du(),t=e.instance();function i(h){this.local=this.regionalOptions[h||""]||this.regionalOptions[""]}i.prototype=new e.baseCalendar,r(i.prototype,{name:"Chinese",jdEpoch:17214255e-1,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(h,d){if(typeof h=="string"){var p=h.match(o);return p?p[0]:""}var g=this._validateYear(h),m=h.month(),y=""+this.toChineseMonth(g,m);return d&&y.length<2&&(y="0"+y),this.isIntercalaryMonth(g,m)&&(y+="i"),y},monthNames:function(h){if(typeof h=="string"){var d=h.match(s);return d?d[0]:""}var p=this._validateYear(h),g=h.month(),m=this.toChineseMonth(p,g),y=["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"][m-1];return this.isIntercalaryMonth(p,g)&&(y="\u95F0"+y),y},monthNamesShort:function(h){if(typeof h=="string"){var d=h.match(l);return d?d[0]:""}var p=this._validateYear(h),g=h.month(),m=this.toChineseMonth(p,g),y=["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D","\u5341","\u5341\u4E00","\u5341\u4E8C"][m-1];return this.isIntercalaryMonth(p,g)&&(y="\u95F0"+y),y},parseMonth:function(h,d){h=this._validateYear(h);var p=parseInt(d),g;if(isNaN(p))d[0]==="\u95F0"&&(g=!0,d=d.substring(1)),d[d.length-1]==="\u6708"&&(d=d.substring(0,d.length-1)),p=1+["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D","\u5341","\u5341\u4E00","\u5341\u4E8C"].indexOf(d);else{var m=d[d.length-1];g=m==="i"||m==="I"}var y=this.toMonthIndex(h,p,g);return y},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(h,d){if(h.year&&(h=h.year()),typeof h!="number"||h<1888||h>2111)throw d.replace(/\{0\}/,this.local.name);return h},toMonthIndex:function(h,d,p){var g=this.intercalaryMonth(h),m=p&&d!==g;if(m||d<1||d>12)throw e.local.invalidMonth.replace(/\{0\}/,this.local.name);var y;return g?!p&&d<=g?y=d-1:y=d:y=d-1,y},toChineseMonth:function(h,d){h.year&&(h=h.year(),d=h.month());var p=this.intercalaryMonth(h),g=p?12:11;if(d<0||d>g)throw e.local.invalidMonth.replace(/\{0\}/,this.local.name);var m;return p?d>13;return p},isIntercalaryMonth:function(h,d){h.year&&(h=h.year(),d=h.month());var p=this.intercalaryMonth(h);return!!p&&p===d},leapYear:function(h){return this.intercalaryMonth(h)!==0},weekOfYear:function(h,d,p){var g=this._validateYear(h,e.local.invalidyear),m=u[g-u[0]],y=m>>9&4095,_=m>>5&15,v=m&31,x;x=t.newDate(y,_,v),x.add(4-(x.dayOfWeek()||7),"d");var S=this.toJD(h,d,p)-x.toJD();return 1+Math.floor(S/7)},monthsInYear:function(h){return this.leapYear(h)?13:12},daysInMonth:function(h,d){h.year&&(d=h.month(),h=h.year()),h=this._validateYear(h);var p=n[h-n[0]],g=p>>13,m=g?12:11;if(d>m)throw e.local.invalidMonth.replace(/\{0\}/,this.local.name);var y=p&1<<12-d?30:29;return y},weekDay:function(h,d,p){return(this.dayOfWeek(h,d,p)||7)<6},toJD:function(h,d,p){var g=this._validate(h,y,p,e.local.invalidDate);h=this._validateYear(g.year()),d=g.month(),p=g.day();var m=this.isIntercalaryMonth(h,d),y=this.toChineseMonth(h,d),_=f(h,y,p,m);return t.toJD(_.year,_.month,_.day)},fromJD:function(h){var d=t.fromJD(h),p=c(d.year(),d.month(),d.day()),g=this.toMonthIndex(p.year,p.month,p.isIntercalary);return this.newDate(p.year,g,p.day)},fromString:function(h){var d=h.match(a),p=this._validateYear(+d[1]),g=+d[2],m=!!d[3],y=this.toMonthIndex(p,g,m),_=+d[4];return this.newDate(p,y,_)},add:function(h,d,p){var g=h.year(),m=h.month(),y=this.isIntercalaryMonth(g,m),_=this.toChineseMonth(g,m),v=Object.getPrototypeOf(i.prototype).add.call(this,h,d,p);if(p==="y"){var x=v.year(),S=v.month(),M=this.isIntercalaryMonth(x,_),C=y&&M?this.toMonthIndex(x,_,!0):this.toMonthIndex(x,_,!1);C!==S&&v.month(C)}return v}});var a=/^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m,o=/^\d?\d[iI]?/m,s=/^闰?十?[一二三四五六七八九]?月/m,l=/^闰?十?[一二三四五六七八九]?/m;e.calendars.chinese=i;var n=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548],u=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904];function c(h,d,p,g){var m,y;if(typeof h=="object")m=h,y=d||{};else{var _=typeof h=="number"&&h>=1888&&h<=2111;if(!_)throw new Error("Solar year outside range 1888-2111");var v=typeof d=="number"&&d>=1&&d<=12;if(!v)throw new Error("Solar month outside range 1 - 12");var x=typeof p=="number"&&p>=1&&p<=31;if(!x)throw new Error("Solar day outside range 1 - 31");m={year:h,month:d,day:p},y=g||{}}var S=u[m.year-u[0]],M=m.year<<9|m.month<<5|m.day;y.year=M>=S?m.year:m.year-1,S=u[y.year-u[0]];var C=S>>9&4095,w=S>>5&15,k=S&31,A,b=new Date(C,w-1,k),E=new Date(m.year,m.month-1,m.day);A=Math.round((E-b)/(24*3600*1e3));var T=n[y.year-n[0]],F;for(F=0;F<13;F++){var D=T&1<<12-F?30:29;if(A>13;return!R||F=1888&&h<=2111;if(!v)throw new Error("Lunar year outside range 1888-2111");var x=typeof d=="number"&&d>=1&&d<=12;if(!x)throw new Error("Lunar month outside range 1 - 12");var S=typeof p=="number"&&p>=1&&p<=30;if(!S)throw new Error("Lunar day outside range 1 - 30");var M;typeof g=="object"?(M=!1,y=g):(M=!!g,y=m||{}),_={year:h,month:d,day:p,isIntercalary:M}}var C;C=_.day-1;var w=n[_.year-n[0]],k=w>>13,A;k&&(_.month>k||_.isIntercalary)?A=_.month:A=_.month-1;for(var b=0;b>9&4095,D=T>>5&15,R=T&31,P=new Date(F,D-1,R+C);return y.year=P.getFullYear(),y.month=1+P.getMonth(),y.day=P.getDate(),y}}}),hce=de({"node_modules/world-calendars/dist/calendars/coptic.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Coptic",jdEpoch:18250295e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(o){var a=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),o=a.year()+(a.year()<0?1:0);return o%4===3||o%4===-1},monthsInYear:function(i){return this._validate(i,this.minMonth,this.minDay,e.local.invalidYear||e.regionalOptions[""].invalidYear),13},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===13&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return(this.dayOfWeek(i,a,o)||7)<6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),i<0&&i++,s.day()+(s.month()-1)*30+(i-1)*365+Math.floor(i/4)+this.jdEpoch-1},fromJD:function(i){var a=Math.floor(i)+.5-this.jdEpoch,o=Math.floor((a-Math.floor((a+366)/1461))/365)+1;o<=0&&o--,a=Math.floor(i)+.5-this.newDate(o,1,1).toJD();var s=Math.floor(a/30)+1,l=a-(s-1)*30+1;return this.newDate(o,s,l)}}),e.calendars.coptic=t}}),dce=de({"node_modules/world-calendars/dist/calendars/discworld.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Discworld",jdEpoch:17214255e-1,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),!1},monthsInYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),13},daysInYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),400},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-l.dayOfWeek(),"d"),Math.floor((l.dayOfYear()-1)/8)+1},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return(l.day()+1)%8},weekDay:function(a,o,s){var l=this.dayOfWeek(a,o,s);return l>=2&&l<=6},extraInfo:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return{century:i[Math.floor((l.year()-1)/100)+1]||""}},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return a=l.year()+(l.year()<0?1:0),o=l.month(),s=l.day(),s+(o>1?16:0)+(o>2?(o-2)*32:0)+(a-1)*400+this.jdEpoch-1},fromJD:function(a){a=Math.floor(a+.5)-Math.floor(this.jdEpoch)-1;var o=Math.floor(a/400)+1;a-=(o-1)*400,a+=a>15?16:0;var s=Math.floor(a/32)+1,l=a-(s-1)*32+1;return this.newDate(o<=0?o-1:o,s,l)}});var i={20:"Fruitbat",21:"Anchovy"};e.calendars.discworld=t}}),pce=de({"node_modules/world-calendars/dist/calendars/ethiopian.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Ethiopian",jdEpoch:17242205e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(o){var a=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),o=a.year()+(a.year()<0?1:0);return o%4===3||o%4===-1},monthsInYear:function(i){return this._validate(i,this.minMonth,this.minDay,e.local.invalidYear||e.regionalOptions[""].invalidYear),13},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===13&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return(this.dayOfWeek(i,a,o)||7)<6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),i<0&&i++,s.day()+(s.month()-1)*30+(i-1)*365+Math.floor(i/4)+this.jdEpoch-1},fromJD:function(i){var a=Math.floor(i)+.5-this.jdEpoch,o=Math.floor((a-Math.floor((a+366)/1461))/365)+1;o<=0&&o--,a=Math.floor(i)+.5-this.newDate(o,1,1).toJD();var s=Math.floor(a/30)+1,l=a-(s-1)*30+1;return this.newDate(o,s,l)}}),e.calendars.ethiopian=t}}),vce=de({"node_modules/world-calendars/dist/calendars/hebrew.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return this._leapYear(o.year())},_leapYear:function(a){return a=a<0?a+1:a,i(a*7+1,19)<7},monthsInYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),this._leapYear(a.year?a.year():a)?13:12},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-l.dayOfWeek(),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return a=o.year(),this.toJD(a===-1?1:a+1,7,1)-this.toJD(a,7,1)},daysInMonth:function(a,o){return a.year&&(o=a.month(),a=a.year()),this._validate(a,o,this.minDay,e.local.invalidMonth),o===12&&this.leapYear(a)||o===8&&i(this.daysInYear(a),10)===5?30:o===9&&i(this.daysInYear(a),10)===3?29:this.daysPerMonth[o-1]},weekDay:function(a,o,s){return this.dayOfWeek(a,o,s)!==6},extraInfo:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return{yearType:(this.leapYear(l)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(l)%10-3]}},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);a=l.year(),o=l.month(),s=l.day();var n=a<=0?a+1:a,u=this.jdEpoch+this._delay1(n)+this._delay2(n)+s+1;if(o<7){for(var c=7;c<=this.monthsInYear(a);c++)u+=this.daysInMonth(a,c);for(var c=1;c=this.toJD(o===-1?1:o+1,7,1);)o++;for(var s=athis.toJD(o,s,this.daysInMonth(o,s));)s++;var l=a-this.toJD(o,s,1)+1;return this.newDate(o,s,l)}});function i(a,o){return a-o*Math.floor(a/o)}e.calendars.hebrew=t}}),mce=de({"node_modules/world-calendars/dist/calendars/islamic.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Islamic",jdEpoch:19484395e-1,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012Bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(i){var a=this._validate(i,this.minMonth,this.minDay,e.local.invalidYear);return(a.year()*11+14)%30<11},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInYear:function(i){return this.leapYear(i)?355:354},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===12&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return this.dayOfWeek(i,a,o)!==5},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),a=s.month(),o=s.day(),i=i<=0?i+1:i,o+Math.ceil(29.5*(a-1))+(i-1)*354+Math.floor((3+11*i)/30)+this.jdEpoch-1},fromJD:function(i){i=Math.floor(i)+.5;var a=Math.floor((30*(i-this.jdEpoch)+10646)/10631);a=a<=0?a-1:a;var o=Math.min(12,Math.ceil((i-29-this.toJD(a,1,1))/29.5)+1),s=i-this.toJD(a,o,1)+1;return this.newDate(a,o,s)}}),e.calendars.islamic=t}}),gce=de({"node_modules/world-calendars/dist/calendars/julian.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Julian",jdEpoch:17214235e-1,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(o){var a=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),o=a.year()<0?a.year()+1:a.year();return o%4===0},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(4-(s.dayOfWeek()||7),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===2&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return(this.dayOfWeek(i,a,o)||7)<6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),a=s.month(),o=s.day(),i<0&&i++,a<=2&&(i--,a+=12),Math.floor(365.25*(i+4716))+Math.floor(30.6001*(a+1))+o-1524.5},fromJD:function(i){var a=Math.floor(i+.5),o=a+1524,s=Math.floor((o-122.1)/365.25),l=Math.floor(365.25*s),n=Math.floor((o-l)/30.6001),u=n-Math.floor(n<14?1:13),c=s-Math.floor(u>2?4716:4715),f=o-l-Math.floor(30.6001*n);return c<=0&&c--,this.newDate(c,u,f)}}),e.calendars.julian=t}}),yce=de({"node_modules/world-calendars/dist/calendars/mayan.js"(){var e=_c(),r=du();function t(o){this.local=this.regionalOptions[o||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(o){return this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),!1},formatYear:function(o){var s=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear);o=s.year();var l=Math.floor(o/400);o=o%400,o+=o<0?400:0;var n=Math.floor(o/20);return l+"."+n+"."+o%20},forYear:function(o){if(o=o.split("."),o.length<3)throw"Invalid Mayan year";for(var s=0,l=0;l19||l>0&&n<0)throw"Invalid Mayan year";s=s*20+n}return s},monthsInYear:function(o){return this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),18},weekOfYear:function(o,s,l){return this._validate(o,s,l,e.local.invalidDate),0},daysInYear:function(o){return this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),360},daysInMonth:function(o,s){return this._validate(o,s,this.minDay,e.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(o,s,l){var n=this._validate(o,s,l,e.local.invalidDate);return n.day()},weekDay:function(o,s,l){return this._validate(o,s,l,e.local.invalidDate),!0},extraInfo:function(o,s,l){var n=this._validate(o,s,l,e.local.invalidDate),u=n.toJD(),c=this._toHaab(u),f=this._toTzolkin(u);return{haabMonthName:this.local.haabMonths[c[0]-1],haabMonth:c[0],haabDay:c[1],tzolkinDayName:this.local.tzolkinMonths[f[0]-1],tzolkinDay:f[0],tzolkinTrecena:f[1]}},_toHaab:function(o){o-=this.jdEpoch;var s=i(o+8+340,365);return[Math.floor(s/20)+1,i(s,20)]},_toTzolkin:function(o){return o-=this.jdEpoch,[a(o+20,20),a(o+4,13)]},toJD:function(o,s,l){var n=this._validate(o,s,l,e.local.invalidDate);return n.day()+n.month()*20+n.year()*360+this.jdEpoch},fromJD:function(o){o=Math.floor(o)+.5-this.jdEpoch;var s=Math.floor(o/360);o=o%360,o+=o<0?360:0;var l=Math.floor(o/20),n=o%20;return this.newDate(s,l,n)}});function i(o,s){return o-s*Math.floor(o/s)}function a(o,s){return i(o-1,s)+1}e.calendars.mayan=t}}),_ce=de({"node_modules/world-calendars/dist/calendars/nanakshahi.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar;var i=e.instance("gregorian");r(t.prototype,{name:"Nanakshahi",jdEpoch:22576735e-1,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear||e.regionalOptions[""].invalidYear);return i.leapYear(o.year()+(o.year()<1?1:0)+1469)},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(1-(l.dayOfWeek()||7),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===12&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return(this.dayOfWeek(a,o,s)||7)<6},toJD:function(n,o,s){var l=this._validate(n,o,s,e.local.invalidMonth),n=l.year();n<0&&n++;for(var u=l.day(),c=1;c=this.toJD(o+1,1,1);)o++;for(var s=a-Math.floor(this.toJD(o,1,1)+.5)+1,l=1;s>this.daysInMonth(o,l);)s-=this.daysInMonth(o,l),l++;return this.newDate(o,l,s)}}),e.calendars.nanakshahi=t}}),xce=de({"node_modules/world-calendars/dist/calendars/nepali.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Nepali",jdEpoch:17007095e-1,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(i){return this.daysInYear(i)!==this.daysPerYear},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInYear:function(i){var a=this._validate(i,this.minMonth,this.minDay,e.local.invalidYear);if(i=a.year(),typeof this.NEPALI_CALENDAR_DATA[i]>"u")return this.daysPerYear;for(var o=0,s=this.minMonth;s<=12;s++)o+=this.NEPALI_CALENDAR_DATA[i][s];return o},daysInMonth:function(i,a){return i.year&&(a=i.month(),i=i.year()),this._validate(i,a,this.minDay,e.local.invalidMonth),typeof this.NEPALI_CALENDAR_DATA[i]>"u"?this.daysPerMonth[a-1]:this.NEPALI_CALENDAR_DATA[i][a]},weekDay:function(i,a,o){return this.dayOfWeek(i,a,o)!==6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);i=s.year(),a=s.month(),o=s.day();var l=e.instance(),n=0,u=a,c=i;this._createMissingCalendarData(i);var f=i-(u>9||u===9&&o>=this.NEPALI_CALENDAR_DATA[c][0]?56:57);for(a!==9&&(n=o,u--);u!==9;)u<=0&&(u=12,c--),n+=this.NEPALI_CALENDAR_DATA[c][u],u--;return a===9?(n+=o-this.NEPALI_CALENDAR_DATA[c][0],n<0&&(n+=l.daysInYear(f))):n+=this.NEPALI_CALENDAR_DATA[c][9]-this.NEPALI_CALENDAR_DATA[c][0],l.newDate(f,1,1).add(n,"d").toJD()},fromJD:function(i){var a=e.instance(),o=a.fromJD(i),s=o.year(),l=o.dayOfYear(),n=s+56;this._createMissingCalendarData(n);for(var u=9,c=this.NEPALI_CALENDAR_DATA[n][0],f=this.NEPALI_CALENDAR_DATA[n][u]-c+1;l>f;)u++,u>12&&(u=1,n++),f+=this.NEPALI_CALENDAR_DATA[n][u];var h=this.NEPALI_CALENDAR_DATA[n][u]-(f-l);return this.newDate(n,u,h)},_createMissingCalendarData:function(i){var a=this.daysPerMonth.slice(0);a.unshift(17);for(var o=i-1;o"u"&&(this.NEPALI_CALENDAR_DATA[o]=a)},NEPALI_CALENDAR_DATA:{1970:[18,31,31,32,31,31,31,30,29,30,29,30,30],1971:[18,31,31,32,31,32,30,30,29,30,29,30,30],1972:[17,31,32,31,32,31,30,30,30,29,29,30,30],1973:[19,30,32,31,32,31,30,30,30,29,30,29,31],1974:[19,31,31,32,30,31,31,30,29,30,29,30,30],1975:[18,31,31,32,32,30,31,30,29,30,29,30,30],1976:[17,31,32,31,32,31,30,30,30,29,29,30,31],1977:[18,31,32,31,32,31,31,29,30,29,30,29,31],1978:[18,31,31,32,31,31,31,30,29,30,29,30,30],1979:[18,31,31,32,32,31,30,30,29,30,29,30,30],1980:[17,31,32,31,32,31,30,30,30,29,29,30,31],1981:[18,31,31,31,32,31,31,29,30,30,29,30,30],1982:[18,31,31,32,31,31,31,30,29,30,29,30,30],1983:[18,31,31,32,32,31,30,30,29,30,29,30,30],1984:[17,31,32,31,32,31,30,30,30,29,29,30,31],1985:[18,31,31,31,32,31,31,29,30,30,29,30,30],1986:[18,31,31,32,31,31,31,30,29,30,29,30,30],1987:[18,31,32,31,32,31,30,30,29,30,29,30,30],1988:[17,31,32,31,32,31,30,30,30,29,29,30,31],1989:[18,31,31,31,32,31,31,30,29,30,29,30,30],1990:[18,31,31,32,31,31,31,30,29,30,29,30,30],1991:[18,31,32,31,32,31,30,30,29,30,29,30,30],1992:[17,31,32,31,32,31,30,30,30,29,30,29,31],1993:[18,31,31,31,32,31,31,30,29,30,29,30,30],1994:[18,31,31,32,31,31,31,30,29,30,29,30,30],1995:[17,31,32,31,32,31,30,30,30,29,29,30,30],1996:[17,31,32,31,32,31,30,30,30,29,30,29,31],1997:[18,31,31,32,31,31,31,30,29,30,29,30,30],1998:[18,31,31,32,31,31,31,30,29,30,29,30,30],1999:[17,31,32,31,32,31,30,30,30,29,29,30,31],2e3:[17,30,32,31,32,31,30,30,30,29,30,29,31],2001:[18,31,31,32,31,31,31,30,29,30,29,30,30],2002:[18,31,31,32,32,31,30,30,29,30,29,30,30],2003:[17,31,32,31,32,31,30,30,30,29,29,30,31],2004:[17,30,32,31,32,31,30,30,30,29,30,29,31],2005:[18,31,31,32,31,31,31,30,29,30,29,30,30],2006:[18,31,31,32,32,31,30,30,29,30,29,30,30],2007:[17,31,32,31,32,31,30,30,30,29,29,30,31],2008:[17,31,31,31,32,31,31,29,30,30,29,29,31],2009:[18,31,31,32,31,31,31,30,29,30,29,30,30],2010:[18,31,31,32,32,31,30,30,29,30,29,30,30],2011:[17,31,32,31,32,31,30,30,30,29,29,30,31],2012:[17,31,31,31,32,31,31,29,30,30,29,30,30],2013:[18,31,31,32,31,31,31,30,29,30,29,30,30],2014:[18,31,31,32,32,31,30,30,29,30,29,30,30],2015:[17,31,32,31,32,31,30,30,30,29,29,30,31],2016:[17,31,31,31,32,31,31,29,30,30,29,30,30],2017:[18,31,31,32,31,31,31,30,29,30,29,30,30],2018:[18,31,32,31,32,31,30,30,29,30,29,30,30],2019:[17,31,32,31,32,31,30,30,30,29,30,29,31],2020:[17,31,31,31,32,31,31,30,29,30,29,30,30],2021:[18,31,31,32,31,31,31,30,29,30,29,30,30],2022:[17,31,32,31,32,31,30,30,30,29,29,30,30],2023:[17,31,32,31,32,31,30,30,30,29,30,29,31],2024:[17,31,31,31,32,31,31,30,29,30,29,30,30],2025:[18,31,31,32,31,31,31,30,29,30,29,30,30],2026:[17,31,32,31,32,31,30,30,30,29,29,30,31],2027:[17,30,32,31,32,31,30,30,30,29,30,29,31],2028:[17,31,31,32,31,31,31,30,29,30,29,30,30],2029:[18,31,31,32,31,32,30,30,29,30,29,30,30],2030:[17,31,32,31,32,31,30,30,30,30,30,30,31],2031:[17,31,32,31,32,31,31,31,31,31,31,31,31],2032:[17,32,32,32,32,32,32,32,32,32,32,32,32],2033:[18,31,31,32,32,31,30,30,29,30,29,30,30],2034:[17,31,32,31,32,31,30,30,30,29,29,30,31],2035:[17,30,32,31,32,31,31,29,30,30,29,29,31],2036:[17,31,31,32,31,31,31,30,29,30,29,30,30],2037:[18,31,31,32,32,31,30,30,29,30,29,30,30],2038:[17,31,32,31,32,31,30,30,30,29,29,30,31],2039:[17,31,31,31,32,31,31,29,30,30,29,30,30],2040:[17,31,31,32,31,31,31,30,29,30,29,30,30],2041:[18,31,31,32,32,31,30,30,29,30,29,30,30],2042:[17,31,32,31,32,31,30,30,30,29,29,30,31],2043:[17,31,31,31,32,31,31,29,30,30,29,30,30],2044:[17,31,31,32,31,31,31,30,29,30,29,30,30],2045:[18,31,32,31,32,31,30,30,29,30,29,30,30],2046:[17,31,32,31,32,31,30,30,30,29,29,30,31],2047:[17,31,31,31,32,31,31,30,29,30,29,30,30],2048:[17,31,31,32,31,31,31,30,29,30,29,30,30],2049:[17,31,32,31,32,31,30,30,30,29,29,30,30],2050:[17,31,32,31,32,31,30,30,30,29,30,29,31],2051:[17,31,31,31,32,31,31,30,29,30,29,30,30],2052:[17,31,31,32,31,31,31,30,29,30,29,30,30],2053:[17,31,32,31,32,31,30,30,30,29,29,30,30],2054:[17,31,32,31,32,31,30,30,30,29,30,29,31],2055:[17,31,31,32,31,31,31,30,29,30,30,29,30],2056:[17,31,31,32,31,32,30,30,29,30,29,30,30],2057:[17,31,32,31,32,31,30,30,30,29,29,30,31],2058:[17,30,32,31,32,31,30,30,30,29,30,29,31],2059:[17,31,31,32,31,31,31,30,29,30,29,30,30],2060:[17,31,31,32,32,31,30,30,29,30,29,30,30],2061:[17,31,32,31,32,31,30,30,30,29,29,30,31],2062:[17,30,32,31,32,31,31,29,30,29,30,29,31],2063:[17,31,31,32,31,31,31,30,29,30,29,30,30],2064:[17,31,31,32,32,31,30,30,29,30,29,30,30],2065:[17,31,32,31,32,31,30,30,30,29,29,30,31],2066:[17,31,31,31,32,31,31,29,30,30,29,29,31],2067:[17,31,31,32,31,31,31,30,29,30,29,30,30],2068:[17,31,31,32,32,31,30,30,29,30,29,30,30],2069:[17,31,32,31,32,31,30,30,30,29,29,30,31],2070:[17,31,31,31,32,31,31,29,30,30,29,30,30],2071:[17,31,31,32,31,31,31,30,29,30,29,30,30],2072:[17,31,32,31,32,31,30,30,29,30,29,30,30],2073:[17,31,32,31,32,31,30,30,30,29,29,30,31],2074:[17,31,31,31,32,31,31,30,29,30,29,30,30],2075:[17,31,31,32,31,31,31,30,29,30,29,30,30],2076:[16,31,32,31,32,31,30,30,30,29,29,30,30],2077:[17,31,32,31,32,31,30,30,30,29,30,29,31],2078:[17,31,31,31,32,31,31,30,29,30,29,30,30],2079:[17,31,31,32,31,31,31,30,29,30,29,30,30],2080:[16,31,32,31,32,31,30,30,30,29,29,30,30],2081:[17,31,31,32,32,31,30,30,30,29,30,30,30],2082:[17,31,32,31,32,31,30,30,30,29,30,30,30],2083:[17,31,31,32,31,31,30,30,30,29,30,30,30],2084:[17,31,31,32,31,31,30,30,30,29,30,30,30],2085:[17,31,32,31,32,31,31,30,30,29,30,30,30],2086:[17,31,32,31,32,31,30,30,30,29,30,30,30],2087:[16,31,31,32,31,31,31,30,30,29,30,30,30],2088:[16,30,31,32,32,30,31,30,30,29,30,30,30],2089:[17,31,32,31,32,31,30,30,30,29,30,30,30],2090:[17,31,32,31,32,31,30,30,30,29,30,30,30],2091:[16,31,31,32,31,31,31,30,30,29,30,30,30],2092:[16,31,31,32,32,31,30,30,30,29,30,30,30],2093:[17,31,32,31,32,31,30,30,30,29,30,30,30],2094:[17,31,31,32,31,31,30,30,30,29,30,30,30],2095:[17,31,31,32,31,31,31,30,29,30,30,30,30],2096:[17,30,31,32,32,31,30,30,29,30,29,30,30],2097:[17,31,32,31,32,31,30,30,30,29,30,30,30],2098:[17,31,31,32,31,31,31,29,30,29,30,30,31],2099:[17,31,31,32,31,31,31,30,29,29,30,30,30],2100:[17,31,32,31,32,30,31,30,29,30,29,30,30]}}),e.calendars.nepali=t}}),bce=de({"node_modules/world-calendars/dist/calendars/persian.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}function i(a){var o=a-475;a<0&&o++;var s=.242197,l=s*o,n=s*(o+1),u=l-Math.floor(l),c=n-Math.floor(n);return u>c}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Persian",jdEpoch:19483205e-1,daysPerMonth:[31,31,31,31,31,31,30,30,30,30,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Persian",epochs:["BP","AP"],monthNames:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"],monthNamesShort:["Far","Ord","Kho","Tir","Mor","Sha","Meh","Aba","Aza","Dey","Bah","Esf"],dayNames:["Yekshanbeh","Doshanbeh","Seshanbeh","Chah\u0101rshanbeh","Panjshanbeh","Jom'eh","Shanbeh"],dayNamesShort:["Yek","Do","Se","Cha","Panj","Jom","Sha"],dayNamesMin:["Ye","Do","Se","Ch","Pa","Jo","Sh"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return i(o.year())},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-((l.dayOfWeek()+1)%7),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===12&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return this.dayOfWeek(a,o,s)!==5},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);a=l.year(),o=l.month(),s=l.day();var n=0;if(a>0)for(var u=1;u0?a-1:a)*365+n+this.jdEpoch-1},fromJD:function(a){a=Math.floor(a)+.5;var o=475+(a-this.toJD(475,1,1))/365.242197,s=Math.floor(o);s<=0&&s--,a>this.toJD(s,12,i(s)?30:29)&&(s++,s===0&&s++);var l=a-this.toJD(s,1,1)+1,n=l<=186?Math.ceil(l/31):Math.ceil((l-6)/30),u=a-this.toJD(s,n,1)+1;return this.newDate(s,n,u)}}),e.calendars.persian=t,e.calendars.jalali=t}}),wce=de({"node_modules/world-calendars/dist/calendars/taiwan.js"(){var e=_c(),r=du(),t=e.instance();function i(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}i.prototype=new e.baseCalendar,r(i.prototype,{name:"Taiwan",jdEpoch:24194025e-1,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(s){var o=this._validate(s,this.minMonth,this.minDay,e.local.invalidYear),s=this._t2gYear(o.year());return t.leapYear(s)},weekOfYear:function(n,o,s){var l=this._validate(n,this.minMonth,this.minDay,e.local.invalidYear),n=this._t2gYear(l.year());return t.weekOfYear(n,l.month(),l.day())},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===2&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return(this.dayOfWeek(a,o,s)||7)<6},toJD:function(n,o,s){var l=this._validate(n,o,s,e.local.invalidDate),n=this._t2gYear(l.year());return t.toJD(n,l.month(),l.day())},fromJD:function(a){var o=t.fromJD(a),s=this._g2tYear(o.year());return this.newDate(s,o.month(),o.day())},_t2gYear:function(a){return a+this.yearsOffset+(a>=-this.yearsOffset&&a<=-1?1:0)},_g2tYear:function(a){return a-this.yearsOffset-(a>=1&&a<=this.yearsOffset?1:0)}}),e.calendars.taiwan=i}}),Tce=de({"node_modules/world-calendars/dist/calendars/thai.js"(){var e=_c(),r=du(),t=e.instance();function i(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}i.prototype=new e.baseCalendar,r(i.prototype,{name:"Thai",jdEpoch:15230985e-1,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(s){var o=this._validate(s,this.minMonth,this.minDay,e.local.invalidYear),s=this._t2gYear(o.year());return t.leapYear(s)},weekOfYear:function(n,o,s){var l=this._validate(n,this.minMonth,this.minDay,e.local.invalidYear),n=this._t2gYear(l.year());return t.weekOfYear(n,l.month(),l.day())},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===2&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return(this.dayOfWeek(a,o,s)||7)<6},toJD:function(n,o,s){var l=this._validate(n,o,s,e.local.invalidDate),n=this._t2gYear(l.year());return t.toJD(n,l.month(),l.day())},fromJD:function(a){var o=t.fromJD(a),s=this._g2tYear(o.year());return this.newDate(s,o.month(),o.day())},_t2gYear:function(a){return a-this.yearsOffset-(a>=1&&a<=this.yearsOffset?1:0)},_g2tYear:function(a){return a+this.yearsOffset+(a>=-this.yearsOffset&&a<=-1?1:0)}}),e.calendars.thai=i}}),Ace=de({"node_modules/world-calendars/dist/calendars/ummalqura.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012Bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return this.daysInYear(o.year())===355},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-l.dayOfWeek(),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInYear:function(a){for(var o=0,s=1;s<=12;s++)o+=this.daysInMonth(a,s);return o},daysInMonth:function(a,o){for(var s=this._validate(a,o,this.minDay,e.local.invalidMonth),l=s.toJD()-24e5+.5,n=0,u=0;ul)return i[n]-i[n-1];n++}return 30},weekDay:function(a,o,s){return this.dayOfWeek(a,o,s)!==5},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate),n=12*(l.year()-1)+l.month()-15292,u=l.day()+i[n-1]-1;return u+24e5-.5},fromJD:function(a){for(var o=a-24e5+.5,s=0,l=0;lo);l++)s++;var n=s+15292,u=Math.floor((n-1)/12),c=u+1,f=n-12*u,h=o-i[s-1]+1;return this.newDate(c,f,h)},isValid:function(a,o,s){var l=e.baseCalendar.prototype.isValid.apply(this,arguments);return l&&(a=a.year!=null?a.year:a,l=a>=1276&&a<=1500),l},_validate:function(a,o,s,l){var n=e.baseCalendar.prototype._validate.apply(this,arguments);if(n.year<1276||n.year>1500)throw l.replace(/\{0\}/,this.local.name);return n}}),e.calendars.ummalqura=t;var i=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]}}),Mce=de({"src/components/calendars/calendars.js"(e,r){"use strict";r.exports=_c(),cce(),fce(),hce(),dce(),pce(),vce(),mce(),gce(),yce(),_ce(),xce(),bce(),wce(),Tce(),Ace()}}),Sce=de({"src/components/calendars/index.js"(e,r){"use strict";var t=Mce(),i=Qt(),a=cn(),o=a.EPOCHJD,s=a.ONEDAY,l={valType:"enumerated",values:i.sortObjectKeys(t.calendars),editType:"calc",dflt:"gregorian"},n=function(w,k,A,b){var E={};return E[A]=l,i.coerce(w,k,E,A,b)},u=function(w,k,A,b){for(var E=0;E{dt.preventDefault(),dt.stopPropagation(),dt.clipboardData.setData("text",Ie),Oe.removeEventListener("copy",Qe,!0)};Oe.addEventListener("copy",Qe,!0),document.execCommand("copy")}We.copyText=oe})(Tj||(Tj={}));var Os;(function(We){function oe(dt){let Jt=window.getComputedStyle(dt),jt=parseFloat(Jt.borderTopWidth)||0,Xt=parseFloat(Jt.borderLeftWidth)||0,nr=parseFloat(Jt.borderRightWidth)||0,Ht=parseFloat(Jt.borderBottomWidth)||0,er=parseFloat(Jt.paddingTop)||0,ur=parseFloat(Jt.paddingLeft)||0,ir=parseFloat(Jt.paddingRight)||0,Ot=parseFloat(Jt.paddingBottom)||0,ar=Xt+ur+ir+nr,Lr=jt+er+Ot+Ht;return{borderTop:jt,borderLeft:Xt,borderRight:nr,borderBottom:Ht,paddingTop:er,paddingLeft:ur,paddingRight:ir,paddingBottom:Ot,horizontalSum:ar,verticalSum:Lr}}We.boxSizing=oe;function Ie(dt){let Jt=window.getComputedStyle(dt),jt=parseFloat(Jt.minWidth)||0,Xt=parseFloat(Jt.minHeight)||0,nr=parseFloat(Jt.maxWidth)||1/0,Ht=parseFloat(Jt.maxHeight)||1/0;return nr=Math.max(jt,nr),Ht=Math.max(Xt,Ht),{minWidth:jt,minHeight:Xt,maxWidth:nr,maxHeight:Ht}}We.sizeLimits=Ie;function Oe(dt,Jt,jt){let Xt=dt.getBoundingClientRect();return Jt>=Xt.left&&Jt=Xt.top&&jt=jt.bottom)){if(Xt.topjt.bottom&&Xt.height>=jt.height){dt.scrollTop-=jt.top-Xt.top;return}if(Xt.topjt.height){dt.scrollTop-=jt.bottom-Xt.bottom;return}if(Xt.bottom>jt.bottom&&Xt.height{let Ht=Element.prototype;return Ht.matches||Ht.matchesSelector||Ht.mozMatchesSelector||Ht.msMatchesSelector||Ht.oMatchesSelector||Ht.webkitMatchesSelector||function(er){let ur=this,ir=ur.ownerDocument?ur.ownerDocument.querySelectorAll(er):[];return Array.prototype.indexOf.call(ir,ur)!==-1}})();function oe(Ht){Ht=Ht.split(",",1)[0];let er=0,ur=0,ir=0;function Ot(ar){let Lr=Ht.match(ar);return Lr===null?!1:(Ht=Ht.slice(Lr[0].length),!0)}for(Ht=Ht.replace(nr," $1 ");Ht.length>0;){if(Ot(Ie)){er++;continue}if(Ot(Oe)){ur++;continue}if(Ot(Qe)){ur++;continue}if(Ot(Jt)){ir++;continue}if(Ot(jt)){ur++;continue}if(Ot(dt)){ir++;continue}if(!Ot(Xt))return 0}return er=Math.min(er,255),ur=Math.min(ur,255),ir=Math.min(ir,255),er<<16|ur<<8|ir}We.calculateSingle=oe;let Ie=/^#[^\s\+>~#\.\[:]+/,Oe=/^\.[^\s\+>~#\.\[:]+/,Qe=/^\[[^\]]+\]/,dt=/^[^\s\+>~#\.\[:]+/,Jt=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,jt=/^:[^\s\+>~#\.\[:]+/,Xt=/^[\s\+>~\*]+/,nr=/:not\(([^\)]+)\)/g})(hd||(hd={}));var pp=hp(lv());var Km=class{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return this._size===0}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let oe=this._first;for(;oe;)yield oe.value,oe=oe.next}*retro(){let oe=this._last;for(;oe;)yield oe.value,oe=oe.prev}*nodes(){let oe=this._first;for(;oe;)yield oe,oe=oe.next}*retroNodes(){let oe=this._last;for(;oe;)yield oe,oe=oe.prev}assign(oe){this.clear();for(let Ie of oe)this.addLast(Ie)}push(oe){this.addLast(oe)}pop(){return this.removeLast()}shift(oe){this.addFirst(oe)}unshift(){return this.removeFirst()}addFirst(oe){let Ie=new dp.LinkedListNode(this,oe);return this._first?(Ie.next=this._first,this._first.prev=Ie,this._first=Ie):(this._first=Ie,this._last=Ie),this._size++,Ie}addLast(oe){let Ie=new dp.LinkedListNode(this,oe);return this._last?(Ie.prev=this._last,this._last.next=Ie,this._last=Ie):(this._first=Ie,this._last=Ie),this._size++,Ie}insertBefore(oe,Ie){if(!Ie||Ie===this._first)return this.addFirst(oe);if(!(Ie instanceof dp.LinkedListNode)||Ie.list!==this)throw new Error("Reference node is not owned by the list.");let Oe=new dp.LinkedListNode(this,oe),Qe=Ie,dt=Qe.prev;return Oe.next=Qe,Oe.prev=dt,Qe.prev=Oe,dt.next=Oe,this._size++,Oe}insertAfter(oe,Ie){if(!Ie||Ie===this._last)return this.addLast(oe);if(!(Ie instanceof dp.LinkedListNode)||Ie.list!==this)throw new Error("Reference node is not owned by the list.");let Oe=new dp.LinkedListNode(this,oe),Qe=Ie,dt=Qe.next;return Oe.next=dt,Oe.prev=Qe,Qe.next=Oe,dt.prev=Oe,this._size++,Oe}removeFirst(){let oe=this._first;if(oe)return oe===this._last?(this._first=null,this._last=null):(this._first=oe.next,this._first.prev=null),oe.list=null,oe.next=null,oe.prev=null,this._size--,oe.value}removeLast(){let oe=this._last;if(oe)return oe===this._first?(this._first=null,this._last=null):(this._last=oe.prev,this._last.next=null),oe.list=null,oe.next=null,oe.prev=null,this._size--,oe.value}removeNode(oe){if(!(oe instanceof dp.LinkedListNode)||oe.list!==this)throw new Error("Node is not owned by the list.");let Ie=oe;Ie===this._first&&Ie===this._last?(this._first=null,this._last=null):Ie===this._first?(this._first=Ie.next,this._first.prev=null):Ie===this._last?(this._last=Ie.prev,this._last.next=null):(Ie.next.prev=Ie.prev,Ie.prev.next=Ie.next),Ie.list=null,Ie.next=null,Ie.prev=null,this._size--}clear(){let oe=this._first;for(;oe;){let Ie=oe.next;oe.list=null,oe.prev=null,oe.next=null,oe=Ie}this._first=null,this._last=null,this._size=0}};(function(We){function oe(Ie){let Oe=new We;return Oe.assign(Ie),Oe}We.from=oe})(Km||(Km={}));var dp;(function(We){class oe{constructor(Oe,Qe){this.list=null,this.next=null,this.prev=null,this.list=Oe,this.value=Qe}}We.LinkedListNode=oe})(dp||(dp={}));var rf=class{constructor(oe){this.type=oe}get isConflatable(){return!1}conflate(oe){return!1}},o0=class extends rf{get isConflatable(){return!0}conflate(oe){return!0}},za;(function(We){let oe=null,Ie=(Ki=>Ia=>{let _i=!1;return Ki.then(()=>!_i&&Ia()),()=>{_i=!0}})(Promise.resolve());function Oe(Ki,Ia){let _i=ur.get(Ki);if(!_i||_i.length===0){Ir(Ki,Ia);return}(0,pp.every)((0,pp.retro)(_i),Yr=>Yr?Lr(Yr,Ki,Ia):!0)&&Ir(Ki,Ia)}We.sendMessage=Oe;function Qe(Ki,Ia){if(!Ia.isConflatable){de(Ki,Ia);return}(0,pp.some)(er,ia=>ia.handler!==Ki||!ia.msg||ia.msg.type!==Ia.type||!ia.msg.isConflatable?!1:ia.msg.conflate(Ia))||de(Ki,Ia)}We.postMessage=Qe;function dt(Ki,Ia){let _i=ur.get(Ki);_i&&_i.indexOf(Ia)!==-1||(_i?_i.push(Ia):ur.set(Ki,[Ia]))}We.installMessageHook=dt;function Jt(Ki,Ia){let _i=ur.get(Ki);if(!_i)return;let ia=_i.indexOf(Ia);ia!==-1&&(_i[ia]=null,qr(_i))}We.removeMessageHook=Jt;function jt(Ki){let Ia=ur.get(Ki);Ia&&Ia.length>0&&(pp.ArrayExt.fill(Ia,null),qr(Ia));for(let _i of er)_i.handler===Ki&&(_i.handler=null,_i.msg=null)}We.clearData=jt;function Xt(){ar||oe===null||(oe(),oe=null,ar=!0,Mr(),ar=!1)}We.flush=Xt;function nr(){return Ot}We.getExceptionHandler=nr;function Ht(Ki){let Ia=Ot;return Ot=Ki,Ia}We.setExceptionHandler=Ht;let er=new Km,ur=new WeakMap,ir=new Set,Ot=Ki=>{console.error(Ki)},ar=!1;function Lr(Ki,Ia,_i){let ia=!0;try{typeof Ki=="function"?ia=Ki(Ia,_i):ia=Ki.messageHook(Ia,_i)}catch(Yr){Ot(Yr)}return ia}function Ir(Ki,Ia){try{Ki.processMessage(Ia)}catch(_i){Ot(_i)}}function de(Ki,Ia){er.addLast({handler:Ki,msg:Ia}),oe===null&&(oe=Ie(Mr))}function Mr(){if(oe=null,er.isEmpty)return;let Ki={handler:null,msg:null};for(er.addLast(Ki);;){let Ia=er.removeFirst();if(Ia===Ki)return;Ia.handler&&Ia.msg&&Oe(Ia.handler,Ia.msg)}}function qr(Ki){ir.size===0&&Ie(Vr),ir.add(Ki)}function Vr(){ir.forEach(ti),ir.clear()}function ti(Ki){pp.ArrayExt.removeAllWhere(Ki,Xr)}function Xr(Ki){return Ki===null}})(za||(za={}));var af=class{constructor(oe){this._pid=uv.nextPID(),this.name=oe.name,this._create=oe.create,this._coerce=oe.coerce||null,this._compare=oe.compare||null,this._changed=oe.changed||null}get(oe){let Ie,Oe=uv.ensureMap(oe);return this._pid in Oe?Ie=Oe[this._pid]:Ie=Oe[this._pid]=this._createValue(oe),Ie}set(oe,Ie){let Oe,Qe=uv.ensureMap(oe);this._pid in Qe?Oe=Qe[this._pid]:Oe=Qe[this._pid]=this._createValue(oe);let dt=this._coerceValue(oe,Ie);this._maybeNotify(oe,Oe,Qe[this._pid]=dt)}coerce(oe){let Ie,Oe=uv.ensureMap(oe);this._pid in Oe?Ie=Oe[this._pid]:Ie=Oe[this._pid]=this._createValue(oe);let Qe=this._coerceValue(oe,Ie);this._maybeNotify(oe,Ie,Oe[this._pid]=Qe)}_createValue(oe){let Ie=this._create;return Ie(oe)}_coerceValue(oe,Ie){let Oe=this._coerce;return Oe?Oe(oe,Ie):Ie}_compareValue(oe,Ie){let Oe=this._compare;return Oe?Oe(oe,Ie):oe===Ie}_maybeNotify(oe,Ie,Oe){let Qe=this._changed;Qe&&!this._compareValue(Ie,Oe)&&Qe(oe,Ie,Oe)}};(function(We){function oe(Ie){uv.ownerData.delete(Ie)}We.clearData=oe})(af||(af={}));var uv;(function(We){We.ownerData=new WeakMap,We.nextPID=(()=>{let Ie=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${Ie++}`})();function oe(Ie){let Oe=We.ownerData.get(Ie);return Oe||(Oe=Object.create(null),We.ownerData.set(Ie,Oe),Oe)}We.ensureMap=oe})(uv||(uv={}));var ew=hp(lv()),zce=hp(Q2()),Ls=class{constructor(oe){this.sender=oe}connect(oe,Ie){return rh.connect(this,oe,Ie)}disconnect(oe,Ie){return rh.disconnect(this,oe,Ie)}emit(oe){rh.emit(this,oe)}};(function(We){function oe(Xt,nr){rh.disconnectBetween(Xt,nr)}We.disconnectBetween=oe;function Ie(Xt){rh.disconnectSender(Xt)}We.disconnectSender=Ie;function Oe(Xt){rh.disconnectReceiver(Xt)}We.disconnectReceiver=Oe;function Qe(Xt){rh.disconnectAll(Xt)}We.disconnectAll=Qe;function dt(Xt){rh.disconnectAll(Xt)}We.clearData=dt;function Jt(){return rh.exceptionHandler}We.getExceptionHandler=Jt;function jt(Xt){let nr=rh.exceptionHandler;return rh.exceptionHandler=Xt,nr}We.setExceptionHandler=jt})(Ls||(Ls={}));var rh;(function(We){We.exceptionHandler=de=>{console.error(de)};function oe(de,Mr,qr){qr=qr||void 0;let Vr=Xt.get(de.sender);if(Vr||(Vr=[],Xt.set(de.sender,Vr)),ur(Vr,de,Mr,qr))return!1;let ti=qr||Mr,Xr=nr.get(ti);Xr||(Xr=[],nr.set(ti,Xr));let Ki={signal:de,slot:Mr,thisArg:qr};return Vr.push(Ki),Xr.push(Ki),!0}We.connect=oe;function Ie(de,Mr,qr){qr=qr||void 0;let Vr=Xt.get(de.sender);if(!Vr||Vr.length===0)return!1;let ti=ur(Vr,de,Mr,qr);if(!ti)return!1;let Xr=qr||Mr,Ki=nr.get(Xr);return ti.signal=null,Ot(Vr),Ot(Ki),!0}We.disconnect=Ie;function Oe(de,Mr){let qr=Xt.get(de);if(!qr||qr.length===0)return;let Vr=nr.get(Mr);if(!(!Vr||Vr.length===0)){for(let ti of Vr)ti.signal&&ti.signal.sender===de&&(ti.signal=null);Ot(qr),Ot(Vr)}}We.disconnectBetween=Oe;function Qe(de){let Mr=Xt.get(de);if(!(!Mr||Mr.length===0)){for(let qr of Mr){if(!qr.signal)continue;let Vr=qr.thisArg||qr.slot;qr.signal=null,Ot(nr.get(Vr))}Ot(Mr)}}We.disconnectSender=Qe;function dt(de){let Mr=nr.get(de);if(!(!Mr||Mr.length===0)){for(let qr of Mr){if(!qr.signal)continue;let Vr=qr.signal.sender;qr.signal=null,Ot(Xt.get(Vr))}Ot(Mr)}}We.disconnectReceiver=dt;function Jt(de){Qe(de),dt(de)}We.disconnectAll=Jt;function jt(de,Mr){let qr=Xt.get(de.sender);if(!(!qr||qr.length===0))for(let Vr=0,ti=qr.length;Vrti.signal===Mr&&ti.slot===qr&&ti.thisArg===Vr)}function ir(de,Mr){let{signal:qr,slot:Vr,thisArg:ti}=de;try{Vr.call(ti,qr.sender,Mr)}catch(Xr){We.exceptionHandler(Xr)}}function Ot(de){Ht.size===0&&er(ar),Ht.add(de)}function ar(){Ht.forEach(Lr),Ht.clear()}function Lr(de){ew.ArrayExt.removeAllWhere(de,Ir)}function Ir(de){return de.signal===null}})(rh||(rh={}));var s0=class{constructor(oe){this._fn=oe}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let oe=this._fn;this._fn=null,oe()}};var uy=class{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(oe=>{oe.dispose()}),this._items.clear())}contains(oe){return this._items.has(oe)}add(oe){this._items.add(oe)}remove(oe){this._items.delete(oe)}clear(){this._items.clear()}};(function(We){function oe(Ie){let Oe=new We;for(let Qe of Ie)Oe.add(Qe);return Oe}We.from=oe})(uy||(uy={}));var tw=class extends uy{constructor(){super(...arguments),this._disposed=new Ls(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),Ls.clearData(this))}};(function(We){function oe(Ie){let Oe=new We;for(let Qe of Ie)Oe.add(Qe);return Oe}We.from=oe})(tw||(tw={}));var nf=class We{constructor(oe){this._onScrollFrame=()=>{if(!this._scrollTarget)return;let{element:Ie,edge:Oe,distance:Qe}=this._scrollTarget,dt=jc.SCROLL_EDGE_SIZE-Qe,Jt=Math.pow(dt/jc.SCROLL_EDGE_SIZE,2),jt=Math.max(1,Math.round(Jt*jc.SCROLL_EDGE_SIZE));switch(Oe){case"top":Ie.scrollTop-=jt;break;case"left":Ie.scrollLeft-=jt;break;case"right":Ie.scrollLeft+=jt;break;case"bottom":Ie.scrollTop+=jt;break}requestAnimationFrame(this._onScrollFrame)},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.document=oe.document||document,this.mimeData=oe.mimeData,this.dragImage=oe.dragImage||null,this.proposedAction=oe.proposedAction||"copy",this.supportedActions=oe.supportedActions||"all",this.source=oe.source||null}dispose(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){let oe=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,clientX:-1,clientY:-1});jc.dispatchDragLeave(this,this._currentTarget,null,oe)}this._finalize("none")}}get isDisposed(){return this._disposed}start(oe,Ie){if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(oe,Ie),this._promise=new Promise(Qe=>{this._resolve=Qe});let Oe=new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,clientX:oe,clientY:Ie});return document.dispatchEvent(Oe),this._promise}handleEvent(oe){switch(oe.type){case"pointermove":this._evtPointerMove(oe);break;case"pointerup":this._evtPointerUp(oe);break;case"keydown":this._evtKeyDown(oe);break;default:oe.preventDefault(),oe.stopPropagation();break}}moveDragImage(oe,Ie){if(!this.dragImage)return;let Oe=this.dragImage.style;Oe.transform=`translate(${oe}px, ${Ie}px)`}_evtPointerMove(oe){oe.preventDefault(),oe.stopPropagation(),this._updateCurrentTarget(oe),this._updateDragScroll(oe),this.moveDragImage(oe.clientX,oe.clientY)}_evtPointerUp(oe){if(oe.preventDefault(),oe.stopPropagation(),oe.button!==0)return;if(this._updateCurrentTarget(oe),!this._currentTarget){this._finalize("none");return}if(this._dropAction==="none"){jc.dispatchDragLeave(this,this._currentTarget,null,oe),this._finalize("none");return}let Ie=jc.dispatchDrop(this,this._currentTarget,oe);this._finalize(Ie)}_evtKeyDown(oe){oe.preventDefault(),oe.stopPropagation(),oe.keyCode===27&&this.dispose()}_addListeners(){document.addEventListener("pointerdown",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("pointerup",this,!0),document.addEventListener("pointerenter",this,!0),document.addEventListener("pointerleave",this,!0),document.addEventListener("pointerover",this,!0),document.addEventListener("pointerout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)}_removeListeners(){document.removeEventListener("pointerdown",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointerenter",this,!0),document.removeEventListener("pointerleave",this,!0),document.removeEventListener("pointerover",this,!0),document.removeEventListener("pointerout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)}_updateDragScroll(oe){let Ie=jc.findScrollTarget(oe);!this._scrollTarget&&!Ie||(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=Ie)}_updateCurrentTarget(oe){let Ie=this._currentTarget,Oe=this._currentTarget,Qe=this._currentElement,dt=jc.findElementBehindBackdrop(oe,this.document);this._currentElement=dt,dt!==Qe&&dt!==Oe&&jc.dispatchDragExit(this,Oe,dt,oe),dt!==Qe&&dt!==Oe&&(Oe=jc.dispatchDragEnter(this,dt,Oe,oe)),Oe!==Ie&&(this._currentTarget=Oe,jc.dispatchDragLeave(this,Ie,Oe,oe));let Jt=jc.dispatchDragOver(this,Oe,oe);this._setDropAction(Jt)}_attachDragImage(oe,Ie){if(!this.dragImage)return;this.dragImage.classList.add("lm-mod-drag-image");let Oe=this.dragImage.style;Oe.pointerEvents="none",Oe.position="fixed",Oe.transform=`translate(${oe}px, ${Ie}px)`,(this.document instanceof Document?this.document.body:this.document.firstElementChild).appendChild(this.dragImage)}_detachDragImage(){if(!this.dragImage)return;let oe=this.dragImage.parentNode;oe&&oe.removeChild(this.dragImage)}_setDropAction(oe){if(oe=jc.validateAction(oe,this.supportedActions),!(this._override&&this._dropAction===oe))switch(oe){case"none":this._dropAction=oe,this._override=We.overrideCursor("no-drop",this.document);break;case"copy":this._dropAction=oe,this._override=We.overrideCursor("copy",this.document);break;case"link":this._dropAction=oe,this._override=We.overrideCursor("alias",this.document);break;case"move":this._dropAction=oe,this._override=We.overrideCursor("move",this.document);break}}_finalize(oe){let Ie=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,Ie&&Ie(oe)}};(function(We){class oe extends DragEvent{constructor(Qe,dt){super(dt.type,{bubbles:!0,cancelable:!0,altKey:Qe.altKey,button:Qe.button,clientX:Qe.clientX,clientY:Qe.clientY,ctrlKey:Qe.ctrlKey,detail:0,metaKey:Qe.metaKey,relatedTarget:dt.related,screenX:Qe.screenX,screenY:Qe.screenY,shiftKey:Qe.shiftKey,view:window});let{drag:Jt}=dt;this.dropAction="none",this.mimeData=Jt.mimeData,this.proposedAction=Jt.proposedAction,this.supportedActions=Jt.supportedActions,this.source=Jt.source}}We.Event=oe;function Ie(Oe,Qe=document){return jc.overrideCursor(Oe,Qe)}We.overrideCursor=Ie})(nf||(nf={}));var jc;(function(We){We.SCROLL_EDGE_SIZE=20;function oe(qr,Vr){return er[qr]&ur[Vr]?qr:"none"}We.validateAction=oe;function Ie(qr,Vr=document){if(qr){if(Oe&&qr==Oe.event)return Oe.element;We.cursorBackdrop.style.zIndex="-1000";let ti=Vr.elementFromPoint(qr.clientX,qr.clientY);return We.cursorBackdrop.style.zIndex="",Oe={event:qr,element:ti},ti}else{let ti=We.cursorBackdrop.style.transform;if(Qe&&ti===Qe.transform)return Qe.element;let Xr=We.cursorBackdrop.getBoundingClientRect();We.cursorBackdrop.style.zIndex="-1000";let Ki=Vr.elementFromPoint(Xr.left+Xr.width/2,Xr.top+Xr.height/2);return We.cursorBackdrop.style.zIndex="",Qe={transform:ti,element:Ki},Ki}}We.findElementBehindBackdrop=Ie;let Oe=null,Qe=null;function dt(qr){let Vr=qr.clientX,ti=qr.clientY,Xr=Ie(qr);for(;Xr;Xr=Xr.parentElement){if(!Xr.hasAttribute("data-lm-dragscroll"))continue;let Ki=0,Ia=0;Xr===document.body&&(Ki=window.pageXOffset,Ia=window.pageYOffset);let _i=Xr.getBoundingClientRect(),ia=_i.top+Ia,Yr=_i.left+Ki,Ba=Yr+_i.width,eo=ia+_i.height;if(Vr=Ba||ti=eo)continue;let rs=Vr-Yr+1,Oo=ti-ia+1,da=Ba-Vr,cn=eo-ti,Ss=Math.min(rs,Oo,da,cn);if(Ss>We.SCROLL_EDGE_SIZE)continue;let is;switch(Ss){case cn:is="bottom";break;case Oo:is="top";break;case da:is="right";break;case rs:is="left";break;default:throw"unreachable"}let Do=Xr.scrollWidth-Xr.clientWidth,sl=Xr.scrollHeight-Xr.clientHeight,cu;switch(is){case"top":cu=sl>0&&Xr.scrollTop>0;break;case"left":cu=Do>0&&Xr.scrollLeft>0;break;case"right":cu=Do>0&&Xr.scrollLeft0&&Xr.scrollTop{ti===Mr&&We.cursorBackdrop.isConnected&&(document.removeEventListener("pointermove",Ot,!0),We.cursorBackdrop.removeEventListener("scroll",ar,!0),Xr.removeChild(We.cursorBackdrop))})}We.overrideCursor=ir;function Ot(qr){if(We.cursorBackdrop){We.cursorBackdrop.style.transform=`translate(${qr.clientX}px, ${qr.clientY}px)`;try{We.cursorBackdrop.hasPointerCapture(qr.pointerId)||We.cursorBackdrop.setPointerCapture(qr.pointerId)}catch{}}}function ar(qr){if(!We.cursorBackdrop)return;let Vr=Ie();if(!Vr)return;let ti=Vr.closest("[data-lm-dragscroll]");ti&&(ti.scrollTop+=We.cursorBackdrop.scrollTop-Ir,ti.scrollLeft+=We.cursorBackdrop.scrollLeft-Ir,Lr())}function Lr(){We.cursorBackdrop.scrollTop=Ir,We.cursorBackdrop.scrollLeft=Ir}let Ir=500;function de(){let qr=document.createElement("div");return qr.classList.add("lm-cursor-backdrop"),qr}let Mr=0;We.cursorBackdrop=de()})(jc||(jc={}));var Aj=hp(lv()),cc=hp(Q2());function Jm(){return YS.keyboardLayout}var cy=class We{constructor(oe,Ie,Oe=[]){this.name=oe,this._codes=Ie,this._keys=We.extractKeys(Ie),this._modifierKeys=We.convertToKeySet(Oe)}keys(){return Object.keys(this._keys)}isValidKey(oe){return oe in this._keys}isModifierKey(oe){return oe in this._modifierKeys}keyForKeydownEvent(oe){return this._codes[oe.keyCode]||""}};(function(We){function oe(Oe){let Qe=Object.create(null);for(let dt in Oe)Qe[Oe[dt]]=!0;return Qe}We.extractKeys=oe;function Ie(Oe){let Qe=Object(null);for(let dt=0,Jt=Oe.length;dt{this._commands.delete(oe),this._commandChanged.emit({id:oe,type:"removed"})})}notifyCommandChanged(oe){if(oe!==void 0&&!this._commands.has(oe))throw new Error(`Command '${oe}' is not registered.`);this._commandChanged.emit({id:oe,type:oe?"changed":"many-changed"})}describedBy(oe,Ie=cc.JSONExt.emptyObject){var Oe;let Qe=this._commands.get(oe);return Promise.resolve((Oe=Qe?.describedBy.call(void 0,Ie))!==null&&Oe!==void 0?Oe:{args:null})}label(oe,Ie=cc.JSONExt.emptyObject){var Oe;let Qe=this._commands.get(oe);return(Oe=Qe?.label.call(void 0,Ie))!==null&&Oe!==void 0?Oe:""}mnemonic(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.mnemonic.call(void 0,Ie):-1}icon(oe,Ie=cc.JSONExt.emptyObject){var Oe;return(Oe=this._commands.get(oe))===null||Oe===void 0?void 0:Oe.icon.call(void 0,Ie)}iconClass(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.iconClass.call(void 0,Ie):""}iconLabel(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.iconLabel.call(void 0,Ie):""}caption(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.caption.call(void 0,Ie):""}usage(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.usage.call(void 0,Ie):""}className(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.className.call(void 0,Ie):""}dataset(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.dataset.call(void 0,Ie):{}}isEnabled(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isEnabled.call(void 0,Ie):!1}isToggled(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isToggled.call(void 0,Ie):!1}isToggleable(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isToggleable:!1}isVisible(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isVisible.call(void 0,Ie):!1}execute(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);if(!Oe)return Promise.reject(new Error(`Command '${oe}' not registered.`));let Qe;try{Qe=Oe.execute.call(void 0,Ie)}catch(Jt){Qe=Promise.reject(Jt)}let dt=Promise.resolve(Qe);return this._commandExecuted.emit({id:oe,args:Ie,result:dt}),dt}addKeyBinding(oe){let Ie=pd.createKeyBinding(oe);return this._keyBindings.push(Ie),this._keyBindingChanged.emit({binding:Ie,type:"added"}),new s0(()=>{Aj.ArrayExt.removeFirstOf(this._keyBindings,Ie),this._keyBindingChanged.emit({binding:Ie,type:"removed"})})}processKeydownEvent(oe){if(oe.defaultPrevented||this._replaying)return;let Ie=We.keystrokeForKeydownEvent(oe);if(!Ie){this._replayKeydownEvents(),this._clearPendingState();return}if(We.isModifierKeyPressed(oe)){let{exact:Jt}=pd.matchKeyBinding(this._keyBindings,[Ie],oe);Jt?(oe.preventDefault(),oe.stopPropagation(),this._startModifierTimer(Jt)):this._clearModifierTimer();return}this._keystrokes.push(Ie);let{exact:Oe,partial:Qe}=pd.matchKeyBinding(this._keyBindings,this._keystrokes,oe),dt=Qe.length!==0;if(!Oe&&!dt){this._replayKeydownEvents(),this._clearPendingState();return}if((Oe?.preventDefault||Qe.some(Jt=>Jt.preventDefault))&&(oe.preventDefault(),oe.stopPropagation()),this._keydownEvents.push(oe),Oe&&!dt){this._executeKeyBinding(Oe),this._clearPendingState();return}Oe&&(this._exactKeyMatch=Oe),this._startTimer()}holdKeyBindingExecution(oe,Ie){this._holdKeyBindingPromises.set(oe,Ie)}processKeyupEvent(oe){this._clearModifierTimer()}_startModifierTimer(oe){this._clearModifierTimer(),this._timerModifierID=window.setTimeout(()=>{this._executeKeyBinding(oe)},pd.modifierkeyTimeOut)}_clearModifierTimer(){this._timerModifierID!==0&&(clearTimeout(this._timerModifierID),this._timerModifierID=0)}_startTimer(){this._clearTimer(),this._timerID=window.setTimeout(()=>{this._onPendingTimeout()},pd.CHORD_TIMEOUT)}_clearTimer(){this._timerID!==0&&(clearTimeout(this._timerID),this._timerID=0)}_replayKeydownEvents(){this._keydownEvents.length!==0&&(this._replaying=!0,this._keydownEvents.forEach(pd.replayKeyEvent),this._replaying=!1)}async _executeKeyBinding(oe){if(this._holdKeyBindingPromises.size!==0){let dt=[...this._keydownEvents],Jt=(await Promise.race([Promise.all(dt.map(async jt=>{var Xt;return(Xt=this._holdKeyBindingPromises.get(jt))!==null&&Xt!==void 0?Xt:Promise.resolve(!0)})),new Promise(jt=>{setTimeout(()=>jt([!1]),pd.KEYBINDING_HOLD_TIMEOUT)})])).every(Boolean);if(this._holdKeyBindingPromises.clear(),!Jt)return}let{command:Ie,args:Oe}=oe,Qe={_luminoEvent:{type:"keybinding",keys:oe.keys},...Oe};if(!this.hasCommand(Ie)||!this.isEnabled(Ie,Qe)){let dt=this.hasCommand(Ie)?"enabled":"registered",jt=`Cannot execute key binding '${oe.keys.join(", ")}':`,Xt=`command '${Ie}' is not ${dt}.`;console.warn(`${jt} ${Xt}`);return}await this.execute(Ie,Qe)}_clearPendingState(){this._clearTimer(),this._clearModifierTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0}_onPendingTimeout(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()}};(function(We){function oe(jt){let Xt="",nr=!1,Ht=!1,er=!1,ur=!1;for(let ir of jt.split(/\s+/))ir==="Accel"?Nc.IS_MAC?Ht=!0:er=!0:ir==="Alt"?nr=!0:ir==="Cmd"?Ht=!0:ir==="Ctrl"?er=!0:ir==="Shift"?ur=!0:ir.length>0&&(Xt=ir);return{cmd:Ht,ctrl:er,alt:nr,shift:ur,key:Xt}}We.parseKeystroke=oe;function Ie(jt){let Xt="",nr=oe(jt);return nr.ctrl&&(Xt+="Ctrl "),nr.alt&&(Xt+="Alt "),nr.shift&&(Xt+="Shift "),nr.cmd&&Nc.IS_MAC&&(Xt+="Cmd "),nr.key?Xt+nr.key:Xt.trim()}We.normalizeKeystroke=Ie;function Oe(jt){let Xt;return Nc.IS_WIN?Xt=jt.winKeys||jt.keys:Nc.IS_MAC?Xt=jt.macKeys||jt.keys:Xt=jt.linuxKeys||jt.keys,Xt.map(Ie)}We.normalizeKeys=Oe;function Qe(jt){return typeof jt=="string"?Xt(jt):jt.map(Xt).join(", ");function Xt(nr){let Ht=[],er=Nc.IS_MAC?" ":"+",ur=oe(nr);return ur.ctrl&&Ht.push("Ctrl"),ur.alt&&Ht.push("Alt"),ur.shift&&Ht.push("Shift"),Nc.IS_MAC&&ur.cmd&&Ht.push("Cmd"),Ht.push(ur.key),Ht.map(pd.formatKey).join(er)}}We.formatKeystroke=Qe;function dt(jt){let Xt=Jm(),nr=Xt.keyForKeydownEvent(jt);return Xt.isModifierKey(nr)}We.isModifierKeyPressed=dt;function Jt(jt){let Xt=Jm(),nr=Xt.keyForKeydownEvent(jt),Ht=[];return jt.ctrlKey&&Ht.push("Ctrl"),jt.altKey&&Ht.push("Alt"),jt.shiftKey&&Ht.push("Shift"),jt.metaKey&&Nc.IS_MAC&&Ht.push("Cmd"),Xt.isModifierKey(nr)||Ht.push(nr),Ht.join(" ")}We.keystrokeForKeydownEvent=Jt})(vp||(vp={}));var pd;(function(We){We.CHORD_TIMEOUT=1e3,We.KEYBINDING_HOLD_TIMEOUT=1e3,We.modifierkeyTimeOut=500;function oe(Mr){return{execute:Mr.execute,describedBy:Ot(typeof Mr.describedBy=="function"?Mr.describedBy:{args:null,...Mr.describedBy},()=>({args:null})),label:Ot(Mr.label,Xt),mnemonic:Ot(Mr.mnemonic,nr),icon:Ot(Mr.icon,ir),iconClass:Ot(Mr.iconClass,Xt),iconLabel:Ot(Mr.iconLabel,Xt),caption:Ot(Mr.caption,Xt),usage:Ot(Mr.usage,Xt),className:Ot(Mr.className,Xt),dataset:Ot(Mr.dataset,ur),isEnabled:Mr.isEnabled||Ht,isToggled:Mr.isToggled||er,isToggleable:Mr.isToggleable||!!Mr.isToggled,isVisible:Mr.isVisible||Ht}}We.createCommand=oe;function Ie(Mr){var qr;return{keys:vp.normalizeKeys(Mr),selector:ar(Mr),command:Mr.command,args:Mr.args||cc.JSONExt.emptyObject,preventDefault:(qr=Mr.preventDefault)!==null&&qr!==void 0?qr:!0}}We.createKeyBinding=Ie;function Oe(Mr,qr,Vr){let ti=null,Xr=[],Ki=1/0,Ia=0;for(let _i=0,ia=Mr.length;_iKi)continue;let rs=dd.calculateSpecificity(Yr.selector);(!ti||eo=Ia)&&(ti=Yr,Ki=eo,Ia=rs)}return{exact:ti,partial:Xr}}We.matchKeyBinding=Oe;function Qe(Mr){Mr.target.dispatchEvent(de(Mr))}We.replayKeyEvent=Qe;function dt(Mr){return Nc.IS_MAC?Jt.hasOwnProperty(Mr)?Jt[Mr]:Mr:jt.hasOwnProperty(Mr)?jt[Mr]:Mr}We.formatKey=dt;let Jt={Backspace:"\u232B",Tab:"\u21E5",Enter:"\u23CE",Shift:"\u21E7",Ctrl:"\u2303",Alt:"\u2325",Escape:"\u238B",PageUp:"\u21DE",PageDown:"\u21DF",End:"\u2198",Home:"\u2196",ArrowLeft:"\u2190",ArrowUp:"\u2191",ArrowRight:"\u2192",ArrowDown:"\u2193",Delete:"\u2326",Cmd:"\u2318"},jt={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},Xt=()=>"",nr=()=>-1,Ht=()=>!0,er=()=>!1,ur=()=>({}),ir=()=>{};function Ot(Mr,qr){return Mr===void 0?qr:typeof Mr=="function"?Mr:()=>Mr}function ar(Mr){if(Mr.selector.indexOf(",")!==-1)throw new Error(`Selector cannot contain commas: ${Mr.selector}`);if(!dd.isValid(Mr.selector))throw new Error(`Invalid selector: ${Mr.selector}`);return Mr.selector}function Lr(Mr,qr){if(Mr.lengthqr.length?2:1}function Ir(Mr,qr){let Vr=qr.target,ti=qr.currentTarget;for(let Xr=0;Vr!==null;Vr=Vr.parentElement,++Xr){if(Vr.hasAttribute("data-lm-suppress-shortcuts"))return-1;if(dd.matches(Vr,Mr))return Xr;if(Vr===ti)return-1}return-1}function de(Mr){let qr=document.createEvent("Event"),Vr=Mr.bubbles||!0,ti=Mr.cancelable||!0;return qr.initEvent(Mr.type||"keydown",Vr,ti),qr.key=Mr.key||"",qr.keyCode=Mr.keyCode||0,qr.which=Mr.keyCode||0,qr.ctrlKey=Mr.ctrlKey||!1,qr.altKey=Mr.altKey||!1,qr.shiftKey=Mr.shiftKey||!1,qr.metaKey=Mr.metaKey||!1,qr.view=Mr.view||window,qr}})(pd||(pd={}));var Qm=hp(lv()),e1=class{constructor(oe){this.type="text",this.content=oe}},fy=class{constructor(oe,Ie,Oe,Qe){this.type="element",this.tag=oe,this.attrs=Ie,this.children=Oe,this.renderer=Qe}};function Fs(We){let oe={},Ie,Oe=[];for(let dt=1,Jt=arguments.length;dt=Ir.length){Ie(ar[qr],ir);continue}let Vr=Ir[qr],ti=ar[qr];if(Vr===ti){de=de.nextSibling;continue}if(Vr.type==="text"&&ti.type==="text"){de.textContent!==ti.content&&(de.textContent=ti.content),de=de.nextSibling;continue}if(Vr.type==="text"||ti.type==="text"){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}if(!Vr.renderer!=!ti.renderer){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}let Xr=ti.attrs.key;if(Xr&&Xr in Lr){let Ia=Lr[Xr];Ia.vNode!==Vr&&(Qm.ArrayExt.move(Ir,Ir.indexOf(Ia.vNode,qr+1),qr),ir.insertBefore(Ia.element,de),Vr=Ia.vNode,de=Ia.element)}if(Vr===ti){de=de.nextSibling;continue}let Ki=Vr.attrs.key;if(Ki&&Ki!==Xr){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}if(Vr.tag!==ti.tag){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}jt(de,Vr.attrs,ti.attrs),ti.renderer?ti.renderer.render(de,{attrs:ti.attrs,children:ti.children}):Oe(de,Vr.children,ti.children),de=de.nextSibling}Qe(ir,Ir,Mr,!0)}We.updateContent=Oe;function Qe(ir,Ot,ar,Lr){for(let Ir=Ot.length-1;Ir>=ar;--Ir){let de=Ot[Ir],Mr=Lr?ir.lastChild:ir.childNodes[Ir];de.type==="text"||(de.renderer&&de.renderer.unrender?de.renderer.unrender(Mr,{attrs:de.attrs,children:de.children}):Qe(Mr,de.children,0,!1)),Lr&&ir.removeChild(Mr)}}let dt={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function Jt(ir,Ot){for(let ar in Ot)ar in dt||(ar.substr(0,2)==="on"?ir[ar]=Ot[ar]:ir.setAttribute(ar,Ot[ar]));Ot.className!==void 0&&ir.setAttribute("class",Ot.className),Ot.htmlFor!==void 0&&ir.setAttribute("for",Ot.htmlFor),Ot.dataset&&Xt(ir,Ot.dataset),Ot.style&&Ht(ir,Ot.style)}function jt(ir,Ot,ar){if(Ot===ar)return;let Lr;for(Lr in Ot)Lr in dt||Lr in ar||(Lr.substr(0,2)==="on"?ir[Lr]=null:ir.removeAttribute(Lr));for(Lr in ar)Lr in dt||Ot[Lr]===ar[Lr]||(Lr.substr(0,2)==="on"?ir[Lr]=ar[Lr]:ir.setAttribute(Lr,ar[Lr]));Ot.className!==ar.className&&(ar.className!==void 0?ir.setAttribute("class",ar.className):ir.removeAttribute("class")),Ot.htmlFor!==ar.htmlFor&&(ar.htmlFor!==void 0?ir.setAttribute("for",ar.htmlFor):ir.removeAttribute("for")),Ot.dataset!==ar.dataset&&nr(ir,Ot.dataset||{},ar.dataset||{}),Ot.style!==ar.style&&er(ir,Ot.style||{},ar.style||{})}function Xt(ir,Ot){for(let ar in Ot)ir.setAttribute(`data-${ar}`,Ot[ar])}function nr(ir,Ot,ar){for(let Lr in Ot)Lr in ar||ir.removeAttribute(`data-${Lr}`);for(let Lr in ar)Ot[Lr]!==ar[Lr]&&ir.setAttribute(`data-${Lr}`,ar[Lr])}function Ht(ir,Ot){let ar=ir.style,Lr;for(Lr in Ot)ar[Lr]=Ot[Lr]}function er(ir,Ot,ar){let Lr=ir.style,Ir;for(Ir in Ot)Ir in ar||(Lr[Ir]="");for(Ir in ar)Ot[Ir]!==ar[Ir]&&(Lr[Ir]=ar[Ir])}function ur(ir,Ot){let ar=ir.firstChild,Lr=Object.create(null);for(let Ir of Ot)Ir.type==="element"&&Ir.attrs.key&&(Lr[Ir.attrs.key]={vNode:Ir,element:ar}),ar=ar.nextSibling;return Lr}})(cv||(cv={}));var Wd=class{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}},ih;(function(We){function oe(dt,Jt){let jt=dt.length;if(jt===0)return Jt;let Xt=0,nr=0,Ht=0,er=0,ur=0;for(let ar=0;ar0&&(er+=Lr.stretch,ur++)}if(Jt===Ht)return 0;if(Jt<=Xt){for(let ar=0;ar=nr){for(let ar=0;ar0&&ar>ir;){let Lr=ar,Ir=er;for(let de=0;de0&&ar>ir;){let Lr=ar/Ot;for(let Ir=0;Ir0&&ar>ir;){let Lr=ar,Ir=er;for(let de=0;de=Mr.maxSize?(ar-=Mr.maxSize-Mr.size,er-=Mr.stretch,Mr.size=Mr.maxSize,Mr.done=!0,Ot--,ur--):(ar-=qr,Mr.size+=qr)}}for(;Ot>0&&ar>ir;){let Lr=ar/Ot;for(let Ir=0;Ir=de.maxSize?(ar-=de.maxSize-de.size,de.size=de.maxSize,de.done=!0,Ot--):(ar-=Lr,de.size+=Lr))}}}return 0}We.calc=oe;function Ie(dt,Jt,jt){dt.length===0||jt===0||(jt>0?Oe(dt,Jt,jt):Qe(dt,Jt,-jt))}We.adjust=Ie;function Oe(dt,Jt,jt){let Xt=0;for(let ur=0;ur<=Jt;++ur){let ir=dt[ur];Xt+=ir.maxSize-ir.size}let nr=0;for(let ur=Jt+1,ir=dt.length;ur=0&&Ht>0;--ur){let ir=dt[ur],Ot=ir.maxSize-ir.size;Ot>=Ht?(ir.sizeHint=ir.size+Ht,Ht=0):(ir.sizeHint=ir.size+Ot,Ht-=Ot)}let er=jt;for(let ur=Jt+1,ir=dt.length;ur0;++ur){let Ot=dt[ur],ar=Ot.size-Ot.minSize;ar>=er?(Ot.sizeHint=Ot.size-er,er=0):(Ot.sizeHint=Ot.size-ar,er-=ar)}}function Qe(dt,Jt,jt){let Xt=0;for(let ur=Jt+1,ir=dt.length;ur0;++ur){let Ot=dt[ur],ar=Ot.maxSize-Ot.size;ar>=Ht?(Ot.sizeHint=Ot.size+Ht,Ht=0):(Ot.sizeHint=Ot.size+ar,Ht-=ar)}let er=jt;for(let ur=Jt;ur>=0&&er>0;--ur){let ir=dt[ur],Ot=ir.size-ir.minSize;Ot>=er?(ir.sizeHint=ir.size-er,er=0):(ir.sizeHint=ir.size-Ot,er-=Ot)}}})(ih||(ih={}));var hy=class{constructor(oe){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new Ls(this),this._isDisposed=!1,this.owner=oe.owner,oe.label!==void 0&&(this._label=oe.label),oe.mnemonic!==void 0&&(this._mnemonic=oe.mnemonic),oe.icon!==void 0&&(this._icon=oe.icon),oe.iconClass!==void 0&&(this._iconClass=oe.iconClass),oe.iconLabel!==void 0&&(this._iconLabel=oe.iconLabel),oe.caption!==void 0&&(this._caption=oe.caption),oe.className!==void 0&&(this._className=oe.className),oe.closable!==void 0&&(this._closable=oe.closable),this._dataset=oe.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(oe){this._label!==oe&&(this._label=oe,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(oe){this._mnemonic!==oe&&(this._mnemonic=oe,this._changed.emit(void 0))}get icon(){return this._icon}set icon(oe){this._icon!==oe&&(this._icon=oe,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(oe){this._iconClass!==oe&&(this._iconClass=oe,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(oe){this._iconLabel!==oe&&(this._iconLabel=oe,this._changed.emit(void 0))}get caption(){return this._caption}set caption(oe){this._caption!==oe&&(this._caption=oe,this._changed.emit(void 0))}get className(){return this._className}set className(oe){this._className!==oe&&(this._className=oe,this._changed.emit(void 0))}get closable(){return this._closable}set closable(oe){this._closable!==oe&&(this._closable=oe,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(oe){this._dataset!==oe&&(this._dataset=oe,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,Ls.clearData(this))}},Ya=class We{constructor(oe={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new Ls(this),this._hiddenMode=We.HiddenMode.Display,this.node=rw.createNode(oe),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(We.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&We.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),Ls.clearData(this),za.clearData(this),af.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(We.Flag.IsDisposed)}get isAttached(){return this.testFlag(We.Flag.IsAttached)}get isHidden(){return this.testFlag(We.Flag.IsHidden)}get isVisible(){let oe=this;do{if(oe.isHidden||!oe.isAttached)return!1;oe=oe.parent}while(oe!=null);return!0}get title(){return rw.titleProperty.get(this)}get id(){return this.node.id}set id(oe){this.node.id=oe}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(oe){this._hiddenMode!==oe&&(this.isHidden&&this._toggleHidden(!1),oe==We.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=oe,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(oe){if(this._parent!==oe){if(oe&&this.contains(oe))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let Ie=new We.ChildMessage("child-removed",this);za.sendMessage(this._parent,Ie)}if(this._parent=oe,this._parent&&!this._parent.isDisposed){let Ie=new We.ChildMessage("child-added",this);za.sendMessage(this._parent,Ie)}this.isDisposed||za.sendMessage(this,We.Msg.ParentChanged)}}get layout(){return this._layout}set layout(oe){if(this._layout!==oe){if(this.testFlag(We.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(oe.parent)throw new Error("Cannot change layout parent.");this._layout=oe,oe.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(oe){for(let Ie=oe;Ie;Ie=Ie._parent)if(Ie===this)return!0;return!1}hasClass(oe){return this.node.classList.contains(oe)}addClass(oe){this.node.classList.add(oe)}removeClass(oe){this.node.classList.remove(oe)}toggleClass(oe,Ie){return Ie===!0?(this.node.classList.add(oe),!0):Ie===!1?(this.node.classList.remove(oe),!1):this.node.classList.toggle(oe)}update(){za.postMessage(this,We.Msg.UpdateRequest)}fit(){za.postMessage(this,We.Msg.FitRequest)}activate(){za.postMessage(this,We.Msg.ActivateRequest)}close(){za.sendMessage(this,We.Msg.CloseRequest)}show(){if(this.testFlag(We.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.BeforeShow),this.clearFlag(We.Flag.IsHidden),this._toggleHidden(!1),this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.AfterShow),this.parent)){let oe=new We.ChildMessage("child-shown",this);za.sendMessage(this.parent,oe)}}hide(){if(!this.testFlag(We.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.BeforeHide),this.setFlag(We.Flag.IsHidden),this._toggleHidden(!0),this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.AfterHide),this.parent)){let oe=new We.ChildMessage("child-hidden",this);za.sendMessage(this.parent,oe)}}setHidden(oe){oe?this.hide():this.show()}testFlag(oe){return(this._flags&oe)!==0}setFlag(oe){this._flags|=oe}clearFlag(oe){this._flags&=~oe}processMessage(oe){switch(oe.type){case"resize":this.notifyLayout(oe),this.onResize(oe);break;case"update-request":this.notifyLayout(oe),this.onUpdateRequest(oe);break;case"fit-request":this.notifyLayout(oe),this.onFitRequest(oe);break;case"before-show":this.notifyLayout(oe),this.onBeforeShow(oe);break;case"after-show":this.setFlag(We.Flag.IsVisible),this.notifyLayout(oe),this.onAfterShow(oe);break;case"before-hide":this.notifyLayout(oe),this.onBeforeHide(oe);break;case"after-hide":this.clearFlag(We.Flag.IsVisible),this.notifyLayout(oe),this.onAfterHide(oe);break;case"before-attach":this.notifyLayout(oe),this.onBeforeAttach(oe);break;case"after-attach":!this.isHidden&&(!this.parent||this.parent.isVisible)&&this.setFlag(We.Flag.IsVisible),this.setFlag(We.Flag.IsAttached),this.notifyLayout(oe),this.onAfterAttach(oe);break;case"before-detach":this.notifyLayout(oe),this.onBeforeDetach(oe);break;case"after-detach":this.clearFlag(We.Flag.IsVisible),this.clearFlag(We.Flag.IsAttached),this.notifyLayout(oe),this.onAfterDetach(oe);break;case"activate-request":this.notifyLayout(oe),this.onActivateRequest(oe);break;case"close-request":this.notifyLayout(oe),this.onCloseRequest(oe);break;case"child-added":this.notifyLayout(oe),this.onChildAdded(oe);break;case"child-removed":this.notifyLayout(oe),this.onChildRemoved(oe);break;default:this.notifyLayout(oe);break}}notifyLayout(oe){this._layout&&this._layout.processParentMessage(oe)}onCloseRequest(oe){this.parent?this.parent=null:this.isAttached&&We.detach(this)}onResize(oe){}onUpdateRequest(oe){}onFitRequest(oe){}onActivateRequest(oe){}onBeforeShow(oe){}onAfterShow(oe){}onBeforeHide(oe){}onAfterHide(oe){}onBeforeAttach(oe){}onAfterAttach(oe){}onBeforeDetach(oe){}onAfterDetach(oe){}onChildAdded(oe){}onChildRemoved(oe){}_toggleHidden(oe){if(oe)switch(this._hiddenMode){case We.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case We.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case We.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1",this.node.style.opacity="0";break}else switch(this._hiddenMode){case We.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case We.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case We.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex="",this.node.style.opacity="";break}}};(function(We){(function(dt){dt[dt.Display=0]="Display",dt[dt.Scale=1]="Scale",dt[dt.ContentVisibility=2]="ContentVisibility"})(We.HiddenMode||(We.HiddenMode={})),(function(dt){dt[dt.IsDisposed=1]="IsDisposed",dt[dt.IsAttached=2]="IsAttached",dt[dt.IsHidden=4]="IsHidden",dt[dt.IsVisible=8]="IsVisible",dt[dt.DisallowLayout=16]="DisallowLayout"})(We.Flag||(We.Flag={})),(function(dt){dt.BeforeShow=new rf("before-show"),dt.AfterShow=new rf("after-show"),dt.BeforeHide=new rf("before-hide"),dt.AfterHide=new rf("after-hide"),dt.BeforeAttach=new rf("before-attach"),dt.AfterAttach=new rf("after-attach"),dt.BeforeDetach=new rf("before-detach"),dt.AfterDetach=new rf("after-detach"),dt.ParentChanged=new rf("parent-changed"),dt.UpdateRequest=new o0("update-request"),dt.FitRequest=new o0("fit-request"),dt.ActivateRequest=new o0("activate-request"),dt.CloseRequest=new o0("close-request")})(We.Msg||(We.Msg={}));class oe extends rf{constructor(Jt,jt){super(Jt),this.child=jt}}We.ChildMessage=oe;class Ie extends rf{constructor(Jt,jt){super("resize"),this.width=Jt,this.height=jt}}We.ResizeMessage=Ie,(function(dt){dt.UnknownSize=new dt(-1,-1)})(Ie=We.ResizeMessage||(We.ResizeMessage={}));function Oe(dt,Jt,jt=null){if(dt.parent)throw new Error("Cannot attach a child widget.");if(dt.isAttached||dt.node.isConnected)throw new Error("Widget is already attached.");if(!Jt.isConnected)throw new Error("Host is not attached.");za.sendMessage(dt,We.Msg.BeforeAttach),Jt.insertBefore(dt.node,jt),za.sendMessage(dt,We.Msg.AfterAttach)}We.attach=Oe;function Qe(dt){if(dt.parent)throw new Error("Cannot detach a child widget.");if(!dt.isAttached||!dt.node.isConnected)throw new Error("Widget is not attached.");za.sendMessage(dt,We.Msg.BeforeDetach),dt.node.parentNode.removeChild(dt.node),za.sendMessage(dt,We.Msg.AfterDetach)}We.detach=Qe})(Ya||(Ya={}));var rw;(function(We){We.titleProperty=new af({name:"title",create:Ie=>new hy({owner:Ie})});function oe(Ie){return Ie.node||document.createElement(Ie.tag||"div")}We.createNode=oe})(rw||(rw={}));var _p=class{constructor(oe={}){this._disposed=!1,this._parent=null,this._fitPolicy=oe.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,Ls.clearData(this),af.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(oe){if(this._parent!==oe){if(this._parent)throw new Error("Cannot change parent widget.");if(oe.layout!==this)throw new Error("Invalid parent widget.");this._parent=oe,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(oe){if(this._fitPolicy!==oe&&(this._fitPolicy=oe,this._parent)){let Ie=this._parent.node.style;Ie.minWidth="",Ie.minHeight="",Ie.maxWidth="",Ie.maxHeight="",this._parent.fit()}}processParentMessage(oe){switch(oe.type){case"resize":this.onResize(oe);break;case"update-request":this.onUpdateRequest(oe);break;case"fit-request":this.onFitRequest(oe);break;case"before-show":this.onBeforeShow(oe);break;case"after-show":this.onAfterShow(oe);break;case"before-hide":this.onBeforeHide(oe);break;case"after-hide":this.onAfterHide(oe);break;case"before-attach":this.onBeforeAttach(oe);break;case"after-attach":this.onAfterAttach(oe);break;case"before-detach":this.onBeforeDetach(oe);break;case"after-detach":this.onAfterDetach(oe);break;case"child-removed":this.onChildRemoved(oe);break;case"child-shown":this.onChildShown(oe);break;case"child-hidden":this.onChildHidden(oe);break}}init(){for(let oe of this)oe.parent=this.parent}onResize(oe){for(let Ie of this)za.sendMessage(Ie,Ya.ResizeMessage.UnknownSize)}onUpdateRequest(oe){for(let Ie of this)za.sendMessage(Ie,Ya.ResizeMessage.UnknownSize)}onBeforeAttach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onAfterAttach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onBeforeDetach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onAfterDetach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onBeforeShow(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onAfterShow(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onBeforeHide(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onAfterHide(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onChildRemoved(oe){this.removeWidget(oe.child)}onFitRequest(oe){}onChildShown(oe){}onChildHidden(oe){}};(function(We){function oe(dt){return t1.horizontalAlignmentProperty.get(dt)}We.getHorizontalAlignment=oe;function Ie(dt,Jt){t1.horizontalAlignmentProperty.set(dt,Jt)}We.setHorizontalAlignment=Ie;function Oe(dt){return t1.verticalAlignmentProperty.get(dt)}We.getVerticalAlignment=Oe;function Qe(dt,Jt){t1.verticalAlignmentProperty.set(dt,Jt)}We.setVerticalAlignment=Qe})(_p||(_p={}));var dv=class{constructor(oe){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=oe,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let oe=this.widget.node.style;oe.position="",oe.top="",oe.left="",oe.width="",oe.height="",oe.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let oe=Os.sizeLimits(this.widget.node);this._minWidth=oe.minWidth,this._minHeight=oe.minHeight,this._maxWidth=oe.maxWidth,this._maxHeight=oe.maxHeight}update(oe,Ie,Oe,Qe){let dt=Math.max(this._minWidth,Math.min(Oe,this._maxWidth)),Jt=Math.max(this._minHeight,Math.min(Qe,this._maxHeight));if(dt"center",changed:oe}),We.verticalAlignmentProperty=new af({name:"verticalAlignment",create:()=>"top",changed:oe});function oe(Ie){Ie.parent&&Ie.parent.layout&&Ie.parent.update()}})(t1||(t1={}));var r1=class extends _p{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(oe){this.insertWidget(this._widgets.length,oe)}insertWidget(oe,Ie){Ie.parent=this.parent;let Oe=this._widgets.indexOf(Ie),Qe=Math.max(0,Math.min(oe,this._widgets.length));if(Oe===-1){Sa.ArrayExt.insert(this._widgets,Qe,Ie),this.parent&&this.attachWidget(Qe,Ie);return}Qe===this._widgets.length&&Qe--,Oe!==Qe&&(Sa.ArrayExt.move(this._widgets,Oe,Qe),this.parent&&this.moveWidget(Oe,Qe,Ie))}removeWidget(oe){this.removeWidgetAt(this._widgets.indexOf(oe))}removeWidgetAt(oe){let Ie=Sa.ArrayExt.removeAt(this._widgets,oe);Ie&&this.parent&&this.detachWidget(oe,Ie)}init(){super.init();let oe=0;for(let Ie of this)this.attachWidget(oe++,Ie)}attachWidget(oe,Ie){let Oe=this.parent.node.children[oe];this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.insertBefore(Ie.node,Oe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach)}moveWidget(oe,Ie,Oe){this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Oe.node),this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.AfterDetach);let Qe=this.parent.node.children[Ie];this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.BeforeAttach),this.parent.node.insertBefore(Oe.node,Qe),this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.AfterAttach)}detachWidget(oe,Ie){this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach)}},dy;(function(We){function oe(Ie){return Math.max(0,Math.floor(Ie))}We.clampDimension=oe})(dy||(dy={}));var py=dy,xp=class We extends r1{constructor(oe){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=oe.renderer,oe.orientation!==void 0&&(this._orientation=oe.orientation),oe.alignment!==void 0&&(this._alignment=oe.alignment),oe.spacing!==void 0&&(this._spacing=dy.clampDimension(oe.spacing))}dispose(){for(let oe of this._items)oe.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(oe){this._orientation!==oe&&(this._orientation=oe,this.parent&&(this.parent.dataset.orientation=oe,this.parent.fit()))}get alignment(){return this._alignment}set alignment(oe){this._alignment!==oe&&(this._alignment=oe,this.parent&&(this.parent.dataset.alignment=oe,this.parent.update()))}get spacing(){return this._spacing}set spacing(oe){oe=dy.clampDimension(oe),this._spacing!==oe&&(this._spacing=oe,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map(oe=>oe.size)}relativeSizes(){return gp.normalize(this._sizers.map(oe=>oe.size))}setRelativeSizes(oe,Ie=!0){let Oe=this._sizers.length,Qe=oe.slice(0,Oe);for(;Qe.length0&&(dt.sizeHint=dt.size);ih.adjust(this._sizers,oe,Qe),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(oe,Ie){let Oe=new dv(Ie),Qe=gp.createHandle(this.renderer),dt=gp.averageSize(this._sizers),Jt=gp.createSizer(dt);Sa.ArrayExt.insert(this._items,oe,Oe),Sa.ArrayExt.insert(this._sizers,oe,Jt),Sa.ArrayExt.insert(this._handles,oe,Qe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.appendChild(Ie.node),this.parent.node.appendChild(Qe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach),this.parent.fit()}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._items,oe,Ie),Sa.ArrayExt.move(this._sizers,oe,Ie),Sa.ArrayExt.move(this._handles,oe,Ie),this.parent.fit()}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._items,oe),Qe=Sa.ArrayExt.removeAt(this._handles,oe);Sa.ArrayExt.removeAt(this._sizers,oe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.node.removeChild(Qe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach),Oe.dispose(),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}updateItemPosition(oe,Ie,Oe,Qe,dt,Jt,jt){let Xt=this._items[oe];if(Xt.isHidden)return;let nr=this._handles[oe].style;Ie?(Oe+=this.widgetOffset,Xt.update(Oe,Qe,jt,dt),Oe+=jt,nr.top=`${Qe}px`,nr.left=`${Oe}px`,nr.width=`${this._spacing}px`,nr.height=`${dt}px`):(Qe+=this.widgetOffset,Xt.update(Oe,Qe,Jt,jt),Qe+=jt,nr.top=`${Qe}px`,nr.left=`${Oe}px`,nr.width=`${Jt}px`,nr.height=`${this._spacing}px`)}_fit(){let oe=0,Ie=-1;for(let Xt=0,nr=this._items.length;Xt0&&(er.sizeHint=er.size),Ht.isHidden){er.minSize=0,er.maxSize=0;continue}Ht.fit(),er.stretch=We.getStretch(Ht.widget),Oe?(er.minSize=Ht.minWidth,er.maxSize=Ht.maxWidth,Qe+=Ht.minWidth,dt=Math.max(dt,Ht.minHeight)):(er.minSize=Ht.minHeight,er.maxSize=Ht.maxHeight,dt+=Ht.minHeight,Qe=Math.max(Qe,Ht.minWidth))}let Jt=this._box=Os.boxSizing(this.parent.node);Qe+=Jt.horizontalSum,dt+=Jt.verticalSum;let jt=this.parent.node.style;jt.minWidth=`${Qe}px`,jt.minHeight=`${dt}px`,this._dirty=!0,this.parent.parent&&za.sendMessage(this.parent.parent,Ya.Msg.FitRequest),this._dirty&&za.sendMessage(this.parent,Ya.Msg.UpdateRequest)}_update(oe,Ie){this._dirty=!1;let Oe=0;for(let er=0,ur=this._items.length;er0){let er;if(Ht?er=Math.max(0,Jt-this._fixed):er=Math.max(0,jt-this._fixed),this._hasNormedSizes){for(let ir of this._sizers)ir.sizeHint*=er;this._hasNormedSizes=!1}let ur=ih.calc(this._sizers,er);if(ur>0)switch(this._alignment){case"start":break;case"center":Xt=0,nr=ur/2;break;case"end":Xt=0,nr=ur;break;case"justify":Xt=ur/Oe,nr=0;break;default:throw"unreachable"}}for(let er=0,ur=this._items.length;er0,coerce:(Jt,jt)=>Math.max(0,Math.floor(jt)),changed:dt});function oe(Jt){let jt=new Wd;return jt.sizeHint=Math.floor(Jt),jt}We.createSizer=oe;function Ie(Jt){let jt=Jt.createHandle();return jt.style.position="absolute",jt.style.contain="style",jt}We.createHandle=Ie;function Oe(Jt){return Jt.reduce((jt,Xt)=>jt+Xt.size,0)/Jt.length||0}We.averageSize=Oe;function Qe(Jt){let jt=Jt.length;if(jt===0)return[];let Xt=Jt.reduce((nr,Ht)=>nr+Math.abs(Ht),0);return Xt===0?Jt.map(nr=>1/jt):Jt.map(nr=>nr/Xt)}We.normalize=Qe;function dt(Jt){Jt.parent&&Jt.parent.layout instanceof xp&&Jt.parent.fit()}})(gp||(gp={}));var XS=class extends xp{constructor(oe){super({...oe,orientation:oe.orientation||"vertical"}),this._titles=[],this.titleSpace=oe.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(oe){oe=py.clampDimension(oe),this.widgetOffset!==oe&&(this.widgetOffset=oe,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(oe,Ie){let Oe=this._titles[oe],Qe=Oe.classList.contains("lm-mod-expanded"),dt=iw.createTitle(this.renderer,Ie.title,Qe);this._titles[oe]=dt,this.parent.node.replaceChild(dt,Oe)}insertWidget(oe,Ie){Ie.id||(Ie.id=`id-${yp.UUID.uuid4()}`),super.insertWidget(oe,Ie)}attachWidget(oe,Ie){let Oe=iw.createTitle(this.renderer,Ie.title,!Ie.isHidden);Sa.ArrayExt.insert(this._titles,oe,Oe),this.parent.node.appendChild(Oe),Ie.node.setAttribute("role","region"),Ie.node.setAttribute("aria-labelledby",Oe.id),super.attachWidget(oe,Ie)}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._titles,oe,Ie),super.moveWidget(oe,Ie,Oe)}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._titles,oe);this.parent.node.removeChild(Oe),super.detachWidget(oe,Ie)}updateItemPosition(oe,Ie,Oe,Qe,dt,Jt,jt){let Xt=this._titles[oe].style;Xt.top=`${Qe}px`,Xt.left=`${Oe}px`,Xt.height=`${this.widgetOffset}px`,Ie?Xt.width=`${dt}px`:Xt.width=`${Jt}px`,super.updateItemPosition(oe,Ie,Oe,Qe,dt,Jt,jt)}},iw;(function(We){function oe(Ie,Oe,Qe=!0){let dt=Ie.createSectionTitle(Oe);return dt.style.position="absolute",dt.style.contain="strict",dt.setAttribute("aria-label",`${Oe.label} Section`),dt.setAttribute("aria-expanded",Qe?"true":"false"),dt.setAttribute("aria-controls",Oe.owner.id),Qe&&dt.classList.add("lm-mod-expanded"),dt}We.createTitle=oe})(iw||(iw={}));var aw=class extends Ya{constructor(oe={}){super(),this.addClass("lm-Panel"),this.layout=ZS.createLayout(oe)}get widgets(){return this.layout.widgets}addWidget(oe){this.layout.addWidget(oe)}insertWidget(oe,Ie){this.layout.insertWidget(oe,Ie)}},ZS;(function(We){function oe(Ie){return Ie.layout||new r1}We.createLayout=oe})(ZS||(ZS={}));var pv=class extends aw{constructor(oe={}){super({layout:KS.createLayout(oe)}),this._handleMoved=new Ls(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(oe){this.layout.orientation=oe}get alignment(){return this.layout.alignment}set alignment(oe){this.layout.alignment=oe}get spacing(){return this.layout.spacing}set spacing(oe){this.layout.spacing=oe}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(oe,Ie=!0){this.layout.setRelativeSizes(oe,Ie)}handleEvent(oe){switch(oe.type){case"pointerdown":this._evtPointerDown(oe);break;case"pointermove":this._evtPointerMove(oe);break;case"pointerup":this._evtPointerUp(oe);break;case"keydown":this._evtKeyDown(oe);break;case"contextmenu":oe.preventDefault(),oe.stopPropagation();break}}onBeforeAttach(oe){this.node.addEventListener("pointerdown",this)}onAfterDetach(oe){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(oe){oe.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(oe){oe.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(oe){this._pressData&&(oe.preventDefault(),oe.stopPropagation()),oe.keyCode===27&&this._releaseMouse()}_evtPointerDown(oe){if(oe.button!==0)return;let Ie=this.layout,Oe=Sa.ArrayExt.findFirstIndex(Ie.handles,nr=>nr.contains(oe.target));if(Oe===-1)return;oe.preventDefault(),oe.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let Qe,dt=Ie.handles[Oe],Jt=dt.getBoundingClientRect();Ie.orientation==="horizontal"?Qe=oe.clientX-Jt.left:Qe=oe.clientY-Jt.top;let jt=window.getComputedStyle(dt),Xt=nf.overrideCursor(jt.cursor);this._pressData={index:Oe,delta:Qe,override:Xt}}_evtPointerMove(oe){oe.preventDefault(),oe.stopPropagation();let Ie,Oe=this.layout,Qe=this.node.getBoundingClientRect();Oe.orientation==="horizontal"?Ie=oe.clientX-Qe.left-this._pressData.delta:Ie=oe.clientY-Qe.top-this._pressData.delta,Oe.moveHandle(this._pressData.index,Ie)}_evtPointerUp(oe){oe.button===0&&(oe.preventDefault(),oe.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}};(function(We){class oe{createHandle(){let dt=document.createElement("div");return dt.className="lm-SplitPanel-handle",dt}}We.Renderer=oe,We.defaultRenderer=new oe;function Ie(Qe){return xp.getStretch(Qe)}We.getStretch=Ie;function Oe(Qe,dt){xp.setStretch(Qe,dt)}We.setStretch=Oe})(pv||(pv={}));var KS;(function(We){function oe(Ie){return Ie.layout||new xp({renderer:Ie.renderer||pv.defaultRenderer,orientation:Ie.orientation,alignment:Ie.alignment,spacing:Ie.spacing})}We.createLayout=oe})(KS||(KS={}));var vy=class extends pv{constructor(oe={}){super({...oe,layout:JS.createLayout(oe)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new Ls(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(oe){this.layout.titleSpace=oe}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(oe){super.addWidget(oe),oe.title.changed.connect(this._onTitleChanged,this)}collapse(oe){let Ie=this.layout.widgets[oe];Ie&&!Ie.isHidden&&this._toggleExpansion(oe)}expand(oe){let Ie=this.layout.widgets[oe];Ie&&Ie.isHidden&&this._toggleExpansion(oe)}insertWidget(oe,Ie){super.insertWidget(oe,Ie),Ie.title.changed.connect(this._onTitleChanged,this)}handleEvent(oe){switch(super.handleEvent(oe),oe.type){case"click":this._evtClick(oe);break;case"keydown":this._eventKeyDown(oe);break}}onBeforeAttach(oe){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(oe)}onAfterDetach(oe){super.onAfterDetach(oe),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(oe){let Ie=Sa.ArrayExt.findFirstIndex(this.widgets,Oe=>Oe.contains(oe.owner));Ie>=0&&(this.layout.updateTitle(Ie,oe.owner),this.update())}_computeWidgetSize(oe){let Ie=this.layout,Oe=Ie.widgets[oe];if(!Oe)return;let Qe=Oe.isHidden,dt=Ie.absoluteSizes(),Jt=(Qe?-1:1)*this.spacing,jt=dt.reduce((nr,Ht)=>nr+Ht),Xt=[...dt];if(Qe){let nr=this._widgetSizesCache.get(Oe);if(!nr)return;Xt[oe]+=nr;let Ht=Xt.map(er=>er-nr>0).lastIndexOf(!0);Ht===-1?Xt.forEach((er,ur)=>{ur!==oe&&(Xt[ur]-=dt[ur]/jt*(nr-Jt))}):Xt[Ht]-=nr-Jt}else{let nr=dt[oe];this._widgetSizesCache.set(Oe,nr),Xt[oe]=0;let Ht=Xt.map(er=>er>0).lastIndexOf(!0);if(Ht===-1)return;Xt[Ht]=dt[Ht]+nr+Jt}return Xt.map(nr=>nr/(jt+Jt))}_evtClick(oe){let Ie=oe.target;if(Ie){let Oe=Sa.ArrayExt.findFirstIndex(this.titles,Qe=>Qe.contains(Ie));Oe>=0&&(oe.preventDefault(),oe.stopPropagation(),this._toggleExpansion(Oe))}}_eventKeyDown(oe){if(oe.defaultPrevented)return;let Ie=oe.target,Oe=!1;if(Ie){let Qe=Sa.ArrayExt.findFirstIndex(this.titles,dt=>dt.contains(Ie));if(Qe>=0){let dt=oe.keyCode.toString();if(oe.key.match(/Space|Enter/)||dt.match(/13|32/))Ie.click(),Oe=!0;else if(this.orientation==="horizontal"?oe.key.match(/ArrowLeft|ArrowRight/)||dt.match(/37|39/):oe.key.match(/ArrowUp|ArrowDown/)||dt.match(/38|40/)){let Jt=oe.key.match(/ArrowLeft|ArrowUp/)||dt.match(/37|38/)?-1:1,jt=this.titles.length,Xt=(Qe+jt+Jt)%jt;this.titles[Xt].focus(),Oe=!0}else oe.key==="End"||dt==="35"?(this.titles[this.titles.length-1].focus(),Oe=!0):(oe.key==="Home"||dt==="36")&&(this.titles[0].focus(),Oe=!0)}Oe&&oe.preventDefault()}}_toggleExpansion(oe){let Ie=this.titles[oe],Oe=this.layout.widgets[oe],Qe=this._computeWidgetSize(oe);Qe&&this.setRelativeSizes(Qe,!1),Oe.isHidden?(Ie.classList.add("lm-mod-expanded"),Ie.setAttribute("aria-expanded","true"),Oe.show()):(Ie.classList.remove("lm-mod-expanded"),Ie.setAttribute("aria-expanded","false"),Oe.hide()),this._expansionToggled.emit(oe)}};(function(We){class oe extends pv.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++oe._nInstance}createCollapseIcon(Oe){return document.createElement("span")}createSectionTitle(Oe){let Qe=document.createElement("h3");Qe.setAttribute("tabindex","0"),Qe.id=this.createTitleKey(Oe),Qe.className=this.titleClassName;for(let jt in Oe.dataset)Qe.dataset[jt]=Oe.dataset[jt];let dt=Qe.appendChild(this.createCollapseIcon(Oe));dt.className="lm-AccordionPanel-titleCollapser";let Jt=Qe.appendChild(document.createElement("span"));return Jt.className="lm-AccordionPanel-titleLabel",Jt.textContent=Oe.label,Jt.title=Oe.caption||Oe.label,Qe}createTitleKey(Oe){let Qe=this._titleKeys.get(Oe);return Qe===void 0&&(Qe=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(Oe,Qe)),Qe}}oe._nInstance=0,We.Renderer=oe,We.defaultRenderer=new oe})(vy||(vy={}));var JS;(function(We){function oe(Ie){return Ie.layout||new XS({renderer:Ie.renderer||vy.defaultRenderer,orientation:Ie.orientation,alignment:Ie.alignment,spacing:Ie.spacing,titleSpace:Ie.titleSpace})}We.createLayout=oe})(JS||(JS={}));var $d=class We extends r1{constructor(oe={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",oe.direction!==void 0&&(this._direction=oe.direction),oe.alignment!==void 0&&(this._alignment=oe.alignment),oe.spacing!==void 0&&(this._spacing=py.clampDimension(oe.spacing))}dispose(){for(let oe of this._items)oe.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(oe){this._direction!==oe&&(this._direction=oe,this.parent&&(this.parent.dataset.direction=oe,this.parent.fit()))}get alignment(){return this._alignment}set alignment(oe){this._alignment!==oe&&(this._alignment=oe,this.parent&&(this.parent.dataset.alignment=oe,this.parent.update()))}get spacing(){return this._spacing}set spacing(oe){oe=py.clampDimension(oe),this._spacing!==oe&&(this._spacing=oe,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(oe,Ie){Sa.ArrayExt.insert(this._items,oe,new dv(Ie)),Sa.ArrayExt.insert(this._sizers,oe,new Wd),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.appendChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach),this.parent.fit()}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._items,oe,Ie),Sa.ArrayExt.move(this._sizers,oe,Ie),this.parent.update()}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._items,oe);Sa.ArrayExt.removeAt(this._sizers,oe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach),Oe.dispose(),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_fit(){let oe=0;for(let jt=0,Xt=this._items.length;jt0)switch(this._alignment){case"start":break;case"center":nr=0,Ht=Xt/2;break;case"end":nr=0,Ht=Xt;break;case"justify":nr=Xt/Oe,Ht=0;break;default:throw"unreachable"}for(let er=0,ur=this._items.length;er0,coerce:(Qe,dt)=>Math.max(0,Math.floor(dt)),changed:Oe}),We.sizeBasisProperty=new af({name:"sizeBasis",create:()=>0,coerce:(Qe,dt)=>Math.max(0,Math.floor(dt)),changed:Oe});function oe(Qe){return Qe==="left-to-right"||Qe==="right-to-left"}We.isHorizontal=oe;function Ie(Qe){return Math.max(0,Math.floor(Qe))}We.clampSpacing=Ie;function Oe(Qe){Qe.parent&&Qe.parent.layout instanceof $d&&Qe.parent.fit()}})(fv||(fv={}));var nw=class extends aw{constructor(oe={}){super({layout:QS.createLayout(oe)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(oe){this.layout.direction=oe}get alignment(){return this.layout.alignment}set alignment(oe){this.layout.alignment=oe}get spacing(){return this.layout.spacing}set spacing(oe){this.layout.spacing=oe}onChildAdded(oe){oe.child.addClass("lm-BoxPanel-child")}onChildRemoved(oe){oe.child.removeClass("lm-BoxPanel-child")}};(function(We){function oe(dt){return $d.getStretch(dt)}We.getStretch=oe;function Ie(dt,Jt){$d.setStretch(dt,Jt)}We.setStretch=Ie;function Oe(dt){return $d.getSizeBasis(dt)}We.getSizeBasis=Oe;function Qe(dt,Jt){$d.setSizeBasis(dt,Jt)}We.setSizeBasis=Qe})(nw||(nw={}));var QS;(function(We){function oe(Ie){return Ie.layout||new $d(Ie)}We.createLayout=oe})(QS||(QS={}));var ow=class We extends Ya{constructor(oe){super({node:mp.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(Ya.Flag.DisallowLayout),this.commands=oe.commands,this.renderer=oe.renderer||We.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(oe){let Ie=mp.createItem(this.commands,oe);return this._items.push(Ie),this.refresh(),Ie}addItems(oe){let Ie=oe.map(Oe=>mp.createItem(this.commands,Oe));return Ie.forEach(Oe=>this._items.push(Oe)),this.refresh(),Ie}removeItem(oe){this.removeItemAt(this._items.indexOf(oe))}removeItemAt(oe){Sa.ArrayExt.removeAt(this._items,oe)&&this.refresh()}clearItems(){this._items.length!==0&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,this.inputNode.value!==""){let oe=this.node.getElementsByClassName("lm-close-icon")[0];oe.style.display="inherit"}else{let oe=this.node.getElementsByClassName("lm-close-icon")[0];oe.style.display="none"}this.update()}handleEvent(oe){switch(oe.type){case"click":this._evtClick(oe);break;case"keydown":this._evtKeyDown(oe);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused();break}}onBeforeAttach(oe){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(oe){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(oe){this.update(),super.onAfterShow(oe)}onActivateRequest(oe){if(this.isAttached){let Ie=this.inputNode;Ie.focus(),Ie.select()}}onUpdateRequest(oe){if(!this.isVisible){Hd.render(null,this.contentNode);return}let Ie=this.inputNode.value,Oe=this.contentNode,Qe=this._results;if(Qe||(Qe=this._results=mp.search(this._items,Ie),this._activeIndex=Ie?Sa.ArrayExt.findFirstIndex(Qe,mp.canActivate):-1),!Ie&&Qe.length===0){Hd.render(null,Oe);return}if(Ie&&Qe.length===0){let Xt=this.renderer.renderEmptyMessage({query:Ie});Hd.render(Xt,Oe);return}let dt=this.renderer,Jt=this._activeIndex,jt=new Array(Qe.length);for(let Xt=0,nr=Qe.length;Xt=Qe.length)Oe.scrollTop=0;else{let Xt=Oe.children[Jt];Os.scrollIntoViewIfNeeded(Oe,Xt)}}_evtClick(oe){if(oe.button!==0)return;if(oe.target.classList.contains("lm-close-icon")){this.inputNode.value="",this.refresh();return}let Ie=Sa.ArrayExt.findFirstIndex(this.contentNode.children,Oe=>Oe.contains(oe.target));Ie!==-1&&(oe.preventDefault(),oe.stopPropagation(),this._execute(Ie))}_evtKeyDown(oe){if(!(oe.altKey||oe.ctrlKey||oe.metaKey||oe.shiftKey))switch(oe.keyCode){case 13:oe.preventDefault(),oe.stopPropagation(),this._execute(this._activeIndex);break;case 38:oe.preventDefault(),oe.stopPropagation(),this._activatePreviousItem();break;case 40:oe.preventDefault(),oe.stopPropagation(),this._activateNextItem();break}}_activateNextItem(){if(!this._results||this._results.length===0)return;let oe=this._activeIndex,Ie=this._results.length,Oe=oeKi-Ia),ti=de.slice(0,Vr),Xr=de.slice(Vr);for(let Ki=0,Ia=Xr.length;Kiar.command===ir&&yp.JSONExt.deepEqual(ar.args,Ot))||null}}})(mp||(mp={}));var hv=class We extends Ya{constructor(oe){super({node:of.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new Ls(this),this._menuRequested=new Ls(this),this.addClass("lm-Menu"),this.setFlag(Ya.Flag.DisallowLayout),this.commands=oe.commands,this.renderer=oe.renderer||We.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let oe=this;for(;oe._parentMenu;)oe=oe._parentMenu;return oe}get leafMenu(){let oe=this;for(;oe._childMenu;)oe=oe._childMenu;return oe}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(oe){this.activeIndex=oe?this._items.indexOf(oe):-1}get activeIndex(){return this._activeIndex}set activeIndex(oe){(oe<0||oe>=this._items.length)&&(oe=-1),oe!==-1&&!of.canActivate(this._items[oe])&&(oe=-1),this._activeIndex!==oe&&(this._activeIndex=oe,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let oe=this._items.length,Ie=this._activeIndex,Oe=Ie{this.activeIndex=jt}})}Hd.render(Jt,this.contentNode)}onCloseRequest(oe){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let Ie=this._childMenu;Ie&&(this._childIndex=-1,this._childMenu=null,Ie._parentMenu=null,Ie.close());let Oe=this._parentMenu;Oe&&(this._parentMenu=null,Oe._childIndex=-1,Oe._childMenu=null,Oe.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(oe)}_evtKeyDown(oe){oe.preventDefault(),oe.stopPropagation();let Ie=oe.keyCode;if(Ie===13){this.triggerActiveItem();return}if(Ie===27){this.close();return}if(Ie===37){this._parentMenu?this.close():this._menuRequested.emit("previous");return}if(Ie===38){this.activatePreviousItem();return}if(Ie===39){let Jt=this.activeItem;Jt&&Jt.type==="submenu"?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next");return}if(Ie===40){this.activateNextItem();return}let Oe=Jm().keyForKeydownEvent(oe);if(!Oe)return;let Qe=this._activeIndex+1,dt=of.findMnemonic(this._items,Oe,Qe);dt.index!==-1&&!dt.multiple?(this.activeIndex=dt.index,this.triggerActiveItem()):dt.index!==-1?this.activeIndex=dt.index:dt.auto!==-1&&(this.activeIndex=dt.auto)}_evtPointerUp(oe){oe.button===0&&(oe.preventDefault(),oe.stopPropagation(),this.triggerActiveItem())}_evtPointerMove(oe){let Ie=Sa.ArrayExt.findFirstIndex(this.contentNode.children,Qe=>Os.hitTest(Qe,oe.clientX,oe.clientY));if(Ie===this._activeIndex)return;if(this.activeIndex=Ie,Ie=this.activeIndex,Ie===this._childIndex){this._cancelOpenTimer(),this._cancelCloseTimer();return}this._childIndex!==-1&&this._startCloseTimer(),this._cancelOpenTimer();let Oe=this.activeItem;!Oe||Oe.type!=="submenu"||!Oe.submenu||this._startOpenTimer()}_evtPointerEnter(oe){for(let Ie=this._parentMenu;Ie;Ie=Ie._parentMenu)Ie._cancelOpenTimer(),Ie._cancelCloseTimer(),Ie.activeIndex=Ie._childIndex}_evtPointerLeave(oe){if(this._cancelOpenTimer(),!this._childMenu){this.activeIndex=-1;return}let{clientX:Ie,clientY:Oe}=oe;if(Os.hitTest(this._childMenu.node,Ie,Oe)){this._cancelCloseTimer();return}this.activeIndex=-1,this._startCloseTimer()}_evtPointerDown(oe){this._parentMenu||(of.hitTestMenus(this,oe.clientX,oe.clientY)?(oe.preventDefault(),oe.stopPropagation()):this.close())}_openChildMenu(oe=!1){let Ie=this.activeItem;if(!Ie||Ie.type!=="submenu"||!Ie.submenu){this._closeChildMenu();return}let Oe=Ie.submenu;if(Oe===this._childMenu)return;We.saveWindowData(),this._closeChildMenu(),this._childMenu=Oe,this._childIndex=this._activeIndex,Oe._parentMenu=this,za.sendMessage(this,Ya.Msg.UpdateRequest);let Qe=this.contentNode.children[this._activeIndex];of.openSubmenu(Oe,Qe),oe&&(Oe.activeIndex=-1,Oe.activateNextItem()),Oe.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){this._openTimerID===0&&(this._openTimerID=window.setTimeout(()=>{this._openTimerID=0,this._openChildMenu()},of.TIMER_DELAY))}_startCloseTimer(){this._closeTimerID===0&&(this._closeTimerID=window.setTimeout(()=>{this._closeTimerID=0,this._closeChildMenu()},of.TIMER_DELAY))}_cancelOpenTimer(){this._openTimerID!==0&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){this._closeTimerID!==0&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){of.saveWindowData()}};(function(We){class oe{renderItem(Oe){let Qe=this.createItemClass(Oe),dt=this.createItemDataset(Oe),Jt=this.createItemARIA(Oe);return Fs.li({className:Qe,dataset:dt,tabindex:"0",onfocus:Oe.onfocus,...Jt},this.renderIcon(Oe),this.renderLabel(Oe),this.renderShortcut(Oe),this.renderSubmenu(Oe))}renderIcon(Oe){let Qe=this.createIconClass(Oe);return Fs.div({className:Qe},Oe.item.icon,Oe.item.iconLabel)}renderLabel(Oe){let Qe=this.formatLabel(Oe);return Fs.div({className:"lm-Menu-itemLabel"},Qe)}renderShortcut(Oe){let Qe=this.formatShortcut(Oe);return Fs.div({className:"lm-Menu-itemShortcut"},Qe)}renderSubmenu(Oe){return Fs.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(Oe){let Qe="lm-Menu-item";Oe.item.isEnabled||(Qe+=" lm-mod-disabled"),Oe.item.isToggled&&(Qe+=" lm-mod-toggled"),Oe.item.isVisible||(Qe+=" lm-mod-hidden"),Oe.active&&(Qe+=" lm-mod-active"),Oe.collapsed&&(Qe+=" lm-mod-collapsed");let dt=Oe.item.className;return dt&&(Qe+=` ${dt}`),Qe}createItemDataset(Oe){let Qe,{type:dt,command:Jt,dataset:jt}=Oe.item;return dt==="command"?Qe={...jt,type:dt,command:Jt}:Qe={...jt,type:dt},Qe}createIconClass(Oe){let Qe="lm-Menu-itemIcon",dt=Oe.item.iconClass;return dt?`${Qe} ${dt}`:Qe}createItemARIA(Oe){let Qe={};switch(Oe.item.type){case"separator":Qe.role="presentation";break;case"submenu":Qe["aria-haspopup"]="true",Oe.item.isEnabled||(Qe["aria-disabled"]="true");break;default:Oe.item.isEnabled||(Qe["aria-disabled"]="true"),Oe.item.isToggled?(Qe.role="menuitemcheckbox",Qe["aria-checked"]="true"):Qe.role="menuitem"}return Qe}formatLabel(Oe){let{label:Qe,mnemonic:dt}=Oe.item;if(dt<0||dt>=Qe.length)return Qe;let Jt=Qe.slice(0,dt),jt=Qe.slice(dt+1),Xt=Qe[dt],nr=Fs.span({className:"lm-Menu-itemMnemonic"},Xt);return[Jt,nr,jt]}formatShortcut(Oe){let Qe=Oe.item.keyBinding;return Qe?vp.formatKeystroke(Qe.keys):null}}We.Renderer=oe,We.defaultRenderer=new oe})(hv||(hv={}));var of;(function(We){We.TIMER_DELAY=300,We.SUBMENU_OVERLAP=3;let oe=null,Ie=0;function Oe(){return Ie>0?(Ie--,oe):Ht()}function Qe(){oe=Ht(),Ie++}We.saveWindowData=Qe;function dt(){let ar=document.createElement("div"),Lr=document.createElement("ul");return Lr.className="lm-Menu-content",ar.appendChild(Lr),Lr.setAttribute("role","menu"),ar.tabIndex=0,ar}We.createNode=dt;function Jt(ar){return ar.type!=="separator"&&ar.isEnabled&&ar.isVisible}We.canActivate=Jt;function jt(ar,Lr){return new Ot(ar.commands,Lr)}We.createItem=jt;function Xt(ar,Lr,Ir){for(let de=ar;de;de=de.childMenu)if(Os.hitTest(de.node,Lr,Ir))return!0;return!1}We.hitTestMenus=Xt;function nr(ar){let Lr=new Array(ar.length);Sa.ArrayExt.fill(Lr,!1);let Ir=0,de=ar.length;for(;Ir=0;--Mr){let Vr=ar[Mr];if(Vr.isVisible){if(Vr.type!=="separator")break;Lr[Mr]=!0}}let qr=!1;for(;++IrKi+_i&&(Lr=Ki+_i-rs),!Mr&&Ir+Oo>Ia+ia&&(Ir>Ia+ia?Ir=Ia+ia-Oo:Ir=Ir-Oo),eo.transform=`translate(${Math.max(0,Lr)}px, ${Math.max(0,Ir)}px`,eo.opacity="1"}We.openRootMenu=er;function ur(ar,Lr){let Ir=Oe(),de=Ir.pageXOffset,Mr=Ir.pageYOffset,qr=Ir.clientWidth,Vr=Ir.clientHeight;za.sendMessage(ar,Ya.Msg.UpdateRequest);let ti=Vr,Xr=ar.node,Ki=Xr.style;Ki.opacity="0",Ki.maxHeight=`${ti}px`,Ya.attach(ar,document.body);let{width:Ia,height:_i}=Xr.getBoundingClientRect(),ia=Os.boxSizing(ar.node),Yr=Lr.getBoundingClientRect(),Ba=Yr.right-We.SUBMENU_OVERLAP;Ba+Ia>de+qr&&(Ba=Yr.left+We.SUBMENU_OVERLAP-Ia);let eo=Yr.top-ia.borderTop-ia.paddingTop;eo+_i>Mr+Vr&&(eo=Yr.bottom+ia.borderBottom+ia.paddingBottom-_i),Ki.transform=`translate(${Math.max(0,Ba)}px, ${Math.max(0,eo)}px`,Ki.opacity="1"}We.openSubmenu=ur;function ir(ar,Lr,Ir){let de=-1,Mr=-1,qr=!1,Vr=Lr.toUpperCase();for(let ti=0,Xr=ar.length;ti=0&&ia<_i.length){_i[ia].toUpperCase()===Vr&&(de===-1?de=Ki:qr=!0);continue}Mr===-1&&_i[0].toUpperCase()===Vr&&(Mr=Ki)}return{index:de,multiple:qr,auto:Mr}}We.findMnemonic=ir;class Ot{constructor(Lr,Ir){this._commands=Lr,this.type=Ir.type||"command",this.command=Ir.command||"",this.args=Ir.args||yp.JSONExt.emptyObject,this.submenu=Ir.submenu||null}get label(){return this.type==="command"?this._commands.label(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.label:""}get mnemonic(){return this.type==="command"?this._commands.mnemonic(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.mnemonic:-1}get icon(){if(this.type==="command")return this._commands.icon(this.command,this.args);if(this.type==="submenu"&&this.submenu)return this.submenu.title.icon}get iconClass(){return this.type==="command"?this._commands.iconClass(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconClass:""}get iconLabel(){return this.type==="command"?this._commands.iconLabel(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconLabel:""}get caption(){return this.type==="command"?this._commands.caption(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.caption:""}get className(){return this.type==="command"?this._commands.className(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.className:""}get dataset(){return this.type==="command"?this._commands.dataset(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.dataset:{}}get isEnabled(){return this.type==="command"?this._commands.isEnabled(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0}get isToggled(){return this.type==="command"?this._commands.isToggled(this.command,this.args):!1}get isVisible(){return this.type==="command"?this._commands.isVisible(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0}get keyBinding(){if(this.type==="command"){let{command:Lr,args:Ir}=this;return Sa.ArrayExt.findLastValue(this._commands.keyBindings,de=>de.command===Lr&&yp.JSONExt.deepEqual(de.args,Ir))||null}return null}}})(of||(of={}));var Mj;(function(We){function oe(Jt,jt){let Xt=Oe(Jt.selector),nr=Jt.rank!==void 0?Jt.rank:1/0;return{...Jt,selector:Xt,rank:nr,id:jt}}We.createItem=oe;function Ie(Jt,jt,Xt,nr){let Ht=jt.target;if(!Ht)return null;let er=jt.currentTarget;if(!er||!er.contains(Ht)&&(Ht=document.elementFromPoint(jt.clientX,jt.clientY),!Ht||!er.contains(Ht)))return null;let ur=[],ir=Jt.slice();for(;Ht!==null;){let Ot=[];for(let ar=0,Lr=ir.length;ar=this._titles.length)&&(oe=-1),this._currentIndex===oe)return;let Ie=this._currentIndex,Oe=this._titles[Ie]||null,Qe=oe,dt=this._titles[Qe]||null;this._currentIndex=Qe,this._previousTitle=Oe,this.update(),this._currentChanged.emit({previousIndex:Ie,previousTitle:Oe,currentIndex:Qe,currentTitle:dt})}get name(){return this._name}set name(oe){this._name=oe,oe?this.contentNode.setAttribute("aria-label",oe):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(oe){this._orientation!==oe&&(this._releaseMouse(),this._orientation=oe,this.dataset.orientation=oe,this.contentNode.setAttribute("aria-orientation",oe))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(oe){this._addButtonEnabled!==oe&&(this._addButtonEnabled=oe,oe?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(oe){return this.insertTab(this._titles.length,oe)}insertTab(oe,Ie){this._releaseMouse();let Oe=zh.asTitle(Ie),Qe=this._titles.indexOf(Oe),dt=Math.max(0,Math.min(oe,this._titles.length));return Qe===-1?(Sa.ArrayExt.insert(this._titles,dt,Oe),Oe.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(dt,Oe),Oe):(dt===this._titles.length&&dt--,Qe===dt||(Sa.ArrayExt.move(this._titles,Qe,dt),this.update(),this._adjustCurrentForMove(Qe,dt)),Oe)}removeTab(oe){this.removeTabAt(this._titles.indexOf(oe))}removeTabAt(oe){let Ie=oe>=0&&oe-1?this._currentIndex:0;for(let Xt=0,nr=Oe.length;XtOs.hitTest(Jt,oe.clientX,oe.clientY));if(Oe===-1)return;let Qe=this.titles[Oe],dt=Ie[Oe].querySelector(".lm-TabBar-tabLabel");if(dt&&dt.contains(oe.target)){let Jt=Qe.label||"",jt=dt.innerHTML;dt.innerHTML="";let Xt=document.createElement("input");Xt.classList.add("lm-TabBar-tabInput"),Xt.value=Jt,dt.appendChild(Xt);let nr=()=>{Xt.removeEventListener("blur",nr),dt.innerHTML=jt,this.node.addEventListener("keydown",this)};Xt.addEventListener("dblclick",Ht=>Ht.stopPropagation()),Xt.addEventListener("blur",nr),Xt.addEventListener("keydown",Ht=>{Ht.key==="Enter"?(Xt.value!==""&&(Qe.label=Qe.caption=Xt.value),nr()):Ht.key==="Escape"&&nr()}),this.node.removeEventListener("keydown",this),Xt.select(),Xt.focus(),dt.children.length>0&&dt.children[0].focus()}}_evtKeyDownCapturing(oe){oe.eventPhase===Event.CAPTURING_PHASE&&(oe.preventDefault(),oe.stopPropagation(),oe.key==="Escape"&&this._releaseMouse())}_evtKeyDown(oe){var Ie,Oe,Qe;if(!(oe.key==="Tab"||oe.eventPhase===Event.CAPTURING_PHASE)){if(oe.key==="Enter"||oe.key==="Spacebar"||oe.key===" "){let dt=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(dt))oe.preventDefault(),oe.stopPropagation(),this._addRequested.emit();else{let Jt=Sa.ArrayExt.findFirstIndex(this.contentNode.children,jt=>jt.contains(dt));Jt>=0&&(oe.preventDefault(),oe.stopPropagation(),this.currentIndex=Jt)}}else if(Oce.includes(oe.key)){let dt=[...this.contentNode.children];if(this.addButtonEnabled&&dt.push(this.addButtonNode),dt.length<=1)return;oe.preventDefault(),oe.stopPropagation();let Jt=dt.indexOf(document.activeElement);Jt===-1&&(Jt=this._currentIndex);let jt;oe.key==="ArrowRight"&&this._orientation==="horizontal"||oe.key==="ArrowDown"&&this._orientation==="vertical"?jt=(Ie=dt[Jt+1])!==null&&Ie!==void 0?Ie:dt[0]:oe.key==="ArrowLeft"&&this._orientation==="horizontal"||oe.key==="ArrowUp"&&this._orientation==="vertical"?jt=(Oe=dt[Jt-1])!==null&&Oe!==void 0?Oe:dt[dt.length-1]:oe.key==="Home"?jt=dt[0]:oe.key==="End"&&(jt=dt[dt.length-1]),jt&&((Qe=dt[Jt])===null||Qe===void 0||Qe.setAttribute("tabindex","-1"),jt?.setAttribute("tabindex","0"),jt.focus())}}}_evtPointerDown(oe){if(oe.button!==0&&oe.button!==1||this._dragData||oe.target.classList.contains("lm-TabBar-tabInput"))return;let Ie=this.addButtonEnabled&&this.addButtonNode.contains(oe.target),Oe=this.contentNode.children,Qe=Sa.ArrayExt.findFirstIndex(Oe,Jt=>Os.hitTest(Jt,oe.clientX,oe.clientY));if(Qe===-1&&!Ie||(oe.preventDefault(),oe.stopPropagation(),this._dragData={tab:Oe[Qe],index:Qe,pressX:oe.clientX,pressY:oe.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),oe.button===1||Ie))return;let dt=Oe[Qe].querySelector(this.renderer.closeIconSelector);dt&&dt.contains(oe.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===Qe?this.currentIndex=-1:this.currentIndex=Qe,this.currentIndex!==-1&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(oe){let Ie=this._dragData;if(!Ie)return;oe.preventDefault(),oe.stopPropagation();let Oe=this.contentNode.children;if(!(!Ie.dragActive&&!zh.dragExceeded(Ie,oe))){if(!Ie.dragActive){let Qe=Ie.tab.getBoundingClientRect();this._orientation==="horizontal"?(Ie.tabPos=Ie.tab.offsetLeft,Ie.tabSize=Qe.width,Ie.tabPressPos=Ie.pressX-Qe.left):(Ie.tabPos=Ie.tab.offsetTop,Ie.tabSize=Qe.height,Ie.tabPressPos=Ie.pressY-Qe.top),Ie.tabPressOffset={x:Ie.pressX-Qe.left,y:Ie.pressY-Qe.top},Ie.tabLayout=zh.snapTabLayout(Oe,this._orientation),Ie.contentRect=this.contentNode.getBoundingClientRect(),Ie.override=nf.overrideCursor("default"),Ie.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),Ie.dragActive=!0}if(!Ie.detachRequested&&zh.detachExceeded(Ie,oe)){Ie.detachRequested=!0;let Qe=Ie.index,dt=oe.clientX,Jt=oe.clientY,jt=Oe[Qe],Xt=this._titles[Qe];if(this._tabDetachRequested.emit({index:Qe,title:Xt,tab:jt,clientX:dt,clientY:Jt,offset:Ie.tabPressOffset}),Ie.dragAborted)return}zh.layoutTabs(Oe,Ie,oe,this._orientation)}}_evtPointerUp(oe){if(oe.button!==0&&oe.button!==1)return;let Ie=this._dragData;if(!Ie)return;if(oe.preventDefault(),oe.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!Ie.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(oe.target)){this._addRequested.emit(void 0);return}let dt=this.contentNode.children,Jt=Sa.ArrayExt.findFirstIndex(dt,nr=>Os.hitTest(nr,oe.clientX,oe.clientY));if(Jt!==Ie.index)return;let jt=this._titles[Jt];if(!jt.closable)return;if(oe.button===1){this._tabCloseRequested.emit({index:Jt,title:jt});return}let Xt=dt[Jt].querySelector(this.renderer.closeIconSelector);if(Xt&&Xt.contains(oe.target)){this._tabSizeFrozen=!0,this._tabCloseRequested.emit({index:Jt,title:jt});return}return}if(oe.button!==0)return;zh.finalizeTabPosition(Ie,this._orientation),Ie.tab.classList.remove("lm-mod-dragging");let Oe=zh.parseTransitionDuration(Ie.tab);setTimeout(()=>{if(Ie.dragAborted)return;this._dragData=null,zh.resetTabPositions(this.contentNode.children,this._orientation),Ie.override.dispose(),this.removeClass("lm-mod-dragging");let Qe=Ie.index,dt=Ie.targetIndex;dt===-1||Qe===dt||(Sa.ArrayExt.move(this._titles,Qe,dt),this._adjustCurrentForMove(Qe,dt),this._tabMoved.emit({fromIndex:Qe,toIndex:dt,title:this._titles[dt]}),za.sendMessage(this,Ya.Msg.UpdateRequest))},Oe)}_releaseMouse(){let oe=this._dragData;oe&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),oe.dragAborted=!0,oe.dragActive&&(zh.resetTabPositions(this.contentNode.children,this._orientation),oe.override.dispose(),oe.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(oe,Ie){let Oe=this.currentTitle,Qe=this._currentIndex,dt=this.insertBehavior;if(dt==="select-tab"||dt==="select-tab-if-needed"&&Qe===-1){this._currentIndex=oe,this._previousTitle=Oe,this._currentChanged.emit({previousIndex:Qe,previousTitle:Oe,currentIndex:oe,currentTitle:Ie});return}Qe>=oe&&this._currentIndex++}_adjustCurrentForMove(oe,Ie){this._currentIndex===oe?this._currentIndex=Ie:this._currentIndex=Ie?this._currentIndex++:this._currentIndex>oe&&this._currentIndex<=Ie&&this._currentIndex--}_adjustCurrentForRemove(oe,Ie){let Oe=this._currentIndex,Qe=this.removeBehavior;if(Oe!==oe){Oe>oe&&this._currentIndex--;return}if(this._titles.length===0){this._currentIndex=-1,this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:-1,currentTitle:null});return}if(Qe==="select-tab-after"){this._currentIndex=Math.min(oe,this._titles.length-1),this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(Qe==="select-tab-before"){this._currentIndex=Math.max(0,oe-1),this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(Qe==="select-previous-tab"){this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(oe,this._titles.length-1),this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}this._currentIndex=-1,this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:-1,currentTitle:null})}_onTitleChanged(oe){this.update()}_evtPointerLeave(oe){if(!this._tabSizeFrozen)return;this._tabSizeFrozen=!1,this._frozenTabWidths=null,this._unfreezeRunID++;let Ie=this._unfreezeRunID;this._clearUnfreezeTransitionState(),this.addClass("lm-mod-unfreezing");let Oe=this.contentNode.children;for(let Qe=0,dt=Oe.length;Qe{let Jt=dt.propertyName;(Jt==="width"||Jt==="flex-basis")&&this._finalizeUnfreezeRun(Ie)};this._unfreezeTransitionListener=Qe,this.node.addEventListener("transitionend",Qe),this.node.addEventListener("transitioncancel",Qe),this._unfreezeFallbackTimerID=window.setTimeout(()=>{this._finalizeUnfreezeRun(Ie)},2e3)}this.update()}_setFrozenTabSize(oe,Ie){let Oe=`${Ie}px`;oe.style.width=Oe,oe.style.flexBasis=Oe}_finalizeUnfreezeRun(oe){oe===this._unfreezeRunID&&(this._clearUnfreezeTransitionState(),this.removeClass("lm-mod-unfreezing"))}_clearUnfreezeTransitionState(){this._unfreezeTransitionListener&&(this.node.removeEventListener("transitionend",this._unfreezeTransitionListener),this.node.removeEventListener("transitioncancel",this._unfreezeTransitionListener),this._unfreezeTransitionListener=null),this._unfreezeFallbackTimerID!==0&&(clearTimeout(this._unfreezeFallbackTimerID),this._unfreezeFallbackTimerID=0)}_clearTabSizeFreezeState(){this._tabSizeFrozen=!1,this._frozenTabWidths=null,this.removeClass("lm-mod-unfreezing");let oe=this.contentNode.children;for(let Ie=0,Oe=oe.length;Ie=We.DRAG_THRESHOLD||ir>=We.DRAG_THRESHOLD}We.dragExceeded=dt;function Jt(Ht,er){let ur=Ht.contentRect;return er.clientX=ur.right+We.DETACH_THRESHOLD||er.clientY=ur.bottom+We.DETACH_THRESHOLD}We.detachExceeded=Jt;function jt(Ht,er,ur,ir){let Ot,ar,Lr,Ir;ir==="horizontal"?(Ot=er.pressX,ar=ur.clientX-er.contentRect.left,Lr=ur.clientX,Ir=er.contentRect.width):(Ot=er.pressY,ar=ur.clientY-er.contentRect.top,Lr=ur.clientY,Ir=er.contentRect.height);let de=er.index,Mr=ar-er.tabPressPos,qr=Mr+er.tabSize;for(let Vr=0,ti=Ht.length;Vr>1);if(Vrer.index&&qr>Ia)Xr=`${-er.tabSize-Ki.margin}px`,de=Math.max(de,Vr);else if(Vr===er.index){let _i=Lr-Ot,ia=Ir-(er.tabPos+er.tabSize);Xr=`${Math.max(-er.tabPos,Math.min(_i,ia))}px`}else Xr="";ir==="horizontal"?Ht[Vr].style.left=Xr:Ht[Vr].style.top=Xr}er.targetIndex=de}We.layoutTabs=jt;function Xt(Ht,er){let ur;er==="horizontal"?ur=Ht.contentRect.width:ur=Ht.contentRect.height;let ir;if(Ht.targetIndex===Ht.index)ir=0;else if(Ht.targetIndex>Ht.index){let Lr=Ht.tabLayout[Ht.targetIndex];ir=Lr.pos+Lr.size-Ht.tabSize-Ht.tabPos}else ir=Ht.tabLayout[Ht.targetIndex].pos-Ht.tabPos;let Ot=ur-(Ht.tabPos+Ht.tabSize),ar=Math.max(-Ht.tabPos,Math.min(ir,Ot));er==="horizontal"?Ht.tab.style.left=`${ar}px`:Ht.tab.style.top=`${ar}px`}We.finalizeTabPosition=Xt;function nr(Ht,er){for(let ur of Ht)er==="horizontal"?ur.style.left="":ur.style.top=""}We.resetTabPositions=nr})(zh||(zh={}));var eE=class extends _p{constructor(oe){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=oe.renderer,oe.spacing!==void 0&&(this._spacing=py.clampDimension(oe.spacing)),this._document=oe.document||document,this._hiddenMode=oe.hiddenMode!==void 0?oe.hiddenMode:Ya.HiddenMode.Display}dispose(){let oe=this[Symbol.iterator]();this._items.forEach(Ie=>{Ie.dispose()}),this._box=null,this._root=null,this._items.clear();for(let Ie of oe)Ie.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(oe){if(this._hiddenMode!==oe){this._hiddenMode=oe;for(let Ie of this.tabBars())if(Ie.titles.length>1)for(let Oe of Ie.titles)Oe.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(oe){oe=py.clampDimension(oe),this._spacing!==oe&&(this._spacing=oe,this.parent&&this.parent.fit())}get isEmpty(){return this._root===null}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():(0,Sa.empty)()}widgets(){return this._root?this._root.iterUserWidgets():(0,Sa.empty)()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():(0,Sa.empty)()}tabBars(){return this._root?this._root.iterTabBars():(0,Sa.empty)()}handles(){return this._root?this._root.iterHandles():(0,Sa.empty)()}moveHandle(oe,Ie,Oe){let Qe=oe.classList.contains("lm-mod-hidden");if(!this._root||Qe)return;let dt=this._root.findSplitNode(oe);if(!dt)return;let Jt;dt.node.orientation==="horizontal"?Jt=Ie-oe.offsetLeft:Jt=Oe-oe.offsetTop,Jt!==0&&(dt.node.holdSizes(),ih.adjust(dt.node.sizers,dt.index,Jt),this.parent&&this.parent.update())}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(oe){let Ie=new Set,Oe;oe.main?Oe=Xl.normalizeAreaConfig(oe.main,Ie):Oe=null;let Qe=this.widgets(),dt=this.tabBars(),Jt=this.handles();this._root=null;for(let jt of Qe)Ie.has(jt)||(jt.parent=null);for(let jt of dt)jt.dispose();for(let jt of Jt)jt.parentNode&&jt.parentNode.removeChild(jt);for(let jt of Ie)jt.parent=this.parent;Oe?this._root=Xl.realizeAreaConfig(Oe,{createTabBar:jt=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):this._root=null,this.parent&&(Ie.forEach(jt=>{this.attachWidget(jt)}),this.parent.fit())}addWidget(oe,Ie={}){let Oe=Ie.ref||null,Qe=Ie.mode||"tab-after",dt=null;if(this._root&&Oe&&(dt=this._root.findTabNode(Oe)),Oe&&!dt)throw new Error("Reference widget is not in the layout.");switch(oe.parent=this.parent,Qe){case"tab-after":this._insertTab(oe,Oe,dt,!0);break;case"tab-before":this._insertTab(oe,Oe,dt,!1);break;case"split-top":this._insertSplit(oe,Oe,dt,"vertical",!1);break;case"split-left":this._insertSplit(oe,Oe,dt,"horizontal",!1);break;case"split-right":this._insertSplit(oe,Oe,dt,"horizontal",!0);break;case"split-bottom":this._insertSplit(oe,Oe,dt,"vertical",!0);break;case"merge-top":this._insertSplit(oe,Oe,dt,"vertical",!1,!0);break;case"merge-left":this._insertSplit(oe,Oe,dt,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(oe,Oe,dt,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(oe,Oe,dt,"vertical",!0,!0);break}this.parent&&(this.attachWidget(oe),this.parent.fit())}removeWidget(oe){this._removeWidget(oe),this.parent&&(this.detachWidget(oe),this.parent.fit())}hitTestTabAreas(oe,Ie){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=Os.boxSizing(this.parent.node));let Oe=this.parent.node.getBoundingClientRect(),Qe=oe-Oe.left-this._box.borderLeft,dt=Ie-Oe.top-this._box.borderTop,Jt=this._root.hitTestTabNodes(Qe,dt);if(!Jt)return null;let{tabBar:jt,top:Xt,left:nr,width:Ht,height:er}=Jt,ur=this._box.borderLeft+this._box.borderRight,ir=this._box.borderTop+this._box.borderBottom,Ot=Oe.width-ur-(nr+Ht),ar=Oe.height-ir-(Xt+er);return{tabBar:jt,x:Qe,y:dt,top:Xt,left:nr,right:Ot,bottom:ar,width:Ht,height:er}}init(){super.init();for(let oe of this)this.attachWidget(oe);for(let oe of this.handles())this.parent.node.appendChild(oe);this.parent.fit()}attachWidget(oe){this.parent.node!==oe.node.parentNode&&(this._items.set(oe,new dv(oe)),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeAttach),this.parent.node.appendChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterAttach))}detachWidget(oe){if(this.parent.node!==oe.node.parentNode)return;this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeDetach),this.parent.node.removeChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterDetach);let Ie=this._items.get(oe);Ie&&(this._items.delete(oe),Ie.dispose())}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_removeWidget(oe){if(!this._root)return;let Ie=this._root.findTabNode(oe);if(!Ie)return;if(Xl.removeAria(oe),Ie.tabBar.titles.length>1){if(Ie.tabBar.removeTab(oe.title),this._hiddenMode===Ya.HiddenMode.Scale&&Ie.tabBar.titles.length==1){let ur=Ie.tabBar.titles[0].owner;ur.hiddenMode=Ya.HiddenMode.Display}return}if(Ie.tabBar.dispose(),this._root===Ie){this._root=null;return}this._root.holdAllSizes();let Oe=Ie.parent;Ie.parent=null;let Qe=Sa.ArrayExt.removeFirstOf(Oe.children,Ie),dt=Sa.ArrayExt.removeAt(Oe.handles,Qe);if(Sa.ArrayExt.removeAt(Oe.sizers,Qe),dt.parentNode&&dt.parentNode.removeChild(dt),Oe.children.length>1){Oe.syncHandles();return}let Jt=Oe.parent;Oe.parent=null;let jt=Oe.children[0],Xt=Oe.handles[0];if(Oe.children.length=0,Oe.handles.length=0,Oe.sizers.length=0,Xt.parentNode&&Xt.parentNode.removeChild(Xt),this._root===Oe){jt.parent=null,this._root=jt;return}let nr=Jt,Ht=nr.children.indexOf(Oe);if(jt instanceof Xl.TabLayoutNode){jt.parent=nr,nr.children[Ht]=jt;return}let er=Sa.ArrayExt.removeAt(nr.handles,Ht);Sa.ArrayExt.removeAt(nr.children,Ht),Sa.ArrayExt.removeAt(nr.sizers,Ht),er.parentNode&&er.parentNode.removeChild(er);for(let ur=0,ir=jt.children.length;ur=this._left+this._width||Ot=this._top+this._height?null:this}createConfig(){let ir=this.tabBar.titles.map(ar=>ar.owner),Ot=this.tabBar.currentIndex;return{type:"tab-area",widgets:ir,currentIndex:Ot}}holdAllSizes(){}fit(ir,Ot){let ar=0,Lr=0,Ir=1/0,de=1/0,Mr=Ot.get(this.tabBar),qr=this.tabBar.currentTitle,Vr=qr?Ot.get(qr.owner):void 0,[ti,Xr]=this.sizers;return Mr&&Mr.fit(),Vr&&Vr.fit(),Mr&&!Mr.isHidden?(ar=Math.max(ar,Mr.minWidth),Lr+=Mr.minHeight,ti.minSize=Mr.minHeight,ti.maxSize=Mr.maxHeight):(ti.minSize=0,ti.maxSize=0),Vr&&!Vr.isHidden?(ar=Math.max(ar,Vr.minWidth),Lr+=Vr.minHeight,Xr.minSize=Vr.minHeight,Xr.maxSize=1/0):(Xr.minSize=0,Xr.maxSize=1/0),{minWidth:ar,minHeight:Lr,maxWidth:Ir,maxHeight:de}}update(ir,Ot,ar,Lr,Ir,de){this._top=Ot,this._left=ir,this._width=ar,this._height=Lr;let Mr=de.get(this.tabBar),qr=this.tabBar.currentTitle,Vr=qr?de.get(qr.owner):void 0;if(ih.calc(this.sizers,Lr),Mr&&!Mr.isHidden){let ti=this.sizers[0].size;Mr.update(ir,Ot,ar,ti),Ot+=ti}if(Vr&&!Vr.isHidden){let ti=this.sizers[1].size;Vr.update(ir,Ot,ar,ti)}}}We.TabLayoutNode=Qe;class dt{constructor(ir){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=ir}*iterAllWidgets(){for(let ir of this.children)yield*ir.iterAllWidgets()}*iterUserWidgets(){for(let ir of this.children)yield*ir.iterUserWidgets()}*iterSelectedWidgets(){for(let ir of this.children)yield*ir.iterSelectedWidgets()}*iterTabBars(){for(let ir of this.children)yield*ir.iterTabBars()}*iterHandles(){yield*this.handles;for(let ir of this.children)yield*ir.iterHandles()}findTabNode(ir){for(let Ot=0,ar=this.children.length;OtLr.createConfig());return{type:"split-area",orientation:ir,children:ar,sizes:Ot}}syncHandles(){this.handles.forEach((ir,Ot)=>{ir.setAttribute("data-orientation",this.orientation),Ot===this.handles.length-1?ir.classList.add("lm-mod-hidden"):ir.classList.remove("lm-mod-hidden")})}holdSizes(){for(let ir of this.sizers)ir.sizeHint=ir.size}holdAllSizes(){for(let ir of this.children)ir.holdAllSizes();this.holdSizes()}normalizeSizes(){let ir=this.sizers.length;if(ir===0)return;this.holdSizes();let Ot=this.sizers.reduce((ar,Lr)=>ar+Lr.sizeHint,0);if(Ot===0)for(let ar of this.sizers)ar.size=ar.sizeHint=1/ir;else for(let ar of this.sizers)ar.size=ar.sizeHint/=Ot;this.normalized=!0}createNormalizedSizes(){let ir=this.sizers.length;if(ir===0)return[];let Ot=this.sizers.map(Lr=>Lr.size),ar=Ot.reduce((Lr,Ir)=>Lr+Ir,0);if(ar===0)for(let Lr=Ot.length-1;Lr>-1;Lr--)Ot[Lr]=1/ir;else for(let Lr=Ot.length-1;Lr>-1;Lr--)Ot[Lr]/=ar;return Ot}fit(ir,Ot){let ar=this.orientation==="horizontal",Lr=Math.max(0,this.children.length-1)*ir,Ir=ar?Lr:0,de=ar?0:Lr,Mr=1/0,qr=1/0;for(let Vr=0,ti=this.children.length;Vr=Ot.length)&&(ar=0),{type:"tab-area",widgets:Ot,currentIndex:ar}}function nr(ur,ir){let Ot=ur.orientation,ar=[],Lr=[];for(let Ir=0,de=ur.children.length;Ir{let de=Oe(Lr,ir,Ot),Mr=oe(ur.sizes[Ir]),qr=ir.createHandle();ar.children.push(de),ar.handles.push(qr),ar.sizers.push(Mr),de.parent=ar}),ar.syncHandles(),ar.normalizeSizes(),ar}})(Xl||(Xl={}));var sw=class We extends Ya{constructor(oe={}){super(),this._drag=null,this._tabsMovable=!0,this._tabsConstrained=!1,this._addButtonEnabled=!1,this._pressData=null,this._layoutModified=new Ls(this),this._addRequested=new Ls(this),this.addClass("lm-DockPanel"),this._document=oe.document||document,this._mode=oe.mode||"multiple-document",this._renderer=oe.renderer||We.defaultRenderer,this._edges=oe.edges||Rl.DEFAULT_EDGES,oe.tabsMovable!==void 0&&(this._tabsMovable=oe.tabsMovable),oe.tabsConstrained!==void 0&&(this._tabsConstrained=oe.tabsConstrained),oe.addButtonEnabled!==void 0&&(this._addButtonEnabled=oe.addButtonEnabled),this.dataset.mode=this._mode;let Ie={createTabBar:()=>this._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new eE({document:this._document,renderer:Ie,spacing:oe.spacing,hiddenMode:oe.hiddenMode}),this.overlay=oe.overlay||new We.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(oe){this.layout.hiddenMode=oe}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(oe){this.layout.spacing=oe}get mode(){return this._mode}set mode(oe){if(this._mode===oe)return;this._mode=oe,this.dataset.mode=oe;let Ie=this.layout;switch(oe){case"multiple-document":for(let Oe of Ie.tabBars())Oe.show();break;case"single-document":Ie.restoreLayout(Rl.createSingleDocumentConfig(this));break;default:throw"unreachable"}za.postMessage(this,Rl.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(oe){this._tabsMovable=oe;for(let Ie of this.tabBars())Ie.tabsMovable=oe}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(oe){this._tabsConstrained=oe}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(oe){this._addButtonEnabled=oe;for(let Ie of this.tabBars())Ie.addButtonEnabled=oe}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(oe){let Ie=(0,Sa.find)(this.tabBars(),Oe=>Oe.titles.indexOf(oe.title)!==-1);if(!Ie)throw new Error("Widget is not contained in the dock panel.");Ie.currentTitle=oe.title}activateWidget(oe){this.selectWidget(oe),oe.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(oe){this._mode="multiple-document",this.layout.restoreLayout(oe),(Nc.IS_EDGE||Nc.IS_IE)&&za.flush(),za.postMessage(this,Rl.LayoutModified)}addWidget(oe,Ie={}){this._mode==="single-document"?this.layout.addWidget(oe):this.layout.addWidget(oe,Ie),za.postMessage(this,Rl.LayoutModified)}processMessage(oe){oe.type==="layout-modified"?this._layoutModified.emit(void 0):super.processMessage(oe)}handleEvent(oe){switch(oe.type){case"lm-dragenter":this._evtDragEnter(oe);break;case"lm-dragleave":this._evtDragLeave(oe);break;case"lm-dragover":this._evtDragOver(oe);break;case"lm-drop":this._evtDrop(oe);break;case"pointerdown":this._evtPointerDown(oe);break;case"pointermove":this._evtPointerMove(oe);break;case"pointerup":this._evtPointerUp(oe);break;case"keydown":this._evtKeyDown(oe);break;case"contextmenu":oe.preventDefault(),oe.stopPropagation();break}}onBeforeAttach(oe){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(oe){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(oe){Rl.isGeneratedTabBarProperty.get(oe.child)||oe.child.addClass("lm-DockPanel-widget")}onChildRemoved(oe){Rl.isGeneratedTabBarProperty.get(oe.child)||(oe.child.removeClass("lm-DockPanel-widget"),za.postMessage(this,Rl.LayoutModified))}_evtDragEnter(oe){oe.mimeData.hasData("application/vnd.lumino.widget-factory")&&(oe.preventDefault(),oe.stopPropagation())}_evtDragLeave(oe){oe.preventDefault(),!(this._tabsConstrained&&oe.source!==this)&&(oe.stopPropagation(),this.overlay.hide(1))}_evtDragOver(oe){oe.preventDefault(),this._tabsConstrained&&oe.source!==this||this._showOverlay(oe.clientX,oe.clientY)==="invalid"?oe.dropAction="none":(oe.stopPropagation(),oe.dropAction=oe.proposedAction)}_evtDrop(oe){if(oe.preventDefault(),this.overlay.hide(0),oe.proposedAction==="none"){oe.dropAction="none";return}let{clientX:Ie,clientY:Oe}=oe,{zone:Qe,target:dt}=Rl.findDropTarget(this,Ie,Oe,this._edges);if(this._tabsConstrained&&oe.source!==this||Qe==="invalid"){oe.dropAction="none";return}let jt=oe.mimeData.getData("application/vnd.lumino.widget-factory");if(typeof jt!="function"){oe.dropAction="none";return}let Xt=jt();if(!(Xt instanceof Ya)){oe.dropAction="none";return}if(Xt.contains(this)){oe.dropAction="none";return}let nr=dt?Rl.getDropRef(dt.tabBar):null;switch(Qe){case"root-all":this.addWidget(Xt);break;case"root-top":this.addWidget(Xt,{mode:"split-top"});break;case"root-left":this.addWidget(Xt,{mode:"split-left"});break;case"root-right":this.addWidget(Xt,{mode:"split-right"});break;case"root-bottom":this.addWidget(Xt,{mode:"split-bottom"});break;case"widget-all":this.addWidget(Xt,{mode:"tab-after",ref:nr});break;case"widget-top":this.addWidget(Xt,{mode:"split-top",ref:nr});break;case"widget-left":this.addWidget(Xt,{mode:"split-left",ref:nr});break;case"widget-right":this.addWidget(Xt,{mode:"split-right",ref:nr});break;case"widget-bottom":this.addWidget(Xt,{mode:"split-bottom",ref:nr});break;case"widget-tab":this.addWidget(Xt,{mode:"tab-after",ref:nr});break;default:throw"unreachable"}oe.dropAction=oe.proposedAction,oe.stopPropagation(),this.activateWidget(Xt)}_evtKeyDown(oe){oe.preventDefault(),oe.stopPropagation(),oe.keyCode===27&&(this._releaseMouse(),za.postMessage(this,Rl.LayoutModified))}_evtPointerDown(oe){if(oe.button!==0)return;let Ie=this.layout,Oe=oe.target,Qe=(0,Sa.find)(Ie.handles(),Ht=>Ht.contains(Oe));if(!Qe)return;oe.preventDefault(),oe.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let dt=Qe.getBoundingClientRect(),Jt=oe.clientX-dt.left,jt=oe.clientY-dt.top,Xt=window.getComputedStyle(Qe),nr=nf.overrideCursor(Xt.cursor,this._document);this._pressData={handle:Qe,deltaX:Jt,deltaY:jt,override:nr}}_evtPointerMove(oe){if(!this._pressData)return;oe.preventDefault(),oe.stopPropagation();let Ie=this.node.getBoundingClientRect(),Oe=oe.clientX-Ie.left-this._pressData.deltaX,Qe=oe.clientY-Ie.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,Oe,Qe)}_evtPointerUp(oe){oe.button===0&&(oe.preventDefault(),oe.stopPropagation(),this._releaseMouse(),za.postMessage(this,Rl.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(oe,Ie){let{zone:Oe,target:Qe}=Rl.findDropTarget(this,oe,Ie,this._edges);if(Oe==="invalid")return this.overlay.hide(100),Oe;let dt,Jt,jt,Xt,nr=Os.boxSizing(this.node),Ht=this.node.getBoundingClientRect();switch(Oe){case"root-all":dt=nr.paddingTop,Jt=nr.paddingLeft,jt=nr.paddingRight,Xt=nr.paddingBottom;break;case"root-top":dt=nr.paddingTop,Jt=nr.paddingLeft,jt=nr.paddingRight,Xt=Ht.height*Rl.GOLDEN_RATIO;break;case"root-left":dt=nr.paddingTop,Jt=nr.paddingLeft,jt=Ht.width*Rl.GOLDEN_RATIO,Xt=nr.paddingBottom;break;case"root-right":dt=nr.paddingTop,Jt=Ht.width*Rl.GOLDEN_RATIO,jt=nr.paddingRight,Xt=nr.paddingBottom;break;case"root-bottom":dt=Ht.height*Rl.GOLDEN_RATIO,Jt=nr.paddingLeft,jt=nr.paddingRight,Xt=nr.paddingBottom;break;case"widget-all":dt=Qe.top,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom;break;case"widget-top":dt=Qe.top,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom+Qe.height/2;break;case"widget-left":dt=Qe.top,Jt=Qe.left,jt=Qe.right+Qe.width/2,Xt=Qe.bottom;break;case"widget-right":dt=Qe.top,Jt=Qe.left+Qe.width/2,jt=Qe.right,Xt=Qe.bottom;break;case"widget-bottom":dt=Qe.top+Qe.height/2,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom;break;case"widget-tab":{let er=Qe.tabBar.node.getBoundingClientRect().height;dt=Qe.top,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom+Qe.height-er;break}default:throw"unreachable"}return this.overlay.show({top:dt,left:Jt,right:jt,bottom:Xt}),Oe}_createTabBar(){let oe=this._renderer.createTabBar(this._document);return Rl.isGeneratedTabBarProperty.set(oe,!0),this._mode==="single-document"&&oe.hide(),oe.tabsMovable=this._tabsMovable,oe.allowDeselect=!1,oe.addButtonEnabled=this._addButtonEnabled,oe.removeBehavior="select-previous-tab",oe.insertBehavior="select-tab-if-needed",oe.tabMoved.connect(this._onTabMoved,this),oe.currentChanged.connect(this._onCurrentChanged,this),oe.tabCloseRequested.connect(this._onTabCloseRequested,this),oe.tabDetachRequested.connect(this._onTabDetachRequested,this),oe.tabActivateRequested.connect(this._onTabActivateRequested,this),oe.addRequested.connect(this._onTabAddRequested,this),oe}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){za.postMessage(this,Rl.LayoutModified)}_onCurrentChanged(oe,Ie){let{previousTitle:Oe,currentTitle:Qe}=Ie;Oe&&Oe.owner.hide(),Qe&&Qe.owner.show(),(Nc.IS_EDGE||Nc.IS_IE)&&za.flush(),za.postMessage(this,Rl.LayoutModified)}_onTabAddRequested(oe){this._addRequested.emit(oe)}_onTabActivateRequested(oe,Ie){Ie.title.owner.activate()}_onTabCloseRequested(oe,Ie){Ie.title.owner.close()}_onTabDetachRequested(oe,Ie){if(this._drag)return;oe.releaseMouse();let{title:Oe,tab:Qe,clientX:dt,clientY:Jt,offset:jt}=Ie,Xt=new yp.MimeData,nr=()=>Oe.owner;Xt.setData("application/vnd.lumino.widget-factory",nr);let Ht=Qe.cloneNode(!0);jt&&(Ht.style.top=`-${jt.y}px`,Ht.style.left=`-${jt.x}px`),this._drag=new nf({document:this._document,mimeData:Xt,dragImage:Ht,proposedAction:"move",supportedActions:"move",source:this}),Qe.classList.add("lm-mod-hidden");let er=()=>{this._drag=null,Qe.classList.remove("lm-mod-hidden")};this._drag.start(dt,Jt).then(er)}};(function(We){class oe{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(Qe){let dt=this.node.style;dt.top=`${Qe.top}px`,dt.left=`${Qe.left}px`,dt.right=`${Qe.right}px`,dt.bottom=`${Qe.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(Qe){if(!this._hidden){if(Qe<=0){clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden");return}this._timer===-1&&(this._timer=window.setTimeout(()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")},Qe))}}}We.Overlay=oe;class Ie{createTabBar(Qe){let dt=new i1({document:Qe});return dt.addClass("lm-DockPanel-tabBar"),dt}createHandle(){let Qe=document.createElement("div");return Qe.className="lm-DockPanel-handle",Qe}}We.Renderer=Ie,We.defaultRenderer=new Ie})(sw||(sw={}));var Rl;(function(We){We.GOLDEN_RATIO=.618,We.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},We.LayoutModified=new o0("layout-modified"),We.isGeneratedTabBarProperty=new af({name:"isGeneratedTabBar",create:()=>!1});function oe(Qe){if(Qe.isEmpty)return{main:null};let dt=Array.from(Qe.widgets()),Jt=Qe.selectedWidgets().next().value,jt=Jt?dt.indexOf(Jt):-1;return{main:{type:"tab-area",widgets:dt,currentIndex:jt}}}We.createSingleDocumentConfig=oe;function Ie(Qe,dt,Jt,jt){if(!Os.hitTest(Qe.node,dt,Jt))return{zone:"invalid",target:null};let Xt=Qe.layout;if(Xt.isEmpty)return{zone:"root-all",target:null};if(Qe.mode==="multiple-document"){let Mr=Qe.node.getBoundingClientRect(),qr=dt-Mr.left+1,Vr=Jt-Mr.top+1,ti=Mr.right-dt,Xr=Mr.bottom-Jt;switch(Math.min(Vr,ti,Xr,qr)){case Vr:if(Vrar&&ur>ar&&er>Lr&&ir>Lr)return{zone:"widget-all",target:nr};Ht/=ar,er/=Lr,ur/=ar,ir/=Lr;let Ir=Math.min(Ht,er,ur,ir),de;switch(Ir){case Ht:de="widget-left";break;case er:de="widget-top";break;case ur:de="widget-right";break;case ir:de="widget-bottom";break;default:throw"unreachable"}return{zone:de,target:nr}}We.findDropTarget=Ie;function Oe(Qe){return Qe.titles.length===0?null:Qe.currentTitle?Qe.currentTitle.owner:Qe.titles[Qe.titles.length-1].owner}We.getDropRef=Oe})(Rl||(Rl={}));var my=class We extends _p{constructor(oe={}){super(oe),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new Wd],this._columnSizers=[new Wd],this._box=null,oe.rowCount!==void 0&&Au.reallocSizers(this._rowSizers,oe.rowCount),oe.columnCount!==void 0&&Au.reallocSizers(this._columnSizers,oe.columnCount),oe.rowSpacing!==void 0&&(this._rowSpacing=Au.clampValue(oe.rowSpacing)),oe.columnSpacing!==void 0&&(this._columnSpacing=Au.clampValue(oe.columnSpacing))}dispose(){for(let oe of this._items){let Ie=oe.widget;oe.dispose(),Ie.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(oe){oe!==this.rowCount&&(Au.reallocSizers(this._rowSizers,oe),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(oe){oe!==this.columnCount&&(Au.reallocSizers(this._columnSizers,oe),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(oe){oe=Au.clampValue(oe),this._rowSpacing!==oe&&(this._rowSpacing=oe,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(oe){oe=Au.clampValue(oe),this._columnSpacing!==oe&&(this._columnSpacing=oe,this.parent&&this.parent.fit())}rowStretch(oe){let Ie=this._rowSizers[oe];return Ie?Ie.stretch:-1}setRowStretch(oe,Ie){let Oe=this._rowSizers[oe];Oe&&(Ie=Au.clampValue(Ie),Oe.stretch!==Ie&&(Oe.stretch=Ie,this.parent&&this.parent.update()))}columnStretch(oe){let Ie=this._columnSizers[oe];return Ie?Ie.stretch:-1}setColumnStretch(oe,Ie){let Oe=this._columnSizers[oe];Oe&&(Ie=Au.clampValue(Ie),Oe.stretch!==Ie&&(Oe.stretch=Ie,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(let oe of this._items)yield oe.widget}addWidget(oe){Sa.ArrayExt.findFirstIndex(this._items,Oe=>Oe.widget===oe)===-1&&(this._items.push(new dv(oe)),this.parent&&this.attachWidget(oe))}removeWidget(oe){let Ie=Sa.ArrayExt.findFirstIndex(this._items,Qe=>Qe.widget===oe);if(Ie===-1)return;let Oe=Sa.ArrayExt.removeAt(this._items,Ie);this.parent&&this.detachWidget(oe),Oe.dispose()}init(){super.init();for(let oe of this)this.attachWidget(oe)}attachWidget(oe){this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeAttach),this.parent.node.appendChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterAttach),this.parent.fit()}detachWidget(oe){this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeDetach),this.parent.node.removeChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterDetach),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_fit(){for(let Xt=0,nr=this.rowCount;Xt!Xt.isHidden);for(let Xt=0,nr=oe.length;Xt({row:0,column:0,rowSpan:1,columnSpan:1}),changed:jt});function oe(Xt){let nr=Math.max(0,Math.floor(Xt.row||0)),Ht=Math.max(0,Math.floor(Xt.column||0)),er=Math.max(1,Math.floor(Xt.rowSpan||0)),ur=Math.max(1,Math.floor(Xt.columnSpan||0));return{row:nr,column:Ht,rowSpan:er,columnSpan:ur}}We.normalizeConfig=oe;function Ie(Xt){return Math.max(0,Math.floor(Xt))}We.clampValue=Ie;function Oe(Xt,nr){let Ht=We.cellConfigProperty.get(Xt.widget),er=We.cellConfigProperty.get(nr.widget);return Ht.rowSpan-er.rowSpan}We.rowSpanCmp=Oe;function Qe(Xt,nr){let Ht=We.cellConfigProperty.get(Xt.widget),er=We.cellConfigProperty.get(nr.widget);return Ht.columnSpan-er.columnSpan}We.columnSpanCmp=Qe;function dt(Xt,nr){for(nr=Math.max(1,Math.floor(nr));Xt.lengthnr&&(Xt.length=nr)}We.reallocSizers=dt;function Jt(Xt,nr,Ht,er){if(Ht=er)return;let ir=(er-ur)/(Ht-nr+1);for(let Ot=nr;Ot<=Ht;++Ot)Xt[Ot].minSize+=ir}We.distributeMin=Jt;function jt(Xt){Xt.parent&&Xt.parent.layout instanceof my&&Xt.parent.fit()}})(Au||(Au={}));var lw=class We extends Ya{constructor(oe={}){super({node:uw.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(Ya.Flag.DisallowLayout),this.renderer=oe.renderer||We.defaultRenderer,this._forceItemsPosition=oe.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=oe.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(oe){this.activeIndex=oe?this._menus.indexOf(oe):-1}get activeIndex(){return this._activeIndex}set activeIndex(oe){(oe<0||oe>=this._menus.length)&&(oe=-1),oe>-1&&this._menus[oe].items.length===0&&(oe=-1),this._activeIndex!==oe&&(this._activeIndex=oe,this.update())}get menus(){return this._menus}openActiveMenu(){this._activeIndex!==-1&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(oe,Ie=!0){this.insertMenu(this._menus.length,oe,Ie)}insertMenu(oe,Ie,Oe=!0){this._closeChildMenu();let Qe=this._menus.indexOf(Ie),dt=Math.max(0,Math.min(oe,this._menus.length));if(Qe===-1){Sa.ArrayExt.insert(this._menus,dt,Ie),Ie.addClass("lm-MenuBar-menu"),Ie.aboutToClose.connect(this._onMenuAboutToClose,this),Ie.menuRequested.connect(this._onMenuMenuRequested,this),Ie.title.changed.connect(this._onTitleChanged,this),Oe&&this.update();return}dt===this._menus.length&&dt--,Qe!==dt&&(Sa.ArrayExt.move(this._menus,Qe,dt),Oe&&this.update())}removeMenu(oe,Ie=!0){this.removeMenuAt(this._menus.indexOf(oe),Ie)}removeMenuAt(oe,Ie=!0){this._closeChildMenu();let Oe=Sa.ArrayExt.removeAt(this._menus,oe);Oe&&(Oe.aboutToClose.disconnect(this._onMenuAboutToClose,this),Oe.menuRequested.disconnect(this._onMenuMenuRequested,this),Oe.title.changed.disconnect(this._onTitleChanged,this),Oe.removeClass("lm-MenuBar-menu"),Ie&&this.update())}clearMenus(){if(this._menus.length!==0){this._closeChildMenu();for(let oe of this._menus)oe.aboutToClose.disconnect(this._onMenuAboutToClose,this),oe.menuRequested.disconnect(this._onMenuMenuRequested,this),oe.title.changed.disconnect(this._onTitleChanged,this),oe.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(oe){switch(oe.type){case"keydown":this._evtKeyDown(oe);break;case"pointerdown":this._evtPointerDown(oe);break;case"pointermove":case"pointerleave":this._evtPointerMove(oe);break;case"focusout":this._evtFocusOut(oe);break;case"contextmenu":oe.preventDefault(),oe.stopPropagation();break}}onBeforeAttach(oe){this.node.addEventListener("keydown",this),this.node.addEventListener("pointerdown",this),this.node.addEventListener("pointermove",this),this.node.addEventListener("pointerleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(oe){this.node.removeEventListener("keydown",this),this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("pointermove",this),this.node.removeEventListener("pointerleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(oe){this.isAttached&&this._focusItemAt(0)}onResize(oe){this.update(),super.onResize(oe)}onUpdateRequest(oe){var Ie;let Oe=this._menus,Qe=this.renderer,dt=this._activeIndex,Jt=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:Oe.length,Xt=0,nr=!1;jt=this._overflowMenu!==null?jt-1:jt;let Ht=new Array(jt);for(let er=0;er{this._tabFocusIndex=er,this.activeIndex=er}}),Xt+=this._menuItemSizes[er],Oe[er].title.label===this._overflowMenuOptions.title&&(nr=!0,jt--);if(this._overflowMenuOptions.isVisible){if(this._overflowIndex>-1&&!nr){if(this._overflowMenu===null){let er=(Ie=this._overflowMenuOptions.title)!==null&&Ie!==void 0?Ie:"...";this._overflowMenu=new hv({commands:new vp}),this._overflowMenu.title.label=er,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let er=Oe.length-2;er>=jt;er--){let ur=this.menus[er];ur.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:ur}),this.removeMenu(ur,!1)}Ht[jt]=Qe.renderItem({title:this._overflowMenu.title,active:jt===dt&&Oe[jt].items.length!==0,tabbable:jt===Jt,disabled:Oe[jt].items.length===0,onfocus:()=>{this._tabFocusIndex=jt,this.activeIndex=jt}}),jt++}else if(this._overflowMenu!==null){let er=this._overflowMenu.items,ur=this.node.offsetWidth,ir=this._overflowMenu.items.length;for(let Ot=0;Otthis._menuItemSizes[ar]){let Lr=er[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(jt,Lr,!1),Ht[jt]=Qe.renderItem({title:Lr.title,active:!1,tabbable:jt===Jt,disabled:Oe[jt].items.length===0,onfocus:()=>{this._tabFocusIndex=jt,this.activeIndex=jt}}),jt++}}this._overflowMenu.items.length===0&&(this.removeMenu(this._overflowMenu,!1),Ht.pop(),this._overflowMenu=null,this._overflowIndex=-1)}}Hd.render(Ht,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;let oe=this.contentNode.childNodes,Ie=this.node.offsetWidth,Oe=0,Qe=-1,dt=oe.length;if(this._menuItemSizes.length==0)for(let Jt=0;JtIe&&Qe===-1&&(Qe=Jt)}else for(let Jt=0;JtIe){Qe=Jt;break}this._overflowIndex=Qe}_evtKeyDown(oe){let Ie=oe.keyCode;if(Ie===9){this.activeIndex=-1;return}if(oe.preventDefault(),oe.stopPropagation(),Ie===13||Ie===32||Ie===38||Ie===40){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;this.openActiveMenu();return}if(Ie===27){this._closeChildMenu(),this._focusItemAt(this.activeIndex);return}if(Ie===37||Ie===39){let Jt=Ie===37?-1:1,jt=this._tabFocusIndex+Jt,Xt=this._menus.length;for(let nr=0;nrOs.hitTest(Oe,oe.clientX,oe.clientY));if(Ie===-1){this._closeChildMenu();return}if(oe.button===0)if(this._childMenu)this._closeChildMenu(),this.activeIndex=Ie;else{oe.preventDefault();let Oe=this._positionForMenu(Ie);hv.saveWindowData(),this.activeIndex=Ie,this._openChildMenu(Oe)}}_evtPointerMove(oe){let Ie=Sa.ArrayExt.findFirstIndex(this.contentNode.children,Qe=>Os.hitTest(Qe,oe.clientX,oe.clientY));if(Ie===this._activeIndex||Ie===-1&&this._childMenu)return;let Oe=Ie>=0&&this._childMenu?this._positionForMenu(Ie):null;hv.saveWindowData(),this.activeIndex=Ie,Oe&&this._openChildMenu(Oe)}_positionForMenu(oe){let Ie=this.contentNode.children[oe],{left:Oe,bottom:Qe}=Ie.getBoundingClientRect();return{top:Qe,left:Oe}}_evtFocusOut(oe){!this._childMenu&&!this.node.contains(oe.relatedTarget)&&(this.activeIndex=-1)}_focusItemAt(oe){let Ie=this.contentNode.childNodes[oe];Ie&&Ie.focus()}_openChildMenu(oe={}){let Ie=this.activeMenu;if(!Ie){this._closeChildMenu();return}let Oe=this._childMenu;if(Oe===Ie)return;this._childMenu=Ie,Oe?Oe.close():document.addEventListener("pointerdown",this,!0),this._tabFocusIndex=this.activeIndex,za.sendMessage(this,Ya.Msg.UpdateRequest);let{left:Qe,top:dt}=oe;(typeof Qe>"u"||typeof dt>"u")&&({left:Qe,top:dt}=this._positionForMenu(this._activeIndex)),Oe||this.addClass("lm-mod-active"),Ie.items.length>0&&Ie.open(Qe,dt,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0);let oe=this._childMenu;this._childMenu=null,oe.close(),this.activeIndex=-1}_onMenuAboutToClose(oe){oe===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(oe,Ie){if(oe!==this._childMenu)return;let Oe=this._activeIndex,Qe=this._menus.length;switch(Ie){case"next":this.activeIndex=Oe===Qe-1?0:Oe+1;break;case"previous":this.activeIndex=Oe===0?Qe-1:Oe-1;break}this.openActiveMenu()}_onTitleChanged(){this.update()}};(function(We){class oe{renderItem(Oe){let Qe=this.createItemClass(Oe),dt=this.createItemDataset(Oe),Jt=this.createItemARIA(Oe);return Fs.li({className:Qe,dataset:dt,...Oe.disabled?{}:{tabindex:Oe.tabbable?"0":"-1"},onfocus:Oe.onfocus,...Jt},this.renderIcon(Oe),this.renderLabel(Oe))}renderIcon(Oe){let Qe=this.createIconClass(Oe);return Fs.div({className:Qe},Oe.title.icon,Oe.title.iconLabel)}renderLabel(Oe){let Qe=this.formatLabel(Oe);return Fs.div({className:"lm-MenuBar-itemLabel"},Qe)}createItemClass(Oe){let Qe="lm-MenuBar-item";return Oe.title.className&&(Qe+=` ${Oe.title.className}`),Oe.active&&!Oe.disabled&&(Qe+=" lm-mod-active"),Qe}createItemDataset(Oe){return Oe.title.dataset}createItemARIA(Oe){return{role:"menuitem","aria-haspopup":"true","aria-disabled":Oe.disabled?"true":"false"}}createIconClass(Oe){let Qe="lm-MenuBar-itemIcon",dt=Oe.title.iconClass;return dt?`${Qe} ${dt}`:Qe}formatLabel(Oe){let{label:Qe,mnemonic:dt}=Oe.title;if(dt<0||dt>=Qe.length)return Qe;let Jt=Qe.slice(0,dt),jt=Qe.slice(dt+1),Xt=Qe[dt],nr=Fs.span({className:"lm-MenuBar-itemMnemonic"},Xt);return[Jt,nr,jt]}}We.Renderer=oe,We.defaultRenderer=new oe})(lw||(lw={}));var uw;(function(We){function oe(){let Oe=document.createElement("div"),Qe=document.createElement("ul");return Qe.className="lm-MenuBar-content",Oe.appendChild(Qe),Qe.setAttribute("role","menubar"),Oe}We.createNode=oe;function Ie(Oe,Qe,dt){let Jt=-1,jt=-1,Xt=!1,nr=Qe.toUpperCase();for(let Ht=0,er=Oe.length;Ht=0&&Ot1&&this.widgets.forEach(Ie=>{Ie.hiddenMode=this._hiddenMode}))}dispose(){for(let oe of this._items)oe.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(oe,Ie){this._hiddenMode===Ya.HiddenMode.Scale&&this._items.length>0?(this._items.length===1&&(this.widgets[0].hiddenMode=Ya.HiddenMode.Scale),Ie.hiddenMode=Ya.HiddenMode.Scale):Ie.hiddenMode=Ya.HiddenMode.Display,Sa.ArrayExt.insert(this._items,oe,new dv(Ie)),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.appendChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach),this.parent.fit()}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._items,oe,Ie),this.parent.update()}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._items,oe);this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach),Oe.widget.node.style.zIndex="",this._hiddenMode===Ya.HiddenMode.Scale&&(Ie.hiddenMode=Ya.HiddenMode.Display,this._items.length===1&&(this._items[0].widget.hiddenMode=Ya.HiddenMode.Display)),Oe.dispose(),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_fit(){let oe=0,Ie=0;for(let dt=0,Jt=this._items.length;dt{this.createGraph(this._model)})}renderModel(oe){if(this.hasGraphElement())return Promise.resolve();this._model=oe;let Ie=oe.data["image/png"];return Ie!=null?(this.updateImage(Ie),Promise.resolve()):this.createGraph(oe)}hasGraphElement(){return this.node.querySelector(".plot-container")!==null}updateImage(oe){this.hideGraph(),this._img_el.src="data:image/png;base64,"+oe,this.showImage()}hideGraph(){let oe=this.node.querySelector(".plot-container");oe!=null&&(oe.style.display="none")}showGraph(){let oe=this.node.querySelector(".plot-container");oe!=null&&(oe.style.display="block")}hideImage(){let oe=this.node.querySelector(".plot-img");oe!=null&&(oe.style.display="none")}showImage(){let oe=this.node.querySelector(".plot-img");oe!=null&&(oe.style.display="block")}createGraph(oe){let{data:Ie,layout:Oe,frames:Qe,config:dt}=oe.data[this._mimeType];return Oe.height||(Oe.height=360),(async()=>(We.Plotly===null&&(We.Plotly=await Promise.resolve().then(()=>hp(hU())),We._resolveLoadingPlotly()),We.loadingPlotly))().then(()=>We.Plotly.react(this.node,Ie,Oe,dt)).then(jt=>{this.showGraph(),this.hideImage(),this.update(),Qe&&We.Plotly.addFrames(this.node,Qe),this.node.offsetWidth>0&&this.node.offsetHeight>0&&We.Plotly.toImage(jt,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then(Xt=>{let nr=Xt.split(",")[1];oe.data["image/png"]!==nr&&oe.setData({data:{...oe.data,"image/png":nr}})}),this.node.on("plotly_webglcontextlost",()=>{let Xt=oe.data["image/png"];if(Xt!=null)return this.updateImage(Xt),Promise.resolve()})})}onAfterShow(oe){this.update()}onResize(oe){this.update()}onUpdateRequest(oe){We.Plotly&&this.isVisible&&this.hasGraphElement()&&We.Plotly.redraw(this.node).then(()=>{We.Plotly.Plots.resize(this.node)})}static{this.Plotly=null}static{this.loadingPlotly=new Promise(oe=>{We._resolveLoadingPlotly=oe})}},Uce={safe:!0,mimeTypes:[dU],createRenderer:We=>new cE(We)},qce=[{id:"@jupyterlab/plotly-extension:factory",rendererFactory:Uce,rank:2,dataType:"json",fileTypes:[{name:"plotly",mimeTypes:[dU],extensions:[".plotly",".plotly.json"],iconClass:jce}],documentWidgetFactoryOptions:{name:"Plotly",primaryFileType:"plotly",fileTypes:["plotly","json"],defaultFor:["plotly"]}}],$me=qce;export{dU as MIME_TYPE,cE as RenderedPlotly,$me as default,Uce as rendererFactory}; +`),S=u.createShader(u.FRAGMENT_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(S,v),u.compileShader(S),u.attachShader(this.program,S);let M=u.createShader(u.VERTEX_SHADER);if(u.isContextLost()){this.failedToCreate=!0;return}u.shaderSource(M,x),u.compileShader(M),u.attachShader(this.program,M),this.attributes={};let C={};if(this.numAttributes=h.length,u.linkProgram(this.program),!u.getProgramParameter(this.program,u.LINK_STATUS)){if(u.isContextLost()){this.failedToCreate=!0;return}throw u.getShaderParameter(S,u.COMPILE_STATUS)?u.getShaderParameter(M,u.COMPILE_STATUS)?Error(`Program failed to link: ${u.getProgramInfoLog(this.program)}`):Error(`Could not compile vertex shader: ${u.getShaderInfoLog(M)}`):Error(`Could not compile fragment shader: ${u.getShaderInfoLog(S)}`)}goe(u,this.program);let w=woe(u,this.program);for(let k of h){if(!k)continue;let A=u.getAttribLocation(this.program,k);A>=0&&(this.attributes[k]={location:A,isInteger:w.has(k)})}u.deleteShader(M),u.deleteShader(S);for(let k of y)if(k&&!C[k]){let A=u.getUniformLocation(this.program,k);A&&(C[k]=A)}this.fixedUniforms=i(e,C),this.terrainUniforms=aO(e,C),this.binderUniforms=t?t.getUniforms(e,C):[]}draw(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p,g,m,y,_){var v;let x=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(t),e.setStencilMode(i),e.setColorMode(a),e.setCullFace(o),l){e.activeTexture.set(x.TEXTURE2),x.bindTexture(x.TEXTURE_2D,l.depthTexture),e.activeTexture.set(x.TEXTURE3),x.bindTexture(x.TEXTURE_2D,l.texture);for(let M in this.terrainUniforms)this.terrainUniforms[M].set(l[M]);boe(e.terrainUniformBuffer,l)}if(n&&_oe(e.projectionUniformBuffer,n),s)for(let M in this.fixedUniforms)this.fixedUniforms[M].set(s[M]);g&&g.setUniforms(e,this.binderUniforms,d,{zoom:p});let S=0;switch(r){case x.LINES:S=2;break;case x.TRIANGLES:S=3;break;case x.LINE_STRIP:S=1}for(let M of h.get())M.vaos||(M.vaos={}),(v=M.vaos)[u]||(v[u]=new iO),M.vaos[u].bind(e,this,c,g?g.getPaintVertexBuffers():[],f,M.vertexOffset,m,y,_),x.drawElements(r,M.primitiveLength*S,x.UNSIGNED_SHORT,M.primitiveOffset*S*2)}},fO=(e,r)=>({u_lightpos:new vc(e,r.u_lightpos),u_lightpos_globe:new vc(e,r.u_lightpos_globe),u_lightintensity:new Xa(e,r.u_lightintensity),u_lightcolor:new vc(e,r.u_lightcolor),u_vertical_gradient:new Xa(e,r.u_vertical_gradient),u_opacity:new Xa(e,r.u_opacity),u_fill_translate:new mo(e,r.u_fill_translate)}),hO=(e,r)=>({u_lightpos:new vc(e,r.u_lightpos),u_lightpos_globe:new vc(e,r.u_lightpos_globe),u_lightintensity:new Xa(e,r.u_lightintensity),u_lightcolor:new vc(e,r.u_lightcolor),u_vertical_gradient:new Xa(e,r.u_vertical_gradient),u_height_factor:new Xa(e,r.u_height_factor),u_opacity:new Xa(e,r.u_opacity),u_fill_translate:new mo(e,r.u_fill_translate),u_image:new En(e,r.u_image),u_texsize:new mo(e,r.u_texsize),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade)}),KM=(e,r,t,i)=>{let a=e.style.light,o=a.getCartesianPosition(),s=u9();a.properties.get("anchor")==="viewport"&&CK(s,e.transform.bearingInRadians),jK(o,o,s);let l=e.transform.transformLightDirection(o),n=a.properties.get("color");return{u_lightpos:o,u_lightpos_globe:l,u_lightintensity:a.properties.get("intensity"),u_lightcolor:[n.r,n.g,n.b],u_vertical_gradient:+r,u_opacity:t,u_fill_translate:i}},dO=(e,r,t,i,a,o,s)=>yn(KM(e,r,t,i),Mz(o,e,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),pO=(e,r)=>({u_fill_translate:new mo(e,r.u_fill_translate)}),vO=(e,r)=>({u_image:new En(e,r.u_image),u_texsize:new mo(e,r.u_texsize),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade),u_sdf_pattern:new En(e,r.u_sdf_pattern),u_fill_translate:new mo(e,r.u_fill_translate)}),mO=(e,r)=>({u_fill_translate:new mo(e,r.u_fill_translate)}),gO=(e,r)=>({u_image:new En(e,r.u_image),u_texsize:new mo(e,r.u_texsize),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade),u_sdf_pattern:new En(e,r.u_sdf_pattern),u_fill_translate:new mo(e,r.u_fill_translate)}),JM=(e,r,t,i,a)=>yn(Mz(r,e,t),{u_fill_translate:i,u_sdf_pattern:+!!a}),yO=e=>({u_fill_translate:e}),_O=e=>({u_fill_translate:e}),xO=(e,r,t,i,a)=>JM(e,r,t,i,a),bO=(e,r)=>({u_scale_with_map:new En(e,r.u_scale_with_map),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_extrude_scale:new mo(e,r.u_extrude_scale),u_globe_extrude_scale:new Xa(e,r.u_globe_extrude_scale),u_translate:new mo(e,r.u_translate)}),wO=(e,r,t,i,a)=>{let o=e.transform,s,l,n=0;if(t.paint.get("circle-pitch-alignment")==="map"){let u=Cf(r,1,o.zoom);s=!0,l=[u,u],n=u/(Bi*2**r.tileID.overscaledZ)*2*Math.PI*a}else s=!1,l=o.pixelsToGLUnits;return{u_scale_with_map:+(t.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+s,u_extrude_scale:l,u_globe_extrude_scale:n,u_translate:i}},TO=(e,r)=>({u_color:new lp(e,r.u_color),u_overlay:new En(e,r.u_overlay),u_overlay_scale:new Xa(e,r.u_overlay_scale)}),QM=(e,r=1)=>({u_color:e,u_overlay:0,u_overlay_scale:r}),AO=(e,r)=>({u_extrude_scale:new Xa(e,r.u_extrude_scale),u_intensity:new Xa(e,r.u_intensity),u_globe_extrude_scale:new Xa(e,r.u_globe_extrude_scale)}),MO=(e,r)=>({u_matrix:new vh(e,r.u_matrix),u_image:new En(e,r.u_image),u_color_ramp:new En(e,r.u_color_ramp),u_opacity:new Xa(e,r.u_opacity)}),eS=(e,r,t,i)=>{let a=Cf(e,1,r)/(Bi*2**e.tileID.overscaledZ)*2*Math.PI*i;return{u_extrude_scale:Cf(e,1,r),u_intensity:t,u_globe_extrude_scale:a}},tS=(e,r,t,i)=>{let a=Rp();return $h(a,0,e.width,e.height,0,0,1),{u_matrix:a,u_image:t,u_color_ramp:i,u_opacity:r.paint.get("heatmap-opacity")}},SO=(e,r)=>({u_image:new En(e,r.u_image),u_latrange:new mo(e,r.u_latrange),u_exaggeration:new Xa(e,r.u_exaggeration),u_altitudes:new eA(e,r.u_altitudes),u_azimuths:new eA(e,r.u_azimuths),u_accent:new lp(e,r.u_accent),u_method:new En(e,r.u_method),u_shadows:new QT(e,r.u_shadows),u_highlights:new QT(e,r.u_highlights)}),EO=(e,r)=>({u_matrix:new vh(e,r.u_matrix),u_image:new En(e,r.u_image),u_dimension:new mo(e,r.u_dimension),u_zoom:new Xa(e,r.u_zoom),u_unpack:new Sm(e,r.u_unpack)}),kO=(e,r,t)=>{let i=t.paint.get("hillshade-accent-color"),a;switch(t.paint.get("hillshade-method")){case"basic":a=4;break;case"combined":a=1;break;case"igor":a=2;break;case"multidirectional":a=3;break;default:a=0}let o=t.getIlluminationProperties();for(let s=0;s{let t=r.stride,i=Rp();return $h(i,0,Bi,-Bi,0,0,1),Ol(i,i,[0,-Bi,0]),{u_matrix:i,u_image:1,u_dimension:[t,t],u_zoom:e.overscaledZ,u_unpack:r.getUnpackVector()}},DO=(e,r)=>({u_image:new En(e,r.u_image),u_unpack:new Sm(e,r.u_unpack),u_dimension:new mo(e,r.u_dimension),u_elevation_stops:new En(e,r.u_elevation_stops),u_color_stops:new En(e,r.u_color_stops),u_color_ramp_size:new En(e,r.u_color_ramp_size),u_opacity:new Xa(e,r.u_opacity)}),LO=(e,r,t=0)=>({u_image:0,u_unpack:r.getUnpackVector(),u_dimension:[r.stride,r.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:t,u_opacity:e.paint.get("color-relief-opacity")}),FO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio)}),PO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_image_height:new Xa(e,r.u_image_height)}),IO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_texsize:new mo(e,r.u_texsize),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_scale:new vc(e,r.u_scale),u_fade:new Xa(e,r.u_fade)}),RO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_mix:new Xa(e,r.u_mix),u_tileratio:new Xa(e,r.u_tileratio),u_crossfade_from:new Xa(e,r.u_crossfade_from),u_crossfade_to:new Xa(e,r.u_crossfade_to),u_lineatlas_width:new Xa(e,r.u_lineatlas_width),u_lineatlas_height:new Xa(e,r.u_lineatlas_height)}),zO=(e,r)=>({u_translation:new mo(e,r.u_translation),u_ratio:new Xa(e,r.u_ratio),u_image:new En(e,r.u_image),u_image_height:new Xa(e,r.u_image_height),u_tileratio:new Xa(e,r.u_tileratio),u_crossfade_from:new Xa(e,r.u_crossfade_from),u_crossfade_to:new Xa(e,r.u_crossfade_to),u_image_dash:new En(e,r.u_image_dash),u_mix:new Xa(e,r.u_mix),u_lineatlas_width:new Xa(e,r.u_lineatlas_width),u_lineatlas_height:new Xa(e,r.u_lineatlas_height)}),ty=(e,r,t,i)=>{let a=e.transform;return{u_translation:Sz(e,r,t),u_ratio:i/Cf(r,1,a.zoom)}},BO=(e,r,t,i,a)=>yn(ty(e,r,t,i),{u_image:0,u_image_height:a}),OO=(e,r,t,i,a)=>{let o=e.transform,s=oM(r,o);return{u_translation:Sz(e,r,t),u_texsize:r.imageAtlasTexture.size,u_ratio:i/Cf(r,1,o.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},NO=(e,r,t,i,a)=>{let o=e.transform,s=oM(r,o);return yn(ty(e,r,t,i),{u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},jO=(e,r,t,i,a,o)=>{let s=e.transform,l=oM(r,s);return yn(ty(e,r,t,i),{u_image:0,u_image_height:o,u_tileratio:l,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:e.lineAtlas.width,u_lineatlas_height:e.lineAtlas.height})},UO=(e,r)=>({u_image:new En(e,r.u_image),u_opacity:new Xa(e,r.u_opacity)}),qO=(e,r)=>({u_image:r,u_opacity:e}),VO=(e,r)=>({u_is_size_zoom_constant:new En(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new En(e,r.u_is_size_feature_constant),u_size_t:new Xa(e,r.u_size_t),u_size:new Xa(e,r.u_size),u_rotate_symbol:new En(e,r.u_rotate_symbol),u_label_plane_matrix:new vh(e,r.u_label_plane_matrix),u_coord_matrix:new vh(e,r.u_coord_matrix),u_is_text:new En(e,r.u_is_text),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_is_along_line:new En(e,r.u_is_along_line),u_is_variable_anchor:new En(e,r.u_is_variable_anchor),u_texsize:new mo(e,r.u_texsize),u_texture:new En(e,r.u_texture),u_translation:new mo(e,r.u_translation),u_pitched_scale:new Xa(e,r.u_pitched_scale),u_is_offset:new En(e,r.u_is_offset),u_height_anchor_ground:new En(e,r.u_height_anchor_ground)}),GO=(e,r)=>({u_is_size_zoom_constant:new En(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new En(e,r.u_is_size_feature_constant),u_size_t:new Xa(e,r.u_size_t),u_size:new Xa(e,r.u_size),u_rotate_symbol:new En(e,r.u_rotate_symbol),u_label_plane_matrix:new vh(e,r.u_label_plane_matrix),u_coord_matrix:new vh(e,r.u_coord_matrix),u_is_text:new En(e,r.u_is_text),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_is_along_line:new En(e,r.u_is_along_line),u_is_variable_anchor:new En(e,r.u_is_variable_anchor),u_texsize:new mo(e,r.u_texsize),u_texture:new En(e,r.u_texture),u_gamma_scale:new Xa(e,r.u_gamma_scale),u_is_halo:new En(e,r.u_is_halo),u_is_plain:new En(e,r.u_is_plain),u_translation:new mo(e,r.u_translation),u_pitched_scale:new Xa(e,r.u_pitched_scale),u_is_offset:new En(e,r.u_is_offset),u_height_anchor_ground:new En(e,r.u_height_anchor_ground)}),HO=(e,r)=>({u_is_size_zoom_constant:new En(e,r.u_is_size_zoom_constant),u_is_size_feature_constant:new En(e,r.u_is_size_feature_constant),u_size_t:new Xa(e,r.u_size_t),u_size:new Xa(e,r.u_size),u_rotate_symbol:new En(e,r.u_rotate_symbol),u_label_plane_matrix:new vh(e,r.u_label_plane_matrix),u_coord_matrix:new vh(e,r.u_coord_matrix),u_is_text:new En(e,r.u_is_text),u_pitch_with_map:new En(e,r.u_pitch_with_map),u_is_along_line:new En(e,r.u_is_along_line),u_is_variable_anchor:new En(e,r.u_is_variable_anchor),u_texsize:new mo(e,r.u_texsize),u_texsize_icon:new mo(e,r.u_texsize_icon),u_texture:new En(e,r.u_texture),u_texture_icon:new En(e,r.u_texture_icon),u_gamma_scale:new Xa(e,r.u_gamma_scale),u_is_halo:new En(e,r.u_is_halo),u_translation:new mo(e,r.u_translation),u_pitched_scale:new Xa(e,r.u_pitched_scale),u_is_offset:new En(e,r.u_is_offset),u_height_anchor_ground:new En(e,r.u_height_anchor_ground)}),rS=(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p)=>({u_is_size_zoom_constant:+(e==="constant"||e==="source"),u_is_size_feature_constant:+(e==="constant"||e==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_rotate_symbol:+t,u_label_plane_matrix:l,u_coord_matrix:n,u_is_text:+c,u_pitch_with_map:+i,u_is_along_line:a,u_is_variable_anchor:o,u_texsize:f,u_texture:0,u_translation:u,u_pitched_scale:h,u_is_offset:d,u_height_anchor_ground:+p}),iS=(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p,g)=>{let m=s.transform;return yn(rS(e,r,t,i,a,o,s,l,n,u,c,f,d,p,g),{u_gamma_scale:i?Math.cos(m.pitch*Math.PI/180)*m.cameraToCenterDistance:1,u_is_halo:+!!h,u_is_plain:1})},$O=(e,r,t,i,a,o,s,l,n,u,c,f,h,d,p)=>yn(iS(e,r,t,i,a,o,s,l,n,u,!0,c,!0,h,d,p),{u_texsize_icon:f,u_texture_icon:1}),WO=(e,r)=>({u_opacity:new Xa(e,r.u_opacity),u_color:new lp(e,r.u_color)}),YO=(e,r)=>({u_opacity:new Xa(e,r.u_opacity),u_image:new En(e,r.u_image),u_pattern_tl_a:new mo(e,r.u_pattern_tl_a),u_pattern_br_a:new mo(e,r.u_pattern_br_a),u_pattern_tl_b:new mo(e,r.u_pattern_tl_b),u_pattern_br_b:new mo(e,r.u_pattern_br_b),u_texsize:new mo(e,r.u_texsize),u_mix:new Xa(e,r.u_mix),u_pattern_size_a:new mo(e,r.u_pattern_size_a),u_pattern_size_b:new mo(e,r.u_pattern_size_b),u_scale_a:new Xa(e,r.u_scale_a),u_scale_b:new Xa(e,r.u_scale_b),u_pixel_coord_upper:new mo(e,r.u_pixel_coord_upper),u_pixel_coord_lower:new mo(e,r.u_pixel_coord_lower),u_tile_units_to_pixels:new Xa(e,r.u_tile_units_to_pixels)}),XO=(e,r)=>({u_opacity:e,u_color:r}),ZO=(e,r,t,i,a)=>yn(Toe(t,a,r,i),{u_opacity:e}),KO=(e,r)=>({u_sun_pos:new vc(e,r.u_sun_pos),u_atmosphere_blend:new Xa(e,r.u_atmosphere_blend),u_globe_position:new vc(e,r.u_globe_position),u_globe_radius:new Xa(e,r.u_globe_radius),u_inv_proj_matrix:new vh(e,r.u_inv_proj_matrix)}),JO=(e,r,t,i,a)=>({u_sun_pos:e,u_atmosphere_blend:r,u_globe_position:t,u_globe_radius:i,u_inv_proj_matrix:a}),QO=(e,r)=>({u_sky_color:new lp(e,r.u_sky_color),u_horizon_color:new lp(e,r.u_horizon_color),u_horizon:new mo(e,r.u_horizon),u_horizon_normal:new mo(e,r.u_horizon_normal),u_sky_horizon_blend:new Xa(e,r.u_sky_horizon_blend),u_sky_blend:new Xa(e,r.u_sky_blend),u_inv_proj_matrix:new vh(e,r.u_inv_proj_matrix),u_globe_position:new vc(e,r.u_globe_position),u_globe_radius:new Xa(e,r.u_globe_radius)}),eN=(e,r,t)=>{let i=Math.cos(r.rollInRadians),a=Math.sin(r.rollInRadians),o=lg(r),s=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:e.properties.get("sky-color"),u_horizon_color:e.properties.get("horizon-color"),u_horizon:[(r.width/2-o*a)*t,(r.height/2+o*i)*t],u_horizon_normal:[-a,i],u_sky_horizon_blend:e.properties.get("sky-horizon-blend")*r.height/2*t,u_sky_blend:s,u_inv_proj_matrix:r.inverseProjectionMatrix,u_globe_position:_z(r),u_globe_radius:Nm(r.worldSize,r.center.lat)}},ry=(e,r)=>({}),tN={fillExtrusion:fO,fillExtrusionPattern:hO,fill:pO,fillPattern:vO,fillOutline:mO,fillOutlinePattern:gO,circle:bO,collisionBox:ry,collisionCircle:ry,debug:TO,depth:ry,clippingMask:ry,heatmap:AO,heatmapTexture:MO,hillshade:SO,hillshadePrepare:EO,colorRelief:DO,line:FO,lineGradient:PO,linePattern:IO,lineSDF:RO,lineGradientSDF:zO,layerOpacity:UO,raster:pB,symbolIcon:VO,symbolSDF:GO,symbolTextAndIcon:HO,background:WO,backgroundPattern:YO,terrain:nO,terrainDepth:oO,atmosphere:KO,sky:QO},rN=class{constructor(e,r,t){this.context=e;let i=e.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!t,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){let r=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},aS={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},iN=class{constructor(e,r,t,i){this.length=r.length,this.attributes=t,this.itemSize=r.bytesPerElement,this.dynamicDraw=i,this.context=e;let a=e.gl;this.buffer=a.createBuffer(),e.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,r){for(let t of this.attributes){let i=r.attributes[t.name];i!==void 0&&e.enableVertexAttribArray(i.location)}}setVertexAttribPointers(e,r,t){for(let i of this.attributes){let a=r.attributes[i.name];if(a!==void 0){let o=i.offset+this.itemSize*(t||0);a.isInteger?e.vertexAttribIPointer(a.location,i.components,e[aS[i.type]],this.itemSize,o):e.vertexAttribPointer(a.location,i.components,e[aS[i.type]],!1,this.itemSize,o)}}}destroy(){let e=this.context.gl;this.buffer&&(e.deleteBuffer(this.buffer),delete this.buffer)}},os=class{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}},aN=class extends os{getDefault(){return ro.transparent}set(e){let r=this.current;(e.r!==r.r||e.g!==r.g||e.b!==r.b||e.a!==r.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},nN=class extends os{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}},oN=class extends os{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}},sN=class extends os{getDefault(){return[!0,!0,!0,!0]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},lN=class extends os{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}},uN=class extends os{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}},cN=class extends os{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){let r=this.current;(e.func!==r.func||e.ref!==r.ref||e.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}},fN=class extends os{getDefault(){let e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}},hN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=e,this.dirty=!1}},dN=class extends os{getDefault(){return[0,1]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}},pN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=e,this.dirty=!1}},vN=class extends os{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}},mN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.BLEND):r.disable(r.BLEND),this.current=e,this.dirty=!1}},gN=class extends os{getDefault(){let e=this.gl;return[e.ONE,e.ZERO]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}},yN=class extends os{getDefault(){return ro.transparent}set(e){let r=this.current;(e.r!==r.r||e.g!==r.g||e.b!==r.b||e.a!==r.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}},_N=class extends os{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}},xN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;e?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=e,this.dirty=!1}},bN=class extends os{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}},wN=class extends os{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}},TN=class extends os{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}},AN=class extends os{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}},MN=class extends os{getDefault(){let e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){let r=this.current;(e[0]!==r[0]||e[1]!==r[1]||e[2]!==r[2]||e[3]!==r[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}},SN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,e),this.current=e,this.dirty=!1}},EN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},kN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,e),this.current=e,this.dirty=!1}},CN=class extends os{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},DN=class extends os{getDefault(){return null}set(e){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}},LN=class extends os{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.bindVertexArray(e),this.current=e,this.dirty=!1)}},FN=class extends os{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}},PN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}},IN=class extends os{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}},P2=class extends os{constructor(e,r){super(e),this.context=e,this.parent=r}getDefault(){return null}},RN=class extends P2{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}},zN=class extends P2{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},BN=class extends P2{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,e),this.current=e,this.dirty=!1}},ON=class{constructor(e,r,t,i,a){this.context=e,this.width=r,this.height=t;let o=e.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new RN(e,s),i)this.depthAttachment=a?new BN(e,s):new zN(e,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let e=this.context.gl,r=this.colorAttachment.get();if(r&&e.deleteTexture(r),this.depthAttachment){let t=this.depthAttachment.get();t&&e.deleteRenderbuffer(t)}e.deleteFramebuffer(this.framebuffer)}},nS=aM([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}]),pf=nS.offsets,cl=class{constructor(e,r,t){this.blendFunction=e,this.blendColor=r,this.mask=t}},cl.Replace=[1,0],cl.disabled=new cl(cl.Replace,ro.transparent,[!1,!1,!1,!1]),cl.unblended=new cl(cl.Replace,ro.transparent,[!0,!0,!0,!0]),cl.alphaBlended=new cl([1,771],ro.transparent,[!0,!0,!0,!0]),NN=class{constructor(e){this.gl=e,this.clearColor=new aN(this),this.clearDepth=new nN(this),this.clearStencil=new oN(this),this.colorMask=new sN(this),this.depthMask=new lN(this),this.stencilMask=new uN(this),this.stencilFunc=new cN(this),this.stencilOp=new fN(this),this.stencilTest=new hN(this),this.depthRange=new dN(this),this.depthTest=new pN(this),this.depthFunc=new vN(this),this.blend=new mN(this),this.blendFunc=new gN(this),this.blendColor=new yN(this),this.blendEquation=new _N(this),this.cullFace=new xN(this),this.cullFaceSide=new bN(this),this.frontFace=new wN(this),this.program=new TN(this),this.activeTexture=new AN(this),this.viewport=new MN(this),this.bindFramebuffer=new SN(this),this.bindRenderbuffer=new EN(this),this.bindTexture=new kN(this),this.bindVertexBuffer=new CN(this),this.bindElementBuffer=new DN(this),this.bindVertexArray=new LN(this),this.pixelStoreUnpack=new FN(this),this.pixelStoreUnpackPremultiplyAlpha=new PN(this),this.pixelStoreUnpackFlipY=new IN(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),e.getExtension("EXT_color_buffer_half_float"),e.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=yoe(this),this.terrainUniformBuffer=xoe(this),this.frameUniformBuffer=Moe(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(e,r){return new rN(this,e,r)}createVertexBuffer(e,r,t){return new iN(this,e,r,t)}createRenderbuffer(e,r,t){let i=this.gl,a=i.createRenderbuffer();return this.bindRenderbuffer.set(a),i.renderbufferStorage(i.RENDERBUFFER,e,r,t),this.bindRenderbuffer.set(null),a}createFramebuffer(e,r,t,i){return new ON(this,e,r,t,i)}clear({color:e,depth:r,stencil:t}){let i=this.gl,a=0;e&&(a|=i.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),r!==void 0&&(a|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),t!==void 0&&(a|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(t),this.stencilMask.set(255)),i.clear(a)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func===this.gl.ALWAYS&&!e.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range))}setStencilMode(e){e.test.func===this.gl.ALWAYS&&!e.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask}))}setColorMode(e){Td(e.blendFunction,cl.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(e){this.gl.deleteVertexArray(e)}unbindVAO(){this.bindVertexArray.set(null)}},Lo=class{constructor(e,r,t){this.func=e,this.mask=r,this.range=t}},Lo.ReadOnly=!1,Lo.ReadWrite=!0,Lo.disabled=new Lo(519,Lo.ReadOnly,[0,1]),I2=7680,es=class{constructor(e,r,t,i,a,o){this.test=e,this.ref=r,this.mask=t,this.fail=i,this.depthFail=a,this.pass=o}},es.disabled=new es({func:519,mask:0},0,0,I2,I2,I2),oS=1029,R2=2305,Ko=class{constructor(e,r,t){this.enable=e,this.mode=r,this.frontFace=t}},Ko.disabled=new Ko(!1,oS,R2),Ko.backCCW=new Ko(!0,oS,R2),Ko.frontCCW=new Ko(!0,1028,R2),jN=Hh(new Float32Array(16)),B2=0,O2=[new Wr(0,0),new Wr(Bi,0),new Wr(Bi,Bi),new Wr(0,Bi)],UN=new ro(1,0,0,1),qN=new ro(0,1,0,1),VN=new ro(0,0,1,1),GN=new ro(1,0,1,1),HN=new ro(0,1,1,1),$N={symbol:koe,circle:Ioe,heatmap:Roe,line:$oe,fill:Woe,fillExtrusion:Yoe,hillshade:Xoe,colorRelief:Koe,raster:Joe,background:rse,sky:hse,atmosphere:pse,custom:use,debug:nse,debugPadding:ise,terrainDepth:cse},WN=(N2=class{constructor(e,r){this.drawFunctions=$N,this.context=new NN(e),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:Hh(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=A2.maxOverzooming+A2.maxUnderzooming+1,this.depthEpsilon=1/2**16,this.crossTileSymbolIndex=new zM}resize(e,r,t){if(this.width=Math.floor(e*t),this.height=Math.floor(r*t),this.pixelRatio=t,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let i of this.style._order)this.style._layers[i].resize()}setup(){let e=this.context,r=new sp;r.emplaceBack(0,0),r.emplaceBack(Bi,0),r.emplaceBack(0,Bi),r.emplaceBack(Bi,Bi),this.tileExtentBuffer=e.createVertexBuffer(r,i0.members),this.tileExtentSegments=Ks.simpleSegment(0,0,4,2);let t=new sp;t.emplaceBack(0,0),t.emplaceBack(Bi,0),t.emplaceBack(0,Bi),t.emplaceBack(Bi,Bi),this.debugBuffer=e.createVertexBuffer(t,i0.members),this.debugSegments=Ks.simpleSegment(0,0,4,5);let i=new fI;i.emplaceBack(0,0,0,0),i.emplaceBack(Bi,0,Bi,0),i.emplaceBack(0,Bi,0,Bi),i.emplaceBack(Bi,Bi,Bi,Bi),this.rasterBoundsBuffer=e.createVertexBuffer(i,rO.members),this.rasterBoundsSegments=Ks.simpleSegment(0,0,4,2);let a=new sp;a.emplaceBack(0,0),a.emplaceBack(Bi,0),a.emplaceBack(0,Bi),a.emplaceBack(Bi,Bi),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(a,i0.members),this.rasterBoundsSegmentsPosOnly=Ks.simpleSegment(0,0,4,5);let o=new sp;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(o,i0.members),this.viewportSegments=Ks.simpleSegment(0,0,4,2);let s=new TI;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(s);let l=new ed;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(l);let n=this.context.gl;this.stencilClearMode=new es({func:n.ALWAYS,mask:0},0,255,n.ZERO,n.ZERO,n.ZERO),this.tileExtentMesh=new Um(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let e=this.context,r=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let t=Rp();$h(t,0,this.width,this.height,0,0,1),Xu(t,t,[r.drawingBufferWidth,r.drawingBufferHeight,0]);let i={mainMatrix:t,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:t,clipAntimeridian:!1};this.useProgram("clippingMask",null,!0).draw(e,r.TRIANGLES,Lo.disabled,this.stencilClearMode,cl.disabled,Ko.disabled,null,null,i,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(e,r,t){if(this.currentStencilSource===e.source||!e.isTileClipped()||!r?.length)return;this.currentStencilSource=e.source,this.nextStencilID+r.length>256&&this.clearStencil();let i=this.context;i.setColorMode(cl.disabled),i.setDepthMode(Lo.disabled);let a={};for(let o of r)a[o.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,r,t,!0),this._renderTileMasks(a,r,t,!1),this._tileClippingMaskIDs=a}_renderTileMasks(e,r,t,i){let a=this.context,o=a.gl,s=this.style.projection,l=this.transform,n=this.useProgram("clippingMask");for(let u of r){let c=e[u.key],f=this.getTerrainDataForTile(u,t),h=s.getMeshFromTileID(this.context,u.canonical,i,!0,"stencil"),d=l.getProjectionData({overscaledTileID:u,applyGlobeMatrix:!t,applyTerrainMatrix:!0});n.draw(a,o.TRIANGLES,Lo.disabled,new es({func:o.ALWAYS,mask:0},c,255,o.KEEP,o.KEEP,o.REPLACE),cl.disabled,t?Ko.disabled:Ko.backCCW,null,f,d,"$clipping",h.vertexBuffer,h.indexBuffer,h.segments)}}getTerrainDataForTile(e,r){var t,i;return r&&((t=this.style.projection)==null?void 0:t.name)==="mercator"?null:((i=this.style.map.terrain)==null?void 0:i.getTerrainData(e))||null}_renderTilesDepthBuffer(){var e;let r=this.context,t=r.gl,i=this.style.projection,a=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D(),l=Bm(a,{tileSize:a.tileSize});for(let n of l){let u=(e=this.style.map.terrain)==null?void 0:e.getTerrainData(n),c=i.getMeshFromTileID(this.context,n.canonical,!0,!0,"raster"),f=a.getProjectionData({overscaledTileID:n,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(r,t.TRIANGLES,s,es.disabled,cl.disabled,Ko.backCCW,null,u,f,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let e=this.nextStencilID++,r=this.context.gl;return new es({func:r.NOTEQUAL,mask:255},e,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(e){let r=this.context.gl;return new es({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){let r=this.context.gl,t=e.sort((o,s)=>s.overscaledZ-o.overscaledZ),i=t[t.length-1].overscaledZ,a=t[0].overscaledZ-i+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let o={};for(let s=0;ss.overscaledZ-o.overscaledZ),i=t[t.length-1].overscaledZ,a=t[0].overscaledZ-i+1;if(this.clearStencil(),a>1){let o={},s={};for(let l=0;l=0;a.currentLayer--){let f=this.style._layers[o[a.currentLayer]];if(f.isHidden(this.transform.zoom))continue;let h=s[f.source],d=l[f.source];this.renderTileClippingMasks(f,d,!1),this.renderLayer(this,h,f,d,a)}a.currentPass="translucent";let c=!1;for(a.currentLayer=0;a.currentLayer0?r.pop():null}acquireRTT(e){let r=this.context.gl,t=this._rttObjectRecyclePool.pop();if(t)return t.size!==e&&(t.texture.update({width:e,height:e,data:null},{premultiply:!1,useMipmap:!0}),t.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),t.size=e),t;let i=new jl(this.context,{width:e,height:e,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return i.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:i,size:e}}bindRTT(e){let r=this.context.gl,t=e.size;if(!this._rttSharedFbo){let i=this.context.createFramebuffer(t,t,!0,!0),a=this.context.createRenderbuffer(r.DEPTH_STENCIL,t,t);i.depthAttachment.set(a),this._rttSharedFbo={fbo:i,depthRenderbuffer:a,size:t}}this._rttSharedFbo.size!==t&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,t),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=t,this._rttSharedFbo.fbo.height=t,this._rttSharedFbo.size=t),this._rttSharedFbo.fbo.colorAttachment.set(e.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(e){this._rttObjectRecyclePool.push(e)}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;let r=this.patternAtlas.getPattern(e.from.toString()),t=this.patternAtlas.getPattern(e.to.toString());return!r||!t}useProgram(e,r,t=!1,i=[]){var a;this.cache||(this.cache={});let o=!!this.style.map.terrain,s=this.style.projection,l=t?rd.projectionMercator:s.shaderPreludeCode,n=t?OM:s.shaderDefine,u=`/${t?NM:s.shaderVariantName}`,c=r?r.cacheKey:"",f=this._showOverdrawInspector?"/overdraw":"",h=o?"/terrain":"",d=i?`/${i.join("/")}`:"",p=e+c+u+f+h+d;return(a=this.cache)[p]||(a[p]=new cO(this.context,rd[e],r,tN[e],this._showOverdrawInspector,o,l,n,i)),this.cache[p]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let e=this.context.gl;this.debugOverlayTexture=new jl(this.context,this.debugOverlayCanvas,e.RGBA)}}destroy(){var e,r,t;if(this._tileTextures){for(let i in this._tileTextures){let a=this._tileTextures[i];if(a)for(let o of a)o.destroy()}this._tileTextures={}}for(let i of this._rttObjectRecyclePool)i.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let i=this.context.gl;i.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),i.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if((e=this.layerOpacityFbo)==null||e.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&((r=this.tileExtentMesh.vertexBuffer)==null||r.destroy()),this.tileExtentMesh&&((t=this.tileExtentMesh.indexBuffer)==null||t.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let i in this.cache){let a=this.cache[i];a?.program&&this.context.gl.deleteProgram(a.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:e,drawingBufferHeight:r}=this.context.gl;return this.width!==e||this.height!==r}},N2.MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,N2),sS=class extends Error{constructor(e,r){var t;super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=e,this.statusMessage=(t=r?.statusMessage)!=null?t:null}},lS=class{constructor(e){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{var r;let t=this._getHashParams();return this._hashName?(t.get(this._hashName)||"").split("/"):((r=[...t.keys()][0])!=null?r:"").split("/")},this._onHashChange=()=>{let r=this._getCurrentHash();if(!this._isValidHash(r))return!1;let t=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(r[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+r[2],+r[1]],zoom:+r[0],bearing:t,pitch:+(r[4]||0)}),!0},this._updateHashUnthrottled=()=>{let r=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,r)},this._removeHash=()=>{let r=this._getHashParams();if(this._hashName)r.delete(this._hashName);else{let o=Array.from(r.keys());o.length>0&&r.delete(o[0])}let t=decodeURIComponent(r.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=t?`#${t}`:"",a=window.location.href.replace(/(#.+)?$/,i);a=a.replace("&&","&"),window.history.replaceState(window.history.state,null,a)},this._updateHash=qz(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){let r=this._map.getCenter(),t=Math.round(this._map.getZoom()*100)/100,i=10**Math.ceil((t*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(r.lng*i)/i,o=Math.round(r.lat*i)/i,s=this._map.getBearing(),l=this._map.getPitch(),n="";if(n+=e?`/${a}/${o}/${t}`:`${t}/${o}/${a}`,(s||l)&&(n+=`/${Math.round(s*10)/10}`),l&&(n+=`/${Math.round(l)}`),this._hashName){let u=this._getHashParams();return u.set(this._hashName,n),`#${decodeURIComponent(u.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${n}`}_isValidHash(e){if(e.length<3||e.some(a=>isNaN(+a)))return!1;try{new An(+e[2],+e[1])}catch{return!1}let r=+e[0],t=+(e[3]||0),i=+(e[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&t>=-180&&t<=180&&i>=this._map.getMinPitch()&&i<=this._map.getMaxPitch()}},$m={linearity:.3,easing:H4(0,0,.3,1)},YN=yn({deceleration:2500,maxSpeed:1400},$m),XN=yn({deceleration:20,maxSpeed:1400},$m),ZN=yn({deceleration:1e3,maxSpeed:360},$m),KN=yn({deceleration:1e3,maxSpeed:90},$m),JN=yn({deceleration:1e3,maxSpeed:360},$m),QN=class{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:hs(),settings:e})}_drainInertiaBuffer(){let e=this._inertiaBuffer,r=hs();for(;e.length>0&&r-e[0].time>160;)e.shift()}_getVelocityEntries(){let e=this._inertiaBuffer,r=hs()-60,t=Math.max(0,e.length-2);for(;t>0&&e[t-1].time>=r;)t--;return e.slice(t)}_onMoveEnd(e){this._drainInertiaBuffer();let r=this._getVelocityEntries();if(r.length<2){this.clear();return}let t={zoom:0,bearing:0,pitch:0,roll:0,pan:new Wr(0,0),pinchAround:void 0,around:void 0};for(let{settings:o}of r)o.around&&(t.around=o.around),o.pinchAround&&(t.pinchAround=o.pinchAround);for(let{settings:o}of r.slice(1))t.zoom+=o.zoomDelta||0,t.bearing+=o.bearingDelta||0,t.pitch+=o.pitchDelta||0,t.roll+=o.rollDelta||0,o.panDelta&&t.pan._add(o.panDelta);if(!t.pan.mag()&&!t.zoom&&!t.bearing&&!t.pitch&&!t.roll){this.clear();return}let i=hs()-r[0].time,a={};if(t.pan.mag()){let o=Gg(t.pan.mag(),i,yn({},YN,e||{})),s=t.pan.mult(o.amount/t.pan.mag()),l=this._map._camera.cameraHelper.handlePanInertia(s,this._map._camera.transform);a.center=l.easingCenter,a.offset=l.easingOffset,Vg(a,o)}if(t.zoom){let o=Gg(t.zoom,i,XN);a.zoom=Lf(this._map.getZoom()+o.amount,this._map.getZoomSnap(),o.amount),Vg(a,o)}if(t.bearing){let o=Gg(t.bearing,i,ZN);a.bearing=this._map.getBearing()+to(o.amount,-179,179),Vg(a,o)}if(t.pitch){let o=Gg(t.pitch,i,KN);a.pitch=this._map.getPitch()+o.amount,Vg(a,o)}if(t.roll){let o=Gg(t.roll,i,JN);a.roll=this._map.getRoll()+to(o.amount,-179,179),Vg(a,o)}if(a.zoom||a.bearing){let o=t.pinchAround===void 0?t.around:t.pinchAround;a.around=o?this._map.unproject(o):this._map.getCenter()}return this.clear(),yn(a,{noMoveStart:!0})}},e8=class{constructor(e,r){this._map=e,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new gM(this._map,e))}mousedown(e,r){return this._mousedownPos=r,this._firePreventable(new df(e.type,this._map,e))}mouseup(e){this._map.fire(new df(e.type,this._map,e))}click(e,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new df(e.type,this._map,e))}dblclick(e){return this._firePreventable(new df(e.type,this._map,e))}mouseover(e){this._map.fire(new df(e.type,this._map,e))}mouseout(e){this._map.fire(new df(e.type,this._map,e))}touchstart(e){return this._firePreventable(new jm(e.type,this._map,e))}touchmove(e){this._map.fire(new jm(e.type,this._map,e))}touchend(e){this._map.fire(new jm(e.type,this._map,e))}touchcancel(e){this._map.fire(new jm(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},t8=class{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new df(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new df("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new df(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},uS=class{constructor(e,r,t){this._map=e,this._tr=t,this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=r.clickTolerance||1,r.boxZoom&&typeof r.boxZoom=="object"&&(this._boxZoomEnd=r.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,r){this.isEnabled()&&e.shiftKey&&e.button===0&&($n.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(e,r){if(!this._active)return;let t=r;if(this._lastPos.equals(t)||!this._box&&t.dist(this._startPos)a.fitScreenCoordinates(t,i,this._tr.bearing,{linear:!0})}}}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),$n.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,r){return this._map.fire(new d2(e,{originalEvent:r}))}},r8=class{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,r,t){(this.centroid||t.length>this.numTouches)&&(this.aborted=!0),!this.aborted&&(this.startTime===void 0&&(this.startTime=e.timeStamp),t.length===this.numTouches&&(this.centroid=mse(r),this.touches=fM(t,r)))}touchmove(e,r,t){if(this.aborted||!this.centroid)return;let i=fM(t,r);for(let a in this.touches){let o=this.touches[a],s=i[a];(!s||s.dist(o)>30)&&(this.aborted=!0)}}touchend(e,r,t){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),t.length===0){let i=!this.aborted&&this.centroid;if(this.reset(),i)return i}}},j2=class{constructor(e){this.singleTap=new r8(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,r,t){this.singleTap.touchstart(e,r,t)}touchmove(e,r,t){this.singleTap.touchmove(e,r,t)}touchend(e,r,t){let i=this.singleTap.touchend(e,r,t);if(i){let a=e.timeStamp-this.lastTime<500,o=!this.lastTap||this.lastTap.dist(i)<30;if((!a||!o)&&this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=i,this.count===this.numTaps)return this.reset(),i}}},i8=class{constructor(e,r){this._tr=r,this._zoomIn=new j2({numTouches:1,numTaps:2}),this._zoomOut=new j2({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,r,t){this._zoomIn.touchstart(e,r,t),this._zoomOut.touchstart(e,r,t)}touchmove(e,r,t){this._zoomIn.touchmove(e,r,t),this._zoomOut.touchmove(e,r,t)}touchend(e,r,t){let i=this._zoomIn.touchend(e,r,t),a=this._zoomOut.touchend(e,r,t),o=this._tr;if(i)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:Lf(o.zoom+1,s.getZoomSnap()),around:o.unproject(i)},{originalEvent:e})};if(a)return this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:s=>s.easeTo({duration:300,zoom:Lf(o.zoom-1,s.getZoomSnap()),around:o.unproject(a)},{originalEvent:e})}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},Wm=class{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){let r=this._moveFunction(...e);if(r.bearingDelta||r.pitchDelta||r.rollDelta||r.around||r.panDelta)return this._active=!0,r}dragStart(e,r){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(r)?r[0]:r,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,r){if(!this.isEnabled())return;let t=this._lastPoint;if(!t)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e)){this.reset(e);return}let i=Array.isArray(r)?r[0]:r;if(!(!this._moved&&i.dist(t)!0}),r=new n8){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=r}_executeRelevantHandler(e,r,t){if(e instanceof MouseEvent)return r(e);if(typeof TouchEvent<"u"&&e instanceof TouchEvent)return t(e)}startMove(e){this._executeRelevantHandler(e,r=>{this.mouseMoveStateManager.startMove(r)},r=>{this.oneFingerTouchMoveStateManager.startMove(r)})}endMove(e){this._executeRelevantHandler(e,r=>{this.mouseMoveStateManager.endMove(r)},r=>{this.oneFingerTouchMoveStateManager.endMove(r)})}isValidStartEvent(e){return!!this._executeRelevantHandler(e,r=>this.mouseMoveStateManager.isValidStartEvent(r),r=>this.oneFingerTouchMoveStateManager.isValidStartEvent(r))}isValidMoveEvent(e){return!!this._executeRelevantHandler(e,r=>this.mouseMoveStateManager.isValidMoveEvent(r),r=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(r))}isValidEndEvent(e){return!!this._executeRelevantHandler(e,r=>this.mouseMoveStateManager.isValidEndEvent(r),r=>this.oneFingerTouchMoveStateManager.isValidEndEvent(r))}},iy=e=>{e.mousedown=e.dragStart,e.mousemoveWindow=e.dragMove,e.mouseup=e.dragEnd,e.contextmenu=r=>{r.preventDefault()}},s8=class{constructor(e,r){this._clickTolerance=e.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new Wr(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,r,t){return this._calculateTransform(e,r,t)}touchmove(e,r,t){if(this._active){if(this._shouldBePrevented(t.length)){this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e);return}return e.preventDefault(),this._calculateTransform(e,r,t)}}touchend(e,r,t){this._calculateTransform(e,r,t),this._active&&this._shouldBePrevented(t.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,r,t){t.length>0&&(this._active=!0);let i=fM(t,r),a=new Wr(0,0),o=new Wr(0,0),s=0;for(let n in i){let u=i[n],c=this._touches[n];c&&(a._add(u),o._add(u.sub(c)),s++,i[n]=u)}if(this._touches=i,this._shouldBePrevented(s)||!o.mag())return;let l=o.div(s);if(this._sum._add(l),!(this._sum.mag()=2,a=r.mag()>=2;if(!i&&!a)return;if(!i||!a)return this._firstMove===void 0&&(this._firstMove=t),t-this._firstMove<100&&void 0;let o=e.y>0==r.y>0;return hM(e)&&hM(r)&&o}},l8={panStep:100,bearingStep:15,pitchStep:10},pS=class{constructor(e,r){this._tr=r;let t=l8;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let r=0,t=0,i=0,a=0,o=0;switch(e.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:e.shiftKey?t=-1:(e.preventDefault(),a=-1);break;case 39:e.shiftKey?t=1:(e.preventDefault(),a=1);break;case 38:e.shiftKey?i=1:(e.preventDefault(),o=-1);break;case 40:e.shiftKey?i=-1:(e.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(t=0,i=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:wse,zoom:r?Lf(l.zoom+r*(e.shiftKey?2:1),s.getZoomSnap()):l.zoom,bearing:l.bearing+t*this._bearingStep,pitch:l.pitch+i*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:l.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}},vS=4.000244140625,mS=class{constructor(e,r,t){this._onTimeout=i=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(i)},this._map=e,this._tr=t,this._triggerRenderFrame=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return this._map.cooperativeGestures.isEnabled()?!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e)):!1}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e)){this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);return}let r=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*40:e.deltaY,t=hs(),i=t-(this._lastWheelEventTime||0);this._lastWheelEventTime=t,r!==0&&r%vS==0?this._type="wheel":r!==0&&Math.abs(r)<4?this._type="trackpad":i>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(i*r)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),e.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=e,this._delta-=r,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=$n.mousePos(this._map.getCanvas(),e),t=this._tr;this._aroundPoint=this._aroundCenter?t.transform.locationToScreenPoint(An.convert(t.center)):r,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){let s=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=s),typeof this._targetZoom=="number"&&(this._targetZoom+=s)}if(this._delta!==0){let s=this._type==="wheel"&&Math.abs(this._delta)>vS?this._wheelZoomRate:this._defaultZoomRate,l=2/(1+Math.exp(-Math.abs(this._delta*s)));this._delta<0&&l!==0&&(l=1/l);let n=typeof this._targetZoom=="number"?Vc(this._targetZoom):e.scale,u=e.applyConstrain(e.getCameraLngLat(),Ku(n*l)).zoom,c=this._map.getZoomSnap();if(this._type==="wheel"&&c>0){let f=Lf(e.zoom,c);this._targetZoom=Lf(u,c,u-f)}else this._targetZoom=u;this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r=typeof this._targetZoom=="number"?this._targetZoom:e.zoom,t=this._startZoom,i=this._easing,a=!1,o;if(this._type==="wheel"&&t&&i){let s=hs()-this._lastWheelEventTime,l=Math.min((s+5)/200,1),n=i(l);o=Zs.number(t,r,n),l<1?this._needsRerender=!0:a=!0}else o=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let r=Sx;if(this._prevEase){let t=this._prevEase,i=(hs()-t.start)/t.duration,a=t.easing(i+.01)-t.easing(i),o=.27/Math.sqrt(a*a+1e-4)*.01,s=Math.sqrt(.0729-o*o);r=H4(o,s,.25,1)}return this._prevEase={start:hs(),duration:e,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},gS=class{constructor(e,r){this._clickZoom=e,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},u8=class{constructor(e,r){this._tr=r,this.reset()}reset(){this._active=!1}dblclick(e,r){return e.preventDefault(),{cameraAnimation:t=>{t.easeTo({duration:300,zoom:Lf(this._tr.zoom+(e.shiftKey?-1:1),t.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},c8=class{constructor(){this._tap=new j2({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(e){this._zoomRate=e??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,r,t){if(!this._swipePoint)if(!this._tapTime)this._tap.touchstart(e,r,t);else{let i=r[0],a=e.timeStamp-this._tapTime<500,o=this._tapPoint.dist(i)<30;!a||!o?this.reset():t.length>0&&(this._swipePoint=i,this._swipeTouch=t[0].identifier)}}touchmove(e,r,t){if(!this._tapTime)this._tap.touchmove(e,r,t);else if(this._swipePoint){if(t[0].identifier!==this._swipeTouch)return;let i=r[0],a=i.y-this._swipePoint.y;return this._swipePoint=i,e.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}touchend(e,r,t){if(this._tapTime)this._swipePoint&&t.length===0&&this.reset();else{let i=this._tap.touchend(e,r,t);i&&(this._tapTime=e.timeStamp,this._tapPoint=i)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},yS=class{constructor(e,r,t){this._el=e,this._mousePan=r,this._touchPan=t}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},_S=class{constructor(e,r,t,i){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=r,this._mousePitch=t,this._mouseRoll=i}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},xS=class{constructor(e,r,t,i){this._el=e,this._touchZoom=r,this._touchRotate=t,this._tapDragZoom=i,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(e){this._touchZoom.setZoomRate(e),this._tapDragZoom.setZoomRate(e)}setZoomThreshold(e){this._touchZoom.setZoomThreshold(e)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},bS=class{constructor(e,r){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=e,this._options=r,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=$n.create("div","maplibregl-cooperative-gesture-screen",e);let r=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(r=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let t=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),i=document.createElement("div");i.className="maplibregl-desktop-message",i.textContent=r,this._container.appendChild(i);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=t,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,r){this._enabled&&(this._map.fire(new iu("cooperativegestureprevented",{gestureType:e,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},f8=class{constructor(e){this._camera=e}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(Wr.convert(e),this._camera.terrain)}},ay=e=>e.zoom||e.drag||e.roll||e.pitch||e.rotate,h8=class extends hf{},d8=class{get _ownerDocument(){var e;return((e=this._el)==null?void 0:e.ownerDocument)||document}get _ownerWindow(){var e,r;return((r=(e=this._el)==null?void 0:e.ownerDocument)==null?void 0:r.defaultView)||window}constructor(e,r,t){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=a=>{this.handleEvent(a,`${a.type}Window`)},this.handleEvent=(a,o)=>{if(a.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let s=a.type==="renderFrame"?void 0:a,l={needsRenderFrame:!1},n={},u={};for(let{handlerName:h,handler:d,allowed:p}of this._handlers){if(!d.isEnabled())continue;let g;if(this._blockedByActive(u,p,h))d.reset();else if(d[o||a.type]){if(hJ(a,o||a.type)){let m=$n.mousePos(this._map.getCanvas(),a);g=d[o||a.type](a,m)}else if(fJ(a,o||a.type)){let m=a.touches,y=this._getMapTouches(m),_=$n.touchPos(this._map.getCanvas(),y);g=d[o||a.type](a,_,y)}else dJ(o||a.type)||(g=d[o||a.type](a));this.mergeHandlerResult(l,n,g,h,s),g?.needsRenderFrame&&this._triggerRenderFrame()}(g||d.isActive())&&(u[h]=d)}let c={};for(let h in this._previousActiveHandlers)u[h]||(c[h]=s);this._previousActiveHandlers=u,(Object.keys(c).length||dM(l))&&(this._changes.push([l,n,c]),this._triggerRenderFrame()),(Object.keys(u).length||dM(l))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:f}=l;f&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],f(this._map))},this._map=e,this._camera=r,this._transformProvider=new f8(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new QN(e),this._bearingSnap=t.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(t);let i=this._el;this._listeners=[[i,"touchstart",{passive:!0}],[i,"touchmove",{passive:!1}],[i,"touchend",void 0],[i,"touchcancel",void 0],[i,"mousedown",void 0],[i,"mousemove",void 0],[i,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[i,"mouseover",void 0],[i,"mouseout",void 0],[i,"dblclick",void 0],[i,"click",void 0],[i,"keydown",{capture:!1}],[i,"keyup",void 0],[i,"wheel",{passive:!1}],[i,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]];for(let[a,o,s]of this._listeners)a.addEventListener(o,a===this._ownerDocument?this.handleWindowEvent:this.handleEvent,s)}destroy(){for(let[e,r,t]of this._listeners)e.removeEventListener(r,e===this._ownerDocument?this.handleWindowEvent:this.handleEvent,t)}_addDefaultHandlers(e){let r=this._map,t=r.getCanvasContainer();this._add("mapEvent",new e8(r,e));let i=r.boxZoom=new uS(r,e,this._transformProvider);this._add("boxZoom",i),e.interactive&&e.boxZoom&&i.enable();let a=r.cooperativeGestures=new bS(r,e.cooperativeGestures);this._add("cooperativeGestures",a),e.cooperativeGestures&&a.enable();let o=new i8(r,this._transformProvider),s=new u8(r,this._transformProvider);r.doubleClickZoom=new gS(s,o),this._add("tapZoom",o),this._add("clickZoom",s),e.interactive&&e.doubleClickZoom&&r.doubleClickZoom.enable();let l=new c8;this._add("tapDragZoom",l);let n=r.touchPitch=new dS(r);this._add("touchPitch",n),e.interactive&&e.touchPitch&&r.touchPitch.enable(e.touchPitch);let u=()=>r.project(r.getCenter()),c=_se(e,u),f=xse(e),h=bse(e,u);r.dragRotate=new _S(e,c,f,h),this._add("mouseRotate",c,["mousePitch"]),this._add("mousePitch",f,["mouseRotate","mouseRoll"]),this._add("mouseRoll",h,["mousePitch"]),e.interactive&&e.dragRotate&&r.dragRotate.enable();let d=yse(e),p=new s8(e,r);r.dragPan=new yS(t,d,p),this._add("mousePan",d),this._add("touchPan",p,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&r.dragPan.enable(e.dragPan);let g=new hS,m=new fS;r.touchZoomRotate=new xS(t,m,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",m,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&r.touchZoomRotate.enable(e.touchZoomRotate),this._add("blockableMapEvent",new t8(r));let y=r.scrollZoom=new mS(r,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",y,["mousePan"]),e.interactive&&e.scrollZoom&&r.scrollZoom.enable(e.scrollZoom);let _=r.keyboard=new pS(r,this._transformProvider);this._add("keyboard",_),e.interactive&&e.keyboard&&r.keyboard.enable()}_add(e,r,t){this._handlers.push({handlerName:e,handler:r,allowed:t}),this._handlersById[e]=r}stop(e){if(!this._updatingCamera){for(let{handler:r}of this._handlers)r.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(let{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ay(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,r,t){for(let i in e)if(i!==t&&!r?.includes(i))return!0;return!1}_getMapTouches(e){let r=[];for(let t of e){let i=t.target;this._el.contains(i)&&r.push(t)}return r}mergeHandlerResult(e,r,t,i,a){if(!t)return;yn(e,t);let o={handlerName:i,originalEvent:t.originalEvent||a};t.zoomDelta!==void 0&&(r.zoom=o),t.panDelta!==void 0&&(r.drag=o),t.rollDelta!==void 0&&(r.roll=o),t.pitchDelta!==void 0&&(r.pitch=o),t.bearingDelta!==void 0&&(r.rotate=o)}_applyChanges(){let e={},r={},t={};for(let[i,a,o]of this._changes)i.panDelta&&(e.panDelta=(e.panDelta||new Wr(0,0))._add(i.panDelta)),i.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+i.pitchDelta),i.rollDelta&&(e.rollDelta=(e.rollDelta||0)+i.rollDelta),i.around!==void 0&&(e.around=i.around),i.pinchAround!==void 0&&(e.pinchAround=i.pinchAround),i.noInertia&&(e.noInertia=i.noInertia),yn(r,a),yn(t,o);this._updateMapTransform(e,r,t),this._changes=[]}_updateMapTransform(e,r,t){let i=this._map,a=this._camera.getTransformForUpdate(),o=i.terrain;if(!dM(e)&&!(o&&this._terrainMovement)){this._fireEvents(r,t,!0);return}this._camera.stop(!0);let{panDelta:s,zoomDelta:l,bearingDelta:n,pitchDelta:u,rollDelta:c}=e,{around:f,aroundOnSurface:h}=this._resolveAround(e,o,a),d=o?this._terrainGestureElevation(o,f,h,a,r):void 0,p={panDelta:s,zoomDelta:l,rollDelta:c,pitchDelta:u,bearingDelta:n,around:f,aroundElevation:d};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(f)&&(f=a.centerPoint);let g=this._computePreZoomAroundLoc(a,f,s,d);this._handleMapControls({terrain:o,tr:a,deltasForHelper:p,preZoomAroundLoc:g,combinedEventsInProgress:r,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(r,t,!0)}_resolveAround(e,r,t){let i=e.pinchAround===void 0?e.around:e.pinchAround;return i||(i=this._camera.transform.centerPoint),r&&!t.isPointOnMapSurface(i)?{around:t.centerPoint,aroundOnSurface:!1}:{around:i,aroundOnSurface:!0}}_terrainGestureElevation(e,r,t,i,a){if(!t)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let s=i.screenTerrainPointToMercatorCoordinate(r,e);this._terrainGestureAnchorElevation=s?s.z:null}if(this._terrainGestureAnchorElevation===null)return;let o=this._terrainGestureAnchorElevation;if(!(r.distSqr(i.centerPoint)<.01)&&!(o-i.elevation>=.9*(i.getCameraAltitude()-i.elevation)))return o}_computePreZoomAroundLoc(e,r,t,i){if(r.distSqr(e.centerPoint)<.01)return e.center;let a=t?r.sub(t):r;return i===void 0?e.screenPointToLocation(a):e.screenPointToLocationAtElevation(a,i)}_handleMapControls({terrain:e,tr:r,deltasForHelper:t,preZoomAroundLoc:i,combinedEventsInProgress:a,panDelta:o}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(t,r),!e){s.handleMapControlsPan(t,r,i);return}if(s.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),s.handleMapControlsPan(t,r,i);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(t,r,i);return}if(t.aroundElevation===void 0&&a.drag&&this._terrainMovement&&o){r.setCenter(r.screenPointToLocation(r.centerPoint.sub(o)));return}s.handleMapControlsPan(t,r,i)}_fireEvents(e,r,t){let i=ay(this._eventsInProgress),a=ay(e),o={};for(let c in e){let{originalEvent:f}=e[c];this._eventsInProgress[c]||(o[`${c}start`]=f),this._eventsInProgress[c]=e[c]}!i&&a&&this._fireEvent("movestart",a.originalEvent);for(let c in o)this._fireEvent(c,o[c]);a&&this._fireEvent("move",a.originalEvent);for(let c in e){let{originalEvent:f}=e[c];this._fireEvent(c,f)}let s={},l;for(let c in this._eventsInProgress){let{handlerName:f,originalEvent:h}=this._eventsInProgress[c];this._handlersById[f].isActive()||(delete this._eventsInProgress[c],l=r[f]||h,s[`${c}end`]=l)}for(let c in s)this._fireEvent(c,s[c]);let n=ay(this._eventsInProgress),u=(i||a)&&!n;if(u&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let c=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&c.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(c)}if(t&&u){this._updatingCamera=!0;let c=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),f=h=>h!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new h8("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}},p8=class extends Nl{constructor(e){var r,t,i;super(),this._renderFrameCallback=()=>{let a=Math.min((hs()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(a)),a<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new Kg,this.cameraHelper=new Jg,e.minZoom!==void 0&&this.transform.setMinZoom(e.minZoom),e.maxZoom!==void 0&&this.transform.setMaxZoom(e.maxZoom),e.minPitch!==void 0&&this.transform.setMinPitch(e.minPitch),e.maxPitch!==void 0&&this.transform.setMaxPitch(e.maxPitch),e.renderWorldCopies!==void 0&&this.transform.setRenderWorldCopies(e.renderWorldCopies),e.transformConstrain!==null&&this.transform.setConstrainOverride(e.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=e.bearingSnap,this._zoomSnap=e.zoomSnap,this._requestRenderFrame=e.requestRenderFrame,this._cancelRenderFrame=e.cancelRenderFrame,this.terrain=e.terrain,this._centerClampedToGround=(r=e.centerClampedToGround)!=null?r:!0,this.transformCameraUpdate=(t=e.transformCameraUpdate)!=null?t:null,this._stopHandlers=(i=e.stopHandlers)!=null?i:(()=>{}),this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,r){if(e.apply(this.transform,!0),this.transform=e,this.cameraHelper=r,this._requestedCameraState){let t=e.clone();t.apply(this._requestedCameraState,!0),this._requestedCameraState=t}}getCenter(){return new An(this.transform.center.lng,this.transform.center.lat)}setCenter(e,r){return this.jumpTo({center:e},r)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,r){return this.jumpTo({elevation:e},r),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,r,t){return e=Wr.convert(e).mult(-1),this.panTo(this.transform.center,yn({offset:e},r),t)}panTo(e,r,t){return this.easeTo(yn({center:e},r),t)}getZoom(){return this.transform.zoom}setZoom(e,r){return this.jumpTo({zoom:e},r),this}zoomTo(e,r,t){return this.easeTo(yn({zoom:e},r),t)}zoomIn(e,r){return this.zoomTo(Lf(this.getZoom()+1,this._zoomSnap),e,r),this}zoomOut(e,r){return this.zoomTo(Lf(this.getZoom()-1,this._zoomSnap),e,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,r){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new kn("movestart",r)).fire(new kn("move",r)).fire(new kn("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(e){return this._zoomSnap=e,this}getZoomSnap(){return this._zoomSnap}setBearing(e,r){return this.jumpTo({bearing:e},r),this}getPadding(){return this.transform.padding}setPadding(e,r){return this.jumpTo({padding:e},r),this}rotateTo(e,r,t){return this.easeTo(yn({bearing:e},r),t)}resetNorth(e,r){return this.rotateTo(0,yn({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(yn({bearing:0,pitch:0,roll:0,duration:1e3},e),r),this}snapToNorth(e,r){return Math.abs(this.getBearing()){p.easeFunc(g),this.terrain&&!e.freezeElevation&&this._updateElevation(g),this.applyUpdatedTransform(t),this._fireMoveEvents(r)},g=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r,g)},e),this}_prepareEase(e,r,t={}){this._moving=!0,!r&&!t.moving&&this.fire(new kn("movestart",e)),this._zooming&&!t.zooming&&this.fire(new kn("zoomstart",e)),this._rotating&&!t.rotating&&this.fire(new kn("rotatestart",e)),this._pitching&&!t.pitching&&this.fire(new kn("pitchstart",e)),this._rolling&&!t.rolling&&this.fire(new kn("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(e,this.transform),this.elevationFreeze=!0}_updateElevation(e){(this._elevationStart===void 0||this._elevationCenter===void 0)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(e<1&&r!==this._elevationTarget){let t=this._elevationTarget-this._elevationStart,i=(r-(t*e+this._elevationStart))/(1-e);this._elevationStart+=e*(t-i),this._elevationTarget=r}this.transform.setElevation(Zs.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return!this.transformCameraUpdate&&!this.terrain?this.transform:(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState)}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};let r=e.getCameraLngLat(),t=e.getCameraAltitude(),i=this.terrain?this.terrain.getElevationForLngLatZoom(r,e.zoom):0;if(tthis._elevateCameraIfInsideTerrain(i)),this.transformCameraUpdate&&r.push(i=>this.transformCameraUpdate(i)),!r.length)return;let t=e.clone();for(let i of r){let a=t.clone(),{center:o,zoom:s,roll:l,pitch:n,bearing:u,elevation:c}=i(a);o&&a.setCenter(o),c!==void 0&&a.setElevation(c),s!==void 0&&a.setZoom(s),l!==void 0&&a.setRoll(l),n!==void 0&&a.setPitch(n),u!==void 0&&a.setBearing(u),t.apply(a,!1)}this.transform.apply(t,!1)}_fireMoveEvents(e){this.fire(new kn("move",e)),this._zooming&&this.fire(new kn("zoom",e)),this._rotating&&this.fire(new kn("rotate",e)),this._pitching&&this.fire(new kn("pitch",e)),this._rolling&&this.fire(new kn("roll",e))}_afterEase(e,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let t=this._zooming,i=this._rotating,a=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,t&&this.fire(new kn("zoomend",e)),i&&this.fire(new kn("rotateend",e)),a&&this.fire(new kn("pitchend",e)),o&&this.fire(new kn("rollend",e)),this.fire(new kn("moveend",e))}flyTo(e,r){if(!e.essential&&yc.prefersReducedMotion){let T=N1(e,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(T,r)}this.stop(),e=yn({offset:[0,0],speed:1.2,curve:1.42,easing:Sx},e),e.zoom!==void 0&&this._zoomSnap&&(e.zoom=Lf(e.zoom,this._zoomSnap));let t=this.getTransformForUpdate(),i=t.bearing,a=t.pitch,o=t.roll,s=t.padding,l=e.bearing===void 0?i:this._normalizeBearing(e.bearing,i),n=e.pitch===void 0?a:+e.pitch,u=e.roll===void 0?o:this._normalizeBearing(e.roll,o),c=e.padding===void 0?t.padding:e.padding,f=Wr.convert(e.offset),h=t.centerPoint.add(f),d=t.screenPointToLocation(h),p=this.cameraHelper.handleFlyTo(t,{bearing:l,pitch:n,roll:u,padding:c,locationAtOffset:d,offsetAsPoint:f,center:e.center,minZoom:e.minZoom,zoom:e.zoom}),g=e.curve,m=Math.max(t.width,t.height),y=m/p.scaleOfZoom,_=p.pixelPathLength,v=m/p.scaleOfMinZoom;g=Math.min(g,Math.sqrt(v/_*2));let x=g*g;function S(T){let F=(y*y-m*m+(T?-1:1)*x*x*_*_)/(2*(T?y:m)*x*_);return Math.log(Math.sqrt(F*F+1)-F)}function M(T){return(Math.exp(T)-Math.exp(-T))/2}function C(T){return(Math.exp(T)+Math.exp(-T))/2}function w(T){return M(T)/C(T)}let k=S(!1),A=function(T){return C(k)/C(k+g*T)},b=function(T){return m*((C(k)*w(k+g*T)-M(k))/x)/_},E=(S(!0)-k)/g;if(Math.abs(_)<2e-6||!isFinite(E)){if(Math.abs(m-y)<1e-6)return this.easeTo(e,r);let T=y0,A=F=>Math.exp(T*g*F)}if(e.duration!==void 0)e.duration=+e.duration;else{let T=e.screenSpeed===void 0?+e.speed:+e.screenSpeed/g;e.duration=1e3*E/T}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=i!==l,this._pitching=n!==a,this._rolling=u!==o,this._padding=!t.isPaddingEqual(c),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(p.targetCenter),this._ease(T=>{let F=T*E,D=1/A(F),R=b(F);this._rotating&&t.setBearing(Zs.number(i,l,T)),this._pitching&&t.setPitch(Zs.number(a,n,T)),this._rolling&&t.setRoll(Zs.number(o,u,T)),this._padding&&(t.interpolatePadding(s,c,T),h=t.centerPoint.add(f)),p.easeFunc(T,D,R,h),this.terrain&&!e.freezeElevation&&this._updateElevation(T),this.applyUpdatedTransform(t),this._fireMoveEvents(r)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(e){return this._stop(e)}_stop(e,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,r)}return e||this._stopHandlers(),this}_ease(e,r,t){t.animate===!1||t.duration===0?(e(1),r()):(this._easeStart=hs(),this._easeOptions=t,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=ch(e,-180,180);let t=Math.abs(e-r);return Math.abs(e-360-r)MapLibre
'},TS=class{constructor(e=wS){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=r=>{r&&(r.type==="terrain"||r.dataType==="style"||r.dataType==="source"&&(r.sourceDataType==="metadata"||r.sourceDataType==="visibility"))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("maplibregl-compact")&&!this._container.classList.contains("maplibregl-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=$n.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=$n.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=$n.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,r){let t=this._map._getUIString(`AttributionControl.${r}`);e.title=t,e.setAttribute("aria-label",t)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(i=>typeof i=="string"?i:"")):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let r=this._map.style.tileManagers;for(let i in r){let a=r[i];if(a.used||a.usedForTerrain){let o=a.getSource();o.attribution&&!e.includes(o.attribution)&&e.push(o.attribution)}}e=e.filter(i=>String(i).trim()),e.sort((i,a)=>i.length-a.length),e=e.filter((i,a)=>{for(let o=a+1;o{let r=this._container.children;if(r.length){let t=r[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&t.classList.add("maplibregl-compact"):t.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){var r;this._map=e,this._compact=(r=this.options)==null?void 0:r.compact,this._container=$n.create("div","maplibregl-ctrl");let t=$n.create("a","maplibregl-ctrl-logo");return t.target="_blank",t.rel="noopener nofollow",t.href="https://maplibre.org/",t.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),t.setAttribute("rel","noopener nofollow"),this._container.appendChild(t),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},v8=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){let r=++this._id;return this._queue.push({callback:e,id:r,cancelled:!1}),r}remove(e){let r=this._currentlyRunning,t=r?this._queue.concat(r):this._queue;for(let i of t)if(i.id===e){i.cancelled=!0;return}}run(e=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let r=this._currentlyRunning=this._queue;this._queue=[];let t=!1,i;for(let a of r)if(!a.cancelled){try{a.callback(e)}catch(o){t||(t=!0,i=o)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,t)throw i}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},MS=["none","zoom","sourceTiles","visibleLayers","revision"],m8=class{constructor(e,r,t,i){this._tileKeys=e.map(a=>a.key).sort().join(),this._revision=r,this._zoom=t,this._visibleLayerIds=i}difference(e){return this._revision===e?._revision?this._visibleLayerIds===e._visibleLayerIds?this._tileKeys===e._tileKeys?this._zoom===e._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}},av={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},g8=class{constructor(e,r){this.needsFollowUpFrame=!1,this.painter=e,this.terrain=r,this.rttSize=r.tileManager.tileSize*r.qualityFactor}getTexture(e){return e.getRTT(this._stacks.length-1).texture}prepareForRender(e,r){let t=r!==this._lastPrepareZoom;this._lastPrepareZoom=r,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=e._order.filter(l=>!e._layers[l].isHidden(r));let i=this._renderableLayerIds.join(),a=new Set;for(let l of this._renderableLayerIds){let n=e._layers[l],u=n.source;u&&av[n.type]&&a.add(u)}this._coordsAscending={},this._rttFingerprints={};for(let l of a){let n=e.tileManagers[l];if(!n)continue;this._coordsAscending[l]={};let u=this._coordsAscending[l],c=n.getSource(),f=c instanceof rv?c.terrainTileRanges:null;for(let p of n.getVisibleCoordinates()){let g=this.terrain.tileManager.getTerrainCoords(p,f);for(let m in g)u[m]||(u[m]=[]),u[m].push(g[m])}this._rttFingerprints[l]={};let h=this._rttFingerprints[l],d=n.getState().revision;for(let p in u)h[p]=new m8(u[p],d,r,i)}this.needsFollowUpFrame=!1;let o=t||this.painter.options.moving,s=!1;for(let l of this._renderableTiles){let n=this._textureDifference(l);n!=="none"&&(n==="zoom"&&o||n==="visibleLayers"&&t?this.needsFollowUpFrame=!0:n==="zoom"||n==="sourceTiles"?(s?this.needsFollowUpFrame=!0:l.releaseRTT(this.painter),s=!0):l.releaseRTT(this.painter))}}_textureDifference(e){let r="none";for(let t in this._rttFingerprints){let i=this._rttFingerprints[t][e.tileID.key];if(!i)continue;let a=i.difference(e.rttFingerprint[t]);MS.indexOf(a)>MS.indexOf(r)&&(r=a)}return r}renderLayer(e,r){if(e.isHidden(this.painter.transform.zoom))return!1;let t=ar(Ot({},r),{isRenderingToTexture:!0}),i=e.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(av[i]&&((!this._prevType||!av[this._prevType])&&this._stacks.push([]),this._prevType=i,this._stacks[this._stacks.length-1].push(e.id),!o))return!0;if(av[this._prevType]||av[i]&&o){this._prevType=i;let s=this._stacks.length-1,l=this._stacks[s]||[];for(let n of this._renderableTiles){if(this._rttTiles.push(n),n.getRTT(s))continue;let u=n.acquireRTT(a,s,this.rttSize);a.bindRTT(u),a.context.clear({color:ro.transparent,stencil:0}),a.currentStencilSource=void 0;for(let c of l){let f=a.style._layers[c],h=f.source?this._coordsAscending[f.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(f,h,!0),a.renderLayer(a,a.style.tileManagers[f.source],f,h,t),f.source&&(n.rttFingerprint[f.source]=this._rttFingerprints[f.source][n.tileID.key])}u.texture.generateMipmap()}return fse(this.painter,this.terrain,this._rttTiles,t),this._rttTiles=[],av[i]}return!1}},y8={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use \u2318 + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},_8=vM,SS={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:wS,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:ff.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20},ES=class extends Nl{get _ownerWindow(){var e,r;return((r=(e=this._container)==null?void 0:e.ownerDocument)==null?void 0:r.defaultView)||window}constructor(e){var r,t,i;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new v8,this._controls=[],this._mapId=x9(),this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=l=>{if(l.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style){this.fire(new Wg("webglcontextlost",{originalEvent:l}));return}for(let n of Object.values(this.style._layers))if(n.type==="custom"&&console.warn(`Custom layer with id '${n.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),n._listeners)for(let[u]of Object.entries(n._listeners))console.warn(`Custom layer with id '${n.id}' had event listeners for event '${u}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new Wg("webglcontextlost",{originalEvent:l}))},this._contextRestored=l=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style){this.style.imageManager.images=this._lostContextStyle.images;for(let n in this._lostContextStyle.images){let u=this._lostContextStyle.images[n];u.isWebGLImage&&this.style.imageManager.updateImage(n,u,!1)}}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(n){this.fire(new Ln(n));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new Wg("webglcontextrestored",{originalEvent:l}))},this._onMapScroll=l=>{if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let a=ar(Ot(Ot({},SS),e),{canvasContextAttributes:Ot(Ot({},SS.canvasContextAttributes),e.canvasContextAttributes)});if(a.minZoom!=null&&a.maxZoom!=null&&a.minZoom>a.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(a.minPitch!=null&&a.maxPitch!=null&&a.minPitch>a.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(a.minPitch!=null&&a.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(a.maxPitch!=null&&a.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new p8({minZoom:a.minZoom,maxZoom:a.maxZoom,minPitch:a.minPitch,maxPitch:a.maxPitch,bearingSnap:a.bearingSnap,zoomSnap:a.zoomSnap,renderWorldCopies:a.renderWorldCopies,centerClampedToGround:a.centerClampedToGround,terrain:this.terrain,transformConstrain:a.transformConstrain,requestRenderFrame:l=>this._requestRenderFrame(l),cancelRenderFrame:l=>this._cancelRenderFrame(l),transformCameraUpdate:a.transformCameraUpdate,stopHandlers:()=>{var l;return(l=this._handlers)==null?void 0:l.stop(!1)}}),this._camera.setEventedParent(this),this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=Ot({},a.canvasContextAttributes),this._trackResize=a.trackResize===!0,this._terrainSkirtLength=a.terrainSkirtLength,this._refreshExpiredTiles=a.refreshExpiredTiles===!0,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=a.crossSourceCollisions===!0,this._collectResourceTiming=a.collectResourceTiming===!0,this._locale=Ot(Ot({},y8),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=a.cancelPendingTileRequestsWhileZooming===!0,this.setAnisotropicFilterPitch(a.anisotropicFilterPitch),a.reduceMotion!==void 0&&(yc.prefersReducedMotion=a.reduceMotion),this._requestManager=new Zz(a.transformRequest),this._container=this._resolveContainer(a.container),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer();try{this._setupPainter()}catch(l){throw this._cleanupContainer(),l}this._imageQueueHandle=td.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new d8(this,this._camera,a),typeof window<"u"&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let o=typeof a.hash=="string"&&a.hash||void 0;this._hash=a.hash?new lS(o).addTo(this):void 0,(r=this._hash)!=null&&r._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,yn({},a.fitBoundsOptions,{duration:0}))));let s=typeof a.style=="string"||((i=(t=a.style)==null?void 0:t.projection)==null?void 0:i.type)!=="globe";this.resize(null,s),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new TS(typeof a.attributionControl=="boolean"?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new AS,a.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this._camera.transform.unmodified){let l=N1(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(l)}}),this.on("data",l=>{this._update(l.dataType==="style"),this.fire(l.dataType==="style"?new Nf("styledata",l):new zs("sourcedata",l))}),this.on("dataloading",l=>{this.fire(l.dataType==="style"?new Nf("styledataloading",l):new zs("sourcedataloading",l))}),this.on("dataabort",l=>{this.fire(new zs("sourcedataabort",l))})}_getMapId(){return this._mapId}setGlobalStateProperty(e,r){return this.style.setGlobalStateProperty(e,r),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(e,r){if(r===void 0&&(r=e.getDefaultPosition?e.getDefaultPosition():"top-right"),!e?.onAdd)return this.fire(new Ln(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let t=e.onAdd(this);this._controls.push(e);let i=this._controlPositions[r];return r.includes("bottom")?i.insertBefore(t,i.firstChild):i.appendChild(t),this}removeControl(e){if(!e?.onRemove)return this.fire(new Ln(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.includes(e)}coveringTiles(e){return Bm(this._camera.transform,e)}setTransformCameraUpdate(e){this._camera.transformCameraUpdate=e}getCenter(){return new An(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(e,r){return this._camera.setCenter(e,r),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(e,r){return this._camera.setCenterElevation(e,r),this}setCenterClampedToGround(e){this._camera.setCenterClampedToGround(e)}panBy(e,r,t){return this._camera.panBy(e,r,t),this}panTo(e,r,t){return this._camera.panTo(e,r,t),this}getZoom(){return this._camera.transform.zoom}setZoom(e,r){return this._camera.setZoom(e,r),this}zoomTo(e,r,t){return this._camera.zoomTo(e,r,t),this}zoomIn(e,r){return this._camera.zoomIn(e,r),this}zoomOut(e,r){return this._camera.zoomOut(e,r),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(e,r){return this._camera.setVerticalFieldOfView(e,r),this}getBearing(){return this._camera.transform.bearing}setBearing(e,r){return this._camera.setBearing(e,r),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(e){return this._camera.setZoomSnap(e),this}getPadding(){return this._camera.transform.padding}setPadding(e,r){return this._camera.setPadding(e,r),this}rotateTo(e,r,t){return this._camera.rotateTo(e,r,t),this}resetNorth(e,r){return this._camera.resetNorth(e,r),this}resetNorthPitch(e,r){return this._camera.resetNorthPitch(e,r),this}snapToNorth(e,r){return this._camera.snapToNorth(e,r),this}getPitch(){return this._camera.transform.pitch}setPitch(e,r){return this._camera.setPitch(e,r),this}getRoll(){return this._camera.transform.roll}setRoll(e,r){return this._camera.setRoll(e,r),this}cameraForBounds(e,r){return this._camera.cameraForBounds(e,r)}fitBounds(e,r,t){return this._camera.fitBounds(e,r,t),this}fitScreenCoordinates(e,r,t,i,a){return this._camera.fitScreenCoordinates(e,r,t,i,a),this}jumpTo(e,r){return this._camera.jumpTo(e,r),this}calculateCameraOptionsFromCameraLngLatAltRotation(e,r,t,i,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(e,r,t,i,a)}easeTo(e,r){return this._camera.easeTo(e,r),this}flyTo(e,r){return this._camera.flyTo(e,r),this}stop(){return this._camera.stop(),this}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLat(An.convert(e),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(e,r,t,i){return i==null&&this.terrain&&(i=this.terrain.getElevationForLngLat(t,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(e,r,t,i??0)}resize(e,r=!0){if(this._lostContextStyle.style!==null)return this;this._resizeInternal(r);let t=!this._camera._moving;return t&&(this.stop(),this.fire(new kn("movestart",e)).fire(new kn("move",e))),this.fire(new iu("resize",e)),t&&this.fire(new kn("moveend",e)),this}_resizeInternal(e=!0){let[r,t]=this._containerDimensions(),i=this._getClampedPixelRatio(r,t);if(this._resizeCanvas(r,t,i),this.painter.resize(r,t,i),this.painter.overLimit()){let a=this.painter.context.gl;this._maxCanvasSize=[a.drawingBufferWidth,a.drawingBufferHeight];let o=this._getClampedPixelRatio(r,t);this._resizeCanvas(r,t,o),this.painter.resize(r,t,o)}this._resizeTransform(e)}_resizeTransform(e=!0){var r;let[t,i]=this._containerDimensions();this._camera.transform.resize(t,i,e),(r=this._camera._requestedCameraState)==null||r.resize(t,i,e)}_getClampedPixelRatio(e,r){let{0:t,1:i}=this._maxCanvasSize,a=this.getPixelRatio(),o=e*a,s=r*a,l=o>t?t/o:1,n=s>i?i/s:1,u=Math.min(l,n);return u<1&&To("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),u*a}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(e){return this._camera.transform.setMaxBounds(bh.convert(e)),this._update()}setMinZoom(e){if(e??(e=-2),e>=-2&&e<=this._camera.transform.maxZoom){let r=this._camera.transform.zoom,t=this._camera.getTransformForUpdate();return t.setMinZoom(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.zoom&&this.fire(new kn("zoomstart")).fire(new kn("zoom")).fire(new kn("zoomend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(e=!1){let r=this._camera.transform;return e?r.applyConstrain(r.center,r.minZoom).zoom:r.minZoom}setMaxZoom(e){if(e??(e=22),e>=this._camera.transform.minZoom){let r=this._camera.transform.zoom,t=this._camera.getTransformForUpdate();return t.setMaxZoom(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.zoom&&this.fire(new kn("zoomstart")).fire(new kn("zoom")).fire(new kn("zoomend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(e){if(e??(e=0),e<0)throw Error("minPitch must be greater than or equal to 0");if(e>=0&&e<=this._camera.transform.maxPitch){let r=this._camera.transform.pitch,t=this._camera.getTransformForUpdate();return t.setMinPitch(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.pitch&&this.fire(new kn("pitchstart")).fire(new kn("pitch")).fire(new kn("pitchend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(e){if(e??(e=60),e>180)throw Error("maxPitch must be less than or equal to 180");if(e>=this._camera.transform.minPitch){let r=this._camera.transform.pitch,t=this._camera.getTransformForUpdate();return t.setMaxPitch(e),this._camera.applyUpdatedTransform(t),this._update(),r!==this._camera.transform.pitch&&this.fire(new kn("pitchstart")).fire(new kn("pitch")).fire(new kn("pitchend")).fire(new kn("movestart")).fire(new kn("move")).fire(new kn("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(e){if(e??(e=20),e>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(e<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=e,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(e){return this._camera.transform.setRenderWorldCopies(e),this._update()}setTransformConstrain(e){return this._camera.transform.setConstrainOverride(e),this._update()}project(e){return this._camera.transform.locationToScreenPoint(An.convert(e),this.style&&this.terrain)}unproject(e){return this._camera.transform.screenPointToLocation(Wr.convert(e),this.terrain)}isMoving(){var e;return this._camera.isMoving()||((e=this._handlers)==null?void 0:e.isMoving())||!1}isZooming(){var e;return this._camera.isZooming()||((e=this._handlers)==null?void 0:e.isZooming())||!1}isRotating(){var e;return this._camera.isRotating()||((e=this._handlers)==null?void 0:e.isRotating())||!1}_createDelegatedListener(e,r,t){if(e==="mouseenter"||e==="mouseover"){let i=!1;return{layers:r,listener:t,delegates:{mousemove:a=>{let o=r.filter(l=>this.getLayer(l)),s=o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length?i||(i=!0,t.call(this,new df(e,this,a.originalEvent,{features:s}))):i=!1},mouseout:()=>{i=!1}}}}if(e==="mouseleave"||e==="mouseout"){let i=!1;return{layers:r,listener:t,delegates:{mousemove:a=>{let o=r.filter(s=>this.getLayer(s));(o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o})).length?i=!0:i&&(i=!1,t.call(this,new df(e,this,a.originalEvent)))},mouseout:a=>{i&&(i=!1,t.call(this,new df(e,this,a.originalEvent)))}}}}{let i=a=>{let o=r.filter(l=>this.getLayer(l)),s=o.length===0?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length&&(a.features=s,t.call(this,a),delete a.features)};return{layers:r,listener:t,delegates:{[e]:i}}}}_saveDelegatedListener(e,r){var t;this._delegatedListeners||(this._delegatedListeners={}),(t=this._delegatedListeners)[e]||(t[e]=[]),this._delegatedListeners[e].push(r)}_removeDelegatedListener(e,r,t){var i;if(!((i=this._delegatedListeners)!=null&&i[e]))return;let a=this._delegatedListeners[e];for(let o=0;or.includes(l))){for(let l in s.delegates)this.off(l,s.delegates[l]);a.splice(o,1);return}}}on(e,r,t){if(t===void 0)return super.on(e,r);let i=typeof r=="string"?[r]:r,a=this._createDelegatedListener(e,i,t);this._saveDelegatedListener(e,a);for(let o in a.delegates)this.on(o,a.delegates[o]);return{unsubscribe:()=>{this._removeDelegatedListener(e,i,t)}}}once(e,r,t){if(t===void 0)return super.once(e,r);let i=typeof r=="string"?[r]:r,a=this._createDelegatedListener(e,i,t);for(let o in a.delegates){let s=a.delegates[o];a.delegates[o]=(...l)=>{this._removeDelegatedListener(e,i,t),s(...l)}}this._saveDelegatedListener(e,a);for(let o in a.delegates)this.once(o,a.delegates[o]);return this}off(e,r,t){if(t===void 0)return super.off(e,r);let i=typeof r=="string"?[r]:r;return this._removeDelegatedListener(e,i,t),this}queryRenderedFeatures(e,r){if(!this.style)return[];let t,i=e instanceof Wr||Array.isArray(e),a=i?e:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(r||(r=(i?{}:e)||{}),a instanceof Wr||typeof a[0]=="number")t=[Wr.convert(a)];else{let o=Wr.convert(a[0]),s=Wr.convert(a[1]);t=[o,new Wr(s.x,o.y),s,new Wr(o.x,s.y),o]}return this.style.queryRenderedFeatures(t,r,this._camera.transform)}querySourceFeatures(e,r){return this.style.querySourceFeatures(e,r)}setStyle(e,r){return r=yn({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),this._styleUrl=typeof e=="string"?e:null,r.diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let r=this._locale[e];if(r==null)throw Error(`Missing UI string '${e}'`);return r}_updateStyle(e,r){var t,i,a;if((t=this._diffStyleRequest)==null||t.abort(),this._diffStyleRequest=null,r.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,r));return}let o=this.style&&r.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new L2(this,r||{});else return this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),(a=(i=this.style)==null?void 0:i.projection)==null||a.destroy(),delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,r,o):this.style.loadJSON(e,r,o),this}_lazyInitEmptyStyle(){this.style||(this.style=new L2(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){return Xr(this,null,function*(){var t;if((t=this._diffStyleRequest)==null||t.abort(),typeof e=="string"){let i=e;this._diffStyleRequest=new AbortController;let a=this._diffStyleRequest;try{let o=yield this._requestManager.transformRequest(i,"Style");if(a.signal.aborted){this._diffStyleRequest=null;return}let s=yield vg(o,a);this._diffStyleRequest=null,this._updateDiff(s.data,r)}catch(o){this._diffStyleRequest=null,jp(o)||this.fire(new Ln(Zu(o)))}}else typeof e=="object"&&(this._diffStyleRequest=null,this._updateDiff(e,r))})}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(t){To(`Unable to perform style diff: ${Zu(t).message}. Rebuilding the style from scratch.`),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){if(!this.style){To("There is no style added to the map.");return}return this.style.loaded()}addSource(e,r){return this._lazyInitEmptyStyle(),this.style.addSource(e,r),this._update(!0)}isSourceLoaded(e){var r;let t=(r=this.style)==null?void 0:r.tileManagers[e];if(t===void 0){this.fire(new Ln(Error(`There is no tile manager with ID '${e}'`)));return}return t.loaded()}setTerrain(e,r={}){if(this.style._checkLoaded(),e&&Q1(this,Hc.terrain,{value:e},r))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);else{let t=this.style.tileManagers[e.source];if(!t)throw Error(`cannot load terrain, because there exists no source with ID: ${e.source}`);this.terrain===null&&t.reload();for(let i in this.style._layers){let a=this.style._layers[i];a.type==="hillshade"&&a.source===e.source&&To("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),a.type==="color-relief"&&a.source===e.source&&To("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new ZB(this.painter,t,e,this._terrainSkirtLength),this.painter.renderToTexture=new g8(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=i=>this._handleTerrainDataEvent(i,e.source),this.style.on("data",this._terrainDataCallback)}return this.style.triggerSymbolPlacement(),this.fire(new yM({terrain:e})),this}_handleTerrainDataEvent(e,r){var t;if(e.dataType==="style"){this.terrain.tileManager.releaseAllRTT();return}let i=e.sourceId===r;if(i&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),i&&e.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),e.tile){if(((t=e.source)==null?void 0:t.type)==="image"){this.terrain.tileManager.releaseAllRTT();return}this.terrain.tileManager.releaseRTT(e.tile.tileID)}}getTerrain(){var e,r;return(r=(e=this.terrain)==null?void 0:e.options)!=null?r:null}areTilesLoaded(){var e;let r=(e=this.style)==null?void 0:e.tileManagers;for(let t of Object.values(r))if(!t.areTilesLoaded())return!1;return!0}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){var r;return(r=this.style)==null?void 0:r.getSource(e)}setSourceTileLodParams(e,r,t){if(t){let i=this.getSource(t);if(!i)throw Error(`There is no source with ID "${t}", cannot set LOD parameters`);i.calculateTileZoom=HA(Math.max(1,e),Math.max(1,r))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=HA(Math.max(1,e),Math.max(1,r));return this._update(!0),this}refreshTiles(e,r){let t=this.style.tileManagers[e];if(!t)throw Error(`There is no tile manager with ID "${e}", cannot refresh tile`);r===void 0?t.reload(!0):t.refreshTiles(r.map(i=>new Rg(i.z,i.x,i.y)))}addImage(e,r,t={}){var i;this._lazyInitEmptyStyle();let a=this._createStyleImage(r,t);return a?(this.style.addImage(e,a),(i=a.userImage)!=null&&i.onAdd&&a.userImage.onAdd(this,e),this):this}setMissingStyleImageResolver(e){var r;return this._missingStyleImageResolver=e,(r=this.style)==null||r.setMissingImageResolver(e),this}_createStyleImage(e,r={}){let{pixelRatio:t=1,sdf:i=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:n}=r;if(e instanceof HTMLImageElement||P0(e)){let{width:u,height:c,data:f}=yc.getImageData(e);return{data:new Rs({width:u,height:c},f),pixelRatio:t,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:n,sdf:i,version:0}}if(e.width===void 0||e.height===void 0)return this.fire(new Ln(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:u,height:c,data:f}=e,h=e,d=ux(h.data);return{data:d?new Rs({width:u,height:c}):new Rs({width:u,height:c},new Uint8Array(f)),pixelRatio:t,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:n,sdf:i,version:0,isWebGLImage:d,userImage:h}}}updateImage(e,r){let t=this.style.getImage(e);if(!t)return this.fire(new Ln(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:i,height:a,data:o}=r instanceof HTMLImageElement||P0(r)?yc.getImageData(r):r;if(i===void 0||a===void 0)return this.fire(new Ln(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(i!==t.data.width||a!==t.data.height)return this.fire(new Ln(Error("The width and height of the updated image must be that same as the previous version of the image")));if(t.isWebGLImage=ux(o),t.isWebGLImage)t.userImage=r;else{let s=!(r instanceof HTMLImageElement||P0(r));t.data.replace(o,s)}return this.style.updateImage(e,t),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new Ln(Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e){return Xr(this,null,function*(){let r=yield td.getImage(yield this._requestManager.transformRequest(e,"Image"),new AbortController);if(!r.data)throw Error(`Could not load image ${e}: the response is empty`);return r})}listImages(){var e,r;return(r=(e=this.style)==null?void 0:e.listImages())!=null?r:[]}addLayer(e,r){return this._lazyInitEmptyStyle(),this.style.addLayer(e,r),this._update(!0)}moveLayer(e,r){return this.style.moveLayer(e,r),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){var r;return(r=this.style)==null?void 0:r.getLayer(e)}getLayersOrder(){var e,r;return(r=(e=this.style)==null?void 0:e.getLayersOrder())!=null?r:[]}setLayerZoomRange(e,r,t){return this.style.setLayerZoomRange(e,r,t),this._update(!0)}setFilter(e,r,t={}){var i;return(i=this.style)==null||i.setFilter(e,r,t),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,r,t,i={}){var a;return(a=this.style)==null||a.setPaintProperty(e,r,t,i),this._update(!0)}getPaintProperty(e,r){return this.style.getPaintProperty(e,r)}setLayoutProperty(e,r,t,i={}){return this.style.setLayoutProperty(e,r,t,i),this._update(!0)}getLayoutProperty(e,r){return this.style.getLayoutProperty(e,r)}setGlyphs(e,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(e){return this._lazyInitEmptyStyle(),this.style.setFontFaces(e),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(e,r,t={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,r,t,i=>{i||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,r,t=>{t||this._update(!0)}),this}setLight(e,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSky(e,r),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(e,r){return this.style.setFeatureState(e,r),this._update()}removeFeatureState(e,r){return this.style.removeFeatureState(e,r),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,r=0;return this._container&&(e=this._container.clientWidth||400,r=this._container.clientHeight||300),[e,r]}_shouldHandleInitialResize(){var e;if(!((e=this._container)!=null&&e.clientWidth)||!this._container.clientHeight)return!1;let[r,t]=this._containerDimensions();return r!==this._camera.transform.width||t!==this._camera.transform.height}_setupResizeObserver(){var e;let r=!1,t=qz(a=>{this._trackResize&&!this._removed&&(this.resize(a),this.redraw())},50),i=(e=this._ownerWindow.ResizeObserver)!=null?e:ResizeObserver;this._resizeObserver=new i(a=>{!r&&(r=!0,!this._shouldHandleInitialResize())||t(a)}),this._resizeObserver.observe(this._container)}_resolveContainer(e){if(typeof e=="string"){let r=document.getElementById(e);if(!r)throw Error(`Container '${e}' not found.`);return r}if(e instanceof HTMLElement||e&&typeof e=="object"&&e.nodeType===1)return e;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let e=this._container;e.classList.add("maplibregl-map");let r=this._canvasContainer=$n.create("div","maplibregl-canvas-container",e);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=$n.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let t=this._containerDimensions(),i=this._getClampedPixelRatio(t[0],t[1]);this._resizeCanvas(t[0],t[1],i);let a=this._controlContainer=$n.create("div","maplibregl-control-container",e),o=this._controlPositions={};for(let s of["top-left","top-right","bottom-left","bottom-right"])o[s]=$n.create("div",`maplibregl-ctrl-${s} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(e,r,t){this._canvas.width=Math.floor(t*e),this._canvas.height=Math.floor(t*r),this._canvas.style.width=`${e}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let e=ar(Ot({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),r=null;this._canvas.addEventListener("webglcontextcreationerror",i=>{r=i},{once:!0});let t=this._canvas.getContext("webgl2",e);if(!t)throw new sS(e,r);this.painter=new WN(t,this._camera.transform)}migrateProjection(e,r){this._camera.migrateProjection(e,r),this.painter.transform=e,this.fire(new _M({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){var r;return(r=this.style)!=null&&r._loaded?(this._styleDirty||(this._styleDirty=e),this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){var r,t,i,a,o;let s=this._idleTriggered?this._fadeDuration:0,l=((r=this.style.projection)==null?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let n=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let f=this._camera.transform.zoom,h=hs();this.style.zoomHistory.update(f,h);let d=new ns(f,{now:h,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),p=d.crossFadingFactor();(p!==1||p!==this._crossFadingFactor)&&(n=!0,this._crossFadingFactor=p),this.style.update(d)}let u=((t=this.style.projection)==null?void 0:t.transitionState)>0!==l;this._camera.transform.setTransitionState((i=this.style.projection)==null?void 0:i.transitionState),this.style&&(this._sourcesDirty||u)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=(a=this.style)==null?void 0:a._updatePlacement(this._camera.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,u),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new iu("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new iu("load"))),this.style&&(this.style.hasTransitions()||n)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let c=this._sourcesDirty||this._styleDirty||this._placementDirty||((o=this.painter.renderToTexture)==null?void 0:o.needsFollowUpFrame);return c||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new iu("idle")),this._loaded&&!this._fullyLoaded&&!c&&(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var e,r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),(e=this._diffStyleRequest)==null||e.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),typeof window<"u"&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),td.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let t=this.painter.context.gl.getExtension("WEBGL_lose_context");t?.loseContext&&t.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new iu("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,yc.frame(this._frameRequest,e=>{this._frameRequest=null;try{this._render(e)}catch(r){if(!jp(r))throw r}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return _8}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(e){return this._lazyInitEmptyStyle(),this.style.setProjection(e),this._update(!0)}},x8={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0},b8=class{constructor(e){this._updateZoomButtons=()=>{let r=this._map.getZoom(),t=r===this._map.getMaxZoom(),i=r===this._map.getMinZoom(!0);this._zoomInButton.disabled=t,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let r=this._map.getPitch(),t=this._map.getRoll(),i=this._map.getBearing(),a=1/Math.cos(rl(r))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${a}) rotateZ(${-t}deg) rotateX(${r}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${a}) rotateX(${r}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-i-t}deg)`;return}this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(r,t)=>{let i=this._map._getUIString(`NavigationControl.${t}`);r.title=i,r.setAttribute("aria-label",i)},this.options=yn({},x8,e),this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",r=>this._map.zoomIn({},{originalEvent:r})),$n.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",r=>this._map.zoomOut({},{originalEvent:r})),$n.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",r=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:r}):this._map.resetNorth({},{originalEvent:r})}),this._compassIcon=$n.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(e){return this._map=e,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new w8(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(e,r){let t=$n.create("button",e,this._container);return t.type="button",t.addEventListener("click",r),t}},w8=class{constructor(e,r,t=!1){this.mousedown=a=>{this.startMove(a,$n.mousePos(this.element,a)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=a=>{this.move(a,$n.mousePos(this.element,a))},this.mouseup=a=>{this._rotatePitchHandler.dragEnd(a),this.offTemp()},this.touchstart=a=>{a.targetTouches.length===1?(this._startPos=this._lastPos=$n.touchPos(this.element,a.targetTouches)[0],this.startMove(a,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=a=>{a.targetTouches.length===1?(this._lastPos=$n.touchPos(this.element,a.targetTouches)[0],this.move(a,this._lastPos)):this.reset()},this.touchend=a=>{a.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;let i=new o8;this._rotatePitchHandler=new Wm({clickTolerance:3,move:(a,o)=>{let s=r.getBoundingClientRect(),l=new Wr((s.bottom-s.top)/2,(s.right-s.left)/2);return{bearingDelta:T9(new Wr(a.x,o.y),o,l),pitchDelta:t?(o.y-a.y)*-.5:void 0}},moveStateManager:i,enable:!0,assignEvents:()=>{}}),this.map=e,r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchcancel",this.reset)}startMove(e,r){this._rotatePitchHandler.dragStart(e,r),$n.disableDrag()}move(e,r){let t=this.map,{bearingDelta:i,pitchDelta:a}=this._rotatePitchHandler.dragMove(e,r)||{};i&&t.setBearing(t.getBearing()+i),a&&t.setPitch(t.getPitch()+a)}off(){let e=this.element;e.removeEventListener("mousedown",this.mousedown),e.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),e.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){$n.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}},q2={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},kS={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},CS="#3FB1CE",a0=class extends hf{},LS=class extends hf{},V2=class extends Nl{constructor(e){if(super(),this._onClick=r=>{this.fire(new LS("click",{originalEvent:r}))},this._onKeyPress=r=>{(r.code==="Space"||r.code==="Enter")&&this.togglePopup()},this._onKeyDown=r=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||r.composedPath()[0]!==this._element||r.altKey||r.ctrlKey||r.metaKey)return;let t=kS[r.key];if(!t)return;r.preventDefault(),r.stopPropagation();let i=r.shiftKey?10:1,a=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new Wr(a.x+t[0]*i,a.y+t[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new a0("dragstart"))),this.fire(new a0("drag"))},this._onKeyUp=r=>{kS[r.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=r=>{let t=r.originalEvent.target,i=this._element;this._popup&&(t===i||i.contains(t))&&this.togglePopup()},this._update=r=>{if(!this._map)return;let t=this._map.loaded()&&!this._map.isMoving();(r?.type==="terrain"||r?.type==="render"&&!t)&&this._map.once("render",this._update),this._lngLat=Hz(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?i=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let a="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?a="rotateX(0deg)":this._pitchAlignment==="map"&&(a=`rotateX(${this._map.getPitch()}deg)`),!this._subpixelPositioning&&(!r||r.type==="moveend")&&(this._pos=this._pos.round()),this._element.style.transform=`${q2[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${a} ${i}`,yc.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(r?.type==="moveend")}).catch(()=>{})},this._onMove=r=>{if(!this._isDragging){let t=this._clickTolerance||this._map._clickTolerance;this._isDragging=r.point.dist(this._pointerdownPos)>=t}this._isDragging&&(this._pos=r.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new a0("dragstart"))),this.fire(new a0("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new a0("dragend")),this._state="inactive"},this._addDragHandler=r=>{this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(this._pos).add(this._offset),this._pointerdownPos=r.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e?.anchor||"center",this._color=e?.color||CS,this._scale=e?.scale||1,this._draggable=e?.draggable||!1,this._clickTolerance=e?.clickTolerance||0,this._subpixelPositioning=e?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=e?.rotation||0,this._rotationAlignment=e?.rotationAlignment||"auto",this._pitchAlignment=e?.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e?.opacity,e?.opacityWhenCovered),e?.element)this._element=e.element,this._offset=Wr.convert(e?.offset||[0,0]);else{this._defaultMarker=!0,this._element=$n.create("div");let r=Ase().cloneNode(!0);r.setAttributeNS(null,"height",`${41*this._scale}px`),r.setAttributeNS(null,"width",`${27*this._scale}px`),Mse(r).setAttributeNS(null,"fill",this._color),this._element.appendChild(r),this._offset=Wr.convert(e?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",r=>{r.preventDefault()}),this._element.addEventListener("mousedown",r=>{r.preventDefault()}),$z(this._element,this._anchor,"marker"),e?.className)for(let r of e.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(e){return this.remove(),this._map=e,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),this._updateAccessibilityRole(),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=An.convert(e),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),e){if(!("offset"in e.options)){let r=13.5/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,(24.6+r)*-1],"bottom-right":[-r,(24.6+r)*-1],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=e,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new a0("dragend")))}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(this._element.style.opacity===this._opacityWhenCovered)return this;if(e)e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map));else return this;return this}_updateOpacity(e=!1){var r,t;let i=(r=this._map)==null?void 0:r.terrain,a=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!i||a){let p=a?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==p&&(this._element.style.opacity=p,this._element.classList.toggle("maplibregl-marker-covered",a));return}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,s=o.terrain.depthAtPoint(this._pos),l=o.terrain.getElevationForLngLat(this._lngLat,o._camera.transform),n=o._camera.transform.lngLatToCameraDepth(this._lngLat,l),u=.006;if(n-su;(t=this._popup)!=null&&t.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",d)}getOffset(){return this._offset}setOffset(e){return this._offset=Wr.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&(this._tabIndexManaged=(this._element.getAttribute("tabindex")==="0"&&this._element.removeAttribute("tabindex"),!1))}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let e=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",e),this._roleManaged=!0}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,r){return(this._opacity===void 0||e===void 0&&r===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=String(e)),r!==void 0&&(this._opacityWhenCovered=String(r)),this._map&&this._updateOpacity(!0),this}},T8={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},ny=0,Xm=!1,n0=class extends hf{},G2=class extends hf{},FS=class extends hf{},A8=class extends Nl{constructor(e){super(),this._onSuccess=r=>{if(this._map){if(this._isOutOfMapMaxBounds(r)){this._setErrorState(),this.fire(new G2("outofmaxbounds",r)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=r,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(r),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(r),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new G2("geolocate",r)),this._finish()}},this._updateCamera=r=>{let t=new An(r.coords.longitude,r.coords.latitude),i=r.coords.accuracy,a=this._map.getBearing(),o=yn({bearing:a},this.options.fitBoundsOptions),s=bh.fromLngLat(t,i);this._map.fitBounds(s,o,{geolocateSource:!0})},this._updateMarker=r=>{if(r){let t=new An(r.coords.longitude,r.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=r.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=r=>{if(this._map){if(r.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(r.code===3&&Xm)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new FS("error",r)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=r=>{if(!this._map)return;let t=r?.[0]instanceof ResizeObserverEntry;!r.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!t&&!this._map.isZooming()&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new n0("trackuserlocationend")),this.fire(new n0("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",r=>{r.preventDefault()}),this._geolocateButton=$n.create("button","maplibregl-ctrl-geolocate",this._container),$n.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=r=>{if(this._map){if(r===!1){To("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=$n.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new V2({element:this._dotElement}),this._circleElement=$n.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new V2({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=yn({},T8,e)}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),Tse().then(r=>this._finishSetupUI(r)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,ny=0,Xm=!1}_isOutOfMapMaxBounds(e){let r=this._map.getMaxBounds(),t=e.coords;return r&&(t.longituder.getEast()||t.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":break;case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let e=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!e)return;let r=this._map.project(e),t=this._map.unproject([r.x+100,r.y]),i=e.distanceTo(t)/100,a=2*this._accuracy/i;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return To("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new n0("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ny--,Xm=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new n0("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new n0("trackuserlocationstart")),this.fire(new n0("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ny++;let e;ny>1?(e={maximumAge:6e5,timeout:0},Xm=!0):(e=this.options.positionOptions,Xm=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},M8={maxWidth:100,unit:"metric"},S8=class{constructor(e){this._onMove=()=>{Wz(this._map,this._container,this.options)},this.setUnit=r=>{this.options.unit=r,Wz(this._map,this._container,this.options)},this.options=Ot(Ot({},M8),e)}getDefaultPosition(){return"bottom-left"}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-scale",e.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},H2=class extends hf{},E8=class extends Nl{constructor(e={}){var r;super(),this._onFullscreenChange=()=>{var t;let i=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;(t=i?.shadowRoot)!=null&&t.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=(r=e.pseudo)!=null?r:!1,e?.container&&(e.container instanceof HTMLElement?this._container=e.container:To("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=$n.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);$n.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new H2("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new H2("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},k8=class{constructor(e){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=e}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=$n.create("button","maplibregl-ctrl-terrain",this._container),$n.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},C8=class{constructor(){this._toggleProjection=()=>{var e;let r=(e=this._map.getProjection())==null?void 0:e.type;r==="mercator"||!r?this._map.setProjection({type:"globe"}):this._map.setProjection({type:"mercator"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var e;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((e=this._map.getProjection())==null?void 0:e.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(e){return this._map=e,this._container=$n.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=$n.create("button","maplibregl-ctrl-globe",this._container),$n.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},D8={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},L8=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),$2=class extends hf{},F8=class extends Nl{constructor(e){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new $2("close"))),this),this._update=r=>{let t=this._lngLat||this._trackPointer;if(!this._map||!t||!this._content)return;if(!this._container){if(this._container=$n.create("div","maplibregl-popup",this._map.getContainer()),this._tip=$n.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let n of this.options.className.split(" "))this._container.classList.add(n);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=Hz(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer);let i;if(r&&"point"in r&&r.point&&(i=r.point),this._trackPointer&&!i)return;let a=this._flatPos=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&i?i:this._map._camera.transform.locationToScreenPoint(this._lngLat));let o=this.options.anchor,s=Yz(this.options.offset);if(!o){let n=this._container.offsetWidth,u=this._container.offsetHeight,c=kse(this.options.padding),f;f=a.y+s.bottom.ythis._map._camera.transform.height-u-c.bottom?["bottom"]:[],a.xthis._map._camera.transform.width-n/2-c.right&&f.push("right"),o=f.length===0?"bottom":f.join("-")}let l=a.add(s[o]);this.options.subpixelPositioning||(l=l.round()),this._container.style.transform=`${q2[o]} translate(${l.x}px,${l.y}px)`,$z(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=yn(Object.create(D8),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new $2("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=An.convert(e),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let r=document.createDocumentFragment(),t=document.createElement("body"),i;for(t.innerHTML=e;i=t.firstChild,i;)r.appendChild(i);return this.setDOMContent(r)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=$n.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){return this._container&&this._container.classList.add(e),this}removeClassName(e){return this._container&&this._container.classList.remove(e),this}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}setSubpixelPositioning(e){this.options.subpixelPositioning=e}setPadding(e){this.options.padding=e,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=$n.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(L8);e&&e.focus()}},P8=vM}}),jse=de({"build/maplibre_worker.js"(e,r){"use strict";r.exports='var t1=Object.defineProperty,e1=Object.defineProperties;var r1=Object.getOwnPropertyDescriptors;var nh=Object.getOwnPropertySymbols;var i1=Object.prototype.hasOwnProperty,n1=Object.prototype.propertyIsEnumerable;var ah=(t,e,r)=>e in t?t1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,je=(t,e)=>{for(var r in e||(e={}))i1.call(e,r)&&ah(t,r,e[r]);if(nh)for(var r of nh(e))n1.call(e,r)&&ah(t,r,e[r]);return t},Si=(t,e)=>e1(t,r1(e));var rt=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())});var a1=Object.create,ep=Object.defineProperty,s1=Object.getOwnPropertyDescriptor,o1=Object.getOwnPropertyNames,l1=Object.getPrototypeOf,rp=Object.prototype.hasOwnProperty,fl=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),u1=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=o1(e),a=0,s=n.length,o;ae[l]).bind(null,o),enumerable:!(i=s1(e,o))||i.enumerable});return t},h1=(t,e,r)=>(r=t==null?{}:a1(l1(t)),u1(e||!t||!t.__esModule||!rp.call(t,"default")?ep(r,"default",{value:t,enumerable:!0}):r,t));function B(t,e){this.x=t,this.y=e}B.prototype={clone(){return new B(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){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},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){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(t){if(t instanceof B)return t;if(Array.isArray(t))return new B(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new B(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};function c1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Nn;function p1(){return Nn!=null||(Nn=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Nn}var Un;function f1(){if(Un==null&&(Un=!1,p1())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){Un=!0;break}}}return Un||!1}var pe=typeof Float32Array<"u"?Float32Array:Array;Math.PI/180,180/Math.PI;function d1(){var t=new pe(9);return pe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function ip(){var t=new pe(3);return pe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function y1(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function sh(t,e,r){var i=new pe(3);return i[0]=t,i[1]=e,i[2]=r,i}function m1(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function g1(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ks(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var x1=y1;(function(){var t=ip();return function(e,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function w1(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=v1();return function(e,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function _1(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var lh=b1;(function(){var t=ip(),e=sh(1,0,0),r=sh(0,1,0);return function(i,n,a){var s=g1(n,a);return s<-.999999?(ks(t,e,n),x1(t)<1e-6&&ks(t,r,n),m1(t,t),D1(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(ks(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,lh(i,i))}})(),(function(){var t=oh(),e=oh();return function(r,i,n,a,s,o){return Ts(t,i,s,o),Ts(e,n,a,o),Ts(r,t,e,2*o*(1-o)),r}})(),(function(){var t=d1();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],lh(e,_1(e,t))}})();function A1(){var t=new pe(2);return pe!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=A1();return function(e,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function E1(t,e,r,i){return c1(t,e,r,i)}var d5=E1(.25,.1,.25,1);function Ji(t,e,r){return Math.min(r,Math.max(e,t))}function F1(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Gt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function k1(t){return Math.log(t)/Math.LN2%1==0}function Ia(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function T1(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function He(t){return Array.isArray(t)?t.map(He):typeof t=="object"&&t?Ia(t,He):t}var uh={};function Bt(t){uh[t]||(typeof console<"u"&&console.warn(t),uh[t]=!0)}function Ke(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}function Ca(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function I1(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}function C1(t,e,r,i,n){return rt(this,null,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(t,{timestamp:0});try{let s=a==null?void 0:a.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(yield a.copyTo(l,I1(t,e,r,i,n)),o)for(let u=0;u{t.removeEventListener(e,r,i)}}}function ch(t){return t*Math.PI/180}var ph="AbortError",dl=class extends Error{constructor(t=ph){super(t instanceof Error?t.message:t),this.name=ph,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function yl(t){return t instanceof Error&&t.name==="AbortError"}function B1(t){if(t.aborted)throw new dl(t.reason)}var ml={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function P1(t){return ml.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function sp(t,e){ml.REGISTERED_PROTOCOLS[t]=e}function op(t){delete ml.REGISTERED_PROTOCOLS[t]}var fh="global-dispatcher",ya=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function lp(){var t;if(mr(self))return(t=self.worker)==null?void 0:t.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch(e){}return window.location.href}var z1=t=>{var e;return t.startsWith("file:")||((e=lp())==null?void 0:e.startsWith("file:"))&&!/^\\w+:/.test(t)};function L1(t,e){return rt(this,null,function*(){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:lp(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=yield fetch(r)}catch(s){throw yl(s)?s:new ya(0,Ki(s).message,t.url,new Blob)}if(!i.ok){let s=yield i.blob();throw new ya(i.status,i.statusText,t.url,s)}let n;n=t.type==="arrayBuffer"||t.type==="image"?i.arrayBuffer():t.type==="json"?i.json():i.text();let a=yield n;return B1(e.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}})}function V1(t,e){return new Promise((r,i)=>{var a;let n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(n.responseType="arraybuffer");for(let s in t.headers)n.setRequestHeader(s,t.headers[s]);t.type==="json"&&(n.responseType="text",(a=t.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=t.credentials==="include",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let s=n.response;if(t.type==="json")try{s=JSON.parse(n.response)}catch(o){i(o);return}r({data:s,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let s=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new ya(n.status,n.statusText,t.url,s))}},e.signal.addEventListener("abort",()=>{n.abort(),i(new dl(e.signal.reason))}),n.send(t.body)})}var Ma=function(t,e){return rt(this,null,function*(){var r,i;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=P1(t.url);if(n){let a=yield n(t,e);return!a.data&&t.type==="arrayBuffer"?Gt(a,{data:new ArrayBuffer(0)}):a}if(mr(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:fh},e)}if(!z1(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return L1(t,e);if(mr(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:fh},e)}return V1(t,e)})},up=(t,e)=>Ma(Gt(t,{type:"json"}),e),hp=(t,e)=>Ma(Gt(t,{type:"arrayBuffer"}),e);function dh(t,e,r){var i;(i=r[t])!=null&&i.includes(e)||(r[t]||(r[t]=[]),r[t].push(e))}function Is(t,e,r){if(r!=null&&r[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var cp=class{constructor(t,e={}){Gt(this,e),this.type=t}},ma=class extends cp{constructor(t,e={}){super("error",Gt({error:t},e))}},O1=class{on(t,e){return this._listeners||(this._listeners={}),dh(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Is(t,e,this._listeners),Is(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),dh(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){var n,a,s,o,l,u;let r=typeof t=="string"?new cp(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let h=(s=(a=(n=this._listeners)==null?void 0:n[i])==null?void 0:a.slice())!=null?s:[];for(let f of h)f.call(this,r);let c=(u=(l=(o=this._oneTimeListeners)==null?void 0:o[i])==null?void 0:l.slice())!=null?u:[];for(let f of c)Is(i,f,this._oneTimeListeners),f.call(this,r);let p=this._eventedParent;p&&(Gt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(r))}else r instanceof ma&&console.error(r.error);return this}listens(t){var e,r,i,n,a;return!!((r=(e=this._listeners)==null?void 0:e[t])!=null&&r.length||(n=(i=this._oneTimeListeners)==null?void 0:i[t])!=null&&n.length||(a=this._eventedParent)!=null&&a.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},pp={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},w=pp,fp=["type","source","source-layer","minzoom","maxzoom","filter","layout"],E=class{constructor(t,e,r,i,n="error"){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},dn={kind:"null"},I={kind:"number"},Y={kind:"string"},tt={kind:"boolean"},ce={kind:"color"},Ba={kind:"projectionDefinition"},fr={kind:"object"},Z={kind:"value"},R1={kind:"error"},Pa={kind:"collator"},yn={kind:"formatted"},za={kind:"padding"},Qi={kind:"colorArray"},La={kind:"numberArray"},mn={kind:"resolvedImage"},Va={kind:"variableAnchorOffsetCollection"};function Ut(t,e){return{kind:"array",itemType:t,N:e}}function yt(t){if(t.kind==="array"){let e=yt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}var $1=[dn,I,Y,tt,ce,Ba,yn,fr,Ut(Z),za,La,Qi,mn,Va];function tn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of $1)if(!tn(r,e))return null}}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function gl(t,e){return e.some(r=>r.kind===t.kind)}function dr(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Ge(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var dp=.96422,yp=.82521,mp=4/29,Ks=6/29,gp=3*Ks*Ks,N1=Math.PI/180,U1=180/Math.PI;function xp(t){return t%=360,t<0&&(t+=360),t}function vp([t,e,r,i]){t=Cs(t),e=Cs(e),r=Cs(r);let n,a,s=Ms((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Ms((.4360747*t+.3850649*e+.1430804*r)/dp),a=Ms((.0139322*t+.0971045*e+.7141733*r)/yp));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Cs(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ms(t){return t>.008856451679035631?t**(1/3):t/gp+mp}function bp([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*Ps(n),a=dp*Ps(a),s=yp*Ps(s),[Bs(3.1338561*a-1.6168667*n-.4906146*s),Bs(-.9787684*a+1.9161415*n+.033454*s),Bs(.0719453*a-.2289914*n+1.4052427*s),i]}function Bs(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Ps(t){return t>Ks?t*t*t:gp*(t-mp)}function q1(t){let[e,r,i,n]=vp(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?xp(Math.atan2(i,r)*U1):NaN,a,e,n]}function j1([t,e,r,i]){return t=isNaN(t)?0:t*N1,bp([r,Math.cos(t)*e,Math.sin(t)*e,i])}function G1([t,e,r,i]){t=xp(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var X1=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ji(t,e){return X1(t,e)?t[e]:void 0}function Y1(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=ji(W1,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+i)||"ff")]}if(t.startsWith("rgb")){let i=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||" ",h||" ",f].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[s,u,p].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let v=[Rr(+a/x,0,1),Rr(+l/x,0,1),Rr(+c/x,0,1),d?yh(+d,y):1];if(mh(v))return v}}return}}let r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||" ",o||" ",u].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){let f=[+n,Rr(+s,0,100),Rr(+l,0,100),h?yh(+h,c):1];if(mh(f))return G1(f)}}}function qn(t){return parseInt(t.padEnd(2,t),16)/255}function yh(t,e){return Rr(e?t/100:t,0,1)}function Rr(t,e,r){return Math.min(Math.max(e,t),r)}function mh(t){return!t.some(Number.isNaN)}var W1={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],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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],rebeccapurple:[102,51,153],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]};function Je(t,e,r){return t+r*(e-t)}function ti(t,e,r){return t.map((i,n)=>Je(i,e[n],r))}function Z1(t){return t==="rgb"||t==="hcl"||t==="lab"}var Pt,gt=(Pt=class{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,r,i,n]))}static parse(e){if(e instanceof Pt)return e;if(typeof e!="string")return;let r=Y1(e);if(r)return new Pt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter("hcl",q1(this.rgb))}get lab(){return this.overwriteGetter("lab",vp(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(",")},${n})`}static interpolate(e,r,i,n="rgb"){switch(n){case"rgb":{let[a,s,o,l]=ti(e.rgb,r.rgb,i);return new Pt(a,s,o,l,!1)}case"hcl":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u180&&(v+=360),f=a+i*v}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=j1([f,d!=null?d:Je(s,h,i),Je(o,c,i),Je(l,p,i)]);return new Pt(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=bp(ti(e.lab,r.lab,i));return new Pt(a,s,o,l,!1)}}}},Pt.black=new Pt(0,0,0,1),Pt.white=new Pt(1,1,1,1),Pt.transparent=new Pt(0,0,0,0),Pt.red=new Pt(1,0,0,1),Pt),H1=["bottom","center","top"],Js=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},ze=class la{constructor(e){this.sections=e}static fromString(e){return new la([new Js(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof la?e:la.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Ae=class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Li(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Li(ti(e.values,r.values,i))}},Se=class Vi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vi)return e;if(typeof e=="number")return new Vi([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new Vi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Vi(ti(e.values,r.values,i))}},oe=class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(typeof e=="string"){let i=gt.parse(e);return i?new Oi([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!="string")return;let n=gt.parse(i);if(!n)return;r.push(n)}return new Oi(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n="rgb"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?i===void 0||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[t,e,r,i]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function ei(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Dr||t instanceof gt||t instanceof xl||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e)return!0;if(Array.isArray(t)){for(let e of t)if(!ei(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!ei(t[e]))return!1;return!0}return!1}function _t(t){if(t===null)return dn;if(typeof t=="string")return Y;if(typeof t=="boolean")return tt;if(typeof t=="number")return I;if(t instanceof gt)return ce;if(t instanceof Dr)return Ba;if(t instanceof xl)return Pa;if(t instanceof ze)return yn;if(t instanceof Ae)return za;if(t instanceof Se)return La;if(t instanceof oe)return Qi;if(t instanceof De)return Va;if(t instanceof _e)return mn;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=_t(i);if(!r)r=n;else{if(r===n)continue;r=Z;break}}return Ut(r||Z,e)}return fr}function Gi(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof gt||t instanceof Dr||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e?t.toString():JSON.stringify(t)}var ri=class _p{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i),a=r.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new _p(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},J1=["Unknown","Point","LineString","Polygon"],Ap=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?J1[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=gt.parse(t),this._parseColorCache.set(t,e)),e}};function Oa(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||ee)a=s-1;else throw new ft("Input is not a number.",r);return 0}var vl=class Sp{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let s=1;s=o)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new Sp(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[Oa(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Q1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var be=class Qs{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name==="exponential")a=zs(r,e.base,i,n);else if(e.name==="linear")a=zs(r,1,i,n);else if(e.name==="cubic-bezier"){let s=e.controlPoints;a=Q1(s[0],s[1],s[2],s[3])(zs(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,I),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Qi?l=ce:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u=h)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!Ge(l,I)&&!Ge(l,Ba)&&!Ge(l,ce)&&!Ge(l,za)&&!Ge(l,La)&&!Ge(l,Qi)&&!Ge(l,Va)&&!Ge(l,Ut(I))?r.error(`Type ${yt(l)} is not interpolatable.`):new Qs(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=Oa(r,n,this.key),o=r[s],l=r[s+1],u=Qs.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Je(h,c,u);case"color":return gt.interpolate(h,c,u);case"padding":return Ae.interpolate(h,c,u);case"colorArray":return oe.interpolate(h,c,u);case"numberArray":return Se.interpolate(h,c,u);case"variableAnchorOffsetCollection":return De.interpolate(h,c,u,this.key);case"array":return ti(h,c,u);case"projectionDefinition":return Dr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"hcl");case"colorArray":return oe.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"lab");case"colorArray":return oe.interpolate(h,c,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function zs(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var gr={color:gt.interpolate,number:Je,padding:Ae.interpolate,numberArray:Se.interpolate,colorArray:oe.interpolate,variableAnchorOffsetCollection:De.interpolate,array:ti},Ep=class Fp{constructor(e){this.type=yn,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return r.error("First argument must be an image or text section.");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o=="object"&&!Array.isArray(o)){a=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,I),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,Ut(Y)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,ce),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!H1.includes(o["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${o["vertical-align"]}\' instead.`);if(c=r.parse(o["vertical-align"],1,Y),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,Z);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Fp(n)}evaluate(e){return new ze(this.sections.map(r=>{let i=r.content.evaluate(e);return _t(i)===mn?new Js("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Js(Gi(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function kp(t,e,r=0,i=t.length-1,n=t0){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);kp(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(ki(t,r,e),n(t[i],a)>0&&ki(t,r,i);s0;)o--}n(t[r],a)===0?ki(t,r,o):(o++,ki(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function ki(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function t0(t,e){return te)}function Ra(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=r0(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a2){let u=e[1];if(typeof u!="string"||!(u in jn)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);o=jn[u],i++}else o=Z;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],i++}n=Ut(o,l)}else{if(!jn[a])throw Error(`Types doesn\'t contain name = ${a}`);n=jn[a]}let s=[];for(;ie.outputDefined())}},gh={"to-boolean":tt,"to-color":ce,"to-number":I,"to-string":Y},jr=class Ip{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[0];if(!gh[i])throw Error(`Can\'t parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return r.error("Expected one argument.");let n=gh[i],a=[];for(let s=1;s4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Dp(r[0],r[1],r[2],r[3]),!i))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ft(i||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(e);let n=Ae.parse(r);if(n)return n}throw new ft(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=Se.parse(r);if(n)return n}throw new ft(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=oe.parse(r);if(n)return n}throw new ft(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(e);let n=De.parse(r);if(n)return n}throw new ft(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"number":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new ft(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return ze.fromString(Gi(this.args[0].evaluate(e)));case"resolvedImage":return _e.fromString(Gi(this.args[0].evaluate(e)));case"projectionDefinition":{let r=this.args[0].evaluate(e);if(Dr.parse(r))return r;throw new ft(`Could not parse projectionDefinition from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}default:return Gi(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Cp=class Mp{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a=i.length)throw new ft(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new ft(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},n0=class Lp{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=tt}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);return!i||!n?null:gl(i.type,[tt,Y,I,dn,Z])?new Lp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);if(!dr(i,["string","array"]))throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},a0=class to{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=I}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);if(!i||!n)return null;if(!gl(i.type,[tt,Y,I,dn,Z]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new to(i,n,r.key,a):null}return new to(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),dr(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(dr(i,["array"]))return i.indexOf(r,n);throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},s0=class Vp{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let i,n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let a={},s=[];for(let u=2;u2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d=="number"&&Math.floor(d)!==d)return p.error("Numeric branch labels must be integer values.");if(!i)i=_t(d);else if(p.checkSubtype(i,_t(d)))return null;if(a[String(d)]!==void 0)return p.error("Branch labels must be unique.");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(e[1],1,Z);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!=="value"&&r.concat(1).checkSubtype(i,o.type)?null:new Vp(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(_t(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},o0=class Op{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let n=[];for(let s=1;sr.outputDefined())&&this.otherwise.outputDefined()}},l0=class eo{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,I);if(!i||!n)return null;if(!gl(i.type,[Ut(Z),Y,Z]))return r.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new eo(i.type,i,n,r.key,a):null}return new eo(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),dr(r,["string"]))return[...r].slice(i,n).join("");if(dr(r,["array"]))return r.slice(i,n);throw new ft(`Expected first argument to be of type array or string, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Rp=class ro{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=null,n=r.expectedType;n&&n.kind!=="value"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>tn(n,s.type))?new ro(Z,a):new ro(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof _e&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function xh(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function u0(t,e,r){return e===r}function h0(t,e,r){return e!==r}function c0(t,e,r){return er}function f0(t,e,r){return e<=r}function d0(t,e,r){return e>=r}function $p(t,e,r,i){return i.compare(e,r)===0}function y0(t,e,r,i){return!$p(t,e,r,i)}function m0(t,e,r,i){return i.compare(e,r)<0}function g0(t,e,r,i){return i.compare(e,r)>0}function x0(t,e,r,i){return i.compare(e,r)<=0}function v0(t,e,r,i){return i.compare(e,r)>=0}function li(t,e,r){let i=t!=="=="&&t!=="!=";return class Np{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=tt,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let o=a[0],l=s.parse(a[1],1,Z);if(!l)return null;if(!xh(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type \'${yt(l.type)}\'.`);let u=s.parse(a[2],2,Z);if(!u)return null;if(!xh(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type \'${yt(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types \'${yt(l.type)}\' and \'${yt(u.type)}\'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ie(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ie(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Pa),!h)return null}return new Np(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new ft(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!=="string"||u.kind!=="string")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var b0=li("==",u0,$p),w0=li("!=",h0,y0),D0=li("<",c0,m0),_0=li(">",p0,g0),A0=li("<=",f0,x0),S0=li(">=",d0,v0),Up=class qp{constructor(e,r,i){this.type=Pa,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return r.error("Collator options argument must be an object.");let n=r.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,tt);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,tt);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,Y),!s)?null:new qp(n,a,s)}evaluate(e){return new xl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},E0=class jp{constructor(e,r,i,n,a,s){this.type=Y,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=r.parse(n.locale,1,Y),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,Y),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,Y),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=r.parse(n["min-fraction-digits"],1,I),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,I),!u)?null:new jp(i,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},F0=class Gp{constructor(e){this.type=mn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let i=r.parse(e[1],1,Y);return i?new Gp(i):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),i=_e.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},k0=class Xp{constructor(e,r){this.input=e,this.key=r,this.type=I}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Xp(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ft(`Expected value to be of type string or array, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},we=8192;function T0(t,e){let r=I0(t[0]),i=M0(t[1]),n=2**e.z;return[Math.round(r*n*we),Math.round(i*n*we)]}function bl(t,e){let r=2**e.z,i=(t[0]/we+e.x)/r,n=(t[1]/we+e.y)/r;return[C0(i),B0(n)]}function I0(t){return(180+t)/360}function C0(t){return t*360-180}function M0(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function B0(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function gn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function en(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function P0(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function z0(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function $a(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return R0([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(vh(t,e,r,i)&&vh(r,i,t,e))}function L0(t,e,r){for(let i of r)for(let n=0;n0&&c<0||h<0&&c>0}function wl(t,e,r){let i=[];for(let n=0;nr[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}gn(e,t)}function $0(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function bh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Zp(u,e,r,n),s.push(u)}return s}function wh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){$0(e);for(let o of s)for(let l of o)Zp(l,e,r,n)}return s}function N0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!ui(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!V0(o,a))return!1}return!0}function U0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!Yp(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!O0(o,a))return!1}return!0}var Dl=class ha{constructor(e,r){this.type=tt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s==="Polygon"&&n.push(o),s==="MultiPolygon"&&n.push(...o)}if(n.length)return new ha(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new ha(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new ha(i,i)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return N0(e,this.geometries);if(e.geometryType()==="LineString")return U0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Hp=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}},Dh=Math.PI/180,_l=class{constructor(t){let e=Dh*6378.137*1e3,r=Math.cos(t*Dh),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f180;)t-=360;return t}};function Kp(t,e){return e[0]-t[0]}function ga(t){return t[1]-t[0]+1}function Le(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];let r=ga(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function no(t,e){if(!Le(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)gn(r,t[i]);return r}function ao(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)gn(e,i);return e}function _h(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Al(t,e,r){if(!_h(t)||!_h(e))return NaN;let i=0,n=0;return t[2]e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]=i)return i;if(en(n,a)){if(Ah(t,e))return 0}else if(Ah(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(ga(u)<=h){if(!Le(u,t.length))return NaN;if(e){let c=X0(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=G0(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=io(u,e);Sh(s,a,i,t,o,c[0]),Sh(s,a,i,t,o,c[1])}}return a}function va(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new Hp([[0,[0,t.length-1],[0,r.length-1]]],Kp);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(ga(u)<=c&&ga(h)<=p){if(!Le(u,t.length)&&Le(h,r.length))return NaN;let f;if(e&&i)f=q0(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=hr(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=hr(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=j0(t,u,r,h,n),s=Math.min(s,f)}else{let f=io(u,e),d=io(h,i);Gn(o,s,n,t,r,f[0],d[0]),Gn(o,s,n,t,r,f[0],d[1]),Gn(o,s,n,t,r,f[1],d[0]),Gn(o,s,n,t,r,f[1],d[1])}}return s}function W0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function Z0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function H0(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Ra(r,0).map(s=>s.map(o=>o.map(l=>bl([l.x,l.y],t.canonical)))),n=new _l(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case"Point":a=Math.min(a,xa([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,xa(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,Y0(o,s.coordinates,n,a))}if(a===0)return a}return a}function Ls(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var El=class ca{constructor(e,r){this.type=I,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new ca(i,i.features.map(n=>Ls(n.geometry)).flat());if(i.type==="Feature")return new ca(i,Ls(i.geometry));if("type"in i&&"coordinates"in i)return new ca(i,Ls(i))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W0(e,this.geometries);if(e.geometryType()==="LineString")return Z0(e,this.geometries);if(e.geometryType()==="Polygon")return H0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},K0=class Jp{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=Z;break}this.type=Ut(r!=null?r:Z,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`\'semiliteral\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,Z));return new Jp(a)}return new ri(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},Fl=class Qp{constructor(e){this.key=e,this.type=Z}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error("Global state property must be defined."):typeof i=="string"?new Qp(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){var i,n;let r=(i=e.globals)==null?void 0:i.globalState;return!r||Object.keys(r).length===0?null:(n=ji(r,this.key))!=null?n:null}eachChild(){}outputDefined(){return!1}},Yr={"==":b0,"!=":w0,">":_0,"<":D0,">=":S0,"<=":A0,array:Ie,at:i0,boolean:Ie,case:o0,coalesce:Rp,collator:Up,format:Ep,image:F0,in:n0,"index-of":a0,interpolate:be,"interpolate-hcl":be,"interpolate-lab":be,length:k0,let:Cp,literal:ri,match:s0,number:Ie,"number-format":E0,object:Ie,semiliteral:K0,slice:l0,step:vl,string:Ie,"to-boolean":jr,"to-color":jr,"to-number":jr,"to-string":jr,var:Bp,within:Dl,distance:El,"global-state":Fl},ve=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},J0=class tf{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new tf(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},ef=class rf{constructor(e,r,i=[],n,a=new J0,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);let i=this.key;function n(a,s,o){return o==="assert"?new Ie(s,[a],i):o==="coerce"?new jr(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let a=e[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=n(o,l,r.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=n(o,l,r.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof ri)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new Ap;try{o=new ri(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return e===void 0?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e=="number"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new rf(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join("")}`;this.errors.push(new ve(i,e))}checkSubtype(e,r){let i=tn(e,r);return i&&this.error(i),i}},_r=class Ri{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Ri.definitions[i];if(!n)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new ef(r.registry,ba,r.path,null,r.scope);let c=[],p=!1;for(let f=1;ftm(c)).join(" | "),h=[];for(let c=1;c>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function sr(t){return{type:t}}_r.register(Yr,{error:[R1,[Y],(t,[e],r)=>{throw new ft(e.evaluate(t),r)}],typeof:[Y,[Z],(t,[e])=>yt(_t(e.evaluate(t)))],"to-rgba":[Ut(I,4),[ce],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[ce,[I,I,I],Eh],rgba:[ce,[I,I,I,I],Eh],has:{type:tt,overloads:[[[Y],(t,[e])=>Fh(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Fh(e.evaluate(t),r.evaluate(t))]]},get:{type:Z,overloads:[[[Y],(t,[e])=>Vs(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Vs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Z,[Y],(t,[e])=>Vs(e.evaluate(t),t.featureState||{})],properties:[fr,[],t=>t.properties()],"geometry-type":[Y,[],t=>t.geometryType()],id:[Z,[],t=>t.id()],zoom:[I,[],t=>t.globals.zoom],"heatmap-density":[I,[],t=>t.globals.heatmapDensity||0],elevation:[I,[],t=>t.globals.elevation||0],"line-progress":[I,[],t=>t.globals.lineProgress||0],accumulated:[Z,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[I,sr(I),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],"*":[I,sr(I),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],"-":{type:I,overloads:[[[I,I],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[I],(t,[e])=>-e.evaluate(t)]]},"/":[I,[I,I],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[I,[I,I],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[I,[I],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[I,[I],(t,[e])=>Math.log(e.evaluate(t))],log2:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[I,[I],(t,[e])=>Math.sin(e.evaluate(t))],cos:[I,[I],(t,[e])=>Math.cos(e.evaluate(t))],tan:[I,[I],(t,[e])=>Math.tan(e.evaluate(t))],asin:[I,[I],(t,[e])=>Math.asin(e.evaluate(t))],acos:[I,[I],(t,[e])=>Math.acos(e.evaluate(t))],atan:[I,[I],(t,[e])=>Math.atan(e.evaluate(t))],min:[I,sr(I),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[I,sr(I),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[I,[I],(t,[e])=>Math.abs(e.evaluate(t))],round:[I,[I],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[I,[I],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[I,[I],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[tt,[Y,Z],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[tt,[Z],(t,[e])=>t.id()===e.value],"filter-type-==":[tt,[Y],(t,[e])=>t.geometryType()===e.value],"filter-<":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i{let r=t.id(),i=e.value;return typeof r==typeof i&&r":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[tt,[Z],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[tt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[tt,[Ut(Y)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[tt,[Ut(Z)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[tt,[Y,Ut(Z)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[tt,[Y,Ut(Z)],(t,[e,r])=>Q0(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[tt,[tt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[tt,[Y],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Y,[Y],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Y,[Y],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Y,sr(Z),(t,e)=>e.map(r=>Gi(r.evaluate(t))).join("")],split:[Ut(Y),[Y,Y],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[Y,[Ut(Y),Y],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[Y,[Pa],(t,[e])=>e.evaluate(t).resolvedLocale()]});function tm(t){return Array.isArray(t)?`(${t.map(yt).join(", ")})`:`(${yt(t.type)}...)`}function ba(t){if(t instanceof Bp)return ba(t.boundExpression);if(t instanceof _r&&t.name==="error"||t instanceof Up||t instanceof Dl||t instanceof El||t instanceof Fl)return!1;let e=t instanceof jr||t instanceof Ie,r=!0;return t.eachChild(i=>{r&&(r=e?ba(i):i instanceof ri)}),r?Na(t)&&Ua(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Na(t){if(t instanceof _r&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Dl||t instanceof El)return!1;let e=!0;return t.eachChild(r=>{e&&!Na(r)&&(e=!1)}),e}function rn(t){if(t instanceof _r&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!rn(r)&&(e=!1)}),e}function Ua(t,e){if(t instanceof _r&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!Ua(i,e)&&(r=!1)}),r}function ii(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function nf(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function kl(t){return!!t.expression&&t.expression.interpolated}var Tl=/^(.*)-transition$/;function nn(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function Q(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function qa(t){return typeof t=="object"&&!!t&&!Array.isArray(t)&&_t(t)===fr}function em(t){return t}function rm(t){switch(t.type){case"color":return gt.parse;case"padding":return Ae.parse;case"numberArray":return Se.parse;case"colorArray":return oe.parse;default:return null}}function im(t){switch(t){case"exponential":return sf;case"interval":return am;case"categorical":return nm;case"identity":return sm;default:throw Error(`Unknown function type "${t}"`)}}function af(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",i=r||t.property!==void 0,n=r||!i,a=t.type||(kl(e)?"exponential":"interval"),s=rm(e);if(s&&(t=nn({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!Z1(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o=im(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;dd[0]),evaluate({zoom:d},y){return sf({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a==="exponential"?{name:"exponential",base:t.base===void 0?1:t.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:be.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?xn(t.default,e.default):o(t,e,p,l,u)}}}function xn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function nm(t,e,r,i,n){return xn(typeof r===n?i[r]:void 0,t.default,e.default)}function am(t,e,r){if(Q(r)!=="number")return xn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=Oa(t.stops.map(a=>a[0]),r,"");return t.stops[n][1]}function sf(t,e,r){let i=t.base===void 0?1:t.base;if(Q(r)!=="number")return xn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=Oa(t.stops.map(h=>h[0]),r,""),s=om(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=gr[e.type]||em;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function sm(t,e,r){switch(e.type){case"color":r=gt.parse(r);break;case"formatted":r=ze.fromString(r.toString());break;case"resolvedImage":r=_e.fromString(r.toString());break;case"padding":r=Ae.parse(r);break;case"colorArray":r=oe.parse(r);break;case"numberArray":r=Se.parse(r);break;default:Q(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return xn(r,t.default,e.default)}function om(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function so(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}var Il=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new Ap,this._defaultValue=r?pf(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ft(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(", ")}, but found ${JSON.stringify(s)} instead.`,"");return s}catch(s){let o=s instanceof ft?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(of(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function of(t,e,r,i){return`${t}${e}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function lf(t){if(!t)throw Error(\'rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".\')}function ja(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Yr}function er(t,e,r,i){lf(e);let n=new ef(Yr,ba,[],r?hm(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?so(new Il(a,e,r,i)):Nr(n.errors)}var an=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},wa=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?be.interpolationFactor(this.interpolationType,t,e,r):0}};function lm(t){return t._styleExpression!==void 0}function uf(t,e,r,i){let n=er(t,e,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Na(a);if(!s&&!ii(r))return Nr([new ve("","data expressions not supported")]);let o=Ua(a,["zoom"]);if(!o&&!nf(r))return Nr([new ve("","zoom expressions not supported")]);let l=pa(a);if(!l&&!o)return Nr([new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(l instanceof ve)return Nr([l]);if(l instanceof be&&!kl(r))return Nr([new ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!l)return so(s?new an("constant",n.value,i):new an("source",n.value,i));let u=l instanceof be?l.interpolation:void 0;return so(s?new wa("camera",n.value,l.labels,u,i):new wa("composite",n.value,l.labels,u,i))}var hf=class cf{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,lf(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=pf(i),this._warningHistory={};let n=af(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<"u"&&console.warn(of(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new cf(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function um(t,e,r,i){if(qa(t))return new hf(t,e,r);if(ja(t)){let n=uf(t,e,r,i);if(n.result==="error")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return n.value}{let n=t;return r.type==="color"&&typeof t=="string"?n=gt.parse(t):r.type==="padding"&&(typeof t=="number"||Array.isArray(t))?n=Ae.parse(t):r.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?n=Se.parse(t):r.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?n=oe.parse(t):r.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?n=De.parse(t):r.type==="projectionDefinition"&&typeof t=="string"&&(n=Dr.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function pa(t){let e=null;if(t instanceof Cp)e=pa(t.result);else if(t instanceof Rp){for(let r of t.args)if(e=pa(r),e)break}else(t instanceof vl||t instanceof be)&&t.input instanceof _r&&t.input.name==="zoom"&&(e=t);return e instanceof ve||t.eachChild(r=>{let i=pa(r);i instanceof ve?e=i:!e&&i?e=new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&i&&e!==i&&(e=new ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function vn(t,e=new Set){return t instanceof Fl&&e.add(t.key),t.eachChild(r=>{vn(r,e)}),e}function hm(t){let e={color:ce,string:Y,number:I,enum:Y,boolean:tt,formatted:yn,padding:za,numberArray:La,colorArray:Qi,projectionDefinition:Ba,resolvedImage:mn,variableAnchorOffsetCollection:Va};return t.type==="array"?Ut(e[t.value]||Z,t.length):e[t.type]}function pf(t){if(t.type==="color"&&qa(t.default))return new gt(0,0,0,0);switch(t.type){case"color":return gt.parse(t.default)||null;case"padding":return Ae.parse(t.default)||null;case"numberArray":return Se.parse(t.default)||null;case"colorArray":return oe.parse(t.default)||null;case"variableAnchorOffsetCollection":return De.parse(t.default)||null;case"projectionDefinition":return Dr.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ni(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=t!=null?t:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:e}}function cm(t){let e=!1;for(let r of t){let i=ff(r);if(i==="expression")return"expression";i==="legacy"&&(e=!0)}return e?"legacy":"neutral"}function ff(t){if(typeof t=="boolean")return"neutral";if(!Array.isArray(t)||t.length===0)return"legacy";switch(t[0]){case"has":return t.length<2||t[1]==="$id"||t[1]==="$type"?"legacy":t.length===2?"neutral":"expression";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return cm(t.slice(1));default:return"expression"}}function Cl(t){return ff(t)!=="legacy"}function kh(t){return t==="$type"?["geometry-type"]:t==="$id"?["id"]:["get",t]}function pm(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return t.length!==3||typeof t[1]!="string"?null:[t[0],kh(t[1]),t[2]];case"in":case"!in":{if(t.length<2||typeof t[1]!="string")return null;let e=["in",kh(t[1]),["literal",t.slice(2)]];return t[0]==="!in"?["!",e]:e}case"has":case"!has":{if(t.length!==2||typeof t[1]!="string"||t[1]==="$type"||t[1]==="$id")return null;let e=["has",t[1]];return t[0]==="!has"?["!",e]:e}default:return null}}function df(t){if((t[0]==="<"||t[0]==="<="||t[0]===">"||t[0]===">=")&&t[1]==="$type")return`"$type" cannot be use with operator "${t[0]}"`;let e=pm(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Os(t,e,r){let i=r[t];return Array.isArray(i)?Cl(i)?Ml(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Ml(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case"all":case"any":case"none":for(let r=1;r"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${e}${i}: ${df(r.legacyFilter)}`)}var dm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ai(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cl(t)?fm(t,e):t=Da(t);let i=er(t,e,dm,r);if(i.result==="error")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:yf(t),getGlobalStateRefs:()=>vn(i.value.expression)}}function ym(t,e){return te)}function yf(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Rs(t[1],t[2],e):e==="any"?mm(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Da)):e==="none"?["all"].concat(t.slice(1).map(Da).map(Xn)):e==="in"?Th(t[1],t.slice(2)):e==="!in"?Xn(Th(t[1],t.slice(2))):e==="has"?Ih(t[1]):e!=="!has"||Xn(Ih(t[1]))}function Rs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function mm(t){return["any"].concat(t.map(Da))}function Th(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(ym)]]:["filter-in-small",t,["literal",e]]}}function Ih(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Xn(t){return["!",t]}function mf(t){let e=t.key,r=t.value;return r?[new E(e,r,"constants have been deprecated as of v8")]:[]}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function xr(t){if(Array.isArray(t))return t.map(xr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=xr(t[r]);return e}return Dt(t)}function te(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=Q(r);if(u!=="object")return[new E(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=ji(i,c)||i["*"],f;if(ji(n,c))f=n[c];else if(ji(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new E(e,r[h],`unknown property "${h}"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new E(e,r,`missing required property "${h}"`));return l}function Bl(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(Q(e)!=="array")return[new E(s,e,`array expected, ${Q(e)} found`)];if(r.length&&e.length!==r.length)return[new E(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),Q(r.value)==="object"&&(l=r.value);let u=[];for(let h=0;hi.maximum?[new E(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new E(e,r,`number expected, ${n} found`)]}function gf(t){let e=t.valueSpec,r=Dt(t.value.type),i,n={},a,s,o=r!=="categorical"&&t.value.property===void 0,l=!o,u=Q(t.value.stops)==="array"&&Q(t.value.stops[0])==="array"&&Q(t.value.stops[0][0])==="object",h=te({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r==="identity"&&o&&h.push(new E(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&h.push(new E(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!kl(t.valueSpec)&&h.push(new E(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ii(t.valueSpec)?h.push(new E(t.key,t.value,"property functions not supported")):o&&!nf(t.valueSpec)&&h.push(new E(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&h.push(new E(t.key,t.value,\'"property" property is required\')),h;function c(y){if(r==="identity")return[new E(y.key,y.value,\'identity function may not have a "stops" property\')];let m=[],g=y.value;return m=m.concat(Bl({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),Q(g)==="array"&&g.length===0&&m.push(new E(y.key,g,"array must have at least one stop")),m}function p(y){let m=[],g=y.value,x=y.key;if(Q(g)!=="array")return[new E(x,g,`array expected, ${Q(g)} found`)];if(g.length!==2)return[new E(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(Q(g[0])!=="object")return[new E(x,g,`object expected, ${Q(g[0])} found`)];if(g[0].zoom===void 0)return[new E(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new E(x,g,"object stop key must have value")];if(s&&s>Dt(g[0].zoom))return[new E(x,g[0].zoom,"stop zoom values must appear in ascending order")];Dt(g[0].zoom)!==s&&(s=Dt(g[0].zoom),a=void 0,n={}),m=m.concat(te({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Ga,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return ja(xr(g[1]))?m.concat([new E(`${x}[1]`,g[1],"expressions are not allowed in function stops.")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=Q(y.value),x=Dt(y.value),v=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new E(y.key,v,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new E(y.key,v,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let b=`number expected, ${g} found`;return ii(e)&&r===void 0&&(b+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new E(y.key,v,b)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new E(y.key,v,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&xnew E(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new E(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ua(r,["zoom","feature-state"]))return[new E(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Na(r))return[new E(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gm(t){let e=t.value,r=t.key,i=Q(e);return i==="boolean"?[]:[new E(r,e,`boolean expected, ${i} found`)]}function oo(t){let e=t.key,r=t.value,i=Q(r);return i==="string"?gt.parse(String(r))?[]:[new E(e,r,`color expected, "${r}" found`)]:[new E(e,r,`color expected, ${i} found`)]}function sn(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function xm(t,e){let r=t;for(let i of e)r=r[i];return r}function vm(t,e){let r=Ml(e);return r?[new E(`${t.key}${r.path.map(i=>`[${i}]`).join("")}`,xm(t.value,r.path),df(r.legacyFilter),null,"warning")]:[]}function Pl(t){let e=xr(t.value);return Cl(e)?[...vm(t,e),...si(nn({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:xf(t)}function xf(t){let e=t.value,r=t.key;if(Q(e)!=="array")return[new E(r,e,`array expected, ${Q(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new E(r,e,"filter array must have at least 1 element")];switch(a=a.concat(sn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Dt(e[1])==="$type"&&a.push(new E(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new E(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Q(e[1]),n!=="string"&&a.push(new E(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s{c in r&&e.push(new E(i,r[c],`"${c}" is prohibited for ref layers`))});let h;n.layers.forEach(c=>{Dt(c.id)===o&&(h=c)}),h?h.ref?e.push(new E(i,r.ref,"ref cannot reference another ref layer")):s=Dt(h.type):e.push(new E(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)e.push(new E(i,r,\'missing required property "source"\'));else{let h=n.sources&&n.sources[r.source],c=h&&Dt(h.type);h?c==="vector"&&s==="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster source`)):c!=="raster-dem"&&s==="hillshade"||c!=="raster-dem"&&s==="color-relief"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster-dem source`)):c==="raster"&&s!=="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a vector source`)):c==="vector"&&!r["source-layer"]?e.push(new E(i,r,`layer "${r.id}" must specify a "source-layer"`)):c==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?e.push(new E(i,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):s==="line"&&r.paint&&r.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&e.push(new E(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new E(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&((l=r.paint)!=null&&l.resampling)&&((u=r.paint)!=null&&u["raster-resampling"])&&e.push(new E(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),e=e.concat(te({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Pl,layout(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return wf(nn({layerType:s},c))}}})},paint(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return bf(nn({layerType:s},c))}}})}}})),e}function tr(t){let e=t.value,r=t.key,i=Q(e);return i==="string"?[]:[new E(r,e,`string expected, ${i} found`)]}function bm(t){var c;let e=(c=t.sourceName)!=null?c:"",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=Q(r);if(r===void 0)return s;if(o!=="object")return s.push(new E("source_raster_dem",r,`object expected, ${o} found`)),s;let l=Dt(r.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let p in r)!l&&u.includes(p)?s.push(new E(p,r[p],`In "${e}": "${p}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):n[p]?s=s.concat(t.validateSpec({key:p,value:r[p],valueSpec:n[p],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new E(p,r[p],`unknown property "${p}"`));return s}var Ch={promoteId:wm};function _f(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new E(r,e,\'"type" is required\')];let s=Dt(e.type),o;switch(s){case"vector":case"raster":return o=te({key:r,value:e,valueSpec:i[`source_${s.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Ch,validateSpec:a}),o;case"raster-dem":return o=bm({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=te({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Ch}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...si({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:"cluster-map"})),o.push(...si({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return te({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return te({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new E(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function wm({key:t,value:e}){if(Q(e)==="string")return tr({key:t,value:e});{let r=[];for(let i in e)r.push(...tr({key:`${t}.${i}`,value:e[i]}));return r}}function Af(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("light",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(Tl);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)])}return a}function Sf(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=Q(e);if(e===void 0)return[];if(a!=="object")return[new E("sky",e,`object expected, ${a} found`)];let s=[];for(let o in e){let l=o.match(Tl);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,style:n,styleSpec:r})):i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new E(o,e[o],`unknown property "${o}"`)])}return s}function Ef(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("terrain",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)]);return a}function Dm(t){return tr(t).length===0?[]:si(t)}function _m(t){return tr(t).length===0?[]:si(t)}function Am(t){let e=t.key,r=t.value;if(Q(r)==="array"){if(r.length<1||r.length>4)return[new E(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a[new E(t,e,\'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"\')],n=r.match(Mm);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>Mh||u>Mh?[new E(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new E(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function Tf(t){var o,l;let e=(o=t.key)!=null?o:"font-faces",r=t.value,i=t.validateSpec,n=(l=t.styleSpec)!=null?l:pp,a=t.style;if(!lo(r))return[new E(e,r,`object expected, ${Q(r)} found`)];let s=[];for(let u in r){let h=r[u],c=Q(h);if(c==="string")s.push(...tr({key:`${e}.${u}`,value:h}));else if(c==="array"){let p={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[f,d]of h.entries()){let y=`${e}.${u}[${f}]`;s.push(...te({key:y,value:d,valueSpec:p,styleSpec:n,style:a,validateSpec:i}));let m=lo(d)?d["unicode-range"]:void 0;if(Q(m)==="array")for(let[g,x]of m.entries())s.push(...Bm(`${y}.unicode-range[${g}]`,x))}}else s.push(new E(`${e}.${u}`,h,`string or array expected, ${c} found`))}return s}var Bh={"*"(){return[]},array:Bl,boolean:gm,number:Ga,color:oo,constants:mf,enum:sn,filter:Pl,function:gf,layer:Df,object:te,source:_f,light:Af,sky:Sf,terrain:Ef,projection:km,projectionDefinition:Tm,string:tr,formatted:Dm,resolvedImage:_m,padding:Am,numberArray:Sm,colorArray:Em,variableAnchorOffsetCollection:Fm,sprite:Ff,state:kf,fontFaces:Tf};function Xi(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Xi,r.expression&&qa(Dt(e))?gf(t):r.expression&&ja(xr(e))?si(t):r.type&&Bh[r.type]?Bh[r.type](t):te(nn({},t,{valueSpec:r.type?i[r.type]:r}))}function If(t){let e=t.value,r=t.key,i=tr(t);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{range}" token\'))),i}function Qt(t,e=w){let r=[];return r=r.concat(Xi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xi,objectElementValidators:{glyphs:If,"*"(){return[]}}})),t.constants&&(r=r.concat(mf({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Xi}))),Cf(r)}Qt.source=ie(re(_f)),Qt.sprite=ie(re(Ff)),Qt.glyphs=ie(re(If)),Qt.fontFaces=ie(re(Tf)),Qt.light=ie(re(Af)),Qt.sky=ie(re(Sf)),Qt.terrain=ie(re(Ef)),Qt.state=ie(re(kf)),Qt.layer=ie(re(Df)),Qt.filter=ie(re(Pl)),Qt.paintProperty=ie(re(bf)),Qt.layoutProperty=ie(re(wf));function re(t){return function(e){return t(Object.assign({},e,{validateSpec:Xi}))}}function Cf(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function ie(t){return function(...e){return Cf(t.apply(this,e))}}var Pm={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"},zm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){var t;return(t=this._literalValue)!=null?t:this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none"){this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=er(t,this._rootKey,Pm,this._globalState);if(e.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=vn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Lm(t,e,r){return new zm(t,e,r)}var Ph=Qt,y5=new Set(Object.keys(w).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function Vm(t,e){let r=!1;for(let i of e){if(i.severity==="warning"){Bt(i.message);continue}t.fire(new ma(Error(i.message))),r=!0}return r}function Om(t,e,r,i){return(i==null?void 0:i.validate)!==!1&&Vm(t,e(je({styleSpec:w},r)))}var uo=class Mf{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if((!l||l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;sr?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}},$m="-transition",Xa=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=um(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},ho=class{constructor(t,e,r){this.property=t,this.value=new Xa(t,void 0,e,r)}transitioned(t,e){return new Lh(this.property,this.value,e,Gt({},t.transition,this.transition),t.now)}untransitioned(){return new Lh(this.property,this.value,null,{},0)}},Nm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return He(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Xa(this._values[t].property,e===null?void 0:He(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return He(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=He(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${$m}`]=i)}return t}transitioned(t,e){let r=new Vh(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Vh(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Lh=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(ii.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Lf=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new st(Math.floor(e.zoom-1),e)),t.expression.evaluate(new st(Math.floor(e.zoom),e)),t.expression.evaluate(new st(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Wa=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},Xt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Xa(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new ho(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",N),C("DataConstantProperty",V),C("CrossFadedDataDrivenProperty",on),C("CrossFadedProperty",Lf),C("ColorRampProperty",Wa);var Rh=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",$s=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",de=class extends O1{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Lm(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=ai(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Um(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new Nm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=ai(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if(t==="visibility")return this.visibility;if((e=this._transitionablePaint)!=null&&e.hasProperty(t))throw Error(t+Rh);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var e;let t=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let i=this._transitionablePaint._values[r].value;for(let n of i.getGlobalStateRefs()){let a=(e=t.get(n))!=null?e:[];a.push({name:r,value:i.value}),t.set(n,a)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){var i;if(t==="visibility"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if((i=this._transitionablePaint)!=null&&i.hasProperty(t)){this.fire(new ma(Error(t+Rh)));return}e!=null&&this._validate(Ph.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,r;if(t.endsWith("-transition")){let i=t.slice(0,-11);if(i==="visibility"||(e=this._unevaluatedLayout)!=null&&e.hasProperty(i))throw Error(t+$s);return this._transitionablePaint.getTransition(i)}if(t==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(t))throw Error(t+$s);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){var i;if(t==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(t))return this.fire(new ma(Error(t+$s))),!1;if(e!=null&&this._validate(Ph.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let n=this._transitionablePaint._values[t],a=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let l=this._transitionablePaint._values[t].value;return l.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(t,o,l)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){var e,r;let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)==null?void 0:e.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),T1(t,(i,n)=>i!==void 0&&!(n==="layout"&&!Object.keys(i).length)&&!(n==="paint"&&!Object.keys(i).length))}_validate(t,e,r,i,n={}){return Om(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof se&&ii(e.property.specification)&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}},qm,jm=()=>qm||(qm=new Xt({"raster-opacity":new V(w.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new V(w.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new V(w.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new V(w.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new V(w.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new V(w.paint_raster["raster-contrast"],"raster-contrast"),resampling:new V(w.paint_raster.resampling,"resampling"),"raster-resampling":new V(w.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new V(w.paint_raster["raster-fade-duration"],"raster-fade-duration")})),Gm={get paint(){return jm()}};var Xm=class extends de{constructor(t,e){super(t,Gm,e)}},Ym={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},bn=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},xt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function At(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Wm(n.type),s=r=$h(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:$h(r,Math.max(i,e)),alignment:e}}function Wm(t){return Ym[t].BYTES_PER_ELEMENT}function $h(t,e){return Math.ceil(t/e)*e}var ln=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};ln.prototype.bytesPerElement=4,C("StructArrayLayout2i4",ln);var co=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};co.prototype.bytesPerElement=6,C("StructArrayLayout3i6",co);var Nh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Nh.prototype.bytesPerElement=8,C("StructArrayLayout4i8",Nh);var po=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};po.prototype.bytesPerElement=12,C("StructArrayLayout2i4i12",po);var fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};fo.prototype.bytesPerElement=8,C("StructArrayLayout2i4ub8",fo);var un=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};un.prototype.bytesPerElement=8,C("StructArrayLayout2f8",un);var yo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};yo.prototype.bytesPerElement=20,C("StructArrayLayout10ui20",yo);var mo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};mo.prototype.bytesPerElement=16,C("StructArrayLayout8ui16",mo);var go=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};go.prototype.bytesPerElement=28,C("StructArrayLayout4i4ui4i1f28",go);var xo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};xo.prototype.bytesPerElement=12,C("StructArrayLayout3f12",xo);var vo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};vo.prototype.bytesPerElement=4,C("StructArrayLayout1ul4",vo);var bo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};bo.prototype.bytesPerElement=20,C("StructArrayLayout6i1ul2ui20",bo);var wo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};wo.prototype.bytesPerElement=12,C("StructArrayLayout2i2i2i12",wo);var Uh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};Uh.prototype.bytesPerElement=16,C("StructArrayLayout2f1f2i16",Uh);var Do=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};Do.prototype.bytesPerElement=16,C("StructArrayLayout2ub2f2i16",Do);var _o=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};_o.prototype.bytesPerElement=6,C("StructArrayLayout3ui6",_o);var Ao=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let v=t*26,b=t*13,D=t*52;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=i,this.uint16[v+3]=n,this.uint32[b+2]=a,this.uint32[b+3]=s,this.uint32[b+4]=o,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[b+7]=c,this.float32[b+8]=p,this.uint8[D+36]=f,this.uint8[D+37]=d,this.uint8[D+38]=y,this.uint32[b+10]=m,this.int16[v+22]=g,this.float32[b+12]=x,t}};Ao.prototype.bytesPerElement=52,C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ao);var So=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P){let L=this.length;return this.resize(L+1),this.emplace(L,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P,L){let F=t*34,$=t*17;return this.int16[F+0]=e,this.int16[F+1]=r,this.int16[F+2]=i,this.int16[F+3]=n,this.int16[F+4]=a,this.int16[F+5]=s,this.int16[F+6]=o,this.int16[F+7]=l,this.uint16[F+8]=u,this.uint16[F+9]=h,this.uint16[F+10]=c,this.uint16[F+11]=p,this.uint16[F+12]=f,this.uint16[F+13]=d,this.uint16[F+14]=y,this.uint16[F+15]=m,this.uint16[F+16]=g,this.uint16[F+17]=x,this.uint16[F+18]=v,this.uint16[F+19]=b,this.uint16[F+20]=D,this.uint16[F+21]=A,this.uint16[F+22]=_,this.uint32[$+12]=S,this.float32[$+13]=k,this.float32[$+14]=z,this.uint16[F+30]=O,this.uint16[F+31]=P,this.float32[$+16]=L,t}};So.prototype.bytesPerElement=68,C("StructArrayLayout8i15ui1ul2f2ui1f68",So);var _a=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};_a.prototype.bytesPerElement=4,C("StructArrayLayout1f4",_a);var Eo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};Eo.prototype.bytesPerElement=12,C("StructArrayLayout1ui2f12",Eo);var Fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};Fo.prototype.bytesPerElement=8,C("StructArrayLayout1ul2ui8",Fo);var ko=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};ko.prototype.bytesPerElement=4,C("StructArrayLayout2ui4",ko);var qh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};qh.prototype.bytesPerElement=2,C("StructArrayLayout1ui2",qh);var To=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};To.prototype.bytesPerElement=16,C("StructArrayLayout4f16",To);var Vf=class extends bn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new B(this.anchorPointX,this.anchorPointY)}};Vf.prototype.size=20;var Ll=class extends bo{get(t){return new Vf(this,t)}};C("CollisionBoxArray",Ll);var Of=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Of.prototype.size=52;var Rf=class extends Ao{get(t){return new Of(this,t)}};C("PlacedSymbolArray",Rf);var $f=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};$f.prototype.size=68;var Nf=class extends So{get(t){return new $f(this,t)}};C("SymbolInstanceArray",Nf);var Uf=class extends _a{getoffsetX(t){return this.float32[t*1+0]}};C("GlyphOffsetArray",Uf);var qf=class extends co{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};C("SymbolLineVertexArray",qf);var jf=class extends bn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};jf.prototype.size=12;var Gf=class extends Eo{get(t){return new jf(this,t)}};C("TextAnchorOffsetArray",Gf);var Xf=class extends bn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Xf.prototype.size=8;var Yf=class extends Fo{get(t){return new Xf(this,t)}};C("FeatureIndexArray",Yf);var Zm=class extends ln{};var Hm=class extends ln{},Km=class extends ln{},Jm=class extends po{},Qm=class extends fo{},tg=class extends un{},Vr=class extends yo{},jh=class extends mo{},eg=class extends go{},rg=class extends xo{},ig=class extends vo{},Gh=class extends wo{};var ng=class extends Do{};var wn=class extends _o{},Io=class extends ko{};var Co=At([{name:"a_pos",components:2,type:"Int16"}],4),ag=Co.members;Co.size,Co.alignment;var ee=class Ur{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Ur.MAX_VERTEX_ARRAY_LENGTH&&Bt(`Max vertices per segment is ${Ur.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${Ur.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Ur.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new Ur([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};ee.MAX_VERTEX_ARRAY_LENGTH=2**16-1,C("SegmentVector",ee);function Xh(t,e){return t=Ji(Math.floor(t),0,255),e=Ji(Math.floor(e),0,255),256*t+e}var sg=At([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),og=At([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),lg=fl(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),ug=fl(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),Mo=h1(fl(((t,e)=>{var r=lg(),i=ug();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),Wf=class Zf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Yh(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=Yh(e),i=0,n=this.ids.length-1;for(;i>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Bo(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Zf;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Yh(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Mo.default)(String(t))}function Bo(t,e,r,i){for(;r>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]n);if(a>=s)break;Yn(t,a,s),Yn(e,3*a,3*s),Yn(e,3*a+1,3*s+1),Yn(e,3*a+2,3*s+2)}s-r`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new cg(t,e):new Ol(t,e)}},ur=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i==="u_pattern_to"?n=this.patternTo:i==="u_pattern_from"?n=this.patternFrom:i==="u_dasharray_to"?n=this.dashTo:i==="u_dasharray_from"?n=this.dashFrom:i==="u_pixel_ratio_to"?n=this.pixelRatioTo:i==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new hg(t,e):new Ol(t,e)}},ke=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new st(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type==="color"){let i=Po(r);for(let n=t;n`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new st(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new st(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(this.zoom,n),r,i),s=this.expression.evaluate(new st(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=Po(r),a=Po(i);for(let s=t;s`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof ke||r instanceof he)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof Ye){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof $i||r instanceof ur||r instanceof he)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof $i||n instanceof ur||n instanceof he){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof Ye){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ke||r instanceof he)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof ke||r instanceof he||r instanceof Ye)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ke||e instanceof he||e instanceof Ye)&&e.destroy()}}},vr=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Jf(i,e,r);this.needsUpload=!1,this._featureMap=new Wf,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function pg(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function fg(t){return{"line-pattern":{source:Vr,composite:Vr},"fill-pattern":{source:Vr,composite:Vr},"fill-extrusion-pattern":{source:Vr,composite:Vr},"line-dasharray":{source:jh,composite:jh}}[t]}function Wh(t,e,r){var n;let i={color:{source:un,composite:To},number:{source:_a,composite:un}};return((n=fg(t))==null?void 0:n[r])||i[e][r]}C("ConstantBinder",$i),C("CrossFadedConstantBinder",ur),C("SourceExpressionBinder",ke),C("CrossFadedPatternBinder",Hf),C("CrossFadedDasharrayBinder",Kf),C("CompositeExpressionBinder",he),C("ProgramConfiguration",Jf,{omit:["_buffers"]}),C("ProgramConfigurationSet",vr);var zo=2**14-1,Zh=-zo-1;function Ar(t){let e=mt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Ji(a,Zh,zo),n.y=Ji(s,Zh,zo),(an.x+1||sn.y+1)&&Bt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function hi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ar(t):[]}}var Hh=-32768;function dg(t,e,r,i,n){t.emplaceBack(Hh+e*8+i,Hh+r*8+n)}var Rl=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Hm,this.indexArray=new wn,this.segments=new ee,this.programConfigurations=new vr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),o||(o=c.paint.get("circle-pitch-alignment")==="map")}let l=o?e.subdivisionGranularity.circle:1,u=new st(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=hi(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Ar(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ag),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f=3){for(let n of i)if(oi(t,n))return!0}if(gg(t,i,r))return!0}return!1}function gg(t,e,r){if(t.length>1){if($l(t,e))return!0;for(let i of e)if(Lo(i,t,r))return!0}for(let i of t)if(Lo(i,e,r))return!0;return!1}function $l(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function Kh(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;oe.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function oi(t,e){let r=!1;for(let i=0,n=t.length-1;ie.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function vg(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(e,r),new B(e,n),new B(i,n),new B(i,r)];if(t.length>2){for(let s of a)if(oi(t,s))return!0}for(let s=0;sn.x&&e.x>n.x||t.yn.y&&e.y>n.y)return!1;let a=Ke(t,e,r[0]);return a!==Ke(t,e,r[1])||a!==Ke(t,e,r[2])||a!==Ke(t,e,r[3])}function Wr(t,e,r){let i=e.paint.get(t).value;return i.kind==="constant"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ha(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ka(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=B.convert(e)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function wg(t){let e=[];for(let r=0;rNl(n,e,r,i))}var kg,Tg=()=>kg||(kg=new Xt({"circle-sort-key":new N(w.layout_circle["circle-sort-key"],"circle-sort-key")})),Ig,Cg=()=>Ig||(Ig=new Xt({"circle-radius":new N(w.paint_circle["circle-radius"],"circle-radius"),"circle-color":new N(w.paint_circle["circle-color"],"circle-color"),"circle-blur":new N(w.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new N(w.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new V(w.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new V(w.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new V(w.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new V(w.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new N(w.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new N(w.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new N(w.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})),Mg={get paint(){return Cg()},get layout(){return Tg()}};var Bg=class extends de{constructor(t,e){super(t,Mg,e)}createBucket(t){return new Rl(t)}queryRadius(t){let e=t;return Wr("circle-radius",this,e)+Wr("circle-stroke-width",this,e)+Ha(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ka(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),h=this.paint.get("circle-pitch-scale"),c=this.paint.get("circle-pitch-alignment"),p,f;return c==="map"?(p=l,f=u*a):(p=Fg(l,n,s,o),f=u),ed({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},rd=class extends Rl{};C("HeatmapBucket",rd,{omit:["layers"]});var Pg,zg=()=>Pg||(Pg=new Xt({"heatmap-radius":new N(w.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new N(w.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new V(w.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Wa(w.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new V(w.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})),Lg={get paint(){return zg()}};function Ul(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function id(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Ul({},{width:e,height:r},i);ql(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function ql(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,o=e.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s$g||($g=new Xt({"hillshade-illumination-direction":new V(w.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new V(w.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new V(w.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new V(w.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new V(w.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new V(w.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new V(w.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new V(w.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new V(w.paint_hillshade.resampling,"resampling")})),Ug={get paint(){return Ng()}};var qg=class extends de{constructor(t,e){super(t,Ug,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(ch);return{directionRadians:t.map(ch),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},jg,Gg=()=>jg||(jg=new Xt({"color-relief-opacity":new V(w["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Wa(w["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new V(w["paint_color-relief"].resampling,"resampling")})),Xg={get paint(){return Gg()}};function Wn(t){return"data"in t}var Jh=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){var u;let{width:i,height:n}=t,a=(((u=this.size)==null?void 0:u[0])!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!(e!=null&&e.useMipmap),a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&(e==null?void 0:e.premultiply)!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let h=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,h,o.RGBA8,i,n),Wn(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:c}=t;l&&c&&(c=Ns(c)),c&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,c)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:h,y:c}=r||{x:0,y:0};Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,h,c,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,h,c,o))}this.useMipmap&&!(Wn(t)&&t.data===null)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=Ns(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=Ns(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Pe,jl=(Pe=class{constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){Bt(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),Pe.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;hthis.max&&(this.max=f),f=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+2)*this.stride+i+2)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-2||e>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(e+2)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return sd(e,this.getUnpackVector())}getPixels(){return new Zt({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-2;break;case 1:a=n+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;ph&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Ro(a,s,o,l,u),s}function od(t,e,r,i,n){let a=null;if(n===fx(t,e,r,i)>0)for(let s=e;s=e;s-=i)a=ec(s/i|0,t[s],t[s+1],a);return a&&cn(a,a.next)&&(fn(a),a=a.next),a}function br(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(hn.size===0||!hn.has(i))&&(cn(i,i.next)||Ft(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),Oo=!0,fn(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function Ro(t,e,r,i,n){n&&ox(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(Ft(o,t,l)<0&&(n?Kg(t,r,i,n):Hg(t))){e.push(o.i,t.i,l.i),fn(t),t=l,a=l;continue}if(t=l,t===a){if(Oo=!1,t=br(t),Oo){a=t;continue}if(!s){t=Jg(t,e),a=t,s=!0;continue}Qg(t,e,r,i,n);break}}}function Hg(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&Ea(n,o,a,l,s,u,d.x,d.y)&&Ft(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Kg(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=qo(f,d,e,r,i),x=qo(y,m,e,r,i),v=t.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&Ea(o,h,l,c,u,p,v.x,v.y)&&Ft(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=t.nextZ;for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&Ea(o,h,l,c,u,p,b.x,b.y)&&Ft(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Jg(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;ud(n,r,r.next,a,!1)&&pn(n,a)&&pn(a,n)&&(e.push(n.i,r.i,a.i),fn(r),fn(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?br(r):r}function Qg(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&hx(a,s)){let o=hd(a,s);a=br(a,a.next),o=br(o,o.next),Ro(a,e,r,i,n),Ro(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var $o=!1;function tx(t,e,r,i){let n=[];for(let a=0,s=e.length;as&&(s=r.x),r.yo&&(o=r.y),h.xs&&(s=h.x),h.yo&&(o=h.y),r=h}while(++l<16&&r!==e);Uo[i]=r;let u=i*4;wt[u]=n,wt[u+1]=a,wt[u+2]=s,wt[u+3]=o}while(r!==e)}function nx(t,e){let r=t.z*4;e.xwt[r+2]&&(wt[r+2]=e.x),e.y>wt[r+3]&&(wt[r+3]=e.y)}function Qh(t){let e=Uo[t];for(;e.prev.next!==e;)e=e.next;return Uo[t]=e,e}function tc(t){let e=No[t];for(;e.prev.next!==e;)e=e.next;return No[t]=e,e}function ax(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(cn(t,r))return r;for(let p=0,f=0;pwt[f+3]||wt[f]>i||wt[f+2]<=a)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r){if(cn(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.xi||wt[f+3]h)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&Ea(ni)&&(ys.x||r.x===s.x&&sx(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function sx(t,e){return Ft(t.prev,t,e.prev)<0&&Ft(e.next,t,t.next)<0}var ae=[],Ti=[],or=new Uint32Array,Ii=new Uint32Array,Ci=new Uint32Array(256);function ox(t,e,r,i){let n=t,a=0;do n.z=qo(n.x,n.y,e,r,i),ae[a++]=n,n=n.next;while(n!==t);lx(a);let s=null;for(let o=0;o=0&&ae[n].z>i;)ae[n+1]=ae[n],n--;ae[n+1]=r}return}or.length>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=Ci[o];Ci[o]=s,s+=l}for(let o=0;o>>a&255]++;i[u]=e[o],n[u]=l}}function qo(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function ux(t){let e=t,r=t;do(e.x=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function hx(t,e){let r=cn(t,e)&&Ft(t.prev,t,t.next)>0&&Ft(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||pn(t,e)&&pn(e,t)&&(Ft(t.prev,t,e.prev)!==0||Ft(t,e.prev,e)!==0))&&!cx(t,e)&&(r||px(t,e))}function Ft(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function cn(t,e){return t.x===e.x&&t.y===e.y}function ud(t,e,r,i,n=!0){let a=Ft(t,e,r),s=Ft(t,e,i),o=Ft(r,i,t),l=Ft(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Hn(t,r,e)||s===0&&Hn(t,i,e)||o===0&&Hn(r,t,i)||l===0&&Hn(r,e,i)):!1}function Hn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function cx(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.xa&&o.y>a||s.y=0&&Ft(t,t.prev,e)>=0:Ft(t,e,t.prev)<0||Ft(t,t.next,e)<0}function px(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function hd(t,e){let r=jo(t.i,t.x,t.y),i=jo(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function ec(t,e,r,i){let n=jo(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function fn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),$o&&nx(t.prev,t.next)}function jo(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function fx(t,e,r,i){let n=0;for(let a=e,s=r-i;at)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return gx(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i=1||b<=0)||m&&(ln)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&v>0){let _=o+f*v,S=l+d*v;a.push(this._vertexToIndex(_,S))}let D=o+f*Math.max(v,0),A=o+f*Math.min(b,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,D,A),!m&&b<1){let _=o+f*b,S=l+d*b;a.push(this._vertexToIndex(_,S))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,A,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,b=o=1||m<=0){let _=e-a,S=r-s,k=(l-s)/S,z=(u-s)/S,O=a+_*Math.min(k,z);x=Math.floor(Math.min(O,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(O,o)/this._granularityCellSize)-1,b=o0?u:l;if(b)for(let _=x;_<=v;_++){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}else for(let _=v;_>=x;_--){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}}_generateOutline(t){let e=[];for(let r of t){let i=cr(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;sn==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=mt,a=t.length;for(let s=2;s=2&&((s=this._canonical)==null?void 0:s.z)===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(o=>this._removeLinesOutsideTileX(o))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,O=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,P=Math.abs(_-z),L=Math.abs(S-O),F=Math.abs(_-y),$=Math.abs(S-m),U=g?P/D:1/0,T=x?L/A:1/0;if((F<=P||!g)&&($<=L||!x))break;if(U0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function xx(t,e,r){if(e.length===0)throw Error("Subdivision vertex ring is empty.");let i=0,n=t[e[0]*2];for(let l=1;l=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(hp)x=!1;else{let v=g-y,b=-(m-d),D=y((p-d)*v+(f-y)*b)*D&&(x=!0)}if(x){let v=e[l],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),s--,s<0&&(s=a-1)}else{let v=e[u],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),o++,o>=a&&(o=0)}if(l===u)break}}function pd(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(uee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let v=Zi(s,i,a,o,p,y,u),b=Zi(s,i,a,o,f,m,u),D=Zi(s,i,a,o,d,g,u);r.emplaceBack(h+v-l,h+b-l,h+D-l),u.primitiveLength++}}function bx(t,e,r,i,n,a){let s=[];for(let c=0;cee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Zi(s,i,a,o,f,y,u),v=Zi(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+v-l),u.primitiveLength++}}var fd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Km,this.indexArray=new wn,this.indexArray2=new Io,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.segments2=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=Gl("fill",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:e,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let r in e.patterns){let i=e.patterns[r];this.recordSdfPattern(r,t[i.min]),this.recordSdfPattern(r,t[i.mid]),this.recordSdfPattern(r,t[i.max])}for(let e of this.layers){let r=e.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(e.id,t[r.from.toString()]),this.recordSdfPattern(e.id,t[r.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let r=e.sdf===!0,i=this.sdfPatterns[t];i===void 0?this.sdfPatterns[t]=r:i!==r&&Bt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t}"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wg),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Ra(e,500)){let o=cd(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;pd((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};C("FillBucket",fd,{omit:["layers","patternFeatures"]});var wx,Dx=()=>wx||(wx=new Xt({"fill-sort-key":new N(w.layout_fill["fill-sort-key"],"fill-sort-key")})),_x,Ax=()=>_x||(_x=new Xt({"fill-antialias":new V(w.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new N(w.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new V(w.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new N(w.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new N(w.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new V(w.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new V(w.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new on(w.paint_fill["fill-pattern"],"fill-pattern")})),Sx={get paint(){return Ax()},get layout(){return Dx()}};var Ex=class extends de{constructor(t,e){super(t,Sx,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new fd(t)}queryRadius(){return Ha(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Qf(Ka(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},Go=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fx=At([{name:"a_centroid",components:2,type:"Int16"}],4),kx=Go.members;Go.size,Go.alignment;var Fa=class Xo{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new Xo;return r.extend(e(new B(this.minX,this.minY))),r.extend(e(new B(this.maxX,this.minY))),r.extend(e(new B(this.minX,this.maxY))),r.extend(e(new B(this.maxX,this.maxY))),r}static fromPoints(e){let r=new Xo;for(let i of e)r.extend(i);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}},g5=Fa.fromPoints([new B(0,0),new B(mt,mt)]);function Yo(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function rc(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Dn=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),no&&(o=n),au&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:"LineString",coordinates:c[0]}:{type:"MultiLineString",coordinates:c}}else if(this.type===3){let c=dd(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};Dn.types=["Unknown","Point","LineString","Polygon"];function dd(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new Dn(this._pbf,e,this.extent,this._keys,this._values)}};function Cx(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ui(F1(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return yd*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof Ui)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ui(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e)return new Ui(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}},md=2*Math.PI*yd;function gd(t){return md*Math.cos(t*Math.PI/180)}function Mx(t){return(180+t)/360}function Bx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Px(t,e){return t/gd(e)}function zx(t){return t*360-180}function Wo(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Lx(t,e){return t*gd(Wo(e))}function Vx(t){return 1/Math.cos(t*Math.PI/180)}var Yl=class xd{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=ic.convert(e);return new xd(Mx(i.lng),Bx(i.lat),Px(r,i.lat))}toLngLat(){return new ic(zx(this.x),Wo(this.y))}toAltitude(){return Lx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/md*Vx(Wo(this.y))}};function Ox(t,e,r){let i=1/(1<Nx(n,i))}function $x(t,e){let r=Rx(mt/2,mt/2,e),i=Yl.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function qx(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var js=8192;function Mi(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*js)*2+s,n*js*2,a*js*2,Math.round(o))}var vd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Jm,this.centroidVertexArray=new Zm,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=Aa("fill-extrusion",this.layers,e);let i=new st(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=hi(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Ar(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?nc(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Gl("fill-extrusion",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures({options:t,canonical:e,patternPositions:r}){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Fx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?nc(e,o,i):e;for(let u of Ra(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y{Mi(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;iee.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function jx(t,e){for(let r=0;rGx||(Gx=new Xt({"fill-extrusion-rounded-corner-distance":new V(w["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})),Yx,Wx=()=>Yx||(Yx=new Xt({"fill-extrusion-opacity":new V(w["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new N(w["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new V(w["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new V(w["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new on(w["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new N(w["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new N(w["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new V(w["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})),Zx={get paint(){return Wx()},get layout(){return Xx()}};var Hx=class extends de{constructor(t,e){super(t,Zx,e)}createBucket(t){return new vd(t)}queryRadius(){return Ha(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ka(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=Qx(o,s,0),c=Jx(i,u,l,s),p=c[0],f=c[1];return Kx(p,f,h)}};function Bi(t,e){return t.x*e.x+t.y*e.y}function ac(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;pn){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);di&&(o-e>3&&Zo(t,e,o,i),t[o+2]=n,r-o>3&&Zo(t,o,r,i))}function t2(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function Mt(t,e,r,i){let n={type:e,geom:r},a={id:t!=null?t:null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":Pi(a,n.geom);break;case"LineString":Pi(a,n.geom.points);break;case"Polygon":Pi(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)Pi(a,s.points);break;case"MultiPolygon":for(let s of n.geom)Pi(a,s[0].points)}return a}function Wl(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Pi(t,e){for(let r=0;r1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(e.geometry.type==="GeometryCollection"){r2(t,e,e.geometry,r,i,n+1);return}if(!((o=e.geometry.coordinates)!=null&&o.length))return;let a=e2(e,r,i),s=(r.tolerance/((1<0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&Zo(e.points,0,o,r),e.points[o+2]=1,Wl(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function Kl(t,e,r,i){for(let n=0;n1?1:r}function u2(t){return{type:"FeatureCollection",features:t.map(e=>ka(e))}}function ka(t){let e={type:"Feature",geometry:h2(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function h2(t){let{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:bd(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:Kn(r)};case"LineString":return{type:e,coordinates:Kn(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map(i=>Kn(i.points))};case"MultiPolygon":return{type:e,coordinates:r.map(i=>i.map(n=>Kn(n.points)))}}}function Kn(t){let e=[];for(let r=0;r=r&&s=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c=i))switch(u.type){case"Point":case"MultiPoint":c2(u,l,r,i,n);continue;case"LineString":p2(u,l,r,i,n,o);continue;case"MultiLineString":f2(u,l,r,i,n);continue;case"Polygon":d2(u,l,r,i,n);continue;case"MultiPolygon":y2(u,l,r,i,n);continue}}return l.length?l:null}function c2(t,e,r,i,n){let a=[];if(m2(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";e.push(Mt(t.id,s,a,t.tags))}function p2(t,e,r,i,n,a){let s=[];if(_d(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(Mt(t.id,"LineString",o,t.tags));return}if(s.length>1){e.push(Mt(t.id,"MultiLineString",s,t.tags));return}e.push(Mt(t.id,"LineString",s[0],t.tags))}}function f2(t,e,r,i,n){let a=[];if(Jl(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(Mt(t.id,"LineString",a[0],t.tags));return}e.push(Mt(t.id,"MultiLineString",a,t.tags))}}function d2(t,e,r,i,n){let a=[];Jl(t.geometry,a,r,i,n,!0),a.length&&e.push(Mt(t.id,"Polygon",a,t.tags))}function y2(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];Jl(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(Mt(t.id,"MultiPolygon",a,t.tags))}function m2(t,e,r,i,n){for(let a=0;a=r&&s<=i&&Kr(e,t[a],t[a+1],t[a+2])}}function _d(t,e,r,i,n,a,s){let o=sc(t),l=n===0?g2:x2,u=t.start,h,c;for(let g=0;gr&&(c=l(o,x,v,D,A,r),s&&(o.start=u+h*c)):_>i?S=r&&(c=l(o,x,v,D,A,r),k=!0),S>i&&_<=i&&(c=l(o,x,v,D,A,i),k=!0),!a&&k&&(s&&(o.end=u+h*c),e.push(o),o=sc(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&Kr(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&Kr(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Wl(o),e.push(o))}function sc(t){return{points:[],size:t.size,start:t.start,end:t.end}}function Jl(t,e,r,i,n,a){for(let s of t)_d(s,e,r,i,n,a,!1)}function Kr(t,e,r,i){t.push(e,r,i)}function g2(t,e,r,i,n,a){let s=(a-e)/(i-e);return Kr(t.points,a,r+(n-r)*s,1),s}function x2(t,e,r,i,n,a){let s=(a-r)/(n-r);return Kr(t.points,e+(i-e)*s,a,1),s}function Ql(t,e){let r=e.buffer/e.extent,i=t,n=Te(t,1,-1-r,r,0,-1,2,e),a=Te(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=Te(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=oc(n,1).concat(i)),a&&(i=i.concat(oc(a,-1)))),i}function oc(t,e){let r=[];for(let i of t)switch(i.type){case"Point":case"MultiPoint":{let n=v2(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"LineString":{let n=Gs(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(Gs(a,e));r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(Gs(o,e));n.push(s)}r.push(Mt(i.id,i.type,n,i.tags));continue}}return r}function v2(t,e){let r=[];for(let i=0;io.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=Zl({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=Ql(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=w2(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function w2(t,e,r){var a,s;let i=!!e.newGeometry,n=e.removeAllProperties||((a=e.removeProperties)==null?void 0:a.length)>0||((s=e.addOrUpdateProperties)==null?void 0:s.length)>0;if(i){let o=t[0],l=Zl({type:"FeatureCollection",features:[{type:"Feature",id:o.id,geometry:e.newGeometry,properties:n?lc(o.tags,e):o.tags}]},r);return l=Ql(l,r),l}if(n){let o=[];for(let l of t){let u=je({},l);u.tags=lc(u.tags,e),o.push(u)}return o}return t}function lc(t,e){if(e.removeAllProperties)return{};let r=je({},t||{});if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function D2(t,e){var r,i;return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map((r=t.add)==null?void 0:r.map(n=>[e.promoteId?n.properties[e.promoteId]:n.id,n])),update:new Map((i=t.update)==null?void 0:i.map(n=>[n.id,n]))}:{remove:new Set,add:new Map,update:new Map}}var uc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],dt=new Uint32Array(96),_2=class Ad{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=uc[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new Ad(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=uc.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ho(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=[];for(;l>0;){let h=dt[--l],c=dt[--l],p=dt[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(dt[l++]=p,dt[l++]=f-1,dt[l++]=1-h),(h===0?i>=d:n>=y)&&(dt[l++]=f+1,dt[l++]=c,dt[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=dt[--l],p=dt[--l],f=dt[--l];if(p-f<=o){for(let g=f;g<=p;g++)hc(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];hc(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(dt[l++]=f,dt[l++]=d-1,dt[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(dt[l++]=d+1,dt[l++]=p,dt[l++]=1-c)}return u}};function Ho(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;Sd(t,e,s,i,n,a),Ho(t,e,r,i,s-1,1-a),Ho(t,e,r,s+1,n,1-a)}function Sd(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Sd(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(zi(t,e,i,r),e[2*n+a]>s&&zi(t,e,i,n);os;)l--}e[2*i+a]===s?zi(t,e,i,l):(l++,zi(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function zi(t,e,r,i){Xs(t,r,i),Xs(e,2*r,2*i),Xs(e,2*r+1,2*i+1)}function Xs(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function hc(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var Ko={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},A2=class{constructor(t){this.options=Object.assign(Object.create(Ko),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[Zr(i),Hr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type==="Point"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(Ko),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>ka(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(Zr(r),Hr(a),Zr(n),Hr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?S2(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?E2(a,p,this.clusterProps):ka(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||(e=10),r||(r=0);let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o!=null&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n1,u,h,c;if(l)u=tu(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;he&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,v=-1,b=((h/u|0)<<5)+(e+1)+this.points.length;for(let D of f){let A=D*u;if(o[A+2]<=e)continue;o[A+2]=e;let _=o[A+5];m+=o[A]*_,g+=o[A+1]*_,o[A+4]=b,n&&(x||(x=this.map(o,h,!0),v=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=b,l.push(m/y,g/y,1/0,b,-1,y),n&&l.push(v)}else{for(let m=0;m1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function S2(t,e,r){return{id:t[e+3],type:"Point",tags:tu(t,e,r),geometry:[t[e],t[e+1]]}}function E2(t,e,r){return{type:"Feature",id:t[e+3],properties:tu(t,e,r),geometry:{type:"Point",coordinates:[wd(t[e]),Dd(t[e+1])]}}}function tu(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var Ed="geojsonvt_clip_start",Fd="geojsonvt_clip_end";function cc(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;ls)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&M2(o,a),t.push(o)}function M2(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i0===e)for(let i=0,n=t.length;i1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=cc(t,i,n,a,r);s.source=t;let o=Jn(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Jn(o,l,u)];return!(h!=null&&h.source)||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:pc(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<1&&console.time("creation"),p=this.tiles[c]=cc(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let _=`z${e}`;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let _=n-e;if(r!==a>>_||i!==s>>_)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,v=null,b=null,D=Te(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=Te(t,h,r+d,r+m,0,p.minX,p.maxX,l);D&&(g=Te(D,h,i-f,i+y,1,p.minY,p.maxY,l),x=Te(D,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(v=Te(A,h,i-f,i+y,1,p.minY,p.maxY,l),b=Te(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(v||[],e+1,r*2+1,i*2),o.push(b||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<=f||s=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX=d&&g.minY1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Jn(t,e,r){return((1<24)throw Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw Error("promoteId and generateId cannot be used together.");let i=Zl(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),i=Ql(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new A2(e.clusterOptions):new z2(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=b2(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(ka(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return u2(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},Jo=At([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),V2=Jo.members;Jo.size,Jo.alignment;var Qo=At([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),O2=Qo.members;Qo.size,Qo.alignment;var R2=Math.cos(75/2*(Math.PI/180)),Id=1/2,fc=2**14/Id,Cd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Qm,this.layoutVertexArray2=new tg,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("line",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(Aa("line",this.layers,e)?Gl("line",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures({options:t,canonical:e,patternPositions:r,dashPositions:i}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,O2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,V2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties[Ed],end:+t.properties[Fd]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(t,{}),u=o.get("line-cap").evaluate(t,{}),h=o.get("line-miter-limit").evaluate(t,{}),c=o.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=cr(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c0;if(k&&v>c){let L=d.dist(y);if(L>2*p){let F=d.sub(d.sub(y)._mult(p/L)._round());this.updateDistance(y,F),this.addCurrentVertex(F,g,0,0,f),y=F}}let O=y&&m,P=O?r:u?"butt":i;if(O&&P==="round"&&(_n&&(P="bevel"),P==="bevel"&&(_>2&&(P="flipbevel"),_100)b=x.mult(-1);else{let L=_*g.add(x).mag()/g.sub(x).mag();b._perp()._mult(L*(z?-1:1))}this.addCurrentVertex(d,b,0,0,f),this.addCurrentVertex(d,b.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let L=-Math.sqrt(_*_-1),F=z?L:0,$=z?0:L;if(y&&this.addCurrentVertex(d,g,F,$,f),P==="fakeround"){let U=Math.round(S*180/Math.PI/20);for(let T=1;T2*p){let F=d.add(m.sub(d)._mult(p/L)._round());this.updateDistance(d,F),this.addCurrentVertex(F,x,0,0,f),d=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>fc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(fc-1):this.scaledDistance)*Id;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};C("LineBucket",Cd,{omit:["layers","patternFeatures"]});var $2,N2=()=>$2||($2=new Xt({"line-cap":new N(w.layout_line["line-cap"],"line-cap"),"line-join":new N(w.layout_line["line-join"],"line-join"),"line-miter-limit":new N(w.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new N(w.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new N(w.layout_line["line-sort-key"],"line-sort-key")})),U2,q2=()=>U2||(U2=new Xt({"line-opacity":new N(w.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new V(w.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new N(w.paint_line["line-color"],"line-color"),"line-translate":new V(w.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new V(w.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new N(w.paint_line["line-width"],"line-width"),"line-gap-width":new N(w.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new N(w.paint_line["line-offset"],"line-offset"),"line-blur":new N(w.paint_line["line-blur"],"line-blur"),"line-dasharray":new on(w.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new on(w.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Wa(w.paint_line["line-gradient"],"line-gradient")})),dc={get paint(){return q2()},get layout(){return N2()}},j2=class extends N{possiblyEvaluate(t,e){return e=new st(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Gt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Qn;var G2=class extends de{constructor(t,e){super(t,dc,e),this.gradientVersion=0,Qn||(Qn=new j2(dc.paint.properties["line-width"].specification,"line-floorwidth"),Qn.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=lm(e)?e._styleExpression.expression instanceof vl:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Qn.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Cd(t)}queryRadius(t){let e=t,r=yc(Wr("line-width",this,e),Wr("line-gap-width",this,e)),i=Wr("line-offset",this,e);return r/2+Math.abs(i)+Ha(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ka(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*yc(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(i=Dg(i,l*a)),mg(s,i,o)}isTileClipped(){return!0}};function yc(t,e){return e>0?e+2*t:t}var X2=At([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),Y2=At([{name:"a_projected_pos",components:3,type:"Float32"}],4);At([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var W2=At([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);At([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var mc=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x5=At([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);At([{name:"triangle",components:3,type:"Uint16"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Float32",name:"offsetX"}]),At([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),At([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var wr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(wr.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,e){return rt(this,null,function*(){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(yield e(r),yield Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};function Z2(t){return/[\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u077F\\u07C0-\\u07FA\\u07FD-\\u07FF\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\u1800\\u1801\\u1804\\u1806-\\u1819\\u1820-\\u1878\\u1880-\\u18AA\\uA840-\\uA877\\uFB50-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF80-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDD00-\\uDD27\\uDD30-\\uDD39\\uDE60-\\uDE7E\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDEFF\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB]|\\uD805[\\uDE60-\\uDE6C]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9C-\\uDC9F]|\\uD83A[\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function H2(t){return/[\\u0591-\\u05C7\\u05D0-\\u05EA\\u05EF-\\u05F4\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u07B1\\u07C0-\\u07FA\\u07FD-\\u082D\\u0830-\\u083E\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\uFB1D-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC57-\\uDC9E\\uDCA7-\\uDCAF\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDCFB-\\uDD1B\\uDD1F-\\uDD39\\uDD3F-\\uDD59\\uDD80-\\uDDB7\\uDDBC-\\uDDCF\\uDDD2-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE38-\\uDE3A\\uDE3F-\\uDE48\\uDE50-\\uDE58\\uDE60-\\uDE9F\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF00-\\uDF35\\uDF39-\\uDF55\\uDF58-\\uDF72\\uDF78-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDCFA-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD65\\uDD69-\\uDD85\\uDD8E\\uDD8F\\uDE60-\\uDE7E\\uDE80-\\uDEA9\\uDEAB-\\uDEAD\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDF27\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB\\uDFE0-\\uDFF6]|\\uD83A[\\uDC00-\\uDCC4\\uDCC7-\\uDCD6\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function K2(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function Qa(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1401-\\u167F\\u18B0-\\u18FF\\u2065\\u20DD-\\u20E0\\u20E2-\\u20E4\\u2B97\\u2BF0-\\u2BFF\\u2E50\\u2E51\\u2E80-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u30FB\\u30FD-\\uA4CF\\uA960-\\uA97F\\uAC00-\\uD7FF\\uF900-\\uFAFF\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7\\uFFF0-\\uFFF8]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|[\\uD80C-\\uD810\\uD81C-\\uD822\\uD83C\\uD83D\\uD840-\\uD87E\\uD880-\\uD8BE][\\uDC00-\\uDFFF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFFF]|\\uD823[\\uDC00-\\uDDFF]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFF]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83E[\\uDD00-\\uDEFF]|[\\uD87F\\uD8BF][\\uDC00-\\uDFFD]/gim.test(String.fromCodePoint(t))}function J2(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function Q2(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function gc(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u103F\\u1050-\\u108F\\u109A-\\u109F\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19DE\\u19DF\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1AA0-\\u1AAD\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9EF\\uA9FA-\\uA9FE\\uAA60-\\uAAC2\\uAADB-\\uAADF]|\\uD805[\\uDF00-\\uDF1A\\uDF1D-\\uDF2B\\uDF3A\\uDF3B\\uDF3F-\\uDF46]/gim.test(String.fromCodePoint(t))}function tv(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||new RegExp("^\\\\p{gc=Mc}","u").test(e)}var ev={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},rv={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},iv={\\u0644\\u0622:[65269,65270],\\u0644\\u0623:[65271,65272],\\u0644\\u0625:[65273,65274],\\u0644\\u0627:[65275,65276]},xc=1604,nv=/[\\u0600-\\u06ff\\u0750-\\u077f\\u0870-\\u089f\\u08a0-\\u08ff\\ufb50-\\ufdff\\ufe70-\\ufeff]/;function av(t,e,r){let i=0;for(let n of t.split(";")){let[a,s]=n.split(",").map(l=>parseInt(l,36)),o=i+a;for(let l=o;l{let r=e.codePointAt(0);return{codePoint:r,type:sv(r),form:null}})}function cv(t){let e=t.filter(r=>r.type!=="T");for(let r=0;r0&&ov(e[r-1].type),a=r+1String.fromCodePoint(dv(r))).join("")}function mv(t,e,r){var n;let i=e.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?t=t.toLocaleUpperCase():i==="lowercase"&&(t=t.toLocaleLowerCase()),((n=wr.applyArabicShaping)!=null?n:yv)(t)}function gv(t,e,r){for(let i of t.sections)i.text=mv(i.text,e,r);return t}function xv(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;uu.geometry)}var Bd=typeof Intl<"u"&&"Segmenter"in Intl,ta,ea;function tl(t){if(!Bd||!Q2(t))return[...t];ta!=null||(ta=new Intl.Segmenter(void 0,{granularity:"grapheme"}));let e=[];for(let{segment:r}of ta.segment(t)){let i=e.length-1;i>=0&&tv(e[i],r)?e[i]+=r:e.push(r)}return e}function vv(t){let e=new Set;if(Bd){ea!=null||(ea=new Intl.Segmenter(void 0,{granularity:"word"}));for(let{index:i}of ea.segment(t))e.add(i);return e}let r=0;for(let i of t.split(new RegExp("\\\\b|(?=\\\\p{Ideo})","u")))e.add(r),r+=i.length;return e}function Pd(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}function ru(t){return/\\s/u.test(String.fromCodePoint(t))}function el(t){for(let e of t)if(Qa(e.codePointAt(0)))return!0;return!1}function bv(t){for(let e of t)if(!wv(e.codePointAt(0)))return!1;return!0}function wv(t){return!Z2(t)}function vc(t){return!(Qa(t)||J2(t))}function zd(t){return new RegExp("\\\\p{sc=Arab}","u").test(String.fromCodePoint(t))}function Ld(t){return H2(t)}function Vd(t){for(let e of t)if(Ld(e.codePointAt(0)))return!0;return!1}var Gr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u22EF":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Dv(t){let e="",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!vc(s.value.codePointAt(0))||Gr[s.value])&&(r.premature||!vc(r.value.codePointAt(0))||Gr[r.value])&&Gr[n.value]?e+=Gr[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var _v={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Av={40:!0};function bc(t,e,r,i,n,a){if("fontStack"in e){let s=r[e.fontStack],o=s==null?void 0:s[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s==null?void 0:s[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function wc(t,e,r,i){let n=(t-e)**2;return i?tr&&Dc(e[i-1]);)i--;this.text=e.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(""),n=this.sectionIndex.slice(e,r);return new rl(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n0?i[i.length-1]:"",a=tl(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=K2(y),x=gc(y)&&gc(m);(_v[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&Av[m]||x&&(h!=null?h:h=vv(this.text)).has(p))&&s.push(_c(f,c,o,s,Sv(y,m,g&&l),!1))}ru(d.codePointAt(0))||(c+=bc(d,this.getSection(f),i,n,e,a)),p+=d.length}return Od(_c(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=bc(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}};function Ev(){return(function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(e).forEach(function(R,J){r[R]=1<1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function d(R,J){var W=0,M=new Map,ut=J&&new Map,X;return R.split(",").forEach(function G(K){if(K.indexOf("+")!==-1)for(var Nt=+K;Nt--;)G(X);else{X=K;var vt=K.split(">"),nt=vt[0],Tt=vt[1];nt=String.fromCodePoint(W+=parseInt(nt,36)),Tt=String.fromCodePoint(W+=parseInt(Tt,36)),M.set(nt,Tt),J&&ut.set(Tt,nt)}}),{map:M,reverseMap:ut}}var y,m,g;function x(){if(!y){var R=d(f.pairs,!0),J=R.map,W=R.reverseMap;y=J,m=W,g=d(f.canonical,!1).map}}function v(R){return x(),y.get(R)||null}function b(R){return x(),m.get(R)||null}function D(R){return x(),g.get(R)||null}var A=r.L,_=r.R,S=r.EN,k=r.ES,z=r.ET,O=r.AN,P=r.CS,L=r.B,F=r.S,$=r.ON,U=r.BN,T=r.NSM,q=r.AL,at=r.LRO,ot=r.RLO,pt=r.LRE,Et=r.RLE,qt=r.PDF,Ht=r.LRI,Ve=r.RLI,ye=r.FSI,Kt=r.PDI;function Oe(R,J){for(var W=125,M=new Uint32Array(R.length),ut=0;ut0)Fe--;else if(rs>0){for(Ne=0;!lt[lt.length-1]._isolate;)lt.pop();var is=lt[lt.length-1]._isolInitIndex;is!=null&&(Nt.set(is,zt),Nt.set(zt,is)),lt.pop(),rs--}bt=lt[lt.length-1],K[zt]=bt._level,bt._override&&G(zt,bt._override)}else Lt&qt?(Fe===0&&(Ne>0?Ne--:!bt._isolate&<.length>1&&(lt.pop(),bt=lt[lt.length-1])),K[zt]=bt._level):Lt&L&&(K[zt]=nt.level);else K[zt]=bt._level,bt._override&&Lt!==U&&G(zt,bt._override)}for(var Cr=[],me=null,ar=nt.start;ar<=nt.end;ar++){var ns=M[ar];if(!(ns&o)){var Bu=K[ar],Pu=ns&n,Wy=ns===Kt;me&&Bu===me._level?(me._end=ar,me._endsWithIsolInit=Pu):Cr.push(me={_start:ar,_end:ar,_level:Bu,_startsWithPDI:Wy,_endsWithIsolInit:Pu})}}for(var as=[],Sn=0;Sn=0;kn--)if(!(M[kn]&o)){Vu=K[kn];break}var us=Mr[Mr.length-1],Hy=K[us],Ou=nt.level;if(!(M[us]&n)){for(var Tn=us+1;Tn<=nt.end;Tn++)if(!(M[Tn]&o)){Ou=K[Tn];break}}as.push({_seqIndices:Mr,_sosType:Math.max(Vu,Zy)%2?_:A,_eosType:Math.max(Ou,Hy)%2?_:A})}}for(var hs=0;hs=0;Cn--)if(!(M[j[Cn]]&o)){ps=M[j[Cn]];break}G(Ru,ps&(n|Kt)?$:ps)}}if(X.get(S))for(var Mn=0;Mn=-1;Bn--){var Nu=Bn===-1?yi:M[j[Bn]];if(Nu&a){Nu===q&&G($u,O);break}}}if(X.get(q))for(var fs=0;fs=0&&(Pr=M[j[ms]],Pr&o);ms--);for(var gs=mi+1;gs=0&&M[j[Pn]]&(z|o);Pn--)G(j[Pn],S);for(ge++;ge=0&&M[j[zn]]&o;zn--)G(j[zn],$);for(var Ln=gi+1;Ln=0;bi--){var bs=zr[bi].char;if(bs===Yu||bs===b(D(vi))||v(D(bs))===vi){Vn.push([zr[bi].seqIndex,Lr]),zr.length=bi;break}}}Vn.sort(function(Yt,ue){return Yt[0]-ue[0]});for(var ws=0;ws=0;As--){var Ju=j[As];if(M[Ju]&Xu){var Qu=M[Ju]&xi?_:A;xe=Qu===Br?Br:Qu;break}}}if(xe){if(M[j[On]]=M[j[Ds]]=xe,xe!==Br){for(var wi=On+1;wi=0;_i--)if(M[j[_i]]&o)th=_i;else{Es=M[j[_i]]&xi?_:A;break}for(var eh=Ky,Ai=Ue+1;Ai=0&&c(R[$n])&l;$n--)K[$n]=nt.level}}return{levels:K,paragraphs:vt};function rh(Yt,ue){for(var Wt=Yt;Wt=K&&c(R[nt])&l;nt--)vt[nt]=G.level;for(var Tt=G.level,di=1/0,nr=0;nrTt&&(Tt=Re),Re=di;$e--)for(var lt=0;lt=$e){for(var bt=lt;lt+1=$e;)lt++;lt>bt&&X.push([bt+K,lt+K])}}}),X}function Tr(R,J,W,M){var ut=Ir(R,J,W,M),X=[].concat(R);return ut.forEach(function(G,K){X[K]=(J.levels[G]&1?kt(R[G]):null)||R[G]}),X.join("")}function Ir(R,J,W,M){for(var ut=ir(R,J,W,M),X=[],G=0;G=0;i--){let n=nu.getBidiCharTypeName(t[i].text[0]);Tv.has(n)?(t[i].level=e,r=!0):r&&kv.has(n)?t[i].level=e:r=!1}}function Mv(t,e){let r=e,i=1/0;for(let{level:a}of t)a>r&&(r=a),(a|1)=i;a--)for(let s=0;s=a;)o++;for(let l=s,u=o;le>=n.start&&e<=n.end))==null?void 0:r.level)!=null?i:0}function zv(t,e,r,i,n){let a=Iv(t,e,i,n);Cv(a,r);let s="",o=[];for(let l of Mv(a,r)){if(Fv.test(l.text))continue;let u=Bv(l);s+=u,o.push(...Array(u.length).fill(l.index))}return{text:s,sourceIndices:o}}function Lv(t,e){let r=e.filter(a=>a>0&&aa-s),n=[];for(let a=0;a+1n.start))).map(([n,a])=>zv(t,r,Pv(i,n),n,a))}function Vv(t,e){return Rd(t,e).map(r=>r.text)}function Ov(t,e,r){return Rd(t,r).map(i=>[i.text,i.sourceIndices.map(n=>{var a;return(a=e[n])!=null?a:0})])}var il=4294967296,Ac=1/il,Sc=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),au=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*il;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*il;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,$v(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Sc?Sc.decode(this.buf.subarray(e,t)):tb(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},Rv=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Uv(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=eb(this.buf,t,this.pos);let r=this.pos-e;r>=128&&Ec(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&Ec(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Gv,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Xv,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Zv,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Yv,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Wv,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Hv,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Kv,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Jv,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Qv,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function $v(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return Nv(t,n,e);throw Error("Expected varint not more than 10 bytes")}function Nv(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Uv(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),qv(r,i,e),jv(i,e)}function qv(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function jv(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((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 Ec(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Gv(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;sa){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function Xv(t,e){for(let r=0;r239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function eb(t,e,r){for(let i=0,n,a;i55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(a=(t[r++]=239,t[r++]=191,t[r++]=189,null));n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function rb(t){return typeof(t==null?void 0:t.renderWithWebGL)=="function"}function su(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o=r;a--)e.push(a);r=i+1}else{for(let a=r;at.toCodeUnitIndex(a)),i=wr.isParsed()?wr:null;if(t.sections.length===1)return i?i.processBidirectionalText(t.toString(),r).map(a=>kc(a,t.sections,[...a].map(()=>0))):Vv(t.toString(),r).map(a=>nl([...a],t.sections,[...a].map(()=>0)));let n=sb(t);return i?i.processStyledBidirectionalText(t.text,n,r).map(([a,s])=>kc(a,t.sections,s)):Ov(t.text,n,r).map(([a,s])=>{let o=[...a];return nl(o,t.sections,Ud(o).map(l=>{var u;return(u=s[l])!=null?u:0}))})}function nl(t,e,r){var a;let i=new iu(t.join(""),e,[]),n=0;for(let s of i.graphemes())i.sectionIndex.push((a=r[n])!=null?a:0),n+=[...s].length;return i}function Ud(t){let e=[],r=0;for(let i of t)e.push(r),r+=i.length;return e}function kc(t,e,r){let i=[...t],n=Ud(i),a=ab(i);return nl(a.map(s=>i[s]),e,a.map(s=>{var o;return(o=r[n[s]])!=null?o:0}))}function ra(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=iu.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m=y.determineLineBreaks(u,a,e,i,f),g=Vd(y.text)?ob(y,m):nb(y,m),x=[],v={positionedLines:x,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return mb(v,e,r,i,g,s,o,l,c,u,p,d),!ib(x)&&v}function qd(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function lb(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function jd(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function ub(t,e,r,i){var a;if(t!=null&&t.rect)return t;let n=(a=e[r.fontStack])==null?void 0:a[i];return n?{rect:null,metrics:n.metrics}:null}function hb(t,e,r){return!(t===1||!e&&!Qa(r)||e&&(ru(r)||zd(r)))}function da(t){return new RegExp("\\\\p{Nd}","u").test(String.fromCodePoint(t))}function Gd(t){return new RegExp("\\\\p{Lu}","u").test(String.fromCodePoint(t))}function cb(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function pb(t){let e=t.some(da)&&t.every(i=>da(i)||cb(i)),r=t.length<=3&&t.every(i=>Gd(i)||da(i));return e||r}function fb(t){return(da(t)||Gd(t))&&!zd(t)}function db(t,e){let r=!1;for(let i=0;ia.codePointAt(0)),i=r.map(Qa),n=a=>!i[a]&&!ru(r[a])&&!("imageName"in t.getSection(a));for(let a=0;au){let p=Math.ceil(i/u);r*=p/n,n=p}return{x1:e,y1:r,x2:e+i,y2:r+n}}function Tc(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var Ic=32640;function Cc(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new st(t+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=Db(r.zoomStops,t);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=_b(r),n=r.evaluate(new st(t+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function Db(t,e){let r=0;for(;rt.evaluate(new st(e===-1/0?t.zoomStops[1]-1:e)))}var Jr=class Yd extends B{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new Yd(this.x,this.y,this.angle,this.segment)}};C("Anchor",Jr);function Wd(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;oi;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function Zd(t){let e=0;for(let r=0;ru){let d=(u-l)/f,y=new Jr(gr.number(c.x,p.x,d),gr.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||Wd(t,y,o,s,e)?y:void 0}l+=f}}function Sb(t,e,r,i,n,a,s,o,l){let u=Hd(i,a,s),h=Kd(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c=0&&b=0&&D=0&&p+u<=h){let A=new Jr(b,D,x,d);A._round(),(!i||Wd(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=Jd(t,c/2,r,i,n,a,s,!0,l)),f}function Eb(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l=i&&h.x>=i)&&(u.x>=i?u=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function Qd(t,e,r,i,n,a){let s=Mc(t,e,r,n,0);return s=Mc(s,e,i,a,1),s}function Mc(t,e,r,i,n){switch(e){case 1:return Fb(t,r,i,n);case 2:return Bc(t,r,i,n,!1);case 3:return Bc(t,r,i,n,!0)}return[]}function Fb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function kb(t,e,r,i,n){let a=i===0?Tb:Ib,s=[],o=[];for(let h=0;he&&s.push(a(c,p,e)):f>r?d=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new B(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Bc(t,e,r,i,n){let a=[];for(let s of t){let o=kb(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function Tb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new B(r,t.y+(e.y-t.y)*i)}function Ib(t,e,r){let i=(r-t.y)/(e.y-t.y);return new B(t.x+(e.x-t.x)*i,r)}function Pc(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(F,$)=>F+$[1]-$[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,v=0,b=d,D=0,A=y,_=0,S=m;if(a.content&&i){let F=a.content,$=F[2]-F[0],U=F[3]-F[1];(a.textFitWidth||a.textFitHeight)&&(u=Xd(t)),g=ia(h,0,F[0]),v=ia(c,0,F[1]),x=ia(h,F[0],F[2]),b=ia(c,F[1],F[3]),D=F[0]-g,_=F[1]-v,A=$-x,S=U-b}let k=u.x1,z=u.y1,O=u.x2-k,P=u.y2-z,L=(F,$,U,T)=>{let q=na(F.stretch-g,x,O,k),at=aa(F.fixed-D,A,F.stretch,f),ot=na($.stretch-v,b,P,z),pt=aa($.fixed-_,S,$.stretch,d),Et=na(U.stretch-g,x,O,k),qt=aa(U.fixed-D,A,U.stretch,f),Ht=na(T.stretch-v,b,P,z),Ve=aa(T.fixed-_,S,T.stretch,d),ye=new B(q,ot),Kt=new B(Et,ot),Oe=new B(Et,Ht),kr=new B(q,Ht),rr=new B(at/s,pt/s),fi=new B(qt/s,Ve/s),kt=e*Math.PI/180;if(kt){let R=Math.sin(kt),J=Math.cos(kt),W=[J,-R,R,J];ye._matMult(W),Kt._matMult(W),kr._matMult(W),Oe._matMult(W)}let Ee=F.stretch+F.fixed,ir=U.stretch+U.fixed,Tr=$.stretch+$.fixed,Ir=T.stretch+T.fixed;return{tl:ye,tr:Kt,bl:kr,br:Oe,tex:{x:a.paddedRect.x+1+Ee,y:a.paddedRect.y+1+Tr,w:ir-Ee,h:Ir-Tr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rr,pixelOffsetBR:fi,minFontScaleX:A/s/O,minFontScaleY:S/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let F=zc(h,y,f),$=zc(c,m,d);for(let U=0;U0&&(d=Math.max(10,d),this.circleDiameter=d)}else{let c=(h=a.image)!=null&&h.content&&(a.image.textFitWidth||a.image.textFitHeight)?Xd(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-o[0],c.y2=c.y2*s+o[2],c.x1=c.x1*s-o[3],c.x2=c.x2*s+o[1];let p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),u){let f=new B(c.x1,c.y1),d=new B(c.x2,c.y1),y=new B(c.x1,c.y2),m=new B(c.x2,c.y2),g=u*Math.PI/180;f._rotate(g),d._rotate(g),y._rotate(g),m._rotate(g),c.x1=Math.min(f.x,d.x,y.x,m.x),c.x2=Math.max(f.x,d.x,y.x,m.x),c.y1=Math.min(f.y,d.y,y.y,m.y),c.y2=Math.max(f.y,d.y,y.y,m.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,r,i,n)}this.boxEndIndex=t.length}},Mb=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}};function Bb(t,e=1){let r=Fa.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Mb([],Pb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new B(s,o);for(let p=s;pc.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new qr(p.p.x-n,p.p.y-n,n,t)),a.push(new qr(p.p.x+n,p.p.y-n,n,t)),a.push(new qr(p.p.x-n,p.p.y+n,n,t)),a.push(new qr(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Pb(t,e){return e.max-t.max}var qr=class{constructor(t,e,r,i){this.p=new B(t,e),this.h=r,this.d=zb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function zb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;at.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,td(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Lb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;ap*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new De(l)}let a=i.get("text-variable-anchor");if(a){let o;o=t._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(e,{},r).map(u=>u*24):[i.get("text-radial-offset").evaluate(e,{},r)*24,lu];let l=[];for(let u of a)l.push(u,ty(u,o));return new De(l)}return null}function Ob(t){var h,c;t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=mt/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new st(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new st(p),t.canonical),n["text-size"].possiblyEvaluate(new st(f),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new st(p),t.canonical),n["icon-size"].possiblyEvaluate(new st(f),t.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let p of t.bucket.features){let f=i.get("text-font").evaluate(p,{},t.canonical).join(","),d=u.evaluate(p,{},t.canonical),y=a.layoutTextSize.evaluate(p,{},t.canonical),m=a.layoutIconSize.evaluate(p,{},t.canonical),g={horizontal:{},vertical:void 0},x=p.text,v=[0,0];if(x){let _=x.toString(),S=i.get("text-letter-spacing").evaluate(p,{},t.canonical)*24,k=bv(_)?S:0,z=i.get("text-anchor").evaluate(p,{},t.canonical),O=ey(r,p,t.canonical);if(!O){let $=i.get("text-radial-offset").evaluate(p,{},t.canonical);v=$?ty(z,[$*24,lu]):i.get("text-offset").evaluate(p,{},t.canonical).map(U=>U*24)}let P=o?"center":i.get("text-justify").evaluate(p,{},t.canonical),L=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(p,{},t.canonical)*24:1/0,F=()=>{t.bucket.allowVerticalPlacement&&el(_)&&(g.vertical=ra(x,t.glyphMap,t.glyphPositions,t.imagePositions,f,L,s,z,"left",k,v,2,!0,y,d))};if(!o&&O){let $=new Set;if(P==="auto")for(let T=0;T{T.x<0||T.x>=8192||T.y<0||T.y>=8192||Nb(t,T,U,r,i,n,L,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[D,D,D,D],S,l,v,A,k,d,e,a,u,h,s)};if(z==="line")for(let U of Eb(e.geometry,0,0,mt,mt)){let T=cr(U,F),q=Sb(T,b,_,r.vertical||y,i,24,x,t.overscaling,mt);for(let at of q){let ot=y;(!ot||!Ub(t,ot.text,O,at))&&$(T,at)}}else if(z==="line-center"){for(let U of e.geometry)if(U.length>1){let T=cr(U,F),q=Ab(T,_,r.vertical||y,i,24,x);q&&$(T,q)}}else if(e.type==="Polygon")for(let U of Ra(e.geometry,0)){let T=Bb(U,16);$(cr(U[0],F,!0),new Jr(T.x,T.y,0))}else if(e.type==="LineString")for(let U of e.geometry){let T=cr(U,F);$(T,new Jr(T[0].x,T[0].y,0))}else if(e.type==="Point")for(let U of e.geometry)for(let T of U)$([T],new Jr(T.x,T.y,0))}function $b(t,e){let r=t.length,i=e==null?void 0:e.values;if((i==null?void 0:i.length)>0)for(let n=0;n32640&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let v of c)p[v]=t.text.placedSymbolArray.length-1;return m.length*4}function ry(t){for(let e in t)return t[e];return null}function Nb(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S){let k=t.addToLineVertexArray(e,r),z=o.layout.get("symbol-height-offset").evaluate(b,{},_);z>t.maxHeightOffset&&(t.maxHeightOffset=z);let O,P,L,F,$=0,U=0,T=0,q=0,at=-1,ot=-1,pt={},Et=(0,Mo.default)("");if(t.allowVerticalPlacement&&i.vertical){let J=o.layout.get("text-rotate").evaluate(b,{},_)+90,W=i.vertical;L=new sa(l,e,u,h,c,W,p,f,d,J),s&&(F=new sa(l,e,u,h,c,s,m,g,d,J))}if(n){let J=o.layout.get("icon-rotate").evaluate(b,{}),W=o.layout.get("icon-text-fit")!=="none",M=Pc(n,J,A,W),ut=s?Pc(s,J,A,W):void 0;P=new sa(l,e,u,h,c,n,m,g,!1,J),$=M.length*4;let X=t.iconSizeData,G=null;X.kind==="source"?(G=[128*o.layout.get("icon-size").evaluate(b,{})],G[0]>32640&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):X.kind==="composite"&&(G=[128*D.compositeIconSizes[0].evaluate(b,{},_),128*D.compositeIconSizes[1].evaluate(b,{},_)],(G[0]>32640||G[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,M,G,v,x,b,0,e,k.lineStartIndex,k.lineLength,-1,_,z),at=t.icon.placedSymbolArray.length-1,ut&&(U=ut.length*4,t.addSymbols(t.icon,ut,G,v,x,b,2,e,k.lineStartIndex,k.lineLength,-1,_,z),ot=t.icon.placedSymbolArray.length-1)}let qt=Object.keys(i.horizontal);for(let J of qt){let W=i.horizontal[J];O||(O=(Et=(0,Mo.default)(W.text),new sa(l,e,u,h,c,W,p,f,d,o.layout.get("text-rotate").evaluate(b,{},_))));let M=W.positionedLines.length===1;if(T+=Vc(t,e,W,a,o,d,b,y,z,k,i.vertical?1:3,M?qt:[J],pt,at,D,_),M)break}i.vertical&&(q+=Vc(t,e,i.vertical,a,o,d,b,y,z,k,2,["vertical"],pt,ot,D,_));let Ht=O?O.boxStartIndex:t.collisionBoxArray.length,Ve=O?O.boxEndIndex:t.collisionBoxArray.length,ye=L?L.boxStartIndex:t.collisionBoxArray.length,Kt=L?L.boxEndIndex:t.collisionBoxArray.length,Oe=P?P.boxStartIndex:t.collisionBoxArray.length,kr=P?P.boxEndIndex:t.collisionBoxArray.length,rr=F?F.boxStartIndex:t.collisionBoxArray.length,fi=F?F.boxEndIndex:t.collisionBoxArray.length,kt=-1,Ee=(J,W)=>J!=null&&J.circleDiameter?Math.max(J.circleDiameter,W):W;kt=Ee(O,kt),kt=Ee(L,kt),kt=Ee(P,kt),kt=Ee(F,kt);let ir=+(kt>-1);ir&&(kt*=S/24),t.glyphOffsetArray.length>=t.maxGlyphs&&Bt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),b.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);let Tr=ey(o,b,_),[Ir,R]=$b(t.textAnchorOffsets,Tr);t.symbolInstances.emplaceBack(e.x,e.y,pt.right>=0?pt.right:-1,pt.center>=0?pt.center:-1,pt.left>=0?pt.left:-1,pt.vertical||-1,at,ot,Et,Ht,Ve,ye,Kt,Oe,kr,rr,fi,u,T,q,$,U,ir,0,p,kt,Ir,R,z)}function Ub(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cc(this.zoom,e["text-size"]),this.iconSizeData=Cc(this.zoom,e["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=Oc(r,"text-overlap","text-allow-overlap")!=="never"||Oc(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>Nd[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new al(new vr(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new al(new vr(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new Uf,this.lineVertexArray=new qf,this.symbolInstances=new Nf,this.textAnchorOffsets=new Gf}calculateGlyphDependencies(t,e,r,i,n){var l;let a=(i||this.allowVerticalPlacement)&&n,s=iu.fromFeature(t,r),o=s.graphemes();for(let u=0;u0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new st(this.zoom);for(let{feature:m,id:g,index:x,sourceLayerIndex:v}of t){let b=i._featureFilter.needGeometry,D=hi(m,b);if(!i._featureFilter.filter(d,D,r))continue;b||(D.geometry=Ar(m));let A;if(l){let z=i.getValueAndResolveTokens("text-field",D,r,f),O=ze.factory(z);this.hasRTLText||(this.hasRTLText=Gb(O)),A=gv(O,i,D)}let _;if(u){let z=i.getValueAndResolveTokens("icon-image",D,r,f);_=z instanceof _e?z:_e.fromString(z)}if(!A&&!_)continue;let S=this.sortFeaturesByKey?h.evaluate(D,{},r):void 0,k={id:g,text:A,icon:_,index:x,sourceLayerIndex:v,geometry:D.geometry,properties:m.properties,type:Dn.types[m.type],sortKey:S};if(this.features.push(k),_&&(c[_.name]=!0),A){let z=a.evaluate(D,{},r).join(","),O=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=(y=this.writingModes)==null?void 0:y.includes(2);let P=el(A.toString());this.calculateGlyphDependencies(A,p,z,O,P);for(let L of A.sections)L.image&&(c[L.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=xv(this.features)),this.sortFeaturesByKey&&this.features.sort((m,g)=>m.sortKey-g.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}addFeatures({options:t,canonical:e,glyphMap:r,glyphPositions:i,iconMap:n,iconPositions:a,showCollisionBoxes:s}){Ob({bucket:this,glyphMap:r,glyphPositions:i,imageMap:n,imagePositions:a,showCollisionBoxes:s,canonical:e,subdivisionGranularity:t.subdivisionGranularity})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;ni[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(r==null?void 0:r.sortKey)===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",iy,{omit:["layers","collisionBoxArray","features","compareText"]});function Xb(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):"")}var Yb,Wb=()=>Yb||(Yb=new Xt({"symbol-placement":new V(w.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new V(w.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new V(w.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new N(w.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new V(w.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new V(w.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new V(w.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new V(w.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new V(w.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new N(w.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new N(w.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new V(w.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new V(w.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new N(w.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new N(w.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new N(w.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new V(w.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new N(w.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new N(w.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new V(w.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new V(w.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new V(w.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new N(w.layout_symbol["text-field"],"text-field"),"text-font":new N(w.layout_symbol["text-font"],"text-font"),"text-size":new N(w.layout_symbol["text-size"],"text-size"),"text-max-width":new N(w.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new V(w.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new N(w.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new N(w.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new N(w.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new V(w.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new N(w.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new N(w.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new V(w.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new V(w.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new N(w.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new V(w.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new V(w.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new N(w.layout_symbol["text-transform"],"text-transform"),"text-offset":new N(w.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new V(w.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new V(w.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new V(w.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new V(w.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new N(w.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new V(w.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})),Zb,Hb=()=>Zb||(Zb=new Xt({"icon-opacity":new N(w.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new N(w.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new N(w.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new N(w.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new N(w.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new V(w.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new V(w.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new N(w.paint_symbol["text-opacity"],"text-opacity"),"text-color":new N(w.paint_symbol["text-color"],"text-color",{runtimeType:ce,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new N(w.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new N(w.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new N(w.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new V(w.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new V(w.paint_symbol["text-translate-anchor"],"text-translate-anchor")})),Ys={get paint(){return Hb()},get layout(){return Wb()}},ny=class{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:dn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e!=null&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};C("FormatSectionOverride",ny,{omit:["defaultValue"]});var Kb=class ol extends de{constructor(e,r){super(e,Ys,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new se(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!ja(s.value)&&a?Xb(r.properties,a):a}createBucket(e){return new iy(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Ys.paint.overridableProperties){if(!ol.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Il(new ny(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new an("source",i):new wa("composite",i,r.value.zoomStops),this.paint._values[e]=new se(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:ol.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=Ys.paint.properties[r],a=!1,s=o=>{var l;for(let u of o)if((l=n.overrides)!=null&&l.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof ze)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof ri&&_t(u.value)===yn){let h=u.value;s(h.sections)}else u instanceof Ep?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Jb(t,e,r,i=1){var a;let n=(a=t.get("icon-padding").evaluate(e,{},r))==null?void 0:a.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Qb,tw=()=>Qb||(Qb=new Xt({"background-color":new V(w.paint_background["background-color"],"background-color"),"background-pattern":new Lf(w.paint_background["background-pattern"],"background-pattern"),"background-opacity":new V(w.paint_background["background-opacity"],"background-opacity")})),ew={get paint(){return tw()}};var rw=class extends de{constructor(t,e){super(t,ew,e)}};var iw=class extends de{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function ay(t,e){if(t.type==="custom")return new iw(t,e);switch(t.type){case"background":return new rw(t,e);case"circle":return new Bg(t,e);case"color-relief":return new Yg(t,e);case"fill":return new Ex(t,e);case"fill-extrusion":return new Hx(t,e);case"heatmap":return new Rg(t,e);case"hillshade":return new qg(t,e);case"line":return new G2(t,e);case"raster":return new Xm(t,e);case"symbol":return new Kb(t,e)}}var nw=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,(t=this._channel)==null||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},aw={once:!0},sy=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new nw(()=>this.process()),this.subscription=hh(this.target,"message",r=>this.receive(r),!1),this.globalScope=mr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?hh(e.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new dl(e.signal.reason))},aw):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),r(l)},reject:l=>{a==null||a.unsubscribe(),i(l)}};let s=[],o=Si(je({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Yi(t.data,s)});this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=["file://","resource://android","null"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if((a||s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(mr(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){return rt(this,null,function*(){if(e.type===""){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Ki(Wi(e.error))):n.resolve(Wi(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Wi(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=yield this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Ki(n))}})}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Yi(e):null,data:Yi(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function sw(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var oy=class{constructor(t,e,r){if(!sw(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Hi(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=lw(this.x,this.y,this.z),n=uw(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new B((t.x*e-this.x)*mt,(t.y*e-this.y)*mt)}toString(){return`${this.z}/${this.x}/${this.y}`}},ow=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Hi(t,e.z,e.z,e.x,e.y)}},uu=class ne{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new oy(i,+n,+a),this.key=Hi(r,e,i,n,a)}clone(){return new ne(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new ne(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ne(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Hi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Hi(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ne(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new ne(r,this.wrap,r,i,n),new ne(r,this.wrap,r,i+1,n),new ne(r,this.wrap,r,i,n+1),new ne(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrape.wrap?!1:this.overscaledZe.overscaledZ?!1:this.canonical.xe.canonical.x?!1:this.canonical.y=0&&e=0&&r=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new ne(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Hi(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<0;n--){let a=1<pw(n,a,r),t.layers[i])}function pw(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s>31}function yw(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(Zs(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},gw=class{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]=="string"&&t.properties[a].startsWith("__$json__:")&&(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=dd(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}},Sr=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){var e;return((e=this.nullabilityBuffer)==null?void 0:e.get(t))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},ts=class extends Sr{},pu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},fu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},uy=class extends Sr{constructor(t,e,r,i){super(t,e,i),this.delta=r}},du=class extends uy{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},yu=class extends Sr{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},xw=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){var t;return(t=this._propertyVectors)!=null?t:[]}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r>>32-t;var ul=mu,py=65536;function gu(t,e){return t-t%e}function vw(t){return gu(t+31,32)}function bw(t){if(!Number.isFinite(t)||t<=0)return py;let e=gu(Math.floor(t),256);return e===0?256:e}function ww(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function Dw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function _w(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function Aw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function Sw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function Ew(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function Fw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function kw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function Tw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function Iw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function Cw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function Mw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function Bw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,v=t[e+14]>>>0,b=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=v>>>0&65535,r[n++]=v>>>16&65535,r[n++]=b>>>0&65535,r[n]=b>>>16&65535}function Pw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function zw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function Lw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function Vw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function Ow(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function Rw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function $w(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function Nw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function Uw(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function qw(t,e,r,i,n){let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<>>0)}}var hl=bw(py),jw=3*hl/256+hl|0;function fy(){let t=new Uint8Array(jw);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Gw(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:fy()}}function Xw(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function Yw(t,e,r,i){i.byteContainer.length>>2;if(n.byteOffset&3)for(let o=0;o>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u>>(u<<3)&255}return n}function Ww(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=vw(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length>>5)|0,r.exceptionSizes[a]=s}return e}function Zw(t,e,r,i,n){switch(n){case 1:Pw(t,e,r,i);break;case 2:zw(t,e,r,i);break;case 3:Lw(t,e,r,i);break;case 4:Vw(t,e,r,i);break;case 5:Ow(t,e,r,i);break;case 6:Rw(t,e,r,i);break;case 7:$w(t,e,r,i);break;case 8:Nw(t,e,r,i);break;case 16:Uw(t,e,r,i);break;default:qw(t,e,r,i,n)}return e+(n<<3)|0}function Hw(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function Kw(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function Jw(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=Kw(n,a,s,r,i,l);if(s=c,h===1){let m=1<y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m0&&(c=Jw(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function t3(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=Yw(t,p,h,a),y=h,m=Ww(t,f,a);return a.dataPointers.fill(0),Qw(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function e3(t,e,r,i,n,a){let s=i+gu(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(hl,s-o);l=t3(t,e,l,o,u,a),o=o+u|0}return l}function r3(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function i3(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r!=null?r:fy();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=e3(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return r3(t,i,o,a,n,l),a}function n3(t,e,r,i,n){switch(n){case 2:Dw(t,e,r,i);return;case 3:_w(t,e,r,i);return;case 4:Aw(t,e,r,i);return;case 5:Sw(t,e,r,i);return;case 6:Ew(t,e,r,i);return;case 7:Fw(t,e,r,i);return;case 8:kw(t,e,r,i);return;case 9:Tw(t,e,r,i);return;case 10:Iw(t,e,r,i);return;case 11:Cw(t,e,r,i);return;case 12:Mw(t,e,r,i);return;case 16:Bw(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=ul[n-h]>>>0,f=(c|(l&p)<t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length0){let o=t.byteOffset+e;if(o&3)for(let l=0;l=64)throw Error("Varint too long")}return e.set(n),r}function o3(t,e,r){let i=new Float64Array(r);for(let n=0;n>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error("Expected varint not more than 10 bytes")}function h3(t,e,r,i){return c3(t,e,r,i,Gw(r>>>2))}function c3(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=Xw(n,s);a3(t,a,r,o);let l=i3(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function et(t){return t>>>1^-(t&1)}function Ot(t){return t>>BigInt(1)^-(t&BigInt(1))}function We(t){return t%2==1?(t+1)/-2:t/2}function p3(t){let e=new Int32Array(t.length);for(let r=0;r=4)for(;i=4)for(;i=4)for(;r=4)for(let i=t[0];r=4)for(;i=4)for(;l>>0;for(let r=1;r>>0;return e}function jc(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,Ot(t[0]));for(let r=1;r>>0,e[1]=et(t[1])>>>0;for(let r=2;r>>0,e[r+1]=e[r-1]+et(t[r+1])>>>0;return e}function F3(t,e,r,i){let n=yy(t,e,r,i);return new Uint32Array(n)}function k3(t){return t[1]}function T3(t){return et(t[1])}function I3(t){if(t.length===2){let e=et(t[1]);return[e,e]}return[et(t[2]),et(t[3])]}function C3(t){return t[1]}function M3(t){return Ot(t[1])}function B3(t){if(t.length===2){let e=Ot(t[1]);return[e,e]}return[Ot(t[2]),Ot(t[3])]}var St;(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(St||(St={}));var jt;(function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"})(jt||(jt={}));var Me;(function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"})(Me||(Me={}));var Ct;(function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"})(Ct||(Ct={}));var P3=[St.PRESENT,St.DATA,St.OFFSET,St.LENGTH],Gc=[H.NONE,H.DELTA,H.COMPONENTWISE_DELTA,H.RLE,H.MORTON],z3=[le.NONE,le.FAST_PFOR,le.VARINT],L3=[jt.NONE,jt.SINGLE,jt.SHARED,jt.VERTEX,jt.MORTON,jt.FSST],V3=[Me.VERTEX,Me.INDEX,Me.STRING,Me.KEY],O3=[Ct.VAR_BINARY,Ct.GEOMETRIES,Ct.PARTS,Ct.RINGS,Ct.TRIANGLES,Ct.SYMBOL,Ct.DICTIONARY];function ct(t,e){let r=N3(t,e);return r.logicalLevelTechnique1===H.MORTON?R3(r,t,e):(H.RLE===r.logicalLevelTechnique1||H.RLE===r.logicalLevelTechnique2)&&le.NONE!==r.physicalLevelTechnique?$3(r,t,e):r}function R3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function $3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function N3(t,e){let r=t[e.get()],i=P3[r>>4],n={};switch(i){case St.DATA:n={dictionaryType:L3[r&15]};break;case St.OFFSET:n={offsetType:V3[r&15]};break;case St.LENGTH:n={lengthType:O3[r&15]}}e.increment();let a=t[e.get()],s=Gc[a>>5],o=Gc[a>>2&7],l=z3[a&3];e.increment();let u=$t(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var ht;(function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ht||(ht={}));var fe=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<>r&1}size(){return this._size}getBuffer(){return this.values}};function Er(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u=12?X3.decode(t.subarray(e,r)):Y3(t,e,r)}function Y3(t,e,r){let i="",n=e;for(;n239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Ta(t,e,r,i,n){return J3(pi(t,e,r),r,i,n)}function Vt(t,e,r,i,n){return Q3(pi(t,e,r),r,i,n)}function Ze(t,e,r){return e6(pi(t,e,r),r)}function pi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.FAST_PFOR:return h3(t,r.numValues,r.byteLength,e);case le.VARINT:return $t(t,e,r.numValues);case le.NONE:return j3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function _n(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.VARINT:return xu(t,e,r.numValues);case le.NONE:return G3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function W3(t,e,r){let i=pi(t,e,r);return i.length===1?et(i[0]):T3(i)}function wu(t,e,r){let i=pi(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?et(i[0]):i[0]:k3(i)}function vy(t,e,r){return I3(pi(t,e,r))}function by(t,e,r){return B3(xu(t,e,r.numValues))}function wy(t,e,r,i){return _y(_n(t,e,r),r,i)}function Du(t,e,r,i){return Ay(_n(t,e,r),r,i)}function Z3(t,e,r,i){let n=H3(t,e,r,!1);return i?Er(n,i,0):n}function H3(t,e,r,i){if(r.physicalLevelTechnique===le.VARINT)return t6(o3(t,e,r.numValues),r,i);let n=_n(t,e,r),a=i?_y(n,r):Ay(n,r);return Float64Array.from(a,Number)}function K3(t,e,r){let i=_n(t,e,r);return i.length===1?Ot(i[0]):M3(i)}function Dy(t,e,r){let i=_n(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?Ot(i[0]):i[0]:C3(i)}function J3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;if(!i)return A3(t,a.runs,a.numRleValues);t=cl(t,a.runs,a.numRleValues),n=Nc(t)}else n=Nc(t);break;case H.RLE:n=m3(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=new Int32Array(t);break;case H.COMPONENTWISE_DELTA:if(r&&!i)return yy(t,r.scale,r.min,r.max);n=b3(t);break;case H.NONE:n=p3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function Q3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;n=qc(cl(t,a.runs,a.numRleValues))}else n=qc(t);break;case H.RLE:n=cl(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=t;break;case H.COMPONENTWISE_DELTA:n=r&&!i?F3(t,r.scale,r.min,r.max):E3(t);break;case H.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function _y(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;if(!r)return S3(t,n.runs,n.numRleValues);t=pl(t,n.runs,n.numRleValues),i=Uc(t)}else i=Uc(t);break;case H.RLE:i=g3(t,e.runs,e.numRleValues);break;case H.NONE:i=f3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function Ay(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;i=jc(pl(t,n.runs,n.numRleValues))}else i=jc(t);break;case H.RLE:i=pl(t,e.runs,e.numRleValues);break;case H.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function t6(t,e,r){switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let i=e;t=dy(t,i.runs,i.numRleValues)}return y3(t),t;case H.RLE:return i6(t,e,r);case H.NONE:return r&&d3(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function e6(t,e){if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.NONE)return w3(t);if(e.logicalLevelTechnique1===H.RLE&&e.logicalLevelTechnique2===H.NONE){let r=e;return _3(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===H.NONE&&e.logicalLevelTechnique2===H.NONE){v3(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.RLE){let r=e,i=D3(t,r.runs,r.numRleValues);return vu(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function es(t,e,r,i,n="int32"){let a=t.logicalLevelTechnique1;if(a===H.RLE)return t.runs===1?ht.CONST:ht.FLAT;if(a!==H.DELTA||t.logicalLevelTechnique2!==H.RLE)return t.numValues===1?ht.CONST:ht.FLAT;let s=e instanceof fe?e.size():e,o=t;if(o.numRleValues!==s)return ht.FLAT;if(o.runs===1)return ht.SEQUENCE;if(o.runs!==2)return t.numValues===1?ht.CONST:ht.FLAT;let l=i.get();if(t.physicalLevelTechnique===le.VARINT)return r6(r,i,n)?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT}function r6(t,e,r){let i=new cy(e.get());if(r==="int64"){let a=xu(t,i,4);return a[2]===BigInt(2)&&a[3]===BigInt(2)}let n=$t(t,i,4);return n[2]===2&&n[3]===2}function i6(t,e,r){return r?x3(t,e.runs,e.numRleValues):dy(t,e.runs,e.numRleValues)}var Sy=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},Ey=class extends uy{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function _u(t,e,r){return{x:Xc(t,e)-r,y:Xc(t>>1,e)-r}}function Xc(t,e){let r=0;for(let i=0;i>i;return r}var Rt;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(Rt||(Rt={}));var n6;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"})(n6||(n6={}));var Fr;(function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"})(Fr||(Fr={}));function a6(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g[D]),r+=v,i+=v}break;case Rt.LINESTRING:{let v;y?(v=p[i]-p[i-1],i++):v=c[r]-c[r-1],r++;let b;d?(b=Or(m,s,v,!1),s+=v*2):(b=lr(t.vertexBufferType,m,f,o,v,!1,l),o+=v),e[a++]=[b],h&&n++}break;case Rt.POLYGON:{let v=c[r]-c[r-1];r++;let b=Array(v-1),D,A=p[i]-p[i-1];if(i++,d){D=Or(m,s,A,!0),s+=A*2;for(let _=0;_r?e[a++]:1);return i}function Zc(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l0;)n[a++]=t[u++]}}return n}var By=class extends Au{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s!=null?s:e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){var n,a,s;(s=this.decodedDictionary)!=null||(this.decodedDictionary=(n=this.sharedDictionaryCache)==null?void 0:n.decodedDictionary,(a=this.decodedDictionary)!=null||(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return bu(this.decodedDictionary,r,i)}decodeDictionary(){var t;return(t=this.symbolLengthBuffer)!=null||(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),v6(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=ct(t,e);m=new fe(ci(t,x.numValues,x.byteLength,e),x.numValues)}let g=Vt(t,e,ct(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new By(y,g,n,a,s,o,m,c)}else h[p++]=new Qr(y,g,n,a,m)}return h}var Kc=class extends Sr{constructor(t,e,r){super(t,new Uint8Array,r!=null?r:e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},Be;(function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"})(Be||(Be={}));var pr;(function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"})(pr||(pr={}));function A6(t,e,r,i){let n=S6(r);if(i===0)return n.map(h=>new Kc(h,[]));let a=E6(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h{var i;return t.name+((i=r.name)!=null?i:"")})}function E6(t,e,r){let i=t[e.get()];e.add(1);let n=Vt(t,e,ct(t,e)),a=r-1,s=[];i&Be.STRING&&(a-=F6(t,e,s)),a-=k6(t,e,i,s),a-=T6(t,e,i,s);let o,l=0;if(i&Be.PRESENCE){let h=I6(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=Vt(t,e,ct(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function F6(t,e,r){let i=t[e.get()];e.add(1);let n=Py("",t,e,i);if(n)for(let a=0;aa.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;xs.length)throw Error("Map value stream underflow while decoding feature payload");let b=M6(s,y,v,l);f[x]=b.value,y=b.nextIndex}let m=0;for(let x=i;x=r)throw Error("Unexpected end of map value stream");let n=t[e];if(n===pr.FALSE)return{value:!1,nextIndex:e+1};if(n===pr.TRUE)return{value:!0,nextIndex:e+1};if(n===pr.START_MAP){let a=Jc(t,e,r);return{value:zy(t,e+2,a,i).value,nextIndex:a}}if(n===pr.START_LIST){let a=Jc(t,e,r),s=[],o=e+2;for(;o=r)throw Error("Missing length for nested map/list payload");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function Ly(t,e){let r=t-pr.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function Xr(t,e){for(let r of e)t.push(r)}function B6(t,e,r,i,n,a){var s;return r.type==="scalarType"?a&&!a.has(r.name)?(my(i,t,e),null):P6(i,t,e,n,r.scalarType,r):((s=r.complexType)==null?void 0:s.physicalType)===Qe.MAP?A6(t,e,r,i):i===0?null:_6(t,e,r,a)}function P6(t,e,r,i,n,a){var l;let s;if(t===0)return null;if(a.nullable){let u=ct(e,r),h=u.numValues,c=r.get(),p=ci(e,h,u.byteLength,r);r.set(c+u.byteLength),s=new fe(p,u.numValues)}let o=s!=null?s:i;switch(n.physicalType){case it.UINT_32:case it.INT_32:return R6(e,r,a,n,o);case it.STRING:{let u=a.nullable?t-1:t;return(l=Py(a.name,e,r,u,s))!=null?l:null}case it.BOOLEAN:return z6(e,r,a,i,o);case it.UINT_64:case it.INT_64:return O6(e,r,a,o,n);case it.FLOAT:return L6(e,r,a,o);case it.DOUBLE:return V6(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function z6(t,e,r,i,n){let a=ct(t,e),s=a.numValues,o=e.get(),l=An(n)?n:void 0,u=ci(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new fe(u,s);return new m6(r.name,h,n)}function L6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=gy(t,e,n.numValues,a);return new g6(r.name,s,i)}function V6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=xy(t,e,n.numValues,a);return new fu(r.name,s,i)}function O6(t,e,r,i,n){let a=ct(t,e),s=es(a,i,t,e,"int64"),o=n.physicalType===it.INT_64;if(s===ht.FLAT){let u=An(i)?i:void 0,h=o?wy(t,e,a,u):Du(t,e,a,u);return new Sy(r.name,h,i)}if(s===ht.SEQUENCE){let u=by(t,e,a);return new Ey(r.name,u[0],u[1],a.numRleValues,o)}let l=o?K3(t,e,a):Dy(t,e,a);return new My(r.name,l,i,o)}function R6(t,e,r,i,n){let a=ct(t,e),s=es(a,n,t,e),o=i.physicalType===it.INT_32;if(s===ht.FLAT){let u=An(n)?n:void 0,h=o?Ta(t,e,a,void 0,u):Vt(t,e,a,void 0,u);return new pu(r.name,h,n)}if(s===ht.SEQUENCE){let u=vy(t,e,a);return new du(r.name,u[0],u[1],a.numRleValues,o)}let l=o?W3(t,e,a):wu(t,e,a);return new yu(r.name,l,n,o)}function An(t){return t instanceof fe}var It={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function Vy(t){switch(t){case It.ID:case It.ID|It.ID_NULLABLE:case It.ID|It.ID_LONG:case It.ID|It.ID_LONG|It.ID_NULLABLE:return{nullable:(t&It.ID_NULLABLE)!==0,columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:(t&It.ID_LONG)!==0,type:"logicalType",logicalType:hy.ID}};case It.GEOMETRY:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.GEOMETRY,children:[]}};case It.STRUCT:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.STRUCT,children:[]}};case It.MAP:return{nullable:!0,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.MAP,children:[]}};default:return j6(t)}}function $6(t){return t>=It.SCALAR_BASE}function Oy(t){return t===It.STRUCT||t===It.MAP}function N6(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case it.BOOLEAN:case it.INT_8:case it.UINT_8:case it.INT_32:case it.UINT_32:case it.INT_64:case it.UINT_64:case it.FLOAT:case it.DOUBLE:return!1;case it.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case Qe.GEOMETRY:case Qe.STRUCT:case Qe.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function U6(t){var e;return t.type==="scalarType"&&((e=t.scalarType)==null?void 0:e.type)==="logicalType"&&t.scalarType.logicalType===hy.ID}function q6(t){var e;return t.type==="complexType"&&((e=t.complexType)==null?void 0:e.type)==="physicalType"&&t.complexType.physicalType===Qe.GEOMETRY}function j6(t){let e;switch(t){case 10:case 11:e=it.BOOLEAN;break;case 12:case 13:e=it.INT_8;break;case 14:case 15:e=it.UINT_8;break;case 16:case 17:e=it.INT_32;break;case 18:case 19:e=it.UINT_32;break;case 20:case 21:e=it.INT_64;break;case 22:case 23:e=it.UINT_64;break;case 24:case 25:e=it.FLOAT;break;case 26:case 27:e=it.DOUBLE;break;case 28:case 29:e=it.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}var G6=new TextDecoder,Qc="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Eu(t,e){let r=$t(t,e,1)[0];if(r===0)return"";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),G6.decode(a)}function X6(t){let e=t.name,r=t.nullable;return t.type==="scalarType"?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:r}:{type:"complexField",complexField:t.complexType,name:e,nullable:r}}function Ry(t,e){let r=$t(t,e,1)[0]>>>0,i=r>=It.SCALAR_BASE?Vy(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n=Si(je({},i),{name:Eu(t,e)});if(n.type==="complexType"&&Oy(r)){let a=n.complexType,s=$t(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o>>0,i=Vy(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Qc}`);let n;if($6(r))n=Eu(t,e);else if(r>>0,o=a.complexType;o.children=Array(s);for(let l=0;l>>0,a=$t(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=$t(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=W6(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(U6(m)){let x=null;if(m.nullable){let b=ct(t,i),D=i.get(),A=ci(t,b.numValues,b.byteLength,i);i.set(D+b.byteLength),x=new fe(A,b.numValues)}let v=ct(t,i);d=x?x.size():v.decompressedCount,c=H6(t,m,i,g,v,x!=null?x:d,r)}else if(q6(m)){let x=$t(t,i,1)[0];if(d===0){let v=i.get();d=ct(t,i).decompressedCount,i.set(v)}e&&(e.scale=e.extent/u),p=f6(t,x,i,d,e)}else{let x=N6(m)?$t(t,i,1)[0]:1;if(x===0)continue;let v=B6(t,i,m,x,d,void 0);if(v)if(Array.isArray(v))for(let b of v)f.push(b);else f.push(v)}}let y=new xw(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function H6(t,e,r,i,n,a,s=!1){var h;let o=(h=e.scalarType)!=null&&h.longID?it.UINT_64:it.UINT_32,l=typeof a=="number"?void 0:a,u=es(n,a,t,r,o===it.UINT_64?"int64":"int32");if(o===it.UINT_32)switch(u){case ht.FLAT:return new pu(i,Vt(t,r,n,void 0,l),a);case ht.SEQUENCE:{let c=vy(t,r,n);return new du(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new yu(i,wu(t,r,n),a,!1)}switch(u){case ht.FLAT:return s?new fu(i,Z3(t,r,n,l),a):new Sy(i,Du(t,r,n,l),a);case ht.SEQUENCE:{let c=by(t,r,n);return new Ey(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new My(i,Dy(t,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var K6=class{constructor(t,e){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},(r=this._featureData.geometry)==null?void 0:r.type){case Rt.POINT:case Rt.MULTIPOINT:this.type=1;break;case Rt.LINESTRING:case Rt.MULTILINESTRING:this.type=2;break;case Rt.POLYGON:case Rt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new B(i.x,i.y));t.push(r)}return t}},J6=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new K6(this.features[t],this.extent)}},Fu=class{constructor(t){this.layers={};let e=Z6(new Uint8Array(t));this.layers=e.reduce((r,i)=>Si(je({},r),{[i.name]:new J6(i)}),{})}},ku=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new uo(mt,16,0),this.grid3D=new uo(mt,16,0),this.featureIndexArray=new Yf,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){return this.vtLayers||(this.encoding==="mlt"?this.vtLayers=new Fu(this.rawTileData).layers:this.vtLayers=new Xl(new au(this.rawTileData)).layers,this.sourceLayerCoder=new cu(this.vtLayers?Object.keys(this.vtLayers).sort():[ll])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=mt/t.tileSize/t.scale,s=ai(n.filter,"queryRenderedFeatures filter",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=Fa.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Fa.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>vg(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(t5);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,v,b)=>(g||(g=Ar(x)),v.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:b,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=hi(f,!0);if(!n.filter(new st(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new st(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=Gt({},l[y]);x.paint=tp(x.paint,m.paint,f,g,s),x.layout=tp(x.layout,m.layout,f,g,s);let v=!h||h(f,m,g);if(!v)continue;let b=new gw(f,this.z,this.x,this.y,d);b.layer=x;let D=t[y];D===void 0&&(D=t[y]=[]),D.push({featureIndex:i,feature:b,intersectionZ:v})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=ai(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){var i;let r=t.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[n],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=t.properties)!=null&&i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};C("FeatureIndex",ku,{omit:["rawTileData","sourceLayerCoder"]});function Q6(t){return typeof t=="object"&&!!t&&"evaluate"in t}function tp(t,e,r,i,n){return Ia(t,(a,s)=>{let o=e instanceof Ya?e.get(s):null;return Q6(o)?o.evaluate(r,i,void 0,n):o})}function t5(t,e){return e-t}var $y=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function Tu(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n="[";for(let a of t)n+=`${Tu(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i="{";for(let n=0;nthis._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||(l=this.familiesBySource[o]={});let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||(h=l[u]=[]),h.push(a)}}},qy=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=su(r),a=new Ja({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Ja.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};C("GlyphAtlas",qy);var jy=class{constructor(t){this.tileID=new uu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,e,r,i,n){return rt(this,null,function*(){this.data=t,this.collisionBoxArray=new Ll;let a=new cu(Object.keys(t.layers).sort()),s=new ku(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let S in u){let k=t.layers[S];if(!k)continue;k.version===1&&Bt(`Vector tile source "${this.source}" layer "${S}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let z=a.encode(S),O=[];for(let P=0;PF.id)))}}let h=Ia(l.glyphDependencies,S=>Object.keys(S));for(let S of this.inFlightDependencies)S==null||S.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let S=new AbortController;this.inFlightDependencies.push(S),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},S)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let S=new AbortController;this.inFlightDependencies.push(S),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},S)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let S=new AbortController;this.inFlightDependencies.push(S),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},S)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let S=new AbortController;this.inFlightDependencies.push(S),g=i.sendAsync({type:"GDA",data:{dashes:m}},S)}let[x,v,b,D]=yield Promise.all([c,f,y,g]),A=new qy(x),_=new ou(v,b);for(let S in o){let k=o[S];k.hasDependencies&&(Ny(k.layers,this.zoom,r),k.addFeatures({options:l,canonical:this.tileID.canonical,glyphMap:x,glyphPositions:A.positions,iconMap:v,iconPositions:_.iconPositions,patternMap:b,patternPositions:_.patternPositions,dashPositions:D,showCollisionBoxes:this.showCollisionBoxes}))}return{buckets:Object.values(o).filter(S=>!S.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:_,dashPositions:D,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?A.positions:null}})}};function Ny(t,e,r){let i=new st(e);for(let n of t)n.recalculate(i,r)}var Gy=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e!=null&&e.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Xy=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},n5=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new B(e.x,e.y)))}},a5=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},s5=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function o5(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l0&&l.addLayer(d)}let h={vectorTile:l,rawData:hu(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}},u5=class{constructor(){this.loaded={}}loadTile(t){return rt(this,null,function*(){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+4,u=i.height+4,h=Ca(i)?new Zt({width:l,height:u},yield ap(i,-2,-2,l,u)):i,c=new jl(e,h,r,n,a,s,o);return this.loaded||(this.loaded={}),this.loaded[e]=c,c})}removeTile(t){let e=this.loaded,r=t.uid;e!=null&&e[r]&&delete e[r]}},h5=class{constructor(t,e,r,i=c5){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Gy,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new ly(n.features,{version:2,extent:mt});return{vectorTile:a,rawData:hu(a,np).buffer}}loadTile(t){return rt(this,null,function*(){let{uid:e}=t,r=new jy(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),yield this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}})}_parseWorkerTile(t,e){return rt(this,null,function*(){let r=this.tileState.getParsing(t.uid),i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Gt({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(t.uid)}return i})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}loadData(t){return rt(this,null,function*(){var r;(r=this._pendingRequest)==null||r.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let i={};return t.request&&(i.data=t.data),this._finishRequestTiming(e,t,i),i}catch(i){if(delete this._pendingRequest,!yl(i))throw i;return{abandoned:!0}}})}_startRequestTiming(t){var e;if((e=t.request)!=null&&e.collectResourceTiming)return new Xy(t.request.url)}_finishRequestTiming(t,e,r){let i=t==null?void 0:t.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return yield this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}loadAndProcessGeoJSON(t,e){return rt(this,null,function*(){var r;if(t.request&&(t.data=(yield up(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){(r=this._geoJSONIndex)!=null||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Yy(t)),this._geoJSONIndex==null)throw Error(`Input data given to \'${t.source}\' is not a valid GeoJSON object.`)})}_filterGeoJSON(t,e,r){if(t.type!=="FeatureCollection")return t;let i=this._getFilterPredicate(e,r);return i?{type:"FeatureCollection",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!="boolean"&&!(t!=null&&t.length))return;let r=er(t,`sources.${e}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}removeSource(t){return rt(this,null,function*(){var e;(e=this._pendingRequest)==null||e.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function c5(t,e){let r=Gt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Yy(e)});return new Td(t,r)}function Yy({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=er(h,`sources.${r}.clusterProperties.${l}[1]`),p=er(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}function Uy(t){return rt(this,null,function*(){if(t.endsWith(".mjs")){yield import(t);return}let e=yield fetch(t,{credentials:"same-origin"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=yield e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{yield import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)})}var p5=class{constructor(t){this.self=t,this.actor=new sy(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=sp,this.self.removeProtocol=op,this.self.registerRTLTextPlugin=e=>{wr.setMethods(e)},this.self.makeRequest=Ma,this.actor.registerMessageHandler("LDT",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",(e,r)=>rt(this,null,function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",(e,r)=>rt(this,null,function*(){var n,a;if(!((a=(n=this.workerSources[e])==null?void 0:n[r.type])!=null&&a[r.source]))return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)})),this.actor.registerMessageHandler("RM",e=>rt(this,null,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)})),this.actor.registerMessageHandler("SR",(e,r)=>rt(this,null,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler("IS",(e,r)=>rt(this,null,function*(){yield Uy(r)})),this.actor.registerMessageHandler("SI",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler("UL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))})),this.actor.registerMessageHandler("UGS",(e,r)=>rt(this,null,function*(){let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]})),this.actor.registerMessageHandler("SL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).replace(r,this._getGlobalState(e))}))}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}_setImages(t,e){return rt(this,null,function*(){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}})}_syncRTLPluginState(t,e){return rt(this,null,function*(){return yield wr.syncState(e,Uy)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i5),e}_getWorkerSource(t,e,r){var i,n;if((i=this.workerSources)[t]||(i[t]={}),(n=this.workerSources[t])[e]||(n[e]={}),!this.workerSources[t][e][r]){let a={sendAsync:(s,o)=>(s.targetMapId=t,this.actor.sendAsync(s,o))};switch(e){case"vector":this.workerSources[t][e][r]=new l5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new h5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){var r,i;return(r=this.demWorkerSources)[t]||(r[t]={}),(i=this.demWorkerSources[t])[e]||(i[e]=new u5),this.demWorkerSources[t][e]}};mr(self)&&(self.worker=new p5(self));export{p5 as default};\n/*! Bundled license information:\n\nmaplibre-gl/dist/maplibre-gl-shared.mjs:\nmaplibre-gl/dist/maplibre-gl-worker.mjs:\n (**\n * MapLibre GL JS\n * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt\n *)\n*/\n'}}),Use=de({"src/plots/map/layers.js"(e,r){"use strict";var t=Qt(),i=Zo().sanitizeHTML,a=s9(),o=D0();function s(f,h){this.subplot=f,this.uid=f.uid+"-"+h,this.index=h,this.idSource="source-"+this.uid,this.idLayer=o.layoutLayerPrefix+this.uid,this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}var l=s.prototype;l.update=function(h){this.visible?this.needsNewImage(h)?this.updateImage(h):this.needsNewSource(h)?(this.removeLayer(),this.updateSource(h),this.updateLayer(h)):this.needsNewLayer(h)?this.updateLayer(h):this.updateStyle(h):(this.updateSource(h),this.updateLayer(h)),this.visible=n(h)},l.needsNewImage=function(f){var h=this.subplot.map;return h.getSource(this.idSource)&&this.sourceType==="image"&&f.sourcetype==="image"&&(this.source!==f.source||JSON.stringify(this.coordinates)!==JSON.stringify(f.coordinates))},l.needsNewSource=function(f){return this.sourceType!==f.sourcetype||JSON.stringify(this.source)!==JSON.stringify(f.source)||this.layerType!==f.type},l.needsNewLayer=function(f){return this.layerType!==f.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(f){var h=this.subplot.map;h.getSource(this.idSource).updateImage({url:f.source,coordinates:f.coordinates});var d=this.findFollowingMapLayerId(this.lookupBelow());d!==null&&this.subplot.map.moveLayer(this.idLayer,d)},l.updateSource=function(f){var h=this.subplot.map;if(h.getSource(this.idSource)&&h.removeSource(this.idSource),this.sourceType=f.sourcetype,this.source=f.source,!!n(f)){var d=c(f);h.addSource(this.idSource,d)}},l.findFollowingMapLayerId=function(f){if(f==="traces")for(var h=this.subplot.getMapLayers(),d=0;d0){for(var d=0;d0}function u(f){var h={},d={};switch(f.type){case"circle":t.extendFlat(d,{"circle-radius":f.circle.radius,"circle-color":f.color,"circle-opacity":f.opacity});break;case"line":t.extendFlat(d,{"line-width":f.line.width,"line-color":f.color,"line-opacity":f.opacity,"line-dasharray":f.line.dash});break;case"fill":t.extendFlat(d,{"fill-color":f.color,"fill-outline-color":f.fill.outlinecolor,"fill-opacity":f.opacity});break;case"symbol":var p=f.symbol,g=a(p.textposition,p.iconsize);t.extendFlat(h,{"icon-image":p.icon,"icon-size":p.iconsize/10,"text-field":p.text,"text-size":p.textfont.size,"text-anchor":g.anchor,"text-offset":g.offset,"symbol-placement":p.placement}),t.extendFlat(d,{"icon-color":f.color,"text-color":p.textfont.color,"text-opacity":f.opacity});break;case"raster":t.extendFlat(d,{"raster-fade-duration":0,"raster-opacity":f.opacity});break}return{layout:h,paint:d}}function c(f){var h=f.sourcetype,d=f.source,p={type:h},g;return h==="geojson"?g="data":h==="vector"?g=typeof d=="string"?"url":"tiles":h==="raster"?(g="tiles",p.tileSize=256):h==="image"&&(g="url",p.coordinates=f.coordinates),p[g]=d,f.sourceattribution&&(p.attribution=i(f.sourceattribution)),p}r.exports=function(h,d,p){var g=new s(h,d);return g.update(p),g}}}),qse=de({"src/plots/map/map.js"(e,r){"use strict";var t=(Nse(),ti(C5)),i=jse(),a=!1,o=()=>{a||(a=!0,t.setWorkerUrl(URL.createObjectURL(new Blob([i],{type:"text/javascript"}))))},s=Qt(),l=Fp(),n=Ma(),u=nn(),c=Uc(),f=$s(),h=Xd(),d=h.drawMode,p=h.selectMode,g=Zl().prepSelect,m=Zl().clearOutline,y=Zl().clearSelectionsCache,_=Zl().selectOnClick,v=D0(),x=Use();function S(E,T){this.id=T,this.gd=E;var F=E._fullLayout,D=E._context;this.container=F._glcontainer.node(),this.isStatic=D.staticPlot,this.uid=F._uid+"-"+this.id,this.div=null,this.xaxis=null,this.yaxis=null,this.createFramework(F),this.map=null,this.styleObj=null,this.traceHash={},this.layerList=[],this.belowLookup={},this.dragging=!1,this.wheeling=!1}var M=S.prototype;M.plot=function(E,T,F){var D=this,R;D.map?R=new Promise(function(P,z){D.updateMap(E,T,P,z)}):R=new Promise(function(P,z){D.createMap(E,T,P,z)}),F.push(R)},M.createMap=function(E,T,F,D){var R=this,P=T[R.id],z=R.styleObj=A(P.style),I=P.bounds,L=I?[[I.west,I.south],[I.east,I.north]]:null;let B={container:R.div,style:z.style,center:b(P.center),zoom:P.zoom,bearing:P.bearing,pitch:P.pitch,maxBounds:L,interactive:!R.isStatic,canvasContextAttributes:{preserveDrawingBuffer:R.isStatic},doubleClickZoom:!1,boxZoom:!1,attributionControl:!1},O=P._fitBounds;O&&(B.bounds=[[O.west,O.south],[O.east,O.north]],B.fitBoundsOptions={padding:v.fitBoundsPadding}),o();let G=R.map=new t.Map(B).addControl(new t.AttributionControl({compact:!0})),W={};G.setMissingStyleImageResolver(Z=>(!W[Z]&&/^[a-zA-Z0-9-]+$/.test(Z)&&(W[Z]=new Promise(J=>{let N=new Image(15,15);N.onload=()=>{G.addImage(Z,N,{sdf:!0}),J()},N.onerror=()=>J(),N.crossOrigin="Anonymous",N.src=`https://cdn.jsdelivr.net/npm/@mapbox/maki@8.2.0/icons/${Z}.svg`})),W[Z])),G.setTransformRequest(function(Z){return Z=Z.replace("https://fonts.openmaptiles.org/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold"),Z=Z.replace("https://tiles.basemaps.cartocdn.com/fonts/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold"),Z=Z.replace("https://fonts.openmaptiles.org/Open Sans Regular,Arial Unicode MS Regular","https://fonts.openmaptiles.org/Klokantech Noto Sans Regular"),{url:Z}}),G._canvas.style.left="0px",G._canvas.style.top="0px",R.rejectOnError(D),R.isStatic||R.initFx(E,T);var X=[];X.push(new Promise(function(Z){G.once("load",Z)})),X=X.concat(l.fetchTraceGeoData(E)),Promise.all(X).then(function(){O&&C(R,P),w(R,P),R.fillBelowLookup(E,T),R.updateData(E),R.updateLayout(T),R.resolveOnRender(F)}).catch(D)},M.updateMap=function(E,T,F,D){var R=this,P=R.map,z=T[this.id];R.rejectOnError(D);var I=[],L=A(z.style);JSON.stringify(R.styleObj)!==JSON.stringify(L)&&(R.styleObj=L,P.setStyle(L.style),R.traceHash={},I.push(new Promise(function(B){P.once("styledata",B)}))),I=I.concat(l.fetchTraceGeoData(E)),Promise.all(I).then(function(){R.fillBelowLookup(E,T),R.updateData(E);let B=z._fitBounds;B&&(P.fitBounds([[B.west,B.south],[B.east,B.north]],{padding:v.fitBoundsPadding,animate:!1}),C(R,z),w(R,z)),R.updateLayout(T),R.resolveOnRender(F)}).catch(D)};function C(E,T){let{center:F,zoom:D}=E.getView();T._input.center=T.center=F,T._input.zoom=T.zoom=D,T._input._fitView={center:Ot({},F),zoom:D}}function w(E,T){let F=E.getView();E.viewInitial={center:s.extendFlat({},F.center),bearing:T.bearing,pitch:T.pitch,zoom:F.zoom}}M.fillBelowLookup=function(E,T){var F=T[this.id],D=F.layers,R,P,z=this.belowLookup={},I=!1;for(R=0;R1)for(R=0;RT.project(D).x,_subplot:T},T.yaxis={_id:"y",c2p:D=>T.project(D).y,_subplot:T},T.updateFramework(E),T.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},u.setConvert(T.mockAxis,E)},M.initFx=function(E,T){var F=this,D=F.gd,R=F.map;R.on("moveend",function(I){if(F.map){var L=D._fullLayout;if(I.originalEvent||F.wheeling){var B=L[F.id];n.call("_storeDirectGUIEdit",D.layout,L._preGUI,F.getViewEdits(B));var O=F.getView();B._input.center=B.center=O.center,B._input.zoom=B.zoom=O.zoom,B._input.bearing=B.bearing=O.bearing,B._input.pitch=B.pitch=O.pitch,D.emit("plotly_relayout",F.getViewEditsWithDerived(O))}I.originalEvent&&I.originalEvent.type==="mouseup"?F.dragging=!1:F.wheeling&&(F.wheeling=!1),L&&L._rehover&&L._rehover()}}),R.on("wheel",function(){F.wheeling=!0}),R.on("mousemove",function(I){var L=F.div.getBoundingClientRect(),B=[I.originalEvent.offsetX,I.originalEvent.offsetY];I.target.getBoundingClientRect=function(){return L},F.xaxis.p2c=function(){return R.unproject(B).lng},F.yaxis.p2c=function(){return R.unproject(B).lat},D._fullLayout._rehover=function(){D._fullLayout._hoversubplot===F.id&&D._fullLayout[F.id]&&f.hover(D,I,F.id)},f.hover(D,I,F.id),D._fullLayout._hoversubplot=F.id});function P(){f.loneUnhover(T._hoverlayer)}R.on("dragstart",function(){F.dragging=!0,P()}),R.on("zoomstart",P),R.on("mouseout",function(){D._fullLayout._hoversubplot=null});function z(){var I=F.getView();D.emit("plotly_relayouting",F.getViewEditsWithDerived(I))}R.on("drag",z),R.on("zoom",z),R.on("dblclick",function(){var I=D._fullLayout[F.id];n.call("_storeDirectGUIEdit",D.layout,D._fullLayout._preGUI,F.getViewEdits(I));var L=F.viewInitial;R.setCenter(b(L.center)),R.setZoom(L.zoom),R.setBearing(L.bearing),R.setPitch(L.pitch);var B=F.getView();I._input.center=I.center=B.center,I._input.zoom=I.zoom=B.zoom,I._input.bearing=I.bearing=B.bearing,I._input.pitch=I.pitch=B.pitch,D.emit("plotly_doubleclick",null),D.emit("plotly_relayout",F.getViewEditsWithDerived(B))}),F.clearOutline=function(){y(F.dragOptions),m(F.dragOptions.gd)},F.onClickInPanFn=function(I){return function(L){var B=D._fullLayout.clickmode;B.indexOf("select")>-1&&_(L.originalEvent,D,[F.xaxis],[F.yaxis],F.id,I),B.indexOf("event")>-1&&f.click(D,L.originalEvent)}}},M.updateFx=function(E){var T=this,F=T.map,D=T.gd;if(T.isStatic)return;function R(L){var B=T.map.unproject(L);return[B.lng,B.lat]}var P=E.dragmode,z;z=function(L,B){if(B.isRect){var O=L.range={};O[T.id]=[R([B.xmin,B.ymin]),R([B.xmax,B.ymax])]}else{var G=L.lassoPoints={};G[T.id]=B.map(R)}};var I=T.dragOptions;T.dragOptions=s.extendDeep(I||{},{dragmode:E.dragmode,element:T.div,gd:D,plotinfo:{id:T.id,domain:E[T.id].domain,xaxis:T.xaxis,yaxis:T.yaxis,fillRangeItems:z},xaxes:[T.xaxis],yaxes:[T.yaxis],subplot:T.id}),F.off("click",T.onClickInPanHandler),p(P)||d(P)?(F.dragPan.disable(),F.on("zoomstart",T.clearOutline),T.dragOptions.prepFn=function(L,B,O){g(L,B,O,T.dragOptions,P)},c.init(T.dragOptions)):(F.dragPan.enable(),F.off("zoomstart",T.clearOutline),T.div.onmousedown=null,T.div.ontouchstart=null,T.div.removeEventListener("touchstart",T.div._ontouchstart),T.onClickInPanHandler=T.onClickInPanFn(T.dragOptions),F.on("click",T.onClickInPanHandler))},M.updateFramework=function(E){var T=E[this.id].domain,F=E._size,D=this.div.style;D.width=F.w*(T.x[1]-T.x[0])+"px",D.height=F.h*(T.y[1]-T.y[0])+"px",D.left=F.l+T.x[0]*F.w+"px",D.top=F.t+(1-T.y[1])*F.h+"px",this.xaxis._offset=F.l+T.x[0]*F.w,this.xaxis._length=F.w*(T.x[1]-T.x[0]),this.yaxis._offset=F.t+(1-T.y[1])*F.h,this.yaxis._length=F.h*(T.y[1]-T.y[0])},M.updateLayers=function(E){var T=E[this.id],F=T.layers,D=this.layerList,R;if(F.length!==D.length){for(R=0;RVse});function Vse(e,r){let t=[];for(let n of e){if(n.subplot!==r||n.visible!==!0)continue;if(n.type==="choroplethmap")return null;let{lat:u,lon:c}=n;if(!c||!u)continue;let f=Math.min(c.length,u.length);for(let h=0;hA/2){var b=M.split("|").join("
");w.text(b).attr("data-unformatted",b).call(n.convertToTspans,f),k=l.bBox(w.node())}w.attr("transform",t(-3,-k.height+8)),C.insert("rect",".static-attribution").attr({x:-k.width-6,y:-k.height-3,width:k.width+6,height:k.height+3,fill:"rgba(255, 255, 255, 0.75)"});var E=1;k.width+6>A&&(E=A/(k.width+6));var T=[p.l+p.w*y.x[1],p.t+p.h*(1-y.y[0])];C.attr("transform",t(T[0],T[1])+i(E))}},e.updateFx=function(f){for(var h=f._fullLayout,d=h._subplots[c],p=0;p=0;u--)l.removeLayer(n[u][1])},s.dispose=function(){var l=this.subplot.map;this._removeLayers(),l.removeSource(this.sourceId)},r.exports=function(n,u){var c=u[0].trace,f=new o(n,c.uid),h=f.sourceId,d=t(u),p=f.below=n.belowLookup["trace-"+c.uid];return n.map.addSource(h,{type:"geojson",data:d.geojson}),f._addLayers(d,p),u[0].trace._glTrace=f,f}}}),Zse=de({"src/traces/choroplethmap/index.js"(e,r){"use strict";r.exports={attributes:z8(),supplyDefaults:Yse(),colorbar:b1(),calc:h7(),plot:Xse(),hoverPoints:d7(),eventData:p7(),selectPoints:v7(),styleOnSelect:function(t,i){if(i){var a=i[0].trace;a._glTrace.updateOnSelect(i)}},getBelow:function(t,i){for(var a=i.getMapLayers(),o=a.length-2;o>=0;o--){var s=a[o].id;if(typeof s=="string"&&s.indexOf("water")===0){for(var l=o+1;l0?+y[g]:0),p.push({type:"Feature",geometry:{type:"Point",coordinates:S},properties:M})}}var w=o.extractOpts(c),k=w.reversescale?o.flipScale(w.colorscale):w.colorscale,A=k[0][1],b=a.opacity(A)<1?A:a.addOpacity(A,0),E=["interpolate",["linear"],["heatmap-density"],0,b];for(g=1;g=0;n--)s.removeLayer(l[n][1])},o.dispose=function(){var s=this.subplot.map;this._removeLayers(),s.removeSource(this.sourceId)},r.exports=function(l,n){var u=n[0].trace,c=new a(l,u.uid),f=c.sourceId,h=t(n),d=c.below=l.belowLookup["trace-"+u.uid];return l.map.addSource(f,{type:"geojson",data:h.geojson}),c._addLayers(h,d),c}}}),rle=de({"src/traces/densitymap/hover.js"(e,r){"use strict";var t=nn(),i=z4().hoverPoints,a=z4().getExtraText;r.exports=function(s,l,n){var u=i(s,l,n);if(u){var c=u[0],f=c.cd,h=f[0].trace,d=f[c.index];if(delete c.color,"z"in d){var p=c.subplot.mockAxis;c.z=d.z,c.zLabel=t.tickText(p,p.c2l(d.z),"hover").text}return c.extraText=a(h,d,f[0].t.labels),[c]}}}}),ile=de({"src/traces/densitymap/event_data.js"(e,r){"use strict";r.exports=function(i,a){return i.lon=a.lon,i.lat=a.lat,i.z=a.z,i}}}),ale=de({"src/traces/densitymap/index.js"(e,r){"use strict";r.exports={attributes:O8(),supplyDefaults:Jse(),colorbar:b1(),formatLabels:o9(),calc:Qse(),plot:tle(),hoverPoints:rle(),eventData:ile(),getBelow:function(t,i){for(var a=i.getMapLayers(),o=0;ox[F%x.length];v("color",_.label.map((F,D)=>a.addOpacity(S(D),.8))),v("customdata");var M=f.link||{},C=l.newContainer(h,"link");function w(F,D){return t.coerce(M,C,i.link,F,D)}w("label"),w("arrowlen"),w("source"),w("target"),w("value"),w("line.color"),w("line.width"),w("hoverinfo",f.hoverinfo),s(M,C,w,m),w("hovertemplate"),w("sort");var k=a.luminosity(p.paper_bgcolor)<.333,A=k?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)",b=w("color",A);function E(F){if(!a.isValid(F))return F;let D=a.opacity(F);return D<=.8?a.addOpacity(F,D+.2):k?a.brighten(F,10):a.adjustLightness(F,-10)}w("hovercolor",Array.isArray(b)?b.map(E):E(b)),w("customdata"),n(M,C,{name:"colorscales",handleItemDefaults:u}),o(h,p,g),g("orientation"),g("direction"),g("valueformat"),g("valuesuffix");let T=_.x.length&&_.y.length?"freeform":void 0;g("arrangement",T),t.coerceFont(g,"textfont",p.font,{autoShadowDflt:!0}),h._length=null};function u(c,f){function h(d,p){return t.coerce(c,f,i.link.colorscales,d,p)}h("label"),h("cmin"),h("cmax"),h("colorscale")}}}),j8=de({"node_modules/strongly-connected-components/scc.js"(e,r){"use strict";r.exports=t;function t(i){for(var a=i.length,o=new Array(a),s=new Array(a),l=new Array(a),n=new Array(a),u=new Array(a),c=new Array(a),f=0;f0;){v=S[S.length-1];var M=i[v];if(n[v]=0&&c[v].push(u[w])}n[v]=C}else{if(s[v]===o[v]){for(var k=[],A=[],b=0,C=x.length-1;C>=0;--C){var E=x[C];if(l[E]=!1,k.push(E),A.push(c[E]),b+=c[E].length,u[E]=d.length,E===v){x.length=C;break}}d.push(k);for(var T=new Array(b),C=0;Cw&&(w=h.source[x]),h.target[x]>w&&(w=h.target[x]);var k=w+1;c.node._count=k;var A,b=c.node.groups,E={};for(x=0;x0&&s(z,k)&&s(I,k)&&!(E.hasOwnProperty(z)&&E.hasOwnProperty(I)&&E[z]===E[I])){E.hasOwnProperty(I)&&(I=E[I]),E.hasOwnProperty(z)&&(z=E[z]),z=+z,I=+I,y[z]=y[I]=!0;var L="";h.label&&h.label[x]&&(L=h.label[x]);var B=null;L&&_.hasOwnProperty(L)&&(B=_[L]),d.push({pointNumber:x,label:L,color:p?h.color[x]:h.color,hovercolor:g?h.hovercolor[x]:h.hovercolor,customdata:m?h.customdata[x]:h.customdata,concentrationscale:B,source:z,target:I,value:+P}),R.source.push(z),R.target.push(I)}}var O=k+b.length,G=o(f.color),W=o(f.customdata),X=[];for(x=0;xk-1,childrenNodes:[],pointNumber:x,label:Z,color:G?f.color[x]:f.color,customdata:W?f.customdata[x]:f.customdata})}var J=!1;return u(O,R.source,R.target)&&(J=!0),{circular:J,links:d,nodes:X,groups:b,groupLookup:E}}function u(c,f,h){for(var d=i.init2dArray(c,0),p=0;p1})}r.exports=function(f,h){var d=n(h);return a({circular:d.circular,_nodes:d.nodes,_links:d.links,_groups:d.groups,_groupLookup:d.groupLookup})}}}),lle=de({"node_modules/d3-quadtree/dist/d3-quadtree.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e):(t=t||self,i(t.d3=t.d3||{}))})(e,function(t){"use strict";function i(k){var A=+this._x.call(null,k),b=+this._y.call(null,k);return a(this.cover(A,b),A,b,k)}function a(k,A,b,E){if(isNaN(A)||isNaN(b))return k;var T,F=k._root,D={data:E},R=k._x0,P=k._y0,z=k._x1,I=k._y1,L,B,O,G,W,X,Z,J;if(!F)return k._root=D,k;for(;F.length;)if((W=A>=(L=(R+z)/2))?R=L:z=L,(X=b>=(B=(P+I)/2))?P=B:I=B,T=F,!(F=F[Z=X<<1|W]))return T[Z]=D,k;if(O=+k._x.call(null,F.data),G=+k._y.call(null,F.data),A===O&&b===G)return D.next=F,T?T[Z]=D:k._root=D,k;do T=T?T[Z]=new Array(4):k._root=new Array(4),(W=A>=(L=(R+z)/2))?R=L:z=L,(X=b>=(B=(P+I)/2))?P=B:I=B;while((Z=X<<1|W)===(J=(G>=B)<<1|O>=L));return T[J]=F,T[Z]=D,k}function o(k){var A,b,E=k.length,T,F,D=new Array(E),R=new Array(E),P=1/0,z=1/0,I=-1/0,L=-1/0;for(b=0;bI&&(I=T),FL&&(L=F));if(P>I||z>L)return this;for(this.cover(P,z).cover(I,L),b=0;bk||k>=T||E>A||A>=F;)switch(z=(AI||(R=G.y0)>L||(P=G.x1)=Z)<<1|k>=X)&&(G=B[B.length-1],B[B.length-1]=B[B.length-1-W],B[B.length-1-W]=G)}else{var J=k-+this._x.call(null,O.data),N=A-+this._y.call(null,O.data),H=J*J+N*N;if(H=(B=(D+P)/2))?D=B:P=B,(W=L>=(O=(R+z)/2))?R=O:z=O,A=b,!(b=b[X=W<<1|G]))return this;if(!b.length)break;(A[X+1&3]||A[X+2&3]||A[X+3&3])&&(E=A,Z=X)}for(;b.data!==k;)if(T=b,!(b=b.next))return this;return(F=b.next)&&delete b.next,T?(F?T.next=F:delete T.next,this):A?(F?A[X]=F:delete A[X],(b=A[0]||A[1]||A[2]||A[3])&&b===(A[3]||A[2]||A[1]||A[0])&&!b.length&&(E?E[Z]=b:this._root=b),this):(this._root=F,this)}function h(k){for(var A=0,b=k.length;A=y.length)return v!=null&&w.sort(v),x!=null?x(w):w;for(var E=-1,T=w.length,F=y[k++],D,R,P=o(),z,I=A();++Ey.length)return w;var A,b=_[k-1];return x!=null&&k>=y.length?A=w.entries():(A=[],w.each(function(E,T){A.push({key:T,values:C(E,k)})})),b!=null?A.sort(function(E,T){return b(E.key,T.key)}):A}return S={object:function(w){return M(w,0,l,n)},map:function(w){return M(w,0,u,c)},entries:function(w){return C(M(w,0,u,c),0)},key:function(w){return y.push(w),S},sortKeys:function(w){return _[y.length-1]=w,S},sortValues:function(w){return v=w,S},rollup:function(w){return x=w,S}}}function l(){return{}}function n(y,_,v){y[_]=v}function u(){return o()}function c(y,_,v){y.set(_,v)}function f(){}var h=o.prototype;f.prototype=d.prototype={constructor:f,has:h.has,add:function(y){return y+="",this[i+y]=y,this},remove:h.remove,clear:h.clear,values:h.keys,size:h.size,empty:h.empty,each:h.each};function d(y,_){var v=new f;if(y instanceof f)y.each(function(M){v.add(M)});else if(y){var x=-1,S=y.length;if(_==null)for(;++x=0&&(h=f.slice(d+1),f=f.slice(0,d)),f&&!c.hasOwnProperty(f))throw new Error("unknown type: "+f);return{type:f,name:h}})}o.prototype=a.prototype={constructor:o,on:function(u,c){var f=this._,h=s(u+"",f),d,p=-1,g=h.length;if(arguments.length<2){for(;++p0)for(var f=new Array(d),h=0,d,p;h=0&&k._call.call(null,A),k=k._next;--i}function v(){c=(u=h.now())+f,i=a=0;try{_()}finally{i=0,S(),c=0}}function x(){var k=h.now(),A=k-u;A>s&&(f-=A,u=k)}function S(){for(var k,A=l,b,E=1/0;A;)A._call?(E>A._time&&(E=A._time),k=A,A=A._next):(b=A._next,A._next=null,A=k?k._next=b:l=b);n=k,M(E)}function M(k){if(!i){a&&(a=clearTimeout(a));var A=k-c;A>24?(k<1/0&&(a=setTimeout(v,k-h.now()-f)),o&&(o=clearInterval(o))):(o||(u=h.now(),o=setInterval(x,s)),i=1,d(v))}}function C(k,A,b){var E=new m;return A=A==null?0:+A,E.restart(function(T){E.stop(),k(T+A)},A,b),E}function w(k,A,b){var E=new m,T=A;return A==null?(E.restart(k,A,b),E):(A=+A,b=b==null?p():+b,E.restart(function F(D){D+=T,E.restart(F,T+=A,b),k(D)},A,b),E)}t.interval=w,t.now=p,t.timeout=C,t.timer=y,t.timerFlush=_,Object.defineProperty(t,"__esModule",{value:!0})})}}),fle=de({"node_modules/d3-force/dist/d3-force.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e,lle(),U8(),ule(),cle()):i(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3)})(e,(function(t,i,a,o,s){"use strict";function l(k,A){var b;k==null&&(k=0),A==null&&(A=0);function E(){var T,F=b.length,D,R=0,P=0;for(T=0;TL.index){var Y=B-V.x-V.vx,K=O-V.y-V.vy,te=Y*Y+K*K;teB+q||$O+q||UP.r&&(P.r=P[z].r)}function R(){if(A){var P,z=A.length,I;for(b=new Array(z),P=0;P1?(W==null?R.remove(G):R.set(G,O(W)),A):R.get(G)},find:function(G,W,X){var Z=0,J=k.length,N,H,$,U,V;for(X==null?X=1/0:X*=X,Z=0;Z1?(z.on(G,W),A):z.on(G)}}}function S(){var k,A,b,E=n(-30),T,F=1,D=1/0,R=.81;function P(B){var O,G=k.length,W=i.quadtree(k,m,y).visitAfter(I);for(b=B,O=0;O=D)return;(B.data!==A||B.next)&&(X===0&&(X=u(),N+=X*X),Z===0&&(Z=u(),N+=Z*Z),Nyt?1:gt>=yt?0:NaN}function a(gt){let yt=gt,kt=gt;gt.length===1&&(yt=(mr,br)=>gt(mr)-br,kt=o(gt));function Lt(mr,br,Er,Tr){for(Er==null&&(Er=0),Tr==null&&(Tr=mr.length);Er>>1;kt(mr[Ur],br)<0?Er=Ur+1:Tr=Ur}return Er}function Ct(mr,br,Er,Tr){for(Er==null&&(Er=0),Tr==null&&(Tr=mr.length);Er>>1;kt(mr[Ur],br)>0?Tr=Ur:Er=Ur+1}return Er}function $t(mr,br,Er,Tr){Er==null&&(Er=0),Tr==null&&(Tr=mr.length);let Ur=Lt(mr,br,Er,Tr-1);return Ur>Er&&yt(mr[Ur-1],br)>-yt(mr[Ur],br)?Ur-1:Ur}return{left:Lt,center:$t,right:Ct}}function o(gt){return(yt,kt)=>i(gt(yt),kt)}function s(gt){return gt===null?NaN:+gt}function*l(gt,yt){if(yt===void 0)for(let kt of gt)kt!=null&&(kt=+kt)>=kt&&(yield kt);else{let kt=-1;for(let Lt of gt)(Lt=yt(Lt,++kt,gt))!=null&&(Lt=+Lt)>=Lt&&(yield Lt)}}let n=a(i),u=n.right,c=n.left,f=a(s).center;function h(gt,yt){let kt=0;if(yt===void 0)for(let Lt of gt)Lt!=null&&(Lt=+Lt)>=Lt&&++kt;else{let Lt=-1;for(let Ct of gt)(Ct=yt(Ct,++Lt,gt))!=null&&(Ct=+Ct)>=Ct&&++kt}return kt}function d(gt){return gt.length|0}function p(gt){return!(gt>0)}function g(gt){return typeof gt!="object"||"length"in gt?gt:Array.from(gt)}function m(gt){return yt=>gt(...yt)}function y(...gt){let yt=typeof gt[gt.length-1]=="function"&&m(gt.pop());gt=gt.map(g);let kt=gt.map(d),Lt=gt.length-1,Ct=new Array(Lt+1).fill(0),$t=[];if(Lt<0||kt.some(p))return $t;for(;;){$t.push(Ct.map((br,Er)=>gt[Er][br]));let mr=Lt;for(;++Ct[mr]===kt[mr];){if(mr===0)return yt?$t.map(yt):$t;Ct[mr--]=0}}}function _(gt,yt){var kt=0,Lt=0;return Float64Array.from(gt,yt===void 0?Ct=>kt+=+Ct||0:Ct=>kt+=+yt(Ct,Lt++,gt)||0)}function v(gt,yt){return ytgt?1:yt>=gt?0:NaN}function x(gt,yt){let kt=0,Lt,Ct=0,$t=0;if(yt===void 0)for(let mr of gt)mr!=null&&(mr=+mr)>=mr&&(Lt=mr-Ct,Ct+=Lt/++kt,$t+=Lt*(mr-Ct));else{let mr=-1;for(let br of gt)(br=yt(br,++mr,gt))!=null&&(br=+br)>=br&&(Lt=br-Ct,Ct+=Lt/++kt,$t+=Lt*(br-Ct))}if(kt>1)return $t/(kt-1)}function S(gt,yt){let kt=x(gt,yt);return kt&&Math.sqrt(kt)}function M(gt,yt){let kt,Lt;if(yt===void 0)for(let Ct of gt)Ct!=null&&(kt===void 0?Ct>=Ct&&(kt=Lt=Ct):(kt>Ct&&(kt=Ct),Lt=$t&&(kt=Lt=$t):(kt>$t&&(kt=$t),Lt<$t&&(Lt=$t)))}return[kt,Lt]}class C{constructor(){this._partials=new Float64Array(32),this._n=0}add(yt){let kt=this._partials,Lt=0;for(let Ct=0;Ct0){for(mr=yt[--kt];kt>0&&(Lt=mr,Ct=yt[--kt],mr=Lt+Ct,$t=Ct-(mr-Lt),!$t););kt>0&&($t<0&&yt[kt-1]<0||$t>0&&yt[kt-1]>0)&&(Ct=$t*2,Lt=mr+Ct,Ct==Lt-mr&&(mr=Lt))}return mr}}function w(gt,yt){let kt=new C;if(yt===void 0)for(let Lt of gt)(Lt=+Lt)&&kt.add(Lt);else{let Lt=-1;for(let Ct of gt)(Ct=+yt(Ct,++Lt,gt))&&kt.add(Ct)}return+kt}function k(gt,yt){let kt=new C,Lt=-1;return Float64Array.from(gt,yt===void 0?Ct=>kt.add(+Ct||0):Ct=>kt.add(+yt(Ct,++Lt,gt)||0))}class A extends Map{constructor(yt,kt=D){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:kt}}),yt!=null)for(let[Lt,Ct]of yt)this.set(Lt,Ct)}get(yt){return super.get(E(this,yt))}has(yt){return super.has(E(this,yt))}set(yt,kt){return super.set(T(this,yt),kt)}delete(yt){return super.delete(F(this,yt))}}class b extends Set{constructor(yt,kt=D){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:kt}}),yt!=null)for(let Lt of yt)this.add(Lt)}has(yt){return super.has(E(this,yt))}add(yt){return super.add(T(this,yt))}delete(yt){return super.delete(F(this,yt))}}function E({_intern:gt,_key:yt},kt){let Lt=yt(kt);return gt.has(Lt)?gt.get(Lt):kt}function T({_intern:gt,_key:yt},kt){let Lt=yt(kt);return gt.has(Lt)?gt.get(Lt):(gt.set(Lt,kt),kt)}function F({_intern:gt,_key:yt},kt){let Lt=yt(kt);return gt.has(Lt)&&(kt=gt.get(kt),gt.delete(Lt)),kt}function D(gt){return gt!==null&&typeof gt=="object"?gt.valueOf():gt}function R(gt){return gt}function P(gt,...yt){return W(gt,R,R,yt)}function z(gt,...yt){return W(gt,Array.from,R,yt)}function I(gt,yt,...kt){return W(gt,R,yt,kt)}function L(gt,yt,...kt){return W(gt,Array.from,yt,kt)}function B(gt,...yt){return W(gt,R,G,yt)}function O(gt,...yt){return W(gt,Array.from,G,yt)}function G(gt){if(gt.length!==1)throw new Error("duplicate key");return gt[0]}function W(gt,yt,kt,Lt){return(function Ct($t,mr){if(mr>=Lt.length)return kt($t);let br=new A,Er=Lt[mr++],Tr=-1;for(let Ur of $t){let Ai=Er(Ur,++Tr,$t),oi=br.get(Ai);oi?oi.push(Ur):br.set(Ai,[Ur])}for(let[Ur,Ai]of br)br.set(Ur,Ct(Ai,mr));return yt(br)})(gt,0)}function X(gt,yt){return Array.from(yt,kt=>gt[kt])}function Z(gt,...yt){if(typeof gt[Symbol.iterator]!="function")throw new TypeError("values is not iterable");gt=Array.from(gt);let[kt=i]=yt;if(kt.length===1||yt.length>1){let Lt=Uint32Array.from(gt,(Ct,$t)=>$t);return yt.length>1?(yt=yt.map(Ct=>gt.map(Ct)),Lt.sort((Ct,$t)=>{for(let mr of yt){let br=i(mr[Ct],mr[$t]);if(br)return br}})):(kt=gt.map(kt),Lt.sort((Ct,$t)=>i(kt[Ct],kt[$t]))),X(gt,Lt)}return gt.sort(kt)}function J(gt,yt,kt){return(yt.length===1?Z(I(gt,yt,kt),(([Lt,Ct],[$t,mr])=>i(Ct,mr)||i(Lt,$t))):Z(P(gt,kt),(([Lt,Ct],[$t,mr])=>yt(Ct,mr)||i(Lt,$t)))).map(([Lt])=>Lt)}var N=Array.prototype,H=N.slice;function $(gt){return function(){return gt}}var U=Math.sqrt(50),V=Math.sqrt(10),j=Math.sqrt(2);function q(gt,yt,kt){var Lt,Ct=-1,$t,mr,br;if(yt=+yt,gt=+gt,kt=+kt,gt===yt&&kt>0)return[gt];if((Lt=yt0){let Er=Math.round(gt/br),Tr=Math.round(yt/br);for(Er*bryt&&--Tr,mr=new Array($t=Tr-Er+1);++Ct<$t;)mr[Ct]=(Er+Ct)*br}else{br=-br;let Er=Math.round(gt*br),Tr=Math.round(yt*br);for(Er/bryt&&--Tr,mr=new Array($t=Tr-Er+1);++Ct<$t;)mr[Ct]=(Er+Ct)/br}return Lt&&mr.reverse(),mr}function Y(gt,yt,kt){var Lt=(yt-gt)/Math.max(0,kt),Ct=Math.floor(Math.log(Lt)/Math.LN10),$t=Lt/Math.pow(10,Ct);return Ct>=0?($t>=U?10:$t>=V?5:$t>=j?2:1)*Math.pow(10,Ct):-Math.pow(10,-Ct)/($t>=U?10:$t>=V?5:$t>=j?2:1)}function K(gt,yt,kt){var Lt=Math.abs(yt-gt)/Math.max(0,kt),Ct=Math.pow(10,Math.floor(Math.log(Lt)/Math.LN10)),$t=Lt/Ct;return $t>=U?Ct*=10:$t>=V?Ct*=5:$t>=j&&(Ct*=2),yt0?(gt=Math.floor(gt/Ct)*Ct,yt=Math.ceil(yt/Ct)*Ct):Ct<0&&(gt=Math.ceil(gt*Ct)/Ct,yt=Math.floor(yt*Ct)/Ct),Lt=Ct}}function ne(gt){return Math.ceil(Math.log(h(gt))/Math.LN2)+1}function se(){var gt=R,yt=M,kt=ne;function Lt(Ct){Array.isArray(Ct)||(Ct=Array.from(Ct));var $t,mr=Ct.length,br,Er=new Array(mr);for($t=0;$t=Ai)if(ja>=Ai&&yt===M){let pa=Y(Ur,Ai,ya);isFinite(pa)&&(pa>0?Ai=(Math.floor(Ai/pa)+1)*pa:pa<0&&(Ai=(Math.ceil(Ai*-pa)+1)/-pa))}else oi.pop()}for(var Qr=oi.length;oi[0]<=Ur;)oi.shift(),--Qr;for(;oi[Qr-1]>Ai;)oi.pop(),--Qr;var ea=new Array(Qr+1),$i;for($t=0;$t<=Qr;++$t)$i=ea[$t]=[],$i.x0=$t>0?oi[$t-1]:Ur,$i.x1=$t=Lt)&&(kt=Lt);else{let Lt=-1;for(let Ct of gt)(Ct=yt(Ct,++Lt,gt))!=null&&(kt=Ct)&&(kt=Ct)}return kt}function ce(gt,yt){let kt;if(yt===void 0)for(let Lt of gt)Lt!=null&&(kt>Lt||kt===void 0&&Lt>=Lt)&&(kt=Lt);else{let Lt=-1;for(let Ct of gt)(Ct=yt(Ct,++Lt,gt))!=null&&(kt>Ct||kt===void 0&&Ct>=Ct)&&(kt=Ct)}return kt}function pe(gt,yt,kt=0,Lt=gt.length-1,Ct=i){for(;Lt>kt;){if(Lt-kt>600){let Er=Lt-kt+1,Tr=yt-kt+1,Ur=Math.log(Er),Ai=.5*Math.exp(2*Ur/3),oi=.5*Math.sqrt(Ur*Ai*(Er-Ai)/Er)*(Tr-Er/2<0?-1:1),Qr=Math.max(kt,Math.floor(yt-Tr*Ai/Er+oi)),ea=Math.min(Lt,Math.floor(yt+(Er-Tr)*Ai/Er+oi));pe(gt,yt,Qr,ea,Ct)}let $t=gt[yt],mr=kt,br=Lt;for(xe(gt,kt,yt),Ct(gt[Lt],$t)>0&&xe(gt,kt,Lt);mr0;)--br}Ct(gt[kt],$t)===0?xe(gt,kt,br):(++br,xe(gt,br,Lt)),br<=yt&&(kt=br+1),yt<=br&&(Lt=br-1)}return gt}function xe(gt,yt,kt){let Lt=gt[yt];gt[yt]=gt[kt],gt[kt]=Lt}function ye(gt,yt,kt){if(gt=Float64Array.from(l(gt,kt)),!!(Lt=gt.length)){if((yt=+yt)<=0||Lt<2)return ce(gt);if(yt>=1)return le(gt);var Lt,Ct=(Lt-1)*yt,$t=Math.floor(Ct),mr=le(pe(gt,$t).subarray(0,$t+1)),br=ce(gt.subarray($t+1));return mr+(br-mr)*(Ct-$t)}}function fe(gt,yt,kt=s){if(Lt=gt.length){if((yt=+yt)<=0||Lt<2)return+kt(gt[0],0,gt);if(yt>=1)return+kt(gt[Lt-1],Lt-1,gt);var Lt,Ct=(Lt-1)*yt,$t=Math.floor(Ct),mr=+kt(gt[$t],$t,gt),br=+kt(gt[$t+1],$t+1,gt);return mr+(br-mr)*(Ct-$t)}}function ae(gt,yt,kt){return Math.ceil((kt-yt)/(2*(ye(gt,.75)-ye(gt,.25))*Math.pow(h(gt),-1/3)))}function ee(gt,yt,kt){return Math.ceil((kt-yt)/(3.5*S(gt)*Math.pow(h(gt),-1/3)))}function ie(gt,yt){let kt,Lt=-1,Ct=-1;if(yt===void 0)for(let $t of gt)++Ct,$t!=null&&(kt<$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);else for(let $t of gt)($t=yt($t,++Ct,gt))!=null&&(kt<$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);return Lt}function Q(gt,yt){let kt=0,Lt=0;if(yt===void 0)for(let Ct of gt)Ct!=null&&(Ct=+Ct)>=Ct&&(++kt,Lt+=Ct);else{let Ct=-1;for(let $t of gt)($t=yt($t,++Ct,gt))!=null&&($t=+$t)>=$t&&(++kt,Lt+=$t)}if(kt)return Lt/kt}function ue(gt,yt){return ye(gt,.5,yt)}function*ge(gt){for(let yt of gt)yield*Ia(yt)}function Me(gt){return Array.from(ge(gt))}function Te(gt,yt){let kt,Lt=-1,Ct=-1;if(yt===void 0)for(let $t of gt)++Ct,$t!=null&&(kt>$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);else for(let $t of gt)($t=yt($t,++Ct,gt))!=null&&(kt>$t||kt===void 0&&$t>=$t)&&(kt=$t,Lt=Ct);return Lt}function je(gt,yt=Ve){let kt=[],Lt,Ct=!1;for(let $t of gt)Ct&&kt.push(yt(Lt,$t)),Lt=$t,Ct=!0;return kt}function Ve(gt,yt){return[gt,yt]}function Ze(gt,yt,kt){gt=+gt,yt=+yt,kt=(Ct=arguments.length)<2?(yt=gt,gt=0,1):Ct<3?1:+kt;for(var Lt=-1,Ct=Math.max(0,Math.ceil((yt-gt)/kt))|0,$t=new Array(Ct);++Lt0:i(mr,mr)===0)&&(kt=$t,Ct=mr,Lt=!0)}}else for(let Ct of gt)(Lt?yt(Ct,kt)>0:yt(Ct,Ct)===0)&&(kt=Ct,Lt=!0);return kt}function Pt(gt,yt=i){if(yt.length===1)return ie(gt,yt);let kt,Lt=-1,Ct=-1;for(let $t of gt)++Ct,(Lt<0?yt($t,$t)===0:yt($t,kt)>0)&&(kt=$t,Lt=Ct);return Lt}function mt(gt,yt){let kt=vt(gt,yt);return kt<0?void 0:kt}var Mt=lt(Math.random);function lt(gt){return function(kt,Lt=0,Ct=kt.length){let $t=Ct-(Lt=+Lt);for(;$t;){let mr=gt()*$t--|0,br=kt[$t+Lt];kt[$t+Lt]=kt[mr+Lt],kt[mr+Lt]=br}return kt}}function qe(gt,yt){let kt=0;if(yt===void 0)for(let Lt of gt)(Lt=+Lt)&&(kt+=Lt);else{let Lt=-1;for(let Ct of gt)(Ct=+yt(Ct,++Lt,gt))&&(kt+=Ct)}return kt}function Ye(gt){if(!($t=gt.length))return[];for(var yt=-1,kt=ce(gt,me),Lt=new Array(kt);++ytyt(kt,Lt,gt))}function Je(gt,yt,kt){if(typeof yt!="function")throw new TypeError("reducer is not a function");let Lt=gt[Symbol.iterator](),Ct,$t,mr=-1;if(arguments.length<3){if({done:Ct,value:kt}=Lt.next(),Ct)return;++mr}for(;{done:Ct,value:$t}=Lt.next(),!Ct;)kt=yt(kt,$t,++mr,gt);return kt}function Ue(gt){if(typeof gt[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(gt).reverse()}function at(gt,...yt){gt=new Set(gt);for(let kt of yt)for(let Lt of kt)gt.delete(Lt);return gt}function rt(gt,yt){let kt=yt[Symbol.iterator](),Lt=new Set;for(let Ct of gt){if(Lt.has(Ct))return!1;let $t,mr;for(;({value:$t,done:mr}=kt.next())&&!mr;){if(Object.is(Ct,$t))return!1;Lt.add($t)}}return!0}function ft(gt){return gt instanceof Set?gt:new Set(gt)}function At(gt,...yt){gt=new Set(gt),yt=yt.map(ft);e:for(let kt of gt)for(let Lt of yt)if(!Lt.has(kt)){gt.delete(kt);continue e}return gt}function ht(gt,yt){let kt=gt[Symbol.iterator](),Lt=new Set;for(let Ct of yt){if(Lt.has(Ct))continue;let $t,mr;for(;{value:$t,done:mr}=kt.next();){if(mr)return!1;if(Lt.add($t),Object.is(Ct,$t))break}}return!0}function Gt(gt,yt){return ht(yt,gt)}function fr(...gt){let yt=new Set;for(let kt of gt)for(let Lt of kt)yt.add(Lt);return yt}t.Adder=C,t.InternMap=A,t.InternSet=b,t.ascending=i,t.bin=se,t.bisect=u,t.bisectCenter=f,t.bisectLeft=c,t.bisectRight=u,t.bisector=a,t.count=h,t.cross=y,t.cumsum=_,t.descending=v,t.deviation=S,t.difference=at,t.disjoint=rt,t.every=Ae,t.extent=M,t.fcumsum=k,t.filter=Ee,t.fsum=w,t.greatest=xt,t.greatestIndex=Pt,t.group=P,t.groupSort=J,t.groups=z,t.histogram=se,t.index=B,t.indexes=O,t.intersection=At,t.least=Ke,t.leastIndex=vt,t.map=De,t.max=le,t.maxIndex=ie,t.mean=Q,t.median=ue,t.merge=Me,t.min=ce,t.minIndex=Te,t.nice=te,t.pairs=je,t.permute=X,t.quantile=ye,t.quantileSorted=fe,t.quickselect=pe,t.range=Ze,t.reduce=Je,t.reverse=Ue,t.rollup=I,t.rollups=L,t.scan=mt,t.shuffle=Mt,t.shuffler=lt,t.some=ke,t.sort=Z,t.subset=Gt,t.sum=qe,t.superset=ht,t.thresholdFreedmanDiaconis=ae,t.thresholdScott=ee,t.thresholdSturges=ne,t.tickIncrement=Y,t.tickStep=K,t.ticks=q,t.transpose=Ye,t.union=fr,t.variance=x,t.zip=_e,Object.defineProperty(t,"__esModule",{value:!0})}))}}),dle=de({"node_modules/d3-path/dist/d3-path.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e):(t=t||self,i(t.d3=t.d3||{}))})(e,function(t){"use strict";var i=Math.PI,a=2*i,o=1e-6,s=a-o;function l(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function n(){return new l}l.prototype=n.prototype={constructor:l,moveTo:function(u,c){this._+="M"+(this._x0=this._x1=+u)+","+(this._y0=this._y1=+c)},closePath:function(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(u,c){this._+="L"+(this._x1=+u)+","+(this._y1=+c)},quadraticCurveTo:function(u,c,f,h){this._+="Q"+ +u+","+ +c+","+(this._x1=+f)+","+(this._y1=+h)},bezierCurveTo:function(u,c,f,h,d,p){this._+="C"+ +u+","+ +c+","+ +f+","+ +h+","+(this._x1=+d)+","+(this._y1=+p)},arcTo:function(u,c,f,h,d){u=+u,c=+c,f=+f,h=+h,d=+d;var p=this._x1,g=this._y1,m=f-u,y=h-c,_=p-u,v=g-c,x=_*_+v*v;if(d<0)throw new Error("negative radius: "+d);if(this._x1===null)this._+="M"+(this._x1=u)+","+(this._y1=c);else if(x>o)if(!(Math.abs(v*m-y*_)>o)||!d)this._+="L"+(this._x1=u)+","+(this._y1=c);else{var S=f-p,M=h-g,C=m*m+y*y,w=S*S+M*M,k=Math.sqrt(C),A=Math.sqrt(x),b=d*Math.tan((i-Math.acos((C+x-w)/(2*k*A)))/2),E=b/A,T=b/k;Math.abs(E-1)>o&&(this._+="L"+(u+E*_)+","+(c+E*v)),this._+="A"+d+","+d+",0,0,"+ +(v*S>_*M)+","+(this._x1=u+T*m)+","+(this._y1=c+T*y)}},arc:function(u,c,f,h,d,p){u=+u,c=+c,f=+f,p=!!p;var g=f*Math.cos(h),m=f*Math.sin(h),y=u+g,_=c+m,v=1^p,x=p?h-d:d-h;if(f<0)throw new Error("negative radius: "+f);this._x1===null?this._+="M"+y+","+_:(Math.abs(this._x1-y)>o||Math.abs(this._y1-_)>o)&&(this._+="L"+y+","+_),f&&(x<0&&(x=x%a+a),x>s?this._+="A"+f+","+f+",0,1,"+v+","+(u-g)+","+(c-m)+"A"+f+","+f+",0,1,"+v+","+(this._x1=y)+","+(this._y1=_):x>o&&(this._+="A"+f+","+f+",0,"+ +(x>=i)+","+v+","+(this._x1=u+f*Math.cos(d))+","+(this._y1=c+f*Math.sin(d))))},rect:function(u,c,f,h){this._+="M"+(this._x0=this._x1=+u)+","+(this._y0=this._y1=+c)+"h"+ +f+"v"+ +h+"h"+-f+"Z"},toString:function(){return this._}},t.path=n,Object.defineProperty(t,"__esModule",{value:!0})})}}),q8=de({"node_modules/d3-shape/dist/d3-shape.js"(e,r){(function(t,i){typeof e=="object"&&typeof r<"u"?i(e,dle()):(t=t||self,i(t.d3=t.d3||{},t.d3))})(e,function(t,i){"use strict";function a(ze){return function(){return ze}}var o=Math.abs,s=Math.atan2,l=Math.cos,n=Math.max,u=Math.min,c=Math.sin,f=Math.sqrt,h=1e-12,d=Math.PI,p=d/2,g=2*d;function m(ze){return ze>1?0:ze<-1?d:Math.acos(ze)}function y(ze){return ze>=1?p:ze<=-1?-p:Math.asin(ze)}function _(ze){return ze.innerRadius}function v(ze){return ze.outerRadius}function x(ze){return ze.startAngle}function S(ze){return ze.endAngle}function M(ze){return ze&&ze.padAngle}function C(ze,tt,ct,wt,Nt,It,Zt,qt){var vr=ct-ze,Br=wt-tt,Pr=Zt-Nt,Mi=qt-It,gi=Mi*vr-Pr*Br;if(!(gi*giln*ln+on*on&&(tn=Kn,Mn=zn),{cx:tn,cy:Mn,x01:-Pr,y01:-Mi,x11:tn*(Nt/pn-1),y11:Mn*(Nt/pn-1)}}function k(){var ze=_,tt=v,ct=a(0),wt=null,Nt=x,It=S,Zt=M,qt=null;function vr(){var Br,Pr,Mi=+ze.apply(this,arguments),gi=+tt.apply(this,arguments),ba=Nt.apply(this,arguments)-p,Hi=It.apply(this,arguments)-p,Za=o(Hi-ba),oa=Hi>ba;if(qt||(qt=Br=i.path()),gih))qt.moveTo(0,0);else if(Za>g-h)qt.moveTo(gi*l(ba),gi*c(ba)),qt.arc(0,0,gi,ba,Hi,!oa),Mi>h&&(qt.moveTo(Mi*l(Hi),Mi*c(Hi)),qt.arc(0,0,Mi,Hi,ba,oa));else{var Cn=ba,_n=Hi,Li=ba,In=Hi,pn=Za,Ka=Za,Rn=Zt.apply(this,arguments)/2,tn=Rn>h&&(wt?+wt.apply(this,arguments):f(Mi*Mi+gi*gi)),Mn=u(o(gi-Mi)/2,+ct.apply(this,arguments)),Kn=Mn,zn=Mn,ua,Ea;if(tn>h){var ln=y(tn/Mi*c(Rn)),on=y(tn/gi*c(Rn));(pn-=ln*2)>h?(ln*=oa?1:-1,Li+=ln,In-=ln):(pn=0,Li=In=(ba+Hi)/2),(Ka-=on*2)>h?(on*=oa?1:-1,Cn+=on,_n-=on):(Ka=0,Cn=_n=(ba+Hi)/2)}var ao=gi*l(Cn),ho=gi*c(Cn),Jn=Mi*l(In),lo=Mi*c(In);if(Mn>h){var Fo=gi*l(_n),uo=gi*c(_n),Qn=Mi*l(Li),jo=Mi*c(Li),Yn;if(Zah?zn>h?(ua=w(Qn,jo,ao,ho,gi,zn,oa),Ea=w(Fo,uo,Jn,lo,gi,zn,oa),qt.moveTo(ua.cx+ua.x01,ua.cy+ua.y01),znh)||!(pn>h)?qt.lineTo(Jn,lo):Kn>h?(ua=w(Jn,lo,Fo,uo,Mi,-Kn,oa),Ea=w(ao,ho,Qn,jo,Mi,-Kn,oa),qt.lineTo(ua.cx+ua.x01,ua.cy+ua.y01),Kn=gi;--ba)qt.point(_n[ba],Li[ba]);qt.lineEnd(),qt.areaEnd()}oa&&(_n[Mi]=+ze(Za,Mi,Pr),Li[Mi]=+ct(Za,Mi,Pr),qt.point(tt?+tt(Za,Mi,Pr):_n[Mi],wt?+wt(Za,Mi,Pr):Li[Mi]))}if(Cn)return qt=null,Cn+""||null}function Br(){return F().defined(Nt).curve(Zt).context(It)}return vr.x=function(Pr){return arguments.length?(ze=typeof Pr=="function"?Pr:a(+Pr),tt=null,vr):ze},vr.x0=function(Pr){return arguments.length?(ze=typeof Pr=="function"?Pr:a(+Pr),vr):ze},vr.x1=function(Pr){return arguments.length?(tt=Pr==null?null:typeof Pr=="function"?Pr:a(+Pr),vr):tt},vr.y=function(Pr){return arguments.length?(ct=typeof Pr=="function"?Pr:a(+Pr),wt=null,vr):ct},vr.y0=function(Pr){return arguments.length?(ct=typeof Pr=="function"?Pr:a(+Pr),vr):ct},vr.y1=function(Pr){return arguments.length?(wt=Pr==null?null:typeof Pr=="function"?Pr:a(+Pr),vr):wt},vr.lineX0=vr.lineY0=function(){return Br().x(ze).y(ct)},vr.lineY1=function(){return Br().x(ze).y(wt)},vr.lineX1=function(){return Br().x(tt).y(ct)},vr.defined=function(Pr){return arguments.length?(Nt=typeof Pr=="function"?Pr:a(!!Pr),vr):Nt},vr.curve=function(Pr){return arguments.length?(Zt=Pr,It!=null&&(qt=Zt(It)),vr):Zt},vr.context=function(Pr){return arguments.length?(Pr==null?It=qt=null:qt=Zt(It=Pr),vr):It},vr}function R(ze,tt){return ttze?1:tt>=ze?0:NaN}function P(ze){return ze}function z(){var ze=P,tt=R,ct=null,wt=a(0),Nt=a(g),It=a(0);function Zt(qt){var vr,Br=qt.length,Pr,Mi,gi=0,ba=new Array(Br),Hi=new Array(Br),Za=+wt.apply(this,arguments),oa=Math.min(g,Math.max(-g,Nt.apply(this,arguments)-Za)),Cn,_n=Math.min(Math.abs(oa)/Br,It.apply(this,arguments)),Li=_n*(oa<0?-1:1),In;for(vr=0;vr0&&(gi+=In);for(tt!=null?ba.sort(function(pn,Ka){return tt(Hi[pn],Hi[Ka])}):ct!=null&&ba.sort(function(pn,Ka){return ct(qt[pn],qt[Ka])}),vr=0,Mi=gi?(oa-Br*Li)/gi:0;vr0?In*Mi:0)+Li,Hi[Pr]={data:qt[Pr],index:vr,value:In,startAngle:Za,endAngle:Cn,padAngle:_n};return Hi}return Zt.value=function(qt){return arguments.length?(ze=typeof qt=="function"?qt:a(+qt),Zt):ze},Zt.sortValues=function(qt){return arguments.length?(tt=qt,ct=null,Zt):tt},Zt.sort=function(qt){return arguments.length?(ct=qt,tt=null,Zt):ct},Zt.startAngle=function(qt){return arguments.length?(wt=typeof qt=="function"?qt:a(+qt),Zt):wt},Zt.endAngle=function(qt){return arguments.length?(Nt=typeof qt=="function"?qt:a(+qt),Zt):Nt},Zt.padAngle=function(qt){return arguments.length?(It=typeof qt=="function"?qt:a(+qt),Zt):It},Zt}var I=B(b);function L(ze){this._curve=ze}L.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(ze,tt){this._curve.point(tt*Math.sin(ze),tt*-Math.cos(ze))}};function B(ze){function tt(ct){return new L(ze(ct))}return tt._curve=ze,tt}function O(ze){var tt=ze.curve;return ze.angle=ze.x,delete ze.x,ze.radius=ze.y,delete ze.y,ze.curve=function(ct){return arguments.length?tt(B(ct)):tt()._curve},ze}function G(){return O(F().curve(I))}function W(){var ze=D().curve(I),tt=ze.curve,ct=ze.lineX0,wt=ze.lineX1,Nt=ze.lineY0,It=ze.lineY1;return ze.angle=ze.x,delete ze.x,ze.startAngle=ze.x0,delete ze.x0,ze.endAngle=ze.x1,delete ze.x1,ze.radius=ze.y,delete ze.y,ze.innerRadius=ze.y0,delete ze.y0,ze.outerRadius=ze.y1,delete ze.y1,ze.lineStartAngle=function(){return O(ct())},delete ze.lineX0,ze.lineEndAngle=function(){return O(wt())},delete ze.lineX1,ze.lineInnerRadius=function(){return O(Nt())},delete ze.lineY0,ze.lineOuterRadius=function(){return O(It())},delete ze.lineY1,ze.curve=function(Zt){return arguments.length?tt(B(Zt)):tt()._curve},ze}function X(ze,tt){return[(tt=+tt)*Math.cos(ze-=Math.PI/2),tt*Math.sin(ze)]}var Z=Array.prototype.slice;function J(ze){return ze.source}function N(ze){return ze.target}function H(ze){var tt=J,ct=N,wt=E,Nt=T,It=null;function Zt(){var qt,vr=Z.call(arguments),Br=tt.apply(this,vr),Pr=ct.apply(this,vr);if(It||(It=qt=i.path()),ze(It,+wt.apply(this,(vr[0]=Br,vr)),+Nt.apply(this,vr),+wt.apply(this,(vr[0]=Pr,vr)),+Nt.apply(this,vr)),qt)return It=null,qt+""||null}return Zt.source=function(qt){return arguments.length?(tt=qt,Zt):tt},Zt.target=function(qt){return arguments.length?(ct=qt,Zt):ct},Zt.x=function(qt){return arguments.length?(wt=typeof qt=="function"?qt:a(+qt),Zt):wt},Zt.y=function(qt){return arguments.length?(Nt=typeof qt=="function"?qt:a(+qt),Zt):Nt},Zt.context=function(qt){return arguments.length?(It=qt??null,Zt):It},Zt}function $(ze,tt,ct,wt,Nt){ze.moveTo(tt,ct),ze.bezierCurveTo(tt=(tt+wt)/2,ct,tt,Nt,wt,Nt)}function U(ze,tt,ct,wt,Nt){ze.moveTo(tt,ct),ze.bezierCurveTo(tt,ct=(ct+Nt)/2,wt,ct,wt,Nt)}function V(ze,tt,ct,wt,Nt){var It=X(tt,ct),Zt=X(tt,ct=(ct+Nt)/2),qt=X(wt,ct),vr=X(wt,Nt);ze.moveTo(It[0],It[1]),ze.bezierCurveTo(Zt[0],Zt[1],qt[0],qt[1],vr[0],vr[1])}function j(){return H($)}function q(){return H(U)}function Y(){var ze=H(V);return ze.angle=ze.x,delete ze.x,ze.radius=ze.y,delete ze.y,ze}var K={draw:function(ze,tt){var ct=Math.sqrt(tt/d);ze.moveTo(ct,0),ze.arc(0,0,ct,0,g)}},te={draw:function(ze,tt){var ct=Math.sqrt(tt/5)/2;ze.moveTo(-3*ct,-ct),ze.lineTo(-ct,-ct),ze.lineTo(-ct,-3*ct),ze.lineTo(ct,-3*ct),ze.lineTo(ct,-ct),ze.lineTo(3*ct,-ct),ze.lineTo(3*ct,ct),ze.lineTo(ct,ct),ze.lineTo(ct,3*ct),ze.lineTo(-ct,3*ct),ze.lineTo(-ct,ct),ze.lineTo(-3*ct,ct),ze.closePath()}},ne=Math.sqrt(1/3),se=ne*2,le={draw:function(ze,tt){var ct=Math.sqrt(tt/se),wt=ct*ne;ze.moveTo(0,-ct),ze.lineTo(wt,0),ze.lineTo(0,ct),ze.lineTo(-wt,0),ze.closePath()}},ce=.8908130915292852,pe=Math.sin(d/10)/Math.sin(7*d/10),xe=Math.sin(g/10)*pe,ye=-Math.cos(g/10)*pe,fe={draw:function(ze,tt){var ct=Math.sqrt(tt*ce),wt=xe*ct,Nt=ye*ct;ze.moveTo(0,-ct),ze.lineTo(wt,Nt);for(var It=1;It<5;++It){var Zt=g*It/5,qt=Math.cos(Zt),vr=Math.sin(Zt);ze.lineTo(vr*ct,-qt*ct),ze.lineTo(qt*wt-vr*Nt,vr*wt+qt*Nt)}ze.closePath()}},ae={draw:function(ze,tt){var ct=Math.sqrt(tt),wt=-ct/2;ze.rect(wt,wt,ct,ct)}},ee=Math.sqrt(3),ie={draw:function(ze,tt){var ct=-Math.sqrt(tt/(ee*3));ze.moveTo(0,ct*2),ze.lineTo(-ee*ct,-ct),ze.lineTo(ee*ct,-ct),ze.closePath()}},Q=-.5,ue=Math.sqrt(3)/2,ge=1/Math.sqrt(12),Me=(ge/2+1)*3,Te={draw:function(ze,tt){var ct=Math.sqrt(tt/Me),wt=ct/2,Nt=ct*ge,It=wt,Zt=ct*ge+ct,qt=-It,vr=Zt;ze.moveTo(wt,Nt),ze.lineTo(It,Zt),ze.lineTo(qt,vr),ze.lineTo(Q*wt-ue*Nt,ue*wt+Q*Nt),ze.lineTo(Q*It-ue*Zt,ue*It+Q*Zt),ze.lineTo(Q*qt-ue*vr,ue*qt+Q*vr),ze.lineTo(Q*wt+ue*Nt,Q*Nt-ue*wt),ze.lineTo(Q*It+ue*Zt,Q*Zt-ue*It),ze.lineTo(Q*qt+ue*vr,Q*vr-ue*qt),ze.closePath()}},je=[K,te,le,ae,fe,ie,Te];function Ve(){var ze=a(K),tt=a(64),ct=null;function wt(){var Nt;if(ct||(ct=Nt=i.path()),ze.apply(this,arguments).draw(ct,+tt.apply(this,arguments)),Nt)return ct=null,Nt+""||null}return wt.type=function(Nt){return arguments.length?(ze=typeof Nt=="function"?Nt:a(Nt),wt):ze},wt.size=function(Nt){return arguments.length?(tt=typeof Nt=="function"?Nt:a(+Nt),wt):tt},wt.context=function(Nt){return arguments.length?(ct=Nt??null,wt):ct},wt}function Ze(){}function Ke(ze,tt,ct){ze._context.bezierCurveTo((2*ze._x0+ze._x1)/3,(2*ze._y0+ze._y1)/3,(ze._x0+2*ze._x1)/3,(ze._y0+2*ze._y1)/3,(ze._x0+4*ze._x1+tt)/6,(ze._y0+4*ze._y1+ct)/6)}function vt(ze){this._context=ze}vt.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:Ke(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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);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:Ke(this,ze,tt);break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt}};function xt(ze){return new vt(ze)}function Pt(ze){this._context=ze}Pt.prototype={areaStart:Ze,areaEnd:Ze,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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._x2=ze,this._y2=tt;break;case 1:this._point=2,this._x3=ze,this._y3=tt;break;case 2:this._point=3,this._x4=ze,this._y4=tt,this._context.moveTo((this._x0+4*this._x1+ze)/6,(this._y0+4*this._y1+tt)/6);break;default:Ke(this,ze,tt);break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt}};function mt(ze){return new Pt(ze)}function Mt(ze){this._context=ze}Mt.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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var ct=(this._x0+4*this._x1+ze)/6,wt=(this._y0+4*this._y1+tt)/6;this._line?this._context.lineTo(ct,wt):this._context.moveTo(ct,wt);break;case 3:this._point=4;default:Ke(this,ze,tt);break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt}};function lt(ze){return new Mt(ze)}function qe(ze,tt){this._basis=new vt(ze),this._beta=tt}qe.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var ze=this._x,tt=this._y,ct=ze.length-1;if(ct>0)for(var wt=ze[0],Nt=tt[0],It=ze[ct]-wt,Zt=tt[ct]-Nt,qt=-1,vr;++qt<=ct;)vr=qt/ct,this._basis.point(this._beta*ze[qt]+(1-this._beta)*(wt+vr*It),this._beta*tt[qt]+(1-this._beta)*(Nt+vr*Zt));this._x=this._y=null,this._basis.lineEnd()},point:function(ze,tt){this._x.push(+ze),this._y.push(+tt)}};var Ye=(function ze(tt){function ct(wt){return tt===1?new vt(wt):new qe(wt,tt)}return ct.beta=function(wt){return ze(+wt)},ct})(.85);function me(ze,tt,ct){ze._context.bezierCurveTo(ze._x1+ze._k*(ze._x2-ze._x0),ze._y1+ze._k*(ze._y2-ze._y0),ze._x2+ze._k*(ze._x1-tt),ze._y2+ze._k*(ze._y1-ct),ze._x2,ze._y2)}function _e(ze,tt){this._context=ze,this._k=(1-tt)/6}_e.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:me(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2,this._x1=ze,this._y1=tt;break;case 2:this._point=3;default:me(this,ze,tt);break}this._x0=this._x1,this._x1=this._x2,this._x2=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Ae=(function ze(tt){function ct(wt){return new _e(wt,tt)}return ct.tension=function(wt){return ze(+wt)},ct})(0);function ke(ze,tt){this._context=ze,this._k=(1-tt)/6}ke.prototype={areaStart:Ze,areaEnd:Ze,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(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._x3=ze,this._y3=tt;break;case 1:this._point=2,this._context.moveTo(this._x4=ze,this._y4=tt);break;case 2:this._point=3,this._x5=ze,this._y5=tt;break;default:me(this,ze,tt);break}this._x0=this._x1,this._x1=this._x2,this._x2=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Ee=(function ze(tt){function ct(wt){return new ke(wt,tt)}return ct.tension=function(wt){return ze(+wt)},ct})(0);function De(ze,tt){this._context=ze,this._k=(1-tt)/6}De.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(ze,tt){switch(ze=+ze,tt=+tt,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:me(this,ze,tt);break}this._x0=this._x1,this._x1=this._x2,this._x2=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Je=(function ze(tt){function ct(wt){return new De(wt,tt)}return ct.tension=function(wt){return ze(+wt)},ct})(0);function Ue(ze,tt,ct){var wt=ze._x1,Nt=ze._y1,It=ze._x2,Zt=ze._y2;if(ze._l01_a>h){var qt=2*ze._l01_2a+3*ze._l01_a*ze._l12_a+ze._l12_2a,vr=3*ze._l01_a*(ze._l01_a+ze._l12_a);wt=(wt*qt-ze._x0*ze._l12_2a+ze._x2*ze._l01_2a)/vr,Nt=(Nt*qt-ze._y0*ze._l12_2a+ze._y2*ze._l01_2a)/vr}if(ze._l23_a>h){var Br=2*ze._l23_2a+3*ze._l23_a*ze._l12_a+ze._l12_2a,Pr=3*ze._l23_a*(ze._l23_a+ze._l12_a);It=(It*Br+ze._x1*ze._l23_2a-tt*ze._l12_2a)/Pr,Zt=(Zt*Br+ze._y1*ze._l23_2a-ct*ze._l12_2a)/Pr}ze._context.bezierCurveTo(wt,Nt,It,Zt,ze._x2,ze._y2)}function at(ze,tt){this._context=ze,this._alpha=tt}at.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(ze,tt){if(ze=+ze,tt=+tt,this._point){var ct=this._x2-ze,wt=this._y2-tt;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(ct*ct+wt*wt,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2;break;case 2:this._point=3;default:Ue(this,ze,tt);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=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var rt=(function ze(tt){function ct(wt){return tt?new at(wt,tt):new _e(wt,0)}return ct.alpha=function(wt){return ze(+wt)},ct})(.5);function ft(ze,tt){this._context=ze,this._alpha=tt}ft.prototype={areaStart:Ze,areaEnd:Ze,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(ze,tt){if(ze=+ze,tt=+tt,this._point){var ct=this._x2-ze,wt=this._y2-tt;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(ct*ct+wt*wt,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=ze,this._y3=tt;break;case 1:this._point=2,this._context.moveTo(this._x4=ze,this._y4=tt);break;case 2:this._point=3,this._x5=ze,this._y5=tt;break;default:Ue(this,ze,tt);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=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var At=(function ze(tt){function ct(wt){return tt?new ft(wt,tt):new ke(wt,0)}return ct.alpha=function(wt){return ze(+wt)},ct})(.5);function ht(ze,tt){this._context=ze,this._alpha=tt}ht.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(ze,tt){if(ze=+ze,tt=+tt,this._point){var ct=this._x2-ze,wt=this._y2-tt;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(ct*ct+wt*wt,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:Ue(this,ze,tt);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=ze,this._y0=this._y1,this._y1=this._y2,this._y2=tt}};var Gt=(function ze(tt){function ct(wt){return tt?new ht(wt,tt):new De(wt,0)}return ct.alpha=function(wt){return ze(+wt)},ct})(.5);function fr(ze){this._context=ze}fr.prototype={areaStart:Ze,areaEnd:Ze,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(ze,tt){ze=+ze,tt=+tt,this._point?this._context.lineTo(ze,tt):(this._point=1,this._context.moveTo(ze,tt))}};function gt(ze){return new fr(ze)}function yt(ze){return ze<0?-1:1}function kt(ze,tt,ct){var wt=ze._x1-ze._x0,Nt=tt-ze._x1,It=(ze._y1-ze._y0)/(wt||Nt<0&&-0),Zt=(ct-ze._y1)/(Nt||wt<0&&-0),qt=(It*Nt+Zt*wt)/(wt+Nt);return(yt(It)+yt(Zt))*Math.min(Math.abs(It),Math.abs(Zt),.5*Math.abs(qt))||0}function Lt(ze,tt){var ct=ze._x1-ze._x0;return ct?(3*(ze._y1-ze._y0)/ct-tt)/2:tt}function Ct(ze,tt,ct){var wt=ze._x0,Nt=ze._y0,It=ze._x1,Zt=ze._y1,qt=(It-wt)/3;ze._context.bezierCurveTo(wt+qt,Nt+qt*tt,It-qt,Zt-qt*ct,It,Zt)}function $t(ze){this._context=ze}$t.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:Ct(this,this._t0,Lt(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(ze,tt){var ct=NaN;if(ze=+ze,tt=+tt,!(ze===this._x1&&tt===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2;break;case 2:this._point=3,Ct(this,Lt(this,ct=kt(this,ze,tt)),ct);break;default:Ct(this,this._t0,ct=kt(this,ze,tt));break}this._x0=this._x1,this._x1=ze,this._y0=this._y1,this._y1=tt,this._t0=ct}}};function mr(ze){this._context=new br(ze)}(mr.prototype=Object.create($t.prototype)).point=function(ze,tt){$t.prototype.point.call(this,tt,ze)};function br(ze){this._context=ze}br.prototype={moveTo:function(ze,tt){this._context.moveTo(tt,ze)},closePath:function(){this._context.closePath()},lineTo:function(ze,tt){this._context.lineTo(tt,ze)},bezierCurveTo:function(ze,tt,ct,wt,Nt,It){this._context.bezierCurveTo(tt,ze,wt,ct,It,Nt)}};function Er(ze){return new $t(ze)}function Tr(ze){return new mr(ze)}function Ur(ze){this._context=ze}Ur.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var ze=this._x,tt=this._y,ct=ze.length;if(ct)if(this._line?this._context.lineTo(ze[0],tt[0]):this._context.moveTo(ze[0],tt[0]),ct===2)this._context.lineTo(ze[1],tt[1]);else for(var wt=Ai(ze),Nt=Ai(tt),It=0,Zt=1;Zt=0;--tt)Nt[tt]=(Zt[tt]-Nt[tt+1])/It[tt];for(It[ct-1]=(ze[ct]+Nt[ct-1])/2,tt=0;tt=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(ze,tt){switch(ze=+ze,tt=+tt,this._point){case 0:this._point=1,this._line?this._context.lineTo(ze,tt):this._context.moveTo(ze,tt);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,tt),this._context.lineTo(ze,tt);else{var ct=this._x*(1-this._t)+ze*this._t;this._context.lineTo(ct,this._y),this._context.lineTo(ct,tt)}break}}this._x=ze,this._y=tt}};function ea(ze){return new Qr(ze,.5)}function $i(ze){return new Qr(ze,0)}function ja(ze){return new Qr(ze,1)}function ya(ze,tt){if((Zt=ze.length)>1)for(var ct=1,wt,Nt,It=ze[tt[0]],Zt,qt=It.length;ct=0;)ct[tt]=tt;return ct}function xi(ze,tt){return ze[tt]}function bi(){var ze=a([]),tt=pa,ct=ya,wt=xi;function Nt(It){var Zt=ze.apply(this,arguments),qt,vr=It.length,Br=Zt.length,Pr=new Array(Br),Mi;for(qt=0;qt0){for(var ct,wt,Nt=0,It=ze[0].length,Zt;Nt0)for(var ct,wt=0,Nt,It,Zt,qt,vr,Br=ze[tt[0]].length;wt0?(Nt[0]=Zt,Nt[1]=Zt+=It):It<0?(Nt[1]=qt,Nt[0]=qt+=It):(Nt[0]=0,Nt[1]=It)}function pi(ze,tt){if((Nt=ze.length)>0){for(var ct=0,wt=ze[tt[0]],Nt,It=wt.length;ct0)||!((It=(Nt=ze[tt[0]]).length)>0))){for(var ct=0,wt=1,Nt,It,Zt;wtIt&&(It=Nt,ct=tt);return ct}function Et(ze){var tt=ze.map(St);return pa(ze).sort(function(ct,wt){return tt[ct]-tt[wt]})}function St(ze){for(var tt=0,ct=-1,wt=ze.length,Nt;++ct[D(xe,ye,le),xe]));for(let[xe,ye]of ce.entries()){ye.index=xe;let{source:fe,target:ae}=ye;typeof fe!="object"&&(fe=ye.source=_(pe,fe)),typeof ae!="object"&&(ae=ye.target=_(pe,ae)),fe.sourceLinks.push(ye),ae.targetLinks.push(ye)}if(z!=null)for(let{sourceLinks:xe,targetLinks:ye}of le)xe.sort(z),ye.sort(z)}function X({nodes:le}){for(let ce of le)ce.value=ce.fixedValue===void 0?Math.max(i.sum(ce.sourceLinks,p),i.sum(ce.targetLinks,p)):ce.fixedValue}function Z({nodes:le}){let ce=le.length,pe=new Set(le),xe=new Set,ye=0;for(;pe.size;){for(let fe of pe){fe.depth=ye;for(let{target:ae}of fe.sourceLinks)xe.add(ae)}if(++ye>ce)throw new Error("circular link");pe=xe,xe=new Set}}function J({nodes:le}){let ce=le.length,pe=new Set(le),xe=new Set,ye=0;for(;pe.size;){for(let fe of pe){fe.height=ye;for(let{source:ae}of fe.targetLinks)xe.add(ae)}if(++ye>ce)throw new Error("circular link");pe=xe,xe=new Set}}function N({nodes:le}){let ce=i.max(le,ye=>ye.depth)+1,pe=(A-w-E)/(ce-1),xe=new Array(ce);for(let ye of le){let fe=Math.max(0,Math.min(ce-1,Math.floor(R.call(null,ye,ce))));ye.layer=fe,ye.x0=w+fe*pe,ye.x1=ye.x0+E,xe[fe]?xe[fe].push(ye):xe[fe]=[ye]}if(P)for(let ye of xe)ye.sort(P);return xe}function H(le){let ce=i.min(le,pe=>(b-k-(pe.length-1)*F)/i.sum(pe,p));for(let pe of le){let xe=k;for(let ye of pe){ye.y0=xe,ye.y1=xe+ye.value*ce,xe=ye.y1+F;for(let fe of ye.sourceLinks)fe.width=fe.value*ce}xe=(b-xe+F)/(pe.length+1);for(let ye=0;yepe.length)-1)),H(ce);for(let pe=0;pe0))continue;let Q=(ee/ie-ae.y0)*ce;ae.y0+=Q,ae.y1+=Q,K(ae)}P===void 0&&fe.sort(d),j(fe,pe)}}function V(le,ce,pe){for(let xe=le.length,ye=xe-2;ye>=0;--ye){let fe=le[ye];for(let ae of fe){let ee=0,ie=0;for(let{target:ue,value:ge}of ae.sourceLinks){let Me=ge*(ue.layer-ae.layer);ee+=se(ae,ue)*Me,ie+=Me}if(!(ie>0))continue;let Q=(ee/ie-ae.y0)*ce;ae.y0+=Q,ae.y1+=Q,K(ae)}P===void 0&&fe.sort(d),j(fe,pe)}}function j(le,ce){let pe=le.length>>1,xe=le[pe];Y(le,xe.y0-F,pe-1,ce),q(le,xe.y1+F,pe+1,ce),Y(le,b,le.length-1,ce),q(le,k,0,ce)}function q(le,ce,pe,xe){for(;pe1e-6&&(ye.y0+=fe,ye.y1+=fe),ce=ye.y1+F}}function Y(le,ce,pe,xe){for(;pe>=0;--pe){let ye=le[pe],fe=(ye.y1-ce)*xe;fe>1e-6&&(ye.y0-=fe,ye.y1-=fe),ce=ye.y0-F}}function K({sourceLinks:le,targetLinks:ce}){if(z===void 0){for(let{source:{sourceLinks:pe}}of ce)pe.sort(h);for(let{target:{targetLinks:pe}}of le)pe.sort(f)}}function te(le){if(z===void 0)for(let{sourceLinks:ce,targetLinks:pe}of le)ce.sort(h),pe.sort(f)}function ne(le,ce){let pe=le.y0-(le.sourceLinks.length-1)*F/2;for(let{target:xe,width:ye}of le.sourceLinks){if(xe===ce)break;pe+=ye+F}for(let{source:xe,width:ye}of ce.targetLinks){if(xe===le)break;pe-=ye}return pe}function se(le,ce){let pe=ce.y0-(ce.targetLinks.length-1)*F/2;for(let{source:xe,width:ye}of ce.targetLinks){if(xe===le)break;pe+=ye+F}for(let{target:xe,width:ye}of le.sourceLinks){if(xe===ce)break;pe-=ye}return pe}return G}function S(w){return[w.source.x1,w.y0]}function M(w){return[w.target.x0,w.y1]}function C(){return a.linkHorizontal().source(S).target(M)}t.sankey=x,t.sankeyCenter=u,t.sankeyJustify=n,t.sankeyLeft=s,t.sankeyLinkHorizontal=C,t.sankeyRight=l,Object.defineProperty(t,"__esModule",{value:!0})})}}),vle=de({"node_modules/@plotly/d3-sankey-circular/node_modules/d3-array/dist/d3-array.js"(e,r){(function(t,i){i(typeof e=="object"&&typeof r<"u"?e:t.d3=t.d3||{})})(e,(function(t){"use strict";function i($,U){return $U?1:$>=U?0:NaN}function a($){return $.length===1&&($=o($)),{left:function(U,V,j,q){for(j==null&&(j=0),q==null&&(q=U.length);j>>1;$(U[Y],V)<0?j=Y+1:q=Y}return j},right:function(U,V,j,q){for(j==null&&(j=0),q==null&&(q=U.length);j>>1;$(U[Y],V)>0?q=Y:j=Y+1}return j}}}function o($){return function(U,V){return i($(U),V)}}var s=a(i),l=s.right,n=s.left;function u($,U){U==null&&(U=c);for(var V=0,j=$.length-1,q=$[0],Y=new Array(j<0?0:j);V$?1:U>=$?0:NaN}function d($){return $===null?NaN:+$}function p($,U){var V=$.length,j=0,q=-1,Y=0,K,te,ne=0;if(U==null)for(;++q1)return ne/(j-1)}function g($,U){var V=p($,U);return V&&Math.sqrt(V)}function m($,U){var V=$.length,j=-1,q,Y,K;if(U==null){for(;++j=q)for(Y=K=q;++jq&&(Y=q),K=q)for(Y=K=q;++jq&&(Y=q),K0)return[$];if((j=U<$)&&(Y=$,$=U,U=Y),(te=b($,U,V))===0||!isFinite(te))return[];if(te>0)for($=Math.ceil($/te),U=Math.floor(U/te),K=new Array(Y=Math.ceil(U-$+1));++q=0?(Y>=C?10:Y>=w?5:Y>=k?2:1)*Math.pow(10,q):-Math.pow(10,-q)/(Y>=C?10:Y>=w?5:Y>=k?2:1)}function E($,U,V){var j=Math.abs(U-$)/Math.max(0,V),q=Math.pow(10,Math.floor(Math.log(j)/Math.LN10)),Y=j/q;return Y>=C?q*=10:Y>=w?q*=5:Y>=k&&(q*=2),U<$?-q:q}function T($){return Math.ceil(Math.log($.length)/Math.LN2)+1}function F(){var $=S,U=m,V=T;function j(q){var Y,K=q.length,te,ne=new Array(K);for(Y=0;Yce;)pe.pop(),--xe;var ye=new Array(xe+1),fe;for(Y=0;Y<=xe;++Y)fe=ye[Y]=[],fe.x0=Y>0?pe[Y-1]:le,fe.x1=Y=1)return+V($[j-1],j-1,$);var j,q=(j-1)*U,Y=Math.floor(q),K=+V($[Y],Y,$),te=+V($[Y+1],Y+1,$);return K+(te-K)*(q-Y)}}function R($,U,V){return $=v.call($,d).sort(i),Math.ceil((V-U)/(2*(D($,.75)-D($,.25))*Math.pow($.length,-1/3)))}function P($,U,V){return Math.ceil((V-U)/(3.5*g($)*Math.pow($.length,-1/3)))}function z($,U){var V=$.length,j=-1,q,Y;if(U==null){for(;++j=q)for(Y=q;++jY&&(Y=q)}else for(;++j=q)for(Y=q;++jY&&(Y=q);return Y}function I($,U){var V=$.length,j=V,q=-1,Y,K=0;if(U==null)for(;++q=0;)for(K=$[U],V=K.length;--V>=0;)Y[--q]=K[V];return Y}function O($,U){var V=$.length,j=-1,q,Y;if(U==null){for(;++j=q)for(Y=q;++jq&&(Y=q)}else for(;++j=q)for(Y=q;++jq&&(Y=q);return Y}function G($,U){for(var V=U.length,j=new Array(V);V--;)j[V]=$[U[V]];return j}function W($,U){if(V=$.length){var V,j=0,q=0,Y,K=$[q];for(U==null&&(U=i);++j=M})}function m(M){g(M);for(var C=a,w=t(C),k=w.components.filter(function(R){return R.length>1}),A=1/0,b,E=0;E"u"?"undefined":d(_e))!=="object"&&(_e=Ye.source=w(qe,_e)),(typeof Ae>"u"?"undefined":d(Ae))!=="object"&&(Ae=Ye.target=w(qe,Ae)),_e.sourceLinks.push(Ye),Ae.targetLinks.push(Ye)}),lt}function Ke(lt){lt.nodes.forEach(function(qe){qe.partOfCycle=!1,qe.value=Math.max(i.sum(qe.sourceLinks,y),i.sum(qe.targetLinks,y)),qe.sourceLinks.forEach(function(Ye){Ye.circular&&(qe.partOfCycle=!0,qe.circularLinkType=Ye.circularLinkType)}),qe.targetLinks.forEach(function(Ye){Ye.circular&&(qe.partOfCycle=!0,qe.circularLinkType=Ye.circularLinkType)})})}function vt(lt){var qe=0,Ye=0,me=0,_e=0,Ae=i.max(lt.nodes,function(ke){return ke.column});return lt.links.forEach(function(ke){ke.circular&&(ke.circularLinkType=="top"?qe=qe+ke.width:Ye=Ye+ke.width,ke.target.column==0&&(_e=_e+ke.width),ke.source.column==Ae&&(me=me+ke.width))}),qe=qe>0?qe+A+b:qe,Ye=Ye>0?Ye+A+b:Ye,me=me>0?me+A+b:me,_e=_e>0?_e+A+b:_e,{top:qe,bottom:Ye,left:_e,right:me}}function xt(lt,qe){var Ye=i.max(lt.nodes,function(Je){return Je.column}),me=xe-ce,_e=ye-pe,Ae=me+qe.right+qe.left,ke=_e+qe.top+qe.bottom,Ee=me/Ae,De=_e/ke;return ce=ce*Ee+qe.left,xe=qe.right==0?xe:xe*Ee,pe=pe*De+qe.top,ye=ye*De,lt.nodes.forEach(function(Je){Je.x0=ce+Je.column*((xe-ce-fe)/Ye),Je.x1=Je.x0+fe}),De}function Pt(lt){var qe,Ye,me;for(qe=lt.nodes,Ye=[],me=0;qe.length;++me,qe=Ye,Ye=[])qe.forEach(function(_e){_e.depth=me,_e.sourceLinks.forEach(function(Ae){Ye.indexOf(Ae.target)<0&&!Ae.circular&&Ye.push(Ae.target)})});for(qe=lt.nodes,Ye=[],me=0;qe.length;++me,qe=Ye,Ye=[])qe.forEach(function(_e){_e.height=me,_e.targetLinks.forEach(function(Ae){Ye.indexOf(Ae.source)<0&&!Ae.circular&&Ye.push(Ae.source)})});lt.nodes.forEach(function(_e){_e.column=Math.floor(ie.call(null,_e,me))})}function mt(lt,qe,Ye){var me=a.nest().key(function(Je){return Je.column}).sortKeys(i.ascending).entries(lt.nodes).map(function(Je){return Je.values});ke(Ye),De();for(var _e=1,Ae=qe;Ae>0;--Ae)Ee(_e*=.99,Ye),De();function ke(Je){if(Te){var Ue=1/0;me.forEach(function(At){var ht=ye*Te/(At.length+1);Ue=ht0))if(At==0&&ft==1)Gt=ht.y1-ht.y0,ht.y0=ye/2-Gt/2,ht.y1=ye/2+Gt/2;else if(At==at-1&&ft==1)Gt=ht.y1-ht.y0,ht.y0=ye/2-Gt/2,ht.y1=ye/2+Gt/2;else{var fr=0,gt=i.mean(ht.sourceLinks,x),yt=i.mean(ht.targetLinks,v);gt&&yt?fr=(gt+yt)/2:fr=gt||yt;var kt=(fr-_(ht))*Je;ht.y0+=kt,ht.y1+=kt}})})}function De(){me.forEach(function(Je){var Ue,at,rt=pe,ft=Je.length,At;for(Je.sort(m),At=0;At0&&(Ue.y0+=at,Ue.y1+=at),rt=Ue.y1+ae;if(at=rt-ae-ye,at>0)for(rt=Ue.y0-=at,Ue.y1-=at,At=ft-2;At>=0;--At)Ue=Je[At],at=Ue.y1+ae-rt,at>0&&(Ue.y0-=at,Ue.y1-=at),rt=Ue.y0})}}function Mt(lt){lt.nodes.forEach(function(qe){qe.sourceLinks.sort(g),qe.targetLinks.sort(p)}),lt.nodes.forEach(function(qe){var Ye=qe.y0,me=Ye,_e=qe.y1,Ae=_e;qe.sourceLinks.forEach(function(ke){ke.circular?(ke.y0=_e-ke.width/2,_e=_e-ke.width):(ke.y0=Ye+ke.width/2,Ye+=ke.width)}),qe.targetLinks.forEach(function(ke){ke.circular?(ke.y1=Ae-ke.width/2,Ae=Ae-ke.width):(ke.y1=me+ke.width/2,me+=ke.width)})})}return Ve}function F(ce,pe,xe){var ye=0;if(xe===null){for(var fe=[],ae=0;aepe.source.column)}function z(ce,pe){var xe=0;ce.sourceLinks.forEach(function(fe){xe=fe.circular&&!se(fe,pe)?xe+1:xe});var ye=0;return ce.targetLinks.forEach(function(fe){ye=fe.circular&&!se(fe,pe)?ye+1:ye}),xe+ye}function I(ce){var pe=ce.source.sourceLinks,xe=0;pe.forEach(function(ae){xe=ae.circular?xe+1:xe});var ye=ce.target.targetLinks,fe=0;return ye.forEach(function(ae){fe=ae.circular?fe+1:fe}),!(xe>1||fe>1)}function L(ce,pe,xe){return ce.sort(G),ce.forEach(function(ye,fe){var ae=0;if(se(ye,xe)&&I(ye))ye.circularPathData.verticalBuffer=ae+ye.width/2;else{var ee=0;for(ee;eeae?ie:ae}ye.circularPathData.verticalBuffer=ae+ye.width/2}}),ce}function B(ce,pe,xe,ye){var fe=5,ae=i.min(ce.links,function(Q){return Q.source.y0});ce.links.forEach(function(Q){Q.circular&&(Q.circularPathData={})});var ee=ce.links.filter(function(Q){return Q.circularLinkType=="top"});L(ee,pe,ye);var ie=ce.links.filter(function(Q){return Q.circularLinkType=="bottom"});L(ie,pe,ye),ce.links.forEach(function(Q){if(Q.circular){if(Q.circularPathData.arcRadius=Q.width+b,Q.circularPathData.leftNodeBuffer=fe,Q.circularPathData.rightNodeBuffer=fe,Q.circularPathData.sourceWidth=Q.source.x1-Q.source.x0,Q.circularPathData.sourceX=Q.source.x0+Q.circularPathData.sourceWidth,Q.circularPathData.targetX=Q.target.x0,Q.circularPathData.sourceY=Q.y0,Q.circularPathData.targetY=Q.y1,se(Q,ye)&&I(Q))Q.circularPathData.leftSmallArcRadius=b+Q.width/2,Q.circularPathData.leftLargeArcRadius=b+Q.width/2,Q.circularPathData.rightSmallArcRadius=b+Q.width/2,Q.circularPathData.rightLargeArcRadius=b+Q.width/2,Q.circularLinkType=="bottom"?(Q.circularPathData.verticalFullExtent=Q.source.y1+A+Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.rightLargeArcRadius):(Q.circularPathData.verticalFullExtent=Q.source.y0-A-Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.rightLargeArcRadius);else{var ue=Q.source.column,ge=Q.circularLinkType,Me=ce.links.filter(function(Ve){return Ve.source.column==ue&&Ve.circularLinkType==ge});Q.circularLinkType=="bottom"?Me.sort(X):Me.sort(W);var Te=0;Me.forEach(function(Ve,Ze){Ve.circularLinkID==Q.circularLinkID&&(Q.circularPathData.leftSmallArcRadius=b+Q.width/2+Te,Q.circularPathData.leftLargeArcRadius=b+Q.width/2+Ze*pe+Te),Te=Te+Ve.width}),ue=Q.target.column,Me=ce.links.filter(function(Ve){return Ve.target.column==ue&&Ve.circularLinkType==ge}),Q.circularLinkType=="bottom"?Me.sort(J):Me.sort(Z),Te=0,Me.forEach(function(Ve,Ze){Ve.circularLinkID==Q.circularLinkID&&(Q.circularPathData.rightSmallArcRadius=b+Q.width/2+Te,Q.circularPathData.rightLargeArcRadius=b+Q.width/2+Ze*pe+Te),Te=Te+Ve.width}),Q.circularLinkType=="bottom"?(Q.circularPathData.verticalFullExtent=Math.max(xe,Q.source.y1,Q.target.y1)+A+Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent-Q.circularPathData.rightLargeArcRadius):(Q.circularPathData.verticalFullExtent=ae-A-Q.circularPathData.verticalBuffer,Q.circularPathData.verticalLeftInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.leftLargeArcRadius,Q.circularPathData.verticalRightInnerExtent=Q.circularPathData.verticalFullExtent+Q.circularPathData.rightLargeArcRadius)}Q.circularPathData.leftInnerExtent=Q.circularPathData.sourceX+Q.circularPathData.leftNodeBuffer,Q.circularPathData.rightInnerExtent=Q.circularPathData.targetX-Q.circularPathData.rightNodeBuffer,Q.circularPathData.leftFullExtent=Q.circularPathData.sourceX+Q.circularPathData.leftLargeArcRadius+Q.circularPathData.leftNodeBuffer,Q.circularPathData.rightFullExtent=Q.circularPathData.targetX-Q.circularPathData.rightLargeArcRadius-Q.circularPathData.rightNodeBuffer}if(Q.circular)Q.path=O(Q);else{var je=o.linkHorizontal().source(function(Ve){var Ze=Ve.source.x0+(Ve.source.x1-Ve.source.x0),Ke=Ve.y0;return[Ze,Ke]}).target(function(Ve){var Ze=Ve.target.x0,Ke=Ve.y1;return[Ze,Ke]});Q.path=je(Q)}})}function O(ce){var pe="";return ce.circularLinkType=="top"?pe="M"+ce.circularPathData.sourceX+" "+ce.circularPathData.sourceY+" L"+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.sourceY+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftSmallArcRadius+" 0 0 0 "+ce.circularPathData.leftFullExtent+" "+(ce.circularPathData.sourceY-ce.circularPathData.leftSmallArcRadius)+" L"+ce.circularPathData.leftFullExtent+" "+ce.circularPathData.verticalLeftInnerExtent+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftLargeArcRadius+" 0 0 0 "+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.verticalFullExtent+" L"+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.verticalFullExtent+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightLargeArcRadius+" 0 0 0 "+ce.circularPathData.rightFullExtent+" "+ce.circularPathData.verticalRightInnerExtent+" L"+ce.circularPathData.rightFullExtent+" "+(ce.circularPathData.targetY-ce.circularPathData.rightSmallArcRadius)+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightSmallArcRadius+" 0 0 0 "+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.targetY+" L"+ce.circularPathData.targetX+" "+ce.circularPathData.targetY:pe="M"+ce.circularPathData.sourceX+" "+ce.circularPathData.sourceY+" L"+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.sourceY+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftSmallArcRadius+" 0 0 1 "+ce.circularPathData.leftFullExtent+" "+(ce.circularPathData.sourceY+ce.circularPathData.leftSmallArcRadius)+" L"+ce.circularPathData.leftFullExtent+" "+ce.circularPathData.verticalLeftInnerExtent+" A"+ce.circularPathData.leftLargeArcRadius+" "+ce.circularPathData.leftLargeArcRadius+" 0 0 1 "+ce.circularPathData.leftInnerExtent+" "+ce.circularPathData.verticalFullExtent+" L"+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.verticalFullExtent+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightLargeArcRadius+" 0 0 1 "+ce.circularPathData.rightFullExtent+" "+ce.circularPathData.verticalRightInnerExtent+" L"+ce.circularPathData.rightFullExtent+" "+(ce.circularPathData.targetY+ce.circularPathData.rightSmallArcRadius)+" A"+ce.circularPathData.rightLargeArcRadius+" "+ce.circularPathData.rightSmallArcRadius+" 0 0 1 "+ce.circularPathData.rightInnerExtent+" "+ce.circularPathData.targetY+" L"+ce.circularPathData.targetX+" "+ce.circularPathData.targetY,pe}function G(ce,pe){return N(ce)==N(pe)?ce.circularLinkType=="bottom"?X(ce,pe):W(ce,pe):N(pe)-N(ce)}function W(ce,pe){return ce.y0-pe.y0}function X(ce,pe){return pe.y0-ce.y0}function Z(ce,pe){return ce.y1-pe.y1}function J(ce,pe){return pe.y1-ce.y1}function N(ce){return ce.target.column-ce.source.column}function H(ce){return ce.target.x0-ce.source.x1}function $(ce,pe){var xe=R(ce),ye=H(pe)/Math.tan(xe),fe=ne(ce)=="up"?ce.y1+ye:ce.y1-ye;return fe}function U(ce,pe){var xe=R(ce),ye=H(pe)/Math.tan(xe),fe=ne(ce)=="up"?ce.y1-ye:ce.y1+ye;return fe}function V(ce,pe,xe,ye){ce.links.forEach(function(fe){if(!fe.circular&&fe.target.column-fe.source.column>1){var ae=fe.source.column+1,ee=fe.target.column-1,ie=1,Q=ee-ae+1;for(ie=1;ae<=ee;ae++,ie++)ce.nodes.forEach(function(ue){if(ue.column==ae){var ge=ie/(Q+1),Me=Math.pow(1-ge,3),Te=3*ge*Math.pow(1-ge,2),je=3*Math.pow(ge,2)*(1-ge),Ve=Math.pow(ge,3),Ze=Me*fe.y0+Te*fe.y0+je*fe.y1+Ve*fe.y1,Ke=Ze-fe.width/2,vt=Ze+fe.width/2,xt;Ke>ue.y0&&Keue.y0&&vtue.y1&&q(Pt,xt,pe,xe)})):Keue.y1&&(xt=vt-ue.y0+10,ue=q(ue,xt,pe,xe),ce.nodes.forEach(function(Pt){k(Pt,ye)==k(ue,ye)||Pt.column!=ue.column||Pt.y0ue.y1&&q(Pt,xt,pe,xe)}))}})}})}function j(ce,pe){return ce.y0>pe.y0&&ce.y0pe.y0&&ce.y1pe.y1}function q(ce,pe,xe,ye){return ce.y0+pe>=xe&&ce.y1+pe<=ye&&(ce.y0=ce.y0+pe,ce.y1=ce.y1+pe,ce.targetLinks.forEach(function(fe){fe.y1=fe.y1+pe}),ce.sourceLinks.forEach(function(fe){fe.y0=fe.y0+pe})),ce}function Y(ce,pe,xe,ye){ce.nodes.forEach(function(fe){ye&&fe.y+(fe.y1-fe.y0)>pe&&(fe.y=fe.y-(fe.y+(fe.y1-fe.y0)-pe));var ae=ce.links.filter(function(Q){return k(Q.source,xe)==k(fe,xe)}),ee=ae.length;ee>1&&ae.sort(function(Q,ue){if(!Q.circular&&!ue.circular){if(Q.target.column==ue.target.column)return Q.y1-ue.y1;if(te(Q,ue)){if(Q.target.column>ue.target.column){var ge=U(ue,Q);return Q.y1-ge}if(ue.target.column>Q.target.column){var Me=U(Q,ue);return Me-ue.y1}}else return Q.y1-ue.y1}if(Q.circular&&!ue.circular)return Q.circularLinkType=="top"?-1:1;if(ue.circular&&!Q.circular)return ue.circularLinkType=="top"?1:-1;if(Q.circular&&ue.circular)return Q.circularLinkType===ue.circularLinkType&&Q.circularLinkType=="top"?Q.target.column===ue.target.column?Q.target.y1-ue.target.y1:ue.target.column-Q.target.column:Q.circularLinkType===ue.circularLinkType&&Q.circularLinkType=="bottom"?Q.target.column===ue.target.column?ue.target.y1-Q.target.y1:Q.target.column-ue.target.column:Q.circularLinkType=="top"?-1:1});var ie=fe.y0;ae.forEach(function(Q){Q.y0=ie+Q.width/2,ie=ie+Q.width}),ae.forEach(function(Q,ue){if(Q.circularLinkType=="bottom"){var ge=ue+1,Me=0;for(ge;ge1&&fe.sort(function(ie,Q){if(!ie.circular&&!Q.circular){if(ie.source.column==Q.source.column)return ie.y0-Q.y0;if(te(ie,Q)){if(Q.source.column0?"up":"down"}function se(ce,pe){return k(ce.source,pe)==k(ce.target,pe)}function le(ce,pe,xe){var ye=ce.nodes,fe=ce.links,ae=!1,ee=!1;if(fe.forEach(function(Te){Te.circularLinkType=="top"?ae=!0:Te.circularLinkType=="bottom"&&(ee=!0)}),ae==!1||ee==!1){var ie=i.min(ye,function(Te){return Te.y0}),Q=i.max(ye,function(Te){return Te.y1}),ue=Q-ie,ge=xe-pe,Me=ge/ue;ye.forEach(function(Te){var je=(Te.y1-Te.y0)*Me;Te.y0=(Te.y0-ie)*Me,Te.y1=Te.y0+je}),fe.forEach(function(Te){Te.y0=(Te.y0-ie)*Me,Te.y1=(Te.y1-ie)*Me,Te.width=Te.width*Me})}}t.sankeyCircular=T,t.sankeyCenter=f,t.sankeyLeft=n,t.sankeyRight=u,t.sankeyJustify=c,Object.defineProperty(t,"__esModule",{value:!0})}))}}),V8=de({"src/traces/sankey/constants.js"(e,r){"use strict";r.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeLabel:"node-label"}}}}),yle=de({"src/traces/sankey/render.js"(e,r){"use strict";var t=fle(),i=(jv(),ti(M0)).interpolateNumber,a=Yr(),o=ple(),s=gle(),l=V8(),n=ta(),u=hn(),c=Qt(),f=c.strTranslate,h=c.strRotate,d=ip(),p=d.keyFun,g=d.repeat,m=d.unwrap,y=Zo(),_=Ma(),v=Bl(),x=v.CAP_SHIFT,S=v.LINE_SPACING,M=3;function C(H,$,U){var V=m($),j=V.trace,q=j.domain,Y=j.orientation==="h",K=j.direction==="reversed",te=j.node.pad,ne=j.node.thickness,se={justify:o.sankeyJustify,left:o.sankeyLeft,right:o.sankeyRight,center:o.sankeyCenter}[j.node.align],le=H.width*(q.x[1]-q.x[0]),ce=H.height*(q.y[1]-q.y[0]),pe=V._nodes,xe=V._links,ye=V.circular,fe;ye?fe=s.sankeyCircular().circularLinkGap(0):fe=o.sankey(),fe.iterations(l.sankeyIterations).size(Y?[le,ce]:[ce,le]).nodeWidth(ne).nodePadding(te).nodeId(function(mt){return mt.pointNumber}).nodeAlign(se).nodes(pe).links(xe);function ae(mt){j[mt].sort==="input"&&(ye?c.warn(`Circular Sankey diagrams do not support the "input" ${mt}.sort mode; falling back to the default sort.`):fe[`${mt}Sort`](null))}ae("link"),ae("node");var ee=fe();fe.nodePadding()=Ye||(qe=Ye-lt.y0,qe>1e-6&&(lt.y0+=qe,lt.y1+=qe)),Ye=lt.y1+te})}function Ke(mt){var Mt=mt.map(function(ke,Ee){return{x0:ke.x0,index:Ee}}).sort(function(ke,Ee){return ke.x0-Ee.x0}),lt=[],qe=-1,Ye,me=-1/0,_e;for(ie=0;ieme+ne&&(qe+=1,Ye=Ae.x0),me=Ae.x0,lt[qe]||(lt[qe]=[]),lt[qe].push(Ae),_e=Ye-Ae.x0,Ae.x0+=_e,Ae.x1+=_e}return lt}if(j.node.x.length&&j.node.y.length){for(ie=0;ie0?" L "+j.targetX+" "+j.targetY:"")+"Z"):(U="M "+(j.targetX-$)+" "+(j.targetY-V)+" L "+(j.rightInnerExtent-$)+" "+(j.targetY-V)+" A "+(j.rightLargeArcRadius+V)+" "+(j.rightSmallArcRadius+V)+" 0 0 0 "+(j.rightFullExtent-V-$)+" "+(j.targetY+j.rightSmallArcRadius)+" L "+(j.rightFullExtent-V-$)+" "+j.verticalRightInnerExtent,q&&Y?U+=" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.rightInnerExtent-V-$)+" "+(j.verticalFullExtent+V)+" L "+(j.rightFullExtent+V-$-(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent+V)+" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.leftFullExtent+V)+" "+j.verticalLeftInnerExtent:q?U+=" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.rightFullExtent-$-V-(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" L "+(j.leftFullExtent+V+(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.leftFullExtent+V)+" "+j.verticalLeftInnerExtent:U+=" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.rightInnerExtent-$)+" "+(j.verticalFullExtent+V)+" L "+j.leftInnerExtent+" "+(j.verticalFullExtent+V)+" A "+(j.leftLargeArcRadius+V)+" "+(j.leftLargeArcRadius+V)+" 0 0 0 "+(j.leftFullExtent+V)+" "+j.verticalLeftInnerExtent,U+=" L "+(j.leftFullExtent+V)+" "+(j.sourceY+j.leftSmallArcRadius)+" A "+(j.leftLargeArcRadius+V)+" "+(j.leftSmallArcRadius+V)+" 0 0 0 "+j.leftInnerExtent+" "+(j.sourceY-V)+" L "+j.sourceX+" "+(j.sourceY-V)+" L "+j.sourceX+" "+(j.sourceY+V)+" L "+j.leftInnerExtent+" "+(j.sourceY+V)+" A "+(j.leftLargeArcRadius-V)+" "+(j.leftSmallArcRadius-V)+" 0 0 1 "+(j.leftFullExtent-V)+" "+(j.sourceY+j.leftSmallArcRadius)+" L "+(j.leftFullExtent-V)+" "+j.verticalLeftInnerExtent,q&&Y?U+=" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.leftFullExtent-V-(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" L "+(j.rightFullExtent+V-$+(j.rightLargeArcRadius-V))+" "+(j.verticalFullExtent-V)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.rightFullExtent+V-$)+" "+j.verticalRightInnerExtent:q?U+=" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.leftFullExtent+V)+" "+(j.verticalFullExtent+V)+" L "+(j.rightFullExtent-$-V)+" "+(j.verticalFullExtent+V)+" A "+(j.rightLargeArcRadius+V)+" "+(j.rightLargeArcRadius+V)+" 0 0 0 "+(j.rightFullExtent+V-$)+" "+j.verticalRightInnerExtent:U+=" A "+(j.leftLargeArcRadius-V)+" "+(j.leftLargeArcRadius-V)+" 0 0 1 "+j.leftInnerExtent+" "+(j.verticalFullExtent-V)+" L "+(j.rightInnerExtent-$)+" "+(j.verticalFullExtent-V)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightLargeArcRadius-V)+" 0 0 1 "+(j.rightFullExtent+V-$)+" "+j.verticalRightInnerExtent,U+=" L "+(j.rightFullExtent+V-$)+" "+(j.targetY+j.rightSmallArcRadius)+" A "+(j.rightLargeArcRadius-V)+" "+(j.rightSmallArcRadius-V)+" 0 0 1 "+(j.rightInnerExtent-$)+" "+(j.targetY+V)+" L "+(j.targetX-$)+" "+(j.targetY+V)+($>0?" L "+j.targetX+" "+j.targetY:"")+"Z"),U}function A(){var H=.5;function $(U){var V=U.linkArrowLength;if(U.link.circular)return k(U.link,V);var j=Math.abs((U.link.target.x0-U.link.source.x1)/2);V>j&&(V=j);var q=U.link.source.x1,Y=U.link.target.x0-V,K=i(q,Y),te=K(H),ne=K(1-H),se=U.link.y0-U.link.width/2,le=U.link.y0+U.link.width/2,ce=U.link.y1-U.link.width/2,pe=U.link.y1+U.link.width/2,xe="M"+q+","+se,ye="C"+te+","+se+" "+ne+","+ce+" "+Y+","+ce,fe="C"+ne+","+pe+" "+te+","+le+" "+q+","+le,ae=V>0?"L"+(Y+V)+","+(ce+U.link.width/2):"";return ae+="L"+Y+","+pe,xe+ye+ae+fe+"Z"}return $}function b(H,$){var U=l.nodePadAcross,V=H.nodePad/2;$.dx=$.x1-$.x0,$.dy=$.y1-$.y0;var j=$.dx,q=Math.max(.5,$.dy),Y="node_"+$.pointNumber;return $.group&&(Y=c.randstr()),$.trace=H.trace,$.curveNumber=H.trace.index,{index:$.pointNumber,key:Y,partOfGroup:$.partOfGroup||!1,group:$.group,traceId:H.key,trace:H.trace,node:$,nodePad:H.nodePad,nodeLineColor:H.nodeLineColor,nodeLineWidth:H.nodeLineWidth,textFont:H.textFont,size:H.horizontal?H.height:H.width,visibleWidth:Math.ceil(j),visibleHeight:q,zoneX:-U,zoneY:-V,zoneWidth:j+2*U,zoneHeight:q+2*V,labelY:H.horizontal?$.dy/2+1:$.dx/2+1,left:$.originalLayer===1,sizeAcross:H.width,forceLayouts:H.forceLayouts,horizontal:H.horizontal,reversed:H.reversed,rgb:n.rgb($.color),alpha:n.parse($.color).alpha,valueFormat:H.valueFormat,valueSuffix:H.valueSuffix,sankey:H.sankey,graph:H.graph,arrangement:H.arrangement,uniqueNodeLabelPathId:[H.guid,H.key,Y].join("_"),interactionState:H.interactionState,figure:H}}function E(H){H.attr("transform",function($){return f($.node.x0.toFixed(3),$.node.y0.toFixed(3))})}function T(H){H.call(E)}function F(H,$){H.call(T),$.attr("d",A())}function D(H){H.attr("width",function($){return $.node.x1-$.node.x0}).attr("height",function($){return $.visibleHeight})}function R(H){return H.link.width>1||H.linkLineWidth>0}function P(H){return H.horizontal?H.reversed?f(H.translateX+H.width,H.translateY)+"matrix(-1 0 0 1 0 0)":f(H.translateX,H.translateY)+"matrix(1 0 0 1 0 0)":H.reversed?f(H.translateX,H.translateY+H.height)+"matrix(0 -1 1 0 0 0)":f(H.translateX,H.translateY)+"matrix(0 1 1 0 0 0)"}function z(H,$,U){H.on(".basic",null).on("mouseover.basic",function(V){!V.interactionState.dragInProgress&&!V.partOfGroup&&(U.hover(this,V,$),V.interactionState.hovered=[this,V])}).on("mousemove.basic",function(V){!V.interactionState.dragInProgress&&!V.partOfGroup&&(U.follow(this,V),V.interactionState.hovered=[this,V])}).on("mouseout.basic",function(V){!V.interactionState.dragInProgress&&!V.partOfGroup&&(U.unhover(this,V,$),V.interactionState.hovered=!1)}).on("click.basic",function(V){V.interactionState.hovered&&(U.unhover(this,V,$),V.interactionState.hovered=!1),!V.interactionState.dragInProgress&&!V.partOfGroup&&U.select(this,V,$)})}function I(H,$,U,V){var j=a.behavior.drag().origin(function(q){return{x:q.node.x0+q.visibleWidth/2,y:q.node.y0+q.visibleHeight/2}}).on("dragstart",function(q){if(q.arrangement!=="fixed"&&(c.ensureSingle(V._fullLayout._infolayer,"g","dragcover",function(K){V._fullLayout._dragCover=K}),c.raiseToTop(this),q.interactionState.dragInProgress=q.node,X(q.node),q.interactionState.hovered&&(U.nodeEvents.unhover.apply(0,q.interactionState.hovered),q.interactionState.hovered=!1),q.arrangement==="snap")){var Y=q.traceId+"|"+q.key;q.forceLayouts[Y]?q.forceLayouts[Y].alpha(1):L(H,Y,q,V),B(H,$,q,Y,V)}}).on("drag",function(q){if(q.arrangement!=="fixed"){var Y=a.event.x,K=a.event.y;q.arrangement==="snap"?(q.node.x0=Y-q.visibleWidth/2,q.node.x1=Y+q.visibleWidth/2,q.node.y0=K-q.visibleHeight/2,q.node.y1=K+q.visibleHeight/2):(q.arrangement==="freeform"&&(q.node.x0=Y-q.visibleWidth/2,q.node.x1=Y+q.visibleWidth/2),K=Math.max(0,Math.min(q.size-q.visibleHeight/2,K)),q.node.y0=K-q.visibleHeight/2,q.node.y1=K+q.visibleHeight/2),X(q.node),q.arrangement!=="snap"&&(q.sankey.update(q.graph),F(H.filter(Z(q)),$))}}).on("dragend",function(q){if(q.arrangement!=="fixed"){q.interactionState.dragInProgress=!1;for(var Y=0;Y0)window.requestAnimationFrame(q);else{var te=U.node.originalX;U.node.x0=te-U.visibleWidth/2,U.node.x1=te+U.visibleWidth/2,G(U,j)}})}function O(H,$,U,V){return function(){for(var q=0,Y=0;Y0&&V.forceLayouts[$].alpha(0)}}function G(H,$){for(var U=[],V=[],j=0;jR(fe)?n.rgb(fe.linkLineColor):fe.rgb).style("stroke-opacity",fe=>R(fe)?n.opacity(fe.linkLineColor):fe.alpha).style("fill",fe=>fe.rgb).style("fill-opacity",fe=>fe.alpha).style("stroke-width",fe=>R(fe)?fe.linkLineWidth:1).attr("d",A()),le.style("opacity",function(){return H._context.staticPlot||Y||K?1:0}).transition().ease(l.ease).duration(l.duration).style("opacity",1),le.exit().transition().ease(l.ease).duration(l.duration).style("opacity",0).remove();var ce=ne.selectAll("."+l.cn.sankeyNodeSet).data(g,p);ce.enter().append("g").classed(l.cn.sankeyNodeSet,!0),ce.style("cursor",function(fe){switch(fe.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var pe=ce.selectAll("."+l.cn.sankeyNode).data(function(fe){var ae=fe.graph.nodes;return W(ae),ae.map(b.bind(null,fe))},p);pe.enter().append("g").classed(l.cn.sankeyNode,!0).call(E).style("opacity",function(fe){return(H._context.staticPlot||Y)&&!fe.partOfGroup?1:0}),pe.call(z,ne,j.nodeEvents).call(I,le,j,H),pe.transition().ease(l.ease).duration(l.duration).call(E).style("opacity",function(fe){return fe.partOfGroup?0:1}),pe.exit().transition().ease(l.ease).duration(l.duration).style("opacity",0).remove();var xe=pe.selectAll("."+l.cn.nodeRect).data(g);xe.enter().append("rect").classed(l.cn.nodeRect,!0).call(D),xe.style("stroke-width",function(fe){return fe.nodeLineWidth}).style("stroke",function(fe){return n.rgb(fe.nodeLineColor)}).style("stroke-opacity",function(fe){return n.opacity(fe.nodeLineColor)}).style("fill",fe=>fe.rgb).style("fill-opacity",fe=>fe.alpha),xe.transition().ease(l.ease).duration(l.duration).call(D);var ye=pe.selectAll("."+l.cn.nodeLabel).data(g);ye.enter().append("text").classed(l.cn.nodeLabel,!0).style("cursor","default"),ye.attr("data-notex",1).text(function(fe){return fe.node.label}).each(function(fe){var ae=a.select(this);u.font(ae,fe.textFont),y.convertToTspans(ae,H)}).attr("text-anchor",function(fe){return fe.horizontal&&fe.left!==fe.reversed?"end":"start"}).attr("transform",function(fe){var ae=a.select(this),ee=y.lineCount(ae),ie=fe.textFont.size*((ee-1)*S-x),Q=fe.nodeLineWidth/2+M;if(!fe.horizontal){var Me=fe.reversed?(fe.visibleWidth+ie)/2:(fe.visibleWidth-ie)/2,ue=fe.reversed?h(90):"scale(-1,1)"+h(90);return f(Me,Q)+ue}var ge=Q,Me=(fe.visibleHeight-ie)/2;return fe.left?ge=-ge:ge+=fe.visibleWidth,f(ge,Me)+(fe.reversed?"scale(-1,1)":"")}),ye.transition().ease(l.ease).duration(l.duration)}}}),G8=de({"src/traces/sankey/plot.js"(e,r){"use strict";var t=Yr(),i=Qt(),a=i.numberFormat,o=yle(),s=$s(),l=ta(),n=V8().cn,u=i._;function c(S){return S!==""}function f(S,M){return S.filter(function(C){return C.key===M.traceId})}function h(S,M){t.select(S).select("path").style("fill-opacity",M),t.select(S).select("rect").style("fill-opacity",M)}function d(S){t.select(S).select("text.name").style("fill","black")}function p(S){return function(M){return S.node.sourceLinks.indexOf(M.link)!==-1||S.node.targetLinks.indexOf(M.link)!==-1}}function g(S){return function(M){return M.node.sourceLinks.indexOf(S.link)!==-1||M.node.targetLinks.indexOf(S.link)!==-1}}function m(S,M,C){M&&C&&f(C,M).selectAll("."+n.sankeyLink).filter(p(M)).call(_.bind(0,M,C,!1))}function y(S,M,C){M&&C&&f(C,M).selectAll("."+n.sankeyLink).filter(p(M)).call(v.bind(0,M,C,!1))}function _(S,M,C,w){w.style("fill",function(k){if(!k.link.concentrationscale)return k.hoverRgb}).style("fill-opacity",function(k){if(!k.link.concentrationscale)return k.hoverAlpha}),w.each(function(k){var A=k.link.label;A!==""&&f(M,S).selectAll("."+n.sankeyLink).filter(function(b){return b.link.label===A}).style("fill",function(b){if(!b.link.concentrationscale)return b.hoverRgb}).style("fill-opacity",function(b){if(!b.link.concentrationscale)return b.hoverAlpha})}),C&&f(M,S).selectAll("."+n.sankeyNode).filter(g(S)).call(m)}function v(S,M,C,w){w.style("fill",function(k){return k.rgb}).style("fill-opacity",function(k){return k.alpha}),w.each(function(k){var A=k.link.label;A!==""&&f(M,S).selectAll("."+n.sankeyLink).filter(function(b){return b.link.label===A}).style("fill",b=>b.rgb).style("fill-opacity",b=>b.alpha)}),C&&f(M,S).selectAll(n.sankeyNode).filter(g(S)).call(y)}function x(S,M){var C=S.hoverlabel||{},w=i.nestedProperty(C,M).get();return Array.isArray(w)?!1:w}r.exports=function(M,C){for(var w=M._fullLayout,k=w._paper,A=w._size,b=0;b"),color:x(N,"bgcolor")||l.addOpacity(j.color,1),borderColor:x(N,"bordercolor"),fontFamily:x(N,"font.family"),fontSize:x(N,"font.size"),fontColor:x(N,"font.color"),fontWeight:x(N,"font.weight"),fontStyle:x(N,"font.style"),fontVariant:x(N,"font.variant"),fontTextcase:x(N,"font.textcase"),fontLineposition:x(N,"font.lineposition"),fontShadow:x(N,"font.shadow"),nameLength:x(N,"namelength"),textAlign:x(N,"align"),idealAlign:t.event.x"),color:x(N,"bgcolor")||J.rgb,borderColor:x(N,"bordercolor"),fontFamily:x(N,"font.family"),fontSize:x(N,"font.size"),fontColor:x(N,"font.color"),fontWeight:x(N,"font.weight"),fontStyle:x(N,"font.style"),fontVariant:x(N,"font.variant"),fontTextcase:x(N,"font.textcase"),fontLineposition:x(N,"font.lineposition"),fontShadow:x(N,"font.shadow"),nameLength:x(N,"namelength"),textAlign:x(N,"align"),idealAlign:"left",hovertemplate:N.hovertemplate,hovertemplateLabels:Y,eventData:[J.node]},{container:w._hoverlayer.node(),outerContainer:w._paper.node(),gd:M});h(ne,.85),d(ne)}}},X=function(Z,J,N){M._fullLayout.hovermode!==!1&&(t.select(Z).call(y,J,N),J.node.trace.node.hoverinfo!=="skip"&&(J.node.fullData=J.node.trace,M.emit("plotly_unhover",{event:t.event,points:[J.node]})),s.loneUnhover(w._hoverlayer.node()))};o(M,k,C,{width:A.w,height:A.h,margin:{t:A.t,r:A.r,b:A.b,l:A.l}},{linkEvents:{hover:F,follow:L,unhover:B,select:T},nodeEvents:{hover:G,follow:W,unhover:X,select:O}})}}}),_le=de({"src/traces/sankey/base_plot.js"(e){"use strict";var r=Ps().overrideAll,t=$u().getModuleCalcData,i=G8(),a=La(),o=md(),s=Uc(),l=Zl().prepSelect,n=Qt(),u=Ma(),c="sankey";e.name=c,e.baseLayoutAttrOverrides=r({hoverlabel:a.hoverlabel},"plot","nested"),e.plot=function(h){var d=t(h.calcdata,c)[0];i(h,d),e.updateFx(h)},e.clean=function(h,d,p,g){var m=g._has&&g._has(c),y=d._has&&d._has(c);m&&!y&&(g._paperdiv.selectAll(".sankey").remove(),g._paperdiv.selectAll(".bgsankey").remove())},e.updateFx=function(h){for(var d=0;d0}r.exports=function(P,z,I,L){var B=P._fullLayout,O;S(I)&&L&&(O=L()),o.makeTraceGroups(B._indicatorlayer,z,"trace").each(function(G){var W=G[0],X=W.trace,Z=t.select(this),J=X._hasGauge,N=X._isAngular,H=X._isBullet,$=X.domain,U={w:B._size.w*($.x[1]-$.x[0]),h:B._size.h*($.y[1]-$.y[0]),l:B._size.l+B._size.w*$.x[0],r:B._size.r+B._size.w*(1-$.x[1]),t:B._size.t+B._size.h*(1-$.y[1]),b:B._size.b+B._size.h*$.y[0]},V=U.l+U.w/2,j=U.t+U.h/2,q=Math.min(U.w/2,U.h),Y=f.innerRadius*q,K,te,ne,se=X.align||"center";if(te=j,!J)K=U.l+v[se]*U.w,ne=function(Q){return E(Q,U.w,U.h)};else if(N&&(K=V,te=j+q/2,ne=function(Q){return T(Q,.9*Y)}),H){var le=f.bulletPadding,ce=1-f.bulletNumberDomainSize+le;K=U.l+(ce+(1-ce)*v[se])*U.w,ne=function(Q){return E(Q,(f.bulletNumberDomainSize-le)*U.w,U.h)}}w(P,Z,G,{numbersX:K,numbersY:te,numbersScaler:ne,transitionOpts:I,onComplete:O});var pe,xe;J&&(pe={range:X.gauge.axis.range,color:X.gauge.bgcolor,line:{color:X.gauge.bordercolor,width:0},thickness:1},xe={range:X.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:X.gauge.bordercolor,width:X.gauge.borderwidth},thickness:1});var ye=Z.selectAll("g.angular").data(N?G:[]);ye.exit().remove();var fe=Z.selectAll("g.angularaxis").data(N?G:[]);fe.exit().remove(),N&&C(P,Z,G,{radius:q,innerRadius:Y,gauge:ye,layer:fe,size:U,gaugeBg:pe,gaugeOutline:xe,transitionOpts:I,onComplete:O});var ae=Z.selectAll("g.bullet").data(H?G:[]);ae.exit().remove();var ee=Z.selectAll("g.bulletaxis").data(H?G:[]);ee.exit().remove(),H&&M(P,Z,G,{gauge:ae,layer:ee,size:U,gaugeBg:pe,gaugeOutline:xe,transitionOpts:I,onComplete:O});var ie=Z.selectAll("text.title").data(G);ie.exit().remove(),ie.enter().append("text").classed("title",!0),ie.attr("text-anchor",function(){return H?_.right:_[X.title.align]}).text(X.title.text).call(c.font,X.title.font).call(h.convertToTspans,P),ie.attr("transform",function(){var Q=U.l+U.w*v[X.title.align],ue,ge=f.titlePadding,Me=c.bBox(ie.node());if(J){if(N)if(X.gauge.axis.visible){var Te=c.bBox(fe.node());ue=Te.top-ge-Me.bottom}else ue=U.t+U.h/2-q/2-Me.bottom-ge;H&&(ue=te-(Me.top+Me.bottom)/2,Q=U.l-f.bulletPadding*U.w)}else ue=X._numbersTop-ge-Me.bottom;return l(Q,ue)})})};function M(R,P,z,I){var L=z[0].trace,B=I.gauge,O=I.layer,G=I.gaugeBg,W=I.gaugeOutline,X=I.size,Z=L.domain,J=I.transitionOpts,N=I.onComplete,H,$,U,V,j;B.enter().append("g").classed("bullet",!0),B.attr("transform",l(X.l,X.t)),O.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),O.selectAll("g.xbulletaxistick,path,text").remove();var q=X.h,Y=L.gauge.bar.thickness*q,K=Z.x[0],te=Z.x[0]+(Z.x[1]-Z.x[0])*(L._hasNumber||L._hasDelta?1-f.bulletNumberDomainSize:1);H=b(R,L.gauge.axis),H._id="xbulletaxis",H.domain=[K,te],H.setScale(),$=d.calcTicks(H),U=d.makeTransTickFn(H),V=d.getTickSigns(H)[2],j=X.t+X.h,H.visible&&(d.drawTicks(R,H,{vals:H.ticks==="inside"?d.clipEnds(H,$):$,layer:O,path:d.makeTickPath(H,j,V),transFn:U}),d.drawLabels(R,H,{vals:$,layer:O,transFn:U,labelFns:d.makeLabelFns(H,j)}));function ne(fe){fe.attr("width",function(ae){return Math.max(0,H.c2p(ae.range[1])-H.c2p(ae.range[0]))}).attr("x",function(ae){return H.c2p(ae.range[0])}).attr("y",function(ae){return .5*(1-ae.thickness)*q}).attr("height",function(ae){return ae.thickness*q})}var se=[G].concat(L.gauge.steps),le=B.selectAll("g.bg-bullet").data(se);le.enter().append("g").classed("bg-bullet",!0).append("rect"),le.select("rect").call(ne).call(k),le.exit().remove();var ce=B.selectAll("g.value-bullet").data([L.gauge.bar]);ce.enter().append("g").classed("value-bullet",!0).append("rect"),ce.select("rect").attr("height",Y).attr("y",(q-Y)/2).call(k),S(J)?ce.select("rect").transition().duration(J.duration).ease(J.easing).each("end",function(){N&&N()}).each("interrupt",function(){N&&N()}).attr("width",Math.max(0,H.c2p(Math.min(L.gauge.axis.range[1],z[0].y)))):ce.select("rect").attr("width",typeof z[0].y=="number"?Math.max(0,H.c2p(Math.min(L.gauge.axis.range[1],z[0].y))):0),ce.exit().remove();var pe=z.filter(function(){return L.gauge.threshold.value||L.gauge.threshold.value===0}),xe=B.selectAll("g.threshold-bullet").data(pe);xe.enter().append("g").classed("threshold-bullet",!0).append("line"),xe.select("line").attr("x1",H.c2p(L.gauge.threshold.value)).attr("x2",H.c2p(L.gauge.threshold.value)).attr("y1",(1-L.gauge.threshold.thickness)/2*q).attr("y2",(1-(1-L.gauge.threshold.thickness)/2)*q).call(y.stroke,L.gauge.threshold.line.color).style("stroke-width",L.gauge.threshold.line.width),xe.exit().remove();var ye=B.selectAll("g.gauge-outline").data([W]);ye.enter().append("g").classed("gauge-outline",!0).append("rect"),ye.select("rect").call(ne).call(k),ye.exit().remove()}function C(R,P,z,I){var L=z[0].trace,B=I.size,O=I.radius,G=I.innerRadius,W=I.gaugeBg,X=I.gaugeOutline,Z=[B.l+B.w/2,B.t+B.h/2+O/2],J=I.gauge,N=I.layer,H=I.transitionOpts,$=I.onComplete,U=Math.PI/2;function V(je){var Ve=L.gauge.axis.range[0],Ze=L.gauge.axis.range[1],Ke=(je-Ve)/(Ze-Ve)*Math.PI-U;return Ke<-U?-U:Ke>U?U:Ke}function j(je){return t.svg.arc().innerRadius((G+O)/2-je/2*(O-G)).outerRadius((G+O)/2+je/2*(O-G)).startAngle(-U)}function q(je){je.attr("d",function(Ve){return j(Ve.thickness).startAngle(V(Ve.range[0])).endAngle(V(Ve.range[1]))()})}var Y,K,te,ne;J.enter().append("g").classed("angular",!0),J.attr("transform",l(Z[0],Z[1])),N.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),N.selectAll("g.xangularaxistick,path,text").remove(),Y=b(R,L.gauge.axis),Y.type="linear",Y.range=L.gauge.axis.range,Y._id="xangularaxis",Y.ticklabeloverflow="allow",Y.setScale();var se=function(je){return(Y.range[0]-je.x)/(Y.range[1]-Y.range[0])*Math.PI+Math.PI},le={},ce=d.makeLabelFns(Y,0),pe=ce.labelStandoff;le.xFn=function(je){var Ve=se(je);return Math.cos(Ve)*pe},le.yFn=function(je){var Ve=se(je),Ze=Math.sin(Ve)>0?.2:1;return-Math.sin(Ve)*(pe+je.fontSize*Ze)+Math.abs(Math.cos(Ve))*(je.fontSize*u)},le.anchorFn=function(je){var Ve=se(je),Ze=Math.cos(Ve);return Math.abs(Ze)<.1?"middle":Ze>0?"start":"end"},le.heightFn=function(je,Ve,Ze){var Ke=se(je);return-.5*(1+Math.sin(Ke))*Ze};var xe=function(je){return l(Z[0]+O*Math.cos(je),Z[1]-O*Math.sin(je))};te=function(je){return xe(se(je))};var ye=function(je){var Ve=se(je);return xe(Ve)+"rotate("+-n(Ve)+")"};if(K=d.calcTicks(Y),ne=d.getTickSigns(Y)[2],Y.visible){ne=Y.ticks==="inside"?-1:1;var fe=(Y.linewidth||1)/2;d.drawTicks(R,Y,{vals:K,layer:N,path:"M"+ne*fe+",0h"+ne*Y.ticklen,transFn:ye}),d.drawLabels(R,Y,{vals:K,layer:N,transFn:te,labelFns:le})}var ae=[W].concat(L.gauge.steps),ee=J.selectAll("g.bg-arc").data(ae);ee.enter().append("g").classed("bg-arc",!0).append("path"),ee.select("path").call(q).call(k),ee.exit().remove();var ie=j(L.gauge.bar.thickness),Q=J.selectAll("g.value-arc").data([L.gauge.bar]);Q.enter().append("g").classed("value-arc",!0).append("path");var ue=Q.select("path");S(H)?(ue.transition().duration(H.duration).ease(H.easing).each("end",function(){$&&$()}).each("interrupt",function(){$&&$()}).attrTween("d",A(ie,V(z[0].lastY),V(z[0].y))),L._lastValue=z[0].y):ue.attr("d",typeof z[0].y=="number"?ie.endAngle(V(z[0].y)):"M0,0Z"),ue.call(k),Q.exit().remove(),ae=[];var ge=L.gauge.threshold.value;(ge||ge===0)&&ae.push({range:[ge,ge],color:L.gauge.threshold.color,line:{color:L.gauge.threshold.line.color,width:L.gauge.threshold.line.width},thickness:L.gauge.threshold.thickness});var Me=J.selectAll("g.threshold-arc").data(ae);Me.enter().append("g").classed("threshold-arc",!0).append("path"),Me.select("path").call(q).call(k),Me.exit().remove();var Te=J.selectAll("g.gauge-outline").data([X]);Te.enter().append("g").classed("gauge-outline",!0).append("path"),Te.select("path").call(q).call(k),Te.exit().remove()}function w(R,P,z,I){var L=z[0].trace,B=I.numbersX,O=I.numbersY,G=L.align||"center",W=_[G],X=I.transitionOpts,Z=I.onComplete,J=o.ensureSingle(P,"g","numbers"),N,H,$,U=[];L._hasNumber&&U.push("number"),L._hasDelta&&(U.push("delta"),L.delta.position==="left"&&U.reverse());var V=J.selectAll("text").data(U);V.enter().append("text"),V.attr("text-anchor",function(){return W}).attr("class",function(xe){return xe}).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),V.exit().remove();function j(xe,ye,fe,ae){if(xe.match("s")&&fe>=0!=ae>=0&&!ye(fe).slice(-1).match(x)&&!ye(ae).slice(-1).match(x)){var ee=xe.slice().replace("s","f").replace(/\d+/,function(Q){return parseInt(Q)-1}),ie=b(R,{tickformat:ee});return function(Q){return Math.abs(Q)<1?d.tickText(ie,Q).text:ye(Q)}}else return ye}function q(){var xe=b(R,{tickformat:L.number.valueformat},L._range);xe.setScale(),d.prepTicks(xe);var ye=function(Q){return d.tickText(xe,Q).text},fe=L.number.suffix,ae=L.number.prefix,ee=J.select("text.number");function ie(){var Q=typeof z[0].y=="number"?ae+ye(z[0].y)+fe:"-";ee.text(Q).call(c.font,L.number.font).call(h.convertToTspans,R)}return S(X)?ee.transition().duration(X.duration).ease(X.easing).each("end",function(){ie(),Z&&Z()}).each("interrupt",function(){ie(),Z&&Z()}).attrTween("text",function(){var Q=t.select(this),ue=a(z[0].lastY,z[0].y);L._lastValue=z[0].y;var ge=j(L.number.valueformat,ye,z[0].lastY,z[0].y);return function(Me){Q.text(ae+ge(ue(Me))+fe)}}):ie(),N=F(ae+ye(z[0].y)+fe,L.number.font,W,R),ee}function Y(){var xe=b(R,{tickformat:L.delta.valueformat},L._range);xe.setScale(),d.prepTicks(xe);var ye=function(Me){return d.tickText(xe,Me).text},fe=L.delta.suffix,ae=L.delta.prefix,ee=function(Me){var Te=L.delta.relative?Me.relativeDelta:Me.delta;return Te},ie=function(Me,Te){return Me===0||typeof Me!="number"||isNaN(Me)?"-":(Me>0?L.delta.increasing.symbol:L.delta.decreasing.symbol)+ae+Te(Me)+fe},Q=function(Me){return Me.delta>=0?L.delta.increasing.color:L.delta.decreasing.color};L._deltaLastValue===void 0&&(L._deltaLastValue=ee(z[0]));var ue=J.select("text.delta");ue.call(c.font,L.delta.font).call(y.fill,Q({delta:L._deltaLastValue}));function ge(){ue.text(ie(ee(z[0]),ye)).call(y.fill,Q(z[0])).call(h.convertToTspans,R)}return S(X)?ue.transition().duration(X.duration).ease(X.easing).tween("text",function(){var Me=t.select(this),Te=ee(z[0]),je=L._deltaLastValue,Ve=j(L.delta.valueformat,ye,je,Te),Ze=a(je,Te);return L._deltaLastValue=Te,function(Ke){Me.text(ie(Ze(Ke),Ve)),Me.call(y.fill,Q({delta:Ze(Ke)}))}}).each("end",function(){ge(),Z&&Z()}).each("interrupt",function(){ge(),Z&&Z()}):ge(),H=F(ie(ee(z[0]),ye),L.delta.font,W,R),ue}var K=L.mode+L.align,te;if(L._hasDelta&&(te=Y(),K+=L.delta.position+L.delta.font.size+L.delta.font.family+L.delta.valueformat,K+=L.delta.increasing.symbol+L.delta.decreasing.symbol,$=H),L._hasNumber&&(q(),K+=L.number.font.size+L.number.font.family+L.number.valueformat+L.number.suffix+L.number.prefix,$=N),L._hasDelta&&L._hasNumber){var ne=[(N.left+N.right)/2,(N.top+N.bottom)/2],se=[(H.left+H.right)/2,(H.top+H.bottom)/2],le,ce,pe=.75*L.delta.font.size;L.delta.position==="left"&&(le=D(L,"deltaPos",0,-1*(N.width*v[L.align]+H.width*(1-v[L.align])+pe),K,Math.min),ce=ne[1]-se[1],$={width:N.width+H.width+pe,height:Math.max(N.height,H.height),left:H.left+le,right:N.right,top:Math.min(N.top,H.top+ce),bottom:Math.max(N.bottom,H.bottom+ce)}),L.delta.position==="right"&&(le=D(L,"deltaPos",0,N.width*(1-v[L.align])+H.width*v[L.align]+pe,K,Math.max),ce=ne[1]-se[1],$={width:N.width+H.width+pe,height:Math.max(N.height,H.height),left:N.left,right:H.right+le,top:Math.min(N.top,H.top+ce),bottom:Math.max(N.bottom,H.bottom+ce)}),L.delta.position==="bottom"&&(le=null,ce=H.height,$={width:Math.max(N.width,H.width),height:N.height+H.height,left:Math.min(N.left,H.left),right:Math.max(N.right,H.right),top:N.bottom-N.height,bottom:N.bottom+H.height}),L.delta.position==="top"&&(le=null,ce=N.top,$={width:Math.max(N.width,H.width),height:N.height+H.height,left:Math.min(N.left,H.left),right:Math.max(N.right,H.right),top:N.bottom-N.height-H.height,bottom:N.bottom}),te.attr({dx:le,dy:ce})}(L._hasNumber||L._hasDelta)&&J.attr("transform",function(){var xe=I.numbersScaler($);K+=xe[2];var ye=D(L,"numbersScale",1,xe[0],K,Math.min),fe;L._scaleNumbers||(ye=1),L._isAngular?fe=O-ye*$.bottom:fe=O-ye*($.top+$.bottom)/2,L._numbersTop=ye*$.top+fe;var ae=$[G];G==="center"&&(ae=($.left+$.right)/2);var ee=B-ye*ae;return ee=D(L,"numbersTranslate",0,ee,K,Math.max),l(ee,fe)+s(ye)})}function k(R){R.each(function(P){y.stroke(t.select(this),P.line.color)}).each(function(P){y.fill(t.select(this),P.color)}).style("stroke-width",function(P){return P.line.width})}function A(R,P,z){return function(){var I=i(P,z);return function(L){return R.endAngle(I(L))()}}}function b(R,P,z){var I=R._fullLayout,L=o.extendFlat({type:"linear",ticks:"outside",range:z,showline:!0},P),B={type:"linear",_id:"x"+P._id},O={letter:"x",font:I.font,noAutotickangles:!0,noHover:!0,noTickson:!0};function G(W,X){return o.coerce(L,B,m,W,X)}return p(L,B,G,O,I),g(L,B,G,O),B}function E(R,P,z){var I=Math.min(P/R.width,z/R.height);return[I,R,P+"x"+z]}function T(R,P){var z=Math.sqrt(R.width/2*(R.width/2)+R.height*R.height),I=P/z;return[I,R,P]}function F(R,P,z,I){var L=document.createElementNS("http://www.w3.org/2000/svg","text"),B=t.select(L);return B.text(R).attr("x",0).attr("y",0).attr("text-anchor",z).attr("data-unformatted",R).call(h.convertToTspans,I).call(c.font,P),c.bBox(B.node())}function D(R,P,z,I,L,B){var O="_cache"+P;R[O]&&R[O].key===L||(R[O]={key:L,value:z});var G=o.aggNums(B,null,[R[O].value,I],2);return R[O].value=G,G}}}),Ele=de({"src/traces/indicator/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"indicator",basePlotModule:Tle(),categories:["svg","noOpacity","noHover"],animatable:!0,attributes:H8(),supplyDefaults:Ale().supplyDefaults,calc:Mle().calc,plot:Sle(),meta:{}}}}),kle=de({"lib/indicator.js"(e,r){"use strict";r.exports=Ele()}}),W8=de({"src/traces/table/attributes.js"(e,r){"use strict";var t=g0(),i=fn().extendFlat,a=Ps().overrideAll,o=us(),s=Is().attributes,l=Ns().descriptionOnlyNumbers,n=r.exports=a({domain:s({name:"table",trace:!0}),columnwidth:{valType:"number",arrayOk:!0,dflt:null},columnorder:{valType:"data_array"},header:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:28},align:i({},t.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:i({},o({arrayOk:!0}))},cells:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:20},align:i({},t.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:i({},o({arrayOk:!0}))}},"calc","from-root")}}),Cle=de({"src/traces/table/defaults.js"(e,r){"use strict";var t=Qt(),i=W8(),a=Is().defaults;function o(s,l){for(var n=s.columnorder||[],u=s.header.values.length,c=n.slice(0,u),f=c.slice().sort(function(p,g){return p-g}),h=c.map(function(p){return f.indexOf(p)}),d=h.length;d",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}}}),Lle=de({"src/traces/table/data_preparation_helper.js"(e,r){"use strict";var t=Y8(),i=fn().extendFlat,a=da(),o=Do().isTypedArray,s=Do().isArrayOrTypedArray;r.exports=function(m,y){var _=u(y.cells.values),v=function(W){return W.slice(y.header.values.length,W.length)},x=u(y.header.values);x.length&&!x[0].length&&(x[0]=[""],x=u(x));var S=x.concat(v(_).map(function(){return c((x[0]||[""]).length)})),M=y.domain,C=Math.floor(m._fullLayout._size.w*(M.x[1]-M.x[0])),w=Math.floor(m._fullLayout._size.h*(M.y[1]-M.y[0])),k=y.header.values.length?S[0].map(function(){return y.header.height}):[t.emptyHeaderHeight],A=_.length?_[0].map(function(){return y.cells.height}):[],b=k.reduce(n,0),E=w-b,T=E+t.uplift,F=d(A,T),D=d(k,b),R=h(D,[]),P=h(F,R),z={},I=y.columnorder;s(I)&&(I=Array.from(I)),I=I.concat(v(_.map(function(W,X){return X})));var L=S.map(function(W,X){var Z=s(y.columnwidth)?y.columnwidth[Math.min(X,y.columnwidth.length-1)]:y.columnwidth;return a(Z)?Number(Z):1}),B=L.reduce(n,0);L=L.map(function(W){return W/B*C});var O=Math.max(l(y.header.line.width),l(y.cells.line.width)),G={key:y.uid+m._context.staticPlot,translateX:M.x[0]*m._fullLayout._size.w,translateY:m._fullLayout._size.h*(1-M.y[1]),size:m._fullLayout._size,width:C,maxLineWidth:O,height:w,columnOrder:I,groupHeight:w,rowBlocks:P,headerRowBlocks:R,scrollY:0,cells:i({},y.cells,{values:_}),headerCells:i({},y.header,{values:S}),gdColumns:S.map(function(W){return W[0]}),gdColumnsOriginalOrder:S.map(function(W){return W[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:S.map(function(W,X){var Z=z[W];z[W]=(Z||0)+1;var J=W+"__"+z[W];return{key:J,label:W,specIndex:X,xIndex:I[X],xScale:f,x:void 0,calcdata:void 0,columnWidth:L[X]}})};return G.columns.forEach(function(W){W.calcdata=G,W.x=f(W)}),G};function l(g){if(s(g)){for(var m=0,y=0;y=m||w===g.length-1)&&(y[v]=S,S.key=C++,S.firstRowIndex=M,S.lastRowIndex=w,S=p(),v+=x,M=w+1,x=0);return y}function p(){return{firstRowIndex:null,lastRowIndex:null,rows:[]}}}}),Fle=de({"src/traces/table/data_split_helpers.js"(e){"use strict";var r=fn().extendFlat;e.splitToPanels=function(i){var a=[0,0],o=r({},i,{key:"header",type:"header",page:0,prevPages:a,currentRepaint:[null,null],dragHandle:!0,values:i.calcdata.headerCells.values[i.specIndex],rowBlocks:i.calcdata.headerRowBlocks,calcdata:r({},i.calcdata,{cells:i.calcdata.headerCells})}),s=r({},i,{key:"cells1",type:"cells",page:0,prevPages:a,currentRepaint:[null,null],dragHandle:!1,values:i.calcdata.cells.values[i.specIndex],rowBlocks:i.calcdata.rowBlocks}),l=r({},i,{key:"cells2",type:"cells",page:1,prevPages:a,currentRepaint:[null,null],dragHandle:!1,values:i.calcdata.cells.values[i.specIndex],rowBlocks:i.calcdata.rowBlocks});return[s,l,o]},e.splitToCells=function(i){var a=t(i);return(i.values||[]).slice(a[0],a[1]).map(function(o,s){var l=typeof o=="string"&&o.match(/[<$&> ]/)?"_keybuster_"+Math.random():"";return{keyWithinBlock:s+l,key:a[0]+s,column:i,calcdata:i.calcdata,page:i.page,rowBlocks:i.rowBlocks,value:o}})};function t(i){var a=i.rowBlocks[i.page],o=a?a.rows[0].rowIndex:0,s=a?o+a.rows.length:0;return[o,s]}}}),X8=de({"src/traces/table/plot.js"(e,r){"use strict";var t=Y8(),i=Yr(),a=Qt(),o=a.numberFormat,s=ip(),l=hn(),n=Zo(),u=Qt().raiseToTop,c=Qt().strTranslate,f=Qt().cancelTransition,h=Lle(),d=Fle(),p=ta();r.exports=function(K,te){var ne=!K._context.staticPlot,se=K._fullLayout._paper.selectAll("."+t.cn.table).data(te.map(function(Te){var je=s.unwrap(Te),Ve=je.trace;return h(K,Ve)}),s.keyFun);se.exit().remove(),se.enter().append("g").classed(t.cn.table,!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","all"),se.attr("width",function(Te){return Te.width+Te.size.l+Te.size.r}).attr("height",function(Te){return Te.height+Te.size.t+Te.size.b}).attr("transform",function(Te){return c(Te.translateX,Te.translateY)});var le=se.selectAll("."+t.cn.tableControlView).data(s.repeat,s.keyFun),ce=le.enter().append("g").classed(t.cn.tableControlView,!0).style("box-sizing","content-box");if(ne){var pe="onwheel"in document?"wheel":"mousewheel";ce.on("mousemove",function(Te){le.filter(function(je){return Te===je}).call(v,K)}).on(pe,function(Te){if(!Te.scrollbarState.wheeling){Te.scrollbarState.wheeling=!0;var je=Te.scrollY+i.event.deltaY,Ve=W(K,le,null,je)(Te);Ve||(i.event.stopPropagation(),i.event.preventDefault()),Te.scrollbarState.wheeling=!1}}).call(v,K,!0)}le.attr("transform",function(Te){return c(Te.size.l,Te.size.t)});var xe=le.selectAll("."+t.cn.scrollBackground).data(s.repeat,s.keyFun);xe.enter().append("rect").classed(t.cn.scrollBackground,!0).attr("fill","none"),xe.attr("width",function(Te){return Te.width}).attr("height",function(Te){return Te.height}),le.each(function(Te){l.setClipUrl(i.select(this),m(K,Te),K)});var ye=le.selectAll("."+t.cn.yColumn).data(function(Te){return Te.columns},s.keyFun);ye.enter().append("g").classed(t.cn.yColumn,!0),ye.exit().remove(),ye.attr("transform",function(Te){return c(Te.x,0)}),ne&&ye.call(i.behavior.drag().origin(function(Te){var je=i.select(this);return z(je,Te,-t.uplift),u(this),Te.calcdata.columnDragInProgress=!0,v(le.filter(function(Ve){return Te.calcdata.key===Ve.key}),K),Te}).on("drag",function(Te){var je=i.select(this),Ve=function(vt){return(Te===vt?i.event.x:vt.x)+vt.columnWidth/2};Te.x=Math.max(-t.overdrag,Math.min(Te.calcdata.width+t.overdrag-Te.columnWidth,i.event.x));var Ze=_(ye).filter(function(vt){return vt.calcdata.key===Te.calcdata.key}),Ke=Ze.sort(function(vt,xt){return Ve(vt)-Ve(xt)});Ke.forEach(function(vt,xt){vt.xIndex=xt,vt.x=Te===vt?vt.x:vt.xScale(vt)}),ye.filter(function(vt){return Te!==vt}).transition().ease(t.transitionEase).duration(t.transitionDuration).attr("transform",function(vt){return c(vt.x,0)}),je.call(f).attr("transform",c(Te.x,-t.uplift))}).on("dragend",function(Te){var je=i.select(this),Ve=Te.calcdata;Te.x=Te.xScale(Te),Te.calcdata.columnDragInProgress=!1,z(je,Te,0),R(K,Ve,Ve.columns.map(function(Ze){return Ze.xIndex}))})),ye.each(function(Te){l.setClipUrl(i.select(this),y(K,Te),K)});var fe=ye.selectAll("."+t.cn.columnBlock).data(d.splitToPanels,s.keyFun);fe.enter().append("g").classed(t.cn.columnBlock,!0).attr("id",function(Te){return Te.key}),fe.style("cursor",function(Te){return Te.dragHandle?"ew-resize":Te.calcdata.scrollbarState.barWiggleRoom?"ns-resize":"default"});var ae=fe.filter(L),ee=fe.filter(I);ne&&ee.call(i.behavior.drag().origin(function(Te){return i.event.stopPropagation(),Te}).on("drag",W(K,le,-1)).on("dragend",function(){})),x(K,le,ae,fe),x(K,le,ee,fe);var ie=le.selectAll("."+t.cn.scrollAreaClip).data(s.repeat,s.keyFun);ie.enter().append("clipPath").classed(t.cn.scrollAreaClip,!0).attr("id",function(Te){return m(K,Te)});var Q=ie.selectAll("."+t.cn.scrollAreaClipRect).data(s.repeat,s.keyFun);Q.enter().append("rect").classed(t.cn.scrollAreaClipRect,!0).attr("x",-t.overdrag).attr("y",-t.uplift).attr("fill","none"),Q.attr("width",function(Te){return Te.width+2*t.overdrag}).attr("height",function(Te){return Te.height+t.uplift});var ue=ye.selectAll("."+t.cn.columnBoundary).data(s.repeat,s.keyFun);ue.enter().append("g").classed(t.cn.columnBoundary,!0);var ge=ye.selectAll("."+t.cn.columnBoundaryClippath).data(s.repeat,s.keyFun);ge.enter().append("clipPath").classed(t.cn.columnBoundaryClippath,!0),ge.attr("id",function(Te){return y(K,Te)});var Me=ge.selectAll("."+t.cn.columnBoundaryRect).data(s.repeat,s.keyFun);Me.enter().append("rect").classed(t.cn.columnBoundaryRect,!0).attr("fill","none"),Me.attr("width",function(Te){return Te.columnWidth+2*g(Te)}).attr("height",function(Te){return Te.calcdata.height+2*g(Te)+t.uplift}).attr("x",function(Te){return-g(Te)}).attr("y",function(Te){return-g(Te)}),G(null,ee,le)};function g(Y){return Math.ceil(Y.calcdata.maxLineWidth/2)}function m(Y,K){return"clip"+Y._fullLayout._uid+"_scrollAreaBottomClip_"+K.key}function y(Y,K){return"clip"+Y._fullLayout._uid+"_columnBoundaryClippath_"+K.calcdata.key+"_"+K.specIndex}function _(Y){return[].concat.apply([],Y.map(function(K){return K})).map(function(K){return K.__data__})}function v(Y,K,te){function ne(ye){var fe=ye.rowBlocks;return $(fe,fe.length-1)+(fe.length?U(fe[fe.length-1],1/0):1)}var se=Y.selectAll("."+t.cn.scrollbarKit).data(s.repeat,s.keyFun);se.enter().append("g").classed(t.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),se.each(function(ye){var fe=ye.scrollbarState;fe.totalHeight=ne(ye),fe.scrollableAreaHeight=ye.groupHeight-B(ye),fe.currentlyVisibleHeight=Math.min(fe.totalHeight,fe.scrollableAreaHeight),fe.ratio=fe.currentlyVisibleHeight/fe.totalHeight,fe.barLength=Math.max(fe.ratio*fe.currentlyVisibleHeight,t.goldenRatio*t.scrollbarWidth),fe.barWiggleRoom=fe.currentlyVisibleHeight-fe.barLength,fe.wiggleRoom=Math.max(0,fe.totalHeight-fe.scrollableAreaHeight),fe.topY=fe.barWiggleRoom===0?0:ye.scrollY/fe.wiggleRoom*fe.barWiggleRoom,fe.bottomY=fe.topY+fe.barLength,fe.dragMultiplier=fe.wiggleRoom/fe.barWiggleRoom}).attr("transform",function(ye){var fe=ye.width+t.scrollbarWidth/2+t.scrollbarOffset;return c(fe,B(ye))});var le=se.selectAll("."+t.cn.scrollbar).data(s.repeat,s.keyFun);le.enter().append("g").classed(t.cn.scrollbar,!0);var ce=le.selectAll("."+t.cn.scrollbarSlider).data(s.repeat,s.keyFun);ce.enter().append("g").classed(t.cn.scrollbarSlider,!0),ce.attr("transform",function(ye){return c(0,ye.scrollbarState.topY||0)});var pe=ce.selectAll("."+t.cn.scrollbarGlyph).data(s.repeat,s.keyFun);pe.enter().append("line").classed(t.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",t.scrollbarWidth).attr("stroke-linecap","round").attr("y1",t.scrollbarWidth/2),pe.attr("y2",function(ye){return ye.scrollbarState.barLength-t.scrollbarWidth/2}).attr("stroke-opacity",function(ye){return ye.columnDragInProgress||!ye.scrollbarState.barWiggleRoom||te?0:.4}),pe.transition().delay(0).duration(0),pe.transition().delay(t.scrollbarHideDelay).duration(t.scrollbarHideDuration).attr("stroke-opacity",0);var xe=le.selectAll("."+t.cn.scrollbarCaptureZone).data(s.repeat,s.keyFun);xe.enter().append("line").classed(t.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",t.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(ye){var fe=i.event.y,ae=this.getBoundingClientRect(),ee=ye.scrollbarState,ie=fe-ae.top,Q=i.scale.linear().domain([0,ee.scrollableAreaHeight]).range([0,ee.totalHeight]).clamp(!0);ee.topY<=ie&&ie<=ee.bottomY||W(K,Y,null,Q(ie-ee.barLength/2))(ye)}).call(i.behavior.drag().origin(function(ye){return i.event.stopPropagation(),ye.scrollbarState.scrollbarScrollInProgress=!0,ye}).on("drag",W(K,Y)).on("dragend",function(){})),xe.attr("y2",function(ye){return ye.scrollbarState.scrollableAreaHeight}),K._context.staticPlot&&(pe.remove(),xe.remove())}function x(Y,K,te,ne){var se=S(te),le=M(se);A(le);var ce=C(le);E(ce);var pe=k(le),xe=w(pe);b(xe),T(xe,K,ne,Y),H(le)}function S(Y){var K=Y.selectAll("."+t.cn.columnCells).data(s.repeat,s.keyFun);return K.enter().append("g").classed(t.cn.columnCells,!0),K.exit().remove(),K}function M(Y){var K=Y.selectAll("."+t.cn.columnCell).data(d.splitToCells,function(te){return te.keyWithinBlock});return K.enter().append("g").classed(t.cn.columnCell,!0),K.exit().remove(),K}function C(Y){var K=Y.selectAll("."+t.cn.cellRect).data(s.repeat,function(te){return te.keyWithinBlock});return K.enter().append("rect").classed(t.cn.cellRect,!0),K}function w(Y){var K=Y.selectAll("."+t.cn.cellText).data(s.repeat,function(te){return te.keyWithinBlock});return K.enter().append("text").classed(t.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){i.event.stopPropagation()}),K}function k(Y){var K=Y.selectAll("."+t.cn.cellTextHolder).data(s.repeat,function(te){return te.keyWithinBlock});return K.enter().append("g").classed(t.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),K}function A(Y){Y.each(function(K,te){var ne=K.calcdata.cells.font,se=K.column.specIndex,le={size:P(ne.size,se,te),color:P(ne.color,se,te),family:P(ne.family,se,te),weight:P(ne.weight,se,te),style:P(ne.style,se,te),variant:P(ne.variant,se,te),textcase:P(ne.textcase,se,te),lineposition:P(ne.lineposition,se,te),shadow:P(ne.shadow,se,te)};K.rowNumber=K.key,K.align=P(K.calcdata.cells.align,se,te),K.cellBorderWidth=P(K.calcdata.cells.line.width,se,te),K.font=le})}function b(Y){Y.each(function(K){l.font(i.select(this),K.font)})}function E(Y){Y.attr("width",function(K){return K.column.columnWidth}).attr("stroke-width",function(K){return K.cellBorderWidth}).each(function(K){var te=i.select(this);p.stroke(te,P(K.calcdata.cells.line.color,K.column.specIndex,K.rowNumber)),p.fill(te,P(K.calcdata.cells.fill.color,K.column.specIndex,K.rowNumber))})}function T(Y,K,te,ne){Y.text(function(se){var le=se.column.specIndex,ce=se.rowNumber,pe=se.value,xe=typeof pe=="string",ye=xe&&pe.match(/
/i),fe=!xe||ye;se.mayHaveMarkup=xe&&pe.match(/[<&>]/);var ae=F(pe);se.latex=ae;var ee=ae?"":P(se.calcdata.cells.prefix,le,ce)||"",ie=ae?"":P(se.calcdata.cells.suffix,le,ce)||"",Q=ae?null:P(se.calcdata.cells.format,le,ce)||null,ue=ee+(Q?o(Q)(se.value):se.value)+ie,ge;se.wrappingNeeded=!se.wrapped&&!fe&&!ae&&(ge=D(ue)),se.cellHeightMayIncrease=ye||ae||se.mayHaveMarkup||(ge===void 0?D(ue):ge),se.needsConvertToTspans=se.mayHaveMarkup||se.wrappingNeeded||se.latex;var Me;if(se.wrappingNeeded){var Te=t.wrapSplitCharacter===" "?ue.replace(/se&&ne.push(le),se+=xe}return ne}function G(Y,K,te){var ne=_(K)[0];if(ne!==void 0){var se=ne.rowBlocks,le=ne.calcdata,ce=$(se,se.length),pe=ne.calcdata.groupHeight-B(ne),xe=le.scrollY=Math.max(0,Math.min(ce-pe,le.scrollY)),ye=O(se,xe,pe);ye.length===1&&(ye[0]===se.length-1?ye.unshift(ye[0]-1):ye.push(ye[0]+1)),ye[0]%2&&ye.reverse(),K.each(function(fe,ae){fe.page=ye[ae],fe.scrollY=xe}),K.attr("transform",function(fe){var ae=$(fe.rowBlocks,fe.page)-fe.scrollY;return c(0,ae)}),Y&&(X(Y,te,K,ye,ne.prevPages,ne,0),X(Y,te,K,ye,ne.prevPages,ne,1),v(te,Y))}}function W(Y,K,te,ne){return function(le){var ce=le.calcdata?le.calcdata:le,pe=K.filter(function(ae){return ce.key===ae.key}),xe=te||ce.scrollbarState.dragMultiplier,ye=ce.scrollY;ce.scrollY=ne===void 0?ce.scrollY+xe*i.event.dy:ne;var fe=pe.selectAll("."+t.cn.yColumn).selectAll("."+t.cn.columnBlock).filter(I);return G(Y,fe,pe),ce.scrollY===ye}}function X(Y,K,te,ne,se,le,ce){var pe=ne[ce]!==se[ce];pe&&(clearTimeout(le.currentRepaint[ce]),le.currentRepaint[ce]=setTimeout(function(){var xe=te.filter(function(ye,fe){return fe===ce&&ne[fe]!==se[fe]});x(Y,K,xe,te),se[ce]=ne[ce]}))}function Z(Y,K,te,ne){return function(){var le=i.select(K.parentNode);le.each(function(ce){var pe=ce.fragments;le.selectAll("tspan.line").each(function(ue,ge){pe[ge].width=this.getComputedTextLength()});var xe=pe[pe.length-1].width,ye=pe.slice(0,-1),fe=[],ae,ee,ie=0,Q=ce.column.columnWidth-2*t.cellPad;for(ce.value="";ye.length;)ae=ye.shift(),ee=ae.width+xe,ie+ee>Q&&(ce.value+=fe.join(t.wrapSpacer)+t.lineBreaker,fe=[],ie=0),fe.push(ae.text),ie+=ee;ie&&(ce.value+=fe.join(t.wrapSpacer)),ce.wrapped=!0}),le.selectAll("tspan.line").remove(),T(le.select("."+t.cn.cellText),te,Y,ne),i.select(K.parentNode.parentNode).call(H)}}function J(Y,K,te,ne,se){return function(){if(!se.settledY){var ce=i.select(K.parentNode),pe=j(se),xe=se.key-pe.firstRowIndex,ye=pe.rows[xe].rowHeight,fe=se.cellHeightMayIncrease?K.parentNode.getBoundingClientRect().height+2*t.cellPad:ye,ae=Math.max(fe,ye),ee=ae-pe.rows[xe].rowHeight;ee&&(pe.rows[xe].rowHeight=ae,Y.selectAll("."+t.cn.columnCell).call(H),G(null,Y.filter(I),0),v(te,ne,!0)),ce.attr("transform",function(){var ie=this,Q=ie.parentNode,ue=Q.getBoundingClientRect(),ge=i.select(ie.parentNode).select("."+t.cn.cellRect).node().getBoundingClientRect(),Me=ie.transform.baseVal.consolidate(),Te=ge.top-ue.top+(Me?Me.matrix.f:t.cellPad);return c(N(se,i.select(ie.parentNode).select("."+t.cn.cellTextHolder).node().getBoundingClientRect().width),Te)}),se.settledY=!0}}}function N(Y,K){switch(Y.align){case"left":return t.cellPad;case"right":return Y.column.columnWidth-(K||0)-t.cellPad;case"center":return(Y.column.columnWidth-(K||0))/2;default:return t.cellPad}}function H(Y){Y.attr("transform",function(K){var te=K.rowBlocks[0].auxiliaryBlocks.reduce(function(ce,pe){return ce+U(pe,1/0)},0),ne=j(K),se=U(ne,K.key),le=se+te;return c(0,le)}).selectAll("."+t.cn.cellRect).attr("height",function(K){return q(j(K),K.key).rowHeight})}function $(Y,K){for(var te=0,ne=K-1;ne>=0;ne--)te+=V(Y[ne]);return te}function U(Y,K){for(var te=0,ne=0;neo.length&&(a=a.slice(0,o.length)):a=[],l=0;l90&&(m-=180,f=-f),{angle:m,flip:f,p:i.c2p(s,a,o),offsetMultplier:h}}}}),qle=de({"src/traces/carpet/plot.js"(e,r){"use strict";var t=Yr(),i=hn(),a=Z8(),o=K8(),s=Ule(),l=Zo(),n=Qt(),u=n.strRotate,c=n.strTranslate,f=Bl();r.exports=function(x,S,M,C){var w=x._context.staticPlot,k=S.xaxis,A=S.yaxis,b=x._fullLayout,E=b._clips;n.makeTraceGroups(C,M,"trace").each(function(T){var F=t.select(this),D=T[0],R=D.trace,P=R.aaxis,z=R.baxis,I=n.ensureSingle(F,"g","minorlayer"),L=n.ensureSingle(F,"g","majorlayer"),B=n.ensureSingle(F,"g","boundarylayer"),O=n.ensureSingle(F,"g","labellayer");F.style("opacity",R.opacity),d(k,A,L,P,"a",P._gridlines,!0,w),d(k,A,L,z,"b",z._gridlines,!0,w),d(k,A,I,P,"a",P._minorgridlines,!0,w),d(k,A,I,z,"b",z._minorgridlines,!0,w),d(k,A,B,P,"a-boundary",P._boundarylines,w),d(k,A,B,z,"b-boundary",z._boundarylines,w);var G=p(x,k,A,R,D,O,P._labels,"a-label"),W=p(x,k,A,R,D,O,z._labels,"b-label");g(x,O,R,D,k,A,G,W),h(R,D,E,k,A)})};function h(v,x,S,M,C){var w,k,A,b,E=S.select("#"+v._clipPathId);E.size()||(E=S.append("clipPath").classed("carpetclip",!0));var T=n.ensureSingle(E,"path","carpetboundary"),F=x.clipsegments,D=[];for(b=0;b0?"start":"end","data-notex":1}).call(i.font,F.font).text(F.text).call(l.convertToTspans,v),L=i.bBox(this);I.attr("transform",c(R.p[0],R.p[1])+u(R.angle)+c(F.axis.labelpadding*z,L.height*.3)),E=Math.max(E,L.width+F.axis.labelpadding)}),b.exit().remove(),T.maxExtent=E,T}function g(v,x,S,M,C,w,k,A){var b,E,T,F,D=n.aggNums(Math.min,null,S.a),R=n.aggNums(Math.max,null,S.a),P=n.aggNums(Math.min,null,S.b),z=n.aggNums(Math.max,null,S.b);b=.5*(D+R),E=P,T=S.ab2xy(b,E,!0),F=S.dxyda_rough(b,E),k.angle===void 0&&n.extendFlat(k,s(S,C,w,T,S.dxydb_rough(b,E))),_(v,x,S,M,T,F,S.aaxis,C,w,k,"a-title"),b=D,E=.5*(P+z),T=S.ab2xy(b,E,!0),F=S.dxydb_rough(b,E),A.angle===void 0&&n.extendFlat(A,s(S,C,w,T,S.dxyda_rough(b,E))),_(v,x,S,M,T,F,S.baxis,C,w,A,"b-title")}var m=f.LINE_SPACING,y=(1-f.MID_SHIFT)/m+1;function _(v,x,S,M,C,w,k,A,b,E,T){var F=[];k.title.text&&F.push(k.title.text);var D=x.selectAll("text."+T).data(F),R=E.maxExtent;D.enter().append("text").classed(T,!0),D.each(function(){var P=s(S,A,b,C,w);["start","both"].indexOf(k.showticklabels)===-1&&(R=0);var z=k.title.font.size;R+=z+k.title.offset;var I=E.angle+(E.flip<0?180:0),L=(I-P.angle+450)%360,B=L>90&&L<270,O=t.select(this);O.text(k.title.text).call(l.convertToTspans,v),B&&(R=(-l.lineCount(O)+y)*m*z-R),O.attr("transform",c(P.p[0],P.p[1])+u(P.angle)+c(0,R)).attr("text-anchor","middle").call(i.font,k.title.font)}),D.exit().remove()}}}),Vle=de({"src/traces/carpet/cheater_basis.js"(e,r){"use strict";var t=Qt().isArrayOrTypedArray;r.exports=function(i,a,o){var s,l,n,u,c,f,h=[],d=t(i)?i.length:i,p=t(a)?a.length:a,g=t(i)?i:null,m=t(a)?a:null;g&&(n=(g.length-1)/(g[g.length-1]-g[0])/(d-1)),m&&(u=(m.length-1)/(m[m.length-1]-m[0])/(p-1));var y,_=1/0,v=-1/0;for(l=0;l=10)return null;for(var s=1/0,l=-1/0,n=a.length,u=0;u0&&(U=o.dxydi([],G-1,X,0,Z),Y.push(J[0]+U[0]/3),K.push(J[1]+U[1]/3),V=o.dxydi([],G-1,X,1,Z),Y.push($[0]-V[0]/3),K.push($[1]-V[1]/3)),Y.push($[0]),K.push($[1]),J=$;else for(G=o.a2i(O),N=Math.floor(Math.max(0,Math.min(P-2,G))),H=G-N,te.length=P,te.crossLength=z,te.xy=function(ne){return o.evalxy([],G,ne)},te.dxy=function(ne,se){return o.dxydj([],N,ne,H,se)},W=0;W0&&(j=o.dxydj([],N,W-1,H,0),Y.push(J[0]+j[0]/3),K.push(J[1]+j[1]/3),q=o.dxydj([],N,W-1,H,1),Y.push($[0]-q[0]/3),K.push($[1]-q[1]/3)),Y.push($[0]),K.push($[1]),J=$;return te.axisLetter=s,te.axis=C,te.crossAxis=E,te.value=O,te.constvar=l,te.index=g,te.x=Y,te.y=K,te.smoothing=E.smoothing,te}function B(O){var G,W,X,Z,J,N=[],H=[],$={};if($.length=M.length,$.crossLength=b.length,s==="b")for(X=Math.max(0,Math.min(z-2,O)),J=Math.min(1,Math.max(0,O-X)),$.xy=function(U){return o.evalxy([],U,O)},$.dxy=function(U,V){return o.dxydi([],U,X,V,J)},G=0;GM.length-1)&&w.push(i(B(u),{color:C.gridcolor,width:C.gridwidth,dash:C.griddash}));for(g=d;gM.length-1)&&!(_<0||_>M.length-1))for(v=M[c],x=M[_],n=0;nM[M.length-1])&&k.push(i(L(y),{color:C.minorgridcolor,width:C.minorgridwidth,dash:C.minorgriddash})));C.startline&&A.push(i(B(0),{color:C.startlinecolor,width:C.startlinewidth})),C.endline&&A.push(i(B(M.length-1),{color:C.endlinecolor,width:C.endlinewidth}))}else{for(f=5e-15,h=[Math.floor((M[M.length-1]-C.tick0)/C.dtick*(1+f)),Math.ceil((M[0]-C.tick0)/C.dtick/(1+f))].sort(function(O,G){return O-G}),d=h[0],p=h[1],g=d;g<=p;g++)m=C.tick0+C.dtick*g,w.push(i(L(m),{color:C.gridcolor,width:C.gridwidth,dash:C.griddash}));for(g=d-1;gM[M.length-1])&&k.push(i(L(y),{color:C.minorgridcolor,width:C.minorgridwidth,dash:C.minorgriddash}));C.startline&&A.push(i(L(M[0]),{color:C.startlinecolor,width:C.startlinewidth})),C.endline&&A.push(i(L(M[M.length-1]),{color:C.endlinecolor,width:C.endlinewidth}))}}}}),$le=de({"src/traces/carpet/calc_labels.js"(e,r){"use strict";var t=nn(),i=fn().extendFlat;r.exports=function(o,s){var l,n,u,c,f,h=s._labels=[],d=s._gridlines;for(l=0;l=0;l--)n[d-l]=i[p][l],u[d-l]=a[p][l];for(c.push({x:n,y:u,bicubic:f}),l=p,n=[],u=[];l>=0;l--)n[p-l]=i[l][0],u[p-l]=a[l][0];return c.push({x:n,y:u,bicubic:h}),c}}}),Yle=de({"src/traces/carpet/smooth_fill_2d_array.js"(e,r){"use strict";var t=Qt();r.exports=function(a,o,s){var l,n,u,c=[],f=[],h=a[0].length,d=a.length;function p(W,X){var Z=0,J,N=0;return W>0&&(J=a[X][W-1])!==void 0&&(N++,Z+=J),W0&&(J=a[X-1][W])!==void 0&&(N++,Z+=J),X0&&n0&&lb);return t.log("Smoother converged to",E,"after",F,"iterations"),a}}}),Xle=de({"src/traces/carpet/constants.js"(e,r){"use strict";r.exports={RELATIVE_CULL_TOLERANCE:1e-6}}}),Zle=de({"src/traces/carpet/catmull_rom.js"(e,r){"use strict";var t=.5;r.exports=function(a,o,s,l){var n=a[0]-o[0],u=a[1]-o[1],c=s[0]-o[0],f=s[1]-o[1],h=Math.pow(n*n+u*u,t/2),d=Math.pow(c*c+f*f,t/2),p=(d*d*n-h*h*c)*l,g=(d*d*u-h*h*f)*l,m=d*(h+d)*3,y=h*(h+d)*3;return[[o[0]+(m&&p/m),o[1]+(m&&g/m)],[o[0]-(y&&p/y),o[1]-(y&&g/y)]]}}}),Kle=de({"src/traces/carpet/compute_control_points.js"(e,r){"use strict";var t=Zle(),i=Qt().ensureArray;function a(o,s,l){var n=-.5*l[0]+1.5*s[0],u=-.5*l[1]+1.5*s[1];return[(2*n+o[0])/3,(2*u+o[1])/3]}r.exports=function(s,l,n,u,c,f){var h,d,p,g,m,y,_,v,x,S,M=n[0].length,C=n.length,w=c?3*M-2:M,k=f?3*C-2:C;for(s=i(s,k),l=i(l,k),p=0;pm&&w_&&ky||k<_||k>v},u.setScale=function(){var w=u._x,k=u._y,A=a(u._xctrl,u._yctrl,w,k,p.smoothing,g.smoothing);u._xctrl=A[0],u._yctrl=A[1],u.evalxy=o([u._xctrl,u._yctrl],h,d,p.smoothing,g.smoothing),u.dxydi=s([u._xctrl,u._yctrl],p.smoothing,g.smoothing),u.dxydj=l([u._xctrl,u._yctrl],p.smoothing,g.smoothing)},u.i2a=function(w){var k=Math.max(0,Math.floor(w[0]),h-2),A=w[0]-k;return(1-A)*c[k]+A*c[k+1]},u.j2b=function(w){var k=Math.max(0,Math.floor(w[1]),h-2),A=w[1]-k;return(1-A)*f[k]+A*f[k+1]},u.ij2ab=function(w){return[u.i2a(w[0]),u.j2b(w[1])]},u.a2i=function(w){var k=Math.max(0,Math.min(i(w,c),h-2)),A=c[k],b=c[k+1];return Math.max(0,Math.min(h-1,k+(w-A)/(b-A)))},u.b2j=function(w){var k=Math.max(0,Math.min(i(w,f),d-2)),A=f[k],b=f[k+1];return Math.max(0,Math.min(d-1,k+(w-A)/(b-A)))},u.ab2ij=function(w){return[u.a2i(w[0]),u.b2j(w[1])]},u.i2c=function(w,k){return u.evalxy([],w,k)},u.ab2xy=function(w,k,A){if(!A&&(wc[h-1]|kf[d-1]))return[!1,!1];var b=u.a2i(w),E=u.b2j(k),T=u.evalxy([],b,E);if(A){var F=0,D=0,R=[],P,z,I,L;wc[h-1]?(P=h-2,z=1,F=(w-c[h-1])/(c[h-1]-c[h-2])):(P=Math.max(0,Math.min(h-2,Math.floor(b))),z=b-P),kf[d-1]?(I=d-2,L=1,D=(k-f[d-1])/(f[d-1]-f[d-2])):(I=Math.max(0,Math.min(d-2,Math.floor(E))),L=E-I),F&&(u.dxydi(R,P,I,z,L),T[0]+=R[0]*F,T[1]+=R[1]*F),D&&(u.dxydj(R,P,I,z,L),T[0]+=R[0]*D,T[1]+=R[1]*D)}return T},u.c2p=function(w,k,A){return[k.c2p(w[0]),A.c2p(w[1])]},u.p2x=function(w,k,A){return[k.p2c(w[0]),A.p2c(w[1])]},u.dadi=function(w){var k=Math.max(0,Math.min(c.length-2,w));return c[k+1]-c[k]},u.dbdj=function(w){var k=Math.max(0,Math.min(f.length-2,w));return f[k+1]-f[k]},u.dxyda=function(w,k,A,b){var E=u.dxydi(null,w,k,A,b),T=u.dadi(w,A);return[E[0]/T,E[1]/T]},u.dxydb=function(w,k,A,b){var E=u.dxydj(null,w,k,A,b),T=u.dbdj(k,b);return[E[0]/T,E[1]/T]},u.dxyda_rough=function(w,k,A){var b=x*(A||.1),E=u.ab2xy(w+b,k,!0),T=u.ab2xy(w-b,k,!0);return[(E[0]-T[0])*.5/b,(E[1]-T[1])*.5/b]},u.dxydb_rough=function(w,k,A){var b=S*(A||.1),E=u.ab2xy(w,k+b,!0),T=u.ab2xy(w,k-b,!0);return[(E[0]-T[0])*.5/b,(E[1]-T[1])*.5/b]},u.dpdx=function(w){return w._m},u.dpdy=function(w){return w._m}}}}),rue=de({"src/traces/carpet/calc.js"(e,r){"use strict";var t=nn(),i=Qt().isArray1D,a=Vle(),o=Gle(),s=Hle(),l=$le(),n=Wle(),u=t3(),c=Yle(),f=e3(),h=tue();r.exports=function(p,g){var m=t.getFromId(p,g.xaxis),y=t.getFromId(p,g.yaxis),_=g.aaxis,v=g.baxis,x=g.x,S=g.y,M=[];x&&i(x)&&M.push("x"),S&&i(S)&&M.push("y"),M.length&&f(g,_,v,"a","b",M);var C=g._a=g._a||g.a,w=g._b=g._b||g.b;x=g._x||g.x,S=g._y||g.y;var k={};if(g._cheater){var A=_.cheatertype==="index"?C.length:C,b=v.cheatertype==="index"?w.length:w;x=a(A,b,g.cheaterslope)}g._x=x=u(x),g._y=S=u(S),c(x,C,w),c(S,C,w),h(g),g.setScale();var E=o(x),T=o(S),F=.5*(E[1]-E[0]),D=.5*(E[1]+E[0]),R=.5*(T[1]-T[0]),P=.5*(T[1]+T[0]),z=1.3;return E=[D-F*z,D+F*z],T=[P-R*z,P+R*z],g._extremes[m._id]=t.findExtremes(m,E,{padded:!0}),g._extremes[y._id]=t.findExtremes(y,T,{padded:!0}),s(g,"a","b"),s(g,"b","a"),l(g,_),l(g,v),k.clipsegments=n(g._xctrl,g._yctrl,_,v),k.x=x,k.y=S,k.a=C,k.b=w,[k]}}}),iue=de({"src/traces/carpet/index.js"(e,r){"use strict";r.exports={attributes:IS(),supplyDefaults:jle(),plot:qle(),calc:rue(),animatable:!0,isContainer:!0,moduleType:"trace",name:"carpet",basePlotModule:ml(),categories:["cartesian","svg","carpet","carpetAxis","notLegendIsolatable","noMultiCategory","noHover","noSortingByValue"],meta:{}}}}),aue=de({"lib/carpet.js"(e,r){"use strict";r.exports=iue()}}),J8=de({"src/traces/scattercarpet/attributes.js"(e,r){"use strict";var t=Kd(),i=tl(),a=ri(),{hovertemplateAttrs:o,texttemplateAttrs:s,templatefallbackAttrs:l}=Vo(),n=cs(),u=fn().extendFlat,c=i.marker,f=i.line,h=c.line;r.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:u({},i.mode,{dflt:"markers"}),text:u({},i.text,{}),texttemplate:s({editType:"plot"},{keys:["a","b","text"]}),texttemplatefallback:l({editType:"plot"}),hovertext:u({},i.hovertext,{}),line:{color:f.color,width:f.width,dash:f.dash,backoff:f.backoff,shape:u({},f.shape,{values:["linear","spline"]}),smoothing:f.smoothing,editType:"calc"},connectgaps:i.connectgaps,fill:u({},i.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:t(),marker:u({symbol:c.symbol,opacity:c.opacity,maxdisplayed:c.maxdisplayed,angle:c.angle,angleref:c.angleref,standoff:c.standoff,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,line:u({width:h.width,dash:h.dash,editType:"calc"},n("marker.line")),gradient:c.gradient,editType:"calc"},n("marker")),textfont:i.textfont,textposition:i.textposition,selected:i.selected,unselected:i.unselected,hoverinfo:u({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:i.hoveron,hovertemplate:o(),hovertemplatefallback:l(),zorder:i.zorder}}}),nue=de({"src/traces/scattercarpet/defaults.js"(e,r){"use strict";var t=Qt(),i=Zd(),a=bs(),o=Nh(),s=yd(),l=p1(),n=_d(),u=Jd(),c=J8();r.exports=function(h,d,p,g){function m(C,w){return t.coerce(h,d,c,C,w)}m("carpet"),d.xaxis="x",d.yaxis="y";var y=m("a"),_=m("b"),v=Math.min(y.length,_.length);if(!v){d.visible=!1;return}d._length=v,m("text"),m("texttemplate"),m("texttemplatefallback"),m("hovertext");var x=v0?k=C.labelprefix.replace(/ = $/,""):k=C._hovertitle,v.push(k+": "+w.toFixed(3)+C.labelsuffix)}if(!m.hovertemplate){var S=g.hi||m.hoverinfo,M=S.split("+");M.indexOf("all")!==-1&&(M=["a","b","text"]),M.indexOf("a")!==-1&&x(y.aaxis,g.a),M.indexOf("b")!==-1&&x(y.baxis,g.b),v.push("y: "+c.yLabel),M.indexOf("text")!==-1&&i(g,m,v),c.extraText=v.join("
")}return u}}}),cue=de({"src/traces/scattercarpet/event_data.js"(e,r){"use strict";r.exports=function(i,a,o,s,l){var n=s[l];return i.a=n.a,i.b=n.b,i.y=n.y,i}}}),fue=de({"src/traces/scattercarpet/index.js"(e,r){"use strict";r.exports={attributes:J8(),supplyDefaults:nue(),colorbar:Yu(),formatLabels:oue(),calc:sue(),plot:lue(),style:lf().style,styleOnSelect:lf().styleOnSelect,hoverPoints:uue(),selectPoints:Mv(),eventData:cue(),moduleType:"trace",name:"scattercarpet",basePlotModule:ml(),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}}}),hue=de({"lib/scattercarpet.js"(e,r){"use strict";r.exports=fue()}}),Q8=de({"src/traces/contourcarpet/attributes.js"(e,r){"use strict";var t=x1(),i=Vy(),a=cs(),o=fn().extendFlat,s=i.contours;r.exports=o({carpet:{valType:"string",editType:"calc"},z:t.z,a:t.x,a0:t.x0,da:t.dx,b:t.y,b0:t.y0,db:t.dy,text:t.text,hovertext:t.hovertext,transpose:t.transpose,atype:t.xtype,btype:t.ytype,fillcolor:i.fillcolor,autocontour:i.autocontour,ncontours:i.ncontours,contours:{type:s.type,start:s.start,end:s.end,size:s.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:s.showlines,showlabels:s.showlabels,labelfont:s.labelfont,labelformat:s.labelformat,operation:s.operation,value:s.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:i.line.color,width:i.line.width,dash:i.line.dash,smoothing:i.line.smoothing,editType:"plot"},zorder:i.zorder},a("",{cLetter:"z",autoColorDflt:!1}))}}),ej=de({"src/traces/contourcarpet/defaults.js"(e,r){"use strict";var t=Qt(),i=Qw(),a=Q8(),o=Hk(),s=d3(),l=p3();r.exports=function(u,c,f,h){function d(y,_){return t.coerce(u,c,a,y,_)}function p(y){return t.coerce2(u,c,a,y)}if(d("carpet"),u.a&&u.b){var g=i(u,c,d,h,"a","b");if(!g){c.visible=!1;return}d("text");var m=d("contours.type")==="constraint";m?o(u,c,d,h,f,{hasHover:!1}):(s(u,c,d,p),l(u,c,d,h,{hasHover:!1}))}else c._defaultColor=f,c._length=null;d("zorder")}}}),due=de({"src/traces/contourcarpet/calc.js"(e,r){"use strict";var t=hc(),i=Qt(),a=e3(),o=t3(),s=r3(),l=i3(),n=Ck(),u=ej(),c=RS(),f=zk();r.exports=function(p,g){var m=g._carpetTrace=c(p,g);if(!(!m||!m.visible||m.visible==="legendonly")){if(!g.a||!g.b){var y=p.data[m.index],_=p.data[g.index];_.a||(_.a=y.a),_.b||(_.b=y.b),u(_,g,g._defaultColor,p._fullLayout)}var v=h(p,g);return f(g,g._z),v}};function h(d,p){var g=p._carpetTrace,m=g.aaxis,y=g.baxis,_,v,x,S,M,C,w;m._minDtick=0,y._minDtick=0,i.isArray1D(p.z)&&a(p,m,y,"a","b",["z"]),_=p._a=p._a||p.a,S=p._b=p._b||p.b,_=_?m.makeCalcdata(p,"_a"):[],S=S?y.makeCalcdata(p,"_b"):[],v=p.a0||0,x=p.da||1,M=p.b0||0,C=p.db||1,w=p._z=o(p._z||p.z,p.transpose),p._emptypoints=l(w),s(w,p._emptypoints);var k=i.maxRowLength(w),A=p.xtype==="scaled"?"":_,b=n(p,A,v,x,k,m),E=p.ytype==="scaled"?"":S,T=n(p,E,M,C,w.length,y),F={a:b,b:T,z:w};return p.contours.type==="levels"&&p.contours.coloring!=="none"&&t(d,p,{vals:w,containerStr:"",cLetter:"z"}),[F]}}}),pue=de({"src/traces/carpet/axis_aligned_line.js"(e,r){"use strict";var t=Qt().isArrayOrTypedArray;r.exports=function(i,a,o,s){var l,n,u,c,f,h,d,p,g,m,y,_,v,x=t(o)?"a":"b",S=x==="a"?i.aaxis:i.baxis,M=S.smoothing,C=x==="a"?i.a2i:i.b2j,w=x==="a"?o:s,k=x==="a"?s:o,A=x==="a"?a.a.length:a.b.length,b=x==="a"?a.b.length:a.a.length,E=Math.floor(x==="a"?i.b2j(k):i.a2i(k)),T=x==="a"?function(X){return i.evalxy([],X,E)}:function(X){return i.evalxy([],E,X)};M&&(u=Math.max(0,Math.min(b-2,E)),c=E-u,n=x==="a"?function(X,Z){return i.dxydi([],X,u,Z,c)}:function(X,Z){return i.dxydj([],u,X,c,Z)});var F=C(w[0]),D=C(w[1]),R=F0?Math.floor:Math.ceil,I=R>0?Math.ceil:Math.floor,L=R>0?Math.min:Math.max,B=R>0?Math.max:Math.min,O=z(F+P),G=I(D-P);d=T(F);var W=[[d]];for(l=O;l*R=0;te--)q=B.clipsegments[te],Y=i([],q.x,F.c2p),K=i([],q.y,D.c2p),Y.reverse(),K.reverse(),ne.push(a(Y,K,q.bicubic));var se="M"+ne.join("L")+"Z";M(P,B.clipsegments,F,D,Z,N),C(I,P,F,D,j,$,H,L,B,N,se),y(P,X,A,z,W,b,L),o.setClipUrl(P,L._clipPathId,A)})};function m(k,A){var b,E,T,F,D,R,P,z,I;for(b=0;bX&&(E.max=X),E.len=E.max-E.min}function v(k,A,b){var E=k.getPointAtLength(A),T=k.getPointAtLength(b),F=T.x-E.x,D=T.y-E.y,R=Math.sqrt(F*F+D*D);return[F/R,D/R]}function x(k){var A=Math.sqrt(k[0]*k[0]+k[1]*k[1]);return[k[0]/A,k[1]/A]}function S(k,A){var b=Math.abs(k[0]*A[0]+k[1]*A[1]),E=Math.sqrt(1-b*b);return E/b}function M(k,A,b,E,T,F){var D,R,P,z,I=s.ensureSingle(k,"g","contourbg"),L=I.selectAll("path").data(F==="fill"&&!T?[0]:[]);L.enter().append("path"),L.exit().remove();var B=[];for(z=0;z=0&&(O=Y,W=X):Math.abs(B[1]-O[1])=0&&(O=Y,W=X):s.log("endpt to newendpt is not vert. or horz.",B,O,Y)}if(W>=0)break;z+=j(B,O),B=O}if(W===A.edgepaths.length){s.log("unclosed perimeter path");break}P=W,L=I.indexOf(P)===-1,L&&(P=I[0],z+=j(B,O)+"Z",B=null)}for(P=0;Pw):C=R>T,w=R;var P=m(T,F,D,R);P.pos=E,P.yc=(T+R)/2,P.i=b,P.dir=C?"increasing":"decreasing",P.x=P.pos,P.y=[D,F],k&&(P.orig_p=d[b]),S&&(P.tx=h.text[b]),M&&(P.htx=h.hovertext[b]),A.push(P)}else A.push({pos:E,empty:!0})}return h._extremes[g._id]=a.findExtremes(g,t.concat(v,_),{padded:!0}),A.length&&(A[0].t={labels:{open:i(f,"open:")+" ",high:i(f,"high:")+" ",low:i(f,"low:")+" ",close:i(f,"close:")+" "}}),A}function c(f,h,d){var p=d._minDiff;if(!p){var g=f._fullData,m=[];p=1/0;var y;for(y=0;y"+x.labels[E]+t.hoverLabelText(_,T,v.yhoverformat)):(D=i.extendFlat({},M),D.y0=D.y1=F,D.yLabelVal=T,D.yLabel=x.labels[E]+t.hoverLabelText(_,T,v.yhoverformat),D.name="",S.push(D),A[T]=D)}return S}function h(d,p,g,m){var y=d.cd,_=d.ya,v=y[0].trace,x=y[0].t,S=c(d,p,g,m);if(!S)return[];var M=S.index,C=y[M],w=S.index=C.i,k=C.dir;function A(P){return x.labels[P]+t.hoverLabelText(_,v[P][w],v.yhoverformat)}var b=C.hi||v.hoverinfo||"",E=b.split("+"),T=b==="all",F=T||E.indexOf("y")!==-1,D=T||E.indexOf("text")!==-1,R=F?[A("open"),A("high"),A("low"),A("close")+" "+n[k]]:[];return D&&s(C,v,R),S.extraText=R.join("
"),S.y0=S.y1=_.c2p(C.yc,!0),[S]}r.exports={hoverPoints:u,hoverSplit:f,hoverOnPoints:h}}}),aj=de({"src/traces/ohlc/select.js"(e,r){"use strict";r.exports=function(i,a){var o=i.cd,s=i.xaxis,l=i.yaxis,n=[],u,c=o[0].t.bPos||0;if(a===!1)for(u=0;up?function(v){return v<=0}:function(v){return v>=0};c.c2g=function(v){var x=c.c2l(v)-d;return(_(x)?x:0)+y},c.g2c=function(v){return c.l2c(v+d-y)},c.g2p=function(v){return v*m},c.c2p=function(v){return c.g2p(c.c2g(v))}}}function l(c,f){return f==="degrees"?a(c):c}function n(c,f){return f==="degrees"?o(c):c}function u(c,f){var h=c.type;if(h==="linear"){var d=c.d2c,p=c.c2d;c.d2c=function(g,m){return l(d(g),m)},c.c2d=function(g,m){return p(n(g,m))}}c.makeCalcdata=function(g,m){var y=g[m],_=g._length,v,x,S=function(A){return c.d2c(A,g.thetaunit)};if(y)for(v=new Array(_),x=0;x<_;x++)v[x]=S(y[x]);else{var M=m+"0",C="d"+m,w=M in g?S(g[M]):0,k=g[C]?S(g[C]):(c.period||2*Math.PI)/_;for(v=new Array(_),x=0;x<_;x++)v[x]=w+x*k}return v},c.setGeometry=function(){var g=f.sector,m=g.map(a),y={clockwise:-1,counterclockwise:1}[c.direction],_=a(c.rotation),v=function(b){return y*b+_},x=function(b){return(b-_)/y},S,M,C,w;switch(h){case"linear":M=S=t.identity,w=a,C=o,c.range=t.isFullCircle(m)?[g[0],g[0]+360]:m.map(x).map(o);break;case"category":var k=c._categories.length,A=c.period?Math.max(c.period,k):k;A===0&&(A=1),M=w=function(b){return b*2*Math.PI/A},S=C=function(b){return b*A/Math.PI/2},c.range=[0,A];break}c.c2g=function(b){return v(M(b))},c.g2c=function(b){return S(x(b))},c.t2g=function(b){return v(w(b))},c.g2t=function(b){return C(x(b))}}}}}),BS=de({"src/plots/polar/constants.js"(e,r){"use strict";r.exports={attr:"subplot",name:"polar",axisNames:["angularaxis","radialaxis"],axisName2dataArray:{angularaxis:"theta",radialaxis:"r"},layerNames:["draglayer","plotbg","backplot","angular-grid","radial-grid","frontplot","angular-line","radial-line","angular-axis","radial-axis"],radialDragBoxSize:50,angularDragBoxSize:30,cornerLen:25,cornerHalfWidth:2,MINDRAG:8,MINZOOM:20,OFFEDGE:20}}}),OS=de({"src/plots/polar/helpers.js"(e,r){"use strict";var t=Qt(),i=Fy().tester,a=t.findIndexOfMin,o=t.isAngleInsideSector,s=t.angleDelta,l=t.angleDist;function n(x,S,M,C,w){if(!o(S,C))return!1;var k,A;M[0]0?A:1/0},C=a(S,M),w=t.mod(C+1,S.length);return[S[C],S[w]]}function m(x){return Math.abs(x)>1e-10?x:0}function y(x,S,M){S=S||0,M=M||0;for(var C=x.length,w=new Array(C),k=0;k0?1:0}function i(n){var u=n[0],c=n[1];if(!isFinite(u)||!isFinite(c))return[1,0];var f=(u+1)*(u+1)+c*c;return[(u*u+c*c-1)/f,2*c/f]}function a(n,u){var c=u[0],f=u[1];return[c*n.radius+n.cx,-f*n.radius+n.cy]}function o(n,u){return u*n.radius}function s(n,u,c,f){var h=a(n,i([c,u])),d=h[0],p=h[1],g=a(n,i([f,u])),m=g[0],y=g[1];if(u===0)return["M"+d+","+p,"L"+m+","+y].join(" ");var _=o(n,1/Math.abs(u));return["M"+d+","+p,"A"+_+","+_+" 0 0,"+(u<0?1:0)+" "+m+","+y].join(" ")}function l(n,u,c,f){var h=o(n,1/(u+1)),d=a(n,i([u,c])),p=d[0],g=d[1],m=a(n,i([u,f])),y=m[0],_=m[1];if(t(c)!==t(f)){var v=a(n,i([u,0])),x=v[0],S=v[1];return["M"+p+","+g,"A"+h+","+h+" 0 0,"+(0pe?(xe=Y,ye=Y*pe,ee=(K-ye)/$.h/2,fe=[j[0],j[1]],ae=[q[0]+ee,q[1]-ee]):(xe=K/pe,ye=K,ee=(Y-xe)/$.w/2,fe=[j[0]+ee,j[1]-ee],ae=[q[0],q[1]]),N.xLength2=xe,N.yLength2=ye,N.xDomain2=fe,N.yDomain2=ae;var ie=N.xOffset2=$.l+$.w*fe[0],Q=N.yOffset2=$.t+$.h*(1-ae[1]),ue=N.radius=xe/se,ge=N.innerRadius=N.getHole(J)*ue,Me=N.cx=ie-ue*ne[0],Te=N.cy=Q+ue*ne[3],je=N.cxx=Me-ie,Ve=N.cyy=Te-Q,Ze=U.side,Ke;Ze==="counterclockwise"?(Ke=Ze,Ze="top"):Ze==="clockwise"&&(Ke=Ze,Ze="bottom"),N.radialAxis=N.mockAxis(Z,J,U,{_id:"x",side:Ze,_trueSide:Ke,domain:[ge/$.w,ue/$.w]}),N.angularAxis=N.mockAxis(Z,J,V,{side:"right",domain:[0,Math.PI],autorange:!1}),N.doAutoRange(Z,J),N.updateAngularAxis(Z,J),N.updateRadialAxis(Z,J),N.updateRadialAxisTitle(Z,J),N.xaxis=N.mockCartesianAxis(Z,J,{_id:"x",domain:fe}),N.yaxis=N.mockCartesianAxis(Z,J,{_id:"y",domain:ae});var vt=N.pathSubplot();N.clipPaths.forTraces.select("path").attr("d",vt).attr("transform",s(je,Ve)),H.frontplot.attr("transform",s(ie,Q)).call(n.setClipUrl,N._hasClipOnAxisFalse?null:N.clipIds.forTraces,N.gd),H.bg.attr("d",vt).attr("transform",s(Me,Te)).call(l.fill,J.bgcolor)},B.mockAxis=function(Z,J,N,H){var $=a.extendFlat({},N,H);return h($,J,Z),$},B.mockCartesianAxis=function(Z,J,N){var H=this,$=H.isSmith,U=N._id,V=a.extendFlat({type:"linear"},N);f(V,Z);var j={x:[0,2],y:[1,3]};return V.setRange=function(){var q=H.sectorBBox,Y=j[U],K=H.radialAxis._rl,te=(K[1]-K[0])/(1-H.getHole(J));V.range=[q[Y[0]]*te,q[Y[1]]*te]},V.isPtWithinRange=U==="x"&&!$?function(q){return H.isPtInside(q)}:function(){return!0},V.setRange(),V.setScale(),V},B.doAutoRange=function(Z,J){var N=this,H=N.gd,$=N.radialAxis,U=N.getRadial(J);d(H,$);var V=$.range;if(U.range=V.slice(),U._input.range=V.slice(),$._rl=[$.r2l(V[0],null,"gregorian"),$.r2l(V[1],null,"gregorian")],$.minallowed!==void 0){var j=$.r2l($.minallowed);$._rl[0]>$._rl[1]?$._rl[1]=Math.max($._rl[1],j):$._rl[0]=Math.max($._rl[0],j)}if($.maxallowed!==void 0){var q=$.r2l($.maxallowed);$._rl[0]<$._rl[1]?$._rl[1]=Math.min($._rl[1],q):$._rl[0]=Math.min($._rl[0],q)}},B.updateRadialAxis=function(Z,J){var N=this,H=N.gd,$=N.layers,U=N.radius,V=N.innerRadius,j=N.cx,q=N.cy,Y=N.getRadial(J),K=P(N.getSector(J)[0],360),te=N.radialAxis,ne=V90&&K<=270&&(te.tickangle=180);var le=se?function(ue){var ge=D(N,E([ue.x,0]));return s(ge[0]-j,ge[1]-q)}:function(ue){return s(te.l2p(ue.x)+V,0)},ce=se?function(ue){return F(N,ue.x,-1/0,1/0)}:function(ue){return N.pathArc(te.r2p(ue.x)+V)},pe=O(Y);if(N.radialTickLayout!==pe&&($["radial-axis"].selectAll(".xtick").remove(),N.radialTickLayout=pe),ne){te.setScale();var xe=0,ye=se?(te.tickvals||[]).filter(function(ue){return ue>=0}).map(function(ue){return c.tickText(te,ue,!0,!1)}):c.calcTicks(te),fe=se?ye:c.clipEnds(te,ye),ae=c.getTickSigns(te)[2];se&&((te.ticks==="top"&&te.side==="bottom"||te.ticks==="bottom"&&te.side==="top")&&(ae=-ae),te.ticks==="top"&&te.side==="top"&&(xe=-te.ticklen),te.ticks==="bottom"&&te.side==="bottom"&&(xe=te.ticklen)),c.drawTicks(H,te,{vals:ye,layer:$["radial-axis"],path:c.makeTickPath(te,0,ae),transFn:le,crisp:!1}),c.drawGrid(H,te,{vals:fe,layer:$["radial-grid"],path:ce,transFn:a.noop,crisp:!1}),c.drawLabels(H,te,{vals:ye,layer:$["radial-axis"],transFn:le,labelFns:c.makeLabelFns(te,xe)})}var ee=N.radialAxisAngle=N.vangles?I(W(z(Y.angle),N.vangles)):Y.angle,ie=s(j,q),Q=ie+o(-ee);X($["radial-axis"],ne&&(Y.showticklabels||Y.ticks),{transform:Q}),X($["radial-grid"],ne&&Y.showgrid,{transform:se?"":ie}),X($["radial-line"].select("line"),ne&&Y.showline,{x1:se?-U:V,y1:0,x2:U,y2:0,transform:Q}).attr("stroke-width",Y.linewidth).call(l.stroke,Y.linecolor)},B.updateRadialAxisTitle=function(Z,J,N){if(!this.isSmith){var H=this,$=H.gd,U=H.radius,V=H.cx,j=H.cy,q=H.getRadial(J),Y=H.id+"title",K=0;if(q.title){var te=n.bBox(H.layers["radial-axis"].node()).height,ne=q.title.font.size,se=q.side;K=se==="top"?ne:se==="counterclockwise"?-(te+ne*.4):te+ne*.8}var le=N!==void 0?N:H.radialAxisAngle,ce=z(le),pe=Math.cos(ce),xe=Math.sin(ce),ye=V+U/2*pe+K*xe,fe=j-U/2*xe+K*pe;H.layers["radial-axis-title"]=y.draw($,Y,{propContainer:q,propName:H.id+".radialaxis.title.text",placeholder:R($,"Click to enter radial axis title"),attributes:{x:ye,y:fe,"text-anchor":"middle"},transform:{rotate:-le}})}},B.updateAngularAxis=function(Z,J){var N=this,H=N.gd,$=N.layers,U=N.radius,V=N.innerRadius,j=N.cx,q=N.cy,Y=N.getAngular(J),K=N.angularAxis,te=N.isSmith;te||(N.fillViewInitialKey("angularaxis.rotation",Y.rotation),K.setGeometry(),K.setScale());var ne=te?function(ge){var Me=D(N,E([0,ge.x]));return Math.atan2(Me[0]-j,Me[1]-q)-Math.PI/2}:function(ge){return K.t2g(ge.x)};K.type==="linear"&&K.thetaunit==="radians"&&(K.tick0=I(K.tick0),K.dtick=I(K.dtick));var se=function(ge){return s(j+U*Math.cos(ge),q-U*Math.sin(ge))},le=te?function(ge){var Me=D(N,E([0,ge.x]));return s(Me[0],Me[1])}:function(ge){return se(ne(ge))},ce=te?function(ge){var Me=D(N,E([0,ge.x])),Te=Math.atan2(Me[0]-j,Me[1]-q)-Math.PI/2;return s(Me[0],Me[1])+o(-I(Te))}:function(ge){var Me=ne(ge);return se(Me)+o(-I(Me))},pe=te?function(ge){return T(N,ge.x,0,1/0)}:function(ge){var Me=ne(ge),Te=Math.cos(Me),je=Math.sin(Me);return"M"+[j+V*Te,q-V*je]+"L"+[j+U*Te,q-U*je]},xe=c.makeLabelFns(K,0),ye=xe.labelStandoff,fe={};fe.xFn=function(ge){var Me=ne(ge);return Math.cos(Me)*ye},fe.yFn=function(ge){var Me=ne(ge),Te=Math.sin(Me)>0?.2:1;return-Math.sin(Me)*(ye+ge.fontSize*Te)+Math.abs(Math.cos(Me))*(ge.fontSize*w)},fe.anchorFn=function(ge){var Me=ne(ge),Te=Math.cos(Me);return Math.abs(Te)<.1?"middle":Te>0?"start":"end"},fe.heightFn=function(ge,Me,Te){var je=ne(ge);return-.5*(1+Math.sin(je))*Te};var ae=O(Y);N.angularTickLayout!==ae&&($["angular-axis"].selectAll("."+K._id+"tick").remove(),N.angularTickLayout=ae);var ee=te?[1/0].concat(K.tickvals||[]).map(function(ge){return c.tickText(K,ge,!0,!1)}):c.calcTicks(K);te&&(ee[0].text="\u221E",ee[0].fontSize*=1.75);var ie;if(J.gridshape==="linear"?(ie=ee.map(ne),a.angleDelta(ie[0],ie[1])<0&&(ie=ie.slice().reverse())):ie=null,N.vangles=ie,K.type==="category"&&(ee=ee.filter(function(ge){return a.isAngleInsideSector(ne(ge),N.sectorInRad)})),K.visible){var Q=K.ticks==="inside"?-1:1,ue=(K.linewidth||1)/2;c.drawTicks(H,K,{vals:ee,layer:$["angular-axis"],path:"M"+Q*ue+",0h"+Q*K.ticklen,transFn:ce,crisp:!1}),c.drawGrid(H,K,{vals:ee,layer:$["angular-grid"],path:pe,transFn:a.noop,crisp:!1}),c.drawLabels(H,K,{vals:ee,layer:$["angular-axis"],repositionOnUpdate:!0,transFn:le,labelFns:fe})}X($["angular-line"].select("path"),Y.showline,{d:N.pathSubplot(),transform:s(j,q)}).attr("stroke-width",Y.linewidth).call(l.stroke,Y.linecolor)},B.updateFx=function(Z,J){if(!this.gd._context.staticPlot){var N=!this.isSmith;N&&(this.updateAngularDrag(Z),this.updateRadialDrag(Z,J,0),this.updateRadialDrag(Z,J,1)),this.updateHoverAndMainDrag(Z)}},B.updateHoverAndMainDrag=function(Z){var J=this,N=J.isSmith,H=J.gd,$=J.layers,U=Z._zoomlayer,V=k.MINZOOM,j=k.OFFEDGE,q=J.radius,Y=J.innerRadius,K=J.cx,te=J.cy,ne=J.cxx,se=J.cyy,le=J.sectorInRad,ce=J.vangles,pe=J.radialAxis,xe=A.clampTiny,ye=A.findXYatLength,fe=A.findEnclosingVertexAngles,ae=k.cornerHalfWidth,ee=k.cornerLen/2,ie,Q,ue=p.makeDragger($,"path","maindrag",Z.dragmode===!1?"none":"crosshair");t.select(ue).attr("d",J.pathSubplot()).attr("transform",s(K,te)),ue.onmousemove=function(ft){m.hover(H,ft,J.id),H._fullLayout._lasthover=ue,H._fullLayout._hoversubplot=J.id},ue.onmouseout=function(ft){H._dragging||g.unhover(H,ft)};var ge={element:ue,gd:H,subplot:J.id,plotinfo:{id:J.id,xaxis:J.xaxis,yaxis:J.yaxis},xaxes:[J.xaxis],yaxes:[J.yaxis]},Me,Te,je,Ve,Ze,Ke,vt,xt,Pt;function mt(ft,At){return Math.sqrt(ft*ft+At*At)}function Mt(ft,At){return mt(ft-ne,At-se)}function lt(ft,At){return Math.atan2(se-At,ft-ne)}function qe(ft,At){return[ft*Math.cos(At),ft*Math.sin(-At)]}function Ye(ft,At){if(ft===0)return J.pathSector(2*ae);var ht=ee/ft,Gt=At-ht,fr=At+ht,gt=Math.max(0,Math.min(ft,q)),yt=gt-ae,kt=gt+ae;return"M"+qe(yt,Gt)+"A"+[yt,yt]+" 0,0,0 "+qe(yt,fr)+"L"+qe(kt,fr)+"A"+[kt,kt]+" 0,0,1 "+qe(kt,Gt)+"Z"}function me(ft,At,ht){if(ft===0)return J.pathSector(2*ae);var Gt=qe(ft,At),fr=qe(ft,ht),gt=xe((Gt[0]+fr[0])/2),yt=xe((Gt[1]+fr[1])/2),kt,Lt;if(gt&&yt){var Ct=yt/gt,$t=-1/Ct,mr=ye(ae,Ct,gt,yt);kt=ye(ee,$t,mr[0][0],mr[0][1]),Lt=ye(ee,$t,mr[1][0],mr[1][1])}else{var br,Er;yt?(br=ee,Er=ae):(br=ae,Er=ee),kt=[[gt-br,yt-Er],[gt+br,yt-Er]],Lt=[[gt-br,yt+Er],[gt+br,yt+Er]]}return"M"+kt.join("L")+"L"+Lt.reverse().join("L")+"Z"}function _e(){je=null,Ve=null,Ze=J.pathSubplot(),Ke=!1;var ft=H._fullLayout[J.id];vt=l.luminosity(ft.bgcolor),xt=p.makeZoombox(U,vt,K,te,Ze),xt.attr("fill-rule","evenodd"),Pt=p.makeCorners(U,K,te),x(H)}function Ae(ft,At){return At=Math.max(Math.min(At,q),Y),ftV?(ft-1&&ft===1&&v(At,H,[J.xaxis],[J.yaxis],J.id,ge),ht.indexOf("event")>-1&&m.click(H,At,J.id)}ge.prepFn=function(ft,At,ht){var Gt=H._fullLayout.dragmode,fr=ue.getBoundingClientRect();H._fullLayout._calcInverseTransform(H);var gt=H._fullLayout._invTransform;ie=H._fullLayout._invScaleX,Q=H._fullLayout._invScaleY;var yt=a.apply3DTransform(gt)(At-fr.left,ht-fr.top);if(Me=yt[0],Te=yt[1],ce){var kt=A.findPolygonOffset(q,le[0],le[1],ce);Me+=ne+kt[0],Te+=se+kt[1]}switch(Gt){case"zoom":ge.clickFn=rt,N||(ce?ge.moveFn=Je:ge.moveFn=Ee,ge.doneFn=Ue,_e(ft,At,ht));break;case"select":case"lasso":_(ft,At,ht,ge,Gt);break}},g.init(ge)},B.updateRadialDrag=function(Z,J,N){var H=this,$=H.gd,U=H.layers,V=H.radius,j=H.innerRadius,q=H.cx,Y=H.cy,K=H.radialAxis,te=k.radialDragBoxSize,ne=te/2;if(!K.visible)return;var se=z(H.radialAxisAngle),le=K._rl,ce=le[0],pe=le[1],xe=le[N],ye=.75*(le[1]-le[0])/(1-H.getHole(J))/V,fe,ae,ee;N?(fe=q+(V+ne)*Math.cos(se),ae=Y-(V+ne)*Math.sin(se),ee="radialdrag"):(fe=q+(j-ne)*Math.cos(se),ae=Y-(j-ne)*Math.sin(se),ee="radialdrag-inner");var ie=p.makeRectDragger(U,ee,"crosshair",-ne,-ne,te,te),Q={element:ie,gd:$};Z.dragmode===!1&&(Q.dragmode=!1),X(t.select(ie),K.visible&&j0!=(N?Me>ce:Me=90||$>90&&U>=450?se=1:j<=0&&Y<=0?se=0:se=Math.max(j,Y),$<=180&&U>=180||$>180&&U>=540?K=-1:V>=0&&q>=0?K=0:K=Math.min(V,q),$<=270&&U>=270||$>270&&U>=630?te=-1:j>=0&&Y>=0?te=0:te=Math.min(j,Y),U>=360?ne=1:V<=0&&q<=0?ne=0:ne=Math.max(V,q),[K,te,ne,se]}function W(Z,J){var N=function($){return a.angleDist(Z,$)},H=a.findIndexOfMin(J,N);return J[H]}function X(Z,J,N){return J?(Z.attr("display",null),Z.attr(N)):Z&&Z.attr("display","none"),Z}}}),uj=de({"src/plots/polar/layout_attributes.js"(e,r){"use strict";var t=Jo(),i=Mu(),a=Is().attributes,o=Qt().extendFlat,s=Ps().overrideAll,l=s({color:i.color,showline:o({},i.showline,{dflt:!0}),linecolor:i.linecolor,linewidth:i.linewidth,showgrid:o({},i.showgrid,{dflt:!0}),gridcolor:i.gridcolor,gridwidth:i.gridwidth,griddash:i.griddash},"plot","from-root"),n=s({tickmode:i.minor.tickmode,nticks:i.nticks,tick0:i.tick0,dtick:i.dtick,tickvals:i.tickvals,ticktext:i.ticktext,ticks:i.ticks,ticklen:i.ticklen,tickwidth:i.tickwidth,tickcolor:i.tickcolor,ticklabelstep:i.ticklabelstep,showticklabels:i.showticklabels,labelalias:i.labelalias,minorloglabels:i.minorloglabels,showtickprefix:i.showtickprefix,tickprefix:i.tickprefix,showticksuffix:i.showticksuffix,ticksuffix:i.ticksuffix,showexponent:i.showexponent,exponentformat:i.exponentformat,minexponent:i.minexponent,separatethousands:i.separatethousands,tickfont:i.tickfont,tickangle:i.tickangle,tickformat:i.tickformat,tickformatstops:i.tickformatstops,layer:i.layer},"plot","from-root"),u={visible:o({},i.visible,{dflt:!0}),type:o({},i.type,{values:["-","linear","log","date","category"]}),autotypenumbers:i.autotypenumbers,autorangeoptions:{minallowed:i.autorangeoptions.minallowed,maxallowed:i.autorangeoptions.maxallowed,clipmin:i.autorangeoptions.clipmin,clipmax:i.autorangeoptions.clipmax,include:i.autorangeoptions.include,editType:"plot"},autorange:o({},i.autorange,{editType:"plot"}),rangemode:{valType:"enumerated",values:["tozero","nonnegative","normal"],dflt:"tozero",editType:"calc"},minallowed:o({},i.minallowed,{editType:"plot"}),maxallowed:o({},i.maxallowed,{editType:"plot"}),range:o({},i.range,{items:[{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}}],editType:"plot"}),categoryorder:i.categoryorder,categoryarray:i.categoryarray,angle:{valType:"angle",editType:"plot"},autotickangles:i.autotickangles,side:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"clockwise",editType:"plot"},title:{text:o({},i.title.text,{editType:"plot",dflt:""}),font:o({},i.title.font,{editType:"plot"}),editType:"plot"},hoverformat:i.hoverformat,uirevision:{valType:"any",editType:"none"},editType:"calc"};o(u,l,n);var c={visible:o({},i.visible,{dflt:!0}),type:{valType:"enumerated",values:["-","linear","category"],dflt:"-",editType:"calc",_noTemplating:!0},autotypenumbers:i.autotypenumbers,categoryorder:i.categoryorder,categoryarray:i.categoryarray,thetaunit:{valType:"enumerated",values:["radians","degrees"],dflt:"degrees",editType:"calc"},period:{valType:"number",editType:"calc",min:0},direction:{valType:"enumerated",values:["counterclockwise","clockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"angle",editType:"calc"},hoverformat:i.hoverformat,uirevision:{valType:"any",editType:"none"},editType:"calc"};o(c,l,n),r.exports={domain:a({name:"polar",editType:"plot"}),sector:{valType:"info_array",items:[{valType:"number",editType:"plot"},{valType:"number",editType:"plot"}],dflt:[0,360],editType:"plot"},hole:{valType:"number",min:0,max:1,dflt:0,editType:"plot"},bgcolor:{valType:"color",editType:"plot",dflt:t.background},radialaxis:u,angularaxis:c,gridshape:{valType:"enumerated",values:["circular","linear"],dflt:"circular",editType:"plot"},uirevision:{valType:"any",editType:"none"},editType:"calc"}}}),Eue=de({"src/plots/polar/layout_defaults.js"(e,r){"use strict";var t=Qt(),i=ta(),a=Ro(),o=Ev(),s=$u().getSubplotData,l=_v(),n=f1(),u=h0(),c=d0(),f=Ow(),h=Ry(),d=LE(),p=h1(),g=uj(),m=oj(),y=BS(),_=y.axisNames;function v(S,M,C,w){var k=C("bgcolor");w.bgColor=i.combine(k,w.paper_bgcolor);var A=C("sector");C("hole");var b=s(w.fullData,y.name,w.id),E=w.layoutOut,T;function F(ne,se){return C(T+"."+ne,se)}for(var D=0;D<_.length;D++){T=_[D],t.isPlainObject(S[T])||(S[T]={});var R=S[T],P=a.newContainer(M,T);P._id=P._name=T,P._attr=w.id+"."+T,P._traceIndices=b.map(function(ne){return ne.index});var z=y.axisName2dataArray[T],I=x(R,P,F,b,z,w);f(R,P,F,{axData:b,dataAttr:z});var L=F("visible");switch(m(P,M,E),F("uirevision",M.uirevision),P._m=1,T){case"radialaxis":F("minallowed"),F("maxallowed");var B=F("range"),O=P.getAutorangeDflt(B),G=F("autorange",O),W;B&&(B[0]===null&&B[1]===null||(B[0]===null||B[1]===null)&&(G==="reversed"||G===!0)||B[0]!==null&&(G==="min"||G==="max reversed")||B[1]!==null&&(G==="max"||G==="min reversed"))&&(B=void 0,delete P.range,P.autorange=!0,W=!0),W||(O=P.getAutorangeDflt(B),G=F("autorange",O)),R.autorange=G,G&&(d(F,G,B),(I==="linear"||I==="-")&&F("rangemode"),P.isReversed()&&(P._m=-1)),P.cleanRange("range",{dfltRange:[0,1]});break;case"angularaxis":if(I==="date"){t.log("Polar plots do not support date angular axes yet.");for(var X=0;X")}}r.exports={hoverPoints:i,makeHoverPointText:a}}}),Due=de({"src/traces/scatterpolar/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:NS(),categories:["polar","symbols","showLegend","scatter-like"],attributes:W2(),supplyDefaults:jS().supplyDefaults,colorbar:Yu(),formatLabels:US(),calc:kue(),plot:Cue(),style:lf().style,styleOnSelect:lf().styleOnSelect,hoverPoints:qS().hoverPoints,selectPoints:Mv(),meta:{}}}}),Lue=de({"lib/scatterpolar.js"(e,r){"use strict";r.exports=Due()}}),cj=de({"src/traces/scatterpolargl/attributes.js"(e,r){"use strict";var t=W2(),{cliponaxis:i,hoveron:a}=t,o=Lr(t,["cliponaxis","hoveron"]),{connectgaps:s,line:{color:l,dash:n,width:u},fill:c,fillcolor:f,marker:h,textfont:d,textposition:p}=__();r.exports=ar(Ot({},o),{connectgaps:s,fill:c,fillcolor:f,line:{color:l,dash:n,editType:"calc",width:u},marker:h,textfont:d,textposition:p})}}),Fue=de({"src/traces/scatterpolargl/defaults.js"(e,r){"use strict";var t=Qt(),i=bs(),a=jS().handleRThetaDefaults,o=Nh(),s=yd(),l=_d(),n=Jd(),u=Zd().PTS_LINESONLY,c=cj();r.exports=function(h,d,p,g){function m(_,v){return t.coerce(h,d,c,_,v)}var y=a(h,d,g,m);if(!y){d.visible=!1;return}m("thetaunit"),m("mode",y=n&&(w.marker.cluster=x.tree),w.marker&&(w.markerSel.positions=w.markerUnsel.positions=w.marker.positions=E),w.line&&E.length>1&&l.extendFlat(w.line,s.linePositions(f,v,E)),w.text&&(l.extendFlat(w.text,{positions:E},s.textPosition(f,v,w.text,w.marker)),l.extendFlat(w.textSel,{positions:E},s.textPosition(f,v,w.text,w.markerSel)),l.extendFlat(w.textUnsel,{positions:E},s.textPosition(f,v,w.text,w.markerUnsel))),w.fill&&!m.fill2d&&(m.fill2d=!0),w.marker&&!m.scatter2d&&(m.scatter2d=!0),w.line&&!m.line2d&&(m.line2d=!0),w.text&&!m.glText&&(m.glText=!0),m.lineOptions.push(w.line),m.fillOptions.push(w.fill),m.markerOptions.push(w.marker),m.markerSelectedOptions.push(w.markerSel),m.markerUnselectedOptions.push(w.markerUnsel),m.textOptions.push(w.text),m.textSelectedOptions.push(w.textSel),m.textUnselectedOptions.push(w.textUnsel),m.selectBatch.push([]),m.unselectBatch.push([]),x.x=T,x.y=F,x.rawx=T,x.rawy=F,x.r=M,x.theta=C,x.positions=E,x._scene=m,x.index=m.count,m.count++}}),a(f,h,d)}},r.exports.reglPrecompiled=u}}),Oue=de({"src/traces/scatterpolargl/index.js"(e,r){"use strict";var t=zue();t.plot=Bue(),r.exports=t}}),Nue=de({"lib/scatterpolargl.js"(e,r){"use strict";r.exports=Oue()}}),fj=de({"src/traces/barpolar/attributes.js"(e,r){"use strict";var{hovertemplateAttrs:t,templatefallbackAttrs:i}=Vo(),a=fn().extendFlat,o=W2(),s=ep();r.exports={r:o.r,theta:o.theta,r0:o.r0,dr:o.dr,theta0:o.theta0,dtheta:o.dtheta,thetaunit:o.thetaunit,base:a({},s.base,{}),offset:a({},s.offset,{}),width:a({},s.width,{}),text:a({},s.text,{}),hovertext:a({},s.hovertext,{}),marker:l(),hoverinfo:o.hoverinfo,hovertemplate:t(),hovertemplatefallback:i(),selected:s.selected,unselected:s.unselected};function l(){var n=a({},s.marker);return delete n.cornerradius,n}}}),hj=de({"src/traces/barpolar/layout_attributes.js"(e,r){"use strict";r.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}}}),jue=de({"src/traces/barpolar/defaults.js"(e,r){"use strict";var t=Qt(),i=jS().handleRThetaDefaults,a=Ww(),o=fj();r.exports=function(l,n,u,c){function f(d,p){return t.coerce(l,n,o,d,p)}var h=i(l,n,c,f);if(!h){n.visible=!1;return}f("thetaunit"),f("base"),f("offset"),f("width"),f("text"),f("hovertext"),f("hovertemplate"),f("hovertemplatefallback"),a(l,n,f,u,c),t.coerceSelectionMarkerOpacity(n,f)}}}),Uue=de({"src/traces/barpolar/layout_defaults.js"(e,r){"use strict";var t=Qt(),i=hj();r.exports=function(a,o,s){var l={},n;function u(h,d){return t.coerce(a[n]||{},o[n],i,h,d)}for(var c=0;c0?(g=d,m=p):(g=p,m=d);var y=s.findEnclosingVertexAngles(g,n.vangles)[0],_=s.findEnclosingVertexAngles(m,n.vangles)[1],v=[y,(g+m)/2,_];return s.pathPolygonAnnulus(f,h,g,m,v,u,c)}:function(f,h,d,p){return a.pathAnnulus(f,h,d,p,u,c)}}}}),Vue=de({"src/traces/barpolar/hover.js"(e,r){"use strict";var t=$s(),i=Qt(),a=y1().getTraceColor,o=i.fillText,s=qS().makeHoverPointText,l=OS().isPtInsidePolygon;r.exports=function(u,c,f){var h=u.cd,d=h[0].trace,p=u.subplot,g=p.radialAxis,m=p.angularAxis,y=p.vangles,_=y?l:i.isPtInsideSector,v=u.maxHoverDistance,x=m._period||2*Math.PI,S=Math.abs(g.g2p(Math.sqrt(c*c+f*f))),M=Math.atan2(f,c);g.range[0]>g.range[1]&&(M+=Math.PI);var C=function(b){return _(S,M,[b.rp0,b.rp1],[b.thetag0,b.thetag1],y)?v+Math.min(1,Math.abs(b.thetag1-b.thetag0)/x)-1+(b.rp1-S)/(b.rp1-b.rp0)-1:1/0};if(t.getClosest(h,C,u),u.index!==!1){var w=u.index,k=h[w];u.x0=u.x1=k.ct[0],u.y0=u.y1=k.ct[1];var A=i.extendFlat({},k,{r:k.s,theta:k.p});return o(k,d,u),s(A,d,p,u),u.hovertemplate=d.hovertemplate,u.color=a(d,k),u.xLabelVal=u.yLabelVal=void 0,k.s<0&&(u.idealAlign="left"),[u]}}}}),Gue=de({"src/traces/barpolar/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"barpolar",basePlotModule:NS(),categories:["polar","bar","showLegend"],attributes:fj(),layoutAttributes:hj(),supplyDefaults:jue(),supplyLayoutDefaults:Uue(),calc:dj().calc,crossTraceCalc:dj().crossTraceCalc,plot:que(),colorbar:Yu(),formatLabels:US(),style:qh().style,styleOnSelect:qh().styleOnSelect,hoverPoints:Vue(),selectPoints:_1(),meta:{}}}}),Hue=de({"lib/barpolar.js"(e,r){"use strict";r.exports=Gue()}}),pj=de({"src/plots/smith/constants.js"(e,r){"use strict";r.exports={attr:"subplot",name:"smith",axisNames:["realaxis","imaginaryaxis"],axisName2dataArray:{imaginaryaxis:"imag",realaxis:"real"}}}}),vj=de({"src/plots/smith/layout_attributes.js"(e,r){"use strict";var t=Jo(),i=Mu(),a=Is().attributes,o=Qt().extendFlat,s=Ps().overrideAll,l=s({color:i.color,showline:o({},i.showline,{dflt:!0}),linecolor:i.linecolor,linewidth:i.linewidth,showgrid:o({},i.showgrid,{dflt:!0}),gridcolor:i.gridcolor,gridwidth:i.gridwidth,griddash:i.griddash},"plot","from-root"),n=s({ticklen:i.ticklen,tickwidth:o({},i.tickwidth,{dflt:2}),tickcolor:i.tickcolor,showticklabels:i.showticklabels,labelalias:i.labelalias,showtickprefix:i.showtickprefix,tickprefix:i.tickprefix,showticksuffix:i.showticksuffix,ticksuffix:i.ticksuffix,tickfont:i.tickfont,tickformat:i.tickformat,hoverformat:i.hoverformat,layer:i.layer},"plot","from-root"),u=o({visible:o({},i.visible,{dflt:!0}),tickvals:{dflt:[.2,.5,1,2,5],valType:"data_array",editType:"plot"},tickangle:o({},i.tickangle,{dflt:90}),ticks:{valType:"enumerated",values:["top","bottom",""],editType:"ticks"},side:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},editType:"calc"},l,n),c=o({visible:o({},i.visible,{dflt:!0}),tickvals:{valType:"data_array",editType:"plot"},ticks:i.ticks,editType:"calc"},l,n);r.exports={domain:a({name:"smith",editType:"plot"}),bgcolor:{valType:"color",editType:"plot",dflt:t.background},realaxis:u,imaginaryaxis:c,editType:"calc"}}}),$ue=de({"src/plots/smith/layout_defaults.js"(e,r){"use strict";var t=Qt(),i=ta(),a=Ro(),o=Ev(),s=$u().getSubplotData,l=d0(),n=h0(),u=Ry(),c=Yd(),f=vj(),h=pj(),d=h.axisNames,p=m(function(y){return t.isTypedArray(y)&&(y=Array.from(y)),y.slice().reverse().map(function(_){return-_}).concat([0]).concat(y)},String);function g(y,_,v,x){var S=v("bgcolor");x.bgColor=i.combine(S,x.paper_bgcolor);var M=s(x.fullData,h.name,x.id),C=x.layoutOut,w;function k(O,G){return v(w+"."+O,G)}for(var A=0;A")}}r.exports={hoverPoints:i,makeHoverPointText:a}}}),Que=de({"src/traces/scattersmith/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"scattersmith",basePlotModule:Wue(),categories:["smith","symbols","showLegend","scatter-like"],attributes:mj(),supplyDefaults:Yue(),colorbar:Yu(),formatLabels:Xue(),calc:Zue(),plot:Kue(),style:lf().style,styleOnSelect:lf().styleOnSelect,hoverPoints:Jue().hoverPoints,selectPoints:Mv(),meta:{}}}}),ece=de({"lib/scattersmith.js"(e,r){"use strict";r.exports=Que()}}),gj=de({"src/traces/quiver/attributes.js"(e,r){"use strict";var t=ri(),i=Vo().hovertemplateAttrs,a=Ns().axisHoverFormat,o=fn().extendFlat,s=cs(),l=fu().dash,n=g0(),u=tl(),c={x:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},x0:u.x0,dx:u.dx,y:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},y0:u.y0,dy:u.dy,u:{valType:"data_array",editType:"calc",anim:!0},v:{valType:"data_array",editType:"calc",anim:!0},arrowref:{valType:"enumerated",values:["paper","data"],dflt:"data",editType:"calc"},lengthmode:{valType:"enumerated",values:["scaled","raw"],editType:"calc",dflt:"scaled"},lengthfactor:{valType:"number",min:0,editType:"calc",dflt:1},anchor:{valType:"enumerated",values:["tip","tail","center"],dflt:"tail",editType:"calc"},xhoverformat:a("x"),yhoverformat:a("y"),uhoverformat:a("u","noDate"),vhoverformat:a("v","noDate"),hoverinfo:o({},t.hoverinfo,{flags:["x","y","u","v","text","name"],dflt:"all"}),hovertemplate:i({},{keys:["x","y","u","v","text","name"]}),text:u.text,textposition:u.textposition,textfont:u.textfont,marker:o({arrowsize:o({},n.arrowsize,{editType:"calc"}),line:{width:{valType:"number",min:0,dflt:2,editType:"style"},dash:l,editType:"style"},editType:"calc"},s("marker",{showScaleDflt:!0,editTypeOverride:"calc"})),selected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},unselected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"}};r.exports=c}}),tce=de({"src/traces/quiver/defaults.js"(e,r){"use strict";var t=Qt(),i=gj(),a=wv(),o=Wu().hasColorscale,s=hu();r.exports=function(n,u,c,f){function h(S,M){return t.coerce(n,u,i,S,M)}var d=a(n,u,f,h);if(!d){u.visible=!1;return}var p=h("u"),g=h("v");if(!t.isArrayOrTypedArray(p)||p.length===0){u.u=new Array(d);for(var m=0;mR&&(R=p[W]),g[W]z&&(z=g[W]),NL&&(L=N),HO&&(O=H);var $=Math.sqrt(N*N+H*H);if($>v&&(v=$),$<_&&(_=$),C){var U=M[W];X.mc=U,a(U)&&(US&&(S=U))}}else X.x=o,X.y=o}if(f._maxNorm=v,b==="scaled"||E==="paper"){let le=R-D,ce=z-P;var V;le===0&&ce===0?V=1:V=(le+ce+Math.sqrt((le-ce)*(le-ce)+4*G*le*ce))/(2*(G-1)),V*=n,f._scaleFactor=V/f._maxNorm}else f._scaleFactor=1;f._scaleFactor*=f.lengthfactor;let j=new Array(m),q=new Array(m),Y=new Array(m),K=new Array(m);for(var te,ne,W=0;Wg.i&&isFinite(m[g.i]))y=m[g.i];else{var _=h.u&&h.u[g.i]||0,v=h.v&&h.v[g.i]||0;y=Math.sqrt(_*_+v*v)}return g.mcc=p(y),g.mcc})}function n(f){var h=t.select(f).selectAll("g.trace.quiver");h.each(function(d){c(f,d,t.select(this))})}function u(f,h,d){c(f,h,d)}function c(f,h,d){var p=h[0].trace,g=p.marker||{},m=g.line||{},y=i.isArrayOrTypedArray(g.color)?void 0:g.color,_=p._hasColorscale;if(d)if(p.selectedpoints){var v=(p.selected||{}).marker||{},x=(p.unselected||{}).marker||{},S=v.line||{},M=x.line||{};d.selectAll("path.js-line").each(function(w){var k=t.select(this),A=!w.selected,b=A?x.color:v.color,E=A?M.width!==void 0?M.width:m.width:S.width!==void 0?S.width:m.width;b?(a.lineGroupStyle(k,E,b,m.dash),k.style("stroke-opacity",1)):(a.lineGroupStyle(k,E,y,m.dash),_&&l(k,p),k.style("stroke-opacity",A?s:1))}),a.selectedTextStyle(d.selectAll("text"),p)}else{var C=d.selectAll("path.js-line");C.call(a.lineGroupStyle,m.width,y,m.dash),_&&l(C,p),C.style("stroke-opacity",1),a.textPointStyle(d.selectAll("text"),p,f)}}r.exports={style:n,styleOnSelect:u,colorscaleStroke:l}}}),ace=de({"src/traces/quiver/plot.js"(e,r){"use strict";var t=Yr(),i=Qt(),a=hn(),o=VS().colorscaleStroke,s=Math.PI/12,l=5.8,n=1.5,u=.7;r.exports=function(h,d,p,g,m,y){var _,v,x=!m,S=!!m&&m.duration>0;if(_=g.selectAll("g.trace").data(p,function(C){return C[0].trace.uid}),_.enter().append("g").attr("class",function(C){return"trace quiver trace"+C[0].trace.uid}).style("stroke-miterlimit",2),_.order(),S){y&&(v=y());var M=t.transition().duration(m.duration).ease(m.easing).each("end",function(){v&&v()}).each("interrupt",function(){v&&v()});M.each(function(){g.selectAll("g.trace").each(function(C,w){c(h,w,d,C,p,this,m)})})}else _.each(function(C,w){c(h,w,d,C,p,this,m)});x&&_.exit().remove()};function c(f,h,d,p,g,m,y){var _=p[0].trace,v=d.xaxis,x=d.yaxis;p[0][d.isRangePlot?"nodeRangePlot3":"node3"]=t.select(m);var S=t.select(m).selectAll("g.lines").data([p]);S.enter().append("g").classed("lines",!0),a.setClipUrl(S,d.layerClipId,f);var M=S.selectAll("path.js-line").data(p);M.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke"),M.exit().remove();let{anchor:C,maxNorm:w=0,arrowref:k}=_,A=k==="paper"?_._scaleFactor*Math.sqrt(Math.abs(v._m*x._m)):_._scaleFactor,b=_.marker.arrowsize;M.each(function(z){let I=t.select(this);if(z.x===void 0||z.y===void 0){I.attr("d",null);return}let L=(k==="paper"?z._u*Math.sign(v._m):t.round(v._m*z._u))*A,B=(k==="paper"?z._v*Math.sign(x._m):t.round(x._m*z._v))*A,O=(_._input.marker||{}).arrowsize!==void 0;var G,W,X,Z;C==="tip"?(G=v.c2p(z.x)-L,X=x.c2p(z.y)-B,W=v.c2p(z.x),Z=x.c2p(z.y)):C==="center"?(G=v.c2p(z.x)-L/2,X=x.c2p(z.y)-B/2,W=v.c2p(z.x)+L/2,Z=x.c2p(z.y)+B/2):(G=v.c2p(z.x),X=x.c2p(z.y),W=v.c2p(z.x)+L,Z=x.c2p(z.y)+B),z._px0=G,z._py0=X,z._px1=W,z._py1=Z;var J=_.marker.line.width;O||(J=Math.max(J,n));let N=Math.sqrt((W-G)*(W-G)+(Z-X)*(Z-X)),H=u*N,$=Math.min(l*b*J,H),U=Math.atan2(Z-X,W-G),V=W-$*Math.cos(U-s),j=Z-$*Math.sin(U-s),q=W-$*Math.cos(U+s),Y=Z-$*Math.sin(U+s),K="M"+G+","+X+"L"+W+","+Z+"L"+V+","+j+"L"+W+","+Z+"L"+q+","+Y;I.attr("d",K)});var E=_.marker||{},T=E.line||{},F=i.isArrayOrTypedArray(E.color)?void 0:E.color;a.lineGroupStyle(M,T.width,F,T.dash),_._hasColorscale&&o(M,_);var D=t.select(m).selectAll("g.text").data([p]);D.enter().append("g").classed("text",!0),a.setClipUrl(D,d.layerClipId,f);var R=D.selectAll("g.textpoint").data(p);if(R.enter().append("g").classed("textpoint",!0).append("text"),R.exit().remove(),R.each(function(z){var I=t.select(this),L=a.translatePoint(z,I.select("text"),v,x);L||I.remove()}),R.selectAll("text").call(a.textPointStyle,_,f).each(function(z){var I=v.c2p(z.x),L=x.c2p(z.y);t.select(this).selectAll("tspan.line").each(function(){t.select(this).attr({x:I,y:L})})}),y&&y.duration>0){var P=t.transition().duration(y.duration).ease(y.easing);M.transition(P).style("opacity",1)}}}}),nce=de({"src/traces/quiver/hover.js"(e,r){"use strict";var t=Qt(),i=$s(),a=m1();function o(s,l,n,u,c,f){let h=c-n,d=f-u,p=h*h+d*d;if(!p)return Math.sqrt((s-n)*(s-n)+(l-u)*(l-u));var g=((s-n)*h+(l-u)*d)/p;g=Math.max(0,Math.min(1,g));let m=n+g*h,y=u+g*d;return Math.sqrt((s-m)*(s-m)+(l-y)*(l-y))}r.exports=function(l,n,u,c){var f=l.cd,h=f[0].trace,d=l.xa,p=l.ya,g=d.c2p(n),m=p.c2p(u),y=function(k){return k._px0===void 0?1/0:o(g,m,k._px0,k._py0,k._px1,k._py1)};if(i.getClosest(f,y,l),l.index!==!1){var _=f[l.index],v=d.c2p(_.x,!0),x=p.c2p(_.y,!0),S=Math.sqrt((g-v)*(g-v)+(m-x)*(m-x));l.index=_.i;var M=h.u?h.u[_.i]:0,C=h.v?h.v[_.i]:0,w="u: "+M+", v: "+C;return t.extendFlat(l,{color:a(h,_),x0:v-3,x1:v+3,xLabelVal:_.x,y0:x-3,y1:x+3,yLabelVal:_.y,uLabelVal:M,vLabelVal:C,extraText:w,spikeDistance:S,hovertemplate:h.hovertemplate}),t.fillText(_,h,l),[l]}}}}),oce=de({"src/traces/quiver/format_labels.js"(e,r){"use strict";var t=nn(),i=Qt();r.exports=function(o,s,l){var n={},u={_fullLayout:l},c=t.getFromTrace(u,s,"x"),f=t.getFromTrace(u,s,"y"),h=o.x,d=o.y;n.xLabel=t.tickText(c,c.c2l(h),!0).text,n.yLabel=t.tickText(f,f.c2l(d),!0).text;var p=s.u?s.u[o.i]:0,g=s.v?s.v[o.i]:0,m=s.uhoverformat,y=s.vhoverformat;return n.uLabel=m?i.numberFormat(m)(p):String(p),n.vLabel=y?i.numberFormat(y)(g):String(g),n}}}),sce=de({"src/traces/quiver/event_data.js"(e,r){"use strict";r.exports=function(i,a,o,s,l){return i.x=a.x,i.y=a.y,i.u=o.u?o.u[l]:void 0,i.v=o.v?o.v[l]:void 0,i}}}),lce=de({"src/traces/quiver/index.js"(e,r){"use strict";r.exports={moduleType:"trace",name:"quiver",basePlotModule:ml(),categories:["cartesian","svg","showLegend","scatter-like","zoomScale"],attributes:gj(),supplyDefaults:tce(),calc:rce(),crossTraceCalc:ice(),plot:ace(),style:VS().style,styleOnSelect:VS().styleOnSelect,hoverPoints:nce(),formatLabels:oce(),eventData:sce(),selectPoints:Mv(),colorbar:Yu(),animatable:!0,meta:{}}}}),uce=de({"lib/quiver.js"(e,r){"use strict";r.exports=lce()}}),_c=de({"node_modules/world-calendars/dist/main.js"(e,r){var t=du();function i(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}t(i.prototype,{instance:function(u,c){u=(u||"gregorian").toLowerCase(),c=c||"";var f=this._localCals[u+"-"+c];if(!f&&this.calendars[u]&&(f=new this.calendars[u](c),this._localCals[u+"-"+c]=f),!f)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,u);return f},newDate:function(u,c,f,h,d){return h=(u!=null&&u.year?u.calendar():typeof h=="string"?this.instance(h,d):h)||this.instance(),h.newDate(u,c,f)},substituteDigits:function(u){return function(c){return(c+"").replace(/[0-9]/g,function(f){return u[f]})}},substituteChineseDigits:function(u,c){return function(f){for(var h="",d=0;f>0;){var p=f%10;h=(p===0?"":u[p]+c[d])+h,d++,f=Math.floor(f/10)}return h.indexOf(u[1]+c[1])===0&&(h=h.substr(1)),h||u[0]}}});function a(u,c,f,h){if(this._calendar=u,this._year=c,this._month=f,this._day=h,this._calendar._validateLevel===0&&!this._calendar.isValid(this._year,this._month,this._day))throw(n.local.invalidDate||n.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(u,c){return u=""+u,"000000".substring(0,c-u.length)+u}t(a.prototype,{newDate:function(u,c,f){return this._calendar.newDate(u??this,c,f)},year:function(u){return arguments.length===0?this._year:this.set(u,"y")},month:function(u){return arguments.length===0?this._month:this.set(u,"m")},day:function(u){return arguments.length===0?this._day:this.set(u,"d")},date:function(u,c,f){if(!this._calendar.isValid(u,c,f))throw(n.local.invalidDate||n.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=u,this._month=c,this._day=f,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(u,c){return this._calendar.add(this,u,c)},set:function(u,c){return this._calendar.set(this,u,c)},compareTo:function(u){if(this._calendar.name!==u._calendar.name)throw(n.local.differentCalendars||n.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,u._calendar.local.name);var c=this._year!==u._year?this._year-u._year:this._month!==u._month?this.monthOfYear()-u.monthOfYear():this._day-u._day;return c===0?0:c<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(u){return this._calendar.fromJD(u)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(u){return this._calendar.fromJSDate(u)},toString:function(){return(this.year()<0?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}});function s(){this.shortYearCutoff="+10"}t(s.prototype,{_validateLevel:0,newDate:function(u,c,f){return u==null?this.today():(u.year&&(this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate),f=u.day(),c=u.month(),u=u.year()),new a(this,u,c,f))},today:function(){return this.fromJSDate(new Date)},epoch:function(u){var c=this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return c.year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(u){var c=this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return(c.year()<0?"-":"")+o(Math.abs(c.year()),4)},monthsInYear:function(u){return this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear),12},monthOfYear:function(u,c){var f=this._validate(u,c,this.minDay,n.local.invalidMonth||n.regionalOptions[""].invalidMonth);return(f.month()+this.monthsInYear(f)-this.firstMonth)%this.monthsInYear(f)+this.minMonth},fromMonthOfYear:function(u,c){var f=(c+this.firstMonth-2*this.minMonth)%this.monthsInYear(u)+this.minMonth;return this._validate(u,f,this.minDay,n.local.invalidMonth||n.regionalOptions[""].invalidMonth),f},daysInYear:function(u){var c=this._validate(u,this.minMonth,this.minDay,n.local.invalidYear||n.regionalOptions[""].invalidYear);return this.leapYear(c)?366:365},dayOfYear:function(u,c,f){var h=this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate);return h.toJD()-this.newDate(h.year(),this.fromMonthOfYear(h.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(u,c,f){var h=this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(h))+2)%this.daysInWeek()},extraInfo:function(u,c,f){return this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate),{}},add:function(u,c,f){return this._validate(u,this.minMonth,this.minDay,n.local.invalidDate||n.regionalOptions[""].invalidDate),this._correctAdd(u,this._add(u,c,f),c,f)},_add:function(u,c,f){if(this._validateLevel++,f==="d"||f==="w"){var h=u.toJD()+c*(f==="w"?this.daysInWeek():1),d=u.calendar().fromJD(h);return this._validateLevel--,[d.year(),d.month(),d.day()]}try{var p=u.year()+(f==="y"?c:0),g=u.monthOfYear()+(f==="m"?c:0),d=u.day(),m=function(v){for(;gx-1+v.minMonth;)p++,g-=x,x=v.monthsInYear(p)};f==="y"?(u.month()!==this.fromMonthOfYear(p,g)&&(g=this.newDate(p,u.month(),this.minDay).monthOfYear()),g=Math.min(g,this.monthsInYear(p)),d=Math.min(d,this.daysInMonth(p,this.fromMonthOfYear(p,g)))):f==="m"&&(m(this),d=Math.min(d,this.daysInMonth(p,this.fromMonthOfYear(p,g))));var y=[p,this.fromMonthOfYear(p,g),d];return this._validateLevel--,y}catch(_){throw this._validateLevel--,_}},_correctAdd:function(u,c,f,h){if(!this.hasYearZero&&(h==="y"||h==="m")&&(c[0]===0||u.year()>0!=c[0]>0)){var d={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[h],p=f<0?-1:1;c=this._add(u,f*d[0]+p*d[1],d[2])}return u.date(c[0],c[1],c[2])},set:function(u,c,f){this._validate(u,this.minMonth,this.minDay,n.local.invalidDate||n.regionalOptions[""].invalidDate);var h=f==="y"?c:u.year(),d=f==="m"?c:u.month(),p=f==="d"?c:u.day();return(f==="y"||f==="m")&&(p=Math.min(p,this.daysInMonth(h,d))),u.date(h,d,p)},isValid:function(u,c,f){this._validateLevel++;var h=this.hasYearZero||u!==0;if(h){var d=this.newDate(u,c,this.minDay);h=c>=this.minMonth&&c-this.minMonth=this.minDay&&f-this.minDay13.5?13:1),_=d-(y>2.5?4716:4715);return _<=0&&_--,this.newDate(_,y,m)},toJSDate:function(u,c,f){var h=this._validate(u,c,f,n.local.invalidDate||n.regionalOptions[""].invalidDate),d=new Date(h.year(),h.month()-1,h.day());return d.setHours(0),d.setMinutes(0),d.setSeconds(0),d.setMilliseconds(0),d.setHours(d.getHours()>12?d.getHours()+2:0),d},fromJSDate:function(u){return this.newDate(u.getFullYear(),u.getMonth()+1,u.getDate())}});var n=r.exports=new i;n.cdate=a,n.baseCalendar=s,n.calendars.gregorian=l}}),cce=de({"node_modules/world-calendars/dist/plus.js"(){var e=du(),r=_c();e(r.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),r.local=r.regionalOptions[""],e(r.cdate.prototype,{formatDate:function(t,i){return typeof t!="string"&&(i=t,t=""),this._calendar.formatDate(t||"",this,i)}}),e(r.baseCalendar.prototype,{UNIX_EPOCH:r.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:1440*60,TICKS_EPOCH:r.instance().jdEpoch,TICKS_PER_DAY:1440*60*1e7,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,i,a){if(typeof t!="string"&&(a=i,i=t,t=""),!i)return"";if(i.calendar()!==this)throw r.local.invalidFormat||r.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat,a=a||{};for(var o=a.dayNamesShort||this.local.dayNamesShort,s=a.dayNames||this.local.dayNames,l=a.monthNumbers||this.local.monthNumbers,n=a.monthNamesShort||this.local.monthNamesShort,u=a.monthNames||this.local.monthNames,c=a.calculateWeek||this.local.calculateWeek,f=function(M,C){for(var w=1;S+w1},h=function(M,C,w,k){var A=""+C;if(f(M,k))for(;A.length1},x=function(F,D){var R=v(F,D),P=[2,3,R?4:2,R?4:2,10,11,20]["oyYJ@!".indexOf(F)+1],z=new RegExp("^-?\\d{1,"+P+"}"),I=i.substring(A).match(z);if(!I)throw(r.local.missingNumberAt||r.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=I[0].length,parseInt(I[0],10)},S=this,M=function(){if(typeof u=="function"){v("m");var F=u.call(S,i.substring(A));return A+=F.length,F}return x("m")},C=function(F,D,R,P){for(var z=v(F,P)?R:D,I=0;I-1){p=1,g=m;for(var T=this.daysInMonth(d,p);g>T;T=this.daysInMonth(d,p))p++,g-=T}return h>-1?this.fromJD(h):this.newDate(d,p,g)},determineDate:function(t,i,a,o,s){a&&typeof a!="object"&&(s=o,o=a,a=null),typeof o!="string"&&(s=o,o="");var l=this,n=function(u){try{return l.parseDate(o,u,s)}catch{}u=u.toLowerCase();for(var c=(u.match(/^c/)&&a?a.newDate():null)||l.today(),f=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,h=f.exec(u);h;)c.add(parseInt(h[1],10),h[2]||"d"),h=f.exec(u);return c};return i=i?i.newDate():null,t=t==null?i:typeof t=="string"?n(t):typeof t=="number"?isNaN(t)||t===1/0||t===-1/0?i:l.today().add(t,"d"):l.newDate(t),t}})}}),fce=de({"node_modules/world-calendars/dist/calendars/chinese.js"(){var e=_c(),r=du(),t=e.instance();function i(h){this.local=this.regionalOptions[h||""]||this.regionalOptions[""]}i.prototype=new e.baseCalendar,r(i.prototype,{name:"Chinese",jdEpoch:17214255e-1,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(h,d){if(typeof h=="string"){var p=h.match(o);return p?p[0]:""}var g=this._validateYear(h),m=h.month(),y=""+this.toChineseMonth(g,m);return d&&y.length<2&&(y="0"+y),this.isIntercalaryMonth(g,m)&&(y+="i"),y},monthNames:function(h){if(typeof h=="string"){var d=h.match(s);return d?d[0]:""}var p=this._validateYear(h),g=h.month(),m=this.toChineseMonth(p,g),y=["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"][m-1];return this.isIntercalaryMonth(p,g)&&(y="\u95F0"+y),y},monthNamesShort:function(h){if(typeof h=="string"){var d=h.match(l);return d?d[0]:""}var p=this._validateYear(h),g=h.month(),m=this.toChineseMonth(p,g),y=["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D","\u5341","\u5341\u4E00","\u5341\u4E8C"][m-1];return this.isIntercalaryMonth(p,g)&&(y="\u95F0"+y),y},parseMonth:function(h,d){h=this._validateYear(h);var p=parseInt(d),g;if(isNaN(p))d[0]==="\u95F0"&&(g=!0,d=d.substring(1)),d[d.length-1]==="\u6708"&&(d=d.substring(0,d.length-1)),p=1+["\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D","\u4E03","\u516B","\u4E5D","\u5341","\u5341\u4E00","\u5341\u4E8C"].indexOf(d);else{var m=d[d.length-1];g=m==="i"||m==="I"}var y=this.toMonthIndex(h,p,g);return y},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(h,d){if(h.year&&(h=h.year()),typeof h!="number"||h<1888||h>2111)throw d.replace(/\{0\}/,this.local.name);return h},toMonthIndex:function(h,d,p){var g=this.intercalaryMonth(h),m=p&&d!==g;if(m||d<1||d>12)throw e.local.invalidMonth.replace(/\{0\}/,this.local.name);var y;return g?!p&&d<=g?y=d-1:y=d:y=d-1,y},toChineseMonth:function(h,d){h.year&&(h=h.year(),d=h.month());var p=this.intercalaryMonth(h),g=p?12:11;if(d<0||d>g)throw e.local.invalidMonth.replace(/\{0\}/,this.local.name);var m;return p?d>13;return p},isIntercalaryMonth:function(h,d){h.year&&(h=h.year(),d=h.month());var p=this.intercalaryMonth(h);return!!p&&p===d},leapYear:function(h){return this.intercalaryMonth(h)!==0},weekOfYear:function(h,d,p){var g=this._validateYear(h,e.local.invalidyear),m=u[g-u[0]],y=m>>9&4095,_=m>>5&15,v=m&31,x;x=t.newDate(y,_,v),x.add(4-(x.dayOfWeek()||7),"d");var S=this.toJD(h,d,p)-x.toJD();return 1+Math.floor(S/7)},monthsInYear:function(h){return this.leapYear(h)?13:12},daysInMonth:function(h,d){h.year&&(d=h.month(),h=h.year()),h=this._validateYear(h);var p=n[h-n[0]],g=p>>13,m=g?12:11;if(d>m)throw e.local.invalidMonth.replace(/\{0\}/,this.local.name);var y=p&1<<12-d?30:29;return y},weekDay:function(h,d,p){return(this.dayOfWeek(h,d,p)||7)<6},toJD:function(h,d,p){var g=this._validate(h,y,p,e.local.invalidDate);h=this._validateYear(g.year()),d=g.month(),p=g.day();var m=this.isIntercalaryMonth(h,d),y=this.toChineseMonth(h,d),_=f(h,y,p,m);return t.toJD(_.year,_.month,_.day)},fromJD:function(h){var d=t.fromJD(h),p=c(d.year(),d.month(),d.day()),g=this.toMonthIndex(p.year,p.month,p.isIntercalary);return this.newDate(p.year,g,p.day)},fromString:function(h){var d=h.match(a),p=this._validateYear(+d[1]),g=+d[2],m=!!d[3],y=this.toMonthIndex(p,g,m),_=+d[4];return this.newDate(p,y,_)},add:function(h,d,p){var g=h.year(),m=h.month(),y=this.isIntercalaryMonth(g,m),_=this.toChineseMonth(g,m),v=Object.getPrototypeOf(i.prototype).add.call(this,h,d,p);if(p==="y"){var x=v.year(),S=v.month(),M=this.isIntercalaryMonth(x,_),C=y&&M?this.toMonthIndex(x,_,!0):this.toMonthIndex(x,_,!1);C!==S&&v.month(C)}return v}});var a=/^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m,o=/^\d?\d[iI]?/m,s=/^闰?十?[一二三四五六七八九]?月/m,l=/^闰?十?[一二三四五六七八九]?/m;e.calendars.chinese=i;var n=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548],u=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904];function c(h,d,p,g){var m,y;if(typeof h=="object")m=h,y=d||{};else{var _=typeof h=="number"&&h>=1888&&h<=2111;if(!_)throw new Error("Solar year outside range 1888-2111");var v=typeof d=="number"&&d>=1&&d<=12;if(!v)throw new Error("Solar month outside range 1 - 12");var x=typeof p=="number"&&p>=1&&p<=31;if(!x)throw new Error("Solar day outside range 1 - 31");m={year:h,month:d,day:p},y=g||{}}var S=u[m.year-u[0]],M=m.year<<9|m.month<<5|m.day;y.year=M>=S?m.year:m.year-1,S=u[y.year-u[0]];var C=S>>9&4095,w=S>>5&15,k=S&31,A,b=new Date(C,w-1,k),E=new Date(m.year,m.month-1,m.day);A=Math.round((E-b)/(24*3600*1e3));var T=n[y.year-n[0]],F;for(F=0;F<13;F++){var D=T&1<<12-F?30:29;if(A>13;return!R||F=1888&&h<=2111;if(!v)throw new Error("Lunar year outside range 1888-2111");var x=typeof d=="number"&&d>=1&&d<=12;if(!x)throw new Error("Lunar month outside range 1 - 12");var S=typeof p=="number"&&p>=1&&p<=30;if(!S)throw new Error("Lunar day outside range 1 - 30");var M;typeof g=="object"?(M=!1,y=g):(M=!!g,y=m||{}),_={year:h,month:d,day:p,isIntercalary:M}}var C;C=_.day-1;var w=n[_.year-n[0]],k=w>>13,A;k&&(_.month>k||_.isIntercalary)?A=_.month:A=_.month-1;for(var b=0;b>9&4095,D=T>>5&15,R=T&31,P=new Date(F,D-1,R+C);return y.year=P.getFullYear(),y.month=1+P.getMonth(),y.day=P.getDate(),y}}}),hce=de({"node_modules/world-calendars/dist/calendars/coptic.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Coptic",jdEpoch:18250295e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(o){var a=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),o=a.year()+(a.year()<0?1:0);return o%4===3||o%4===-1},monthsInYear:function(i){return this._validate(i,this.minMonth,this.minDay,e.local.invalidYear||e.regionalOptions[""].invalidYear),13},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===13&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return(this.dayOfWeek(i,a,o)||7)<6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),i<0&&i++,s.day()+(s.month()-1)*30+(i-1)*365+Math.floor(i/4)+this.jdEpoch-1},fromJD:function(i){var a=Math.floor(i)+.5-this.jdEpoch,o=Math.floor((a-Math.floor((a+366)/1461))/365)+1;o<=0&&o--,a=Math.floor(i)+.5-this.newDate(o,1,1).toJD();var s=Math.floor(a/30)+1,l=a-(s-1)*30+1;return this.newDate(o,s,l)}}),e.calendars.coptic=t}}),dce=de({"node_modules/world-calendars/dist/calendars/discworld.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Discworld",jdEpoch:17214255e-1,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),!1},monthsInYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),13},daysInYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),400},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-l.dayOfWeek(),"d"),Math.floor((l.dayOfYear()-1)/8)+1},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return(l.day()+1)%8},weekDay:function(a,o,s){var l=this.dayOfWeek(a,o,s);return l>=2&&l<=6},extraInfo:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return{century:i[Math.floor((l.year()-1)/100)+1]||""}},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return a=l.year()+(l.year()<0?1:0),o=l.month(),s=l.day(),s+(o>1?16:0)+(o>2?(o-2)*32:0)+(a-1)*400+this.jdEpoch-1},fromJD:function(a){a=Math.floor(a+.5)-Math.floor(this.jdEpoch)-1;var o=Math.floor(a/400)+1;a-=(o-1)*400,a+=a>15?16:0;var s=Math.floor(a/32)+1,l=a-(s-1)*32+1;return this.newDate(o<=0?o-1:o,s,l)}});var i={20:"Fruitbat",21:"Anchovy"};e.calendars.discworld=t}}),pce=de({"node_modules/world-calendars/dist/calendars/ethiopian.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Ethiopian",jdEpoch:17242205e-1,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(o){var a=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),o=a.year()+(a.year()<0?1:0);return o%4===3||o%4===-1},monthsInYear:function(i){return this._validate(i,this.minMonth,this.minDay,e.local.invalidYear||e.regionalOptions[""].invalidYear),13},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===13&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return(this.dayOfWeek(i,a,o)||7)<6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),i<0&&i++,s.day()+(s.month()-1)*30+(i-1)*365+Math.floor(i/4)+this.jdEpoch-1},fromJD:function(i){var a=Math.floor(i)+.5-this.jdEpoch,o=Math.floor((a-Math.floor((a+366)/1461))/365)+1;o<=0&&o--,a=Math.floor(i)+.5-this.newDate(o,1,1).toJD();var s=Math.floor(a/30)+1,l=a-(s-1)*30+1;return this.newDate(o,s,l)}}),e.calendars.ethiopian=t}}),vce=de({"node_modules/world-calendars/dist/calendars/hebrew.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return this._leapYear(o.year())},_leapYear:function(a){return a=a<0?a+1:a,i(a*7+1,19)<7},monthsInYear:function(a){return this._validate(a,this.minMonth,this.minDay,e.local.invalidYear),this._leapYear(a.year?a.year():a)?13:12},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-l.dayOfWeek(),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return a=o.year(),this.toJD(a===-1?1:a+1,7,1)-this.toJD(a,7,1)},daysInMonth:function(a,o){return a.year&&(o=a.month(),a=a.year()),this._validate(a,o,this.minDay,e.local.invalidMonth),o===12&&this.leapYear(a)||o===8&&i(this.daysInYear(a),10)===5?30:o===9&&i(this.daysInYear(a),10)===3?29:this.daysPerMonth[o-1]},weekDay:function(a,o,s){return this.dayOfWeek(a,o,s)!==6},extraInfo:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);return{yearType:(this.leapYear(l)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(l)%10-3]}},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);a=l.year(),o=l.month(),s=l.day();var n=a<=0?a+1:a,u=this.jdEpoch+this._delay1(n)+this._delay2(n)+s+1;if(o<7){for(var c=7;c<=this.monthsInYear(a);c++)u+=this.daysInMonth(a,c);for(var c=1;c=this.toJD(o===-1?1:o+1,7,1);)o++;for(var s=athis.toJD(o,s,this.daysInMonth(o,s));)s++;var l=a-this.toJD(o,s,1)+1;return this.newDate(o,s,l)}});function i(a,o){return a-o*Math.floor(a/o)}e.calendars.hebrew=t}}),mce=de({"node_modules/world-calendars/dist/calendars/islamic.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Islamic",jdEpoch:19484395e-1,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012Bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(i){var a=this._validate(i,this.minMonth,this.minDay,e.local.invalidYear);return(a.year()*11+14)%30<11},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInYear:function(i){return this.leapYear(i)?355:354},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===12&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return this.dayOfWeek(i,a,o)!==5},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),a=s.month(),o=s.day(),i=i<=0?i+1:i,o+Math.ceil(29.5*(a-1))+(i-1)*354+Math.floor((3+11*i)/30)+this.jdEpoch-1},fromJD:function(i){i=Math.floor(i)+.5;var a=Math.floor((30*(i-this.jdEpoch)+10646)/10631);a=a<=0?a-1:a;var o=Math.min(12,Math.ceil((i-29-this.toJD(a,1,1))/29.5)+1),s=i-this.toJD(a,o,1)+1;return this.newDate(a,o,s)}}),e.calendars.islamic=t}}),gce=de({"node_modules/world-calendars/dist/calendars/julian.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Julian",jdEpoch:17214235e-1,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(o){var a=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),o=a.year()<0?a.year()+1:a.year();return o%4===0},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(4-(s.dayOfWeek()||7),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInMonth:function(i,a){var o=this._validate(i,a,this.minDay,e.local.invalidMonth);return this.daysPerMonth[o.month()-1]+(o.month()===2&&this.leapYear(o.year())?1:0)},weekDay:function(i,a,o){return(this.dayOfWeek(i,a,o)||7)<6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);return i=s.year(),a=s.month(),o=s.day(),i<0&&i++,a<=2&&(i--,a+=12),Math.floor(365.25*(i+4716))+Math.floor(30.6001*(a+1))+o-1524.5},fromJD:function(i){var a=Math.floor(i+.5),o=a+1524,s=Math.floor((o-122.1)/365.25),l=Math.floor(365.25*s),n=Math.floor((o-l)/30.6001),u=n-Math.floor(n<14?1:13),c=s-Math.floor(u>2?4716:4715),f=o-l-Math.floor(30.6001*n);return c<=0&&c--,this.newDate(c,u,f)}}),e.calendars.julian=t}}),yce=de({"node_modules/world-calendars/dist/calendars/mayan.js"(){var e=_c(),r=du();function t(o){this.local=this.regionalOptions[o||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(o){return this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),!1},formatYear:function(o){var s=this._validate(o,this.minMonth,this.minDay,e.local.invalidYear);o=s.year();var l=Math.floor(o/400);o=o%400,o+=o<0?400:0;var n=Math.floor(o/20);return l+"."+n+"."+o%20},forYear:function(o){if(o=o.split("."),o.length<3)throw"Invalid Mayan year";for(var s=0,l=0;l19||l>0&&n<0)throw"Invalid Mayan year";s=s*20+n}return s},monthsInYear:function(o){return this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),18},weekOfYear:function(o,s,l){return this._validate(o,s,l,e.local.invalidDate),0},daysInYear:function(o){return this._validate(o,this.minMonth,this.minDay,e.local.invalidYear),360},daysInMonth:function(o,s){return this._validate(o,s,this.minDay,e.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(o,s,l){var n=this._validate(o,s,l,e.local.invalidDate);return n.day()},weekDay:function(o,s,l){return this._validate(o,s,l,e.local.invalidDate),!0},extraInfo:function(o,s,l){var n=this._validate(o,s,l,e.local.invalidDate),u=n.toJD(),c=this._toHaab(u),f=this._toTzolkin(u);return{haabMonthName:this.local.haabMonths[c[0]-1],haabMonth:c[0],haabDay:c[1],tzolkinDayName:this.local.tzolkinMonths[f[0]-1],tzolkinDay:f[0],tzolkinTrecena:f[1]}},_toHaab:function(o){o-=this.jdEpoch;var s=i(o+8+340,365);return[Math.floor(s/20)+1,i(s,20)]},_toTzolkin:function(o){return o-=this.jdEpoch,[a(o+20,20),a(o+4,13)]},toJD:function(o,s,l){var n=this._validate(o,s,l,e.local.invalidDate);return n.day()+n.month()*20+n.year()*360+this.jdEpoch},fromJD:function(o){o=Math.floor(o)+.5-this.jdEpoch;var s=Math.floor(o/360);o=o%360,o+=o<0?360:0;var l=Math.floor(o/20),n=o%20;return this.newDate(s,l,n)}});function i(o,s){return o-s*Math.floor(o/s)}function a(o,s){return i(o-1,s)+1}e.calendars.mayan=t}}),_ce=de({"node_modules/world-calendars/dist/calendars/nanakshahi.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar;var i=e.instance("gregorian");r(t.prototype,{name:"Nanakshahi",jdEpoch:22576735e-1,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear||e.regionalOptions[""].invalidYear);return i.leapYear(o.year()+(o.year()<1?1:0)+1469)},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(1-(l.dayOfWeek()||7),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===12&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return(this.dayOfWeek(a,o,s)||7)<6},toJD:function(n,o,s){var l=this._validate(n,o,s,e.local.invalidMonth),n=l.year();n<0&&n++;for(var u=l.day(),c=1;c=this.toJD(o+1,1,1);)o++;for(var s=a-Math.floor(this.toJD(o,1,1)+.5)+1,l=1;s>this.daysInMonth(o,l);)s-=this.daysInMonth(o,l),l++;return this.newDate(o,l,s)}}),e.calendars.nanakshahi=t}}),xce=de({"node_modules/world-calendars/dist/calendars/nepali.js"(){var e=_c(),r=du();function t(i){this.local=this.regionalOptions[i||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Nepali",jdEpoch:17007095e-1,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(i){return this.daysInYear(i)!==this.daysPerYear},weekOfYear:function(i,a,o){var s=this.newDate(i,a,o);return s.add(-s.dayOfWeek(),"d"),Math.floor((s.dayOfYear()-1)/7)+1},daysInYear:function(i){var a=this._validate(i,this.minMonth,this.minDay,e.local.invalidYear);if(i=a.year(),typeof this.NEPALI_CALENDAR_DATA[i]>"u")return this.daysPerYear;for(var o=0,s=this.minMonth;s<=12;s++)o+=this.NEPALI_CALENDAR_DATA[i][s];return o},daysInMonth:function(i,a){return i.year&&(a=i.month(),i=i.year()),this._validate(i,a,this.minDay,e.local.invalidMonth),typeof this.NEPALI_CALENDAR_DATA[i]>"u"?this.daysPerMonth[a-1]:this.NEPALI_CALENDAR_DATA[i][a]},weekDay:function(i,a,o){return this.dayOfWeek(i,a,o)!==6},toJD:function(i,a,o){var s=this._validate(i,a,o,e.local.invalidDate);i=s.year(),a=s.month(),o=s.day();var l=e.instance(),n=0,u=a,c=i;this._createMissingCalendarData(i);var f=i-(u>9||u===9&&o>=this.NEPALI_CALENDAR_DATA[c][0]?56:57);for(a!==9&&(n=o,u--);u!==9;)u<=0&&(u=12,c--),n+=this.NEPALI_CALENDAR_DATA[c][u],u--;return a===9?(n+=o-this.NEPALI_CALENDAR_DATA[c][0],n<0&&(n+=l.daysInYear(f))):n+=this.NEPALI_CALENDAR_DATA[c][9]-this.NEPALI_CALENDAR_DATA[c][0],l.newDate(f,1,1).add(n,"d").toJD()},fromJD:function(i){var a=e.instance(),o=a.fromJD(i),s=o.year(),l=o.dayOfYear(),n=s+56;this._createMissingCalendarData(n);for(var u=9,c=this.NEPALI_CALENDAR_DATA[n][0],f=this.NEPALI_CALENDAR_DATA[n][u]-c+1;l>f;)u++,u>12&&(u=1,n++),f+=this.NEPALI_CALENDAR_DATA[n][u];var h=this.NEPALI_CALENDAR_DATA[n][u]-(f-l);return this.newDate(n,u,h)},_createMissingCalendarData:function(i){var a=this.daysPerMonth.slice(0);a.unshift(17);for(var o=i-1;o"u"&&(this.NEPALI_CALENDAR_DATA[o]=a)},NEPALI_CALENDAR_DATA:{1970:[18,31,31,32,31,31,31,30,29,30,29,30,30],1971:[18,31,31,32,31,32,30,30,29,30,29,30,30],1972:[17,31,32,31,32,31,30,30,30,29,29,30,30],1973:[19,30,32,31,32,31,30,30,30,29,30,29,31],1974:[19,31,31,32,30,31,31,30,29,30,29,30,30],1975:[18,31,31,32,32,30,31,30,29,30,29,30,30],1976:[17,31,32,31,32,31,30,30,30,29,29,30,31],1977:[18,31,32,31,32,31,31,29,30,29,30,29,31],1978:[18,31,31,32,31,31,31,30,29,30,29,30,30],1979:[18,31,31,32,32,31,30,30,29,30,29,30,30],1980:[17,31,32,31,32,31,30,30,30,29,29,30,31],1981:[18,31,31,31,32,31,31,29,30,30,29,30,30],1982:[18,31,31,32,31,31,31,30,29,30,29,30,30],1983:[18,31,31,32,32,31,30,30,29,30,29,30,30],1984:[17,31,32,31,32,31,30,30,30,29,29,30,31],1985:[18,31,31,31,32,31,31,29,30,30,29,30,30],1986:[18,31,31,32,31,31,31,30,29,30,29,30,30],1987:[18,31,32,31,32,31,30,30,29,30,29,30,30],1988:[17,31,32,31,32,31,30,30,30,29,29,30,31],1989:[18,31,31,31,32,31,31,30,29,30,29,30,30],1990:[18,31,31,32,31,31,31,30,29,30,29,30,30],1991:[18,31,32,31,32,31,30,30,29,30,29,30,30],1992:[17,31,32,31,32,31,30,30,30,29,30,29,31],1993:[18,31,31,31,32,31,31,30,29,30,29,30,30],1994:[18,31,31,32,31,31,31,30,29,30,29,30,30],1995:[17,31,32,31,32,31,30,30,30,29,29,30,30],1996:[17,31,32,31,32,31,30,30,30,29,30,29,31],1997:[18,31,31,32,31,31,31,30,29,30,29,30,30],1998:[18,31,31,32,31,31,31,30,29,30,29,30,30],1999:[17,31,32,31,32,31,30,30,30,29,29,30,31],2e3:[17,30,32,31,32,31,30,30,30,29,30,29,31],2001:[18,31,31,32,31,31,31,30,29,30,29,30,30],2002:[18,31,31,32,32,31,30,30,29,30,29,30,30],2003:[17,31,32,31,32,31,30,30,30,29,29,30,31],2004:[17,30,32,31,32,31,30,30,30,29,30,29,31],2005:[18,31,31,32,31,31,31,30,29,30,29,30,30],2006:[18,31,31,32,32,31,30,30,29,30,29,30,30],2007:[17,31,32,31,32,31,30,30,30,29,29,30,31],2008:[17,31,31,31,32,31,31,29,30,30,29,29,31],2009:[18,31,31,32,31,31,31,30,29,30,29,30,30],2010:[18,31,31,32,32,31,30,30,29,30,29,30,30],2011:[17,31,32,31,32,31,30,30,30,29,29,30,31],2012:[17,31,31,31,32,31,31,29,30,30,29,30,30],2013:[18,31,31,32,31,31,31,30,29,30,29,30,30],2014:[18,31,31,32,32,31,30,30,29,30,29,30,30],2015:[17,31,32,31,32,31,30,30,30,29,29,30,31],2016:[17,31,31,31,32,31,31,29,30,30,29,30,30],2017:[18,31,31,32,31,31,31,30,29,30,29,30,30],2018:[18,31,32,31,32,31,30,30,29,30,29,30,30],2019:[17,31,32,31,32,31,30,30,30,29,30,29,31],2020:[17,31,31,31,32,31,31,30,29,30,29,30,30],2021:[18,31,31,32,31,31,31,30,29,30,29,30,30],2022:[17,31,32,31,32,31,30,30,30,29,29,30,30],2023:[17,31,32,31,32,31,30,30,30,29,30,29,31],2024:[17,31,31,31,32,31,31,30,29,30,29,30,30],2025:[18,31,31,32,31,31,31,30,29,30,29,30,30],2026:[17,31,32,31,32,31,30,30,30,29,29,30,31],2027:[17,30,32,31,32,31,30,30,30,29,30,29,31],2028:[17,31,31,32,31,31,31,30,29,30,29,30,30],2029:[18,31,31,32,31,32,30,30,29,30,29,30,30],2030:[17,31,32,31,32,31,30,30,30,30,30,30,31],2031:[17,31,32,31,32,31,31,31,31,31,31,31,31],2032:[17,32,32,32,32,32,32,32,32,32,32,32,32],2033:[18,31,31,32,32,31,30,30,29,30,29,30,30],2034:[17,31,32,31,32,31,30,30,30,29,29,30,31],2035:[17,30,32,31,32,31,31,29,30,30,29,29,31],2036:[17,31,31,32,31,31,31,30,29,30,29,30,30],2037:[18,31,31,32,32,31,30,30,29,30,29,30,30],2038:[17,31,32,31,32,31,30,30,30,29,29,30,31],2039:[17,31,31,31,32,31,31,29,30,30,29,30,30],2040:[17,31,31,32,31,31,31,30,29,30,29,30,30],2041:[18,31,31,32,32,31,30,30,29,30,29,30,30],2042:[17,31,32,31,32,31,30,30,30,29,29,30,31],2043:[17,31,31,31,32,31,31,29,30,30,29,30,30],2044:[17,31,31,32,31,31,31,30,29,30,29,30,30],2045:[18,31,32,31,32,31,30,30,29,30,29,30,30],2046:[17,31,32,31,32,31,30,30,30,29,29,30,31],2047:[17,31,31,31,32,31,31,30,29,30,29,30,30],2048:[17,31,31,32,31,31,31,30,29,30,29,30,30],2049:[17,31,32,31,32,31,30,30,30,29,29,30,30],2050:[17,31,32,31,32,31,30,30,30,29,30,29,31],2051:[17,31,31,31,32,31,31,30,29,30,29,30,30],2052:[17,31,31,32,31,31,31,30,29,30,29,30,30],2053:[17,31,32,31,32,31,30,30,30,29,29,30,30],2054:[17,31,32,31,32,31,30,30,30,29,30,29,31],2055:[17,31,31,32,31,31,31,30,29,30,30,29,30],2056:[17,31,31,32,31,32,30,30,29,30,29,30,30],2057:[17,31,32,31,32,31,30,30,30,29,29,30,31],2058:[17,30,32,31,32,31,30,30,30,29,30,29,31],2059:[17,31,31,32,31,31,31,30,29,30,29,30,30],2060:[17,31,31,32,32,31,30,30,29,30,29,30,30],2061:[17,31,32,31,32,31,30,30,30,29,29,30,31],2062:[17,30,32,31,32,31,31,29,30,29,30,29,31],2063:[17,31,31,32,31,31,31,30,29,30,29,30,30],2064:[17,31,31,32,32,31,30,30,29,30,29,30,30],2065:[17,31,32,31,32,31,30,30,30,29,29,30,31],2066:[17,31,31,31,32,31,31,29,30,30,29,29,31],2067:[17,31,31,32,31,31,31,30,29,30,29,30,30],2068:[17,31,31,32,32,31,30,30,29,30,29,30,30],2069:[17,31,32,31,32,31,30,30,30,29,29,30,31],2070:[17,31,31,31,32,31,31,29,30,30,29,30,30],2071:[17,31,31,32,31,31,31,30,29,30,29,30,30],2072:[17,31,32,31,32,31,30,30,29,30,29,30,30],2073:[17,31,32,31,32,31,30,30,30,29,29,30,31],2074:[17,31,31,31,32,31,31,30,29,30,29,30,30],2075:[17,31,31,32,31,31,31,30,29,30,29,30,30],2076:[16,31,32,31,32,31,30,30,30,29,29,30,30],2077:[17,31,32,31,32,31,30,30,30,29,30,29,31],2078:[17,31,31,31,32,31,31,30,29,30,29,30,30],2079:[17,31,31,32,31,31,31,30,29,30,29,30,30],2080:[16,31,32,31,32,31,30,30,30,29,29,30,30],2081:[17,31,31,32,32,31,30,30,30,29,30,30,30],2082:[17,31,32,31,32,31,30,30,30,29,30,30,30],2083:[17,31,31,32,31,31,30,30,30,29,30,30,30],2084:[17,31,31,32,31,31,30,30,30,29,30,30,30],2085:[17,31,32,31,32,31,31,30,30,29,30,30,30],2086:[17,31,32,31,32,31,30,30,30,29,30,30,30],2087:[16,31,31,32,31,31,31,30,30,29,30,30,30],2088:[16,30,31,32,32,30,31,30,30,29,30,30,30],2089:[17,31,32,31,32,31,30,30,30,29,30,30,30],2090:[17,31,32,31,32,31,30,30,30,29,30,30,30],2091:[16,31,31,32,31,31,31,30,30,29,30,30,30],2092:[16,31,31,32,32,31,30,30,30,29,30,30,30],2093:[17,31,32,31,32,31,30,30,30,29,30,30,30],2094:[17,31,31,32,31,31,30,30,30,29,30,30,30],2095:[17,31,31,32,31,31,31,30,29,30,30,30,30],2096:[17,30,31,32,32,31,30,30,29,30,29,30,30],2097:[17,31,32,31,32,31,30,30,30,29,30,30,30],2098:[17,31,31,32,31,31,31,29,30,29,30,30,31],2099:[17,31,31,32,31,31,31,30,29,29,30,30,30],2100:[17,31,32,31,32,30,31,30,29,30,29,30,30]}}),e.calendars.nepali=t}}),bce=de({"node_modules/world-calendars/dist/calendars/persian.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}function i(a){var o=a-475;a<0&&o++;var s=.242197,l=s*o,n=s*(o+1),u=l-Math.floor(l),c=n-Math.floor(n);return u>c}t.prototype=new e.baseCalendar,r(t.prototype,{name:"Persian",jdEpoch:19483205e-1,daysPerMonth:[31,31,31,31,31,31,30,30,30,30,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Persian",epochs:["BP","AP"],monthNames:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"],monthNamesShort:["Far","Ord","Kho","Tir","Mor","Sha","Meh","Aba","Aza","Dey","Bah","Esf"],dayNames:["Yekshanbeh","Doshanbeh","Seshanbeh","Chah\u0101rshanbeh","Panjshanbeh","Jom'eh","Shanbeh"],dayNamesShort:["Yek","Do","Se","Cha","Panj","Jom","Sha"],dayNamesMin:["Ye","Do","Se","Ch","Pa","Jo","Sh"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return i(o.year())},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-((l.dayOfWeek()+1)%7),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===12&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return this.dayOfWeek(a,o,s)!==5},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate);a=l.year(),o=l.month(),s=l.day();var n=0;if(a>0)for(var u=1;u0?a-1:a)*365+n+this.jdEpoch-1},fromJD:function(a){a=Math.floor(a)+.5;var o=475+(a-this.toJD(475,1,1))/365.242197,s=Math.floor(o);s<=0&&s--,a>this.toJD(s,12,i(s)?30:29)&&(s++,s===0&&s++);var l=a-this.toJD(s,1,1)+1,n=l<=186?Math.ceil(l/31):Math.ceil((l-6)/30),u=a-this.toJD(s,n,1)+1;return this.newDate(s,n,u)}}),e.calendars.persian=t,e.calendars.jalali=t}}),wce=de({"node_modules/world-calendars/dist/calendars/taiwan.js"(){var e=_c(),r=du(),t=e.instance();function i(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}i.prototype=new e.baseCalendar,r(i.prototype,{name:"Taiwan",jdEpoch:24194025e-1,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(s){var o=this._validate(s,this.minMonth,this.minDay,e.local.invalidYear),s=this._t2gYear(o.year());return t.leapYear(s)},weekOfYear:function(n,o,s){var l=this._validate(n,this.minMonth,this.minDay,e.local.invalidYear),n=this._t2gYear(l.year());return t.weekOfYear(n,l.month(),l.day())},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===2&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return(this.dayOfWeek(a,o,s)||7)<6},toJD:function(n,o,s){var l=this._validate(n,o,s,e.local.invalidDate),n=this._t2gYear(l.year());return t.toJD(n,l.month(),l.day())},fromJD:function(a){var o=t.fromJD(a),s=this._g2tYear(o.year());return this.newDate(s,o.month(),o.day())},_t2gYear:function(a){return a+this.yearsOffset+(a>=-this.yearsOffset&&a<=-1?1:0)},_g2tYear:function(a){return a-this.yearsOffset-(a>=1&&a<=this.yearsOffset?1:0)}}),e.calendars.taiwan=i}}),Tce=de({"node_modules/world-calendars/dist/calendars/thai.js"(){var e=_c(),r=du(),t=e.instance();function i(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}i.prototype=new e.baseCalendar,r(i.prototype,{name:"Thai",jdEpoch:15230985e-1,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(s){var o=this._validate(s,this.minMonth,this.minDay,e.local.invalidYear),s=this._t2gYear(o.year());return t.leapYear(s)},weekOfYear:function(n,o,s){var l=this._validate(n,this.minMonth,this.minDay,e.local.invalidYear),n=this._t2gYear(l.year());return t.weekOfYear(n,l.month(),l.day())},daysInMonth:function(a,o){var s=this._validate(a,o,this.minDay,e.local.invalidMonth);return this.daysPerMonth[s.month()-1]+(s.month()===2&&this.leapYear(s.year())?1:0)},weekDay:function(a,o,s){return(this.dayOfWeek(a,o,s)||7)<6},toJD:function(n,o,s){var l=this._validate(n,o,s,e.local.invalidDate),n=this._t2gYear(l.year());return t.toJD(n,l.month(),l.day())},fromJD:function(a){var o=t.fromJD(a),s=this._g2tYear(o.year());return this.newDate(s,o.month(),o.day())},_t2gYear:function(a){return a-this.yearsOffset-(a>=1&&a<=this.yearsOffset?1:0)},_g2tYear:function(a){return a+this.yearsOffset+(a>=-this.yearsOffset&&a<=-1?1:0)}}),e.calendars.thai=i}}),Ace=de({"node_modules/world-calendars/dist/calendars/ummalqura.js"(){var e=_c(),r=du();function t(a){this.local=this.regionalOptions[a||""]||this.regionalOptions[""]}t.prototype=new e.baseCalendar,r(t.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012Bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(a){var o=this._validate(a,this.minMonth,this.minDay,e.local.invalidYear);return this.daysInYear(o.year())===355},weekOfYear:function(a,o,s){var l=this.newDate(a,o,s);return l.add(-l.dayOfWeek(),"d"),Math.floor((l.dayOfYear()-1)/7)+1},daysInYear:function(a){for(var o=0,s=1;s<=12;s++)o+=this.daysInMonth(a,s);return o},daysInMonth:function(a,o){for(var s=this._validate(a,o,this.minDay,e.local.invalidMonth),l=s.toJD()-24e5+.5,n=0,u=0;ul)return i[n]-i[n-1];n++}return 30},weekDay:function(a,o,s){return this.dayOfWeek(a,o,s)!==5},toJD:function(a,o,s){var l=this._validate(a,o,s,e.local.invalidDate),n=12*(l.year()-1)+l.month()-15292,u=l.day()+i[n-1]-1;return u+24e5-.5},fromJD:function(a){for(var o=a-24e5+.5,s=0,l=0;lo);l++)s++;var n=s+15292,u=Math.floor((n-1)/12),c=u+1,f=n-12*u,h=o-i[s-1]+1;return this.newDate(c,f,h)},isValid:function(a,o,s){var l=e.baseCalendar.prototype.isValid.apply(this,arguments);return l&&(a=a.year!=null?a.year:a,l=a>=1276&&a<=1500),l},_validate:function(a,o,s,l){var n=e.baseCalendar.prototype._validate.apply(this,arguments);if(n.year<1276||n.year>1500)throw l.replace(/\{0\}/,this.local.name);return n}}),e.calendars.ummalqura=t;var i=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]}}),Mce=de({"src/components/calendars/calendars.js"(e,r){"use strict";r.exports=_c(),cce(),fce(),hce(),dce(),pce(),vce(),mce(),gce(),yce(),_ce(),xce(),bce(),wce(),Tce(),Ace()}}),Sce=de({"src/components/calendars/index.js"(e,r){"use strict";var t=Mce(),i=Qt(),a=cn(),o=a.EPOCHJD,s=a.ONEDAY,l={valType:"enumerated",values:i.sortObjectKeys(t.calendars),editType:"calc",dflt:"gregorian"},n=function(w,k,A,b){var E={};return E[A]=l,i.coerce(w,k,E,A,b)},u=function(w,k,A,b){for(var E=0;E{dt.preventDefault(),dt.stopPropagation(),dt.clipboardData.setData("text",Ie),Oe.removeEventListener("copy",Qe,!0)};Oe.addEventListener("copy",Qe,!0),document.execCommand("copy")}We.copyText=oe})(Tj||(Tj={}));var Os;(function(We){function oe(dt){let Jt=window.getComputedStyle(dt),jt=parseFloat(Jt.borderTopWidth)||0,Xt=parseFloat(Jt.borderLeftWidth)||0,nr=parseFloat(Jt.borderRightWidth)||0,Ht=parseFloat(Jt.borderBottomWidth)||0,er=parseFloat(Jt.paddingTop)||0,ur=parseFloat(Jt.paddingLeft)||0,ir=parseFloat(Jt.paddingRight)||0,Ot=parseFloat(Jt.paddingBottom)||0,ar=Xt+ur+ir+nr,Lr=jt+er+Ot+Ht;return{borderTop:jt,borderLeft:Xt,borderRight:nr,borderBottom:Ht,paddingTop:er,paddingLeft:ur,paddingRight:ir,paddingBottom:Ot,horizontalSum:ar,verticalSum:Lr}}We.boxSizing=oe;function Ie(dt){let Jt=window.getComputedStyle(dt),jt=parseFloat(Jt.minWidth)||0,Xt=parseFloat(Jt.minHeight)||0,nr=parseFloat(Jt.maxWidth)||1/0,Ht=parseFloat(Jt.maxHeight)||1/0;return nr=Math.max(jt,nr),Ht=Math.max(Xt,Ht),{minWidth:jt,minHeight:Xt,maxWidth:nr,maxHeight:Ht}}We.sizeLimits=Ie;function Oe(dt,Jt,jt){let Xt=dt.getBoundingClientRect();return Jt>=Xt.left&&Jt=Xt.top&&jt=jt.bottom)){if(Xt.topjt.bottom&&Xt.height>=jt.height){dt.scrollTop-=jt.top-Xt.top;return}if(Xt.topjt.height){dt.scrollTop-=jt.bottom-Xt.bottom;return}if(Xt.bottom>jt.bottom&&Xt.height{let Ht=Element.prototype;return Ht.matches||Ht.matchesSelector||Ht.mozMatchesSelector||Ht.msMatchesSelector||Ht.oMatchesSelector||Ht.webkitMatchesSelector||function(er){let ur=this,ir=ur.ownerDocument?ur.ownerDocument.querySelectorAll(er):[];return Array.prototype.indexOf.call(ir,ur)!==-1}})();function oe(Ht){Ht=Ht.split(",",1)[0];let er=0,ur=0,ir=0;function Ot(ar){let Lr=Ht.match(ar);return Lr===null?!1:(Ht=Ht.slice(Lr[0].length),!0)}for(Ht=Ht.replace(nr," $1 ");Ht.length>0;){if(Ot(Ie)){er++;continue}if(Ot(Oe)){ur++;continue}if(Ot(Qe)){ur++;continue}if(Ot(Jt)){ir++;continue}if(Ot(jt)){ur++;continue}if(Ot(dt)){ir++;continue}if(!Ot(Xt))return 0}return er=Math.min(er,255),ur=Math.min(ur,255),ir=Math.min(ir,255),er<<16|ur<<8|ir}We.calculateSingle=oe;let Ie=/^#[^\s\+>~#\.\[:]+/,Oe=/^\.[^\s\+>~#\.\[:]+/,Qe=/^\[[^\]]+\]/,dt=/^[^\s\+>~#\.\[:]+/,Jt=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,jt=/^:[^\s\+>~#\.\[:]+/,Xt=/^[\s\+>~\*]+/,nr=/:not\(([^\)]+)\)/g})(hd||(hd={}));var pp=hp(lv());var Km=class{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return this._size===0}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let oe=this._first;for(;oe;)yield oe.value,oe=oe.next}*retro(){let oe=this._last;for(;oe;)yield oe.value,oe=oe.prev}*nodes(){let oe=this._first;for(;oe;)yield oe,oe=oe.next}*retroNodes(){let oe=this._last;for(;oe;)yield oe,oe=oe.prev}assign(oe){this.clear();for(let Ie of oe)this.addLast(Ie)}push(oe){this.addLast(oe)}pop(){return this.removeLast()}shift(oe){this.addFirst(oe)}unshift(){return this.removeFirst()}addFirst(oe){let Ie=new dp.LinkedListNode(this,oe);return this._first?(Ie.next=this._first,this._first.prev=Ie,this._first=Ie):(this._first=Ie,this._last=Ie),this._size++,Ie}addLast(oe){let Ie=new dp.LinkedListNode(this,oe);return this._last?(Ie.prev=this._last,this._last.next=Ie,this._last=Ie):(this._first=Ie,this._last=Ie),this._size++,Ie}insertBefore(oe,Ie){if(!Ie||Ie===this._first)return this.addFirst(oe);if(!(Ie instanceof dp.LinkedListNode)||Ie.list!==this)throw new Error("Reference node is not owned by the list.");let Oe=new dp.LinkedListNode(this,oe),Qe=Ie,dt=Qe.prev;return Oe.next=Qe,Oe.prev=dt,Qe.prev=Oe,dt.next=Oe,this._size++,Oe}insertAfter(oe,Ie){if(!Ie||Ie===this._last)return this.addLast(oe);if(!(Ie instanceof dp.LinkedListNode)||Ie.list!==this)throw new Error("Reference node is not owned by the list.");let Oe=new dp.LinkedListNode(this,oe),Qe=Ie,dt=Qe.next;return Oe.next=dt,Oe.prev=Qe,Qe.next=Oe,dt.prev=Oe,this._size++,Oe}removeFirst(){let oe=this._first;if(oe)return oe===this._last?(this._first=null,this._last=null):(this._first=oe.next,this._first.prev=null),oe.list=null,oe.next=null,oe.prev=null,this._size--,oe.value}removeLast(){let oe=this._last;if(oe)return oe===this._first?(this._first=null,this._last=null):(this._last=oe.prev,this._last.next=null),oe.list=null,oe.next=null,oe.prev=null,this._size--,oe.value}removeNode(oe){if(!(oe instanceof dp.LinkedListNode)||oe.list!==this)throw new Error("Node is not owned by the list.");let Ie=oe;Ie===this._first&&Ie===this._last?(this._first=null,this._last=null):Ie===this._first?(this._first=Ie.next,this._first.prev=null):Ie===this._last?(this._last=Ie.prev,this._last.next=null):(Ie.next.prev=Ie.prev,Ie.prev.next=Ie.next),Ie.list=null,Ie.next=null,Ie.prev=null,this._size--}clear(){let oe=this._first;for(;oe;){let Ie=oe.next;oe.list=null,oe.prev=null,oe.next=null,oe=Ie}this._first=null,this._last=null,this._size=0}};(function(We){function oe(Ie){let Oe=new We;return Oe.assign(Ie),Oe}We.from=oe})(Km||(Km={}));var dp;(function(We){class oe{constructor(Oe,Qe){this.list=null,this.next=null,this.prev=null,this.list=Oe,this.value=Qe}}We.LinkedListNode=oe})(dp||(dp={}));var rf=class{constructor(oe){this.type=oe}get isConflatable(){return!1}conflate(oe){return!1}},o0=class extends rf{get isConflatable(){return!0}conflate(oe){return!0}},za;(function(We){let oe=null,Ie=(Ki=>Ia=>{let _i=!1;return Ki.then(()=>!_i&&Ia()),()=>{_i=!0}})(Promise.resolve());function Oe(Ki,Ia){let _i=ur.get(Ki);if(!_i||_i.length===0){Ir(Ki,Ia);return}(0,pp.every)((0,pp.retro)(_i),Yr=>Yr?Lr(Yr,Ki,Ia):!0)&&Ir(Ki,Ia)}We.sendMessage=Oe;function Qe(Ki,Ia){if(!Ia.isConflatable){de(Ki,Ia);return}(0,pp.some)(er,ia=>ia.handler!==Ki||!ia.msg||ia.msg.type!==Ia.type||!ia.msg.isConflatable?!1:ia.msg.conflate(Ia))||de(Ki,Ia)}We.postMessage=Qe;function dt(Ki,Ia){let _i=ur.get(Ki);_i&&_i.indexOf(Ia)!==-1||(_i?_i.push(Ia):ur.set(Ki,[Ia]))}We.installMessageHook=dt;function Jt(Ki,Ia){let _i=ur.get(Ki);if(!_i)return;let ia=_i.indexOf(Ia);ia!==-1&&(_i[ia]=null,qr(_i))}We.removeMessageHook=Jt;function jt(Ki){let Ia=ur.get(Ki);Ia&&Ia.length>0&&(pp.ArrayExt.fill(Ia,null),qr(Ia));for(let _i of er)_i.handler===Ki&&(_i.handler=null,_i.msg=null)}We.clearData=jt;function Xt(){ar||oe===null||(oe(),oe=null,ar=!0,Mr(),ar=!1)}We.flush=Xt;function nr(){return Ot}We.getExceptionHandler=nr;function Ht(Ki){let Ia=Ot;return Ot=Ki,Ia}We.setExceptionHandler=Ht;let er=new Km,ur=new WeakMap,ir=new Set,Ot=Ki=>{console.error(Ki)},ar=!1;function Lr(Ki,Ia,_i){let ia=!0;try{typeof Ki=="function"?ia=Ki(Ia,_i):ia=Ki.messageHook(Ia,_i)}catch(Yr){Ot(Yr)}return ia}function Ir(Ki,Ia){try{Ki.processMessage(Ia)}catch(_i){Ot(_i)}}function de(Ki,Ia){er.addLast({handler:Ki,msg:Ia}),oe===null&&(oe=Ie(Mr))}function Mr(){if(oe=null,er.isEmpty)return;let Ki={handler:null,msg:null};for(er.addLast(Ki);;){let Ia=er.removeFirst();if(Ia===Ki)return;Ia.handler&&Ia.msg&&Oe(Ia.handler,Ia.msg)}}function qr(Ki){ir.size===0&&Ie(Vr),ir.add(Ki)}function Vr(){ir.forEach(ti),ir.clear()}function ti(Ki){pp.ArrayExt.removeAllWhere(Ki,Xr)}function Xr(Ki){return Ki===null}})(za||(za={}));var af=class{constructor(oe){this._pid=uv.nextPID(),this.name=oe.name,this._create=oe.create,this._coerce=oe.coerce||null,this._compare=oe.compare||null,this._changed=oe.changed||null}get(oe){let Ie,Oe=uv.ensureMap(oe);return this._pid in Oe?Ie=Oe[this._pid]:Ie=Oe[this._pid]=this._createValue(oe),Ie}set(oe,Ie){let Oe,Qe=uv.ensureMap(oe);this._pid in Qe?Oe=Qe[this._pid]:Oe=Qe[this._pid]=this._createValue(oe);let dt=this._coerceValue(oe,Ie);this._maybeNotify(oe,Oe,Qe[this._pid]=dt)}coerce(oe){let Ie,Oe=uv.ensureMap(oe);this._pid in Oe?Ie=Oe[this._pid]:Ie=Oe[this._pid]=this._createValue(oe);let Qe=this._coerceValue(oe,Ie);this._maybeNotify(oe,Ie,Oe[this._pid]=Qe)}_createValue(oe){let Ie=this._create;return Ie(oe)}_coerceValue(oe,Ie){let Oe=this._coerce;return Oe?Oe(oe,Ie):Ie}_compareValue(oe,Ie){let Oe=this._compare;return Oe?Oe(oe,Ie):oe===Ie}_maybeNotify(oe,Ie,Oe){let Qe=this._changed;Qe&&!this._compareValue(Ie,Oe)&&Qe(oe,Ie,Oe)}};(function(We){function oe(Ie){uv.ownerData.delete(Ie)}We.clearData=oe})(af||(af={}));var uv;(function(We){We.ownerData=new WeakMap,We.nextPID=(()=>{let Ie=0;return()=>`pid-${`${Math.random()}`.slice(2)}-${Ie++}`})();function oe(Ie){let Oe=We.ownerData.get(Ie);return Oe||(Oe=Object.create(null),We.ownerData.set(Ie,Oe),Oe)}We.ensureMap=oe})(uv||(uv={}));var ew=hp(lv()),zce=hp(Q2()),Ls=class{constructor(oe){this.sender=oe}connect(oe,Ie){return rh.connect(this,oe,Ie)}disconnect(oe,Ie){return rh.disconnect(this,oe,Ie)}emit(oe){rh.emit(this,oe)}};(function(We){function oe(Xt,nr){rh.disconnectBetween(Xt,nr)}We.disconnectBetween=oe;function Ie(Xt){rh.disconnectSender(Xt)}We.disconnectSender=Ie;function Oe(Xt){rh.disconnectReceiver(Xt)}We.disconnectReceiver=Oe;function Qe(Xt){rh.disconnectAll(Xt)}We.disconnectAll=Qe;function dt(Xt){rh.disconnectAll(Xt)}We.clearData=dt;function Jt(){return rh.exceptionHandler}We.getExceptionHandler=Jt;function jt(Xt){let nr=rh.exceptionHandler;return rh.exceptionHandler=Xt,nr}We.setExceptionHandler=jt})(Ls||(Ls={}));var rh;(function(We){We.exceptionHandler=de=>{console.error(de)};function oe(de,Mr,qr){qr=qr||void 0;let Vr=Xt.get(de.sender);if(Vr||(Vr=[],Xt.set(de.sender,Vr)),ur(Vr,de,Mr,qr))return!1;let ti=qr||Mr,Xr=nr.get(ti);Xr||(Xr=[],nr.set(ti,Xr));let Ki={signal:de,slot:Mr,thisArg:qr};return Vr.push(Ki),Xr.push(Ki),!0}We.connect=oe;function Ie(de,Mr,qr){qr=qr||void 0;let Vr=Xt.get(de.sender);if(!Vr||Vr.length===0)return!1;let ti=ur(Vr,de,Mr,qr);if(!ti)return!1;let Xr=qr||Mr,Ki=nr.get(Xr);return ti.signal=null,Ot(Vr),Ot(Ki),!0}We.disconnect=Ie;function Oe(de,Mr){let qr=Xt.get(de);if(!qr||qr.length===0)return;let Vr=nr.get(Mr);if(!(!Vr||Vr.length===0)){for(let ti of Vr)ti.signal&&ti.signal.sender===de&&(ti.signal=null);Ot(qr),Ot(Vr)}}We.disconnectBetween=Oe;function Qe(de){let Mr=Xt.get(de);if(!(!Mr||Mr.length===0)){for(let qr of Mr){if(!qr.signal)continue;let Vr=qr.thisArg||qr.slot;qr.signal=null,Ot(nr.get(Vr))}Ot(Mr)}}We.disconnectSender=Qe;function dt(de){let Mr=nr.get(de);if(!(!Mr||Mr.length===0)){for(let qr of Mr){if(!qr.signal)continue;let Vr=qr.signal.sender;qr.signal=null,Ot(Xt.get(Vr))}Ot(Mr)}}We.disconnectReceiver=dt;function Jt(de){Qe(de),dt(de)}We.disconnectAll=Jt;function jt(de,Mr){let qr=Xt.get(de.sender);if(!(!qr||qr.length===0))for(let Vr=0,ti=qr.length;Vrti.signal===Mr&&ti.slot===qr&&ti.thisArg===Vr)}function ir(de,Mr){let{signal:qr,slot:Vr,thisArg:ti}=de;try{Vr.call(ti,qr.sender,Mr)}catch(Xr){We.exceptionHandler(Xr)}}function Ot(de){Ht.size===0&&er(ar),Ht.add(de)}function ar(){Ht.forEach(Lr),Ht.clear()}function Lr(de){ew.ArrayExt.removeAllWhere(de,Ir)}function Ir(de){return de.signal===null}})(rh||(rh={}));var s0=class{constructor(oe){this._fn=oe}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let oe=this._fn;this._fn=null,oe()}};var uy=class{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(oe=>{oe.dispose()}),this._items.clear())}contains(oe){return this._items.has(oe)}add(oe){this._items.add(oe)}remove(oe){this._items.delete(oe)}clear(){this._items.clear()}};(function(We){function oe(Ie){let Oe=new We;for(let Qe of Ie)Oe.add(Qe);return Oe}We.from=oe})(uy||(uy={}));var tw=class extends uy{constructor(){super(...arguments),this._disposed=new Ls(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),Ls.clearData(this))}};(function(We){function oe(Ie){let Oe=new We;for(let Qe of Ie)Oe.add(Qe);return Oe}We.from=oe})(tw||(tw={}));var nf=class We{constructor(oe){this._onScrollFrame=()=>{if(!this._scrollTarget)return;let{element:Ie,edge:Oe,distance:Qe}=this._scrollTarget,dt=jc.SCROLL_EDGE_SIZE-Qe,Jt=Math.pow(dt/jc.SCROLL_EDGE_SIZE,2),jt=Math.max(1,Math.round(Jt*jc.SCROLL_EDGE_SIZE));switch(Oe){case"top":Ie.scrollTop-=jt;break;case"left":Ie.scrollLeft-=jt;break;case"right":Ie.scrollLeft+=jt;break;case"bottom":Ie.scrollTop+=jt;break}requestAnimationFrame(this._onScrollFrame)},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.document=oe.document||document,this.mimeData=oe.mimeData,this.dragImage=oe.dragImage||null,this.proposedAction=oe.proposedAction||"copy",this.supportedActions=oe.supportedActions||"all",this.source=oe.source||null}dispose(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){let oe=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,clientX:-1,clientY:-1});jc.dispatchDragLeave(this,this._currentTarget,null,oe)}this._finalize("none")}}get isDisposed(){return this._disposed}start(oe,Ie){if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(oe,Ie),this._promise=new Promise(Qe=>{this._resolve=Qe});let Oe=new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,clientX:oe,clientY:Ie});return document.dispatchEvent(Oe),this._promise}handleEvent(oe){switch(oe.type){case"pointermove":this._evtPointerMove(oe);break;case"pointerup":this._evtPointerUp(oe);break;case"keydown":this._evtKeyDown(oe);break;default:oe.preventDefault(),oe.stopPropagation();break}}moveDragImage(oe,Ie){if(!this.dragImage)return;let Oe=this.dragImage.style;Oe.transform=`translate(${oe}px, ${Ie}px)`}_evtPointerMove(oe){oe.preventDefault(),oe.stopPropagation(),this._updateCurrentTarget(oe),this._updateDragScroll(oe),this.moveDragImage(oe.clientX,oe.clientY)}_evtPointerUp(oe){if(oe.preventDefault(),oe.stopPropagation(),oe.button!==0)return;if(this._updateCurrentTarget(oe),!this._currentTarget){this._finalize("none");return}if(this._dropAction==="none"){jc.dispatchDragLeave(this,this._currentTarget,null,oe),this._finalize("none");return}let Ie=jc.dispatchDrop(this,this._currentTarget,oe);this._finalize(Ie)}_evtKeyDown(oe){oe.preventDefault(),oe.stopPropagation(),oe.keyCode===27&&this.dispose()}_addListeners(){document.addEventListener("pointerdown",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("pointerup",this,!0),document.addEventListener("pointerenter",this,!0),document.addEventListener("pointerleave",this,!0),document.addEventListener("pointerover",this,!0),document.addEventListener("pointerout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)}_removeListeners(){document.removeEventListener("pointerdown",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointerenter",this,!0),document.removeEventListener("pointerleave",this,!0),document.removeEventListener("pointerover",this,!0),document.removeEventListener("pointerout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)}_updateDragScroll(oe){let Ie=jc.findScrollTarget(oe);!this._scrollTarget&&!Ie||(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=Ie)}_updateCurrentTarget(oe){let Ie=this._currentTarget,Oe=this._currentTarget,Qe=this._currentElement,dt=jc.findElementBehindBackdrop(oe,this.document);this._currentElement=dt,dt!==Qe&&dt!==Oe&&jc.dispatchDragExit(this,Oe,dt,oe),dt!==Qe&&dt!==Oe&&(Oe=jc.dispatchDragEnter(this,dt,Oe,oe)),Oe!==Ie&&(this._currentTarget=Oe,jc.dispatchDragLeave(this,Ie,Oe,oe));let Jt=jc.dispatchDragOver(this,Oe,oe);this._setDropAction(Jt)}_attachDragImage(oe,Ie){if(!this.dragImage)return;this.dragImage.classList.add("lm-mod-drag-image");let Oe=this.dragImage.style;Oe.pointerEvents="none",Oe.position="fixed",Oe.transform=`translate(${oe}px, ${Ie}px)`,(this.document instanceof Document?this.document.body:this.document.firstElementChild).appendChild(this.dragImage)}_detachDragImage(){if(!this.dragImage)return;let oe=this.dragImage.parentNode;oe&&oe.removeChild(this.dragImage)}_setDropAction(oe){if(oe=jc.validateAction(oe,this.supportedActions),!(this._override&&this._dropAction===oe))switch(oe){case"none":this._dropAction=oe,this._override=We.overrideCursor("no-drop",this.document);break;case"copy":this._dropAction=oe,this._override=We.overrideCursor("copy",this.document);break;case"link":this._dropAction=oe,this._override=We.overrideCursor("alias",this.document);break;case"move":this._dropAction=oe,this._override=We.overrideCursor("move",this.document);break}}_finalize(oe){let Ie=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,Ie&&Ie(oe)}};(function(We){class oe extends DragEvent{constructor(Qe,dt){super(dt.type,{bubbles:!0,cancelable:!0,altKey:Qe.altKey,button:Qe.button,clientX:Qe.clientX,clientY:Qe.clientY,ctrlKey:Qe.ctrlKey,detail:0,metaKey:Qe.metaKey,relatedTarget:dt.related,screenX:Qe.screenX,screenY:Qe.screenY,shiftKey:Qe.shiftKey,view:window});let{drag:Jt}=dt;this.dropAction="none",this.mimeData=Jt.mimeData,this.proposedAction=Jt.proposedAction,this.supportedActions=Jt.supportedActions,this.source=Jt.source}}We.Event=oe;function Ie(Oe,Qe=document){return jc.overrideCursor(Oe,Qe)}We.overrideCursor=Ie})(nf||(nf={}));var jc;(function(We){We.SCROLL_EDGE_SIZE=20;function oe(qr,Vr){return er[qr]&ur[Vr]?qr:"none"}We.validateAction=oe;function Ie(qr,Vr=document){if(qr){if(Oe&&qr==Oe.event)return Oe.element;We.cursorBackdrop.style.zIndex="-1000";let ti=Vr.elementFromPoint(qr.clientX,qr.clientY);return We.cursorBackdrop.style.zIndex="",Oe={event:qr,element:ti},ti}else{let ti=We.cursorBackdrop.style.transform;if(Qe&&ti===Qe.transform)return Qe.element;let Xr=We.cursorBackdrop.getBoundingClientRect();We.cursorBackdrop.style.zIndex="-1000";let Ki=Vr.elementFromPoint(Xr.left+Xr.width/2,Xr.top+Xr.height/2);return We.cursorBackdrop.style.zIndex="",Qe={transform:ti,element:Ki},Ki}}We.findElementBehindBackdrop=Ie;let Oe=null,Qe=null;function dt(qr){let Vr=qr.clientX,ti=qr.clientY,Xr=Ie(qr);for(;Xr;Xr=Xr.parentElement){if(!Xr.hasAttribute("data-lm-dragscroll"))continue;let Ki=0,Ia=0;Xr===document.body&&(Ki=window.pageXOffset,Ia=window.pageYOffset);let _i=Xr.getBoundingClientRect(),ia=_i.top+Ia,Yr=_i.left+Ki,Ba=Yr+_i.width,eo=ia+_i.height;if(Vr=Ba||ti=eo)continue;let rs=Vr-Yr+1,Oo=ti-ia+1,da=Ba-Vr,cn=eo-ti,Ss=Math.min(rs,Oo,da,cn);if(Ss>We.SCROLL_EDGE_SIZE)continue;let is;switch(Ss){case cn:is="bottom";break;case Oo:is="top";break;case da:is="right";break;case rs:is="left";break;default:throw"unreachable"}let Do=Xr.scrollWidth-Xr.clientWidth,sl=Xr.scrollHeight-Xr.clientHeight,cu;switch(is){case"top":cu=sl>0&&Xr.scrollTop>0;break;case"left":cu=Do>0&&Xr.scrollLeft>0;break;case"right":cu=Do>0&&Xr.scrollLeft0&&Xr.scrollTop{ti===Mr&&We.cursorBackdrop.isConnected&&(document.removeEventListener("pointermove",Ot,!0),We.cursorBackdrop.removeEventListener("scroll",ar,!0),Xr.removeChild(We.cursorBackdrop))})}We.overrideCursor=ir;function Ot(qr){if(We.cursorBackdrop){We.cursorBackdrop.style.transform=`translate(${qr.clientX}px, ${qr.clientY}px)`;try{We.cursorBackdrop.hasPointerCapture(qr.pointerId)||We.cursorBackdrop.setPointerCapture(qr.pointerId)}catch{}}}function ar(qr){if(!We.cursorBackdrop)return;let Vr=Ie();if(!Vr)return;let ti=Vr.closest("[data-lm-dragscroll]");ti&&(ti.scrollTop+=We.cursorBackdrop.scrollTop-Ir,ti.scrollLeft+=We.cursorBackdrop.scrollLeft-Ir,Lr())}function Lr(){We.cursorBackdrop.scrollTop=Ir,We.cursorBackdrop.scrollLeft=Ir}let Ir=500;function de(){let qr=document.createElement("div");return qr.classList.add("lm-cursor-backdrop"),qr}let Mr=0;We.cursorBackdrop=de()})(jc||(jc={}));var Aj=hp(lv()),cc=hp(Q2());function Jm(){return YS.keyboardLayout}var cy=class We{constructor(oe,Ie,Oe=[]){this.name=oe,this._codes=Ie,this._keys=We.extractKeys(Ie),this._modifierKeys=We.convertToKeySet(Oe)}keys(){return Object.keys(this._keys)}isValidKey(oe){return oe in this._keys}isModifierKey(oe){return oe in this._modifierKeys}keyForKeydownEvent(oe){return this._codes[oe.keyCode]||""}};(function(We){function oe(Oe){let Qe=Object.create(null);for(let dt in Oe)Qe[Oe[dt]]=!0;return Qe}We.extractKeys=oe;function Ie(Oe){let Qe=Object(null);for(let dt=0,Jt=Oe.length;dt{this._commands.delete(oe),this._commandChanged.emit({id:oe,type:"removed"})})}notifyCommandChanged(oe){if(oe!==void 0&&!this._commands.has(oe))throw new Error(`Command '${oe}' is not registered.`);this._commandChanged.emit({id:oe,type:oe?"changed":"many-changed"})}describedBy(oe,Ie=cc.JSONExt.emptyObject){var Oe;let Qe=this._commands.get(oe);return Promise.resolve((Oe=Qe?.describedBy.call(void 0,Ie))!==null&&Oe!==void 0?Oe:{args:null})}label(oe,Ie=cc.JSONExt.emptyObject){var Oe;let Qe=this._commands.get(oe);return(Oe=Qe?.label.call(void 0,Ie))!==null&&Oe!==void 0?Oe:""}mnemonic(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.mnemonic.call(void 0,Ie):-1}icon(oe,Ie=cc.JSONExt.emptyObject){var Oe;return(Oe=this._commands.get(oe))===null||Oe===void 0?void 0:Oe.icon.call(void 0,Ie)}iconClass(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.iconClass.call(void 0,Ie):""}iconLabel(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.iconLabel.call(void 0,Ie):""}caption(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.caption.call(void 0,Ie):""}usage(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.usage.call(void 0,Ie):""}className(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.className.call(void 0,Ie):""}dataset(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.dataset.call(void 0,Ie):{}}isEnabled(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isEnabled.call(void 0,Ie):!1}isToggled(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isToggled.call(void 0,Ie):!1}isToggleable(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isToggleable:!1}isVisible(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);return Oe?Oe.isVisible.call(void 0,Ie):!1}execute(oe,Ie=cc.JSONExt.emptyObject){let Oe=this._commands.get(oe);if(!Oe)return Promise.reject(new Error(`Command '${oe}' not registered.`));let Qe;try{Qe=Oe.execute.call(void 0,Ie)}catch(Jt){Qe=Promise.reject(Jt)}let dt=Promise.resolve(Qe);return this._commandExecuted.emit({id:oe,args:Ie,result:dt}),dt}addKeyBinding(oe){let Ie=pd.createKeyBinding(oe);return this._keyBindings.push(Ie),this._keyBindingChanged.emit({binding:Ie,type:"added"}),new s0(()=>{Aj.ArrayExt.removeFirstOf(this._keyBindings,Ie),this._keyBindingChanged.emit({binding:Ie,type:"removed"})})}processKeydownEvent(oe){if(oe.defaultPrevented||this._replaying)return;let Ie=We.keystrokeForKeydownEvent(oe);if(!Ie){this._replayKeydownEvents(),this._clearPendingState();return}if(We.isModifierKeyPressed(oe)){let{exact:Jt}=pd.matchKeyBinding(this._keyBindings,[Ie],oe);Jt?(oe.preventDefault(),oe.stopPropagation(),this._startModifierTimer(Jt)):this._clearModifierTimer();return}this._keystrokes.push(Ie);let{exact:Oe,partial:Qe}=pd.matchKeyBinding(this._keyBindings,this._keystrokes,oe),dt=Qe.length!==0;if(!Oe&&!dt){this._replayKeydownEvents(),this._clearPendingState();return}if((Oe?.preventDefault||Qe.some(Jt=>Jt.preventDefault))&&(oe.preventDefault(),oe.stopPropagation()),this._keydownEvents.push(oe),Oe&&!dt){this._executeKeyBinding(Oe),this._clearPendingState();return}Oe&&(this._exactKeyMatch=Oe),this._startTimer()}holdKeyBindingExecution(oe,Ie){this._holdKeyBindingPromises.set(oe,Ie)}processKeyupEvent(oe){this._clearModifierTimer()}_startModifierTimer(oe){this._clearModifierTimer(),this._timerModifierID=window.setTimeout(()=>{this._executeKeyBinding(oe)},pd.modifierkeyTimeOut)}_clearModifierTimer(){this._timerModifierID!==0&&(clearTimeout(this._timerModifierID),this._timerModifierID=0)}_startTimer(){this._clearTimer(),this._timerID=window.setTimeout(()=>{this._onPendingTimeout()},pd.CHORD_TIMEOUT)}_clearTimer(){this._timerID!==0&&(clearTimeout(this._timerID),this._timerID=0)}_replayKeydownEvents(){this._keydownEvents.length!==0&&(this._replaying=!0,this._keydownEvents.forEach(pd.replayKeyEvent),this._replaying=!1)}async _executeKeyBinding(oe){if(this._holdKeyBindingPromises.size!==0){let dt=[...this._keydownEvents],Jt=(await Promise.race([Promise.all(dt.map(async jt=>{var Xt;return(Xt=this._holdKeyBindingPromises.get(jt))!==null&&Xt!==void 0?Xt:Promise.resolve(!0)})),new Promise(jt=>{setTimeout(()=>jt([!1]),pd.KEYBINDING_HOLD_TIMEOUT)})])).every(Boolean);if(this._holdKeyBindingPromises.clear(),!Jt)return}let{command:Ie,args:Oe}=oe,Qe={_luminoEvent:{type:"keybinding",keys:oe.keys},...Oe};if(!this.hasCommand(Ie)||!this.isEnabled(Ie,Qe)){let dt=this.hasCommand(Ie)?"enabled":"registered",jt=`Cannot execute key binding '${oe.keys.join(", ")}':`,Xt=`command '${Ie}' is not ${dt}.`;console.warn(`${jt} ${Xt}`);return}await this.execute(Ie,Qe)}_clearPendingState(){this._clearTimer(),this._clearModifierTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0}_onPendingTimeout(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()}};(function(We){function oe(jt){let Xt="",nr=!1,Ht=!1,er=!1,ur=!1;for(let ir of jt.split(/\s+/))ir==="Accel"?Nc.IS_MAC?Ht=!0:er=!0:ir==="Alt"?nr=!0:ir==="Cmd"?Ht=!0:ir==="Ctrl"?er=!0:ir==="Shift"?ur=!0:ir.length>0&&(Xt=ir);return{cmd:Ht,ctrl:er,alt:nr,shift:ur,key:Xt}}We.parseKeystroke=oe;function Ie(jt){let Xt="",nr=oe(jt);return nr.ctrl&&(Xt+="Ctrl "),nr.alt&&(Xt+="Alt "),nr.shift&&(Xt+="Shift "),nr.cmd&&Nc.IS_MAC&&(Xt+="Cmd "),nr.key?Xt+nr.key:Xt.trim()}We.normalizeKeystroke=Ie;function Oe(jt){let Xt;return Nc.IS_WIN?Xt=jt.winKeys||jt.keys:Nc.IS_MAC?Xt=jt.macKeys||jt.keys:Xt=jt.linuxKeys||jt.keys,Xt.map(Ie)}We.normalizeKeys=Oe;function Qe(jt){return typeof jt=="string"?Xt(jt):jt.map(Xt).join(", ");function Xt(nr){let Ht=[],er=Nc.IS_MAC?" ":"+",ur=oe(nr);return ur.ctrl&&Ht.push("Ctrl"),ur.alt&&Ht.push("Alt"),ur.shift&&Ht.push("Shift"),Nc.IS_MAC&&ur.cmd&&Ht.push("Cmd"),Ht.push(ur.key),Ht.map(pd.formatKey).join(er)}}We.formatKeystroke=Qe;function dt(jt){let Xt=Jm(),nr=Xt.keyForKeydownEvent(jt);return Xt.isModifierKey(nr)}We.isModifierKeyPressed=dt;function Jt(jt){let Xt=Jm(),nr=Xt.keyForKeydownEvent(jt),Ht=[];return jt.ctrlKey&&Ht.push("Ctrl"),jt.altKey&&Ht.push("Alt"),jt.shiftKey&&Ht.push("Shift"),jt.metaKey&&Nc.IS_MAC&&Ht.push("Cmd"),Xt.isModifierKey(nr)||Ht.push(nr),Ht.join(" ")}We.keystrokeForKeydownEvent=Jt})(vp||(vp={}));var pd;(function(We){We.CHORD_TIMEOUT=1e3,We.KEYBINDING_HOLD_TIMEOUT=1e3,We.modifierkeyTimeOut=500;function oe(Mr){return{execute:Mr.execute,describedBy:Ot(typeof Mr.describedBy=="function"?Mr.describedBy:{args:null,...Mr.describedBy},()=>({args:null})),label:Ot(Mr.label,Xt),mnemonic:Ot(Mr.mnemonic,nr),icon:Ot(Mr.icon,ir),iconClass:Ot(Mr.iconClass,Xt),iconLabel:Ot(Mr.iconLabel,Xt),caption:Ot(Mr.caption,Xt),usage:Ot(Mr.usage,Xt),className:Ot(Mr.className,Xt),dataset:Ot(Mr.dataset,ur),isEnabled:Mr.isEnabled||Ht,isToggled:Mr.isToggled||er,isToggleable:Mr.isToggleable||!!Mr.isToggled,isVisible:Mr.isVisible||Ht}}We.createCommand=oe;function Ie(Mr){var qr;return{keys:vp.normalizeKeys(Mr),selector:ar(Mr),command:Mr.command,args:Mr.args||cc.JSONExt.emptyObject,preventDefault:(qr=Mr.preventDefault)!==null&&qr!==void 0?qr:!0}}We.createKeyBinding=Ie;function Oe(Mr,qr,Vr){let ti=null,Xr=[],Ki=1/0,Ia=0;for(let _i=0,ia=Mr.length;_iKi)continue;let rs=dd.calculateSpecificity(Yr.selector);(!ti||eo=Ia)&&(ti=Yr,Ki=eo,Ia=rs)}return{exact:ti,partial:Xr}}We.matchKeyBinding=Oe;function Qe(Mr){Mr.target.dispatchEvent(de(Mr))}We.replayKeyEvent=Qe;function dt(Mr){return Nc.IS_MAC?Jt.hasOwnProperty(Mr)?Jt[Mr]:Mr:jt.hasOwnProperty(Mr)?jt[Mr]:Mr}We.formatKey=dt;let Jt={Backspace:"\u232B",Tab:"\u21E5",Enter:"\u23CE",Shift:"\u21E7",Ctrl:"\u2303",Alt:"\u2325",Escape:"\u238B",PageUp:"\u21DE",PageDown:"\u21DF",End:"\u2198",Home:"\u2196",ArrowLeft:"\u2190",ArrowUp:"\u2191",ArrowRight:"\u2192",ArrowDown:"\u2193",Delete:"\u2326",Cmd:"\u2318"},jt={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},Xt=()=>"",nr=()=>-1,Ht=()=>!0,er=()=>!1,ur=()=>({}),ir=()=>{};function Ot(Mr,qr){return Mr===void 0?qr:typeof Mr=="function"?Mr:()=>Mr}function ar(Mr){if(Mr.selector.indexOf(",")!==-1)throw new Error(`Selector cannot contain commas: ${Mr.selector}`);if(!dd.isValid(Mr.selector))throw new Error(`Invalid selector: ${Mr.selector}`);return Mr.selector}function Lr(Mr,qr){if(Mr.lengthqr.length?2:1}function Ir(Mr,qr){let Vr=qr.target,ti=qr.currentTarget;for(let Xr=0;Vr!==null;Vr=Vr.parentElement,++Xr){if(Vr.hasAttribute("data-lm-suppress-shortcuts"))return-1;if(dd.matches(Vr,Mr))return Xr;if(Vr===ti)return-1}return-1}function de(Mr){let qr=document.createEvent("Event"),Vr=Mr.bubbles||!0,ti=Mr.cancelable||!0;return qr.initEvent(Mr.type||"keydown",Vr,ti),qr.key=Mr.key||"",qr.keyCode=Mr.keyCode||0,qr.which=Mr.keyCode||0,qr.ctrlKey=Mr.ctrlKey||!1,qr.altKey=Mr.altKey||!1,qr.shiftKey=Mr.shiftKey||!1,qr.metaKey=Mr.metaKey||!1,qr.view=Mr.view||window,qr}})(pd||(pd={}));var Qm=hp(lv()),e1=class{constructor(oe){this.type="text",this.content=oe}},fy=class{constructor(oe,Ie,Oe,Qe){this.type="element",this.tag=oe,this.attrs=Ie,this.children=Oe,this.renderer=Qe}};function Fs(We){let oe={},Ie,Oe=[];for(let dt=1,Jt=arguments.length;dt=Ir.length){Ie(ar[qr],ir);continue}let Vr=Ir[qr],ti=ar[qr];if(Vr===ti){de=de.nextSibling;continue}if(Vr.type==="text"&&ti.type==="text"){de.textContent!==ti.content&&(de.textContent=ti.content),de=de.nextSibling;continue}if(Vr.type==="text"||ti.type==="text"){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}if(!Vr.renderer!=!ti.renderer){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}let Xr=ti.attrs.key;if(Xr&&Xr in Lr){let Ia=Lr[Xr];Ia.vNode!==Vr&&(Qm.ArrayExt.move(Ir,Ir.indexOf(Ia.vNode,qr+1),qr),ir.insertBefore(Ia.element,de),Vr=Ia.vNode,de=Ia.element)}if(Vr===ti){de=de.nextSibling;continue}let Ki=Vr.attrs.key;if(Ki&&Ki!==Xr){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}if(Vr.tag!==ti.tag){Qm.ArrayExt.insert(Ir,qr,ti),Ie(ti,ir,de);continue}jt(de,Vr.attrs,ti.attrs),ti.renderer?ti.renderer.render(de,{attrs:ti.attrs,children:ti.children}):Oe(de,Vr.children,ti.children),de=de.nextSibling}Qe(ir,Ir,Mr,!0)}We.updateContent=Oe;function Qe(ir,Ot,ar,Lr){for(let Ir=Ot.length-1;Ir>=ar;--Ir){let de=Ot[Ir],Mr=Lr?ir.lastChild:ir.childNodes[Ir];de.type==="text"||(de.renderer&&de.renderer.unrender?de.renderer.unrender(Mr,{attrs:de.attrs,children:de.children}):Qe(Mr,de.children,0,!1)),Lr&&ir.removeChild(Mr)}}let dt={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function Jt(ir,Ot){for(let ar in Ot)ar in dt||(ar.substr(0,2)==="on"?ir[ar]=Ot[ar]:ir.setAttribute(ar,Ot[ar]));Ot.className!==void 0&&ir.setAttribute("class",Ot.className),Ot.htmlFor!==void 0&&ir.setAttribute("for",Ot.htmlFor),Ot.dataset&&Xt(ir,Ot.dataset),Ot.style&&Ht(ir,Ot.style)}function jt(ir,Ot,ar){if(Ot===ar)return;let Lr;for(Lr in Ot)Lr in dt||Lr in ar||(Lr.substr(0,2)==="on"?ir[Lr]=null:ir.removeAttribute(Lr));for(Lr in ar)Lr in dt||Ot[Lr]===ar[Lr]||(Lr.substr(0,2)==="on"?ir[Lr]=ar[Lr]:ir.setAttribute(Lr,ar[Lr]));Ot.className!==ar.className&&(ar.className!==void 0?ir.setAttribute("class",ar.className):ir.removeAttribute("class")),Ot.htmlFor!==ar.htmlFor&&(ar.htmlFor!==void 0?ir.setAttribute("for",ar.htmlFor):ir.removeAttribute("for")),Ot.dataset!==ar.dataset&&nr(ir,Ot.dataset||{},ar.dataset||{}),Ot.style!==ar.style&&er(ir,Ot.style||{},ar.style||{})}function Xt(ir,Ot){for(let ar in Ot)ir.setAttribute(`data-${ar}`,Ot[ar])}function nr(ir,Ot,ar){for(let Lr in Ot)Lr in ar||ir.removeAttribute(`data-${Lr}`);for(let Lr in ar)Ot[Lr]!==ar[Lr]&&ir.setAttribute(`data-${Lr}`,ar[Lr])}function Ht(ir,Ot){let ar=ir.style,Lr;for(Lr in Ot)ar[Lr]=Ot[Lr]}function er(ir,Ot,ar){let Lr=ir.style,Ir;for(Ir in Ot)Ir in ar||(Lr[Ir]="");for(Ir in ar)Ot[Ir]!==ar[Ir]&&(Lr[Ir]=ar[Ir])}function ur(ir,Ot){let ar=ir.firstChild,Lr=Object.create(null);for(let Ir of Ot)Ir.type==="element"&&Ir.attrs.key&&(Lr[Ir.attrs.key]={vNode:Ir,element:ar}),ar=ar.nextSibling;return Lr}})(cv||(cv={}));var Wd=class{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}},ih;(function(We){function oe(dt,Jt){let jt=dt.length;if(jt===0)return Jt;let Xt=0,nr=0,Ht=0,er=0,ur=0;for(let ar=0;ar0&&(er+=Lr.stretch,ur++)}if(Jt===Ht)return 0;if(Jt<=Xt){for(let ar=0;ar=nr){for(let ar=0;ar0&&ar>ir;){let Lr=ar,Ir=er;for(let de=0;de0&&ar>ir;){let Lr=ar/Ot;for(let Ir=0;Ir0&&ar>ir;){let Lr=ar,Ir=er;for(let de=0;de=Mr.maxSize?(ar-=Mr.maxSize-Mr.size,er-=Mr.stretch,Mr.size=Mr.maxSize,Mr.done=!0,Ot--,ur--):(ar-=qr,Mr.size+=qr)}}for(;Ot>0&&ar>ir;){let Lr=ar/Ot;for(let Ir=0;Ir=de.maxSize?(ar-=de.maxSize-de.size,de.size=de.maxSize,de.done=!0,Ot--):(ar-=Lr,de.size+=Lr))}}}return 0}We.calc=oe;function Ie(dt,Jt,jt){dt.length===0||jt===0||(jt>0?Oe(dt,Jt,jt):Qe(dt,Jt,-jt))}We.adjust=Ie;function Oe(dt,Jt,jt){let Xt=0;for(let ur=0;ur<=Jt;++ur){let ir=dt[ur];Xt+=ir.maxSize-ir.size}let nr=0;for(let ur=Jt+1,ir=dt.length;ur=0&&Ht>0;--ur){let ir=dt[ur],Ot=ir.maxSize-ir.size;Ot>=Ht?(ir.sizeHint=ir.size+Ht,Ht=0):(ir.sizeHint=ir.size+Ot,Ht-=Ot)}let er=jt;for(let ur=Jt+1,ir=dt.length;ur0;++ur){let Ot=dt[ur],ar=Ot.size-Ot.minSize;ar>=er?(Ot.sizeHint=Ot.size-er,er=0):(Ot.sizeHint=Ot.size-ar,er-=ar)}}function Qe(dt,Jt,jt){let Xt=0;for(let ur=Jt+1,ir=dt.length;ur0;++ur){let Ot=dt[ur],ar=Ot.maxSize-Ot.size;ar>=Ht?(Ot.sizeHint=Ot.size+Ht,Ht=0):(Ot.sizeHint=Ot.size+ar,Ht-=ar)}let er=jt;for(let ur=Jt;ur>=0&&er>0;--ur){let ir=dt[ur],Ot=ir.size-ir.minSize;Ot>=er?(ir.sizeHint=ir.size-er,er=0):(ir.sizeHint=ir.size-Ot,er-=Ot)}}})(ih||(ih={}));var hy=class{constructor(oe){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new Ls(this),this._isDisposed=!1,this.owner=oe.owner,oe.label!==void 0&&(this._label=oe.label),oe.mnemonic!==void 0&&(this._mnemonic=oe.mnemonic),oe.icon!==void 0&&(this._icon=oe.icon),oe.iconClass!==void 0&&(this._iconClass=oe.iconClass),oe.iconLabel!==void 0&&(this._iconLabel=oe.iconLabel),oe.caption!==void 0&&(this._caption=oe.caption),oe.className!==void 0&&(this._className=oe.className),oe.closable!==void 0&&(this._closable=oe.closable),this._dataset=oe.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(oe){this._label!==oe&&(this._label=oe,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(oe){this._mnemonic!==oe&&(this._mnemonic=oe,this._changed.emit(void 0))}get icon(){return this._icon}set icon(oe){this._icon!==oe&&(this._icon=oe,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(oe){this._iconClass!==oe&&(this._iconClass=oe,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(oe){this._iconLabel!==oe&&(this._iconLabel=oe,this._changed.emit(void 0))}get caption(){return this._caption}set caption(oe){this._caption!==oe&&(this._caption=oe,this._changed.emit(void 0))}get className(){return this._className}set className(oe){this._className!==oe&&(this._className=oe,this._changed.emit(void 0))}get closable(){return this._closable}set closable(oe){this._closable!==oe&&(this._closable=oe,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(oe){this._dataset!==oe&&(this._dataset=oe,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,Ls.clearData(this))}},Ya=class We{constructor(oe={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new Ls(this),this._hiddenMode=We.HiddenMode.Display,this.node=rw.createNode(oe),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(We.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&We.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),Ls.clearData(this),za.clearData(this),af.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(We.Flag.IsDisposed)}get isAttached(){return this.testFlag(We.Flag.IsAttached)}get isHidden(){return this.testFlag(We.Flag.IsHidden)}get isVisible(){let oe=this;do{if(oe.isHidden||!oe.isAttached)return!1;oe=oe.parent}while(oe!=null);return!0}get title(){return rw.titleProperty.get(this)}get id(){return this.node.id}set id(oe){this.node.id=oe}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(oe){this._hiddenMode!==oe&&(this.isHidden&&this._toggleHidden(!1),oe==We.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=oe,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(oe){if(this._parent!==oe){if(oe&&this.contains(oe))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let Ie=new We.ChildMessage("child-removed",this);za.sendMessage(this._parent,Ie)}if(this._parent=oe,this._parent&&!this._parent.isDisposed){let Ie=new We.ChildMessage("child-added",this);za.sendMessage(this._parent,Ie)}this.isDisposed||za.sendMessage(this,We.Msg.ParentChanged)}}get layout(){return this._layout}set layout(oe){if(this._layout!==oe){if(this.testFlag(We.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(oe.parent)throw new Error("Cannot change layout parent.");this._layout=oe,oe.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(oe){for(let Ie=oe;Ie;Ie=Ie._parent)if(Ie===this)return!0;return!1}hasClass(oe){return this.node.classList.contains(oe)}addClass(oe){this.node.classList.add(oe)}removeClass(oe){this.node.classList.remove(oe)}toggleClass(oe,Ie){return Ie===!0?(this.node.classList.add(oe),!0):Ie===!1?(this.node.classList.remove(oe),!1):this.node.classList.toggle(oe)}update(){za.postMessage(this,We.Msg.UpdateRequest)}fit(){za.postMessage(this,We.Msg.FitRequest)}activate(){za.postMessage(this,We.Msg.ActivateRequest)}close(){za.sendMessage(this,We.Msg.CloseRequest)}show(){if(this.testFlag(We.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.BeforeShow),this.clearFlag(We.Flag.IsHidden),this._toggleHidden(!1),this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.AfterShow),this.parent)){let oe=new We.ChildMessage("child-shown",this);za.sendMessage(this.parent,oe)}}hide(){if(!this.testFlag(We.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.BeforeHide),this.setFlag(We.Flag.IsHidden),this._toggleHidden(!0),this.isAttached&&(!this.parent||this.parent.isVisible)&&za.sendMessage(this,We.Msg.AfterHide),this.parent)){let oe=new We.ChildMessage("child-hidden",this);za.sendMessage(this.parent,oe)}}setHidden(oe){oe?this.hide():this.show()}testFlag(oe){return(this._flags&oe)!==0}setFlag(oe){this._flags|=oe}clearFlag(oe){this._flags&=~oe}processMessage(oe){switch(oe.type){case"resize":this.notifyLayout(oe),this.onResize(oe);break;case"update-request":this.notifyLayout(oe),this.onUpdateRequest(oe);break;case"fit-request":this.notifyLayout(oe),this.onFitRequest(oe);break;case"before-show":this.notifyLayout(oe),this.onBeforeShow(oe);break;case"after-show":this.setFlag(We.Flag.IsVisible),this.notifyLayout(oe),this.onAfterShow(oe);break;case"before-hide":this.notifyLayout(oe),this.onBeforeHide(oe);break;case"after-hide":this.clearFlag(We.Flag.IsVisible),this.notifyLayout(oe),this.onAfterHide(oe);break;case"before-attach":this.notifyLayout(oe),this.onBeforeAttach(oe);break;case"after-attach":!this.isHidden&&(!this.parent||this.parent.isVisible)&&this.setFlag(We.Flag.IsVisible),this.setFlag(We.Flag.IsAttached),this.notifyLayout(oe),this.onAfterAttach(oe);break;case"before-detach":this.notifyLayout(oe),this.onBeforeDetach(oe);break;case"after-detach":this.clearFlag(We.Flag.IsVisible),this.clearFlag(We.Flag.IsAttached),this.notifyLayout(oe),this.onAfterDetach(oe);break;case"activate-request":this.notifyLayout(oe),this.onActivateRequest(oe);break;case"close-request":this.notifyLayout(oe),this.onCloseRequest(oe);break;case"child-added":this.notifyLayout(oe),this.onChildAdded(oe);break;case"child-removed":this.notifyLayout(oe),this.onChildRemoved(oe);break;default:this.notifyLayout(oe);break}}notifyLayout(oe){this._layout&&this._layout.processParentMessage(oe)}onCloseRequest(oe){this.parent?this.parent=null:this.isAttached&&We.detach(this)}onResize(oe){}onUpdateRequest(oe){}onFitRequest(oe){}onActivateRequest(oe){}onBeforeShow(oe){}onAfterShow(oe){}onBeforeHide(oe){}onAfterHide(oe){}onBeforeAttach(oe){}onAfterAttach(oe){}onBeforeDetach(oe){}onAfterDetach(oe){}onChildAdded(oe){}onChildRemoved(oe){}_toggleHidden(oe){if(oe)switch(this._hiddenMode){case We.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case We.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case We.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1",this.node.style.opacity="0";break}else switch(this._hiddenMode){case We.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case We.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case We.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex="",this.node.style.opacity="";break}}};(function(We){(function(dt){dt[dt.Display=0]="Display",dt[dt.Scale=1]="Scale",dt[dt.ContentVisibility=2]="ContentVisibility"})(We.HiddenMode||(We.HiddenMode={})),(function(dt){dt[dt.IsDisposed=1]="IsDisposed",dt[dt.IsAttached=2]="IsAttached",dt[dt.IsHidden=4]="IsHidden",dt[dt.IsVisible=8]="IsVisible",dt[dt.DisallowLayout=16]="DisallowLayout"})(We.Flag||(We.Flag={})),(function(dt){dt.BeforeShow=new rf("before-show"),dt.AfterShow=new rf("after-show"),dt.BeforeHide=new rf("before-hide"),dt.AfterHide=new rf("after-hide"),dt.BeforeAttach=new rf("before-attach"),dt.AfterAttach=new rf("after-attach"),dt.BeforeDetach=new rf("before-detach"),dt.AfterDetach=new rf("after-detach"),dt.ParentChanged=new rf("parent-changed"),dt.UpdateRequest=new o0("update-request"),dt.FitRequest=new o0("fit-request"),dt.ActivateRequest=new o0("activate-request"),dt.CloseRequest=new o0("close-request")})(We.Msg||(We.Msg={}));class oe extends rf{constructor(Jt,jt){super(Jt),this.child=jt}}We.ChildMessage=oe;class Ie extends rf{constructor(Jt,jt){super("resize"),this.width=Jt,this.height=jt}}We.ResizeMessage=Ie,(function(dt){dt.UnknownSize=new dt(-1,-1)})(Ie=We.ResizeMessage||(We.ResizeMessage={}));function Oe(dt,Jt,jt=null){if(dt.parent)throw new Error("Cannot attach a child widget.");if(dt.isAttached||dt.node.isConnected)throw new Error("Widget is already attached.");if(!Jt.isConnected)throw new Error("Host is not attached.");za.sendMessage(dt,We.Msg.BeforeAttach),Jt.insertBefore(dt.node,jt),za.sendMessage(dt,We.Msg.AfterAttach)}We.attach=Oe;function Qe(dt){if(dt.parent)throw new Error("Cannot detach a child widget.");if(!dt.isAttached||!dt.node.isConnected)throw new Error("Widget is not attached.");za.sendMessage(dt,We.Msg.BeforeDetach),dt.node.parentNode.removeChild(dt.node),za.sendMessage(dt,We.Msg.AfterDetach)}We.detach=Qe})(Ya||(Ya={}));var rw;(function(We){We.titleProperty=new af({name:"title",create:Ie=>new hy({owner:Ie})});function oe(Ie){return Ie.node||document.createElement(Ie.tag||"div")}We.createNode=oe})(rw||(rw={}));var _p=class{constructor(oe={}){this._disposed=!1,this._parent=null,this._fitPolicy=oe.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,Ls.clearData(this),af.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(oe){if(this._parent!==oe){if(this._parent)throw new Error("Cannot change parent widget.");if(oe.layout!==this)throw new Error("Invalid parent widget.");this._parent=oe,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(oe){if(this._fitPolicy!==oe&&(this._fitPolicy=oe,this._parent)){let Ie=this._parent.node.style;Ie.minWidth="",Ie.minHeight="",Ie.maxWidth="",Ie.maxHeight="",this._parent.fit()}}processParentMessage(oe){switch(oe.type){case"resize":this.onResize(oe);break;case"update-request":this.onUpdateRequest(oe);break;case"fit-request":this.onFitRequest(oe);break;case"before-show":this.onBeforeShow(oe);break;case"after-show":this.onAfterShow(oe);break;case"before-hide":this.onBeforeHide(oe);break;case"after-hide":this.onAfterHide(oe);break;case"before-attach":this.onBeforeAttach(oe);break;case"after-attach":this.onAfterAttach(oe);break;case"before-detach":this.onBeforeDetach(oe);break;case"after-detach":this.onAfterDetach(oe);break;case"child-removed":this.onChildRemoved(oe);break;case"child-shown":this.onChildShown(oe);break;case"child-hidden":this.onChildHidden(oe);break}}init(){for(let oe of this)oe.parent=this.parent}onResize(oe){for(let Ie of this)za.sendMessage(Ie,Ya.ResizeMessage.UnknownSize)}onUpdateRequest(oe){for(let Ie of this)za.sendMessage(Ie,Ya.ResizeMessage.UnknownSize)}onBeforeAttach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onAfterAttach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onBeforeDetach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onAfterDetach(oe){for(let Ie of this)za.sendMessage(Ie,oe)}onBeforeShow(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onAfterShow(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onBeforeHide(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onAfterHide(oe){for(let Ie of this)Ie.isHidden||za.sendMessage(Ie,oe)}onChildRemoved(oe){this.removeWidget(oe.child)}onFitRequest(oe){}onChildShown(oe){}onChildHidden(oe){}};(function(We){function oe(dt){return t1.horizontalAlignmentProperty.get(dt)}We.getHorizontalAlignment=oe;function Ie(dt,Jt){t1.horizontalAlignmentProperty.set(dt,Jt)}We.setHorizontalAlignment=Ie;function Oe(dt){return t1.verticalAlignmentProperty.get(dt)}We.getVerticalAlignment=Oe;function Qe(dt,Jt){t1.verticalAlignmentProperty.set(dt,Jt)}We.setVerticalAlignment=Qe})(_p||(_p={}));var dv=class{constructor(oe){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=oe,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let oe=this.widget.node.style;oe.position="",oe.top="",oe.left="",oe.width="",oe.height="",oe.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let oe=Os.sizeLimits(this.widget.node);this._minWidth=oe.minWidth,this._minHeight=oe.minHeight,this._maxWidth=oe.maxWidth,this._maxHeight=oe.maxHeight}update(oe,Ie,Oe,Qe){let dt=Math.max(this._minWidth,Math.min(Oe,this._maxWidth)),Jt=Math.max(this._minHeight,Math.min(Qe,this._maxHeight));if(dt"center",changed:oe}),We.verticalAlignmentProperty=new af({name:"verticalAlignment",create:()=>"top",changed:oe});function oe(Ie){Ie.parent&&Ie.parent.layout&&Ie.parent.update()}})(t1||(t1={}));var r1=class extends _p{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(oe){this.insertWidget(this._widgets.length,oe)}insertWidget(oe,Ie){Ie.parent=this.parent;let Oe=this._widgets.indexOf(Ie),Qe=Math.max(0,Math.min(oe,this._widgets.length));if(Oe===-1){Sa.ArrayExt.insert(this._widgets,Qe,Ie),this.parent&&this.attachWidget(Qe,Ie);return}Qe===this._widgets.length&&Qe--,Oe!==Qe&&(Sa.ArrayExt.move(this._widgets,Oe,Qe),this.parent&&this.moveWidget(Oe,Qe,Ie))}removeWidget(oe){this.removeWidgetAt(this._widgets.indexOf(oe))}removeWidgetAt(oe){let Ie=Sa.ArrayExt.removeAt(this._widgets,oe);Ie&&this.parent&&this.detachWidget(oe,Ie)}init(){super.init();let oe=0;for(let Ie of this)this.attachWidget(oe++,Ie)}attachWidget(oe,Ie){let Oe=this.parent.node.children[oe];this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.insertBefore(Ie.node,Oe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach)}moveWidget(oe,Ie,Oe){this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Oe.node),this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.AfterDetach);let Qe=this.parent.node.children[Ie];this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.BeforeAttach),this.parent.node.insertBefore(Oe.node,Qe),this.parent.isAttached&&za.sendMessage(Oe,Ya.Msg.AfterAttach)}detachWidget(oe,Ie){this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach)}},dy;(function(We){function oe(Ie){return Math.max(0,Math.floor(Ie))}We.clampDimension=oe})(dy||(dy={}));var py=dy,xp=class We extends r1{constructor(oe){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=oe.renderer,oe.orientation!==void 0&&(this._orientation=oe.orientation),oe.alignment!==void 0&&(this._alignment=oe.alignment),oe.spacing!==void 0&&(this._spacing=dy.clampDimension(oe.spacing))}dispose(){for(let oe of this._items)oe.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(oe){this._orientation!==oe&&(this._orientation=oe,this.parent&&(this.parent.dataset.orientation=oe,this.parent.fit()))}get alignment(){return this._alignment}set alignment(oe){this._alignment!==oe&&(this._alignment=oe,this.parent&&(this.parent.dataset.alignment=oe,this.parent.update()))}get spacing(){return this._spacing}set spacing(oe){oe=dy.clampDimension(oe),this._spacing!==oe&&(this._spacing=oe,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map(oe=>oe.size)}relativeSizes(){return gp.normalize(this._sizers.map(oe=>oe.size))}setRelativeSizes(oe,Ie=!0){let Oe=this._sizers.length,Qe=oe.slice(0,Oe);for(;Qe.length0&&(dt.sizeHint=dt.size);ih.adjust(this._sizers,oe,Qe),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(oe,Ie){let Oe=new dv(Ie),Qe=gp.createHandle(this.renderer),dt=gp.averageSize(this._sizers),Jt=gp.createSizer(dt);Sa.ArrayExt.insert(this._items,oe,Oe),Sa.ArrayExt.insert(this._sizers,oe,Jt),Sa.ArrayExt.insert(this._handles,oe,Qe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.appendChild(Ie.node),this.parent.node.appendChild(Qe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach),this.parent.fit()}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._items,oe,Ie),Sa.ArrayExt.move(this._sizers,oe,Ie),Sa.ArrayExt.move(this._handles,oe,Ie),this.parent.fit()}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._items,oe),Qe=Sa.ArrayExt.removeAt(this._handles,oe);Sa.ArrayExt.removeAt(this._sizers,oe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.node.removeChild(Qe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach),Oe.dispose(),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}updateItemPosition(oe,Ie,Oe,Qe,dt,Jt,jt){let Xt=this._items[oe];if(Xt.isHidden)return;let nr=this._handles[oe].style;Ie?(Oe+=this.widgetOffset,Xt.update(Oe,Qe,jt,dt),Oe+=jt,nr.top=`${Qe}px`,nr.left=`${Oe}px`,nr.width=`${this._spacing}px`,nr.height=`${dt}px`):(Qe+=this.widgetOffset,Xt.update(Oe,Qe,Jt,jt),Qe+=jt,nr.top=`${Qe}px`,nr.left=`${Oe}px`,nr.width=`${Jt}px`,nr.height=`${this._spacing}px`)}_fit(){let oe=0,Ie=-1;for(let Xt=0,nr=this._items.length;Xt0&&(er.sizeHint=er.size),Ht.isHidden){er.minSize=0,er.maxSize=0;continue}Ht.fit(),er.stretch=We.getStretch(Ht.widget),Oe?(er.minSize=Ht.minWidth,er.maxSize=Ht.maxWidth,Qe+=Ht.minWidth,dt=Math.max(dt,Ht.minHeight)):(er.minSize=Ht.minHeight,er.maxSize=Ht.maxHeight,dt+=Ht.minHeight,Qe=Math.max(Qe,Ht.minWidth))}let Jt=this._box=Os.boxSizing(this.parent.node);Qe+=Jt.horizontalSum,dt+=Jt.verticalSum;let jt=this.parent.node.style;jt.minWidth=`${Qe}px`,jt.minHeight=`${dt}px`,this._dirty=!0,this.parent.parent&&za.sendMessage(this.parent.parent,Ya.Msg.FitRequest),this._dirty&&za.sendMessage(this.parent,Ya.Msg.UpdateRequest)}_update(oe,Ie){this._dirty=!1;let Oe=0;for(let er=0,ur=this._items.length;er0){let er;if(Ht?er=Math.max(0,Jt-this._fixed):er=Math.max(0,jt-this._fixed),this._hasNormedSizes){for(let ir of this._sizers)ir.sizeHint*=er;this._hasNormedSizes=!1}let ur=ih.calc(this._sizers,er);if(ur>0)switch(this._alignment){case"start":break;case"center":Xt=0,nr=ur/2;break;case"end":Xt=0,nr=ur;break;case"justify":Xt=ur/Oe,nr=0;break;default:throw"unreachable"}}for(let er=0,ur=this._items.length;er0,coerce:(Jt,jt)=>Math.max(0,Math.floor(jt)),changed:dt});function oe(Jt){let jt=new Wd;return jt.sizeHint=Math.floor(Jt),jt}We.createSizer=oe;function Ie(Jt){let jt=Jt.createHandle();return jt.style.position="absolute",jt.style.contain="style",jt}We.createHandle=Ie;function Oe(Jt){return Jt.reduce((jt,Xt)=>jt+Xt.size,0)/Jt.length||0}We.averageSize=Oe;function Qe(Jt){let jt=Jt.length;if(jt===0)return[];let Xt=Jt.reduce((nr,Ht)=>nr+Math.abs(Ht),0);return Xt===0?Jt.map(nr=>1/jt):Jt.map(nr=>nr/Xt)}We.normalize=Qe;function dt(Jt){Jt.parent&&Jt.parent.layout instanceof xp&&Jt.parent.fit()}})(gp||(gp={}));var XS=class extends xp{constructor(oe){super({...oe,orientation:oe.orientation||"vertical"}),this._titles=[],this.titleSpace=oe.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(oe){oe=py.clampDimension(oe),this.widgetOffset!==oe&&(this.widgetOffset=oe,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(oe,Ie){let Oe=this._titles[oe],Qe=Oe.classList.contains("lm-mod-expanded"),dt=iw.createTitle(this.renderer,Ie.title,Qe);this._titles[oe]=dt,this.parent.node.replaceChild(dt,Oe)}insertWidget(oe,Ie){Ie.id||(Ie.id=`id-${yp.UUID.uuid4()}`),super.insertWidget(oe,Ie)}attachWidget(oe,Ie){let Oe=iw.createTitle(this.renderer,Ie.title,!Ie.isHidden);Sa.ArrayExt.insert(this._titles,oe,Oe),this.parent.node.appendChild(Oe),Ie.node.setAttribute("role","region"),Ie.node.setAttribute("aria-labelledby",Oe.id),super.attachWidget(oe,Ie)}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._titles,oe,Ie),super.moveWidget(oe,Ie,Oe)}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._titles,oe);this.parent.node.removeChild(Oe),super.detachWidget(oe,Ie)}updateItemPosition(oe,Ie,Oe,Qe,dt,Jt,jt){let Xt=this._titles[oe].style;Xt.top=`${Qe}px`,Xt.left=`${Oe}px`,Xt.height=`${this.widgetOffset}px`,Ie?Xt.width=`${dt}px`:Xt.width=`${Jt}px`,super.updateItemPosition(oe,Ie,Oe,Qe,dt,Jt,jt)}},iw;(function(We){function oe(Ie,Oe,Qe=!0){let dt=Ie.createSectionTitle(Oe);return dt.style.position="absolute",dt.style.contain="strict",dt.setAttribute("aria-label",`${Oe.label} Section`),dt.setAttribute("aria-expanded",Qe?"true":"false"),dt.setAttribute("aria-controls",Oe.owner.id),Qe&&dt.classList.add("lm-mod-expanded"),dt}We.createTitle=oe})(iw||(iw={}));var aw=class extends Ya{constructor(oe={}){super(),this.addClass("lm-Panel"),this.layout=ZS.createLayout(oe)}get widgets(){return this.layout.widgets}addWidget(oe){this.layout.addWidget(oe)}insertWidget(oe,Ie){this.layout.insertWidget(oe,Ie)}},ZS;(function(We){function oe(Ie){return Ie.layout||new r1}We.createLayout=oe})(ZS||(ZS={}));var pv=class extends aw{constructor(oe={}){super({layout:KS.createLayout(oe)}),this._handleMoved=new Ls(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(oe){this.layout.orientation=oe}get alignment(){return this.layout.alignment}set alignment(oe){this.layout.alignment=oe}get spacing(){return this.layout.spacing}set spacing(oe){this.layout.spacing=oe}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(oe,Ie=!0){this.layout.setRelativeSizes(oe,Ie)}handleEvent(oe){switch(oe.type){case"pointerdown":this._evtPointerDown(oe);break;case"pointermove":this._evtPointerMove(oe);break;case"pointerup":this._evtPointerUp(oe);break;case"keydown":this._evtKeyDown(oe);break;case"contextmenu":oe.preventDefault(),oe.stopPropagation();break}}onBeforeAttach(oe){this.node.addEventListener("pointerdown",this)}onAfterDetach(oe){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(oe){oe.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(oe){oe.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(oe){this._pressData&&(oe.preventDefault(),oe.stopPropagation()),oe.keyCode===27&&this._releaseMouse()}_evtPointerDown(oe){if(oe.button!==0)return;let Ie=this.layout,Oe=Sa.ArrayExt.findFirstIndex(Ie.handles,nr=>nr.contains(oe.target));if(Oe===-1)return;oe.preventDefault(),oe.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let Qe,dt=Ie.handles[Oe],Jt=dt.getBoundingClientRect();Ie.orientation==="horizontal"?Qe=oe.clientX-Jt.left:Qe=oe.clientY-Jt.top;let jt=window.getComputedStyle(dt),Xt=nf.overrideCursor(jt.cursor);this._pressData={index:Oe,delta:Qe,override:Xt}}_evtPointerMove(oe){oe.preventDefault(),oe.stopPropagation();let Ie,Oe=this.layout,Qe=this.node.getBoundingClientRect();Oe.orientation==="horizontal"?Ie=oe.clientX-Qe.left-this._pressData.delta:Ie=oe.clientY-Qe.top-this._pressData.delta,Oe.moveHandle(this._pressData.index,Ie)}_evtPointerUp(oe){oe.button===0&&(oe.preventDefault(),oe.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}};(function(We){class oe{createHandle(){let dt=document.createElement("div");return dt.className="lm-SplitPanel-handle",dt}}We.Renderer=oe,We.defaultRenderer=new oe;function Ie(Qe){return xp.getStretch(Qe)}We.getStretch=Ie;function Oe(Qe,dt){xp.setStretch(Qe,dt)}We.setStretch=Oe})(pv||(pv={}));var KS;(function(We){function oe(Ie){return Ie.layout||new xp({renderer:Ie.renderer||pv.defaultRenderer,orientation:Ie.orientation,alignment:Ie.alignment,spacing:Ie.spacing})}We.createLayout=oe})(KS||(KS={}));var vy=class extends pv{constructor(oe={}){super({...oe,layout:JS.createLayout(oe)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new Ls(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(oe){this.layout.titleSpace=oe}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(oe){super.addWidget(oe),oe.title.changed.connect(this._onTitleChanged,this)}collapse(oe){let Ie=this.layout.widgets[oe];Ie&&!Ie.isHidden&&this._toggleExpansion(oe)}expand(oe){let Ie=this.layout.widgets[oe];Ie&&Ie.isHidden&&this._toggleExpansion(oe)}insertWidget(oe,Ie){super.insertWidget(oe,Ie),Ie.title.changed.connect(this._onTitleChanged,this)}handleEvent(oe){switch(super.handleEvent(oe),oe.type){case"click":this._evtClick(oe);break;case"keydown":this._eventKeyDown(oe);break}}onBeforeAttach(oe){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(oe)}onAfterDetach(oe){super.onAfterDetach(oe),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(oe){let Ie=Sa.ArrayExt.findFirstIndex(this.widgets,Oe=>Oe.contains(oe.owner));Ie>=0&&(this.layout.updateTitle(Ie,oe.owner),this.update())}_computeWidgetSize(oe){let Ie=this.layout,Oe=Ie.widgets[oe];if(!Oe)return;let Qe=Oe.isHidden,dt=Ie.absoluteSizes(),Jt=(Qe?-1:1)*this.spacing,jt=dt.reduce((nr,Ht)=>nr+Ht),Xt=[...dt];if(Qe){let nr=this._widgetSizesCache.get(Oe);if(!nr)return;Xt[oe]+=nr;let Ht=Xt.map(er=>er-nr>0).lastIndexOf(!0);Ht===-1?Xt.forEach((er,ur)=>{ur!==oe&&(Xt[ur]-=dt[ur]/jt*(nr-Jt))}):Xt[Ht]-=nr-Jt}else{let nr=dt[oe];this._widgetSizesCache.set(Oe,nr),Xt[oe]=0;let Ht=Xt.map(er=>er>0).lastIndexOf(!0);if(Ht===-1)return;Xt[Ht]=dt[Ht]+nr+Jt}return Xt.map(nr=>nr/(jt+Jt))}_evtClick(oe){let Ie=oe.target;if(Ie){let Oe=Sa.ArrayExt.findFirstIndex(this.titles,Qe=>Qe.contains(Ie));Oe>=0&&(oe.preventDefault(),oe.stopPropagation(),this._toggleExpansion(Oe))}}_eventKeyDown(oe){if(oe.defaultPrevented)return;let Ie=oe.target,Oe=!1;if(Ie){let Qe=Sa.ArrayExt.findFirstIndex(this.titles,dt=>dt.contains(Ie));if(Qe>=0){let dt=oe.keyCode.toString();if(oe.key.match(/Space|Enter/)||dt.match(/13|32/))Ie.click(),Oe=!0;else if(this.orientation==="horizontal"?oe.key.match(/ArrowLeft|ArrowRight/)||dt.match(/37|39/):oe.key.match(/ArrowUp|ArrowDown/)||dt.match(/38|40/)){let Jt=oe.key.match(/ArrowLeft|ArrowUp/)||dt.match(/37|38/)?-1:1,jt=this.titles.length,Xt=(Qe+jt+Jt)%jt;this.titles[Xt].focus(),Oe=!0}else oe.key==="End"||dt==="35"?(this.titles[this.titles.length-1].focus(),Oe=!0):(oe.key==="Home"||dt==="36")&&(this.titles[0].focus(),Oe=!0)}Oe&&oe.preventDefault()}}_toggleExpansion(oe){let Ie=this.titles[oe],Oe=this.layout.widgets[oe],Qe=this._computeWidgetSize(oe);Qe&&this.setRelativeSizes(Qe,!1),Oe.isHidden?(Ie.classList.add("lm-mod-expanded"),Ie.setAttribute("aria-expanded","true"),Oe.show()):(Ie.classList.remove("lm-mod-expanded"),Ie.setAttribute("aria-expanded","false"),Oe.hide()),this._expansionToggled.emit(oe)}};(function(We){class oe extends pv.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++oe._nInstance}createCollapseIcon(Oe){return document.createElement("span")}createSectionTitle(Oe){let Qe=document.createElement("h3");Qe.setAttribute("tabindex","0"),Qe.id=this.createTitleKey(Oe),Qe.className=this.titleClassName;for(let jt in Oe.dataset)Qe.dataset[jt]=Oe.dataset[jt];let dt=Qe.appendChild(this.createCollapseIcon(Oe));dt.className="lm-AccordionPanel-titleCollapser";let Jt=Qe.appendChild(document.createElement("span"));return Jt.className="lm-AccordionPanel-titleLabel",Jt.textContent=Oe.label,Jt.title=Oe.caption||Oe.label,Qe}createTitleKey(Oe){let Qe=this._titleKeys.get(Oe);return Qe===void 0&&(Qe=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(Oe,Qe)),Qe}}oe._nInstance=0,We.Renderer=oe,We.defaultRenderer=new oe})(vy||(vy={}));var JS;(function(We){function oe(Ie){return Ie.layout||new XS({renderer:Ie.renderer||vy.defaultRenderer,orientation:Ie.orientation,alignment:Ie.alignment,spacing:Ie.spacing,titleSpace:Ie.titleSpace})}We.createLayout=oe})(JS||(JS={}));var $d=class We extends r1{constructor(oe={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",oe.direction!==void 0&&(this._direction=oe.direction),oe.alignment!==void 0&&(this._alignment=oe.alignment),oe.spacing!==void 0&&(this._spacing=py.clampDimension(oe.spacing))}dispose(){for(let oe of this._items)oe.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(oe){this._direction!==oe&&(this._direction=oe,this.parent&&(this.parent.dataset.direction=oe,this.parent.fit()))}get alignment(){return this._alignment}set alignment(oe){this._alignment!==oe&&(this._alignment=oe,this.parent&&(this.parent.dataset.alignment=oe,this.parent.update()))}get spacing(){return this._spacing}set spacing(oe){oe=py.clampDimension(oe),this._spacing!==oe&&(this._spacing=oe,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(oe,Ie){Sa.ArrayExt.insert(this._items,oe,new dv(Ie)),Sa.ArrayExt.insert(this._sizers,oe,new Wd),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.appendChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach),this.parent.fit()}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._items,oe,Ie),Sa.ArrayExt.move(this._sizers,oe,Ie),this.parent.update()}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._items,oe);Sa.ArrayExt.removeAt(this._sizers,oe),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach),Oe.dispose(),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_fit(){let oe=0;for(let jt=0,Xt=this._items.length;jt0)switch(this._alignment){case"start":break;case"center":nr=0,Ht=Xt/2;break;case"end":nr=0,Ht=Xt;break;case"justify":nr=Xt/Oe,Ht=0;break;default:throw"unreachable"}for(let er=0,ur=this._items.length;er0,coerce:(Qe,dt)=>Math.max(0,Math.floor(dt)),changed:Oe}),We.sizeBasisProperty=new af({name:"sizeBasis",create:()=>0,coerce:(Qe,dt)=>Math.max(0,Math.floor(dt)),changed:Oe});function oe(Qe){return Qe==="left-to-right"||Qe==="right-to-left"}We.isHorizontal=oe;function Ie(Qe){return Math.max(0,Math.floor(Qe))}We.clampSpacing=Ie;function Oe(Qe){Qe.parent&&Qe.parent.layout instanceof $d&&Qe.parent.fit()}})(fv||(fv={}));var nw=class extends aw{constructor(oe={}){super({layout:QS.createLayout(oe)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(oe){this.layout.direction=oe}get alignment(){return this.layout.alignment}set alignment(oe){this.layout.alignment=oe}get spacing(){return this.layout.spacing}set spacing(oe){this.layout.spacing=oe}onChildAdded(oe){oe.child.addClass("lm-BoxPanel-child")}onChildRemoved(oe){oe.child.removeClass("lm-BoxPanel-child")}};(function(We){function oe(dt){return $d.getStretch(dt)}We.getStretch=oe;function Ie(dt,Jt){$d.setStretch(dt,Jt)}We.setStretch=Ie;function Oe(dt){return $d.getSizeBasis(dt)}We.getSizeBasis=Oe;function Qe(dt,Jt){$d.setSizeBasis(dt,Jt)}We.setSizeBasis=Qe})(nw||(nw={}));var QS;(function(We){function oe(Ie){return Ie.layout||new $d(Ie)}We.createLayout=oe})(QS||(QS={}));var ow=class We extends Ya{constructor(oe){super({node:mp.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(Ya.Flag.DisallowLayout),this.commands=oe.commands,this.renderer=oe.renderer||We.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(oe){let Ie=mp.createItem(this.commands,oe);return this._items.push(Ie),this.refresh(),Ie}addItems(oe){let Ie=oe.map(Oe=>mp.createItem(this.commands,Oe));return Ie.forEach(Oe=>this._items.push(Oe)),this.refresh(),Ie}removeItem(oe){this.removeItemAt(this._items.indexOf(oe))}removeItemAt(oe){Sa.ArrayExt.removeAt(this._items,oe)&&this.refresh()}clearItems(){this._items.length!==0&&(this._items.length=0,this.refresh())}refresh(){if(this._results=null,this.inputNode.value!==""){let oe=this.node.getElementsByClassName("lm-close-icon")[0];oe.style.display="inherit"}else{let oe=this.node.getElementsByClassName("lm-close-icon")[0];oe.style.display="none"}this.update()}handleEvent(oe){switch(oe.type){case"click":this._evtClick(oe);break;case"keydown":this._evtKeyDown(oe);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused();break}}onBeforeAttach(oe){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(oe){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(oe){this.update(),super.onAfterShow(oe)}onActivateRequest(oe){if(this.isAttached){let Ie=this.inputNode;Ie.focus(),Ie.select()}}onUpdateRequest(oe){if(!this.isVisible){Hd.render(null,this.contentNode);return}let Ie=this.inputNode.value,Oe=this.contentNode,Qe=this._results;if(Qe||(Qe=this._results=mp.search(this._items,Ie),this._activeIndex=Ie?Sa.ArrayExt.findFirstIndex(Qe,mp.canActivate):-1),!Ie&&Qe.length===0){Hd.render(null,Oe);return}if(Ie&&Qe.length===0){let Xt=this.renderer.renderEmptyMessage({query:Ie});Hd.render(Xt,Oe);return}let dt=this.renderer,Jt=this._activeIndex,jt=new Array(Qe.length);for(let Xt=0,nr=Qe.length;Xt=Qe.length)Oe.scrollTop=0;else{let Xt=Oe.children[Jt];Os.scrollIntoViewIfNeeded(Oe,Xt)}}_evtClick(oe){if(oe.button!==0)return;if(oe.target.classList.contains("lm-close-icon")){this.inputNode.value="",this.refresh();return}let Ie=Sa.ArrayExt.findFirstIndex(this.contentNode.children,Oe=>Oe.contains(oe.target));Ie!==-1&&(oe.preventDefault(),oe.stopPropagation(),this._execute(Ie))}_evtKeyDown(oe){if(!(oe.altKey||oe.ctrlKey||oe.metaKey||oe.shiftKey))switch(oe.keyCode){case 13:oe.preventDefault(),oe.stopPropagation(),this._execute(this._activeIndex);break;case 38:oe.preventDefault(),oe.stopPropagation(),this._activatePreviousItem();break;case 40:oe.preventDefault(),oe.stopPropagation(),this._activateNextItem();break}}_activateNextItem(){if(!this._results||this._results.length===0)return;let oe=this._activeIndex,Ie=this._results.length,Oe=oeKi-Ia),ti=de.slice(0,Vr),Xr=de.slice(Vr);for(let Ki=0,Ia=Xr.length;Kiar.command===ir&&yp.JSONExt.deepEqual(ar.args,Ot))||null}}})(mp||(mp={}));var hv=class We extends Ya{constructor(oe){super({node:of.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new Ls(this),this._menuRequested=new Ls(this),this.addClass("lm-Menu"),this.setFlag(Ya.Flag.DisallowLayout),this.commands=oe.commands,this.renderer=oe.renderer||We.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let oe=this;for(;oe._parentMenu;)oe=oe._parentMenu;return oe}get leafMenu(){let oe=this;for(;oe._childMenu;)oe=oe._childMenu;return oe}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(oe){this.activeIndex=oe?this._items.indexOf(oe):-1}get activeIndex(){return this._activeIndex}set activeIndex(oe){(oe<0||oe>=this._items.length)&&(oe=-1),oe!==-1&&!of.canActivate(this._items[oe])&&(oe=-1),this._activeIndex!==oe&&(this._activeIndex=oe,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let oe=this._items.length,Ie=this._activeIndex,Oe=Ie{this.activeIndex=jt}})}Hd.render(Jt,this.contentNode)}onCloseRequest(oe){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let Ie=this._childMenu;Ie&&(this._childIndex=-1,this._childMenu=null,Ie._parentMenu=null,Ie.close());let Oe=this._parentMenu;Oe&&(this._parentMenu=null,Oe._childIndex=-1,Oe._childMenu=null,Oe.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(oe)}_evtKeyDown(oe){oe.preventDefault(),oe.stopPropagation();let Ie=oe.keyCode;if(Ie===13){this.triggerActiveItem();return}if(Ie===27){this.close();return}if(Ie===37){this._parentMenu?this.close():this._menuRequested.emit("previous");return}if(Ie===38){this.activatePreviousItem();return}if(Ie===39){let Jt=this.activeItem;Jt&&Jt.type==="submenu"?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next");return}if(Ie===40){this.activateNextItem();return}let Oe=Jm().keyForKeydownEvent(oe);if(!Oe)return;let Qe=this._activeIndex+1,dt=of.findMnemonic(this._items,Oe,Qe);dt.index!==-1&&!dt.multiple?(this.activeIndex=dt.index,this.triggerActiveItem()):dt.index!==-1?this.activeIndex=dt.index:dt.auto!==-1&&(this.activeIndex=dt.auto)}_evtPointerUp(oe){oe.button===0&&(oe.preventDefault(),oe.stopPropagation(),this.triggerActiveItem())}_evtPointerMove(oe){let Ie=Sa.ArrayExt.findFirstIndex(this.contentNode.children,Qe=>Os.hitTest(Qe,oe.clientX,oe.clientY));if(Ie===this._activeIndex)return;if(this.activeIndex=Ie,Ie=this.activeIndex,Ie===this._childIndex){this._cancelOpenTimer(),this._cancelCloseTimer();return}this._childIndex!==-1&&this._startCloseTimer(),this._cancelOpenTimer();let Oe=this.activeItem;!Oe||Oe.type!=="submenu"||!Oe.submenu||this._startOpenTimer()}_evtPointerEnter(oe){for(let Ie=this._parentMenu;Ie;Ie=Ie._parentMenu)Ie._cancelOpenTimer(),Ie._cancelCloseTimer(),Ie.activeIndex=Ie._childIndex}_evtPointerLeave(oe){if(this._cancelOpenTimer(),!this._childMenu){this.activeIndex=-1;return}let{clientX:Ie,clientY:Oe}=oe;if(Os.hitTest(this._childMenu.node,Ie,Oe)){this._cancelCloseTimer();return}this.activeIndex=-1,this._startCloseTimer()}_evtPointerDown(oe){this._parentMenu||(of.hitTestMenus(this,oe.clientX,oe.clientY)?(oe.preventDefault(),oe.stopPropagation()):this.close())}_openChildMenu(oe=!1){let Ie=this.activeItem;if(!Ie||Ie.type!=="submenu"||!Ie.submenu){this._closeChildMenu();return}let Oe=Ie.submenu;if(Oe===this._childMenu)return;We.saveWindowData(),this._closeChildMenu(),this._childMenu=Oe,this._childIndex=this._activeIndex,Oe._parentMenu=this,za.sendMessage(this,Ya.Msg.UpdateRequest);let Qe=this.contentNode.children[this._activeIndex];of.openSubmenu(Oe,Qe),oe&&(Oe.activeIndex=-1,Oe.activateNextItem()),Oe.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){this._openTimerID===0&&(this._openTimerID=window.setTimeout(()=>{this._openTimerID=0,this._openChildMenu()},of.TIMER_DELAY))}_startCloseTimer(){this._closeTimerID===0&&(this._closeTimerID=window.setTimeout(()=>{this._closeTimerID=0,this._closeChildMenu()},of.TIMER_DELAY))}_cancelOpenTimer(){this._openTimerID!==0&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){this._closeTimerID!==0&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){of.saveWindowData()}};(function(We){class oe{renderItem(Oe){let Qe=this.createItemClass(Oe),dt=this.createItemDataset(Oe),Jt=this.createItemARIA(Oe);return Fs.li({className:Qe,dataset:dt,tabindex:"0",onfocus:Oe.onfocus,...Jt},this.renderIcon(Oe),this.renderLabel(Oe),this.renderShortcut(Oe),this.renderSubmenu(Oe))}renderIcon(Oe){let Qe=this.createIconClass(Oe);return Fs.div({className:Qe},Oe.item.icon,Oe.item.iconLabel)}renderLabel(Oe){let Qe=this.formatLabel(Oe);return Fs.div({className:"lm-Menu-itemLabel"},Qe)}renderShortcut(Oe){let Qe=this.formatShortcut(Oe);return Fs.div({className:"lm-Menu-itemShortcut"},Qe)}renderSubmenu(Oe){return Fs.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(Oe){let Qe="lm-Menu-item";Oe.item.isEnabled||(Qe+=" lm-mod-disabled"),Oe.item.isToggled&&(Qe+=" lm-mod-toggled"),Oe.item.isVisible||(Qe+=" lm-mod-hidden"),Oe.active&&(Qe+=" lm-mod-active"),Oe.collapsed&&(Qe+=" lm-mod-collapsed");let dt=Oe.item.className;return dt&&(Qe+=` ${dt}`),Qe}createItemDataset(Oe){let Qe,{type:dt,command:Jt,dataset:jt}=Oe.item;return dt==="command"?Qe={...jt,type:dt,command:Jt}:Qe={...jt,type:dt},Qe}createIconClass(Oe){let Qe="lm-Menu-itemIcon",dt=Oe.item.iconClass;return dt?`${Qe} ${dt}`:Qe}createItemARIA(Oe){let Qe={};switch(Oe.item.type){case"separator":Qe.role="presentation";break;case"submenu":Qe["aria-haspopup"]="true",Oe.item.isEnabled||(Qe["aria-disabled"]="true");break;default:Oe.item.isEnabled||(Qe["aria-disabled"]="true"),Oe.item.isToggled?(Qe.role="menuitemcheckbox",Qe["aria-checked"]="true"):Qe.role="menuitem"}return Qe}formatLabel(Oe){let{label:Qe,mnemonic:dt}=Oe.item;if(dt<0||dt>=Qe.length)return Qe;let Jt=Qe.slice(0,dt),jt=Qe.slice(dt+1),Xt=Qe[dt],nr=Fs.span({className:"lm-Menu-itemMnemonic"},Xt);return[Jt,nr,jt]}formatShortcut(Oe){let Qe=Oe.item.keyBinding;return Qe?vp.formatKeystroke(Qe.keys):null}}We.Renderer=oe,We.defaultRenderer=new oe})(hv||(hv={}));var of;(function(We){We.TIMER_DELAY=300,We.SUBMENU_OVERLAP=3;let oe=null,Ie=0;function Oe(){return Ie>0?(Ie--,oe):Ht()}function Qe(){oe=Ht(),Ie++}We.saveWindowData=Qe;function dt(){let ar=document.createElement("div"),Lr=document.createElement("ul");return Lr.className="lm-Menu-content",ar.appendChild(Lr),Lr.setAttribute("role","menu"),ar.tabIndex=0,ar}We.createNode=dt;function Jt(ar){return ar.type!=="separator"&&ar.isEnabled&&ar.isVisible}We.canActivate=Jt;function jt(ar,Lr){return new Ot(ar.commands,Lr)}We.createItem=jt;function Xt(ar,Lr,Ir){for(let de=ar;de;de=de.childMenu)if(Os.hitTest(de.node,Lr,Ir))return!0;return!1}We.hitTestMenus=Xt;function nr(ar){let Lr=new Array(ar.length);Sa.ArrayExt.fill(Lr,!1);let Ir=0,de=ar.length;for(;Ir=0;--Mr){let Vr=ar[Mr];if(Vr.isVisible){if(Vr.type!=="separator")break;Lr[Mr]=!0}}let qr=!1;for(;++IrKi+_i&&(Lr=Ki+_i-rs),!Mr&&Ir+Oo>Ia+ia&&(Ir>Ia+ia?Ir=Ia+ia-Oo:Ir=Ir-Oo),eo.transform=`translate(${Math.max(0,Lr)}px, ${Math.max(0,Ir)}px`,eo.opacity="1"}We.openRootMenu=er;function ur(ar,Lr){let Ir=Oe(),de=Ir.pageXOffset,Mr=Ir.pageYOffset,qr=Ir.clientWidth,Vr=Ir.clientHeight;za.sendMessage(ar,Ya.Msg.UpdateRequest);let ti=Vr,Xr=ar.node,Ki=Xr.style;Ki.opacity="0",Ki.maxHeight=`${ti}px`,Ya.attach(ar,document.body);let{width:Ia,height:_i}=Xr.getBoundingClientRect(),ia=Os.boxSizing(ar.node),Yr=Lr.getBoundingClientRect(),Ba=Yr.right-We.SUBMENU_OVERLAP;Ba+Ia>de+qr&&(Ba=Yr.left+We.SUBMENU_OVERLAP-Ia);let eo=Yr.top-ia.borderTop-ia.paddingTop;eo+_i>Mr+Vr&&(eo=Yr.bottom+ia.borderBottom+ia.paddingBottom-_i),Ki.transform=`translate(${Math.max(0,Ba)}px, ${Math.max(0,eo)}px`,Ki.opacity="1"}We.openSubmenu=ur;function ir(ar,Lr,Ir){let de=-1,Mr=-1,qr=!1,Vr=Lr.toUpperCase();for(let ti=0,Xr=ar.length;ti=0&&ia<_i.length){_i[ia].toUpperCase()===Vr&&(de===-1?de=Ki:qr=!0);continue}Mr===-1&&_i[0].toUpperCase()===Vr&&(Mr=Ki)}return{index:de,multiple:qr,auto:Mr}}We.findMnemonic=ir;class Ot{constructor(Lr,Ir){this._commands=Lr,this.type=Ir.type||"command",this.command=Ir.command||"",this.args=Ir.args||yp.JSONExt.emptyObject,this.submenu=Ir.submenu||null}get label(){return this.type==="command"?this._commands.label(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.label:""}get mnemonic(){return this.type==="command"?this._commands.mnemonic(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.mnemonic:-1}get icon(){if(this.type==="command")return this._commands.icon(this.command,this.args);if(this.type==="submenu"&&this.submenu)return this.submenu.title.icon}get iconClass(){return this.type==="command"?this._commands.iconClass(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconClass:""}get iconLabel(){return this.type==="command"?this._commands.iconLabel(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.iconLabel:""}get caption(){return this.type==="command"?this._commands.caption(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.caption:""}get className(){return this.type==="command"?this._commands.className(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.className:""}get dataset(){return this.type==="command"?this._commands.dataset(this.command,this.args):this.type==="submenu"&&this.submenu?this.submenu.title.dataset:{}}get isEnabled(){return this.type==="command"?this._commands.isEnabled(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0}get isToggled(){return this.type==="command"?this._commands.isToggled(this.command,this.args):!1}get isVisible(){return this.type==="command"?this._commands.isVisible(this.command,this.args):this.type==="submenu"?this.submenu!==null:!0}get keyBinding(){if(this.type==="command"){let{command:Lr,args:Ir}=this;return Sa.ArrayExt.findLastValue(this._commands.keyBindings,de=>de.command===Lr&&yp.JSONExt.deepEqual(de.args,Ir))||null}return null}}})(of||(of={}));var Mj;(function(We){function oe(Jt,jt){let Xt=Oe(Jt.selector),nr=Jt.rank!==void 0?Jt.rank:1/0;return{...Jt,selector:Xt,rank:nr,id:jt}}We.createItem=oe;function Ie(Jt,jt,Xt,nr){let Ht=jt.target;if(!Ht)return null;let er=jt.currentTarget;if(!er||!er.contains(Ht)&&(Ht=document.elementFromPoint(jt.clientX,jt.clientY),!Ht||!er.contains(Ht)))return null;let ur=[],ir=Jt.slice();for(;Ht!==null;){let Ot=[];for(let ar=0,Lr=ir.length;ar=this._titles.length)&&(oe=-1),this._currentIndex===oe)return;let Ie=this._currentIndex,Oe=this._titles[Ie]||null,Qe=oe,dt=this._titles[Qe]||null;this._currentIndex=Qe,this._previousTitle=Oe,this.update(),this._currentChanged.emit({previousIndex:Ie,previousTitle:Oe,currentIndex:Qe,currentTitle:dt})}get name(){return this._name}set name(oe){this._name=oe,oe?this.contentNode.setAttribute("aria-label",oe):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(oe){this._orientation!==oe&&(this._releaseMouse(),this._orientation=oe,this.dataset.orientation=oe,this.contentNode.setAttribute("aria-orientation",oe))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(oe){this._addButtonEnabled!==oe&&(this._addButtonEnabled=oe,oe?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(oe){return this.insertTab(this._titles.length,oe)}insertTab(oe,Ie){this._releaseMouse();let Oe=zh.asTitle(Ie),Qe=this._titles.indexOf(Oe),dt=Math.max(0,Math.min(oe,this._titles.length));return Qe===-1?(Sa.ArrayExt.insert(this._titles,dt,Oe),Oe.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(dt,Oe),Oe):(dt===this._titles.length&&dt--,Qe===dt||(Sa.ArrayExt.move(this._titles,Qe,dt),this.update(),this._adjustCurrentForMove(Qe,dt)),Oe)}removeTab(oe){this.removeTabAt(this._titles.indexOf(oe))}removeTabAt(oe){let Ie=oe>=0&&oe-1?this._currentIndex:0;for(let Xt=0,nr=Oe.length;XtOs.hitTest(Jt,oe.clientX,oe.clientY));if(Oe===-1)return;let Qe=this.titles[Oe],dt=Ie[Oe].querySelector(".lm-TabBar-tabLabel");if(dt&&dt.contains(oe.target)){let Jt=Qe.label||"",jt=dt.innerHTML;dt.innerHTML="";let Xt=document.createElement("input");Xt.classList.add("lm-TabBar-tabInput"),Xt.value=Jt,dt.appendChild(Xt);let nr=()=>{Xt.removeEventListener("blur",nr),dt.innerHTML=jt,this.node.addEventListener("keydown",this)};Xt.addEventListener("dblclick",Ht=>Ht.stopPropagation()),Xt.addEventListener("blur",nr),Xt.addEventListener("keydown",Ht=>{Ht.key==="Enter"?(Xt.value!==""&&(Qe.label=Qe.caption=Xt.value),nr()):Ht.key==="Escape"&&nr()}),this.node.removeEventListener("keydown",this),Xt.select(),Xt.focus(),dt.children.length>0&&dt.children[0].focus()}}_evtKeyDownCapturing(oe){oe.eventPhase===Event.CAPTURING_PHASE&&(oe.preventDefault(),oe.stopPropagation(),oe.key==="Escape"&&this._releaseMouse())}_evtKeyDown(oe){var Ie,Oe,Qe;if(!(oe.key==="Tab"||oe.eventPhase===Event.CAPTURING_PHASE)){if(oe.key==="Enter"||oe.key==="Spacebar"||oe.key===" "){let dt=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(dt))oe.preventDefault(),oe.stopPropagation(),this._addRequested.emit();else{let Jt=Sa.ArrayExt.findFirstIndex(this.contentNode.children,jt=>jt.contains(dt));Jt>=0&&(oe.preventDefault(),oe.stopPropagation(),this.currentIndex=Jt)}}else if(Oce.includes(oe.key)){let dt=[...this.contentNode.children];if(this.addButtonEnabled&&dt.push(this.addButtonNode),dt.length<=1)return;oe.preventDefault(),oe.stopPropagation();let Jt=dt.indexOf(document.activeElement);Jt===-1&&(Jt=this._currentIndex);let jt;oe.key==="ArrowRight"&&this._orientation==="horizontal"||oe.key==="ArrowDown"&&this._orientation==="vertical"?jt=(Ie=dt[Jt+1])!==null&&Ie!==void 0?Ie:dt[0]:oe.key==="ArrowLeft"&&this._orientation==="horizontal"||oe.key==="ArrowUp"&&this._orientation==="vertical"?jt=(Oe=dt[Jt-1])!==null&&Oe!==void 0?Oe:dt[dt.length-1]:oe.key==="Home"?jt=dt[0]:oe.key==="End"&&(jt=dt[dt.length-1]),jt&&((Qe=dt[Jt])===null||Qe===void 0||Qe.setAttribute("tabindex","-1"),jt?.setAttribute("tabindex","0"),jt.focus())}}}_evtPointerDown(oe){if(oe.button!==0&&oe.button!==1||this._dragData||oe.target.classList.contains("lm-TabBar-tabInput"))return;let Ie=this.addButtonEnabled&&this.addButtonNode.contains(oe.target),Oe=this.contentNode.children,Qe=Sa.ArrayExt.findFirstIndex(Oe,Jt=>Os.hitTest(Jt,oe.clientX,oe.clientY));if(Qe===-1&&!Ie||(oe.preventDefault(),oe.stopPropagation(),this._dragData={tab:Oe[Qe],index:Qe,pressX:oe.clientX,pressY:oe.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),oe.button===1||Ie))return;let dt=Oe[Qe].querySelector(this.renderer.closeIconSelector);dt&&dt.contains(oe.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===Qe?this.currentIndex=-1:this.currentIndex=Qe,this.currentIndex!==-1&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(oe){let Ie=this._dragData;if(!Ie)return;oe.preventDefault(),oe.stopPropagation();let Oe=this.contentNode.children;if(!(!Ie.dragActive&&!zh.dragExceeded(Ie,oe))){if(!Ie.dragActive){let Qe=Ie.tab.getBoundingClientRect();this._orientation==="horizontal"?(Ie.tabPos=Ie.tab.offsetLeft,Ie.tabSize=Qe.width,Ie.tabPressPos=Ie.pressX-Qe.left):(Ie.tabPos=Ie.tab.offsetTop,Ie.tabSize=Qe.height,Ie.tabPressPos=Ie.pressY-Qe.top),Ie.tabPressOffset={x:Ie.pressX-Qe.left,y:Ie.pressY-Qe.top},Ie.tabLayout=zh.snapTabLayout(Oe,this._orientation),Ie.contentRect=this.contentNode.getBoundingClientRect(),Ie.override=nf.overrideCursor("default"),Ie.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),Ie.dragActive=!0}if(!Ie.detachRequested&&zh.detachExceeded(Ie,oe)){Ie.detachRequested=!0;let Qe=Ie.index,dt=oe.clientX,Jt=oe.clientY,jt=Oe[Qe],Xt=this._titles[Qe];if(this._tabDetachRequested.emit({index:Qe,title:Xt,tab:jt,clientX:dt,clientY:Jt,offset:Ie.tabPressOffset}),Ie.dragAborted)return}zh.layoutTabs(Oe,Ie,oe,this._orientation)}}_evtPointerUp(oe){if(oe.button!==0&&oe.button!==1)return;let Ie=this._dragData;if(!Ie)return;if(oe.preventDefault(),oe.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!Ie.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(oe.target)){this._addRequested.emit(void 0);return}let dt=this.contentNode.children,Jt=Sa.ArrayExt.findFirstIndex(dt,nr=>Os.hitTest(nr,oe.clientX,oe.clientY));if(Jt!==Ie.index)return;let jt=this._titles[Jt];if(!jt.closable)return;if(oe.button===1){this._tabCloseRequested.emit({index:Jt,title:jt});return}let Xt=dt[Jt].querySelector(this.renderer.closeIconSelector);if(Xt&&Xt.contains(oe.target)){this._tabSizeFrozen=!0,this._tabCloseRequested.emit({index:Jt,title:jt});return}return}if(oe.button!==0)return;zh.finalizeTabPosition(Ie,this._orientation),Ie.tab.classList.remove("lm-mod-dragging");let Oe=zh.parseTransitionDuration(Ie.tab);setTimeout(()=>{if(Ie.dragAborted)return;this._dragData=null,zh.resetTabPositions(this.contentNode.children,this._orientation),Ie.override.dispose(),this.removeClass("lm-mod-dragging");let Qe=Ie.index,dt=Ie.targetIndex;dt===-1||Qe===dt||(Sa.ArrayExt.move(this._titles,Qe,dt),this._adjustCurrentForMove(Qe,dt),this._tabMoved.emit({fromIndex:Qe,toIndex:dt,title:this._titles[dt]}),za.sendMessage(this,Ya.Msg.UpdateRequest))},Oe)}_releaseMouse(){let oe=this._dragData;oe&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),oe.dragAborted=!0,oe.dragActive&&(zh.resetTabPositions(this.contentNode.children,this._orientation),oe.override.dispose(),oe.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(oe,Ie){let Oe=this.currentTitle,Qe=this._currentIndex,dt=this.insertBehavior;if(dt==="select-tab"||dt==="select-tab-if-needed"&&Qe===-1){this._currentIndex=oe,this._previousTitle=Oe,this._currentChanged.emit({previousIndex:Qe,previousTitle:Oe,currentIndex:oe,currentTitle:Ie});return}Qe>=oe&&this._currentIndex++}_adjustCurrentForMove(oe,Ie){this._currentIndex===oe?this._currentIndex=Ie:this._currentIndex=Ie?this._currentIndex++:this._currentIndex>oe&&this._currentIndex<=Ie&&this._currentIndex--}_adjustCurrentForRemove(oe,Ie){let Oe=this._currentIndex,Qe=this.removeBehavior;if(Oe!==oe){Oe>oe&&this._currentIndex--;return}if(this._titles.length===0){this._currentIndex=-1,this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:-1,currentTitle:null});return}if(Qe==="select-tab-after"){this._currentIndex=Math.min(oe,this._titles.length-1),this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(Qe==="select-tab-before"){this._currentIndex=Math.max(0,oe-1),this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if(Qe==="select-previous-tab"){this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(oe,this._titles.length-1),this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}this._currentIndex=-1,this._currentChanged.emit({previousIndex:oe,previousTitle:Ie,currentIndex:-1,currentTitle:null})}_onTitleChanged(oe){this.update()}_evtPointerLeave(oe){if(!this._tabSizeFrozen)return;this._tabSizeFrozen=!1,this._frozenTabWidths=null,this._unfreezeRunID++;let Ie=this._unfreezeRunID;this._clearUnfreezeTransitionState(),this.addClass("lm-mod-unfreezing");let Oe=this.contentNode.children;for(let Qe=0,dt=Oe.length;Qe{let Jt=dt.propertyName;(Jt==="width"||Jt==="flex-basis")&&this._finalizeUnfreezeRun(Ie)};this._unfreezeTransitionListener=Qe,this.node.addEventListener("transitionend",Qe),this.node.addEventListener("transitioncancel",Qe),this._unfreezeFallbackTimerID=window.setTimeout(()=>{this._finalizeUnfreezeRun(Ie)},2e3)}this.update()}_setFrozenTabSize(oe,Ie){let Oe=`${Ie}px`;oe.style.width=Oe,oe.style.flexBasis=Oe}_finalizeUnfreezeRun(oe){oe===this._unfreezeRunID&&(this._clearUnfreezeTransitionState(),this.removeClass("lm-mod-unfreezing"))}_clearUnfreezeTransitionState(){this._unfreezeTransitionListener&&(this.node.removeEventListener("transitionend",this._unfreezeTransitionListener),this.node.removeEventListener("transitioncancel",this._unfreezeTransitionListener),this._unfreezeTransitionListener=null),this._unfreezeFallbackTimerID!==0&&(clearTimeout(this._unfreezeFallbackTimerID),this._unfreezeFallbackTimerID=0)}_clearTabSizeFreezeState(){this._tabSizeFrozen=!1,this._frozenTabWidths=null,this.removeClass("lm-mod-unfreezing");let oe=this.contentNode.children;for(let Ie=0,Oe=oe.length;Ie=We.DRAG_THRESHOLD||ir>=We.DRAG_THRESHOLD}We.dragExceeded=dt;function Jt(Ht,er){let ur=Ht.contentRect;return er.clientX=ur.right+We.DETACH_THRESHOLD||er.clientY=ur.bottom+We.DETACH_THRESHOLD}We.detachExceeded=Jt;function jt(Ht,er,ur,ir){let Ot,ar,Lr,Ir;ir==="horizontal"?(Ot=er.pressX,ar=ur.clientX-er.contentRect.left,Lr=ur.clientX,Ir=er.contentRect.width):(Ot=er.pressY,ar=ur.clientY-er.contentRect.top,Lr=ur.clientY,Ir=er.contentRect.height);let de=er.index,Mr=ar-er.tabPressPos,qr=Mr+er.tabSize;for(let Vr=0,ti=Ht.length;Vr>1);if(Vrer.index&&qr>Ia)Xr=`${-er.tabSize-Ki.margin}px`,de=Math.max(de,Vr);else if(Vr===er.index){let _i=Lr-Ot,ia=Ir-(er.tabPos+er.tabSize);Xr=`${Math.max(-er.tabPos,Math.min(_i,ia))}px`}else Xr="";ir==="horizontal"?Ht[Vr].style.left=Xr:Ht[Vr].style.top=Xr}er.targetIndex=de}We.layoutTabs=jt;function Xt(Ht,er){let ur;er==="horizontal"?ur=Ht.contentRect.width:ur=Ht.contentRect.height;let ir;if(Ht.targetIndex===Ht.index)ir=0;else if(Ht.targetIndex>Ht.index){let Lr=Ht.tabLayout[Ht.targetIndex];ir=Lr.pos+Lr.size-Ht.tabSize-Ht.tabPos}else ir=Ht.tabLayout[Ht.targetIndex].pos-Ht.tabPos;let Ot=ur-(Ht.tabPos+Ht.tabSize),ar=Math.max(-Ht.tabPos,Math.min(ir,Ot));er==="horizontal"?Ht.tab.style.left=`${ar}px`:Ht.tab.style.top=`${ar}px`}We.finalizeTabPosition=Xt;function nr(Ht,er){for(let ur of Ht)er==="horizontal"?ur.style.left="":ur.style.top=""}We.resetTabPositions=nr})(zh||(zh={}));var eE=class extends _p{constructor(oe){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=oe.renderer,oe.spacing!==void 0&&(this._spacing=py.clampDimension(oe.spacing)),this._document=oe.document||document,this._hiddenMode=oe.hiddenMode!==void 0?oe.hiddenMode:Ya.HiddenMode.Display}dispose(){let oe=this[Symbol.iterator]();this._items.forEach(Ie=>{Ie.dispose()}),this._box=null,this._root=null,this._items.clear();for(let Ie of oe)Ie.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(oe){if(this._hiddenMode!==oe){this._hiddenMode=oe;for(let Ie of this.tabBars())if(Ie.titles.length>1)for(let Oe of Ie.titles)Oe.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(oe){oe=py.clampDimension(oe),this._spacing!==oe&&(this._spacing=oe,this.parent&&this.parent.fit())}get isEmpty(){return this._root===null}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():(0,Sa.empty)()}widgets(){return this._root?this._root.iterUserWidgets():(0,Sa.empty)()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():(0,Sa.empty)()}tabBars(){return this._root?this._root.iterTabBars():(0,Sa.empty)()}handles(){return this._root?this._root.iterHandles():(0,Sa.empty)()}moveHandle(oe,Ie,Oe){let Qe=oe.classList.contains("lm-mod-hidden");if(!this._root||Qe)return;let dt=this._root.findSplitNode(oe);if(!dt)return;let Jt;dt.node.orientation==="horizontal"?Jt=Ie-oe.offsetLeft:Jt=Oe-oe.offsetTop,Jt!==0&&(dt.node.holdSizes(),ih.adjust(dt.node.sizers,dt.index,Jt),this.parent&&this.parent.update())}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(oe){let Ie=new Set,Oe;oe.main?Oe=Xl.normalizeAreaConfig(oe.main,Ie):Oe=null;let Qe=this.widgets(),dt=this.tabBars(),Jt=this.handles();this._root=null;for(let jt of Qe)Ie.has(jt)||(jt.parent=null);for(let jt of dt)jt.dispose();for(let jt of Jt)jt.parentNode&&jt.parentNode.removeChild(jt);for(let jt of Ie)jt.parent=this.parent;Oe?this._root=Xl.realizeAreaConfig(Oe,{createTabBar:jt=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):this._root=null,this.parent&&(Ie.forEach(jt=>{this.attachWidget(jt)}),this.parent.fit())}addWidget(oe,Ie={}){let Oe=Ie.ref||null,Qe=Ie.mode||"tab-after",dt=null;if(this._root&&Oe&&(dt=this._root.findTabNode(Oe)),Oe&&!dt)throw new Error("Reference widget is not in the layout.");switch(oe.parent=this.parent,Qe){case"tab-after":this._insertTab(oe,Oe,dt,!0);break;case"tab-before":this._insertTab(oe,Oe,dt,!1);break;case"split-top":this._insertSplit(oe,Oe,dt,"vertical",!1);break;case"split-left":this._insertSplit(oe,Oe,dt,"horizontal",!1);break;case"split-right":this._insertSplit(oe,Oe,dt,"horizontal",!0);break;case"split-bottom":this._insertSplit(oe,Oe,dt,"vertical",!0);break;case"merge-top":this._insertSplit(oe,Oe,dt,"vertical",!1,!0);break;case"merge-left":this._insertSplit(oe,Oe,dt,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(oe,Oe,dt,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(oe,Oe,dt,"vertical",!0,!0);break}this.parent&&(this.attachWidget(oe),this.parent.fit())}removeWidget(oe){this._removeWidget(oe),this.parent&&(this.detachWidget(oe),this.parent.fit())}hitTestTabAreas(oe,Ie){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=Os.boxSizing(this.parent.node));let Oe=this.parent.node.getBoundingClientRect(),Qe=oe-Oe.left-this._box.borderLeft,dt=Ie-Oe.top-this._box.borderTop,Jt=this._root.hitTestTabNodes(Qe,dt);if(!Jt)return null;let{tabBar:jt,top:Xt,left:nr,width:Ht,height:er}=Jt,ur=this._box.borderLeft+this._box.borderRight,ir=this._box.borderTop+this._box.borderBottom,Ot=Oe.width-ur-(nr+Ht),ar=Oe.height-ir-(Xt+er);return{tabBar:jt,x:Qe,y:dt,top:Xt,left:nr,right:Ot,bottom:ar,width:Ht,height:er}}init(){super.init();for(let oe of this)this.attachWidget(oe);for(let oe of this.handles())this.parent.node.appendChild(oe);this.parent.fit()}attachWidget(oe){this.parent.node!==oe.node.parentNode&&(this._items.set(oe,new dv(oe)),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeAttach),this.parent.node.appendChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterAttach))}detachWidget(oe){if(this.parent.node!==oe.node.parentNode)return;this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeDetach),this.parent.node.removeChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterDetach);let Ie=this._items.get(oe);Ie&&(this._items.delete(oe),Ie.dispose())}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_removeWidget(oe){if(!this._root)return;let Ie=this._root.findTabNode(oe);if(!Ie)return;if(Xl.removeAria(oe),Ie.tabBar.titles.length>1){if(Ie.tabBar.removeTab(oe.title),this._hiddenMode===Ya.HiddenMode.Scale&&Ie.tabBar.titles.length==1){let ur=Ie.tabBar.titles[0].owner;ur.hiddenMode=Ya.HiddenMode.Display}return}if(Ie.tabBar.dispose(),this._root===Ie){this._root=null;return}this._root.holdAllSizes();let Oe=Ie.parent;Ie.parent=null;let Qe=Sa.ArrayExt.removeFirstOf(Oe.children,Ie),dt=Sa.ArrayExt.removeAt(Oe.handles,Qe);if(Sa.ArrayExt.removeAt(Oe.sizers,Qe),dt.parentNode&&dt.parentNode.removeChild(dt),Oe.children.length>1){Oe.syncHandles();return}let Jt=Oe.parent;Oe.parent=null;let jt=Oe.children[0],Xt=Oe.handles[0];if(Oe.children.length=0,Oe.handles.length=0,Oe.sizers.length=0,Xt.parentNode&&Xt.parentNode.removeChild(Xt),this._root===Oe){jt.parent=null,this._root=jt;return}let nr=Jt,Ht=nr.children.indexOf(Oe);if(jt instanceof Xl.TabLayoutNode){jt.parent=nr,nr.children[Ht]=jt;return}let er=Sa.ArrayExt.removeAt(nr.handles,Ht);Sa.ArrayExt.removeAt(nr.children,Ht),Sa.ArrayExt.removeAt(nr.sizers,Ht),er.parentNode&&er.parentNode.removeChild(er);for(let ur=0,ir=jt.children.length;ur=this._left+this._width||Ot=this._top+this._height?null:this}createConfig(){let ir=this.tabBar.titles.map(ar=>ar.owner),Ot=this.tabBar.currentIndex;return{type:"tab-area",widgets:ir,currentIndex:Ot}}holdAllSizes(){}fit(ir,Ot){let ar=0,Lr=0,Ir=1/0,de=1/0,Mr=Ot.get(this.tabBar),qr=this.tabBar.currentTitle,Vr=qr?Ot.get(qr.owner):void 0,[ti,Xr]=this.sizers;return Mr&&Mr.fit(),Vr&&Vr.fit(),Mr&&!Mr.isHidden?(ar=Math.max(ar,Mr.minWidth),Lr+=Mr.minHeight,ti.minSize=Mr.minHeight,ti.maxSize=Mr.maxHeight):(ti.minSize=0,ti.maxSize=0),Vr&&!Vr.isHidden?(ar=Math.max(ar,Vr.minWidth),Lr+=Vr.minHeight,Xr.minSize=Vr.minHeight,Xr.maxSize=1/0):(Xr.minSize=0,Xr.maxSize=1/0),{minWidth:ar,minHeight:Lr,maxWidth:Ir,maxHeight:de}}update(ir,Ot,ar,Lr,Ir,de){this._top=Ot,this._left=ir,this._width=ar,this._height=Lr;let Mr=de.get(this.tabBar),qr=this.tabBar.currentTitle,Vr=qr?de.get(qr.owner):void 0;if(ih.calc(this.sizers,Lr),Mr&&!Mr.isHidden){let ti=this.sizers[0].size;Mr.update(ir,Ot,ar,ti),Ot+=ti}if(Vr&&!Vr.isHidden){let ti=this.sizers[1].size;Vr.update(ir,Ot,ar,ti)}}}We.TabLayoutNode=Qe;class dt{constructor(ir){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=ir}*iterAllWidgets(){for(let ir of this.children)yield*ir.iterAllWidgets()}*iterUserWidgets(){for(let ir of this.children)yield*ir.iterUserWidgets()}*iterSelectedWidgets(){for(let ir of this.children)yield*ir.iterSelectedWidgets()}*iterTabBars(){for(let ir of this.children)yield*ir.iterTabBars()}*iterHandles(){yield*this.handles;for(let ir of this.children)yield*ir.iterHandles()}findTabNode(ir){for(let Ot=0,ar=this.children.length;OtLr.createConfig());return{type:"split-area",orientation:ir,children:ar,sizes:Ot}}syncHandles(){this.handles.forEach((ir,Ot)=>{ir.setAttribute("data-orientation",this.orientation),Ot===this.handles.length-1?ir.classList.add("lm-mod-hidden"):ir.classList.remove("lm-mod-hidden")})}holdSizes(){for(let ir of this.sizers)ir.sizeHint=ir.size}holdAllSizes(){for(let ir of this.children)ir.holdAllSizes();this.holdSizes()}normalizeSizes(){let ir=this.sizers.length;if(ir===0)return;this.holdSizes();let Ot=this.sizers.reduce((ar,Lr)=>ar+Lr.sizeHint,0);if(Ot===0)for(let ar of this.sizers)ar.size=ar.sizeHint=1/ir;else for(let ar of this.sizers)ar.size=ar.sizeHint/=Ot;this.normalized=!0}createNormalizedSizes(){let ir=this.sizers.length;if(ir===0)return[];let Ot=this.sizers.map(Lr=>Lr.size),ar=Ot.reduce((Lr,Ir)=>Lr+Ir,0);if(ar===0)for(let Lr=Ot.length-1;Lr>-1;Lr--)Ot[Lr]=1/ir;else for(let Lr=Ot.length-1;Lr>-1;Lr--)Ot[Lr]/=ar;return Ot}fit(ir,Ot){let ar=this.orientation==="horizontal",Lr=Math.max(0,this.children.length-1)*ir,Ir=ar?Lr:0,de=ar?0:Lr,Mr=1/0,qr=1/0;for(let Vr=0,ti=this.children.length;Vr=Ot.length)&&(ar=0),{type:"tab-area",widgets:Ot,currentIndex:ar}}function nr(ur,ir){let Ot=ur.orientation,ar=[],Lr=[];for(let Ir=0,de=ur.children.length;Ir{let de=Oe(Lr,ir,Ot),Mr=oe(ur.sizes[Ir]),qr=ir.createHandle();ar.children.push(de),ar.handles.push(qr),ar.sizers.push(Mr),de.parent=ar}),ar.syncHandles(),ar.normalizeSizes(),ar}})(Xl||(Xl={}));var sw=class We extends Ya{constructor(oe={}){super(),this._drag=null,this._tabsMovable=!0,this._tabsConstrained=!1,this._addButtonEnabled=!1,this._pressData=null,this._layoutModified=new Ls(this),this._addRequested=new Ls(this),this.addClass("lm-DockPanel"),this._document=oe.document||document,this._mode=oe.mode||"multiple-document",this._renderer=oe.renderer||We.defaultRenderer,this._edges=oe.edges||Rl.DEFAULT_EDGES,oe.tabsMovable!==void 0&&(this._tabsMovable=oe.tabsMovable),oe.tabsConstrained!==void 0&&(this._tabsConstrained=oe.tabsConstrained),oe.addButtonEnabled!==void 0&&(this._addButtonEnabled=oe.addButtonEnabled),this.dataset.mode=this._mode;let Ie={createTabBar:()=>this._createTabBar(),createHandle:()=>this._createHandle()};this.layout=new eE({document:this._document,renderer:Ie,spacing:oe.spacing,hiddenMode:oe.hiddenMode}),this.overlay=oe.overlay||new We.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(oe){this.layout.hiddenMode=oe}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(oe){this.layout.spacing=oe}get mode(){return this._mode}set mode(oe){if(this._mode===oe)return;this._mode=oe,this.dataset.mode=oe;let Ie=this.layout;switch(oe){case"multiple-document":for(let Oe of Ie.tabBars())Oe.show();break;case"single-document":Ie.restoreLayout(Rl.createSingleDocumentConfig(this));break;default:throw"unreachable"}za.postMessage(this,Rl.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(oe){this._tabsMovable=oe;for(let Ie of this.tabBars())Ie.tabsMovable=oe}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(oe){this._tabsConstrained=oe}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(oe){this._addButtonEnabled=oe;for(let Ie of this.tabBars())Ie.addButtonEnabled=oe}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(oe){let Ie=(0,Sa.find)(this.tabBars(),Oe=>Oe.titles.indexOf(oe.title)!==-1);if(!Ie)throw new Error("Widget is not contained in the dock panel.");Ie.currentTitle=oe.title}activateWidget(oe){this.selectWidget(oe),oe.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(oe){this._mode="multiple-document",this.layout.restoreLayout(oe),(Nc.IS_EDGE||Nc.IS_IE)&&za.flush(),za.postMessage(this,Rl.LayoutModified)}addWidget(oe,Ie={}){this._mode==="single-document"?this.layout.addWidget(oe):this.layout.addWidget(oe,Ie),za.postMessage(this,Rl.LayoutModified)}processMessage(oe){oe.type==="layout-modified"?this._layoutModified.emit(void 0):super.processMessage(oe)}handleEvent(oe){switch(oe.type){case"lm-dragenter":this._evtDragEnter(oe);break;case"lm-dragleave":this._evtDragLeave(oe);break;case"lm-dragover":this._evtDragOver(oe);break;case"lm-drop":this._evtDrop(oe);break;case"pointerdown":this._evtPointerDown(oe);break;case"pointermove":this._evtPointerMove(oe);break;case"pointerup":this._evtPointerUp(oe);break;case"keydown":this._evtKeyDown(oe);break;case"contextmenu":oe.preventDefault(),oe.stopPropagation();break}}onBeforeAttach(oe){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(oe){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(oe){Rl.isGeneratedTabBarProperty.get(oe.child)||oe.child.addClass("lm-DockPanel-widget")}onChildRemoved(oe){Rl.isGeneratedTabBarProperty.get(oe.child)||(oe.child.removeClass("lm-DockPanel-widget"),za.postMessage(this,Rl.LayoutModified))}_evtDragEnter(oe){oe.mimeData.hasData("application/vnd.lumino.widget-factory")&&(oe.preventDefault(),oe.stopPropagation())}_evtDragLeave(oe){oe.preventDefault(),!(this._tabsConstrained&&oe.source!==this)&&(oe.stopPropagation(),this.overlay.hide(1))}_evtDragOver(oe){oe.preventDefault(),this._tabsConstrained&&oe.source!==this||this._showOverlay(oe.clientX,oe.clientY)==="invalid"?oe.dropAction="none":(oe.stopPropagation(),oe.dropAction=oe.proposedAction)}_evtDrop(oe){if(oe.preventDefault(),this.overlay.hide(0),oe.proposedAction==="none"){oe.dropAction="none";return}let{clientX:Ie,clientY:Oe}=oe,{zone:Qe,target:dt}=Rl.findDropTarget(this,Ie,Oe,this._edges);if(this._tabsConstrained&&oe.source!==this||Qe==="invalid"){oe.dropAction="none";return}let jt=oe.mimeData.getData("application/vnd.lumino.widget-factory");if(typeof jt!="function"){oe.dropAction="none";return}let Xt=jt();if(!(Xt instanceof Ya)){oe.dropAction="none";return}if(Xt.contains(this)){oe.dropAction="none";return}let nr=dt?Rl.getDropRef(dt.tabBar):null;switch(Qe){case"root-all":this.addWidget(Xt);break;case"root-top":this.addWidget(Xt,{mode:"split-top"});break;case"root-left":this.addWidget(Xt,{mode:"split-left"});break;case"root-right":this.addWidget(Xt,{mode:"split-right"});break;case"root-bottom":this.addWidget(Xt,{mode:"split-bottom"});break;case"widget-all":this.addWidget(Xt,{mode:"tab-after",ref:nr});break;case"widget-top":this.addWidget(Xt,{mode:"split-top",ref:nr});break;case"widget-left":this.addWidget(Xt,{mode:"split-left",ref:nr});break;case"widget-right":this.addWidget(Xt,{mode:"split-right",ref:nr});break;case"widget-bottom":this.addWidget(Xt,{mode:"split-bottom",ref:nr});break;case"widget-tab":this.addWidget(Xt,{mode:"tab-after",ref:nr});break;default:throw"unreachable"}oe.dropAction=oe.proposedAction,oe.stopPropagation(),this.activateWidget(Xt)}_evtKeyDown(oe){oe.preventDefault(),oe.stopPropagation(),oe.keyCode===27&&(this._releaseMouse(),za.postMessage(this,Rl.LayoutModified))}_evtPointerDown(oe){if(oe.button!==0)return;let Ie=this.layout,Oe=oe.target,Qe=(0,Sa.find)(Ie.handles(),Ht=>Ht.contains(Oe));if(!Qe)return;oe.preventDefault(),oe.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let dt=Qe.getBoundingClientRect(),Jt=oe.clientX-dt.left,jt=oe.clientY-dt.top,Xt=window.getComputedStyle(Qe),nr=nf.overrideCursor(Xt.cursor,this._document);this._pressData={handle:Qe,deltaX:Jt,deltaY:jt,override:nr}}_evtPointerMove(oe){if(!this._pressData)return;oe.preventDefault(),oe.stopPropagation();let Ie=this.node.getBoundingClientRect(),Oe=oe.clientX-Ie.left-this._pressData.deltaX,Qe=oe.clientY-Ie.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,Oe,Qe)}_evtPointerUp(oe){oe.button===0&&(oe.preventDefault(),oe.stopPropagation(),this._releaseMouse(),za.postMessage(this,Rl.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(oe,Ie){let{zone:Oe,target:Qe}=Rl.findDropTarget(this,oe,Ie,this._edges);if(Oe==="invalid")return this.overlay.hide(100),Oe;let dt,Jt,jt,Xt,nr=Os.boxSizing(this.node),Ht=this.node.getBoundingClientRect();switch(Oe){case"root-all":dt=nr.paddingTop,Jt=nr.paddingLeft,jt=nr.paddingRight,Xt=nr.paddingBottom;break;case"root-top":dt=nr.paddingTop,Jt=nr.paddingLeft,jt=nr.paddingRight,Xt=Ht.height*Rl.GOLDEN_RATIO;break;case"root-left":dt=nr.paddingTop,Jt=nr.paddingLeft,jt=Ht.width*Rl.GOLDEN_RATIO,Xt=nr.paddingBottom;break;case"root-right":dt=nr.paddingTop,Jt=Ht.width*Rl.GOLDEN_RATIO,jt=nr.paddingRight,Xt=nr.paddingBottom;break;case"root-bottom":dt=Ht.height*Rl.GOLDEN_RATIO,Jt=nr.paddingLeft,jt=nr.paddingRight,Xt=nr.paddingBottom;break;case"widget-all":dt=Qe.top,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom;break;case"widget-top":dt=Qe.top,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom+Qe.height/2;break;case"widget-left":dt=Qe.top,Jt=Qe.left,jt=Qe.right+Qe.width/2,Xt=Qe.bottom;break;case"widget-right":dt=Qe.top,Jt=Qe.left+Qe.width/2,jt=Qe.right,Xt=Qe.bottom;break;case"widget-bottom":dt=Qe.top+Qe.height/2,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom;break;case"widget-tab":{let er=Qe.tabBar.node.getBoundingClientRect().height;dt=Qe.top,Jt=Qe.left,jt=Qe.right,Xt=Qe.bottom+Qe.height-er;break}default:throw"unreachable"}return this.overlay.show({top:dt,left:Jt,right:jt,bottom:Xt}),Oe}_createTabBar(){let oe=this._renderer.createTabBar(this._document);return Rl.isGeneratedTabBarProperty.set(oe,!0),this._mode==="single-document"&&oe.hide(),oe.tabsMovable=this._tabsMovable,oe.allowDeselect=!1,oe.addButtonEnabled=this._addButtonEnabled,oe.removeBehavior="select-previous-tab",oe.insertBehavior="select-tab-if-needed",oe.tabMoved.connect(this._onTabMoved,this),oe.currentChanged.connect(this._onCurrentChanged,this),oe.tabCloseRequested.connect(this._onTabCloseRequested,this),oe.tabDetachRequested.connect(this._onTabDetachRequested,this),oe.tabActivateRequested.connect(this._onTabActivateRequested,this),oe.addRequested.connect(this._onTabAddRequested,this),oe}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){za.postMessage(this,Rl.LayoutModified)}_onCurrentChanged(oe,Ie){let{previousTitle:Oe,currentTitle:Qe}=Ie;Oe&&Oe.owner.hide(),Qe&&Qe.owner.show(),(Nc.IS_EDGE||Nc.IS_IE)&&za.flush(),za.postMessage(this,Rl.LayoutModified)}_onTabAddRequested(oe){this._addRequested.emit(oe)}_onTabActivateRequested(oe,Ie){Ie.title.owner.activate()}_onTabCloseRequested(oe,Ie){Ie.title.owner.close()}_onTabDetachRequested(oe,Ie){if(this._drag)return;oe.releaseMouse();let{title:Oe,tab:Qe,clientX:dt,clientY:Jt,offset:jt}=Ie,Xt=new yp.MimeData,nr=()=>Oe.owner;Xt.setData("application/vnd.lumino.widget-factory",nr);let Ht=Qe.cloneNode(!0);jt&&(Ht.style.top=`-${jt.y}px`,Ht.style.left=`-${jt.x}px`),this._drag=new nf({document:this._document,mimeData:Xt,dragImage:Ht,proposedAction:"move",supportedActions:"move",source:this}),Qe.classList.add("lm-mod-hidden");let er=()=>{this._drag=null,Qe.classList.remove("lm-mod-hidden")};this._drag.start(dt,Jt).then(er)}};(function(We){class oe{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(Qe){let dt=this.node.style;dt.top=`${Qe.top}px`,dt.left=`${Qe.left}px`,dt.right=`${Qe.right}px`,dt.bottom=`${Qe.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(Qe){if(!this._hidden){if(Qe<=0){clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden");return}this._timer===-1&&(this._timer=window.setTimeout(()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")},Qe))}}}We.Overlay=oe;class Ie{createTabBar(Qe){let dt=new i1({document:Qe});return dt.addClass("lm-DockPanel-tabBar"),dt}createHandle(){let Qe=document.createElement("div");return Qe.className="lm-DockPanel-handle",Qe}}We.Renderer=Ie,We.defaultRenderer=new Ie})(sw||(sw={}));var Rl;(function(We){We.GOLDEN_RATIO=.618,We.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},We.LayoutModified=new o0("layout-modified"),We.isGeneratedTabBarProperty=new af({name:"isGeneratedTabBar",create:()=>!1});function oe(Qe){if(Qe.isEmpty)return{main:null};let dt=Array.from(Qe.widgets()),Jt=Qe.selectedWidgets().next().value,jt=Jt?dt.indexOf(Jt):-1;return{main:{type:"tab-area",widgets:dt,currentIndex:jt}}}We.createSingleDocumentConfig=oe;function Ie(Qe,dt,Jt,jt){if(!Os.hitTest(Qe.node,dt,Jt))return{zone:"invalid",target:null};let Xt=Qe.layout;if(Xt.isEmpty)return{zone:"root-all",target:null};if(Qe.mode==="multiple-document"){let Mr=Qe.node.getBoundingClientRect(),qr=dt-Mr.left+1,Vr=Jt-Mr.top+1,ti=Mr.right-dt,Xr=Mr.bottom-Jt;switch(Math.min(Vr,ti,Xr,qr)){case Vr:if(Vrar&&ur>ar&&er>Lr&&ir>Lr)return{zone:"widget-all",target:nr};Ht/=ar,er/=Lr,ur/=ar,ir/=Lr;let Ir=Math.min(Ht,er,ur,ir),de;switch(Ir){case Ht:de="widget-left";break;case er:de="widget-top";break;case ur:de="widget-right";break;case ir:de="widget-bottom";break;default:throw"unreachable"}return{zone:de,target:nr}}We.findDropTarget=Ie;function Oe(Qe){return Qe.titles.length===0?null:Qe.currentTitle?Qe.currentTitle.owner:Qe.titles[Qe.titles.length-1].owner}We.getDropRef=Oe})(Rl||(Rl={}));var my=class We extends _p{constructor(oe={}){super(oe),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new Wd],this._columnSizers=[new Wd],this._box=null,oe.rowCount!==void 0&&Au.reallocSizers(this._rowSizers,oe.rowCount),oe.columnCount!==void 0&&Au.reallocSizers(this._columnSizers,oe.columnCount),oe.rowSpacing!==void 0&&(this._rowSpacing=Au.clampValue(oe.rowSpacing)),oe.columnSpacing!==void 0&&(this._columnSpacing=Au.clampValue(oe.columnSpacing))}dispose(){for(let oe of this._items){let Ie=oe.widget;oe.dispose(),Ie.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(oe){oe!==this.rowCount&&(Au.reallocSizers(this._rowSizers,oe),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(oe){oe!==this.columnCount&&(Au.reallocSizers(this._columnSizers,oe),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(oe){oe=Au.clampValue(oe),this._rowSpacing!==oe&&(this._rowSpacing=oe,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(oe){oe=Au.clampValue(oe),this._columnSpacing!==oe&&(this._columnSpacing=oe,this.parent&&this.parent.fit())}rowStretch(oe){let Ie=this._rowSizers[oe];return Ie?Ie.stretch:-1}setRowStretch(oe,Ie){let Oe=this._rowSizers[oe];Oe&&(Ie=Au.clampValue(Ie),Oe.stretch!==Ie&&(Oe.stretch=Ie,this.parent&&this.parent.update()))}columnStretch(oe){let Ie=this._columnSizers[oe];return Ie?Ie.stretch:-1}setColumnStretch(oe,Ie){let Oe=this._columnSizers[oe];Oe&&(Ie=Au.clampValue(Ie),Oe.stretch!==Ie&&(Oe.stretch=Ie,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(let oe of this._items)yield oe.widget}addWidget(oe){Sa.ArrayExt.findFirstIndex(this._items,Oe=>Oe.widget===oe)===-1&&(this._items.push(new dv(oe)),this.parent&&this.attachWidget(oe))}removeWidget(oe){let Ie=Sa.ArrayExt.findFirstIndex(this._items,Qe=>Qe.widget===oe);if(Ie===-1)return;let Oe=Sa.ArrayExt.removeAt(this._items,Ie);this.parent&&this.detachWidget(oe),Oe.dispose()}init(){super.init();for(let oe of this)this.attachWidget(oe)}attachWidget(oe){this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeAttach),this.parent.node.appendChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterAttach),this.parent.fit()}detachWidget(oe){this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.BeforeDetach),this.parent.node.removeChild(oe.node),this.parent.isAttached&&za.sendMessage(oe,Ya.Msg.AfterDetach),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_fit(){for(let Xt=0,nr=this.rowCount;Xt!Xt.isHidden);for(let Xt=0,nr=oe.length;Xt({row:0,column:0,rowSpan:1,columnSpan:1}),changed:jt});function oe(Xt){let nr=Math.max(0,Math.floor(Xt.row||0)),Ht=Math.max(0,Math.floor(Xt.column||0)),er=Math.max(1,Math.floor(Xt.rowSpan||0)),ur=Math.max(1,Math.floor(Xt.columnSpan||0));return{row:nr,column:Ht,rowSpan:er,columnSpan:ur}}We.normalizeConfig=oe;function Ie(Xt){return Math.max(0,Math.floor(Xt))}We.clampValue=Ie;function Oe(Xt,nr){let Ht=We.cellConfigProperty.get(Xt.widget),er=We.cellConfigProperty.get(nr.widget);return Ht.rowSpan-er.rowSpan}We.rowSpanCmp=Oe;function Qe(Xt,nr){let Ht=We.cellConfigProperty.get(Xt.widget),er=We.cellConfigProperty.get(nr.widget);return Ht.columnSpan-er.columnSpan}We.columnSpanCmp=Qe;function dt(Xt,nr){for(nr=Math.max(1,Math.floor(nr));Xt.lengthnr&&(Xt.length=nr)}We.reallocSizers=dt;function Jt(Xt,nr,Ht,er){if(Ht=er)return;let ir=(er-ur)/(Ht-nr+1);for(let Ot=nr;Ot<=Ht;++Ot)Xt[Ot].minSize+=ir}We.distributeMin=Jt;function jt(Xt){Xt.parent&&Xt.parent.layout instanceof my&&Xt.parent.fit()}})(Au||(Au={}));var lw=class We extends Ya{constructor(oe={}){super({node:uw.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(Ya.Flag.DisallowLayout),this.renderer=oe.renderer||We.defaultRenderer,this._forceItemsPosition=oe.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=oe.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(oe){this.activeIndex=oe?this._menus.indexOf(oe):-1}get activeIndex(){return this._activeIndex}set activeIndex(oe){(oe<0||oe>=this._menus.length)&&(oe=-1),oe>-1&&this._menus[oe].items.length===0&&(oe=-1),this._activeIndex!==oe&&(this._activeIndex=oe,this.update())}get menus(){return this._menus}openActiveMenu(){this._activeIndex!==-1&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(oe,Ie=!0){this.insertMenu(this._menus.length,oe,Ie)}insertMenu(oe,Ie,Oe=!0){this._closeChildMenu();let Qe=this._menus.indexOf(Ie),dt=Math.max(0,Math.min(oe,this._menus.length));if(Qe===-1){Sa.ArrayExt.insert(this._menus,dt,Ie),Ie.addClass("lm-MenuBar-menu"),Ie.aboutToClose.connect(this._onMenuAboutToClose,this),Ie.menuRequested.connect(this._onMenuMenuRequested,this),Ie.title.changed.connect(this._onTitleChanged,this),Oe&&this.update();return}dt===this._menus.length&&dt--,Qe!==dt&&(Sa.ArrayExt.move(this._menus,Qe,dt),Oe&&this.update())}removeMenu(oe,Ie=!0){this.removeMenuAt(this._menus.indexOf(oe),Ie)}removeMenuAt(oe,Ie=!0){this._closeChildMenu();let Oe=Sa.ArrayExt.removeAt(this._menus,oe);Oe&&(Oe.aboutToClose.disconnect(this._onMenuAboutToClose,this),Oe.menuRequested.disconnect(this._onMenuMenuRequested,this),Oe.title.changed.disconnect(this._onTitleChanged,this),Oe.removeClass("lm-MenuBar-menu"),Ie&&this.update())}clearMenus(){if(this._menus.length!==0){this._closeChildMenu();for(let oe of this._menus)oe.aboutToClose.disconnect(this._onMenuAboutToClose,this),oe.menuRequested.disconnect(this._onMenuMenuRequested,this),oe.title.changed.disconnect(this._onTitleChanged,this),oe.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(oe){switch(oe.type){case"keydown":this._evtKeyDown(oe);break;case"pointerdown":this._evtPointerDown(oe);break;case"pointermove":case"pointerleave":this._evtPointerMove(oe);break;case"focusout":this._evtFocusOut(oe);break;case"contextmenu":oe.preventDefault(),oe.stopPropagation();break}}onBeforeAttach(oe){this.node.addEventListener("keydown",this),this.node.addEventListener("pointerdown",this),this.node.addEventListener("pointermove",this),this.node.addEventListener("pointerleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(oe){this.node.removeEventListener("keydown",this),this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("pointermove",this),this.node.removeEventListener("pointerleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(oe){this.isAttached&&this._focusItemAt(0)}onResize(oe){this.update(),super.onResize(oe)}onUpdateRequest(oe){var Ie;let Oe=this._menus,Qe=this.renderer,dt=this._activeIndex,Jt=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:Oe.length,Xt=0,nr=!1;jt=this._overflowMenu!==null?jt-1:jt;let Ht=new Array(jt);for(let er=0;er{this._tabFocusIndex=er,this.activeIndex=er}}),Xt+=this._menuItemSizes[er],Oe[er].title.label===this._overflowMenuOptions.title&&(nr=!0,jt--);if(this._overflowMenuOptions.isVisible){if(this._overflowIndex>-1&&!nr){if(this._overflowMenu===null){let er=(Ie=this._overflowMenuOptions.title)!==null&&Ie!==void 0?Ie:"...";this._overflowMenu=new hv({commands:new vp}),this._overflowMenu.title.label=er,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let er=Oe.length-2;er>=jt;er--){let ur=this.menus[er];ur.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:ur}),this.removeMenu(ur,!1)}Ht[jt]=Qe.renderItem({title:this._overflowMenu.title,active:jt===dt&&Oe[jt].items.length!==0,tabbable:jt===Jt,disabled:Oe[jt].items.length===0,onfocus:()=>{this._tabFocusIndex=jt,this.activeIndex=jt}}),jt++}else if(this._overflowMenu!==null){let er=this._overflowMenu.items,ur=this.node.offsetWidth,ir=this._overflowMenu.items.length;for(let Ot=0;Otthis._menuItemSizes[ar]){let Lr=er[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(jt,Lr,!1),Ht[jt]=Qe.renderItem({title:Lr.title,active:!1,tabbable:jt===Jt,disabled:Oe[jt].items.length===0,onfocus:()=>{this._tabFocusIndex=jt,this.activeIndex=jt}}),jt++}}this._overflowMenu.items.length===0&&(this.removeMenu(this._overflowMenu,!1),Ht.pop(),this._overflowMenu=null,this._overflowIndex=-1)}}Hd.render(Ht,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;let oe=this.contentNode.childNodes,Ie=this.node.offsetWidth,Oe=0,Qe=-1,dt=oe.length;if(this._menuItemSizes.length==0)for(let Jt=0;JtIe&&Qe===-1&&(Qe=Jt)}else for(let Jt=0;JtIe){Qe=Jt;break}this._overflowIndex=Qe}_evtKeyDown(oe){let Ie=oe.keyCode;if(Ie===9){this.activeIndex=-1;return}if(oe.preventDefault(),oe.stopPropagation(),Ie===13||Ie===32||Ie===38||Ie===40){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;this.openActiveMenu();return}if(Ie===27){this._closeChildMenu(),this._focusItemAt(this.activeIndex);return}if(Ie===37||Ie===39){let Jt=Ie===37?-1:1,jt=this._tabFocusIndex+Jt,Xt=this._menus.length;for(let nr=0;nrOs.hitTest(Oe,oe.clientX,oe.clientY));if(Ie===-1){this._closeChildMenu();return}if(oe.button===0)if(this._childMenu)this._closeChildMenu(),this.activeIndex=Ie;else{oe.preventDefault();let Oe=this._positionForMenu(Ie);hv.saveWindowData(),this.activeIndex=Ie,this._openChildMenu(Oe)}}_evtPointerMove(oe){let Ie=Sa.ArrayExt.findFirstIndex(this.contentNode.children,Qe=>Os.hitTest(Qe,oe.clientX,oe.clientY));if(Ie===this._activeIndex||Ie===-1&&this._childMenu)return;let Oe=Ie>=0&&this._childMenu?this._positionForMenu(Ie):null;hv.saveWindowData(),this.activeIndex=Ie,Oe&&this._openChildMenu(Oe)}_positionForMenu(oe){let Ie=this.contentNode.children[oe],{left:Oe,bottom:Qe}=Ie.getBoundingClientRect();return{top:Qe,left:Oe}}_evtFocusOut(oe){!this._childMenu&&!this.node.contains(oe.relatedTarget)&&(this.activeIndex=-1)}_focusItemAt(oe){let Ie=this.contentNode.childNodes[oe];Ie&&Ie.focus()}_openChildMenu(oe={}){let Ie=this.activeMenu;if(!Ie){this._closeChildMenu();return}let Oe=this._childMenu;if(Oe===Ie)return;this._childMenu=Ie,Oe?Oe.close():document.addEventListener("pointerdown",this,!0),this._tabFocusIndex=this.activeIndex,za.sendMessage(this,Ya.Msg.UpdateRequest);let{left:Qe,top:dt}=oe;(typeof Qe>"u"||typeof dt>"u")&&({left:Qe,top:dt}=this._positionForMenu(this._activeIndex)),Oe||this.addClass("lm-mod-active"),Ie.items.length>0&&Ie.open(Qe,dt,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0);let oe=this._childMenu;this._childMenu=null,oe.close(),this.activeIndex=-1}_onMenuAboutToClose(oe){oe===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(oe,Ie){if(oe!==this._childMenu)return;let Oe=this._activeIndex,Qe=this._menus.length;switch(Ie){case"next":this.activeIndex=Oe===Qe-1?0:Oe+1;break;case"previous":this.activeIndex=Oe===0?Qe-1:Oe-1;break}this.openActiveMenu()}_onTitleChanged(){this.update()}};(function(We){class oe{renderItem(Oe){let Qe=this.createItemClass(Oe),dt=this.createItemDataset(Oe),Jt=this.createItemARIA(Oe);return Fs.li({className:Qe,dataset:dt,...Oe.disabled?{}:{tabindex:Oe.tabbable?"0":"-1"},onfocus:Oe.onfocus,...Jt},this.renderIcon(Oe),this.renderLabel(Oe))}renderIcon(Oe){let Qe=this.createIconClass(Oe);return Fs.div({className:Qe},Oe.title.icon,Oe.title.iconLabel)}renderLabel(Oe){let Qe=this.formatLabel(Oe);return Fs.div({className:"lm-MenuBar-itemLabel"},Qe)}createItemClass(Oe){let Qe="lm-MenuBar-item";return Oe.title.className&&(Qe+=` ${Oe.title.className}`),Oe.active&&!Oe.disabled&&(Qe+=" lm-mod-active"),Qe}createItemDataset(Oe){return Oe.title.dataset}createItemARIA(Oe){return{role:"menuitem","aria-haspopup":"true","aria-disabled":Oe.disabled?"true":"false"}}createIconClass(Oe){let Qe="lm-MenuBar-itemIcon",dt=Oe.title.iconClass;return dt?`${Qe} ${dt}`:Qe}formatLabel(Oe){let{label:Qe,mnemonic:dt}=Oe.title;if(dt<0||dt>=Qe.length)return Qe;let Jt=Qe.slice(0,dt),jt=Qe.slice(dt+1),Xt=Qe[dt],nr=Fs.span({className:"lm-MenuBar-itemMnemonic"},Xt);return[Jt,nr,jt]}}We.Renderer=oe,We.defaultRenderer=new oe})(lw||(lw={}));var uw;(function(We){function oe(){let Oe=document.createElement("div"),Qe=document.createElement("ul");return Qe.className="lm-MenuBar-content",Oe.appendChild(Qe),Qe.setAttribute("role","menubar"),Oe}We.createNode=oe;function Ie(Oe,Qe,dt){let Jt=-1,jt=-1,Xt=!1,nr=Qe.toUpperCase();for(let Ht=0,er=Oe.length;Ht=0&&Ot1&&this.widgets.forEach(Ie=>{Ie.hiddenMode=this._hiddenMode}))}dispose(){for(let oe of this._items)oe.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(oe,Ie){this._hiddenMode===Ya.HiddenMode.Scale&&this._items.length>0?(this._items.length===1&&(this.widgets[0].hiddenMode=Ya.HiddenMode.Scale),Ie.hiddenMode=Ya.HiddenMode.Scale):Ie.hiddenMode=Ya.HiddenMode.Display,Sa.ArrayExt.insert(this._items,oe,new dv(Ie)),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeAttach),this.parent.node.appendChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterAttach),this.parent.fit()}moveWidget(oe,Ie,Oe){Sa.ArrayExt.move(this._items,oe,Ie),this.parent.update()}detachWidget(oe,Ie){let Oe=Sa.ArrayExt.removeAt(this._items,oe);this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.BeforeDetach),this.parent.node.removeChild(Ie.node),this.parent.isAttached&&za.sendMessage(Ie,Ya.Msg.AfterDetach),Oe.widget.node.style.zIndex="",this._hiddenMode===Ya.HiddenMode.Scale&&(Ie.hiddenMode=Ya.HiddenMode.Display,this._items.length===1&&(this._items[0].widget.hiddenMode=Ya.HiddenMode.Display)),Oe.dispose(),this.parent.fit()}onBeforeShow(oe){super.onBeforeShow(oe),this.parent.update()}onBeforeAttach(oe){super.onBeforeAttach(oe),this.parent.fit()}onChildShown(oe){this.parent.fit()}onChildHidden(oe){this.parent.fit()}onResize(oe){this.parent.isVisible&&this._update(oe.width,oe.height)}onUpdateRequest(oe){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(oe){this.parent.isAttached&&this._fit()}_fit(){let oe=0,Ie=0;for(let dt=0,Jt=this._items.length;dt{this.createGraph(this._model)})}renderModel(oe){if(this.hasGraphElement()){let Oe=this._model?.data[this._mimeType];return JSON.stringify(Oe)===JSON.stringify(oe.data[this._mimeType])?Promise.resolve():(this._model=oe,this.createGraph(oe))}this._model=oe;let Ie=oe.data["image/png"];return Ie!=null?(this.updateImage(Ie),Promise.resolve()):this.createGraph(oe)}hasGraphElement(){return this.node.querySelector(".plot-container")!==null}updateImage(oe){this.hideGraph(),this._img_el.src="data:image/png;base64,"+oe,this.showImage()}hideGraph(){let oe=this.node.querySelector(".plot-container");oe!=null&&(oe.style.display="none")}showGraph(){let oe=this.node.querySelector(".plot-container");oe!=null&&(oe.style.display="block")}hideImage(){let oe=this.node.querySelector(".plot-img");oe!=null&&(oe.style.display="none")}showImage(){let oe=this.node.querySelector(".plot-img");oe!=null&&(oe.style.display="block")}createGraph(oe){let{data:Ie,layout:Oe,frames:Qe,config:dt}=oe.data[this._mimeType];return Oe.height||(Oe.height=360),(async()=>(We.Plotly===null&&(We.Plotly=await Promise.resolve().then(()=>hp(hU())),We._resolveLoadingPlotly()),We.loadingPlotly))().then(()=>We.Plotly.react(this.node,Ie,Oe,dt)).then(jt=>{this.showGraph(),this.hideImage(),this.update(),Qe&&We.Plotly.addFrames(this.node,Qe),this.node.offsetWidth>0&&this.node.offsetHeight>0&&We.Plotly.toImage(jt,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then(Xt=>{let nr=Xt.split(",")[1];oe.data["image/png"]!==nr&&oe.setData({data:{...oe.data,"image/png":nr}})}),this.node.on("plotly_webglcontextlost",()=>{let Xt=oe.data["image/png"];if(Xt!=null)return this.updateImage(Xt),Promise.resolve()})})}onAfterShow(oe){this.update()}onResize(oe){this.update()}onUpdateRequest(oe){We.Plotly&&this.isVisible&&this.hasGraphElement()&&We.Plotly.redraw(this.node).then(()=>{We.Plotly.Plots.resize(this.node)})}static{this.Plotly=null}static{this.loadingPlotly=new Promise(oe=>{We._resolveLoadingPlotly=oe})}},Uce={safe:!0,mimeTypes:[dU],createRenderer:We=>new cE(We)},qce=[{id:"@jupyterlab/plotly-extension:factory",rendererFactory:Uce,rank:2,dataType:"json",fileTypes:[{name:"plotly",mimeTypes:[dU],extensions:[".plotly",".plotly.json"],iconClass:jce}],documentWidgetFactoryOptions:{name:"Plotly",primaryFileType:"plotly",fileTypes:["plotly","json"],defaultFor:["plotly"]}}],$me=qce;export{dU as MIME_TYPE,cE as RenderedPlotly,$me as default,Uce as rendererFactory}; /*! Bundled license information: plotly.js/dist/plotly.js: diff --git a/plotly/labextension/package.json b/plotly/labextension/package.json index c64871a4fc7..57ea10da4a3 100644 --- a/plotly/labextension/package.json +++ b/plotly/labextension/package.json @@ -33,7 +33,7 @@ "outputDir": "../plotly/labextension", "webpackConfig": "./webpack.config.js", "_build": { - "load": "static/remoteEntry.1dda3c8f6e5cd2a3.js", + "load": "static/remoteEntry.954b872b457cd897.js", "mimeExtension": "./mimeExtension" } } diff --git a/plotly/labextension/static/0.03957c7088ad5ed0.js b/plotly/labextension/static/0.d6f08baae2d5090c.js similarity index 99% rename from plotly/labextension/static/0.03957c7088ad5ed0.js rename to plotly/labextension/static/0.d6f08baae2d5090c.js index f01accdf45c..a3c7b17d480 100644 --- a/plotly/labextension/static/0.03957c7088ad5ed0.js +++ b/plotly/labextension/static/0.d6f08baae2d5090c.js @@ -3523,4 +3523,4 @@ precision highp float; in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758 );color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:Pc("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;uniform vec3 u_globe_position;uniform float u_globe_radius;in vec3 v_view_direction;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (u_sky_blend > 0.0) {vec3 ray=normalize(v_view_direction);float globe_distance=length(u_globe_position);float angle_to_globe_center=acos(clamp(dot(ray,u_globe_position)/globe_distance,-1.0,1.0));float horizon_angle=asin(min(u_globe_radius/globe_distance,1.0));blend=mix(blend,(angle_to_globe_center-horizon_angle)*u_camera_to_center_distance*u_device_pixel_ratio,u_sky_blend);}if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","layout(location=0) in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 v_view_direction;void main() {v_view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,1.0,1.0);}")},Ob=class{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return"mercator"}get shaderDefine(){return"#define PROJECTION_MERCATOR"}get shaderPreludeCode(){return Ox.projectionMercator}get vertexShaderPreludeCode(){return Ox.projectionMercator.vertexSource}get subdivisionGranularity(){return Dz.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}destroy(){}getMeshFromTileID(t,r,i,n,a){if(this._cachedMesh)return this._cachedMesh;let o=new Es;o.emplaceBack(0,0),o.emplaceBack(Mf,0),o.emplaceBack(0,Mf),o.emplaceBack(Mf,Mf);let s=t.createVertexBuffer(o,Fz.members),l=ED.simpleSegment(0,0,4,2),u=new EA;u.emplaceBack(1,0,2),u.emplaceBack(1,2,3);let c=t.createIndexBuffer(u);return this._cachedMesh=new FP(s,c,l),this._cachedMesh}recalculate(){}hasTransition(){return!1}},O_=class t{constructor(t=0,r=0,i=0,n=0){if(isNaN(t)||t<0||isNaN(r)||r<0||isNaN(i)||i<0||isNaN(n)||n<0)throw Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=r,this.left=i,this.right=n}interpolate(t,r,i){return null!=r.top&&null!=t.top&&(this.top=kx.number(t.top,r.top,i)),null!=r.bottom&&null!=t.bottom&&(this.bottom=kx.number(t.bottom,r.bottom,i)),null!=r.left&&null!=t.left&&(this.left=kx.number(t.left,r.left,i)),null!=r.right&&null!=t.right&&(this.right=kx.number(t.right,r.right,i)),this}getCenter(t,r){return new vu(xr((this.left+t-this.right)/2,0,t),xr((this.top+r-this.bottom)/2,0,r))}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new t(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}},Ow=class{constructor(t,r){var i;this.applyConstrain=(t,r)=>null===this._constrainOverride?this._callbacks.defaultConstrain(t,r):this._constrainOverride(t,r),this._callbacks=t,this._tileSize=512,this._renderWorldCopies=r?.renderWorldCopies===void 0||!!r?.renderWorldCopies,this._minZoom=r?.minZoom||0,this._maxZoom=r?.maxZoom||22,this._minPitch=r?.minPitch===void 0||r?.minPitch===null?0:r?.minPitch,this._maxPitch=r?.maxPitch===void 0||r?.maxPitch===null?60:r?.maxPitch,this._constrainOverride=null!=(i=r?.constrainOverride)?i:null,this.setMaxBounds(),this._width=0,this._height=0,this._center=new DQ(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Pd(this._zoom),this._scale=xo(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new O_,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(t,r,i){this._constrainOverride=t.constrainOverride,this._latRange=t.latRange,this._lngRange=t.lngRange,this._width=t.width,this._height=t.height,this._center=t.center,this._elevation=t.elevation,this._minElevationForCurrentTile=t.minElevationForCurrentTile,this._zoom=t.zoom,this._tileZoom=Pd(this._zoom),this._scale=xo(this._zoom),this._bearingInRadians=t.bearingInRadians,this._fovInRadians=t.fovInRadians,this._pitchInRadians=t.pitchInRadians,this._rollInRadians=t.rollInRadians,this._unmodified=t.unmodified,this._edgeInsets=new O_(t.padding.top,t.padding.bottom,t.padding.left,t.padding.right),this._minZoom=t.minZoom,this._maxZoom=t.maxZoom,this._minPitch=t.minPitch,this._maxPitch=t.maxPitch,this._renderWorldCopies=t.renderWorldCopies,this._cameraToCenterDistance=t.cameraToCenterDistance,this._nearZ=t.nearZ,this._farZ=t.farZ,this._autoCalculateNearFarZ=!i&&t.autoCalculateNearFarZ,r&&this.constrainInternal(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(t){this._minElevationForCurrentTile=t}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(t){if(this._minZoom===t)return;this._minZoom=t;let r=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=r}get maxZoom(){return this._maxZoom}setMaxZoom(t){if(this._maxZoom===t)return;this._maxZoom=t;let r=this._unmodified;this.setZoom(this.applyConstrain(this._center,this.zoom).zoom),this._unmodified=r}get minPitch(){return this._minPitch}setMinPitch(t){if(this._minPitch===t)return;this._minPitch=t;let r=this._unmodified;this.setPitch(Math.max(this.pitch,t)),this._unmodified=r}get maxPitch(){return this._maxPitch}setMaxPitch(t){if(this._maxPitch===t)return;this._maxPitch=t;let r=this._unmodified;this.setPitch(Math.min(this.pitch,t)),this._unmodified=r}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(t){void 0===t?t=!0:null===t&&(t=!1),this._renderWorldCopies=t}get constrainOverride(){return this._constrainOverride}setConstrainOverride(t){void 0===t&&(t=null),this._constrainOverride!==t&&(this._constrainOverride=t,this.constrainInternal(),this._calcMatrices())}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new vu(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(t){var r,i,n,a,o,s,l,u,c;let h=xi(t,-180,180)*Math.PI/180;this._bearingInRadians!==h&&(this._unmodified=!1,this._bearingInRadians=h,this._calcMatrices(),this._rotationMatrix=Ll(),r=this._rotationMatrix,i=this._rotationMatrix,n=-this._bearingInRadians,a=i[0],o=i[1],s=i[2],l=i[3],u=Math.sin(n),c=Math.cos(n),r[0]=a*c+s*u,r[1]=o*c+l*u,r[2]=-(a*u)+s*c,r[3]=-(o*u)+l*c)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(t){let r=xr(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==r&&(this._unmodified=!1,this._pitchInRadians=r,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(t){let r=t/180*Math.PI;this._rollInRadians!==r&&(this._unmodified=!1,this._rollInRadians=r,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return xx(this._fovInRadians)}setFov(t){t=xr(t,.1,150),this.fov!==t&&(this._unmodified=!1,this._fovInRadians=xv(t),this._calcMatrices())}get zoom(){return this._zoom}setZoom(t){let r=this.applyConstrain(this._center,t).zoom;this._zoom!==r&&(this._unmodified=!1,this._zoom=r,this._tileZoom=Math.max(0,Math.floor(r)),this._scale=xo(r),this.constrainInternal(),this._calcMatrices())}get center(){return this._center}setCenter(t){(t.lat!==this._center.lat||t.lng!==this._center.lng)&&(this._unmodified=!1,this._center=t,this.constrainInternal(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(t){t!==this._elevation&&(this._elevation=t,this.constrainInternal(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(t,r){this._autoCalculateNearFarZ=!1,this._nearZ=t,this._farZ=r,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,r,i){this._unmodified=!1,this._edgeInsets.interpolate(t,r,i),this.constrainInternal(),this._calcMatrices()}resize(t,r,i=!0){this._width=t,this._height=r,i&&this.constrainInternal(),this._calcMatrices()}getMaxBounds(){var t,r;return(null==(t=this._latRange)?void 0:t.length)!==2||(null==(r=this._lngRange)?void 0:r.length)!==2?null:new FA([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]])}setMaxBounds(t){t?(this._lngRange=[t.getWest(),t.getEast()],this._latRange=[t.getSouth(),t.getNorth()],this.constrainInternal()):(this._lngRange=null,this._latRange=[-Mb,Mb])}getCameraQueryGeometry(t,r){if(1===r.length)return[r[0],t];{let{minX:i,minY:n,maxX:a,maxY:o}=DW.fromPoints(r).extend(t);return[new vu(i,n),new vu(a,n),new vu(a,o),new vu(i,o),new vu(i,n)]}}constrainInternal(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;let t=this._unmodified,{center:r,zoom:i}=this.applyConstrain(this.center,this.zoom);this.setCenter(r),this.setZoom(i),this._unmodified=t,this._constraining=!1}_calcMatrices(){if(this._pixelPerMeter=1/w9(this.center.lat)*this.worldSize,!this._width||!this._height)return;this._pixelsToGLUnits=[2/this._width,-2/this._height];let t=vm(new Float64Array(16));vx(t,t,[this._width/2,-this._height/2,1]),vv(t,t,[1,-1,0]),this._clipSpaceToPixelsMatrix=t,vx(t=vm(new Float64Array(16)),t,[1,-1,1]),vv(t,t,[-1,-1,0]),vx(t,t,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=t;let r=this.fovInRadians/2;this._cameraToCenterDistance=.5/Math.tan(r)*this._height,this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(t,r,i,n){let a=void 0===i?this.bearing:i,o=n=void 0===n?this.pitch:n,{distanceToCenter:s,clampedElevation:l}=this._distanceToCenterFromAltElevationPitch(r,this.elevation,o),{x:u,y:c}=Tc(o,a),h=D1.fromLngLat(t,r),d=+w9(Ti(h.y)),f,p,m=0;do{if((m+=1)>10)break;let t=u*(p=s/d),r=c*p;d=1/(f=new D1(h.x+t,h.y+r)).meterInMercatorCoordinateUnits()}while(Math.abs(s-p*d)>1e-12);return{center:f.toLngLat(),elevation:l,zoom:xs(this.height/2/Math.tan(this.fovInRadians/2)/p/this.tileSize)}}recalculateZoomAndCenter(t){if(this.elevation-t==0)return;let r=1/this.worldSize,i=1/w9(this.center.lat)*this.worldSize,n=D1.fromLngLat(this.center,this.elevation),a=n.x/r,o=n.y/r,s=n.z/r,l=this.pitch,{x:u,y:c,z:h}=Tc(l,this.bearing),d=this.cameraToCenterDistance,{distanceToCenter:f,clampedElevation:p}=this._distanceToCenterFromAltElevationPitch((s+d*h)/i,t,l),m=f*i,g=new D1((a+-(d*u)+u*m)*r,(o+-(d*c)+c*m)*r,0).toLngLat(),y=1/w9(g.lat),v=xs(this.height/2/Math.tan(this.fovInRadians/2)/f/y/this.tileSize);this._elevation=p,this._center=g,this.setZoom(v)}_distanceToCenterFromAltElevationPitch(t,r,i){let n=-Math.cos(xv(i)),a=t-r,o,s=r;return n*a>=0||.1>Math.abs(n)?s=t+(o=1e4)*n:o=-a/n,{distanceToCenter:o,clampedElevation:s}}getCameraPoint(){let t=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new vu(t*Math.sin(this.rollInRadians),t*Math.cos(this.rollInRadians)))}getMercatorTileCoordinates(t){if(!t)return[0,0,1,1];let r=t.canonical.z>=0?1<i}allowWorldCopies(){return!0}prepareNextFrame(){}},OA=wi([{name:"a_pos3d",type:"Int16",components:3}]),OM=class extends MP{constructor(t){super(),this._lastTilesetChange=Lu(),this.tileManager=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=t._source.tileSize*2**this.deltaZoom,t.usedForTerrain=!0,t.tileSize=this.tileSize}destruct(){this.tileManager.usedForTerrain=!1,this.tileManager.tileSize=null,this.releaseAllRTT()}getSource(){return this.tileManager._source}update(t,r){this.tileManager.update(t,r),this._renderableTilesKeys=[];let i={},n=!1;for(let a of L$(t,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r,calculateTileZoom:this.tileManager._source.calculateTileZoom}))i[a.key]=!0,this._renderableTilesKeys.push(a.key),this._tiles[a.key]||(a.terrainRttPosMatrix32f=new Float32Array(16),Ms(a.terrainRttPosMatrix32f,0,Mf,Mf,0,0,1),this._tiles[a.key]=new FH(a,this.tileSize),this._lastTilesetChange=Lu(),n=!0);for(let t in this._tiles)i[t]||(this._tiles[t].releaseRTT(this.tileManager.map.painter),delete this._tiles[t],n=!0);return n}releaseRTT(t){for(let r in this._tiles){let i=this._tiles[r];(i.tileID.equals(t)||i.tileID.isChildOf(t)||t.isChildOf(i.tileID))&&i.releaseRTT(this.tileManager.map.painter)}}releaseAllRTT(){for(let t in this._tiles)this._tiles[t].releaseRTT(this.tileManager.map.painter)}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t,r){return r?this._getTerrainCoordsForTileRanges(t,r):this._getTerrainCoordsForRegularTile(t)}_getTerrainCoordsForRegularTile(t){let r={};for(let i of this._renderableTilesKeys){let n=this._tiles[i].tileID,a=t.clone(),o=v1();if(n.canonical.equals(t.canonical))Ms(o,0,Mf,Mf,0,0,1);else if(n.canonical.isChildOf(t.canonical)){let r=n.canonical.z-t.canonical.z,i=n.canonical.x-(n.canonical.x>>r<>r<>r;Ms(o,0,s,s,0,0,1),vv(o,o,[-i*s,-a*s,0])}else{if(!t.canonical.isChildOf(n.canonical))continue;let r=t.canonical.z-n.canonical.z,i=t.canonical.x-(t.canonical.x>>r<>r<>r;Ms(o,0,Mf,Mf,0,0,1),vv(o,o,[i*s,a*s,0]),vx(o,o,[1/2**r,1/2**r,0])}a.terrainRttPosMatrix32f=new Float32Array(o),r[i]=a}return r}_getTerrainCoordsForTileRanges(t,r){let i={};for(let n of this._renderableTilesKeys){let a=this._tiles[n].tileID;if(!this._isWithinTileRanges(a,r))continue;let o=t.clone(),s=v1();if(a.canonical.z===t.canonical.z){let r=t.canonical.x-a.canonical.x+t.wrap*(1<t.canonical.z){let r=a.canonical.z-t.canonical.z,i=a.canonical.x-(a.canonical.x>>r<>r<>r),l=t.canonical.y-(a.canonical.y>>r),u=Mf>>r;Ms(s,0,u,u,0,0,1),vv(s,s,[-i*u+o*Mf,-n*u+l*Mf,0])}else{let r=t.canonical.z-a.canonical.z,i=t.canonical.x-(t.canonical.x>>r<>r<>r)-a.canonical.x,l=(t.canonical.y>>r)-a.canonical.y,u=Mf<a.maxzoom&&(o=a.maxzoom),o=a.minzoom&&!s?.dem;)s=this.findTileInCaches(t.scaledTo(o--).key);return s}findTileInCaches(t){let r=this.tileManager.getTileByID(t);return r||(r=this.tileManager._outOfViewCache.getByKey(t))}anyTilesAfterTime(t=Lu()){return this._lastTilesetChange>=t}_isWithinTileRanges(t,r){let i=r[t.canonical.z];return!!i&&(t.wrap>i.minWrap||t.wrap=i.minTileXWrapped&&t.canonical.x<=i.maxTileXWrapped&&t.canonical.y>=i.minTileY&&t.canonical.y<=i.maxTileY)}},Ok=Mf*(1-1e-12),OS=class{constructor(t,r,i,n="auto"){this._meshCache={},this.painter=t,this.tileManager=new OM(r),this.options=i,this.exaggeration="number"==typeof i.exaggeration?i.exaggeration:1,this._terrainSkirtLength=n,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache=new Map,this._elevationSamplerCache=new Map}destroy(){for(let t in this._fbo&&(this._fbo=(this._fbo.destroy(),null)),this._fboDepthTexture&&(this._fboDepthTexture=(this._fboDepthTexture.destroy(),null)),this._emptyDemTexture&&(this._emptyDemTexture=(this._emptyDemTexture.destroy(),null)),this._emptyDepthTexture&&(this._emptyDepthTexture=(this._emptyDepthTexture.destroy(),null)),this._meshCache)this._meshCache[t].destroy();this._meshCache={},this.tileManager.destruct()}getDEMElevation(t,r,i,n=Mf){let a=t.normalizeCoordinates(r,i,n);if(!a)return 0;let o=this.getElevationSampler(a.tileID);return o?o(a.x,a.y,n):0}getElevationForLngLatZoom(t,r){if(!At(r,t.wrap()))return 0;let{tileID:i,mercatorX:n,mercatorY:a}=this._getOverscaledTileIDFromLngLatZoom(t,r);return this.getElevation(i,n%Mf,a%Mf,Mf)}getElevationForLngLat(t,r){let i=this.getCoverageIndex();if(i){let r=D1.fromLngLat(t),n=Pf(i,this.exaggeration,r.x,r.y);if(n.demLoaded)return n.elevation}let n=L$(r,{maxzoom:this.tileManager.maxzoom,minzoom:this.tileManager.minzoom,tileSize:512,terrain:this}),a=0;for(let t of n)t.canonical.z>a&&(a=Math.min(t.canonical.z,this.tileManager.maxzoom));return this.getElevationForLngLatZoom(t,a)}getElevation(t,r,i,n=Mf){return this.getDEMElevation(t,r,i,n)*this.exaggeration}resetElevationCache(){this._elevationSamplerCache.clear(),this._coverageIndex=void 0}getCoverageIndex(){return void 0===this._coverageIndex&&(this._coverageIndex=this._buildCoverageIndex()),this._coverageIndex}_buildCoverageIndex(){let t=[],r=new Map,i=0,n=0;for(let a of this.tileManager.getRenderableTiles()){if(!a)continue;let{canonical:o,wrap:s}=a.tileID;t.includes(o.z)||t.push(o.z);let l=this.getElevationSampler(a.tileID);r.set(`${s}/${o.z}/${o.x}/${o.y}`,l);let{minElevation:u,maxElevation:c}=this.getMinMaxElevation(a.tileID);i=Math.min(i,u??0),n=Math.max(n,c??0)}return 0===r.size?null:(t.sort((t,r)=>r-t),{zooms:t,samplerPerTile:r,minElevation:i-10,maxElevation:n+10})}getElevationSampler(t){let r=t.key,i=this._elevationSamplerCache.get(r);if(i)return i;let n=this.tileManager.getSourceTile(t,!0),a=n?.dem;if(!n||!a)return null;let o=this._getDEMTileMatrix(t,n),s=o[0]*a.dim,l=o[5]*a.dim,u=o[12]*a.dim,c=o[13]*a.dim,h=(t,r,i)=>{let n=8192===i?1:Mf/i;return a.sampleBilinear(t*n*s+u,r*n*l+c)};return this._elevationSamplerCache.set(r,h),h}_getDEMTileMatrix(t,r){var i,n;let a=`${r.tileID.key}/${t.key}`,o=this._demMatrixCache.get(a);if(o)return o;let s=this.tileManager.getSource().maxzoom,l=t.canonical.z-r.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=s?l=t.canonical.z-s:xf("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let u=t.canonical.x-(t.canonical.x>>l<>l<0,n=i&&0===t.canonical.y,a=i&&t.canonical.y===(1<{r=xr(+r,this.minZoom,this.maxZoom);let i={center:new DQ(t.lng,t.lat),zoom:r},n=this._helper._lngRange;this._helper._renderWorldCopies||null!==n||(n=[-179.9999999999,180-1e-10]);let a=this.tileSize*xo(i.zoom),o=0,s=a,l=0,u=a,c=0,h=0,{x:d,y:f}=this.size;if(this._helper._latRange){let t=this._helper._latRange;o=Tt(t[1])*a,(s=Tt(t[0])*a)-os&&(y=s-t)}if(n){let t=(l+u)/2,r=p;this._helper._renderWorldCopies&&(r=xi(p,t-a/2,t+a/2));let i=d/2;r-iu&&(g=u-i)}return(void 0!==g||void 0!==y)&&(i.center=To(a,new vu(g??p,y??m)).wrap()),i},this.applyConstrain=(t,r)=>this._helper.applyConstrain(t,r),this._helper=new Ow({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,r)=>this.defaultConstrain(t,r)},t),this._coveringTilesDetailsProvider=new OT}clone(){let r=new t;return r.apply(this,!1),r}apply(t,r,i){this._helper.apply(t,r,i)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(t){let r=[new In(0,t)];if(this._helper._renderWorldCopies){let i=this.screenPointToMercatorCoordinate(new vu(0,0)),n=this.screenPointToMercatorCoordinate(new vu(this._helper._width,0)),a=this.screenPointToMercatorCoordinate(new vu(this._helper._width,this._helper._height)),o=this.screenPointToMercatorCoordinate(new vu(0,this._helper._height)),s=Math.floor(Math.min(i.x,n.x,a.x,o.x)),l=Math.floor(Math.max(i.x,n.x,a.x,o.x));for(let i=s-1;i<=l+1;i++)0!==i&&r.push(new In(i,t))}return r}getCameraFrustum(){return FY.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){let r=this.screenPointToLocation(this.centerPoint,t),i=t?t.getElevationForLngLat(r,this):0;this._helper.recalculateZoomAndCenter(i)}setLocationAtPoint(t,r,i=this.elevation){let n=i-this.elevation,a=this.screenPointToMercatorCoordinateAtZ(r,n),o=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,0),s=D1.fromLngLat(t),l=new D1(s.x-(a.x-o.x),s.y-(a.y-o.y));this.setCenter(l?.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(t,r){return r?this.coordinatePoint(D1.fromLngLat(t),r.getElevationForLngLat(t,this),this._pixelMatrix3D):this.coordinatePoint(D1.fromLngLat(t))}screenPointToLocation(t,r){var i;return null==(i=this.screenPointToMercatorCoordinate(t,r))?void 0:i.toLngLat()}screenPointToLocationAtElevation(t,r){var i;return null==(i=this.screenPointToMercatorCoordinateAtZ(t,r-this.elevation))?void 0:i.toLngLat()}screenPointToMercatorCoordinate(t,r){if(r){let i=this.screenTerrainPointToMercatorCoordinate(t,r);if(null!=i)return i}return this.screenPointToMercatorCoordinateAtZ(t)}screenTerrainPointToMercatorCoordinate(t,r){let i=r.getCoverageIndex();if(!i)return null;let{near:n,far:a}=this.getRaySegmentFromPixel(t),o=this.worldSize,s=a[0]-n[0],l=a[1]-n[1],u=a[2]-n[2],c={index:i,exaggeration:r.exaggeration,near:n,dx:s,dy:l,dz:u,worldSize:o},h=0,d=1;if(0===u){if(n[2]>i.maxElevation||n[2](d=Math.min(d,Math.max(t,r))))return null}let f=Math.hypot(s,l),p=xr(Math.ceil(f*(d-h)/4),1,512),m=0,g=!Py(c,0);for(let t=0;t<=p;t++){let r=h+(d-h)*t/p;if(g){if(Py(c,r)){let{lo:t,hi:i}=Pm(c,Py,m,r,.001/f),a=Pg(c,t),h=Pg(c,i),d=n[2]+t*u-a.elevation,p=n[2]+i*u-h.elevation,g=a.covered&&d>p?xr(t+d*(i-t)/(d-p),t,i):i;return new D1((n[0]+g*s)/o,(n[1]+g*l)/o,Pg(c,g).elevation)}}else g=!Py(c,r);m=r}return null}getRaySegmentFromPixel(t){let r=[t.x,t.y,0,1],i=[t.x,t.y,1,1];vU(r,r,this._pixelMatrixInverse),vU(i,i,this._pixelMatrixInverse);let n=r[3],a=i[3],o=this.elevation;return{near:[r[0]/n,r[1]/n,r[2]/n+o],far:[i[0]/a,i[1]/a,i[2]/a+o]}}screenPointToMercatorCoordinateAtZ(t,r){let i=r||0,{near:n,far:a}=this.getRaySegmentFromPixel(t),o=n[2]===a[2]?0:(i+this.elevation-n[2])/(a[2]-n[2]);return new D1(kx.number(n[0],a[0],o)/this.worldSize,kx.number(n[1],a[1],o)/this.worldSize,i)}coordinatePoint(t,r=0,i=this._pixelMatrix){let n=[t.x*this.worldSize,t.y*this.worldSize,r,1];return vU(n,n,i),new vu(n[0]/n[3],n[1]/n[3])}getBounds(){let t=Math.max(0,this._helper._height/2-Ts(this));return new FA().extend(this.screenPointToLocation(new vu(0,t))).extend(this.screenPointToLocation(new vu(this._helper._width,t))).extend(this.screenPointToLocation(new vu(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new vu(0,this._helper._height)))}isPointOnMapSurface(t,r){return r?null!=this.screenTerrainPointToMercatorCoordinate(t,r):t.y>this.height/2-Ts(this)}calculatePosMatrix(t,r=!1,i=!1){var n;let a=null!=(n=t.key)?n:Ar(t.wrap,t.canonical.z,t.canonical.z,t.canonical.x,t.canonical.y),o=r?this._alignedPosMatrixCache:this._posMatrixCache;if(o.has(a)){let t=o.get(a);return i?t.f32:t.f64}let s=Tl(t,this.worldSize);vy(s,r?this._alignedProjMatrix:this._viewProjMatrix,s);let l={f64:s,f32:new Float32Array(s)};return o.set(a,l),i?l.f32:l.f64}calculateFogMatrix(t){let r=t.key,i=this._fogMatrixCacheF32;if(i.has(r))return i.get(r);let n=Tl(t,this.worldSize);return vy(n,this._fogMatrix,n),i.set(r,new Float32Array(n)),i.get(r)}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}calculateCameraOptionsFromTo(t,r,i,n){let a=D1.fromLngLat(t,r),o=D1.fromLngLat(i,n),s=o.x-a.x,l=o.y-a.y,u=o.z-a.z,c=Math.hypot(s,l,u);if(0===c)throw Error("Can't calculate camera options with same From and To");let h=Math.hypot(s,l),d=xs(this.cameraToCenterDistance/c/this.tileSize),f=xx(Math.atan2(s,-l)),p=xx(Math.acos(h/c));return p=u<0?90-p:90+p,{center:o.toLngLat(),elevation:n,zoom:d,pitch:p,bearing:f}}_calculateNearFarZIfNeeded(t,r,i){if(!this._helper.autoCalculateNearFarZ)return;let n=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),a=t-n*this._helper._pixelPerMeter/Math.cos(r),o=n<0?a:t,s=Math.PI/2+this.pitchInRadians,l=xv(this.fov)*(Math.abs(Math.cos(xv(this.roll)))*this.height+Math.abs(Math.sin(xv(this.roll)))*this.width)/this.height*(.5+i.y/this.height),u=Math.sin(l)*o/Math.sin(xr(Math.PI-s-l,.01,Math.PI-.01)),c=Ts(this),h=Math.atan(c/this._helper.cameraToCenterDistance),d=xv(90-D2),f=h>d?2*h*(.5+i.y/(2*c)):d,p=Math.min(u,Math.sin(f)*o/Math.sin(xr(Math.PI-s-f,.01,Math.PI-.01)));this._helper._farZ=(Math.cos(Math.PI/2-r)*p+o)*1.01,this._helper._nearZ=this._helper._height/50}_calcMatrices(){var t,r;let i,n=this.centerOffset,a=Ta(this.worldSize,this.center),o=a.x,s=a.y,l=xv(Math.min(this.pitch,D2)),u=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(l));this._calculateNearFarZIfNeeded(u,l,n),i=new Float64Array(16),Mo(i,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),t=this._invProjMatrix,r=i,t[0]=1/r[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1/r[5],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=0,t[11]=1/r[14],t[12]=0,t[13]=0,t[14]=-1,t[15]=r[10]/r[14],i[8]=-(2*n.x)/this._helper._width,i[9]=2*n.y/this._helper._height,this._projectionMatrix=vp(i),vx(i,i,[1,-1,1]),vv(i,i,[0,0,-this._helper.cameraToCenterDistance]),vw(i,i,-this.rollInRadians),vb(i,i,this.pitchInRadians),vw(i,i,-this.bearingInRadians),vv(i,i,[-o,-s,0]),this._mercatorMatrix=vx([],i,[this.worldSize,this.worldSize,this.worldSize]),vx(i,i,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=vy(new Float64Array(16),this.clipSpaceToPixelsMatrix,i),vv(i,i,[0,0,-this.elevation]),this._viewProjMatrix=i,this._invViewProjMatrix=vg([],i);let c=[0,0,-1,1];vU(c,c,this._invViewProjMatrix),this._cameraPosition=[c[0]/c[3],c[1]/c[3],c[2]/c[3]],this._fogMatrix=new Float64Array(16),Mo(this._fogMatrix,this.fovInRadians,this.width/this.height,u,this._helper._farZ),this._fogMatrix[8]=-(2*n.x)/this.width,this._fogMatrix[9]=2*n.y/this.height,vx(this._fogMatrix,this._fogMatrix,[1,-1,1]),vv(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),vw(this._fogMatrix,this._fogMatrix,-this.rollInRadians),vb(this._fogMatrix,this._fogMatrix,this.pitchInRadians),vw(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),vv(this._fogMatrix,this._fogMatrix,[-o,-s,0]),vx(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),vv(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=vy(new Float64Array(16),this.clipSpaceToPixelsMatrix,i);let h=this._helper._width%2/2,d=this._helper._height%2/2,f=Math.cos(this.bearingInRadians),p=Math.sin(-this.bearingInRadians),m=o-Math.round(o)+f*h+p*d,g=s-Math.round(s)+f*d+p*h,y=new Float64Array(i);if(vv(y,y,[m>.5?m-1:m,g>.5?g-1:g,0]),this._alignedProjMatrix=y,!(i=vg(new Float64Array(16),this._pixelMatrix)))throw Error("failed to invert matrix");this._pixelMatrixInverse=i,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;let t=this.screenPointToMercatorCoordinate(new vu(0,0)),r=[t.x*this.worldSize,t.y*this.worldSize,0,1];return vU(r,r,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this.cameraToCenterDistance/this.pixelsPerMeter+this.elevation}getCameraLngLat(){let t=1/w9(this.center.lat)*this.worldSize,r=this._helper.cameraToCenterDistance/t;return Tu(this.center,this.elevation,this.pitch,this.bearing,r).toLngLat()}lngLatToCameraDepth(t,r){let i=D1.fromLngLat(t),n=[i.x*this.worldSize,i.y*this.worldSize,r,1];return vU(n,n,this._viewProjMatrix),n[2]/n[3]}getProjectionData(t){let{overscaledTileID:r,aligned:i,applyTerrainMatrix:n}=t,a=this._helper.getMercatorTileCoordinates(r),o=r?this.calculatePosMatrix(r,i,!0):null,s;return{mainMatrix:s=r?.terrainRttPosMatrix32f&&n?r.terrainRttPosMatrix32f:o||v3(),tileMercatorCoords:a,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s,clipAntimeridian:!1}}isLocationOccluded(t){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(t,r,i){return 1}transformLightDirection(t){return vk(t)}getRayDirectionFromPixel(t){throw Error("Not implemented.")}projectTileCoordinates(t,r,i,n){let a=this.calculatePosMatrix(i),o;null==n?Pi(o=[t,r,0,1],o,a):vU(o=[t,r,n,1],o,a);let s=o[3];return{point:new vu(o[0]/s,o[1]/s),signedDistanceFromCamera:s,isOccluded:!1}}populateCache(t){for(let r of t)this.calculatePosMatrix(r)}getProjectionDataForCustomLayer(t=!0){let r=new Ia(0,0,0,0,0),i=this.getProjectionData({overscaledTileID:r,applyGlobeMatrix:t}),n=Tl(r,this.worldSize);vy(n,this._viewProjMatrix,n);let a=[Mf,Mf,this.worldSize/this._helper.pixelsPerMeter],o=v1();return vx(o,n,a),p(f({},i),{tileMercatorCoords:[0,0,1,1],fallbackMatrix:o,mainMatrix:o})}getFastPathSimpleProjectionMatrix(t){return this.calculatePosMatrix(t)}},OC=class{get useGlobeControls(){return!1}handlePanInertia(t,r){let i=t.mag(),n=Math.abs(Ts(r));return{easingOffset:t.mult(Math.min(.75*n/i,1)),easingCenter:r.center}}handleMapControlsRollPitchBearingZoom(t,r){t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta),t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta)}handleMapControlsPan(t,r,i){.01>t.around.distSqr(r.centerPoint)||r.setLocationAtPoint(i,t.around,t.aroundElevation)}cameraForBoxAndBearing(t,r,i,n,a){return Pb(t,r,i,n,a)}handleJumpToCenterZoom(t,r){let i=void 0===r.zoom?t.zoom:+r.zoom;t.zoom!==i&&t.setZoom(+r.zoom),void 0!==r.center&&t.setCenter(DQ.convert(r.center))}handleEaseTo(t,r){let i=t.zoom,n=t.padding,a={roll:t.roll,pitch:t.pitch,bearing:t.bearing},o={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},s=void 0!==r.zoom,l=!t.isPaddingEqual(r.padding),u=!1,c=s?+r.zoom:t.zoom,h=t.centerPoint.add(r.offsetAsPoint),d=t.screenPointToLocation(h),{center:f,zoom:p}=t.applyConstrain(DQ.convert(r.center||d),c??i);Ph(t,f);let m=Ta(t.worldSize,d),g=Ta(t.worldSize,f).sub(m),y=xo(p-i);return{easeFunc:s=>{if(u&&t.setZoom(kx.number(i,p,s)),xb(a,o)||Px({startEulerAngles:a,endEulerAngles:o,tr:t,k:s,useSlerp:a.roll!=o.roll}),l&&(t.interpolatePadding(n,r.padding,s),h=t.centerPoint.add(r.offsetAsPoint)),r.around)t.setLocationAtPoint(r.around,r.aroundPoint);else{let r=xo(t.zoom-i),n=(p>i?Math.min(2,y):Math.max(.5,y))**(1-s),a=To(t.worldSize,m.add(g.mult(s*n)).mult(r));t.setLocationAtPoint(t.renderWorldCopies?a.wrap():a,h)}},isZooming:u=p!==i,elevationCenter:f}}handleFlyTo(t,r){let i=void 0!==r.zoom,n=t.zoom,a=t.applyConstrain(DQ.convert(r.center||r.locationAtOffset),i?+r.zoom:n),o=a.center,s=a.zoom;Ph(t,o);let l=t.worldSize,u=Ta(l,r.locationAtOffset),c=Ta(l,o).sub(u),h=c.mag(),d=xo(s-n),f=Math.min(Math.max(void 0===r.minZoom?t.minZoom:+r.minZoom,t.minZoom),n,s),p=t.applyConstrain(o,f).zoom;return{easeFunc:(r,i,a,h)=>{t.setZoom(1===r?s:n+xs(i));let d=1===r?o:To(l,u.add(c.mult(a)));t.setLocationAtPoint(t.renderWorldCopies?d.wrap():d,h)},scaleOfZoom:d,targetCenter:o,scaleOfMinZoom:xo(p-n),pixelPathLength:h}}},OL=new Dz({fill:new DL(128,2),line:new DL(512,0),tile:new DL(128,32),stencil:new DL(128,1),circle:3}),OP=class{constructor(){this._tileMeshCache={}}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return Ox.projectionGlobe}get vertexShaderPreludeCode(){return Ox.projectionMercator.vertexSource}get subdivisionGranularity(){return OL}get useGlobeControls(){return!0}destroy(){}_getMeshKey(t){return`${t.granularity.toString(36)}_${t.generateBorders?"b":""}${t.extendToNorthPole?"n":""}${t.extendToSouthPole?"s":""}`}getMeshFromTileID(t,r,i,n,a){let o=("stencil"===a?OL.stencil:OL.tile).getGranularityForZoomLevel(r.z),s=0===r.y&&n,l=r.y===(1<0}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}getMeshFromTileID(t,r,i,n,a){return this.currentProjection.getMeshFromTileID(t,r,i,n,a)}setProjection(t){this._transitionable.setValue("type",t?.type||"mercator")}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}},OF=.98*Math.PI,OO=class{constructor(t){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=t}swapBuffers(){if(!this._hadAnyChanges)return;let t=this._cachePrevious;this._cachePrevious=this._cache,this._cache=t,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(t,r,i,n){let a=`${t.z}_${t.x}_${t.y}_${n?.terrain?"t":""}_${Math.round(i)}`,o=this._cache.get(a);if(o)return o;let s=this._cachePrevious.get(a);if(s)return this._cache.set(a,s),s;let l=this._boundingVolumeFactory(t,r,i,n);return this._cache.set(a,l),this._hadAnyChanges=!0,l}},OR=class t{constructor(t,r,i,n){this.min=i,this.max=n,this.points=t,this.planes=r}static fromAabb(r,i){let n=[];for(let t=0;t<8;t++)n.push([(1&t)==1?i[0]:r[0],(t>>1&1)==1?i[1]:r[1],(t>>2&1)==1?i[2]:r[2]]);return new t(n,[[-1,0,0,i[0]],[1,0,0,-r[0]],[0,-1,0,i[1]],[0,1,0,-r[1]],[0,0,-1,i[2]],[0,0,1,-r[2]]],r,i)}static fromCenterSizeAngles(r,i,n){let a=vG([],n[0],n[1],n[2]),o=vO([],[i[0],0,0],a),s=vO([],[0,i[1],0],a),l=vO([],[0,0,i[2]],a),u=[...r],c=[...r];for(let t=0;t<8;t++)for(let i=0;i<3;i++){let n=r[i]+o[i]*((1&t)==1?1:-1)+s[i]*((t>>1&1)==1?1:-1)+l[i]*((t>>2&1)==1?1:-1);u[i]=Math.min(u[i],n),c[i]=Math.max(c[i],n)}let h=[];for(let t=0;t<8;t++){let i=[...r];vD(i,i,vI([],o,(1&t)==1?1:-1)),vD(i,i,vI([],s,(t>>1&1)==1?1:-1)),vD(i,i,vI([],l,(t>>2&1)==1?1:-1)),h.push(i)}return new t(h,[[...o,-vz(o,h[0])],[...s,-vz(s,h[0])],[...l,-vz(l,h[0])],[-o[0],-o[1],-o[2],-vz(o,h[7])],[-s[0],-s[1],-s[2],-vz(s,h[7])],[-l[0],-l[1],-l[2],-vz(l,h[7])]],u,c)}intersectsFrustum(t){let r=!0,i=this.points.length,n=this.planes.length,a=t.planes.length,o=t.points.length;for(let n=0;n=0&&o++}if(0===o)return 0;o=0&&n++}if(0===n)return 0}return 1}intersectsPlane(t){let r=this.points.length,i=0;for(let n=0;n=0&&i++}return i===r?2:+(0!==i)}},OB=class{constructor(){this._boundingVolumeCache=new OO(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(t,r,i,n){let a=1<4}allowWorldCopies(){return!1}getTileBoundingVolume(t,r,i,n){return this._boundingVolumeCache.getTileBoundingVolume(t,r,i,n)}_computeTileBoundingVolume(t,r,i,n){var a,o;let s=Math.min(0,i),l=Math.max(0,i);if(n?.terrain){let i=new Ia(t.z,r,t.z,t.x,t.y),u=n.terrain.getMinMaxElevation(i);s=null!=(a=u.minElevation)?a:s,l=Math.max(null!=(o=u.maxElevation)?o:l,l)}if(s/=DJ,l/=DJ,s+=1,l+=1,t.z<=0)return OR.fromAabb([-l,-l,-l],[l,l,l]);if(1===t.z)return OR.fromAabb([0===t.x?-l:0,0===t.y?0:-l,-l],[0===t.x?0:l,0===t.y?l:0,l]);{let r=[Pw(0,0,t.x,t.y,t.z),Pw(Mf,0,t.x,t.y,t.z),Pw(Mf,Mf,t.x,t.y,t.z),Pw(0,Mf,t.x,t.y,t.z)],i=[];for(let t of r)i.push(vI([],t,l));if(l!==s)for(let t of r)i.push(vI([],t,s));0===t.y&&i.push([0,1,0]),t.y===(1<=(1<{let i=xr(t.lat,-Mb,Mb),n=xr(+r,this.minZoom+PD(0,i),this.maxZoom);return{center:new DQ(t.lng,i),zoom:n}},this.applyConstrain=(t,r)=>this._helper.applyConstrain(t,r),this._helper=new Ow({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,r)=>this.defaultConstrain(t,r)},t),this._coveringTilesDetailsProvider=new OB}clone(){let r=new t;return r.apply(this,!1),r}apply(t,r){this._helper.apply(t,r)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixF64}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){let t=v0();return t[0]=this._cameraPosition[0],t[1]=this._cameraPosition[1],t[2]=this._cameraPosition[2],t}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(t){let{overscaledTileID:r,applyGlobeMatrix:i}=t,n=this._helper.getMercatorTileCoordinates(r);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:n,clippingPlane:this._cachedClippingPlane,projectionTransition:+!!i,fallbackMatrix:this._globeViewProjMatrix32f,clipAntimeridian:r?.canonical.z===0}}_computeClippingPlane(t){let r=this.pitchInRadians,i=this.cameraToCenterDistance/t,n=Math.sin(r)*i,a=Math.cos(r)*i+1,o=1/Math.sqrt(n*n+a*a)*1,s=-n,l=a,u=Math.sqrt(s*s+l*l),c=[0,s/=u,l/=u];vj(c,c,[0,0,0],-this.bearingInRadians),vR(c,c,[0,0,0],-1*this.center.lat*Math.PI/180),vB(c,c,[0,0,0],this.center.lng*Math.PI/180);let h=1/vS(c);return vI(c,c,h),[...c,-o*h]}isLocationOccluded(t){return!this.isSurfacePointVisible(PT(t))}transformLightDirection(t){let r=this._helper._center.lng*Math.PI/180,i=this._helper._center.lat*Math.PI/180,n=Math.cos(i),a=[Math.sin(r)*n,Math.sin(i),Math.cos(r)*n],o=[a[2],0,-a[0]],s=[0,0,0];vF(s,o,a),vP(o,o),vP(s,s);let l=[o[0]*t[0]+s[0]*t[1]+a[0]*t[2],o[1]*t[0]+s[1]*t[1]+a[1]*t[2],o[2]*t[0]+s[2]*t[1]+a[2]*t[2]],u=[0,0,0];return vP(u,l),u}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(t,r,i){var n,a,o;let s=Tn(t,r,i.canonical),l=(n=s.x,a=s.y,[((n*Math.PI*2+Math.PI)%(o=2*Math.PI)+o)%o,2*Math.atan(Math.exp(Math.PI-a*Math.PI*2))-.5*Math.PI]);return this.getCircleRadiusCorrection()/Math.cos(l[1])}projectTileCoordinates(t,r,i,n){let a,o=i.canonical,s=Pw(t,r,o.x,o.y,o.z),l=1+(n??0)/DJ,u=s[0]*l,c=s[1]*l,h=s[2]*l,d=[u,c,h,1];if(vU(d,d,this._globeViewProjMatrixF64),l<=1){let t=this._cachedClippingPlane;a=t[0]*s[0]+t[1]*s[1]+t[2]*s[2]+t[3]<0}else a=this._isLineOfSightBlocked(u,c,h);return{point:new vu(d[0]/d[3],d[1]/d[3]),signedDistanceFromCamera:d[3],isOccluded:a}}_isLineOfSightBlocked(t,r,i){let n=this._cameraPosition,a=t-n[0],o=r-n[1],s=i-n[2],l=a*a+o*o+s*s;if(0===l)return!1;let u=xr(-(n[0]*a+n[1]*o+n[2]*s)/l,0,1),c=n[0]+u*a,h=n[1]+u*o,d=n[2]+u*s;return c*c+h*h+d*d<1}_calcMatrices(){let t=PA(this.worldSize,this.center.lat),r=v1();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*t),Mo(r,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);let i=this.centerOffset;r[8]=-(2*i.x)/this._helper._width,r[9]=2*i.y/this._helper._height,this._projectionMatrix=vp(r),this._globeProjMatrixInverted=v1(),vg(this._globeProjMatrixInverted,r),vv(r,r,[0,0,-this.cameraToCenterDistance]),vw(r,r,this.rollInRadians),vb(r,r,-this.pitchInRadians),vw(r,r,this.bearingInRadians),vv(r,r,[0,0,-t]);let n=v0();n[0]=t,n[1]=t,n[2]=t,vb(r,r,this.center.lat*Math.PI/180),v_(r,r,-this.center.lng*Math.PI/180),vx(r,r,n),this._globeViewProjMatrixF64=r,this._globeViewProjMatrix32f=new Float32Array(r),this._globeViewProjMatrixF64Inverted=v1(),vg(this._globeViewProjMatrixF64Inverted,r);let a=v0();this._cameraPosition=v0(),this._cameraPosition[2]=this.cameraToCenterDistance/t,vj(this._cameraPosition,this._cameraPosition,a,-this.rollInRadians),vR(this._cameraPosition,this._cameraPosition,a,this.pitchInRadians),vj(this._cameraPosition,this._cameraPosition,a,-this.bearingInRadians),vD(this._cameraPosition,this._cameraPosition,[0,0,1]),vR(this._cameraPosition,this._cameraPosition,a,-this.center.lat*Math.PI/180),vB(this._cameraPosition,this._cameraPosition,a,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(t);let o=vp(this._globeViewProjMatrixF64Inverted);vx(o,o,[1,1,-1]),this._cachedFrustum=FY.fromInvProjectionMatrix(o,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(t){xf("calculateFogMatrix is not supported on globe projection.");let r=v1();return vm(r),r}getVisibleUnwrappedCoordinates(t){return[new In(0,t)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(t){t?xf("terrain is not fully supported on vertical perspective projection."):this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return(vS(this._cameraPosition)-1)*DJ}getCameraLngLat(){let t=v0();return vP(t,this._cameraPosition),Pk(t)}lngLatToCameraDepth(t,r){let i=PT(t);vI(i,i,1+r/DJ);let n=vQ();return vU(n,[i[0],i[1],i[2],1],this._globeViewProjMatrixF64),n[2]/n[3]}populateCache(t){}getBounds(){let t=.5*this.width,r=.5*this.height,i=[new vu(0,0),new vu(t,0),new vu(this.width,0),new vu(this.width,r),new vu(this.width,this.height),new vu(t,this.height),new vu(0,this.height),new vu(0,r)],n=[];for(let t of i)n.push(this.unprojectScreenPoint(t));let a=0,o=0,s=0,l=0,u=this.center;for(let t of n){let r=v7(u.lng,t.lng),i=v7(u.lat,t.lat);ra&&(a=r),is&&(s=i)}let c=[u.lng+o,u.lat+l,u.lng+a,u.lat+s];return this.isSurfacePointOnScreen([0,1,0])&&(c[3]=90,c[0]=-180,c[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(c[1]=-90,c[0]=-180,c[2]=180),new FA(c)}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}calculateCameraOptionsFromTo(t,r,i,n){var a,o,s;let l=DQ.convert(i),u=PT(DQ.convert(t));vI(u,u,1+r/DJ);let c=PT(l),h=vI(v0(),c,1+n/DJ),d=vC(v0(),u,c),f=vS(d);if(f<1e-12||(a=h[0]-u[0],1e-12>Math.sqrt(a*a+(o=h[1]-u[1])*o+(s=h[2]-u[2])*s)))throw Error("Can't calculate camera options with same From and To");let p=v0();vB(d,d,p,-xv(l.lng)),vR(d,d,p,xv(l.lat));let m=xx(Math.acos(xr(d[2]/f,-1,1))),g=Math.hypot(d[0],d[1])<1e-9*f?this.bearing:xx(Math.atan2(-d[0],-d[1]));return{center:l,elevation:n,zoom:xs(this.cameraToCenterDistance/f/PA(this.tileSize,l.lat)),pitch:m,bearing:g}}setLocationAtPoint(t,r,i){let n=PT(this.unprojectScreenPoint(r)),a=PT(t),o=v0();o[0]=0,o[1]=0,o[2]=0;let s=v0();vB(s,n,o,-this.center.lng*Math.PI/180),vR(s,s,o,this.center.lat*Math.PI/180);let l=a[0]*a[0]+a[2]*a[2],u=s[0]*s[0];if(l=-y&&p<=y,x=g>=-y&&g<=y,b,_;if(v&&x){let t=this.center.lng*Math.PI/180,r=this.center.lat*Math.PI/180;v9(h,t)+v9(p,r)=0}isSurfacePointOnScreen(t){if(!this.isSurfacePointVisible(t))return!1;let r=vQ();return vU(r,[...t,1],this._globeViewProjMatrixF64),r[0]/=r[3],r[1]/=r[3],r[2]/=r[3],r[0]>-1&&r[0]<1&&r[1]>-1&&r[1]<1&&r[2]>-1&&r[2]<1}unprojectScreenPoint(t){var r,i;let n,a,o,s=this._cameraPosition,l=this.getRayDirectionFromPixel(t),u=PL(s,l);if(u){let t=v0();vD(t,s,[l[0]*u.tMin,l[1]*u.tMin,l[2]*u.tMin]);let r=v0();return vP(r,t),Pk(r)}let c=this._cachedClippingPlane,h=c[0]*l[0]+c[1]*l[1]+c[2]*l[2],d=-v4(c,s)/h,f=v0();if(d>0)vD(f,s,[l[0]*d,l[1]*d,l[2]*d]);else{let t=v0();vD(t,s,[2*l[0],2*l[1],2*l[2]]);let r=v4(this._cachedClippingPlane,t);Ml(f,t,[this._cachedClippingPlane[0]*r,this._cachedClippingPlane[1]*r,this._cachedClippingPlane[2]*r])}let p=((n=v0())[0]=-(c[0]*c[3]),n[1]=-(c[1]*c[3]),n[2]=-(c[2]*c[3]),{center:n,radius:Math.sqrt(1-c[3]*c[3])});return Pk((r=p.center,i=p.radius,a=v0(),Ml(a,f,r),vL(o=v0(),r,a,i/Mu(a)),o))}getProjectionDataForCustomLayer(t=!0){let r=this.getProjectionData({overscaledTileID:new Ia(0,0,0,0,0),applyGlobeMatrix:t});return r.tileMercatorCoords=[0,0,1,1],r}getFastPathSimpleProjectionMatrix(t){}},ON=class t{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(t){this._helper.setMinZoom(t)}setMaxZoom(t){this._helper.setMaxZoom(t)}setMinPitch(t){this._helper.setMinPitch(t)}setMaxPitch(t){this._helper.setMaxPitch(t)}setRenderWorldCopies(t){this._helper.setRenderWorldCopies(t)}setBearing(t){this._helper.setBearing(t)}setPitch(t){this._helper.setPitch(t)}setRoll(t){this._helper.setRoll(t)}setFov(t){this._helper.setFov(t)}setZoom(t){this._helper.setZoom(t)}setCenter(t){this._helper.setCenter(t)}setElevation(t){this._helper.setElevation(t)}setMinElevationForCurrentTile(t){this._helper.setMinElevationForCurrentTile(t)}setPadding(t){this._helper.setPadding(t)}interpolatePadding(t,r,i){this._helper.interpolatePadding(t,r,i)}isPaddingEqual(t){return this._helper.isPaddingEqual(t)}resize(t,r,i=!0){this._helper.resize(t,r,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(t){this._helper.setMaxBounds(t)}setConstrainOverride(t){this._helper.setConstrainOverride(t)}overrideNearFarZ(t,r){this._helper.overrideNearFarZ(t,r)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(t){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),t)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get constrainOverride(){return this._helper.constrainOverride}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(t){this._globeness=t,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(t){this._globeness=1,this.defaultConstrain=(t,r)=>this.currentTransform.defaultConstrain(t,r),this.applyConstrain=(t,r)=>this._helper.applyConstrain(t,r),this._helper=new Ow({calcMatrices:()=>this._calcMatrices(),defaultConstrain:(t,r)=>this.defaultConstrain(t,r)},t),this._globeness=1,this._mercatorTransform=new OD,this._verticalPerspectiveTransform=new Oj}clone(){let r=new t;return r._globeness=this._globeness,r.apply(this,!1),r}apply(t,r){this._helper.apply(t,r),this._mercatorTransform.apply(this,!1),this._verticalPerspectiveTransform.apply(this,!1)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(t){let r=this._mercatorTransform.getProjectionData(t),i=this._verticalPerspectiveTransform.getProjectionData(t);return{mainMatrix:this.isGlobeRendering?i.mainMatrix:r.mainMatrix,clippingPlane:i.clippingPlane,tileMercatorCoords:i.tileMercatorCoords,projectionTransition:t.applyGlobeMatrix?this._globeness:0,fallbackMatrix:r.fallbackMatrix,clipAntimeridian:i.clipAntimeridian}}isLocationOccluded(t){return this.currentTransform.isLocationOccluded(t)}transformLightDirection(t){return this.currentTransform.transformLightDirection(t)}getPixelScale(){var t,r,i;return t=this._mercatorTransform.getPixelScale(),r=this._verticalPerspectiveTransform.getPixelScale(),t*(1-(i=this._globeness))+r*i}getCircleRadiusCorrection(){var t,r,i;return t=this._mercatorTransform.getCircleRadiusCorrection(),r=this._verticalPerspectiveTransform.getCircleRadiusCorrection(),t*(1-(i=this._globeness))+r*i}getPitchedTextCorrection(t,r,i){var n;let a=this._mercatorTransform.getPitchedTextCorrection(t,r,i),o=this._verticalPerspectiveTransform.getPitchedTextCorrection(t,r,i);return a*(1-(n=this._globeness))+o*n}projectTileCoordinates(t,r,i,n){return this.currentTransform.projectTileCoordinates(t,r,i,n)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,!1),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(t){return this.currentTransform.calculateFogMatrix(t)}getVisibleUnwrappedCoordinates(t){return this.currentTransform.getVisibleUnwrappedCoordinates(t)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(t){this.currentTransform.recalculateZoomAndCenter(t)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this.currentTransform.getCameraAltitude()}getCameraLngLat(){return this.currentTransform.getCameraLngLat()}lngLatToCameraDepth(t,r){return this.currentTransform.lngLatToCameraDepth(t,r)}populateCache(t){this._mercatorTransform.populateCache(t),this._verticalPerspectiveTransform.populateCache(t)}getBounds(){return this.currentTransform.getBounds()}calculateCenterFromCameraLngLatAlt(t,r,i,n){return this._helper.calculateCenterFromCameraLngLatAlt(t,r,i,n)}calculateCameraOptionsFromTo(t,r,i,n){return this.currentTransform.calculateCameraOptionsFromTo(t,r,i,n)}setLocationAtPoint(t,r,i){if(!this.isGlobeRendering){this._mercatorTransform.setLocationAtPoint(t,r,i),this.apply(this._mercatorTransform,!1);return}this._verticalPerspectiveTransform.setLocationAtPoint(t,r,i),this.apply(this._verticalPerspectiveTransform,!1)}locationToScreenPoint(t,r){return this.currentTransform.locationToScreenPoint(t,r)}screenPointToMercatorCoordinate(t,r){return this.currentTransform.screenPointToMercatorCoordinate(t,r)}screenTerrainPointToMercatorCoordinate(t,r){return this.currentTransform.screenTerrainPointToMercatorCoordinate(t,r)}screenPointToLocation(t,r){return this.currentTransform.screenPointToLocation(t,r)}screenPointToLocationAtElevation(t,r){return this.currentTransform.screenPointToLocationAtElevation(t,r)}isPointOnMapSurface(t,r){return this.currentTransform.isPointOnMapSurface(t,r)}getRayDirectionFromPixel(t){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(t)}getProjectionDataForCustomLayer(t=!0){let r=this._mercatorTransform.getProjectionDataForCustomLayer(t);if(!this.isGlobeRendering)return r;let i=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(t);return i.fallbackMatrix=r.mainMatrix,i.projectionTransition=this._globeness,i}getFastPathSimpleProjectionMatrix(t){return this.currentTransform.getFastPathSimpleProjectionMatrix(t)}},OV=class t{get useGlobeControls(){return!0}handlePanInertia(t,r){var i,n,a;let o,s,l,u,c=(o=t.rotate(r.bearingInRadians),s=r.zoom+PD(r.center.lat,0),i=1/PE(r.center.lat),n=1/PE(Math.min(Math.abs(r.center.lat),60)),l=i*(1-(a=xe(s,7,3,0,1)))+n*a,u=360/P_({worldSize:r.worldSize,center:{lat:r.center.lat}}),new DQ(r.center.lng-o.x*u*l,xr(r.center.lat+o.y*u,-Mb,Mb)));return Math.abs(c.lng-r.center.lng)>180&&(c.lng=r.center.lng+179.5*Math.sign(c.lng-r.center.lng)),{easingCenter:c,easingOffset:new vu(0,0)}}handleMapControlsRollPitchBearingZoom(t,r){let i=t.around,n=r.screenPointToLocation(i);t.bearingDelta&&r.setBearing(r.bearing+t.bearingDelta),t.pitchDelta&&r.setPitch(r.pitch+t.pitchDelta),t.rollDelta&&r.setRoll(r.roll+t.rollDelta);let a=r.zoom;t.zoomDelta&&r.setZoom(r.zoom+t.zoomDelta);let o=r.zoom-a;if(0===o)return;let s=v7(r.center.lng,n.lng),l=s/(Math.abs(s/180)+1),u=v7(r.center.lat,n.lat),c=r.getRayDirectionFromPixel(i),h=r.cameraPosition,d=-1*vz(h,c),f=v0();vD(f,h,[c[0]*d,c[1]*d,c[2]*d]);let p=vS(f),m=Math.exp(-(.5*Math.max(p-1-.3,0))),g=xe(p,.95,.999,0,1),y=Math.min(m,+(1-g)+xe(PA(r.worldSize,r.center.lat)/Math.min(r.width,r.height),.9,.5,1,.25)*g),v=(1-xo(-o))*y,x=r.center.lat,b=r.zoom,_=new DQ(r.center.lng+l*v,xr(r.center.lat+u*v,-Mb,Mb));r.setLocationAtPoint(n,i);let w=r.center,T=Math.max(xe(Math.abs(s),45,85,0,1),g)**.25,A=v7(w.lng,_.lng),M=v7(w.lat,_.lat);r.setCenter(new DQ(w.lng+A*T,w.lat+M*T).wrap()),r.setZoom(b+PD(x,r.center.lat))}handleMapControlsPan(t,r,i){t.panDelta&&function(t,r,i,n,a=!0){var o,s,l,u,c,h,d,f,p,m,g,y,v,x,b,_;let w,T,A,M,k,S,E,D,C,I,L,P,z,F,O=PS(t,i),R=r;if(n)R=PS(t,i.sub(n));else if(!t.isPointOnMapSurface(i))return;let B=PT(O),j=PT(R),N=(o=t.center,s=t.bearing,vG(vQ(),-o.lng,-o.lat,s)),V=vF(v0(),j,B),U=Math.sqrt(vz(V,V)),q=Math.acos(xr(vz(j,B),-1,1))/2,G=Math.sin(q),H=U?Mh(V[1]/U*G,-V[0]/U*G,V[2]/U*G,Math.cos(q)):Mh(0,0,0,1),{lng:$,lat:W,bearing:Y}=(L=(l=vQ(),u=N[0],c=N[1],h=N[2],d=N[3],f=H[0],p=H[1],m=H[2],g=H[3],l[0]=u*g+d*f+c*m-h*p,l[1]=c*g+d*p+h*f-u*m,l[2]=h*g+d*m+u*p-c*f,l[3]=d*g-u*f-c*p-h*m,y=l)[0],P=y[1],z=y[2],{lng:-(180*Math.atan2(2*((F=y[3])*L+P*z),1-2*(L*L+P*P)))/Math.PI,lat:-(180*Math.asin(xr(2*(F*P-z*L),-1,1)))/Math.PI,bearing:180*Math.atan2(2*(F*z+L*P),1-2*(P*P+z*z))/Math.PI}),Z=t.center.lat,X=t.zoom,K=xr(W,-90,90),J=a?(v=t,x=i,b=n,_=$,w=v.center.lng,A=(T=v.center.lat)>=0?90:-90,M=v.locationToScreenPoint(new DQ(0,A)),k=x.x-M.x,S=x.y-M.y,D=(E=xr(1-(Mb-Math.abs(T))/12,0,1))*E*(3-2*E),C=((_-w+180)%360+360)%360-180,I=0,D>0&&b&&(I=(A>0?1:-1)*((k*b.y-S*b.x)/Math.max(k*k+S*S,400))*180/Math.PI),w+(1-D)*C+D*I):$;t.setCenter(new DQ(xi(J,-180,180),K)),a||t.setBearing(Y),t.setZoom(X+PD(Z,t.center.lat))}(r,i,r.isPointOnMapSurface(t.around)?t.around:r.centerPoint,t.panDelta)}cameraForBoxAndBearing(r,i,n,a,o){let s=Pb(r,i,n,a,o),l=i.left/o.width*2-1,u=(o.width-i.right)/o.width*2-1,c=-(i.top/o.height*2)+1,h=-((o.height-i.bottom)/o.height*2)+1,d=0>v7(n.getWest(),n.getEast()),f=d?n.getEast():n.getWest(),p=d?n.getWest():n.getEast(),m=Math.max(n.getNorth(),n.getSouth()),g=Math.min(n.getNorth(),n.getSouth()),y=f+.5*v7(f,p),v=m+.5*v7(m,g),x=o.clone();x.setCenter(s.center),x.setBearing(s.bearing),x.setPitch(0),x.setRoll(0),x.setZoom(s.zoom);let b=x.modelViewProjectionMatrix,_=[PT(n.getNorthWest()),PT(n.getNorthEast()),PT(n.getSouthWest()),PT(n.getSouthEast()),PT(new DQ(p,v)),PT(new DQ(f,v)),PT(new DQ(y,m)),PT(new DQ(y,g))],w=PT(s.center),T=1/0;for(let r of _)l<0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(r,w,b,"x",l))),u>0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(r,w,b,"x",u))),c>0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(r,w,b,"y",c))),h<0&&(T=t.getLesserNonNegativeNonNull(T,t.solveVectorScale(r,w,b,"y",h)));return Number.isFinite(T)&&0!==T?(s.zoom=Math.min(x.zoom+xs(T),r.maxZoom),s):void Pv()}handleJumpToCenterZoom(t,r){let i=t.center.lat,n=t.applyConstrain(r.center?DQ.convert(r.center):t.center,t.zoom).center;t.setCenter(n.wrap());let a=void 0===r.zoom?t.zoom+PD(i,n.lat):+r.zoom;t.zoom!==a&&t.setZoom(a)}handleEaseTo(t,r){let i=t.zoom,n=t.center,a=t.padding,o={roll:t.roll,pitch:t.pitch,bearing:t.bearing},s={roll:void 0===r.roll?t.roll:r.roll,pitch:void 0===r.pitch?t.pitch:r.pitch,bearing:void 0===r.bearing?t.bearing:r.bearing},l=void 0!==r.zoom,u=!t.isPaddingEqual(r.padding),c=!1,h=r.center?DQ.convert(r.center):n,d=t.applyConstrain(h,i).center;Ph(t,d);let f=t.clone();f.setCenter(d),f.setZoom(l?+r.zoom:i+PD(n.lat,h.lat)),f.setBearing(r.bearing);let p=new vu(xr(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),xr(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));f.setLocationAtPoint(d,p);let m=(r.offset&&r.offsetAsPoint.mag())>0?f.center:d,g=l?+r.zoom:i+PD(n.lat,m.lat),y=i+PD(n.lat,0),v=g+PD(m.lat,0),x=v7(n.lng,m.lng),b=v7(n.lat,m.lat),_=xo(v-y);return{easeFunc:i=>{if(xb(o,s)||Px({startEulerAngles:o,endEulerAngles:s,tr:t,k:i,useSlerp:o.roll!=s.roll}),u&&t.interpolatePadding(a,r.padding,i),r.around)xf("Easing around a point is not supported under globe projection."),t.setLocationAtPoint(r.around,r.aroundPoint);else{let r=PI(n,x,b,i*(v>y?Math.min(2,_):Math.max(.5,_))**(1-i));t.setCenter(r.wrap())}if(c){let r=kx.number(y,v,i)+PD(0,t.center.lat);t.setZoom(r)}},isZooming:c=g!==i,elevationCenter:m}}handleFlyTo(t,r){let i=void 0!==r.zoom,n=t.center,a=t.zoom,o=t.padding,s=!t.isPaddingEqual(r.padding),l=t.applyConstrain(DQ.convert(r.center||r.locationAtOffset),a).center,u=i?+r.zoom:t.zoom+PD(t.center.lat,l.lat),c=t.clone();c.setCenter(l),c.setZoom(u),c.setBearing(r.bearing);let h=new vu(xr(t.centerPoint.x+r.offsetAsPoint.x,0,t.width),xr(t.centerPoint.y+r.offsetAsPoint.y,0,t.height));c.setLocationAtPoint(l,h);let d=c.center;Ph(t,d);let f=Math.acos(vz(PT(n),PT(d)))/(2*Math.PI)*P_(t),p=a+PD(n.lat,0),m=u+PD(d.lat,0),g=xo(m-p),y=Math.min(Math.max("number"==typeof r.minZoom?+r.minZoom:t.minZoom,t.minZoom)+PD(d.lat,0),p,m)+PD(0,d.lat),v=xo(t.applyConstrain(d,y).zoom+PD(d.lat,0)-p),x=v7(n.lng,d.lng),b=v7(n.lat,d.lat);return{easeFunc:(i,a,l,c)=>{let h=PI(n,x,b,l);s&&t.interpolatePadding(o,r.padding,i);let f=1===i?d:h;t.setCenter(f.wrap());let m=p+xs(a);t.setZoom(1===i?u:m+PD(0,f.lat))},scaleOfZoom:g,targetCenter:d,scaleOfMinZoom:v,pixelPathLength:f}}static solveVectorScale(t,r,i,n,a){let o="x"===n?[i[0],i[4],i[8],i[12]]:[i[1],i[5],i[9],i[13]],s=[i[3],i[7],i[11],i[15]],l=t[0]*o[0]+t[1]*o[1]+t[2]*o[2],u=t[0]*s[0]+t[1]*s[1]+t[2]*s[2],c=r[0]*o[0]+r[1]*o[1]+r[2]*o[2],h=r[0]*s[0]+r[1]*s[1]+r[2]*s[2],d=(c+o[3]-a*h-a*s[3])/(c-l-a*h+a*u);return c+a*u===l+a*h||s[3]*(l-c)+o[3]*(h-u)+l*h==c*u?null:d}static getLesserNonNegativeNonNull(t,r){return null!==r&&r>=0&&r{for(let t in this.tileManagers){let r=this.tileManagers[t].getSource().type;("vector"===r||"geojson"===r)&&this.tileManagers[t].reload()}},this.map=t,this.dispatcher=new Fw(LS(),t._getMapId()),this.dispatcher.registerMessageHandler("GG",(t,r)=>this.getGlyphs(t,r)),this.dispatcher.registerMessageHandler("GI",(t,r)=>this.getImages(t,r)),this.dispatcher.registerMessageHandler("GDA",(t,r)=>this.getDashes(t,r)),this.imageManager=new Ft,this.imageManager.setEventedParent(this),this.imageManager.setMissingImageResolver(t._missingStyleImageResolver),this.patternAtlas=new Fr(this.imageManager);let a=(null==(i=t._container)?void 0:i.lang)||"u">typeof document&&(null==(n=document.documentElement)?void 0:n.lang)||void 0;this.glyphManager=new Fd(t._requestManager,r.localIdeographFontFamily,a),this.lineAtlas=new Fy(256,512),this.crossTileSymbolIndex=new Op,this._setInitialValues(),this._resetUpdates(),this.dispatcher.broadcast("SR",xE()),LV().on(FU,this._rtlPluginLoaded),this.on("data",t=>{if("source"!==t.dataType||"metadata"!==t.sourceDataType)return;let r=this.tileManagers[t.sourceId];if(!r)return;let i=r.getSource();if(i?.vectorLayerIds)for(let t in this._layers){let r=this._layers[t];r.source===i.id&&this._validateLayer(r)}})}_setInitialValues(){var t;this._layers={},this._order=[],this.tileManagers={},this.zoomHistory=new Su,this._imagesListDirty=!1,this._globalState={},this._serializedLayers={},this.stylesheet=null,this.light=null,this.sky=null,this.projection&&(this.projection.destroy(),delete this.projection),this._loaded=!1,this._changed=!1,this._updatedLayers={},this._updatedSources={},this._changedImages={},this._glyphsDidChange=!1,this._updatedPaintProps={},this._layerOrderChanged=!1,this._symbolPlacementTriggered=!1,this._placedProjectionTransition=void 0,this.crossTileSymbolIndex=new((null==(t=this.crossTileSymbolIndex)?void 0:t.constructor)||Object),this.pauseablePlacement=void 0,this.placement=void 0,this.z=0}setGlobalStateProperty(t,r){var i,n,a;this._checkLoaded();let o=null===r?null!=(a=null==(n=null==(i=this.stylesheet.state)?void 0:i[t])?void 0:n.default)?a:null:r;if(xh(o,this._globalState[t]))return this;this._globalState[t]=o,this._applyGlobalStateChanges([t])}getGlobalState(){return this._globalState}setGlobalState(t){this._checkLoaded();let r=[];for(let i in t)xh(this._globalState[i],t[i].default)||(r.push(i),this._globalState[i]=t[i].default);this._applyGlobalStateChanges(r)}_applyGlobalStateChanges(t){if(0===t.length)return;let r=new Set,i={};for(let n of t)for(let t in i[n]=this._globalState[n],this._layers){let i=this._layers[t],a=i.getLayoutAffectingGlobalStateRefs(),o=i.getPaintAffectingGlobalStateRefs(),s=i.getVisibilityAffectingGlobalStateRefs();if(a.has(n)&&r.add(i.source),o.has(n))for(let{name:t,value:r}of o.get(n))this._updatePaintProperty(i,t,r);s?.has(n)&&(i.recalculateVisibility(),this._updateLayer(i))}for(let t in this.dispatcher.broadcast("UGS",i),this.tileManagers)r.has(t)&&(this._reloadSource(t),this._changed=!0)}loadURL(t){return _(this,arguments,function*(t,r={},i){this.fire(new z1("dataloading")),r.validate="boolean"!=typeof r.validate||r.validate,this._loadStyleRequest=new AbortController;let n=this._loadStyleRequest;try{let a=yield this.map._requestManager.transformRequest(t,"Style");xA(n.signal);let o=yield ME(a,n);this._loadStyleRequest===n&&(this._loadStyleRequest=null),this._load(o.data,r,i)}catch(t){this._loadStyleRequest===n&&(this._loadStyleRequest=null),t&&!n.signal.aborted&&this.fire(new ML(vJ(t)))}})}loadJSON(t,r={},i){this.fire(new z1("dataloading")),this._frameRequest=new AbortController,zH.frameAsync(this._frameRequest,this.map._ownerWindow).then(()=>{this._frameRequest=null,r.validate=!1!==r.validate,this._load(t,r,i)}).catch(()=>{})}loadEmpty(){this.fire(new z1("dataloading")),this._load(Oq,{validate:!1})}_load(t,r,i){var n,a,o;let s=r.transformStyle?r.transformStyle(i,t):t;if(!(r.validate&&_2(this,s))){for(let t in s=f({},s),this._loaded=!0,this.stylesheet=s,s.sources)this.addSource(t,s.sources[t],{validate:!1});s.sprite?this._loadSprite(s.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(s.glyphs),this.glyphManager.setFontFaces(s["font-faces"]),this._createLayers(),this.light=new Fp(null!=(n=this.stylesheet.light)?n:{},this._globalState),this._setProjectionInternal((null==(a=this.stylesheet.projection)?void 0:a.type)||"mercator"),this.sky=new Fg(this.stylesheet.sky,this._globalState),this.map.setTerrain(null!=(o=this.stylesheet.terrain)?o:null,{validate:!1}),this.fire(new z1("data")),this.fire(new z0)}}_createLayers(){var t,r,i;let n=Lf(this.stylesheet.layers);for(let a of(this.setGlobalState(null!=(t=this.stylesheet.state)?t:null),this.dispatcher.broadcast("SL",n),this._order=n.map(t=>t.id),this._layers={},this._serializedLayers=null,n)){let t=Ae(a,this._globalState);if(t.setEventedParent(this,{layer:{id:a.id}}),this._layers[a.id]=t,SC(t)&&this.tileManagers[t.source]){let n=null!=(i=null==(r=a.paint)?void 0:r["raster-fade-duration"])?i:t.paint.get("raster-fade-duration");this.tileManagers[t.source].setRasterFadeDuration(n)}}}_loadSprite(t,r=!1,i){return _(this,null,function*(){let n;this.imageManager.setLoaded(!1);let a=new AbortController;this._spriteRequest=a;try{let i=yield function(t,r,i,n){return _(this,null,function*(){let a=L_(t),o=i>1?"@2x":"",s={},l={};for(let{id:t,url:i}of a){let a=yield r.transformRequest(Lw(i,o,".json"),"SpriteJSON");s[t]=ME(a,n);let u=yield r.transformRequest(Lw(i,o,".png"),"SpriteImage");l[t]=zX.getImage(u,n)}return yield Promise.all([...Object.values(s),...Object.values(l)]),function(t,r){return _(this,null,function*(){let i={};for(let n in t){i[n]={};let a=(yield r[n]).data;if(!a)throw Error(`Could not load sprite image for ${n}: the response is empty`);let o=zH.getImageCanvasContext(a),s=(yield t[n]).data;for(let t in s){let{width:r,height:a,x:l,y:u,sdf:c,pixelRatio:h,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:g}=s[t],y={width:r,height:a,x:l,y:u,context:o};i[n][t]={data:null,pixelRatio:h,sdf:c,stretchX:d,stretchY:f,content:p,textFitWidth:m,textFitHeight:g,spriteData:y}}}return i})}(s,l)})}(t,this.map._requestManager,this.map.getPixelRatio(),a);if(!i)return;for(let t in i){let{loaded:n,removed:a}=this.imageManager.setSpriteImages(t,i[t]);this._markImagesChanged(a),r&&this._markImagesChanged(n)}}catch(t){n=t,a.signal.aborted||this.fire(new ML(n))}finally{this._spriteRequest=null,this.imageManager.setLoaded(!0),r&&(this._changed=!0),this.dispatcher.broadcast("SI",this.imageManager.listImages()),this.fire(new z1("data")),i?.(n)}})}_unloadSprite(){this._markImagesChanged(this.imageManager.removeAllSpriteImages()),this._imagesListDirty=!0,this._changed=!0,this.fire(new z1("data"))}_validateLayer(t){let r=this.tileManagers[t.source];if(!r)return;let i=t.sourceLayer;if(!i)return;let n=r.getSource();("geojson"===n.type||n.vectorLayerIds&&!n.vectorLayerIds.includes(i))&&this.fire(new ML(Error(`Source layer "${i}" does not exist on source "${n.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let t in this.tileManagers)if(!this.tileManagers[t].loaded())return!1;return this.imageManager.isLoaded()}_serializeByIds(t,r=!1){let i=this._serializedAllLayers();if(!t||0===t.length)return Object.values(r?xd(i):i);let n=[];for(let a of t)if(i[a]){let t=r?xd(i[a]):i[a];n.push(t)}return n}_serializedAllLayers(){let t=this._serializedLayers;if(t)return t;for(let r of(t=this._serializedLayers={},Object.keys(this._layers))){let i=this._layers[r];"custom"!==i.type&&(t[r]=i.serialize())}return t}hasTransitions(){var t,r,i;if(null!=(t=this.light)&&t.hasTransition()||null!=(r=this.sky)&&r.hasTransition()||null!=(i=this.projection)&&i.hasTransition())return!0;for(let t in this.tileManagers)if(this.tileManagers[t].hasTransition())return!0;for(let t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw Error("Style is not done loading.")}update(t){if(!this._loaded)return;let r=this._changed;if(r){this._imagesListDirty&&(this._imagesListDirty=(this.dispatcher.broadcast("SI",this.imageManager.listImages()),!1));let r=Object.keys(this._updatedLayers),i=Object.keys(this._removedLayers);for(let t in(r.length||i.length)&&this._updateWorkerLayers(r,i),this._updatedSources){let r=this._updatedSources[t];if("reload"===r)this._reloadSource(t);else if("clear"===r)this._clearSource(t);else throw Error(`Invalid action ${r}`)}for(let r in this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs(),this._updatedPaintProps)this._layers[r].updateTransitions(t);this._resetUpdates()}let i={};for(let t in this.tileManagers){let r=this.tileManagers[t];i[t]=r.used,r.used=!1}let n=this.imageManager.listImages();for(let r of this._order){let i=this._layers[r];i.recalculate(t,n),!i.isHidden(t.zoom)&&i.source&&(this.tileManagers[i.source].used=!0)}for(let t in i){let r=this.tileManagers[t];!!i[t]!=!!r.used&&r.fire(new z2("data",{sourceDataType:"visibility",sourceId:t}))}this.light.recalculate(t),this.sky.recalculate(t),this.projection.recalculate(t),this.z=t.zoom,r&&this.fire(new z1("data"))}_updateTilesForChangedImages(){let t=Object.keys(this._changedImages);if(t.length){for(let r in this.tileManagers)this.tileManagers[r].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let t in this.tileManagers)this.tileManagers[t].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(t,r){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(t,!1),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(t,r={}){var i;this._checkLoaded();let n=this.serialize();if(t=r.transformStyle?r.transformStyle(n,t):t,(null==(i=r.validate)||i)&&_2(this,t))return!1;(t=xd(t)).layers=Lf(t.layers);let a=function(t,r){if(!t)return[{command:"setStyle",args:[r]}];let i=[];try{if(!Lp(t.version,r.version))return[{command:"setStyle",args:[r]}];Lp(t.center,r.center)||i.push({command:"setCenter",args:[r.center]}),Lp(t.state,r.state)||i.push({command:"setGlobalState",args:[r.state]}),Lp(t.centerAltitude,r.centerAltitude)||i.push({command:"setCenterAltitude",args:[r.centerAltitude]}),Lp(t.zoom,r.zoom)||i.push({command:"setZoom",args:[r.zoom]}),Lp(t.bearing,r.bearing)||i.push({command:"setBearing",args:[r.bearing]}),Lp(t.pitch,r.pitch)||i.push({command:"setPitch",args:[r.pitch]}),Lp(t.roll,r.roll)||i.push({command:"setRoll",args:[r.roll]}),Lp(t.sprite,r.sprite)||i.push({command:"setSprite",args:[r.sprite]}),Lp(t.glyphs,r.glyphs)||i.push({command:"setGlyphs",args:[r.glyphs]}),Lp(t["font-faces"],r["font-faces"])||i.push({command:"setFontFaces",args:[r["font-faces"]]}),Lp(t.transition,r.transition)||i.push({command:"setTransition",args:[r.transition]}),Lp(t.light,r.light)||i.push({command:"setLight",args:[r.light]}),Lp(t.terrain,r.terrain)||i.push({command:"setTerrain",args:[r.terrain]}),Lp(t.sky,r.sky)||i.push({command:"setSky",args:[r.sky]}),Lp(t.projection,r.projection)||i.push({command:"setProjection",args:[r.projection]});let n={},a=[];!function(t,r,i,n){let a;for(a in t||(t={}),r||(r={}),t)Object.prototype.hasOwnProperty.call(t,a)&&(Object.prototype.hasOwnProperty.call(r,a)||Ly(a,i,n));for(a in r){var o;Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(t,a)?Lp(t[a],r[a])||("geojson"===t[a].type&&"geojson"===r[a].type&&function(t,r,i){let n;for(n in t[i])if(Object.prototype.hasOwnProperty.call(t[i],n)&&"data"!==n&&!Lp(t[i][n],r[i][n]))return!1;for(n in r[i])if(Object.prototype.hasOwnProperty.call(r[i],n)&&"data"!==n&&!Lp(t[i][n],r[i][n]))return!1;return!0}(t,r,a)?Lm(i,{command:"setGeoJSONSourceData",args:[a,r[a].data]}):(o=r,Ly(a,i,n),Lg(a,o,i))):Lg(a,r,i))}}(t.sources,r.sources,a,n);let o=[];t.layers&&t.layers.forEach(t=>{"source"in t&&n[t.source]?i.push({command:"removeLayer",args:[t.id]}):o.push(t)}),i=i.concat(a),function(t,r,i){t||(t=[]),r||(r=[]);let n=t.map(Lx),a=r.map(Lx),o=t.reduce(Lb,{}),s=r.reduce(Lb,{}),l=n.slice(),u=Object.create(null),c,h,d,f,p;for(let t=0,r=0;t0)throw Error(`Unimplemented: ${o.unimplemented.join(", ")}.`);if(0===o.operations.length)return!1;for(let t of o.operations)t();return this.stylesheet=t,this._serializedLayers=null,this.fire(new z0({style:this})),!0}_getOperationsToPerform(t){let r=[],i=[];for(let n of t)switch(n.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":r.push(()=>this.addLayer.apply(this,n.args));break;case"removeLayer":r.push(()=>this.removeLayer.apply(this,n.args));break;case"setPaintProperty":r.push(()=>this.setPaintProperty.apply(this,n.args));break;case"setLayoutProperty":r.push(()=>this.setLayoutProperty.apply(this,n.args));break;case"setFilter":r.push(()=>this.setFilter.apply(this,n.args));break;case"addSource":r.push(()=>this.addSource.apply(this,n.args));break;case"removeSource":r.push(()=>this.removeSource.apply(this,n.args));break;case"setLayerZoomRange":r.push(()=>this.setLayerZoomRange.apply(this,n.args));break;case"setLight":r.push(()=>this.setLight.apply(this,n.args));break;case"setGeoJSONSourceData":r.push(()=>this.setGeoJSONSourceData.apply(this,n.args));break;case"setGlyphs":r.push(()=>this.setGlyphs.apply(this,n.args));break;case"setFontFaces":r.push(()=>this.setFontFaces.apply(this,n.args));break;case"setSprite":r.push(()=>this.setSprite.apply(this,n.args));break;case"setTerrain":r.push(()=>this.map.setTerrain.apply(this,n.args));break;case"setSky":r.push(()=>this.setSky.apply(this,n.args));break;case"setProjection":this.setProjection.apply(this,n.args);break;case"setGlobalState":r.push(()=>this.setGlobalState.apply(this,n.args));break;case"setTransition":r.push(()=>{});break;default:i.push(n.command)}return{operations:r,unimplemented:i}}addImage(t,r){this.getImage(t)?this.fire(new ML(Error(`An image named "${t}" already exists.`))):(this.imageManager.addImage(t,r),this._afterImageUpdated(t))}updateImage(t,r){this.imageManager.updateImage(t,r)}getImage(t){return this.imageManager.getImage(t)}setMissingImageResolver(t){this.imageManager.setMissingImageResolver(t)}removeImage(t){this.getImage(t)?(this.imageManager.removeImage(t),this._afterImageUpdated(t)):this.fire(new ML(Error(`An image named "${t}" does not exist.`)))}_markImagesChanged(t){for(let r of t)this._changedImages[r]=!0}_afterImageUpdated(t){this._changedImages[t]=!0,this._imagesListDirty=!0,this._changed=!0,this.fire(new z1("data"))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,r,i={}){var n;if(this._checkLoaded(),void 0!==this.tileManagers[t])throw Error(`Source "${t}" already exists.`);if(!r.type)throw Error(`The type property must be defined, but only the following properties were given: ${Object.keys(r).join(", ")}.`);if(So.has(r.type)&&this._validate(Sa.source,`sources.${t}`,r,null,i))return;null!=(n=this.map)&&n._collectResourceTiming&&(r.collectResourceTiming=!0);let a=this.tileManagers[t]=new FJ(t,r,this.dispatcher);a.style=this,a.setEventedParent(this,()=>({isSourceLoaded:a.loaded(),source:a.serialize(),sourceId:t})),a.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);for(let r in this._layers)if(this._layers[r].source===t)return this.fire(new ML(Error(`Source "${t}" cannot be removed while layer "${r}" is using it.`)));let r=this.tileManagers[t];delete this.tileManagers[t],delete this._updatedSources[t],r.fire(new z2("data",{sourceDataType:"metadata",sourceId:t})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,r){if(this._checkLoaded(),void 0===this.tileManagers[t])throw Error(`There is no source with this ID=${t}`);let i=this.tileManagers[t].getSource();if("geojson"!==i.type)throw Error(`geojsonSource.type is ${i.type}, which is !== 'geojson`);i.setData(r),this._changed=!0}getSource(t){var r;return null==(r=this.tileManagers[t])?void 0:r.getSource()}addLayer(t,r,i={}){let n;this._checkLoaded();let a=t.id;if(this.getLayer(a))return void this.fire(new ML(Error(`Layer "${a}" already exists on this map.`)));if("custom"===t.type){var o;let r,i;if(_3(this,(r=[],void 0===(i=(o=t).id)&&r.push(new MR(`layers.${i}`,null,'missing required property "id"')),void 0===o.render&&r.push(new MR(`layers.${i}`,null,'missing required method "render"')),o.renderingMode&&"2d"!==o.renderingMode&&"3d"!==o.renderingMode&&r.push(new MR(`layers.${i}`,null,'property "renderingMode" must be either "2d" or "3d"')),r)))return;n=Ae(t,this._globalState)}else{if("source"in t&&"object"==typeof t.source&&(this.addSource(a,t.source),t=xn(t=xd(t),{source:a})),this._validate(Sa.layer,`layers.${a}`,t,{arrayIndex:-1},i))return;n=Ae(t,this._globalState),this._validateLayer(n),n.setEventedParent(this,{layer:{id:a}})}let s=r?this._order.indexOf(r):this._order.length;if(r&&-1===s)return void this.fire(new ML(Error(`Cannot add layer "${a}" before non-existing layer "${r}".`)));if(this._order.splice(s,0,a),this._layerOrderChanged=!0,this._layers[a]=n,this._removedLayers[a]&&n.source&&"custom"!==n.type){let t=this._removedLayers[a];delete this._removedLayers[a],t.type===n.type?(this._updatedSources[n.source]="reload",this.tileManagers[n.source].pause()):this._updatedSources[n.source]="clear"}this._updateLayer(n),n.onAdd&&n.onAdd(this.map)}moveLayer(t,r){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new ML(Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===r)return;if(r&&!this._order.includes(r))return void this.fire(new ML(Error(`Cannot move layer "${t}" before non-existing layer "${r}".`)));let i=this._order.indexOf(t);this._order.splice(i,1);let n=r?this._order.indexOf(r):this._order.length;this._order.splice(n,0,t),this._layerOrderChanged=!0}removeLayer(t){var r;this._checkLoaded();let i=this._layers[t];if(!i)return void this.fire(new ML(Error(`Cannot remove non-existing layer "${t}".`)));i.setEventedParent(null);let n=this._order.indexOf(t);this._order.splice(n,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=i,delete this._layers[t],this._serializedLayers&&delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],"symbol"===i.type&&i.source&&(null==(r=this.tileManagers[i.source])||r.resetMaxContentElevation()),i.onRemove&&i.onRemove(this.map)}getLayer(t){return this._layers[t]}getLayersOrder(){return[...this._order]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,r,i){this._checkLoaded();let n=this.getLayer(t);n?(n.minzoom!==r||n.maxzoom!==i)&&(null!=r&&(n.minzoom=r),null!=i&&(n.maxzoom=i),this._updateLayer(n)):this.fire(new ML(Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,r,i={}){this._checkLoaded();let n=this.getLayer(t);if(!n)return void this.fire(new ML(Error(`Cannot filter non-existing layer "${t}".`)));if(!xh(n.filter,r)){if(null==r){n.setFilter(void 0),this._updateLayer(n);return}this._validate(Sa.filter,`layers.${n.id}.filter`,r,null,i)||(n.setFilter(xd(r)),this._updateLayer(n))}}getFilter(t){return xd(this.getLayer(t).filter)}setLayoutProperty(t,r,i,n={}){this._checkLoaded();let a=this.getLayer(t);a?xh(a.getLayoutProperty(r),i)||(a.setLayoutProperty(r,i,n),this._updateLayer(a)):this.fire(new ML(Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,r){let i=this.getLayer(t);return i?i.getLayoutProperty(r):void this.fire(new ML(Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,r,i,n={}){this._checkLoaded();let a=this.getLayer(t);a?xh(a.getPaintProperty(r),i)||this._updatePaintProperty(a,r,i,n):this.fire(new ML(Error(`Cannot style non-existing layer "${t}".`)))}_updatePaintProperty(t,r,i,n={}){t.setPaintProperty(r,i,n)&&this._updateLayer(t),SC(t)&&"raster-fade-duration"===r&&this.tileManagers[t.source].setRasterFadeDuration(i),this._changed=!0,this._updatedPaintProps[t.id]=!0,"symbol"===t.type&&this.triggerSymbolPlacement(),this._serializedLayers=null}getPaintProperty(t,r){return this.getLayer(t).getPaintProperty(r)}setFeatureState(t,r){this._checkLoaded();let i=t.source,n=t.sourceLayer,a=this.tileManagers[i];if(void 0===a)return void this.fire(new ML(Error(`The source '${i}' does not exist in the map's style.`)));let o=a.getSource().type;if("geojson"===o&&n)return void this.fire(new ML(Error("GeoJSON sources cannot have a sourceLayer parameter.")));if("vector"===o&&!n)return void this.fire(new ML(Error("The sourceLayer parameter must be provided for vector source types.")));if(void 0===t.id)return void this.fire(new ML(Error("The feature id parameter must be provided.")));let s=["__proto__","constructor","prototype"];r&&Object.keys(r).some(t=>s.includes(t))?this.fire(new ML(Error(`The feature state should not include one of the following keys: ${s}`))):a.setFeatureState(n,t.id,r)}removeFeatureState(t,r){this._checkLoaded();let i=t.source,n=this.tileManagers[i];if(void 0===n)return void this.fire(new ML(Error(`The source '${i}' does not exist in the map's style.`)));let a=n.getSource().type,o="vector"===a?t.sourceLayer:void 0;"vector"!==a||o?r&&"string"!=typeof t.id&&"number"!=typeof t.id?this.fire(new ML(Error("A feature id is required to remove its specific state property."))):n.removeFeatureState(o,t.id,r):this.fire(new ML(Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();let r=t.source,i=t.sourceLayer,n=this.tileManagers[r];return void 0===n?void this.fire(new ML(Error(`The source '${r}' does not exist in the map's style.`))):"vector"!==n.getSource().type||i?(void 0===t.id&&this.fire(new ML(Error("The feature id parameter must be provided."))),n.getFeatureState(i,t.id)):void this.fire(new ML(Error("The sourceLayer parameter must be provided for vector source types.")))}getTransition(){var t;return xn({duration:300,delay:0},null==(t=this.stylesheet)?void 0:t.transition)}serialize(){if(!this._loaded)return;let t=xu(this.tileManagers,t=>t.serialize()),r=this._serializeByIds(this._order,!0),i=this.map.getTerrain()||void 0,n=this.stylesheet;return xc({version:n.version,name:n.name,metadata:n.metadata,light:n.light,sky:n.sky,center:n.center,zoom:n.zoom,bearing:n.bearing,pitch:n.pitch,sprite:n.sprite,glyphs:n.glyphs,"font-faces":n["font-faces"],transition:n.transition,projection:n.projection,state:n.state,sources:t,layers:r,terrain:i},t=>void 0!==t)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&"raster"!==this.tileManagers[t.source].getSource().type&&(this._updatedSources[t.source]="reload",this.tileManagers[t.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(t){let r=t=>"fill-extrusion"===this._layers[t].type,i={},n=[];for(let a=this._order.length-1;a>=0;a--){let o=this._order[a];if(r(o))for(let r of(i[o]=a,t)){let t=r[o];if(t)for(let r of t)n.push(r)}}n.sort((t,r)=>r.intersectionZ-t.intersectionZ);let a=[];for(let o=this._order.length-1;o>=0;o--){let s=this._order[o];if(r(s))for(let t=n.length-1;t>=0;t--){let r=n[t].feature;if(i[r.layer.id]s(n.tileID,t,r):void 0)});var d,f=function(t){let r={},i={};for(let{queryResults:n,wrappedTileID:a}of t){i[a]||(i[a]={});let t=i[a];for(let i in n){let a=n[i];t[i]||(t[i]={});let o=t[i];for(let t of(r[i]||(r[i]=[]),a))o[t.featureIndex]||(o[t.featureIndex]=!0,r[i].push(t))}}return r}(h),p=t;for(let t in f)for(let r of f[t])LL(r,p);return f}(this.tileManagers[s],this._layers,o,t,l,i,this.map.terrain?(t,r,i)=>this.map.terrain.getElevation(t,r,i):void 0));return this.placement&&a.push(function(t,r,i,n,a,o,s){let l={},u=o.queryRenderedSymbols(n),c=[];for(let t of Object.keys(u).map(Number))c.push(s[t]);for(let i of(c.sort(LI),c)){let n=i.featureIndex.lookupSymbolFeatures(u[i.bucketInstanceId],r,i.bucketIndex,i.sourceLayerIndex,{filterSpec:a.filter,globalState:a.globalState},a.layers,a.availableImages,t);for(let t in n){l[t]||(l[t]=[]);let r=n[t];for(let n of(r.sort((t,r)=>{let n=i.featureSortOrder;if(n){let i=n.indexOf(t.featureIndex);return n.indexOf(r.featureIndex)-i}return r.featureIndex-t.featureIndex}),r))l[t].push(n)}}var h=l,d=t,f=i;for(let t in h)for(let r of h[t])LL(r,f[d[t].source]);return h}(this._layers,o,this.tileManagers,t,l,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(t,r){r?.filter&&this._validate(Sa.filter,"querySourceFeatures.filter",r.filter,null,r);let i=this.tileManagers[t];return i?function(t,r){let i=t.getRenderableIds().map(r=>t.getTileByID(r)),n=[],a={};for(let t of i){let i=t.tileID.canonical.key;a[i]||(a[i]=!0,t.querySourceFeatures(n,r))}return n}(i,r?p(f({},r),{globalState:this._globalState}):{globalState:this._globalState}):[]}getLight(){return this.light.getLight()}setLight(t,r={}){this._checkLoaded();let i=this.light.getLight(),n=!1;for(let r in t)if(!xh(t[r],i[r])){n=!0;break}if(!n)return;let a={now:Lu(),transition:xn({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(t,r),this.light.updateTransitions(a)}getProjection(){var t;return null==(t=this.stylesheet)?void 0:t.projection}setProjection(t){this._checkLoaded();let r=t??{type:"mercator"};if(this.stylesheet.projection=t,this.projection){if(this.projection.name===r.type)return;this.projection.destroy(),delete this.projection}this._setProjectionInternal(r.type)}getSky(){var t;return null==(t=this.stylesheet)?void 0:t.sky}setSky(t,r={}){this._checkLoaded();let i=this.getSky(),n=!1;if(!t&&!i)return;if(t&&!i)n=!0;else if(!t&&i)n=!0;else for(let r in t)if(!xh(t[r],i[r])){n=!0;break}if(!n)return;let a={now:Lu(),transition:xn({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=t,this.sky.setSky(t,r),this.sky.updateTransitions(a)}_setProjectionInternal(t){var r;let i=function(t,r,i){let n={constrainOverride:r};if(Array.isArray(t)){let r=new Oz({type:t},i);return{projection:r,transform:new ON(n),cameraHelper:new OU(r)}}switch(t){case"mercator":return{projection:new Ob,transform:new OD(n),cameraHelper:new OC};case"globe":{let t=new Oz({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]},{});return{projection:t,transform:new ON(n),cameraHelper:new OU(t)}}case"vertical-perspective":return{projection:new OP,transform:new Oj(n),cameraHelper:new OV};default:return xf(`Unknown projection name: ${t}. Falling back to mercator projection.`),{projection:new Ob,transform:new OD(n),cameraHelper:new OC}}}(t,null==(r=this.map._camera)?void 0:r.transform.constrainOverride,this._globalState);for(let t in this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper),this.tileManagers)this.tileManagers[t].reload()}_validate(t,r,i,n,a={}){return!1!==a.validate&&_5(this,t,f({key:r,style:this.serialize(),value:i},n),a)}_remove(t=!0){for(let t in this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),LV().off(FU,this._rtlPluginLoaded),this._layers)this._layers[t].setEventedParent(null);for(let t in this.tileManagers){let r=this.tileManagers[t];r.setEventedParent(null),r.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),t&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(t)}_clearSource(t){this.tileManagers[t].clearTiles()}_reloadSource(t){this.tileManagers[t].resume(),this.tileManagers[t].reload()}_updateSources(t){for(let r in this.tileManagers)this.tileManagers[r].update(t,this.map.terrain)}_generateCollisionBoxes(){for(let t in this.tileManagers)this._reloadSource(t)}triggerSymbolPlacement(){this._symbolPlacementTriggered=!0}_placementInputsChanged(t,r,i){var n,a,o;let s=this.pauseablePlacement;return!s||this._symbolPlacementTriggered||this._placedProjectionTransition!==(null==(n=this.projection)?void 0:n.transitionState)||s._showCollisionBoxes!==r||s.placement.collisionGroups.crossSourceCollisions!==i||s.placement.transform.renderWorldCopies!==t.renderWorldCopies||(a=s.placement.transform.modelViewProjectionMatrix,o=t.modelViewProjectionMatrix,a[0]!==o[0]||a[1]!==o[1]||a[2]!==o[2]||a[3]!==o[3]||a[4]!==o[4]||a[5]!==o[5]||a[6]!==o[6]||a[7]!==o[7]||a[8]!==o[8]||a[9]!==o[9]||a[10]!==o[10]||a[11]!==o[11]||a[12]!==o[12]||a[13]!==o[13]||a[14]!==o[14]||a[15]!==o[15])}_updatePlacement(t,r,i,n,a=!1){var o,s;let l=!1,u=!1,c={};for(let r of this._order){let i=this._layers[r];if("symbol"!==i.type)continue;if(!c[i.source]){let t=this.tileManagers[i.source];c[i.source]=t.getRenderableIds(!0).map(r=>t.getTileByID(r)).sort((t,r)=>r.tileID.overscaledZ-t.tileID.overscaledZ||(t.tileID.isLessThan(r.tileID)?-1:1))}let n=this.crossTileSymbolIndex.addLayer(i,c[i.source],t.center.lng);l||(l=n)}this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a||(a=this._layerOrderChanged||0===i);let h=l||this._placementInputsChanged(t,r,n),d=(null==(o=this.pauseablePlacement)?void 0:o.isDone())&&!this.placement.stillRecent(Lu(),t.zoom);if((a||!this.pauseablePlacement||d&&(h||this.placement.stale))&&(this._symbolPlacementTriggered=!1,this._placedProjectionTransition=null==(s=this.projection)?void 0:s.transitionState,this.pauseablePlacement=new Oo(t,this.map.terrain,this._order,a,r,i,n,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?h&&this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Lu()),u=!0),l&&this.pauseablePlacement.placement.setStale()),u||l)for(let t of this._order){let r=this._layers[t];"symbol"===r.type&&this.placement.updateLayerOpacities(r,c[r.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Lu())}_releaseSymbolFadeTiles(){for(let t in this.tileManagers)this.tileManagers[t].releaseSymbolFadeTiles()}getImages(t,r){return _(this,null,function*(){let t=yield this.imageManager.getImages(r.icons);this._updateTilesForChangedImages();let i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,r.icons),t})}getGlyphs(t,r){return _(this,null,function*(){let t=yield this.glyphManager.getGlyphs(r.stacks),i=this.tileManagers[r.source];return i&&i.setDependencies(r.tileID.key,r.type,[""]),t})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(t,r={}){this._checkLoaded(),t&&this._validate(Sa.glyphs,"glyphs",t,null,r)||(this._changed=!0,this._glyphsDidChange=!0,this.stylesheet.glyphs=t,this.glyphManager.entries={},this.glyphManager.setURL(t))}getFontFaces(){return this.stylesheet["font-faces"]||null}setFontFaces(t){this._checkLoaded(),this._changed=!0,this._glyphsDidChange=!0,this.stylesheet["font-faces"]=t,this.glyphManager.setFontFaces(t)}getDashes(t,r){return _(this,null,function*(){let t={};for(let[i,n]of Object.entries(r.dashes))t[i]=this.lineAtlas.getDash(n.dasharray,n.round);return t})}addSprite(t,r,i={},n){this._checkLoaded();let a=[{id:t,url:r}],o=[...L_(this.stylesheet.sprite),...a];this._validate(Sa.sprite,"sprite",o,null,i)||(this.stylesheet.sprite=o,this._loadSprite(a,!0,n))}removeSprite(t){this._checkLoaded();let r=L_(this.stylesheet.sprite);if(!r.find(r=>r.id===t))return void this.fire(new ML(Error(`Sprite "${t}" doesn't exists on this map.`)));let i=this.imageManager.removeSpriteImages(t);this._markImagesChanged(i),r.splice(r.findIndex(r=>r.id===t),1),this.stylesheet.sprite=r.length>0?r:void 0,this._imagesListDirty=!0,this._changed=!0,this.fire(new z1("data"))}getSprite(){return L_(this.stylesheet.sprite)}setSprite(t,r={},i){this._checkLoaded(),!(t&&this._validate(Sa.sprite,"sprite",t,null,r))&&(this.stylesheet.sprite=t,t?this._loadSprite(t,!0,i):(this._unloadSprite(),i&&i(null)))}destroy(){for(let t in this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._loadStyleRequest&&(this._loadStyleRequest=(this._loadStyleRequest.abort(),null)),this._spriteRequest&&(this._spriteRequest=(this._spriteRequest.abort(),null)),this.tileManagers){let r=this.tileManagers[t];r.setEventedParent(null),r.onRemove(this.map)}for(let t in this.tileManagers={},this.imageManager&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.patternAtlas.destroy()),this.glyphManager&&this.glyphManager.destroy(),this._layers){let r=this._layers[t];r.setEventedParent(null),r.onRemove&&r.onRemove(this.map)}this._setInitialValues(),this.setEventedParent(null),this.dispatcher.unregisterMessageHandler("GG"),this.dispatcher.unregisterMessageHandler("GI"),this.dispatcher.unregisterMessageHandler("GDA"),this.dispatcher.remove(!0),this._listeners={},this._oneTimeListeners={}}},OH=wi([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),O$=class{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,r,i,n,a,o,s,l,u){this.context=t;let c=this.boundPaintVertexBuffers.length!==n.length;for(let t=0;!c&&t({u_texture:new ER(t,r.u_texture),u_ele_delta:new EB(t,r.u_ele_delta),u_fog_matrix:new E$(t,r.u_fog_matrix),u_fog_color:new EU(t,r.u_fog_color),u_fog_ground_blend:new EB(t,r.u_fog_ground_blend),u_fog_ground_blend_opacity:new EB(t,r.u_fog_ground_blend_opacity),u_horizon_color:new EU(t,r.u_horizon_color),u_horizon_fog_blend:new EB(t,r.u_horizon_fog_blend),u_is_globe_mode:new EB(t,r.u_is_globe_mode)}),OY=(t,r)=>({u_ele_delta:new EB(t,r.u_ele_delta)}),OZ=(t,r,i,n,a)=>({u_texture:0,u_ele_delta:t,u_fog_matrix:r,u_fog_color:i?i.properties.get("fog-color"):kt.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:a?0:i?i.calculateFogBlendOpacity(n):0,u_horizon_color:i?i.properties.get("horizon-color"):kt.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:+!!a}),OX=t=>({u_ele_delta:t}),OK={ProjectionUBO:0,TerrainUBO:1,FrameUBO:2},OJ={float:[1,1],int:[1,1],vec2:[2,2],vec4:[4,4],mat4:[16,4]},OQ=class{constructor(t,r,i){this.context=t,this.binding=r,this.contentWords=i.contentWords;let n=t.gl;this.buffer=n.createBuffer(),n.bindBuffer(n.UNIFORM_BUFFER,this.buffer),n.bufferData(n.UNIFORM_BUFFER,4*i.sizeWords,n.DYNAMIC_DRAW),n.bindBufferBase(n.UNIFORM_BUFFER,r,this.buffer),this.uploaded=new Float32Array(i.sizeWords),this.pending=new Float32Array(i.sizeWords),this.uploadedWords=new Uint32Array(this.uploaded.buffer),this.pendingWords=new Uint32Array(this.pending.buffer),this.hasData=!1,this.bindingDirty=!1}upload(){let t=this.context.gl,r=!this.hasData;if(!r){let t=this.pendingWords,i=this.uploadedWords;for(let n=0;n=0&&(this.attributes[t]={location:r,isInteger:M.has(t)})}for(let t of(c.deleteShader(T),c.deleteShader(w),v))if(t&&!A[t]){let r=c.getUniformLocation(this.program,t);r&&(A[t]=r)}this.fixedUniforms=n(t,A),this.terrainUniforms=((t,r)=>({u_depth:new ER(t,r.u_depth),u_terrain:new ER(t,r.u_terrain)}))(t,A),this.binderUniforms=i?i.getUniforms(t,A):[]}draw(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m,g,y,v,x){var b,_,w;let T,A=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(a),t.setCullFace(o),l){let r;for(let r in t.activeTexture.set(A.TEXTURE2),A.bindTexture(A.TEXTURE_2D,l.depthTexture),t.activeTexture.set(A.TEXTURE3),A.bindTexture(A.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[r].set(l[r]);_=t.terrainUniformBuffer,(r=_.pending).set(l.u_terrain_matrix,O3.u_terrain_matrix),r.set(l.u_terrain_unpack,O3.u_terrain_unpack),r[O3.u_terrain_dim]=l.u_terrain_dim,r[O3.u_terrain_exaggeration]=l.u_terrain_exaggeration,_.upload()}if(u&&(w=t.projectionUniformBuffer,(T=w.pending).set(u.mainMatrix,O1.u_projection_matrix),T.set(u.fallbackMatrix,O1.u_projection_fallback_matrix),T.set(u.tileMercatorCoords,O1.u_projection_tile_mercator_coords),T.set(u.clippingPlane,O1.u_projection_clipping_plane),T[O1.u_projection_transition]=u.projectionTransition,w.pendingWords[O1.u_projection_clip_antimeridian]=+!!u.clipAntimeridian,w.upload()),s)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(s[t]);g&&g.setUniforms(t,this.binderUniforms,p,{zoom:m});let M=0;switch(r){case A.LINES:M=2;break;case A.TRIANGLES:M=3;break;case A.LINE_STRIP:M=1}for(let i of f.get())i.vaos||(i.vaos={}),(b=i.vaos)[c]||(b[c]=new O$),i.vaos[c].bind(t,this,h,g?g.getPaintVertexBuffers():[],d,i.vertexOffset,y,v,x),A.drawElements(r,i.primitiveLength*M,A.UNSIGNED_SHORT,i.primitiveOffset*M*2)}},O4=(t,r)=>({u_lightpos:new EN(t,r.u_lightpos),u_lightpos_globe:new EN(t,r.u_lightpos_globe),u_lightintensity:new EB(t,r.u_lightintensity),u_lightcolor:new EN(t,r.u_lightcolor),u_vertical_gradient:new EB(t,r.u_vertical_gradient),u_opacity:new EB(t,r.u_opacity),u_fill_translate:new Ej(t,r.u_fill_translate)}),O6=(t,r)=>({u_lightpos:new EN(t,r.u_lightpos),u_lightpos_globe:new EN(t,r.u_lightpos_globe),u_lightintensity:new EB(t,r.u_lightintensity),u_lightcolor:new EN(t,r.u_lightcolor),u_vertical_gradient:new EB(t,r.u_vertical_gradient),u_height_factor:new EB(t,r.u_height_factor),u_opacity:new EB(t,r.u_opacity),u_fill_translate:new Ej(t,r.u_fill_translate),u_image:new ER(t,r.u_image),u_texsize:new Ej(t,r.u_texsize),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade)}),O8=(t,r,i,n)=>{var a,o,s,l,u,c;let h=t.style.light,d=h.getCartesianPosition(),f=vd();"viewport"===h.properties.get("anchor")&&(o=Math.sin(a=t.transform.bearingInRadians),s=Math.cos(a),f[0]=s,f[1]=o,f[2]=0,f[3]=-o,f[4]=s,f[5]=0,f[6]=0,f[7]=0,f[8]=1),l=d[0],u=d[1],c=d[2],d[0]=l*f[0]+u*f[3]+c*f[6],d[1]=l*f[1]+u*f[4]+c*f[7],d[2]=l*f[2]+u*f[5]+c*f[8];let p=t.transform.transformLightDirection(d),m=h.properties.get("color");return{u_lightpos:d,u_lightpos_globe:p,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[m.r,m.g,m.b],u_vertical_gradient:+r,u_opacity:i,u_fill_translate:n}},O7=(t,r,i,n,a,o,s)=>xn(O8(t,r,i,n),PN(o,t,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),O9=(t,r)=>({u_fill_translate:new Ej(t,r.u_fill_translate)}),Re=(t,r)=>({u_image:new ER(t,r.u_image),u_texsize:new Ej(t,r.u_texsize),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade),u_sdf_pattern:new ER(t,r.u_sdf_pattern),u_fill_translate:new Ej(t,r.u_fill_translate)}),Rt=(t,r)=>({u_fill_translate:new Ej(t,r.u_fill_translate)}),Rr=(t,r)=>({u_image:new ER(t,r.u_image),u_texsize:new Ej(t,r.u_texsize),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade),u_sdf_pattern:new ER(t,r.u_sdf_pattern),u_fill_translate:new Ej(t,r.u_fill_translate)}),Ri=(t,r,i,n,a)=>xn(PN(r,t,i),{u_fill_translate:n,u_sdf_pattern:+!!a}),Rn=t=>({u_fill_translate:t}),Ra=t=>({u_fill_translate:t}),Ro=(t,r,i,n,a)=>Ri(t,r,i,n,a),Rs=(t,r)=>({u_scale_with_map:new ER(t,r.u_scale_with_map),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_extrude_scale:new Ej(t,r.u_extrude_scale),u_globe_extrude_scale:new EB(t,r.u_globe_extrude_scale),u_translate:new Ej(t,r.u_translate)}),Rl=(t,r,i,n,a)=>{let o=t.transform,s,l,u=0;if("map"===i.paint.get("circle-pitch-alignment")){let t=vK(r,1,o.zoom);s=!0,l=[t,t],u=t/(Mf*2**r.tileID.overscaledZ)*2*Math.PI*a}else s=!1,l=o.pixelsToGLUnits;return{u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_extrude_scale:l,u_globe_extrude_scale:u,u_translate:n}},Ru=(t,r)=>({u_color:new EU(t,r.u_color),u_overlay:new ER(t,r.u_overlay),u_overlay_scale:new EB(t,r.u_overlay_scale)}),Rc=(t,r=1)=>({u_color:t,u_overlay:0,u_overlay_scale:r}),Rh=(t,r)=>({u_extrude_scale:new EB(t,r.u_extrude_scale),u_intensity:new EB(t,r.u_intensity),u_globe_extrude_scale:new EB(t,r.u_globe_extrude_scale)}),Rd=(t,r)=>({u_matrix:new E$(t,r.u_matrix),u_image:new ER(t,r.u_image),u_color_ramp:new ER(t,r.u_color_ramp),u_opacity:new EB(t,r.u_opacity)}),Rf=(t,r,i,n)=>{let a=vK(t,1,r)/(Mf*2**t.tileID.overscaledZ)*2*Math.PI*n;return{u_extrude_scale:vK(t,1,r),u_intensity:i,u_globe_extrude_scale:a}},Rp=(t,r,i,n)=>{let a=vf();return Ms(a,0,t.width,t.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},Rm=(t,r)=>({u_image:new ER(t,r.u_image),u_latrange:new Ej(t,r.u_latrange),u_exaggeration:new EB(t,r.u_exaggeration),u_altitudes:new EG(t,r.u_altitudes),u_azimuths:new EG(t,r.u_azimuths),u_accent:new EU(t,r.u_accent),u_method:new ER(t,r.u_method),u_shadows:new Eq(t,r.u_shadows),u_highlights:new Eq(t,r.u_highlights)}),Rg=(t,r)=>({u_matrix:new E$(t,r.u_matrix),u_image:new ER(t,r.u_image),u_dimension:new Ej(t,r.u_dimension),u_zoom:new EB(t,r.u_zoom),u_unpack:new EV(t,r.u_unpack)}),Ry=(t,r,i)=>{var n;let a,o,s=i.paint.get("hillshade-accent-color"),l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}let u=i.getIlluminationProperties();for(let r=0;r{let i=r.stride,n=vf();return Ms(n,0,Mf,-Mf,0,0,1),vv(n,n,[0,-Mf,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}},Rx=(t,r)=>({u_image:new ER(t,r.u_image),u_unpack:new EV(t,r.u_unpack),u_dimension:new Ej(t,r.u_dimension),u_elevation_stops:new ER(t,r.u_elevation_stops),u_color_stops:new ER(t,r.u_color_stops),u_color_ramp_size:new ER(t,r.u_color_ramp_size),u_opacity:new EB(t,r.u_opacity)}),Rb=(t,r,i=0)=>({u_image:0,u_unpack:r.getUnpackVector(),u_dimension:[r.stride,r.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:t.paint.get("color-relief-opacity")}),R_=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio)}),Rw=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_image_height:new EB(t,r.u_image_height)}),RT=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_texsize:new Ej(t,r.u_texsize),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade)}),RA=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_mix:new EB(t,r.u_mix),u_tileratio:new EB(t,r.u_tileratio),u_crossfade_from:new EB(t,r.u_crossfade_from),u_crossfade_to:new EB(t,r.u_crossfade_to),u_lineatlas_width:new EB(t,r.u_lineatlas_width),u_lineatlas_height:new EB(t,r.u_lineatlas_height)}),RM=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_image_height:new EB(t,r.u_image_height),u_tileratio:new EB(t,r.u_tileratio),u_crossfade_from:new EB(t,r.u_crossfade_from),u_crossfade_to:new EB(t,r.u_crossfade_to),u_image_dash:new ER(t,r.u_image_dash),u_mix:new EB(t,r.u_mix),u_lineatlas_width:new EB(t,r.u_lineatlas_width),u_lineatlas_height:new EB(t,r.u_lineatlas_height)}),Rk=(t,r,i,n)=>{let a=t.transform;return{u_translation:PU(t,r,i),u_ratio:n/vK(r,1,a.zoom)}},RS=(t,r,i,n,a)=>xn(Rk(t,r,i,n),{u_image:0,u_image_height:a}),RE=(t,r,i,n,a)=>{let o=t.transform,s=PV(r,o);return{u_translation:PU(t,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/vK(r,1,o.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},RD=(t,r,i,n,a)=>{let o=PV(r,t.transform);return xn(Rk(t,r,i,n),{u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},RC=(t,r,i,n,a,o)=>{let s=PV(r,t.transform);return xn(Rk(t,r,i,n),{u_image:0,u_image_height:o,u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},RI=(t,r)=>({u_image:new ER(t,r.u_image),u_opacity:new EB(t,r.u_opacity)}),RL=(t,r)=>({u_image:r,u_opacity:t}),RP=(t,r)=>({u_is_size_zoom_constant:new ER(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new ER(t,r.u_is_size_feature_constant),u_size_t:new EB(t,r.u_size_t),u_size:new EB(t,r.u_size),u_rotate_symbol:new ER(t,r.u_rotate_symbol),u_label_plane_matrix:new E$(t,r.u_label_plane_matrix),u_coord_matrix:new E$(t,r.u_coord_matrix),u_is_text:new ER(t,r.u_is_text),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_is_along_line:new ER(t,r.u_is_along_line),u_is_variable_anchor:new ER(t,r.u_is_variable_anchor),u_texsize:new Ej(t,r.u_texsize),u_texture:new ER(t,r.u_texture),u_translation:new Ej(t,r.u_translation),u_pitched_scale:new EB(t,r.u_pitched_scale),u_is_offset:new ER(t,r.u_is_offset),u_height_anchor_ground:new ER(t,r.u_height_anchor_ground)}),Rz=(t,r)=>({u_is_size_zoom_constant:new ER(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new ER(t,r.u_is_size_feature_constant),u_size_t:new EB(t,r.u_size_t),u_size:new EB(t,r.u_size),u_rotate_symbol:new ER(t,r.u_rotate_symbol),u_label_plane_matrix:new E$(t,r.u_label_plane_matrix),u_coord_matrix:new E$(t,r.u_coord_matrix),u_is_text:new ER(t,r.u_is_text),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_is_along_line:new ER(t,r.u_is_along_line),u_is_variable_anchor:new ER(t,r.u_is_variable_anchor),u_texsize:new Ej(t,r.u_texsize),u_texture:new ER(t,r.u_texture),u_gamma_scale:new EB(t,r.u_gamma_scale),u_is_halo:new ER(t,r.u_is_halo),u_is_plain:new ER(t,r.u_is_plain),u_translation:new Ej(t,r.u_translation),u_pitched_scale:new EB(t,r.u_pitched_scale),u_is_offset:new ER(t,r.u_is_offset),u_height_anchor_ground:new ER(t,r.u_height_anchor_ground)}),RF=(t,r)=>({u_is_size_zoom_constant:new ER(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new ER(t,r.u_is_size_feature_constant),u_size_t:new EB(t,r.u_size_t),u_size:new EB(t,r.u_size),u_rotate_symbol:new ER(t,r.u_rotate_symbol),u_label_plane_matrix:new E$(t,r.u_label_plane_matrix),u_coord_matrix:new E$(t,r.u_coord_matrix),u_is_text:new ER(t,r.u_is_text),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_is_along_line:new ER(t,r.u_is_along_line),u_is_variable_anchor:new ER(t,r.u_is_variable_anchor),u_texsize:new Ej(t,r.u_texsize),u_texsize_icon:new Ej(t,r.u_texsize_icon),u_texture:new ER(t,r.u_texture),u_texture_icon:new ER(t,r.u_texture_icon),u_gamma_scale:new EB(t,r.u_gamma_scale),u_is_halo:new ER(t,r.u_is_halo),u_translation:new Ej(t,r.u_translation),u_pitched_scale:new EB(t,r.u_pitched_scale),u_is_offset:new ER(t,r.u_is_offset),u_height_anchor_ground:new ER(t,r.u_height_anchor_ground)}),RO=(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m)=>({u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:l,u_coord_matrix:u,u_is_text:+h,u_pitch_with_map:+n,u_is_along_line:a,u_is_variable_anchor:o,u_texsize:d,u_texture:0,u_translation:c,u_pitched_scale:f,u_is_offset:p,u_height_anchor_ground:+m}),RR=(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m,g)=>{let y=s.transform;return xn(RO(t,r,i,n,a,o,s,l,u,c,h,d,p,m,g),{u_gamma_scale:n?Math.cos(y.pitch*Math.PI/180)*y.cameraToCenterDistance:1,u_is_halo:+!!f,u_is_plain:1})},RB=(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m)=>xn(RR(t,r,i,n,a,o,s,l,u,c,!0,h,!0,f,p,m),{u_texsize_icon:d,u_texture_icon:1}),Rj=(t,r)=>({u_opacity:new EB(t,r.u_opacity),u_color:new EU(t,r.u_color)}),RN=(t,r)=>({u_opacity:new EB(t,r.u_opacity),u_image:new ER(t,r.u_image),u_pattern_tl_a:new Ej(t,r.u_pattern_tl_a),u_pattern_br_a:new Ej(t,r.u_pattern_br_a),u_pattern_tl_b:new Ej(t,r.u_pattern_tl_b),u_pattern_br_b:new Ej(t,r.u_pattern_br_b),u_texsize:new Ej(t,r.u_texsize),u_mix:new EB(t,r.u_mix),u_pattern_size_a:new Ej(t,r.u_pattern_size_a),u_pattern_size_b:new Ej(t,r.u_pattern_size_b),u_scale_a:new EB(t,r.u_scale_a),u_scale_b:new EB(t,r.u_scale_b),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new EB(t,r.u_tile_units_to_pixels)}),RV=(t,r)=>({u_opacity:t,u_color:r}),RU=(t,r,i,n,a)=>xn(function(t,r,i,n){let a=i.patternAtlas.getPattern(t.from.toString()),o=i.patternAtlas.getPattern(t.to.toString()),{width:s,height:l}=i.patternAtlas.getPixelSize(),u=2**n.tileID.overscaledZ,c=n.tileSize*2**i.transform.tileZoom/u,h=c*(n.tileID.canonical.x+n.tileID.wrap*u),d=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,l],u_mix:r.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/vK(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(i,a,r,n),{u_opacity:t}),Rq=(t,r)=>({u_sun_pos:new EN(t,r.u_sun_pos),u_atmosphere_blend:new EB(t,r.u_atmosphere_blend),u_globe_position:new EN(t,r.u_globe_position),u_globe_radius:new EB(t,r.u_globe_radius),u_inv_proj_matrix:new E$(t,r.u_inv_proj_matrix)}),RG=(t,r,i,n,a)=>({u_sun_pos:t,u_atmosphere_blend:r,u_globe_position:i,u_globe_radius:n,u_inv_proj_matrix:a}),RH=(t,r)=>({u_sky_color:new EU(t,r.u_sky_color),u_horizon_color:new EU(t,r.u_horizon_color),u_horizon:new Ej(t,r.u_horizon),u_horizon_normal:new Ej(t,r.u_horizon_normal),u_sky_horizon_blend:new EB(t,r.u_sky_horizon_blend),u_sky_blend:new EB(t,r.u_sky_blend),u_inv_proj_matrix:new E$(t,r.u_inv_proj_matrix),u_globe_position:new EN(t,r.u_globe_position),u_globe_radius:new EB(t,r.u_globe_radius)}),R$=(t,r,i)=>{let n=Math.cos(r.rollInRadians),a=Math.sin(r.rollInRadians),o=Ts(r),s=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(r.width/2-o*a)*i,(r.height/2+o*n)*i],u_horizon_normal:[-a,n],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*r.height/2*i,u_sky_blend:s,u_inv_proj_matrix:r.inverseProjectionMatrix,u_globe_position:PM(r),u_globe_radius:PA(r.worldSize,r.center.lat)}},RY={fillExtrusion:O4,fillExtrusionPattern:O6,fill:O9,fillPattern:Re,fillOutline:Rt,fillOutlinePattern:Rr,circle:Rs,collisionBox:RW=(t,r)=>({}),collisionCircle:RW,debug:Ru,depth:RW,clippingMask:RW,heatmap:Rh,heatmapTexture:Rd,hillshade:Rm,hillshadePrepare:Rg,colorRelief:Rx,line:R_,lineGradient:Rw,linePattern:RT,lineSDF:RA,lineGradientSDF:RM,layerOpacity:RI,raster:FI,symbolIcon:RP,symbolSDF:Rz,symbolTextAndIcon:RF,background:Rj,backgroundPattern:RN,terrain:OW,terrainDepth:OY,atmosphere:Rq,sky:RH},RZ=class{constructor(t,r,i){this.context=t;let n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let r=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},RX={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},RK=class{constructor(t,r,i,n){this.length=r.length,this.attributes=i,this.itemSize=r.bytesPerElement,this.dynamicDraw=n,this.context=t;let a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,r){for(let i of this.attributes){let n=r.attributes[i.name];void 0!==n&&t.enableVertexAttribArray(n.location)}}setVertexAttribPointers(t,r,i){for(let n of this.attributes){let a=r.attributes[n.name];if(void 0!==a){let r=n.offset+this.itemSize*(i||0);a.isInteger?t.vertexAttribIPointer(a.location,n.components,t[RX[n.type]],this.itemSize,r):t.vertexAttribPointer(a.location,n.components,t[RX[n.type]],!1,this.itemSize,r)}}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},RJ=class{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}},RQ=class extends RJ{getDefault(){return kt.transparent}set(t){let r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},R0=class extends RJ{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}},R1=class extends RJ{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}},R2=class extends RJ{getDefault(){return[!0,!0,!0,!0]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},R3=class extends RJ{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}},R5=class extends RJ{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}},R4=class extends RJ{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let r=this.current;(t.func!==r.func||t.ref!==r.ref||t.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}},R6=class extends RJ{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}},R8=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=t,this.dirty=!1}},R7=class extends RJ{getDefault(){return[0,1]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}},R9=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=t,this.dirty=!1}},Be=class extends RJ{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}},Bt=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.BLEND):r.disable(r.BLEND),this.current=t,this.dirty=!1}},Br=class extends RJ{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}},Bi=class extends RJ{getDefault(){return kt.transparent}set(t){let r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},Bn=class extends RJ{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}},Ba=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=t,this.dirty=!1}},Bo=class extends RJ{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}},Bs=class extends RJ{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}},Bl=class extends RJ{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}},Bu=class extends RJ{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}},Bc=class extends RJ{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},Bh=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},Bd=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},Bf=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,t),this.current=t,this.dirty=!1}},Bp=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},Bm=class extends RJ{getDefault(){return null}set(t){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},Bg=class extends RJ{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}},By=class extends RJ{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},Bv=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},Bx=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},Bb=class extends RJ{constructor(t,r){super(t),this.context=t,this.parent=r}getDefault(){return null}},B_=class extends Bb{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},Bw=class extends Bb{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},BT=class extends Bb{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},BA=class{constructor(t,r,i,n,a){this.context=t,this.width=r,this.height=i;let o=t.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new B_(t,s),n)this.depthAttachment=a?new BT(t,s):new Bw(t,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let t=this.context.gl,r=this.colorAttachment.get();if(r&&t.deleteTexture(r),this.depthAttachment){let r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)}},Bk=(BM=PB([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}])).offsets,(BS=class{constructor(t,r,i){this.blendFunction=t,this.blendColor=r,this.mask=i}}).Replace=[1,0],BS.disabled=new BS(BS.Replace,kt.transparent,[!1,!1,!1,!1]),BS.unblended=new BS(BS.Replace,kt.transparent,[!0,!0,!0,!0]),BS.alphaBlended=new BS([1,771],kt.transparent,[!0,!0,!0,!0]),BE=class{constructor(t){this.gl=t,this.clearColor=new RQ(this),this.clearDepth=new R0(this),this.clearStencil=new R1(this),this.colorMask=new R2(this),this.depthMask=new R3(this),this.stencilMask=new R5(this),this.stencilFunc=new R4(this),this.stencilOp=new R6(this),this.stencilTest=new R8(this),this.depthRange=new R7(this),this.depthTest=new R9(this),this.depthFunc=new Be(this),this.blend=new Bt(this),this.blendFunc=new Br(this),this.blendColor=new Bi(this),this.blendEquation=new Bn(this),this.cullFace=new Ba(this),this.cullFaceSide=new Bo(this),this.frontFace=new Bs(this),this.program=new Bl(this),this.activeTexture=new Bu(this),this.viewport=new Bc(this),this.bindFramebuffer=new Bh(this),this.bindRenderbuffer=new Bd(this),this.bindTexture=new Bf(this),this.bindVertexBuffer=new Bp(this),this.bindElementBuffer=new Bm(this),this.bindVertexArray=new Bg(this),this.pixelStoreUnpack=new By(this),this.pixelStoreUnpackPremultiplyAlpha=new Bv(this),this.pixelStoreUnpackFlipY=new Bx(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(t){return new OQ(t,OK.ProjectionUBO,O0)}(this),this.terrainUniformBuffer=function(t){return new OQ(t,OK.TerrainUBO,O2)}(this),this.frameUniformBuffer=function(t){return new OQ(t,OK.FrameUBO,BM)}(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(t,r){return new RZ(this,t,r)}createVertexBuffer(t,r,i){return new RK(this,t,r,i)}createRenderbuffer(t,r,i){let n=this.gl,a=n.createRenderbuffer();return this.bindRenderbuffer.set(a),n.renderbufferStorage(n.RENDERBUFFER,t,r,i),this.bindRenderbuffer.set(null),a}createFramebuffer(t,r,i,n){return new BA(this,t,r,i,n)}clear({color:t,depth:r,stencil:i}){let n=this.gl,a=0;t&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==i&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(a)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){xh(t.blendFunction,BS.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}},(BD=class{constructor(t,r,i){this.func=t,this.mask=r,this.range=i}}).ReadOnly=!1,BD.ReadWrite=!0,BD.disabled=new BD(519,BD.ReadOnly,[0,1]),(BC=class{constructor(t,r,i,n,a,o){this.test=t,this.ref=r,this.mask=i,this.fail=n,this.depthFail=a,this.pass=o}}).disabled=new BC({func:519,mask:0},0,0,7680,7680,7680),(BI=class{constructor(t,r,i){this.enable=t,this.mode=r,this.frontFace=i}}).disabled=new BI(!1,1029,2305),BI.backCCW=new BI(!0,1029,2305),BI.frontCCW=new BI(!0,1028,2305),BP=vm(new Float32Array(16)),Bz=0,BF=[new vu(0,0),new vu(Mf,0),new vu(Mf,Mf),new vu(0,Mf)],BO=new kt(1,0,0,1),BR=new kt(0,1,0,1),BB=new kt(0,0,1,1),Bj=new kt(1,0,1,1),BN=new kt(0,1,1,1),BV={symbol:PG,circle:PW,heatmap:PY,line:P0,fill:P3,fillExtrusion:P8,hillshade:P9,colorRelief:zt,raster:zi,background:za,sky:zp,atmosphere:zm,custom:zh,debug:zc,debugPadding:zo,terrainDepth:zd},(BU=class{constructor(t,r){this.drawFunctions=BV,this.context=new BE(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:vm(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=FJ.maxOverzooming+FJ.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new Op}resize(t,r,i){if(this.width=Math.floor(t*i),this.height=Math.floor(r*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,r=new Es;r.emplaceBack(0,0),r.emplaceBack(Mf,0),r.emplaceBack(0,Mf),r.emplaceBack(Mf,Mf),this.tileExtentBuffer=t.createVertexBuffer(r,Fz.members),this.tileExtentSegments=ED.simpleSegment(0,0,4,2);let i=new Es;i.emplaceBack(0,0),i.emplaceBack(Mf,0),i.emplaceBack(0,Mf),i.emplaceBack(Mf,Mf),this.debugBuffer=t.createVertexBuffer(i,Fz.members),this.debugSegments=ED.simpleSegment(0,0,4,5);let n=new Eu;n.emplaceBack(0,0,0,0),n.emplaceBack(Mf,0,Mf,0),n.emplaceBack(0,Mf,0,Mf),n.emplaceBack(Mf,Mf,Mf,Mf),this.rasterBoundsBuffer=t.createVertexBuffer(n,OH.members),this.rasterBoundsSegments=ED.simpleSegment(0,0,4,2);let a=new Es;a.emplaceBack(0,0),a.emplaceBack(Mf,0),a.emplaceBack(0,Mf),a.emplaceBack(Mf,Mf),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(a,Fz.members),this.rasterBoundsSegmentsPosOnly=ED.simpleSegment(0,0,4,5);let o=new Es;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,Fz.members),this.viewportSegments=ED.simpleSegment(0,0,4,2);let s=new Ek;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);let l=new EA;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new BC({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new FP(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=vf();Ms(i,0,this.width,this.height,0,0,1),vx(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,BD.disabled,this.stencilClearMode,BS.disabled,BI.disabled,null,null,{mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!r?.length)return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let n=this.context;n.setColorMode(BS.disabled),n.setDepthMode(BD.disabled);let a={};for(let t of r)a[t.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,r,i,!0),this._renderTileMasks(a,r,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(t,r,i,n){let a=this.context,o=a.gl,s=this.style.projection,l=this.transform,u=this.useProgram("clippingMask");for(let c of r){let r=t[c.key],h=this.getTerrainDataForTile(c,i),d=s.getMeshFromTileID(this.context,c.canonical,n,!0,"stencil"),f=l.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!i,applyTerrainMatrix:!0});u.draw(a,o.TRIANGLES,BD.disabled,new BC({func:o.ALWAYS,mask:0},r,255,o.KEEP,o.KEEP,o.REPLACE),BS.disabled,i?BI.disabled:BI.backCCW,null,h,f,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(t,r){var i,n;return r&&(null==(i=this.style.projection)?void 0:i.name)==="mercator"?null:(null==(n=this.style.map.terrain)?void 0:n.getTerrainData(t))||null}_renderTilesDepthBuffer(){var t;let r=this.context,i=r.gl,n=this.style.projection,a=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D();for(let l of L$(a,{tileSize:a.tileSize})){let u=null==(t=this.style.map.terrain)?void 0:t.getTerrainData(l),c=n.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),h=a.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(r,i.TRIANGLES,s,BC.disabled,BS.disabled,BI.backCCW,null,u,h,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new BC({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new BC({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let r=this.context.gl,i=t.sort((t,r)=>r.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let t={};for(let i=0;ir.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(this.clearStencil(),a>1){let t={},o={};for(let i=0;i0});this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Lu()),function(t,r){let i=t.pending,{transform:n}=r,a=r.context.gl;i[Bk.u_units_to_pixels]=1/n.pixelsToGLUnits[0],i[Bk.u_units_to_pixels+1]=1/n.pixelsToGLUnits[1],i[Bk.u_world_size]=a.drawingBufferWidth,i[Bk.u_world_size+1]=a.drawingBufferHeight,i[Bk.u_camera_to_center_distance]=n.cameraToCenterDistance,i[Bk.u_symbol_fade_change]=r.options.fadeDuration?r.symbolFadeChange:1,i[Bk.u_aspect_ratio]=n.width/n.height,i[Bk.u_device_pixel_ratio]=r.pixelRatio,i[Bk.u_viewport_size]=n.width,i[Bk.u_viewport_size+1]=n.height,i[Bk.u_pixel_extrude_scale]=1/n.width,i[Bk.u_pixel_extrude_scale+1]=1/n.height,i[Bk.u_pitch]=n.pitch/360*2*Math.PI,t.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let c=this.style._order,h=this.style.tileManagers,d={},f={},p={};for(let t in h){let r=h[t];r.used&&r.prepare(this.context),d[t]=r.getVisibleCoordinates(!1),f[t]=d[t].slice().reverse(),p[t]=r.getVisibleCoordinates(!0).reverse()}u.opaquePassCutoff=1/0;for(let t=0;t=0;u.currentLayer--){let t=this.style._layers[c[u.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let r=h[t.source],i=d[t.source];this.renderTileClippingMasks(t,i,!1),this.renderLayer(this,r,t,i,u)}u.currentPass="translucent";let m=!1;for(u.currentLayer=0;u.currentLayeri.source&&!i.isHidden(r)?[t.tileManagers[i.source]]:[]),a=n.filter(t=>"vector"===t.getSource().type),o=n.filter(t=>"vector"!==t.getSource().type),s=t=>{(!i||i.getSource().maxzoom0?r.pop():null}acquireRTT(t){let r=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(i.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=t),i;let n=new Dp(this.context,{width:t,height:t,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return n.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:n,size:t}}bindRTT(t){let r=this.context.gl,i=t.size;if(!this._rttSharedFbo){let t=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);t.depthAttachment.set(n),this._rttSharedFbo={fbo:t,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let r=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!r||!i}useProgram(t,r,i=!1,n=[]){var a;this.cache||(this.cache={});let o=!!this.style.map.terrain,s=this.style.projection,l=i?Ox.projectionMercator:s.shaderPreludeCode,u=i?"#define PROJECTION_MERCATOR":s.shaderDefine,c=`/${i?"mercator":s.shaderVariantName}`,h=t+(r?r.cacheKey:"")+c+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"")+(n?`/${n.join("/")}`:"");return(a=this.cache)[h]||(a[h]=new O5(this.context,Ox[t],r,RY[t],this._showOverdrawInspector,o,l,u,n)),this.cache[h]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new Dp(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){var t,r,i;if(this._tileTextures){for(let t in this._tileTextures){let r=this._tileTextures[t];if(r)for(let t of r)t.destroy()}this._tileTextures={}}for(let t of this._rttObjectRecyclePool)t.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(null==(t=this.layerOpacityFbo)||t.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null==(r=this.tileExtentMesh.vertexBuffer)||r.destroy()),this.tileExtentMesh&&(null==(i=this.tileExtentMesh.indexBuffer)||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let t in this.cache){let r=this.cache[t];r?.program&&this.context.gl.deleteProgram(r.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}}).MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,Bq=BU,BG=class extends Error{constructor(t,r){var i;super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=t,this.statusMessage=null!=(i=r?.statusMessage)?i:null}},BH=class{constructor(t){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{var t;let r=this._getHashParams();return this._hashName?(r.get(this._hashName)||"").split("/"):(null!=(t=[...r.keys()][0])?t:"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let r=Array.from(t.keys());r.length>0&&t.delete(r[0])}let r=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=r?`#${r}`:"",n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=zg(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let r=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(r.lng*n)/n,o=Math.round(r.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(u+=t?`/${a}/${o}/${i}`:`${i}/${o}/${a}`,(s||l)&&(u+=`/${Math.round(10*s)/10}`),l&&(u+=`/${Math.round(l)}`),this._hashName){let t=this._getHashParams();return t.set(this._hashName,u),`#${decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${u}`}_isValidHash(t){if(t.length<3||t.some(t=>isNaN(+t)))return!1;try{new DQ(+t[2],+t[1])}catch{return!1}let r=+t[0],i=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}},BW=xn({deceleration:2500,maxSpeed:1400},B$={linearity:.3,easing:xt(0,0,.3,1)}),BY=xn({deceleration:20,maxSpeed:1400},B$),BZ=xn({deceleration:1e3,maxSpeed:360},B$),BX=xn({deceleration:1e3,maxSpeed:90},B$),BK=xn({deceleration:1e3,maxSpeed:360},B$),BJ=class{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Lu(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,r=Lu();for(;t.length>0&&r-t[0].time>160;)t.shift()}_getVelocityEntries(){let t=this._inertiaBuffer,r=Lu()-60,i=Math.max(0,t.length-2);for(;i>0&&t[i-1].time>=r;)i--;return t.slice(i)}_onMoveEnd(t){this._drainInertiaBuffer();let r=this._getVelocityEntries();if(r.length<2)return void this.clear();let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new vu(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of r)t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);for(let{settings:t}of r.slice(1))i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta);if(!i.pan.mag()&&!i.zoom&&!i.bearing&&!i.pitch&&!i.roll)return void this.clear();let n=Lu()-r[0].time,a={};if(i.pan.mag()){let r=zv(i.pan.mag(),n,xn({},BW,t||{})),o=i.pan.mult(r.amount/i.pan.mag()),s=this._map._camera.cameraHelper.handlePanInertia(o,this._map._camera.transform);a.center=s.easingCenter,a.offset=s.easingOffset,zy(a,r)}if(i.zoom){let t=zv(i.zoom,n,BY);a.zoom=xl(this._map.getZoom()+t.amount,this._map.getZoomSnap(),t.amount),zy(a,t)}if(i.bearing){let t=zv(i.bearing,n,BZ);a.bearing=this._map.getBearing()+xr(t.amount,-179,179),zy(a,t)}if(i.pitch){let t=zv(i.pitch,n,BX);a.pitch=this._map.getPitch()+t.amount,zy(a,t)}if(i.roll){let t=zv(i.roll,n,BK);a.roll=this._map.getRoll()+xr(t.amount,-179,179),zy(a,t)}if(a.zoom||a.bearing){let t=void 0===i.pinchAround?i.around:i.pinchAround;a.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),xn(a,{noMoveStart:!0})}},BQ=class{constructor(t,r){this._map=t,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new z4(this._map,t))}mousedown(t,r){return this._mousedownPos=r,this._firePreventable(new z3(t.type,this._map,t))}mouseup(t){this._map.fire(new z3(t.type,this._map,t))}click(t,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new z3(t.type,this._map,t))}dblclick(t){return this._firePreventable(new z3(t.type,this._map,t))}mouseover(t){this._map.fire(new z3(t.type,this._map,t))}mouseout(t){this._map.fire(new z3(t.type,this._map,t))}touchstart(t){return this._firePreventable(new z5(t.type,this._map,t))}touchmove(t){this._map.fire(new z5(t.type,this._map,t))}touchend(t){this._map.fire(new z5(t.type,this._map,t))}touchcancel(t){this._map.fire(new z5(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},B0=class{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new z3(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new z3("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new z3(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},B1=class{constructor(t,r,i){this._map=t,this._tr=i,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=r.clickTolerance||1,r.boxZoom&&"object"==typeof r.boxZoom&&(this._boxZoomEnd=r.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,r){this.isEnabled()&&t.shiftKey&&0===t.button&&(zZ.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(t,r){if(!this._active||this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)t.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),zZ.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new z6(t,{originalEvent:r}))}},B2=class{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){let r=new vu(0,0);for(let i of t)r._add(i);return r.div(t.length)}(r),this.touches=zx(i,r)))}touchmove(t,r,i){if(this.aborted||!this.centroid)return;let n=zx(i,r);for(let t in this.touches){let r=this.touches[t],i=n[t];(!i||i.dist(r)>30)&&(this.aborted=!0)}}touchend(t,r,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}},B3=class{constructor(t){this.singleTap=new B2(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,r,i){this.singleTap.touchstart(t,r,i)}touchmove(t,r,i){this.singleTap.touchmove(t,r,i)}touchend(t,r,i){let n=this.singleTap.touchend(t,r,i);if(n){let r=t.timeStamp-this.lastTime<500,i=!this.lastTap||30>this.lastTap.dist(n);if(r&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}},B5=class{constructor(t,r){this._tr=r,this._zoomIn=new B3({numTouches:1,numTaps:2}),this._zoomOut=new B3({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,r,i){this._zoomIn.touchstart(t,r,i),this._zoomOut.touchstart(t,r,i)}touchmove(t,r,i){this._zoomIn.touchmove(t,r,i),this._zoomOut.touchmove(t,r,i)}touchend(t,r,i){let n=this._zoomIn.touchend(t,r,i),a=this._zoomOut.touchend(t,r,i),o=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:xl(o.zoom+1,r.getZoomSnap()),around:o.unproject(n)},{originalEvent:t})}):a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:xl(o.zoom-1,r.getZoomSnap()),around:o.unproject(a)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},B4=class{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let r=this._moveFunction(...t);if(r.bearingDelta||r.pitchDelta||r.rollDelta||r.around||r.panDelta)return this._active=!0,r}dragStart(t,r){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(r)?r[0]:r,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,r){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let n=Array.isArray(r)?r[0]:r;if(!(!this._moved&&n.dist(i)!0}),r=new B7){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=r}_executeRelevantHandler(t,r,i){return t instanceof MouseEvent?r(t):"u">typeof TouchEvent&&t instanceof TouchEvent?i(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}},je=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}},jt=class{constructor(t,r){this._clickTolerance=t.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new vu(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,r,i){return this._calculateTransform(t,r,i)}touchmove(t,r,i){if(this._active)return this._shouldBePrevented(i.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t):(t.preventDefault(),this._calculateTransform(t,r,i))}touchend(t,r,i){this._calculateTransform(t,r,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);let n=zx(i,r),a=new vu(0,0),o=new vu(0,0),s=0;for(let t in n){let r=n[t],i=this._touches[t];i&&(a._add(r),o._add(r.sub(i)),s++,n[t]=r)}if(this._touches=n,this._shouldBePrevented(s)||!o.mag())return;let l=o.div(s);if(this._sum._add(l),!(this._sum.mag()=2,a=r.mag()>=2;if(!n&&!a)return;if(!n||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let o=t.y>0==r.y>0;return zT(t)&&zT(r)&&o}},jo={panStep:100,bearingStep:15,pitchStep:10},js=class{constructor(t,r){this._tr=r,this._panStep=jo.panStep,this._bearingStep=jo.bearingStep,this._pitchStep=jo.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,i=0,n=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:zA,zoom:r?xl(l.zoom+r*(t.shiftKey?2:1),s.getZoomSnap()):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:l.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}},jl=class{constructor(t,r,i){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=i,this._triggerRenderFrame=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,i=Lu(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),t.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=t,this._delta-=r,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=zZ.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(DQ.convert(i.center)):r,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let r=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=r),"number"==typeof this._targetZoom&&(this._targetZoom+=r)}if(0!==this._delta){let r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);let n="number"==typeof this._targetZoom?xo(this._targetZoom):t.scale,a=t.applyConstrain(t.getCameraLngLat(),xs(n*i)).zoom,o=this._map.getZoomSnap();if("wheel"===this._type&&o>0){let r=xl(t.zoom,o);this._targetZoom=xl(a,o,a-r)}else this._targetZoom=a;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r="number"==typeof this._targetZoom?this._targetZoom:t.zoom,i=this._startZoom,n=this._easing,a=!1,o;if("wheel"===this._type&&i&&n){let t=Math.min((Lu()-this._lastWheelEventTime+5)/200,1),s=n(t);o=kx.number(i,r,s),t<1?this._needsRerender=!0:a=!0}else o=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=Mp;if(this._prevEase){let t=this._prevEase,i=(Lu()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-a*a);r=xt(a,o,.25,1)}return this._prevEase={start:Lu(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},ju=class{constructor(t,r){this._clickZoom=t,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},jc=class{constructor(t,r){this._tr=r,this.reset()}reset(){this._active=!1}dblclick(t,r){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:xl(this._tr.zoom+(t.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},jh=class{constructor(){this._tap=new B3({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,r,i){if(!this._swipePoint)if(this._tapTime){let n=r[0],a=t.timeStamp-this._tapTime<500,o=30>this._tapPoint.dist(n);a&&o?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,r,i)}touchmove(t,r,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=r[0],a=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}else this._tap.touchmove(t,r,i)}touchend(t,r,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let n=this._tap.touchend(t,r,i);n&&(this._tapTime=t.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},jd=class{constructor(t,r,i){this._el=t,this._mousePan=r,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},jf=class{constructor(t,r,i,n){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=r,this._mousePitch=i,this._mouseRoll=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},jp=class{constructor(t,r,i,n){this._el=t,this._touchZoom=r,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},jm=class{constructor(t,r){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=r,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=zZ.create("div","maplibregl-cooperative-gesture-screen",t);let r=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(r=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=r,this._container.appendChild(n);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new zJ("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},jg=class{constructor(t){this._camera=t}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(vu.convert(t),this._camera.terrain)}},jy=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate,jv=class extends MI{},jx=class{get _ownerDocument(){var t;return(null==(t=this._el)?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,r;return(null==(r=null==(t=this._el)?void 0:t.ownerDocument)?void 0:r.defaultView)||window}constructor(t,r,i){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},a={},o={};for(let{handlerName:l,handler:u,allowed:c}of this._handlers){let h;if(u.isEnabled()){if(this._blockedByActive(o,c,l))u.reset();else if(u[r||t.type]){if(function(t,r){var i,n;if(!Mw[r])return!1;let a=(null==(n=null==(i=t?.target)?void 0:i.ownerDocument)?void 0:n.defaultView)||window;return t instanceof a.MouseEvent||t instanceof a.WheelEvent}(t,r||t.type)){let i=zZ.mousePos(this._map.getCanvas(),t);h=u[r||t.type](t,i)}else{var s;if(M_[r||t.type]&&"touches"in t){let i=t.touches,n=this._getMapTouches(i),a=zZ.touchPos(this._map.getCanvas(),n);h=u[r||t.type](t,a,n)}else M_[s=r||t.type]||Mw[s]||(h=u[r||t.type](t))}this.mergeHandlerResult(n,a,h,l,i),h?.needsRenderFrame&&this._triggerRenderFrame()}(h||u.isActive())&&(o[l]=u)}}let l={};for(let t in this._previousActiveHandlers)o[t]||(l[t]=i);this._previousActiveHandlers=o,(Object.keys(l).length||zM(n))&&(this._changes.push([n,a,l]),this._triggerRenderFrame()),(Object.keys(o).length||zM(n))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._camera=r,this._transformProvider=new jg(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new BJ(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let n=this._el;for(let[t,r,i]of(this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]],this._listeners))t.addEventListener(r,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[t,r,i]of this._listeners)t.removeEventListener(r,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){let r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new BQ(r,t));let n=r.boxZoom=new B1(r,t,this._transformProvider);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();let a=r.cooperativeGestures=new jm(r,t.cooperativeGestures);this._add("cooperativeGestures",a),t.cooperativeGestures&&a.enable();let o=new B5(r,this._transformProvider),s=new jc(r,this._transformProvider);r.doubleClickZoom=new ju(s,o),this._add("tapZoom",o),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();let l=new jh;this._add("tapDragZoom",l);let u=r.touchPitch=new ja(r);this._add("touchPitch",u),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);let c=()=>r.project(r.getCenter()),h=function({enable:t,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateSpeed:a=.8},o){return new B4({clickTolerance:r,move:(t,r)=>{let s=o();if(i&&Math.abs(s.y-t.y)>n)return{bearingDelta:x_(new vu(t.x,r.y),r,s)};let l=(r.x-t.x)*a;return i&&r.y0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:je})}(t,c),d=function({enable:t,clickTolerance:r,pitchSpeed:i=-.5}){return new B4({clickTolerance:r,move:(t,r)=>({pitchDelta:(r.y-t.y)*i}),moveStateManager:new B8({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:je})}(t),f=function({enable:t,clickTolerance:r,rollDegreesPerPixelMoved:i=.3},n){return new B4({clickTolerance:r,move:(t,r)=>{let a=n(),o=(r.x-t.x)*i;return r.y2===t.button&&t.ctrlKey}),enable:t,assignEvents:je})}(t,c);r.dragRotate=new jf(t,h,d,f),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();let p=function({enable:t,clickTolerance:r}){return new B4({clickTolerance:r,move:(t,r)=>({around:r,panDelta:r.sub(t)}),activateOnStart:!0,moveStateManager:new B8({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:je})}(t),m=new jt(t,r);r.dragPan=new jd(i,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);let g=new jn,y=new ji;r.touchZoomRotate=new jp(i,y,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new B0(r));let v=r.scrollZoom=new jl(r,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);let x=r.keyboard=new js(r,this._transformProvider);this._add("keyboard",x),t.interactive&&t.keyboard&&r.keyboard.enable()}_add(t,r,i){this._handlers.push({handlerName:t,handler:r,allowed:i}),this._handlersById[t]=r}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!jy(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,r,i){for(let n in t)if(n!==i&&!r?.includes(n))return!0;return!1}_getMapTouches(t){let r=[];for(let i of t){let t=i.target;this._el.contains(t)&&r.push(i)}return r}mergeHandlerResult(t,r,i,n,a){if(!i)return;xn(t,i);let o={handlerName:n,originalEvent:i.originalEvent||a};void 0!==i.zoomDelta&&(r.zoom=o),void 0!==i.panDelta&&(r.drag=o),void 0!==i.rollDelta&&(r.roll=o),void 0!==i.pitchDelta&&(r.pitch=o),void 0!==i.bearingDelta&&(r.rotate=o)}_applyChanges(){let t={},r={},i={};for(let[n,a,o]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new vu(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),xn(r,a),xn(i,o);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,r,i){let n=this._map,a=this._camera.getTransformForUpdate(),o=n.terrain;if(!zM(t)&&!(o&&this._terrainMovement))return void this._fireEvents(r,i,!0);this._camera.stop(!0);let{panDelta:s,zoomDelta:l,bearingDelta:u,pitchDelta:c,rollDelta:h}=t,{around:d,aroundOnSurface:f}=this._resolveAround(t,o,a),p=o?this._terrainGestureElevation(o,d,f,a,r):void 0,m={panDelta:s,zoomDelta:l,rollDelta:h,pitchDelta:c,bearingDelta:u,around:d,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(d)&&(d=a.centerPoint);let g=this._computePreZoomAroundLoc(a,d,s,p);this._handleMapControls({terrain:o,tr:a,deltasForHelper:m,preZoomAroundLoc:g,combinedEventsInProgress:r,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(r,i,!0)}_resolveAround(t,r,i){let n=void 0===t.pinchAround?t.around:t.pinchAround;return n||(n=this._camera.transform.centerPoint),r&&!i.isPointOnMapSurface(n)?{around:i.centerPoint,aroundOnSurface:!1}:{around:n,aroundOnSurface:!0}}_terrainGestureElevation(t,r,i,n,a){if(!i)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let i=n.screenTerrainPointToMercatorCoordinate(r,t);this._terrainGestureAnchorElevation=i?i.z:null}if(null===this._terrainGestureAnchorElevation)return;let o=this._terrainGestureAnchorElevation;if(!(.01>r.distSqr(n.centerPoint))&&!(o-n.elevation>=.9*(n.getCameraAltitude()-n.elevation)))return o}_computePreZoomAroundLoc(t,r,i,n){if(.01>r.distSqr(t.centerPoint))return t.center;let a=i?r.sub(i):r;return void 0===n?t.screenPointToLocation(a):t.screenPointToLocationAtElevation(a,n)}_handleMapControls({terrain:t,tr:r,deltasForHelper:i,preZoomAroundLoc:n,combinedEventsInProgress:a,panDelta:o}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,r),!t)return void s.handleMapControlsPan(i,r,n);if(s.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),s.handleMapControlsPan(i,r,n);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(i,r,n);return}void 0===i.aroundElevation&&a.drag&&this._terrainMovement&&o?r.setCenter(r.screenPointToLocation(r.centerPoint.sub(o))):s.handleMapControlsPan(i,r,n)}_fireEvents(t,r,i){let n=jy(this._eventsInProgress),a=jy(t),o={};for(let r in t){let{originalEvent:i}=t[r];this._eventsInProgress[r]||(o[`${r}start`]=i),this._eventsInProgress[r]=t[r]}for(let t in!n&&a&&this._fireEvent("movestart",a.originalEvent),o)this._fireEvent(t,o[t]);for(let r in a&&this._fireEvent("move",a.originalEvent),t){let{originalEvent:i}=t[r];this._fireEvent(r,i)}let s={},l;for(let t in this._eventsInProgress){let{handlerName:i,originalEvent:n}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],l=r[i]||n,s[`${t}end`]=l)}for(let t in s)this._fireEvent(t,s[t]);let u=jy(this._eventsInProgress),c=(n||a)&&!u;if(c&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let t=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(t)}if(i&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new jv("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},jb=class extends MP{constructor(t){var r,i,n;super(),this._renderFrameCallback=()=>{let t=Math.min((Lu()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new OD,this.cameraHelper=new OC,void 0!==t.minZoom&&this.transform.setMinZoom(t.minZoom),void 0!==t.maxZoom&&this.transform.setMaxZoom(t.maxZoom),void 0!==t.minPitch&&this.transform.setMinPitch(t.minPitch),void 0!==t.maxPitch&&this.transform.setMaxPitch(t.maxPitch),void 0!==t.renderWorldCopies&&this.transform.setRenderWorldCopies(t.renderWorldCopies),null!==t.transformConstrain&&this.transform.setConstrainOverride(t.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=t.bearingSnap,this._zoomSnap=t.zoomSnap,this._requestRenderFrame=t.requestRenderFrame,this._cancelRenderFrame=t.cancelRenderFrame,this.terrain=t.terrain,this._centerClampedToGround=null==(r=t.centerClampedToGround)||r,this.transformCameraUpdate=null!=(i=t.transformCameraUpdate)?i:null,this._stopHandlers=null!=(n=t.stopHandlers)?n:()=>{},this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,r){if(t.apply(this.transform,!0),this.transform=t,this.cameraHelper=r,this._requestedCameraState){let r=t.clone();r.apply(this._requestedCameraState,!0),this._requestedCameraState=r}}getCenter(){return new DQ(this.transform.center.lng,this.transform.center.lat)}setCenter(t,r){return this.jumpTo({center:t},r)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,r){return this.jumpTo({elevation:t},r),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,i){return t=vu.convert(t).mult(-1),this.panTo(this.transform.center,xn({offset:t},r),i)}panTo(t,r,i){return this.easeTo(xn({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(t,r){return this.jumpTo({zoom:t},r),this}zoomTo(t,r,i){return this.easeTo(xn({zoom:t},r),i)}zoomIn(t,r){return this.zoomTo(xl(this.getZoom()+1,this._zoomSnap),t,r),this}zoomOut(t,r){return this.zoomTo(xl(this.getZoom()-1,this._zoomSnap),t,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new zQ("movestart",r)).fire(new zQ("move",r)).fire(new zQ("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,r){return this.jumpTo({bearing:t},r),this}getPadding(){return this.transform.padding}setPadding(t,r){return this.jumpTo({padding:t},r),this}rotateTo(t,r,i){return this.easeTo(xn({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,xn({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(xn({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,r){return Math.abs(this.getBearing()){m.easeFunc(n),this.terrain&&!t.freezeElevation&&this._updateElevation(n),this.applyUpdatedTransform(i),this._fireMoveEvents(r)},i=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,i)},t),this}_prepareEase(t,r,i={}){this._moving=!0,r||i.moving||this.fire(new zQ("movestart",t)),this._zooming&&!i.zooming&&this.fire(new zQ("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new zQ("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new zQ("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new zQ("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(t,this.transform),this.elevationFreeze=!0}_updateElevation(t){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(t<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,n=(r-(i*t+this._elevationStart))/(1-t);this._elevationStart+=t*(i-n),this._elevationTarget=r}this.transform.setElevation(kx.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let r=t.getCameraLngLat(),i=t.getCameraAltitude(),n=this.terrain?this.terrain.getElevationForLngLatZoom(r,t.zoom):0;if(ithis._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&r.push(t=>this.transformCameraUpdate(t)),!r.length)return;let i=t.clone();for(let t of r){let r=i.clone(),{center:n,zoom:a,roll:o,pitch:s,bearing:l,elevation:u}=t(r);n&&r.setCenter(n),void 0!==u&&r.setElevation(u),void 0!==a&&r.setZoom(a),void 0!==o&&r.setRoll(o),void 0!==s&&r.setPitch(s),void 0!==l&&r.setBearing(l),i.apply(r,!1)}this.transform.apply(i,!1)}_fireMoveEvents(t){this.fire(new zQ("move",t)),this._zooming&&this.fire(new zQ("zoom",t)),this._rotating&&this.fire(new zQ("rotate",t)),this._pitching&&this.fire(new zQ("pitch",t)),this._rolling&&this.fire(new zQ("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let i=this._zooming,n=this._rotating,a=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new zQ("zoomend",t)),n&&this.fire(new zQ("rotateend",t)),a&&this.fire(new zQ("pitchend",t)),o&&this.fire(new zQ("rollend",t)),this.fire(new zQ("moveend",t))}flyTo(t,r){if(!t.essential&&zH.prefersReducedMotion){let i=xa(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,r)}this.stop(),void 0!==(t=xn({offset:[0,0],speed:1.2,curve:1.42,easing:Mp},t)).zoom&&this._zoomSnap&&(t.zoom=xl(t.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=i.bearing,a=i.pitch,o=i.roll,s=i.padding,l=void 0===t.bearing?n:this._normalizeBearing(t.bearing,n),u=void 0===t.pitch?a:+t.pitch,c=void 0===t.roll?o:this._normalizeBearing(t.roll,o),h=void 0===t.padding?i.padding:t.padding,d=vu.convert(t.offset),f=i.centerPoint.add(d),p=i.screenPointToLocation(f),m=this.cameraHelper.handleFlyTo(i,{bearing:l,pitch:u,roll:c,padding:h,locationAtOffset:p,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),g=t.curve,y=Math.max(i.width,i.height),v=y/m.scaleOfZoom,x=m.pixelPathLength,b=y/m.scaleOfMinZoom,_=(g=Math.min(g,Math.sqrt(b/x*2)))*g;function w(t){let r=(v*v-y*y+(t?-1:1)*_*_*x*x)/(2*(t?v:y)*_*x);return Math.log(Math.sqrt(r*r+1)-r)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function A(t){return(Math.exp(t)+Math.exp(-t))/2}let M=w(!1),k=function(t){return A(M)/A(M+g*t)},S=function(t){var r;return y*((A(M)*(T(r=M+g*t)/A(r))-T(M))/_)/x},E=(w(!0)-M)/g;if(2e-6>Math.abs(x)||!isFinite(E)){if(1e-6>Math.abs(y-v))return this.easeTo(t,r);let i=v0,k=t=>Math.exp(i*g*t)}if(void 0!==t.duration)t.duration=+t.duration;else{let r=void 0===t.screenSpeed?+t.speed:t.screenSpeed/g;t.duration=1e3*E/r}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==l,this._pitching=u!==a,this._rolling=c!==o,this._padding=!i.isPaddingEqual(h),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let g=p*E,y=1/k(g),v=S(g);this._rotating&&i.setBearing(kx.number(n,l,p)),this._pitching&&i.setPitch(kx.number(a,u,p)),this._rolling&&i.setRoll(kx.number(o,c,p)),this._padding&&(i.interpolatePadding(s,h,p),f=i.centerPoint.add(d)),m.easeFunc(p,y,v,f),this.terrain&&!t.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(t){return this._stop(t)}_stop(t,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,r)}return t||this._stopHandlers(),this}_ease(t,r,i){!1===i.animate||0===i.duration?(t(1),r()):(this._easeStart=Lu(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){let i=Math.abs((t=xi(t,-180,180))-r);return Math.abs(t-360-r)MapLibre
'},jw=class{constructor(t=j_){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("terrain"===t.type||"style"===t.dataType||"source"===t.dataType&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=zZ.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=zZ.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=zZ.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,r){let i=this._map._getUIString(`AttributionControl.${r}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"==typeof t?t:"")):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let r=this._map.style.tileManagers;for(let i in r){let n=r[i];if(n.used||n.usedForTerrain){let r=n.getSource();r.attribution&&!t.includes(r.attribution)&&t.push(r.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,r)=>t.length-r.length);let i=(t=t.filter((r,i)=>{for(let n=i+1;n{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var r;this._map=t,this._compact=null==(r=this.options)?void 0:r.compact,this._container=zZ.create("div","maplibregl-ctrl");let i=zZ.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},jA=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let r=++this._id;return this._queue.push({callback:t,id:r,cancelled:!1}),r}remove(t){let r=this._currentlyRunning;for(let i of r?this._queue.concat(r):this._queue)if(i.id===t){i.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let r=this._currentlyRunning=this._queue;this._queue=[];let i=!1,n;for(let a of r)if(!a.cancelled){try{a.callback(t)}catch(t){i||(i=!0,n=t)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,i)throw n}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},jM=["none","zoom","sourceTiles","visibleLayers","revision"],jk=class{constructor(t,r,i,n){this._tileKeys=t.map(t=>t.key).sort().join(),this._revision=r,this._zoom=i,this._visibleLayerIds=n}difference(t){return this._revision===t?._revision?this._visibleLayerIds===t._visibleLayerIds?this._tileKeys===t._tileKeys?this._zoom===t._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}},jS={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},jE=class{constructor(t,r){this.needsFollowUpFrame=!1,this.painter=t,this.terrain=r,this.rttSize=r.tileManager.tileSize*r.qualityFactor}getTexture(t){return t.getRTT(this._stacks.length-1).texture}prepareForRender(t,r){let i=r!==this._lastPrepareZoom;this._lastPrepareZoom=r,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(i=>!t._layers[i].isHidden(r));let n=this._renderableLayerIds.join(),a=new Set;for(let r of this._renderableLayerIds){let i=t._layers[r],n=i.source;n&&jS[i.type]&&a.add(n)}for(let i of(this._coordsAscending={},this._rttFingerprints={},a)){let a=t.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let o=this._coordsAscending[i],s=a.getSource(),l=s instanceof FO?s.terrainTileRanges:null;for(let t of a.getVisibleCoordinates()){let r=this.terrain.tileManager.getTerrainCoords(t,l);for(let t in r)o[t]||(o[t]=[]),o[t].push(r[t])}this._rttFingerprints[i]={};let u=this._rttFingerprints[i],c=a.getState().revision;for(let t in o)u[t]=new jk(o[t],c,r,n)}this.needsFollowUpFrame=!1;let o=i||this.painter.options.moving,s=!1;for(let t of this._renderableTiles){let r=this._textureDifference(t);"none"!==r&&("zoom"===r&&o||"visibleLayers"===r&&i?this.needsFollowUpFrame=!0:"zoom"===r||"sourceTiles"===r?(s?this.needsFollowUpFrame=!0:t.releaseRTT(this.painter),s=!0):t.releaseRTT(this.painter))}}_textureDifference(t){let r="none";for(let i in this._rttFingerprints){let n=this._rttFingerprints[i][t.tileID.key];if(!n)continue;let a=n.difference(t.rttFingerprint[i]);jM.indexOf(a)>jM.indexOf(r)&&(r=a)}return r}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;let i=p(f({},r),{isRenderingToTexture:!0}),n=t.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(jS[n]&&(this._prevType&&jS[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(jS[this._prevType]||jS[n]&&o){this._prevType=n;let t=this._stacks.length-1,r=this._stacks[t]||[];for(let n of this._renderableTiles){if(this._rttTiles.push(n),n.getRTT(t))continue;let o=n.acquireRTT(a,t,this.rttSize);for(let t of(a.bindRTT(o),a.context.clear({color:kt.transparent,stencil:0}),a.currentStencilSource=void 0,r)){let r=a.style._layers[t],o=r.source?this._coordsAscending[r.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(r,o,!0),a.renderLayer(a,a.style.tileManagers[r.source],r,o,i),r.source&&(n.rttFingerprint[r.source]=this._rttFingerprints[r.source][n.tileID.key])}o.texture.generateMipmap()}return function(t,r,i,n){let{isRenderingGlobe:a}=n,o=t.context,s=o.gl,l=t.transform,u=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),h=t.useProgram("terrain");for(let n of(o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]),i)){let i=r.getTerrainMesh(n.tileID),d=t.renderToTexture.getTexture(n),f=r.getTerrainData(n.tileID);o.activeTexture.set(s.TEXTURE0),d.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let p=OZ(r.getSkirtLength(l.zoom),l.calculateFogMatrix(n.tileID.toUnwrapped()),t.style.sky,l.pitch,a),m=l.getProjectionData({overscaledTileID:n.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(o,s.TRIANGLES,c,BC.disabled,u,BI.backCCW,p,f,m,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],jS[n]}return!1}},jD={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},jC={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:j_,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:MA.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20},jI=class extends MP{get _ownerWindow(){var t,r;return(null==(r=null==(t=this._container)?void 0:t.ownerDocument)?void 0:r.defaultView)||window}constructor(t){var r,i,n;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new jA,this._controls=[],this._mapId=Mm++,this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style)return void this.fire(new z9("webglcontextlost",{originalEvent:t}));for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[r]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${r}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new z9("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style)for(let t in this.style.imageManager.images=this._lostContextStyle.images,this._lostContextStyle.images){let r=this._lostContextStyle.images[t];r.isWebGLImage&&this.style.imageManager.updateImage(t,r,!1)}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(t){this.fire(new ML(t));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new z9("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let a=p(f(f({},jC),t),{canvasContextAttributes:f(f({},jC.canvasContextAttributes),t.canvasContextAttributes)});if(null!=a.minZoom&&null!=a.maxZoom&&a.minZoom>a.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=a.minPitch&&null!=a.maxPitch&&a.minPitch>a.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=a.minPitch&&a.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=a.maxPitch&&a.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new jb({minZoom:a.minZoom,maxZoom:a.maxZoom,minPitch:a.minPitch,maxPitch:a.maxPitch,bearingSnap:a.bearingSnap,zoomSnap:a.zoomSnap,renderWorldCopies:a.renderWorldCopies,centerClampedToGround:a.centerClampedToGround,terrain:this.terrain,transformConstrain:a.transformConstrain,requestRenderFrame:t=>this._requestRenderFrame(t),cancelRenderFrame:t=>this._cancelRenderFrame(t),transformCameraUpdate:a.transformCameraUpdate,stopHandlers:()=>{var t;return null==(t=this._handlers)?void 0:t.stop(!1)}}),this._camera.setEventedParent(this),this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=f({},a.canvasContextAttributes),this._trackResize=!0===a.trackResize,this._terrainSkirtLength=a.terrainSkirtLength,this._refreshExpiredTiles=!0===a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=!0===a.crossSourceCollisions,this._collectResourceTiming=!0===a.collectResourceTiming,this._locale=f(f({},jD),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===a.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(a.anisotropicFilterPitch),void 0!==a.reduceMotion&&(zH.prefersReducedMotion=a.reduceMotion),this._requestManager=new zK(a.transformRequest),this._container=this._resolveContainer(a.container),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer();try{this._setupPainter()}catch(t){throw this._cleanupContainer(),t}this._imageQueueHandle=zX.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new jx(this,this._camera,a),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let o="string"==typeof a.hash&&a.hash||void 0;this._hash=a.hash?new BH(o).addTo(this):void 0,null!=(r=this._hash)&&r._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,xn({},a.fitBoundsOptions,{duration:0}))));let s="string"==typeof a.style||(null==(n=null==(i=a.style)?void 0:i.projection)?void 0:n.type)!=="globe";this.resize(null,s),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new jw("boolean"==typeof a.attributionControl?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new jT,a.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this._camera.transform.unmodified){let t=xa(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire("style"===t.dataType?new z1("styledata",t):new z2("sourcedata",t))}),this.on("dataloading",t=>{this.fire("style"===t.dataType?new z1("styledataloading",t):new z2("sourcedataloading",t))}),this.on("dataabort",t=>{this.fire(new z2("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,r){return this.style.setGlobalStateProperty(t,r),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t?.onAdd)return this.fire(new ML(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let n=this._controlPositions[r];return r.includes("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t?.onRemove)return this.fire(new ML(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return L$(this._camera.transform,t)}setTransformCameraUpdate(t){this._camera.transformCameraUpdate=t}getCenter(){return new DQ(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(t,r){return this._camera.setCenter(t,r),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(t,r){return this._camera.setCenterElevation(t,r),this}setCenterClampedToGround(t){this._camera.setCenterClampedToGround(t)}panBy(t,r,i){return this._camera.panBy(t,r,i),this}panTo(t,r,i){return this._camera.panTo(t,r,i),this}getZoom(){return this._camera.transform.zoom}setZoom(t,r){return this._camera.setZoom(t,r),this}zoomTo(t,r,i){return this._camera.zoomTo(t,r,i),this}zoomIn(t,r){return this._camera.zoomIn(t,r),this}zoomOut(t,r){return this._camera.zoomOut(t,r),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(t,r){return this._camera.setVerticalFieldOfView(t,r),this}getBearing(){return this._camera.transform.bearing}setBearing(t,r){return this._camera.setBearing(t,r),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(t){return this._camera.setZoomSnap(t),this}getPadding(){return this._camera.transform.padding}setPadding(t,r){return this._camera.setPadding(t,r),this}rotateTo(t,r,i){return this._camera.rotateTo(t,r,i),this}resetNorth(t,r){return this._camera.resetNorth(t,r),this}resetNorthPitch(t,r){return this._camera.resetNorthPitch(t,r),this}snapToNorth(t,r){return this._camera.snapToNorth(t,r),this}getPitch(){return this._camera.transform.pitch}setPitch(t,r){return this._camera.setPitch(t,r),this}getRoll(){return this._camera.transform.roll}setRoll(t,r){return this._camera.setRoll(t,r),this}cameraForBounds(t,r){return this._camera.cameraForBounds(t,r)}fitBounds(t,r,i){return this._camera.fitBounds(t,r,i),this}fitScreenCoordinates(t,r,i,n,a){return this._camera.fitScreenCoordinates(t,r,i,n,a),this}jumpTo(t,r){return this._camera.jumpTo(t,r),this}calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a)}easeTo(t,r){return this._camera.easeTo(t,r),this}flyTo(t,r){return this._camera.flyTo(t,r),this}stop(){return this._camera.stop(),this}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(DQ.convert(t),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(t,r,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(t,r,i,n??0)}resize(t,r=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(r);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new zQ("movestart",t)).fire(new zQ("move",t))),this.fire(new zJ("resize",t)),i&&this.fire(new zQ("moveend",t)),this}_resizeInternal(t=!0){let[r,i]=this._containerDimensions(),n=this._getClampedPixelRatio(r,i);if(this._resizeCanvas(r,i,n),this.painter.resize(r,i,n),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let n=this._getClampedPixelRatio(r,i);this._resizeCanvas(r,i,n),this.painter.resize(r,i,n)}this._resizeTransform(t)}_resizeTransform(t=!0){var r;let[i,n]=this._containerDimensions();this._camera.transform.resize(i,n,t),null==(r=this._camera._requestedCameraState)||r.resize(i,n,t)}_getClampedPixelRatio(t,r){let{0:i,1:n}=this._maxCanvasSize,a=this.getPixelRatio(),o=t*a,s=r*a,l=Math.min(o>i?i/o:1,s>n?n/s:1);return l<1&&xf("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),l*a}getPixelRatio(){var t;return null!=(t=this._overridePixelRatio)?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(t){return this._camera.transform.setMaxBounds(FA.convert(t)),this._update()}setMinZoom(t){if(t??(t=-2),t>=-2&&t<=this._camera.transform.maxZoom){let r=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.zoom&&this.fire(new zQ("zoomstart")).fire(new zQ("zoom")).fire(new zQ("zoomend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(t=!1){let r=this._camera.transform;return t?r.applyConstrain(r.center,r.minZoom).zoom:r.minZoom}setMaxZoom(t){if(t??(t=22),t>=this._camera.transform.minZoom){let r=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.zoom&&this.fire(new zQ("zoomstart")).fire(new zQ("zoom")).fire(new zQ("zoomend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(t){if(t??(t=0),t<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this._camera.transform.maxPitch){let r=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.pitch&&this.fire(new zQ("pitchstart")).fire(new zQ("pitch")).fire(new zQ("pitchend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(t){if(t??(t=60),t>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this._camera.transform.minPitch){let r=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.pitch&&this.fire(new zQ("pitchstart")).fire(new zQ("pitch")).fire(new zQ("pitchend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if(t??(t=20),t>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(t){return this._camera.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this._camera.transform.setConstrainOverride(t),this._update()}project(t){return this._camera.transform.locationToScreenPoint(DQ.convert(t),this.style&&this.terrain)}unproject(t){return this._camera.transform.screenPointToLocation(vu.convert(t),this.terrain)}isMoving(){var t;return this._camera.isMoving()||(null==(t=this._handlers)?void 0:t.isMoving())||!1}isZooming(){var t;return this._camera.isZooming()||(null==(t=this._handlers)?void 0:t.isZooming())||!1}isRotating(){var t;return this._camera.isRotating()||(null==(t=this._handlers)?void 0:t.isRotating())||!1}_createDelegatedListener(t,r,i){if("mouseenter"===t||"mouseover"===t){let n=!1;return{layers:r,listener:i,delegates:{mousemove:a=>{let o=r.filter(t=>this.getLayer(t)),s=0===o.length?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length?n||(n=!0,i.call(this,new z3(t,this,a.originalEvent,{features:s}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;return{layers:r,listener:i,delegates:{mousemove:a=>{let o=r.filter(t=>this.getLayer(t));(0===o.length?[]:this.queryRenderedFeatures(a.point,{layers:o})).length?n=!0:n&&(n=!1,i.call(this,new z3(t,this,a.originalEvent)))},mouseout:r=>{n&&(n=!1,i.call(this,new z3(t,this,r.originalEvent)))}}}}{let n=t=>{let n=r.filter(t=>this.getLayer(t)),a=0===n.length?[]:this.queryRenderedFeatures(t.point,{layers:n});a.length&&(t.features=a,i.call(this,t),delete t.features)};return{layers:r,listener:i,delegates:{[t]:n}}}}_saveDelegatedListener(t,r){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[t]||(i[t]=[]),this._delegatedListeners[t].push(r)}_removeDelegatedListener(t,r,i){var n;if(!(null!=(n=this._delegatedListeners)&&n[t]))return;let a=this._delegatedListeners[t];for(let t=0;tr.includes(t))){for(let t in n.delegates)this.off(t,n.delegates[t]);a.splice(t,1);return}}}on(t,r,i){if(void 0===i)return super.on(t,r);let n="string"==typeof r?[r]:r,a=this._createDelegatedListener(t,n,i);for(let r in this._saveDelegatedListener(t,a),a.delegates)this.on(r,a.delegates[r]);return{unsubscribe:()=>{this._removeDelegatedListener(t,n,i)}}}once(t,r,i){if(void 0===i)return super.once(t,r);let n="string"==typeof r?[r]:r,a=this._createDelegatedListener(t,n,i);for(let r in a.delegates){let o=a.delegates[r];a.delegates[r]=(...r)=>{this._removeDelegatedListener(t,n,i),o(...r)}}for(let r in this._saveDelegatedListener(t,a),a.delegates)this.once(r,a.delegates[r]);return this}off(t,r,i){if(void 0===i)return super.off(t,r);let n="string"==typeof r?[r]:r;return this._removeDelegatedListener(t,n,i),this}queryRenderedFeatures(t,r){if(!this.style)return[];let i,n=t instanceof vu||Array.isArray(t),a=n?t:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(r||(r=(n?{}:t)||{}),a instanceof vu||"number"==typeof a[0])i=[vu.convert(a)];else{let t=vu.convert(a[0]),r=vu.convert(a[1]);i=[t,new vu(r.x,t.y),r,new vu(t.x,r.y),t]}return this.style.queryRenderedFeatures(i,r,this._camera.transform)}querySourceFeatures(t,r){return this.style.querySourceFeatures(t,r)}setStyle(t,r){return r=xn({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),this._styleUrl="string"==typeof t?t:null,!1!==r.diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let r=this._locale[t];if(null==r)throw Error(`Missing UI string '${t}'`);return r}_updateStyle(t,r){var i,n,a;if(null==(i=this._diffStyleRequest)||i.abort(),this._diffStyleRequest=null,r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,r));let o=this.style&&r.transformStyle?this.style.serialize():void 0;return(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)?(this.style=new OG(this,r||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,r,o):this.style.loadJSON(t,r,o)):(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),null==(a=null==(n=this.style)?void 0:n.projection)||a.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new OG(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){return _(this,null,function*(){var i;if(null==(i=this._diffStyleRequest)||i.abort(),"string"==typeof t){this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let n=yield this._requestManager.transformRequest(t,"Style");if(i.signal.aborted){this._diffStyleRequest=null;return}let a=yield ME(n,i);this._diffStyleRequest=null,this._updateDiff(a.data,r)}catch(t){this._diffStyleRequest=null,xT(t)||this.fire(new ML(vJ(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,r))})}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(i){xf(`Unable to perform style diff: ${vJ(i).message}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():void xf("There is no style added to the map.")}addSource(t,r){return this._lazyInitEmptyStyle(),this.style.addSource(t,r),this._update(!0)}isSourceLoaded(t){var r;let i=null==(r=this.style)?void 0:r.tileManagers[t];return void 0===i?void this.fire(new ML(Error(`There is no tile manager with ID '${t}'`))):i.loaded()}setTerrain(t,r={}){if(this.style._checkLoaded(),t&&_5(this,Sa.terrain,{value:t},r))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let r=this.style.tileManagers[t.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let i in null===this.terrain&&r.reload(),this.style._layers){let r=this.style._layers[i];"hillshade"===r.type&&r.source===t.source&&xf("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===t.source&&xf("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new OS(this.painter,r,t,this._terrainSkirtLength),this.painter.renderToTexture=new jE(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=r=>this._handleTerrainDataEvent(r,t.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.style.triggerSymbolPlacement(),this.fire(new z8({terrain:t})),this}_handleTerrainDataEvent(t,r){var i;if("style"===t.dataType)return void this.terrain.tileManager.releaseAllRTT();let n=t.sourceId===r;if(n&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),n&&t.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),t.tile){if((null==(i=t.source)?void 0:i.type)==="image")return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(t.tile.tileID)}}getTerrain(){var t,r;return null!=(r=null==(t=this.terrain)?void 0:t.options)?r:null}areTilesLoaded(){var t;for(let r of Object.values(null==(t=this.style)?void 0:t.tileManagers))if(!r.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){var r;return null==(r=this.style)?void 0:r.getSource(t)}setSourceTileLodParams(t,r,i){if(i){let n=this.getSource(i);if(!n)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=LG(Math.max(1,t),Math.max(1,r))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=LG(Math.max(1,t),Math.max(1,r));return this._update(!0),this}refreshTiles(t,r){let i=this.style.tileManagers[t];if(!i)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(t=>new Ii(t.z,t.x,t.y)))}addImage(t,r,i={}){var n;this._lazyInitEmptyStyle();let a=this._createStyleImage(r,i);return a&&(this.style.addImage(t,a),null!=(n=a.userImage)&&n.onAdd&&a.userImage.onAdd(this,t)),this}setMissingStyleImageResolver(t){var r;return this._missingStyleImageResolver=t,null==(r=this.style)||r.setMissingImageResolver(t),this}_createStyleImage(t,r={}){let{pixelRatio:i=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=r;if(t instanceof HTMLImageElement||xg(t)){let{width:r,height:c,data:h}=zH.getImageData(t);return{data:new Dn({width:r,height:c},h),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:0}}if(void 0===t.width||void 0===t.height)return this.fire(new ML(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:r,height:c,data:h}=t,d=TP(t.data);return{data:d?new Dn({width:r,height:c}):new Dn({width:r,height:c},new Uint8Array(h)),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:0,isWebGLImage:d,userImage:t}}}updateImage(t,r){let i=this.style.getImage(t);if(!i)return this.fire(new ML(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:a,data:o}=r instanceof HTMLImageElement||xg(r)?zH.getImageData(r):r;if(void 0===n||void 0===a)return this.fire(new ML(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||a!==i.data.height)return this.fire(new ML(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=TP(o),i.isWebGLImage)i.userImage=r;else{let t=!(r instanceof HTMLImageElement||xg(r));i.data.replace(o,t)}return this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new ML(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return _(this,null,function*(){let r=yield zX.getImage((yield this._requestManager.transformRequest(t,"Image")),new AbortController);if(!r.data)throw Error(`Could not load image ${t}: the response is empty`);return r})}listImages(){var t,r;return null!=(r=null==(t=this.style)?void 0:t.listImages())?r:[]}addLayer(t,r){return this._lazyInitEmptyStyle(),this.style.addLayer(t,r),this._update(!0)}moveLayer(t,r){return this.style.moveLayer(t,r),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){var r;return null==(r=this.style)?void 0:r.getLayer(t)}getLayersOrder(){var t,r;return null!=(r=null==(t=this.style)?void 0:t.getLayersOrder())?r:[]}setLayerZoomRange(t,r,i){return this.style.setLayerZoomRange(t,r,i),this._update(!0)}setFilter(t,r,i={}){var n;return null==(n=this.style)||n.setFilter(t,r,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,r,i,n={}){var a;return null==(a=this.style)||a.setPaintProperty(t,r,i,n),this._update(!0)}getPaintProperty(t,r){return this.style.getPaintProperty(t,r)}setLayoutProperty(t,r,i,n={}){return this.style.setLayoutProperty(t,r,i,n),this._update(!0)}getLayoutProperty(t,r){return this.style.getLayoutProperty(t,r)}setGlyphs(t,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(t){return this._lazyInitEmptyStyle(),this.style.setFontFaces(t),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(t,r,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,r,i,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,r,t=>{t||this._update(!0)}),this}setLight(t,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,r={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,r),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,r){return this.style.setFeatureState(t,r),this._update()}removeFeatureState(t,r){return this.style.removeFeatureState(t,r),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,r=0;return this._container&&(t=this._container.clientWidth||400,r=this._container.clientHeight||300),[t,r]}_shouldHandleInitialResize(){var t;if(!(null!=(t=this._container)&&t.clientWidth)||!this._container.clientHeight)return!1;let[r,i]=this._containerDimensions();return r!==this._camera.transform.width||i!==this._camera.transform.height}_setupResizeObserver(){var t;let r=!1,i=zg(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),n=null!=(t=this._ownerWindow.ResizeObserver)?t:ResizeObserver;this._resizeObserver=new n(t=>{(r||(r=!0,this._shouldHandleInitialResize()))&&i(t)}),this._resizeObserver.observe(this._container)}_resolveContainer(t){if("string"==typeof t){let r=document.getElementById(t);if(!r)throw Error(`Container '${t}' not found.`);return r}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let r=this._canvasContainer=zZ.create("div","maplibregl-canvas-container",t);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=zZ.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);let a=this._controlContainer=zZ.create("div","maplibregl-control-container",t),o=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])o[t]=zZ.create("div",`maplibregl-ctrl-${t} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(t,r,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*r),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let t=p(f({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),r=null;this._canvas.addEventListener("webglcontextcreationerror",t=>{r=t},{once:!0});let i=this._canvas.getContext("webgl2",t);if(!i)throw new BG(t,r);this.painter=new Bq(i,this._camera.transform)}migrateProjection(t,r){this._camera.migrateProjection(t,r),this.painter.transform=t,this.fire(new z7({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){var r;return null!=(r=this.style)&&r._loaded&&(this._styleDirty||(this._styleDirty=t),this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,i,n,a,o;let s=this._idleTriggered?this._fadeDuration:0,l=(null==(r=this.style.projection)?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this._camera.transform.zoom,r=Lu();this.style.zoomHistory.update(t,r);let i=new Sc(t,{now:r,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=i.crossFadingFactor();(1!==n||n!==this._crossFadingFactor)&&(u=!0,this._crossFadingFactor=n),this.style.update(i)}let c=(null==(i=this.style.projection)?void 0:i.transitionState)>0!==l;this._camera.transform.setTransitionState(null==(n=this.style.projection)?void 0:n.transitionState),this.style&&(this._sourcesDirty||c)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=null==(a=this.style)?void 0:a._updatePlacement(this._camera.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,c),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new zJ("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new zJ("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let h=this._sourcesDirty||this._styleDirty||this._placementDirty||(null==(o=this.painter.renderToTexture)?void 0:o.needsFollowUpFrame);return h||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new zJ("idle")),!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var t,r;for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),null==(t=this._diffStyleRequest)||t.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),zX.removeThrottleControl(this._imageQueueHandle),null==(r=this._resizeObserver)||r.disconnect();let i=this.painter.context.gl.getExtension("WEBGL_lose_context");i?.loseContext&&i.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new zJ("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,zH.frame(this._frameRequest,t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!xT(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return"6.9.0"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},jL={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0},jP=class{constructor(t){this._updateZoomButtons=()=>{let t=this._map.getZoom(),r=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom(!0);this._zoomInButton.disabled=r,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let t=this._map.getPitch(),r=this._map.getRoll(),i=this._map.getBearing(),n=1/Math.cos(xv(t))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${n}) rotateZ(${-r}deg) rotateX(${t}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${n}) rotateX(${t}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-i-r}deg)`;return}this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(t,r)=>{let i=this._map._getUIString(`NavigationControl.${r}`);t.title=i,t.setAttribute("aria-label",i)},this.options=xn({},jL,t),this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),zZ.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),zZ.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=zZ.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new jz(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,r){let i=zZ.create("button",t,this._container);return i.type="button",i.addEventListener("click",r),i}},jz=class{constructor(t,r,i=!1){this.mousedown=t=>{this.startMove(t,zZ.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,zZ.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1===t.targetTouches.length?(this._startPos=this._lastPos=zZ.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=t=>{1===t.targetTouches.length?(this._lastPos=zZ.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos)):this.reset()},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;let n=new B9;this._rotatePitchHandler=new B4({clickTolerance:3,move:(t,n)=>{let a=r.getBoundingClientRect(),o=new vu((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:x_(new vu(t.x,n.y),n,o),pitchDelta:i?-((n.y-t.y)*.5):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchcancel",this.reset)}startMove(t,r){this._rotatePitchHandler.dragStart(t,r),zZ.disableDrag()}move(t,r){let i=this.map,{bearingDelta:n,pitchDelta:a}=this._rotatePitchHandler.dragMove(t,r)||{};n&&i.setBearing(i.getBearing()+n),a&&i.setPitch(i.getPitch()+a)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){zZ.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}},jO={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},jR={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},jj=class extends MI{},jN=class extends MI{},jV=class extends MP{constructor(t){if(super(),this._onClick=t=>{this.fire(new jN("click",{originalEvent:t}))},this._onKeyPress=t=>{("Space"===t.code||"Enter"===t.code)&&this.togglePopup()},this._onKeyDown=t=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t.composedPath()[0]!==this._element||t.altKey||t.ctrlKey||t.metaKey)return;let r=jR[t.key];if(!r)return;t.preventDefault(),t.stopPropagation();let i=t.shiftKey?10:1,n=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new vu(n.x+r[0]*i,n.y+r[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new jj("dragstart"))),this.fire(new jj("drag"))},this._onKeyUp=t=>{jR[t.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=t=>{let r=t.originalEvent.target,i=this._element;this._popup&&(r===i||i.contains(r))&&this.togglePopup()},this._update=t=>{if(!this._map)return;let r=this._map.loaded()&&!this._map.isMoving();t?.type!=="terrain"&&(t?.type!=="render"||r)||this._map.once("render",this._update),this._lngLat=zk(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),this._element.style.transform=`${jO[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${i}`,zH.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(t?.type==="moveend")}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){let r=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new jj("dragstart"))),this.fire(new jj("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new jj("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=vu.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=zZ.create("div");let r=(jB||(jB=zE("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[zE("g",{"fill-rule":"nonzero"},[zE("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([t,r])=>zE("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:t,ry:r}))),zE("g",{fill:"#3FB1CE"},[zE("path",{d:"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"})]),zE("g",{opacity:"0.25",fill:"#000000"},[zE("path",{d:"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"})]),zE("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),zE("g",{transform:"translate(8.0, 8.0)"},[zE("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),zE("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]))).cloneNode(!0);r.setAttributeNS(null,"height",`${41*this._scale}px`),r.setAttributeNS(null,"width",`${27*this._scale}px`),(function(t){return t.firstElementChild.children[1]})(r).setAttributeNS(null,"fill",this._color),this._element.appendChild(r),this._offset=vu.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),zS(this._element,this._anchor,"marker"),t?.className)for(let r of t.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(t){return this.remove(),this._map=t,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._updateAccessibilityRole(),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=DQ.convert(t),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),t){if(!("offset"in t.options)){let r=13.5/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-((24.6+r)*1)],"bottom-right":[-r,-((24.6+r)*1)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new jj("dragend")))}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(t=!1){var r,i;let n=null==(r=this._map)?void 0:r.terrain,a=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!n||a){let t=a?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==t&&(this._element.style.opacity=t,this._element.classList.toggle("maplibregl-marker-covered",a));return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,s=o.terrain.depthAtPoint(this._pos),l=o.terrain.getElevationForLngLat(this._lngLat,o._camera.transform);if(o._camera.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006){this._element.style.opacity=this._opacity,this._element.classList.remove("maplibregl-marker-covered");return}let u=-this._offset.y/o._camera.transform.pixelsPerMeter,c=Math.sin(o.getPitch()*Math.PI/180)*u,h=o.terrain.depthAtPoint(new vu(this._pos.x,this._pos.y-this._offset.y)),d=o._camera.transform.lngLatToCameraDepth(this._lngLat,l+c)-h>.006;null!=(i=this._popup)&&i.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",d)}getOffset(){return this._offset}setOffset(t){return this._offset=vu.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&(this._tabIndexManaged=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1))}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let t=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",t),this._roleManaged=!0}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,r){return(void 0===this._opacity||void 0===t&&void 0===r)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=String(t)),void 0!==r&&(this._opacityWhenCovered=String(r)),this._map&&this._updateOpacity(!0),this}},jU={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},jq=0,jG=!1,jH=class extends MI{},j$=class extends MI{},jW=class extends MI{},jY=class extends MP{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new j$("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new j$("geolocate",t)),this._finish()}},this._updateCamera=t=>{let r=new DQ(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=xn({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=FA.fromLngLat(r,i);this._map.fitBounds(a,n,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let r=new DQ(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&jG)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new jW("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let r=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new jH("trackuserlocationend")),this.fire(new jH("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>{t.preventDefault()}),this._geolocateButton=zZ.create("button","maplibregl-ctrl-geolocate",this._container),zZ.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){xf("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=zZ.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new jV({element:this._dotElement}),this._circleElement=zZ.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new jV({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=xn({},jU,t)}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(t=!1){return _(this,null,function*(){if(void 0!==jF&&!t)return jF;if(void 0===window.navigator.permissions)return jF=!!window.navigator.geolocation;try{jF="denied"!==(yield window.navigator.permissions.query({name:"geolocation"})).state}catch{jF=!!window.navigator.geolocation}return jF})})().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,jq=0,jG=!1}_isOutOfMapMaxBounds(t){let r=this._map.getMaxBounds(),i=t.coords;return r&&(i.longituder.getEast()||i.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let t=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!t)return;let r=this._map.project(t),i=this._map.unproject([r.x+100,r.y]),n=t.distanceTo(i)/100,a=2*this._accuracy/n;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return xf("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new jH("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":jq--,jG=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new jH("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new jH("trackuserlocationstart")),this.fire(new jH("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++jq>1?(t={maximumAge:6e5,timeout:0},jG=!0):(t=this.options.positionOptions,jG=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},jZ={maxWidth:100,unit:"metric"},jX=class{constructor(t){this._onMove=()=>{zD(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,zD(this._map,this._container,this.options)},this.options=f(f({},jZ),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},jK=class extends MI{},jJ=class extends MP{constructor(t={}){var r;super(),this._onFullscreenChange=()=>{var t;let r=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null!=(t=r?.shadowRoot)&&t.fullscreenElement;)r=r.shadowRoot.fullscreenElement;r===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!=(r=t.pseudo)&&r,t?.container&&(t.container instanceof HTMLElement?this._container=t.container:xf("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=zZ.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);zZ.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new jK("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new jK("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},jQ=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=t}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=zZ.create("button","maplibregl-ctrl-terrain",this._container),zZ.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},j0=class{constructor(){this._toggleProjection=()=>{var t;let r=null==(t=this._map.getProjection())?void 0:t.type;"mercator"!==r&&r?this._map.setProjection({type:"mercator"}):this._map.setProjection({type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),(null==(t=this._map.getProjection())?void 0:t.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=zZ.create("button","maplibregl-ctrl-globe",this._container),zZ.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},j1={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},j2=class extends MI{},j3=class extends MP{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new j2("close"))),this),this._update=t=>{let r,i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=zZ.create("div","maplibregl-popup",this._map.getContainer()),this._tip=zZ.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=zk(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer),t&&"point"in t&&t.point&&(r=t.point),this._trackPointer&&!r)return;let n=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map._camera.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor,o=function t(r){if(!r)return t(new vu(0,0));if("number"==typeof r){let t=Math.round(Math.abs(r)/Math.SQRT2);return{center:new vu(0,0),top:new vu(0,r),"top-left":new vu(t,t),"top-right":new vu(-t,t),bottom:new vu(0,-r),"bottom-left":new vu(t,-t),"bottom-right":new vu(-t,-t),left:new vu(r,0),right:new vu(-r,0)}}if(r instanceof vu||Array.isArray(r)){let t=vu.convert(r);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:vu.convert(r.center||[0,0]),top:vu.convert(r.top||[0,0]),"top-left":vu.convert(r["top-left"]||[0,0]),"top-right":vu.convert(r["top-right"]||[0,0]),bottom:vu.convert(r.bottom||[0,0]),"bottom-left":vu.convert(r["bottom-left"]||[0,0]),"bottom-right":vu.convert(r["bottom-right"]||[0,0]),left:vu.convert(r.left||[0,0]),right:vu.convert(r.right||[0,0])}}(this.options.offset);if(!a){var s,l,u,c,h;let t=this._container.offsetWidth,r=this._container.offsetHeight,i=(s=this.options.padding)?{top:null!=(l=s.top)?l:0,right:null!=(u=s.right)?u:0,bottom:null!=(c=s.bottom)?c:0,left:null!=(h=s.left)?h:0}:{top:0,right:0,bottom:0,left:0},d;d=n.y+o.bottom.ythis._map._camera.transform.height-r-i.bottom?["bottom"]:[],n.xthis._map._camera.transform.width-t/2-i.right&&d.push("right"),a=0===d.length?"bottom":d.join("-")}let d=n.add(o[a]);this.options.subpixelPositioning||(d=d.round()),this._container.style.transform=`${jO[a]} translate(${d.x}px,${d.y}px)`,zS(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=xn(Object.create(j1),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new j2("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=DQ.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let r=document.createDocumentFragment(),i=document.createElement("body"),n;for(i.innerHTML=t;n=i.firstChild;)r.appendChild(n);return this.setDOMContent(r)}getMaxWidth(){var t;return null==(t=this._container)?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=zZ.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=zZ.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");t&&t.focus()}},j5="6.9.0"}}),j6=g({"build/maplibre_worker.js"(t,r){r.exports='var t1=Object.defineProperty,e1=Object.defineProperties;var r1=Object.getOwnPropertyDescriptors;var nh=Object.getOwnPropertySymbols;var i1=Object.prototype.hasOwnProperty,n1=Object.prototype.propertyIsEnumerable;var ah=(t,e,r)=>e in t?t1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,je=(t,e)=>{for(var r in e||(e={}))i1.call(e,r)&&ah(t,r,e[r]);if(nh)for(var r of nh(e))n1.call(e,r)&&ah(t,r,e[r]);return t},Si=(t,e)=>e1(t,r1(e));var rt=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())});var a1=Object.create,ep=Object.defineProperty,s1=Object.getOwnPropertyDescriptor,o1=Object.getOwnPropertyNames,l1=Object.getPrototypeOf,rp=Object.prototype.hasOwnProperty,fl=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),u1=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=o1(e),a=0,s=n.length,o;ae[l]).bind(null,o),enumerable:!(i=s1(e,o))||i.enumerable});return t},h1=(t,e,r)=>(r=t==null?{}:a1(l1(t)),u1(e||!t||!t.__esModule||!rp.call(t,"default")?ep(r,"default",{value:t,enumerable:!0}):r,t));function B(t,e){this.x=t,this.y=e}B.prototype={clone(){return new B(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){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},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){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(t){if(t instanceof B)return t;if(Array.isArray(t))return new B(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new B(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};function c1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Nn;function p1(){return Nn!=null||(Nn=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Nn}var Un;function f1(){if(Un==null&&(Un=!1,p1())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){Un=!0;break}}}return Un||!1}var pe=typeof Float32Array<"u"?Float32Array:Array;Math.PI/180,180/Math.PI;function d1(){var t=new pe(9);return pe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function ip(){var t=new pe(3);return pe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function y1(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function sh(t,e,r){var i=new pe(3);return i[0]=t,i[1]=e,i[2]=r,i}function m1(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function g1(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ks(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var x1=y1;(function(){var t=ip();return function(e,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function w1(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=v1();return function(e,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function _1(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var lh=b1;(function(){var t=ip(),e=sh(1,0,0),r=sh(0,1,0);return function(i,n,a){var s=g1(n,a);return s<-.999999?(ks(t,e,n),x1(t)<1e-6&&ks(t,r,n),m1(t,t),D1(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(ks(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,lh(i,i))}})(),(function(){var t=oh(),e=oh();return function(r,i,n,a,s,o){return Ts(t,i,s,o),Ts(e,n,a,o),Ts(r,t,e,2*o*(1-o)),r}})(),(function(){var t=d1();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],lh(e,_1(e,t))}})();function A1(){var t=new pe(2);return pe!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=A1();return function(e,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function E1(t,e,r,i){return c1(t,e,r,i)}var d5=E1(.25,.1,.25,1);function Ji(t,e,r){return Math.min(r,Math.max(e,t))}function F1(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Gt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function k1(t){return Math.log(t)/Math.LN2%1==0}function Ia(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function T1(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function He(t){return Array.isArray(t)?t.map(He):typeof t=="object"&&t?Ia(t,He):t}var uh={};function Bt(t){uh[t]||(typeof console<"u"&&console.warn(t),uh[t]=!0)}function Ke(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}function Ca(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function I1(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}function C1(t,e,r,i,n){return rt(this,null,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(t,{timestamp:0});try{let s=a==null?void 0:a.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(yield a.copyTo(l,I1(t,e,r,i,n)),o)for(let u=0;u{t.removeEventListener(e,r,i)}}}function ch(t){return t*Math.PI/180}var ph="AbortError",dl=class extends Error{constructor(t=ph){super(t instanceof Error?t.message:t),this.name=ph,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function yl(t){return t instanceof Error&&t.name==="AbortError"}function B1(t){if(t.aborted)throw new dl(t.reason)}var ml={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function P1(t){return ml.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function sp(t,e){ml.REGISTERED_PROTOCOLS[t]=e}function op(t){delete ml.REGISTERED_PROTOCOLS[t]}var fh="global-dispatcher",ya=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function lp(){var t;if(mr(self))return(t=self.worker)==null?void 0:t.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch(e){}return window.location.href}var z1=t=>{var e;return t.startsWith("file:")||((e=lp())==null?void 0:e.startsWith("file:"))&&!/^\\w+:/.test(t)};function L1(t,e){return rt(this,null,function*(){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:lp(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=yield fetch(r)}catch(s){throw yl(s)?s:new ya(0,Ki(s).message,t.url,new Blob)}if(!i.ok){let s=yield i.blob();throw new ya(i.status,i.statusText,t.url,s)}let n;n=t.type==="arrayBuffer"||t.type==="image"?i.arrayBuffer():t.type==="json"?i.json():i.text();let a=yield n;return B1(e.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}})}function V1(t,e){return new Promise((r,i)=>{var a;let n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(n.responseType="arraybuffer");for(let s in t.headers)n.setRequestHeader(s,t.headers[s]);t.type==="json"&&(n.responseType="text",(a=t.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=t.credentials==="include",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let s=n.response;if(t.type==="json")try{s=JSON.parse(n.response)}catch(o){i(o);return}r({data:s,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let s=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new ya(n.status,n.statusText,t.url,s))}},e.signal.addEventListener("abort",()=>{n.abort(),i(new dl(e.signal.reason))}),n.send(t.body)})}var Ma=function(t,e){return rt(this,null,function*(){var r,i;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=P1(t.url);if(n){let a=yield n(t,e);return!a.data&&t.type==="arrayBuffer"?Gt(a,{data:new ArrayBuffer(0)}):a}if(mr(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:fh},e)}if(!z1(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return L1(t,e);if(mr(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:fh},e)}return V1(t,e)})},up=(t,e)=>Ma(Gt(t,{type:"json"}),e),hp=(t,e)=>Ma(Gt(t,{type:"arrayBuffer"}),e);function dh(t,e,r){var i;(i=r[t])!=null&&i.includes(e)||(r[t]||(r[t]=[]),r[t].push(e))}function Is(t,e,r){if(r!=null&&r[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var cp=class{constructor(t,e={}){Gt(this,e),this.type=t}},ma=class extends cp{constructor(t,e={}){super("error",Gt({error:t},e))}},O1=class{on(t,e){return this._listeners||(this._listeners={}),dh(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Is(t,e,this._listeners),Is(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),dh(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){var n,a,s,o,l,u;let r=typeof t=="string"?new cp(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let h=(s=(a=(n=this._listeners)==null?void 0:n[i])==null?void 0:a.slice())!=null?s:[];for(let f of h)f.call(this,r);let c=(u=(l=(o=this._oneTimeListeners)==null?void 0:o[i])==null?void 0:l.slice())!=null?u:[];for(let f of c)Is(i,f,this._oneTimeListeners),f.call(this,r);let p=this._eventedParent;p&&(Gt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(r))}else r instanceof ma&&console.error(r.error);return this}listens(t){var e,r,i,n,a;return!!((r=(e=this._listeners)==null?void 0:e[t])!=null&&r.length||(n=(i=this._oneTimeListeners)==null?void 0:i[t])!=null&&n.length||(a=this._eventedParent)!=null&&a.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},pp={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},w=pp,fp=["type","source","source-layer","minzoom","maxzoom","filter","layout"],E=class{constructor(t,e,r,i,n="error"){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},dn={kind:"null"},I={kind:"number"},Y={kind:"string"},tt={kind:"boolean"},ce={kind:"color"},Ba={kind:"projectionDefinition"},fr={kind:"object"},Z={kind:"value"},R1={kind:"error"},Pa={kind:"collator"},yn={kind:"formatted"},za={kind:"padding"},Qi={kind:"colorArray"},La={kind:"numberArray"},mn={kind:"resolvedImage"},Va={kind:"variableAnchorOffsetCollection"};function Ut(t,e){return{kind:"array",itemType:t,N:e}}function yt(t){if(t.kind==="array"){let e=yt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}var $1=[dn,I,Y,tt,ce,Ba,yn,fr,Ut(Z),za,La,Qi,mn,Va];function tn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of $1)if(!tn(r,e))return null}}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function gl(t,e){return e.some(r=>r.kind===t.kind)}function dr(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Ge(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var dp=.96422,yp=.82521,mp=4/29,Ks=6/29,gp=3*Ks*Ks,N1=Math.PI/180,U1=180/Math.PI;function xp(t){return t%=360,t<0&&(t+=360),t}function vp([t,e,r,i]){t=Cs(t),e=Cs(e),r=Cs(r);let n,a,s=Ms((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Ms((.4360747*t+.3850649*e+.1430804*r)/dp),a=Ms((.0139322*t+.0971045*e+.7141733*r)/yp));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Cs(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ms(t){return t>.008856451679035631?t**(1/3):t/gp+mp}function bp([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*Ps(n),a=dp*Ps(a),s=yp*Ps(s),[Bs(3.1338561*a-1.6168667*n-.4906146*s),Bs(-.9787684*a+1.9161415*n+.033454*s),Bs(.0719453*a-.2289914*n+1.4052427*s),i]}function Bs(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Ps(t){return t>Ks?t*t*t:gp*(t-mp)}function q1(t){let[e,r,i,n]=vp(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?xp(Math.atan2(i,r)*U1):NaN,a,e,n]}function j1([t,e,r,i]){return t=isNaN(t)?0:t*N1,bp([r,Math.cos(t)*e,Math.sin(t)*e,i])}function G1([t,e,r,i]){t=xp(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var X1=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ji(t,e){return X1(t,e)?t[e]:void 0}function Y1(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=ji(W1,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+i)||"ff")]}if(t.startsWith("rgb")){let i=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||" ",h||" ",f].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[s,u,p].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let v=[Rr(+a/x,0,1),Rr(+l/x,0,1),Rr(+c/x,0,1),d?yh(+d,y):1];if(mh(v))return v}}return}}let r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||" ",o||" ",u].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){let f=[+n,Rr(+s,0,100),Rr(+l,0,100),h?yh(+h,c):1];if(mh(f))return G1(f)}}}function qn(t){return parseInt(t.padEnd(2,t),16)/255}function yh(t,e){return Rr(e?t/100:t,0,1)}function Rr(t,e,r){return Math.min(Math.max(e,t),r)}function mh(t){return!t.some(Number.isNaN)}var W1={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],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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],rebeccapurple:[102,51,153],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]};function Je(t,e,r){return t+r*(e-t)}function ti(t,e,r){return t.map((i,n)=>Je(i,e[n],r))}function Z1(t){return t==="rgb"||t==="hcl"||t==="lab"}var Pt,gt=(Pt=class{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,r,i,n]))}static parse(e){if(e instanceof Pt)return e;if(typeof e!="string")return;let r=Y1(e);if(r)return new Pt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter("hcl",q1(this.rgb))}get lab(){return this.overwriteGetter("lab",vp(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(",")},${n})`}static interpolate(e,r,i,n="rgb"){switch(n){case"rgb":{let[a,s,o,l]=ti(e.rgb,r.rgb,i);return new Pt(a,s,o,l,!1)}case"hcl":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u180&&(v+=360),f=a+i*v}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=j1([f,d!=null?d:Je(s,h,i),Je(o,c,i),Je(l,p,i)]);return new Pt(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=bp(ti(e.lab,r.lab,i));return new Pt(a,s,o,l,!1)}}}},Pt.black=new Pt(0,0,0,1),Pt.white=new Pt(1,1,1,1),Pt.transparent=new Pt(0,0,0,0),Pt.red=new Pt(1,0,0,1),Pt),H1=["bottom","center","top"],Js=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},ze=class la{constructor(e){this.sections=e}static fromString(e){return new la([new Js(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof la?e:la.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Ae=class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Li(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Li(ti(e.values,r.values,i))}},Se=class Vi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vi)return e;if(typeof e=="number")return new Vi([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new Vi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Vi(ti(e.values,r.values,i))}},oe=class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(typeof e=="string"){let i=gt.parse(e);return i?new Oi([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!="string")return;let n=gt.parse(i);if(!n)return;r.push(n)}return new Oi(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n="rgb"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?i===void 0||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[t,e,r,i]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function ei(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Dr||t instanceof gt||t instanceof xl||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e)return!0;if(Array.isArray(t)){for(let e of t)if(!ei(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!ei(t[e]))return!1;return!0}return!1}function _t(t){if(t===null)return dn;if(typeof t=="string")return Y;if(typeof t=="boolean")return tt;if(typeof t=="number")return I;if(t instanceof gt)return ce;if(t instanceof Dr)return Ba;if(t instanceof xl)return Pa;if(t instanceof ze)return yn;if(t instanceof Ae)return za;if(t instanceof Se)return La;if(t instanceof oe)return Qi;if(t instanceof De)return Va;if(t instanceof _e)return mn;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=_t(i);if(!r)r=n;else{if(r===n)continue;r=Z;break}}return Ut(r||Z,e)}return fr}function Gi(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof gt||t instanceof Dr||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e?t.toString():JSON.stringify(t)}var ri=class _p{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i),a=r.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new _p(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},J1=["Unknown","Point","LineString","Polygon"],Ap=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?J1[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=gt.parse(t),this._parseColorCache.set(t,e)),e}};function Oa(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||ee)a=s-1;else throw new ft("Input is not a number.",r);return 0}var vl=class Sp{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let s=1;s=o)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new Sp(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[Oa(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Q1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var be=class Qs{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name==="exponential")a=zs(r,e.base,i,n);else if(e.name==="linear")a=zs(r,1,i,n);else if(e.name==="cubic-bezier"){let s=e.controlPoints;a=Q1(s[0],s[1],s[2],s[3])(zs(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,I),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Qi?l=ce:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u=h)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!Ge(l,I)&&!Ge(l,Ba)&&!Ge(l,ce)&&!Ge(l,za)&&!Ge(l,La)&&!Ge(l,Qi)&&!Ge(l,Va)&&!Ge(l,Ut(I))?r.error(`Type ${yt(l)} is not interpolatable.`):new Qs(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=Oa(r,n,this.key),o=r[s],l=r[s+1],u=Qs.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Je(h,c,u);case"color":return gt.interpolate(h,c,u);case"padding":return Ae.interpolate(h,c,u);case"colorArray":return oe.interpolate(h,c,u);case"numberArray":return Se.interpolate(h,c,u);case"variableAnchorOffsetCollection":return De.interpolate(h,c,u,this.key);case"array":return ti(h,c,u);case"projectionDefinition":return Dr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"hcl");case"colorArray":return oe.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"lab");case"colorArray":return oe.interpolate(h,c,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function zs(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var gr={color:gt.interpolate,number:Je,padding:Ae.interpolate,numberArray:Se.interpolate,colorArray:oe.interpolate,variableAnchorOffsetCollection:De.interpolate,array:ti},Ep=class Fp{constructor(e){this.type=yn,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return r.error("First argument must be an image or text section.");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o=="object"&&!Array.isArray(o)){a=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,I),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,Ut(Y)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,ce),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!H1.includes(o["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${o["vertical-align"]}\' instead.`);if(c=r.parse(o["vertical-align"],1,Y),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,Z);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Fp(n)}evaluate(e){return new ze(this.sections.map(r=>{let i=r.content.evaluate(e);return _t(i)===mn?new Js("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Js(Gi(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function kp(t,e,r=0,i=t.length-1,n=t0){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);kp(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(ki(t,r,e),n(t[i],a)>0&&ki(t,r,i);s0;)o--}n(t[r],a)===0?ki(t,r,o):(o++,ki(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function ki(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function t0(t,e){return te)}function Ra(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=r0(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a2){let u=e[1];if(typeof u!="string"||!(u in jn)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);o=jn[u],i++}else o=Z;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],i++}n=Ut(o,l)}else{if(!jn[a])throw Error(`Types doesn\'t contain name = ${a}`);n=jn[a]}let s=[];for(;ie.outputDefined())}},gh={"to-boolean":tt,"to-color":ce,"to-number":I,"to-string":Y},jr=class Ip{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[0];if(!gh[i])throw Error(`Can\'t parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return r.error("Expected one argument.");let n=gh[i],a=[];for(let s=1;s4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Dp(r[0],r[1],r[2],r[3]),!i))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ft(i||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(e);let n=Ae.parse(r);if(n)return n}throw new ft(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=Se.parse(r);if(n)return n}throw new ft(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=oe.parse(r);if(n)return n}throw new ft(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(e);let n=De.parse(r);if(n)return n}throw new ft(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"number":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new ft(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return ze.fromString(Gi(this.args[0].evaluate(e)));case"resolvedImage":return _e.fromString(Gi(this.args[0].evaluate(e)));case"projectionDefinition":{let r=this.args[0].evaluate(e);if(Dr.parse(r))return r;throw new ft(`Could not parse projectionDefinition from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}default:return Gi(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Cp=class Mp{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a=i.length)throw new ft(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new ft(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},n0=class Lp{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=tt}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);return!i||!n?null:gl(i.type,[tt,Y,I,dn,Z])?new Lp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);if(!dr(i,["string","array"]))throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},a0=class to{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=I}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);if(!i||!n)return null;if(!gl(i.type,[tt,Y,I,dn,Z]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new to(i,n,r.key,a):null}return new to(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),dr(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(dr(i,["array"]))return i.indexOf(r,n);throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},s0=class Vp{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let i,n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let a={},s=[];for(let u=2;u2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d=="number"&&Math.floor(d)!==d)return p.error("Numeric branch labels must be integer values.");if(!i)i=_t(d);else if(p.checkSubtype(i,_t(d)))return null;if(a[String(d)]!==void 0)return p.error("Branch labels must be unique.");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(e[1],1,Z);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!=="value"&&r.concat(1).checkSubtype(i,o.type)?null:new Vp(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(_t(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},o0=class Op{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let n=[];for(let s=1;sr.outputDefined())&&this.otherwise.outputDefined()}},l0=class eo{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,I);if(!i||!n)return null;if(!gl(i.type,[Ut(Z),Y,Z]))return r.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new eo(i.type,i,n,r.key,a):null}return new eo(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),dr(r,["string"]))return[...r].slice(i,n).join("");if(dr(r,["array"]))return r.slice(i,n);throw new ft(`Expected first argument to be of type array or string, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Rp=class ro{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=null,n=r.expectedType;n&&n.kind!=="value"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>tn(n,s.type))?new ro(Z,a):new ro(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof _e&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function xh(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function u0(t,e,r){return e===r}function h0(t,e,r){return e!==r}function c0(t,e,r){return er}function f0(t,e,r){return e<=r}function d0(t,e,r){return e>=r}function $p(t,e,r,i){return i.compare(e,r)===0}function y0(t,e,r,i){return!$p(t,e,r,i)}function m0(t,e,r,i){return i.compare(e,r)<0}function g0(t,e,r,i){return i.compare(e,r)>0}function x0(t,e,r,i){return i.compare(e,r)<=0}function v0(t,e,r,i){return i.compare(e,r)>=0}function li(t,e,r){let i=t!=="=="&&t!=="!=";return class Np{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=tt,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let o=a[0],l=s.parse(a[1],1,Z);if(!l)return null;if(!xh(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type \'${yt(l.type)}\'.`);let u=s.parse(a[2],2,Z);if(!u)return null;if(!xh(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type \'${yt(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types \'${yt(l.type)}\' and \'${yt(u.type)}\'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ie(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ie(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Pa),!h)return null}return new Np(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new ft(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!=="string"||u.kind!=="string")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var b0=li("==",u0,$p),w0=li("!=",h0,y0),D0=li("<",c0,m0),_0=li(">",p0,g0),A0=li("<=",f0,x0),S0=li(">=",d0,v0),Up=class qp{constructor(e,r,i){this.type=Pa,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return r.error("Collator options argument must be an object.");let n=r.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,tt);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,tt);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,Y),!s)?null:new qp(n,a,s)}evaluate(e){return new xl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},E0=class jp{constructor(e,r,i,n,a,s){this.type=Y,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=r.parse(n.locale,1,Y),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,Y),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,Y),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=r.parse(n["min-fraction-digits"],1,I),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,I),!u)?null:new jp(i,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},F0=class Gp{constructor(e){this.type=mn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let i=r.parse(e[1],1,Y);return i?new Gp(i):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),i=_e.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},k0=class Xp{constructor(e,r){this.input=e,this.key=r,this.type=I}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Xp(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ft(`Expected value to be of type string or array, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},we=8192;function T0(t,e){let r=I0(t[0]),i=M0(t[1]),n=2**e.z;return[Math.round(r*n*we),Math.round(i*n*we)]}function bl(t,e){let r=2**e.z,i=(t[0]/we+e.x)/r,n=(t[1]/we+e.y)/r;return[C0(i),B0(n)]}function I0(t){return(180+t)/360}function C0(t){return t*360-180}function M0(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function B0(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function gn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function en(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function P0(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function z0(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function $a(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return R0([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(vh(t,e,r,i)&&vh(r,i,t,e))}function L0(t,e,r){for(let i of r)for(let n=0;n0&&c<0||h<0&&c>0}function wl(t,e,r){let i=[];for(let n=0;nr[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}gn(e,t)}function $0(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function bh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Zp(u,e,r,n),s.push(u)}return s}function wh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){$0(e);for(let o of s)for(let l of o)Zp(l,e,r,n)}return s}function N0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!ui(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!V0(o,a))return!1}return!0}function U0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!Yp(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!O0(o,a))return!1}return!0}var Dl=class ha{constructor(e,r){this.type=tt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s==="Polygon"&&n.push(o),s==="MultiPolygon"&&n.push(...o)}if(n.length)return new ha(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new ha(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new ha(i,i)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return N0(e,this.geometries);if(e.geometryType()==="LineString")return U0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Hp=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}},Dh=Math.PI/180,_l=class{constructor(t){let e=Dh*6378.137*1e3,r=Math.cos(t*Dh),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f180;)t-=360;return t}};function Kp(t,e){return e[0]-t[0]}function ga(t){return t[1]-t[0]+1}function Le(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];let r=ga(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function no(t,e){if(!Le(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)gn(r,t[i]);return r}function ao(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)gn(e,i);return e}function _h(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Al(t,e,r){if(!_h(t)||!_h(e))return NaN;let i=0,n=0;return t[2]e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]=i)return i;if(en(n,a)){if(Ah(t,e))return 0}else if(Ah(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(ga(u)<=h){if(!Le(u,t.length))return NaN;if(e){let c=X0(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=G0(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=io(u,e);Sh(s,a,i,t,o,c[0]),Sh(s,a,i,t,o,c[1])}}return a}function va(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new Hp([[0,[0,t.length-1],[0,r.length-1]]],Kp);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(ga(u)<=c&&ga(h)<=p){if(!Le(u,t.length)&&Le(h,r.length))return NaN;let f;if(e&&i)f=q0(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=hr(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=hr(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=j0(t,u,r,h,n),s=Math.min(s,f)}else{let f=io(u,e),d=io(h,i);Gn(o,s,n,t,r,f[0],d[0]),Gn(o,s,n,t,r,f[0],d[1]),Gn(o,s,n,t,r,f[1],d[0]),Gn(o,s,n,t,r,f[1],d[1])}}return s}function W0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function Z0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function H0(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Ra(r,0).map(s=>s.map(o=>o.map(l=>bl([l.x,l.y],t.canonical)))),n=new _l(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case"Point":a=Math.min(a,xa([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,xa(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,Y0(o,s.coordinates,n,a))}if(a===0)return a}return a}function Ls(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var El=class ca{constructor(e,r){this.type=I,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new ca(i,i.features.map(n=>Ls(n.geometry)).flat());if(i.type==="Feature")return new ca(i,Ls(i.geometry));if("type"in i&&"coordinates"in i)return new ca(i,Ls(i))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W0(e,this.geometries);if(e.geometryType()==="LineString")return Z0(e,this.geometries);if(e.geometryType()==="Polygon")return H0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},K0=class Jp{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=Z;break}this.type=Ut(r!=null?r:Z,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`\'semiliteral\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,Z));return new Jp(a)}return new ri(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},Fl=class Qp{constructor(e){this.key=e,this.type=Z}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error("Global state property must be defined."):typeof i=="string"?new Qp(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){var i,n;let r=(i=e.globals)==null?void 0:i.globalState;return!r||Object.keys(r).length===0?null:(n=ji(r,this.key))!=null?n:null}eachChild(){}outputDefined(){return!1}},Yr={"==":b0,"!=":w0,">":_0,"<":D0,">=":S0,"<=":A0,array:Ie,at:i0,boolean:Ie,case:o0,coalesce:Rp,collator:Up,format:Ep,image:F0,in:n0,"index-of":a0,interpolate:be,"interpolate-hcl":be,"interpolate-lab":be,length:k0,let:Cp,literal:ri,match:s0,number:Ie,"number-format":E0,object:Ie,semiliteral:K0,slice:l0,step:vl,string:Ie,"to-boolean":jr,"to-color":jr,"to-number":jr,"to-string":jr,var:Bp,within:Dl,distance:El,"global-state":Fl},ve=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},J0=class tf{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new tf(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},ef=class rf{constructor(e,r,i=[],n,a=new J0,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);let i=this.key;function n(a,s,o){return o==="assert"?new Ie(s,[a],i):o==="coerce"?new jr(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let a=e[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=n(o,l,r.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=n(o,l,r.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof ri)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new Ap;try{o=new ri(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return e===void 0?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e=="number"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new rf(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join("")}`;this.errors.push(new ve(i,e))}checkSubtype(e,r){let i=tn(e,r);return i&&this.error(i),i}},_r=class Ri{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Ri.definitions[i];if(!n)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new ef(r.registry,ba,r.path,null,r.scope);let c=[],p=!1;for(let f=1;ftm(c)).join(" | "),h=[];for(let c=1;c>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function sr(t){return{type:t}}_r.register(Yr,{error:[R1,[Y],(t,[e],r)=>{throw new ft(e.evaluate(t),r)}],typeof:[Y,[Z],(t,[e])=>yt(_t(e.evaluate(t)))],"to-rgba":[Ut(I,4),[ce],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[ce,[I,I,I],Eh],rgba:[ce,[I,I,I,I],Eh],has:{type:tt,overloads:[[[Y],(t,[e])=>Fh(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Fh(e.evaluate(t),r.evaluate(t))]]},get:{type:Z,overloads:[[[Y],(t,[e])=>Vs(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Vs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Z,[Y],(t,[e])=>Vs(e.evaluate(t),t.featureState||{})],properties:[fr,[],t=>t.properties()],"geometry-type":[Y,[],t=>t.geometryType()],id:[Z,[],t=>t.id()],zoom:[I,[],t=>t.globals.zoom],"heatmap-density":[I,[],t=>t.globals.heatmapDensity||0],elevation:[I,[],t=>t.globals.elevation||0],"line-progress":[I,[],t=>t.globals.lineProgress||0],accumulated:[Z,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[I,sr(I),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],"*":[I,sr(I),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],"-":{type:I,overloads:[[[I,I],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[I],(t,[e])=>-e.evaluate(t)]]},"/":[I,[I,I],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[I,[I,I],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[I,[I],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[I,[I],(t,[e])=>Math.log(e.evaluate(t))],log2:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[I,[I],(t,[e])=>Math.sin(e.evaluate(t))],cos:[I,[I],(t,[e])=>Math.cos(e.evaluate(t))],tan:[I,[I],(t,[e])=>Math.tan(e.evaluate(t))],asin:[I,[I],(t,[e])=>Math.asin(e.evaluate(t))],acos:[I,[I],(t,[e])=>Math.acos(e.evaluate(t))],atan:[I,[I],(t,[e])=>Math.atan(e.evaluate(t))],min:[I,sr(I),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[I,sr(I),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[I,[I],(t,[e])=>Math.abs(e.evaluate(t))],round:[I,[I],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[I,[I],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[I,[I],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[tt,[Y,Z],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[tt,[Z],(t,[e])=>t.id()===e.value],"filter-type-==":[tt,[Y],(t,[e])=>t.geometryType()===e.value],"filter-<":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i{let r=t.id(),i=e.value;return typeof r==typeof i&&r":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[tt,[Z],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[tt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[tt,[Ut(Y)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[tt,[Ut(Z)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[tt,[Y,Ut(Z)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[tt,[Y,Ut(Z)],(t,[e,r])=>Q0(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[tt,[tt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[tt,[Y],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Y,[Y],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Y,[Y],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Y,sr(Z),(t,e)=>e.map(r=>Gi(r.evaluate(t))).join("")],split:[Ut(Y),[Y,Y],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[Y,[Ut(Y),Y],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[Y,[Pa],(t,[e])=>e.evaluate(t).resolvedLocale()]});function tm(t){return Array.isArray(t)?`(${t.map(yt).join(", ")})`:`(${yt(t.type)}...)`}function ba(t){if(t instanceof Bp)return ba(t.boundExpression);if(t instanceof _r&&t.name==="error"||t instanceof Up||t instanceof Dl||t instanceof El||t instanceof Fl)return!1;let e=t instanceof jr||t instanceof Ie,r=!0;return t.eachChild(i=>{r&&(r=e?ba(i):i instanceof ri)}),r?Na(t)&&Ua(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Na(t){if(t instanceof _r&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Dl||t instanceof El)return!1;let e=!0;return t.eachChild(r=>{e&&!Na(r)&&(e=!1)}),e}function rn(t){if(t instanceof _r&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!rn(r)&&(e=!1)}),e}function Ua(t,e){if(t instanceof _r&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!Ua(i,e)&&(r=!1)}),r}function ii(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function nf(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function kl(t){return!!t.expression&&t.expression.interpolated}var Tl=/^(.*)-transition$/;function nn(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function Q(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function qa(t){return typeof t=="object"&&!!t&&!Array.isArray(t)&&_t(t)===fr}function em(t){return t}function rm(t){switch(t.type){case"color":return gt.parse;case"padding":return Ae.parse;case"numberArray":return Se.parse;case"colorArray":return oe.parse;default:return null}}function im(t){switch(t){case"exponential":return sf;case"interval":return am;case"categorical":return nm;case"identity":return sm;default:throw Error(`Unknown function type "${t}"`)}}function af(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",i=r||t.property!==void 0,n=r||!i,a=t.type||(kl(e)?"exponential":"interval"),s=rm(e);if(s&&(t=nn({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!Z1(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o=im(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;dd[0]),evaluate({zoom:d},y){return sf({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a==="exponential"?{name:"exponential",base:t.base===void 0?1:t.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:be.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?xn(t.default,e.default):o(t,e,p,l,u)}}}function xn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function nm(t,e,r,i,n){return xn(typeof r===n?i[r]:void 0,t.default,e.default)}function am(t,e,r){if(Q(r)!=="number")return xn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=Oa(t.stops.map(a=>a[0]),r,"");return t.stops[n][1]}function sf(t,e,r){let i=t.base===void 0?1:t.base;if(Q(r)!=="number")return xn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=Oa(t.stops.map(h=>h[0]),r,""),s=om(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=gr[e.type]||em;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function sm(t,e,r){switch(e.type){case"color":r=gt.parse(r);break;case"formatted":r=ze.fromString(r.toString());break;case"resolvedImage":r=_e.fromString(r.toString());break;case"padding":r=Ae.parse(r);break;case"colorArray":r=oe.parse(r);break;case"numberArray":r=Se.parse(r);break;default:Q(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return xn(r,t.default,e.default)}function om(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function so(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}var Il=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new Ap,this._defaultValue=r?pf(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ft(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(", ")}, but found ${JSON.stringify(s)} instead.`,"");return s}catch(s){let o=s instanceof ft?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(of(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function of(t,e,r,i){return`${t}${e}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function lf(t){if(!t)throw Error(\'rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".\')}function ja(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Yr}function er(t,e,r,i){lf(e);let n=new ef(Yr,ba,[],r?hm(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?so(new Il(a,e,r,i)):Nr(n.errors)}var an=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},wa=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?be.interpolationFactor(this.interpolationType,t,e,r):0}};function lm(t){return t._styleExpression!==void 0}function uf(t,e,r,i){let n=er(t,e,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Na(a);if(!s&&!ii(r))return Nr([new ve("","data expressions not supported")]);let o=Ua(a,["zoom"]);if(!o&&!nf(r))return Nr([new ve("","zoom expressions not supported")]);let l=pa(a);if(!l&&!o)return Nr([new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(l instanceof ve)return Nr([l]);if(l instanceof be&&!kl(r))return Nr([new ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!l)return so(s?new an("constant",n.value,i):new an("source",n.value,i));let u=l instanceof be?l.interpolation:void 0;return so(s?new wa("camera",n.value,l.labels,u,i):new wa("composite",n.value,l.labels,u,i))}var hf=class cf{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,lf(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=pf(i),this._warningHistory={};let n=af(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<"u"&&console.warn(of(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new cf(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function um(t,e,r,i){if(qa(t))return new hf(t,e,r);if(ja(t)){let n=uf(t,e,r,i);if(n.result==="error")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return n.value}{let n=t;return r.type==="color"&&typeof t=="string"?n=gt.parse(t):r.type==="padding"&&(typeof t=="number"||Array.isArray(t))?n=Ae.parse(t):r.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?n=Se.parse(t):r.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?n=oe.parse(t):r.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?n=De.parse(t):r.type==="projectionDefinition"&&typeof t=="string"&&(n=Dr.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function pa(t){let e=null;if(t instanceof Cp)e=pa(t.result);else if(t instanceof Rp){for(let r of t.args)if(e=pa(r),e)break}else(t instanceof vl||t instanceof be)&&t.input instanceof _r&&t.input.name==="zoom"&&(e=t);return e instanceof ve||t.eachChild(r=>{let i=pa(r);i instanceof ve?e=i:!e&&i?e=new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&i&&e!==i&&(e=new ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function vn(t,e=new Set){return t instanceof Fl&&e.add(t.key),t.eachChild(r=>{vn(r,e)}),e}function hm(t){let e={color:ce,string:Y,number:I,enum:Y,boolean:tt,formatted:yn,padding:za,numberArray:La,colorArray:Qi,projectionDefinition:Ba,resolvedImage:mn,variableAnchorOffsetCollection:Va};return t.type==="array"?Ut(e[t.value]||Z,t.length):e[t.type]}function pf(t){if(t.type==="color"&&qa(t.default))return new gt(0,0,0,0);switch(t.type){case"color":return gt.parse(t.default)||null;case"padding":return Ae.parse(t.default)||null;case"numberArray":return Se.parse(t.default)||null;case"colorArray":return oe.parse(t.default)||null;case"variableAnchorOffsetCollection":return De.parse(t.default)||null;case"projectionDefinition":return Dr.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ni(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=t!=null?t:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:e}}function cm(t){let e=!1;for(let r of t){let i=ff(r);if(i==="expression")return"expression";i==="legacy"&&(e=!0)}return e?"legacy":"neutral"}function ff(t){if(typeof t=="boolean")return"neutral";if(!Array.isArray(t)||t.length===0)return"legacy";switch(t[0]){case"has":return t.length<2||t[1]==="$id"||t[1]==="$type"?"legacy":t.length===2?"neutral":"expression";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return cm(t.slice(1));default:return"expression"}}function Cl(t){return ff(t)!=="legacy"}function kh(t){return t==="$type"?["geometry-type"]:t==="$id"?["id"]:["get",t]}function pm(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return t.length!==3||typeof t[1]!="string"?null:[t[0],kh(t[1]),t[2]];case"in":case"!in":{if(t.length<2||typeof t[1]!="string")return null;let e=["in",kh(t[1]),["literal",t.slice(2)]];return t[0]==="!in"?["!",e]:e}case"has":case"!has":{if(t.length!==2||typeof t[1]!="string"||t[1]==="$type"||t[1]==="$id")return null;let e=["has",t[1]];return t[0]==="!has"?["!",e]:e}default:return null}}function df(t){if((t[0]==="<"||t[0]==="<="||t[0]===">"||t[0]===">=")&&t[1]==="$type")return`"$type" cannot be use with operator "${t[0]}"`;let e=pm(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Os(t,e,r){let i=r[t];return Array.isArray(i)?Cl(i)?Ml(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Ml(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case"all":case"any":case"none":for(let r=1;r"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${e}${i}: ${df(r.legacyFilter)}`)}var dm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ai(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cl(t)?fm(t,e):t=Da(t);let i=er(t,e,dm,r);if(i.result==="error")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:yf(t),getGlobalStateRefs:()=>vn(i.value.expression)}}function ym(t,e){return te)}function yf(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Rs(t[1],t[2],e):e==="any"?mm(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Da)):e==="none"?["all"].concat(t.slice(1).map(Da).map(Xn)):e==="in"?Th(t[1],t.slice(2)):e==="!in"?Xn(Th(t[1],t.slice(2))):e==="has"?Ih(t[1]):e!=="!has"||Xn(Ih(t[1]))}function Rs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function mm(t){return["any"].concat(t.map(Da))}function Th(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(ym)]]:["filter-in-small",t,["literal",e]]}}function Ih(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Xn(t){return["!",t]}function mf(t){let e=t.key,r=t.value;return r?[new E(e,r,"constants have been deprecated as of v8")]:[]}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function xr(t){if(Array.isArray(t))return t.map(xr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=xr(t[r]);return e}return Dt(t)}function te(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=Q(r);if(u!=="object")return[new E(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=ji(i,c)||i["*"],f;if(ji(n,c))f=n[c];else if(ji(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new E(e,r[h],`unknown property "${h}"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new E(e,r,`missing required property "${h}"`));return l}function Bl(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(Q(e)!=="array")return[new E(s,e,`array expected, ${Q(e)} found`)];if(r.length&&e.length!==r.length)return[new E(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),Q(r.value)==="object"&&(l=r.value);let u=[];for(let h=0;hi.maximum?[new E(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new E(e,r,`number expected, ${n} found`)]}function gf(t){let e=t.valueSpec,r=Dt(t.value.type),i,n={},a,s,o=r!=="categorical"&&t.value.property===void 0,l=!o,u=Q(t.value.stops)==="array"&&Q(t.value.stops[0])==="array"&&Q(t.value.stops[0][0])==="object",h=te({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r==="identity"&&o&&h.push(new E(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&h.push(new E(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!kl(t.valueSpec)&&h.push(new E(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ii(t.valueSpec)?h.push(new E(t.key,t.value,"property functions not supported")):o&&!nf(t.valueSpec)&&h.push(new E(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&h.push(new E(t.key,t.value,\'"property" property is required\')),h;function c(y){if(r==="identity")return[new E(y.key,y.value,\'identity function may not have a "stops" property\')];let m=[],g=y.value;return m=m.concat(Bl({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),Q(g)==="array"&&g.length===0&&m.push(new E(y.key,g,"array must have at least one stop")),m}function p(y){let m=[],g=y.value,x=y.key;if(Q(g)!=="array")return[new E(x,g,`array expected, ${Q(g)} found`)];if(g.length!==2)return[new E(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(Q(g[0])!=="object")return[new E(x,g,`object expected, ${Q(g[0])} found`)];if(g[0].zoom===void 0)return[new E(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new E(x,g,"object stop key must have value")];if(s&&s>Dt(g[0].zoom))return[new E(x,g[0].zoom,"stop zoom values must appear in ascending order")];Dt(g[0].zoom)!==s&&(s=Dt(g[0].zoom),a=void 0,n={}),m=m.concat(te({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Ga,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return ja(xr(g[1]))?m.concat([new E(`${x}[1]`,g[1],"expressions are not allowed in function stops.")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=Q(y.value),x=Dt(y.value),v=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new E(y.key,v,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new E(y.key,v,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let b=`number expected, ${g} found`;return ii(e)&&r===void 0&&(b+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new E(y.key,v,b)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new E(y.key,v,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&xnew E(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new E(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ua(r,["zoom","feature-state"]))return[new E(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Na(r))return[new E(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gm(t){let e=t.value,r=t.key,i=Q(e);return i==="boolean"?[]:[new E(r,e,`boolean expected, ${i} found`)]}function oo(t){let e=t.key,r=t.value,i=Q(r);return i==="string"?gt.parse(String(r))?[]:[new E(e,r,`color expected, "${r}" found`)]:[new E(e,r,`color expected, ${i} found`)]}function sn(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function xm(t,e){let r=t;for(let i of e)r=r[i];return r}function vm(t,e){let r=Ml(e);return r?[new E(`${t.key}${r.path.map(i=>`[${i}]`).join("")}`,xm(t.value,r.path),df(r.legacyFilter),null,"warning")]:[]}function Pl(t){let e=xr(t.value);return Cl(e)?[...vm(t,e),...si(nn({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:xf(t)}function xf(t){let e=t.value,r=t.key;if(Q(e)!=="array")return[new E(r,e,`array expected, ${Q(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new E(r,e,"filter array must have at least 1 element")];switch(a=a.concat(sn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Dt(e[1])==="$type"&&a.push(new E(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new E(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Q(e[1]),n!=="string"&&a.push(new E(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s{c in r&&e.push(new E(i,r[c],`"${c}" is prohibited for ref layers`))});let h;n.layers.forEach(c=>{Dt(c.id)===o&&(h=c)}),h?h.ref?e.push(new E(i,r.ref,"ref cannot reference another ref layer")):s=Dt(h.type):e.push(new E(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)e.push(new E(i,r,\'missing required property "source"\'));else{let h=n.sources&&n.sources[r.source],c=h&&Dt(h.type);h?c==="vector"&&s==="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster source`)):c!=="raster-dem"&&s==="hillshade"||c!=="raster-dem"&&s==="color-relief"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster-dem source`)):c==="raster"&&s!=="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a vector source`)):c==="vector"&&!r["source-layer"]?e.push(new E(i,r,`layer "${r.id}" must specify a "source-layer"`)):c==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?e.push(new E(i,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):s==="line"&&r.paint&&r.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&e.push(new E(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new E(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&((l=r.paint)!=null&&l.resampling)&&((u=r.paint)!=null&&u["raster-resampling"])&&e.push(new E(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),e=e.concat(te({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Pl,layout(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return wf(nn({layerType:s},c))}}})},paint(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return bf(nn({layerType:s},c))}}})}}})),e}function tr(t){let e=t.value,r=t.key,i=Q(e);return i==="string"?[]:[new E(r,e,`string expected, ${i} found`)]}function bm(t){var c;let e=(c=t.sourceName)!=null?c:"",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=Q(r);if(r===void 0)return s;if(o!=="object")return s.push(new E("source_raster_dem",r,`object expected, ${o} found`)),s;let l=Dt(r.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let p in r)!l&&u.includes(p)?s.push(new E(p,r[p],`In "${e}": "${p}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):n[p]?s=s.concat(t.validateSpec({key:p,value:r[p],valueSpec:n[p],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new E(p,r[p],`unknown property "${p}"`));return s}var Ch={promoteId:wm};function _f(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new E(r,e,\'"type" is required\')];let s=Dt(e.type),o;switch(s){case"vector":case"raster":return o=te({key:r,value:e,valueSpec:i[`source_${s.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Ch,validateSpec:a}),o;case"raster-dem":return o=bm({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=te({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Ch}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...si({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:"cluster-map"})),o.push(...si({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return te({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return te({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new E(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function wm({key:t,value:e}){if(Q(e)==="string")return tr({key:t,value:e});{let r=[];for(let i in e)r.push(...tr({key:`${t}.${i}`,value:e[i]}));return r}}function Af(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("light",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(Tl);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)])}return a}function Sf(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=Q(e);if(e===void 0)return[];if(a!=="object")return[new E("sky",e,`object expected, ${a} found`)];let s=[];for(let o in e){let l=o.match(Tl);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,style:n,styleSpec:r})):i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new E(o,e[o],`unknown property "${o}"`)])}return s}function Ef(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("terrain",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)]);return a}function Dm(t){return tr(t).length===0?[]:si(t)}function _m(t){return tr(t).length===0?[]:si(t)}function Am(t){let e=t.key,r=t.value;if(Q(r)==="array"){if(r.length<1||r.length>4)return[new E(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a[new E(t,e,\'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"\')],n=r.match(Mm);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>Mh||u>Mh?[new E(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new E(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function Tf(t){var o,l;let e=(o=t.key)!=null?o:"font-faces",r=t.value,i=t.validateSpec,n=(l=t.styleSpec)!=null?l:pp,a=t.style;if(!lo(r))return[new E(e,r,`object expected, ${Q(r)} found`)];let s=[];for(let u in r){let h=r[u],c=Q(h);if(c==="string")s.push(...tr({key:`${e}.${u}`,value:h}));else if(c==="array"){let p={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[f,d]of h.entries()){let y=`${e}.${u}[${f}]`;s.push(...te({key:y,value:d,valueSpec:p,styleSpec:n,style:a,validateSpec:i}));let m=lo(d)?d["unicode-range"]:void 0;if(Q(m)==="array")for(let[g,x]of m.entries())s.push(...Bm(`${y}.unicode-range[${g}]`,x))}}else s.push(new E(`${e}.${u}`,h,`string or array expected, ${c} found`))}return s}var Bh={"*"(){return[]},array:Bl,boolean:gm,number:Ga,color:oo,constants:mf,enum:sn,filter:Pl,function:gf,layer:Df,object:te,source:_f,light:Af,sky:Sf,terrain:Ef,projection:km,projectionDefinition:Tm,string:tr,formatted:Dm,resolvedImage:_m,padding:Am,numberArray:Sm,colorArray:Em,variableAnchorOffsetCollection:Fm,sprite:Ff,state:kf,fontFaces:Tf};function Xi(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Xi,r.expression&&qa(Dt(e))?gf(t):r.expression&&ja(xr(e))?si(t):r.type&&Bh[r.type]?Bh[r.type](t):te(nn({},t,{valueSpec:r.type?i[r.type]:r}))}function If(t){let e=t.value,r=t.key,i=tr(t);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{range}" token\'))),i}function Qt(t,e=w){let r=[];return r=r.concat(Xi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xi,objectElementValidators:{glyphs:If,"*"(){return[]}}})),t.constants&&(r=r.concat(mf({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Xi}))),Cf(r)}Qt.source=ie(re(_f)),Qt.sprite=ie(re(Ff)),Qt.glyphs=ie(re(If)),Qt.fontFaces=ie(re(Tf)),Qt.light=ie(re(Af)),Qt.sky=ie(re(Sf)),Qt.terrain=ie(re(Ef)),Qt.state=ie(re(kf)),Qt.layer=ie(re(Df)),Qt.filter=ie(re(Pl)),Qt.paintProperty=ie(re(bf)),Qt.layoutProperty=ie(re(wf));function re(t){return function(e){return t(Object.assign({},e,{validateSpec:Xi}))}}function Cf(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function ie(t){return function(...e){return Cf(t.apply(this,e))}}var Pm={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"},zm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){var t;return(t=this._literalValue)!=null?t:this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none"){this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=er(t,this._rootKey,Pm,this._globalState);if(e.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=vn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Lm(t,e,r){return new zm(t,e,r)}var Ph=Qt,y5=new Set(Object.keys(w).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function Vm(t,e){let r=!1;for(let i of e){if(i.severity==="warning"){Bt(i.message);continue}t.fire(new ma(Error(i.message))),r=!0}return r}function Om(t,e,r,i){return(i==null?void 0:i.validate)!==!1&&Vm(t,e(je({styleSpec:w},r)))}var uo=class Mf{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if((!l||l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;sr?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}},$m="-transition",Xa=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=um(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},ho=class{constructor(t,e,r){this.property=t,this.value=new Xa(t,void 0,e,r)}transitioned(t,e){return new Lh(this.property,this.value,e,Gt({},t.transition,this.transition),t.now)}untransitioned(){return new Lh(this.property,this.value,null,{},0)}},Nm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return He(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Xa(this._values[t].property,e===null?void 0:He(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return He(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=He(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${$m}`]=i)}return t}transitioned(t,e){let r=new Vh(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Vh(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Lh=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(ii.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Lf=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new st(Math.floor(e.zoom-1),e)),t.expression.evaluate(new st(Math.floor(e.zoom),e)),t.expression.evaluate(new st(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Wa=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},Xt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Xa(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new ho(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",N),C("DataConstantProperty",V),C("CrossFadedDataDrivenProperty",on),C("CrossFadedProperty",Lf),C("ColorRampProperty",Wa);var Rh=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",$s=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",de=class extends O1{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Lm(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=ai(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Um(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new Nm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=ai(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if(t==="visibility")return this.visibility;if((e=this._transitionablePaint)!=null&&e.hasProperty(t))throw Error(t+Rh);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var e;let t=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let i=this._transitionablePaint._values[r].value;for(let n of i.getGlobalStateRefs()){let a=(e=t.get(n))!=null?e:[];a.push({name:r,value:i.value}),t.set(n,a)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){var i;if(t==="visibility"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if((i=this._transitionablePaint)!=null&&i.hasProperty(t)){this.fire(new ma(Error(t+Rh)));return}e!=null&&this._validate(Ph.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,r;if(t.endsWith("-transition")){let i=t.slice(0,-11);if(i==="visibility"||(e=this._unevaluatedLayout)!=null&&e.hasProperty(i))throw Error(t+$s);return this._transitionablePaint.getTransition(i)}if(t==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(t))throw Error(t+$s);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){var i;if(t==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(t))return this.fire(new ma(Error(t+$s))),!1;if(e!=null&&this._validate(Ph.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let n=this._transitionablePaint._values[t],a=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let l=this._transitionablePaint._values[t].value;return l.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(t,o,l)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){var e,r;let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)==null?void 0:e.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),T1(t,(i,n)=>i!==void 0&&!(n==="layout"&&!Object.keys(i).length)&&!(n==="paint"&&!Object.keys(i).length))}_validate(t,e,r,i,n={}){return Om(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof se&&ii(e.property.specification)&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}},qm,jm=()=>qm||(qm=new Xt({"raster-opacity":new V(w.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new V(w.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new V(w.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new V(w.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new V(w.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new V(w.paint_raster["raster-contrast"],"raster-contrast"),resampling:new V(w.paint_raster.resampling,"resampling"),"raster-resampling":new V(w.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new V(w.paint_raster["raster-fade-duration"],"raster-fade-duration")})),Gm={get paint(){return jm()}};var Xm=class extends de{constructor(t,e){super(t,Gm,e)}},Ym={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},bn=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},xt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function At(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Wm(n.type),s=r=$h(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:$h(r,Math.max(i,e)),alignment:e}}function Wm(t){return Ym[t].BYTES_PER_ELEMENT}function $h(t,e){return Math.ceil(t/e)*e}var ln=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};ln.prototype.bytesPerElement=4,C("StructArrayLayout2i4",ln);var co=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};co.prototype.bytesPerElement=6,C("StructArrayLayout3i6",co);var Nh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Nh.prototype.bytesPerElement=8,C("StructArrayLayout4i8",Nh);var po=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};po.prototype.bytesPerElement=12,C("StructArrayLayout2i4i12",po);var fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};fo.prototype.bytesPerElement=8,C("StructArrayLayout2i4ub8",fo);var un=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};un.prototype.bytesPerElement=8,C("StructArrayLayout2f8",un);var yo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};yo.prototype.bytesPerElement=20,C("StructArrayLayout10ui20",yo);var mo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};mo.prototype.bytesPerElement=16,C("StructArrayLayout8ui16",mo);var go=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};go.prototype.bytesPerElement=28,C("StructArrayLayout4i4ui4i1f28",go);var xo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};xo.prototype.bytesPerElement=12,C("StructArrayLayout3f12",xo);var vo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};vo.prototype.bytesPerElement=4,C("StructArrayLayout1ul4",vo);var bo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};bo.prototype.bytesPerElement=20,C("StructArrayLayout6i1ul2ui20",bo);var wo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};wo.prototype.bytesPerElement=12,C("StructArrayLayout2i2i2i12",wo);var Uh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};Uh.prototype.bytesPerElement=16,C("StructArrayLayout2f1f2i16",Uh);var Do=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};Do.prototype.bytesPerElement=16,C("StructArrayLayout2ub2f2i16",Do);var _o=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};_o.prototype.bytesPerElement=6,C("StructArrayLayout3ui6",_o);var Ao=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let v=t*26,b=t*13,D=t*52;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=i,this.uint16[v+3]=n,this.uint32[b+2]=a,this.uint32[b+3]=s,this.uint32[b+4]=o,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[b+7]=c,this.float32[b+8]=p,this.uint8[D+36]=f,this.uint8[D+37]=d,this.uint8[D+38]=y,this.uint32[b+10]=m,this.int16[v+22]=g,this.float32[b+12]=x,t}};Ao.prototype.bytesPerElement=52,C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ao);var So=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P){let L=this.length;return this.resize(L+1),this.emplace(L,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P,L){let F=t*34,$=t*17;return this.int16[F+0]=e,this.int16[F+1]=r,this.int16[F+2]=i,this.int16[F+3]=n,this.int16[F+4]=a,this.int16[F+5]=s,this.int16[F+6]=o,this.int16[F+7]=l,this.uint16[F+8]=u,this.uint16[F+9]=h,this.uint16[F+10]=c,this.uint16[F+11]=p,this.uint16[F+12]=f,this.uint16[F+13]=d,this.uint16[F+14]=y,this.uint16[F+15]=m,this.uint16[F+16]=g,this.uint16[F+17]=x,this.uint16[F+18]=v,this.uint16[F+19]=b,this.uint16[F+20]=D,this.uint16[F+21]=A,this.uint16[F+22]=_,this.uint32[$+12]=S,this.float32[$+13]=k,this.float32[$+14]=z,this.uint16[F+30]=O,this.uint16[F+31]=P,this.float32[$+16]=L,t}};So.prototype.bytesPerElement=68,C("StructArrayLayout8i15ui1ul2f2ui1f68",So);var _a=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};_a.prototype.bytesPerElement=4,C("StructArrayLayout1f4",_a);var Eo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};Eo.prototype.bytesPerElement=12,C("StructArrayLayout1ui2f12",Eo);var Fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};Fo.prototype.bytesPerElement=8,C("StructArrayLayout1ul2ui8",Fo);var ko=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};ko.prototype.bytesPerElement=4,C("StructArrayLayout2ui4",ko);var qh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};qh.prototype.bytesPerElement=2,C("StructArrayLayout1ui2",qh);var To=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};To.prototype.bytesPerElement=16,C("StructArrayLayout4f16",To);var Vf=class extends bn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new B(this.anchorPointX,this.anchorPointY)}};Vf.prototype.size=20;var Ll=class extends bo{get(t){return new Vf(this,t)}};C("CollisionBoxArray",Ll);var Of=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Of.prototype.size=52;var Rf=class extends Ao{get(t){return new Of(this,t)}};C("PlacedSymbolArray",Rf);var $f=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};$f.prototype.size=68;var Nf=class extends So{get(t){return new $f(this,t)}};C("SymbolInstanceArray",Nf);var Uf=class extends _a{getoffsetX(t){return this.float32[t*1+0]}};C("GlyphOffsetArray",Uf);var qf=class extends co{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};C("SymbolLineVertexArray",qf);var jf=class extends bn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};jf.prototype.size=12;var Gf=class extends Eo{get(t){return new jf(this,t)}};C("TextAnchorOffsetArray",Gf);var Xf=class extends bn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Xf.prototype.size=8;var Yf=class extends Fo{get(t){return new Xf(this,t)}};C("FeatureIndexArray",Yf);var Zm=class extends ln{};var Hm=class extends ln{},Km=class extends ln{},Jm=class extends po{},Qm=class extends fo{},tg=class extends un{},Vr=class extends yo{},jh=class extends mo{},eg=class extends go{},rg=class extends xo{},ig=class extends vo{},Gh=class extends wo{};var ng=class extends Do{};var wn=class extends _o{},Io=class extends ko{};var Co=At([{name:"a_pos",components:2,type:"Int16"}],4),ag=Co.members;Co.size,Co.alignment;var ee=class Ur{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Ur.MAX_VERTEX_ARRAY_LENGTH&&Bt(`Max vertices per segment is ${Ur.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${Ur.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Ur.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new Ur([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};ee.MAX_VERTEX_ARRAY_LENGTH=2**16-1,C("SegmentVector",ee);function Xh(t,e){return t=Ji(Math.floor(t),0,255),e=Ji(Math.floor(e),0,255),256*t+e}var sg=At([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),og=At([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),lg=fl(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),ug=fl(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),Mo=h1(fl(((t,e)=>{var r=lg(),i=ug();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),Wf=class Zf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Yh(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=Yh(e),i=0,n=this.ids.length-1;for(;i>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Bo(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Zf;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Yh(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Mo.default)(String(t))}function Bo(t,e,r,i){for(;r>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]n);if(a>=s)break;Yn(t,a,s),Yn(e,3*a,3*s),Yn(e,3*a+1,3*s+1),Yn(e,3*a+2,3*s+2)}s-r`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new cg(t,e):new Ol(t,e)}},ur=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i==="u_pattern_to"?n=this.patternTo:i==="u_pattern_from"?n=this.patternFrom:i==="u_dasharray_to"?n=this.dashTo:i==="u_dasharray_from"?n=this.dashFrom:i==="u_pixel_ratio_to"?n=this.pixelRatioTo:i==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new hg(t,e):new Ol(t,e)}},ke=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new st(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type==="color"){let i=Po(r);for(let n=t;n`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new st(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new st(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(this.zoom,n),r,i),s=this.expression.evaluate(new st(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=Po(r),a=Po(i);for(let s=t;s`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof ke||r instanceof he)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof Ye){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof $i||r instanceof ur||r instanceof he)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof $i||n instanceof ur||n instanceof he){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof Ye){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ke||r instanceof he)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof ke||r instanceof he||r instanceof Ye)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ke||e instanceof he||e instanceof Ye)&&e.destroy()}}},vr=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Jf(i,e,r);this.needsUpload=!1,this._featureMap=new Wf,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function pg(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function fg(t){return{"line-pattern":{source:Vr,composite:Vr},"fill-pattern":{source:Vr,composite:Vr},"fill-extrusion-pattern":{source:Vr,composite:Vr},"line-dasharray":{source:jh,composite:jh}}[t]}function Wh(t,e,r){var n;let i={color:{source:un,composite:To},number:{source:_a,composite:un}};return((n=fg(t))==null?void 0:n[r])||i[e][r]}C("ConstantBinder",$i),C("CrossFadedConstantBinder",ur),C("SourceExpressionBinder",ke),C("CrossFadedPatternBinder",Hf),C("CrossFadedDasharrayBinder",Kf),C("CompositeExpressionBinder",he),C("ProgramConfiguration",Jf,{omit:["_buffers"]}),C("ProgramConfigurationSet",vr);var zo=2**14-1,Zh=-zo-1;function Ar(t){let e=mt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Ji(a,Zh,zo),n.y=Ji(s,Zh,zo),(an.x+1||sn.y+1)&&Bt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function hi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ar(t):[]}}var Hh=-32768;function dg(t,e,r,i,n){t.emplaceBack(Hh+e*8+i,Hh+r*8+n)}var Rl=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Hm,this.indexArray=new wn,this.segments=new ee,this.programConfigurations=new vr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),o||(o=c.paint.get("circle-pitch-alignment")==="map")}let l=o?e.subdivisionGranularity.circle:1,u=new st(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=hi(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Ar(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ag),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f=3){for(let n of i)if(oi(t,n))return!0}if(gg(t,i,r))return!0}return!1}function gg(t,e,r){if(t.length>1){if($l(t,e))return!0;for(let i of e)if(Lo(i,t,r))return!0}for(let i of t)if(Lo(i,e,r))return!0;return!1}function $l(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function Kh(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;oe.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function oi(t,e){let r=!1;for(let i=0,n=t.length-1;ie.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function vg(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(e,r),new B(e,n),new B(i,n),new B(i,r)];if(t.length>2){for(let s of a)if(oi(t,s))return!0}for(let s=0;sn.x&&e.x>n.x||t.yn.y&&e.y>n.y)return!1;let a=Ke(t,e,r[0]);return a!==Ke(t,e,r[1])||a!==Ke(t,e,r[2])||a!==Ke(t,e,r[3])}function Wr(t,e,r){let i=e.paint.get(t).value;return i.kind==="constant"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ha(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ka(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=B.convert(e)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function wg(t){let e=[];for(let r=0;rNl(n,e,r,i))}var kg,Tg=()=>kg||(kg=new Xt({"circle-sort-key":new N(w.layout_circle["circle-sort-key"],"circle-sort-key")})),Ig,Cg=()=>Ig||(Ig=new Xt({"circle-radius":new N(w.paint_circle["circle-radius"],"circle-radius"),"circle-color":new N(w.paint_circle["circle-color"],"circle-color"),"circle-blur":new N(w.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new N(w.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new V(w.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new V(w.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new V(w.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new V(w.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new N(w.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new N(w.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new N(w.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})),Mg={get paint(){return Cg()},get layout(){return Tg()}};var Bg=class extends de{constructor(t,e){super(t,Mg,e)}createBucket(t){return new Rl(t)}queryRadius(t){let e=t;return Wr("circle-radius",this,e)+Wr("circle-stroke-width",this,e)+Ha(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ka(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),h=this.paint.get("circle-pitch-scale"),c=this.paint.get("circle-pitch-alignment"),p,f;return c==="map"?(p=l,f=u*a):(p=Fg(l,n,s,o),f=u),ed({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},rd=class extends Rl{};C("HeatmapBucket",rd,{omit:["layers"]});var Pg,zg=()=>Pg||(Pg=new Xt({"heatmap-radius":new N(w.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new N(w.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new V(w.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Wa(w.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new V(w.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})),Lg={get paint(){return zg()}};function Ul(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function id(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Ul({},{width:e,height:r},i);ql(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function ql(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,o=e.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s$g||($g=new Xt({"hillshade-illumination-direction":new V(w.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new V(w.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new V(w.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new V(w.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new V(w.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new V(w.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new V(w.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new V(w.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new V(w.paint_hillshade.resampling,"resampling")})),Ug={get paint(){return Ng()}};var qg=class extends de{constructor(t,e){super(t,Ug,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(ch);return{directionRadians:t.map(ch),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},jg,Gg=()=>jg||(jg=new Xt({"color-relief-opacity":new V(w["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Wa(w["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new V(w["paint_color-relief"].resampling,"resampling")})),Xg={get paint(){return Gg()}};function Wn(t){return"data"in t}var Jh=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){var u;let{width:i,height:n}=t,a=(((u=this.size)==null?void 0:u[0])!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!(e!=null&&e.useMipmap),a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&(e==null?void 0:e.premultiply)!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let h=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,h,o.RGBA8,i,n),Wn(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:c}=t;l&&c&&(c=Ns(c)),c&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,c)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:h,y:c}=r||{x:0,y:0};Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,h,c,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,h,c,o))}this.useMipmap&&!(Wn(t)&&t.data===null)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=Ns(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=Ns(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Pe,jl=(Pe=class{constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){Bt(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),Pe.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;hthis.max&&(this.max=f),f=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+2)*this.stride+i+2)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-2||e>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(e+2)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return sd(e,this.getUnpackVector())}getPixels(){return new Zt({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-2;break;case 1:a=n+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;ph&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Ro(a,s,o,l,u),s}function od(t,e,r,i,n){let a=null;if(n===fx(t,e,r,i)>0)for(let s=e;s=e;s-=i)a=ec(s/i|0,t[s],t[s+1],a);return a&&cn(a,a.next)&&(fn(a),a=a.next),a}function br(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(hn.size===0||!hn.has(i))&&(cn(i,i.next)||Ft(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),Oo=!0,fn(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function Ro(t,e,r,i,n){n&&ox(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(Ft(o,t,l)<0&&(n?Kg(t,r,i,n):Hg(t))){e.push(o.i,t.i,l.i),fn(t),t=l,a=l;continue}if(t=l,t===a){if(Oo=!1,t=br(t),Oo){a=t;continue}if(!s){t=Jg(t,e),a=t,s=!0;continue}Qg(t,e,r,i,n);break}}}function Hg(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&Ea(n,o,a,l,s,u,d.x,d.y)&&Ft(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Kg(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=qo(f,d,e,r,i),x=qo(y,m,e,r,i),v=t.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&Ea(o,h,l,c,u,p,v.x,v.y)&&Ft(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=t.nextZ;for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&Ea(o,h,l,c,u,p,b.x,b.y)&&Ft(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Jg(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;ud(n,r,r.next,a,!1)&&pn(n,a)&&pn(a,n)&&(e.push(n.i,r.i,a.i),fn(r),fn(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?br(r):r}function Qg(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&hx(a,s)){let o=hd(a,s);a=br(a,a.next),o=br(o,o.next),Ro(a,e,r,i,n),Ro(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var $o=!1;function tx(t,e,r,i){let n=[];for(let a=0,s=e.length;as&&(s=r.x),r.yo&&(o=r.y),h.xs&&(s=h.x),h.yo&&(o=h.y),r=h}while(++l<16&&r!==e);Uo[i]=r;let u=i*4;wt[u]=n,wt[u+1]=a,wt[u+2]=s,wt[u+3]=o}while(r!==e)}function nx(t,e){let r=t.z*4;e.xwt[r+2]&&(wt[r+2]=e.x),e.y>wt[r+3]&&(wt[r+3]=e.y)}function Qh(t){let e=Uo[t];for(;e.prev.next!==e;)e=e.next;return Uo[t]=e,e}function tc(t){let e=No[t];for(;e.prev.next!==e;)e=e.next;return No[t]=e,e}function ax(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(cn(t,r))return r;for(let p=0,f=0;pwt[f+3]||wt[f]>i||wt[f+2]<=a)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r){if(cn(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.xi||wt[f+3]h)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&Ea(ni)&&(ys.x||r.x===s.x&&sx(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function sx(t,e){return Ft(t.prev,t,e.prev)<0&&Ft(e.next,t,t.next)<0}var ae=[],Ti=[],or=new Uint32Array,Ii=new Uint32Array,Ci=new Uint32Array(256);function ox(t,e,r,i){let n=t,a=0;do n.z=qo(n.x,n.y,e,r,i),ae[a++]=n,n=n.next;while(n!==t);lx(a);let s=null;for(let o=0;o=0&&ae[n].z>i;)ae[n+1]=ae[n],n--;ae[n+1]=r}return}or.length>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=Ci[o];Ci[o]=s,s+=l}for(let o=0;o>>a&255]++;i[u]=e[o],n[u]=l}}function qo(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function ux(t){let e=t,r=t;do(e.x=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function hx(t,e){let r=cn(t,e)&&Ft(t.prev,t,t.next)>0&&Ft(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||pn(t,e)&&pn(e,t)&&(Ft(t.prev,t,e.prev)!==0||Ft(t,e.prev,e)!==0))&&!cx(t,e)&&(r||px(t,e))}function Ft(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function cn(t,e){return t.x===e.x&&t.y===e.y}function ud(t,e,r,i,n=!0){let a=Ft(t,e,r),s=Ft(t,e,i),o=Ft(r,i,t),l=Ft(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Hn(t,r,e)||s===0&&Hn(t,i,e)||o===0&&Hn(r,t,i)||l===0&&Hn(r,e,i)):!1}function Hn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function cx(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.xa&&o.y>a||s.y=0&&Ft(t,t.prev,e)>=0:Ft(t,e,t.prev)<0||Ft(t,t.next,e)<0}function px(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function hd(t,e){let r=jo(t.i,t.x,t.y),i=jo(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function ec(t,e,r,i){let n=jo(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function fn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),$o&&nx(t.prev,t.next)}function jo(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function fx(t,e,r,i){let n=0;for(let a=e,s=r-i;at)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return gx(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i=1||b<=0)||m&&(ln)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&v>0){let _=o+f*v,S=l+d*v;a.push(this._vertexToIndex(_,S))}let D=o+f*Math.max(v,0),A=o+f*Math.min(b,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,D,A),!m&&b<1){let _=o+f*b,S=l+d*b;a.push(this._vertexToIndex(_,S))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,A,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,b=o=1||m<=0){let _=e-a,S=r-s,k=(l-s)/S,z=(u-s)/S,O=a+_*Math.min(k,z);x=Math.floor(Math.min(O,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(O,o)/this._granularityCellSize)-1,b=o0?u:l;if(b)for(let _=x;_<=v;_++){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}else for(let _=v;_>=x;_--){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}}_generateOutline(t){let e=[];for(let r of t){let i=cr(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;sn==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=mt,a=t.length;for(let s=2;s=2&&((s=this._canonical)==null?void 0:s.z)===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(o=>this._removeLinesOutsideTileX(o))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,O=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,P=Math.abs(_-z),L=Math.abs(S-O),F=Math.abs(_-y),$=Math.abs(S-m),U=g?P/D:1/0,T=x?L/A:1/0;if((F<=P||!g)&&($<=L||!x))break;if(U0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function xx(t,e,r){if(e.length===0)throw Error("Subdivision vertex ring is empty.");let i=0,n=t[e[0]*2];for(let l=1;l=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(hp)x=!1;else{let v=g-y,b=-(m-d),D=y((p-d)*v+(f-y)*b)*D&&(x=!0)}if(x){let v=e[l],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),s--,s<0&&(s=a-1)}else{let v=e[u],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),o++,o>=a&&(o=0)}if(l===u)break}}function pd(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(uee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let v=Zi(s,i,a,o,p,y,u),b=Zi(s,i,a,o,f,m,u),D=Zi(s,i,a,o,d,g,u);r.emplaceBack(h+v-l,h+b-l,h+D-l),u.primitiveLength++}}function bx(t,e,r,i,n,a){let s=[];for(let c=0;cee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Zi(s,i,a,o,f,y,u),v=Zi(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+v-l),u.primitiveLength++}}var fd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Km,this.indexArray=new wn,this.indexArray2=new Io,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.segments2=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=Gl("fill",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:e,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let r in e.patterns){let i=e.patterns[r];this.recordSdfPattern(r,t[i.min]),this.recordSdfPattern(r,t[i.mid]),this.recordSdfPattern(r,t[i.max])}for(let e of this.layers){let r=e.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(e.id,t[r.from.toString()]),this.recordSdfPattern(e.id,t[r.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let r=e.sdf===!0,i=this.sdfPatterns[t];i===void 0?this.sdfPatterns[t]=r:i!==r&&Bt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t}"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wg),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Ra(e,500)){let o=cd(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;pd((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};C("FillBucket",fd,{omit:["layers","patternFeatures"]});var wx,Dx=()=>wx||(wx=new Xt({"fill-sort-key":new N(w.layout_fill["fill-sort-key"],"fill-sort-key")})),_x,Ax=()=>_x||(_x=new Xt({"fill-antialias":new V(w.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new N(w.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new V(w.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new N(w.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new N(w.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new V(w.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new V(w.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new on(w.paint_fill["fill-pattern"],"fill-pattern")})),Sx={get paint(){return Ax()},get layout(){return Dx()}};var Ex=class extends de{constructor(t,e){super(t,Sx,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new fd(t)}queryRadius(){return Ha(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Qf(Ka(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},Go=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fx=At([{name:"a_centroid",components:2,type:"Int16"}],4),kx=Go.members;Go.size,Go.alignment;var Fa=class Xo{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new Xo;return r.extend(e(new B(this.minX,this.minY))),r.extend(e(new B(this.maxX,this.minY))),r.extend(e(new B(this.minX,this.maxY))),r.extend(e(new B(this.maxX,this.maxY))),r}static fromPoints(e){let r=new Xo;for(let i of e)r.extend(i);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}},g5=Fa.fromPoints([new B(0,0),new B(mt,mt)]);function Yo(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function rc(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Dn=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),no&&(o=n),au&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:"LineString",coordinates:c[0]}:{type:"MultiLineString",coordinates:c}}else if(this.type===3){let c=dd(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};Dn.types=["Unknown","Point","LineString","Polygon"];function dd(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new Dn(this._pbf,e,this.extent,this._keys,this._values)}};function Cx(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ui(F1(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return yd*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof Ui)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ui(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e)return new Ui(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}},md=2*Math.PI*yd;function gd(t){return md*Math.cos(t*Math.PI/180)}function Mx(t){return(180+t)/360}function Bx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Px(t,e){return t/gd(e)}function zx(t){return t*360-180}function Wo(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Lx(t,e){return t*gd(Wo(e))}function Vx(t){return 1/Math.cos(t*Math.PI/180)}var Yl=class xd{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=ic.convert(e);return new xd(Mx(i.lng),Bx(i.lat),Px(r,i.lat))}toLngLat(){return new ic(zx(this.x),Wo(this.y))}toAltitude(){return Lx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/md*Vx(Wo(this.y))}};function Ox(t,e,r){let i=1/(1<Nx(n,i))}function $x(t,e){let r=Rx(mt/2,mt/2,e),i=Yl.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function qx(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var js=8192;function Mi(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*js)*2+s,n*js*2,a*js*2,Math.round(o))}var vd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Jm,this.centroidVertexArray=new Zm,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=Aa("fill-extrusion",this.layers,e);let i=new st(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=hi(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Ar(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?nc(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Gl("fill-extrusion",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures({options:t,canonical:e,patternPositions:r}){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Fx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?nc(e,o,i):e;for(let u of Ra(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y{Mi(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;iee.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function jx(t,e){for(let r=0;rGx||(Gx=new Xt({"fill-extrusion-rounded-corner-distance":new V(w["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})),Yx,Wx=()=>Yx||(Yx=new Xt({"fill-extrusion-opacity":new V(w["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new N(w["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new V(w["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new V(w["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new on(w["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new N(w["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new N(w["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new V(w["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})),Zx={get paint(){return Wx()},get layout(){return Xx()}};var Hx=class extends de{constructor(t,e){super(t,Zx,e)}createBucket(t){return new vd(t)}queryRadius(){return Ha(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ka(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=Qx(o,s,0),c=Jx(i,u,l,s),p=c[0],f=c[1];return Kx(p,f,h)}};function Bi(t,e){return t.x*e.x+t.y*e.y}function ac(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;pn){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);di&&(o-e>3&&Zo(t,e,o,i),t[o+2]=n,r-o>3&&Zo(t,o,r,i))}function t2(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function Mt(t,e,r,i){let n={type:e,geom:r},a={id:t!=null?t:null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":Pi(a,n.geom);break;case"LineString":Pi(a,n.geom.points);break;case"Polygon":Pi(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)Pi(a,s.points);break;case"MultiPolygon":for(let s of n.geom)Pi(a,s[0].points)}return a}function Wl(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Pi(t,e){for(let r=0;r1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(e.geometry.type==="GeometryCollection"){r2(t,e,e.geometry,r,i,n+1);return}if(!((o=e.geometry.coordinates)!=null&&o.length))return;let a=e2(e,r,i),s=(r.tolerance/((1<0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&Zo(e.points,0,o,r),e.points[o+2]=1,Wl(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function Kl(t,e,r,i){for(let n=0;n1?1:r}function u2(t){return{type:"FeatureCollection",features:t.map(e=>ka(e))}}function ka(t){let e={type:"Feature",geometry:h2(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function h2(t){let{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:bd(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:Kn(r)};case"LineString":return{type:e,coordinates:Kn(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map(i=>Kn(i.points))};case"MultiPolygon":return{type:e,coordinates:r.map(i=>i.map(n=>Kn(n.points)))}}}function Kn(t){let e=[];for(let r=0;r=r&&s=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c=i))switch(u.type){case"Point":case"MultiPoint":c2(u,l,r,i,n);continue;case"LineString":p2(u,l,r,i,n,o);continue;case"MultiLineString":f2(u,l,r,i,n);continue;case"Polygon":d2(u,l,r,i,n);continue;case"MultiPolygon":y2(u,l,r,i,n);continue}}return l.length?l:null}function c2(t,e,r,i,n){let a=[];if(m2(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";e.push(Mt(t.id,s,a,t.tags))}function p2(t,e,r,i,n,a){let s=[];if(_d(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(Mt(t.id,"LineString",o,t.tags));return}if(s.length>1){e.push(Mt(t.id,"MultiLineString",s,t.tags));return}e.push(Mt(t.id,"LineString",s[0],t.tags))}}function f2(t,e,r,i,n){let a=[];if(Jl(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(Mt(t.id,"LineString",a[0],t.tags));return}e.push(Mt(t.id,"MultiLineString",a,t.tags))}}function d2(t,e,r,i,n){let a=[];Jl(t.geometry,a,r,i,n,!0),a.length&&e.push(Mt(t.id,"Polygon",a,t.tags))}function y2(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];Jl(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(Mt(t.id,"MultiPolygon",a,t.tags))}function m2(t,e,r,i,n){for(let a=0;a=r&&s<=i&&Kr(e,t[a],t[a+1],t[a+2])}}function _d(t,e,r,i,n,a,s){let o=sc(t),l=n===0?g2:x2,u=t.start,h,c;for(let g=0;gr&&(c=l(o,x,v,D,A,r),s&&(o.start=u+h*c)):_>i?S=r&&(c=l(o,x,v,D,A,r),k=!0),S>i&&_<=i&&(c=l(o,x,v,D,A,i),k=!0),!a&&k&&(s&&(o.end=u+h*c),e.push(o),o=sc(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&Kr(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&Kr(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Wl(o),e.push(o))}function sc(t){return{points:[],size:t.size,start:t.start,end:t.end}}function Jl(t,e,r,i,n,a){for(let s of t)_d(s,e,r,i,n,a,!1)}function Kr(t,e,r,i){t.push(e,r,i)}function g2(t,e,r,i,n,a){let s=(a-e)/(i-e);return Kr(t.points,a,r+(n-r)*s,1),s}function x2(t,e,r,i,n,a){let s=(a-r)/(n-r);return Kr(t.points,e+(i-e)*s,a,1),s}function Ql(t,e){let r=e.buffer/e.extent,i=t,n=Te(t,1,-1-r,r,0,-1,2,e),a=Te(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=Te(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=oc(n,1).concat(i)),a&&(i=i.concat(oc(a,-1)))),i}function oc(t,e){let r=[];for(let i of t)switch(i.type){case"Point":case"MultiPoint":{let n=v2(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"LineString":{let n=Gs(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(Gs(a,e));r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(Gs(o,e));n.push(s)}r.push(Mt(i.id,i.type,n,i.tags));continue}}return r}function v2(t,e){let r=[];for(let i=0;io.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=Zl({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=Ql(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=w2(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function w2(t,e,r){var a,s;let i=!!e.newGeometry,n=e.removeAllProperties||((a=e.removeProperties)==null?void 0:a.length)>0||((s=e.addOrUpdateProperties)==null?void 0:s.length)>0;if(i){let o=t[0],l=Zl({type:"FeatureCollection",features:[{type:"Feature",id:o.id,geometry:e.newGeometry,properties:n?lc(o.tags,e):o.tags}]},r);return l=Ql(l,r),l}if(n){let o=[];for(let l of t){let u=je({},l);u.tags=lc(u.tags,e),o.push(u)}return o}return t}function lc(t,e){if(e.removeAllProperties)return{};let r=je({},t||{});if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function D2(t,e){var r,i;return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map((r=t.add)==null?void 0:r.map(n=>[e.promoteId?n.properties[e.promoteId]:n.id,n])),update:new Map((i=t.update)==null?void 0:i.map(n=>[n.id,n]))}:{remove:new Set,add:new Map,update:new Map}}var uc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],dt=new Uint32Array(96),_2=class Ad{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=uc[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new Ad(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=uc.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ho(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=[];for(;l>0;){let h=dt[--l],c=dt[--l],p=dt[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(dt[l++]=p,dt[l++]=f-1,dt[l++]=1-h),(h===0?i>=d:n>=y)&&(dt[l++]=f+1,dt[l++]=c,dt[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=dt[--l],p=dt[--l],f=dt[--l];if(p-f<=o){for(let g=f;g<=p;g++)hc(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];hc(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(dt[l++]=f,dt[l++]=d-1,dt[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(dt[l++]=d+1,dt[l++]=p,dt[l++]=1-c)}return u}};function Ho(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;Sd(t,e,s,i,n,a),Ho(t,e,r,i,s-1,1-a),Ho(t,e,r,s+1,n,1-a)}function Sd(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Sd(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(zi(t,e,i,r),e[2*n+a]>s&&zi(t,e,i,n);os;)l--}e[2*i+a]===s?zi(t,e,i,l):(l++,zi(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function zi(t,e,r,i){Xs(t,r,i),Xs(e,2*r,2*i),Xs(e,2*r+1,2*i+1)}function Xs(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function hc(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var Ko={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},A2=class{constructor(t){this.options=Object.assign(Object.create(Ko),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[Zr(i),Hr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type==="Point"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(Ko),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>ka(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(Zr(r),Hr(a),Zr(n),Hr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?S2(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?E2(a,p,this.clusterProps):ka(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||(e=10),r||(r=0);let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o!=null&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n1,u,h,c;if(l)u=tu(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;he&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,v=-1,b=((h/u|0)<<5)+(e+1)+this.points.length;for(let D of f){let A=D*u;if(o[A+2]<=e)continue;o[A+2]=e;let _=o[A+5];m+=o[A]*_,g+=o[A+1]*_,o[A+4]=b,n&&(x||(x=this.map(o,h,!0),v=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=b,l.push(m/y,g/y,1/0,b,-1,y),n&&l.push(v)}else{for(let m=0;m1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function S2(t,e,r){return{id:t[e+3],type:"Point",tags:tu(t,e,r),geometry:[t[e],t[e+1]]}}function E2(t,e,r){return{type:"Feature",id:t[e+3],properties:tu(t,e,r),geometry:{type:"Point",coordinates:[wd(t[e]),Dd(t[e+1])]}}}function tu(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var Ed="geojsonvt_clip_start",Fd="geojsonvt_clip_end";function cc(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;ls)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&M2(o,a),t.push(o)}function M2(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i0===e)for(let i=0,n=t.length;i1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=cc(t,i,n,a,r);s.source=t;let o=Jn(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Jn(o,l,u)];return!(h!=null&&h.source)||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:pc(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<1&&console.time("creation"),p=this.tiles[c]=cc(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let _=`z${e}`;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let _=n-e;if(r!==a>>_||i!==s>>_)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,v=null,b=null,D=Te(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=Te(t,h,r+d,r+m,0,p.minX,p.maxX,l);D&&(g=Te(D,h,i-f,i+y,1,p.minY,p.maxY,l),x=Te(D,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(v=Te(A,h,i-f,i+y,1,p.minY,p.maxY,l),b=Te(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(v||[],e+1,r*2+1,i*2),o.push(b||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<=f||s=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX=d&&g.minY1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Jn(t,e,r){return((1<24)throw Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw Error("promoteId and generateId cannot be used together.");let i=Zl(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),i=Ql(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new A2(e.clusterOptions):new z2(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=b2(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(ka(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return u2(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},Jo=At([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),V2=Jo.members;Jo.size,Jo.alignment;var Qo=At([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),O2=Qo.members;Qo.size,Qo.alignment;var R2=Math.cos(75/2*(Math.PI/180)),Id=1/2,fc=2**14/Id,Cd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Qm,this.layoutVertexArray2=new tg,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("line",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(Aa("line",this.layers,e)?Gl("line",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures({options:t,canonical:e,patternPositions:r,dashPositions:i}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,O2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,V2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties[Ed],end:+t.properties[Fd]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(t,{}),u=o.get("line-cap").evaluate(t,{}),h=o.get("line-miter-limit").evaluate(t,{}),c=o.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=cr(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c0;if(k&&v>c){let L=d.dist(y);if(L>2*p){let F=d.sub(d.sub(y)._mult(p/L)._round());this.updateDistance(y,F),this.addCurrentVertex(F,g,0,0,f),y=F}}let O=y&&m,P=O?r:u?"butt":i;if(O&&P==="round"&&(_n&&(P="bevel"),P==="bevel"&&(_>2&&(P="flipbevel"),_100)b=x.mult(-1);else{let L=_*g.add(x).mag()/g.sub(x).mag();b._perp()._mult(L*(z?-1:1))}this.addCurrentVertex(d,b,0,0,f),this.addCurrentVertex(d,b.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let L=-Math.sqrt(_*_-1),F=z?L:0,$=z?0:L;if(y&&this.addCurrentVertex(d,g,F,$,f),P==="fakeround"){let U=Math.round(S*180/Math.PI/20);for(let T=1;T2*p){let F=d.add(m.sub(d)._mult(p/L)._round());this.updateDistance(d,F),this.addCurrentVertex(F,x,0,0,f),d=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>fc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(fc-1):this.scaledDistance)*Id;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};C("LineBucket",Cd,{omit:["layers","patternFeatures"]});var $2,N2=()=>$2||($2=new Xt({"line-cap":new N(w.layout_line["line-cap"],"line-cap"),"line-join":new N(w.layout_line["line-join"],"line-join"),"line-miter-limit":new N(w.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new N(w.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new N(w.layout_line["line-sort-key"],"line-sort-key")})),U2,q2=()=>U2||(U2=new Xt({"line-opacity":new N(w.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new V(w.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new N(w.paint_line["line-color"],"line-color"),"line-translate":new V(w.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new V(w.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new N(w.paint_line["line-width"],"line-width"),"line-gap-width":new N(w.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new N(w.paint_line["line-offset"],"line-offset"),"line-blur":new N(w.paint_line["line-blur"],"line-blur"),"line-dasharray":new on(w.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new on(w.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Wa(w.paint_line["line-gradient"],"line-gradient")})),dc={get paint(){return q2()},get layout(){return N2()}},j2=class extends N{possiblyEvaluate(t,e){return e=new st(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Gt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Qn;var G2=class extends de{constructor(t,e){super(t,dc,e),this.gradientVersion=0,Qn||(Qn=new j2(dc.paint.properties["line-width"].specification,"line-floorwidth"),Qn.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=lm(e)?e._styleExpression.expression instanceof vl:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Qn.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Cd(t)}queryRadius(t){let e=t,r=yc(Wr("line-width",this,e),Wr("line-gap-width",this,e)),i=Wr("line-offset",this,e);return r/2+Math.abs(i)+Ha(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ka(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*yc(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(i=Dg(i,l*a)),mg(s,i,o)}isTileClipped(){return!0}};function yc(t,e){return e>0?e+2*t:t}var X2=At([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),Y2=At([{name:"a_projected_pos",components:3,type:"Float32"}],4);At([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var W2=At([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);At([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var mc=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x5=At([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);At([{name:"triangle",components:3,type:"Uint16"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Float32",name:"offsetX"}]),At([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),At([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var wr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(wr.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,e){return rt(this,null,function*(){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(yield e(r),yield Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};function Z2(t){return/[\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u077F\\u07C0-\\u07FA\\u07FD-\\u07FF\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\u1800\\u1801\\u1804\\u1806-\\u1819\\u1820-\\u1878\\u1880-\\u18AA\\uA840-\\uA877\\uFB50-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF80-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDD00-\\uDD27\\uDD30-\\uDD39\\uDE60-\\uDE7E\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDEFF\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB]|\\uD805[\\uDE60-\\uDE6C]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9C-\\uDC9F]|\\uD83A[\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function H2(t){return/[\\u0591-\\u05C7\\u05D0-\\u05EA\\u05EF-\\u05F4\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u07B1\\u07C0-\\u07FA\\u07FD-\\u082D\\u0830-\\u083E\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\uFB1D-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC57-\\uDC9E\\uDCA7-\\uDCAF\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDCFB-\\uDD1B\\uDD1F-\\uDD39\\uDD3F-\\uDD59\\uDD80-\\uDDB7\\uDDBC-\\uDDCF\\uDDD2-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE38-\\uDE3A\\uDE3F-\\uDE48\\uDE50-\\uDE58\\uDE60-\\uDE9F\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF00-\\uDF35\\uDF39-\\uDF55\\uDF58-\\uDF72\\uDF78-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDCFA-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD65\\uDD69-\\uDD85\\uDD8E\\uDD8F\\uDE60-\\uDE7E\\uDE80-\\uDEA9\\uDEAB-\\uDEAD\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDF27\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB\\uDFE0-\\uDFF6]|\\uD83A[\\uDC00-\\uDCC4\\uDCC7-\\uDCD6\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function K2(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function Qa(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1401-\\u167F\\u18B0-\\u18FF\\u2065\\u20DD-\\u20E0\\u20E2-\\u20E4\\u2B97\\u2BF0-\\u2BFF\\u2E50\\u2E51\\u2E80-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u30FB\\u30FD-\\uA4CF\\uA960-\\uA97F\\uAC00-\\uD7FF\\uF900-\\uFAFF\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7\\uFFF0-\\uFFF8]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|[\\uD80C-\\uD810\\uD81C-\\uD822\\uD83C\\uD83D\\uD840-\\uD87E\\uD880-\\uD8BE][\\uDC00-\\uDFFF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFFF]|\\uD823[\\uDC00-\\uDDFF]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFF]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83E[\\uDD00-\\uDEFF]|[\\uD87F\\uD8BF][\\uDC00-\\uDFFD]/gim.test(String.fromCodePoint(t))}function J2(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function Q2(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function gc(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u103F\\u1050-\\u108F\\u109A-\\u109F\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19DE\\u19DF\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1AA0-\\u1AAD\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9EF\\uA9FA-\\uA9FE\\uAA60-\\uAAC2\\uAADB-\\uAADF]|\\uD805[\\uDF00-\\uDF1A\\uDF1D-\\uDF2B\\uDF3A\\uDF3B\\uDF3F-\\uDF46]/gim.test(String.fromCodePoint(t))}function tv(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||new RegExp("^\\\\p{gc=Mc}","u").test(e)}var ev={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},rv={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},iv={\\u0644\\u0622:[65269,65270],\\u0644\\u0623:[65271,65272],\\u0644\\u0625:[65273,65274],\\u0644\\u0627:[65275,65276]},xc=1604,nv=/[\\u0600-\\u06ff\\u0750-\\u077f\\u0870-\\u089f\\u08a0-\\u08ff\\ufb50-\\ufdff\\ufe70-\\ufeff]/;function av(t,e,r){let i=0;for(let n of t.split(";")){let[a,s]=n.split(",").map(l=>parseInt(l,36)),o=i+a;for(let l=o;l{let r=e.codePointAt(0);return{codePoint:r,type:sv(r),form:null}})}function cv(t){let e=t.filter(r=>r.type!=="T");for(let r=0;r0&&ov(e[r-1].type),a=r+1String.fromCodePoint(dv(r))).join("")}function mv(t,e,r){var n;let i=e.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?t=t.toLocaleUpperCase():i==="lowercase"&&(t=t.toLocaleLowerCase()),((n=wr.applyArabicShaping)!=null?n:yv)(t)}function gv(t,e,r){for(let i of t.sections)i.text=mv(i.text,e,r);return t}function xv(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;uu.geometry)}var Bd=typeof Intl<"u"&&"Segmenter"in Intl,ta,ea;function tl(t){if(!Bd||!Q2(t))return[...t];ta!=null||(ta=new Intl.Segmenter(void 0,{granularity:"grapheme"}));let e=[];for(let{segment:r}of ta.segment(t)){let i=e.length-1;i>=0&&tv(e[i],r)?e[i]+=r:e.push(r)}return e}function vv(t){let e=new Set;if(Bd){ea!=null||(ea=new Intl.Segmenter(void 0,{granularity:"word"}));for(let{index:i}of ea.segment(t))e.add(i);return e}let r=0;for(let i of t.split(new RegExp("\\\\b|(?=\\\\p{Ideo})","u")))e.add(r),r+=i.length;return e}function Pd(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}function ru(t){return/\\s/u.test(String.fromCodePoint(t))}function el(t){for(let e of t)if(Qa(e.codePointAt(0)))return!0;return!1}function bv(t){for(let e of t)if(!wv(e.codePointAt(0)))return!1;return!0}function wv(t){return!Z2(t)}function vc(t){return!(Qa(t)||J2(t))}function zd(t){return new RegExp("\\\\p{sc=Arab}","u").test(String.fromCodePoint(t))}function Ld(t){return H2(t)}function Vd(t){for(let e of t)if(Ld(e.codePointAt(0)))return!0;return!1}var Gr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u22EF":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Dv(t){let e="",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!vc(s.value.codePointAt(0))||Gr[s.value])&&(r.premature||!vc(r.value.codePointAt(0))||Gr[r.value])&&Gr[n.value]?e+=Gr[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var _v={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Av={40:!0};function bc(t,e,r,i,n,a){if("fontStack"in e){let s=r[e.fontStack],o=s==null?void 0:s[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s==null?void 0:s[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function wc(t,e,r,i){let n=(t-e)**2;return i?tr&&Dc(e[i-1]);)i--;this.text=e.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(""),n=this.sectionIndex.slice(e,r);return new rl(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n0?i[i.length-1]:"",a=tl(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=K2(y),x=gc(y)&&gc(m);(_v[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&Av[m]||x&&(h!=null?h:h=vv(this.text)).has(p))&&s.push(_c(f,c,o,s,Sv(y,m,g&&l),!1))}ru(d.codePointAt(0))||(c+=bc(d,this.getSection(f),i,n,e,a)),p+=d.length}return Od(_c(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=bc(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}};function Ev(){return(function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(e).forEach(function(R,J){r[R]=1<1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function d(R,J){var W=0,M=new Map,ut=J&&new Map,X;return R.split(",").forEach(function G(K){if(K.indexOf("+")!==-1)for(var Nt=+K;Nt--;)G(X);else{X=K;var vt=K.split(">"),nt=vt[0],Tt=vt[1];nt=String.fromCodePoint(W+=parseInt(nt,36)),Tt=String.fromCodePoint(W+=parseInt(Tt,36)),M.set(nt,Tt),J&&ut.set(Tt,nt)}}),{map:M,reverseMap:ut}}var y,m,g;function x(){if(!y){var R=d(f.pairs,!0),J=R.map,W=R.reverseMap;y=J,m=W,g=d(f.canonical,!1).map}}function v(R){return x(),y.get(R)||null}function b(R){return x(),m.get(R)||null}function D(R){return x(),g.get(R)||null}var A=r.L,_=r.R,S=r.EN,k=r.ES,z=r.ET,O=r.AN,P=r.CS,L=r.B,F=r.S,$=r.ON,U=r.BN,T=r.NSM,q=r.AL,at=r.LRO,ot=r.RLO,pt=r.LRE,Et=r.RLE,qt=r.PDF,Ht=r.LRI,Ve=r.RLI,ye=r.FSI,Kt=r.PDI;function Oe(R,J){for(var W=125,M=new Uint32Array(R.length),ut=0;ut0)Fe--;else if(rs>0){for(Ne=0;!lt[lt.length-1]._isolate;)lt.pop();var is=lt[lt.length-1]._isolInitIndex;is!=null&&(Nt.set(is,zt),Nt.set(zt,is)),lt.pop(),rs--}bt=lt[lt.length-1],K[zt]=bt._level,bt._override&&G(zt,bt._override)}else Lt&qt?(Fe===0&&(Ne>0?Ne--:!bt._isolate&<.length>1&&(lt.pop(),bt=lt[lt.length-1])),K[zt]=bt._level):Lt&L&&(K[zt]=nt.level);else K[zt]=bt._level,bt._override&&Lt!==U&&G(zt,bt._override)}for(var Cr=[],me=null,ar=nt.start;ar<=nt.end;ar++){var ns=M[ar];if(!(ns&o)){var Bu=K[ar],Pu=ns&n,Wy=ns===Kt;me&&Bu===me._level?(me._end=ar,me._endsWithIsolInit=Pu):Cr.push(me={_start:ar,_end:ar,_level:Bu,_startsWithPDI:Wy,_endsWithIsolInit:Pu})}}for(var as=[],Sn=0;Sn=0;kn--)if(!(M[kn]&o)){Vu=K[kn];break}var us=Mr[Mr.length-1],Hy=K[us],Ou=nt.level;if(!(M[us]&n)){for(var Tn=us+1;Tn<=nt.end;Tn++)if(!(M[Tn]&o)){Ou=K[Tn];break}}as.push({_seqIndices:Mr,_sosType:Math.max(Vu,Zy)%2?_:A,_eosType:Math.max(Ou,Hy)%2?_:A})}}for(var hs=0;hs=0;Cn--)if(!(M[j[Cn]]&o)){ps=M[j[Cn]];break}G(Ru,ps&(n|Kt)?$:ps)}}if(X.get(S))for(var Mn=0;Mn=-1;Bn--){var Nu=Bn===-1?yi:M[j[Bn]];if(Nu&a){Nu===q&&G($u,O);break}}}if(X.get(q))for(var fs=0;fs=0&&(Pr=M[j[ms]],Pr&o);ms--);for(var gs=mi+1;gs=0&&M[j[Pn]]&(z|o);Pn--)G(j[Pn],S);for(ge++;ge=0&&M[j[zn]]&o;zn--)G(j[zn],$);for(var Ln=gi+1;Ln=0;bi--){var bs=zr[bi].char;if(bs===Yu||bs===b(D(vi))||v(D(bs))===vi){Vn.push([zr[bi].seqIndex,Lr]),zr.length=bi;break}}}Vn.sort(function(Yt,ue){return Yt[0]-ue[0]});for(var ws=0;ws=0;As--){var Ju=j[As];if(M[Ju]&Xu){var Qu=M[Ju]&xi?_:A;xe=Qu===Br?Br:Qu;break}}}if(xe){if(M[j[On]]=M[j[Ds]]=xe,xe!==Br){for(var wi=On+1;wi=0;_i--)if(M[j[_i]]&o)th=_i;else{Es=M[j[_i]]&xi?_:A;break}for(var eh=Ky,Ai=Ue+1;Ai=0&&c(R[$n])&l;$n--)K[$n]=nt.level}}return{levels:K,paragraphs:vt};function rh(Yt,ue){for(var Wt=Yt;Wt=K&&c(R[nt])&l;nt--)vt[nt]=G.level;for(var Tt=G.level,di=1/0,nr=0;nrTt&&(Tt=Re),Re=di;$e--)for(var lt=0;lt=$e){for(var bt=lt;lt+1=$e;)lt++;lt>bt&&X.push([bt+K,lt+K])}}}),X}function Tr(R,J,W,M){var ut=Ir(R,J,W,M),X=[].concat(R);return ut.forEach(function(G,K){X[K]=(J.levels[G]&1?kt(R[G]):null)||R[G]}),X.join("")}function Ir(R,J,W,M){for(var ut=ir(R,J,W,M),X=[],G=0;G=0;i--){let n=nu.getBidiCharTypeName(t[i].text[0]);Tv.has(n)?(t[i].level=e,r=!0):r&&kv.has(n)?t[i].level=e:r=!1}}function Mv(t,e){let r=e,i=1/0;for(let{level:a}of t)a>r&&(r=a),(a|1)=i;a--)for(let s=0;s=a;)o++;for(let l=s,u=o;le>=n.start&&e<=n.end))==null?void 0:r.level)!=null?i:0}function zv(t,e,r,i,n){let a=Iv(t,e,i,n);Cv(a,r);let s="",o=[];for(let l of Mv(a,r)){if(Fv.test(l.text))continue;let u=Bv(l);s+=u,o.push(...Array(u.length).fill(l.index))}return{text:s,sourceIndices:o}}function Lv(t,e){let r=e.filter(a=>a>0&&aa-s),n=[];for(let a=0;a+1n.start))).map(([n,a])=>zv(t,r,Pv(i,n),n,a))}function Vv(t,e){return Rd(t,e).map(r=>r.text)}function Ov(t,e,r){return Rd(t,r).map(i=>[i.text,i.sourceIndices.map(n=>{var a;return(a=e[n])!=null?a:0})])}var il=4294967296,Ac=1/il,Sc=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),au=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*il;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*il;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,$v(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Sc?Sc.decode(this.buf.subarray(e,t)):tb(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},Rv=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Uv(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=eb(this.buf,t,this.pos);let r=this.pos-e;r>=128&&Ec(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&Ec(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Gv,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Xv,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Zv,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Yv,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Wv,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Hv,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Kv,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Jv,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Qv,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function $v(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return Nv(t,n,e);throw Error("Expected varint not more than 10 bytes")}function Nv(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Uv(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),qv(r,i,e),jv(i,e)}function qv(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function jv(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((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 Ec(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Gv(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;sa){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function Xv(t,e){for(let r=0;r239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function eb(t,e,r){for(let i=0,n,a;i55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(a=(t[r++]=239,t[r++]=191,t[r++]=189,null));n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function rb(t){return typeof(t==null?void 0:t.renderWithWebGL)=="function"}function su(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o=r;a--)e.push(a);r=i+1}else{for(let a=r;at.toCodeUnitIndex(a)),i=wr.isParsed()?wr:null;if(t.sections.length===1)return i?i.processBidirectionalText(t.toString(),r).map(a=>kc(a,t.sections,[...a].map(()=>0))):Vv(t.toString(),r).map(a=>nl([...a],t.sections,[...a].map(()=>0)));let n=sb(t);return i?i.processStyledBidirectionalText(t.text,n,r).map(([a,s])=>kc(a,t.sections,s)):Ov(t.text,n,r).map(([a,s])=>{let o=[...a];return nl(o,t.sections,Ud(o).map(l=>{var u;return(u=s[l])!=null?u:0}))})}function nl(t,e,r){var a;let i=new iu(t.join(""),e,[]),n=0;for(let s of i.graphemes())i.sectionIndex.push((a=r[n])!=null?a:0),n+=[...s].length;return i}function Ud(t){let e=[],r=0;for(let i of t)e.push(r),r+=i.length;return e}function kc(t,e,r){let i=[...t],n=Ud(i),a=ab(i);return nl(a.map(s=>i[s]),e,a.map(s=>{var o;return(o=r[n[s]])!=null?o:0}))}function ra(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=iu.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m=y.determineLineBreaks(u,a,e,i,f),g=Vd(y.text)?ob(y,m):nb(y,m),x=[],v={positionedLines:x,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return mb(v,e,r,i,g,s,o,l,c,u,p,d),!ib(x)&&v}function qd(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function lb(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function jd(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function ub(t,e,r,i){var a;if(t!=null&&t.rect)return t;let n=(a=e[r.fontStack])==null?void 0:a[i];return n?{rect:null,metrics:n.metrics}:null}function hb(t,e,r){return!(t===1||!e&&!Qa(r)||e&&(ru(r)||zd(r)))}function da(t){return new RegExp("\\\\p{Nd}","u").test(String.fromCodePoint(t))}function Gd(t){return new RegExp("\\\\p{Lu}","u").test(String.fromCodePoint(t))}function cb(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function pb(t){let e=t.some(da)&&t.every(i=>da(i)||cb(i)),r=t.length<=3&&t.every(i=>Gd(i)||da(i));return e||r}function fb(t){return(da(t)||Gd(t))&&!zd(t)}function db(t,e){let r=!1;for(let i=0;ia.codePointAt(0)),i=r.map(Qa),n=a=>!i[a]&&!ru(r[a])&&!("imageName"in t.getSection(a));for(let a=0;au){let p=Math.ceil(i/u);r*=p/n,n=p}return{x1:e,y1:r,x2:e+i,y2:r+n}}function Tc(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var Ic=32640;function Cc(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new st(t+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=Db(r.zoomStops,t);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=_b(r),n=r.evaluate(new st(t+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function Db(t,e){let r=0;for(;rt.evaluate(new st(e===-1/0?t.zoomStops[1]-1:e)))}var Jr=class Yd extends B{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new Yd(this.x,this.y,this.angle,this.segment)}};C("Anchor",Jr);function Wd(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;oi;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function Zd(t){let e=0;for(let r=0;ru){let d=(u-l)/f,y=new Jr(gr.number(c.x,p.x,d),gr.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||Wd(t,y,o,s,e)?y:void 0}l+=f}}function Sb(t,e,r,i,n,a,s,o,l){let u=Hd(i,a,s),h=Kd(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c=0&&b=0&&D=0&&p+u<=h){let A=new Jr(b,D,x,d);A._round(),(!i||Wd(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=Jd(t,c/2,r,i,n,a,s,!0,l)),f}function Eb(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l=i&&h.x>=i)&&(u.x>=i?u=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function Qd(t,e,r,i,n,a){let s=Mc(t,e,r,n,0);return s=Mc(s,e,i,a,1),s}function Mc(t,e,r,i,n){switch(e){case 1:return Fb(t,r,i,n);case 2:return Bc(t,r,i,n,!1);case 3:return Bc(t,r,i,n,!0)}return[]}function Fb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function kb(t,e,r,i,n){let a=i===0?Tb:Ib,s=[],o=[];for(let h=0;he&&s.push(a(c,p,e)):f>r?d=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new B(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Bc(t,e,r,i,n){let a=[];for(let s of t){let o=kb(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function Tb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new B(r,t.y+(e.y-t.y)*i)}function Ib(t,e,r){let i=(r-t.y)/(e.y-t.y);return new B(t.x+(e.x-t.x)*i,r)}function Pc(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(F,$)=>F+$[1]-$[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,v=0,b=d,D=0,A=y,_=0,S=m;if(a.content&&i){let F=a.content,$=F[2]-F[0],U=F[3]-F[1];(a.textFitWidth||a.textFitHeight)&&(u=Xd(t)),g=ia(h,0,F[0]),v=ia(c,0,F[1]),x=ia(h,F[0],F[2]),b=ia(c,F[1],F[3]),D=F[0]-g,_=F[1]-v,A=$-x,S=U-b}let k=u.x1,z=u.y1,O=u.x2-k,P=u.y2-z,L=(F,$,U,T)=>{let q=na(F.stretch-g,x,O,k),at=aa(F.fixed-D,A,F.stretch,f),ot=na($.stretch-v,b,P,z),pt=aa($.fixed-_,S,$.stretch,d),Et=na(U.stretch-g,x,O,k),qt=aa(U.fixed-D,A,U.stretch,f),Ht=na(T.stretch-v,b,P,z),Ve=aa(T.fixed-_,S,T.stretch,d),ye=new B(q,ot),Kt=new B(Et,ot),Oe=new B(Et,Ht),kr=new B(q,Ht),rr=new B(at/s,pt/s),fi=new B(qt/s,Ve/s),kt=e*Math.PI/180;if(kt){let R=Math.sin(kt),J=Math.cos(kt),W=[J,-R,R,J];ye._matMult(W),Kt._matMult(W),kr._matMult(W),Oe._matMult(W)}let Ee=F.stretch+F.fixed,ir=U.stretch+U.fixed,Tr=$.stretch+$.fixed,Ir=T.stretch+T.fixed;return{tl:ye,tr:Kt,bl:kr,br:Oe,tex:{x:a.paddedRect.x+1+Ee,y:a.paddedRect.y+1+Tr,w:ir-Ee,h:Ir-Tr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rr,pixelOffsetBR:fi,minFontScaleX:A/s/O,minFontScaleY:S/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let F=zc(h,y,f),$=zc(c,m,d);for(let U=0;U0&&(d=Math.max(10,d),this.circleDiameter=d)}else{let c=(h=a.image)!=null&&h.content&&(a.image.textFitWidth||a.image.textFitHeight)?Xd(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-o[0],c.y2=c.y2*s+o[2],c.x1=c.x1*s-o[3],c.x2=c.x2*s+o[1];let p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),u){let f=new B(c.x1,c.y1),d=new B(c.x2,c.y1),y=new B(c.x1,c.y2),m=new B(c.x2,c.y2),g=u*Math.PI/180;f._rotate(g),d._rotate(g),y._rotate(g),m._rotate(g),c.x1=Math.min(f.x,d.x,y.x,m.x),c.x2=Math.max(f.x,d.x,y.x,m.x),c.y1=Math.min(f.y,d.y,y.y,m.y),c.y2=Math.max(f.y,d.y,y.y,m.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,r,i,n)}this.boxEndIndex=t.length}},Mb=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}};function Bb(t,e=1){let r=Fa.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Mb([],Pb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new B(s,o);for(let p=s;pc.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new qr(p.p.x-n,p.p.y-n,n,t)),a.push(new qr(p.p.x+n,p.p.y-n,n,t)),a.push(new qr(p.p.x-n,p.p.y+n,n,t)),a.push(new qr(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Pb(t,e){return e.max-t.max}var qr=class{constructor(t,e,r,i){this.p=new B(t,e),this.h=r,this.d=zb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function zb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;at.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,td(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Lb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;ap*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new De(l)}let a=i.get("text-variable-anchor");if(a){let o;o=t._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(e,{},r).map(u=>u*24):[i.get("text-radial-offset").evaluate(e,{},r)*24,lu];let l=[];for(let u of a)l.push(u,ty(u,o));return new De(l)}return null}function Ob(t){var h,c;t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=mt/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new st(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new st(p),t.canonical),n["text-size"].possiblyEvaluate(new st(f),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new st(p),t.canonical),n["icon-size"].possiblyEvaluate(new st(f),t.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let p of t.bucket.features){let f=i.get("text-font").evaluate(p,{},t.canonical).join(","),d=u.evaluate(p,{},t.canonical),y=a.layoutTextSize.evaluate(p,{},t.canonical),m=a.layoutIconSize.evaluate(p,{},t.canonical),g={horizontal:{},vertical:void 0},x=p.text,v=[0,0];if(x){let _=x.toString(),S=i.get("text-letter-spacing").evaluate(p,{},t.canonical)*24,k=bv(_)?S:0,z=i.get("text-anchor").evaluate(p,{},t.canonical),O=ey(r,p,t.canonical);if(!O){let $=i.get("text-radial-offset").evaluate(p,{},t.canonical);v=$?ty(z,[$*24,lu]):i.get("text-offset").evaluate(p,{},t.canonical).map(U=>U*24)}let P=o?"center":i.get("text-justify").evaluate(p,{},t.canonical),L=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(p,{},t.canonical)*24:1/0,F=()=>{t.bucket.allowVerticalPlacement&&el(_)&&(g.vertical=ra(x,t.glyphMap,t.glyphPositions,t.imagePositions,f,L,s,z,"left",k,v,2,!0,y,d))};if(!o&&O){let $=new Set;if(P==="auto")for(let T=0;T{T.x<0||T.x>=8192||T.y<0||T.y>=8192||Nb(t,T,U,r,i,n,L,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[D,D,D,D],S,l,v,A,k,d,e,a,u,h,s)};if(z==="line")for(let U of Eb(e.geometry,0,0,mt,mt)){let T=cr(U,F),q=Sb(T,b,_,r.vertical||y,i,24,x,t.overscaling,mt);for(let at of q){let ot=y;(!ot||!Ub(t,ot.text,O,at))&&$(T,at)}}else if(z==="line-center"){for(let U of e.geometry)if(U.length>1){let T=cr(U,F),q=Ab(T,_,r.vertical||y,i,24,x);q&&$(T,q)}}else if(e.type==="Polygon")for(let U of Ra(e.geometry,0)){let T=Bb(U,16);$(cr(U[0],F,!0),new Jr(T.x,T.y,0))}else if(e.type==="LineString")for(let U of e.geometry){let T=cr(U,F);$(T,new Jr(T[0].x,T[0].y,0))}else if(e.type==="Point")for(let U of e.geometry)for(let T of U)$([T],new Jr(T.x,T.y,0))}function $b(t,e){let r=t.length,i=e==null?void 0:e.values;if((i==null?void 0:i.length)>0)for(let n=0;n32640&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let v of c)p[v]=t.text.placedSymbolArray.length-1;return m.length*4}function ry(t){for(let e in t)return t[e];return null}function Nb(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S){let k=t.addToLineVertexArray(e,r),z=o.layout.get("symbol-height-offset").evaluate(b,{},_);z>t.maxHeightOffset&&(t.maxHeightOffset=z);let O,P,L,F,$=0,U=0,T=0,q=0,at=-1,ot=-1,pt={},Et=(0,Mo.default)("");if(t.allowVerticalPlacement&&i.vertical){let J=o.layout.get("text-rotate").evaluate(b,{},_)+90,W=i.vertical;L=new sa(l,e,u,h,c,W,p,f,d,J),s&&(F=new sa(l,e,u,h,c,s,m,g,d,J))}if(n){let J=o.layout.get("icon-rotate").evaluate(b,{}),W=o.layout.get("icon-text-fit")!=="none",M=Pc(n,J,A,W),ut=s?Pc(s,J,A,W):void 0;P=new sa(l,e,u,h,c,n,m,g,!1,J),$=M.length*4;let X=t.iconSizeData,G=null;X.kind==="source"?(G=[128*o.layout.get("icon-size").evaluate(b,{})],G[0]>32640&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):X.kind==="composite"&&(G=[128*D.compositeIconSizes[0].evaluate(b,{},_),128*D.compositeIconSizes[1].evaluate(b,{},_)],(G[0]>32640||G[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,M,G,v,x,b,0,e,k.lineStartIndex,k.lineLength,-1,_,z),at=t.icon.placedSymbolArray.length-1,ut&&(U=ut.length*4,t.addSymbols(t.icon,ut,G,v,x,b,2,e,k.lineStartIndex,k.lineLength,-1,_,z),ot=t.icon.placedSymbolArray.length-1)}let qt=Object.keys(i.horizontal);for(let J of qt){let W=i.horizontal[J];O||(O=(Et=(0,Mo.default)(W.text),new sa(l,e,u,h,c,W,p,f,d,o.layout.get("text-rotate").evaluate(b,{},_))));let M=W.positionedLines.length===1;if(T+=Vc(t,e,W,a,o,d,b,y,z,k,i.vertical?1:3,M?qt:[J],pt,at,D,_),M)break}i.vertical&&(q+=Vc(t,e,i.vertical,a,o,d,b,y,z,k,2,["vertical"],pt,ot,D,_));let Ht=O?O.boxStartIndex:t.collisionBoxArray.length,Ve=O?O.boxEndIndex:t.collisionBoxArray.length,ye=L?L.boxStartIndex:t.collisionBoxArray.length,Kt=L?L.boxEndIndex:t.collisionBoxArray.length,Oe=P?P.boxStartIndex:t.collisionBoxArray.length,kr=P?P.boxEndIndex:t.collisionBoxArray.length,rr=F?F.boxStartIndex:t.collisionBoxArray.length,fi=F?F.boxEndIndex:t.collisionBoxArray.length,kt=-1,Ee=(J,W)=>J!=null&&J.circleDiameter?Math.max(J.circleDiameter,W):W;kt=Ee(O,kt),kt=Ee(L,kt),kt=Ee(P,kt),kt=Ee(F,kt);let ir=+(kt>-1);ir&&(kt*=S/24),t.glyphOffsetArray.length>=t.maxGlyphs&&Bt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),b.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);let Tr=ey(o,b,_),[Ir,R]=$b(t.textAnchorOffsets,Tr);t.symbolInstances.emplaceBack(e.x,e.y,pt.right>=0?pt.right:-1,pt.center>=0?pt.center:-1,pt.left>=0?pt.left:-1,pt.vertical||-1,at,ot,Et,Ht,Ve,ye,Kt,Oe,kr,rr,fi,u,T,q,$,U,ir,0,p,kt,Ir,R,z)}function Ub(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cc(this.zoom,e["text-size"]),this.iconSizeData=Cc(this.zoom,e["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=Oc(r,"text-overlap","text-allow-overlap")!=="never"||Oc(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>Nd[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new al(new vr(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new al(new vr(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new Uf,this.lineVertexArray=new qf,this.symbolInstances=new Nf,this.textAnchorOffsets=new Gf}calculateGlyphDependencies(t,e,r,i,n){var l;let a=(i||this.allowVerticalPlacement)&&n,s=iu.fromFeature(t,r),o=s.graphemes();for(let u=0;u0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new st(this.zoom);for(let{feature:m,id:g,index:x,sourceLayerIndex:v}of t){let b=i._featureFilter.needGeometry,D=hi(m,b);if(!i._featureFilter.filter(d,D,r))continue;b||(D.geometry=Ar(m));let A;if(l){let z=i.getValueAndResolveTokens("text-field",D,r,f),O=ze.factory(z);this.hasRTLText||(this.hasRTLText=Gb(O)),A=gv(O,i,D)}let _;if(u){let z=i.getValueAndResolveTokens("icon-image",D,r,f);_=z instanceof _e?z:_e.fromString(z)}if(!A&&!_)continue;let S=this.sortFeaturesByKey?h.evaluate(D,{},r):void 0,k={id:g,text:A,icon:_,index:x,sourceLayerIndex:v,geometry:D.geometry,properties:m.properties,type:Dn.types[m.type],sortKey:S};if(this.features.push(k),_&&(c[_.name]=!0),A){let z=a.evaluate(D,{},r).join(","),O=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=(y=this.writingModes)==null?void 0:y.includes(2);let P=el(A.toString());this.calculateGlyphDependencies(A,p,z,O,P);for(let L of A.sections)L.image&&(c[L.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=xv(this.features)),this.sortFeaturesByKey&&this.features.sort((m,g)=>m.sortKey-g.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}addFeatures({options:t,canonical:e,glyphMap:r,glyphPositions:i,iconMap:n,iconPositions:a,showCollisionBoxes:s}){Ob({bucket:this,glyphMap:r,glyphPositions:i,imageMap:n,imagePositions:a,showCollisionBoxes:s,canonical:e,subdivisionGranularity:t.subdivisionGranularity})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;ni[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(r==null?void 0:r.sortKey)===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",iy,{omit:["layers","collisionBoxArray","features","compareText"]});function Xb(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):"")}var Yb,Wb=()=>Yb||(Yb=new Xt({"symbol-placement":new V(w.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new V(w.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new V(w.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new N(w.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new V(w.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new V(w.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new V(w.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new V(w.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new V(w.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new N(w.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new N(w.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new V(w.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new V(w.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new N(w.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new N(w.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new N(w.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new V(w.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new N(w.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new N(w.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new V(w.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new V(w.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new V(w.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new N(w.layout_symbol["text-field"],"text-field"),"text-font":new N(w.layout_symbol["text-font"],"text-font"),"text-size":new N(w.layout_symbol["text-size"],"text-size"),"text-max-width":new N(w.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new V(w.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new N(w.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new N(w.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new N(w.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new V(w.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new N(w.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new N(w.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new V(w.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new V(w.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new N(w.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new V(w.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new V(w.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new N(w.layout_symbol["text-transform"],"text-transform"),"text-offset":new N(w.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new V(w.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new V(w.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new V(w.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new V(w.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new N(w.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new V(w.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})),Zb,Hb=()=>Zb||(Zb=new Xt({"icon-opacity":new N(w.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new N(w.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new N(w.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new N(w.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new N(w.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new V(w.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new V(w.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new N(w.paint_symbol["text-opacity"],"text-opacity"),"text-color":new N(w.paint_symbol["text-color"],"text-color",{runtimeType:ce,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new N(w.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new N(w.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new N(w.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new V(w.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new V(w.paint_symbol["text-translate-anchor"],"text-translate-anchor")})),Ys={get paint(){return Hb()},get layout(){return Wb()}},ny=class{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:dn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e!=null&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};C("FormatSectionOverride",ny,{omit:["defaultValue"]});var Kb=class ol extends de{constructor(e,r){super(e,Ys,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new se(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!ja(s.value)&&a?Xb(r.properties,a):a}createBucket(e){return new iy(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Ys.paint.overridableProperties){if(!ol.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Il(new ny(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new an("source",i):new wa("composite",i,r.value.zoomStops),this.paint._values[e]=new se(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:ol.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=Ys.paint.properties[r],a=!1,s=o=>{var l;for(let u of o)if((l=n.overrides)!=null&&l.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof ze)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof ri&&_t(u.value)===yn){let h=u.value;s(h.sections)}else u instanceof Ep?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Jb(t,e,r,i=1){var a;let n=(a=t.get("icon-padding").evaluate(e,{},r))==null?void 0:a.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Qb,tw=()=>Qb||(Qb=new Xt({"background-color":new V(w.paint_background["background-color"],"background-color"),"background-pattern":new Lf(w.paint_background["background-pattern"],"background-pattern"),"background-opacity":new V(w.paint_background["background-opacity"],"background-opacity")})),ew={get paint(){return tw()}};var rw=class extends de{constructor(t,e){super(t,ew,e)}};var iw=class extends de{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function ay(t,e){if(t.type==="custom")return new iw(t,e);switch(t.type){case"background":return new rw(t,e);case"circle":return new Bg(t,e);case"color-relief":return new Yg(t,e);case"fill":return new Ex(t,e);case"fill-extrusion":return new Hx(t,e);case"heatmap":return new Rg(t,e);case"hillshade":return new qg(t,e);case"line":return new G2(t,e);case"raster":return new Xm(t,e);case"symbol":return new Kb(t,e)}}var nw=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,(t=this._channel)==null||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},aw={once:!0},sy=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new nw(()=>this.process()),this.subscription=hh(this.target,"message",r=>this.receive(r),!1),this.globalScope=mr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?hh(e.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new dl(e.signal.reason))},aw):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),r(l)},reject:l=>{a==null||a.unsubscribe(),i(l)}};let s=[],o=Si(je({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Yi(t.data,s)});this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=["file://","resource://android","null"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if((a||s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(mr(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){return rt(this,null,function*(){if(e.type===""){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Ki(Wi(e.error))):n.resolve(Wi(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Wi(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=yield this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Ki(n))}})}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Yi(e):null,data:Yi(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function sw(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var oy=class{constructor(t,e,r){if(!sw(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Hi(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=lw(this.x,this.y,this.z),n=uw(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new B((t.x*e-this.x)*mt,(t.y*e-this.y)*mt)}toString(){return`${this.z}/${this.x}/${this.y}`}},ow=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Hi(t,e.z,e.z,e.x,e.y)}},uu=class ne{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new oy(i,+n,+a),this.key=Hi(r,e,i,n,a)}clone(){return new ne(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new ne(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ne(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Hi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Hi(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ne(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new ne(r,this.wrap,r,i,n),new ne(r,this.wrap,r,i+1,n),new ne(r,this.wrap,r,i,n+1),new ne(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrape.wrap?!1:this.overscaledZe.overscaledZ?!1:this.canonical.xe.canonical.x?!1:this.canonical.y=0&&e=0&&r=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new ne(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Hi(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<0;n--){let a=1<pw(n,a,r),t.layers[i])}function pw(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s>31}function yw(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(Zs(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},gw=class{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]=="string"&&t.properties[a].startsWith("__$json__:")&&(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=dd(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}},Sr=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){var e;return((e=this.nullabilityBuffer)==null?void 0:e.get(t))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},ts=class extends Sr{},pu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},fu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},uy=class extends Sr{constructor(t,e,r,i){super(t,e,i),this.delta=r}},du=class extends uy{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},yu=class extends Sr{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},xw=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){var t;return(t=this._propertyVectors)!=null?t:[]}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r>>32-t;var ul=mu,py=65536;function gu(t,e){return t-t%e}function vw(t){return gu(t+31,32)}function bw(t){if(!Number.isFinite(t)||t<=0)return py;let e=gu(Math.floor(t),256);return e===0?256:e}function ww(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function Dw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function _w(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function Aw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function Sw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function Ew(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function Fw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function kw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function Tw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function Iw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function Cw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function Mw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function Bw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,v=t[e+14]>>>0,b=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=v>>>0&65535,r[n++]=v>>>16&65535,r[n++]=b>>>0&65535,r[n]=b>>>16&65535}function Pw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function zw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function Lw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function Vw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function Ow(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function Rw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function $w(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function Nw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function Uw(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function qw(t,e,r,i,n){let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<>>0)}}var hl=bw(py),jw=3*hl/256+hl|0;function fy(){let t=new Uint8Array(jw);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Gw(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:fy()}}function Xw(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function Yw(t,e,r,i){i.byteContainer.length>>2;if(n.byteOffset&3)for(let o=0;o>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u>>(u<<3)&255}return n}function Ww(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=vw(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length>>5)|0,r.exceptionSizes[a]=s}return e}function Zw(t,e,r,i,n){switch(n){case 1:Pw(t,e,r,i);break;case 2:zw(t,e,r,i);break;case 3:Lw(t,e,r,i);break;case 4:Vw(t,e,r,i);break;case 5:Ow(t,e,r,i);break;case 6:Rw(t,e,r,i);break;case 7:$w(t,e,r,i);break;case 8:Nw(t,e,r,i);break;case 16:Uw(t,e,r,i);break;default:qw(t,e,r,i,n)}return e+(n<<3)|0}function Hw(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function Kw(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function Jw(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=Kw(n,a,s,r,i,l);if(s=c,h===1){let m=1<y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m0&&(c=Jw(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function t3(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=Yw(t,p,h,a),y=h,m=Ww(t,f,a);return a.dataPointers.fill(0),Qw(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function e3(t,e,r,i,n,a){let s=i+gu(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(hl,s-o);l=t3(t,e,l,o,u,a),o=o+u|0}return l}function r3(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function i3(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r!=null?r:fy();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=e3(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return r3(t,i,o,a,n,l),a}function n3(t,e,r,i,n){switch(n){case 2:Dw(t,e,r,i);return;case 3:_w(t,e,r,i);return;case 4:Aw(t,e,r,i);return;case 5:Sw(t,e,r,i);return;case 6:Ew(t,e,r,i);return;case 7:Fw(t,e,r,i);return;case 8:kw(t,e,r,i);return;case 9:Tw(t,e,r,i);return;case 10:Iw(t,e,r,i);return;case 11:Cw(t,e,r,i);return;case 12:Mw(t,e,r,i);return;case 16:Bw(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=ul[n-h]>>>0,f=(c|(l&p)<t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length0){let o=t.byteOffset+e;if(o&3)for(let l=0;l=64)throw Error("Varint too long")}return e.set(n),r}function o3(t,e,r){let i=new Float64Array(r);for(let n=0;n>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error("Expected varint not more than 10 bytes")}function h3(t,e,r,i){return c3(t,e,r,i,Gw(r>>>2))}function c3(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=Xw(n,s);a3(t,a,r,o);let l=i3(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function et(t){return t>>>1^-(t&1)}function Ot(t){return t>>BigInt(1)^-(t&BigInt(1))}function We(t){return t%2==1?(t+1)/-2:t/2}function p3(t){let e=new Int32Array(t.length);for(let r=0;r=4)for(;i=4)for(;i=4)for(;r=4)for(let i=t[0];r=4)for(;i=4)for(;l>>0;for(let r=1;r>>0;return e}function jc(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,Ot(t[0]));for(let r=1;r>>0,e[1]=et(t[1])>>>0;for(let r=2;r>>0,e[r+1]=e[r-1]+et(t[r+1])>>>0;return e}function F3(t,e,r,i){let n=yy(t,e,r,i);return new Uint32Array(n)}function k3(t){return t[1]}function T3(t){return et(t[1])}function I3(t){if(t.length===2){let e=et(t[1]);return[e,e]}return[et(t[2]),et(t[3])]}function C3(t){return t[1]}function M3(t){return Ot(t[1])}function B3(t){if(t.length===2){let e=Ot(t[1]);return[e,e]}return[Ot(t[2]),Ot(t[3])]}var St;(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(St||(St={}));var jt;(function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"})(jt||(jt={}));var Me;(function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"})(Me||(Me={}));var Ct;(function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"})(Ct||(Ct={}));var P3=[St.PRESENT,St.DATA,St.OFFSET,St.LENGTH],Gc=[H.NONE,H.DELTA,H.COMPONENTWISE_DELTA,H.RLE,H.MORTON],z3=[le.NONE,le.FAST_PFOR,le.VARINT],L3=[jt.NONE,jt.SINGLE,jt.SHARED,jt.VERTEX,jt.MORTON,jt.FSST],V3=[Me.VERTEX,Me.INDEX,Me.STRING,Me.KEY],O3=[Ct.VAR_BINARY,Ct.GEOMETRIES,Ct.PARTS,Ct.RINGS,Ct.TRIANGLES,Ct.SYMBOL,Ct.DICTIONARY];function ct(t,e){let r=N3(t,e);return r.logicalLevelTechnique1===H.MORTON?R3(r,t,e):(H.RLE===r.logicalLevelTechnique1||H.RLE===r.logicalLevelTechnique2)&&le.NONE!==r.physicalLevelTechnique?$3(r,t,e):r}function R3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function $3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function N3(t,e){let r=t[e.get()],i=P3[r>>4],n={};switch(i){case St.DATA:n={dictionaryType:L3[r&15]};break;case St.OFFSET:n={offsetType:V3[r&15]};break;case St.LENGTH:n={lengthType:O3[r&15]}}e.increment();let a=t[e.get()],s=Gc[a>>5],o=Gc[a>>2&7],l=z3[a&3];e.increment();let u=$t(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var ht;(function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ht||(ht={}));var fe=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<>r&1}size(){return this._size}getBuffer(){return this.values}};function Er(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u=12?X3.decode(t.subarray(e,r)):Y3(t,e,r)}function Y3(t,e,r){let i="",n=e;for(;n239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Ta(t,e,r,i,n){return J3(pi(t,e,r),r,i,n)}function Vt(t,e,r,i,n){return Q3(pi(t,e,r),r,i,n)}function Ze(t,e,r){return e6(pi(t,e,r),r)}function pi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.FAST_PFOR:return h3(t,r.numValues,r.byteLength,e);case le.VARINT:return $t(t,e,r.numValues);case le.NONE:return j3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function _n(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.VARINT:return xu(t,e,r.numValues);case le.NONE:return G3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function W3(t,e,r){let i=pi(t,e,r);return i.length===1?et(i[0]):T3(i)}function wu(t,e,r){let i=pi(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?et(i[0]):i[0]:k3(i)}function vy(t,e,r){return I3(pi(t,e,r))}function by(t,e,r){return B3(xu(t,e,r.numValues))}function wy(t,e,r,i){return _y(_n(t,e,r),r,i)}function Du(t,e,r,i){return Ay(_n(t,e,r),r,i)}function Z3(t,e,r,i){let n=H3(t,e,r,!1);return i?Er(n,i,0):n}function H3(t,e,r,i){if(r.physicalLevelTechnique===le.VARINT)return t6(o3(t,e,r.numValues),r,i);let n=_n(t,e,r),a=i?_y(n,r):Ay(n,r);return Float64Array.from(a,Number)}function K3(t,e,r){let i=_n(t,e,r);return i.length===1?Ot(i[0]):M3(i)}function Dy(t,e,r){let i=_n(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?Ot(i[0]):i[0]:C3(i)}function J3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;if(!i)return A3(t,a.runs,a.numRleValues);t=cl(t,a.runs,a.numRleValues),n=Nc(t)}else n=Nc(t);break;case H.RLE:n=m3(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=new Int32Array(t);break;case H.COMPONENTWISE_DELTA:if(r&&!i)return yy(t,r.scale,r.min,r.max);n=b3(t);break;case H.NONE:n=p3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function Q3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;n=qc(cl(t,a.runs,a.numRleValues))}else n=qc(t);break;case H.RLE:n=cl(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=t;break;case H.COMPONENTWISE_DELTA:n=r&&!i?F3(t,r.scale,r.min,r.max):E3(t);break;case H.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function _y(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;if(!r)return S3(t,n.runs,n.numRleValues);t=pl(t,n.runs,n.numRleValues),i=Uc(t)}else i=Uc(t);break;case H.RLE:i=g3(t,e.runs,e.numRleValues);break;case H.NONE:i=f3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function Ay(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;i=jc(pl(t,n.runs,n.numRleValues))}else i=jc(t);break;case H.RLE:i=pl(t,e.runs,e.numRleValues);break;case H.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function t6(t,e,r){switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let i=e;t=dy(t,i.runs,i.numRleValues)}return y3(t),t;case H.RLE:return i6(t,e,r);case H.NONE:return r&&d3(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function e6(t,e){if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.NONE)return w3(t);if(e.logicalLevelTechnique1===H.RLE&&e.logicalLevelTechnique2===H.NONE){let r=e;return _3(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===H.NONE&&e.logicalLevelTechnique2===H.NONE){v3(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.RLE){let r=e,i=D3(t,r.runs,r.numRleValues);return vu(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function es(t,e,r,i,n="int32"){let a=t.logicalLevelTechnique1;if(a===H.RLE)return t.runs===1?ht.CONST:ht.FLAT;if(a!==H.DELTA||t.logicalLevelTechnique2!==H.RLE)return t.numValues===1?ht.CONST:ht.FLAT;let s=e instanceof fe?e.size():e,o=t;if(o.numRleValues!==s)return ht.FLAT;if(o.runs===1)return ht.SEQUENCE;if(o.runs!==2)return t.numValues===1?ht.CONST:ht.FLAT;let l=i.get();if(t.physicalLevelTechnique===le.VARINT)return r6(r,i,n)?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT}function r6(t,e,r){let i=new cy(e.get());if(r==="int64"){let a=xu(t,i,4);return a[2]===BigInt(2)&&a[3]===BigInt(2)}let n=$t(t,i,4);return n[2]===2&&n[3]===2}function i6(t,e,r){return r?x3(t,e.runs,e.numRleValues):dy(t,e.runs,e.numRleValues)}var Sy=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},Ey=class extends uy{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function _u(t,e,r){return{x:Xc(t,e)-r,y:Xc(t>>1,e)-r}}function Xc(t,e){let r=0;for(let i=0;i>i;return r}var Rt;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(Rt||(Rt={}));var n6;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"})(n6||(n6={}));var Fr;(function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"})(Fr||(Fr={}));function a6(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g[D]),r+=v,i+=v}break;case Rt.LINESTRING:{let v;y?(v=p[i]-p[i-1],i++):v=c[r]-c[r-1],r++;let b;d?(b=Or(m,s,v,!1),s+=v*2):(b=lr(t.vertexBufferType,m,f,o,v,!1,l),o+=v),e[a++]=[b],h&&n++}break;case Rt.POLYGON:{let v=c[r]-c[r-1];r++;let b=Array(v-1),D,A=p[i]-p[i-1];if(i++,d){D=Or(m,s,A,!0),s+=A*2;for(let _=0;_r?e[a++]:1);return i}function Zc(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l0;)n[a++]=t[u++]}}return n}var By=class extends Au{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s!=null?s:e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){var n,a,s;(s=this.decodedDictionary)!=null||(this.decodedDictionary=(n=this.sharedDictionaryCache)==null?void 0:n.decodedDictionary,(a=this.decodedDictionary)!=null||(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return bu(this.decodedDictionary,r,i)}decodeDictionary(){var t;return(t=this.symbolLengthBuffer)!=null||(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),v6(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=ct(t,e);m=new fe(ci(t,x.numValues,x.byteLength,e),x.numValues)}let g=Vt(t,e,ct(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new By(y,g,n,a,s,o,m,c)}else h[p++]=new Qr(y,g,n,a,m)}return h}var Kc=class extends Sr{constructor(t,e,r){super(t,new Uint8Array,r!=null?r:e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},Be;(function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"})(Be||(Be={}));var pr;(function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"})(pr||(pr={}));function A6(t,e,r,i){let n=S6(r);if(i===0)return n.map(h=>new Kc(h,[]));let a=E6(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h{var i;return t.name+((i=r.name)!=null?i:"")})}function E6(t,e,r){let i=t[e.get()];e.add(1);let n=Vt(t,e,ct(t,e)),a=r-1,s=[];i&Be.STRING&&(a-=F6(t,e,s)),a-=k6(t,e,i,s),a-=T6(t,e,i,s);let o,l=0;if(i&Be.PRESENCE){let h=I6(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=Vt(t,e,ct(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function F6(t,e,r){let i=t[e.get()];e.add(1);let n=Py("",t,e,i);if(n)for(let a=0;aa.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;xs.length)throw Error("Map value stream underflow while decoding feature payload");let b=M6(s,y,v,l);f[x]=b.value,y=b.nextIndex}let m=0;for(let x=i;x=r)throw Error("Unexpected end of map value stream");let n=t[e];if(n===pr.FALSE)return{value:!1,nextIndex:e+1};if(n===pr.TRUE)return{value:!0,nextIndex:e+1};if(n===pr.START_MAP){let a=Jc(t,e,r);return{value:zy(t,e+2,a,i).value,nextIndex:a}}if(n===pr.START_LIST){let a=Jc(t,e,r),s=[],o=e+2;for(;o=r)throw Error("Missing length for nested map/list payload");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function Ly(t,e){let r=t-pr.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function Xr(t,e){for(let r of e)t.push(r)}function B6(t,e,r,i,n,a){var s;return r.type==="scalarType"?a&&!a.has(r.name)?(my(i,t,e),null):P6(i,t,e,n,r.scalarType,r):((s=r.complexType)==null?void 0:s.physicalType)===Qe.MAP?A6(t,e,r,i):i===0?null:_6(t,e,r,a)}function P6(t,e,r,i,n,a){var l;let s;if(t===0)return null;if(a.nullable){let u=ct(e,r),h=u.numValues,c=r.get(),p=ci(e,h,u.byteLength,r);r.set(c+u.byteLength),s=new fe(p,u.numValues)}let o=s!=null?s:i;switch(n.physicalType){case it.UINT_32:case it.INT_32:return R6(e,r,a,n,o);case it.STRING:{let u=a.nullable?t-1:t;return(l=Py(a.name,e,r,u,s))!=null?l:null}case it.BOOLEAN:return z6(e,r,a,i,o);case it.UINT_64:case it.INT_64:return O6(e,r,a,o,n);case it.FLOAT:return L6(e,r,a,o);case it.DOUBLE:return V6(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function z6(t,e,r,i,n){let a=ct(t,e),s=a.numValues,o=e.get(),l=An(n)?n:void 0,u=ci(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new fe(u,s);return new m6(r.name,h,n)}function L6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=gy(t,e,n.numValues,a);return new g6(r.name,s,i)}function V6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=xy(t,e,n.numValues,a);return new fu(r.name,s,i)}function O6(t,e,r,i,n){let a=ct(t,e),s=es(a,i,t,e,"int64"),o=n.physicalType===it.INT_64;if(s===ht.FLAT){let u=An(i)?i:void 0,h=o?wy(t,e,a,u):Du(t,e,a,u);return new Sy(r.name,h,i)}if(s===ht.SEQUENCE){let u=by(t,e,a);return new Ey(r.name,u[0],u[1],a.numRleValues,o)}let l=o?K3(t,e,a):Dy(t,e,a);return new My(r.name,l,i,o)}function R6(t,e,r,i,n){let a=ct(t,e),s=es(a,n,t,e),o=i.physicalType===it.INT_32;if(s===ht.FLAT){let u=An(n)?n:void 0,h=o?Ta(t,e,a,void 0,u):Vt(t,e,a,void 0,u);return new pu(r.name,h,n)}if(s===ht.SEQUENCE){let u=vy(t,e,a);return new du(r.name,u[0],u[1],a.numRleValues,o)}let l=o?W3(t,e,a):wu(t,e,a);return new yu(r.name,l,n,o)}function An(t){return t instanceof fe}var It={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function Vy(t){switch(t){case It.ID:case It.ID|It.ID_NULLABLE:case It.ID|It.ID_LONG:case It.ID|It.ID_LONG|It.ID_NULLABLE:return{nullable:(t&It.ID_NULLABLE)!==0,columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:(t&It.ID_LONG)!==0,type:"logicalType",logicalType:hy.ID}};case It.GEOMETRY:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.GEOMETRY,children:[]}};case It.STRUCT:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.STRUCT,children:[]}};case It.MAP:return{nullable:!0,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.MAP,children:[]}};default:return j6(t)}}function $6(t){return t>=It.SCALAR_BASE}function Oy(t){return t===It.STRUCT||t===It.MAP}function N6(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case it.BOOLEAN:case it.INT_8:case it.UINT_8:case it.INT_32:case it.UINT_32:case it.INT_64:case it.UINT_64:case it.FLOAT:case it.DOUBLE:return!1;case it.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case Qe.GEOMETRY:case Qe.STRUCT:case Qe.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function U6(t){var e;return t.type==="scalarType"&&((e=t.scalarType)==null?void 0:e.type)==="logicalType"&&t.scalarType.logicalType===hy.ID}function q6(t){var e;return t.type==="complexType"&&((e=t.complexType)==null?void 0:e.type)==="physicalType"&&t.complexType.physicalType===Qe.GEOMETRY}function j6(t){let e;switch(t){case 10:case 11:e=it.BOOLEAN;break;case 12:case 13:e=it.INT_8;break;case 14:case 15:e=it.UINT_8;break;case 16:case 17:e=it.INT_32;break;case 18:case 19:e=it.UINT_32;break;case 20:case 21:e=it.INT_64;break;case 22:case 23:e=it.UINT_64;break;case 24:case 25:e=it.FLOAT;break;case 26:case 27:e=it.DOUBLE;break;case 28:case 29:e=it.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}var G6=new TextDecoder,Qc="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Eu(t,e){let r=$t(t,e,1)[0];if(r===0)return"";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),G6.decode(a)}function X6(t){let e=t.name,r=t.nullable;return t.type==="scalarType"?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:r}:{type:"complexField",complexField:t.complexType,name:e,nullable:r}}function Ry(t,e){let r=$t(t,e,1)[0]>>>0,i=r>=It.SCALAR_BASE?Vy(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n=Si(je({},i),{name:Eu(t,e)});if(n.type==="complexType"&&Oy(r)){let a=n.complexType,s=$t(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o>>0,i=Vy(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Qc}`);let n;if($6(r))n=Eu(t,e);else if(r>>0,o=a.complexType;o.children=Array(s);for(let l=0;l>>0,a=$t(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=$t(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=W6(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(U6(m)){let x=null;if(m.nullable){let b=ct(t,i),D=i.get(),A=ci(t,b.numValues,b.byteLength,i);i.set(D+b.byteLength),x=new fe(A,b.numValues)}let v=ct(t,i);d=x?x.size():v.decompressedCount,c=H6(t,m,i,g,v,x!=null?x:d,r)}else if(q6(m)){let x=$t(t,i,1)[0];if(d===0){let v=i.get();d=ct(t,i).decompressedCount,i.set(v)}e&&(e.scale=e.extent/u),p=f6(t,x,i,d,e)}else{let x=N6(m)?$t(t,i,1)[0]:1;if(x===0)continue;let v=B6(t,i,m,x,d,void 0);if(v)if(Array.isArray(v))for(let b of v)f.push(b);else f.push(v)}}let y=new xw(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function H6(t,e,r,i,n,a,s=!1){var h;let o=(h=e.scalarType)!=null&&h.longID?it.UINT_64:it.UINT_32,l=typeof a=="number"?void 0:a,u=es(n,a,t,r,o===it.UINT_64?"int64":"int32");if(o===it.UINT_32)switch(u){case ht.FLAT:return new pu(i,Vt(t,r,n,void 0,l),a);case ht.SEQUENCE:{let c=vy(t,r,n);return new du(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new yu(i,wu(t,r,n),a,!1)}switch(u){case ht.FLAT:return s?new fu(i,Z3(t,r,n,l),a):new Sy(i,Du(t,r,n,l),a);case ht.SEQUENCE:{let c=by(t,r,n);return new Ey(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new My(i,Dy(t,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var K6=class{constructor(t,e){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},(r=this._featureData.geometry)==null?void 0:r.type){case Rt.POINT:case Rt.MULTIPOINT:this.type=1;break;case Rt.LINESTRING:case Rt.MULTILINESTRING:this.type=2;break;case Rt.POLYGON:case Rt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new B(i.x,i.y));t.push(r)}return t}},J6=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new K6(this.features[t],this.extent)}},Fu=class{constructor(t){this.layers={};let e=Z6(new Uint8Array(t));this.layers=e.reduce((r,i)=>Si(je({},r),{[i.name]:new J6(i)}),{})}},ku=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new uo(mt,16,0),this.grid3D=new uo(mt,16,0),this.featureIndexArray=new Yf,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){return this.vtLayers||(this.encoding==="mlt"?this.vtLayers=new Fu(this.rawTileData).layers:this.vtLayers=new Xl(new au(this.rawTileData)).layers,this.sourceLayerCoder=new cu(this.vtLayers?Object.keys(this.vtLayers).sort():[ll])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=mt/t.tileSize/t.scale,s=ai(n.filter,"queryRenderedFeatures filter",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=Fa.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Fa.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>vg(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(t5);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,v,b)=>(g||(g=Ar(x)),v.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:b,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=hi(f,!0);if(!n.filter(new st(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new st(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=Gt({},l[y]);x.paint=tp(x.paint,m.paint,f,g,s),x.layout=tp(x.layout,m.layout,f,g,s);let v=!h||h(f,m,g);if(!v)continue;let b=new gw(f,this.z,this.x,this.y,d);b.layer=x;let D=t[y];D===void 0&&(D=t[y]=[]),D.push({featureIndex:i,feature:b,intersectionZ:v})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=ai(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){var i;let r=t.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[n],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=t.properties)!=null&&i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};C("FeatureIndex",ku,{omit:["rawTileData","sourceLayerCoder"]});function Q6(t){return typeof t=="object"&&!!t&&"evaluate"in t}function tp(t,e,r,i,n){return Ia(t,(a,s)=>{let o=e instanceof Ya?e.get(s):null;return Q6(o)?o.evaluate(r,i,void 0,n):o})}function t5(t,e){return e-t}var $y=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function Tu(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n="[";for(let a of t)n+=`${Tu(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i="{";for(let n=0;nthis._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||(l=this.familiesBySource[o]={});let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||(h=l[u]=[]),h.push(a)}}},qy=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=su(r),a=new Ja({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Ja.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};C("GlyphAtlas",qy);var jy=class{constructor(t){this.tileID=new uu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,e,r,i,n){return rt(this,null,function*(){this.data=t,this.collisionBoxArray=new Ll;let a=new cu(Object.keys(t.layers).sort()),s=new ku(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let S in u){let k=t.layers[S];if(!k)continue;k.version===1&&Bt(`Vector tile source "${this.source}" layer "${S}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let z=a.encode(S),O=[];for(let P=0;PF.id)))}}let h=Ia(l.glyphDependencies,S=>Object.keys(S));for(let S of this.inFlightDependencies)S==null||S.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let S=new AbortController;this.inFlightDependencies.push(S),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},S)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let S=new AbortController;this.inFlightDependencies.push(S),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},S)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let S=new AbortController;this.inFlightDependencies.push(S),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},S)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let S=new AbortController;this.inFlightDependencies.push(S),g=i.sendAsync({type:"GDA",data:{dashes:m}},S)}let[x,v,b,D]=yield Promise.all([c,f,y,g]),A=new qy(x),_=new ou(v,b);for(let S in o){let k=o[S];k.hasDependencies&&(Ny(k.layers,this.zoom,r),k.addFeatures({options:l,canonical:this.tileID.canonical,glyphMap:x,glyphPositions:A.positions,iconMap:v,iconPositions:_.iconPositions,patternMap:b,patternPositions:_.patternPositions,dashPositions:D,showCollisionBoxes:this.showCollisionBoxes}))}return{buckets:Object.values(o).filter(S=>!S.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:_,dashPositions:D,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?A.positions:null}})}};function Ny(t,e,r){let i=new st(e);for(let n of t)n.recalculate(i,r)}var Gy=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e!=null&&e.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Xy=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},n5=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new B(e.x,e.y)))}},a5=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},s5=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function o5(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l0&&l.addLayer(d)}let h={vectorTile:l,rawData:hu(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}},u5=class{constructor(){this.loaded={}}loadTile(t){return rt(this,null,function*(){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+4,u=i.height+4,h=Ca(i)?new Zt({width:l,height:u},yield ap(i,-2,-2,l,u)):i,c=new jl(e,h,r,n,a,s,o);return this.loaded||(this.loaded={}),this.loaded[e]=c,c})}removeTile(t){let e=this.loaded,r=t.uid;e!=null&&e[r]&&delete e[r]}},h5=class{constructor(t,e,r,i=c5){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Gy,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new ly(n.features,{version:2,extent:mt});return{vectorTile:a,rawData:hu(a,np).buffer}}loadTile(t){return rt(this,null,function*(){let{uid:e}=t,r=new jy(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),yield this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}})}_parseWorkerTile(t,e){return rt(this,null,function*(){let r=this.tileState.getParsing(t.uid),i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Gt({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(t.uid)}return i})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}loadData(t){return rt(this,null,function*(){var r;(r=this._pendingRequest)==null||r.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let i={};return t.request&&(i.data=t.data),this._finishRequestTiming(e,t,i),i}catch(i){if(delete this._pendingRequest,!yl(i))throw i;return{abandoned:!0}}})}_startRequestTiming(t){var e;if((e=t.request)!=null&&e.collectResourceTiming)return new Xy(t.request.url)}_finishRequestTiming(t,e,r){let i=t==null?void 0:t.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return yield this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}loadAndProcessGeoJSON(t,e){return rt(this,null,function*(){var r;if(t.request&&(t.data=(yield up(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){(r=this._geoJSONIndex)!=null||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Yy(t)),this._geoJSONIndex==null)throw Error(`Input data given to \'${t.source}\' is not a valid GeoJSON object.`)})}_filterGeoJSON(t,e,r){if(t.type!=="FeatureCollection")return t;let i=this._getFilterPredicate(e,r);return i?{type:"FeatureCollection",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!="boolean"&&!(t!=null&&t.length))return;let r=er(t,`sources.${e}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}removeSource(t){return rt(this,null,function*(){var e;(e=this._pendingRequest)==null||e.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function c5(t,e){let r=Gt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Yy(e)});return new Td(t,r)}function Yy({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=er(h,`sources.${r}.clusterProperties.${l}[1]`),p=er(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}function Uy(t){return rt(this,null,function*(){if(t.endsWith(".mjs")){yield import(t);return}let e=yield fetch(t,{credentials:"same-origin"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=yield e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{yield import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)})}var p5=class{constructor(t){this.self=t,this.actor=new sy(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=sp,this.self.removeProtocol=op,this.self.registerRTLTextPlugin=e=>{wr.setMethods(e)},this.self.makeRequest=Ma,this.actor.registerMessageHandler("LDT",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",(e,r)=>rt(this,null,function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",(e,r)=>rt(this,null,function*(){var n,a;if(!((a=(n=this.workerSources[e])==null?void 0:n[r.type])!=null&&a[r.source]))return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)})),this.actor.registerMessageHandler("RM",e=>rt(this,null,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)})),this.actor.registerMessageHandler("SR",(e,r)=>rt(this,null,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler("IS",(e,r)=>rt(this,null,function*(){yield Uy(r)})),this.actor.registerMessageHandler("SI",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler("UL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))})),this.actor.registerMessageHandler("UGS",(e,r)=>rt(this,null,function*(){let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]})),this.actor.registerMessageHandler("SL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).replace(r,this._getGlobalState(e))}))}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}_setImages(t,e){return rt(this,null,function*(){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}})}_syncRTLPluginState(t,e){return rt(this,null,function*(){return yield wr.syncState(e,Uy)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i5),e}_getWorkerSource(t,e,r){var i,n;if((i=this.workerSources)[t]||(i[t]={}),(n=this.workerSources[t])[e]||(n[e]={}),!this.workerSources[t][e][r]){let a={sendAsync:(s,o)=>(s.targetMapId=t,this.actor.sendAsync(s,o))};switch(e){case"vector":this.workerSources[t][e][r]=new l5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new h5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){var r,i;return(r=this.demWorkerSources)[t]||(r[t]={}),(i=this.demWorkerSources[t])[e]||(i[e]=new u5),this.demWorkerSources[t][e]}};mr(self)&&(self.worker=new p5(self));export{p5 as default};\n/*! Bundled license information:\n\nmaplibre-gl/dist/maplibre-gl-shared.mjs:\nmaplibre-gl/dist/maplibre-gl-worker.mjs:\n (**\n * MapLibre GL JS\n * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt\n *)\n*/\n'}}),j8=g({"src/plots/map/layers.js"(t,r){var i=t_(),n=tN().sanitizeHTML,a=vi(),o=y8();function s(t,r){this.subplot=t,this.uid=t.uid+"-"+r,this.index=r,this.idSource="source-"+this.uid,this.idLayer=o.layoutLayerPrefix+this.uid,this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}var l=s.prototype;function u(t){if(!t.visible)return!1;var r=t.source;if(Array.isArray(r)&&r.length>0){for(var n=0;n0}function c(t){var r={},n={};switch(t.type){case"circle":i.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":i.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity,"line-dasharray":t.line.dash});break;case"fill":i.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var o=t.symbol,s=a(o.textposition,o.iconsize);i.extendFlat(r,{"icon-image":o.icon,"icon-size":o.iconsize/10,"text-field":o.text,"text-size":o.textfont.size,"text-anchor":s.anchor,"text-offset":s.offset,"symbol-placement":o.placement}),i.extendFlat(n,{"icon-color":t.color,"text-color":o.textfont.color,"text-opacity":t.opacity});break;case"raster":i.extendFlat(n,{"raster-fade-duration":0,"raster-opacity":t.opacity})}return{layout:r,paint:n}}l.update=function(t){this.visible?this.needsNewImage(t)?this.updateImage(t):this.needsNewSource(t)?(this.removeLayer(),this.updateSource(t),this.updateLayer(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=u(t)},l.needsNewImage=function(t){return this.subplot.map.getSource(this.idSource)&&"image"===this.sourceType&&"image"===t.sourcetype&&(this.source!==t.source||JSON.stringify(this.coordinates)!==JSON.stringify(t.coordinates))},l.needsNewSource=function(t){return this.sourceType!==t.sourcetype||JSON.stringify(this.source)!==JSON.stringify(t.source)||this.layerType!==t.type},l.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(t){this.subplot.map.getSource(this.idSource).updateImage({url:t.source,coordinates:t.coordinates});var r=this.findFollowingMapLayerId(this.lookupBelow());null!==r&&this.subplot.map.moveLayer(this.idLayer,r)},l.updateSource=function(t){var r=this.subplot.map;if(r.getSource(this.idSource)&&r.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,u(t)){var i,a,o,s,l,c=(o=(i=t).sourcetype,s=i.source,l={type:o},"geojson"===o?a="data":"vector"===o?a="string"==typeof s?"url":"tiles":"raster"===o?(a="tiles",l.tileSize=256):"image"===o&&(a="url",l.coordinates=i.coordinates),l[a]=s,i.sourceattribution&&(l.attribution=n(i.sourceattribution)),l);r.addSource(this.idSource,c)}},l.findFollowingMapLayerId=function(t){if("traces"===t)for(var r=this.subplot.getMapLayers(),i=0;i(!y[t]&&/^[a-zA-Z0-9-]+$/.test(t)&&(y[t]=new Promise(r=>{let i=new Image(15,15);i.onload=()=>{g.addImage(t,i,{sdf:!0}),r()},i.onerror=()=>r(),i.crossOrigin="Anonymous",i.src=`https://cdn.jsdelivr.net/npm/@mapbox/maki@8.2.0/icons/${t}.svg`})),y[t])),g.setTransformRequest(function(t){return{url:t=(t=(t=t.replace("https://fonts.openmaptiles.org/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold")).replace("https://tiles.basemaps.cartocdn.com/fonts/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold")).replace("https://fonts.openmaptiles.org/Open Sans Regular,Arial Unicode MS Regular","https://fonts.openmaptiles.org/Klokantech Noto Sans Regular")}}),g._canvas.style.left="0px",g._canvas.style.top="0px",u.rejectOnError(l),u.isStatic||u.initFx(t,r);var v=[];v.push(new Promise(function(t){g.once("load",t)})),Promise.all(v=v.concat(s.fetchTraceGeoData(t))).then(function(){m&&M(u,c),k(u,c),u.fillBelowLookup(t,r),u.updateData(t),u.updateLayout(r),u.resolveOnRender(o)}).catch(l)},A.updateMap=function(t,r,i,n){var a=this,o=a.map,l=r[this.id];a.rejectOnError(n);var u=[],c=E(l.style);JSON.stringify(a.styleObj)!==JSON.stringify(c)&&(a.styleObj=c,o.setStyle(c.style),a.traceHash={},u.push(new Promise(function(t){o.once("styledata",t)}))),Promise.all(u=u.concat(s.fetchTraceGeoData(t))).then(function(){a.fillBelowLookup(t,r),a.updateData(t);let n=l._fitBounds;n&&(o.fitBounds([[n.west,n.south],[n.east,n.north]],{padding:_.fitBoundsPadding,animate:!1}),M(a,l),k(a,l)),a.updateLayout(r),a.resolveOnRender(i)}).catch(n)},A.fillBelowLookup=function(t,r){var i,n,a=r[this.id].layers,o=this.belowLookup={},s=!1;for(i=0;i1)for(i=0;ir.project(t).x,_subplot:r},r.yaxis={_id:"y",c2p:t=>r.project(t).y,_subplot:r},r.updateFramework(t),r.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},u.setConvert(r.mockAxis,t)},A.initFx=function(t,r){var i=this,n=i.gd,a=i.map;function o(){h.loneUnhover(r._hoverlayer)}function s(){var t=i.getView();n.emit("plotly_relayouting",i.getViewEditsWithDerived(t))}a.on("moveend",function(t){if(i.map){var r=n._fullLayout;if(t.originalEvent||i.wheeling){var a=r[i.id];l.call("_storeDirectGUIEdit",n.layout,r._preGUI,i.getViewEdits(a));var o=i.getView();a._input.center=a.center=o.center,a._input.zoom=a.zoom=o.zoom,a._input.bearing=a.bearing=o.bearing,a._input.pitch=a.pitch=o.pitch,n.emit("plotly_relayout",i.getViewEditsWithDerived(o))}t.originalEvent&&"mouseup"===t.originalEvent.type?i.dragging=!1:i.wheeling&&(i.wheeling=!1),r&&r._rehover&&r._rehover()}}),a.on("wheel",function(){i.wheeling=!0}),a.on("mousemove",function(t){var r=i.div.getBoundingClientRect(),o=[t.originalEvent.offsetX,t.originalEvent.offsetY];t.target.getBoundingClientRect=function(){return r},i.xaxis.p2c=function(){return a.unproject(o).lng},i.yaxis.p2c=function(){return a.unproject(o).lat},n._fullLayout._rehover=function(){n._fullLayout._hoversubplot===i.id&&n._fullLayout[i.id]&&h.hover(n,t,i.id)},h.hover(n,t,i.id),n._fullLayout._hoversubplot=i.id}),a.on("dragstart",function(){i.dragging=!0,o()}),a.on("zoomstart",o),a.on("mouseout",function(){n._fullLayout._hoversubplot=null}),a.on("drag",s),a.on("zoom",s),a.on("dblclick",function(){var t=n._fullLayout[i.id];l.call("_storeDirectGUIEdit",n.layout,n._fullLayout._preGUI,i.getViewEdits(t));var r=i.viewInitial;a.setCenter(D(r.center)),a.setZoom(r.zoom),a.setBearing(r.bearing),a.setPitch(r.pitch);var o=i.getView();t._input.center=t.center=o.center,t._input.zoom=t.zoom=o.zoom,t._input.bearing=t.bearing=o.bearing,t._input.pitch=t.pitch=o.pitch,n.emit("plotly_doubleclick",null),n.emit("plotly_relayout",i.getViewEditsWithDerived(o))}),i.clearOutline=function(){v(i.dragOptions),y(i.dragOptions.gd)},i.onClickInPanFn=function(t){return function(r){var a=n._fullLayout.clickmode;a.indexOf("select")>-1&&x(r.originalEvent,n,[i.xaxis],[i.yaxis],i.id,t),a.indexOf("event")>-1&&h.click(n,r.originalEvent)}}},A.updateFx=function(t){var r=this,i=r.map,n=r.gd;if(!r.isStatic){var a=t.dragmode,s=r.dragOptions;r.dragOptions=o.extendDeep(s||{},{dragmode:t.dragmode,element:r.div,gd:n,plotinfo:{id:r.id,domain:t[r.id].domain,xaxis:r.xaxis,yaxis:r.yaxis,fillRangeItems:function(t,i){i.isRect?(t.range={})[r.id]=[l([i.xmin,i.ymin]),l([i.xmax,i.ymax])]:(t.lassoPoints={})[r.id]=i.map(l)}},xaxes:[r.xaxis],yaxes:[r.yaxis],subplot:r.id}),i.off("click",r.onClickInPanHandler),m(a)||p(a)?(i.dragPan.disable(),i.on("zoomstart",r.clearOutline),r.dragOptions.prepFn=function(t,i,n){g(t,i,n,r.dragOptions,a)},c.init(r.dragOptions)):(i.dragPan.enable(),i.off("zoomstart",r.clearOutline),r.div.onmousedown=null,r.div.ontouchstart=null,r.div.removeEventListener("touchstart",r.div._ontouchstart),r.onClickInPanHandler=r.onClickInPanFn(r.dragOptions),i.on("click",r.onClickInPanHandler))}function l(t){var i=r.map.unproject(t);return[i.lng,i.lat]}},A.updateFramework=function(t){var r=t[this.id].domain,i=t._size,n=this.div.style;n.width=i.w*(r.x[1]-r.x[0])+"px",n.height=i.h*(r.y[1]-r.y[0])+"px",n.left=i.l+r.x[0]*i.w+"px",n.top=i.t+(1-r.y[1])*i.h+"px",this.xaxis._offset=i.l+r.x[0]*i.w,this.xaxis._length=i.w*(r.x[1]-r.x[0]),this.yaxis._offset=i.t+(1-r.y[1])*i.h,this.yaxis._length=i.h*(r.y[1]-r.y[0])},A.updateLayers=function(t){var r,i=t[this.id].layers,n=this.layerList;if(i.length!==n.length){for(r=0;rNe});var Nt,Nr=m({"src/plots/map/get_map_fit_bounds.ts"(){Nt=x(pD())}}),Ni=g({"src/plots/map/layout_defaults.js"(t,r){var i=t_(),n=sr(),a=tJ(),o=y7(),{getMapFitBounds:s}=(Nr(),b(j9));function l(t,r,i,n){i("style"),i("center.lon"),i("center.lat"),i("zoom"),i("bearing"),i("pitch");let o=i("fitbounds");var l=i("bounds.west"),c=i("bounds.east"),h=i("bounds.south"),d=i("bounds.north");(void 0===l||void 0===c||void 0===h||void 0===d)&&delete r.bounds,a(t,r,{name:"layers",handleItemDefaults:u}),r._fitBounds=null;let{_fitView:{center:f,zoom:p}={},center:m,zoom:g}=t,y=m?.lon===f?.lon&&m?.lat===f?.lat&&g===p;if(o&&y){let t=s(n.fullData,n.id);t&&(r._fitBounds=t)}r._input=t}function u(t,r){function n(n,a){return i.coerce(t,r,o.layers,n,a)}if(n("visible")){var a,s=n("sourcetype"),l="raster"===s||"image"===s;n("source"),n("sourceattribution"),"vector"===s&&n("sourcelayer"),"image"===s&&n("coordinates"),l&&(a="raster");var u=n("type",a);l&&"raster"!==u&&(u=r.type="raster",i.log("Source types *raster* and *image* must drawn *raster* layer type.")),n("below"),n("color"),n("opacity"),n("minzoom"),n("maxzoom"),"circle"===u&&n("circle.radius"),"line"===u&&(n("line.width"),n("line.dash")),"fill"===u&&n("fill.outlinecolor"),"symbol"===u&&(n("symbol.icon"),n("symbol.iconsize"),n("symbol.text"),i.coerceFont(n,"symbol.textfont",void 0,{noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0}),n("symbol.textposition"),n("symbol.placement"))}}r.exports=function(t,r,i){n(t,r,i,{type:"map",attributes:o,handleDefaults:l,partition:"y",fullData:i})}}}),Nn=g({"src/plots/map/index.js"(t){var r=t_(),i=r.strTranslate,n=r.strScale,a=tF().getSubplotCalcData,o=tB(),s=k(),l=rr(),u=tN(),c=j7();t.name="map",t.attr="subplot",t.idRoot="map",t.idRegex=t.attrRegex=r.counterRegex("map"),t.attributes={subplot:{valType:"subplotid",dflt:"map",editType:"calc"}},t.layoutAttributes=y7(),t.supplyLayoutDefaults=Ni(),t.plot=function(t){for(var r=t._fullLayout,i=t.calcdata,n=r._subplots.map,o=0;ox/2){var b=m.split("|").join("
");y.text(b).attr("data-unformatted",b).call(u.convertToTspans,t),v=l.bBox(y.node())}y.attr("transform",i(-3,-v.height+8)),g.insert("rect",".static-attribution").attr({x:-v.width-6,y:-v.height-3,width:v.width+6,height:v.height+3,fill:"rgba(255, 255, 255, 0.75)"});var _=1;v.width+6>x&&(_=x/(v.width+6));var w=[c.l+c.w*f.x[1],c.t+c.h*(1-f.y[0])];g.attr("transform",i(w[0],w[1])+n(_))}},t.updateFx=function(t){for(var r=t._fullLayout,i=r._subplots.map,n=0;n=0;i--)t.removeLayer(r[i][1])},s.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},r.exports=function(t,r){var n=r[0].trace,a=new o(t,n.uid),s=a.sourceId,l=i(r),u=a.below=t.belowLookup["trace-"+n.uid];return t.map.addSource(s,{type:"geojson",data:l.geojson}),a._addLayers(l,u),r[0].trace._glTrace=a,a}}}),Nh=g({"src/traces/choroplethmap/index.js"(t,r){r.exports={attributes:Ns(),supplyDefaults:Nl(),colorbar:ou(),calc:p$(),plot:Nc(),hoverPoints:pZ(),eventData:pX(),selectPoints:pK(),styleOnSelect:function(t,r){r&&r[0].trace._glTrace.updateOnSelect(r)},getBelow:function(t,r){for(var i=r.getMapLayers(),n=i.length-2;n>=0;n--){var a=i[n].id;if("string"==typeof a&&0===a.indexOf("water")){for(var o=n+1;o0?+p[h]:0),d.push({type:"Feature",geometry:{type:"Point",coordinates:v},properties:x})}}var _=o.extractOpts(r),w=_.reversescale?o.flipScale(_.colorscale):_.colorscale,T=w[0][1],A=["interpolate",["linear"],["heatmap-density"],0,1>a.opacity(T)?T:a.addOpacity(T,0)];for(h=1;h=0;i--)t.removeLayer(r[i][1])},o.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},r.exports=function(t,r){var n=r[0].trace,o=new a(t,n.uid),s=o.sourceId,l=i(r),u=o.below=t.belowLookup["trace-"+n.uid];return t.map.addSource(s,{type:"geojson",data:l.geojson}),o._addLayers(l,u),o}}}),Nv=g({"src/traces/densitymap/hover.js"(t,r){var i=rs(),n=vo().hoverPoints,a=vo().getExtraText;r.exports=function(t,r,o){var s=n(t,r,o);if(s){var l=s[0],u=l.cd,c=u[0].trace,h=u[l.index];if(delete l.color,"z"in h){var d=l.subplot.mockAxis;l.z=h.z,l.zLabel=i.tickText(d,d.c2l(h.z),"hover").text}return l.extraText=a(c,h,u[0].t.labels),[l]}}}}),Nx=g({"src/traces/densitymap/event_data.js"(t,r){r.exports=function(t,r){return t.lon=r.lon,t.lat=r.lat,t.z=r.z,t}}}),Nb=g({"src/traces/densitymap/index.js"(t,r){r.exports={attributes:Nf(),supplyDefaults:Np(),colorbar:ou(),formatLabels:vr(),calc:Nm(),plot:Ny(),hoverPoints:Nv(),eventData:Nx(),getBelow:function(t,r){for(var i=r.getMapLayers(),n=0;na.addOpacity(v[r%v.length],.8))),y("customdata");var x=t.link||{},b=l.newContainer(r,"link");function _(t,r){return i.coerce(x,b,n.link,t,r)}_("label"),_("arrowlen"),_("source"),_("target"),_("value"),_("line.color"),_("line.width"),_("hoverinfo",t.hoverinfo),s(x,b,_,p),_("hovertemplate"),_("sort");var w=.333>a.luminosity(d.paper_bgcolor),T=_("color",w?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)");function A(t){if(!a.isValid(t))return t;let r=a.opacity(t);return r<=.8?a.addOpacity(t,r+.2):w?a.brighten(t,10):a.adjustLightness(t,-10)}_("hovercolor",Array.isArray(T)?T.map(A):A(T)),_("customdata"),u(x,b,{name:"colorscales",handleItemDefaults:c}),o(r,d,f),f("orientation"),f("direction"),f("valueformat"),f("valuesuffix"),f("arrangement",g.x.length&&g.y.length?"freeform":void 0),i.coerceFont(f,"textfont",d.font,{autoShadowDflt:!0}),r._length=null}}}),NA=g({"node_modules/strongly-connected-components/scc.js"(t,r){r.exports=function(t){for(var r=t.length,i=Array(r),n=Array(r),a=Array(r),o=Array(r),s=Array(r),l=Array(r),u=0;u0;){var p=t[r=f[f.length-1]];if(o[r]=0&&l[r].push(s[g])}o[r]=m}else{if(n[r]===i[r]){for(var y=[],v=[],x=0,m=u.length-1;m>=0;--m){var b=u[m];if(a[b]=!1,y.push(b),v.push(l[b]),x+=l[b].length,s[b]=h.length,b===r){u.length=m;break}}h.push(y);for(var _=Array(x),m=0;mb&&(b=u.source[r]),u.target[r]>b&&(b=u.target[r]);var _=b+1;t.node._count=_;var w,T=t.node.groups,A={};for(r=0;r0&&s(I,_)&&s(L,_)&&!(A.hasOwnProperty(I)&&A.hasOwnProperty(L)&&A[I]===A[L])){A.hasOwnProperty(L)&&(L=A[L]),A.hasOwnProperty(I)&&(I=A[I]),L*=1,p[I*=1]=p[L]=!0;var P="";u.label&&u.label[r]&&(P=u.label[r]);var z=null;P&&m.hasOwnProperty(P)&&(z=m[P]),c.push({pointNumber:r,label:P,color:h?u.color[r]:u.color,hovercolor:d?u.hovercolor[r]:u.hovercolor,customdata:f?u.customdata[r]:u.customdata,concentrationscale:z,source:I,target:L,value:+C}),E.push(I),D.push(L)}}var F=_+T.length,O=o(a.color),R=o(a.customdata),B=[];for(r=0;r_-1,childrenNodes:[],pointNumber:r,label:j,color:O?a.color[r]:a.color,customdata:R?a.customdata[r]:a.customdata})}var N=!1;return function(t,r,a){for(var o=n.init2dArray(t,0),s=0;s1})}(F,E,D)&&(N=!0),{circular:N,links:c,nodes:B,groups:T,groupLookup:A}}(r);return a({circular:u.circular,_nodes:u.nodes,_links:u.links,_groups:u.groups,_groupLookup:u.groupLookup})}}}),Nk=g({"node_modules/d3-quadtree/dist/d3-quadtree.js"(t,r){var i;i=t,function(t){function r(t,r,i,n){if(isNaN(r)||isNaN(i))return t;var a,o,s,l,u,c,h,d,f,p=t._root,m={data:n},g=t._x0,y=t._y0,v=t._x1,x=t._y1;if(!p)return t._root=m,t;for(;p.length;)if((c=r>=(o=(g+v)/2))?g=o:v=o,(h=i>=(s=(y+x)/2))?y=s:x=s,a=p,!(p=p[d=h<<1|c]))return a[d]=m,t;if(l=+t._x.call(null,p.data),u=+t._y.call(null,p.data),r===l&&i===u)return m.next=p,a?a[d]=m:t._root=m,t;do a=a?a[d]=[,,,,]:t._root=[,,,,],(c=r>=(o=(g+v)/2))?g=o:v=o,(h=i>=(s=(y+x)/2))?y=s:x=s;while((d=h<<1|c)==(f=(u>=s)<<1|l>=o));return a[f]=p,a[d]=m,t}function i(t,r,i,n,a){this.node=t,this.x0=r,this.y0=i,this.x1=n,this.y1=a}function n(t){return t[0]}function a(t){return t[1]}function o(t,r,i){var o=new s(r??n,i??a,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function s(t,r,i,n,a,o){this._x=t,this._y=r,this._x0=i,this._y0=n,this._x1=a,this._y1=o,this._root=void 0}function l(t){for(var r={data:t.data},i=r;t=t.next;)i=i.next={data:t.data};return r}var u=o.prototype=s.prototype;u.copy=function(){var t,r,i=new s(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=l(n),i;for(t=[{source:n,target:i._root=[,,,,]}];n=t.pop();)for(var a=0;a<4;++a)(r=n.source[a])&&(r.length?t.push({source:r,target:n.target[a]=[,,,,]}):n.target[a]=l(r));return i},u.add=function(t){var i=+this._x.call(null,t),n=+this._y.call(null,t);return r(this.cover(i,n),i,n,t)},u.addAll=function(t){var i,n,a,o,s=t.length,l=Array(s),u=Array(s),c=1/0,h=1/0,d=-1/0,f=-1/0;for(n=0;nd&&(d=a),of&&(f=o));if(c>d||h>f)return this;for(this.cover(c,h).cover(d,f),n=0;nt||t>=a||n>r||r>=o;)switch((s=[,,,,])[l=(rp||(s=c.y0)>m||(l=c.x1)=x)<<1|t>=v)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=c)}else{var b=t-this._x.call(null,y.data),_=r-this._y.call(null,y.data),w=b*b+_*_;if(w=(l=(m+y)/2))?m=l:y=l,(h=s>=(u=(g+v)/2))?g=u:v=u,r=p,!(p=p[d=h<<1|c]))return this;if(!p.length)break;(r[d+1&3]||r[d+2&3]||r[d+3&3])&&(i=r,f=d)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(a=p.next)&&delete p.next,n?a?n.next=a:delete n.next:r?(a?r[d]=a:delete r[d],(p=r[0]||r[1]||r[2]||r[3])&&p===(r[3]||r[2]||r[1]||r[0])&&!p.length&&(i?i[f]=p:this._root=p)):this._root=a,this},u.removeAll=function(t){for(var r=0,i=t.length;rtypeof r?t:(i=i||self).d3=i.d3||{})}}),NS=g({"node_modules/d3-collection/dist/d3-collection.js"(t,r){(function(t){function r(){}function i(t,i){var n=new r;if(t instanceof r)t.each(function(t,r){n.set(r,t)});else if(Array.isArray(t)){var a,o=-1,s=t.length;if(null==i)for(;++o=u.length)return null!=t&&n.sort(t),null!=r?r(n):n;for(var l,c,d,f=-1,p=n.length,m=u[a++],g=i(),y=o();++fu.length)return i;var a,o=c[n-1];return null!=r&&n>=u.length?a=i.entries():(a=[],i.each(function(r,i){a.push({key:i,values:t(r,n)})})),null!=o?a.sort(function(t,r){return o(t.key,r.key)}):a}(h(t,0,o,s),0)},key:function(t){return u.push(t),l},sortKeys:function(t){return c[u.length-1]=t,l},sortValues:function(r){return t=r,l},rollup:function(t){return r=t,l}}},t.set=c,t.map=i,t.keys=function(t){var r=[];for(var i in t)r.push(i);return r},t.values=function(t){var r=[];for(var i in t)r.push(t[i]);return r},t.entries=function(t){var r=[];for(var i in t)r.push({key:i,value:t[i]});return r},Object.defineProperty(t,"__esModule",{value:!0})})("object"==typeof t&&"u">typeof r?t:t.d3=t.d3||{})}}),NE=g({"node_modules/d3-dispatch/dist/d3-dispatch.js"(t,r){var i;i=t,function(t){var r={value:function(){}};function i(){for(var t,r=0,i=arguments.length,a={};r=0&&(r=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:r}}),s=-1,l=o.length;if(arguments.length<2){for(;++s0)for(var i,n,a=Array(i),o=0;otypeof r?t:(i=i||self).d3=i.d3||{})}}),ND=g({"node_modules/d3-timer/dist/d3-timer.js"(t,r){var i;i=t,function(t){var r,i,n=0,a=0,o=0,s=0,l=0,u=0,c="object"==typeof performance&&performance.now?performance:Date,h="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function d(){return l||(h(f),l=c.now()+u)}function f(){l=0}function p(){this._call=this._time=this._next=null}function m(t,r,i){var n=new p;return n.restart(t,r,i),n}function g(){d(),++n;for(var t,i=r;i;)(t=l-i._time)>=0&&i._call.call(null,t),i=i._next;--n}function y(){l=(s=c.now())+u,n=a=0;try{g()}finally{n=0,function(){for(var t,n,a=r,o=1/0;a;)a._call?(o>a._time&&(o=a._time),t=a,a=a._next):(n=a._next,a._next=null,a=t?t._next=n:r=n);i=t,x(o)}(),l=0}}function v(){var t=c.now(),r=t-s;r>1e3&&(u-=r,s=t)}function x(t){!n&&(a&&(a=clearTimeout(a)),t-l>24?(t<1/0&&(a=setTimeout(y,t-c.now()-u)),o&&(o=clearInterval(o))):(o||(s=c.now(),o=setInterval(v,1e3)),n=1,h(y)))}p.prototype=m.prototype={constructor:p,restart:function(t,n,a){if("function"!=typeof t)throw TypeError("callback is not a function");a=(null==a?d():+a)+(null==n?0:+n),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=t,this._time=a,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}},t.interval=function(t,r,i){var n=new p,a=r;return null==r?n.restart(t,r,i):(r*=1,i=null==i?d():+i,n.restart(function o(s){s+=a,n.restart(o,a+=r,i),t(s)},r,i)),n},t.now=d,t.timeout=function(t,r,i){var n=new p;return r=null==r?0:+r,n.restart(function(i){n.stop(),t(i+r)},r,i),n},t.timer=m,t.timerFlush=g,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof t&&"u">typeof r?t:(i=i||self).d3=i.d3||{})}}),NC=g({"node_modules/d3-force/dist/d3-force.js"(t,r){var i;i=function(t,r,i,n,a){function o(t){return function(){return t}}function s(){return(Math.random()-.5)*1e-6}function l(t){return t.x+t.vx}function u(t){return t.y+t.vy}function c(t){return t.index}function h(t,r){var i=t.get(r);if(!i)throw Error("missing: "+r);return i}function d(t){return t.x}function f(t){return t.y}var p=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,r){var i;function n(){var n,a,o=i.length,s=0,l=0;for(n=0;nh.index){var d=f-l.x-l.vx,y=p-l.y-l.vy,v=d*d+y*y;vf+c||np+c||ot.r&&(t.r=t[r].r)}function f(){if(i){var r,a,o=i.length;for(n=Array(o),r=0;r=c)){(t.data!==i||t.next)&&(0===d&&(m+=(d=s())*d),0===f&&(m+=(f=s())*f),m1?(null==i?h.remove(t):h.set(t,v(i)),r):h.get(t)},find:function(r,i,n){var a,o,s,l,u,c=0,h=t.length;for(null==n?n=1/0:n*=n,c=0;c1?(f.on(t,i),r):f.on(t)}}},t.forceX=function(t){var r,i,n,a=o(.1);function s(t){for(var a,o=0,s=r.length;otypeof r?i(t,Nk(),NS(),NE(),ND()):i(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3)}}),NI=g({"node_modules/d3-array/dist/d3-array.js"(t,r){var i;i=t,function(t){function r(t,r){return tr?1:t>=r?0:NaN}function i(t){var i;let n=t,a=t;function o(t,r,i,n){for(null==i&&(i=0),null==n&&(n=t.length);i>>1;0>a(t[o],r)?i=o+1:n=o}return i}return 1===t.length&&(n=(r,i)=>t(r)-i,i=t,a=(t,n)=>r(i(t),n)),{left:o,center:function(t,r,i,a){null==i&&(i=0),null==a&&(a=t.length);let s=o(t,r,i,a-1);return s>i&&n(t[s-1],r)>-n(t[s],r)?s-1:s},right:function(t,r,i,n){for(null==i&&(i=0),null==n&&(n=t.length);i>>1;a(t[o],r)>0?n=o:i=o+1}return i}}}function n(t){return null===t?NaN:+t}let a=i(r),o=a.right,s=a.left,l=i(n).center;function u(t,r){let i=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&++i;else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(a*=1)>=a&&++i}return i}function c(t){return 0|t.length}function h(t){return!(t>0)}function d(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function f(t,r){let i=0,n,a=0,o=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(n=r-a,a+=n/++i,o+=n*(r-a));else{let s=-1;for(let l of t)null!=(l=r(l,++s,t))&&(l*=1)>=l&&(n=l-a,a+=n/++i,o+=n*(l-a))}if(i>1)return o/(i-1)}function p(t,r){let i=f(t,r);return i&&Math.sqrt(i)}function m(t,r){let i,n;if(void 0===r)for(let r of t)null!=r&&(void 0===i?r>=r&&(i=n=r):(i>r&&(i=r),n=o&&(i=n=o):(i>o&&(i=o),n0){for(o=t[--r];r>0&&(o=(i=o)+(n=t[--r]),!(a=n-(o-i))););r>0&&(a<0&&t[r-1]<0||a>0&&t[r-1]>0)&&(i=o+(n=2*a),n==i-o&&(o=i))}return o}}class y extends Map{constructor(t,r=w){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),null!=t)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(x(this,t))}has(t){return super.has(x(this,t))}set(t,r){return super.set(b(this,t),r)}delete(t){return super.delete(_(this,t))}}class v extends Set{constructor(t,r=w){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),null!=t)for(let r of t)this.add(r)}has(t){return super.has(x(this,t))}add(t){return super.add(b(this,t))}delete(t){return super.delete(_(this,t))}}function x({_intern:t,_key:r},i){let n=r(i);return t.has(n)?t.get(n):i}function b({_intern:t,_key:r},i){let n=r(i);return t.has(n)?t.get(n):(t.set(n,i),i)}function _({_intern:t,_key:r},i){let n=r(i);return t.has(n)&&(i=t.get(i),t.delete(n)),i}function w(t){return null!==t&&"object"==typeof t?t.valueOf():t}function A(t){return t}function M(t,...r){return E(t,A,A,r)}function k(t,r,...i){return E(t,A,r,i)}function S(t){if(1!==t.length)throw Error("duplicate key");return t[0]}function E(t,r,i,n){return function t(a,o){if(o>=n.length)return i(a);let s=new y,l=n[o++],u=-1;for(let t of a){let r=l(t,++u,a),i=s.get(r);i?i.push(t):s.set(r,[t])}for(let[r,i]of s)s.set(r,t(i,o));return r(s)}(t,0)}function D(t,r){return Array.from(r,r=>t[r])}function C(t,...i){if("function"!=typeof t[Symbol.iterator])throw TypeError("values is not iterable");t=Array.from(t);let[n=r]=i;if(1===n.length||i.length>1){let a=Uint32Array.from(t,(t,r)=>r);return i.length>1?(i=i.map(r=>t.map(r)),a.sort((t,n)=>{for(let a of i){let i=r(a[t],a[n]);if(i)return i}})):(n=t.map(n),a.sort((t,i)=>r(n[t],n[i]))),D(t,a)}return t.sort(n)}var I=Array.prototype.slice;function L(t){return function(){return t}}var P=Math.sqrt(50),z=Math.sqrt(10),F=Math.sqrt(2);function O(t,r,i){var n,a,o,s,l=-1;if(i*=1,(t*=1)==(r*=1)&&i>0)return[t];if((n=r0){let i=Math.round(t/s),n=Math.round(r/s);for(i*sr&&--n,o=Array(a=n-i+1);++lr&&--n,o=Array(a=n-i+1);++l=0?(o>=P?10:o>=z?5:o>=F?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(o>=P?10:o>=z?5:o>=F?2:1)}function B(t,r,i){let n;for(;;){let a=R(t,r,i);if(a===n||0===a||!isFinite(a))return[t,r];a>0?(t=Math.floor(t/a)*a,r=Math.ceil(r/a)*a):a<0&&(t=Math.ceil(t*a)/a,r=Math.floor(r*a)/a),n=a}}function j(t){return Math.ceil(Math.log(u(t))/Math.LN2)+1}function N(){var t=A,r=m,i=j;function n(n){Array.isArray(n)||(n=Array.from(n));var a,s,l=n.length,u=Array(l);for(a=0;a=d)if(t>=d&&r===m){let t=R(h,d,i);isFinite(t)&&(t>0?d=(Math.floor(d/t)+1)*t:t<0&&(d=-((Math.ceil(-(d*t))+1)/t)))}else f.pop()}for(var p=f.length;f[0]<=h;)f.shift(),--p;for(;f[p-1]>d;)f.pop(),--p;var g,y=Array(p+1);for(a=0;a<=p;++a)(g=y[a]=[]).x0=a>0?f[a-1]:h,g.x1=a=r)&&(i=r);else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(i=a)&&(i=a)}return i}function U(t,r){let i;if(void 0===r)for(let r of t)null!=r&&(i>r||void 0===i&&r>=r)&&(i=r);else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(i>a||void 0===i&&a>=a)&&(i=a)}return i}function q(t,i,n=0,a=t.length-1,o=r){for(;a>n;){if(a-n>600){let r=a-n+1,s=i-n+1,l=Math.log(r),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(r-u)/r)*(s-r/2<0?-1:1),h=Math.max(n,Math.floor(i-s*u/r+c)),d=Math.min(a,Math.floor(i+(r-s)*u/r+c));q(t,i,h,d,o)}let r=t[i],s=n,l=a;for(G(t,n,i),o(t[a],r)>0&&G(t,n,a);so(t[s],r);)++s;for(;o(t[l],r)>0;)--l}0===o(t[n],r)?G(t,n,l):G(t,++l,a),l<=i&&(n=l+1),i<=l&&(a=l-1)}return t}function G(t,r,i){let n=t[r];t[r]=t[i],t[i]=n}function H(t,r,i){if(n=(t=Float64Array.from(function*(t,r){if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(yield r);else{let i=-1;for(let n of t)null!=(n=r(n,++i,t))&&(n*=1)>=n&&(yield n)}}(t,i))).length){if((r*=1)<=0||n<2)return U(t);if(r>=1)return V(t);var n,a=(n-1)*r,o=Math.floor(a),s=V(q(t,o).subarray(0,o+1));return s+(U(t.subarray(o+1))-s)*(a-o)}}function $(t,r){let i,n=-1,a=-1;if(void 0===r)for(let r of t)++a,null!=r&&(i=r)&&(i=r,n=a);else for(let o of t)null!=(o=r(o,++a,t))&&(i=o)&&(i=o,n=a);return n}function W(t,r){let i,n=-1,a=-1;if(void 0===r)for(let r of t)++a,null!=r&&(i>r||void 0===i&&r>=r)&&(i=r,n=a);else for(let o of t)null!=(o=r(o,++a,t))&&(i>o||void 0===i&&o>=o)&&(i=o,n=a);return n}function Y(t,r){return[t,r]}function Z(t,i=r){if(1===i.length)return W(t,i);let n,a=-1,o=-1;for(let r of t)++o,(a<0?0===i(r,r):0>i(r,n))&&(n=r,a=o);return a}var X=K(Math.random);function K(t){return function(r,i=0,n=r.length){let a=n-(i*=1);for(;a;){let n=t()*a--|0,o=r[a+i];r[a+i]=r[n+i],r[n+i]=o}return r}}function J(t){if(!(a=t.length))return[];for(var r=-1,i=U(t,Q),n=Array(i);++rr(...t)),n=(t=t.map(d)).map(c),a=t.length-1,o=Array(a+1).fill(0),s=[];if(a<0||n.some(h))return s;for(;;){s.push(o.map((r,i)=>t[i][r]));let r=a;for(;++o[r]===n[r];){if(0===r)return i?s.map(i):s;o[r--]=0}}},t.cumsum=function(t,r){var i=0,n=0;return Float64Array.from(t,void 0===r?t=>i+=+t||0:a=>i+=+r(a,n++,t)||0)},t.descending=function(t,r){return rt?1:r>=t?0:NaN},t.deviation=p,t.difference=function(t,...r){for(let i of(t=new Set(t),r))for(let r of i)t.delete(r);return t},t.disjoint=function(t,r){let i=r[Symbol.iterator](),n=new Set;for(let r of t){let t,a;if(n.has(r))return!1;for(;({value:t,done:a}=i.next())&&!a;){if(Object.is(r,t))return!1;n.add(t)}}return!0},t.every=function(t,r){if("function"!=typeof r)throw TypeError("test is not a function");let i=-1;for(let n of t)if(!r(n,++i,t))return!1;return!0},t.extent=m,t.fcumsum=function(t,r){let i=new g,n=-1;return Float64Array.from(t,void 0===r?t=>i.add(+t||0):a=>i.add(+r(a,++n,t)||0))},t.filter=function(t,r){if("function"!=typeof r)throw TypeError("test is not a function");let i=[],n=-1;for(let a of t)r(a,++n,t)&&i.push(a);return i},t.fsum=function(t,r){let i=new g;if(void 0===r)for(let r of t)(r*=1)&&i.add(r);else{let n=-1;for(let a of t)(a=+r(a,++n,t))&&i.add(a)}return+i},t.greatest=function(t,i=r){let n,a=!1;if(1===i.length){let o;for(let s of t){let t=i(s);(a?r(t,o)>0:0===r(t,t))&&(n=s,o=t,a=!0)}}else for(let r of t)(a?i(r,n)>0:0===i(r,r))&&(n=r,a=!0);return n},t.greatestIndex=function(t,i=r){if(1===i.length)return $(t,i);let n,a=-1,o=-1;for(let r of t)++o,(a<0?0===i(r,r):i(r,n)>0)&&(n=r,a=o);return a},t.group=M,t.groupSort=function(t,i,n){return(1===i.length?C(k(t,i,n),([t,i],[n,a])=>r(i,a)||r(t,n)):C(M(t,n),([t,n],[a,o])=>i(n,o)||r(t,a))).map(([t])=>t)},t.groups=function(t,...r){return E(t,Array.from,A,r)},t.histogram=N,t.index=function(t,...r){return E(t,A,S,r)},t.indexes=function(t,...r){return E(t,Array.from,S,r)},t.intersection=function(t,...r){t=new Set(t),r=r.map(ee);e:for(let i of t)for(let n of r)if(!n.has(i)){t.delete(i);continue e}return t},t.least=function(t,i=r){let n,a=!1;if(1===i.length){let o;for(let s of t){let t=i(s);(a?0>r(t,o):0===r(t,t))&&(n=s,o=t,a=!0)}}else for(let r of t)(a?0>i(r,n):0===i(r,r))&&(n=r,a=!0);return n},t.leastIndex=Z,t.map=function(t,r){if("function"!=typeof t[Symbol.iterator])throw TypeError("values is not iterable");if("function"!=typeof r)throw TypeError("mapper is not a function");return Array.from(t,(i,n)=>r(i,n,t))},t.max=V,t.maxIndex=$,t.mean=function(t,r){let i=0,n=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(++i,n+=r);else{let a=-1;for(let o of t)null!=(o=r(o,++a,t))&&(o*=1)>=o&&(++i,n+=o)}if(i)return n/i},t.median=function(t,r){return H(t,.5,r)},t.merge=function(t){return Array.from(function*(t){for(let r of t)yield*T(r)}(t))},t.min=U,t.minIndex=W,t.nice=B,t.pairs=function(t,r=Y){let i=[],n,a=!1;for(let o of t)a&&i.push(r(n,o)),n=o,a=!0;return i},t.permute=D,t.quantile=H,t.quantileSorted=function(t,r,i=n){if(a=t.length){if((r*=1)<=0||a<2)return+i(t[0],0,t);if(r>=1)return+i(t[a-1],a-1,t);var a,o=(a-1)*r,s=Math.floor(o),l=+i(t[s],s,t);return l+(i(t[s+1],s+1,t)-l)*(o-s)}},t.quickselect=q,t.range=function(t,r,i){t*=1,r*=1,i=(a=arguments.length)<2?(r=t,t=0,1):a<3?1:+i;for(var n=-1,a=0|Math.max(0,Math.ceil((r-t)/i)),o=Array(a);++n=P?a*=10:o>=z?a*=5:o>=F&&(a*=2),rtypeof r?t:(i="u">typeof globalThis?globalThis:i||self).d3=i.d3||{})}}),NL=g({"node_modules/d3-path/dist/d3-path.js"(t,r){var i;i=t,function(t){var r=Math.PI,i=2*r,n=i-1e-6;function a(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function o(){return new a}a.prototype=o.prototype={constructor:a,moveTo:function(t,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+r)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,r){this._+="L"+(this._x1=+t)+","+(this._y1=+r)},quadraticCurveTo:function(t,r,i,n){this._+="Q"+ +t+","+ +r+","+(this._x1=+i)+","+(this._y1=+n)},bezierCurveTo:function(t,r,i,n,a,o){this._+="C"+ +t+","+ +r+","+ +i+","+ +n+","+(this._x1=+a)+","+(this._y1=+o)},arcTo:function(t,i,n,a,o){t*=1,i*=1,n*=1,a*=1,o*=1;var s=this._x1,l=this._y1,u=n-t,c=a-i,h=s-t,d=l-i,f=h*h+d*d;if(o<0)throw Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=i);else if(f>1e-6)if(Math.abs(d*u-c*h)>1e-6&&o){var p=n-s,m=a-l,g=u*u+c*c,y=Math.sqrt(g),v=Math.sqrt(f),x=o*Math.tan((r-Math.acos((g+f-(p*p+m*m))/(2*y*v)))/2),b=x/v,_=x/y;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*h)+","+(i+b*d)),this._+="A"+o+","+o+",0,0,"+ +(d*p>h*m)+","+(this._x1=t+_*u)+","+(this._y1=i+_*c)}else this._+="L"+(this._x1=t)+","+(this._y1=i)},arc:function(t,a,o,s,l,u){t*=1,a*=1,o*=1,u=!!u;var c=o*Math.cos(s),h=o*Math.sin(s),d=t+c,f=a+h,p=1^u,m=u?s-l:l-s;if(o<0)throw Error("negative radius: "+o);null===this._x1?this._+="M"+d+","+f:(Math.abs(this._x1-d)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+d+","+f),o&&(m<0&&(m=m%i+i),m>n?this._+="A"+o+","+o+",0,1,"+p+","+(t-c)+","+(a-h)+"A"+o+","+o+",0,1,"+p+","+(this._x1=d)+","+(this._y1=f):m>1e-6&&(this._+="A"+o+","+o+",0,"+ +(m>=r)+","+p+","+(this._x1=t+o*Math.cos(l))+","+(this._y1=a+o*Math.sin(l))))},rect:function(t,r,i,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+r)+"h"+ +i+"v"+ +n+"h"+-i+"Z"},toString:function(){return this._}},t.path=o,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof t&&"u">typeof r?t:(i=i||self).d3=i.d3||{})}}),NP=g({"node_modules/d3-shape/dist/d3-shape.js"(t,r){var i,n;i=t,n=function(t,r){function i(t){return function(){return t}}var n=Math.abs,a=Math.atan2,o=Math.cos,s=Math.max,l=Math.min,u=Math.sin,c=Math.sqrt,h=Math.PI,d=h/2,f=2*h;function p(t){return t>=1?d:t<=-1?-d:Math.asin(t)}function m(t){return t.innerRadius}function g(t){return t.outerRadius}function y(t){return t.startAngle}function v(t){return t.endAngle}function x(t){return t&&t.padAngle}function b(t,r,i,n,a,o,l){var u=t-i,h=r-n,d=(l?o:-o)/c(u*u+h*h),f=d*h,p=-d*u,m=t+f,g=r+p,y=i+f,v=n+p,x=(m+y)/2,b=(g+v)/2,_=y-m,w=v-g,T=_*_+w*w,A=a-o,M=m*v-y*g,k=(w<0?-1:1)*c(s(0,A*A*T-M*M)),S=(M*w-_*k)/T,E=(-M*_-w*k)/T,D=(M*w+_*k)/T,C=(-M*_+w*k)/T,I=S-x,L=E-b,P=D-x,z=C-b;return I*I+L*L>P*P+z*z&&(S=D,E=C),{cx:S,cy:E,x01:-f,y01:-p,x11:S*(a/A-1),y11:E*(a/A-1)}}function _(t){this._context=t}function w(t){return new _(t)}function T(t){return t[0]}function A(t){return t[1]}function M(){var t=T,n=A,a=i(!0),o=null,s=w,l=null;function u(i){var u,c,h,d=i.length,f=!1;for(null==o&&(l=s(h=r.path())),u=0;u<=d;++u)!(u=d;--f)c.point(v[f],x[f]);c.lineEnd(),c.areaEnd()}y&&(v[h]=+t(p,h,i),x[h]=+a(p,h,i),c.point(n?+n(p,h,i):v[h],o?+o(p,h,i):x[h]))}if(m)return c=null,m+""||null}function d(){return M().defined(s).curve(u).context(l)}return h.x=function(r){return arguments.length?(t="function"==typeof r?r:i(+r),n=null,h):t},h.x0=function(r){return arguments.length?(t="function"==typeof r?r:i(+r),h):t},h.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:i(+t),h):n},h.y=function(t){return arguments.length?(a="function"==typeof t?t:i(+t),o=null,h):a},h.y0=function(t){return arguments.length?(a="function"==typeof t?t:i(+t),h):a},h.y1=function(t){return arguments.length?(o=null==t?null:"function"==typeof t?t:i(+t),h):o},h.lineX0=h.lineY0=function(){return d().x(t).y(a)},h.lineY1=function(){return d().x(t).y(o)},h.lineX1=function(){return d().x(n).y(a)},h.defined=function(t){return arguments.length?(s="function"==typeof t?t:i(!!t),h):s},h.curve=function(t){return arguments.length?(u=t,null!=l&&(c=u(l)),h):u},h.context=function(t){return arguments.length?(null==t?l=c=null:c=u(l=t),h):l},h}function S(t,r){return rt?1:r>=t?0:NaN}function E(t){return t}_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r)}}};var D=I(w);function C(t){this._curve=t}function I(t){function r(r){return new C(t(r))}return r._curve=t,r}function L(t){var r=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?r(I(t)):r()._curve},t}function P(){return L(M().curve(D))}function z(){var t=k().curve(D),r=t.curve,i=t.lineX0,n=t.lineX1,a=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return L(i())},delete t.lineX0,t.lineEndAngle=function(){return L(n())},delete t.lineX1,t.lineInnerRadius=function(){return L(a())},delete t.lineY0,t.lineOuterRadius=function(){return L(o())},delete t.lineY1,t.curve=function(t){return arguments.length?r(I(t)):r()._curve},t}function F(t,r){return[(r*=1)*Math.cos(t-=Math.PI/2),r*Math.sin(t)]}C.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,r){this._curve.point(r*Math.sin(t),-(r*Math.cos(t)))}};var O=Array.prototype.slice;function R(t){return t.source}function B(t){return t.target}function j(t){var n=R,a=B,o=T,s=A,l=null;function u(){var i,u=O.call(arguments),c=n.apply(this,u),h=a.apply(this,u);if(l||(l=i=r.path()),t(l,+o.apply(this,(u[0]=c,u)),+s.apply(this,u),+o.apply(this,(u[0]=h,u)),+s.apply(this,u)),i)return l=null,i+""||null}return u.source=function(t){return arguments.length?(n=t,u):n},u.target=function(t){return arguments.length?(a=t,u):a},u.x=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),u):o},u.y=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),u):s},u.context=function(t){return arguments.length?(l=t??null,u):l},u}function N(t,r,i,n,a){t.moveTo(r,i),t.bezierCurveTo(r=(r+n)/2,i,r,a,n,a)}function V(t,r,i,n,a){t.moveTo(r,i),t.bezierCurveTo(r,i=(i+a)/2,n,i,n,a)}function U(t,r,i,n,a){var o=F(r,i),s=F(r,i=(i+a)/2),l=F(n,i),u=F(n,a);t.moveTo(o[0],o[1]),t.bezierCurveTo(s[0],s[1],l[0],l[1],u[0],u[1])}var q={draw:function(t,r){var i=Math.sqrt(r/h);t.moveTo(i,0),t.arc(0,0,i,0,f)}},G={draw:function(t,r){var i=Math.sqrt(r/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()}},H=Math.sqrt(1/3),$=2*H,W={draw:function(t,r){var i=Math.sqrt(r/$),n=i*H;t.moveTo(0,-i),t.lineTo(n,0),t.lineTo(0,i),t.lineTo(-n,0),t.closePath()}},Y=Math.sin(h/10)/Math.sin(7*h/10),Z=Math.sin(f/10)*Y,X=-Math.cos(f/10)*Y,K={draw:function(t,r){var i=Math.sqrt(.8908130915292852*r),n=Z*i,a=X*i;t.moveTo(0,-i),t.lineTo(n,a);for(var o=1;o<5;++o){var s=f*o/5,l=Math.cos(s),u=Math.sin(s);t.lineTo(u*i,-l*i),t.lineTo(l*n-u*a,u*n+l*a)}t.closePath()}},J={draw:function(t,r){var i=Math.sqrt(r),n=-i/2;t.rect(n,n,i,i)}},Q=Math.sqrt(3),ee={draw:function(t,r){var i=-Math.sqrt(r/(3*Q));t.moveTo(0,2*i),t.lineTo(-Q*i,-i),t.lineTo(Q*i,-i),t.closePath()}},et=Math.sqrt(3)/2,er=1/Math.sqrt(12),ei=(er/2+1)*3,en={draw:function(t,r){var i=Math.sqrt(r/ei),n=i/2,a=i*er,o=i*er+i,s=-n;t.moveTo(n,a),t.lineTo(n,o),t.lineTo(s,o),t.lineTo(-.5*n-et*a,et*n+-.5*a),t.lineTo(-.5*n-et*o,et*n+-.5*o),t.lineTo(-.5*s-et*o,et*s+-.5*o),t.lineTo(-.5*n+et*a,-.5*a-et*n),t.lineTo(-.5*n+et*o,-.5*o-et*n),t.lineTo(-.5*s+et*o,-.5*o-et*s),t.closePath()}},ea=[q,G,W,J,K,ee,en];function eo(){}function es(t,r,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+i)/6)}function el(t){this._context=t}function eu(t){this._context=t}function ec(t){this._context=t}function eh(t,r){this._basis=new el(t),this._beta=r}el.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:es(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);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:es(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},eu.prototype={areaStart:eo,areaEnd:eo,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)}},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:es(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},ec.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||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(i,n):this._context.moveTo(i,n);break;case 3:this._point=4;default:es(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},eh.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,r=this._y,i=t.length-1;if(i>0)for(var n,a=t[0],o=r[0],s=t[i]-a,l=r[i]-o,u=-1;++u<=i;)n=u/i,this._basis.point(this._beta*t[u]+(1-this._beta)*(a+n*s),this._beta*r[u]+(1-this._beta)*(o+n*l));this._x=this._y=null,this._basis.lineEnd()},point:function(t,r){this._x.push(+t),this._y.push(+r)}};var ed=function t(r){function i(t){return 1===r?new el(t):new eh(t,r)}return i.beta=function(r){return t(+r)},i}(.85);function ef(t,r,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-r),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function ep(t,r){this._context=t,this._k=(1-r)/6}ep.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:ef(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2,this._x1=t,this._y1=r;break;case 2:this._point=3;default:ef(this,t,r)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var em=function t(r){function i(t){return new ep(t,r)}return i.tension=function(r){return t(+r)},i}(0);function eg(t,r){this._context=t,this._k=(1-r)/6}eg.prototype={areaStart:eo,areaEnd:eo,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)}},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:ef(this,t,r)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ey=function t(r){function i(t){return new eg(t,r)}return i.tension=function(r){return t(+r)},i}(0);function ev(t,r){this._context=t,this._k=(1-r)/6}ev.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||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,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:ef(this,t,r)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ex=function t(r){function i(t){return new ev(t,r)}return i.tension=function(r){return t(+r)},i}(0);function eb(t,r,i){var n=t._x1,a=t._y1,o=t._x2,s=t._y2;if(t._l01_a>1e-12){var l=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*l-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,a=(a*l-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>1e-12){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,h=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-r*t._l12_2a)/h,s=(s*c+t._y1*t._l23_2a-i*t._l12_2a)/h}t._context.bezierCurveTo(n,a,o,s,t._x2,t._y2)}function e_(t,r){this._context=t,this._alpha=r}e_.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)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){if(t*=1,r*=1,this._point){var i=this._x2-t,n=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3;default:eb(this,t,r)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ew=function t(r){function i(t){return r?new e_(t,r):new ep(t,0)}return i.alpha=function(r){return t(+r)},i}(.5);function eT(t,r){this._context=t,this._alpha=r}eT.prototype={areaStart:eo,areaEnd:eo,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)}},point:function(t,r){if(t*=1,r*=1,this._point){var i=this._x2-t,n=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:eb(this,t,r)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var eA=function t(r){function i(t){return r?new eT(t,r):new eg(t,0)}return i.alpha=function(r){return t(+r)},i}(.5);function eM(t,r){this._context=t,this._alpha=r}eM.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||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){if(t*=1,r*=1,this._point){var i=this._x2-t,n=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,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:eb(this,t,r)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ek=function t(r){function i(t){return r?new eM(t,r):new ev(t,0)}return i.alpha=function(r){return t(+r)},i}(.5);function eS(t){this._context=t}eS.prototype={areaStart:eo,areaEnd:eo,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,r){t*=1,r*=1,this._point?this._context.lineTo(t,r):(this._point=1,this._context.moveTo(t,r))}};function eE(t,r,i){var n=t._x1-t._x0,a=r-t._x1,o=(t._y1-t._y0)/(n||a<0&&-0),s=(i-t._y1)/(a||n<0&&-0);return((o<0?-1:1)+(s<0?-1:1))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs((o*a+s*n)/(n+a)))||0}function eD(t,r){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-r)/2:r}function eC(t,r,i){var n=t._x0,a=t._y0,o=t._x1,s=t._y1,l=(o-n)/3;t._context.bezierCurveTo(n+l,a+l*r,o-l,s-l*i,o,s)}function eI(t){this._context=t}function eL(t){this._context=new eP(t)}function eP(t){this._context=t}function ez(t){this._context=t}function eF(t){var r,i,n=t.length-1,a=Array(n),o=Array(n),s=Array(n);for(a[0]=0,o[0]=2,s[0]=t[0]+2*t[1],r=1;r=0;--r)a[r]=(s[r]-a[r+1])/o[r];for(o[n-1]=(t[n]+a[n-1])/2,r=0;r1)for(var i,n,a,o=1,s=t[r[0]],l=s.length;o=0;)i[r]=r;return i}function ej(t,r){return t[r]}function eN(t){var r=t.map(eV);return eB(t).sort(function(t,i){return r[t]-r[i]})}function eV(t){for(var r,i=-1,n=0,a=t.length,o=-1/0;++io&&(o=r,n=i);return n}function eU(t){var r=t.map(eq);return eB(t).sort(function(t,i){return r[t]-r[i]})}function eq(t){for(var r,i=0,n=-1,a=t.length;++n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,r)}}this._x=t,this._y=r}},t.arc=function(){var t=m,s=g,_=i(0),w=null,T=y,A=v,M=x,k=null;function S(){var i,m,g=+t.apply(this,arguments),y=+s.apply(this,arguments),v=T.apply(this,arguments)-d,x=A.apply(this,arguments)-d,S=n(x-v),E=x>v;if(k||(k=i=r.path()),y1e-12)if(S>f-1e-12)k.moveTo(y*o(v),y*u(v)),k.arc(0,0,y,v,x,!E),g>1e-12&&(k.moveTo(g*o(x),g*u(x)),k.arc(0,0,g,x,v,E));else{var D,C,I=v,L=x,P=v,z=x,F=S,O=S,R=M.apply(this,arguments)/2,B=R>1e-12&&(w?+w.apply(this,arguments):c(g*g+y*y)),j=l(n(y-g)/2,+_.apply(this,arguments)),N=j,V=j;if(B>1e-12){var U=p(B/g*u(R)),q=p(B/y*u(R));(F-=2*U)>1e-12?(U*=E?1:-1,P+=U,z-=U):(F=0,P=z=(v+x)/2),(O-=2*q)>1e-12?(q*=E?1:-1,I+=q,L-=q):(O=0,I=L=(v+x)/2)}var G=y*o(I),H=y*u(I),$=g*o(z),W=g*u(z);if(j>1e-12){var Y,Z=y*o(L),X=y*u(L),K=g*o(P),J=g*u(P);if(S1?0:Q<-1?h:Math.acos(Q))/2),ea=c(Y[0]*Y[0]+Y[1]*Y[1]);N=l(j,(g-ea)/(en-1)),V=l(j,(y-ea)/(en+1))}}O>1e-12?V>1e-12?(D=b(K,J,G,H,y,V,E),C=b(Z,X,$,W,y,V,E),k.moveTo(D.cx+D.x01,D.cy+D.y01),V1e-12&&F>1e-12?N>1e-12?(D=b($,W,Z,X,g,-N,E),C=b(G,H,K,J,g,-N,E),k.lineTo(D.cx+D.x01,D.cy+D.y01),N0&&(m+=d);for(null!=r?g.sort(function(t,i){return r(y[t],y[i])}):null!=n&&g.sort(function(t,r){return n(i[t],i[r])}),l=0,c=m?(x-p*_)/m:0;l0?d*c:0)+_,y[u]={data:i[u],index:l,value:d,startAngle:v,endAngle:h,padAngle:b};return y}return l.value=function(r){return arguments.length?(t="function"==typeof r?r:i(+r),l):t},l.sortValues=function(t){return arguments.length?(r=t,n=null,l):r},l.sort=function(t){return arguments.length?(n=t,r=null,l):n},l.startAngle=function(t){return arguments.length?(a="function"==typeof t?t:i(+t),l):a},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),l):o},l.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),l):s},l},t.pointRadial=F,t.radialArea=z,t.radialLine=P,t.stack=function(){var t=i([]),r=eB,n=eR,a=ej;function o(i){var o,s,l=t.apply(this,arguments),u=i.length,c=l.length,h=Array(c);for(o=0;o0)for(var i,n,a,o,s,l,u=0,c=t[r[0]].length;u0?(n[0]=o,n[1]=o+=a):a<0?(n[1]=s,n[0]=s+=a):(n[0]=0,n[1]=a)},t.stackOffsetExpand=function(t,r){if((n=t.length)>0){for(var i,n,a,o=0,s=t[0].length;o0){for(var i,n=0,a=t[r[0]],o=a.length;n0&&(n=(i=t[r[0]]).length)>0){for(var i,n,a,o=0,s=1;stypeof r?n(t,NL()):n((i=i||self).d3=i.d3||{},i.d3)}}),Nz=g({"node_modules/@plotly/d3-sankey/dist/@plotly/d3-sankey.js"(t,r){var i,n;i=t,n=function(t,r,i){function n(t){return t.target.depth}function a(t,r){return t.sourceLinks.length?t.depth:r-1}function o(t){return function(){return t}}function s(t,r){return u(t.source,r.source)||t.index-r.index}function l(t,r){return u(t.target,r.target)||t.index-r.index}function u(t,r){return t.y0-r.y0}function c(t){return t.value}function h(t){return t.index}function d(t){return t.nodes}function f(t){return t.links}function p(t,r){let i=t.get(r);if(!i)throw Error("missing: "+r);return i}function m({nodes:t}){for(let r of t){let t=r.y0,i=t;for(let i of r.sourceLinks)i.y0=t+i.width/2,t+=i.width;for(let t of r.targetLinks)t.y1=i+t.width/2,i+=t.width}}function g(t){return[t.source.x1,t.y0]}function y(t){return[t.target.x0,t.y1]}t.sankey=function(){let t=0,i=0,n=1,g=1,y=24,v=8,x,b=h,_=a,w,T,A=d,M=f,k=6,S=2/3;function E(){let a={nodes:A.apply(null,arguments),links:M.apply(null,arguments)};return function({nodes:t,links:r}){for(let[r,i]of t.entries())i.index=r,i.sourceLinks=[],i.targetLinks=[];let i=new Map(t.map((r,i)=>[b(r,i,t),r]));for(let[t,n]of r.entries()){n.index=t;let{source:r,target:a}=n;"object"!=typeof r&&(r=n.source=p(i,r)),"object"!=typeof a&&(a=n.target=p(i,a)),r.sourceLinks.push(n),a.targetLinks.push(n)}if(null!=T)for(let{sourceLinks:r,targetLinks:i}of t)r.sort(T),i.sort(T)}(a),function({nodes:t}){for(let i of t)i.value=void 0===i.fixedValue?Math.max(r.sum(i.sourceLinks,c),r.sum(i.targetLinks,c)):i.fixedValue}(a),function({nodes:t}){let r=t.length,i=new Set(t),n=new Set,a=0;for(;i.size;){for(let t of i)for(let{target:r}of(t.depth=a,t.sourceLinks))n.add(r);if(++a>r)throw Error("circular link");i=n,n=new Set}}(a),function({nodes:t}){let r=t.length,i=new Set(t),n=new Set,a=0;for(;i.size;){for(let t of i)for(let{source:r}of(t.height=a,t.targetLinks))n.add(r);if(++a>r)throw Error("circular link");i=n,n=new Set}}(a),function(a){let o=function({nodes:i}){let a=r.max(i,t=>t.depth)+1,o=(n-t-y)/(a-1),s=Array(a);for(let r of i){let i=Math.max(0,Math.min(a-1,Math.floor(_.call(null,r,a))));r.layer=i,r.x0=t+i*o,r.x1=r.x0+y,s[i]?s[i].push(r):s[i]=[r]}if(w)for(let t of s)t.sort(w);return s}(a);x=Math.min(v,S*(g-i)/(r.max(o,t=>t.length)-1)),function(t){let n=r.min(t,t=>(g-i-(t.length-1)*x)/r.sum(t,c));for(let r of t){let t=i;for(let i of r)for(let r of(i.y0=t,i.y1=t+i.value*n,t=i.y1+x,i.sourceLinks))r.width=r.value*n;t=(g-t+x)/(r.length+1);for(let i=0;i=0;--a){let n=t[a];for(let t of n){let i=0,n=0;for(let{target:r,value:a}of t.sourceLinks){let o=a*(r.layer-t.layer);i+=function(t,r){let i=r.y0-(r.targetLinks.length-1)*x/2;for(let{source:n,width:a}of r.targetLinks){if(n===t)break;i+=a+x}for(let{target:n,width:a}of t.sourceLinks){if(n===r)break;i-=a}return i}(t,r)*o,n+=o}if(!(n>0))continue;let a=(i/n-t.y0)*r;t.y0+=a,t.y1+=a,L(t)}void 0===w&&n.sort(u),D(n,i)}})(o,r,i),function(t,r,i){for(let n=1,a=t.length;n0))continue;let a=(i/n-t.y0)*r;t.y0+=a,t.y1+=a,L(t)}void 0===w&&a.sort(u),D(a,i)}}(o,r,i)}}(a),m(a),a}function D(t,r){let n=t.length>>1,a=t[n];I(t,a.y0-x,n-1,r),C(t,a.y1+x,n+1,r),I(t,g,t.length-1,r),C(t,i,0,r)}function C(t,r,i,n){for(;i1e-6&&(a.y0+=o,a.y1+=o),r=a.y1+x}}function I(t,r,i,n){for(;i>=0;--i){let a=t[i],o=(a.y1-r)*n;o>1e-6&&(a.y0-=o,a.y1-=o),r=a.y0-x}}function L({sourceLinks:t,targetLinks:r}){if(void 0===T){for(let{source:{sourceLinks:t}}of r)t.sort(l);for(let{target:{targetLinks:r}}of t)r.sort(s)}}return E.update=function(t){return m(t),t},E.nodeId=function(t){return arguments.length?(b="function"==typeof t?t:o(t),E):b},E.nodeAlign=function(t){return arguments.length?(_="function"==typeof t?t:o(t),E):_},E.nodeSort=function(t){return arguments.length?(w=t,E):w},E.nodeWidth=function(t){return arguments.length?(y=+t,E):y},E.nodePadding=function(t){return arguments.length?(v=x=+t,E):v},E.nodes=function(t){return arguments.length?(A="function"==typeof t?t:o(t),E):A},E.links=function(t){return arguments.length?(M="function"==typeof t?t:o(t),E):M},E.linkSort=function(t){return arguments.length?(T=t,E):T},E.size=function(r){return arguments.length?(t=i=0,n=+r[0],g=+r[1],E):[n-t,g-i]},E.extent=function(r){return arguments.length?(t=+r[0][0],n=+r[1][0],i=+r[0][1],g=+r[1][1],E):[[t,i],[n,g]]},E.iterations=function(t){return arguments.length?(k=+t,E):k},E},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?r.min(t.sourceLinks,n)-1:0},t.sankeyJustify=a,t.sankeyLeft=function(t){return t.depth},t.sankeyLinkHorizontal=function(){return i.linkHorizontal().source(g).target(y)},t.sankeyRight=function(t,r){return r-1-t.height},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof t&&"u">typeof r?n(t,NI(),NP()):n((i=i||self).d3=i.d3||{},i.d3,i.d3)}}),NF=g({"node_modules/@plotly/d3-sankey-circular/node_modules/d3-array/dist/d3-array.js"(t,r){(function(t){function r(t,r){return tr?1:t>=r?0:NaN}function i(t){var i;return 1===t.length&&(i=t,t=function(t,n){return r(i(t),n)}),{left:function(r,i,n,a){for(null==n&&(n=0),null==a&&(a=r.length);n>>1;0>t(r[o],i)?n=o+1:a=o}return n},right:function(r,i,n,a){for(null==n&&(n=0),null==a&&(a=r.length);n>>1;t(r[o],i)>0?a=o:n=o+1}return n}}}var n=i(r),a=n.right,o=n.left;function s(t,r){return[t,r]}function l(t){return null===t?NaN:+t}function u(t,r){var i,n,a=t.length,o=0,s=-1,u=0,c=0;if(null==r)for(;++s1)return c/(o-1)}function c(t,r){var i=u(t,r);return i&&Math.sqrt(i)}function h(t,r){var i,n,a,o=t.length,s=-1;if(null==r){for(;++s=i)for(n=a=i;++si&&(n=i),a=i)for(n=a=i;++si&&(n=i),a=0?(o>=v?10:o>=x?5:o>=b?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(o>=v?10:o>=x?5:o>=b?2:1)}function w(t,r,i){var n=Math.abs(r-t)/Math.max(0,i),a=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),o=n/a;return o>=v?a*=10:o>=x?a*=5:o>=b&&(a*=2),r=1)return+i(t[n-1],n-1,t);var n,a=(n-1)*r,o=Math.floor(a),s=+i(t[o],o,t);return s+(i(t[o+1],o+1,t)-s)*(a-o)}}function M(t,r){var i,n,a=t.length,o=-1;if(null==r){for(;++o=i)for(n=i;++oi&&(n=i)}else for(;++o=i)for(n=i;++oi&&(n=i);return n}function k(t){if(!(a=t.length))return[];for(var r=-1,i=M(t,S),n=Array(i);++rt?1:r>=t?0:NaN},t.deviation=c,t.extent=h,t.histogram=function(){var t=g,r=h,i=T;function n(n){var o,s,l=n.length,u=Array(l);for(o=0;od;)f.pop(),--p;var m,g=Array(p+1);for(o=0;o<=p;++o)(m=g[o]=[]).x0=o>0?f[o-1]:h,m.x1=o=i)for(n=i;++on&&(n=i)}else for(;++o=i)for(n=i;++on&&(n=i);return n},t.mean=function(t,r){var i,n=t.length,a=n,o=-1,s=0;if(null==r)for(;++o=0;)for(r=(n=t[a]).length;--r>=0;)i[--s]=n[r];return i},t.min=M,t.pairs=function(t,r){null==r&&(r=s);for(var i=0,n=t.length-1,a=t[0],o=Array(n<0?0:n);ii(a=t[o],l)||0!==i(l,l))&&(l=a,s=o);if(0===i(l,l))return s}},t.shuffle=function(t,r,i){for(var n,a,o=(i??t.length)-(r=null==r?0:+r);o;)a=Math.random()*o--|0,n=t[o+r],t[o+r]=t[a+r],t[a+r]=n;return t},t.sum=function(t,r){var i,n=t.length,a=-1,o=0;if(null==r)for(;++a0)return[t];if((n=r0)for(t=Math.ceil(t/s),o=Array(a=Math.ceil((r=Math.floor(r/s))-t+1));++ltypeof r?t:t.d3=t.d3||{})}}),NO=g({"node_modules/elementary-circuits-directed-graph/johnson.js"(t,r){var i=NA();r.exports=function(t,r){var n,a=[],o=[],s=[],l={},u=[];n=0;for(var c=t.length;n=r});for(var a,o=i(t),s=o.components.filter(function(t){return t.length>1}),l=1/0,u=0;u1||a>1)}function M(t,r,i){return t.sort(S),t.forEach(function(n,a){var o=0;if(N(n,i)&&A(n))n.circularPathData.verticalBuffer=o+n.width/2;else{for(var s,l,u=0;ul.source.column)){var c=t[u].circularPathData.verticalBuffer+t[u].width/2+r;o=c>o?c:o}n.circularPathData.verticalBuffer=o+n.width/2}}),t}function k(t,i,a,o){var s=r.min(t.links,function(t){return t.source.y0});t.links.forEach(function(t){t.circular&&(t.circularPathData={})}),M(t.links.filter(function(t){return"top"==t.circularLinkType}),i,o),M(t.links.filter(function(t){return"bottom"==t.circularLinkType}),i,o),t.links.forEach(function(r){if(r.circular){if(r.circularPathData.arcRadius=r.width+10,r.circularPathData.leftNodeBuffer=5,r.circularPathData.rightNodeBuffer=5,r.circularPathData.sourceWidth=r.source.x1-r.source.x0,r.circularPathData.sourceX=r.source.x0+r.circularPathData.sourceWidth,r.circularPathData.targetX=r.target.x0,r.circularPathData.sourceY=r.y0,r.circularPathData.targetY=r.y1,N(r,o)&&A(r))r.circularPathData.leftSmallArcRadius=10+r.width/2,r.circularPathData.leftLargeArcRadius=10+r.width/2,r.circularPathData.rightSmallArcRadius=10+r.width/2,r.circularPathData.rightLargeArcRadius=10+r.width/2,"bottom"==r.circularLinkType?(r.circularPathData.verticalFullExtent=r.source.y1+25+r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.rightLargeArcRadius):(r.circularPathData.verticalFullExtent=r.source.y0-25-r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.rightLargeArcRadius);else{var l,u=r.source.column,c=r.circularLinkType,h=t.links.filter(function(t){return t.source.column==u&&t.circularLinkType==c});"bottom"==r.circularLinkType?h.sort(D):h.sort(E);var d=0;h.forEach(function(t,n){t.circularLinkID==r.circularLinkID&&(r.circularPathData.leftSmallArcRadius=10+r.width/2+d,r.circularPathData.leftLargeArcRadius=10+r.width/2+n*i+d),d+=t.width}),u=r.target.column,h=t.links.filter(function(t){return t.target.column==u&&t.circularLinkType==c}),"bottom"==r.circularLinkType?h.sort(I):h.sort(C),d=0,h.forEach(function(t,n){t.circularLinkID==r.circularLinkID&&(r.circularPathData.rightSmallArcRadius=10+r.width/2+d,r.circularPathData.rightLargeArcRadius=10+r.width/2+n*i+d),d+=t.width}),"bottom"==r.circularLinkType?(r.circularPathData.verticalFullExtent=Math.max(a,r.source.y1,r.target.y1)+25+r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.rightLargeArcRadius):(r.circularPathData.verticalFullExtent=s-25-r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.rightLargeArcRadius)}r.circularPathData.leftInnerExtent=r.circularPathData.sourceX+r.circularPathData.leftNodeBuffer,r.circularPathData.rightInnerExtent=r.circularPathData.targetX-r.circularPathData.rightNodeBuffer,r.circularPathData.leftFullExtent=r.circularPathData.sourceX+r.circularPathData.leftLargeArcRadius+r.circularPathData.leftNodeBuffer,r.circularPathData.rightFullExtent=r.circularPathData.targetX-r.circularPathData.rightLargeArcRadius-r.circularPathData.rightNodeBuffer}r.circular?r.path="top"==(l=r).circularLinkType?"M"+l.circularPathData.sourceX+" "+l.circularPathData.sourceY+" L"+l.circularPathData.leftInnerExtent+" "+l.circularPathData.sourceY+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftSmallArcRadius+" 0 0 0 "+l.circularPathData.leftFullExtent+" "+(l.circularPathData.sourceY-l.circularPathData.leftSmallArcRadius)+" L"+l.circularPathData.leftFullExtent+" "+l.circularPathData.verticalLeftInnerExtent+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftLargeArcRadius+" 0 0 0 "+l.circularPathData.leftInnerExtent+" "+l.circularPathData.verticalFullExtent+" L"+l.circularPathData.rightInnerExtent+" "+l.circularPathData.verticalFullExtent+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightLargeArcRadius+" 0 0 0 "+l.circularPathData.rightFullExtent+" "+l.circularPathData.verticalRightInnerExtent+" L"+l.circularPathData.rightFullExtent+" "+(l.circularPathData.targetY-l.circularPathData.rightSmallArcRadius)+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightSmallArcRadius+" 0 0 0 "+l.circularPathData.rightInnerExtent+" "+l.circularPathData.targetY+" L"+l.circularPathData.targetX+" "+l.circularPathData.targetY:"M"+l.circularPathData.sourceX+" "+l.circularPathData.sourceY+" L"+l.circularPathData.leftInnerExtent+" "+l.circularPathData.sourceY+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftSmallArcRadius+" 0 0 1 "+l.circularPathData.leftFullExtent+" "+(l.circularPathData.sourceY+l.circularPathData.leftSmallArcRadius)+" L"+l.circularPathData.leftFullExtent+" "+l.circularPathData.verticalLeftInnerExtent+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftLargeArcRadius+" 0 0 1 "+l.circularPathData.leftInnerExtent+" "+l.circularPathData.verticalFullExtent+" L"+l.circularPathData.rightInnerExtent+" "+l.circularPathData.verticalFullExtent+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightLargeArcRadius+" 0 0 1 "+l.circularPathData.rightFullExtent+" "+l.circularPathData.verticalRightInnerExtent+" L"+l.circularPathData.rightFullExtent+" "+(l.circularPathData.targetY+l.circularPathData.rightSmallArcRadius)+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightSmallArcRadius+" 0 0 1 "+l.circularPathData.rightInnerExtent+" "+l.circularPathData.targetY+" L"+l.circularPathData.targetX+" "+l.circularPathData.targetY:r.path=n.linkHorizontal().source(function(t){return[t.source.x0+(t.source.x1-t.source.x0),t.y0]}).target(function(t){return[t.target.x0,t.y1]})(r)})}function S(t,r){return L(t)==L(r)?"bottom"==t.circularLinkType?D(t,r):E(t,r):L(r)-L(t)}function E(t,r){return t.y0-r.y0}function D(t,r){return r.y0-t.y0}function C(t,r){return t.y1-r.y1}function I(t,r){return r.y1-t.y1}function L(t){return t.target.column-t.source.column}function P(t){return t.target.x0-t.source.x1}function z(t,r){var i=w(t),n=P(r)/Math.tan(i);return"up"==j(t)?t.y1+n:t.y1-n}function F(t,r){var i=w(t),n=P(r)/Math.tan(i);return"up"==j(t)?t.y1-n:t.y1+n}function O(t,r,i,n){return t.y0+r>=i&&t.y1+r<=n&&(t.y0=t.y0+r,t.y1=t.y1+r,t.targetLinks.forEach(function(t){t.y1=t.y1+r}),t.sourceLinks.forEach(function(t){t.y0=t.y0+r})),t}function R(t,r,i,n){t.nodes.forEach(function(a){n&&a.y+(a.y1-a.y0)>r&&(a.y=a.y-(a.y+(a.y1-a.y0)-r));var o=t.links.filter(function(t){return i(t.source)==i(a)}),s=o.length;s>1&&o.sort(function(t,r){if(!t.circular&&!r.circular){if(t.target.column==r.target.column)return t.y1-r.y1;if(i=t,n=r,j(i)!=j(n))return t.y1-r.y1;if(t.target.column>r.target.column){var i,n,a=F(r,t);return t.y1-a}if(r.target.column>t.target.column)return F(t,r)-r.y1}return t.circular&&!r.circular?"top"==t.circularLinkType?-1:1:r.circular&&!t.circular?"top"==r.circularLinkType?1:-1:t.circular&&r.circular?t.circularLinkType===r.circularLinkType&&"top"==t.circularLinkType?t.target.column===r.target.column?t.target.y1-r.target.y1:r.target.column-t.target.column:t.circularLinkType===r.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===r.target.column?r.target.y1-t.target.y1:t.target.column-r.target.column:"top"==t.circularLinkType?-1:1:void 0});var l=a.y0;o.forEach(function(t){t.y0=l+t.width/2,l+=t.width}),o.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,n=0;i1&&n.sort(function(t,r){if(!t.circular&&!r.circular){if(t.source.column==r.source.column)return t.y0-r.y0;if(i=t,n=r,j(i)!=j(n))return t.y0-r.y0;if(r.source.column0?"up":"down"}function N(t,r){return r(t.source)==r(t.target)}t.sankeyCircular=function(){var t,n,o=0,w=0,A=1,M=1,S=24,E=y,D=s,C=v,I=x,L=32,P=2,z=null;function F(){var s,l,c={nodes:C.apply(null,arguments),links:I.apply(null,arguments)};(s=c).nodes.forEach(function(t,r){t.index=r,t.sourceLinks=[],t.targetLinks=[]}),l=i.map(s.nodes,E),s.links.forEach(function(t,r){t.index=r;var i=t.source,n=t.target;(typeof i>"u"?"undefined":u(i))!=="object"&&(i=t.source=b(l,i)),(typeof n>"u"?"undefined":u(n))!=="object"&&(n=t.target=b(l,n)),i.sourceLinks.push(t),n.targetLinks.push(t)}),function(t,r){var i=0;if(null===r){for(var n=[],o=0;oi.indexOf(t.target)&&!t.circular&&i.push(t.target)})});for(r=t.nodes,i=[],n=0;r.length;++n,r=i,i=[])r.forEach(function(t){t.height=n,t.targetLinks.forEach(function(t){0>i.indexOf(t.source)&&!t.circular&&i.push(t.source)})});t.nodes.forEach(function(t){t.column=Math.floor(D.call(null,t,n))})}(c),_(c,E),function(a,s,l){var u=i.nest().key(function(t){return t.column}).sortKeys(r.ascending).entries(a.nodes).map(function(t){return t.values});(function(i){if(n){var s,l,c,h,d,p,m,g,y,v,x,b,_=1/0;u.forEach(function(t){var r=M*n/(t.length+1);_=r<_?r:_}),t=_}var k=r.min(u,function(i){return(M-w-(i.length-1)*t)/r.sum(i,f)});k*=.3,a.links.forEach(function(t){t.width=t.value*k});var E=(s=0,l=0,c=0,h=0,d=r.max(a.nodes,function(t){return t.column}),a.links.forEach(function(t){t.circular&&("top"==t.circularLinkType?s+=t.width:l+=t.width,0==t.target.column&&(h+=t.width),t.source.column==d&&(c+=t.width))}),{top:s=s>0?s+25+10:s,bottom:l=l>0?l+25+10:l,left:h=h>0?h+25+10:h,right:c=c>0?c+25+10:c}),D=(p=r.max(a.nodes,function(t){return t.column}),m=A-o,g=M-w,y=m+E.right+E.left,v=g+E.top+E.bottom,x=m/y,b=g/v,o=o*x+E.left,A=0==E.right?A:A*x,w=w*b+E.top,M*=b,a.nodes.forEach(function(t){t.x0=o+t.column*((A-o-S)/p),t.x1=t.x0+S}),b);k*=D,a.links.forEach(function(t){t.width=t.value*k}),u.forEach(function(t){var r=t.length;t.forEach(function(t,n){t.depth==u.length-1&&1==r||0==t.depth&&1==r?t.y0=M/2-t.value*k:t.partOfCycle?0==T(t,i)?t.y0=M/2+n:"top"==t.circularLinkType?t.y0=w+n:t.y0=M-t.value*k-n:0==E.top||0==E.bottom?t.y0=(M-w)/r*n:t.y0=(M-w)/2-r/2+n,t.y1=t.y0+t.value*k})})})(l),y();for(var c=1,h=s;h>0;--h)(function(t,i){var n=u.length;u.forEach(function(a){var o=a.length,s=a[0].depth;a.forEach(function(a){var l;if((a.sourceLinks.length||a.targetLinks.length)&&!(a.partOfCycle&&T(a,i)>0))if(0==s&&1==o)l=a.y1-a.y0,a.y0=M/2-l/2,a.y1=M/2+l/2;else if(s==n-1&&1==o)l=a.y1-a.y0,a.y0=M/2-l/2,a.y1=M/2+l/2;else{var u=r.mean(a.sourceLinks,g),c=r.mean(a.targetLinks,m),h=((u&&c?(u+c)/2:u||c)-p(a))*t;a.y0+=h,a.y1+=h}})})})(c*=.99,l),y();function y(){u.forEach(function(r){var i,n,a,o=w,s=r.length;for(r.sort(d),a=0;a0&&(i.y0+=n,i.y1+=n),o=i.y1+t;if((n=o-t-M)>0)for(o=i.y0-=n,i.y1-=n,a=s-2;a>=0;--a)(n=(i=r[a]).y1+t-o)>0&&(i.y0-=n,i.y1-=n),o=i.y0})}}(c,L,E),j(c);for(var h=0;h<4;h++)R(c,M,E),B(c,M,E),function(t,r,i,n){t.links.forEach(function(a){if(!a.circular&&a.target.column-a.source.column>1){var o=a.source.column+1,s=a.target.column-1,l=1,u=s-o+1;for(l=1;o<=s;o++,l++)t.nodes.forEach(function(s){if(s.column==o){var c,h=l/(u+1),d=Math.pow(1-h,3),f=3*h*Math.pow(1-h,2),p=3*Math.pow(h,2)*(1-h),m=Math.pow(h,3),g=d*a.y0+f*a.y0+p*a.y1+m*a.y1,y=g-a.width/2,v=g+a.width/2;y>s.y0&&yo.y0&&a.y0o.y0&&a.y1o.y1)&&O(t,c,r,i))})):v>s.y0&&vs.y1&&O(t,c,r,i)})):ys.y1&&(c=v-s.y0+10,s=O(s,c,r,i),t.nodes.forEach(function(t){n(t)==n(s)||t.column!=s.column||t.y0s.y1&&O(t,c,r,i)}))}})}})}(c,w,M,E),R(c,M,E),B(c,M,E);return function(t,i,n){var a=t.nodes,o=t.links,s=!1,l=!1;if(o.forEach(function(t){"top"==t.circularLinkType?s=!0:"bottom"==t.circularLinkType&&(l=!0)}),!1==s||!1==l){var u=r.min(a,function(t){return t.y0}),c=(n-i)/(r.max(a,function(t){return t.y1})-u);a.forEach(function(t){var r=(t.y1-t.y0)*c;t.y0=(t.y0-u)*c,t.y1=t.y0+r}),o.forEach(function(t){t.y0=(t.y0-u)*c,t.y1=(t.y1-u)*c,t.width=t.width*c})}}(c,w,M),k(c,P,M,E),c}function j(t){t.nodes.forEach(function(t){t.sourceLinks.sort(h),t.targetLinks.sort(c)}),t.nodes.forEach(function(t){var r=t.y0,i=r,n=t.y1,a=n;t.sourceLinks.forEach(function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=r+t.width/2,r+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=a-t.width/2,a-=t.width):(t.y1=i+t.width/2,i+=t.width)})})}return F.nodeId=function(t){return arguments.length?(E="function"==typeof t?t:l(t),F):E},F.nodeAlign=function(t){return arguments.length?(D="function"==typeof t?t:l(t),F):D},F.nodeWidth=function(t){return arguments.length?(S=+t,F):S},F.nodePadding=function(r){return arguments.length?(t=+r,F):t},F.nodes=function(t){return arguments.length?(C="function"==typeof t?t:l(t),F):C},F.links=function(t){return arguments.length?(I="function"==typeof t?t:l(t),F):I},F.size=function(t){return arguments.length?(o=w=0,A=+t[0],M=+t[1],F):[A-o,M-w]},F.extent=function(t){return arguments.length?(o=+t[0][0],A=+t[1][0],w=+t[0][1],M=+t[1][1],F):[[o,w],[A,M]]},F.iterations=function(t){return arguments.length?(L=+t,F):L},F.circularLinkGap=function(t){return arguments.length?(P=+t,F):P},F.nodePaddingRatio=function(t){return arguments.length?(n=+t,F):n},F.sortNodes=function(t){return arguments.length?(z=t,F):z},F.update=function(t){return _(t,E),j(t),t.links.forEach(function(t){t.circular&&(t.circularLinkType=t.y0+t.y1typeof r?i(t,NF(),NS(),NP(),NO()):i(t.d3=t.d3||{},t.d3,t.d3,t.d3,null)}}),NB=g({"src/traces/sankey/constants.js"(t,r){r.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeLabel:"node-label"}}}}),Nj=g({"src/traces/sankey/render.js"(t,r){var i=NC(),n=(dC(),b(dD)).interpolateNumber,a=k(),o=Nz(),s=NR(),l=NB(),u=ei(),c=rr(),h=t_(),d=h.strTranslate,f=h.strRotate,p=yj(),m=p.keyFun,g=p.repeat,y=p.unwrap,v=tN(),x=e2(),_=tj(),w=_.CAP_SHIFT,T=_.LINE_SPACING;function A(t,r,i){var n,a=y(r),u=a.trace,c=u.domain,d="h"===u.orientation,f="reversed"===u.direction,p=u.node.pad,m=u.node.thickness,g={justify:o.sankeyJustify,left:o.sankeyLeft,right:o.sankeyRight,center:o.sankeyCenter}[u.node.align],v=t.width*(c.x[1]-c.x[0]),x=t.height*(c.y[1]-c.y[0]),b=a._nodes,_=a._links,w=a.circular;function T(t){"input"===u[t].sort&&(w?h.warn(`Circular Sankey diagrams do not support the "input" ${t}.sort mode; falling back to the default sort.`):n[`${t}Sort`](null))}(n=w?s.sankeyCircular().circularLinkGap(0):o.sankey()).iterations(l.sankeyIterations).size(d?[v,x]:[x,v]).nodeWidth(m).nodePadding(p).nodeId(function(t){return t.pointNumber}).nodeAlign(g).nodes(b).links(_),T("link"),T("node");var A=n();for(var M in n.nodePadding()s+m&&(o+=1,r=l.x0),s=l.x0,a[o]||(a[o]=[]),a[o].push(l),i=r-l.x0,l.x0+=i,l.x1+=i}return a})(b=A.nodes).forEach(function(t){var r,i,n,a=0,o=t.length;for(t.sort(function(t,r){return t.y0-r.y0}),n=0;n=a||(i=a-r.y0)>1e-6&&(r.y0+=i,r.y1+=i),a=r.y1+p}),n.update(A)}return{circular:w,key:i,trace:u,guid:h.randstr(),horizontal:d,reversed:f,width:v,height:x,nodePad:u.node.pad,nodeLineColor:u.node.line.color,nodeLineWidth:u.node.line.width,linkLineColor:u.link.line.color,linkLineWidth:u.link.line.width,linkArrowLength:u.link.arrowlen,valueFormat:u.valueformat,valueSuffix:u.valuesuffix,textFont:u.textfont,translateX:c.x[0]*t.width+t.margin.l,translateY:t.height-c.y[1]*t.height+t.margin.t,dragParallel:d?x:v,dragPerpendicular:d?v:x,arrangement:u.arrangement,sankey:n,graph:A,forceLayouts:{},interactionState:{dragInProgress:!1,hovered:!1}}}function M(t,r,i){var n=r.source.label+"|"+r.target.label;return r.trace=t.trace,r.curveNumber=t.trace.index,{circular:t.circular,key:n+"__"+i,traceId:t.key,pointNumber:r.pointNumber,link:r,rgb:u.rgb(r.color),alpha:u.parse(r.color).alpha,hoverRgb:u.rgb(r.hovercolor),hoverAlpha:u.parse(r.hovercolor).alpha,linkPath:S,linkLineColor:t.linkLineColor,linkLineWidth:t.linkLineWidth,linkArrowLength:t.linkArrowLength,valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,parent:t,interactionState:t.interactionState,flow:r.flow}}function S(){return function(t){var r,i,a,o,s,l,u,c=t.linkArrowLength;if(t.link.circular)return r=t.link,i=c,a="",o=r.width/2,l=(s=r.circularPathData).sourceX+s.verticalBuffer0?" L "+s.targetX+" "+s.targetY:"")+"Z"):(a="M "+(s.targetX-i)+" "+(s.targetY-o)+" L "+(s.rightInnerExtent-i)+" "+(s.targetY-o)+" A "+(s.rightLargeArcRadius+o)+" "+(s.rightSmallArcRadius+o)+" 0 0 0 "+(s.rightFullExtent-o-i)+" "+(s.targetY+s.rightSmallArcRadius)+" L "+(s.rightFullExtent-o-i)+" "+s.verticalRightInnerExtent,l&&u?a+=" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.rightInnerExtent-o-i)+" "+(s.verticalFullExtent+o)+" L "+(s.rightFullExtent+o-i-(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent+o)+" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.leftFullExtent+o)+" "+s.verticalLeftInnerExtent:l?a+=" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.rightFullExtent-i-o-(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" L "+(s.leftFullExtent+o+(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.leftFullExtent+o)+" "+s.verticalLeftInnerExtent:a+=" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.rightInnerExtent-i)+" "+(s.verticalFullExtent+o)+" L "+s.leftInnerExtent+" "+(s.verticalFullExtent+o)+" A "+(s.leftLargeArcRadius+o)+" "+(s.leftLargeArcRadius+o)+" 0 0 0 "+(s.leftFullExtent+o)+" "+s.verticalLeftInnerExtent,a+=" L "+(s.leftFullExtent+o)+" "+(s.sourceY+s.leftSmallArcRadius)+" A "+(s.leftLargeArcRadius+o)+" "+(s.leftSmallArcRadius+o)+" 0 0 0 "+s.leftInnerExtent+" "+(s.sourceY-o)+" L "+s.sourceX+" "+(s.sourceY-o)+" L "+s.sourceX+" "+(s.sourceY+o)+" L "+s.leftInnerExtent+" "+(s.sourceY+o)+" A "+(s.leftLargeArcRadius-o)+" "+(s.leftSmallArcRadius-o)+" 0 0 1 "+(s.leftFullExtent-o)+" "+(s.sourceY+s.leftSmallArcRadius)+" L "+(s.leftFullExtent-o)+" "+s.verticalLeftInnerExtent,l&&u?a+=" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.leftFullExtent-o-(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" L "+(s.rightFullExtent+o-i+(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.rightFullExtent+o-i)+" "+s.verticalRightInnerExtent:l?a+=" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.leftFullExtent+o)+" "+(s.verticalFullExtent+o)+" L "+(s.rightFullExtent-i-o)+" "+(s.verticalFullExtent+o)+" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.rightFullExtent+o-i)+" "+s.verticalRightInnerExtent:a+=" A "+(s.leftLargeArcRadius-o)+" "+(s.leftLargeArcRadius-o)+" 0 0 1 "+s.leftInnerExtent+" "+(s.verticalFullExtent-o)+" L "+(s.rightInnerExtent-i)+" "+(s.verticalFullExtent-o)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightLargeArcRadius-o)+" 0 0 1 "+(s.rightFullExtent+o-i)+" "+s.verticalRightInnerExtent,a+=" L "+(s.rightFullExtent+o-i)+" "+(s.targetY+s.rightSmallArcRadius)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.rightInnerExtent-i)+" "+(s.targetY+o)+" L "+(s.targetX-i)+" "+(s.targetY+o)+(i>0?" L "+s.targetX+" "+s.targetY:"")+"Z"),a;var h=Math.abs((t.link.target.x0-t.link.source.x1)/2);c>h&&(c=h);var d=t.link.source.x1,f=t.link.target.x0-c,p=n(d,f),m=p(.5),g=p(.5),y=t.link.y0-t.link.width/2,v=t.link.y0+t.link.width/2,x=t.link.y1-t.link.width/2,b=t.link.y1+t.link.width/2,_="M"+d+","+y,w="C"+m+","+y+" "+g+","+x+" "+f+","+x,T="C"+g+","+b+" "+m+","+v+" "+d+","+v,A=c>0?"L"+(f+c)+","+(x+t.link.width/2):"";return _+w+(A+="L"+f+","+b)+T+"Z"}}function E(t,r){var i=l.nodePadAcross,n=t.nodePad/2;r.dx=r.x1-r.x0,r.dy=r.y1-r.y0;var a=r.dx,o=Math.max(.5,r.dy),s="node_"+r.pointNumber;return r.group&&(s=h.randstr()),r.trace=t.trace,r.curveNumber=t.trace.index,{index:r.pointNumber,key:s,partOfGroup:r.partOfGroup||!1,group:r.group,traceId:t.key,trace:t.trace,node:r,nodePad:t.nodePad,nodeLineColor:t.nodeLineColor,nodeLineWidth:t.nodeLineWidth,textFont:t.textFont,size:t.horizontal?t.height:t.width,visibleWidth:Math.ceil(a),visibleHeight:o,zoneX:-i,zoneY:-n,zoneWidth:a+2*i,zoneHeight:o+2*n,labelY:t.horizontal?r.dy/2+1:r.dx/2+1,left:1===r.originalLayer,sizeAcross:t.width,forceLayouts:t.forceLayouts,horizontal:t.horizontal,reversed:t.reversed,rgb:u.rgb(r.color),alpha:u.parse(r.color).alpha,valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,graph:t.graph,arrangement:t.arrangement,uniqueNodeLabelPathId:[t.guid,t.key,s].join("_"),interactionState:t.interactionState,figure:t}}function D(t){t.attr("transform",function(t){return d(t.node.x0.toFixed(3),t.node.y0.toFixed(3))})}function C(t){t.call(D)}function I(t,r){t.call(C),r.attr("d",S())}function L(t){t.attr("width",function(t){return t.node.x1-t.node.x0}).attr("height",function(t){return t.visibleHeight})}function P(t){return t.link.width>1||t.linkLineWidth>0}function z(t){return t.horizontal?t.reversed?d(t.translateX+t.width,t.translateY)+"matrix(-1 0 0 1 0 0)":d(t.translateX,t.translateY)+"matrix(1 0 0 1 0 0)":t.reversed?d(t.translateX,t.translateY+t.height)+"matrix(0 -1 1 0 0 0)":d(t.translateX,t.translateY)+"matrix(0 1 1 0 0 0)"}function F(t,r,i){t.on(".basic",null).on("mouseover.basic",function(t){t.interactionState.dragInProgress||t.partOfGroup||(i.hover(this,t,r),t.interactionState.hovered=[this,t])}).on("mousemove.basic",function(t){t.interactionState.dragInProgress||t.partOfGroup||(i.follow(this,t),t.interactionState.hovered=[this,t])}).on("mouseout.basic",function(t){t.interactionState.dragInProgress||t.partOfGroup||(i.unhover(this,t,r),t.interactionState.hovered=!1)}).on("click.basic",function(t){t.interactionState.hovered&&(i.unhover(this,t,r),t.interactionState.hovered=!1),t.interactionState.dragInProgress||t.partOfGroup||i.select(this,t,r)})}function O(t,r,n,o){var s=a.behavior.drag().origin(function(t){return{x:t.node.x0+t.visibleWidth/2,y:t.node.y0+t.visibleHeight/2}}).on("dragstart",function(a){if("fixed"!==a.arrangement&&(h.ensureSingle(o._fullLayout._infolayer,"g","dragcover",function(t){o._fullLayout._dragCover=t}),h.raiseToTop(this),a.interactionState.dragInProgress=a.node,B(a.node),a.interactionState.hovered&&(n.nodeEvents.unhover.apply(0,a.interactionState.hovered),a.interactionState.hovered=!1),"snap"===a.arrangement)){var s,u,c,d,f,p=a.traceId+"|"+a.key;a.forceLayouts[p]?a.forceLayouts[p].alpha(1):function(t,r,n){for(var a,o,s,u=n.graph.nodes,c=0;c0&&s.forceLayouts[a].alpha(0)})).stop()}(t,p,a),s=t,u=r,c=a,d=p,f=o,window.requestAnimationFrame(function t(){for(r=0;r0)window.requestAnimationFrame(t);else{var r,i=c.node.originalX;c.node.x0=i-c.visibleWidth/2,c.node.x1=i+c.visibleWidth/2,R(c,f)}})}}).on("drag",function(i){if("fixed"!==i.arrangement){var n=a.event.x,o=a.event.y;"snap"===i.arrangement?(i.node.x0=n-i.visibleWidth/2,i.node.x1=n+i.visibleWidth/2):("freeform"===i.arrangement&&(i.node.x0=n-i.visibleWidth/2,i.node.x1=n+i.visibleWidth/2),o=Math.max(0,Math.min(i.size-i.visibleHeight/2,o))),i.node.y0=o-i.visibleHeight/2,i.node.y1=o+i.visibleHeight/2,B(i.node),"snap"!==i.arrangement&&(i.sankey.update(i.graph),I(t.filter(j(i)),r))}}).on("dragend",function(t){if("fixed"!==t.arrangement){t.interactionState.dragInProgress=!1;for(var r=0;rP(t)?u.rgb(t.linkLineColor):t.rgb).style("stroke-opacity",t=>P(t)?u.opacity(t.linkLineColor):t.alpha).style("fill",t=>t.rgb).style("fill-opacity",t=>t.alpha).style("stroke-width",t=>P(t)?t.linkLineWidth:1).attr("d",S()),C.style("opacity",function(){return t._context.staticPlot||p||x?1:0}).transition().ease(l.ease).duration(l.duration).style("opacity",1),C.exit().transition().ease(l.ease).duration(l.duration).style("opacity",0).remove();var I=_.selectAll("."+l.cn.sankeyNodeSet).data(g,m);I.enter().append("g").classed(l.cn.sankeyNodeSet,!0),I.style("cursor",function(t){switch(t.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var R=I.selectAll("."+l.cn.sankeyNode).data(function(t){var r=t.graph.nodes;return function(t){var r,i=[];for(r=0;rt.rgb).style("fill-opacity",t=>t.alpha),B.transition().ease(l.ease).duration(l.duration).call(L);var j=R.selectAll("."+l.cn.nodeLabel).data(g);j.enter().append("text").classed(l.cn.nodeLabel,!0).style("cursor","default"),j.attr("data-notex",1).text(function(t){return t.node.label}).each(function(r){var i=a.select(this);c.font(i,r.textFont),v.convertToTspans(i,t)}).attr("text-anchor",function(t){return t.horizontal&&t.left!==t.reversed?"end":"start"}).attr("transform",function(t){var r=a.select(this),i=v.lineCount(r),n=t.textFont.size*((i-1)*T-w),o=t.nodeLineWidth/2+3;if(!t.horizontal){var s=t.reversed?(t.visibleWidth+n)/2:(t.visibleWidth-n)/2,l=t.reversed?f(90):"scale(-1,1)"+f(90);return d(s,o)+l}var u=o,s=(t.visibleHeight-n)/2;return t.left?u=-u:u+=t.visibleWidth,d(u,s)+(t.reversed?"scale(-1,1)":"")}),j.transition().ease(l.ease).duration(l.duration)}}}),NN=g({"src/traces/sankey/plot.js"(t,r){var i=k(),n=t_(),a=n.numberFormat,o=Nj(),s=rR(),l=ei(),u=NB().cn,c=n._;function h(t){return""!==t}function d(t,r){return t.filter(function(t){return t.key===r.traceId})}function f(t,r){i.select(t).select("path").style("fill-opacity",r),i.select(t).select("rect").style("fill-opacity",r)}function p(t){i.select(t).select("text.name").style("fill","black")}function m(t){return function(r){return -1!==t.node.sourceLinks.indexOf(r.link)||-1!==t.node.targetLinks.indexOf(r.link)}}function g(t){return function(r){return -1!==r.node.sourceLinks.indexOf(t.link)||-1!==r.node.targetLinks.indexOf(t.link)}}function y(t,r,i){r&&i&&d(i,r).selectAll("."+u.sankeyLink).filter(m(r)).call(x.bind(0,r,i,!1))}function v(t,r,i){r&&i&&d(i,r).selectAll("."+u.sankeyLink).filter(m(r)).call(b.bind(0,r,i,!1))}function x(t,r,i,n){n.style("fill",function(t){if(!t.link.concentrationscale)return t.hoverRgb}).style("fill-opacity",function(t){if(!t.link.concentrationscale)return t.hoverAlpha}),n.each(function(i){var n=i.link.label;""!==n&&d(r,t).selectAll("."+u.sankeyLink).filter(function(t){return t.link.label===n}).style("fill",function(t){if(!t.link.concentrationscale)return t.hoverRgb}).style("fill-opacity",function(t){if(!t.link.concentrationscale)return t.hoverAlpha})}),i&&d(r,t).selectAll("."+u.sankeyNode).filter(g(t)).call(y)}function b(t,r,i,n){n.style("fill",function(t){return t.rgb}).style("fill-opacity",function(t){return t.alpha}),n.each(function(i){var n=i.link.label;""!==n&&d(r,t).selectAll("."+u.sankeyLink).filter(function(t){return t.link.label===n}).style("fill",t=>t.rgb).style("fill-opacity",t=>t.alpha)}),i&&d(r,t).selectAll(u.sankeyNode).filter(g(t)).call(v)}function _(t,r){var i=t.hoverlabel||{},a=n.nestedProperty(i,r).get();return!Array.isArray(a)&&a}r.exports=function(t,r){for(var n=t._fullLayout,d=n._paper,m=n._size,g=0;g"),color:_(u,"bgcolor")||l.addOpacity(g.color,1),borderColor:_(u,"bordercolor"),fontFamily:_(u,"font.family"),fontSize:_(u,"font.size"),fontColor:_(u,"font.color"),fontWeight:_(u,"font.weight"),fontStyle:_(u,"font.style"),fontVariant:_(u,"font.variant"),fontTextcase:_(u,"font.textcase"),fontLineposition:_(u,"font.lineposition"),fontShadow:_(u,"font.shadow"),nameLength:_(u,"namelength"),textAlign:_(u,"align"),idealAlign:i.event.x"),color:_(l,"bgcolor")||o.rgb,borderColor:_(l,"bordercolor"),fontFamily:_(l,"font.family"),fontSize:_(l,"font.size"),fontColor:_(l,"font.color"),fontWeight:_(l,"font.weight"),fontStyle:_(l,"font.style"),fontVariant:_(l,"font.variant"),fontTextcase:_(l,"font.textcase"),fontLineposition:_(l,"font.lineposition"),fontShadow:_(l,"font.shadow"),nameLength:_(l,"namelength"),textAlign:_(l,"align"),idealAlign:"left",hovertemplate:l.hovertemplate,hovertemplateLabels:x,eventData:[o.node]},{container:n._hoverlayer.node(),outerContainer:n._paper.node(),gd:t});f(T,.85),p(T)}}},unhover:function(r,a,o){!1!==t._fullLayout.hovermode&&(i.select(r).call(v,a,o),"skip"!==a.node.trace.node.hoverinfo&&(a.node.fullData=a.node.trace,t.emit("plotly_unhover",{event:i.event,points:[a.node]})),s.loneUnhover(n._hoverlayer.node()))},select:function(r,n,a){var o=n.node;o.originalEvent=i.event,t._hoverdata=[o],i.select(r).call(v,n,a),s.click(t,{target:!0})}}})}}}),NV=g({"src/traces/sankey/base_plot.js"(t){var r=e$().overrideAll,i=tF().getModuleCalcData,n=NN(),a=Z(),o=rg(),s=rm(),l=iS().prepSelect,u=t_(),c=e2(),h="sankey";t.name=h,t.baseLayoutAttrOverrides=r({hoverlabel:a.hoverlabel},"plot","nested"),t.plot=function(r){var a=i(r.calcdata,h)[0];n(r,a),t.updateFx(r)},t.clean=function(t,r,i,n){var a=n._has&&n._has(h),o=r._has&&r._has(h);a&&!o&&(n._paperdiv.selectAll(".sankey").remove(),n._paperdiv.selectAll(".bgsankey").remove())},t.updateFx=function(t){for(var r=0;r0}function A(t){t.each(function(t){v.stroke(i.select(this),t.line.color)}).each(function(t){v.fill(i.select(this),t.color)}).style("stroke-width",function(t){return t.line.width})}function M(t,r,i){var n=t._fullLayout,a=o.extendFlat({type:"linear",ticks:"outside",range:i,showline:!0},r),s={type:"linear",_id:"x"+r._id},l={letter:"x",font:n.font,noAutotickangles:!0,noHover:!0,noTickson:!0};function u(t,r){return o.coerce(a,s,y,t,r)}return m(a,s,u,l,n),g(a,s,u,l),s}function S(t,r,i){return[Math.min(r/t.width,i/t.height),t,r+"x"+i]}function E(t,r,n,a){var o=document.createElementNS("http://www.w3.org/2000/svg","text"),s=i.select(o);return s.text(t).attr("x",0).attr("y",0).attr("text-anchor",n).attr("data-unformatted",t).call(f.convertToTspans,a).call(h.font,r),h.bBox(s.node())}function D(t,r,i,n,a,s){var l="_cache"+r;t[l]&&t[l].key===a||(t[l]={key:a,value:i});var u=o.aggNums(s,null,[t[l].value,n],2);return t[l].value=u,u}r.exports=function(t,r,m,g){var y,b=t._fullLayout;T(m)&&g&&(y=g()),o.makeTraceGroups(b._indicatorlayer,r,"trace").each(function(r){var g,k,C,I,L,P=r[0].trace,z=i.select(this),F=P._hasGauge,O=P._isAngular,R=P._isBullet,B=P.domain,j={w:b._size.w*(B.x[1]-B.x[0]),h:b._size.h*(B.y[1]-B.y[0]),l:b._size.l+b._size.w*B.x[0],r:b._size.r+b._size.w*(1-B.x[1]),t:b._size.t+b._size.h*(1-B.y[1]),b:b._size.b+b._size.h*B.y[0]},N=j.l+j.w/2,V=j.t+j.h/2,U=Math.min(j.w/2,j.h),q=d.innerRadius*U,G=P.align||"center";if(I=V,F){if(O&&(C=N,I=V+U/2,L=function(t){var r,i;return r=t,[(i=.9*q)/Math.sqrt(r.width/2*(r.width/2)+r.height*r.height),r,i]}),R){var H=d.bulletPadding,$=1-d.bulletNumberDomainSize+H;C=j.l+($+(1-$)*_[G])*j.w,L=function(t){return S(t,(d.bulletNumberDomainSize-H)*j.w,j.h)}}}else C=j.l+_[G]*j.w,L=function(t){return S(t,j.w,j.h)};(function(t,r,n,u){var c,d,m,g=n[0].trace,y=u.numbersX,b=u.numbersY,A=g.align||"center",k=x[A],S=u.transitionOpts,C=u.onComplete,I=o.ensureSingle(r,"g","numbers"),L=[];g._hasNumber&&L.push("number"),g._hasDelta&&(L.push("delta"),"left"===g.delta.position&&L.reverse());var P=I.selectAll("text").data(L);function z(r,i,n,a){if(!r.match("s")||n>=0==a>=0||i(n).slice(-1).match(w)||i(a).slice(-1).match(w))return i;var o=M(t,{tickformat:r.slice().replace("s","f").replace(/\d+/,function(t){return parseInt(t)-1})});return function(t){return 1>Math.abs(t)?p.tickText(o,t).text:i(t)}}P.enter().append("text"),P.attr("text-anchor",function(){return k}).attr("class",function(t){return t}).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),P.exit().remove();var F,O=g.mode+g.align;if(g._hasDelta&&(F=function(){var r=M(t,{tickformat:g.delta.valueformat},g._range);r.setScale(),p.prepTicks(r);var o=function(t){return p.tickText(r,t).text},s=g.delta.suffix,l=g.delta.prefix,u=function(t){return g.delta.relative?t.relativeDelta:t.delta},c=function(t,r){return 0===t||"number"!=typeof t||isNaN(t)?"-":(t>0?g.delta.increasing.symbol:g.delta.decreasing.symbol)+l+r(t)+s},m=function(t){return t.delta>=0?g.delta.increasing.color:g.delta.decreasing.color};void 0===g._deltaLastValue&&(g._deltaLastValue=u(n[0]));var y=I.select("text.delta");function x(){y.text(c(u(n[0]),o)).call(v.fill,m(n[0])).call(f.convertToTspans,t)}return y.call(h.font,g.delta.font).call(v.fill,m({delta:g._deltaLastValue})),T(S)?y.transition().duration(S.duration).ease(S.easing).tween("text",function(){var t=i.select(this),r=u(n[0]),s=g._deltaLastValue,l=z(g.delta.valueformat,o,s,r),h=a(s,r);return g._deltaLastValue=r,function(r){t.text(c(h(r),l)),t.call(v.fill,m({delta:h(r)}))}}).each("end",function(){x(),C&&C()}).each("interrupt",function(){x(),C&&C()}):x(),d=E(c(u(n[0]),o),g.delta.font,k,t),y}(),O+=g.delta.position+g.delta.font.size+g.delta.font.family+g.delta.valueformat,O+=g.delta.increasing.symbol+g.delta.decreasing.symbol,m=d),g._hasNumber&&(function(){var r=M(t,{tickformat:g.number.valueformat},g._range);r.setScale(),p.prepTicks(r);var o=function(t){return p.tickText(r,t).text},s=g.number.suffix,l=g.number.prefix,u=I.select("text.number");function d(){var r="number"==typeof n[0].y?l+o(n[0].y)+s:"-";u.text(r).call(h.font,g.number.font).call(f.convertToTspans,t)}T(S)?u.transition().duration(S.duration).ease(S.easing).each("end",function(){d(),C&&C()}).each("interrupt",function(){d(),C&&C()}).attrTween("text",function(){var t=i.select(this),r=a(n[0].lastY,n[0].y);g._lastValue=n[0].y;var u=z(g.number.valueformat,o,n[0].lastY,n[0].y);return function(i){t.text(l+u(r(i))+s)}}):d(),c=E(l+o(n[0].y)+s,g.number.font,k,t)}(),O+=g.number.font.size+g.number.font.family+g.number.valueformat+g.number.suffix+g.number.prefix,m=c),g._hasDelta&&g._hasNumber){var R,B,j=[(c.left+c.right)/2,(c.top+c.bottom)/2],N=[(d.left+d.right)/2,(d.top+d.bottom)/2],V=.75*g.delta.font.size;"left"===g.delta.position&&(R=D(g,"deltaPos",0,-1*(c.width*_[g.align]+d.width*(1-_[g.align])+V),O,Math.min),B=j[1]-N[1],m={width:c.width+d.width+V,height:Math.max(c.height,d.height),left:d.left+R,right:c.right,top:Math.min(c.top,d.top+B),bottom:Math.max(c.bottom,d.bottom+B)}),"right"===g.delta.position&&(R=D(g,"deltaPos",0,c.width*(1-_[g.align])+d.width*_[g.align]+V,O,Math.max),B=j[1]-N[1],m={width:c.width+d.width+V,height:Math.max(c.height,d.height),left:c.left,right:d.right+R,top:Math.min(c.top,d.top+B),bottom:Math.max(c.bottom,d.bottom+B)}),"bottom"===g.delta.position&&(R=null,B=d.height,m={width:Math.max(c.width,d.width),height:c.height+d.height,left:Math.min(c.left,d.left),right:Math.max(c.right,d.right),top:c.bottom-c.height,bottom:c.bottom+d.height}),"top"===g.delta.position&&(R=null,B=c.top,m={width:Math.max(c.width,d.width),height:c.height+d.height,left:Math.min(c.left,d.left),right:Math.max(c.right,d.right),top:c.bottom-c.height-d.height,bottom:c.bottom}),F.attr({dx:R,dy:B})}(g._hasNumber||g._hasDelta)&&I.attr("transform",function(){var t=u.numbersScaler(m);O+=t[2];var r,i=D(g,"numbersScale",1,t[0],O,Math.min);g._scaleNumbers||(i=1),r=g._isAngular?b-i*m.bottom:b-i*(m.top+m.bottom)/2,g._numbersTop=i*m.top+r;var n=m[A];"center"===A&&(n=(m.left+m.right)/2);var a=y-i*n;return l(a=D(g,"numbersTranslate",0,a,O,Math.max),r)+s(i)})})(t,z,r,{numbersX:C,numbersY:I,numbersScaler:L,transitionOpts:m,onComplete:y}),F&&(g={range:P.gauge.axis.range,color:P.gauge.bgcolor,line:{color:P.gauge.bordercolor,width:0},thickness:1},k={range:P.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:P.gauge.bordercolor,width:P.gauge.borderwidth},thickness:1});var W=z.selectAll("g.angular").data(O?r:[]);W.exit().remove();var Y=z.selectAll("g.angularaxis").data(O?r:[]);Y.exit().remove(),O&&function(t,r,a){var o,s,h,d,f,m,g=r[0].trace,y=a.size,v=a.radius,x=a.innerRadius,b=a.gaugeBg,_=a.gaugeOutline,w=[y.l+y.w/2,y.t+y.h/2+v/2],k=a.gauge,S=a.layer,E=a.transitionOpts,D=a.onComplete,C=Math.PI/2;function I(t){var r=g.gauge.axis.range[0],i=(t-r)/(g.gauge.axis.range[1]-r)*Math.PI-C;return i<-C?-C:i>C?C:i}function L(t){return i.svg.arc().innerRadius((x+v)/2-t/2*(v-x)).outerRadius((x+v)/2+t/2*(v-x)).startAngle(-C)}function P(t){t.attr("d",function(t){return L(t.thickness).startAngle(I(t.range[0])).endAngle(I(t.range[1]))()})}k.enter().append("g").classed("angular",!0),k.attr("transform",l(w[0],w[1])),S.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),S.selectAll("g.xangularaxistick,path,text").remove(),(d=M(t,g.gauge.axis)).type="linear",d.range=g.gauge.axis.range,d._id="xangularaxis",d.ticklabeloverflow="allow",d.setScale();var z=function(t){return(d.range[0]-t.x)/(d.range[1]-d.range[0])*Math.PI+Math.PI},F={},O=p.makeLabelFns(d,0).labelStandoff;F.xFn=function(t){return Math.cos(z(t))*O},F.yFn=function(t){var r=z(t),i=Math.sin(r)>0?.2:1;return-Math.sin(r)*(O+t.fontSize*i)+Math.abs(Math.cos(r))*(t.fontSize*c)},F.anchorFn=function(t){var r=Math.cos(z(t));return .1>Math.abs(r)?"middle":r>0?"start":"end"},F.heightFn=function(t,r,i){return -.5*(1+Math.sin(z(t)))*i};var R=function(t){return l(w[0]+v*Math.cos(t),w[1]-v*Math.sin(t))};if(f=p.calcTicks(d),m=p.getTickSigns(d)[2],d.visible){m="inside"===d.ticks?-1:1;var B=(d.linewidth||1)/2;p.drawTicks(t,d,{vals:f,layer:S,path:"M"+m*B+",0h"+m*d.ticklen,transFn:function(t){var r=z(t);return R(r)+"rotate("+-u(r)+")"}}),p.drawLabels(t,d,{vals:f,layer:S,transFn:function(t){return R(z(t))},labelFns:F})}var j=[b].concat(g.gauge.steps),N=k.selectAll("g.bg-arc").data(j);N.enter().append("g").classed("bg-arc",!0).append("path"),N.select("path").call(P).call(A),N.exit().remove();var V=L(g.gauge.bar.thickness),U=k.selectAll("g.value-arc").data([g.gauge.bar]);U.enter().append("g").classed("value-arc",!0).append("path");var q=U.select("path");T(E)?(q.transition().duration(E.duration).ease(E.easing).each("end",function(){D&&D()}).each("interrupt",function(){D&&D()}).attrTween("d",(o=V,s=I(r[0].lastY),h=I(r[0].y),function(){var t=n(s,h);return function(r){return o.endAngle(t(r))()}})),g._lastValue=r[0].y):q.attr("d","number"==typeof r[0].y?V.endAngle(I(r[0].y)):"M0,0Z"),q.call(A),U.exit().remove(),j=[];var G=g.gauge.threshold.value;(G||0===G)&&j.push({range:[G,G],color:g.gauge.threshold.color,line:{color:g.gauge.threshold.line.color,width:g.gauge.threshold.line.width},thickness:g.gauge.threshold.thickness});var H=k.selectAll("g.threshold-arc").data(j);H.enter().append("g").classed("threshold-arc",!0).append("path"),H.select("path").call(P).call(A),H.exit().remove();var $=k.selectAll("g.gauge-outline").data([_]);$.enter().append("g").classed("gauge-outline",!0).append("path"),$.select("path").call(P).call(A),$.exit().remove()}(t,r,{radius:U,innerRadius:q,gauge:W,layer:Y,size:j,gaugeBg:g,gaugeOutline:k,transitionOpts:m,onComplete:y});var Z=z.selectAll("g.bullet").data(R?r:[]);Z.exit().remove();var X=z.selectAll("g.bulletaxis").data(R?r:[]);X.exit().remove(),R&&function(t,r,i){var n,a,o,s,u,c=r[0].trace,h=i.gauge,f=i.layer,m=i.gaugeBg,g=i.gaugeOutline,y=i.size,x=c.domain,b=i.transitionOpts,_=i.onComplete;h.enter().append("g").classed("bullet",!0),h.attr("transform",l(y.l,y.t)),f.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),f.selectAll("g.xbulletaxistick,path,text").remove();var w=y.h,k=c.gauge.bar.thickness*w,S=x.x[0],E=x.x[0]+(x.x[1]-x.x[0])*(c._hasNumber||c._hasDelta?1-d.bulletNumberDomainSize:1);function D(t){t.attr("width",function(t){return Math.max(0,n.c2p(t.range[1])-n.c2p(t.range[0]))}).attr("x",function(t){return n.c2p(t.range[0])}).attr("y",function(t){return .5*(1-t.thickness)*w}).attr("height",function(t){return t.thickness*w})}(n=M(t,c.gauge.axis))._id="xbulletaxis",n.domain=[S,E],n.setScale(),a=p.calcTicks(n),o=p.makeTransTickFn(n),s=p.getTickSigns(n)[2],u=y.t+y.h,n.visible&&(p.drawTicks(t,n,{vals:"inside"===n.ticks?p.clipEnds(n,a):a,layer:f,path:p.makeTickPath(n,u,s),transFn:o}),p.drawLabels(t,n,{vals:a,layer:f,transFn:o,labelFns:p.makeLabelFns(n,u)}));var C=[m].concat(c.gauge.steps),I=h.selectAll("g.bg-bullet").data(C);I.enter().append("g").classed("bg-bullet",!0).append("rect"),I.select("rect").call(D).call(A),I.exit().remove();var L=h.selectAll("g.value-bullet").data([c.gauge.bar]);L.enter().append("g").classed("value-bullet",!0).append("rect"),L.select("rect").attr("height",k).attr("y",(w-k)/2).call(A),T(b)?L.select("rect").transition().duration(b.duration).ease(b.easing).each("end",function(){_&&_()}).each("interrupt",function(){_&&_()}).attr("width",Math.max(0,n.c2p(Math.min(c.gauge.axis.range[1],r[0].y)))):L.select("rect").attr("width","number"==typeof r[0].y?Math.max(0,n.c2p(Math.min(c.gauge.axis.range[1],r[0].y))):0),L.exit().remove();var P=r.filter(function(){return c.gauge.threshold.value||0===c.gauge.threshold.value}),z=h.selectAll("g.threshold-bullet").data(P);z.enter().append("g").classed("threshold-bullet",!0).append("line"),z.select("line").attr("x1",n.c2p(c.gauge.threshold.value)).attr("x2",n.c2p(c.gauge.threshold.value)).attr("y1",(1-c.gauge.threshold.thickness)/2*w).attr("y2",(1-(1-c.gauge.threshold.thickness)/2)*w).call(v.stroke,c.gauge.threshold.line.color).style("stroke-width",c.gauge.threshold.line.width),z.exit().remove();var F=h.selectAll("g.gauge-outline").data([g]);F.enter().append("g").classed("gauge-outline",!0).append("rect"),F.select("rect").call(D).call(A),F.exit().remove()}(t,r,{gauge:Z,layer:X,size:j,gaugeBg:g,gaugeOutline:k,transitionOpts:m,onComplete:y});var K=z.selectAll("text.title").data(r);K.exit().remove(),K.enter().append("text").classed("title",!0),K.attr("text-anchor",function(){return R?x.right:x[P.title.align]}).text(P.title.text).call(h.font,P.title.font).call(f.convertToTspans,t),K.attr("transform",function(){var t,r=j.l+j.w*_[P.title.align],i=d.titlePadding,n=h.bBox(K.node());return F?(O&&(t=P.gauge.axis.visible?h.bBox(Y.node()).top-i-n.bottom:j.t+j.h/2-U/2-n.bottom-i),R&&(t=I-(n.top+n.bottom)/2,r=j.l-d.bulletPadding*j.w)):t=P._numbersTop-i-n.bottom,l(r,t)})})}}}),NK=g({"src/traces/indicator/index.js"(t,r){r.exports={moduleType:"trace",name:"indicator",basePlotModule:NH(),categories:["svg","noOpacity","noHover"],animatable:!0,attributes:N$(),supplyDefaults:NY().supplyDefaults,calc:NZ().calc,plot:NX(),meta:{}}}}),NJ=g({"lib/indicator.js"(t,r){r.exports=NK()}}),NQ=g({"src/traces/table/attributes.js"(t,r){var i=ix(),n=$().extendFlat,a=e$().overrideAll,o=W(),s=an().attributes,l=tU().descriptionOnlyNumbers;r.exports=a({domain:s({name:"table",trace:!0}),columnwidth:{valType:"number",arrayOk:!0,dflt:null},columnorder:{valType:"data_array"},header:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:28},align:n({},i.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:n({},o({arrayOk:!0}))},cells:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:20},align:n({},i.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:n({},o({arrayOk:!0}))}},"calc","from-root")}}),N0=g({"src/traces/table/defaults.js"(t,r){var i=t_(),n=NQ(),a=an().defaults;r.exports=function(t,r,o,s){function l(a,o){return i.coerce(t,r,n,a,o)}a(r,s,l),l("columnwidth"),l("header.values"),l("header.format"),l("header.align"),l("header.prefix"),l("header.suffix"),l("header.height"),l("header.line.width"),l("header.line.color"),l("header.fill.color"),i.coerceFont(l,"header.font",s.font),function(t,r){for(var i=t.columnorder||[],n=t.header.values.length,a=i.slice(0,n),o=a.slice().sort(function(t,r){return t-r}),s=a.map(function(t){return o.indexOf(t)}),l=s.length;l",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}}}),N3=g({"src/traces/table/data_preparation_helper.js"(t,r){var i=N2(),n=$().extendFlat,a=L(),o=O().isTypedArray,s=O().isArrayOrTypedArray;function l(t){if(s(t)){for(var r=0,i=0;i=r||c===t.length-1)&&(n[a]=s,s.key=u++,s.firstRowIndex=l,s.lastRowIndex=c,s=m(),a+=o,l=c+1,o=0);return n}function m(){return{firstRowIndex:null,lastRowIndex:null,rows:[]}}r.exports=function(t,r){var o=c(r.cells.values),m=function(t){return t.slice(r.header.values.length,t.length)},g=c(r.header.values);g.length&&!g[0].length&&(g[0]=[""],g=c(g));var y=g.concat(m(o).map(function(){return h((g[0]||[""]).length)})),v=r.domain,x=Math.floor(t._fullLayout._size.w*(v.x[1]-v.x[0])),b=Math.floor(t._fullLayout._size.h*(v.y[1]-v.y[0])),_=r.header.values.length?y[0].map(function(){return r.header.height}):[i.emptyHeaderHeight],w=o.length?o[0].map(function(){return r.cells.height}):[],T=_.reduce(u,0),A=p(w,b-T+i.uplift),M=f(p(_,T),[]),k=f(A,M),S={},E=r.columnorder;s(E)&&(E=Array.from(E)),E=E.concat(m(o.map(function(t,r){return r})));var D=y.map(function(t,i){var n=s(r.columnwidth)?r.columnwidth[Math.min(i,r.columnwidth.length-1)]:r.columnwidth;return a(n)?Number(n):1}),C=D.reduce(u,0);D=D.map(function(t){return t/C*x});var I=Math.max(l(r.header.line.width),l(r.cells.line.width)),L={key:r.uid+t._context.staticPlot,translateX:v.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-v.y[1]),size:t._fullLayout._size,width:x,maxLineWidth:I,height:b,columnOrder:E,groupHeight:b,rowBlocks:k,headerRowBlocks:M,scrollY:0,cells:n({},r.cells,{values:o}),headerCells:n({},r.header,{values:y}),gdColumns:y.map(function(t){return t[0]}),gdColumnsOriginalOrder:y.map(function(t){return t[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:y.map(function(t,r){var i=S[t];return S[t]=(i||0)+1,{key:t+"__"+S[t],label:t,specIndex:r,xIndex:E[r],xScale:d,x:void 0,calcdata:void 0,columnWidth:D[r]}})};return L.columns.forEach(function(t){t.calcdata=L,t.x=d(t)}),L}}}),N5=g({"src/traces/table/data_split_helpers.js"(t){var r=$().extendFlat;t.splitToPanels=function(t){var i=[0,0],n=r({},t,{key:"header",type:"header",page:0,prevPages:i,currentRepaint:[null,null],dragHandle:!0,values:t.calcdata.headerCells.values[t.specIndex],rowBlocks:t.calcdata.headerRowBlocks,calcdata:r({},t.calcdata,{cells:t.calcdata.headerCells})});return[r({},t,{key:"cells1",type:"cells",page:0,prevPages:i,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),r({},t,{key:"cells2",type:"cells",page:1,prevPages:i,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),n]},t.splitToCells=function(t){var r,i,n,a,o=(n=(i=(r=t).rowBlocks[r.page])?i.rows[0].rowIndex:0,a=i?n+i.rows.length:0,[n,a]);return(t.values||[]).slice(o[0],o[1]).map(function(r,i){return{keyWithinBlock:i+("string"==typeof r&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:o[0]+i,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}})}}}),N4=g({"src/traces/table/plot.js"(t,r){var i=N2(),n=k(),a=t_(),o=a.numberFormat,s=yj(),l=rr(),u=tN(),c=t_().raiseToTop,h=t_().strTranslate,d=t_().cancelTransition,f=N3(),p=N5(),m=ei();function g(t){return Math.ceil(t.calcdata.maxLineWidth/2)}function y(t,r){return"clip"+t._fullLayout._uid+"_scrollAreaBottomClip_"+r.key}function v(t,r){return"clip"+t._fullLayout._uid+"_columnBoundaryClippath_"+r.calcdata.key+"_"+r.specIndex}function x(t){return[].concat.apply([],t.map(function(t){return t})).map(function(t){return t.__data__})}function b(t,r,a){var o=t.selectAll("."+i.cn.scrollbarKit).data(s.repeat,s.keyFun);o.enter().append("g").classed(i.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),o.each(function(t){var r,n=t.scrollbarState;n.totalHeight=R(r=t.rowBlocks,r.length-1)+(r.length?B(r[r.length-1],1/0):1),n.scrollableAreaHeight=t.groupHeight-D(t),n.currentlyVisibleHeight=Math.min(n.totalHeight,n.scrollableAreaHeight),n.ratio=n.currentlyVisibleHeight/n.totalHeight,n.barLength=Math.max(n.ratio*n.currentlyVisibleHeight,i.goldenRatio*i.scrollbarWidth),n.barWiggleRoom=n.currentlyVisibleHeight-n.barLength,n.wiggleRoom=Math.max(0,n.totalHeight-n.scrollableAreaHeight),n.topY=0===n.barWiggleRoom?0:t.scrollY/n.wiggleRoom*n.barWiggleRoom,n.bottomY=n.topY+n.barLength,n.dragMultiplier=n.wiggleRoom/n.barWiggleRoom}).attr("transform",function(t){return h(t.width+i.scrollbarWidth/2+i.scrollbarOffset,D(t))});var l=o.selectAll("."+i.cn.scrollbar).data(s.repeat,s.keyFun);l.enter().append("g").classed(i.cn.scrollbar,!0);var u=l.selectAll("."+i.cn.scrollbarSlider).data(s.repeat,s.keyFun);u.enter().append("g").classed(i.cn.scrollbarSlider,!0),u.attr("transform",function(t){return h(0,t.scrollbarState.topY||0)});var c=u.selectAll("."+i.cn.scrollbarGlyph).data(s.repeat,s.keyFun);c.enter().append("line").classed(i.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",i.scrollbarWidth).attr("stroke-linecap","round").attr("y1",i.scrollbarWidth/2),c.attr("y2",function(t){return t.scrollbarState.barLength-i.scrollbarWidth/2}).attr("stroke-opacity",function(t){return t.columnDragInProgress||!t.scrollbarState.barWiggleRoom||a?0:.4}),c.transition().delay(0).duration(0),c.transition().delay(i.scrollbarHideDelay).duration(i.scrollbarHideDuration).attr("stroke-opacity",0);var d=l.selectAll("."+i.cn.scrollbarCaptureZone).data(s.repeat,s.keyFun);d.enter().append("line").classed(i.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",i.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(i){var a=n.event.y,o=this.getBoundingClientRect(),s=i.scrollbarState,l=a-o.top,u=n.scale.linear().domain([0,s.scrollableAreaHeight]).range([0,s.totalHeight]).clamp(!0);s.topY<=l&&l<=s.bottomY||I(r,t,null,u(l-s.barLength/2))(i)}).call(n.behavior.drag().origin(function(t){return n.event.stopPropagation(),t.scrollbarState.scrollbarScrollInProgress=!0,t}).on("drag",I(r,t)).on("dragend",function(){})),d.attr("y2",function(t){return t.scrollbarState.scrollableAreaHeight}),r._context.staticPlot&&(c.remove(),d.remove())}function _(t,r,a,o){var u,c,h,d,f,g=((c=((u=a.selectAll("."+i.cn.columnCells).data(s.repeat,s.keyFun)).enter().append("g").classed(i.cn.columnCells,!0),u.exit().remove(),u).selectAll("."+i.cn.columnCell).data(p.splitToCells,function(t){return t.keyWithinBlock})).enter().append("g").classed(i.cn.columnCell,!0),c.exit().remove(),c);g.each(function(t,r){var i=t.calcdata.cells.font,n=t.column.specIndex,a={size:A(i.size,n,r),color:A(i.color,n,r),family:A(i.family,n,r),weight:A(i.weight,n,r),style:A(i.style,n,r),variant:A(i.variant,n,r),textcase:A(i.textcase,n,r),lineposition:A(i.lineposition,n,r),shadow:A(i.shadow,n,r)};t.rowNumber=t.key,t.align=A(t.calcdata.cells.align,n,r),t.cellBorderWidth=A(t.calcdata.cells.line.width,n,r),t.font=a}),((h=g.selectAll("."+i.cn.cellRect).data(s.repeat,function(t){return t.keyWithinBlock})).enter().append("rect").classed(i.cn.cellRect,!0),h).attr("width",function(t){return t.column.columnWidth}).attr("stroke-width",function(t){return t.cellBorderWidth}).each(function(t){var r=n.select(this);m.stroke(r,A(t.calcdata.cells.line.color,t.column.specIndex,t.rowNumber)),m.fill(r,A(t.calcdata.cells.fill.color,t.column.specIndex,t.rowNumber))});var y=((f=((d=g.selectAll("."+i.cn.cellTextHolder).data(s.repeat,function(t){return t.keyWithinBlock})).enter().append("g").classed(i.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),d).selectAll("."+i.cn.cellText).data(s.repeat,function(t){return t.keyWithinBlock})).enter().append("text").classed(i.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){n.event.stopPropagation()}),f);y.each(function(t){l.font(n.select(this),t.font)}),w(y,r,o,t),O(g)}function w(t,r,a,s){t.text(function(t){var r,n=t.column.specIndex,a=t.rowNumber,s=t.value,l="string"==typeof s,u=l&&s.match(/
/i),c=!l||u;t.mayHaveMarkup=l&&s.match(/[<&>]/);var h="string"==typeof(d=s)&&d.match(i.latexCheck);t.latex=h;var d,f,p=h?"":A(t.calcdata.cells.prefix,n,a)||"",m=h?"":A(t.calcdata.cells.suffix,n,a)||"",g=h?null:A(t.calcdata.cells.format,n,a)||null,y=p+(g?o(g)(t.value):t.value)+m;if(t.wrappingNeeded=!t.wrapped&&!c&&!h&&(f=T(y)),t.cellHeightMayIncrease=u||h||t.mayHaveMarkup||(void 0===f?T(y):f),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex,t.wrappingNeeded){var v=(" "===i.wrapSplitCharacter?y.replace(/a&&n.push(o),a+=u}return n}(a,u,l);1===c.length&&(c[0]===a.length-1?c.unshift(c[0]-1):c.push(c[0]+1)),c[0]%2&&c.reverse(),r.each(function(t,r){t.page=c[r],t.scrollY=u}),r.attr("transform",function(t){return h(0,R(t.rowBlocks,t.page)-t.scrollY)}),t&&(L(t,i,r,c,n.prevPages,n,0),L(t,i,r,c,n.prevPages,n,1),b(i,t))}}function I(t,r,a,o){return function(s){var l=s.calcdata?s.calcdata:s,u=r.filter(function(t){return l.key===t.key}),c=a||l.scrollbarState.dragMultiplier,h=l.scrollY;return l.scrollY=void 0===o?l.scrollY+c*n.event.dy:o,C(t,u.selectAll("."+i.cn.yColumn).selectAll("."+i.cn.columnBlock).filter(S),u),l.scrollY===h}}function L(t,r,i,n,a,o,s){n[s]!==a[s]&&(clearTimeout(o.currentRepaint[s]),o.currentRepaint[s]=setTimeout(function(){_(t,r,i.filter(function(t,r){return r===s&&n[r]!==a[r]}),i),a[s]=n[s]}))}function P(t,r,a,o){return function(){var s=n.select(r.parentNode);s.each(function(t){var r=t.fragments;s.selectAll("tspan.line").each(function(t,i){r[i].width=this.getComputedTextLength()});var n,a,o=r[r.length-1].width,l=r.slice(0,-1),u=[],c=0,h=t.column.columnWidth-2*i.cellPad;for(t.value="";l.length;)c+(a=(n=l.shift()).width+o)>h&&(t.value+=u.join(i.wrapSpacer)+i.lineBreaker,u=[],c=0),u.push(n.text),c+=a;c&&(t.value+=u.join(i.wrapSpacer)),t.wrapped=!0}),s.selectAll("tspan.line").remove(),w(s.select("."+i.cn.cellText),a,t,o),n.select(r.parentNode.parentNode).call(O)}}function z(t,r,a,o,s){return function(){if(!s.settledY){var l=n.select(r.parentNode),u=j(s),c=s.key-u.firstRowIndex,d=u.rows[c].rowHeight,f=Math.max(s.cellHeightMayIncrease?r.parentNode.getBoundingClientRect().height+2*i.cellPad:d,d);f-u.rows[c].rowHeight&&(u.rows[c].rowHeight=f,t.selectAll("."+i.cn.columnCell).call(O),C(null,t.filter(S),0),b(a,o,!0)),l.attr("transform",function(){var t=this.parentNode.getBoundingClientRect(),r=n.select(this.parentNode).select("."+i.cn.cellRect).node().getBoundingClientRect(),a=this.transform.baseVal.consolidate(),o=r.top-t.top+(a?a.matrix.f:i.cellPad);return h(F(s,n.select(this.parentNode).select("."+i.cn.cellTextHolder).node().getBoundingClientRect().width),o)}),s.settledY=!0}}}function F(t,r){switch(t.align){case"left":default:return i.cellPad;case"right":return t.column.columnWidth-(r||0)-i.cellPad;case"center":return(t.column.columnWidth-(r||0))/2}}function O(t){t.attr("transform",function(t){var r=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,r){return t+B(r,1/0)},0);return h(0,B(j(t),t.key)+r)}).selectAll("."+i.cn.cellRect).attr("height",function(t){var r,i;return(r=j(t),i=t.key,r.rows[i-r.firstRowIndex]).rowHeight})}function R(t,r){for(var i=0,n=r-1;n>=0;n--)i+=function(t){var r=t.allRowsHeight;if(void 0!==r)return r;for(var i=0,n=0;nr.length&&(t=t.slice(0,r.length)):t=[],a=0;a90&&(f-=180,u=-u),{angle:f,flip:u,p:t.c2p(n,r,i),offsetMultplier:c}}}}),Vl=g({"src/traces/carpet/plot.js"(t,r){var i=k(),n=rr(),a=Va(),o=Vo(),s=Vs(),l=tN(),u=t_(),c=u.strRotate,h=u.strTranslate,d=tj();function f(t,r,s,l,u,c,h){var d="const-"+u+"-lines",f=s.selectAll("."+d).data(c);f.enter().append("path").classed(d,!0).style("vector-effect",h?"none":"non-scaling-stroke"),f.each(function(s){var l=s.x,u=s.y,c="M"+o(a([],l,t.c2p),a([],u,r.c2p),s.smoothing);i.select(this).attr("d",c).style("stroke-width",s.width).style("stroke",s.color).style("stroke-dasharray",n.dashStyle(s.dash,s.width)).style("fill","none")}),f.exit().remove()}function p(t,r,a,o,u,d,f,p){var m=d.selectAll("text."+p).data(f);m.enter().append("text").classed(p,!0);var g=0,y={};return m.each(function(u,d){if("auto"===u.axis.tickangle)f=s(o,r,a,u.xy,u.dxy);else{var f,p=(u.axis.tickangle+180)*Math.PI/180;f=s(o,r,a,u.xy,[Math.cos(p),Math.sin(p)])}d||(y={angle:f.angle,flip:f.flip});var m=(u.endAnchor?-1:1)*f.flip,v=i.select(this).attr({"text-anchor":m>0?"start":"end","data-notex":1}).call(n.font,u.font).text(u.text).call(l.convertToTspans,t),x=n.bBox(this);v.attr("transform",h(f.p[0],f.p[1])+c(f.angle)+h(u.axis.labelpadding*m,.3*x.height)),g=Math.max(g,x.width+u.axis.labelpadding)}),m.exit().remove(),y.maxExtent=g,y}r.exports=function(t,r,n,l){var c=t._context.staticPlot,h=r.xaxis,d=r.yaxis,m=t._fullLayout._clips;u.makeTraceGroups(l,n,"trace").each(function(r){var n,l,g,v,x,b,_,w,T,A,M,k,S,E,D,C,I=i.select(this),L=r[0],P=L.trace,z=P.aaxis,F=P.baxis,O=u.ensureSingle(I,"g","minorlayer"),R=u.ensureSingle(I,"g","majorlayer"),B=u.ensureSingle(I,"g","boundarylayer"),j=u.ensureSingle(I,"g","labellayer");I.style("opacity",P.opacity),f(h,d,R,z,"a",z._gridlines,!0),f(h,d,R,F,"b",F._gridlines,!0),f(h,d,O,z,"a",z._minorgridlines,!0),f(h,d,O,F,"b",F._minorgridlines,!0),f(h,d,B,z,"a-boundary",z._boundarylines,c),f(h,d,B,F,"b-boundary",F._boundarylines,c);var N=p(t,h,d,P,L,j,z._labels,"a-label"),V=p(t,h,d,P,L,j,F._labels,"b-label");n=t,l=j,g=P,v=L,x=h,b=d,_=N,w=V,S=u.aggNums(Math.min,null,g.a),E=u.aggNums(Math.max,null,g.a),D=u.aggNums(Math.min,null,g.b),C=u.aggNums(Math.max,null,g.b),T=.5*(S+E),A=D,M=g.ab2xy(T,A,!0),k=g.dxyda_rough(T,A),void 0===_.angle&&u.extendFlat(_,s(g,x,b,M,g.dxydb_rough(T,A))),y(n,l,g,v,M,k,g.aaxis,x,b,_,"a-title"),T=S,A=.5*(D+C),M=g.ab2xy(T,A,!0),k=g.dxydb_rough(T,A),void 0===w.angle&&u.extendFlat(w,s(g,x,b,M,g.dxyda_rough(T,A))),y(n,l,g,v,M,k,g.baxis,x,b,w,"b-title"),function(t,r,i,n,s){var l,c,h=i.select("#"+t._clipPathId);h.size()||(h=i.append("clipPath").classed("carpetclip",!0));var d=u.ensureSingle(h,"path","carpetboundary"),f=r.clipsegments,p=[];for(c=0;c90&&x<270&&(w=(-l.lineCount(b)+g)*m*o-w),b.attr("transform",h(r.p[0],r.p[1])+c(r.angle)+h(0,w)).attr("text-anchor","middle").call(n.font,f.title.font)}),_.exit().remove()}}}),Vu=g({"src/traces/carpet/cheater_basis.js"(t,r){var i=t_().isArrayOrTypedArray;r.exports=function(t,r,n){var a,o,s,l,u,c=[],h=i(t)?t.length:t,d=i(r)?r.length:r,f=i(t)?t:null,p=i(r)?r:null;f&&(s=(f.length-1)/(f[f.length-1]-f[0])/(h-1)),p&&(l=(p.length-1)/(p[p.length-1]-p[0])/(d-1));var m,g=1/0,y=-1/0;for(o=0;o=10)return null;for(var a=1/0,o=-1/0,s=r.length,l=0;l0&&(p=t.dxydi([],n-1,s,0,l),v.push(u[0]+p[0]/3),x.push(u[1]+p[1]/3),m=t.dxydi([],n-1,s,1,l),v.push(d[0]-m[0]/3),x.push(d[1]-m[1]/3)),v.push(d[0]),x.push(d[1]),u=d;else for(c=Math.floor(Math.max(0,Math.min(I-2,n=t.a2i(i)))),h=n-c,b.length=I,b.crossLength=L,b.xy=function(r){return t.evalxy([],n,r)},b.dxy=function(r,i){return t.dxydj([],c,r,h,i)},o=0;o0&&(g=t.dxydj([],c,o-1,h,0),v.push(u[0]+g[0]/3),x.push(u[1]+g[1]/3),y=t.dxydj([],c,o-1,h,1),v.push(d[0]-y[0]/3),x.push(d[1]-y[1]/3)),v.push(d[0]),x.push(d[1]),u=d;return b.axisLetter=r,b.axis=_,b.crossAxis=k,b.value=i,b.constvar=a,b.index=f,b.x=v,b.y=x,b.smoothing=k.smoothing,b}function F(i){var n,o,s,l,u,c=[],h=[],d={};if(d.length=b.length,d.crossLength=M.length,"b"===r)for(s=Math.max(0,Math.min(L-2,i)),u=Math.min(1,Math.max(0,i-s)),d.xy=function(r){return t.evalxy([],r,i)},d.dxy=function(r,i){return t.dxydi([],r,s,i,u)},n=0;nb.length-1||w.push(n(F(s),{color:_.gridcolor,width:_.gridwidth,dash:_.griddash}));for(f=h;fb.length-1)&&!(g<0||g>b.length-1))for(y=b[l],v=b[g],o=0;o<_.minorgridcount;o++)!((x=g-l)<=0)&&((m=y+(v-y)*(o+1)/(_.minorgridcount+1)*(_.arraydtick/x))b[b.length-1]||T.push(n(z(m),{color:_.minorgridcolor,width:_.minorgridwidth,dash:_.minorgriddash})));_.startline&&A.push(n(F(0),{color:_.startlinecolor,width:_.startlinewidth})),_.endline&&A.push(n(F(b.length-1),{color:_.endlinecolor,width:_.endlinewidth}))}else{for(u=5e-15,h=(c=[Math.floor((b[b.length-1]-_.tick0)/_.dtick*(1+u)),Math.ceil((b[0]-_.tick0)/_.dtick/(1+u))].sort(function(t,r){return t-r}))[0],d=c[1],f=h;f<=d;f++)p=_.tick0+_.dtick*f,w.push(n(z(p),{color:_.gridcolor,width:_.gridwidth,dash:_.griddash}));for(f=h-1;fb[b.length-1]||T.push(n(z(m),{color:_.minorgridcolor,width:_.minorgridwidth,dash:_.minorgriddash}));_.startline&&A.push(n(z(b[0]),{color:_.startlinecolor,width:_.startlinewidth})),_.endline&&A.push(n(z(b[b.length-1]),{color:_.endlinecolor,width:_.endlinewidth}))}}}}),Vd=g({"src/traces/carpet/calc_labels.js"(t,r){var i=rs(),n=$().extendFlat;r.exports=function(t,r){var a,o,s,l,u,c=r._labels=[],h=r._gridlines;for(a=0;a=0;a--)o[h-a]=t[d][a],s[h-a]=r[d][a];for(l.push({x:o,y:s,bicubic:u}),a=d,o=[],s=[];a>=0;a--)o[d-a]=t[a][0],s[d-a]=r[a][0];return l.push({x:o,y:s,bicubic:c}),l}}}),Vp=g({"src/traces/carpet/smooth_fill_2d_array.js"(t,r){var i=t_();r.exports=function(t,r,n){var a,o,s,l=[],u=[],c=t[0].length,h=t.length,d=0;for(a=0;a0&&void 0!==(n=t[i][r-1])&&(o++,a+=n),r0&&void 0!==(n=t[i-1][r])&&(o++,a+=n),i0&&o0&&a1e-5);return i.log("Smoother converged to",A,"after",M,"iterations"),t}}}),Vm=g({"src/traces/carpet/constants.js"(t,r){r.exports={RELATIVE_CULL_TOLERANCE:1e-6}}}),Vg=g({"src/traces/carpet/catmull_rom.js"(t,r){r.exports=function(t,r,i,n){var a=t[0]-r[0],o=t[1]-r[1],s=i[0]-r[0],l=i[1]-r[1],u=Math.pow(a*a+o*o,.25),c=Math.pow(s*s+l*l,.25),h=(c*c*a-u*u*s)*n,d=(c*c*o-u*u*l)*n,f=c*(u+c)*3,p=u*(u+c)*3;return[[r[0]+(f&&h/f),r[1]+(f&&d/f)],[r[0]-(p&&h/p),r[1]-(p&&d/p)]]}}}),Vy=g({"src/traces/carpet/compute_control_points.js"(t,r){var i=Vg(),n=t_().ensureArray;function a(t,r,i){var n=-.5*i[0]+1.5*r[0],a=-.5*i[1]+1.5*r[1];return[(2*n+t[0])/3,(2*a+t[1])/3]}r.exports=function(t,r,o,s,l,u){var c,h,d,f,p,m,g,y,v,x,b=o[0].length,_=o.length,w=l?3*b-2:b,T=u?3*_-2:_;for(t=n(t,T),r=n(r,T),d=0;dp&&tg&&rm||ry},t.setScale=function(){var r=t._x,i=t._y,n=a(t._xctrl,t._yctrl,r,i,d.smoothing,f.smoothing);t._xctrl=n[0],t._yctrl=n[1],t.evalxy=o([t._xctrl,t._yctrl],c,h,d.smoothing,f.smoothing),t.dxydi=s([t._xctrl,t._yctrl],d.smoothing,f.smoothing),t.dxydj=l([t._xctrl,t._yctrl],d.smoothing,f.smoothing)},t.i2a=function(t){var i=Math.max(0,Math.floor(t[0]),c-2),n=t[0]-i;return(1-n)*r[i]+n*r[i+1]},t.j2b=function(t){var r=Math.max(0,Math.floor(t[1]),c-2),i=t[1]-r;return(1-i)*u[r]+i*u[r+1]},t.ij2ab=function(r){return[t.i2a(r[0]),t.j2b(r[1])]},t.a2i=function(t){var i=Math.max(0,Math.min(n(t,r),c-2)),a=r[i],o=r[i+1];return Math.max(0,Math.min(c-1,i+(t-a)/(o-a)))},t.b2j=function(t){var r=Math.max(0,Math.min(n(t,u),h-2)),i=u[r],a=u[r+1];return Math.max(0,Math.min(h-1,r+(t-i)/(a-i)))},t.ab2ij=function(r){return[t.a2i(r[0]),t.b2j(r[1])]},t.i2c=function(r,i){return t.evalxy([],r,i)},t.ab2xy=function(i,n,a){if(!a&&(ir[c-1]|nu[h-1]))return[!1,!1];var o=t.a2i(i),s=t.b2j(n),l=t.evalxy([],o,s);if(a){var d,f,p,m,g=0,y=0,v=[];ir[c-1]?(d=c-2,f=1,g=(i-r[c-1])/(r[c-1]-r[c-2])):(d=Math.max(0,Math.min(c-2,Math.floor(o))),f=o-d),nu[h-1]?(p=h-2,m=1,y=(n-u[h-1])/(u[h-1]-u[h-2])):(p=Math.max(0,Math.min(h-2,Math.floor(s))),m=s-p),g&&(t.dxydi(v,d,p,f,m),l[0]+=v[0]*g,l[1]+=v[1]*g),y&&(t.dxydj(v,d,p,f,m),l[0]+=v[0]*y,l[1]+=v[1]*y)}return l},t.c2p=function(t,r,i){return[r.c2p(t[0]),i.c2p(t[1])]},t.p2x=function(t,r,i){return[r.p2c(t[0]),i.p2c(t[1])]},t.dadi=function(t){var i=Math.max(0,Math.min(r.length-2,t));return r[i+1]-r[i]},t.dbdj=function(t){var r=Math.max(0,Math.min(u.length-2,t));return u[r+1]-u[r]},t.dxyda=function(r,i,n,a){var o=t.dxydi(null,r,i,n,a),s=t.dadi(r,n);return[o[0]/s,o[1]/s]},t.dxydb=function(r,i,n,a){var o=t.dxydj(null,r,i,n,a),s=t.dbdj(i,a);return[o[0]/s,o[1]/s]},t.dxyda_rough=function(r,i,n){var a=v*(n||.1),o=t.ab2xy(r+a,i,!0),s=t.ab2xy(r-a,i,!0);return[(o[0]-s[0])*.5/a,(o[1]-s[1])*.5/a]},t.dxydb_rough=function(r,i,n){var a=x*(n||.1),o=t.ab2xy(r,i+a,!0),s=t.ab2xy(r,i-a,!0);return[(o[0]-s[0])*.5/a,(o[1]-s[1])*.5/a]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}}}),Vw=g({"src/traces/carpet/calc.js"(t,r){var i=rs(),n=t_().isArray1D,a=Vu(),o=Vc(),s=Vh(),l=Vd(),u=Vf(),c=ot(),h=Vp(),d=oe(),f=V_();r.exports=function(t,r){var p=i.getFromId(t,r.xaxis),m=i.getFromId(t,r.yaxis),g=r.aaxis,y=r.baxis,v=r.x,x=r.y,b=[];v&&n(v)&&b.push("x"),x&&n(x)&&b.push("y"),b.length&&d(r,g,y,"a","b",b);var _=r._a=r._a||r.a,w=r._b=r._b||r.b;v=r._x||r.x,x=r._y||r.y;var T={};r._cheater&&(v=a("index"===g.cheatertype?_.length:_,"index"===y.cheatertype?w.length:w,r.cheaterslope)),r._x=v=c(v),r._y=x=c(x),h(v,_,w),h(x,_,w),f(r),r.setScale();var A=o(v),M=o(x),k=.5*(A[1]-A[0]),S=.5*(A[1]+A[0]),E=.5*(M[1]-M[0]),D=.5*(M[1]+M[0]);return A=[S-1.3*k,S+1.3*k],M=[D-1.3*E,D+1.3*E],r._extremes[p._id]=i.findExtremes(p,A,{padded:!0}),r._extremes[m._id]=i.findExtremes(m,M,{padded:!0}),s(r,"a","b"),s(r,"b","a"),l(r,g),l(r,y),T.clipsegments=u(r._xctrl,r._yctrl,g,y),T.x=v,T.y=x,T.a=_,T.b=w,[T]}}}),VT=g({"src/traces/carpet/index.js"(t,r){r.exports={attributes:Ve(),supplyDefaults:Vn(),plot:Vl(),calc:Vw(),animatable:!0,isContainer:!0,moduleType:"trace",name:"carpet",basePlotModule:ny(),categories:["cartesian","svg","carpet","carpetAxis","notLegendIsolatable","noMultiCategory","noHover","noSortingByValue"],meta:{}}}}),VA=g({"lib/carpet.js"(t,r){r.exports=VT()}}),VM=g({"src/traces/scattercarpet/attributes.js"(t,r){var i=i_(),n=iw(),a=K(),{hovertemplateAttrs:o,texttemplateAttrs:s,templatefallbackAttrs:l}=eZ(),u=tH(),c=$().extendFlat,h=n.marker,d=n.line,f=h.line;r.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:c({},n.mode,{dflt:"markers"}),text:c({},n.text,{}),texttemplate:s({editType:"plot"},{keys:["a","b","text"]}),texttemplatefallback:l({editType:"plot"}),hovertext:c({},n.hovertext,{}),line:{color:d.color,width:d.width,dash:d.dash,backoff:d.backoff,shape:c({},d.shape,{values:["linear","spline"]}),smoothing:d.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:c({},n.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:i(),marker:c({symbol:h.symbol,opacity:h.opacity,maxdisplayed:h.maxdisplayed,angle:h.angle,angleref:h.angleref,standoff:h.standoff,size:h.size,sizeref:h.sizeref,sizemin:h.sizemin,sizemode:h.sizemode,line:c({width:f.width,dash:f.dash,editType:"calc"},u("marker.line")),gradient:h.gradient,editType:"calc"},u("marker")),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:c({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron,hovertemplate:o(),hovertemplatefallback:l(),zorder:n.zorder}}}),Vk=g({"src/traces/scattercarpet/defaults.js"(t,r){var i=t_(),n=ib(),a=t8(),o=i$(),s=iW(),l=iY(),u=iZ(),c=iX(),h=VM();r.exports=function(t,r,d,f){function p(n,a){return i.coerce(t,r,h,n,a)}p("carpet"),r.xaxis="x",r.yaxis="y";var m=p("a"),g=p("b"),y=Math.min(m.length,g.length);if(!y){r.visible=!1;return}r._length=y,p("text"),p("texttemplate"),p("texttemplatefallback"),p("hovertext"),p("mode",y")}return s}function v(t,r){var i;i=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,g.push(i+": "+r.toFixed(3)+t.labelsuffix)}}}}),VL=g({"src/traces/scattercarpet/event_data.js"(t,r){r.exports=function(t,r,i,n,a){var o=n[a];return t.a=o.a,t.b=o.b,t.y=o.y,t}}}),VP=g({"src/traces/scattercarpet/index.js"(t,r){r.exports={attributes:VM(),supplyDefaults:Vk(),colorbar:ni(),formatLabels:VS(),calc:VD(),plot:VC(),style:na().style,styleOnSelect:na().styleOnSelect,hoverPoints:VI(),selectPoints:nl(),eventData:VL(),moduleType:"trace",name:"scattercarpet",basePlotModule:ny(),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}}}),Vz=g({"lib/scattercarpet.js"(t,r){r.exports=VP()}}),VF=g({"src/traces/contourcarpet/attributes.js"(t,r){var i=aQ(),n=oC(),a=tH(),o=$().extendFlat,s=n.contours;r.exports=o({carpet:{valType:"string",editType:"calc"},z:i.z,a:i.x,a0:i.x0,da:i.dx,b:i.y,b0:i.y0,db:i.dy,text:i.text,hovertext:i.hovertext,transpose:i.transpose,atype:i.xtype,btype:i.ytype,fillcolor:n.fillcolor,autocontour:n.autocontour,ncontours:n.ncontours,contours:{type:s.type,start:s.start,end:s.end,size:s.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:s.showlines,showlabels:s.showlabels,labelfont:s.labelfont,labelformat:s.labelformat,operation:s.operation,value:s.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:n.line.color,width:n.line.width,dash:n.line.dash,smoothing:n.line.smoothing,editType:"plot"},zorder:n.zorder},a("",{cLetter:"z",autoColorDflt:!1}))}}),VO=g({"src/traces/contourcarpet/defaults.js"(t,r){var i=t_(),n=a0(),a=VF(),o=oQ(),s=oL(),l=oz();r.exports=function(t,r,u,c){function h(n,o){return i.coerce(t,r,a,n,o)}if(h("carpet"),t.a&&t.b){if(!n(t,r,h,c,"a","b")){r.visible=!1;return}h("text"),"constraint"===h("contours.type")?o(t,r,h,c,u,{hasHover:!1}):(s(t,r,h,function(n){return i.coerce2(t,r,a,n)}),l(t,r,h,c,{hasHover:!1}))}else r._defaultColor=u,r._length=null;h("zorder")}}}),VR=g({"src/traces/contourcarpet/calc.js"(t,r){var i=t4(),n=t_(),a=oe(),o=ot(),s=or(),l=oi(),u=on(),c=VO(),h=VE(),d=oO();r.exports=function(t,r){var f=r._carpetTrace=h(t,r);if(!(!f||!f.visible||"legendonly"===f.visible)){if(!r.a||!r.b){var p,m,g,y,v,x,b,_,w,T,A,M,k,S,E,D,C,I=t.data[f.index],L=t.data[r.index];L.a||(L.a=I.a),L.b||(L.b=I.b),c(L,r,r._defaultColor,t._fullLayout)}var P=(p=t,A=(T=(m=r)._carpetTrace).aaxis,M=T.baxis,A._minDtick=0,M._minDtick=0,n.isArray1D(m.z)&&a(m,A,M,"a","b",["z"]),g=m._a=m._a||m.a,x=m._b=m._b||m.b,g=g?A.makeCalcdata(m,"_a"):[],x=x?M.makeCalcdata(m,"_b"):[],y=m.a0||0,v=m.da||1,b=m.b0||0,_=m.db||1,w=m._z=o(m._z||m.z,m.transpose),m._emptypoints=l(w),s(w,m._emptypoints),k=n.maxRowLength(w),S="scaled"===m.xtype?"":g,E=u(m,S,y,v,k,A),D="scaled"===m.ytype?"":x,C=u(m,D,b,_,w.length,M),"levels"===m.contours.type&&"none"!==m.contours.coloring&&i(p,m,{vals:w,containerStr:"",cLetter:"z"}),[{a:E,b:C,z:w}]);return d(r,r._z),P}}}}),VB=g({"src/traces/carpet/axis_aligned_line.js"(t,r){var i=t_().isArrayOrTypedArray;r.exports=function(t,r,n,a){var o,s,l,u,c,h,d,f,p,m,g,y,v,x=i(n)?"a":"b",b=("a"===x?t.aaxis:t.baxis).smoothing,_="a"===x?t.a2i:t.b2j,w="a"===x?n:a,T="a"===x?a:n,A="a"===x?r.a.length:r.b.length,M="a"===x?r.b.length:r.a.length,k=Math.floor("a"===x?t.b2j(T):t.a2i(T)),S="a"===x?function(r){return t.evalxy([],r,k)}:function(r){return t.evalxy([],k,r)};b&&(l=Math.max(0,Math.min(M-2,k)),u=k-l,s="a"===x?function(r,i){return t.dxydi([],r,l,i,u)}:function(r,i){return t.dxydj([],l,r,u,i)});var E=_(w[0]),D=_(w[1]),C=E0?Math.floor:Math.ceil,P=C>0?Math.ceil:Math.floor,z=C>0?Math.min:Math.max,F=C>0?Math.max:Math.min,O=L(E+I),R=P(D-I),B=[[d=S(E)]];for(o=O;o*C=0;Q--)K=n([],(X=S.clipsegments[Q]).x,w.c2p),J=n([],X.y,T.c2p),K.reverse(),J.reverse(),ee.push(a(K,J,X.bicubic));var et="M"+ee.join("L")+"Z";(function(t,r,i,o,l,u){var c,h,d=s.ensureSingle(t,"g","contourbg").selectAll("path").data("fill"!==u||l?[]:[0]);d.enter().append("path"),d.exit().remove();var f=[];for(h=0;h=0&&(d=D,p=m):Math.abs(h[1]-d[1])=0&&(d=D,p=m):s.log("endpt to newendpt is not vert. or horz.",h,d,D)}if(p>=0)break;v+=S(h,d),h=d}if(p===t.edgepaths.length){s.log("unclosed perimeter path");break}c=p,(b=-1===x.indexOf(c))&&(c=x[0],v+=S(h,d)+"Z",h=null)}for(c=0;cg&&(n.max=g),n.len=n.max-n.min}function b(t,r){var i=0;return(.1>Math.abs(t[0]-u)||.1>Math.abs(t[0]-c))&&(i=Math.max(i,o*x(r,v(a.dxydb_rough(t[0],t[1],.1)))/2)),(.1>Math.abs(t[1]-h)||.1>Math.abs(t[1]-d))&&(i=Math.max(i,o*x(r,v(a.dxyda_rough(t[0],t[1],.1)))/2)),i}}(this,i,t,n,d,r.height),!(n.len<(r.width+r.height)*h.LABELMIN)))for(var a=Math.min(Math.ceil(n.len/z),h.LABELMAX),o=0;ov):y=k>T,v=k;var S=c(T,A,M,k);S.pos=w,S.yc=(T+k)/2,S.i=_,S.dir=y?"increasing":"decreasing",S.x=S.pos,S.y=[M,A],x&&(S.orig_p=o[_]),m&&(S.tx=r.text[_]),g&&(S.htx=r.hovertext[_]),b.push(S)}else b.push({pos:w,empty:!0})}return r._extremes[u._id]=a.findExtremes(u,i.concat(f,d),{padded:!0}),b.length&&(b[0].t={labels:{open:n(t,"open:")+" ",high:n(t,"high:")+" ",low:n(t,"low:")+" ",close:n(t,"close:")+" "}}),b}r.exports={calc:function(t,r){var n=a.getFromId(t,r.xaxis),s=a.getFromId(t,r.yaxis),c=function(t,r,n){var a=n._minDiff;if(!a){var s,l=t._fullData,u=[];for(s=0,a=1/0;s"+h.labels[x]+i.hoverLabelText(l,b,u.yhoverformat)):((v=n.extendFlat({},f)).y0=v.y1=_,v.yLabelVal=b,v.yLabel=h.labels[x]+i.hoverLabelText(l,b,u.yhoverformat),v.name="",d.push(v),g[b]=v)}return d}function d(t,r,n,a){var o=t.cd,l=t.ya,h=o[0].trace,d=o[0].t,f=c(t,r,n,a);if(!f)return[];var p=o[f.index],m=f.index=p.i,g=p.dir;function y(t){return d.labels[t]+i.hoverLabelText(l,h[t][m],h.yhoverformat)}var v=p.hi||h.hoverinfo||"",x=v.split("+"),b="all"===v,_=b||-1!==x.indexOf("y"),w=b||-1!==x.indexOf("text"),T=_?[y("open"),y("high"),y("low"),y("close")+" "+u[g]]:[];return w&&s(p,h,T),f.extraText=T.join("
"),f.y0=f.y1=l.c2p(p.yc,!0),[f]}r.exports={hoverPoints:function(t,r,i,n){return t.cd[0].trace.hoverlabel.split?h(t,r,i,n):d(t,r,i,n)},hoverSplit:h,hoverOnPoints:d}}}),VZ=g({"src/traces/ohlc/select.js"(t,r){r.exports=function(t,r){var i,n=t.cd,a=t.xaxis,o=t.yaxis,s=[],l=n[0].t.bPos||0;if(!1===r)for(i=0;ir?function(t){return t<=0}:function(t){return t>=0};l.c2g=function(r){var i=l.c2l(r)-t;return(o(i)?i:0)+a},l.g2c=function(r){return l.l2c(r+t-a)},l.g2p=function(t){return t*n},l.c2p=function(t){return l.g2p(l.c2g(t))}};break;case"angularaxis":var c=t,h=r,d=c.type;if("linear"===d){var f=c.d2c,p=c.c2d;c.d2c=function(t,r){var i;return i=f(t),"degrees"===r?a(i):i},c.c2d=function(t,r){return p("degrees"===r?o(t):t)}}c.makeCalcdata=function(t,r){var i,n,a=t[r],o=t._length,s=function(r){return c.d2c(r,t.thetaunit)};if(a)for(i=Array(o),n=0;n1e-10?t:0}function d(t,r,i){r=r||0,i=i||0;for(var n=t.length,a=Array(n),o=0;o0?i:1/0}),o=i.mod(n+1,r.length);return[r[n],r[o]]},findIntersectionXY:u,findXYatLength:function(t,r,i,n){var a=-r*i,o=r*r+1,s=2*(r*a-i),l=Math.sqrt(s*s-4*o*(a*a+i*i-t*t)),u=(-s+l)/(2*o),c=(-s-l)/(2*o);return[[u,r*u+a+n],[c,r*c+a+n]]},clampTiny:h,pathPolygon:function(t,r,i,n,a,o){return"M"+d(c(t,r,i,n),a,o).join("L")},pathPolygonAnnulus:function(t,r,i,n,a,o,s){t0))!=(o<0?-1:+(o>0))){var p=n(t,i([r,0]));return["M"+u+","+c,"A"+s+","+s+" 0 0,"+(0=90||x>90&&b>=450?1:w<=0&&A<=0?0:Math.max(w,A),[x<=180&&b>=180||x>180&&b>=540?-1:_>=0&&T>=0?0:Math.min(_,T),x<=270&&b>=270||x>270&&b>=630?-1:w>=0&&A>=0?0:Math.min(w,A),b>=360?1:_<=0&&T<=0?0:Math.max(_,T),g]),I=C[2]-C[0],L=Math.abs((C[3]-C[1])/I);f/d>L?(M=d,D=(f-(k=d*L))/n.h/2,S=[c[0],c[1]],E=[h[0]+D,h[1]-D]):(M=f/L,k=f,D=(d-M)/n.w/2,S=[c[0]+D,c[1]-D],E=[h[0],h[1]]),this.xLength2=M,this.yLength2=k,this.xDomain2=S,this.yDomain2=E;var P,z=this.xOffset2=n.l+n.w*S[0],R=this.yOffset2=n.t+n.h*(1-E[1]),B=this.radius=M/I,j=this.innerRadius=this.getHole(r)*B,N=this.cx=z-B*C[0],V=this.cy=R+B*C[3],U=this.cxx=N-z,q=this.cyy=V-R,G=a.side;"counterclockwise"===G?(P=G,G="top"):"clockwise"===G&&(P=G,G="bottom"),this.radialAxis=this.mockAxis(t,r,a,{_id:"x",side:G,_trueSide:P,domain:[j/n.w,B/n.w]}),this.angularAxis=this.mockAxis(t,r,o,{side:"right",domain:[0,Math.PI],autorange:!1}),this.doAutoRange(t,r),this.updateAngularAxis(t,r),this.updateRadialAxis(t,r),this.updateRadialAxisTitle(t,r),this.xaxis=this.mockCartesianAxis(t,r,{_id:"x",domain:S}),this.yaxis=this.mockCartesianAxis(t,r,{_id:"y",domain:E});var H=this.pathSubplot();this.clipPaths.forTraces.select("path").attr("d",H).attr("transform",s(U,q)),i.frontplot.attr("transform",s(z,R)).call(u.setClipUrl,this._hasClipOnAxisFalse?null:this.clipIds.forTraces,this.gd),i.bg.attr("d",H).attr("transform",s(N,V)).call(l.fill,r.bgcolor)},j.mockAxis=function(t,r,i,n){var o=a.extendFlat({},i,n);return f(o,r,t),o},j.mockCartesianAxis=function(t,r,i){var n=this,o=n.isSmith,s=i._id,l=a.extendFlat({type:"linear"},i);d(l,t);var u={x:[0,2],y:[1,3]};return l.setRange=function(){var t=n.sectorBBox,i=u[s],a=n.radialAxis._rl,o=(a[1]-a[0])/(1-n.getHole(r));l.range=[t[i[0]]*o,t[i[1]]*o]},l.isPtWithinRange="x"!==s||o?function(){return!0}:function(t){return n.isPtInside(t)},l.setRange(),l.setScale(),l},j.doAutoRange=function(t,r){var i=this.gd,n=this.radialAxis,a=this.getRadial(r);p(i,n);var o=n.range;if(a.range=o.slice(),a._input.range=o.slice(),n._rl=[n.r2l(o[0],null,"gregorian"),n.r2l(o[1],null,"gregorian")],void 0!==n.minallowed){var s=n.r2l(n.minallowed);n._rl[0]>n._rl[1]?n._rl[1]=Math.max(n._rl[1],s):n._rl[0]=Math.max(n._rl[0],s)}if(void 0!==n.maxallowed){var l=n.r2l(n.maxallowed);n._rl[0]90&&g<=270&&(y.tickangle=180);var b=x?function(t){var r=P(i,C([t.x,0]));return s(r[0]-f,r[1]-p)}:function(t){return s(y.l2p(t.x)+d,0)},_=x?function(t){return L(i,t.x,-1/0,1/0)}:function(t){return i.pathArc(y.r2p(t.x)+d)},w=N(m);if(i.radialTickLayout!==w&&(u["radial-axis"].selectAll(".xtick").remove(),i.radialTickLayout=w),v){y.setScale();var T=0,A=x?(y.tickvals||[]).filter(function(t){return t>=0}).map(function(t){return h.tickText(y,t,!0,!1)}):h.calcTicks(y),M=x?A:h.clipEnds(y,A),k=h.getTickSigns(y)[2];x&&(("top"===y.ticks&&"bottom"===y.side||"bottom"===y.ticks&&"top"===y.side)&&(k=-k),"top"===y.ticks&&"top"===y.side&&(T=-y.ticklen),"bottom"===y.ticks&&"bottom"===y.side&&(T=y.ticklen)),h.drawTicks(n,y,{vals:A,layer:u["radial-axis"],path:h.makeTickPath(y,0,k),transFn:b,crisp:!1}),h.drawGrid(n,y,{vals:M,layer:u["radial-grid"],path:_,transFn:a.noop,crisp:!1}),h.drawLabels(n,y,{vals:A,layer:u["radial-axis"],transFn:b,labelFns:h.makeLabelFns(y,T)})}var S=i.radialAxisAngle=i.vangles?R(V(O(m.angle),i.vangles)):m.angle,E=s(f,p),D=E+o(-S);U(u["radial-axis"],v&&(m.showticklabels||m.ticks),{transform:D}),U(u["radial-grid"],v&&m.showgrid,{transform:x?"":E}),U(u["radial-line"].select("line"),v&&m.showline,{x1:x?-c:d,y1:0,x2:c,y2:0,transform:D}).attr("stroke-width",m.linewidth).call(l.stroke,m.linecolor)},j.updateRadialAxisTitle=function(t,r,i){if(!this.isSmith){var n=this.gd,a=this.radius,o=this.cx,s=this.cy,l=this.getRadial(r),c=this.id+"title",h=0;if(l.title){var d=u.bBox(this.layers["radial-axis"].node()).height,f=l.title.font.size,p=l.side;h="top"===p?f:"counterclockwise"===p?-(d+.4*f):d+.8*f}var m=void 0!==i?i:this.radialAxisAngle,g=O(m),y=Math.cos(g),x=Math.sin(g),b=o+a/2*y+h*x,_=s-a/2*x+h*y;this.layers["radial-axis-title"]=v.draw(n,c,{propContainer:l,propName:this.id+".radialaxis.title.text",placeholder:z(n,"Click to enter radial axis title"),attributes:{x:b,y:_,"text-anchor":"middle"},transform:{rotate:-m}})}},j.updateAngularAxis=function(t,r){var i,n=this,u=n.gd,c=n.layers,d=n.radius,f=n.innerRadius,p=n.cx,m=n.cy,g=n.getAngular(r),y=n.angularAxis,v=n.isSmith;v||(n.fillViewInitialKey("angularaxis.rotation",g.rotation),y.setGeometry(),y.setScale());var x=v?function(t){var r=P(n,C([0,t.x]));return Math.atan2(r[0]-p,r[1]-m)-Math.PI/2}:function(t){return y.t2g(t.x)};"linear"===y.type&&"radians"===y.thetaunit&&(y.tick0=R(y.tick0),y.dtick=R(y.dtick));var b=function(t){return s(p+d*Math.cos(t),m-d*Math.sin(t))},_=v?function(t){var r=P(n,C([0,t.x]));return s(r[0],r[1])}:function(t){return b(x(t))},w=v?function(t){var r=P(n,C([0,t.x])),i=Math.atan2(r[0]-p,r[1]-m)-Math.PI/2;return s(r[0],r[1])+o(-R(i))}:function(t){var r=x(t);return b(r)+o(-R(r))},T=v?function(t){return I(n,t.x,0,1/0)}:function(t){var r=x(t),i=Math.cos(r),n=Math.sin(r);return"M"+[p+f*i,m-f*n]+"L"+[p+d*i,m-d*n]},A=h.makeLabelFns(y,0).labelStandoff,k={};k.xFn=function(t){return Math.cos(x(t))*A},k.yFn=function(t){var r=x(t),i=Math.sin(r)>0?.2:1;return-Math.sin(r)*(A+t.fontSize*i)+Math.abs(Math.cos(r))*(t.fontSize*M)},k.anchorFn=function(t){var r=Math.cos(x(t));return .1>Math.abs(r)?"middle":r>0?"start":"end"},k.heightFn=function(t,r,i){return -.5*(1+Math.sin(x(t)))*i};var S=N(g);n.angularTickLayout!==S&&(c["angular-axis"].selectAll("."+y._id+"tick").remove(),n.angularTickLayout=S);var E=v?[1/0].concat(y.tickvals||[]).map(function(t){return h.tickText(y,t,!0,!1)}):h.calcTicks(y);if(v&&(E[0].text="∞",E[0].fontSize*=1.75),"linear"===r.gridshape?(i=E.map(x),0>a.angleDelta(i[0],i[1])&&(i=i.slice().reverse())):i=null,n.vangles=i,"category"===y.type&&(E=E.filter(function(t){return a.isAngleInsideSector(x(t),n.sectorInRad)})),y.visible){var D="inside"===y.ticks?-1:1,L=(y.linewidth||1)/2;h.drawTicks(u,y,{vals:E,layer:c["angular-axis"],path:"M"+D*L+",0h"+D*y.ticklen,transFn:w,crisp:!1}),h.drawGrid(u,y,{vals:E,layer:c["angular-grid"],path:T,transFn:a.noop,crisp:!1}),h.drawLabels(u,y,{vals:E,layer:c["angular-axis"],repositionOnUpdate:!0,transFn:_,labelFns:k})}U(c["angular-line"].select("path"),g.showline,{d:n.pathSubplot(),transform:s(p,m)}).attr("stroke-width",g.linewidth).call(l.stroke,g.linecolor)},j.updateFx=function(t,r){this.gd._context.staticPlot||(this.isSmith||(this.updateAngularDrag(t),this.updateRadialDrag(t,r,0),this.updateRadialDrag(t,r,1)),this.updateHoverAndMainDrag(t))},j.updateHoverAndMainDrag=function(t){var r,o,u=this,c=u.isSmith,h=u.gd,d=u.layers,f=t._zoomlayer,p=S.MINZOOM,v=S.OFFEDGE,w=u.radius,T=u.innerRadius,A=u.cx,M=u.cy,k=u.cxx,D=u.cyy,C=u.sectorInRad,I=u.vangles,L=u.radialAxis,P=E.clampTiny,z=E.findXYatLength,F=E.findEnclosingVertexAngles,O=S.cornerHalfWidth,R=S.cornerLen/2,B=m.makeDragger(d,"path","maindrag",!1===t.dragmode?"none":"crosshair");i.select(B).attr("d",u.pathSubplot()).attr("transform",s(A,M)),B.onmousemove=function(t){y.hover(h,t,u.id),h._fullLayout._lasthover=B,h._fullLayout._hoversubplot=u.id},B.onmouseout=function(t){h._dragging||g.unhover(h,t)};var j,N,V,U,q,G,H,$,W,Y={element:B,gd:h,subplot:u.id,plotinfo:{id:u.id,xaxis:u.xaxis,yaxis:u.yaxis},xaxes:[u.xaxis],yaxes:[u.yaxis]};function Z(t,r){return Math.sqrt(t*t+r*r)}function X(t,r){return Math.atan2(D-r,t-k)}function K(t,r){return[t*Math.cos(r),t*Math.sin(-r)]}function J(t,r){if(0===t)return u.pathSector(2*O);var i=R/t,n=r-i,a=r+i,o=Math.max(0,Math.min(t,w)),s=o-O,l=o+O;return"M"+K(s,n)+"A"+[s,s]+" 0,0,0 "+K(s,a)+"L"+K(l,a)+"A"+[l,l]+" 0,0,1 "+K(l,n)+"Z"}function Q(t,r,i){if(0===t)return u.pathSector(2*O);var n,a,o,s,l=K(t,r),c=K(t,i),h=P((l[0]+c[0])/2),d=P((l[1]+c[1])/2);if(h&&d){var f=d/h,p=-1/f,m=z(O,f,h,d);o=z(R,p,m[0][0],m[0][1]),s=z(R,p,m[1][0],m[1][1])}else d?(n=R,a=O):(n=O,a=R),o=[[h-n,d-a],[h+n,d-a]],s=[[h-n,d+a],[h+n,d+a]];return"M"+o.join("L")+"L"+s.reverse().join("L")+"Z"}function ee(t,r){return r=Math.max(Math.min(r,w),T),tp?(t-1&&1===t&&b(r,h,[u.xaxis],[u.yaxis],u.id,Y),i.indexOf("event")>-1&&y.click(h,r,u.id)}Y.prepFn=function(t,i,n){var s,d=h._fullLayout.dragmode,p=B.getBoundingClientRect();h._fullLayout._calcInverseTransform(h);var g=h._fullLayout._invTransform;r=h._fullLayout._invScaleX,o=h._fullLayout._invScaleY;var y=a.apply3DTransform(g)(i-p.left,n-p.top);if(j=y[0],N=y[1],I){var v=E.findPolygonOffset(w,C[0],C[1],I);j+=k+v[0],N+=D+v[1]}switch(d){case"zoom":Y.clickFn=es,c||(I?Y.moveFn=en:Y.moveFn=er,Y.doneFn=ea,V=null,U=null,q=u.pathSubplot(),G=!1,s=h._fullLayout[u.id],H=l.luminosity(s.bgcolor),($=m.makeZoombox(f,H,A,M,q)).attr("fill-rule","evenodd"),W=m.makeCorners(f,A,M),_(h));break;case"select":case"lasso":x(t,i,n,Y,d)}},g.init(Y)},j.updateRadialDrag=function(t,r,l){var u,c,h,d=this,f=d.gd,p=d.layers,y=d.radius,v=d.innerRadius,x=d.cx,b=d.cy,w=d.radialAxis,M=S.radialDragBoxSize,k=M/2;if(w.visible){var E,D,C,I=O(d.radialAxisAngle),L=w._rl,P=L[0],z=L[1],F=L[l],B=.75*(L[1]-L[0])/(1-d.getHole(r))/y;l?(E=x+(y+k)*Math.cos(I),D=b-(y+k)*Math.sin(I),C="radialdrag"):(E=x+(v-k)*Math.cos(I),D=b-(v-k)*Math.sin(I),C="radialdrag-inner");var j=m.makeRectDragger(p,C,"crosshair",-k,-k,M,M),N={element:j,gd:f};!1===t.dragmode&&(N.dragmode=!1),U(i.select(j),w.visible&&v0!=(l?h>P:h")}}r.exports={hoverPoints:function(t,r,a,o){var s=i(t,r,a,o);if(!(!s||!1===s[0].index)){var l=s[0];if(void 0===l.index)return s;var u=t.subplot,c=l.cd[l.index],h=l.trace;if(u.isPtInside(c))return l.xLabelVal=void 0,l.yLabelVal=void 0,n(c,h,u,l),l.hovertemplate=h.hovertemplate,s}},makeHoverPointText:n}}}),Us=g({"src/traces/scatterpolar/index.js"(t,r){r.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:Ue(),categories:["polar","symbols","showLegend","scatter-like"],attributes:Ut(),supplyDefaults:Ur().supplyDefaults,colorbar:ni(),formatLabels:Ui(),calc:Un(),plot:Ua(),style:na().style,styleOnSelect:na().styleOnSelect,hoverPoints:Uo().hoverPoints,selectPoints:nl(),meta:{}}}}),Ul=g({"lib/scatterpolar.js"(t,r){r.exports=Us()}}),Uu=g({"src/traces/scatterpolargl/attributes.js"(t,r){var i=Ut(),{cliponaxis:n,hoveron:a}=i,o=((t,r)=>{var i={};for(var n in t)u.call(t,n)&&0>r.indexOf(n)&&(i[n]=t[n]);if(null!=t&&s)for(var n of s(t))0>r.indexOf(n)&&c.call(t,n)&&(i[n]=t[n]);return i})(i,["cliponaxis","hoveron"]),{connectgaps:l,line:{color:h,dash:d,width:m},fill:g,fillcolor:y,marker:v,textfont:x,textposition:b}=p2();r.exports=p(f({},o),{connectgaps:l,fill:g,fillcolor:y,line:{color:h,dash:d,editType:"calc",width:m},marker:v,textfont:x,textposition:b})}}),Uc=g({"src/traces/scatterpolargl/defaults.js"(t,r){var i=t_(),n=t8(),a=Ur().handleRThetaDefaults,o=i$(),s=iW(),l=iZ(),u=iX(),c=ib().PTS_LINESONLY,h=Uu();r.exports=function(t,r,d,f){function p(n,a){return i.coerce(t,r,h,n,a)}var m=a(t,r,f,p);if(!m){r.visible=!1;return}p("thetaunit"),p("mode",m=u&&(x.marker.cluster=m.tree),x.marker&&(x.markerSel.positions=x.markerUnsel.positions=x.marker.positions=w),x.line&&w.length>1&&l.extendFlat(x.line,s.linePositions(t,p,w)),x.text&&(l.extendFlat(x.text,{positions:w},s.textPosition(t,p,x.text,x.marker)),l.extendFlat(x.textSel,{positions:w},s.textPosition(t,p,x.text,x.markerSel)),l.extendFlat(x.textUnsel,{positions:w},s.textPosition(t,p,x.text,x.markerUnsel))),x.fill&&!f.fill2d&&(f.fill2d=!0),x.marker&&!f.scatter2d&&(f.scatter2d=!0),x.line&&!f.line2d&&(f.line2d=!0),x.text&&!f.glText&&(f.glText=!0),f.lineOptions.push(x.line),f.fillOptions.push(x.fill),f.markerOptions.push(x.marker),f.markerSelectedOptions.push(x.markerSel),f.markerUnselectedOptions.push(x.markerUnsel),f.textOptions.push(x.text),f.textSelectedOptions.push(x.textSel),f.textUnselectedOptions.push(x.textUnsel),f.selectBatch.push([]),f.unselectBatch.push([]),m.x=T,m.y=A,m.rawx=T,m.rawy=A,m.r=y,m.theta=v,m.positions=w,m._scene=f,m.index=f.count,f.count++}}),a(t,r,c)}},r.exports.reglPrecompiled={}}}),Ug=g({"src/traces/scatterpolargl/index.js"(t,r){var i=Up();i.plot=Um(),r.exports=i}}),Uy=g({"lib/scatterpolargl.js"(t,r){r.exports=Ug()}}),Uv=g({"src/traces/barpolar/attributes.js"(t,r){var i,{hovertemplateAttrs:n,templatefallbackAttrs:a}=eZ(),o=$().extendFlat,s=Ut(),l=aA();r.exports={r:s.r,theta:s.theta,r0:s.r0,dr:s.dr,theta0:s.theta0,dtheta:s.dtheta,thetaunit:s.thetaunit,base:o({},l.base,{}),offset:o({},l.offset,{}),width:o({},l.width,{}),text:o({},l.text,{}),hovertext:o({},l.hovertext,{}),marker:(i=o({},l.marker),delete i.cornerradius,i),hoverinfo:s.hoverinfo,hovertemplate:n(),hovertemplatefallback:a(),selected:l.selected,unselected:l.unselected}}}),Ux=g({"src/traces/barpolar/layout_attributes.js"(t,r){r.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}}}),Ub=g({"src/traces/barpolar/defaults.js"(t,r){var i=t_(),n=Ur().handleRThetaDefaults,a=ak(),o=Uv();r.exports=function(t,r,s,l){function u(n,a){return i.coerce(t,r,o,n,a)}if(!n(t,r,l,u)){r.visible=!1;return}u("thetaunit"),u("base"),u("offset"),u("width"),u("text"),u("hovertext"),u("hovertemplate"),u("hovertemplatefallback"),a(t,r,u,s,l),i.coerceSelectionMarkerOpacity(r,u)}}}),U_=g({"src/traces/barpolar/layout_defaults.js"(t,r){var i=t_(),n=Ux();r.exports=function(t,r,a){var o,s={};function l(a,s){return i.coerce(t[o]||{},r[o],n,a,s)}for(var u=0;u0?(o=i,l=n):(o=n,l=i);var o,l,d=s.findEnclosingVertexAngles(o,u.vangles)[0],f=s.findEnclosingVertexAngles(l,u.vangles)[1],p=[d,(o+l)/2,f];return s.pathPolygonAnnulus(t,r,o,l,p,c,h)}:function(t,r,i,n){return a.pathAnnulus(t,r,i,n,c,h)}),v=r.layers.frontplot.select("g.barlayer");a.makeTraceGroups(v,l,"trace bars").each(function(){var s=i.select(this),l=a.ensureSingle(s,"g","points").selectAll("g.point").data(a.identity);l.enter().append("g").style("vector-effect",d?"none":"non-scaling-stroke").style("stroke-miterlimit",2).classed("point",!0),l.exit().remove(),l.each(function(t){var r,o=i.select(this),s=t.rp0=m.c2p(t.s0),l=t.rp1=m.c2p(t.s1),u=t.thetag0=g.c2g(t.p0),c=t.thetag1=g.c2g(t.p1);if(n(s)&&n(l)&&n(u)&&n(c)&&s!==l&&u!==c){var h=m.c2g(t.s1),d=(u+c)/2;t.ct=[f.c2p(h*Math.cos(d)),p.c2p(h*Math.sin(d))],r=y(s,l,u,c)}else r="M0,0Z";a.ensureSingle(o,"path").attr("d",r)}),o.setClipUrl(s,r._hasClipOnAxisFalse?r.clipIds.forTraces:null,t)})}}}),UA=g({"src/traces/barpolar/hover.js"(t,r){var i=rR(),n=t_(),a=aF().getTraceColor,o=n.fillText,s=Uo().makeHoverPointText,l=V4().isPtInsidePolygon;r.exports=function(t,r,u){var c=t.cd,h=c[0].trace,d=t.subplot,f=d.radialAxis,p=d.angularAxis,m=d.vangles,g=m?l:n.isPtInsideSector,y=t.maxHoverDistance,v=p._period||2*Math.PI,x=Math.abs(f.g2p(Math.sqrt(r*r+u*u))),b=Math.atan2(u,r);if(f.range[0]>f.range[1]&&(b+=Math.PI),i.getClosest(c,function(t){return g(x,b,[t.rp0,t.rp1],[t.thetag0,t.thetag1],m)?y+Math.min(1,Math.abs(t.thetag1-t.thetag0)/v)-1+(t.rp1-x)/(t.rp1-t.rp0)-1:1/0},t),!1!==t.index){var _=c[t.index];t.x0=t.x1=_.ct[0],t.y0=t.y1=_.ct[1];var w=n.extendFlat({},_,{r:_.s,theta:_.p});return o(_,h,t),s(w,h,d,t),t.hovertemplate=h.hovertemplate,t.color=a(h,_),t.xLabelVal=t.yLabelVal=void 0,_.s<0&&(t.idealAlign="left"),[t]}}}}),UM=g({"src/traces/barpolar/index.js"(t,r){r.exports={moduleType:"trace",name:"barpolar",basePlotModule:Ue(),categories:["polar","bar","showLegend"],attributes:Uv(),layoutAttributes:Ux(),supplyDefaults:Ub(),supplyLayoutDefaults:U_(),calc:Uw().calc,crossTraceCalc:Uw().crossTraceCalc,plot:UT(),colorbar:ni(),formatLabels:Ui(),style:aP().style,styleOnSelect:aP().styleOnSelect,hoverPoints:UA(),selectPoints:aR(),meta:{}}}}),Uk=g({"lib/barpolar.js"(t,r){r.exports=UM()}}),US=g({"src/plots/smith/constants.js"(t,r){r.exports={attr:"subplot",name:"smith",axisNames:["realaxis","imaginaryaxis"],axisName2dataArray:{imaginaryaxis:"imag",realaxis:"real"}}}}),UE=g({"src/plots/smith/layout_attributes.js"(t,r){var i=er(),n=tq(),a=an().attributes,o=t_().extendFlat,s=e$().overrideAll,l=s({color:n.color,showline:o({},n.showline,{dflt:!0}),linecolor:n.linecolor,linewidth:n.linewidth,showgrid:o({},n.showgrid,{dflt:!0}),gridcolor:n.gridcolor,gridwidth:n.gridwidth,griddash:n.griddash},"plot","from-root"),u=s({ticklen:n.ticklen,tickwidth:o({},n.tickwidth,{dflt:2}),tickcolor:n.tickcolor,showticklabels:n.showticklabels,labelalias:n.labelalias,showtickprefix:n.showtickprefix,tickprefix:n.tickprefix,showticksuffix:n.showticksuffix,ticksuffix:n.ticksuffix,tickfont:n.tickfont,tickformat:n.tickformat,hoverformat:n.hoverformat,layer:n.layer},"plot","from-root"),c=o({visible:o({},n.visible,{dflt:!0}),tickvals:{dflt:[.2,.5,1,2,5],valType:"data_array",editType:"plot"},tickangle:o({},n.tickangle,{dflt:90}),ticks:{valType:"enumerated",values:["top","bottom",""],editType:"ticks"},side:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},editType:"calc"},l,u),h=o({visible:o({},n.visible,{dflt:!0}),tickvals:{valType:"data_array",editType:"plot"},ticks:n.ticks,editType:"calc"},l,u);r.exports={domain:a({name:"smith",editType:"plot"}),bgcolor:{valType:"color",editType:"plot",dflt:i.background},realaxis:c,imaginaryaxis:h,editType:"calc"}}}),UD=g({"src/plots/smith/layout_defaults.js"(t,r){var i,n,a,o=t_(),s=ei(),l=tC(),u=sr(),c=tF().getSubplotData,h=t0(),d=tQ(),f=nd(),p=rn(),m=UE(),g=US(),y=g.axisNames,v=(i=function(t){return o.isTypedArray(t)&&(t=Array.from(t)),t.slice().reverse().map(function(t){return-t}).concat([0]).concat(t)},n=String,a={},function(t){var r=n?n(t):t;if(r in a)return a[r];var o=i(t);return a[r]=o,o});function x(t,r,i,n){var a=i("bgcolor");n.bgColor=s.combine(a,n.paper_bgcolor);var u,x=c(n.fullData,g.name,n.id),b=n.layoutOut;function _(t,r){return i(u+"."+t,r)}for(var w=0;w")}}r.exports={hoverPoints:function(t,r,a,o){var s=i(t,r,a,o);if(!(!s||!1===s[0].index)){var l=s[0];if(void 0===l.index)return s;var u=t.subplot,c=l.cd[l.index],h=l.trace;if(u.isPtInside(c))return l.xLabelVal=void 0,l.yLabelVal=void 0,n(c,h,u,l),l.hovertemplate=h.hovertemplate,s}},makeHoverPointText:n}}}),UR=g({"src/traces/scattersmith/index.js"(t,r){r.exports={moduleType:"trace",name:"scattersmith",basePlotModule:UC(),categories:["smith","symbols","showLegend","scatter-like"],attributes:UI(),supplyDefaults:UL(),colorbar:ni(),formatLabels:UP(),calc:Uz(),plot:UF(),style:na().style,styleOnSelect:na().styleOnSelect,hoverPoints:UO().hoverPoints,selectPoints:nl(),meta:{}}}}),UB=g({"lib/scattersmith.js"(t,r){r.exports=UR()}}),Uj=g({"src/traces/quiver/attributes.js"(t,r){var i=K(),n=eZ().hovertemplateAttrs,a=tU().axisHoverFormat,o=$().extendFlat,s=tH(),l=eW().dash,u=ix(),c=iw();r.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},x0:c.x0,dx:c.dx,y:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},y0:c.y0,dy:c.dy,u:{valType:"data_array",editType:"calc",anim:!0},v:{valType:"data_array",editType:"calc",anim:!0},arrowref:{valType:"enumerated",values:["paper","data"],dflt:"data",editType:"calc"},lengthmode:{valType:"enumerated",values:["scaled","raw"],editType:"calc",dflt:"scaled"},lengthfactor:{valType:"number",min:0,editType:"calc",dflt:1},anchor:{valType:"enumerated",values:["tip","tail","center"],dflt:"tail",editType:"calc"},xhoverformat:a("x"),yhoverformat:a("y"),uhoverformat:a("u","noDate"),vhoverformat:a("v","noDate"),hoverinfo:o({},i.hoverinfo,{flags:["x","y","u","v","text","name"],dflt:"all"}),hovertemplate:n({},{keys:["x","y","u","v","text","name"]}),text:c.text,textposition:c.textposition,textfont:c.textfont,marker:o({arrowsize:o({},u.arrowsize,{editType:"calc"}),line:{width:{valType:"number",min:0,dflt:2,editType:"style"},dash:l,editType:"style"},editType:"calc"},s("marker",{showScaleDflt:!0,editTypeOverride:"calc"})),selected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},unselected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"}}}}),UN=g({"src/traces/quiver/defaults.js"(t,r){var i=t_(),n=Uj(),a=iq(),o=tV().hasColorscale,s=t2();r.exports=function(t,r,l,u){function c(a,o){return i.coerce(t,r,n,a,o)}var h=a(t,r,u,c);if(!h){r.visible=!1;return}var d=c("u"),f=c("v");if(!i.isArrayOrTypedArray(d)||0===d.length){r.u=Array(h);for(var p=0;pD&&(D=h[R]),d[R]I&&(I=d[R]),BP&&(P=B),jF&&(F=j);var q=Math.sqrt(B*B+j*j);if(q>g&&(g=q),qv&&(v=G))}}else N.x=o,N.y=o}if(r._maxNorm=g,"scaled"===A||"paper"===M){let t=D-E,i=I-C;r._scaleFactor=(0===t&&0===i?1:(t+i+Math.sqrt((t-i)*(t-i)+4*O*t*i))/(2*(O-1)))*.97/r._maxNorm}else r._scaleFactor=1;r._scaleFactor*=r.lengthfactor;let H=Array(f),$=Array(f),W=Array(f),Y=Array(f);for(var Z,X,K,R=0;Rt.i&&isFinite(s[t.i]))o=s[t.i];else{var l=r.u&&r.u[t.i]||0,u=r.v&&r.v[t.i]||0;o=Math.sqrt(l*l+u*u)}return t.mcc=a(o),t.mcc})}function u(t,r,o){var u=r[0].trace,c=u.marker||{},h=c.line||{},d=n.isArrayOrTypedArray(c.color)?void 0:c.color,f=u._hasColorscale;if(o)if(u.selectedpoints){var p=(u.selected||{}).marker||{},m=(u.unselected||{}).marker||{},g=p.line||{},y=m.line||{};o.selectAll("path.js-line").each(function(t){var r=i.select(this),n=!t.selected,o=n?m.color:p.color,c=n?void 0!==y.width?y.width:h.width:void 0!==g.width?g.width:h.width;o?(a.lineGroupStyle(r,c,o,h.dash),r.style("stroke-opacity",1)):(a.lineGroupStyle(r,c,d,h.dash),f&&l(r,u),r.style("stroke-opacity",n?s:1))}),a.selectedTextStyle(o.selectAll("text"),u)}else{var v=o.selectAll("path.js-line");v.call(a.lineGroupStyle,h.width,d,h.dash),f&&l(v,u),v.style("stroke-opacity",1),a.textPointStyle(o.selectAll("text"),u,t)}}r.exports={style:function(t){i.select(t).selectAll("g.trace.quiver").each(function(r){u(t,r,i.select(this))})},styleOnSelect:function(t,r,i){u(t,r,i)},colorscaleStroke:l}}}),UG=g({"src/traces/quiver/plot.js"(t,r){var i=k(),n=t_(),a=rr(),o=Uq().colorscaleStroke,s=Math.PI/12;function l(t,r,l,u,c,h,d){var f=u[0].trace,p=l.xaxis,m=l.yaxis;u[0][l.isRangePlot?"nodeRangePlot3":"node3"]=i.select(h);var g=i.select(h).selectAll("g.lines").data([u]);g.enter().append("g").classed("lines",!0),a.setClipUrl(g,l.layerClipId,t);var y=g.selectAll("path.js-line").data(u);y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke"),y.exit().remove();let{anchor:v,maxNorm:x=0,arrowref:b}=f,_="paper"===b?f._scaleFactor*Math.sqrt(Math.abs(p._m*m._m)):f._scaleFactor,w=f.marker.arrowsize;y.each(function(t){let r=i.select(this);if(void 0===t.x||void 0===t.y)return void r.attr("d",null);let n=("paper"===b?t._u*Math.sign(p._m):i.round(p._m*t._u))*_,a=("paper"===b?t._v*Math.sign(m._m):i.round(m._m*t._v))*_,o=void 0!==(f._input.marker||{}).arrowsize;"tip"===v?(l=p.c2p(t.x)-n,c=m.c2p(t.y)-a,u=p.c2p(t.x),h=m.c2p(t.y)):"center"===v?(l=p.c2p(t.x)-n/2,c=m.c2p(t.y)-a/2,u=p.c2p(t.x)+n/2,h=m.c2p(t.y)+a/2):(l=p.c2p(t.x),c=m.c2p(t.y),u=p.c2p(t.x)+n,h=m.c2p(t.y)+a),t._px0=l,t._py0=c,t._px1=u,t._py1=h;var l,u,c,h,d=f.marker.line.width;o||(d=Math.max(d,1.5));let g=Math.min(5.8*w*d,.7*Math.sqrt((u-l)*(u-l)+(h-c)*(h-c))),y=Math.atan2(h-c,u-l),x=u-g*Math.cos(y-s),T=h-g*Math.sin(y-s),A=u-g*Math.cos(y+s),M=h-g*Math.sin(y+s),k="M"+l+","+c+"L"+u+","+h+"L"+x+","+T+"L"+u+","+h+"L"+A+","+M;r.attr("d",k)});var T=f.marker||{},A=T.line||{},M=n.isArrayOrTypedArray(T.color)?void 0:T.color;a.lineGroupStyle(y,A.width,M,A.dash),f._hasColorscale&&o(y,f);var k=i.select(h).selectAll("g.text").data([u]);k.enter().append("g").classed("text",!0),a.setClipUrl(k,l.layerClipId,t);var S=k.selectAll("g.textpoint").data(u);if(S.enter().append("g").classed("textpoint",!0).append("text"),S.exit().remove(),S.each(function(t){var r=i.select(this);a.translatePoint(t,r.select("text"),p,m)||r.remove()}),S.selectAll("text").call(a.textPointStyle,f,t).each(function(t){var r=p.c2p(t.x),n=m.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){i.select(this).attr({x:r,y:n})})}),d&&d.duration>0){var E=i.transition().duration(d.duration).ease(d.easing);y.transition(E).style("opacity",1)}}r.exports=function(t,r,n,a,o,s){var u,c,h=!o,d=!!o&&o.duration>0;((u=a.selectAll("g.trace").data(n,function(t){return t[0].trace.uid})).enter().append("g").attr("class",function(t){return"trace quiver trace"+t[0].trace.uid}).style("stroke-miterlimit",2),u.order(),d)?(s&&(c=s()),i.transition().duration(o.duration).ease(o.easing).each("end",function(){c&&c()}).each("interrupt",function(){c&&c()}).each(function(){a.selectAll("g.trace").each(function(i,a){l(t,a,r,i,n,this,o)})})):u.each(function(i,a){l(t,a,r,i,n,this,o)}),h&&u.exit().remove()}}}),UH=g({"src/traces/quiver/hover.js"(t,r){var i=t_(),n=rR(),a=no();r.exports=function(t,r,o,s){var l=t.cd,u=l[0].trace,c=t.xa,h=t.ya,d=c.c2p(r),f=h.c2p(o);if(n.getClosest(l,function(t){return void 0===t._px0?1/0:function(t,r,i,n,a,o){let s=a-i,l=o-n,u=s*s+l*l;if(!u)return Math.sqrt((t-i)*(t-i)+(r-n)*(r-n));var c=((t-i)*s+(r-n)*l)/u;let h=i+(c=Math.max(0,Math.min(1,c)))*s,d=n+c*l;return Math.sqrt((t-h)*(t-h)+(r-d)*(r-d))}(d,f,t._px0,t._py0,t._px1,t._py1)},t),!1!==t.index){var p=l[t.index],m=c.c2p(p.x,!0),g=h.c2p(p.y,!0),y=Math.sqrt((d-m)*(d-m)+(f-g)*(f-g));t.index=p.i;var v=u.u?u.u[p.i]:0,x=u.v?u.v[p.i]:0;return i.extendFlat(t,{color:a(u,p),x0:m-3,x1:m+3,xLabelVal:p.x,y0:g-3,y1:g+3,yLabelVal:p.y,uLabelVal:v,vLabelVal:x,extraText:"u: "+v+", v: "+x,spikeDistance:y,hovertemplate:u.hovertemplate}),i.fillText(p,u,t),[t]}}}}),U$=g({"src/traces/quiver/format_labels.js"(t,r){var i=rs(),n=t_();r.exports=function(t,r,a){var o={},s={_fullLayout:a},l=i.getFromTrace(s,r,"x"),u=i.getFromTrace(s,r,"y"),c=t.x,h=t.y;o.xLabel=i.tickText(l,l.c2l(c),!0).text,o.yLabel=i.tickText(u,u.c2l(h),!0).text;var d=r.u?r.u[t.i]:0,f=r.v?r.v[t.i]:0,p=r.uhoverformat,m=r.vhoverformat;return o.uLabel=p?n.numberFormat(p)(d):String(d),o.vLabel=m?n.numberFormat(m)(f):String(f),o}}}),UW=g({"src/traces/quiver/event_data.js"(t,r){r.exports=function(t,r,i,n,a){return t.x=r.x,t.y=r.y,t.u=i.u?i.u[a]:void 0,t.v=i.v?i.v[a]:void 0,t}}}),UY=g({"src/traces/quiver/index.js"(t,r){r.exports={moduleType:"trace",name:"quiver",basePlotModule:ny(),categories:["cartesian","svg","showLegend","scatter-like","zoomScale"],attributes:Uj(),supplyDefaults:UN(),calc:UV(),crossTraceCalc:UU(),plot:UG(),style:Uq().style,styleOnSelect:Uq().styleOnSelect,hoverPoints:UH(),formatLabels:U$(),eventData:UW(),selectPoints:nl(),colorbar:ni(),animatable:!0,meta:{}}}}),UZ=g({"lib/quiver.js"(t,r){r.exports=UY()}}),UX=g({"node_modules/world-calendars/dist/main.js"(t,r){var i=mB();function n(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function a(t,r,i,n){if(this._calendar=t,this._year=r,this._month=i,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(t,r){return t=""+t,"000000".substring(0,r-t.length)+t}function s(){this.shortYearCutoff="+10"}function l(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}i(n.prototype,{instance:function(t,r){t=(t||"gregorian").toLowerCase(),r=r||"";var i=this._localCals[t+"-"+r];if(!i&&this.calendars[t]&&(i=new this.calendars[t](r),this._localCals[t+"-"+r]=i),!i)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return i},newDate:function(t,r,i,n,a){return(n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,a):n)||this.instance()).newDate(t,r,i)},substituteDigits:function(t){return function(r){return(r+"").replace(/[0-9]/g,function(r){return t[r]})}},substituteChineseDigits:function(t,r){return function(i){for(var n="",a=0;i>0;){var o=i%10;n=(0===o?"":t[o]+r[a])+n,a++,i=Math.floor(i/10)}return 0===n.indexOf(t[1]+r[1])&&(n=n.substr(1)),n||t[0]}}}),i(a.prototype,{newDate:function(t,r,i){return this._calendar.newDate(t??this,r,i)},year:function(t){return 0==arguments.length?this._year:this.set(t,"y")},month:function(t){return 0==arguments.length?this._month:this.set(t,"m")},day:function(t){return 0==arguments.length?this._day:this.set(t,"d")},date:function(t,r,i){if(!this._calendar.isValid(t,r,i))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=r,this._day=i,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,r){return this._calendar.add(this,t,r)},set:function(t,r){return this._calendar.set(this,t,r)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(u.local.differentCalendars||u.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name);var r=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===r?0:r<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(0>this.year()?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}}),i(s.prototype,{_validateLevel:0,newDate:function(t,r,i){return null==t?this.today():(t.year&&(this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate),i=t.day(),r=t.month(),t=t.year()),new a(this,t,r,i))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return 0>this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear).year()?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var r=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return(0>r.year()?"-":"")+o(Math.abs(r.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear),12},monthOfYear:function(t,r){var i=this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return(i.month()+this.monthsInYear(i)-this.firstMonth)%this.monthsInYear(i)+this.minMonth},fromMonthOfYear:function(t,r){var i=(r+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,i,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth),i},daysInYear:function(t){var r=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return this.leapYear(r)?366:365},dayOfYear:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,r,i){return this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate),{}},add:function(t,r,i){return this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,r,i),r,i)},_add:function(t,r,i){if(this._validateLevel++,"d"===i||"w"===i){var n=t.toJD()+r*("w"===i?this.daysInWeek():1),a=t.calendar().fromJD(n);return this._validateLevel--,[a.year(),a.month(),a.day()]}try{var o=t.year()+("y"===i?r:0),s=t.monthOfYear()+("m"===i?r:0),a=t.day();"y"===i?(t.month()!==this.fromMonthOfYear(o,s)&&(s=this.newDate(o,t.month(),this.minDay).monthOfYear()),s=Math.min(s,this.monthsInYear(o)),a=Math.min(a,this.daysInMonth(o,this.fromMonthOfYear(o,s)))):"m"===i&&(function(t){for(;sr-1+t.minMonth;)o++,s-=r,r=t.monthsInYear(o)}(this),a=Math.min(a,this.daysInMonth(o,this.fromMonthOfYear(o,s))));var l=[o,this.fromMonthOfYear(o,s),a];return this._validateLevel--,l}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,r,i,n){if(!this.hasYearZero&&("y"===n||"m"===n)&&(0===r[0]||t.year()>0!=r[0]>0)){var a={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n];r=this._add(t,i*a[0]+(i<0?-1:1)*a[1],a[2])}return t.date(r[0],r[1],r[2])},set:function(t,r,i){this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);var n="y"===i?r:t.year(),a="m"===i?r:t.month(),o="d"===i?r:t.day();return("y"===i||"m"===i)&&(o=Math.min(o,this.daysInMonth(n,a))),t.date(n,a,o)},isValid:function(t,r,i){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var a=this.newDate(t,r,this.minDay);n=r>=this.minMonth&&r-this.minMonth=this.minDay&&i-this.minDayr.year());return t%4==0&&(t%100!=0||t%400==0)},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,r){var i=this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return this.daysPerMonth[i.month()-1]+(2===i.month()&&this.leapYear(i.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate);t=n.year(),r=n.month(),i=n.day(),t<0&&t++,r<3&&(r+=12,t--);var a=Math.floor(t/100);return Math.floor(365.25*(t+4716))+Math.floor(30.6001*(r+1))+i+(2-a+Math.floor(a/4))-1524.5},fromJD:function(t){var r=Math.floor(t+.5),i=Math.floor((r-1867216.25)/36524.25),n=(i=r+1+i-Math.floor(i/4))+1524,a=Math.floor((n-122.1)/365.25),o=Math.floor(365.25*a),s=Math.floor((n-o)/30.6001),l=n-o-Math.floor(30.6001*s),u=s-(s>13.5?13:1),c=a-(u>2.5?4716:4715);return c<=0&&c--,this.newDate(c,u,l)},toJSDate:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate),a=new Date(n.year(),n.month()-1,n.day());return a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0),a.setHours(a.getHours()>12?a.getHours()+2:0),a},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var u=r.exports=new n;u.cdate=a,u.baseCalendar=s,u.calendars.gregorian=l}}),UK=g({"node_modules/world-calendars/dist/plus.js"(){var t=mB(),r=UX();t(r.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),r.local=r.regionalOptions[""],t(r.cdate.prototype,{formatDate:function(t,r){return"string"!=typeof t&&(r=t,t=""),this._calendar.formatDate(t||"",this,r)}}),t(r.baseCalendar.prototype,{UNIX_EPOCH:r.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:r.instance().jdEpoch,TICKS_PER_DAY:86400*1e7,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,i,n){if("string"!=typeof t&&(n=i,i=t,t=""),!i)return"";if(i.calendar()!==this)throw r.local.invalidFormat||r.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat,n=n||{};for(var a,o,s,l=n.dayNamesShort||this.local.dayNamesShort,u=n.dayNames||this.local.dayNames,c=n.monthNumbers||this.local.monthNumbers,h=n.monthNamesShort||this.local.monthNamesShort,d=n.monthNames||this.local.monthNames,f=(n.calculateWeek||this.local.calculateWeek,function(r,i){for(var n=1;x+n1}),p=function(t,r,i,n){var a=""+r;if(f(t,n))for(;a.length1},b=function(t,n){var a=x(t,n),o=RegExp("^-?\\d{1,"+[2,3,a?4:2,a?4:2,10,11,20]["oyYJ@!".indexOf(t)+1]+"}"),s=i.substring(A).match(o);if(!s)throw(r.local.missingNumberAt||r.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=s[0].length,parseInt(s[0],10)},_=this,w=function(t,n,a,o){for(var s=x(t,o)?a:n,l=0;l-1){p=1,m=g;for(var S=this.daysInMonth(f,p);m>S;S=this.daysInMonth(f,p))p++,m-=S}return d>-1?this.fromJD(d):this.newDate(f,p,m)},determineDate:function(t,r,i,n,a){i&&"object"!=typeof i&&(a=n,n=i,i=null),"string"!=typeof n&&(a=n,n="");var o=this;return r=r?r.newDate():null,t=null==t?r:"string"==typeof t?function(t){try{return o.parseDate(n,t,a)}catch{}t=t.toLowerCase();for(var r=(t.match(/^c/)&&i?i.newDate():null)||o.today(),s=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,l=s.exec(t);l;)r.add(parseInt(l[1],10),l[2]||"d"),l=s.exec(t);return r}(t):"number"==typeof t?isNaN(t)||t===1/0||t===-1/0?r:o.today().add(t,"d"):o.newDate(t)}})}}),UJ=g({"node_modules/world-calendars/dist/calendars/chinese.js"(){var t=UX(),r=mB(),i=t.instance();function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}n.prototype=new t.baseCalendar,r(n.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,r){if("string"==typeof t){var i=t.match(o);return i?i[0]:""}var n=this._validateYear(t),a=t.month(),s=""+this.toChineseMonth(n,a);return r&&s.length<2&&(s="0"+s),this.isIntercalaryMonth(n,a)&&(s+="i"),s},monthNames:function(t){if("string"==typeof t){var r=t.match(s);return r?r[0]:""}var i=this._validateYear(t),n=t.month(),a=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"][this.toChineseMonth(i,n)-1];return this.isIntercalaryMonth(i,n)&&(a="闰"+a),a},monthNamesShort:function(t){if("string"==typeof t){var r=t.match(l);return r?r[0]:""}var i=this._validateYear(t),n=t.month(),a=["一","二","三","四","五","六","七","八","九","十","十一","十二"][this.toChineseMonth(i,n)-1];return this.isIntercalaryMonth(i,n)&&(a="闰"+a),a},parseMonth:function(t,r){t=this._validateYear(t);var i,n=parseInt(r);if(isNaN(n))"闰"===r[0]&&(i=!0,r=r.substring(1)),"月"===r[r.length-1]&&(r=r.substring(0,r.length-1)),n=1+["一","二","三","四","五","六","七","八","九","十","十一","十二"].indexOf(r);else{var a=r[r.length-1];i="i"===a||"I"===a}return this.toMonthIndex(t,n,i)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,r){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw r.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(r,i,n){var a=this.intercalaryMonth(r);if(n&&i!==a||i<1||i>12)throw t.local.invalidMonth.replace(/\{0\}/,this.local.name);return a?!n&&i<=a?i-1:i:i-1},toChineseMonth:function(r,i){r.year&&(i=(r=r.year()).month());var n=this.intercalaryMonth(r);if(i<0||i>(n?12:11))throw t.local.invalidMonth.replace(/\{0\}/,this.local.name);return n?i>13},isIntercalaryMonth:function(t,r){t.year&&(r=(t=t.year()).month());var i=this.intercalaryMonth(t);return!!i&&i===r},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(r,n,a){var o,s=c[this._validateYear(r,t.local.invalidyear)-c[0]];return(o=i.newDate(s>>9&4095,s>>5&15,31&s)).add(4-(o.dayOfWeek()||7),"d"),1+Math.floor((this.toJD(r,n,a)-o.toJD())/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(r,i){r.year&&(i=r.month(),r=r.year());var n=u[(r=this._validateYear(r))-u[0]];if(i>(n>>13?12:11))throw t.local.invalidMonth.replace(/\{0\}/,this.local.name);return n&1<<12-i?30:29},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,n,a){var o=this._validate(r,l,a,t.local.invalidDate);r=this._validateYear(o.year()),n=o.month(),a=o.day();var s=this.isIntercalaryMonth(r,n),l=this.toChineseMonth(r,n),h=function(t,r,i,n){if("object"==typeof t)o=t,a=r||{};else{if(!("number"==typeof t&&t>=1888&&t<=2111))throw Error("Lunar year outside range 1888-2111");if(!("number"==typeof r&&r>=1&&r<=12))throw Error("Lunar month outside range 1 - 12");if(!("number"==typeof i&&i>=1&&i<=30))throw Error("Lunar day outside range 1 - 30");"object"==typeof n?(s=!1,a=n):(s=!!n,a={}),o={year:t,month:r,day:i,isIntercalary:s}}var a,o,s,l,h=o.day-1,d=u[o.year-u[0]],f=d>>13;l=f&&(o.month>f||o.isIntercalary)?o.month:o.month-1;for(var p=0;p>9&4095,(m>>5&15)-1,(31&m)+h);return a.year=g.getFullYear(),a.month=1+g.getMonth(),a.day=g.getDate(),a}(r,l,a,s);return i.toJD(h.year,h.month,h.day)},fromJD:function(t){var r=i.fromJD(t),n=function(t,r,i){if("object"==typeof t)o=t,s=r||{};else{if(!("number"==typeof t&&t>=1888&&t<=2111))throw Error("Solar year outside range 1888-2111");if(!("number"==typeof r&&r>=1&&r<=12))throw Error("Solar month outside range 1 - 12");if(!("number"==typeof i&&i>=1&&i<=31))throw Error("Solar day outside range 1 - 31");o={year:t,month:r,day:i},s={}}var n=c[o.year-c[0]],a=o.year<<9|o.month<<5|o.day;s.year=a>=n?o.year:o.year-1;var o,s,l,h=new Date((n=c[s.year-c[0]])>>9&4095,(n>>5&15)-1,31&n);l=Math.round((new Date(o.year,o.month-1,o.day)-h)/864e5);var d,f=u[s.year-u[0]];for(d=0;d<13;d++){var p=f&1<<12-d?30:29;if(l>13;return!m||di.year());return r%4==3||r%4==-1},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear||t.regionalOptions[""].invalidYear),13},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(13===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return(r=a.year())<0&&r++,a.day()+(a.month()-1)*30+(r-1)*365+Math.floor(r/4)+this.jdEpoch-1},fromJD:function(t){var r=Math.floor(t)+.5-this.jdEpoch,i=Math.floor((r-Math.floor((r+366)/1461))/365)+1;i<=0&&i--;var n=Math.floor((r=Math.floor(t)+.5-this.newDate(i,1,1).toJD())/30)+1,a=r-(n-1)*30+1;return this.newDate(i,n,a)}}),t.calendars.coptic=i}}),U0=g({"node_modules/world-calendars/dist/calendars/discworld.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Discworld",jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),!1},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),13},daysInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),400},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/8)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(r,i,n){return(this._validate(r,i,n,t.local.invalidDate).day()+1)%8},weekDay:function(t,r,i){var n=this.dayOfWeek(t,r,i);return n>=2&&n<=6},extraInfo:function(r,i,a){return{century:n[Math.floor((this._validate(r,i,a,t.local.invalidDate).year()-1)/100)+1]||""}},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return r=a.year()+ +(0>a.year()),i=a.month(),(n=a.day())+16*(i>1)+(i>2?(i-2)*32:0)+(r-1)*400+this.jdEpoch-1},fromJD:function(t){var r=Math.floor((t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1)/400)+1;t-=(r-1)*400;var i=Math.floor((t+=16*(t>15))/32)+1,n=t-(i-1)*32+1;return this.newDate(r<=0?r-1:r,i,n)}});var n={20:"Fruitbat",21:"Anchovy"};t.calendars.discworld=i}}),U1=g({"node_modules/world-calendars/dist/calendars/ethiopian.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=i.year()+ +(0>i.year());return r%4==3||r%4==-1},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear||t.regionalOptions[""].invalidYear),13},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(13===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return(r=a.year())<0&&r++,a.day()+(a.month()-1)*30+(r-1)*365+Math.floor(r/4)+this.jdEpoch-1},fromJD:function(t){var r=Math.floor(t)+.5-this.jdEpoch,i=Math.floor((r-Math.floor((r+366)/1461))/365)+1;i<=0&&i--;var n=Math.floor((r=Math.floor(t)+.5-this.newDate(i,1,1).toJD())/30)+1,a=r-(n-1)*30+1;return this.newDate(i,n,a)}}),t.calendars.ethiopian=i}}),U2=g({"node_modules/world-calendars/dist/calendars/hebrew.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function n(t,r){return t-r*Math.floor(t/r)}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear);return this._leapYear(i.year())},_leapYear:function(t){return 7>n(7*(t=t<0?t+1:t)+1,19)},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),this._leapYear(r.year?r.year():r)?13:12},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(r){return r=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year(),this.toJD(-1===r?1:r+1,7,1)-this.toJD(r,7,1)},daysInMonth:function(r,i){return r.year&&(i=r.month(),r=r.year()),this._validate(r,i,this.minDay,t.local.invalidMonth),12===i&&this.leapYear(r)||8===i&&5===n(this.daysInYear(r),10)?30:9===i&&3===n(this.daysInYear(r),10)?29:this.daysPerMonth[i-1]},weekDay:function(t,r,i){return 6!==this.dayOfWeek(t,r,i)},extraInfo:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return{yearType:(this.leapYear(a)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(a)%10-3]}},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);r=a.year(),i=a.month(),n=a.day();var o=r<=0?r+1:r,s=this.jdEpoch+this._delay1(o)+this._delay2(o)+n+1;if(i<7){for(var l=7;l<=this.monthsInYear(r);l++)s+=this.daysInMonth(r,l);for(var l=1;ln(3*(i+1),7)&&i++,i},_delay2:function(t){var r=this._delay1(t-1),i=this._delay1(t);return this._delay1(t+1)-i==356?2:+(i-r==382)},fromJD:function(t){t=Math.floor(t)+.5;for(var r=Math.floor((t-this.jdEpoch)*98496/0x224f0b7)-1;t>=this.toJD(-1===r?1:r+1,7,1);)r++;for(var i=tthis.toJD(r,i,this.daysInMonth(r,i));)i++;var n=t-this.toJD(r,i,1)+1;return this.newDate(r,i,n)}}),t.calendars.hebrew=i}}),U3=g({"node_modules/world-calendars/dist/calendars/islamic.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-khamīs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(r){return(11*this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(12===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 5!==this.dayOfWeek(t,r,i)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return r=a.year(),i=a.month(),(n=a.day())+Math.ceil(29.5*(i-1))+((r=r<=0?r+1:r)-1)*354+Math.floor((3+11*r)/30)+this.jdEpoch-1},fromJD:function(t){var r=Math.floor((30*((t=Math.floor(t)+.5)-this.jdEpoch)+10646)/10631);r=r<=0?r-1:r;var i=Math.min(12,Math.ceil((t-29-this.toJD(r,1,1))/29.5)+1),n=t-this.toJD(r,i,1)+1;return this.newDate(r,i,n)}}),t.calendars.islamic=i}}),U5=g({"node_modules/world-calendars/dist/calendars/julian.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=0>i.year()?i.year()+1:i.year();return r%4==0},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(2===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return r=a.year(),i=a.month(),n=a.day(),r<0&&r++,i<=2&&(r--,i+=12),Math.floor(365.25*(r+4716))+Math.floor(30.6001*(i+1))+n-1524.5},fromJD:function(t){var r=Math.floor(t+.5)+1524,i=Math.floor((r-122.1)/365.25),n=Math.floor(365.25*i),a=Math.floor((r-n)/30.6001),o=a-Math.floor(a<14?1:13),s=i-Math.floor(o>2?4716:4715),l=r-n-Math.floor(30.6001*a);return s<=0&&s--,this.newDate(s,o,l)}}),t.calendars.julian=i}}),U4=g({"node_modules/world-calendars/dist/calendars/mayan.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function n(t,r){return t-r*Math.floor(t/r)}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),!1},formatYear:function(r){var i=Math.floor((r=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year())/400);return r%=400,i+"."+Math.floor((r+=400*(r<0))/20)+"."+r%20},forYear:function(t){if((t=t.split(".")).length<3)throw"Invalid Mayan year";for(var r=0,i=0;i19||i>0&&n<0)throw"Invalid Mayan year";r=20*r+n}return r},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),18},weekOfYear:function(r,i,n){return this._validate(r,i,n,t.local.invalidDate),0},daysInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),360},daysInMonth:function(r,i){return this._validate(r,i,this.minDay,t.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(r,i,n){return this._validate(r,i,n,t.local.invalidDate).day()},weekDay:function(r,i,n){return this._validate(r,i,n,t.local.invalidDate),!0},extraInfo:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate).toJD(),o=this._toHaab(a),s=this._toTzolkin(a);return{haabMonthName:this.local.haabMonths[o[0]-1],haabMonth:o[0],haabDay:o[1],tzolkinDayName:this.local.tzolkinMonths[s[0]-1],tzolkinDay:s[0],tzolkinTrecena:s[1]}},_toHaab:function(t){var r=n((t-=this.jdEpoch)+8+340,365);return[Math.floor(r/20)+1,n(r,20)]},_toTzolkin:function(t){return[n((t-=this.jdEpoch)+20-1,20)+1,n(t+4-1,13)+1]},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return a.day()+20*a.month()+360*a.year()+this.jdEpoch},fromJD:function(t){var r=Math.floor((t=Math.floor(t)+.5-this.jdEpoch)/360);t%=360;var i=Math.floor((t+=360*(t<0))/20),n=t%20;return this.newDate(r,i,n)}}),t.calendars.mayan=i}}),U6=g({"node_modules/world-calendars/dist/calendars/nanakshahi.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar;var n=t.instance("gregorian");r(i.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear||t.regionalOptions[""].invalidYear);return n.leapYear(i.year()+ +(1>i.year())+1469)},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(12===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,a){var o=this._validate(r,i,a,t.local.invalidMonth),r=o.year();r<0&&r++;for(var s=o.day(),l=1;l=this.toJD(r+1,1,1);)r++;for(var i=t-Math.floor(this.toJD(r,1,1)+.5)+1,n=1;i>this.daysInMonth(r,n);)i-=this.daysInMonth(r,n),n++;return this.newDate(r,n,i)}}),t.calendars.nanakshahi=i}}),U8=g({"node_modules/world-calendars/dist/calendars/nepali.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(r){if(r=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year(),typeof this.NEPALI_CALENDAR_DATA[r]>"u")return this.daysPerYear;for(var i=0,n=this.minMonth;n<=12;n++)i+=this.NEPALI_CALENDAR_DATA[r][n];return i},daysInMonth:function(r,i){return r.year&&(i=r.month(),r=r.year()),this._validate(r,i,this.minDay,t.local.invalidMonth),typeof this.NEPALI_CALENDAR_DATA[r]>"u"?this.daysPerMonth[i-1]:this.NEPALI_CALENDAR_DATA[r][i]},weekDay:function(t,r,i){return 6!==this.dayOfWeek(t,r,i)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);r=a.year(),i=a.month(),n=a.day();var o=t.instance(),s=0,l=i,u=r;this._createMissingCalendarData(r);var c=r-(l>9||9===l&&n>=this.NEPALI_CALENDAR_DATA[u][0]?56:57);for(9!==i&&(s=n,l--);9!==l;)l<=0&&(l=12,u--),s+=this.NEPALI_CALENDAR_DATA[u][l],l--;return 9===i?(s+=n-this.NEPALI_CALENDAR_DATA[u][0])<0&&(s+=o.daysInYear(c)):s+=this.NEPALI_CALENDAR_DATA[u][9]-this.NEPALI_CALENDAR_DATA[u][0],o.newDate(c,1,1).add(s,"d").toJD()},fromJD:function(r){var i=t.instance().fromJD(r),n=i.year(),a=i.dayOfYear(),o=n+56;this._createMissingCalendarData(o);for(var s=9,l=this.NEPALI_CALENDAR_DATA[o][0],u=this.NEPALI_CALENDAR_DATA[o][s]-l+1;a>u;)++s>12&&(s=1,o++),u+=this.NEPALI_CALENDAR_DATA[o][s];var c=this.NEPALI_CALENDAR_DATA[o][s]-(u-a);return this.newDate(o,s,c)},_createMissingCalendarData:function(t){var r=this.daysPerMonth.slice(0);r.unshift(17);for(var i=t-1;i"u"&&(this.NEPALI_CALENDAR_DATA[i]=r)},NEPALI_CALENDAR_DATA:{1970:[18,31,31,32,31,31,31,30,29,30,29,30,30],1971:[18,31,31,32,31,32,30,30,29,30,29,30,30],1972:[17,31,32,31,32,31,30,30,30,29,29,30,30],1973:[19,30,32,31,32,31,30,30,30,29,30,29,31],1974:[19,31,31,32,30,31,31,30,29,30,29,30,30],1975:[18,31,31,32,32,30,31,30,29,30,29,30,30],1976:[17,31,32,31,32,31,30,30,30,29,29,30,31],1977:[18,31,32,31,32,31,31,29,30,29,30,29,31],1978:[18,31,31,32,31,31,31,30,29,30,29,30,30],1979:[18,31,31,32,32,31,30,30,29,30,29,30,30],1980:[17,31,32,31,32,31,30,30,30,29,29,30,31],1981:[18,31,31,31,32,31,31,29,30,30,29,30,30],1982:[18,31,31,32,31,31,31,30,29,30,29,30,30],1983:[18,31,31,32,32,31,30,30,29,30,29,30,30],1984:[17,31,32,31,32,31,30,30,30,29,29,30,31],1985:[18,31,31,31,32,31,31,29,30,30,29,30,30],1986:[18,31,31,32,31,31,31,30,29,30,29,30,30],1987:[18,31,32,31,32,31,30,30,29,30,29,30,30],1988:[17,31,32,31,32,31,30,30,30,29,29,30,31],1989:[18,31,31,31,32,31,31,30,29,30,29,30,30],1990:[18,31,31,32,31,31,31,30,29,30,29,30,30],1991:[18,31,32,31,32,31,30,30,29,30,29,30,30],1992:[17,31,32,31,32,31,30,30,30,29,30,29,31],1993:[18,31,31,31,32,31,31,30,29,30,29,30,30],1994:[18,31,31,32,31,31,31,30,29,30,29,30,30],1995:[17,31,32,31,32,31,30,30,30,29,29,30,30],1996:[17,31,32,31,32,31,30,30,30,29,30,29,31],1997:[18,31,31,32,31,31,31,30,29,30,29,30,30],1998:[18,31,31,32,31,31,31,30,29,30,29,30,30],1999:[17,31,32,31,32,31,30,30,30,29,29,30,31],2e3:[17,30,32,31,32,31,30,30,30,29,30,29,31],2001:[18,31,31,32,31,31,31,30,29,30,29,30,30],2002:[18,31,31,32,32,31,30,30,29,30,29,30,30],2003:[17,31,32,31,32,31,30,30,30,29,29,30,31],2004:[17,30,32,31,32,31,30,30,30,29,30,29,31],2005:[18,31,31,32,31,31,31,30,29,30,29,30,30],2006:[18,31,31,32,32,31,30,30,29,30,29,30,30],2007:[17,31,32,31,32,31,30,30,30,29,29,30,31],2008:[17,31,31,31,32,31,31,29,30,30,29,29,31],2009:[18,31,31,32,31,31,31,30,29,30,29,30,30],2010:[18,31,31,32,32,31,30,30,29,30,29,30,30],2011:[17,31,32,31,32,31,30,30,30,29,29,30,31],2012:[17,31,31,31,32,31,31,29,30,30,29,30,30],2013:[18,31,31,32,31,31,31,30,29,30,29,30,30],2014:[18,31,31,32,32,31,30,30,29,30,29,30,30],2015:[17,31,32,31,32,31,30,30,30,29,29,30,31],2016:[17,31,31,31,32,31,31,29,30,30,29,30,30],2017:[18,31,31,32,31,31,31,30,29,30,29,30,30],2018:[18,31,32,31,32,31,30,30,29,30,29,30,30],2019:[17,31,32,31,32,31,30,30,30,29,30,29,31],2020:[17,31,31,31,32,31,31,30,29,30,29,30,30],2021:[18,31,31,32,31,31,31,30,29,30,29,30,30],2022:[17,31,32,31,32,31,30,30,30,29,29,30,30],2023:[17,31,32,31,32,31,30,30,30,29,30,29,31],2024:[17,31,31,31,32,31,31,30,29,30,29,30,30],2025:[18,31,31,32,31,31,31,30,29,30,29,30,30],2026:[17,31,32,31,32,31,30,30,30,29,29,30,31],2027:[17,30,32,31,32,31,30,30,30,29,30,29,31],2028:[17,31,31,32,31,31,31,30,29,30,29,30,30],2029:[18,31,31,32,31,32,30,30,29,30,29,30,30],2030:[17,31,32,31,32,31,30,30,30,30,30,30,31],2031:[17,31,32,31,32,31,31,31,31,31,31,31,31],2032:[17,32,32,32,32,32,32,32,32,32,32,32,32],2033:[18,31,31,32,32,31,30,30,29,30,29,30,30],2034:[17,31,32,31,32,31,30,30,30,29,29,30,31],2035:[17,30,32,31,32,31,31,29,30,30,29,29,31],2036:[17,31,31,32,31,31,31,30,29,30,29,30,30],2037:[18,31,31,32,32,31,30,30,29,30,29,30,30],2038:[17,31,32,31,32,31,30,30,30,29,29,30,31],2039:[17,31,31,31,32,31,31,29,30,30,29,30,30],2040:[17,31,31,32,31,31,31,30,29,30,29,30,30],2041:[18,31,31,32,32,31,30,30,29,30,29,30,30],2042:[17,31,32,31,32,31,30,30,30,29,29,30,31],2043:[17,31,31,31,32,31,31,29,30,30,29,30,30],2044:[17,31,31,32,31,31,31,30,29,30,29,30,30],2045:[18,31,32,31,32,31,30,30,29,30,29,30,30],2046:[17,31,32,31,32,31,30,30,30,29,29,30,31],2047:[17,31,31,31,32,31,31,30,29,30,29,30,30],2048:[17,31,31,32,31,31,31,30,29,30,29,30,30],2049:[17,31,32,31,32,31,30,30,30,29,29,30,30],2050:[17,31,32,31,32,31,30,30,30,29,30,29,31],2051:[17,31,31,31,32,31,31,30,29,30,29,30,30],2052:[17,31,31,32,31,31,31,30,29,30,29,30,30],2053:[17,31,32,31,32,31,30,30,30,29,29,30,30],2054:[17,31,32,31,32,31,30,30,30,29,30,29,31],2055:[17,31,31,32,31,31,31,30,29,30,30,29,30],2056:[17,31,31,32,31,32,30,30,29,30,29,30,30],2057:[17,31,32,31,32,31,30,30,30,29,29,30,31],2058:[17,30,32,31,32,31,30,30,30,29,30,29,31],2059:[17,31,31,32,31,31,31,30,29,30,29,30,30],2060:[17,31,31,32,32,31,30,30,29,30,29,30,30],2061:[17,31,32,31,32,31,30,30,30,29,29,30,31],2062:[17,30,32,31,32,31,31,29,30,29,30,29,31],2063:[17,31,31,32,31,31,31,30,29,30,29,30,30],2064:[17,31,31,32,32,31,30,30,29,30,29,30,30],2065:[17,31,32,31,32,31,30,30,30,29,29,30,31],2066:[17,31,31,31,32,31,31,29,30,30,29,29,31],2067:[17,31,31,32,31,31,31,30,29,30,29,30,30],2068:[17,31,31,32,32,31,30,30,29,30,29,30,30],2069:[17,31,32,31,32,31,30,30,30,29,29,30,31],2070:[17,31,31,31,32,31,31,29,30,30,29,30,30],2071:[17,31,31,32,31,31,31,30,29,30,29,30,30],2072:[17,31,32,31,32,31,30,30,29,30,29,30,30],2073:[17,31,32,31,32,31,30,30,30,29,29,30,31],2074:[17,31,31,31,32,31,31,30,29,30,29,30,30],2075:[17,31,31,32,31,31,31,30,29,30,29,30,30],2076:[16,31,32,31,32,31,30,30,30,29,29,30,30],2077:[17,31,32,31,32,31,30,30,30,29,30,29,31],2078:[17,31,31,31,32,31,31,30,29,30,29,30,30],2079:[17,31,31,32,31,31,31,30,29,30,29,30,30],2080:[16,31,32,31,32,31,30,30,30,29,29,30,30],2081:[17,31,31,32,32,31,30,30,30,29,30,30,30],2082:[17,31,32,31,32,31,30,30,30,29,30,30,30],2083:[17,31,31,32,31,31,30,30,30,29,30,30,30],2084:[17,31,31,32,31,31,30,30,30,29,30,30,30],2085:[17,31,32,31,32,31,31,30,30,29,30,30,30],2086:[17,31,32,31,32,31,30,30,30,29,30,30,30],2087:[16,31,31,32,31,31,31,30,30,29,30,30,30],2088:[16,30,31,32,32,30,31,30,30,29,30,30,30],2089:[17,31,32,31,32,31,30,30,30,29,30,30,30],2090:[17,31,32,31,32,31,30,30,30,29,30,30,30],2091:[16,31,31,32,31,31,31,30,30,29,30,30,30],2092:[16,31,31,32,32,31,30,30,30,29,30,30,30],2093:[17,31,32,31,32,31,30,30,30,29,30,30,30],2094:[17,31,31,32,31,31,30,30,30,29,30,30,30],2095:[17,31,31,32,31,31,31,30,29,30,30,30,30],2096:[17,30,31,32,32,31,30,30,29,30,29,30,30],2097:[17,31,32,31,32,31,30,30,30,29,30,30,30],2098:[17,31,31,32,31,31,31,29,30,29,30,30,31],2099:[17,31,31,32,31,31,31,30,29,29,30,30,30],2100:[17,31,32,31,32,30,31,30,29,30,29,30,30]}}),t.calendars.nepali=i}}),U7=g({"node_modules/world-calendars/dist/calendars/persian.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function n(t){var r=t-475;t<0&&r++;var i=.242197*r,n=.242197*(r+1);return i-Math.floor(i)>n-Math.floor(n)}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Persian",jdEpoch:1948320.5,daysPerMonth:[31,31,31,31,31,31,30,30,30,30,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Persian",epochs:["BP","AP"],monthNames:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"],monthNamesShort:["Far","Ord","Kho","Tir","Mor","Sha","Meh","Aba","Aza","Dey","Bah","Esf"],dayNames:["Yekshanbeh","Doshanbeh","Seshanbeh","Chahārshanbeh","Panjshanbeh","Jom'eh","Shanbeh"],dayNamesShort:["Yek","Do","Se","Cha","Panj","Jom","Sha"],dayNamesMin:["Ye","Do","Se","Ch","Pa","Jo","Sh"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(r){return n(this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year())},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-((n.dayOfWeek()+1)%7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(12===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 5!==this.dayOfWeek(t,r,i)},toJD:function(r,i,a){var o=this._validate(r,i,a,t.local.invalidDate);r=o.year(),i=o.month(),a=o.day();var s=0;if(r>0)for(var l=1;l0?r-1:r)*365+s+this.jdEpoch-1},fromJD:function(t){var r=Math.floor(475+((t=Math.floor(t)+.5)-this.toJD(475,1,1))/365.242197);r<=0&&r--,t>this.toJD(r,12,n(r)?30:29)&&0==++r&&r++;var i=t-this.toJD(r,1,1)+1,a=i<=186?Math.ceil(i/31):Math.ceil((i-6)/30),o=t-this.toJD(r,a,1)+1;return this.newDate(r,a,o)}}),t.calendars.persian=i,t.calendars.jalali=i}}),U9=g({"node_modules/world-calendars/dist/calendars/taiwan.js"(){var t=UX(),r=mB(),i=t.instance();function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}n.prototype=new t.baseCalendar,r(n.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(r){var n=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(n.year());return i.leapYear(r)},weekOfYear:function(r,n,a){var o=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(o.year());return i.weekOfYear(r,o.month(),o.day())},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(2===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,n,a){var o=this._validate(r,n,a,t.local.invalidDate),r=this._t2gYear(o.year());return i.toJD(r,o.month(),o.day())},fromJD:function(t){var r=i.fromJD(t),n=this._g2tYear(r.year());return this.newDate(n,r.month(),r.day())},_t2gYear:function(t){return t+this.yearsOffset+ +(t>=-this.yearsOffset&&t<=-1)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset)}}),t.calendars.taiwan=n}}),qe=g({"node_modules/world-calendars/dist/calendars/thai.js"(){var t=UX(),r=mB(),i=t.instance();function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}n.prototype=new t.baseCalendar,r(n.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var n=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(n.year());return i.leapYear(r)},weekOfYear:function(r,n,a){var o=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(o.year());return i.weekOfYear(r,o.month(),o.day())},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(2===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,n,a){var o=this._validate(r,n,a,t.local.invalidDate),r=this._t2gYear(o.year());return i.toJD(r,o.month(),o.day())},fromJD:function(t){var r=i.fromJD(t),n=this._g2tYear(r.year());return this.newDate(n,r.month(),r.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset)},_g2tYear:function(t){return t+this.yearsOffset+ +(t>=-this.yearsOffset&&t<=-1)}}),t.calendars.thai=n}}),qt=g({"node_modules/world-calendars/dist/calendars/ummalqura.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thalāthā’","Yawm al-Arba‘ā’","Yawm al-Khamīs","Yawm al-Jum‘a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear);return 355===this.daysInYear(i.year())},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var r=0,i=1;i<=12;i++)r+=this.daysInMonth(t,i);return r},daysInMonth:function(r,i){for(var a=this._validate(r,i,this.minDay,t.local.invalidMonth),o=a.toJD()-24e5+.5,s=0,l=0;lo)return n[s]-n[s-1];s++}return 30},weekDay:function(t,r,i){return 5!==this.dayOfWeek(t,r,i)},toJD:function(r,i,a){var o=this._validate(r,i,a,t.local.invalidDate),s=12*(o.year()-1)+o.month()-15292;return o.day()+n[s-1]-1+24e5-.5},fromJD:function(t){for(var r=t-24e5+.5,i=0,a=0;ar);a++)i++;var o=i+15292,s=Math.floor((o-1)/12),l=r-n[i-1]+1;return this.newDate(s+1,o-12*s,l)},isValid:function(r,i,n){var a=t.baseCalendar.prototype.isValid.apply(this,arguments);return a&&(a=(r=null!=r.year?r.year:r)>=1276&&r<=1500),a},_validate:function(r,i,n,a){var o=t.baseCalendar.prototype._validate.apply(this,arguments);if(o.year<1276||o.year>1500)throw a.replace(/\{0\}/,this.local.name);return o}}),t.calendars.ummalqura=i;var n=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]}}),qr=g({"src/components/calendars/calendars.js"(t,r){r.exports=UX(),UK(),UJ(),UQ(),U0(),U1(),U2(),U3(),U5(),U4(),U6(),U8(),U7(),U9(),qe(),qt()}}),qi=g({"src/components/calendars/index.js"(t,r){var i=qr(),n=t_(),a=P(),o=a.EPOCHJD,s=a.ONEDAY,l={valType:"enumerated",values:n.sortObjectKeys(i.calendars),editType:"calc",dflt:"gregorian"},u=function(t,r,i,a){var o={};return o[i]=l,n.coerce(t,r,o,i,a)},c={d:{0:"dd","-":"d"},e:{0:"d","-":"d"},a:{0:"D","-":"D"},A:{0:"DD","-":"DD"},j:{0:"oo","-":"o"},W:{0:"ww","-":"w"},m:{0:"mm","-":"m"},b:{0:"M","-":"M"},B:{0:"MM","-":"MM"},y:{0:"yy","-":"yy"},Y:{0:"yyyy","-":"yyyy"},U:"##",w:"##",c:{0:"D M d %X yyyy","-":"D M d %X yyyy"},x:{0:"mm/dd/yyyy","-":"mm/dd/yyyy"}},h={};function d(t){var r=h[t];return r||(r=h[t]=i.instance(t))}function f(t){return n.extendFlat({},l,{description:t})}function p(t){return"Sets the calendar system to use with `"+t+"` date data."}var m={xcalendar:f(p("x"))},g=n.extendFlat({},m,{ycalendar:f(p("y"))}),y=n.extendFlat({},g,{zcalendar:f(p("z"))}),v=f("Sets the calendar system to use for `range` and `tick0` if this is a date axis. This does not set the calendar for interpreting data on this axis, that's specified in the trace or via the global `layout.calendar`");r.exports={moduleType:"component",name:"calendars",schema:{traces:{scatter:g,bar:g,box:g,heatmap:g,contour:g,histogram:g,histogram2d:g,histogram2dcontour:g,scatter3d:y,surface:y,mesh3d:y,scattergl:g,ohlc:m,candlestick:m},layout:{calendar:f("Sets the default calendar system to use for interpreting and displaying dates throughout the plot.")},subplots:{xaxis:{calendar:v},yaxis:{calendar:v},scene:{xaxis:{calendar:v},yaxis:{calendar:v},zaxis:{calendar:v}},polar:{radialaxis:{calendar:v}}}},layoutAttributes:l,handleDefaults:u,handleTraceDefaults:function(t,r,i,n){for(var a=0;a{n.preventDefault(),n.stopPropagation(),n.clipboardData.setData("text",t),r.removeEventListener("copy",i,!0)};r.addEventListener("copy",i,!0),document.execCommand("copy")},(G=X||(X={})).boxSizing=function(t){let r=window.getComputedStyle(t),i=parseFloat(r.borderTopWidth)||0,n=parseFloat(r.borderLeftWidth)||0,a=parseFloat(r.borderRightWidth)||0,o=parseFloat(r.borderBottomWidth)||0,s=parseFloat(r.paddingTop)||0,l=parseFloat(r.paddingLeft)||0,u=parseFloat(r.paddingRight)||0,c=parseFloat(r.paddingBottom)||0;return{borderTop:i,borderLeft:n,borderRight:a,borderBottom:o,paddingTop:s,paddingLeft:l,paddingRight:u,paddingBottom:c,horizontalSum:n+l+u+a,verticalSum:i+s+c+o}},G.sizeLimits=function(t){let r=window.getComputedStyle(t),i=parseFloat(r.minWidth)||0,n=parseFloat(r.minHeight)||0,a=parseFloat(r.maxWidth)||1/0,o=parseFloat(r.maxHeight)||1/0;return a=Math.max(i,a),o=Math.max(n,o),{minWidth:i,minHeight:n,maxWidth:a,maxHeight:o}},G.hitTest=function(t,r,i){let n=t.getBoundingClientRect();return r>=n.left&&r=n.top&&i=i.bottom)){if(n.topi.bottom&&n.height>=i.height){t.scrollTop-=i.top-n.top;return}if(n.topi.height||n.bottom>i.bottom&&n.height0;){if(f(a)){r++;continue}if(f(o)||f(s)){i++;continue}if(f(u)){n++;continue}if(f(c)){i++;continue}if(f(l)){n++;continue}if(!f(h))return 0}return(r=Math.min(r,255))<<16|(i=Math.min(i,255))<<8|(n=Math.min(n,255))},a=/^#[^\s\+>~#\.\[:]+/,o=/^\.[^\s\+>~#\.\[:]+/,s=/^\[[^\]]+\]/,l=/^[^\s\+>~#\.\[:]+/,u=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,c=/^:[^\s\+>~#\.\[:]+/,h=/^[\s\+>~\*]+/,d=/:not\(([^\)]+)\)/g;var U=O(R()),q=class{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return 0===this._size}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let t=this._first;for(;t;)yield t.value,t=t.next}*retro(){let t=this._last;for(;t;)yield t.value,t=t.prev}*nodes(){let t=this._first;for(;t;)yield t,t=t.next}*retroNodes(){let t=this._last;for(;t;)yield t,t=t.prev}assign(t){for(let r of(this.clear(),t))this.addLast(r)}push(t){this.addLast(t)}pop(){return this.removeLast()}shift(t){this.addFirst(t)}unshift(){return this.removeFirst()}addFirst(t){let r=new ee.LinkedListNode(this,t);return this._first?(r.next=this._first,this._first.prev=r,this._first=r):(this._first=r,this._last=r),this._size++,r}addLast(t){let r=new ee.LinkedListNode(this,t);return this._last?(r.prev=this._last,this._last.next=r):this._first=r,this._last=r,this._size++,r}insertBefore(t,r){if(!r||r===this._first)return this.addFirst(t);if(!(r instanceof ee.LinkedListNode)||r.list!==this)throw Error("Reference node is not owned by the list.");let i=new ee.LinkedListNode(this,t),n=r.prev;return i.next=r,i.prev=n,r.prev=i,n.next=i,this._size++,i}insertAfter(t,r){if(!r||r===this._last)return this.addLast(t);if(!(r instanceof ee.LinkedListNode)||r.list!==this)throw Error("Reference node is not owned by the list.");let i=new ee.LinkedListNode(this,t),n=r.next;return i.next=n,i.prev=r,r.next=i,n.prev=i,this._size++,i}removeFirst(){let t=this._first;if(t)return t===this._last?(this._first=null,this._last=null):(this._first=t.next,this._first.prev=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value}removeLast(){let t=this._last;if(t)return t===this._first?(this._first=null,this._last=null):(this._last=t.prev,this._last.next=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value}removeNode(t){if(!(t instanceof ee.LinkedListNode)||t.list!==this)throw Error("Node is not owned by the list.");t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--}clear(){let t=this._first;for(;t;){let r=t.next;t.list=null,t.prev=null,t.next=null,t=r}this._first=null,this._last=null,this._size=0}};(Y=q||(q={})).from=function(t){let r=new Y;return r.assign(t),r},(ee||(ee={})).LinkedListNode=class{constructor(t,r){this.list=null,this.next=null,this.prev=null,this.list=t,this.value=r}};var G,H,$,W,Y,Z,X,K,J,Q,ee,et,er=class{constructor(t){this.type=t}get isConflatable(){return!1}conflate(t){return!1}},ei=class extends er{get isConflatable(){return!0}conflate(t){return!0}};!function(t){let r,i=null,n=(r=Promise.resolve(),t=>{let i=!1;return r.then(()=>!i&&t()),()=>{i=!0}});function a(t,r){let i=s.get(t);i&&0!==i.length?(0,U.every)((0,U.retro)(i),i=>!i||function(t,r,i){let n=!0;try{n="function"==typeof t?t(r,i):t.messageHook(r,i)}catch(t){u(t)}return n}(i,t,r))&&h(t,r):h(t,r)}t.sendMessage=a,t.postMessage=function(t,r){r.isConflatable&&(0,U.some)(o,i=>i.handler===t&&!!i.msg&&i.msg.type===r.type&&!!i.msg.isConflatable&&i.msg.conflate(r))||d(t,r)},t.installMessageHook=function(t,r){let i=s.get(t);i&&-1!==i.indexOf(r)||(i?i.push(r):s.set(t,[r]))},t.removeMessageHook=function(t,r){let i=s.get(t);if(!i)return;let n=i.indexOf(r);-1!==n&&(i[n]=null,p(i))},t.clearData=function(t){let r=s.get(t);for(let i of(r&&r.length>0&&(U.ArrayExt.fill(r,null),p(r)),o))i.handler===t&&(i.handler=null,i.msg=null)},t.flush=function(){c||null===i||(i(),i=null,c=!0,f(),c=!1)},t.getExceptionHandler=function(){return u},t.setExceptionHandler=function(t){let r=u;return u=t,r};let o=new q,s=new WeakMap,l=new Set,u=t=>{console.error(t)},c=!1;function h(t,r){try{t.processMessage(r)}catch(t){u(t)}}function d(t,r){o.addLast({handler:t,msg:r}),null===i&&(i=n(f))}function f(){if(i=null,o.isEmpty)return;let t={handler:null,msg:null};for(o.addLast(t);;){let r=o.removeFirst();if(r===t)return;r.handler&&r.msg&&a(r.handler,r.msg)}}function p(t){0===l.size&&n(m),l.add(t)}function m(){l.forEach(g),l.clear()}function g(t){U.ArrayExt.removeAllWhere(t,y)}function y(t){return null===t}}(et||(et={}));var en=class{constructor(t){this._pid=ew.nextPID(),this.name=t.name,this._create=t.create,this._coerce=t.coerce||null,this._compare=t.compare||null,this._changed=t.changed||null}get(t){let r=ew.ensureMap(t);return this._pid in r?r[this._pid]:r[this._pid]=this._createValue(t)}set(t,r){let i,n=ew.ensureMap(t);i=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(t);let a=this._coerceValue(t,r);this._maybeNotify(t,i,n[this._pid]=a)}coerce(t){let r,i=ew.ensureMap(t);r=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(t);let n=this._coerceValue(t,r);this._maybeNotify(t,r,i[this._pid]=n)}_createValue(t){return(0,this._create)(t)}_coerceValue(t,r){let i=this._coerce;return i?i(t,r):r}_compareValue(t,r){let i=this._compare;return i?i(t,r):t===r}_maybeNotify(t,r,i){let n=this._changed;n&&!this._compareValue(r,i)&&n(t,r,i)}};(en||(en={})).clearData=function(t){ew.ownerData.delete(t)},(ey=ew||(ew={})).ownerData=new WeakMap,f=0,ey.nextPID=()=>`pid-${`${Math.random()}`.slice(2)}-${f++}`,ey.ensureMap=function(t){let r=ey.ownerData.get(t);return r||(r=Object.create(null),ey.ownerData.set(t,r),r)};var ea=O(R()),eo=(O(B()),class{constructor(t){this.sender=t}connect(t,r){return eT.connect(this,t,r)}disconnect(t,r){return eT.disconnect(this,t,r)}emit(t){eT.emit(this,t)}});(ev=eo||(eo={})).disconnectBetween=function(t,r){eT.disconnectBetween(t,r)},ev.disconnectSender=function(t){eT.disconnectSender(t)},ev.disconnectReceiver=function(t){eT.disconnectReceiver(t)},ev.disconnectAll=function(t){eT.disconnectAll(t)},ev.clearData=function(t){eT.disconnectAll(t)},ev.getExceptionHandler=function(){return eT.exceptionHandler},ev.setExceptionHandler=function(t){let r=eT.exceptionHandler;return eT.exceptionHandler=t,r},function(t){function r(t){let r=n.get(t);if(!(!r||0===r.length)){for(let t of r){if(!t.signal)continue;let r=t.thisArg||t.slot;t.signal=null,u(a.get(r))}u(r)}}function i(t){let r=a.get(t);if(!(!r||0===r.length)){for(let t of r){if(!t.signal)continue;let r=t.signal.sender;t.signal=null,u(n.get(r))}u(r)}}t.exceptionHandler=t=>{console.error(t)},t.connect=function(t,r,i){i=i||void 0;let o=n.get(t.sender);if(o||(o=[],n.set(t.sender,o)),l(o,t,r,i))return!1;let s=i||r,u=a.get(s);u||(u=[],a.set(s,u));let c={signal:t,slot:r,thisArg:i};return o.push(c),u.push(c),!0},t.disconnect=function(t,r,i){i=i||void 0;let o=n.get(t.sender);if(!o||0===o.length)return!1;let s=l(o,t,r,i);if(!s)return!1;let c=i||r,h=a.get(c);return s.signal=null,u(o),u(h),!0},t.disconnectBetween=function(t,r){let i=n.get(t);if(!i||0===i.length)return;let o=a.get(r);if(!(!o||0===o.length)){for(let r of o)r.signal&&r.signal.sender===t&&(r.signal=null);u(i),u(o)}},t.disconnectSender=r,t.disconnectReceiver=i,t.disconnectAll=function(t){r(t),i(t)},t.emit=function(r,i){let a=n.get(r.sender);if(!(!a||0===a.length))for(let n=0,o=a.length;nt.signal===r&&t.slot===i&&t.thisArg===n)}function u(t){0===o.size&&s(c),o.add(t)}function c(){o.forEach(h),o.clear()}function h(t){ea.ArrayExt.removeAllWhere(t,d)}function d(t){return null===t.signal}}(eT||(eT={}));var es=class{constructor(t){this._fn=t}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let t=this._fn;this._fn=null,t()}},el=class{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(t=>{t.dispose()}),this._items.clear())}contains(t){return this._items.has(t)}add(t){this._items.add(t)}remove(t){this._items.delete(t)}clear(){this._items.clear()}};(ex=el||(el={})).from=function(t){let r=new ex;for(let i of t)r.add(i);return r};var eu=class extends el{constructor(){super(...arguments),this._disposed=new eo(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),eo.clearData(this))}};(eb=eu||(eu={})).from=function(t){let r=new eb;for(let i of t)r.add(i);return r};var ec=class t{constructor(t){this._onScrollFrame=()=>{if(!this._scrollTarget)return;let{element:t,edge:r,distance:i}=this._scrollTarget,n=Math.max(1,Math.round(Math.pow((eA.SCROLL_EDGE_SIZE-i)/eA.SCROLL_EDGE_SIZE,2)*eA.SCROLL_EDGE_SIZE));switch(r){case"top":t.scrollTop-=n;break;case"left":t.scrollLeft-=n;break;case"right":t.scrollLeft+=n;break;case"bottom":t.scrollTop+=n}requestAnimationFrame(this._onScrollFrame)},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.document=t.document||document,this.mimeData=t.mimeData,this.dragImage=t.dragImage||null,this.proposedAction=t.proposedAction||"copy",this.supportedActions=t.supportedActions||"all",this.source=t.source||null}dispose(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){let t=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,clientX:-1,clientY:-1});eA.dispatchDragLeave(this,this._currentTarget,null,t)}this._finalize("none")}}get isDisposed(){return this._disposed}start(t,r){if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(t,r),this._promise=new Promise(t=>{this._resolve=t});let i=new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,clientX:t,clientY:r});return document.dispatchEvent(i),this._promise}handleEvent(t){switch(t.type){case"pointermove":this._evtPointerMove(t);break;case"pointerup":this._evtPointerUp(t);break;case"keydown":this._evtKeyDown(t);break;default:t.preventDefault(),t.stopPropagation()}}moveDragImage(t,r){this.dragImage&&(this.dragImage.style.transform=`translate(${t}px, ${r}px)`)}_evtPointerMove(t){t.preventDefault(),t.stopPropagation(),this._updateCurrentTarget(t),this._updateDragScroll(t),this.moveDragImage(t.clientX,t.clientY)}_evtPointerUp(t){if(t.preventDefault(),t.stopPropagation(),0!==t.button)return;if(this._updateCurrentTarget(t),!this._currentTarget)return void this._finalize("none");if("none"===this._dropAction){eA.dispatchDragLeave(this,this._currentTarget,null,t),this._finalize("none");return}let r=eA.dispatchDrop(this,this._currentTarget,t);this._finalize(r)}_evtKeyDown(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&this.dispose()}_addListeners(){document.addEventListener("pointerdown",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("pointerup",this,!0),document.addEventListener("pointerenter",this,!0),document.addEventListener("pointerleave",this,!0),document.addEventListener("pointerover",this,!0),document.addEventListener("pointerout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)}_removeListeners(){document.removeEventListener("pointerdown",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointerenter",this,!0),document.removeEventListener("pointerleave",this,!0),document.removeEventListener("pointerover",this,!0),document.removeEventListener("pointerout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)}_updateDragScroll(t){let r=eA.findScrollTarget(t);(this._scrollTarget||r)&&(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=r)}_updateCurrentTarget(t){let r=this._currentTarget,i=this._currentTarget,n=this._currentElement,a=eA.findElementBehindBackdrop(t,this.document);this._currentElement=a,a!==n&&a!==i&&eA.dispatchDragExit(this,i,a,t),a!==n&&a!==i&&(i=eA.dispatchDragEnter(this,a,i,t)),i!==r&&(this._currentTarget=i,eA.dispatchDragLeave(this,r,i,t));let o=eA.dispatchDragOver(this,i,t);this._setDropAction(o)}_attachDragImage(t,r){if(!this.dragImage)return;this.dragImage.classList.add("lm-mod-drag-image");let i=this.dragImage.style;i.pointerEvents="none",i.position="fixed",i.transform=`translate(${t}px, ${r}px)`,(this.document instanceof Document?this.document.body:this.document.firstElementChild).appendChild(this.dragImage)}_detachDragImage(){if(!this.dragImage)return;let t=this.dragImage.parentNode;t&&t.removeChild(this.dragImage)}_setDropAction(r){if(r=eA.validateAction(r,this.supportedActions),!(this._override&&this._dropAction===r))switch(r){case"none":this._dropAction=r,this._override=t.overrideCursor("no-drop",this.document);break;case"copy":this._dropAction=r,this._override=t.overrideCursor("copy",this.document);break;case"link":this._dropAction=r,this._override=t.overrideCursor("alias",this.document);break;case"move":this._dropAction=r,this._override=t.overrideCursor("move",this.document)}}_finalize(t){let r=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,r&&r(t)}},eh=ec||(ec={});class ed extends DragEvent{constructor(t,r){super(r.type,{bubbles:!0,cancelable:!0,altKey:t.altKey,button:t.button,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,detail:0,metaKey:t.metaKey,relatedTarget:r.related,screenX:t.screenX,screenY:t.screenY,shiftKey:t.shiftKey,view:window});let{drag:i}=r;this.dropAction="none",this.mimeData=i.mimeData,this.proposedAction=i.proposedAction,this.supportedActions=i.supportedActions,this.source=i.source}}eh.Event=ed,eh.overrideCursor=function(t,r=document){return eA.overrideCursor(t,r)},function(t){let r;function i(r,o=document){if(r){if(n&&r==n.event)return n.element;t.cursorBackdrop.style.zIndex="-1000";let i=o.elementFromPoint(r.clientX,r.clientY);return t.cursorBackdrop.style.zIndex="",n={event:r,element:i},i}{let r=t.cursorBackdrop.style.transform;if(a&&r===a.transform)return a.element;let i=t.cursorBackdrop.getBoundingClientRect();t.cursorBackdrop.style.zIndex="-1000";let n=o.elementFromPoint(i.left+i.width/2,i.top+i.height/2);return t.cursorBackdrop.style.zIndex="",a={transform:r,element:n},n}}t.SCROLL_EDGE_SIZE=20,t.validateAction=function(t,r){return o[t]&s[r]?t:"none"},t.findElementBehindBackdrop=i;let n=null,a=null;t.findScrollTarget=function(r){let n=r.clientX,a=r.clientY,o=i(r);for(;o;o=o.parentElement){let r;if(!o.hasAttribute("data-lm-dragscroll"))continue;let i=0,s=0;o===document.body&&(i=window.pageXOffset,s=window.pageYOffset);let l=o.getBoundingClientRect(),u=l.top+s,c=l.left+i,h=c+l.width,d=u+l.height;if(n=h||a=d)continue;let f=n-c+1,p=a-u+1,m=h-n,g=d-a,y=Math.min(f,p,m,g);if(y>t.SCROLL_EDGE_SIZE)continue;switch(y){case g:r="bottom";break;case p:r="top";break;case m:r="right";break;case f:r="left";break;default:throw"unreachable"}let v=o.scrollWidth-o.clientWidth,x=o.scrollHeight-o.clientHeight,b;switch(r){case"top":b=x>0&&o.scrollTop>0;break;case"left":b=v>0&&o.scrollLeft>0;break;case"right":b=v>0&&o.scrollLeft0&&o.scrollTop{n===d&&t.cursorBackdrop.isConnected&&(document.removeEventListener("pointermove",l,!0),t.cursorBackdrop.removeEventListener("scroll",u,!0),a.removeChild(t.cursorBackdrop))})};let h=500,d=0;(r=document.createElement("div")).classList.add("lm-cursor-backdrop"),t.cursorBackdrop=r}(eA||(eA={}));var ef=O(R()),ep=O(B());function em(){return eM.keyboardLayout}var eg=class t{constructor(r,i,n=[]){this.name=r,this._codes=i,this._keys=t.extractKeys(i),this._modifierKeys=t.convertToKeySet(n)}keys(){return Object.keys(this._keys)}isValidKey(t){return t in this._keys}isModifierKey(t){return t in this._modifierKeys}keyForKeydownEvent(t){return this._codes[t.keyCode]||""}};(e_=eg||(eg={})).extractKeys=function(t){let r=Object.create(null);for(let i in t)r[t[i]]=!0;return r},e_.convertToKeySet=function(t){let r=Object(null);for(let i=0,n=t.length;i{this._commands.delete(t),this._commandChanged.emit({id:t,type:"removed"})})}notifyCommandChanged(t){if(void 0!==t&&!this._commands.has(t))throw Error(`Command '${t}' is not registered.`);this._commandChanged.emit({id:t,type:t?"changed":"many-changed"})}describedBy(t,r=ep.JSONExt.emptyObject){var i;let n=this._commands.get(t);return Promise.resolve(null!=(i=n?.describedBy.call(void 0,r))?i:{args:null})}label(t,r=ep.JSONExt.emptyObject){var i;let n=this._commands.get(t);return null!=(i=n?.label.call(void 0,r))?i:""}mnemonic(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.mnemonic.call(void 0,r):-1}icon(t,r=ep.JSONExt.emptyObject){var i;return null==(i=this._commands.get(t))?void 0:i.icon.call(void 0,r)}iconClass(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.iconClass.call(void 0,r):""}iconLabel(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.iconLabel.call(void 0,r):""}caption(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.caption.call(void 0,r):""}usage(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.usage.call(void 0,r):""}className(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.className.call(void 0,r):""}dataset(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.dataset.call(void 0,r):{}}isEnabled(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isEnabled.call(void 0,r)}isToggled(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isToggled.call(void 0,r)}isToggleable(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isToggleable}isVisible(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isVisible.call(void 0,r)}execute(t,r=ep.JSONExt.emptyObject){let i,n=this._commands.get(t);if(!n)return Promise.reject(Error(`Command '${t}' not registered.`));try{i=n.execute.call(void 0,r)}catch(t){i=Promise.reject(t)}let a=Promise.resolve(i);return this._commandExecuted.emit({id:t,args:r,result:a}),a}addKeyBinding(t){let r=eN.createKeyBinding(t);return this._keyBindings.push(r),this._keyBindingChanged.emit({binding:r,type:"added"}),new es(()=>{ef.ArrayExt.removeFirstOf(this._keyBindings,r),this._keyBindingChanged.emit({binding:r,type:"removed"})})}processKeydownEvent(r){if(r.defaultPrevented||this._replaying)return;let i=t.keystrokeForKeydownEvent(r);if(!i){this._replayKeydownEvents(),this._clearPendingState();return}if(t.isModifierKeyPressed(r)){let{exact:t}=eN.matchKeyBinding(this._keyBindings,[i],r);t?(r.preventDefault(),r.stopPropagation(),this._startModifierTimer(t)):this._clearModifierTimer();return}this._keystrokes.push(i);let{exact:n,partial:a}=eN.matchKeyBinding(this._keyBindings,this._keystrokes,r),o=0!==a.length;if(!n&&!o){this._replayKeydownEvents(),this._clearPendingState();return}if((n?.preventDefault||a.some(t=>t.preventDefault))&&(r.preventDefault(),r.stopPropagation()),this._keydownEvents.push(r),n&&!o){this._executeKeyBinding(n),this._clearPendingState();return}n&&(this._exactKeyMatch=n),this._startTimer()}holdKeyBindingExecution(t,r){this._holdKeyBindingPromises.set(t,r)}processKeyupEvent(t){this._clearModifierTimer()}_startModifierTimer(t){this._clearModifierTimer(),this._timerModifierID=window.setTimeout(()=>{this._executeKeyBinding(t)},eN.modifierkeyTimeOut)}_clearModifierTimer(){0!==this._timerModifierID&&(clearTimeout(this._timerModifierID),this._timerModifierID=0)}_startTimer(){this._clearTimer(),this._timerID=window.setTimeout(()=>{this._onPendingTimeout()},eN.CHORD_TIMEOUT)}_clearTimer(){0!==this._timerID&&(clearTimeout(this._timerID),this._timerID=0)}_replayKeydownEvents(){0!==this._keydownEvents.length&&(this._replaying=!0,this._keydownEvents.forEach(eN.replayKeyEvent),this._replaying=!1)}async _executeKeyBinding(t){if(0!==this._holdKeyBindingPromises.size){let t=[...this._keydownEvents],r=(await Promise.race([Promise.all(t.map(async t=>{var r;return null!=(r=this._holdKeyBindingPromises.get(t))?r:Promise.resolve(!0)})),new Promise(t=>{setTimeout(()=>t([!1]),eN.KEYBINDING_HOLD_TIMEOUT)})])).every(Boolean);if(this._holdKeyBindingPromises.clear(),!r)return}let{command:r,args:i}=t,n={_luminoEvent:{type:"keybinding",keys:t.keys},...i};if(!this.hasCommand(r)||!this.isEnabled(r,n)){let i=this.hasCommand(r)?"enabled":"registered",n=`Cannot execute key binding '${t.keys.join(", ")}':`,a=`command '${r}' is not ${i}.`;console.warn(`${n} ${a}`);return}await this.execute(r,n)}_clearPendingState(){this._clearTimer(),this._clearModifierTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0}_onPendingTimeout(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()}},eE=eS||(eS={});function eD(t){let r="",i=!1,n=!1,a=!1,o=!1;for(let s of t.split(/\s+/))"Accel"===s?K.IS_MAC?n=!0:a=!0:"Alt"===s?i=!0:"Cmd"===s?n=!0:"Ctrl"===s?a=!0:"Shift"===s?o=!0:s.length>0&&(r=s);return{cmd:n,ctrl:a,alt:i,shift:o,key:r}}function eC(t){let r="",i=eD(t);return i.ctrl&&(r+="Ctrl "),i.alt&&(r+="Alt "),i.shift&&(r+="Shift "),i.cmd&&K.IS_MAC&&(r+="Cmd "),i.key?r+i.key:r.trim()}eE.parseKeystroke=eD,eE.normalizeKeystroke=eC,eE.normalizeKeys=function(t){return(K.IS_WIN?t.winKeys||t.keys:K.IS_MAC?t.macKeys||t.keys:t.linuxKeys||t.keys).map(eC)},eE.formatKeystroke=function(t){return"string"==typeof t?r(t):t.map(r).join(", ");function r(t){let r=[],i=K.IS_MAC?" ":"+",n=eD(t);return n.ctrl&&r.push("Ctrl"),n.alt&&r.push("Alt"),n.shift&&r.push("Shift"),K.IS_MAC&&n.cmd&&r.push("Cmd"),r.push(n.key),r.map(eN.formatKey).join(i)}},eE.isModifierKeyPressed=function(t){let r=em(),i=r.keyForKeydownEvent(t);return r.isModifierKey(i)},eE.keystrokeForKeydownEvent=function(t){let r=em(),i=r.keyForKeydownEvent(t),n=[];return t.ctrlKey&&n.push("Ctrl"),t.altKey&&n.push("Alt"),t.shiftKey&&n.push("Shift"),t.metaKey&&K.IS_MAC&&n.push("Cmd"),r.isModifierKey(i)||n.push(i),n.join(" ")},function(t){t.CHORD_TIMEOUT=1e3,t.KEYBINDING_HOLD_TIMEOUT=1e3,t.modifierkeyTimeOut=500,t.createCommand=function(t){return{execute:t.execute,describedBy:c("function"==typeof t.describedBy?t.describedBy:{args:null,...t.describedBy},()=>({args:null})),label:c(t.label,n),mnemonic:c(t.mnemonic,a),icon:c(t.icon,u),iconClass:c(t.iconClass,n),iconLabel:c(t.iconLabel,n),caption:c(t.caption,n),usage:c(t.usage,n),className:c(t.className,n),dataset:c(t.dataset,l),isEnabled:t.isEnabled||o,isToggled:t.isToggled||s,isToggleable:t.isToggleable||!!t.isToggled,isVisible:t.isVisible||o}},t.createKeyBinding=function(t){var r;return{keys:eS.normalizeKeys(t),selector:function(t){if(-1!==t.selector.indexOf(","))throw Error(`Selector cannot contain commas: ${t.selector}`);if(!J.isValid(t.selector))throw Error(`Invalid selector: ${t.selector}`);return t.selector}(t),command:t.command,args:t.args||ep.JSONExt.emptyObject,preventDefault:null==(r=t.preventDefault)||r}},t.matchKeyBinding=function(t,r,i){let n=null,a=[],o=1/0,s=0;for(let l=0,u=t.length;lr.length?2:1}(u.keys,r);if(0===c)continue;if(2===c){-1!==h(u.selector,i)&&a.push(u);continue}let d=h(u.selector,i);if(-1===d||d>o)continue;let f=J.calculateSpecificity(u.selector);(!n||d=s)&&(n=u,o=d,s=f)}return{exact:n,partial:a}},t.replayKeyEvent=function(t){var r;let i,n,a;t.target.dispatchEvent((r=t,i=document.createEvent("Event"),n=r.bubbles||!0,a=r.cancelable||!0,i.initEvent(r.type||"keydown",n,a),i.key=r.key||"",i.keyCode=r.keyCode||0,i.which=r.keyCode||0,i.ctrlKey=r.ctrlKey||!1,i.altKey=r.altKey||!1,i.shiftKey=r.shiftKey||!1,i.metaKey=r.metaKey||!1,i.view=r.view||window,i))},t.formatKey=function(t){return K.IS_MAC?r.hasOwnProperty(t)?r[t]:t:i.hasOwnProperty(t)?i[t]:t};let r={Backspace:"⌫",Tab:"⇥",Enter:"⏎",Shift:"⇧",Ctrl:"⌃",Alt:"⌥",Escape:"⎋",PageUp:"⇞",PageDown:"⇟",End:"↘",Home:"↖",ArrowLeft:"←",ArrowUp:"↑",ArrowRight:"→",ArrowDown:"↓",Delete:"⌦",Cmd:"⌘"},i={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},n=()=>"",a=()=>-1,o=()=>!0,s=()=>!1,l=()=>({}),u=()=>{};function c(t,r){return void 0===t?r:"function"==typeof t?t:()=>t}function h(t,r){let i=r.target,n=r.currentTarget;for(let r=0;null!==i&&!i.hasAttribute("data-lm-suppress-shortcuts");i=i.parentElement,++r){if(J.matches(i,t))return r;if(i===n)break}return -1}}(eN||(eN={}));var eI=O(R()),eL=class{constructor(t){this.type="text",this.content=t}},eP=class{constructor(t,r,i,n){this.type="element",this.tag=t,this.attrs=r,this.children=i,this.renderer=n}};function ez(t){let r={},i,n=[];for(let t=1,a=arguments.length;t=o.length){eO(n[i],r);continue}let l=o[i],u=n[i];if(l===u){s=s.nextSibling;continue}if("text"===l.type&&"text"===u.type){s.textContent!==u.content&&(s.textContent=u.content),s=s.nextSibling;continue}if("text"===l.type||"text"===u.type||!l.renderer!=!u.renderer){eI.ArrayExt.insert(o,i,u),eO(u,r,s);continue}let c=u.attrs.key;if(c&&c in a){let t=a[c];t.vNode!==l&&(eI.ArrayExt.move(o,o.indexOf(t.vNode,i+1),i),r.insertBefore(t.element,s),l=t.vNode,s=t.element)}if(l===u){s=s.nextSibling;continue}let h=l.attrs.key;if(h&&h!==c||l.tag!==u.tag){eI.ArrayExt.insert(o,i,u),eO(u,r,s);continue}(function(t,r,i){let n;if(r!==i){for(n in r)n in eR||n in i||("on"===n.substr(0,2)?t[n]=null:t.removeAttribute(n));for(n in i)n in eR||r[n]===i[n]||("on"===n.substr(0,2)?t[n]=i[n]:t.setAttribute(n,i[n]));r.className!==i.className&&(void 0!==i.className?t.setAttribute("class",i.className):t.removeAttribute("class")),r.htmlFor!==i.htmlFor&&(void 0!==i.htmlFor?t.setAttribute("for",i.htmlFor):t.removeAttribute("for")),r.dataset!==i.dataset&&function(t,r,i){for(let n in r)n in i||t.removeAttribute(`data-${n}`);for(let n in i)r[n]!==i[n]&&t.setAttribute(`data-${n}`,i[n])}(t,r.dataset||{},i.dataset||{}),r.style!==i.style&&function(t,r,i){let n=t.style,a;for(a in r)a in i||(n[a]="");for(a in i)r[a]!==i[a]&&(n[a]=i[a])}(t,r.style||{},i.style||{})}})(s,l.attrs,u.attrs),u.renderer?u.renderer.render(s,{attrs:u.attrs,children:u.children}):t(s,l.children,u.children),s=s.nextSibling}!function t(r,i,n,a){for(let o=i.length-1;o>=n;--o){let n=i[o],s=a?r.lastChild:r.childNodes[o];"text"===n.type||(n.renderer&&n.renderer.unrender?n.renderer.unrender(s,{attrs:n.attrs,children:n.children}):t(s,n.children,0,!1)),a&&r.removeChild(s)}}(r,o,l,!0)};let eR={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};var eB,ej,eN,eV,eU,eq,eG=class{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}};(eY=eq||(eq={})).calc=function(t,r){let i=t.length;if(0===i)return r;let n=0,a=0,o=0,s=0,l=0;for(let r=0;r0&&(s+=i.stretch,l++)}if(r===o)return 0;if(r<=n){for(let r=0;r=a){for(let r=0;r0&&n>.01;){let r=n,a=s;for(let o=0;o0&&n>.01;){let r=n/u;for(let a=0;a0&&n>.01;){let r=n,a=s;for(let o=0;o=i.maxSize?(n-=i.maxSize-i.size,s-=i.stretch,i.size=i.maxSize,i.done=!0,u--,l--):(n-=c,i.size+=c)}}for(;u>0&&n>.01;){let r=n/u;for(let a=0;a=i.maxSize?(n-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,u--):(n-=r,i.size+=r))}}}return 0},eY.adjust=function(t,r,i){0===t.length||0===i||(i>0?function(t,r,i){let n=0;for(let i=0;i<=r;++i){let r=t[i];n+=r.maxSize-r.size}let a=0;for(let i=r+1,n=t.length;i=0&&o>0;--i){let r=t[i],n=r.maxSize-r.size;n>=o?(r.sizeHint=r.size+o,o=0):(r.sizeHint=r.size+n,o-=n)}let s=i;for(let i=r+1,n=t.length;i0;++i){let r=t[i],n=r.size-r.minSize;n>=s?(r.sizeHint=r.size-s,s=0):(r.sizeHint=r.size-n,s-=n)}}(t,r,i):function(t,r,i){let n=0;for(let i=r+1,a=t.length;i0;++i){let r=t[i],n=r.maxSize-r.size;n>=o?(r.sizeHint=r.size+o,o=0):(r.sizeHint=r.size+n,o-=n)}let s=i;for(let i=r;i>=0&&s>0;--i){let r=t[i],n=r.size-r.minSize;n>=s?(r.sizeHint=r.size-s,s=0):(r.sizeHint=r.size-n,s-=n)}}(t,r,-i))};var eH=class{constructor(t){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new eo(this),this._isDisposed=!1,this.owner=t.owner,void 0!==t.label&&(this._label=t.label),void 0!==t.mnemonic&&(this._mnemonic=t.mnemonic),void 0!==t.icon&&(this._icon=t.icon),void 0!==t.iconClass&&(this._iconClass=t.iconClass),void 0!==t.iconLabel&&(this._iconLabel=t.iconLabel),void 0!==t.caption&&(this._caption=t.caption),void 0!==t.className&&(this._className=t.className),void 0!==t.closable&&(this._closable=t.closable),this._dataset=t.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(t){this._label!==t&&(this._label=t,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(t){this._mnemonic!==t&&(this._mnemonic=t,this._changed.emit(void 0))}get icon(){return this._icon}set icon(t){this._icon!==t&&(this._icon=t,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(t){this._iconClass!==t&&(this._iconClass=t,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(t){this._iconLabel!==t&&(this._iconLabel=t,this._changed.emit(void 0))}get caption(){return this._caption}set caption(t){this._caption!==t&&(this._caption=t,this._changed.emit(void 0))}get className(){return this._className}set className(t){this._className!==t&&(this._className=t,this._changed.emit(void 0))}get closable(){return this._closable}set closable(t){this._closable!==t&&(this._closable=t,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(t){this._dataset!==t&&(this._dataset=t,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,eo.clearData(this))}},e$=class t{constructor(r={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new eo(this),this._hiddenMode=t.HiddenMode.Display,this.node=eK.createNode(r),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(t.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&t.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),eo.clearData(this),et.clearData(this),en.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(t.Flag.IsDisposed)}get isAttached(){return this.testFlag(t.Flag.IsAttached)}get isHidden(){return this.testFlag(t.Flag.IsHidden)}get isVisible(){let t=this;do{if(t.isHidden||!t.isAttached)return!1;t=t.parent}while(null!=t);return!0}get title(){return eK.titleProperty.get(this)}get id(){return this.node.id}set id(t){this.node.id=t}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(r){this._hiddenMode!==r&&(this.isHidden&&this._toggleHidden(!1),r==t.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=r,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(r){if(this._parent!==r){if(r&&this.contains(r))throw Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let r=new t.ChildMessage("child-removed",this);et.sendMessage(this._parent,r)}if(this._parent=r,this._parent&&!this._parent.isDisposed){let r=new t.ChildMessage("child-added",this);et.sendMessage(this._parent,r)}this.isDisposed||et.sendMessage(this,t.Msg.ParentChanged)}}get layout(){return this._layout}set layout(r){if(this._layout!==r){if(this.testFlag(t.Flag.DisallowLayout))throw Error("Cannot set widget layout.");if(this._layout)throw Error("Cannot change widget layout.");if(r.parent)throw Error("Cannot change layout parent.");this._layout=r,r.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(t){for(let r=t;r;r=r._parent)if(r===this)return!0;return!1}hasClass(t){return this.node.classList.contains(t)}addClass(t){this.node.classList.add(t)}removeClass(t){this.node.classList.remove(t)}toggleClass(t,r){return!0===r?(this.node.classList.add(t),!0):!1===r?(this.node.classList.remove(t),!1):this.node.classList.toggle(t)}update(){et.postMessage(this,t.Msg.UpdateRequest)}fit(){et.postMessage(this,t.Msg.FitRequest)}activate(){et.postMessage(this,t.Msg.ActivateRequest)}close(){et.sendMessage(this,t.Msg.CloseRequest)}show(){if(this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.BeforeShow),this.clearFlag(t.Flag.IsHidden),this._toggleHidden(!1),this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.AfterShow),this.parent)){let r=new t.ChildMessage("child-shown",this);et.sendMessage(this.parent,r)}}hide(){if(!this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.BeforeHide),this.setFlag(t.Flag.IsHidden),this._toggleHidden(!0),this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.AfterHide),this.parent)){let r=new t.ChildMessage("child-hidden",this);et.sendMessage(this.parent,r)}}setHidden(t){t?this.hide():this.show()}testFlag(t){return(this._flags&t)!=0}setFlag(t){this._flags|=t}clearFlag(t){this._flags&=~t}processMessage(r){switch(r.type){case"resize":this.notifyLayout(r),this.onResize(r);break;case"update-request":this.notifyLayout(r),this.onUpdateRequest(r);break;case"fit-request":this.notifyLayout(r),this.onFitRequest(r);break;case"before-show":this.notifyLayout(r),this.onBeforeShow(r);break;case"after-show":this.setFlag(t.Flag.IsVisible),this.notifyLayout(r),this.onAfterShow(r);break;case"before-hide":this.notifyLayout(r),this.onBeforeHide(r);break;case"after-hide":this.clearFlag(t.Flag.IsVisible),this.notifyLayout(r),this.onAfterHide(r);break;case"before-attach":this.notifyLayout(r),this.onBeforeAttach(r);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(t.Flag.IsVisible),this.setFlag(t.Flag.IsAttached),this.notifyLayout(r),this.onAfterAttach(r);break;case"before-detach":this.notifyLayout(r),this.onBeforeDetach(r);break;case"after-detach":this.clearFlag(t.Flag.IsVisible),this.clearFlag(t.Flag.IsAttached),this.notifyLayout(r),this.onAfterDetach(r);break;case"activate-request":this.notifyLayout(r),this.onActivateRequest(r);break;case"close-request":this.notifyLayout(r),this.onCloseRequest(r);break;case"child-added":this.notifyLayout(r),this.onChildAdded(r);break;case"child-removed":this.notifyLayout(r),this.onChildRemoved(r);break;default:this.notifyLayout(r)}}notifyLayout(t){this._layout&&this._layout.processParentMessage(t)}onCloseRequest(r){this.parent?this.parent=null:this.isAttached&&t.detach(this)}onResize(t){}onUpdateRequest(t){}onFitRequest(t){}onActivateRequest(t){}onBeforeShow(t){}onAfterShow(t){}onBeforeHide(t){}onAfterHide(t){}onBeforeAttach(t){}onAfterAttach(t){}onBeforeDetach(t){}onAfterDetach(t){}onChildAdded(t){}onChildRemoved(t){}_toggleHidden(r){if(r)switch(this._hiddenMode){case t.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case t.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case t.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1",this.node.style.opacity="0"}else switch(this._hiddenMode){case t.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case t.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case t.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex="",this.node.style.opacity=""}}};!function(t){var r,i,n,a;(r=t.HiddenMode||(t.HiddenMode={}))[r.Display=0]="Display",r[r.Scale=1]="Scale",r[r.ContentVisibility=2]="ContentVisibility",(i=t.Flag||(t.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(n=t.Msg||(t.Msg={})).BeforeShow=new er("before-show"),n.AfterShow=new er("after-show"),n.BeforeHide=new er("before-hide"),n.AfterHide=new er("after-hide"),n.BeforeAttach=new er("before-attach"),n.AfterAttach=new er("after-attach"),n.BeforeDetach=new er("before-detach"),n.AfterDetach=new er("after-detach"),n.ParentChanged=new er("parent-changed"),n.UpdateRequest=new ei("update-request"),n.FitRequest=new ei("fit-request"),n.ActivateRequest=new ei("activate-request"),n.CloseRequest=new ei("close-request"),t.ChildMessage=class extends er{constructor(t,r){super(t),this.child=r}};class o extends er{constructor(t,r){super("resize"),this.width=t,this.height=r}}t.ResizeMessage=o,(a=o=t.ResizeMessage||(t.ResizeMessage={})).UnknownSize=new a(-1,-1),t.attach=function(r,i,n=null){if(r.parent)throw Error("Cannot attach a child widget.");if(r.isAttached||r.node.isConnected)throw Error("Widget is already attached.");if(!i.isConnected)throw Error("Host is not attached.");et.sendMessage(r,t.Msg.BeforeAttach),i.insertBefore(r.node,n),et.sendMessage(r,t.Msg.AfterAttach)},t.detach=function(r){if(r.parent)throw Error("Cannot detach a child widget.");if(!r.isAttached||!r.node.isConnected)throw Error("Widget is not attached.");et.sendMessage(r,t.Msg.BeforeDetach),r.node.parentNode.removeChild(r.node),et.sendMessage(r,t.Msg.AfterDetach)}}(e$||(e$={})),(eZ=eK||(eK={})).titleProperty=new en({name:"title",create:t=>new eH({owner:t})}),eZ.createNode=function(t){return t.node||document.createElement(t.tag||"div")};var eW=class{constructor(t={}){this._disposed=!1,this._parent=null,this._fitPolicy=t.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,eo.clearData(this),en.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(t){if(this._parent!==t){if(this._parent)throw Error("Cannot change parent widget.");if(t.layout!==this)throw Error("Invalid parent widget.");this._parent=t,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(t){if(this._fitPolicy!==t&&(this._fitPolicy=t,this._parent)){let t=this._parent.node.style;t.minWidth="",t.minHeight="",t.maxWidth="",t.maxHeight="",this._parent.fit()}}processParentMessage(t){switch(t.type){case"resize":this.onResize(t);break;case"update-request":this.onUpdateRequest(t);break;case"fit-request":this.onFitRequest(t);break;case"before-show":this.onBeforeShow(t);break;case"after-show":this.onAfterShow(t);break;case"before-hide":this.onBeforeHide(t);break;case"after-hide":this.onAfterHide(t);break;case"before-attach":this.onBeforeAttach(t);break;case"after-attach":this.onAfterAttach(t);break;case"before-detach":this.onBeforeDetach(t);break;case"after-detach":this.onAfterDetach(t);break;case"child-removed":this.onChildRemoved(t);break;case"child-shown":this.onChildShown(t);break;case"child-hidden":this.onChildHidden(t)}}init(){for(let t of this)t.parent=this.parent}onResize(t){for(let t of this)et.sendMessage(t,e$.ResizeMessage.UnknownSize)}onUpdateRequest(t){for(let t of this)et.sendMessage(t,e$.ResizeMessage.UnknownSize)}onBeforeAttach(t){for(let r of this)et.sendMessage(r,t)}onAfterAttach(t){for(let r of this)et.sendMessage(r,t)}onBeforeDetach(t){for(let r of this)et.sendMessage(r,t)}onAfterDetach(t){for(let r of this)et.sendMessage(r,t)}onBeforeShow(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onAfterShow(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onBeforeHide(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onAfterHide(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onChildRemoved(t){this.removeWidget(t.child)}onFitRequest(t){}onChildShown(t){}onChildHidden(t){}};(eX=eW||(eW={})).getHorizontalAlignment=function(t){return eJ.horizontalAlignmentProperty.get(t)},eX.setHorizontalAlignment=function(t,r){eJ.horizontalAlignmentProperty.set(t,r)},eX.getVerticalAlignment=function(t){return eJ.verticalAlignmentProperty.get(t)},eX.setVerticalAlignment=function(t,r){eJ.verticalAlignmentProperty.set(t,r)};var eY,eZ,eX,eK,eJ,eQ=class{constructor(t){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=t,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let t=this.widget.node.style;t.position="",t.top="",t.left="",t.width="",t.height="",t.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let t=X.sizeLimits(this.widget.node);this._minWidth=t.minWidth,this._minHeight=t.minHeight,this._maxWidth=t.maxWidth,this._maxHeight=t.maxHeight}update(t,r,i,n){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),o=Math.max(this._minHeight,Math.min(n,this._maxHeight));if(a"center",changed:e1}),e0.verticalAlignmentProperty=new en({name:"verticalAlignment",create:()=>"top",changed:e1});var e2,e3=class extends eW{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(t){this.insertWidget(this._widgets.length,t)}insertWidget(t,r){r.parent=this.parent;let i=this._widgets.indexOf(r),n=Math.max(0,Math.min(t,this._widgets.length));if(-1===i){N.ArrayExt.insert(this._widgets,n,r),this.parent&&this.attachWidget(n,r);return}n===this._widgets.length&&n--,i!==n&&(N.ArrayExt.move(this._widgets,i,n),this.parent&&this.moveWidget(i,n,r))}removeWidget(t){this.removeWidgetAt(this._widgets.indexOf(t))}removeWidgetAt(t){let r=N.ArrayExt.removeAt(this._widgets,t);r&&this.parent&&this.detachWidget(t,r)}init(){super.init();let t=0;for(let r of this)this.attachWidget(t++,r)}attachWidget(t,r){let i=this.parent.node.children[t];this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.insertBefore(r.node,i),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach)}moveWidget(t,r,i){this.parent.isAttached&&et.sendMessage(i,e$.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&et.sendMessage(i,e$.Msg.AfterDetach);let n=this.parent.node.children[r];this.parent.isAttached&&et.sendMessage(i,e$.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,n),this.parent.isAttached&&et.sendMessage(i,e$.Msg.AfterAttach)}detachWidget(t,r){this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach)}};(e2||(e2={})).clampDimension=function(t){return Math.max(0,Math.floor(t))};var e5=e2,e4=class t extends e3{constructor(t){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=t.renderer,void 0!==t.orientation&&(this._orientation=t.orientation),void 0!==t.alignment&&(this._alignment=t.alignment),void 0!==t.spacing&&(this._spacing=e2.clampDimension(t.spacing))}dispose(){for(let t of this._items)t.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(t){this._orientation!==t&&(this._orientation=t,this.parent&&(this.parent.dataset.orientation=t,this.parent.fit()))}get alignment(){return this._alignment}set alignment(t){this._alignment!==t&&(this._alignment=t,this.parent&&(this.parent.dataset.alignment=t,this.parent.update()))}get spacing(){return this._spacing}set spacing(t){t=e2.clampDimension(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map(t=>t.size)}relativeSizes(){return e7.normalize(this._sizers.map(t=>t.size))}setRelativeSizes(t,r=!0){let i=this._sizers.length,n=t.slice(0,i);for(;n.length0&&(t.sizeHint=t.size);eq.adjust(this._sizers,t,i),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(t,r){let i=new eQ(r),n=e7.createHandle(this.renderer),a=e7.averageSize(this._sizers),o=e7.createSizer(a);N.ArrayExt.insert(this._items,t,i),N.ArrayExt.insert(this._sizers,t,o),N.ArrayExt.insert(this._handles,t,n),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.node.appendChild(n),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach),this.parent.fit()}moveWidget(t,r,i){N.ArrayExt.move(this._items,t,r),N.ArrayExt.move(this._sizers,t,r),N.ArrayExt.move(this._handles,t,r),this.parent.fit()}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._items,t),n=N.ArrayExt.removeAt(this._handles,t);N.ArrayExt.removeAt(this._sizers,t),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.node.removeChild(n),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach),i.dispose(),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}updateItemPosition(t,r,i,n,a,o,s){let l=this._items[t];if(l.isHidden)return;let u=this._handles[t].style;r?(i+=this.widgetOffset,l.update(i,n,s,a),i+=s,u.top=`${n}px`,u.left=`${i}px`,u.width=`${this._spacing}px`,u.height=`${a}px`):(n+=this.widgetOffset,l.update(i,n,o,s),n+=s,u.top=`${n}px`,u.left=`${i}px`,u.width=`${o}px`,u.height=`${this._spacing}px`)}_fit(){let r=0,i=-1;for(let t=0,n=this._items.length;t0&&(s.sizeHint=s.size),i.isHidden){s.minSize=0,s.maxSize=0;continue}i.fit(),s.stretch=t.getStretch(i.widget),n?(s.minSize=i.minWidth,s.maxSize=i.maxWidth,a+=i.minWidth,o=Math.max(o,i.minHeight)):(s.minSize=i.minHeight,s.maxSize=i.maxHeight,o+=i.minHeight,a=Math.max(a,i.minWidth))}let s=this._box=X.boxSizing(this.parent.node);a+=s.horizontalSum,o+=s.verticalSum;let l=this.parent.node.style;l.minWidth=`${a}px`,l.minHeight=`${o}px`,this._dirty=!0,this.parent.parent&&et.sendMessage(this.parent.parent,e$.Msg.FitRequest),this._dirty&&et.sendMessage(this.parent,e$.Msg.UpdateRequest)}_update(t,r){this._dirty=!1;let i=0;for(let t=0,r=this._items.length;t0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,s-this._fixed),this._hasNormedSizes){for(let r of this._sizers)r.sizeHint*=t;this._hasNormedSizes=!1}let r=eq.calc(this._sizers,t);if(r>0)switch(this._alignment){case"start":break;case"center":l=0,u=r/2;break;case"end":l=0,u=r;break;case"justify":l=r/i,u=0;break;default:throw"unreachable"}}for(let t=0,r=this._items.length;t0,coerce:(t,r)=>Math.max(0,Math.floor(r)),changed:function(t){t.parent&&t.parent.layout instanceof e4&&t.parent.fit()}}),e8.createSizer=function(t){let r=new eG;return r.sizeHint=Math.floor(t),r},e8.createHandle=function(t){let r=t.createHandle();return r.style.position="absolute",r.style.contain="style",r},e8.averageSize=function(t){return t.reduce((t,r)=>t+r.size,0)/t.length||0},e8.normalize=function(t){let r=t.length;if(0===r)return[];let i=t.reduce((t,r)=>t+Math.abs(r),0);return 0===i?t.map(t=>1/r):t.map(t=>t/i)};var e6,e8,e7,e9,te=class extends e4{constructor(t){super({...t,orientation:t.orientation||"vertical"}),this._titles=[],this.titleSpace=t.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(t){t=e5.clampDimension(t),this.widgetOffset!==t&&(this.widgetOffset=t,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(t,r){let i=this._titles[t],n=i.classList.contains("lm-mod-expanded"),a=e9.createTitle(this.renderer,r.title,n);this._titles[t]=a,this.parent.node.replaceChild(a,i)}insertWidget(t,r){r.id||(r.id=`id-${V.UUID.uuid4()}`),super.insertWidget(t,r)}attachWidget(t,r){let i=e9.createTitle(this.renderer,r.title,!r.isHidden);N.ArrayExt.insert(this._titles,t,i),this.parent.node.appendChild(i),r.node.setAttribute("role","region"),r.node.setAttribute("aria-labelledby",i.id),super.attachWidget(t,r)}moveWidget(t,r,i){N.ArrayExt.move(this._titles,t,r),super.moveWidget(t,r,i)}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._titles,t);this.parent.node.removeChild(i),super.detachWidget(t,r)}updateItemPosition(t,r,i,n,a,o,s){let l=this._titles[t].style;l.top=`${n}px`,l.left=`${i}px`,l.height=`${this.widgetOffset}px`,r?l.width=`${a}px`:l.width=`${o}px`,super.updateItemPosition(t,r,i,n,a,o,s)}};(e9||(e9={})).createTitle=function(t,r,i=!0){let n=t.createSectionTitle(r);return n.style.position="absolute",n.style.contain="strict",n.setAttribute("aria-label",`${r.label} Section`),n.setAttribute("aria-expanded",i?"true":"false"),n.setAttribute("aria-controls",r.owner.id),i&&n.classList.add("lm-mod-expanded"),n};var tt,tr=class extends e${constructor(t={}){super(),this.addClass("lm-Panel"),this.layout=tt.createLayout(t)}get widgets(){return this.layout.widgets}addWidget(t){this.layout.addWidget(t)}insertWidget(t,r){this.layout.insertWidget(t,r)}};(tt||(tt={})).createLayout=function(t){return t.layout||new e3};var ti=class extends tr{constructor(t={}){super({layout:tL.createLayout(t)}),this._handleMoved=new eo(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(t){this.layout.orientation=t}get alignment(){return this.layout.alignment}set alignment(t){this.layout.alignment=t}get spacing(){return this.layout.spacing}set spacing(t){this.layout.spacing=t}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(t,r=!0){this.layout.setRelativeSizes(t,r)}handleEvent(t){switch(t.type){case"pointerdown":this._evtPointerDown(t);break;case"pointermove":this._evtPointerMove(t);break;case"pointerup":this._evtPointerUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}}onBeforeAttach(t){this.node.addEventListener("pointerdown",this)}onAfterDetach(t){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(t){t.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(t){t.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(t){this._pressData&&(t.preventDefault(),t.stopPropagation()),27===t.keyCode&&this._releaseMouse()}_evtPointerDown(t){if(0!==t.button)return;let r=this.layout,i=N.ArrayExt.findFirstIndex(r.handles,r=>r.contains(t.target));if(-1===i)return;t.preventDefault(),t.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let n,a=r.handles[i],o=a.getBoundingClientRect();n="horizontal"===r.orientation?t.clientX-o.left:t.clientY-o.top;let s=window.getComputedStyle(a),l=ec.overrideCursor(s.cursor);this._pressData={index:i,delta:n,override:l}}_evtPointerMove(t){t.preventDefault(),t.stopPropagation();let r,i=this.layout,n=this.node.getBoundingClientRect();r="horizontal"===i.orientation?t.clientX-n.left-this._pressData.delta:t.clientY-n.top-this._pressData.delta,i.moveHandle(this._pressData.index,r)}_evtPointerUp(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}},tn=ti||(ti={});class ta{createHandle(){let t=document.createElement("div");return t.className="lm-SplitPanel-handle",t}}tn.Renderer=ta,tn.defaultRenderer=new ta,tn.getStretch=function(t){return e4.getStretch(t)},tn.setStretch=function(t,r){e4.setStretch(t,r)},(tL||(tL={})).createLayout=function(t){return t.layout||new e4({renderer:t.renderer||ti.defaultRenderer,orientation:t.orientation,alignment:t.alignment,spacing:t.spacing})};var to=class extends ti{constructor(t={}){super({...t,layout:tP.createLayout(t)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new eo(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(t){this.layout.titleSpace=t}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(t){super.addWidget(t),t.title.changed.connect(this._onTitleChanged,this)}collapse(t){let r=this.layout.widgets[t];r&&!r.isHidden&&this._toggleExpansion(t)}expand(t){let r=this.layout.widgets[t];r&&r.isHidden&&this._toggleExpansion(t)}insertWidget(t,r){super.insertWidget(t,r),r.title.changed.connect(this._onTitleChanged,this)}handleEvent(t){switch(super.handleEvent(t),t.type){case"click":this._evtClick(t);break;case"keydown":this._eventKeyDown(t)}}onBeforeAttach(t){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(t)}onAfterDetach(t){super.onAfterDetach(t),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(t){let r=N.ArrayExt.findFirstIndex(this.widgets,r=>r.contains(t.owner));r>=0&&(this.layout.updateTitle(r,t.owner),this.update())}_computeWidgetSize(t){let r=this.layout,i=r.widgets[t];if(!i)return;let n=i.isHidden,a=r.absoluteSizes(),o=(n?-1:1)*this.spacing,s=a.reduce((t,r)=>t+r),l=[...a];if(n){let r=this._widgetSizesCache.get(i);if(!r)return;l[t]+=r;let n=l.map(t=>t-r>0).lastIndexOf(!0);-1===n?l.forEach((i,n)=>{n!==t&&(l[n]-=a[n]/s*(r-o))}):l[n]-=r-o}else{let r=a[t];this._widgetSizesCache.set(i,r),l[t]=0;let n=l.map(t=>t>0).lastIndexOf(!0);if(-1===n)return;l[n]=a[n]+r+o}return l.map(t=>t/(s+o))}_evtClick(t){let r=t.target;if(r){let i=N.ArrayExt.findFirstIndex(this.titles,t=>t.contains(r));i>=0&&(t.preventDefault(),t.stopPropagation(),this._toggleExpansion(i))}}_eventKeyDown(t){if(t.defaultPrevented)return;let r=t.target,i=!1;if(r){let n=N.ArrayExt.findFirstIndex(this.titles,t=>t.contains(r));if(n>=0){let a=t.keyCode.toString();if(t.key.match(/Space|Enter/)||a.match(/13|32/))r.click(),i=!0;else if("horizontal"===this.orientation?t.key.match(/ArrowLeft|ArrowRight/)||a.match(/37|39/):t.key.match(/ArrowUp|ArrowDown/)||a.match(/38|40/)){let r=t.key.match(/ArrowLeft|ArrowUp/)||a.match(/37|38/)?-1:1,o=this.titles.length;this.titles[(n+o+r)%o].focus(),i=!0}else"End"===t.key||"35"===a?(this.titles[this.titles.length-1].focus(),i=!0):("Home"===t.key||"36"===a)&&(this.titles[0].focus(),i=!0)}i&&t.preventDefault()}}_toggleExpansion(t){let r=this.titles[t],i=this.layout.widgets[t],n=this._computeWidgetSize(t);n&&this.setRelativeSizes(n,!1),i.isHidden?(r.classList.add("lm-mod-expanded"),r.setAttribute("aria-expanded","true"),i.show()):(r.classList.remove("lm-mod-expanded"),r.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(t)}},ts=to||(to={});class tl extends ti.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++tl._nInstance}createCollapseIcon(t){return document.createElement("span")}createSectionTitle(t){let r=document.createElement("h3");for(let i in r.setAttribute("tabindex","0"),r.id=this.createTitleKey(t),r.className=this.titleClassName,t.dataset)r.dataset[i]=t.dataset[i];r.appendChild(this.createCollapseIcon(t)).className="lm-AccordionPanel-titleCollapser";let i=r.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=t.label,i.title=t.caption||t.label,r}createTitleKey(t){let r=this._titleKeys.get(t);return void 0===r&&(r=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(t,r)),r}}tl._nInstance=0,ts.Renderer=tl,ts.defaultRenderer=new tl,(tP||(tP={})).createLayout=function(t){return t.layout||new te({renderer:t.renderer||to.defaultRenderer,orientation:t.orientation,alignment:t.alignment,spacing:t.spacing,titleSpace:t.titleSpace})};var tu=class t extends e3{constructor(t={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==t.direction&&(this._direction=t.direction),void 0!==t.alignment&&(this._alignment=t.alignment),void 0!==t.spacing&&(this._spacing=e5.clampDimension(t.spacing))}dispose(){for(let t of this._items)t.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(t){this._direction!==t&&(this._direction=t,this.parent&&(this.parent.dataset.direction=t,this.parent.fit()))}get alignment(){return this._alignment}set alignment(t){this._alignment!==t&&(this._alignment=t,this.parent&&(this.parent.dataset.alignment=t,this.parent.update()))}get spacing(){return this._spacing}set spacing(t){t=e5.clampDimension(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(t,r){N.ArrayExt.insert(this._items,t,new eQ(r)),N.ArrayExt.insert(this._sizers,t,new eG),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach),this.parent.fit()}moveWidget(t,r,i){N.ArrayExt.move(this._items,t,r),N.ArrayExt.move(this._sizers,t,r),this.parent.update()}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._items,t);N.ArrayExt.removeAt(this._sizers,t),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach),i.dispose(),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_fit(){let r=0;for(let t=0,i=this._items.length;t0)switch(this._alignment){case"start":break;case"center":u=0,c=l/2;break;case"end":u=0,c=l;break;case"justify":u=l/i,c=0;break;default:throw"unreachable"}for(let t=0,r=this._items.length;t0,coerce:(t,r)=>Math.max(0,Math.floor(r)),changed:th}),tc.sizeBasisProperty=new en({name:"sizeBasis",create:()=>0,coerce:(t,r)=>Math.max(0,Math.floor(r)),changed:th}),tc.isHorizontal=function(t){return"left-to-right"===t||"right-to-left"===t},tc.clampSpacing=function(t){return Math.max(0,Math.floor(t))};var td=class extends tr{constructor(t={}){super({layout:tF.createLayout(t)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(t){this.layout.direction=t}get alignment(){return this.layout.alignment}set alignment(t){this.layout.alignment=t}get spacing(){return this.layout.spacing}set spacing(t){this.layout.spacing=t}onChildAdded(t){t.child.addClass("lm-BoxPanel-child")}onChildRemoved(t){t.child.removeClass("lm-BoxPanel-child")}};(tC=td||(td={})).getStretch=function(t){return tu.getStretch(t)},tC.setStretch=function(t,r){tu.setStretch(t,r)},tC.getSizeBasis=function(t){return tu.getSizeBasis(t)},tC.setSizeBasis=function(t,r){tu.setSizeBasis(t,r)},(tF||(tF={})).createLayout=function(t){return t.layout||new tu(t)};var tf=class t extends e${constructor(r){super({node:tO.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(e$.Flag.DisallowLayout),this.commands=r.commands,this.renderer=r.renderer||t.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(t){let r=tO.createItem(this.commands,t);return this._items.push(r),this.refresh(),r}addItems(t){let r=t.map(t=>tO.createItem(this.commands,t));return r.forEach(t=>this._items.push(t)),this.refresh(),r}removeItem(t){this.removeItemAt(this._items.indexOf(t))}removeItemAt(t){N.ArrayExt.removeAt(this._items,t)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){(this._results=null,""!==this.inputNode.value)?this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit":this.node.getElementsByClassName("lm-close-icon")[0].style.display="none",this.update()}handleEvent(t){switch(t.type){case"click":this._evtClick(t);break;case"keydown":this._evtKeyDown(t);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(t){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(t){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(t){this.update(),super.onAfterShow(t)}onActivateRequest(t){if(this.isAttached){let t=this.inputNode;t.focus(),t.select()}}onUpdateRequest(t){if(!this.isVisible)return void eV.render(null,this.contentNode);let r=this.inputNode.value,i=this.contentNode,n=this._results;if(n||(n=this._results=tO.search(this._items,r),this._activeIndex=r?N.ArrayExt.findFirstIndex(n,tO.canActivate):-1),!r&&0===n.length)return void eV.render(null,i);if(r&&0===n.length){let t=this.renderer.renderEmptyMessage({query:r});eV.render(t,i);return}let a=this.renderer,o=this._activeIndex,s=Array(n.length);for(let t=0,r=n.length;t=n.length)i.scrollTop=0;else{let t=i.children[o];X.scrollIntoViewIfNeeded(i,t)}}_evtClick(t){if(0!==t.button)return;if(t.target.classList.contains("lm-close-icon")){this.inputNode.value="",this.refresh();return}let r=N.ArrayExt.findFirstIndex(this.contentNode.children,r=>r.contains(t.target));-1!==r&&(t.preventDefault(),t.stopPropagation(),this._execute(r))}_evtKeyDown(t){if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey))switch(t.keyCode){case 13:t.preventDefault(),t.stopPropagation(),this._execute(this._activeIndex);break;case 38:t.preventDefault(),t.stopPropagation(),this._activatePreviousItem();break;case 40:t.preventDefault(),t.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let t=this._activeIndex,r=this._results.length,i=tt-r),h=s.slice(0,c),d=s.slice(c);for(let t=0,r=d.length;ti.command===t&&V.JSONExt.deepEqual(i.args,r))||null}}var tx=class t extends e${constructor(r){super({node:tR.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new eo(this),this._menuRequested=new eo(this),this.addClass("lm-Menu"),this.setFlag(e$.Flag.DisallowLayout),this.commands=r.commands,this.renderer=r.renderer||t.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let t=this;for(;t._parentMenu;)t=t._parentMenu;return t}get leafMenu(){let t=this;for(;t._childMenu;)t=t._childMenu;return t}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(t){this.activeIndex=t?this._items.indexOf(t):-1}get activeIndex(){return this._activeIndex}set activeIndex(t){(t<0||t>=this._items.length)&&(t=-1),-1===t||tR.canActivate(this._items[t])||(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let t=this._items.length,r=this._activeIndex,i=r{this.activeIndex=t}})}eV.render(o,this.contentNode)}onCloseRequest(t){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let r=this._childMenu;r&&(this._childIndex=-1,this._childMenu=null,r._parentMenu=null,r.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(t)}_evtKeyDown(t){t.preventDefault(),t.stopPropagation();let r=t.keyCode;if(13===r)return void this.triggerActiveItem();if(27===r)return void this.close();if(37===r)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===r)return void this.activatePreviousItem();if(39===r){let t=this.activeItem;t&&"submenu"===t.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next");return}if(40===r)return void this.activateNextItem();let i=em().keyForKeydownEvent(t);if(!i)return;let n=this._activeIndex+1,a=tR.findMnemonic(this._items,i,n);-1===a.index||a.multiple?-1!==a.index?this.activeIndex=a.index:-1!==a.auto&&(this.activeIndex=a.auto):(this.activeIndex=a.index,this.triggerActiveItem())}_evtPointerUp(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.triggerActiveItem())}_evtPointerMove(t){let r=N.ArrayExt.findFirstIndex(this.contentNode.children,r=>X.hitTest(r,t.clientX,t.clientY));if(r===this._activeIndex)return;if(this.activeIndex=r,(r=this.activeIndex)===this._childIndex){this._cancelOpenTimer(),this._cancelCloseTimer();return}-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let i=this.activeItem;i&&"submenu"===i.type&&i.submenu&&this._startOpenTimer()}_evtPointerEnter(t){for(let t=this._parentMenu;t;t=t._parentMenu)t._cancelOpenTimer(),t._cancelCloseTimer(),t.activeIndex=t._childIndex}_evtPointerLeave(t){if(this._cancelOpenTimer(),!this._childMenu){this.activeIndex=-1;return}let{clientX:r,clientY:i}=t;X.hitTest(this._childMenu.node,r,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtPointerDown(t){this._parentMenu||(tR.hitTestMenus(this,t.clientX,t.clientY)?(t.preventDefault(),t.stopPropagation()):this.close())}_openChildMenu(r=!1){let i=this.activeItem;if(!i||"submenu"!==i.type||!i.submenu)return void this._closeChildMenu();let n=i.submenu;if(n===this._childMenu)return;t.saveWindowData(),this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,et.sendMessage(this,e$.Msg.UpdateRequest);let a=this.contentNode.children[this._activeIndex];tR.openSubmenu(n,a),r&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout(()=>{this._openTimerID=0,this._openChildMenu()},tR.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout(()=>{this._closeTimerID=0,this._closeChildMenu()},tR.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){tR.saveWindowData()}},tb=tx||(tx={});class t_{renderItem(t){let r=this.createItemClass(t),i=this.createItemDataset(t),n=this.createItemARIA(t);return ez.li({className:r,dataset:i,tabindex:"0",onfocus:t.onfocus,...n},this.renderIcon(t),this.renderLabel(t),this.renderShortcut(t),this.renderSubmenu(t))}renderIcon(t){let r=this.createIconClass(t);return ez.div({className:r},t.item.icon,t.item.iconLabel)}renderLabel(t){let r=this.formatLabel(t);return ez.div({className:"lm-Menu-itemLabel"},r)}renderShortcut(t){let r=this.formatShortcut(t);return ez.div({className:"lm-Menu-itemShortcut"},r)}renderSubmenu(t){return ez.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(t){let r="lm-Menu-item";t.item.isEnabled||(r+=" lm-mod-disabled"),t.item.isToggled&&(r+=" lm-mod-toggled"),t.item.isVisible||(r+=" lm-mod-hidden"),t.active&&(r+=" lm-mod-active"),t.collapsed&&(r+=" lm-mod-collapsed");let i=t.item.className;return i&&(r+=` ${i}`),r}createItemDataset(t){let{type:r,command:i,dataset:n}=t.item;return"command"===r?{...n,type:r,command:i}:{...n,type:r}}createIconClass(t){let r="lm-Menu-itemIcon",i=t.item.iconClass;return i?`${r} ${i}`:r}createItemARIA(t){let r={};switch(t.item.type){case"separator":r.role="presentation";break;case"submenu":r["aria-haspopup"]="true",t.item.isEnabled||(r["aria-disabled"]="true");break;default:t.item.isEnabled||(r["aria-disabled"]="true"),t.item.isToggled?(r.role="menuitemcheckbox",r["aria-checked"]="true"):r.role="menuitem"}return r}formatLabel(t){let{label:r,mnemonic:i}=t.item;if(i<0||i>=r.length)return r;let n=r.slice(0,i),a=r.slice(i+1),o=r[i];return[n,ez.span({className:"lm-Menu-itemMnemonic"},o),a]}formatShortcut(t){let r=t.item.keyBinding;return r?eS.formatKeystroke(r.keys):null}}tb.Renderer=t_,tb.defaultRenderer=new t_,function(t){t.TIMER_DELAY=300,t.SUBMENU_OVERLAP=3;let r=null,i=0;function n(){return i>0?(i--,r):o()}function a(t){return"separator"!==t.type&&t.isEnabled&&t.isVisible}function o(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}t.saveWindowData=function(){r=o(),i++},t.createNode=function(){let t=document.createElement("div"),r=document.createElement("ul");return r.className="lm-Menu-content",t.appendChild(r),r.setAttribute("role","menu"),t.tabIndex=0,t},t.canActivate=a,t.createItem=function(t,r){return new s(t.commands,r)},t.hitTestMenus=function(t,r,i){for(let n=t;n;n=n.childMenu)if(X.hitTest(n.node,r,i))return!0;return!1},t.computeCollapsed=function(t){let r=Array(t.length);N.ArrayExt.fill(r,!1);let i=0,n=t.length;for(;i=0;--a){let i=t[a];if(i.isVisible){if("separator"!==i.type)break;r[a]=!0}}let o=!1;for(;++ih+f&&(r=h+f-v),!o&&i+x>d+p&&(i>d+p?i=d+p-x:i-=x),y.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px`,y.opacity="1"},t.openSubmenu=function(r,i){let a=n(),o=a.pageXOffset,s=a.pageYOffset,l=a.clientWidth,u=a.clientHeight;et.sendMessage(r,e$.Msg.UpdateRequest);let c=r.node,h=c.style;h.opacity="0",h.maxHeight=`${u}px`,e$.attach(r,document.body);let{width:d,height:f}=c.getBoundingClientRect(),p=X.boxSizing(r.node),m=i.getBoundingClientRect(),g=m.right-t.SUBMENU_OVERLAP;g+d>o+l&&(g=m.left+t.SUBMENU_OVERLAP-d);let y=m.top-p.borderTop-p.paddingTop;y+f>s+u&&(y=m.bottom+p.borderBottom+p.paddingBottom-f),h.transform=`translate(${Math.max(0,g)}px, ${Math.max(0,y)}px`,h.opacity="1"},t.findMnemonic=function(t,r,i){let n=-1,o=-1,s=!1,l=r.toUpperCase();for(let r=0,u=t.length;r=0&&fi.command===t&&V.JSONExt.deepEqual(i.args,r))||null}return null}}}(tR||(tR={}));var tw=tB||(tB={});function tT(t,r){let i=t.rank,n=r.rank;return i!==n?i=this._titles.length)&&(t=-1),this._currentIndex===t)return;let r=this._currentIndex,i=this._titles[r]||null,n=t,a=this._titles[n]||null;this._currentIndex=n,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:n,currentTitle:a})}get name(){return this._name}set name(t){this._name=t,t?this.contentNode.setAttribute("aria-label",t):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(t){this._orientation!==t&&(this._releaseMouse(),this._orientation=t,this.dataset.orientation=t,this.contentNode.setAttribute("aria-orientation",t))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(t){this._addButtonEnabled!==t&&(this._addButtonEnabled=t,t?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(t){return this.insertTab(this._titles.length,t)}insertTab(t,r){this._releaseMouse();let i=tj.asTitle(r),n=this._titles.indexOf(i),a=Math.max(0,Math.min(t,this._titles.length));return -1===n?(N.ArrayExt.insert(this._titles,a,i),i.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,i)):(a===this._titles.length&&a--,n===a||(N.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a))),i}removeTab(t){this.removeTabAt(this._titles.indexOf(t))}removeTabAt(t){let r=t>=0&&t-1?this._currentIndex:0;for(let t=0,r=i.length;tX.hitTest(r,t.clientX,t.clientY));if(-1===i)return;let n=this.titles[i],a=r[i].querySelector(".lm-TabBar-tabLabel");if(a&&a.contains(t.target)){let t=n.label||"",r=a.innerHTML;a.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=t,a.appendChild(i);let o=()=>{i.removeEventListener("blur",o),a.innerHTML=r,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",t=>t.stopPropagation()),i.addEventListener("blur",o),i.addEventListener("keydown",t=>{"Enter"===t.key?(""!==i.value&&(n.label=n.caption=i.value),o()):"Escape"===t.key&&o()}),this.node.removeEventListener("keydown",this),i.select(),i.focus(),a.children.length>0&&a.children[0].focus()}}_evtKeyDownCapturing(t){t.eventPhase===Event.CAPTURING_PHASE&&(t.preventDefault(),t.stopPropagation(),"Escape"===t.key&&this._releaseMouse())}_evtKeyDown(t){var r,i,n;if("Tab"!==t.key&&t.eventPhase!==Event.CAPTURING_PHASE){if("Enter"===t.key||"Spacebar"===t.key||" "===t.key){let r=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(r))t.preventDefault(),t.stopPropagation(),this._addRequested.emit();else{let i=N.ArrayExt.findFirstIndex(this.contentNode.children,t=>t.contains(r));i>=0&&(t.preventDefault(),t.stopPropagation(),this.currentIndex=i)}}else if(tM.includes(t.key)){let a,o=[...this.contentNode.children];if(this.addButtonEnabled&&o.push(this.addButtonNode),o.length<=1)return;t.preventDefault(),t.stopPropagation();let s=o.indexOf(document.activeElement);-1===s&&(s=this._currentIndex),"ArrowRight"===t.key&&"horizontal"===this._orientation||"ArrowDown"===t.key&&"vertical"===this._orientation?a=null!=(r=o[s+1])?r:o[0]:"ArrowLeft"===t.key&&"horizontal"===this._orientation||"ArrowUp"===t.key&&"vertical"===this._orientation?a=null!=(i=o[s-1])?i:o[o.length-1]:"Home"===t.key?a=o[0]:"End"===t.key&&(a=o[o.length-1]),a&&(null==(n=o[s])||n.setAttribute("tabindex","-1"),a?.setAttribute("tabindex","0"),a.focus())}}}_evtPointerDown(t){if(0!==t.button&&1!==t.button||this._dragData||t.target.classList.contains("lm-TabBar-tabInput"))return;let r=this.addButtonEnabled&&this.addButtonNode.contains(t.target),i=this.contentNode.children,n=N.ArrayExt.findFirstIndex(i,r=>X.hitTest(r,t.clientX,t.clientY));if(-1===n&&!r||(t.preventDefault(),t.stopPropagation(),this._dragData={tab:i[n],index:n,pressX:t.clientX,pressY:t.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===t.button||r))return;let a=i[n].querySelector(this.renderer.closeIconSelector);a&&a.contains(t.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===n?this.currentIndex=-1:this.currentIndex=n,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(t){let r=this._dragData;if(!r)return;t.preventDefault(),t.stopPropagation();let i=this.contentNode.children;if(!(!r.dragActive&&!tj.dragExceeded(r,t))){if(!r.dragActive){let t=r.tab.getBoundingClientRect();"horizontal"===this._orientation?(r.tabPos=r.tab.offsetLeft,r.tabSize=t.width,r.tabPressPos=r.pressX-t.left):(r.tabPos=r.tab.offsetTop,r.tabSize=t.height,r.tabPressPos=r.pressY-t.top),r.tabPressOffset={x:r.pressX-t.left,y:r.pressY-t.top},r.tabLayout=tj.snapTabLayout(i,this._orientation),r.contentRect=this.contentNode.getBoundingClientRect(),r.override=ec.overrideCursor("default"),r.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),r.dragActive=!0}if(!r.detachRequested&&tj.detachExceeded(r,t)){r.detachRequested=!0;let n=r.index,a=t.clientX,o=t.clientY,s=i[n],l=this._titles[n];if(this._tabDetachRequested.emit({index:n,title:l,tab:s,clientX:a,clientY:o,offset:r.tabPressOffset}),r.dragAborted)return}tj.layoutTabs(i,r,t,this._orientation)}}_evtPointerUp(t){if(0!==t.button&&1!==t.button)return;let r=this._dragData;if(r){if(t.preventDefault(),t.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!r.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(t.target))return void this._addRequested.emit(void 0);let i=this.contentNode.children,n=N.ArrayExt.findFirstIndex(i,r=>X.hitTest(r,t.clientX,t.clientY));if(n!==r.index)return;let a=this._titles[n];if(!a.closable)return;if(1===t.button)return void this._tabCloseRequested.emit({index:n,title:a});let o=i[n].querySelector(this.renderer.closeIconSelector);return void(o&&o.contains(t.target)&&(this._tabSizeFrozen=!0,this._tabCloseRequested.emit({index:n,title:a})))}0!==t.button||(tj.finalizeTabPosition(r,this._orientation),r.tab.classList.remove("lm-mod-dragging"),setTimeout(()=>{if(r.dragAborted)return;this._dragData=null,tj.resetTabPositions(this.contentNode.children,this._orientation),r.override.dispose(),this.removeClass("lm-mod-dragging");let t=r.index,i=r.targetIndex;-1===i||t===i||(N.ArrayExt.move(this._titles,t,i),this._adjustCurrentForMove(t,i),this._tabMoved.emit({fromIndex:t,toIndex:i,title:this._titles[i]}),et.sendMessage(this,e$.Msg.UpdateRequest))},tj.parseTransitionDuration(r.tab)))}}_releaseMouse(){let t=this._dragData;t&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),t.dragAborted=!0,t.dragActive&&(tj.resetTabPositions(this.contentNode.children,this._orientation),t.override.dispose(),t.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(t,r){let i=this.currentTitle,n=this._currentIndex,a=this.insertBehavior;if("select-tab"===a||"select-tab-if-needed"===a&&-1===n){this._currentIndex=t,this._previousTitle=i,this._currentChanged.emit({previousIndex:n,previousTitle:i,currentIndex:t,currentTitle:r});return}n>=t&&this._currentIndex++}_adjustCurrentForMove(t,r){this._currentIndex===t?this._currentIndex=r:this._currentIndex=r?this._currentIndex++:this._currentIndex>t&&this._currentIndex<=r&&this._currentIndex--}_adjustCurrentForRemove(t,r){let i=this._currentIndex,n=this.removeBehavior;if(i!==t){i>t&&this._currentIndex--;return}if(0===this._titles.length){this._currentIndex=-1,this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:-1,currentTitle:null});return}if("select-tab-after"===n){this._currentIndex=Math.min(t,this._titles.length-1),this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if("select-tab-before"===n){this._currentIndex=Math.max(0,t-1),this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if("select-previous-tab"===n){this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(t,this._titles.length-1),this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}this._currentIndex=-1,this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:-1,currentTitle:null})}_onTitleChanged(t){this.update()}_evtPointerLeave(t){if(!this._tabSizeFrozen)return;this._tabSizeFrozen=!1,this._frozenTabWidths=null,this._unfreezeRunID++;let r=this._unfreezeRunID;this._clearUnfreezeTransitionState(),this.addClass("lm-mod-unfreezing");let i=this.contentNode.children;for(let t=0,r=i.length;t{let i=t.propertyName;("width"===i||"flex-basis"===i)&&this._finalizeUnfreezeRun(r)};this._unfreezeTransitionListener=t,this.node.addEventListener("transitionend",t),this.node.addEventListener("transitioncancel",t),this._unfreezeFallbackTimerID=window.setTimeout(()=>{this._finalizeUnfreezeRun(r)},2e3)}this.update()}_setFrozenTabSize(t,r){let i=`${r}px`;t.style.width=i,t.style.flexBasis=i}_finalizeUnfreezeRun(t){t===this._unfreezeRunID&&(this._clearUnfreezeTransitionState(),this.removeClass("lm-mod-unfreezing"))}_clearUnfreezeTransitionState(){this._unfreezeTransitionListener&&(this.node.removeEventListener("transitionend",this._unfreezeTransitionListener),this.node.removeEventListener("transitioncancel",this._unfreezeTransitionListener),this._unfreezeTransitionListener=null),0!==this._unfreezeFallbackTimerID&&(clearTimeout(this._unfreezeFallbackTimerID),this._unfreezeFallbackTimerID=0)}_clearTabSizeFreezeState(){this._tabSizeFrozen=!1,this._frozenTabWidths=null,this.removeClass("lm-mod-unfreezing");let t=this.contentNode.children;for(let r=0,i=t.length;r=tI.DRAG_THRESHOLD||n>=tI.DRAG_THRESHOLD},tI.detachExceeded=function(t,r){let i=t.contentRect;return r.clientX=i.right+tI.DETACH_THRESHOLD||r.clientY=i.bottom+tI.DETACH_THRESHOLD},tI.layoutTabs=function(t,r,i,n){let a,o,s,l;"horizontal"===n?(a=r.pressX,o=i.clientX-r.contentRect.left,s=i.clientX,l=r.contentRect.width):(a=r.pressY,o=i.clientY-r.contentRect.top,s=i.clientY,l=r.contentRect.height);let u=r.index,c=o-r.tabPressPos,h=c+r.tabSize;for(let i=0,o=t.length;i>1);if(ir.index&&h>f)o=`${-r.tabSize-d.margin}px`,u=Math.max(u,i);else if(i===r.index){let t=s-a,i=l-(r.tabPos+r.tabSize);o=`${Math.max(-r.tabPos,Math.min(t,i))}px`}else o="";"horizontal"===n?t[i].style.left=o:t[i].style.top=o}r.targetIndex=u},tI.finalizeTabPosition=function(t,r){let i,n;if(i="horizontal"===r?t.contentRect.width:t.contentRect.height,t.targetIndex===t.index)n=0;else if(t.targetIndex>t.index){let r=t.tabLayout[t.targetIndex];n=r.pos+r.size-t.tabSize-t.tabPos}else n=t.tabLayout[t.targetIndex].pos-t.tabPos;let a=i-(t.tabPos+t.tabSize),o=Math.max(-t.tabPos,Math.min(n,a));"horizontal"===r?t.tab.style.left=`${o}px`:t.tab.style.top=`${o}px`},tI.resetTabPositions=function(t,r){for(let i of t)"horizontal"===r?i.style.left="":i.style.top=""};var tD,tC,tI,tL,tP,tz,tF,tO,tR,tB,tj,tN,tV=class extends eW{constructor(t){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=t.renderer,void 0!==t.spacing&&(this._spacing=e5.clampDimension(t.spacing)),this._document=t.document||document,this._hiddenMode=void 0!==t.hiddenMode?t.hiddenMode:e$.HiddenMode.Display}dispose(){let t=this[Symbol.iterator]();for(let r of(this._items.forEach(t=>{t.dispose()}),this._box=null,this._root=null,this._items.clear(),t))r.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(t){if(this._hiddenMode!==t){for(let r of(this._hiddenMode=t,this.tabBars()))if(r.titles.length>1)for(let t of r.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(t){t=e5.clampDimension(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():(0,N.empty)()}widgets(){return this._root?this._root.iterUserWidgets():(0,N.empty)()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():(0,N.empty)()}tabBars(){return this._root?this._root.iterTabBars():(0,N.empty)()}handles(){return this._root?this._root.iterHandles():(0,N.empty)()}moveHandle(t,r,i){let n,a=t.classList.contains("lm-mod-hidden");if(!this._root||a)return;let o=this._root.findSplitNode(t);o&&0!=(n="horizontal"===o.node.orientation?r-t.offsetLeft:i-t.offsetTop)&&(o.node.holdSizes(),eq.adjust(o.node.sizers,o.index,n),this.parent&&this.parent.update())}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(t){let r=new Set,i;i=t.main?tN.normalizeAreaConfig(t.main,r):null;let n=this.widgets(),a=this.tabBars(),o=this.handles();for(let t of(this._root=null,n))r.has(t)||(t.parent=null);for(let t of a)t.dispose();for(let t of o)t.parentNode&&t.parentNode.removeChild(t);for(let t of r)t.parent=this.parent;i?this._root=tN.realizeAreaConfig(i,{createTabBar:t=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):this._root=null,this.parent&&(r.forEach(t=>{this.attachWidget(t)}),this.parent.fit())}addWidget(t,r={}){let i=r.ref||null,n=r.mode||"tab-after",a=null;if(this._root&&i&&(a=this._root.findTabNode(i)),i&&!a)throw Error("Reference widget is not in the layout.");switch(t.parent=this.parent,n){case"tab-after":this._insertTab(t,i,a,!0);break;case"tab-before":this._insertTab(t,i,a,!1);break;case"split-top":this._insertSplit(t,i,a,"vertical",!1);break;case"split-left":this._insertSplit(t,i,a,"horizontal",!1);break;case"split-right":this._insertSplit(t,i,a,"horizontal",!0);break;case"split-bottom":this._insertSplit(t,i,a,"vertical",!0);break;case"merge-top":this._insertSplit(t,i,a,"vertical",!1,!0);break;case"merge-left":this._insertSplit(t,i,a,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(t,i,a,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(t,i,a,"vertical",!0,!0)}this.parent&&(this.attachWidget(t),this.parent.fit())}removeWidget(t){this._removeWidget(t),this.parent&&(this.detachWidget(t),this.parent.fit())}hitTestTabAreas(t,r){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=X.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=t-i.left-this._box.borderLeft,a=r-i.top-this._box.borderTop,o=this._root.hitTestTabNodes(n,a);if(!o)return null;let{tabBar:s,top:l,left:u,width:c,height:h}=o,d=this._box.borderLeft+this._box.borderRight,f=this._box.borderTop+this._box.borderBottom,p=i.width-d-(u+c),m=i.height-f-(l+h);return{tabBar:s,x:n,y:a,top:l,left:u,right:p,bottom:m,width:c,height:h}}init(){for(let t of(super.init(),this))this.attachWidget(t);for(let t of this.handles())this.parent.node.appendChild(t);this.parent.fit()}attachWidget(t){this.parent.node!==t.node.parentNode&&(this._items.set(t,new eQ(t)),this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterAttach))}detachWidget(t){if(this.parent.node!==t.node.parentNode)return;this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterDetach);let r=this._items.get(t);r&&(this._items.delete(t),r.dispose())}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_removeWidget(t){if(!this._root)return;let r=this._root.findTabNode(t);if(!r)return;if(tN.removeAria(t),r.tabBar.titles.length>1){r.tabBar.removeTab(t.title),this._hiddenMode===e$.HiddenMode.Scale&&1==r.tabBar.titles.length&&(r.tabBar.titles[0].owner.hiddenMode=e$.HiddenMode.Display);return}if(r.tabBar.dispose(),this._root===r){this._root=null;return}this._root.holdAllSizes();let i=r.parent;r.parent=null;let n=N.ArrayExt.removeFirstOf(i.children,r),a=N.ArrayExt.removeAt(i.handles,n);if(N.ArrayExt.removeAt(i.sizers,n),a.parentNode&&a.parentNode.removeChild(a),i.children.length>1)return void i.syncHandles();let o=i.parent;i.parent=null;let s=i.children[0],l=i.handles[0];if(i.children.length=0,i.handles.length=0,i.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===i){s.parent=null,this._root=s;return}let u=o.children.indexOf(i);if(s instanceof tN.TabLayoutNode){s.parent=o,o.children[u]=s;return}let c=N.ArrayExt.removeAt(o.handles,u);N.ArrayExt.removeAt(o.children,u),N.ArrayExt.removeAt(o.sizers,u),c.parentNode&&c.parentNode.removeChild(c);for(let t=0,r=s.children.length;t=i.length)&&(n=0),{type:"tab-area",widgets:i,currentIndex:n}}(r,i):function(r,i){let n=r.orientation,a=[],o=[];for(let s=0,l=r.children.length;s{let n=a(t,c,h),o=r(u.sizes[i]),s=c.createHandle();d.children.push(n),d.handles.push(s),d.sizers.push(o),n.parent=d}),d.syncHandles(),d.normalizeSizes(),d)};class i{constructor(t){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let r=new eG,i=new eG;r.stretch=0,i.stretch=1,this.tabBar=t,this.sizers=[r,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(let t of this.tabBar.titles)yield t.owner}*iterSelectedWidgets(){let t=this.tabBar.currentTitle;t&&(yield t.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(t){return -1!==this.tabBar.titles.indexOf(t.title)?this:null}findSplitNode(t){return null}findFirstTabNode(){return this}hitTestTabNodes(t,r){return t=this._left+this._width||r=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map(t=>t.owner),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(t,r){let i=0,n=0,a=r.get(this.tabBar),o=this.tabBar.currentTitle,s=o?r.get(o.owner):void 0,[l,u]=this.sizers;return a&&a.fit(),s&&s.fit(),a&&!a.isHidden?(i=Math.max(i,a.minWidth),n+=a.minHeight,l.minSize=a.minHeight,l.maxSize=a.maxHeight):(l.minSize=0,l.maxSize=0),s&&!s.isHidden?(i=Math.max(i,s.minWidth),n+=s.minHeight,u.minSize=s.minHeight):u.minSize=0,u.maxSize=1/0,{minWidth:i,minHeight:n,maxWidth:1/0,maxHeight:1/0}}update(t,r,i,n,a,o){this._top=r,this._left=t,this._width=i,this._height=n;let s=o.get(this.tabBar),l=this.tabBar.currentTitle,u=l?o.get(l.owner):void 0;if(eq.calc(this.sizers,n),s&&!s.isHidden){let n=this.sizers[0].size;s.update(t,r,i,n),r+=n}if(u&&!u.isHidden){let n=this.sizers[1].size;u.update(t,r,i,n)}}}t.TabLayoutNode=i;class n{constructor(t){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=t}*iterAllWidgets(){for(let t of this.children)yield*t.iterAllWidgets()}*iterUserWidgets(){for(let t of this.children)yield*t.iterUserWidgets()}*iterSelectedWidgets(){for(let t of this.children)yield*t.iterSelectedWidgets()}*iterTabBars(){for(let t of this.children)yield*t.iterTabBars()}*iterHandles(){for(let t of(yield*this.handles,this.children))yield*t.iterHandles()}findTabNode(t){for(let r=0,i=this.children.length;rt.createConfig()),sizes:r}}syncHandles(){this.handles.forEach((t,r)=>{t.setAttribute("data-orientation",this.orientation),r===this.handles.length-1?t.classList.add("lm-mod-hidden"):t.classList.remove("lm-mod-hidden")})}holdSizes(){for(let t of this.sizers)t.sizeHint=t.size}holdAllSizes(){for(let t of this.children)t.holdAllSizes();this.holdSizes()}normalizeSizes(){let t=this.sizers.length;if(0===t)return;this.holdSizes();let r=this.sizers.reduce((t,r)=>t+r.sizeHint,0);if(0===r)for(let r of this.sizers)r.size=r.sizeHint=1/t;else for(let t of this.sizers)t.size=t.sizeHint/=r;this.normalized=!0}createNormalizedSizes(){let t=this.sizers.length;if(0===t)return[];let r=this.sizers.map(t=>t.size),i=r.reduce((t,r)=>t+r,0);if(0===i)for(let i=r.length-1;i>-1;i--)r[i]=1/t;else for(let t=r.length-1;t>-1;t--)r[t]/=i;return r}fit(t,r){let i="horizontal"===this.orientation,n=Math.max(0,this.children.length-1)*t,a=i?n:0,o=i?0:n;for(let n=0,s=this.children.length;nthis._createTabBar(),createHandle:()=>this._createHandle()},spacing:r.spacing,hiddenMode:r.hiddenMode}),this.overlay=r.overlay||new t.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(t){this.layout.hiddenMode=t}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(t){this.layout.spacing=t}get mode(){return this._mode}set mode(t){if(this._mode===t)return;this._mode=t,this.dataset.mode=t;let r=this.layout;switch(t){case"multiple-document":for(let t of r.tabBars())t.show();break;case"single-document":r.restoreLayout(w.createSingleDocumentConfig(this));break;default:throw"unreachable"}et.postMessage(this,w.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(t){for(let r of(this._tabsMovable=t,this.tabBars()))r.tabsMovable=t}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(t){this._tabsConstrained=t}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(t){for(let r of(this._addButtonEnabled=t,this.tabBars()))r.addButtonEnabled=t}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(t){let r=(0,N.find)(this.tabBars(),r=>-1!==r.titles.indexOf(t.title));if(!r)throw Error("Widget is not contained in the dock panel.");r.currentTitle=t.title}activateWidget(t){this.selectWidget(t),t.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(t){this._mode="multiple-document",this.layout.restoreLayout(t),(K.IS_EDGE||K.IS_IE)&&et.flush(),et.postMessage(this,w.LayoutModified)}addWidget(t,r={}){"single-document"===this._mode?this.layout.addWidget(t):this.layout.addWidget(t,r),et.postMessage(this,w.LayoutModified)}processMessage(t){"layout-modified"===t.type?this._layoutModified.emit(void 0):super.processMessage(t)}handleEvent(t){switch(t.type){case"lm-dragenter":this._evtDragEnter(t);break;case"lm-dragleave":this._evtDragLeave(t);break;case"lm-dragover":this._evtDragOver(t);break;case"lm-drop":this._evtDrop(t);break;case"pointerdown":this._evtPointerDown(t);break;case"pointermove":this._evtPointerMove(t);break;case"pointerup":this._evtPointerUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}}onBeforeAttach(t){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(t){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(t){w.isGeneratedTabBarProperty.get(t.child)||t.child.addClass("lm-DockPanel-widget")}onChildRemoved(t){w.isGeneratedTabBarProperty.get(t.child)||(t.child.removeClass("lm-DockPanel-widget"),et.postMessage(this,w.LayoutModified))}_evtDragEnter(t){t.mimeData.hasData("application/vnd.lumino.widget-factory")&&(t.preventDefault(),t.stopPropagation())}_evtDragLeave(t){t.preventDefault(),this._tabsConstrained&&t.source!==this||(t.stopPropagation(),this.overlay.hide(1))}_evtDragOver(t){t.preventDefault(),this._tabsConstrained&&t.source!==this||"invalid"===this._showOverlay(t.clientX,t.clientY)?t.dropAction="none":(t.stopPropagation(),t.dropAction=t.proposedAction)}_evtDrop(t){if(t.preventDefault(),this.overlay.hide(0),"none"===t.proposedAction){t.dropAction="none";return}let{clientX:r,clientY:i}=t,{zone:n,target:a}=w.findDropTarget(this,r,i,this._edges);if(this._tabsConstrained&&t.source!==this||"invalid"===n){t.dropAction="none";return}let o=t.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof o){t.dropAction="none";return}let s=o();if(!(s instanceof e$)||s.contains(this)){t.dropAction="none";return}let l=a?w.getDropRef(a.tabBar):null;switch(n){case"root-all":this.addWidget(s);break;case"root-top":this.addWidget(s,{mode:"split-top"});break;case"root-left":this.addWidget(s,{mode:"split-left"});break;case"root-right":this.addWidget(s,{mode:"split-right"});break;case"root-bottom":this.addWidget(s,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(s,{mode:"tab-after",ref:l});break;case"widget-top":this.addWidget(s,{mode:"split-top",ref:l});break;case"widget-left":this.addWidget(s,{mode:"split-left",ref:l});break;case"widget-right":this.addWidget(s,{mode:"split-right",ref:l});break;case"widget-bottom":this.addWidget(s,{mode:"split-bottom",ref:l});break;default:throw"unreachable"}t.dropAction=t.proposedAction,t.stopPropagation(),this.activateWidget(s)}_evtKeyDown(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&(this._releaseMouse(),et.postMessage(this,w.LayoutModified))}_evtPointerDown(t){if(0!==t.button)return;let r=this.layout,i=t.target,n=(0,N.find)(r.handles(),t=>t.contains(i));if(!n)return;t.preventDefault(),t.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),o=t.clientX-a.left,s=t.clientY-a.top,l=window.getComputedStyle(n),u=ec.overrideCursor(l.cursor,this._document);this._pressData={handle:n,deltaX:o,deltaY:s,override:u}}_evtPointerMove(t){if(!this._pressData)return;t.preventDefault(),t.stopPropagation();let r=this.node.getBoundingClientRect(),i=t.clientX-r.left-this._pressData.deltaX,n=t.clientY-r.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,n)}_evtPointerUp(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse(),et.postMessage(this,w.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(t,r){let{zone:i,target:n}=w.findDropTarget(this,t,r,this._edges);if("invalid"===i)return this.overlay.hide(100),i;let a,o,s,l,u=X.boxSizing(this.node),c=this.node.getBoundingClientRect();switch(i){case"root-all":a=u.paddingTop,o=u.paddingLeft,s=u.paddingRight,l=u.paddingBottom;break;case"root-top":a=u.paddingTop,o=u.paddingLeft,s=u.paddingRight,l=c.height*w.GOLDEN_RATIO;break;case"root-left":a=u.paddingTop,o=u.paddingLeft,s=c.width*w.GOLDEN_RATIO,l=u.paddingBottom;break;case"root-right":a=u.paddingTop,o=c.width*w.GOLDEN_RATIO,s=u.paddingRight,l=u.paddingBottom;break;case"root-bottom":a=c.height*w.GOLDEN_RATIO,o=u.paddingLeft,s=u.paddingRight,l=u.paddingBottom;break;case"widget-all":a=n.top,o=n.left,s=n.right,l=n.bottom;break;case"widget-top":a=n.top,o=n.left,s=n.right,l=n.bottom+n.height/2;break;case"widget-left":a=n.top,o=n.left,s=n.right+n.width/2,l=n.bottom;break;case"widget-right":a=n.top,o=n.left+n.width/2,s=n.right,l=n.bottom;break;case"widget-bottom":a=n.top+n.height/2,o=n.left,s=n.right,l=n.bottom;break;case"widget-tab":{let t=n.tabBar.node.getBoundingClientRect().height;a=n.top,o=n.left,s=n.right,l=n.bottom+n.height-t;break}default:throw"unreachable"}return this.overlay.show({top:a,left:o,right:s,bottom:l}),i}_createTabBar(){let t=this._renderer.createTabBar(this._document);return w.isGeneratedTabBarProperty.set(t,!0),"single-document"===this._mode&&t.hide(),t.tabsMovable=this._tabsMovable,t.allowDeselect=!1,t.addButtonEnabled=this._addButtonEnabled,t.removeBehavior="select-previous-tab",t.insertBehavior="select-tab-if-needed",t.tabMoved.connect(this._onTabMoved,this),t.currentChanged.connect(this._onCurrentChanged,this),t.tabCloseRequested.connect(this._onTabCloseRequested,this),t.tabDetachRequested.connect(this._onTabDetachRequested,this),t.tabActivateRequested.connect(this._onTabActivateRequested,this),t.addRequested.connect(this._onTabAddRequested,this),t}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){et.postMessage(this,w.LayoutModified)}_onCurrentChanged(t,r){let{previousTitle:i,currentTitle:n}=r;i&&i.owner.hide(),n&&n.owner.show(),(K.IS_EDGE||K.IS_IE)&&et.flush(),et.postMessage(this,w.LayoutModified)}_onTabAddRequested(t){this._addRequested.emit(t)}_onTabActivateRequested(t,r){r.title.owner.activate()}_onTabCloseRequested(t,r){r.title.owner.close()}_onTabDetachRequested(t,r){if(this._drag)return;t.releaseMouse();let{title:i,tab:n,clientX:a,clientY:o,offset:s}=r,l=new V.MimeData;l.setData("application/vnd.lumino.widget-factory",()=>i.owner);let u=n.cloneNode(!0);s&&(u.style.top=`-${s.y}px`,u.style.left=`-${s.x}px`),this._drag=new ec({document:this._document,mimeData:l,dragImage:u,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");let c=()=>{this._drag=null,n.classList.remove("lm-mod-hidden")};this._drag.start(a,o).then(c)}},tq=tU||(tU={});tq.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(t){let r=this.node.style;r.top=`${t.top}px`,r.left=`${t.left}px`,r.right=`${t.right}px`,r.bottom=`${t.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(t){if(!this._hidden){if(t<=0){clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden");return}-1===this._timer&&(this._timer=window.setTimeout(()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")},t))}}};class tG{createTabBar(t){let r=new tk({document:t});return r.addClass("lm-DockPanel-tabBar"),r}createHandle(){let t=document.createElement("div");return t.className="lm-DockPanel-handle",t}}tq.Renderer=tG,tq.defaultRenderer=new tG,(g=w||(w={})).GOLDEN_RATIO=.618,g.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},g.LayoutModified=new ei("layout-modified"),g.isGeneratedTabBarProperty=new en({name:"isGeneratedTabBar",create:()=>!1}),g.createSingleDocumentConfig=function(t){if(t.isEmpty)return{main:null};let r=Array.from(t.widgets()),i=t.selectedWidgets().next().value,n=i?r.indexOf(i):-1;return{main:{type:"tab-area",widgets:r,currentIndex:n}}},g.findDropTarget=function(t,r,i,n){let a;if(!X.hitTest(t.node,r,i))return{zone:"invalid",target:null};let o=t.layout;if(o.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===t.mode){let a=t.node.getBoundingClientRect(),o=r-a.left+1,s=i-a.top+1,l=a.right-r,u=a.bottom-i;switch(Math.min(s,l,u,o)){case s:if(sd&&c>d&&u>f&&h>f)return{zone:"widget-all",target:s};switch(l/=d,u/=f,Math.min(l,u,c/=d,h/=f)){case l:a="widget-left";break;case u:a="widget-top";break;case c:a="widget-right";break;case h:a="widget-bottom";break;default:throw"unreachable"}return{zone:a,target:s}},g.getDropRef=function(t){return 0===t.titles.length?null:t.currentTitle?t.currentTitle.owner:t.titles[t.titles.length-1].owner};var tH=class t extends eW{constructor(t={}){super(t),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new eG],this._columnSizers=[new eG],this._box=null,void 0!==t.rowCount&&T.reallocSizers(this._rowSizers,t.rowCount),void 0!==t.columnCount&&T.reallocSizers(this._columnSizers,t.columnCount),void 0!==t.rowSpacing&&(this._rowSpacing=T.clampValue(t.rowSpacing)),void 0!==t.columnSpacing&&(this._columnSpacing=T.clampValue(t.columnSpacing))}dispose(){for(let t of this._items){let r=t.widget;t.dispose(),r.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(t){t!==this.rowCount&&(T.reallocSizers(this._rowSizers,t),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(t){t!==this.columnCount&&(T.reallocSizers(this._columnSizers,t),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(t){t=T.clampValue(t),this._rowSpacing!==t&&(this._rowSpacing=t,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(t){t=T.clampValue(t),this._columnSpacing!==t&&(this._columnSpacing=t,this.parent&&this.parent.fit())}rowStretch(t){let r=this._rowSizers[t];return r?r.stretch:-1}setRowStretch(t,r){let i=this._rowSizers[t];i&&(r=T.clampValue(r),i.stretch!==r&&(i.stretch=r,this.parent&&this.parent.update()))}columnStretch(t){let r=this._columnSizers[t];return r?r.stretch:-1}setColumnStretch(t,r){let i=this._columnSizers[t];i&&(r=T.clampValue(r),i.stretch!==r&&(i.stretch=r,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(let t of this._items)yield t.widget}addWidget(t){-1===N.ArrayExt.findFirstIndex(this._items,r=>r.widget===t)&&(this._items.push(new eQ(t)),this.parent&&this.attachWidget(t))}removeWidget(t){let r=N.ArrayExt.findFirstIndex(this._items,r=>r.widget===t);if(-1===r)return;let i=N.ArrayExt.removeAt(this._items,r);this.parent&&this.detachWidget(t),i.dispose()}init(){for(let t of(super.init(),this))this.attachWidget(t)}attachWidget(t){this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterAttach),this.parent.fit()}detachWidget(t){this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterDetach),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_fit(){for(let t=0,r=this.rowCount;t!t.isHidden);for(let t=0,i=r.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(t){t.parent&&t.parent.layout instanceof tH&&t.parent.fit()}}),v.normalizeConfig=function(t){return{row:Math.max(0,Math.floor(t.row||0)),column:Math.max(0,Math.floor(t.column||0)),rowSpan:Math.max(1,Math.floor(t.rowSpan||0)),columnSpan:Math.max(1,Math.floor(t.columnSpan||0))}},v.clampValue=function(t){return Math.max(0,Math.floor(t))},v.rowSpanCmp=function(t,r){let i=v.cellConfigProperty.get(t.widget),n=v.cellConfigProperty.get(r.widget);return i.rowSpan-n.rowSpan},v.columnSpanCmp=function(t,r){let i=v.cellConfigProperty.get(t.widget),n=v.cellConfigProperty.get(r.widget);return i.columnSpan-n.columnSpan},v.reallocSizers=function(t,r){for(r=Math.max(1,Math.floor(r));t.lengthr&&(t.length=r)},v.distributeMin=function(t,r,i,n){if(i=n)return;let o=(n-a)/(i-r+1);for(let n=r;n<=i;++n)t[n].minSize+=o};var t$=class t extends e${constructor(r={}){super({node:A.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(e$.Flag.DisallowLayout),this.renderer=r.renderer||t.defaultRenderer,this._forceItemsPosition=r.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=r.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(t){this.activeIndex=t?this._menus.indexOf(t):-1}get activeIndex(){return this._activeIndex}set activeIndex(t){(t<0||t>=this._menus.length)&&(t=-1),t>-1&&0===this._menus[t].items.length&&(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(t,r=!0){this.insertMenu(this._menus.length,t,r)}insertMenu(t,r,i=!0){this._closeChildMenu();let n=this._menus.indexOf(r),a=Math.max(0,Math.min(t,this._menus.length));if(-1===n){N.ArrayExt.insert(this._menus,a,r),r.addClass("lm-MenuBar-menu"),r.aboutToClose.connect(this._onMenuAboutToClose,this),r.menuRequested.connect(this._onMenuMenuRequested,this),r.title.changed.connect(this._onTitleChanged,this),i&&this.update();return}a===this._menus.length&&a--,n!==a&&(N.ArrayExt.move(this._menus,n,a),i&&this.update())}removeMenu(t,r=!0){this.removeMenuAt(this._menus.indexOf(t),r)}removeMenuAt(t,r=!0){this._closeChildMenu();let i=N.ArrayExt.removeAt(this._menus,t);i&&(i.aboutToClose.disconnect(this._onMenuAboutToClose,this),i.menuRequested.disconnect(this._onMenuMenuRequested,this),i.title.changed.disconnect(this._onTitleChanged,this),i.removeClass("lm-MenuBar-menu"),r&&this.update())}clearMenus(){if(0!==this._menus.length){for(let t of(this._closeChildMenu(),this._menus))t.aboutToClose.disconnect(this._onMenuAboutToClose,this),t.menuRequested.disconnect(this._onMenuMenuRequested,this),t.title.changed.disconnect(this._onTitleChanged,this),t.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(t){switch(t.type){case"keydown":this._evtKeyDown(t);break;case"pointerdown":this._evtPointerDown(t);break;case"pointermove":case"pointerleave":this._evtPointerMove(t);break;case"focusout":this._evtFocusOut(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}}onBeforeAttach(t){this.node.addEventListener("keydown",this),this.node.addEventListener("pointerdown",this),this.node.addEventListener("pointermove",this),this.node.addEventListener("pointerleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(t){this.node.removeEventListener("keydown",this),this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("pointermove",this),this.node.removeEventListener("pointerleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(t){this.isAttached&&this._focusItemAt(0)}onResize(t){this.update(),super.onResize(t)}onUpdateRequest(t){var r;let i=this._menus,n=this.renderer,a=this._activeIndex,o=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:i.length,l=0,u=!1,c=Array(s=null!==this._overflowMenu?s-1:s);for(let t=0;t{this._tabFocusIndex=t,this.activeIndex=t}}),l+=this._menuItemSizes[t],i[t].title.label===this._overflowMenuOptions.title&&(u=!0,s--);if(this._overflowMenuOptions.isVisible){if(this._overflowIndex>-1&&!u){if(null===this._overflowMenu){let t=null!=(r=this._overflowMenuOptions.title)?r:"...";this._overflowMenu=new tx({commands:new eS}),this._overflowMenu.title.label=t,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let t=i.length-2;t>=s;t--){let r=this.menus[t];r.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:r}),this.removeMenu(r,!1)}c[s]=n.renderItem({title:this._overflowMenu.title,active:s===a&&0!==i[s].items.length,tabbable:s===o,disabled:0===i[s].items.length,onfocus:()=>{this._tabFocusIndex=s,this.activeIndex=s}}),s++}else if(null!==this._overflowMenu){let t=this._overflowMenu.items,r=this.node.offsetWidth,a=this._overflowMenu.items.length;for(let u=0;uthis._menuItemSizes[a]){let r=t[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(s,r,!1),c[s]=n.renderItem({title:r.title,active:!1,tabbable:s===o,disabled:0===i[s].items.length,onfocus:()=>{this._tabFocusIndex=s,this.activeIndex=s}}),s++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}}eV.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;let t=this.contentNode.childNodes,r=this.node.offsetWidth,i=0,n=-1,a=t.length;if(0==this._menuItemSizes.length)for(let o=0;or&&-1===n&&(n=o)}else for(let t=0;tr){n=t;break}this._overflowIndex=n}_evtKeyDown(t){let r=t.keyCode;if(9===r){this.activeIndex=-1;return}if(t.preventDefault(),t.stopPropagation(),13===r||32===r||38===r||40===r){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;this.openActiveMenu();return}if(27===r){this._closeChildMenu(),this._focusItemAt(this.activeIndex);return}if(37===r||39===r){let t=37===r?-1:1,i=this._tabFocusIndex+t,n=this._menus.length;for(let r=0;rX.hitTest(r,t.clientX,t.clientY));if(-1===r)return void this._closeChildMenu();if(0===t.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=r;else{t.preventDefault();let i=this._positionForMenu(r);tx.saveWindowData(),this.activeIndex=r,this._openChildMenu(i)}}_evtPointerMove(t){let r=N.ArrayExt.findFirstIndex(this.contentNode.children,r=>X.hitTest(r,t.clientX,t.clientY));if(r===this._activeIndex||-1===r&&this._childMenu)return;let i=r>=0&&this._childMenu?this._positionForMenu(r):null;tx.saveWindowData(),this.activeIndex=r,i&&this._openChildMenu(i)}_positionForMenu(t){let{left:r,bottom:i}=this.contentNode.children[t].getBoundingClientRect();return{top:i,left:r}}_evtFocusOut(t){this._childMenu||this.node.contains(t.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(t){let r=this.contentNode.childNodes[t];r&&r.focus()}_openChildMenu(t={}){let r=this.activeMenu;if(!r)return void this._closeChildMenu();let i=this._childMenu;if(i===r)return;this._childMenu=r,i?i.close():document.addEventListener("pointerdown",this,!0),this._tabFocusIndex=this.activeIndex,et.sendMessage(this,e$.Msg.UpdateRequest);let{left:n,top:a}=t;(typeof n>"u"||typeof a>"u")&&({left:n,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),r.items.length>0&&r.open(n,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0);let t=this._childMenu;this._childMenu=null,t.close(),this.activeIndex=-1}_onMenuAboutToClose(t){t===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(t,r){if(t!==this._childMenu)return;let i=this._activeIndex,n=this._menus.length;switch(r){case"next":this.activeIndex=i===n-1?0:i+1;break;case"previous":this.activeIndex=0===i?n-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}},tW=t$||(t$={});class tY{renderItem(t){let r=this.createItemClass(t),i=this.createItemDataset(t),n=this.createItemARIA(t);return ez.li({className:r,dataset:i,...t.disabled?{}:{tabindex:t.tabbable?"0":"-1"},onfocus:t.onfocus,...n},this.renderIcon(t),this.renderLabel(t))}renderIcon(t){let r=this.createIconClass(t);return ez.div({className:r},t.title.icon,t.title.iconLabel)}renderLabel(t){let r=this.formatLabel(t);return ez.div({className:"lm-MenuBar-itemLabel"},r)}createItemClass(t){let r="lm-MenuBar-item";return t.title.className&&(r+=` ${t.title.className}`),t.active&&!t.disabled&&(r+=" lm-mod-active"),r}createItemDataset(t){return t.title.dataset}createItemARIA(t){return{role:"menuitem","aria-haspopup":"true","aria-disabled":t.disabled?"true":"false"}}createIconClass(t){let r="lm-MenuBar-itemIcon",i=t.title.iconClass;return i?`${r} ${i}`:r}formatLabel(t){let{label:r,mnemonic:i}=t.title;if(i<0||i>=r.length)return r;let n=r.slice(0,i),a=r.slice(i+1),o=r[i];return[n,ez.span({className:"lm-MenuBar-itemMnemonic"},o),a]}}tW.Renderer=tY,tW.defaultRenderer=new tY,(x=A||(A={})).createNode=function(){let t=document.createElement("div"),r=document.createElement("ul");return r.className="lm-MenuBar-content",t.appendChild(r),r.setAttribute("role","menubar"),t},x.findMnemonic=function(t,r,i){let n=-1,a=-1,o=!1,s=r.toUpperCase();for(let r=0,l=t.length;r=0&&h1&&this.widgets.forEach(t=>{t.hiddenMode=this._hiddenMode}))}dispose(){for(let t of this._items)t.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(t,r){this._hiddenMode===e$.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=e$.HiddenMode.Scale),r.hiddenMode=e$.HiddenMode.Scale):r.hiddenMode=e$.HiddenMode.Display,N.ArrayExt.insert(this._items,t,new eQ(r)),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach),this.parent.fit()}moveWidget(t,r,i){N.ArrayExt.move(this._items,t,r),this.parent.update()}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._items,t);this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach),i.widget.node.style.zIndex="",this._hiddenMode===e$.HiddenMode.Scale&&(r.hiddenMode=e$.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=e$.HiddenMode.Display)),i.dispose(),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_fit(){let t=0,r=0;for(let i=0,n=this._items.length;i{this.createGraph(this._model)})}renderModel(t){if(this.hasGraphElement())return Promise.resolve();this._model=t;let r=t.data["image/png"];return null!=r?(this.updateImage(r),Promise.resolve()):this.createGraph(t)}hasGraphElement(){return null!==this.node.querySelector(".plot-container")}updateImage(t){this.hideGraph(),this._img_el.src="data:image/png;base64,"+t,this.showImage()}hideGraph(){let t=this.node.querySelector(".plot-container");null!=t&&(t.style.display="none")}showGraph(){let t=this.node.querySelector(".plot-container");null!=t&&(t.style.display="block")}hideImage(){let t=this.node.querySelector(".plot-img");null!=t&&(t.style.display="none")}showImage(){let t=this.node.querySelector(".plot-img");null!=t&&(t.style.display="block")}createGraph(r){let{data:i,layout:n,frames:a,config:o}=r.data[this._mimeType];return n.height||(n.height=360),(async()=>(null===t.Plotly&&(t.Plotly=await Promise.resolve().then(()=>O(j())),t._resolveLoadingPlotly()),t.loadingPlotly))().then(()=>t.Plotly.react(this.node,i,n,o)).then(i=>{this.showGraph(),this.hideImage(),this.update(),a&&t.Plotly.addFrames(this.node,a),this.node.offsetWidth>0&&this.node.offsetHeight>0&&t.Plotly.toImage(i,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then(t=>{let i=t.split(",")[1];r.data["image/png"]!==i&&r.setData({data:{...r.data,"image/png":i}})}),this.node.on("plotly_webglcontextlost",()=>{let t=r.data["image/png"];if(null!=t)return this.updateImage(t),Promise.resolve()})})}onAfterShow(t){this.update()}onResize(t){this.update()}onUpdateRequest(r){t.Plotly&&this.isVisible&&this.hasGraphElement()&&t.Plotly.redraw(this.node).then(()=>{t.Plotly.Plots.resize(this.node)})}static{this.Plotly=null}static{this.loadingPlotly=new Promise(r=>{t._resolveLoadingPlotly=r})}},tJ={safe:!0,mimeTypes:[tX],createRenderer:t=>new tK(t)},tQ=[{id:"@jupyterlab/plotly-extension:factory",rendererFactory:tJ,rank:2,dataType:"json",fileTypes:[{name:"plotly",mimeTypes:[tX],extensions:[".plotly",".plotly.json"],iconClass:"jp-MaterialIcon jp-PlotlyIcon"}],documentWidgetFactoryOptions:{name:"Plotly",primaryFileType:"plotly",fileTypes:["plotly","json"],defaultFor:["plotly"]}}];i.d(r,{MIME_TYPE:()=>tX,RenderedPlotly:()=>tK,default:()=>tQ,rendererFactory:()=>tJ})},3(t){var r,i,n,a=t.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}function l(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(i){try{return r.call(null,t,0)}catch(i){return r.call(this,t,0)}}}var u=[],c=!1,h=-1;function d(){c&&n&&(c=!1,n.length?u=n.concat(u):h=-1,u.length&&f())}function f(){if(!c){var t=l(d);c=!0;for(var r=u.length;r;){for(n=u,u=[];++h1)for(var i=1;i=0&&(this.attributes[t]={location:r,isInteger:M.has(t)})}for(let t of(c.deleteShader(T),c.deleteShader(w),v))if(t&&!A[t]){let r=c.getUniformLocation(this.program,t);r&&(A[t]=r)}this.fixedUniforms=n(t,A),this.terrainUniforms=((t,r)=>({u_depth:new ER(t,r.u_depth),u_terrain:new ER(t,r.u_terrain)}))(t,A),this.binderUniforms=i?i.getUniforms(t,A):[]}draw(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m,g,y,v,x){var b,_,w;let T,A=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(i),t.setStencilMode(n),t.setColorMode(a),t.setCullFace(o),l){let r;for(let r in t.activeTexture.set(A.TEXTURE2),A.bindTexture(A.TEXTURE_2D,l.depthTexture),t.activeTexture.set(A.TEXTURE3),A.bindTexture(A.TEXTURE_2D,l.texture),this.terrainUniforms)this.terrainUniforms[r].set(l[r]);_=t.terrainUniformBuffer,(r=_.pending).set(l.u_terrain_matrix,O3.u_terrain_matrix),r.set(l.u_terrain_unpack,O3.u_terrain_unpack),r[O3.u_terrain_dim]=l.u_terrain_dim,r[O3.u_terrain_exaggeration]=l.u_terrain_exaggeration,_.upload()}if(u&&(w=t.projectionUniformBuffer,(T=w.pending).set(u.mainMatrix,O1.u_projection_matrix),T.set(u.fallbackMatrix,O1.u_projection_fallback_matrix),T.set(u.tileMercatorCoords,O1.u_projection_tile_mercator_coords),T.set(u.clippingPlane,O1.u_projection_clipping_plane),T[O1.u_projection_transition]=u.projectionTransition,w.pendingWords[O1.u_projection_clip_antimeridian]=+!!u.clipAntimeridian,w.upload()),s)for(let t in this.fixedUniforms)this.fixedUniforms[t].set(s[t]);g&&g.setUniforms(t,this.binderUniforms,p,{zoom:m});let M=0;switch(r){case A.LINES:M=2;break;case A.TRIANGLES:M=3;break;case A.LINE_STRIP:M=1}for(let i of f.get())i.vaos||(i.vaos={}),(b=i.vaos)[c]||(b[c]=new O$),i.vaos[c].bind(t,this,h,g?g.getPaintVertexBuffers():[],d,i.vertexOffset,y,v,x),A.drawElements(r,i.primitiveLength*M,A.UNSIGNED_SHORT,i.primitiveOffset*M*2)}},O4=(t,r)=>({u_lightpos:new EN(t,r.u_lightpos),u_lightpos_globe:new EN(t,r.u_lightpos_globe),u_lightintensity:new EB(t,r.u_lightintensity),u_lightcolor:new EN(t,r.u_lightcolor),u_vertical_gradient:new EB(t,r.u_vertical_gradient),u_opacity:new EB(t,r.u_opacity),u_fill_translate:new Ej(t,r.u_fill_translate)}),O6=(t,r)=>({u_lightpos:new EN(t,r.u_lightpos),u_lightpos_globe:new EN(t,r.u_lightpos_globe),u_lightintensity:new EB(t,r.u_lightintensity),u_lightcolor:new EN(t,r.u_lightcolor),u_vertical_gradient:new EB(t,r.u_vertical_gradient),u_height_factor:new EB(t,r.u_height_factor),u_opacity:new EB(t,r.u_opacity),u_fill_translate:new Ej(t,r.u_fill_translate),u_image:new ER(t,r.u_image),u_texsize:new Ej(t,r.u_texsize),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade)}),O8=(t,r,i,n)=>{var a,o,s,l,u,c;let h=t.style.light,d=h.getCartesianPosition(),f=vd();"viewport"===h.properties.get("anchor")&&(o=Math.sin(a=t.transform.bearingInRadians),s=Math.cos(a),f[0]=s,f[1]=o,f[2]=0,f[3]=-o,f[4]=s,f[5]=0,f[6]=0,f[7]=0,f[8]=1),l=d[0],u=d[1],c=d[2],d[0]=l*f[0]+u*f[3]+c*f[6],d[1]=l*f[1]+u*f[4]+c*f[7],d[2]=l*f[2]+u*f[5]+c*f[8];let p=t.transform.transformLightDirection(d),m=h.properties.get("color");return{u_lightpos:d,u_lightpos_globe:p,u_lightintensity:h.properties.get("intensity"),u_lightcolor:[m.r,m.g,m.b],u_vertical_gradient:+r,u_opacity:i,u_fill_translate:n}},O7=(t,r,i,n,a,o,s)=>xn(O8(t,r,i,n),PN(o,t,s),{u_height_factor:-(2**a.overscaledZ)/s.tileSize/8}),O9=(t,r)=>({u_fill_translate:new Ej(t,r.u_fill_translate)}),Re=(t,r)=>({u_image:new ER(t,r.u_image),u_texsize:new Ej(t,r.u_texsize),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade),u_sdf_pattern:new ER(t,r.u_sdf_pattern),u_fill_translate:new Ej(t,r.u_fill_translate)}),Rt=(t,r)=>({u_fill_translate:new Ej(t,r.u_fill_translate)}),Rr=(t,r)=>({u_image:new ER(t,r.u_image),u_texsize:new Ej(t,r.u_texsize),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade),u_sdf_pattern:new ER(t,r.u_sdf_pattern),u_fill_translate:new Ej(t,r.u_fill_translate)}),Ri=(t,r,i,n,a)=>xn(PN(r,t,i),{u_fill_translate:n,u_sdf_pattern:+!!a}),Rn=t=>({u_fill_translate:t}),Ra=t=>({u_fill_translate:t}),Ro=(t,r,i,n,a)=>Ri(t,r,i,n,a),Rs=(t,r)=>({u_scale_with_map:new ER(t,r.u_scale_with_map),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_extrude_scale:new Ej(t,r.u_extrude_scale),u_globe_extrude_scale:new EB(t,r.u_globe_extrude_scale),u_translate:new Ej(t,r.u_translate)}),Rl=(t,r,i,n,a)=>{let o=t.transform,s,l,u=0;if("map"===i.paint.get("circle-pitch-alignment")){let t=vK(r,1,o.zoom);s=!0,l=[t,t],u=t/(Mf*2**r.tileID.overscaledZ)*2*Math.PI*a}else s=!1,l=o.pixelsToGLUnits;return{u_scale_with_map:+("map"===i.paint.get("circle-pitch-scale")),u_pitch_with_map:+s,u_extrude_scale:l,u_globe_extrude_scale:u,u_translate:n}},Ru=(t,r)=>({u_color:new EU(t,r.u_color),u_overlay:new ER(t,r.u_overlay),u_overlay_scale:new EB(t,r.u_overlay_scale)}),Rc=(t,r=1)=>({u_color:t,u_overlay:0,u_overlay_scale:r}),Rh=(t,r)=>({u_extrude_scale:new EB(t,r.u_extrude_scale),u_intensity:new EB(t,r.u_intensity),u_globe_extrude_scale:new EB(t,r.u_globe_extrude_scale)}),Rd=(t,r)=>({u_matrix:new E$(t,r.u_matrix),u_image:new ER(t,r.u_image),u_color_ramp:new ER(t,r.u_color_ramp),u_opacity:new EB(t,r.u_opacity)}),Rf=(t,r,i,n)=>{let a=vK(t,1,r)/(Mf*2**t.tileID.overscaledZ)*2*Math.PI*n;return{u_extrude_scale:vK(t,1,r),u_intensity:i,u_globe_extrude_scale:a}},Rp=(t,r,i,n)=>{let a=vf();return Ms(a,0,t.width,t.height,0,0,1),{u_matrix:a,u_image:i,u_color_ramp:n,u_opacity:r.paint.get("heatmap-opacity")}},Rm=(t,r)=>({u_image:new ER(t,r.u_image),u_latrange:new Ej(t,r.u_latrange),u_exaggeration:new EB(t,r.u_exaggeration),u_altitudes:new EG(t,r.u_altitudes),u_azimuths:new EG(t,r.u_azimuths),u_accent:new EU(t,r.u_accent),u_method:new ER(t,r.u_method),u_shadows:new Eq(t,r.u_shadows),u_highlights:new Eq(t,r.u_highlights)}),Rg=(t,r)=>({u_matrix:new E$(t,r.u_matrix),u_image:new ER(t,r.u_image),u_dimension:new Ej(t,r.u_dimension),u_zoom:new EB(t,r.u_zoom),u_unpack:new EV(t,r.u_unpack)}),Ry=(t,r,i)=>{var n;let a,o,s=i.paint.get("hillshade-accent-color"),l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}let u=i.getIlluminationProperties();for(let r=0;r{let i=r.stride,n=vf();return Ms(n,0,Mf,-Mf,0,0,1),vv(n,n,[0,-Mf,0]),{u_matrix:n,u_image:1,u_dimension:[i,i],u_zoom:t.overscaledZ,u_unpack:r.getUnpackVector()}},Rx=(t,r)=>({u_image:new ER(t,r.u_image),u_unpack:new EV(t,r.u_unpack),u_dimension:new Ej(t,r.u_dimension),u_elevation_stops:new ER(t,r.u_elevation_stops),u_color_stops:new ER(t,r.u_color_stops),u_color_ramp_size:new ER(t,r.u_color_ramp_size),u_opacity:new EB(t,r.u_opacity)}),Rb=(t,r,i=0)=>({u_image:0,u_unpack:r.getUnpackVector(),u_dimension:[r.stride,r.stride],u_elevation_stops:1,u_color_stops:4,u_color_ramp_size:i,u_opacity:t.paint.get("color-relief-opacity")}),R_=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio)}),Rw=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_image_height:new EB(t,r.u_image_height)}),RT=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_texsize:new Ej(t,r.u_texsize),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_scale:new EN(t,r.u_scale),u_fade:new EB(t,r.u_fade)}),RA=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_mix:new EB(t,r.u_mix),u_tileratio:new EB(t,r.u_tileratio),u_crossfade_from:new EB(t,r.u_crossfade_from),u_crossfade_to:new EB(t,r.u_crossfade_to),u_lineatlas_width:new EB(t,r.u_lineatlas_width),u_lineatlas_height:new EB(t,r.u_lineatlas_height)}),RM=(t,r)=>({u_translation:new Ej(t,r.u_translation),u_ratio:new EB(t,r.u_ratio),u_image:new ER(t,r.u_image),u_image_height:new EB(t,r.u_image_height),u_tileratio:new EB(t,r.u_tileratio),u_crossfade_from:new EB(t,r.u_crossfade_from),u_crossfade_to:new EB(t,r.u_crossfade_to),u_image_dash:new ER(t,r.u_image_dash),u_mix:new EB(t,r.u_mix),u_lineatlas_width:new EB(t,r.u_lineatlas_width),u_lineatlas_height:new EB(t,r.u_lineatlas_height)}),Rk=(t,r,i,n)=>{let a=t.transform;return{u_translation:PU(t,r,i),u_ratio:n/vK(r,1,a.zoom)}},RS=(t,r,i,n,a)=>xn(Rk(t,r,i,n),{u_image:0,u_image_height:a}),RE=(t,r,i,n,a)=>{let o=t.transform,s=PV(r,o);return{u_translation:PU(t,r,i),u_texsize:r.imageAtlasTexture.size,u_ratio:n/vK(r,1,o.zoom),u_image:0,u_scale:[s,a.fromScale,a.toScale],u_fade:a.t}},RD=(t,r,i,n,a)=>{let o=PV(r,t.transform);return xn(Rk(t,r,i,n),{u_tileratio:o,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image:0,u_mix:a.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},RC=(t,r,i,n,a,o)=>{let s=PV(r,t.transform);return xn(Rk(t,r,i,n),{u_image:0,u_image_height:o,u_tileratio:s,u_crossfade_from:a.fromScale,u_crossfade_to:a.toScale,u_image_dash:1,u_mix:a.t,u_lineatlas_width:t.lineAtlas.width,u_lineatlas_height:t.lineAtlas.height})},RI=(t,r)=>({u_image:new ER(t,r.u_image),u_opacity:new EB(t,r.u_opacity)}),RL=(t,r)=>({u_image:r,u_opacity:t}),RP=(t,r)=>({u_is_size_zoom_constant:new ER(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new ER(t,r.u_is_size_feature_constant),u_size_t:new EB(t,r.u_size_t),u_size:new EB(t,r.u_size),u_rotate_symbol:new ER(t,r.u_rotate_symbol),u_label_plane_matrix:new E$(t,r.u_label_plane_matrix),u_coord_matrix:new E$(t,r.u_coord_matrix),u_is_text:new ER(t,r.u_is_text),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_is_along_line:new ER(t,r.u_is_along_line),u_is_variable_anchor:new ER(t,r.u_is_variable_anchor),u_texsize:new Ej(t,r.u_texsize),u_texture:new ER(t,r.u_texture),u_translation:new Ej(t,r.u_translation),u_pitched_scale:new EB(t,r.u_pitched_scale),u_is_offset:new ER(t,r.u_is_offset),u_height_anchor_ground:new ER(t,r.u_height_anchor_ground)}),Rz=(t,r)=>({u_is_size_zoom_constant:new ER(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new ER(t,r.u_is_size_feature_constant),u_size_t:new EB(t,r.u_size_t),u_size:new EB(t,r.u_size),u_rotate_symbol:new ER(t,r.u_rotate_symbol),u_label_plane_matrix:new E$(t,r.u_label_plane_matrix),u_coord_matrix:new E$(t,r.u_coord_matrix),u_is_text:new ER(t,r.u_is_text),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_is_along_line:new ER(t,r.u_is_along_line),u_is_variable_anchor:new ER(t,r.u_is_variable_anchor),u_texsize:new Ej(t,r.u_texsize),u_texture:new ER(t,r.u_texture),u_gamma_scale:new EB(t,r.u_gamma_scale),u_is_halo:new ER(t,r.u_is_halo),u_is_plain:new ER(t,r.u_is_plain),u_translation:new Ej(t,r.u_translation),u_pitched_scale:new EB(t,r.u_pitched_scale),u_is_offset:new ER(t,r.u_is_offset),u_height_anchor_ground:new ER(t,r.u_height_anchor_ground)}),RF=(t,r)=>({u_is_size_zoom_constant:new ER(t,r.u_is_size_zoom_constant),u_is_size_feature_constant:new ER(t,r.u_is_size_feature_constant),u_size_t:new EB(t,r.u_size_t),u_size:new EB(t,r.u_size),u_rotate_symbol:new ER(t,r.u_rotate_symbol),u_label_plane_matrix:new E$(t,r.u_label_plane_matrix),u_coord_matrix:new E$(t,r.u_coord_matrix),u_is_text:new ER(t,r.u_is_text),u_pitch_with_map:new ER(t,r.u_pitch_with_map),u_is_along_line:new ER(t,r.u_is_along_line),u_is_variable_anchor:new ER(t,r.u_is_variable_anchor),u_texsize:new Ej(t,r.u_texsize),u_texsize_icon:new Ej(t,r.u_texsize_icon),u_texture:new ER(t,r.u_texture),u_texture_icon:new ER(t,r.u_texture_icon),u_gamma_scale:new EB(t,r.u_gamma_scale),u_is_halo:new ER(t,r.u_is_halo),u_translation:new Ej(t,r.u_translation),u_pitched_scale:new EB(t,r.u_pitched_scale),u_is_offset:new ER(t,r.u_is_offset),u_height_anchor_ground:new ER(t,r.u_height_anchor_ground)}),RO=(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m)=>({u_is_size_zoom_constant:+("constant"===t||"source"===t),u_is_size_feature_constant:+("constant"===t||"camera"===t),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_rotate_symbol:+i,u_label_plane_matrix:l,u_coord_matrix:u,u_is_text:+h,u_pitch_with_map:+n,u_is_along_line:a,u_is_variable_anchor:o,u_texsize:d,u_texture:0,u_translation:c,u_pitched_scale:f,u_is_offset:p,u_height_anchor_ground:+m}),RR=(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m,g)=>{let y=s.transform;return xn(RO(t,r,i,n,a,o,s,l,u,c,h,d,p,m,g),{u_gamma_scale:n?Math.cos(y.pitch*Math.PI/180)*y.cameraToCenterDistance:1,u_is_halo:+!!f,u_is_plain:1})},RB=(t,r,i,n,a,o,s,l,u,c,h,d,f,p,m)=>xn(RR(t,r,i,n,a,o,s,l,u,c,!0,h,!0,f,p,m),{u_texsize_icon:d,u_texture_icon:1}),Rj=(t,r)=>({u_opacity:new EB(t,r.u_opacity),u_color:new EU(t,r.u_color)}),RN=(t,r)=>({u_opacity:new EB(t,r.u_opacity),u_image:new ER(t,r.u_image),u_pattern_tl_a:new Ej(t,r.u_pattern_tl_a),u_pattern_br_a:new Ej(t,r.u_pattern_br_a),u_pattern_tl_b:new Ej(t,r.u_pattern_tl_b),u_pattern_br_b:new Ej(t,r.u_pattern_br_b),u_texsize:new Ej(t,r.u_texsize),u_mix:new EB(t,r.u_mix),u_pattern_size_a:new Ej(t,r.u_pattern_size_a),u_pattern_size_b:new Ej(t,r.u_pattern_size_b),u_scale_a:new EB(t,r.u_scale_a),u_scale_b:new EB(t,r.u_scale_b),u_pixel_coord_upper:new Ej(t,r.u_pixel_coord_upper),u_pixel_coord_lower:new Ej(t,r.u_pixel_coord_lower),u_tile_units_to_pixels:new EB(t,r.u_tile_units_to_pixels)}),RV=(t,r)=>({u_opacity:t,u_color:r}),RU=(t,r,i,n,a)=>xn(function(t,r,i,n){let a=i.patternAtlas.getPattern(t.from.toString()),o=i.patternAtlas.getPattern(t.to.toString()),{width:s,height:l}=i.patternAtlas.getPixelSize(),u=2**n.tileID.overscaledZ,c=n.tileSize*2**i.transform.tileZoom/u,h=c*(n.tileID.canonical.x+n.tileID.wrap*u),d=c*n.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:a.tl,u_pattern_br_a:a.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[s,l],u_mix:r.t,u_pattern_size_a:a.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:r.fromScale,u_scale_b:r.toScale,u_tile_units_to_pixels:1/vK(n,1,i.transform.tileZoom),u_pixel_coord_upper:[h>>16,d>>16],u_pixel_coord_lower:[65535&h,65535&d]}}(i,a,r,n),{u_opacity:t}),Rq=(t,r)=>({u_sun_pos:new EN(t,r.u_sun_pos),u_atmosphere_blend:new EB(t,r.u_atmosphere_blend),u_globe_position:new EN(t,r.u_globe_position),u_globe_radius:new EB(t,r.u_globe_radius),u_inv_proj_matrix:new E$(t,r.u_inv_proj_matrix)}),RG=(t,r,i,n,a)=>({u_sun_pos:t,u_atmosphere_blend:r,u_globe_position:i,u_globe_radius:n,u_inv_proj_matrix:a}),RH=(t,r)=>({u_sky_color:new EU(t,r.u_sky_color),u_horizon_color:new EU(t,r.u_horizon_color),u_horizon:new Ej(t,r.u_horizon),u_horizon_normal:new Ej(t,r.u_horizon_normal),u_sky_horizon_blend:new EB(t,r.u_sky_horizon_blend),u_sky_blend:new EB(t,r.u_sky_blend),u_inv_proj_matrix:new E$(t,r.u_inv_proj_matrix),u_globe_position:new EN(t,r.u_globe_position),u_globe_radius:new EB(t,r.u_globe_radius)}),R$=(t,r,i)=>{let n=Math.cos(r.rollInRadians),a=Math.sin(r.rollInRadians),o=Ts(r),s=r.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:t.properties.get("sky-color"),u_horizon_color:t.properties.get("horizon-color"),u_horizon:[(r.width/2-o*a)*i,(r.height/2+o*n)*i],u_horizon_normal:[-a,n],u_sky_horizon_blend:t.properties.get("sky-horizon-blend")*r.height/2*i,u_sky_blend:s,u_inv_proj_matrix:r.inverseProjectionMatrix,u_globe_position:PM(r),u_globe_radius:PA(r.worldSize,r.center.lat)}},RY={fillExtrusion:O4,fillExtrusionPattern:O6,fill:O9,fillPattern:Re,fillOutline:Rt,fillOutlinePattern:Rr,circle:Rs,collisionBox:RW=(t,r)=>({}),collisionCircle:RW,debug:Ru,depth:RW,clippingMask:RW,heatmap:Rh,heatmapTexture:Rd,hillshade:Rm,hillshadePrepare:Rg,colorRelief:Rx,line:R_,lineGradient:Rw,linePattern:RT,lineSDF:RA,lineGradientSDF:RM,layerOpacity:RI,raster:FI,symbolIcon:RP,symbolSDF:Rz,symbolTextAndIcon:RF,background:Rj,backgroundPattern:RN,terrain:OW,terrainDepth:OY,atmosphere:Rq,sky:RH},RZ=class{constructor(t,r,i){this.context=t;let n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=!!i,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let r=this.context.gl;if(!this.dynamicDraw)throw Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),r.bufferSubData(r.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},RX={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},RK=class{constructor(t,r,i,n){this.length=r.length,this.attributes=i,this.itemSize=r.bytesPerElement,this.dynamicDraw=n,this.context=t;let a=t.gl;this.buffer=a.createBuffer(),t.bindVertexBuffer.set(this.buffer),a.bufferData(a.ARRAY_BUFFER,r.arrayBuffer,this.dynamicDraw?a.DYNAMIC_DRAW:a.STATIC_DRAW),this.dynamicDraw||r.freeBufferAfterUpload()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);let r=this.context.gl;this.bind(),r.bufferSubData(r.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,r){for(let i of this.attributes){let n=r.attributes[i.name];void 0!==n&&t.enableVertexAttribArray(n.location)}}setVertexAttribPointers(t,r,i){for(let n of this.attributes){let a=r.attributes[n.name];if(void 0!==a){let r=n.offset+this.itemSize*(i||0);a.isInteger?t.vertexAttribIPointer(a.location,n.components,t[RX[n.type]],this.itemSize,r):t.vertexAttribPointer(a.location,n.components,t[RX[n.type]],!1,this.itemSize,r)}}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}},RJ=class{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}},RQ=class extends RJ{getDefault(){return kt.transparent}set(t){let r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},R0=class extends RJ{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}},R1=class extends RJ{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}},R2=class extends RJ{getDefault(){return[!0,!0,!0,!0]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},R3=class extends RJ{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}},R5=class extends RJ{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}},R4=class extends RJ{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let r=this.current;(t.func!==r.func||t.ref!==r.ref||t.mask!==r.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}},R6=class extends RJ{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}},R8=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.STENCIL_TEST):r.disable(r.STENCIL_TEST),this.current=t,this.dirty=!1}},R7=class extends RJ{getDefault(){return[0,1]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}},R9=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.DEPTH_TEST):r.disable(r.DEPTH_TEST),this.current=t,this.dirty=!1}},Be=class extends RJ{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}},Bt=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.BLEND):r.disable(r.BLEND),this.current=t,this.dirty=!1}},Br=class extends RJ{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||this.dirty)&&(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}},Bi=class extends RJ{getDefault(){return kt.transparent}set(t){let r=this.current;(t.r!==r.r||t.g!==r.g||t.b!==r.b||t.a!==r.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}},Bn=class extends RJ{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}},Ba=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;t?r.enable(r.CULL_FACE):r.disable(r.CULL_FACE),this.current=t,this.dirty=!1}},Bo=class extends RJ{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}},Bs=class extends RJ{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}},Bl=class extends RJ{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.useProgram(t),this.current=t,this.dirty=!1)}},Bu=class extends RJ{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}},Bc=class extends RJ{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let r=this.current;(t[0]!==r[0]||t[1]!==r[1]||t[2]!==r[2]||t[3]!==r[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}},Bh=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindFramebuffer(r.FRAMEBUFFER,t),this.current=t,this.dirty=!1}},Bd=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindRenderbuffer(r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},Bf=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindTexture(r.TEXTURE_2D,t),this.current=t,this.dirty=!1}},Bp=class extends RJ{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.bindBuffer(r.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},Bm=class extends RJ{getDefault(){return null}set(t){let r=this.gl;r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}},Bg=class extends RJ{getDefault(){return null}set(t){(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}},By=class extends RJ{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}},Bv=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}},Bx=class extends RJ{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let r=this.gl;r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}},Bb=class extends RJ{constructor(t,r){super(t),this.context=t,this.parent=r}getDefault(){return null}},B_=class extends Bb{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},Bw=class extends Bb{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},BT=class extends Bb{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let r=this.gl;r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,t),this.current=t,this.dirty=!1}},BA=class{constructor(t,r,i,n,a){this.context=t,this.width=r,this.height=i;let o=t.gl,s=this.framebuffer=o.createFramebuffer();if(this.colorAttachment=new B_(t,s),n)this.depthAttachment=a?new BT(t,s):new Bw(t,s);else if(a)throw Error("Stencil cannot be set without depth")}destroy(){let t=this.context.gl,r=this.colorAttachment.get();if(r&&t.deleteTexture(r),this.depthAttachment){let r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)}},Bk=(BM=PB([{name:"u_units_to_pixels",type:"vec2"},{name:"u_world_size",type:"vec2"},{name:"u_camera_to_center_distance",type:"float"},{name:"u_symbol_fade_change",type:"float"},{name:"u_aspect_ratio",type:"float"},{name:"u_device_pixel_ratio",type:"float"},{name:"u_viewport_size",type:"vec2"},{name:"u_pixel_extrude_scale",type:"vec2"},{name:"u_pitch",type:"float"}])).offsets,(BS=class{constructor(t,r,i){this.blendFunction=t,this.blendColor=r,this.mask=i}}).Replace=[1,0],BS.disabled=new BS(BS.Replace,kt.transparent,[!1,!1,!1,!1]),BS.unblended=new BS(BS.Replace,kt.transparent,[!0,!0,!0,!0]),BS.alphaBlended=new BS([1,771],kt.transparent,[!0,!0,!0,!0]),BE=class{constructor(t){this.gl=t,this.clearColor=new RQ(this),this.clearDepth=new R0(this),this.clearStencil=new R1(this),this.colorMask=new R2(this),this.depthMask=new R3(this),this.stencilMask=new R5(this),this.stencilFunc=new R4(this),this.stencilOp=new R6(this),this.stencilTest=new R8(this),this.depthRange=new R7(this),this.depthTest=new R9(this),this.depthFunc=new Be(this),this.blend=new Bt(this),this.blendFunc=new Br(this),this.blendColor=new Bi(this),this.blendEquation=new Bn(this),this.cullFace=new Ba(this),this.cullFaceSide=new Bo(this),this.frontFace=new Bs(this),this.program=new Bl(this),this.activeTexture=new Bu(this),this.viewport=new Bc(this),this.bindFramebuffer=new Bh(this),this.bindRenderbuffer=new Bd(this),this.bindTexture=new Bf(this),this.bindVertexBuffer=new Bp(this),this.bindElementBuffer=new Bm(this),this.bindVertexArray=new Bg(this),this.pixelStoreUnpack=new By(this),this.pixelStoreUnpackPremultiplyAlpha=new Bv(this),this.pixelStoreUnpackFlipY=new Bx(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),t.getExtension("EXT_color_buffer_half_float"),t.getExtension("EXT_color_buffer_float"),this.projectionUniformBuffer=function(t){return new OQ(t,OK.ProjectionUBO,O0)}(this),this.terrainUniformBuffer=function(t){return new OQ(t,OK.TerrainUBO,O2)}(this),this.frameUniformBuffer=function(t){return new OQ(t,OK.FrameUBO,BM)}(this)}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0,this.projectionUniformBuffer.bindingDirty=!0,this.terrainUniformBuffer.bindingDirty=!0,this.frameUniformBuffer.bindingDirty=!0}setCustomLayerDefaults(){this.unbindVAO(),this.cullFace.setDefault(),this.activeTexture.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}createIndexBuffer(t,r){return new RZ(this,t,r)}createVertexBuffer(t,r,i){return new RK(this,t,r,i)}createRenderbuffer(t,r,i){let n=this.gl,a=n.createRenderbuffer();return this.bindRenderbuffer.set(a),n.renderbufferStorage(n.RENDERBUFFER,t,r,i),this.bindRenderbuffer.set(null),a}createFramebuffer(t,r,i,n){return new BA(this,t,r,i,n)}clear({color:t,depth:r,stencil:i}){let n=this.gl,a=0;t&&(a|=n.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(a|=n.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(r),this.depthMask.set(!0)),void 0!==i&&(a|=n.STENCIL_BUFFER_BIT,this.clearStencil.set(i),this.stencilMask.set(255)),n.clear(a)}setCullFace(t){!1===t.enable?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){xh(t.blendFunction,BS.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){return this.gl.createVertexArray()}deleteVertexArray(t){this.gl.deleteVertexArray(t)}unbindVAO(){this.bindVertexArray.set(null)}},(BD=class{constructor(t,r,i){this.func=t,this.mask=r,this.range=i}}).ReadOnly=!1,BD.ReadWrite=!0,BD.disabled=new BD(519,BD.ReadOnly,[0,1]),(BC=class{constructor(t,r,i,n,a,o){this.test=t,this.ref=r,this.mask=i,this.fail=n,this.depthFail=a,this.pass=o}}).disabled=new BC({func:519,mask:0},0,0,7680,7680,7680),(BI=class{constructor(t,r,i){this.enable=t,this.mode=r,this.frontFace=i}}).disabled=new BI(!1,1029,2305),BI.backCCW=new BI(!0,1029,2305),BI.frontCCW=new BI(!0,1028,2305),BP=vm(new Float32Array(16)),Bz=0,BF=[new vu(0,0),new vu(Mf,0),new vu(Mf,Mf),new vu(0,Mf)],BO=new kt(1,0,0,1),BR=new kt(0,1,0,1),BB=new kt(0,0,1,1),Bj=new kt(1,0,1,1),BN=new kt(0,1,1,1),BV={symbol:PG,circle:PW,heatmap:PY,line:P0,fill:P3,fillExtrusion:P8,hillshade:P9,colorRelief:zt,raster:zi,background:za,sky:zp,atmosphere:zm,custom:zh,debug:zc,debugPadding:zo,terrainDepth:zd},(BU=class{constructor(t,r){this.drawFunctions=BV,this.context=new BE(t),this.transform=r,this.layerOpacityFbo=null,this._tileTextures={},this._rttObjectRecyclePool=[],this._rttSharedFbo=null,this.terrainFacilitator={depthDirty:!0,matrix:vm(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=FJ.maxOverzooming+FJ.maxUnderzooming+1,this.depthEpsilon=1/65536,this.crossTileSymbolIndex=new Op}resize(t,r,i){if(this.width=Math.floor(t*i),this.height=Math.floor(r*i),this.pixelRatio=i,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(let t of this.style._order)this.style._layers[t].resize()}setup(){let t=this.context,r=new Es;r.emplaceBack(0,0),r.emplaceBack(Mf,0),r.emplaceBack(0,Mf),r.emplaceBack(Mf,Mf),this.tileExtentBuffer=t.createVertexBuffer(r,Fz.members),this.tileExtentSegments=ED.simpleSegment(0,0,4,2);let i=new Es;i.emplaceBack(0,0),i.emplaceBack(Mf,0),i.emplaceBack(0,Mf),i.emplaceBack(Mf,Mf),this.debugBuffer=t.createVertexBuffer(i,Fz.members),this.debugSegments=ED.simpleSegment(0,0,4,5);let n=new Eu;n.emplaceBack(0,0,0,0),n.emplaceBack(Mf,0,Mf,0),n.emplaceBack(0,Mf,0,Mf),n.emplaceBack(Mf,Mf,Mf,Mf),this.rasterBoundsBuffer=t.createVertexBuffer(n,OH.members),this.rasterBoundsSegments=ED.simpleSegment(0,0,4,2);let a=new Es;a.emplaceBack(0,0),a.emplaceBack(Mf,0),a.emplaceBack(0,Mf),a.emplaceBack(Mf,Mf),this.rasterBoundsBufferPosOnly=t.createVertexBuffer(a,Fz.members),this.rasterBoundsSegmentsPosOnly=ED.simpleSegment(0,0,4,5);let o=new Es;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,Fz.members),this.viewportSegments=ED.simpleSegment(0,0,4,2);let s=new Ek;s.emplaceBack(0),s.emplaceBack(1),s.emplaceBack(3),s.emplaceBack(2),s.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(s);let l=new EA;l.emplaceBack(1,0,2),l.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(l);let u=this.context.gl;this.stencilClearMode=new BC({func:u.ALWAYS,mask:0},0,255,u.ZERO,u.ZERO,u.ZERO),this.tileExtentMesh=new FP(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){let t=this.context,r=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let i=vf();Ms(i,0,this.width,this.height,0,0,1),vx(i,i,[r.drawingBufferWidth,r.drawingBufferHeight,0]),this.useProgram("clippingMask",null,!0).draw(t,r.TRIANGLES,BD.disabled,this.stencilClearMode,BS.disabled,BI.disabled,null,null,{mainMatrix:i,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:i,clipAntimeridian:!1},"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}renderTileClippingMasks(t,r,i){if(this.currentStencilSource===t.source||!t.isTileClipped()||!r?.length)return;this.currentStencilSource=t.source,this.nextStencilID+r.length>256&&this.clearStencil();let n=this.context;n.setColorMode(BS.disabled),n.setDepthMode(BD.disabled);let a={};for(let t of r)a[t.key]=this.nextStencilID++;this.style.projection.useSubdivision&&this._renderTileMasks(a,r,i,!0),this._renderTileMasks(a,r,i,!1),this._tileClippingMaskIDs=a}_renderTileMasks(t,r,i,n){let a=this.context,o=a.gl,s=this.style.projection,l=this.transform,u=this.useProgram("clippingMask");for(let c of r){let r=t[c.key],h=this.getTerrainDataForTile(c,i),d=s.getMeshFromTileID(this.context,c.canonical,n,!0,"stencil"),f=l.getProjectionData({overscaledTileID:c,applyGlobeMatrix:!i,applyTerrainMatrix:!0});u.draw(a,o.TRIANGLES,BD.disabled,new BC({func:o.ALWAYS,mask:0},r,255,o.KEEP,o.KEEP,o.REPLACE),BS.disabled,i?BI.disabled:BI.backCCW,null,h,f,"$clipping",d.vertexBuffer,d.indexBuffer,d.segments)}}getTerrainDataForTile(t,r){var i,n;return r&&(null==(i=this.style.projection)?void 0:i.name)==="mercator"?null:(null==(n=this.style.map.terrain)?void 0:n.getTerrainData(t))||null}_renderTilesDepthBuffer(){var t;let r=this.context,i=r.gl,n=this.style.projection,a=this.transform,o=this.useProgram("depth"),s=this.getDepthModeFor3D();for(let l of L$(a,{tileSize:a.tileSize})){let u=null==(t=this.style.map.terrain)?void 0:t.getTerrainData(l),c=n.getMeshFromTileID(this.context,l.canonical,!0,!0,"raster"),h=a.getProjectionData({overscaledTileID:l,applyGlobeMatrix:!0,applyTerrainMatrix:!0});o.draw(r,i.TRIANGLES,s,BC.disabled,BS.disabled,BI.backCCW,null,u,h,"$clipping",c.vertexBuffer,c.indexBuffer,c.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,r=this.context.gl;return new BC({func:r.NOTEQUAL,mask:255},t,255,r.KEEP,r.KEEP,r.REPLACE)}stencilModeForClipping(t){let r=this.context.gl;return new BC({func:r.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,r.KEEP,r.KEEP,r.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(t){let r=this.context.gl,i=t.sort((t,r)=>r.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(a>1){this.currentStencilSource=void 0,this.nextStencilID+a>256&&this.clearStencil();let t={};for(let i=0;ir.overscaledZ-t.overscaledZ),n=i[i.length-1].overscaledZ,a=i[0].overscaledZ-n+1;if(this.clearStencil(),a>1){let t={},o={};for(let i=0;i0});this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.patternAtlas=t.patternAtlas,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(Lu()),function(t,r){let i=t.pending,{transform:n}=r,a=r.context.gl;i[Bk.u_units_to_pixels]=1/n.pixelsToGLUnits[0],i[Bk.u_units_to_pixels+1]=1/n.pixelsToGLUnits[1],i[Bk.u_world_size]=a.drawingBufferWidth,i[Bk.u_world_size+1]=a.drawingBufferHeight,i[Bk.u_camera_to_center_distance]=n.cameraToCenterDistance,i[Bk.u_symbol_fade_change]=r.options.fadeDuration?r.symbolFadeChange:1,i[Bk.u_aspect_ratio]=n.width/n.height,i[Bk.u_device_pixel_ratio]=r.pixelRatio,i[Bk.u_viewport_size]=n.width,i[Bk.u_viewport_size+1]=n.height,i[Bk.u_pixel_extrude_scale]=1/n.width,i[Bk.u_pixel_extrude_scale+1]=1/n.height,i[Bk.u_pitch]=n.pitch/360*2*Math.PI,t.upload()}(this.context.frameUniformBuffer,this),this.imageManager.beginFrame();let c=this.style._order,h=this.style.tileManagers,d={},f={},p={};for(let t in h){let r=h[t];r.used&&r.prepare(this.context),d[t]=r.getVisibleCoordinates(!1),f[t]=d[t].slice().reverse(),p[t]=r.getVisibleCoordinates(!0).reverse()}u.opaquePassCutoff=1/0;for(let t=0;t=0;u.currentLayer--){let t=this.style._layers[c[u.currentLayer]];if(t.isHidden(this.transform.zoom))continue;let r=h[t.source],i=d[t.source];this.renderTileClippingMasks(t,i,!1),this.renderLayer(this,r,t,i,u)}u.currentPass="translucent";let m=!1;for(u.currentLayer=0;u.currentLayeri.source&&!i.isHidden(r)?[t.tileManagers[i.source]]:[]),a=n.filter(t=>"vector"===t.getSource().type),o=n.filter(t=>"vector"!==t.getSource().type),s=t=>{(!i||i.getSource().maxzoom0?r.pop():null}acquireRTT(t){let r=this.context.gl,i=this._rttObjectRecyclePool.pop();if(i)return i.size!==t&&(i.texture.update({width:t,height:t,data:null},{premultiply:!1,useMipmap:!0}),i.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),i.size=t),i;let n=new Dp(this.context,{width:t,height:t,data:null},r.RGBA,{premultiply:!1,useMipmap:!0});return n.bind(r.LINEAR,r.CLAMP_TO_EDGE,r.LINEAR_MIPMAP_LINEAR),this.context.extTextureFilterAnisotropic&&r.texParameterf(r.TEXTURE_2D,this.context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this.context.extTextureFilterAnisotropicMax),{texture:n,size:t}}bindRTT(t){let r=this.context.gl,i=t.size;if(!this._rttSharedFbo){let t=this.context.createFramebuffer(i,i,!0,!0),n=this.context.createRenderbuffer(r.DEPTH_STENCIL,i,i);t.depthAttachment.set(n),this._rttSharedFbo={fbo:t,depthRenderbuffer:n,size:i}}this._rttSharedFbo.size!==i&&(this.context.bindRenderbuffer.set(this._rttSharedFbo.depthRenderbuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,i,i),this.context.bindRenderbuffer.set(null),this._rttSharedFbo.fbo.width=i,this._rttSharedFbo.fbo.height=i,this._rttSharedFbo.size=i),this._rttSharedFbo.fbo.colorAttachment.set(t.texture.texture),this.context.bindFramebuffer.set(this._rttSharedFbo.fbo.framebuffer)}releaseRTT(t){this._rttObjectRecyclePool.push(t)}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let r=this.patternAtlas.getPattern(t.from.toString()),i=this.patternAtlas.getPattern(t.to.toString());return!r||!i}useProgram(t,r,i=!1,n=[]){var a;this.cache||(this.cache={});let o=!!this.style.map.terrain,s=this.style.projection,l=i?Ox.projectionMercator:s.shaderPreludeCode,u=i?"#define PROJECTION_MERCATOR":s.shaderDefine,c=`/${i?"mercator":s.shaderVariantName}`,h=t+(r?r.cacheKey:"")+c+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"")+(n?`/${n.join("/")}`:"");return(a=this.cache)[h]||(a[h]=new O5(this.context,Ox[t],r,RY[t],this._showOverdrawInspector,o,l,u,n)),this.cache[h]}setCustomLayerDefaults(){this.context.setCustomLayerDefaults()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(null==this.debugOverlayCanvas){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new Dp(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){var t,r,i;if(this._tileTextures){for(let t in this._tileTextures){let r=this._tileTextures[t];if(r)for(let t of r)t.destroy()}this._tileTextures={}}for(let t of this._rttObjectRecyclePool)t.texture.destroy();if(this._rttObjectRecyclePool=[],this._rttSharedFbo){this._rttSharedFbo.fbo.colorAttachment.set(null),this._rttSharedFbo.fbo.depthAttachment.set(null);let t=this.context.gl;t.deleteRenderbuffer(this._rttSharedFbo.depthRenderbuffer),t.deleteFramebuffer(this._rttSharedFbo.fbo.framebuffer),this._rttSharedFbo=null}if(null==(t=this.layerOpacityFbo)||t.destroy(),this.layerOpacityFbo=null,this.tileExtentBuffer&&this.tileExtentBuffer.destroy(),this.debugBuffer&&this.debugBuffer.destroy(),this.rasterBoundsBuffer&&this.rasterBoundsBuffer.destroy(),this.rasterBoundsBufferPosOnly&&this.rasterBoundsBufferPosOnly.destroy(),this.viewportBuffer&&this.viewportBuffer.destroy(),this.tileBorderIndexBuffer&&this.tileBorderIndexBuffer.destroy(),this.quadTriangleIndexBuffer&&this.quadTriangleIndexBuffer.destroy(),this.tileExtentMesh&&(null==(r=this.tileExtentMesh.vertexBuffer)||r.destroy()),this.tileExtentMesh&&(null==(i=this.tileExtentMesh.indexBuffer)||i.destroy()),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this.context.projectionUniformBuffer.destroy(),this.context.terrainUniformBuffer.destroy(),this.context.frameUniformBuffer.destroy(),this.cache){for(let t in this.cache){let r=this.cache[t];r?.program&&this.context.gl.deleteProgram(r.program)}this.cache={}}this.context&&this.context.setDefault()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:r}=this.context.gl;return this.width!==t||this.height!==r}}).MAX_TEXTURE_POOL_SIZE_PER_BUCKET=50,Bq=BU,BG=class extends Error{constructor(t,r){var i;super("WebGL2 is required to display this map. We are sorry, but it seems that your browser does not support WebGL2, a technology for rendering 3D graphics on the web. Read more on https://wiki.openstreetmap.org/wiki/This_map_requires_WebGL"),this.name="GPUInitializationError",this.requestedAttributes=t,this.statusMessage=null!=(i=r?.statusMessage)?i:null}},BH=class{constructor(t){this._getHashParams=()=>new URLSearchParams(window.location.hash.replace("#","")),this._getCurrentHash=()=>{var t;let r=this._getHashParams();return this._hashName?(r.get(this._hashName)||"").split("/"):(null!=(t=[...r.keys()][0])?t:"").split("/")},this._onHashChange=()=>{let t=this._getCurrentHash();if(!this._isValidHash(t))return!1;let r=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:r,pitch:+(t[4]||0)}),!0},this._updateHashUnthrottled=()=>{let t=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,t)},this._removeHash=()=>{let t=this._getHashParams();if(this._hashName)t.delete(this._hashName);else{let r=Array.from(t.keys());r.length>0&&t.delete(r[0])}let r=decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,""),i=r?`#${r}`:"",n=window.location.href.replace(/(#.+)?$/,i);n=n.replace("&&","&"),window.history.replaceState(window.history.state,null,n)},this._updateHash=zg(this._updateHashUnthrottled,300),this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(t){let r=this._map.getCenter(),i=Math.round(100*this._map.getZoom())/100,n=10**Math.ceil((i*Math.LN2+Math.log(512/360/.5))/Math.LN10),a=Math.round(r.lng*n)/n,o=Math.round(r.lat*n)/n,s=this._map.getBearing(),l=this._map.getPitch(),u="";if(u+=t?`/${a}/${o}/${i}`:`${i}/${o}/${a}`,(s||l)&&(u+=`/${Math.round(10*s)/10}`),l&&(u+=`/${Math.round(l)}`),this._hashName){let t=this._getHashParams();return t.set(this._hashName,u),`#${decodeURIComponent(t.toString()).replace(/=&/g,"&").replace(/=$/g,"")}`}return`#${u}`}_isValidHash(t){if(t.length<3||t.some(t=>isNaN(+t)))return!1;try{new DQ(+t[2],+t[1])}catch{return!1}let r=+t[0],i=+(t[3]||0),n=+(t[4]||0);return r>=this._map.getMinZoom()&&r<=this._map.getMaxZoom()&&i>=-180&&i<=180&&n>=this._map.getMinPitch()&&n<=this._map.getMaxPitch()}},BW=xn({deceleration:2500,maxSpeed:1400},B$={linearity:.3,easing:xt(0,0,.3,1)}),BY=xn({deceleration:20,maxSpeed:1400},B$),BZ=xn({deceleration:1e3,maxSpeed:360},B$),BX=xn({deceleration:1e3,maxSpeed:90},B$),BK=xn({deceleration:1e3,maxSpeed:360},B$),BJ=class{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Lu(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,r=Lu();for(;t.length>0&&r-t[0].time>160;)t.shift()}_getVelocityEntries(){let t=this._inertiaBuffer,r=Lu()-60,i=Math.max(0,t.length-2);for(;i>0&&t[i-1].time>=r;)i--;return t.slice(i)}_onMoveEnd(t){this._drainInertiaBuffer();let r=this._getVelocityEntries();if(r.length<2)return void this.clear();let i={zoom:0,bearing:0,pitch:0,roll:0,pan:new vu(0,0),pinchAround:void 0,around:void 0};for(let{settings:t}of r)t.around&&(i.around=t.around),t.pinchAround&&(i.pinchAround=t.pinchAround);for(let{settings:t}of r.slice(1))i.zoom+=t.zoomDelta||0,i.bearing+=t.bearingDelta||0,i.pitch+=t.pitchDelta||0,i.roll+=t.rollDelta||0,t.panDelta&&i.pan._add(t.panDelta);if(!i.pan.mag()&&!i.zoom&&!i.bearing&&!i.pitch&&!i.roll)return void this.clear();let n=Lu()-r[0].time,a={};if(i.pan.mag()){let r=zv(i.pan.mag(),n,xn({},BW,t||{})),o=i.pan.mult(r.amount/i.pan.mag()),s=this._map._camera.cameraHelper.handlePanInertia(o,this._map._camera.transform);a.center=s.easingCenter,a.offset=s.easingOffset,zy(a,r)}if(i.zoom){let t=zv(i.zoom,n,BY);a.zoom=xl(this._map.getZoom()+t.amount,this._map.getZoomSnap(),t.amount),zy(a,t)}if(i.bearing){let t=zv(i.bearing,n,BZ);a.bearing=this._map.getBearing()+xr(t.amount,-179,179),zy(a,t)}if(i.pitch){let t=zv(i.pitch,n,BX);a.pitch=this._map.getPitch()+t.amount,zy(a,t)}if(i.roll){let t=zv(i.roll,n,BK);a.roll=this._map.getRoll()+xr(t.amount,-179,179),zy(a,t)}if(a.zoom||a.bearing){let t=void 0===i.pinchAround?i.around:i.pinchAround;a.around=t?this._map.unproject(t):this._map.getCenter()}return this.clear(),xn(a,{noMoveStart:!0})}},BQ=class{constructor(t,r){this._map=t,this._clickTolerance=r.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new z4(this._map,t))}mousedown(t,r){return this._mousedownPos=r,this._firePreventable(new z3(t.type,this._map,t))}mouseup(t){this._map.fire(new z3(t.type,this._map,t))}click(t,r){this._mousedownPos&&this._mousedownPos.dist(r)>=this._clickTolerance||this._map.fire(new z3(t.type,this._map,t))}dblclick(t){return this._firePreventable(new z3(t.type,this._map,t))}mouseover(t){this._map.fire(new z3(t.type,this._map,t))}mouseout(t){this._map.fire(new z3(t.type,this._map,t))}touchstart(t){return this._firePreventable(new z5(t.type,this._map,t))}touchmove(t){this._map.fire(new z5(t.type,this._map,t))}touchend(t){this._map.fire(new z5(t.type,this._map,t))}touchcancel(t){this._map.fire(new z5(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},B0=class{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new z3(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new z3("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new z3(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}},B1=class{constructor(t,r,i){this._map=t,this._tr=i,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=r.clickTolerance||1,r.boxZoom&&"object"==typeof r.boxZoom&&(this._boxZoomEnd=r.boxZoom.boxZoomEnd)}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,r){this.isEnabled()&&t.shiftKey&&0===t.button&&(zZ.disableDrag(),this._startPos=this._lastPos=r,this._active=!0)}mousemoveWindow(t,r){if(!this._active||this._lastPos.equals(r)||!this._box&&r.dist(this._startPos)t.fitScreenCoordinates(i,r,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&27===t.keyCode&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(this._box=(this._box.remove(),null)),zZ.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,r){return this._map.fire(new z6(t,{originalEvent:r}))}},B2=class{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(t,r,i){(this.centroid||i.length>this.numTouches)&&(this.aborted=!0),this.aborted||(void 0===this.startTime&&(this.startTime=t.timeStamp),i.length===this.numTouches&&(this.centroid=function(t){let r=new vu(0,0);for(let i of t)r._add(i);return r.div(t.length)}(r),this.touches=zx(i,r)))}touchmove(t,r,i){if(this.aborted||!this.centroid)return;let n=zx(i,r);for(let t in this.touches){let r=this.touches[t],i=n[t];(!i||i.dist(r)>30)&&(this.aborted=!0)}}touchend(t,r,i){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),0===i.length){let t=!this.aborted&&this.centroid;if(this.reset(),t)return t}}},B3=class{constructor(t){this.singleTap=new B2(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,r,i){this.singleTap.touchstart(t,r,i)}touchmove(t,r,i){this.singleTap.touchmove(t,r,i)}touchend(t,r,i){let n=this.singleTap.touchend(t,r,i);if(n){let r=t.timeStamp-this.lastTime<500,i=!this.lastTap||30>this.lastTap.dist(n);if(r&&i||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=n,this.count===this.numTaps)return this.reset(),n}}},B5=class{constructor(t,r){this._tr=r,this._zoomIn=new B3({numTouches:1,numTaps:2}),this._zoomOut=new B3({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,r,i){this._zoomIn.touchstart(t,r,i),this._zoomOut.touchstart(t,r,i)}touchmove(t,r,i){this._zoomIn.touchmove(t,r,i),this._zoomOut.touchmove(t,r,i)}touchend(t,r,i){let n=this._zoomIn.touchend(t,r,i),a=this._zoomOut.touchend(t,r,i),o=this._tr;return n?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:xl(o.zoom+1,r.getZoomSnap()),around:o.unproject(n)},{originalEvent:t})}):a?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:r=>r.easeTo({duration:300,zoom:xl(o.zoom-1,r.getZoomSnap()),around:o.unproject(a)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},B4=class{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let r=this._moveFunction(...t);if(r.bearingDelta||r.pitchDelta||r.rollDelta||r.around||r.panDelta)return this._active=!0,r}dragStart(t,r){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=Array.isArray(r)?r[0]:r,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,r){if(!this.isEnabled())return;let i=this._lastPoint;if(!i)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t))return void this.reset(t);let n=Array.isArray(r)?r[0]:r;if(!(!this._moved&&n.dist(i)!0}),r=new B7){this.mouseMoveStateManager=t,this.oneFingerTouchMoveStateManager=r}_executeRelevantHandler(t,r,i){return t instanceof MouseEvent?r(t):"u">typeof TouchEvent&&t instanceof TouchEvent?i(t):void 0}startMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.startMove(t)},t=>{this.oneFingerTouchMoveStateManager.startMove(t)})}endMove(t){this._executeRelevantHandler(t,t=>{this.mouseMoveStateManager.endMove(t)},t=>{this.oneFingerTouchMoveStateManager.endMove(t)})}isValidStartEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidStartEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidStartEvent(t))}isValidMoveEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidMoveEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(t))}isValidEndEvent(t){return!!this._executeRelevantHandler(t,t=>this.mouseMoveStateManager.isValidEndEvent(t),t=>this.oneFingerTouchMoveStateManager.isValidEndEvent(t))}},je=t=>{t.mousedown=t.dragStart,t.mousemoveWindow=t.dragMove,t.mouseup=t.dragEnd,t.contextmenu=t=>{t.preventDefault()}},jt=class{constructor(t,r){this._clickTolerance=t.clickTolerance||1,this._map=r,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new vu(0,0)}_shouldBePrevented(t){return t<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(t,r,i){return this._calculateTransform(t,r,i)}touchmove(t,r,i){if(this._active)return this._shouldBePrevented(i.length)?void this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",t):(t.preventDefault(),this._calculateTransform(t,r,i))}touchend(t,r,i){this._calculateTransform(t,r,i),this._active&&this._shouldBePrevented(i.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,r,i){i.length>0&&(this._active=!0);let n=zx(i,r),a=new vu(0,0),o=new vu(0,0),s=0;for(let t in n){let r=n[t],i=this._touches[t];i&&(a._add(r),o._add(r.sub(i)),s++,n[t]=r)}if(this._touches=n,this._shouldBePrevented(s)||!o.mag())return;let l=o.div(s);if(this._sum._add(l),!(this._sum.mag()=2,a=r.mag()>=2;if(!n&&!a)return;if(!n||!a)return void 0===this._firstMove&&(this._firstMove=i),i-this._firstMove<100&&void 0;let o=t.y>0==r.y>0;return zT(t)&&zT(r)&&o}},jo={panStep:100,bearingStep:15,pitchStep:10},js=class{constructor(t,r){this._tr=r,this._panStep=jo.panStep,this._bearingStep=jo.bearingStep,this._pitchStep=jo.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let r=0,i=0,n=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:r=1;break;case 189:case 109:case 173:r=-1;break;case 37:t.shiftKey?i=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?i=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?n=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?n=-1:(t.preventDefault(),o=1);break;default:return}return this._rotationDisabled&&(i=0,n=0),{cameraAnimation:s=>{let l=this._tr;s.easeTo({duration:300,easeId:"keyboardHandler",easing:zA,zoom:r?xl(l.zoom+r*(t.shiftKey?2:1),s.getZoomSnap()):l.zoom,bearing:l.bearing+i*this._bearingStep,pitch:l.pitch+n*this._pitchStep,offset:[-a*this._panStep,-o*this._panStep],center:l.center},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}},jl=class{constructor(t,r,i){this._onTimeout=t=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)},this._map=t,this._tr=i,this._triggerRenderFrame=r,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||void 0!==this._finishTimeout}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&"center"===t.around)}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(t){return!!this._map.cooperativeGestures.isEnabled()&&!(t.ctrlKey||this._map.cooperativeGestures.isBypassed(t))}wheel(t){if(!this.isEnabled())return;if(this._shouldBePrevented(t))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",t);let r=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY,i=Lu(),n=i-(this._lastWheelEventTime||0);this._lastWheelEventTime=i,0!==r&&r%4.000244140625==0?this._type="wheel":0!==r&&4>Math.abs(r)?this._type="trackpad":n>400?(this._type=null,this._lastValue=r,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=200>Math.abs(n*r)?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,r+=this._lastValue)),t.shiftKey&&r&&(r/=4),this._type&&(this._lastWheelEvent=t,this._delta-=r,this._active||this._start(t)),t.preventDefault()}_start(t){if(!this._delta)return;this._needsRerender=!1,this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);let r=zZ.mousePos(this._map.getCanvas(),t),i=this._tr;this._aroundPoint=this._aroundCenter?i.transform.locationToScreenPoint(DQ.convert(i.center)):r,this._needsRerender||(this._needsRerender=!0,this._triggerRenderFrame())}renderFrame(){if(!this._needsRerender||(this._needsRerender=!1,!this.isActive()))return;let t=this._tr.transform;if("number"==typeof this._lastExpectedZoom){let r=t.zoom-this._lastExpectedZoom;"number"==typeof this._startZoom&&(this._startZoom+=r),"number"==typeof this._targetZoom&&(this._targetZoom+=r)}if(0!==this._delta){let r="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?this._wheelZoomRate:this._defaultZoomRate,i=2/(1+Math.exp(-Math.abs(this._delta*r)));this._delta<0&&0!==i&&(i=1/i);let n="number"==typeof this._targetZoom?xo(this._targetZoom):t.scale,a=t.applyConstrain(t.getCameraLngLat(),xs(n*i)).zoom,o=this._map.getZoomSnap();if("wheel"===this._type&&o>0){let r=xl(t.zoom,o);this._targetZoom=xl(a,o,a-r)}else this._targetZoom=a;"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}let r="number"==typeof this._targetZoom?this._targetZoom:t.zoom,i=this._startZoom,n=this._easing,a=!1,o;if("wheel"===this._type&&i&&n){let t=Math.min((Lu()-this._lastWheelEventTime+5)/200,1),s=n(t);o=kx.number(i,r,s),t<1?this._needsRerender=!0:a=!0}else o=r,a=!0;return this._active=!0,a&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=o,{noInertia:!0,needsRenderFrame:!a,zoomDelta:o-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let r=Mp;if(this._prevEase){let t=this._prevEase,i=(Lu()-t.start)/t.duration,n=t.easing(i+.01)-t.easing(i),a=.27/Math.sqrt(n*n+1e-4)*.01,o=Math.sqrt(.0729-a*a);r=xt(a,o,.25,1)}return this._prevEase={start:Lu(),duration:t,easing:r},r}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}},ju=class{constructor(t,r){this._clickZoom=t,this._tapZoom=r}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}},jc=class{constructor(t,r){this._tr=r,this.reset()}reset(){this._active=!1}dblclick(t,r){return t.preventDefault(),{cameraAnimation:i=>{i.easeTo({duration:300,zoom:xl(this._tr.zoom+(t.shiftKey?-1:1),i.getZoomSnap()),around:this._tr.unproject(r)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},jh=class{constructor(){this._tap=new B3({numTouches:1,numTaps:1}),this._zoomRate=1,this.reset()}setZoomRate(t){this._zoomRate=t??1}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(t,r,i){if(!this._swipePoint)if(this._tapTime){let n=r[0],a=t.timeStamp-this._tapTime<500,o=30>this._tapPoint.dist(n);a&&o?i.length>0&&(this._swipePoint=n,this._swipeTouch=i[0].identifier):this.reset()}else this._tap.touchstart(t,r,i)}touchmove(t,r,i){if(this._tapTime){if(this._swipePoint){if(i[0].identifier!==this._swipeTouch)return;let n=r[0],a=n.y-this._swipePoint.y;return this._swipePoint=n,t.preventDefault(),this._active=!0,{zoomDelta:a/128*this._zoomRate}}}else this._tap.touchmove(t,r,i)}touchend(t,r,i){if(this._tapTime)this._swipePoint&&0===i.length&&this.reset();else{let n=this._tap.touchend(t,r,i);n&&(this._tapTime=t.timeStamp,this._tapPoint=n)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}},jd=class{constructor(t,r,i){this._el=t,this._mousePan=r,this._touchPan=i}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}},jf=class{constructor(t,r,i,n){this._pitchWithRotate=t.pitchWithRotate,this._rollEnabled=t.rollEnabled,this._mouseRotate=r,this._mousePitch=i,this._mouseRoll=n}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}},jp=class{constructor(t,r,i,n){this._el=t,this._touchZoom=r,this._touchRotate=i,this._tapDragZoom=n,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}setZoomRate(t){this._touchZoom.setZoomRate(t),this._tapDragZoom.setZoomRate(t)}setZoomThreshold(t){this._touchZoom.setZoomThreshold(t)}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}},jm=class{constructor(t,r){this._bypassKey=navigator.userAgent.includes("Mac")?"metaKey":"ctrlKey",this._map=t,this._options=r,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;let t=this._map.getCanvasContainer();t.classList.add("maplibregl-cooperative-gestures"),this._container=zZ.create("div","maplibregl-cooperative-gesture-screen",t);let r=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");"metaKey"===this._bypassKey&&(r=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));let i=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),n=document.createElement("div");n.className="maplibregl-desktop-message",n.textContent=r,this._container.appendChild(n);let a=document.createElement("div");a.className="maplibregl-mobile-message",a.textContent=i,this._container.appendChild(a),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(this._container.remove(),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(t){return t[this._bypassKey]}notifyGestureBlocked(t,r){this._enabled&&(this._map.fire(new zJ("cooperativegestureprevented",{gestureType:t,originalEvent:r})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}},jg=class{constructor(t){this._camera=t}get transform(){return this._camera._requestedCameraState||this._camera.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(t){return this.transform.screenPointToLocation(vu.convert(t),this._camera.terrain)}},jy=t=>t.zoom||t.drag||t.roll||t.pitch||t.rotate,jv=class extends MI{},jx=class{get _ownerDocument(){var t;return(null==(t=this._el)?void 0:t.ownerDocument)||document}get _ownerWindow(){var t,r;return(null==(r=null==(t=this._el)?void 0:t.ownerDocument)?void 0:r.defaultView)||window}constructor(t,r,i){this._terrainGestureAnchorElevation=null,this.handleWindowEvent=t=>{this.handleEvent(t,`${t.type}Window`)},this.handleEvent=(t,r)=>{if("blur"===t.type)return void this.stop(!0);this._updatingCamera=!0;let i="renderFrame"===t.type?void 0:t,n={needsRenderFrame:!1},a={},o={};for(let{handlerName:l,handler:u,allowed:c}of this._handlers){let h;if(u.isEnabled()){if(this._blockedByActive(o,c,l))u.reset();else if(u[r||t.type]){if(function(t,r){var i,n;if(!Mw[r])return!1;let a=(null==(n=null==(i=t?.target)?void 0:i.ownerDocument)?void 0:n.defaultView)||window;return t instanceof a.MouseEvent||t instanceof a.WheelEvent}(t,r||t.type)){let i=zZ.mousePos(this._map.getCanvas(),t);h=u[r||t.type](t,i)}else{var s;if(M_[r||t.type]&&"touches"in t){let i=t.touches,n=this._getMapTouches(i),a=zZ.touchPos(this._map.getCanvas(),n);h=u[r||t.type](t,a,n)}else M_[s=r||t.type]||Mw[s]||(h=u[r||t.type](t))}this.mergeHandlerResult(n,a,h,l,i),h?.needsRenderFrame&&this._triggerRenderFrame()}(h||u.isActive())&&(o[l]=u)}}let l={};for(let t in this._previousActiveHandlers)o[t]||(l[t]=i);this._previousActiveHandlers=o,(Object.keys(l).length||zM(n))&&(this._changes.push([n,a,l]),this._triggerRenderFrame()),(Object.keys(o).length||zM(n))&&this._camera.stop(!0),this._updatingCamera=!1;let{cameraAnimation:u}=n;u&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],u(this._map))},this._map=t,this._camera=r,this._transformProvider=new jg(this._camera),this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new BJ(t),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);let n=this._el;for(let[t,r,i]of(this._listeners=[[n,"touchstart",{passive:!0}],[n,"touchmove",{passive:!1}],[n,"touchend",void 0],[n,"touchcancel",void 0],[n,"mousedown",void 0],[n,"mousemove",void 0],[n,"mouseup",void 0],[this._ownerDocument,"mousemove",{capture:!0}],[this._ownerDocument,"mouseup",void 0],[n,"mouseover",void 0],[n,"mouseout",void 0],[n,"dblclick",void 0],[n,"click",void 0],[n,"keydown",{capture:!1}],[n,"keyup",void 0],[n,"wheel",{passive:!1}],[n,"contextmenu",void 0],[this._ownerWindow,"blur",void 0]],this._listeners))t.addEventListener(r,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}destroy(){for(let[t,r,i]of this._listeners)t.removeEventListener(r,t===this._ownerDocument?this.handleWindowEvent:this.handleEvent,i)}_addDefaultHandlers(t){let r=this._map,i=r.getCanvasContainer();this._add("mapEvent",new BQ(r,t));let n=r.boxZoom=new B1(r,t,this._transformProvider);this._add("boxZoom",n),t.interactive&&t.boxZoom&&n.enable();let a=r.cooperativeGestures=new jm(r,t.cooperativeGestures);this._add("cooperativeGestures",a),t.cooperativeGestures&&a.enable();let o=new B5(r,this._transformProvider),s=new jc(r,this._transformProvider);r.doubleClickZoom=new ju(s,o),this._add("tapZoom",o),this._add("clickZoom",s),t.interactive&&t.doubleClickZoom&&r.doubleClickZoom.enable();let l=new jh;this._add("tapDragZoom",l);let u=r.touchPitch=new ja(r);this._add("touchPitch",u),t.interactive&&t.touchPitch&&r.touchPitch.enable(t.touchPitch);let c=()=>r.project(r.getCenter()),h=function({enable:t,clickTolerance:r,aroundCenter:i=!0,minPixelCenterThreshold:n=100,rotateSpeed:a=.8},o){return new B4({clickTolerance:r,move:(t,r)=>{let s=o();if(i&&Math.abs(s.y-t.y)>n)return{bearingDelta:x_(new vu(t.x,r.y),r,s)};let l=(r.x-t.x)*a;return i&&r.y0===t.button&&t.ctrlKey||2===t.button&&!t.ctrlKey}),enable:t,assignEvents:je})}(t,c),d=function({enable:t,clickTolerance:r,pitchSpeed:i=-.5}){return new B4({clickTolerance:r,move:(t,r)=>({pitchDelta:(r.y-t.y)*i}),moveStateManager:new B8({checkCorrectEvent:t=>0===t.button&&t.ctrlKey||2===t.button}),enable:t,assignEvents:je})}(t),f=function({enable:t,clickTolerance:r,rollDegreesPerPixelMoved:i=.3},n){return new B4({clickTolerance:r,move:(t,r)=>{let a=n(),o=(r.x-t.x)*i;return r.y2===t.button&&t.ctrlKey}),enable:t,assignEvents:je})}(t,c);r.dragRotate=new jf(t,h,d,f),this._add("mouseRotate",h,["mousePitch"]),this._add("mousePitch",d,["mouseRotate","mouseRoll"]),this._add("mouseRoll",f,["mousePitch"]),t.interactive&&t.dragRotate&&r.dragRotate.enable();let p=function({enable:t,clickTolerance:r}){return new B4({clickTolerance:r,move:(t,r)=>({around:r,panDelta:r.sub(t)}),activateOnStart:!0,moveStateManager:new B8({checkCorrectEvent:t=>0===t.button&&!t.ctrlKey}),enable:t,assignEvents:je})}(t),m=new jt(t,r);r.dragPan=new jd(i,p,m),this._add("mousePan",p),this._add("touchPan",m,["touchZoom","touchRotate"]),t.interactive&&t.dragPan&&r.dragPan.enable(t.dragPan);let g=new jn,y=new ji;r.touchZoomRotate=new jp(i,y,g,l),this._add("touchRotate",g,["touchPan","touchZoom"]),this._add("touchZoom",y,["touchPan","touchRotate"]),t.interactive&&t.touchZoomRotate&&r.touchZoomRotate.enable(t.touchZoomRotate),this._add("blockableMapEvent",new B0(r));let v=r.scrollZoom=new jl(r,()=>this._triggerRenderFrame(),this._transformProvider);this._add("scrollZoom",v,["mousePan"]),t.interactive&&t.scrollZoom&&r.scrollZoom.enable(t.scrollZoom);let x=r.keyboard=new js(r,this._transformProvider);this._add("keyboard",x),t.interactive&&t.keyboard&&r.keyboard.enable()}_add(t,r,i){this._handlers.push({handlerName:t,handler:r,allowed:i}),this._handlersById[t]=r}stop(t){if(!this._updatingCamera){for(let{handler:t}of this._handlers)t.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!jy(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,r,i){for(let n in t)if(n!==i&&!r?.includes(n))return!0;return!1}_getMapTouches(t){let r=[];for(let i of t){let t=i.target;this._el.contains(t)&&r.push(i)}return r}mergeHandlerResult(t,r,i,n,a){if(!i)return;xn(t,i);let o={handlerName:n,originalEvent:i.originalEvent||a};void 0!==i.zoomDelta&&(r.zoom=o),void 0!==i.panDelta&&(r.drag=o),void 0!==i.rollDelta&&(r.roll=o),void 0!==i.pitchDelta&&(r.pitch=o),void 0!==i.bearingDelta&&(r.rotate=o)}_applyChanges(){let t={},r={},i={};for(let[n,a,o]of this._changes)n.panDelta&&(t.panDelta=(t.panDelta||new vu(0,0))._add(n.panDelta)),n.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+n.zoomDelta),n.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+n.bearingDelta),n.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+n.pitchDelta),n.rollDelta&&(t.rollDelta=(t.rollDelta||0)+n.rollDelta),void 0!==n.around&&(t.around=n.around),void 0!==n.pinchAround&&(t.pinchAround=n.pinchAround),n.noInertia&&(t.noInertia=n.noInertia),xn(r,a),xn(i,o);this._updateMapTransform(t,r,i),this._changes=[]}_updateMapTransform(t,r,i){let n=this._map,a=this._camera.getTransformForUpdate(),o=n.terrain;if(!zM(t)&&!(o&&this._terrainMovement))return void this._fireEvents(r,i,!0);this._camera.stop(!0);let{panDelta:s,zoomDelta:l,bearingDelta:u,pitchDelta:c,rollDelta:h}=t,{around:d,aroundOnSurface:f}=this._resolveAround(t,o,a),p=o?this._terrainGestureElevation(o,d,f,a,r):void 0,m={panDelta:s,zoomDelta:l,rollDelta:h,pitchDelta:c,bearingDelta:u,around:d,aroundElevation:p};this._camera.cameraHelper.useGlobeControls&&!a.isPointOnMapSurface(d)&&(d=a.centerPoint);let g=this._computePreZoomAroundLoc(a,d,s,p);this._handleMapControls({terrain:o,tr:a,deltasForHelper:m,preZoomAroundLoc:g,combinedEventsInProgress:r,panDelta:s}),this._camera.applyUpdatedTransform(a),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(r,i,!0)}_resolveAround(t,r,i){let n=void 0===t.pinchAround?t.around:t.pinchAround;return n||(n=this._camera.transform.centerPoint),r&&!i.isPointOnMapSurface(n)?{around:i.centerPoint,aroundOnSurface:!1}:{around:n,aroundOnSurface:!0}}_terrainGestureElevation(t,r,i,n,a){if(!i)return;if(!this._terrainMovement&&(a.drag||a.zoom)){let i=n.screenTerrainPointToMercatorCoordinate(r,t);this._terrainGestureAnchorElevation=i?i.z:null}if(null===this._terrainGestureAnchorElevation)return;let o=this._terrainGestureAnchorElevation;if(!(.01>r.distSqr(n.centerPoint))&&!(o-n.elevation>=.9*(n.getCameraAltitude()-n.elevation)))return o}_computePreZoomAroundLoc(t,r,i,n){if(.01>r.distSqr(t.centerPoint))return t.center;let a=i?r.sub(i):r;return void 0===n?t.screenPointToLocation(a):t.screenPointToLocationAtElevation(a,n)}_handleMapControls({terrain:t,tr:r,deltasForHelper:i,preZoomAroundLoc:n,combinedEventsInProgress:a,panDelta:o}){let s=this._camera.cameraHelper;if(s.handleMapControlsRollPitchBearingZoom(i,r),!t)return void s.handleMapControlsPan(i,r,n);if(s.useGlobeControls){!this._terrainMovement&&(a.drag||a.zoom)&&(this._terrainMovement=!0,this._camera.elevationFreeze=!0),s.handleMapControlsPan(i,r,n);return}if(!this._terrainMovement&&(a.drag||a.zoom)){this._terrainMovement=!0,this._camera.elevationFreeze=!0,s.handleMapControlsPan(i,r,n);return}void 0===i.aroundElevation&&a.drag&&this._terrainMovement&&o?r.setCenter(r.screenPointToLocation(r.centerPoint.sub(o))):s.handleMapControlsPan(i,r,n)}_fireEvents(t,r,i){let n=jy(this._eventsInProgress),a=jy(t),o={};for(let r in t){let{originalEvent:i}=t[r];this._eventsInProgress[r]||(o[`${r}start`]=i),this._eventsInProgress[r]=t[r]}for(let t in!n&&a&&this._fireEvent("movestart",a.originalEvent),o)this._fireEvent(t,o[t]);for(let r in a&&this._fireEvent("move",a.originalEvent),t){let{originalEvent:i}=t[r];this._fireEvent(r,i)}let s={},l;for(let t in this._eventsInProgress){let{handlerName:i,originalEvent:n}=this._eventsInProgress[t];this._handlersById[i].isActive()||(delete this._eventsInProgress[t],l=r[i]||n,s[`${t}end`]=l)}for(let t in s)this._fireEvent(t,s[t]);let u=jy(this._eventsInProgress),c=(n||a)&&!u;if(c&&this._terrainMovement){this._camera.elevationFreeze=!1,this._terrainMovement=!1,this._terrainGestureAnchorElevation=null;let t=this._camera.getTransformForUpdate();this._map.getCenterClampedToGround()&&t.recalculateZoomAndCenter(this._map.terrain),this._camera.applyUpdatedTransform(t)}if(i&&c){this._updatingCamera=!0;let t=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),r=t=>0!==t&&-this._bearingSnap{delete this._frameId,this.handleEvent(new jv("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){void 0===this._frameId&&(this._frameId=this._requestFrame())}},jb=class extends MP{constructor(t){var r,i,n;super(),this._renderFrameCallback=()=>{let t=Math.min((Lu()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this.transform=new OD,this.cameraHelper=new OC,void 0!==t.minZoom&&this.transform.setMinZoom(t.minZoom),void 0!==t.maxZoom&&this.transform.setMaxZoom(t.maxZoom),void 0!==t.minPitch&&this.transform.setMinPitch(t.minPitch),void 0!==t.maxPitch&&this.transform.setMaxPitch(t.maxPitch),void 0!==t.renderWorldCopies&&this.transform.setRenderWorldCopies(t.renderWorldCopies),null!==t.transformConstrain&&this.transform.setConstrainOverride(t.transformConstrain),this._moving=!1,this._zooming=!1,this._bearingSnap=t.bearingSnap,this._zoomSnap=t.zoomSnap,this._requestRenderFrame=t.requestRenderFrame,this._cancelRenderFrame=t.cancelRenderFrame,this.terrain=t.terrain,this._centerClampedToGround=null==(r=t.centerClampedToGround)||r,this.transformCameraUpdate=null!=(i=t.transformCameraUpdate)?i:null,this._stopHandlers=null!=(n=t.stopHandlers)?n:()=>{},this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(t,r){if(t.apply(this.transform,!0),this.transform=t,this.cameraHelper=r,this._requestedCameraState){let r=t.clone();r.apply(this._requestedCameraState,!0),this._requestedCameraState=r}}getCenter(){return new DQ(this.transform.center.lng,this.transform.center.lat)}setCenter(t,r){return this.jumpTo({center:t},r)}getCenterElevation(){return this.transform.elevation}setCenterElevation(t,r){return this.jumpTo({elevation:t},r),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(t){this._centerClampedToGround=t}panBy(t,r,i){return t=vu.convert(t).mult(-1),this.panTo(this.transform.center,xn({offset:t},r),i)}panTo(t,r,i){return this.easeTo(xn({center:t},r),i)}getZoom(){return this.transform.zoom}setZoom(t,r){return this.jumpTo({zoom:t},r),this}zoomTo(t,r,i){return this.easeTo(xn({zoom:t},r),i)}zoomIn(t,r){return this.zoomTo(xl(this.getZoom()+1,this._zoomSnap),t,r),this}zoomOut(t,r){return this.zoomTo(xl(this.getZoom()-1,this._zoomSnap),t,r),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(t,r){return t!=this.transform.fov&&(this.transform.setFov(t),this.fire(new zQ("movestart",r)).fire(new zQ("move",r)).fire(new zQ("moveend",r))),this}getBearing(){return this.transform.bearing}setZoomSnap(t){return this._zoomSnap=t,this}getZoomSnap(){return this._zoomSnap}setBearing(t,r){return this.jumpTo({bearing:t},r),this}getPadding(){return this.transform.padding}setPadding(t,r){return this.jumpTo({padding:t},r),this}rotateTo(t,r,i){return this.easeTo(xn({bearing:t},r),i)}resetNorth(t,r){return this.rotateTo(0,xn({duration:1e3},t),r),this}resetNorthPitch(t,r){return this.easeTo(xn({bearing:0,pitch:0,roll:0,duration:1e3},t),r),this}snapToNorth(t,r){return Math.abs(this.getBearing()){m.easeFunc(n),this.terrain&&!t.freezeElevation&&this._updateElevation(n),this.applyUpdatedTransform(i),this._fireMoveEvents(r)},i=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r,i)},t),this}_prepareEase(t,r,i={}){this._moving=!0,r||i.moving||this.fire(new zQ("movestart",t)),this._zooming&&!i.zooming&&this.fire(new zQ("zoomstart",t)),this._rotating&&!i.rotating&&this.fire(new zQ("rotatestart",t)),this._pitching&&!i.pitching&&this.fire(new zQ("pitchstart",t)),this._rolling&&!i.rolling&&this.fire(new zQ("rollstart",t))}_prepareElevation(t){this._elevationCenter=t,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLat(t,this.transform),this.elevationFreeze=!0}_updateElevation(t){(void 0===this._elevationStart||void 0===this._elevationCenter)&&this._prepareElevation(this.transform.center),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));let r=this.terrain.getElevationForLngLat(this._elevationCenter,this.transform);if(t<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,n=(r-(i*t+this._elevationStart))/(1-t);this._elevationStart+=t*(i-n),this._elevationTarget=r}this.transform.setElevation(kx.number(this._elevationStart,this._elevationTarget,t))}_finalizeElevation(){this.elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(t){if(!this.terrain&&t.elevation>=0&&t.pitch<=90)return{};let r=t.getCameraLngLat(),i=t.getCameraAltitude(),n=this.terrain?this.terrain.getElevationForLngLatZoom(r,t.zoom):0;if(ithis._elevateCameraIfInsideTerrain(t)),this.transformCameraUpdate&&r.push(t=>this.transformCameraUpdate(t)),!r.length)return;let i=t.clone();for(let t of r){let r=i.clone(),{center:n,zoom:a,roll:o,pitch:s,bearing:l,elevation:u}=t(r);n&&r.setCenter(n),void 0!==u&&r.setElevation(u),void 0!==a&&r.setZoom(a),void 0!==o&&r.setRoll(o),void 0!==s&&r.setPitch(s),void 0!==l&&r.setBearing(l),i.apply(r,!1)}this.transform.apply(i,!1)}_fireMoveEvents(t){this.fire(new zQ("move",t)),this._zooming&&this.fire(new zQ("zoom",t)),this._rotating&&this.fire(new zQ("rotate",t)),this._pitching&&this.fire(new zQ("pitch",t)),this._rolling&&this.fire(new zQ("roll",t))}_afterEase(t,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let i=this._zooming,n=this._rotating,a=this._pitching,o=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,i&&this.fire(new zQ("zoomend",t)),n&&this.fire(new zQ("rotateend",t)),a&&this.fire(new zQ("pitchend",t)),o&&this.fire(new zQ("rollend",t)),this.fire(new zQ("moveend",t))}flyTo(t,r){if(!t.essential&&zH.prefersReducedMotion){let i=xa(t,["center","zoom","bearing","pitch","roll","elevation","padding"]);return this.jumpTo(i,r)}this.stop(),void 0!==(t=xn({offset:[0,0],speed:1.2,curve:1.42,easing:Mp},t)).zoom&&this._zoomSnap&&(t.zoom=xl(t.zoom,this._zoomSnap));let i=this.getTransformForUpdate(),n=i.bearing,a=i.pitch,o=i.roll,s=i.padding,l=void 0===t.bearing?n:this._normalizeBearing(t.bearing,n),u=void 0===t.pitch?a:+t.pitch,c=void 0===t.roll?o:this._normalizeBearing(t.roll,o),h=void 0===t.padding?i.padding:t.padding,d=vu.convert(t.offset),f=i.centerPoint.add(d),p=i.screenPointToLocation(f),m=this.cameraHelper.handleFlyTo(i,{bearing:l,pitch:u,roll:c,padding:h,locationAtOffset:p,offsetAsPoint:d,center:t.center,minZoom:t.minZoom,zoom:t.zoom}),g=t.curve,y=Math.max(i.width,i.height),v=y/m.scaleOfZoom,x=m.pixelPathLength,b=y/m.scaleOfMinZoom,_=(g=Math.min(g,Math.sqrt(b/x*2)))*g;function w(t){let r=(v*v-y*y+(t?-1:1)*_*_*x*x)/(2*(t?v:y)*_*x);return Math.log(Math.sqrt(r*r+1)-r)}function T(t){return(Math.exp(t)-Math.exp(-t))/2}function A(t){return(Math.exp(t)+Math.exp(-t))/2}let M=w(!1),k=function(t){return A(M)/A(M+g*t)},S=function(t){var r;return y*((A(M)*(T(r=M+g*t)/A(r))-T(M))/_)/x},E=(w(!0)-M)/g;if(2e-6>Math.abs(x)||!isFinite(E)){if(1e-6>Math.abs(y-v))return this.easeTo(t,r);let i=v0,k=t=>Math.exp(i*g*t)}if(void 0!==t.duration)t.duration=+t.duration;else{let r=void 0===t.screenSpeed?+t.speed:t.screenSpeed/g;t.duration=1e3*E/r}return t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=n!==l,this._pitching=u!==a,this._rolling=c!==o,this._padding=!i.isPaddingEqual(h),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(m.targetCenter),this._ease(p=>{let g=p*E,y=1/k(g),v=S(g);this._rotating&&i.setBearing(kx.number(n,l,p)),this._pitching&&i.setPitch(kx.number(a,u,p)),this._rolling&&i.setRoll(kx.number(o,c,p)),this._padding&&(i.interpolatePadding(s,h,p),f=i.centerPoint.add(d)),m.easeFunc(p,y,v,f),this.terrain&&!t.freezeElevation&&this._updateElevation(p),this.applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&t.freezeElevation&&this._finalizeElevation(),this._afterEase(r)},t),this}isEasing(){return!!this._easeFrameId}stop(t){return this._stop(t)}_stop(t,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let t=this._onEaseEnd;delete this._onEaseEnd,t.call(this,r)}return t||this._stopHandlers(),this}_ease(t,r,i){!1===i.animate||0===i.duration?(t(1),r()):(this._easeStart=Lu(),this._easeOptions=i,this._onEaseFrame=t,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(t,r){let i=Math.abs((t=xi(t,-180,180))-r);return Math.abs(t-360-r)MapLibre
'},jw=class{constructor(t=j_){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=t=>{t&&("terrain"===t.type||"style"===t.dataType||"source"===t.dataType&&("metadata"===t.sourceDataType||"visibility"===t.sourceDataType))&&this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1===this._compact?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=t}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options.compact,this._container=zZ.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=zZ.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=zZ.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,r){let i=this._map._getUIString(`AttributionControl.${r}`);t.title=i,t.setAttribute("aria-label",i)}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(t=>"string"==typeof t?t:"")):"string"==typeof this.options.customAttribution&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let t=this._map.style.stylesheet;this.styleOwner=t.owner,this.styleId=t.id}let r=this._map.style.tileManagers;for(let i in r){let n=r[i];if(n.used||n.usedForTerrain){let r=n.getSource();r.attribution&&!t.includes(r.attribution)&&t.push(r.attribution)}}(t=t.filter(t=>String(t).trim())).sort((t,r)=>t.length-r.length);let i=(t=t.filter((r,i)=>{for(let n=i+1;n{let t=this._container.children;if(t.length){let r=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?!1!==this._compact&&r.classList.add("maplibregl-compact"):r.classList.remove("maplibregl-compact")}},this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){var r;this._map=t,this._compact=null==(r=this.options)?void 0:r.compact,this._container=zZ.create("div","maplibregl-ctrl");let i=zZ.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}},jA=class{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let r=++this._id;return this._queue.push({callback:t,id:r,cancelled:!1}),r}remove(t){let r=this._currentlyRunning;for(let i of r?this._queue.concat(r):this._queue)if(i.id===t){i.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw Error("Attempting to run(), but is already running.");let r=this._currentlyRunning=this._queue;this._queue=[];let i=!1,n;for(let a of r)if(!a.cancelled){try{a.callback(t)}catch(t){i||(i=!0,n=t)}if(this._cleared)break}if(this._cleared=!1,this._currentlyRunning=!1,i)throw n}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}},jM=["none","zoom","sourceTiles","visibleLayers","revision"],jk=class{constructor(t,r,i,n){this._tileKeys=t.map(t=>t.key).sort().join(),this._revision=r,this._zoom=i,this._visibleLayerIds=n}difference(t){return this._revision===t?._revision?this._visibleLayerIds===t._visibleLayerIds?this._tileKeys===t._tileKeys?this._zoom===t._zoom?"none":"zoom":"sourceTiles":"visibleLayers":"revision"}},jS={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0},jE=class{constructor(t,r){this.needsFollowUpFrame=!1,this.painter=t,this.terrain=r,this.rttSize=r.tileManager.tileSize*r.qualityFactor}getTexture(t){return t.getRTT(this._stacks.length-1).texture}prepareForRender(t,r){let i=r!==this._lastPrepareZoom;this._lastPrepareZoom=r,this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.tileManager.getRenderableTiles(),this._renderableLayerIds=t._order.filter(i=>!t._layers[i].isHidden(r));let n=this._renderableLayerIds.join(),a=new Set;for(let r of this._renderableLayerIds){let i=t._layers[r],n=i.source;n&&jS[i.type]&&a.add(n)}for(let i of(this._coordsAscending={},this._rttFingerprints={},a)){let a=t.tileManagers[i];if(!a)continue;this._coordsAscending[i]={};let o=this._coordsAscending[i],s=a.getSource(),l=s instanceof FO?s.terrainTileRanges:null;for(let t of a.getVisibleCoordinates()){let r=this.terrain.tileManager.getTerrainCoords(t,l);for(let t in r)o[t]||(o[t]=[]),o[t].push(r[t])}this._rttFingerprints[i]={};let u=this._rttFingerprints[i],c=a.getState().revision;for(let t in o)u[t]=new jk(o[t],c,r,n)}this.needsFollowUpFrame=!1;let o=i||this.painter.options.moving,s=!1;for(let t of this._renderableTiles){let r=this._textureDifference(t);"none"!==r&&("zoom"===r&&o||"visibleLayers"===r&&i?this.needsFollowUpFrame=!0:"zoom"===r||"sourceTiles"===r?(s?this.needsFollowUpFrame=!0:t.releaseRTT(this.painter),s=!0):t.releaseRTT(this.painter))}}_textureDifference(t){let r="none";for(let i in this._rttFingerprints){let n=this._rttFingerprints[i][t.tileID.key];if(!n)continue;let a=n.difference(t.rttFingerprint[i]);jM.indexOf(a)>jM.indexOf(r)&&(r=a)}return r}renderLayer(t,r){if(t.isHidden(this.painter.transform.zoom))return!1;let i=p(f({},r),{isRenderingToTexture:!0}),n=t.type,a=this.painter,o=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(jS[n]&&(this._prevType&&jS[this._prevType]||this._stacks.push([]),this._prevType=n,this._stacks[this._stacks.length-1].push(t.id),!o))return!0;if(jS[this._prevType]||jS[n]&&o){this._prevType=n;let t=this._stacks.length-1,r=this._stacks[t]||[];for(let n of this._renderableTiles){if(this._rttTiles.push(n),n.getRTT(t))continue;let o=n.acquireRTT(a,t,this.rttSize);for(let t of(a.bindRTT(o),a.context.clear({color:kt.transparent,stencil:0}),a.currentStencilSource=void 0,r)){let r=a.style._layers[t],o=r.source?this._coordsAscending[r.source][n.tileID.key]:[n.tileID];a.context.viewport.set([0,0,this.rttSize,this.rttSize]),a.renderTileClippingMasks(r,o,!0),a.renderLayer(a,a.style.tileManagers[r.source],r,o,i),r.source&&(n.rttFingerprint[r.source]=this._rttFingerprints[r.source][n.tileID.key])}o.texture.generateMipmap()}return function(t,r,i,n){let{isRenderingGlobe:a}=n,o=t.context,s=o.gl,l=t.transform,u=t.colorModeForRenderPass(),c=t.getDepthModeFor3D(),h=t.useProgram("terrain");for(let n of(o.bindFramebuffer.set(null),o.viewport.set([0,0,t.width,t.height]),i)){let i=r.getTerrainMesh(n.tileID),d=t.renderToTexture.getTexture(n),f=r.getTerrainData(n.tileID);o.activeTexture.set(s.TEXTURE0),d.bind(s.LINEAR,s.CLAMP_TO_EDGE,s.LINEAR_MIPMAP_LINEAR);let p=OZ(r.getSkirtLength(l.zoom),l.calculateFogMatrix(n.tileID.toUnwrapped()),t.style.sky,l.pitch,a),m=l.getProjectionData({overscaledTileID:n.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});h.draw(o,s.TRIANGLES,c,BC.disabled,u,BI.backCCW,p,f,m,"terrain",i.vertexBuffer,i.indexBuffer,i.segments)}}(this.painter,this.terrain,this._rttTiles,i),this._rttTiles=[],jS[n]}return!1}},jD={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Drag to rotate map, click to reset north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},jC={hash:!1,interactive:!0,bearingSnap:7,zoomSnap:0,attributionControl:j_,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:MA.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,transformConstrain:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,rotateSpeed:.8,pitchSpeed:-.5,reduceMotion:void 0,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0,terrainSkirtLength:"auto",zoomLevelsToOverscale:4,anisotropicFilterPitch:20},jI=class extends MP{get _ownerWindow(){var t,r;return(null==(r=null==(t=this._container)?void 0:t.ownerDocument)?void 0:r.defaultView)||window}constructor(t){var r,i,n;super(),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new jA,this._controls=[],this._mapId=Mm++,this._styleUrl=null,this._missingStyleImageResolver=null,this._lostContextStyle={style:null,images:null},this._contextLost=t=>{if(t.preventDefault(),this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this.painter.destroy(),this._lostContextStyle=this._getStyleAndImages(),!this.style)return void this.fire(new z9("webglcontextlost",{originalEvent:t}));for(let t of Object.values(this.style._layers))if("custom"===t.type&&console.warn(`Custom layer with id '${t.id}' cannot be restored after WebGL context loss. You will need to re-add it manually after context restoration.`),t._listeners)for(let[r]of Object.entries(t._listeners))console.warn(`Custom layer with id '${t.id}' had event listeners for event '${r}' which cannot be restored after WebGL context loss. You will need to re-add them manually after context restoration.`);this.style.destroy(),this.style=null,this.fire(new z9("webglcontextlost",{originalEvent:t}))},this._contextRestored=t=>{if(this._lostContextStyle.style&&this.setStyle(this._lostContextStyle.style,{diff:!1}),this._lostContextStyle.images&&this.style)for(let t in this.style.imageManager.images=this._lostContextStyle.images,this._lostContextStyle.images){let r=this._lostContextStyle.images[t];r.isWebGLImage&&this.style.imageManager.updateImage(t,r,!1)}this._lostContextStyle={style:null,images:null};try{this._setupPainter()}catch(t){this.fire(new ML(t));return}this.resize(),this._update(),this._resizeInternal(),this.fire(new z9("webglcontextrestored",{originalEvent:t}))},this._onMapScroll=t=>{if(t.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()};let a=p(f(f({},jC),t),{canvasContextAttributes:f(f({},jC.canvasContextAttributes),t.canvasContextAttributes)});if(null!=a.minZoom&&null!=a.maxZoom&&a.minZoom>a.maxZoom)throw Error("maxZoom must be greater than or equal to minZoom");if(null!=a.minPitch&&null!=a.maxPitch&&a.minPitch>a.maxPitch)throw Error("maxPitch must be greater than or equal to minPitch");if(null!=a.minPitch&&a.minPitch<0)throw Error("minPitch must be greater than or equal to 0");if(null!=a.maxPitch&&a.maxPitch>180)throw Error("maxPitch must be less than or equal to 180");this._camera=new jb({minZoom:a.minZoom,maxZoom:a.maxZoom,minPitch:a.minPitch,maxPitch:a.maxPitch,bearingSnap:a.bearingSnap,zoomSnap:a.zoomSnap,renderWorldCopies:a.renderWorldCopies,centerClampedToGround:a.centerClampedToGround,terrain:this.terrain,transformConstrain:a.transformConstrain,requestRenderFrame:t=>this._requestRenderFrame(t),cancelRenderFrame:t=>this._cancelRenderFrame(t),transformCameraUpdate:a.transformCameraUpdate,stopHandlers:()=>{var t;return null==(t=this._handlers)?void 0:t.stop(!1)}}),this._camera.setEventedParent(this),this._interactive=a.interactive,this._maxTileCacheSize=a.maxTileCacheSize,this._maxTileCacheZoomLevels=a.maxTileCacheZoomLevels,this._canvasContextAttributes=f({},a.canvasContextAttributes),this._trackResize=!0===a.trackResize,this._terrainSkirtLength=a.terrainSkirtLength,this._refreshExpiredTiles=!0===a.refreshExpiredTiles,this._fadeDuration=a.fadeDuration,this._crossSourceCollisions=!0===a.crossSourceCollisions,this._collectResourceTiming=!0===a.collectResourceTiming,this._locale=f(f({},jD),a.locale),this._clickTolerance=a.clickTolerance,this._overridePixelRatio=a.pixelRatio,this._maxCanvasSize=a.maxCanvasSize,this._zoomLevelsToOverscale=a.zoomLevelsToOverscale,this.cancelPendingTileRequestsWhileZooming=!0===a.cancelPendingTileRequestsWhileZooming,this.setAnisotropicFilterPitch(a.anisotropicFilterPitch),void 0!==a.reduceMotion&&(zH.prefersReducedMotion=a.reduceMotion),this._requestManager=new zK(a.transformRequest),this._container=this._resolveContainer(a.container),a.maxBounds&&this.setMaxBounds(a.maxBounds),this._setupContainer();try{this._setupPainter()}catch(t){throw this._cleanupContainer(),t}this._imageQueueHandle=zX.addThrottleControl(()=>this.isMoving()),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.depthDirty=!0,this._update(!0)}),this.once("idle",()=>this._idleTriggered=!0),this._handlers=new jx(this,this._camera,a),"u">typeof window&&(this._ownerWindow.addEventListener("online",this._onWindowOnline,!1),this._setupResizeObserver());let o="string"==typeof a.hash&&a.hash||void 0;this._hash=a.hash?new BH(o).addTo(this):void 0,null!=(r=this._hash)&&r._onHashChange()||(this.jumpTo({center:a.center,elevation:a.elevation,zoom:a.zoom,bearing:a.bearing,pitch:a.pitch,roll:a.roll}),a.bounds&&(this.resize(),this.fitBounds(a.bounds,xn({},a.fitBoundsOptions,{duration:0}))));let s="string"==typeof a.style||(null==(n=null==(i=a.style)?void 0:i.projection)?void 0:n.type)!=="globe";this.resize(null,s),this._localIdeographFontFamily=a.localIdeographFontFamily,this._validateStyle=a.validateStyle,a.style&&this.setStyle(a.style,{localIdeographFontFamily:a.localIdeographFontFamily}),a.attributionControl&&this.addControl(new jw("boolean"==typeof a.attributionControl?void 0:a.attributionControl)),a.maplibreLogo&&this.addControl(new jT,a.logoPosition),this.on("style.load",()=>{if(s||this._resizeTransform(),this._camera.transform.unmodified){let t=xa(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(t)}}),this.on("data",t=>{this._update("style"===t.dataType),this.fire("style"===t.dataType?new z1("styledata",t):new z2("sourcedata",t))}),this.on("dataloading",t=>{this.fire("style"===t.dataType?new z1("styledataloading",t):new z2("sourcedataloading",t))}),this.on("dataabort",t=>{this.fire(new z2("sourcedataabort",t))})}_getMapId(){return this._mapId}setGlobalStateProperty(t,r){return this.style.setGlobalStateProperty(t,r),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}addControl(t,r){if(void 0===r&&(r=t.getDefaultPosition?t.getDefaultPosition():"top-right"),!t?.onAdd)return this.fire(new ML(Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));let i=t.onAdd(this);this._controls.push(t);let n=this._controlPositions[r];return r.includes("bottom")?n.insertBefore(i,n.firstChild):n.appendChild(i),this}removeControl(t){if(!t?.onRemove)return this.fire(new ML(Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(t);return r>-1&&this._controls.splice(r,1),t.onRemove(this),this}hasControl(t){return this._controls.includes(t)}coveringTiles(t){return L$(this._camera.transform,t)}setTransformCameraUpdate(t){this._camera.transformCameraUpdate=t}getCenter(){return new DQ(this._camera.transform.center.lng,this._camera.transform.center.lat)}setCenter(t,r){return this._camera.setCenter(t,r),this}getCenterElevation(){return this._camera.transform.elevation}setCenterElevation(t,r){return this._camera.setCenterElevation(t,r),this}setCenterClampedToGround(t){this._camera.setCenterClampedToGround(t)}panBy(t,r,i){return this._camera.panBy(t,r,i),this}panTo(t,r,i){return this._camera.panTo(t,r,i),this}getZoom(){return this._camera.transform.zoom}setZoom(t,r){return this._camera.setZoom(t,r),this}zoomTo(t,r,i){return this._camera.zoomTo(t,r,i),this}zoomIn(t,r){return this._camera.zoomIn(t,r),this}zoomOut(t,r){return this._camera.zoomOut(t,r),this}getVerticalFieldOfView(){return this._camera.transform.fov}setVerticalFieldOfView(t,r){return this._camera.setVerticalFieldOfView(t,r),this}getBearing(){return this._camera.transform.bearing}setBearing(t,r){return this._camera.setBearing(t,r),this}getZoomSnap(){return this._camera.getZoomSnap()}setZoomSnap(t){return this._camera.setZoomSnap(t),this}getPadding(){return this._camera.transform.padding}setPadding(t,r){return this._camera.setPadding(t,r),this}rotateTo(t,r,i){return this._camera.rotateTo(t,r,i),this}resetNorth(t,r){return this._camera.resetNorth(t,r),this}resetNorthPitch(t,r){return this._camera.resetNorthPitch(t,r),this}snapToNorth(t,r){return this._camera.snapToNorth(t,r),this}getPitch(){return this._camera.transform.pitch}setPitch(t,r){return this._camera.setPitch(t,r),this}getRoll(){return this._camera.transform.roll}setRoll(t,r){return this._camera.setRoll(t,r),this}cameraForBounds(t,r){return this._camera.cameraForBounds(t,r)}fitBounds(t,r,i){return this._camera.fitBounds(t,r,i),this}fitScreenCoordinates(t,r,i,n,a){return this._camera.fitScreenCoordinates(t,r,i,n,a),this}jumpTo(t,r){return this._camera.jumpTo(t,r),this}calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a){return this._camera.calculateCameraOptionsFromCameraLngLatAltRotation(t,r,i,n,a)}easeTo(t,r){return this._camera.easeTo(t,r),this}flyTo(t,r){return this._camera.flyTo(t,r),this}stop(){return this._camera.stop(),this}queryTerrainElevation(t){return this.terrain?this.terrain.getElevationForLngLat(DQ.convert(t),this._camera.transform):null}getCenterClampedToGround(){return this._camera.getCenterClampedToGround()}calculateCameraOptionsFromTo(t,r,i,n){return null==n&&this.terrain&&(n=this.terrain.getElevationForLngLat(i,this._camera.transform)),this._camera.transform.calculateCameraOptionsFromTo(t,r,i,n??0)}resize(t,r=!0){if(null!==this._lostContextStyle.style)return this;this._resizeInternal(r);let i=!this._camera._moving;return i&&(this.stop(),this.fire(new zQ("movestart",t)).fire(new zQ("move",t))),this.fire(new zJ("resize",t)),i&&this.fire(new zQ("moveend",t)),this}_resizeInternal(t=!0){let[r,i]=this._containerDimensions(),n=this._getClampedPixelRatio(r,i);if(this._resizeCanvas(r,i,n),this.painter.resize(r,i,n),this.painter.overLimit()){let t=this.painter.context.gl;this._maxCanvasSize=[t.drawingBufferWidth,t.drawingBufferHeight];let n=this._getClampedPixelRatio(r,i);this._resizeCanvas(r,i,n),this.painter.resize(r,i,n)}this._resizeTransform(t)}_resizeTransform(t=!0){var r;let[i,n]=this._containerDimensions();this._camera.transform.resize(i,n,t),null==(r=this._camera._requestedCameraState)||r.resize(i,n,t)}_getClampedPixelRatio(t,r){let{0:i,1:n}=this._maxCanvasSize,a=this.getPixelRatio(),o=t*a,s=r*a,l=Math.min(o>i?i/o:1,s>n?n/s:1);return l<1&&xf("The canvas is larger than maxCanvasSize and is rendered at a lower pixel ratio to fit. Increase maxCanvasSize, within MAX_TEXTURE_SIZE, to render at full resolution."),l*a}getPixelRatio(){var t;return null!=(t=this._overridePixelRatio)?t:devicePixelRatio}setPixelRatio(t){this._overridePixelRatio=t,this.resize()}getBounds(){return this._camera.transform.getBounds()}getMaxBounds(){return this._camera.transform.getMaxBounds()}setMaxBounds(t){return this._camera.transform.setMaxBounds(FA.convert(t)),this._update()}setMinZoom(t){if(t??(t=-2),t>=-2&&t<=this._camera.transform.maxZoom){let r=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMinZoom(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.zoom&&this.fire(new zQ("zoomstart")).fire(new zQ("zoom")).fire(new zQ("zoomend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(t=!1){let r=this._camera.transform;return t?r.applyConstrain(r.center,r.minZoom).zoom:r.minZoom}setMaxZoom(t){if(t??(t=22),t>=this._camera.transform.minZoom){let r=this._camera.transform.zoom,i=this._camera.getTransformForUpdate();return i.setMaxZoom(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.zoom&&this.fire(new zQ("zoomstart")).fire(new zQ("zoom")).fire(new zQ("zoomend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this._camera.transform.maxZoom}setMinPitch(t){if(t??(t=0),t<0)throw Error("minPitch must be greater than or equal to 0");if(t>=0&&t<=this._camera.transform.maxPitch){let r=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMinPitch(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.pitch&&this.fire(new zQ("pitchstart")).fire(new zQ("pitch")).fire(new zQ("pitchend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this._camera.transform.minPitch}setMaxPitch(t){if(t??(t=60),t>180)throw Error("maxPitch must be less than or equal to 180");if(t>=this._camera.transform.minPitch){let r=this._camera.transform.pitch,i=this._camera.getTransformForUpdate();return i.setMaxPitch(t),this._camera.applyUpdatedTransform(i),this._update(),r!==this._camera.transform.pitch&&this.fire(new zQ("pitchstart")).fire(new zQ("pitch")).fire(new zQ("pitchend")).fire(new zQ("movestart")).fire(new zQ("move")).fire(new zQ("moveend")),this}throw Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this._camera.transform.maxPitch}getAnisotropicFilterPitch(){return this._anisotropicFilterPitch}setAnisotropicFilterPitch(t){if(t??(t=20),t>180)throw Error("anisotropicFilterPitch must be less than or equal to 180");if(t<0)throw Error("anisotropicFilterPitch must be greater than or equal to 0");return this._anisotropicFilterPitch=t,this._update()}getRenderWorldCopies(){return this._camera.transform.renderWorldCopies}setRenderWorldCopies(t){return this._camera.transform.setRenderWorldCopies(t),this._update()}setTransformConstrain(t){return this._camera.transform.setConstrainOverride(t),this._update()}project(t){return this._camera.transform.locationToScreenPoint(DQ.convert(t),this.style&&this.terrain)}unproject(t){return this._camera.transform.screenPointToLocation(vu.convert(t),this.terrain)}isMoving(){var t;return this._camera.isMoving()||(null==(t=this._handlers)?void 0:t.isMoving())||!1}isZooming(){var t;return this._camera.isZooming()||(null==(t=this._handlers)?void 0:t.isZooming())||!1}isRotating(){var t;return this._camera.isRotating()||(null==(t=this._handlers)?void 0:t.isRotating())||!1}_createDelegatedListener(t,r,i){if("mouseenter"===t||"mouseover"===t){let n=!1;return{layers:r,listener:i,delegates:{mousemove:a=>{let o=r.filter(t=>this.getLayer(t)),s=0===o.length?[]:this.queryRenderedFeatures(a.point,{layers:o});s.length?n||(n=!0,i.call(this,new z3(t,this,a.originalEvent,{features:s}))):n=!1},mouseout:()=>{n=!1}}}}if("mouseleave"===t||"mouseout"===t){let n=!1;return{layers:r,listener:i,delegates:{mousemove:a=>{let o=r.filter(t=>this.getLayer(t));(0===o.length?[]:this.queryRenderedFeatures(a.point,{layers:o})).length?n=!0:n&&(n=!1,i.call(this,new z3(t,this,a.originalEvent)))},mouseout:r=>{n&&(n=!1,i.call(this,new z3(t,this,r.originalEvent)))}}}}{let n=t=>{let n=r.filter(t=>this.getLayer(t)),a=0===n.length?[]:this.queryRenderedFeatures(t.point,{layers:n});a.length&&(t.features=a,i.call(this,t),delete t.features)};return{layers:r,listener:i,delegates:{[t]:n}}}}_saveDelegatedListener(t,r){var i;this._delegatedListeners||(this._delegatedListeners={}),(i=this._delegatedListeners)[t]||(i[t]=[]),this._delegatedListeners[t].push(r)}_removeDelegatedListener(t,r,i){var n;if(!(null!=(n=this._delegatedListeners)&&n[t]))return;let a=this._delegatedListeners[t];for(let t=0;tr.includes(t))){for(let t in n.delegates)this.off(t,n.delegates[t]);a.splice(t,1);return}}}on(t,r,i){if(void 0===i)return super.on(t,r);let n="string"==typeof r?[r]:r,a=this._createDelegatedListener(t,n,i);for(let r in this._saveDelegatedListener(t,a),a.delegates)this.on(r,a.delegates[r]);return{unsubscribe:()=>{this._removeDelegatedListener(t,n,i)}}}once(t,r,i){if(void 0===i)return super.once(t,r);let n="string"==typeof r?[r]:r,a=this._createDelegatedListener(t,n,i);for(let r in a.delegates){let o=a.delegates[r];a.delegates[r]=(...r)=>{this._removeDelegatedListener(t,n,i),o(...r)}}for(let r in this._saveDelegatedListener(t,a),a.delegates)this.once(r,a.delegates[r]);return this}off(t,r,i){if(void 0===i)return super.off(t,r);let n="string"==typeof r?[r]:r;return this._removeDelegatedListener(t,n,i),this}queryRenderedFeatures(t,r){if(!this.style)return[];let i,n=t instanceof vu||Array.isArray(t),a=n?t:[[0,0],[this._camera.transform.width,this._camera.transform.height]];if(r||(r=(n?{}:t)||{}),a instanceof vu||"number"==typeof a[0])i=[vu.convert(a)];else{let t=vu.convert(a[0]),r=vu.convert(a[1]);i=[t,new vu(r.x,t.y),r,new vu(t.x,r.y),t]}return this.style.queryRenderedFeatures(i,r,this._camera.transform)}querySourceFeatures(t,r){return this.style.querySourceFeatures(t,r)}setStyle(t,r){return r=xn({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),this._styleUrl="string"==typeof t?t:null,!1!==r.diff&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&t?(this._diffStyle(t,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(t,r))}setTransformRequest(t){return this._requestManager.setTransformRequest(t),this}_getUIString(t){let r=this._locale[t];if(null==r)throw Error(`Missing UI string '${t}'`);return r}_updateStyle(t,r){var i,n,a;if(null==(i=this._diffStyleRequest)||i.abort(),this._diffStyleRequest=null,r.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(t,r));let o=this.style&&r.transformStyle?this.style.serialize():void 0;return(this.style&&(this.style.setEventedParent(null),this.style._remove(!t)),t)?(this.style=new OG(this,r||{}),this.style.setEventedParent(this,{style:this.style}),"string"==typeof t?this.style.loadURL(t,r,o):this.style.loadJSON(t,r,o)):(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),null==(a=null==(n=this.style)?void 0:n.projection)||a.destroy(),delete this.style),this}_lazyInitEmptyStyle(){this.style||(this.style=new OG(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(t,r){return _(this,null,function*(){var i;if(null==(i=this._diffStyleRequest)||i.abort(),"string"==typeof t){this._diffStyleRequest=new AbortController;let i=this._diffStyleRequest;try{let n=yield this._requestManager.transformRequest(t,"Style");if(i.signal.aborted){this._diffStyleRequest=null;return}let a=yield ME(n,i);this._diffStyleRequest=null,this._updateDiff(a.data,r)}catch(t){this._diffStyleRequest=null,xT(t)||this.fire(new ML(vJ(t)))}}else"object"==typeof t&&(this._diffStyleRequest=null,this._updateDiff(t,r))})}_updateDiff(t,r){try{this.style.setState(t,r)&&this._update(!0)}catch(i){xf(`Unable to perform style diff: ${vJ(i).message}. Rebuilding the style from scratch.`),this._updateStyle(t,r)}}getStyle(){if(this.style)return this.style.serialize()}getStyleUrl(){return this._styleUrl}_getStyleAndImages(){return this.style?{style:this.style.serialize(),images:this.style.imageManager.cloneImages()}:{style:null,images:{}}}isStyleLoaded(){return this.style?this.style.loaded():void xf("There is no style added to the map.")}addSource(t,r){return this._lazyInitEmptyStyle(),this.style.addSource(t,r),this._update(!0)}isSourceLoaded(t){var r;let i=null==(r=this.style)?void 0:r.tileManagers[t];return void 0===i?void this.fire(new ML(Error(`There is no tile manager with ID '${t}'`))):i.loaded()}setTerrain(t,r={}){if(this.style._checkLoaded(),t&&_5(this,Sa.terrain,{value:t},r))return this;if(this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),t){let r=this.style.tileManagers[t.source];if(!r)throw Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);for(let i in null===this.terrain&&r.reload(),this.style._layers){let r=this.style._layers[i];"hillshade"===r.type&&r.source===t.source&&xf("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality."),"color-relief"===r.type&&r.source===t.source&&xf("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain&&this.terrain.destroy(),this.terrain=new OS(this.painter,r,t,this._terrainSkirtLength),this.painter.renderToTexture=new jE(this.painter,this.terrain),this._camera.terrain=this.terrain,this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform)),this._terrainDataCallback=r=>this._handleTerrainDataEvent(r,t.source),this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.destroy(),this.terrain=null,this.painter.renderToTexture=null,this._camera.terrain=null,this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0);return this.style.triggerSymbolPlacement(),this.fire(new z8({terrain:t})),this}_handleTerrainDataEvent(t,r){var i;if("style"===t.dataType)return void this.terrain.tileManager.releaseAllRTT();let n=t.sourceId===r;if(n&&(this.terrain.resetElevationCache(),this.style.triggerSymbolPlacement()),n&&t.tile&&!this._camera.elevationFreeze&&(this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))),t.tile){if((null==(i=t.source)?void 0:i.type)==="image")return void this.terrain.tileManager.releaseAllRTT();this.terrain.tileManager.releaseRTT(t.tile.tileID)}}getTerrain(){var t,r;return null!=(r=null==(t=this.terrain)?void 0:t.options)?r:null}areTilesLoaded(){var t;for(let r of Object.values(null==(t=this.style)?void 0:t.tileManagers))if(!r.areTilesLoaded())return!1;return!0}removeSource(t){return this.style.removeSource(t),this._update(!0)}getSource(t){var r;return null==(r=this.style)?void 0:r.getSource(t)}setSourceTileLodParams(t,r,i){if(i){let n=this.getSource(i);if(!n)throw Error(`There is no source with ID "${i}", cannot set LOD parameters`);n.calculateTileZoom=LG(Math.max(1,t),Math.max(1,r))}else for(let i in this.style.tileManagers)this.style.tileManagers[i].getSource().calculateTileZoom=LG(Math.max(1,t),Math.max(1,r));return this._update(!0),this}refreshTiles(t,r){let i=this.style.tileManagers[t];if(!i)throw Error(`There is no tile manager with ID "${t}", cannot refresh tile`);void 0===r?i.reload(!0):i.refreshTiles(r.map(t=>new Ii(t.z,t.x,t.y)))}addImage(t,r,i={}){var n;this._lazyInitEmptyStyle();let a=this._createStyleImage(r,i);return a&&(this.style.addImage(t,a),null!=(n=a.userImage)&&n.onAdd&&a.userImage.onAdd(this,t)),this}setMissingStyleImageResolver(t){var r;return this._missingStyleImageResolver=t,null==(r=this.style)||r.setMissingImageResolver(t),this}_createStyleImage(t,r={}){let{pixelRatio:i=1,sdf:n=!1,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u}=r;if(t instanceof HTMLImageElement||xg(t)){let{width:r,height:c,data:h}=zH.getImageData(t);return{data:new Dn({width:r,height:c},h),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:0}}if(void 0===t.width||void 0===t.height)return this.fire(new ML(Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`"))),null;{let{width:r,height:c,data:h}=t,d=TP(t.data);return{data:d?new Dn({width:r,height:c}):new Dn({width:r,height:c},new Uint8Array(h)),pixelRatio:i,stretchX:a,stretchY:o,content:s,textFitWidth:l,textFitHeight:u,sdf:n,version:0,isWebGLImage:d,userImage:t}}}updateImage(t,r){let i=this.style.getImage(t);if(!i)return this.fire(new ML(Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let{width:n,height:a,data:o}=r instanceof HTMLImageElement||xg(r)?zH.getImageData(r):r;if(void 0===n||void 0===a)return this.fire(new ML(Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(n!==i.data.width||a!==i.data.height)return this.fire(new ML(Error("The width and height of the updated image must be that same as the previous version of the image")));if(i.isWebGLImage=TP(o),i.isWebGLImage)i.userImage=r;else{let t=!(r instanceof HTMLImageElement||xg(r));i.data.replace(o,t)}return this.style.updateImage(t,i),this}getImage(t){return this.style.getImage(t)}hasImage(t){return t?!!this.style.getImage(t):(this.fire(new ML(Error("Missing required image id"))),!1)}removeImage(t){this.style.removeImage(t)}loadImage(t){return _(this,null,function*(){let r=yield zX.getImage((yield this._requestManager.transformRequest(t,"Image")),new AbortController);if(!r.data)throw Error(`Could not load image ${t}: the response is empty`);return r})}listImages(){var t,r;return null!=(r=null==(t=this.style)?void 0:t.listImages())?r:[]}addLayer(t,r){return this._lazyInitEmptyStyle(),this.style.addLayer(t,r),this._update(!0)}moveLayer(t,r){return this.style.moveLayer(t,r),this._update(!0)}removeLayer(t){return this.style.removeLayer(t),this._update(!0)}getLayer(t){var r;return null==(r=this.style)?void 0:r.getLayer(t)}getLayersOrder(){var t,r;return null!=(r=null==(t=this.style)?void 0:t.getLayersOrder())?r:[]}setLayerZoomRange(t,r,i){return this.style.setLayerZoomRange(t,r,i),this._update(!0)}setFilter(t,r,i={}){var n;return null==(n=this.style)||n.setFilter(t,r,i),this._update(!0)}getFilter(t){return this.style.getFilter(t)}setPaintProperty(t,r,i,n={}){var a;return null==(a=this.style)||a.setPaintProperty(t,r,i,n),this._update(!0)}getPaintProperty(t,r){return this.style.getPaintProperty(t,r)}setLayoutProperty(t,r,i,n={}){return this.style.setLayoutProperty(t,r,i,n),this._update(!0)}getLayoutProperty(t,r){return this.style.getLayoutProperty(t,r)}setGlyphs(t,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(t,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}setFontFaces(t){return this._lazyInitEmptyStyle(),this.style.setFontFaces(t),this._update(!0)}getFontFaces(){return this.style.getFontFaces()}addSprite(t,r,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(t,r,i,t=>{t||this._update(!0)}),this}removeSprite(t){return this._lazyInitEmptyStyle(),this.style.removeSprite(t),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(t,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(t,r,t=>{t||this._update(!0)}),this}setLight(t,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(t,r),this._update(!0)}getLight(){return this.style.getLight()}setSky(t,r={}){return this._lazyInitEmptyStyle(),this.style.setSky(t,r),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(t,r){return this.style.setFeatureState(t,r),this._update()}removeFeatureState(t,r){return this.style.removeFeatureState(t,r),this._update()}getFeatureState(t){return this.style.getFeatureState(t)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let t=0,r=0;return this._container&&(t=this._container.clientWidth||400,r=this._container.clientHeight||300),[t,r]}_shouldHandleInitialResize(){var t;if(!(null!=(t=this._container)&&t.clientWidth)||!this._container.clientHeight)return!1;let[r,i]=this._containerDimensions();return r!==this._camera.transform.width||i!==this._camera.transform.height}_setupResizeObserver(){var t;let r=!1,i=zg(t=>{this._trackResize&&!this._removed&&(this.resize(t),this.redraw())},50),n=null!=(t=this._ownerWindow.ResizeObserver)?t:ResizeObserver;this._resizeObserver=new n(t=>{(r||(r=!0,this._shouldHandleInitialResize()))&&i(t)}),this._resizeObserver.observe(this._container)}_resolveContainer(t){if("string"==typeof t){let r=document.getElementById(t);if(!r)throw Error(`Container '${t}' not found.`);return r}if(t instanceof HTMLElement||t&&"object"==typeof t&&1===t.nodeType)return t;throw Error("Invalid type: 'container' must be a String or HTMLElement.")}_setupContainer(){let t=this._container;t.classList.add("maplibregl-map");let r=this._canvasContainer=zZ.create("div","maplibregl-canvas-container",t);this._interactive&&r.classList.add("maplibregl-interactive"),this._canvas=zZ.create("canvas","maplibregl-canvas",r),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");let i=this._containerDimensions(),n=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],n);let a=this._controlContainer=zZ.create("div","maplibregl-control-container",t),o=this._controlPositions={};for(let t of["top-left","top-right","bottom-left","bottom-right"])o[t]=zZ.create("div",`maplibregl-ctrl-${t} `,a);this._container.addEventListener("scroll",this._onMapScroll,!1)}_cleanupContainer(){this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map")}_resizeCanvas(t,r,i){this._canvas.width=Math.floor(i*t),this._canvas.height=Math.floor(i*r),this._canvas.style.width=`${t}px`,this._canvas.style.height=`${r}px`}_setupPainter(){let t=p(f({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0}),r=null;this._canvas.addEventListener("webglcontextcreationerror",t=>{r=t},{once:!0});let i=this._canvas.getContext("webgl2",t);if(!i)throw new BG(t,r);this.painter=new Bq(i,this._camera.transform)}migrateProjection(t,r){this._camera.migrateProjection(t,r),this.painter.transform=t,this.fire(new z7({newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(t){var r;return null!=(r=this.style)&&r._loaded&&(this._styleDirty||(this._styleDirty=t),this._sourcesDirty=!0,this.triggerRepaint()),this}_requestRenderFrame(t){return this._update(),this._renderTaskQueue.add(t)}_cancelRenderFrame(t){this._renderTaskQueue.remove(t)}_render(t){var r,i,n,a,o;let s=this._idleTriggered?this._fadeDuration:0,l=(null==(r=this.style.projection)?void 0:r.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(t),this._removed)return;let u=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let t=this._camera.transform.zoom,r=Lu();this.style.zoomHistory.update(t,r);let i=new Sc(t,{now:r,fadeDuration:s,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),n=i.crossFadingFactor();(1!==n||n!==this._crossFadingFactor)&&(u=!0,this._crossFadingFactor=n),this.style.update(i)}let c=(null==(i=this.style.projection)?void 0:i.transitionState)>0!==l;this._camera.transform.setTransitionState(null==(n=this.style.projection)?void 0:n.transitionState),this.style&&(this._sourcesDirty||c)&&(this._sourcesDirty=!1,this.style._updateSources(this._camera.transform)),this.terrain?(this.terrain.tileManager.update(this._camera.transform,this.terrain)&&this.terrain.resetElevationCache(),this._camera.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._camera.transform.center,this._camera.transform.tileZoom)),!this._camera.elevationFreeze&&this.getCenterClampedToGround()&&this._camera.transform.setElevation(this.terrain.getElevationForLngLat(this._camera.transform.center,this._camera.transform))):(this._camera.transform.setMinElevationForCurrentTile(0),this.getCenterClampedToGround()&&this._camera.transform.setElevation(0)),this._placementDirty=null==(a=this.style)?void 0:a._updatePlacement(this._camera.transform,this.showCollisionBoxes,s,this._crossSourceCollisions,c),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:s,showPadding:this.showPadding,anisotropicFilterPitch:this.getAnisotropicFilterPitch()}),this.fire(new zJ("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire(new zJ("load"))),this.style&&(this.style.hasTransitions()||u)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let h=this._sourcesDirty||this._styleDirty||this._placementDirty||(null==(o=this.painter.renderToTexture)?void 0:o.needsFollowUpFrame);return h||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new zJ("idle")),!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._render(0)),this}remove(){var t,r;for(let t of(this._hash&&this._hash.remove(),this._controls))t.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest=(this._frameRequest.abort(),null)),this._renderTaskQueue.clear(),null==(t=this._diffStyleRequest)||t.abort(),this.painter.destroy(),this._handlers.destroy(),this.setStyle(null),"u">typeof window&&this._ownerWindow.removeEventListener("online",this._onWindowOnline,!1),zX.removeThrottleControl(this._imageQueueHandle),null==(r=this._resizeObserver)||r.disconnect();let i=this.painter.context.gl.getExtension("WEBGL_lose_context");i?.loseContext&&i.loseContext(),this._cleanupContainer(),this._removed=!0,this.fire(new zJ("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,zH.frame(this._frameRequest,t=>{this._frameRequest=null;try{this._render(t)}catch(t){if(!xT(t))throw t}},()=>{},this._ownerWindow))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())}get showPadding(){return!!this._showPadding}set showPadding(t){this._showPadding!==t&&(this._showPadding=t,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,t?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())}get repaint(){return!!this._repaint}set repaint(t){this._repaint!==t&&(this._repaint=t,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(t){this._vertices=t,this._update()}get version(){return"6.9.0"}getCameraTargetElevation(){return this._camera.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(t){return this._lazyInitEmptyStyle(),this.style.setProjection(t),this._update(!0)}},jL={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0},jP=class{constructor(t){this._updateZoomButtons=()=>{let t=this._map.getZoom(),r=t===this._map.getMaxZoom(),i=t===this._map.getMinZoom(!0);this._zoomInButton.disabled=r,this._zoomOutButton.disabled=i,this._zoomInButton.setAttribute("aria-disabled",r.toString()),this._zoomOutButton.setAttribute("aria-disabled",i.toString())},this._rotateCompassArrow=()=>{let t=this._map.getPitch(),r=this._map.getRoll(),i=this._map.getBearing(),n=1/Math.cos(xv(t))**.5;if(this.options.visualizePitch&&this.options.visualizeRoll){this._compassIcon.style.transform=`scale(${n}) rotateZ(${-r}deg) rotateX(${t}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizePitch){this._compassIcon.style.transform=`scale(${n}) rotateX(${t}deg) rotateZ(${-i}deg)`;return}if(this.options.visualizeRoll){this._compassIcon.style.transform=`rotate(${-i-r}deg)`;return}this._compassIcon.style.transform=`rotate(${-i}deg)`},this._setButtonTitle=(t,r)=>{let i=this._map._getUIString(`NavigationControl.${r}`);t.title=i,t.setAttribute("aria-label",i)},this.options=xn({},jL,t),this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),zZ.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),zZ.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=zZ.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("move",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new jz(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){this._container.remove(),this.options.showZoom&&this._map.off("move",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,r){let i=zZ.create("button",t,this._container);return i.type="button",i.addEventListener("click",r),i}},jz=class{constructor(t,r,i=!1){this.mousedown=t=>{this.startMove(t,zZ.mousePos(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)},this.mousemove=t=>{this.move(t,zZ.mousePos(this.element,t))},this.mouseup=t=>{this._rotatePitchHandler.dragEnd(t),this.offTemp()},this.touchstart=t=>{1===t.targetTouches.length?(this._startPos=this._lastPos=zZ.touchPos(this.element,t.targetTouches)[0],this.startMove(t,this._startPos),window.addEventListener("touchmove",this.touchmove,{passive:!1}),window.addEventListener("touchend",this.touchend)):this.reset()},this.touchmove=t=>{1===t.targetTouches.length?(this._lastPos=zZ.touchPos(this.element,t.targetTouches)[0],this.move(t,this._lastPos)):this.reset()},this.touchend=t=>{0===t.targetTouches.length&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this._rotatePitchHandler.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=r;let n=new B9;this._rotatePitchHandler=new B4({clickTolerance:3,move:(t,n)=>{let a=r.getBoundingClientRect(),o=new vu((a.bottom-a.top)/2,(a.right-a.left)/2);return{bearingDelta:x_(new vu(t.x,n.y),n,o),pitchDelta:i?-((n.y-t.y)*.5):void 0}},moveStateManager:n,enable:!0,assignEvents:()=>{}}),this.map=t,r.addEventListener("mousedown",this.mousedown),r.addEventListener("touchstart",this.touchstart,{passive:!1}),r.addEventListener("touchcancel",this.reset)}startMove(t,r){this._rotatePitchHandler.dragStart(t,r),zZ.disableDrag()}move(t,r){let i=this.map,{bearingDelta:n,pitchDelta:a}=this._rotatePitchHandler.dragMove(t,r)||{};n&&i.setBearing(i.getBearing()+n),a&&i.setPitch(i.getPitch()+a)}off(){let t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){zZ.enableDrag(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup),window.removeEventListener("touchmove",this.touchmove),window.removeEventListener("touchend",this.touchend)}},jO={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},jR={ArrowLeft:[-1,0],ArrowRight:[1,0],ArrowUp:[0,-1],ArrowDown:[0,1]},jj=class extends MI{},jN=class extends MI{},jV=class extends MP{constructor(t){if(super(),this._onClick=t=>{this.fire(new jN("click",{originalEvent:t}))},this._onKeyPress=t=>{("Space"===t.code||"Enter"===t.code)&&this.togglePopup()},this._onKeyDown=t=>{if(!this._defaultMarker||!this._draggable||!this._map||!this._lngLat||t.composedPath()[0]!==this._element||t.altKey||t.ctrlKey||t.metaKey)return;let r=jR[t.key];if(!r)return;t.preventDefault(),t.stopPropagation();let i=t.shiftKey?10:1,n=this._map.project(this._lngLat);this.setLngLat(this._map.unproject(new vu(n.x+r[0]*i,n.y+r[1]*i))),this._keyboardDragActive||(this._keyboardDragActive=!0,this.fire(new jj("dragstart"))),this.fire(new jj("drag"))},this._onKeyUp=t=>{jR[t.key]&&this._endKeyboardDrag()},this._onBlur=()=>{this._endKeyboardDrag()},this._onMapClick=t=>{let r=t.originalEvent.target,i=this._element;this._popup&&(r===i||i.contains(r))&&this.togglePopup()},this._update=t=>{if(!this._map)return;let r=this._map.loaded()&&!this._map.isMoving();t?.type!=="terrain"&&(t?.type!=="render"||r)||this._map.once("render",this._update),this._lngLat=zk(this._lngLat,this._flatPos,this._map._camera.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map._camera.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let i="";"viewport"===this._rotationAlignment||"auto"===this._rotationAlignment?i=`rotateZ(${this._rotation}deg)`:"map"===this._rotationAlignment&&(i=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let n="";"viewport"===this._pitchAlignment||"auto"===this._pitchAlignment?n="rotateX(0deg)":"map"===this._pitchAlignment&&(n=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||t&&"moveend"!==t.type||(this._pos=this._pos.round()),this._element.style.transform=`${jO[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${n} ${i}`,zH.frameAsync(new AbortController,this._map._ownerWindow).then(()=>{this._updateOpacity(t?.type==="moveend")}).catch(()=>{})},this._onMove=t=>{if(!this._isDragging){let r=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none","pending"===this._state&&(this._state="active",this.fire(new jj("dragstart"))),this.fire(new jj("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),"active"===this._state&&this.fire(new jj("dragend")),this._state="inactive"},this._addDragHandler=t=>{this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=t?.anchor||"center",this._color=t?.color||"#3FB1CE",this._scale=t?.scale||1,this._draggable=t?.draggable||!1,this._clickTolerance=t?.clickTolerance||0,this._subpixelPositioning=t?.subpixelPositioning||!1,this._isDragging=!1,this._roleManaged=!1,this._tabIndexManaged=!1,this._keyboardDragActive=!1,this._state="inactive",this._rotation=t?.rotation||0,this._rotationAlignment=t?.rotationAlignment||"auto",this._pitchAlignment=t?.pitchAlignment&&"auto"!==t.pitchAlignment?t.pitchAlignment:this._rotationAlignment,this.setOpacity(t?.opacity,t?.opacityWhenCovered),t?.element)this._element=t.element,this._offset=vu.convert(t?.offset||[0,0]);else{this._defaultMarker=!0,this._element=zZ.create("div");let r=(jB||(jB=zE("svg",{display:"block",height:"41px",width:"27px",viewBox:"0 0 27 41"},[zE("g",{"fill-rule":"nonzero"},[zE("g",{transform:"translate(3.0, 29.0)",fill:"#000000"},[["10.5","5.25002273"],["10.5","5.25002273"],["9.5","4.77275007"],["8.5","4.29549936"],["7.5","3.81822308"],["6.5","3.34094679"],["5.5","2.86367051"],["4.5","2.38636864"]].map(([t,r])=>zE("ellipse",{opacity:"0.04",cx:"10.5",cy:"5.80029008",rx:t,ry:r}))),zE("g",{fill:"#3FB1CE"},[zE("path",{d:"M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"})]),zE("g",{opacity:"0.25",fill:"#000000"},[zE("path",{d:"M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"})]),zE("g",{transform:"translate(6.0, 7.0)",fill:"#FFFFFF"}),zE("g",{transform:"translate(8.0, 8.0)"},[zE("circle",{fill:"#000000",opacity:"0.25",cx:"5.5",cy:"5.5",r:"5.4999962"}),zE("circle",{fill:"#FFFFFF",cx:"5.5",cy:"5.5",r:"5.4999962"})])])]))).cloneNode(!0);r.setAttributeNS(null,"height",`${41*this._scale}px`),r.setAttributeNS(null,"width",`${27*this._scale}px`),(function(t){return t.firstElementChild.children[1]})(r).setAttributeNS(null,"fill",this._color),this._element.appendChild(r),this._offset=vu.convert(t?.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",t=>{t.preventDefault()}),this._element.addEventListener("mousedown",t=>{t.preventDefault()}),zS(this._element,this._anchor,"marker"),t?.className)for(let r of t.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(t){return this.remove(),this._map=t,this._defaultMarker&&!this._element.hasAttribute("aria-label")&&this._element.setAttribute("aria-label",t._getUIString("Marker.Title")),this._updateAccessibilityRole(),t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),t.on("terrain",this._update),t.on("projectiontransition",this._update),this._element.addEventListener("click",this._onClick),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),this._element.removeEventListener("click",this._onClick),this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._element.removeEventListener("keypress",this._onKeyPress),this._keyboardDragActive=!1,this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=DQ.convert(t),this._pos=null,this._update(),this._popup&&this._popup.setLngLat(this._lngLat),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress)),t){if(!("offset"in t.options)){let r=13.5/Math.SQRT2;t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[r,-((24.6+r)*1)],"bottom-right":[-r,-((24.6+r)*1)],left:[13.5,-24.6],right:[-13.5,-24.6]}:this._offset}this._popup=t,this._element.addEventListener("keypress",this._onKeyPress)}return this._updateTabIndex(),this._updateAccessibilityRole(),this}setSubpixelPositioning(t){return this._subpixelPositioning=t,this}_endKeyboardDrag(){this._keyboardDragActive&&(this._keyboardDragActive=!1,this.fire(new jj("dragend")))}getPopup(){return this._popup}togglePopup(){let t=this._popup;return this._element.style.opacity===this._opacityWhenCovered||t&&(t.isOpen()?t.remove():(t.setLngLat(this._lngLat),t.addTo(this._map))),this}_updateOpacity(t=!1){var r,i;let n=null==(r=this._map)?void 0:r.terrain,a=this._map._camera.transform.isLocationOccluded(this._lngLat);if(!n||a){let t=a?this._opacityWhenCovered:this._opacity;this._element.style.opacity!==t&&(this._element.style.opacity=t,this._element.classList.toggle("maplibregl-marker-covered",a));return}if(t)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}let o=this._map,s=o.terrain.depthAtPoint(this._pos),l=o.terrain.getElevationForLngLat(this._lngLat,o._camera.transform);if(o._camera.transform.lngLatToCameraDepth(this._lngLat,l)-s<.006){this._element.style.opacity=this._opacity,this._element.classList.remove("maplibregl-marker-covered");return}let u=-this._offset.y/o._camera.transform.pixelsPerMeter,c=Math.sin(o.getPitch()*Math.PI/180)*u,h=o.terrain.depthAtPoint(new vu(this._pos.x,this._pos.y-this._offset.y)),d=o._camera.transform.lngLatToCameraDepth(this._lngLat,l+c)-h>.006;null!=(i=this._popup)&&i.isOpen()&&d&&this._popup.remove(),this._element.style.opacity=d?this._opacityWhenCovered:this._opacity,this._element.classList.toggle("maplibregl-marker-covered",d)}getOffset(){return this._offset}setOffset(t){return this._offset=vu.convert(t),this._update(),this}addClassName(t){this._element.classList.add(t)}removeClassName(t){this._element.classList.remove(t)}toggleClassName(t){return this._element.classList.toggle(t)}setDraggable(t){return this._draggable=!!t,this._element.classList.toggle("maplibregl-marker-draggable",this._draggable),this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this._defaultMarker&&(this._draggable?(this._element.addEventListener("keydown",this._onKeyDown),this._element.addEventListener("keyup",this._onKeyUp),this._element.addEventListener("blur",this._onBlur)):(this._element.removeEventListener("keydown",this._onKeyDown),this._element.removeEventListener("keyup",this._onKeyUp),this._element.removeEventListener("blur",this._onBlur),this._endKeyboardDrag())),this._updateTabIndex(),this._updateAccessibilityRole(),this}isDraggable(){return this._draggable}_updateTabIndex(){this._popup||this._defaultMarker&&this._draggable?this._element.hasAttribute("tabindex")||(this._element.setAttribute("tabindex","0"),this._tabIndexManaged=!0):this._tabIndexManaged&&(this._tabIndexManaged=("0"===this._element.getAttribute("tabindex")&&this._element.removeAttribute("tabindex"),!1))}_updateAccessibilityRole(){if(!this._defaultMarker||this._element.hasAttribute("role")&&!this._roleManaged)return;let t=this._draggable||this._popup?"button":"img";this._element.setAttribute("role",t),this._roleManaged=!0}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&"auto"!==t?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(t,r){return(void 0===this._opacity||void 0===t&&void 0===r)&&(this._opacity="1",this._opacityWhenCovered="0.2"),void 0!==t&&(this._opacity=String(t)),void 0!==r&&(this._opacityWhenCovered=String(r)),this._map&&this._updateOpacity(!0),this}},jU={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},jq=0,jG=!1,jH=class extends MI{},j$=class extends MI{},jW=class extends MI{},jY=class extends MP{constructor(t){super(),this._onSuccess=t=>{if(this._map){if(this._isOutOfMapMaxBounds(t)){this._setErrorState(),this.fire(new j$("outofmaxbounds",t)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new j$("geolocate",t)),this._finish()}},this._updateCamera=t=>{let r=new DQ(t.coords.longitude,t.coords.latitude),i=t.coords.accuracy,n=xn({bearing:this._map.getBearing()},this.options.fitBoundsOptions),a=FA.fromLngLat(r,i);this._map.fitBounds(a,n,{geolocateSource:!0})},this._updateMarker=t=>{if(t){let r=new DQ(t.coords.longitude,t.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=t.coords.accuracy,this._updateCircleRadiusIfNeeded()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onUpdate=()=>{this._updateCircleRadiusIfNeeded()},this._onError=t=>{if(this._map){if(1===t.code){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),void 0!==this._geolocationWatchID&&this._clearWatch()}else{if(3===t.code&&jG)return;this._setErrorState()}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new jW("error",t)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._onMoveStart=t=>{if(!this._map)return;let r=t?.[0]instanceof ResizeObserverEntry;t.geolocateSource||"ACTIVE_LOCK"!==this._watchState||r||this._map.isZooming()||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new jH("trackuserlocationend")),this.fire(new jH("userlocationlostfocus")))},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",t=>{t.preventDefault()}),this._geolocateButton=zZ.create("button","maplibregl-ctrl-geolocate",this._container),zZ.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=t=>{if(this._map){if(!1===t){xf("Geolocation support is not available so the GeolocateControl will be disabled.");let t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{let t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=zZ.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new jV({element:this._dotElement}),this._circleElement=zZ.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new jV({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onUpdate),this._map.on("move",this._onUpdate),this._map.on("rotate",this._onUpdate),this._map.on("pitch",this._onUpdate)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",this._onMoveStart)}},this.options=xn({},jU,t)}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),(function(t=!1){return _(this,null,function*(){if(void 0!==jF&&!t)return jF;if(void 0===window.navigator.permissions)return jF=!!window.navigator.geolocation;try{jF="denied"!==(yield window.navigator.permissions.query({name:"geolocation"})).state}catch{jF=!!window.navigator.geolocation}return jF})})().then(t=>this._finishSetupUI(t)),this._container}onRemove(){void 0!==this._geolocationWatchID&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("movestart",this._onMoveStart),this._map.off("zoom",this._onUpdate),this._map.off("move",this._onUpdate),this._map.off("rotate",this._onUpdate),this._map.off("pitch",this._onUpdate),this._map=void 0,jq=0,jG=!1}_isOutOfMapMaxBounds(t){let r=this._map.getMaxBounds(),i=t.coords;return r&&(i.longituder.getEast()||i.latituder.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":case"BACKGROUND_ERROR":case"OFF":case void 0:break;default:throw Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadiusIfNeeded(){let t=this._userLocationDotMarker.getLngLat();if(!this.options.showUserLocation||!this.options.showAccuracyCircle||!this._accuracy||!t)return;let r=this._map.project(t),i=this._map.unproject([r.x+100,r.y]),n=t.distanceTo(i)/100,a=2*this._accuracy/n;this._circleElement.style.width=`${a.toFixed(2)}px`,this._circleElement.style.height=`${a.toFixed(2)}px`}trigger(){if(!this._setup)return xf("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new jH("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":jq--,jG=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new jH("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new jH("trackuserlocationstart")),this.fire(new jH("userlocationfocus"));break;default:throw Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw Error(`Unexpected watchState ${this._watchState}`)}if("OFF"===this._watchState&&void 0!==this._geolocationWatchID)this._clearWatch();else if(void 0===this._geolocationWatchID){let t;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),++jq>1?(t={maximumAge:6e5,timeout:0},jG=!0):(t=this.options.positionOptions,jG=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,t)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},jZ={maxWidth:100,unit:"metric"},jX=class{constructor(t){this._onMove=()=>{zD(this._map,this._container,this.options)},this.setUnit=t=>{this.options.unit=t,zD(this._map,this._container,this.options)},this.options=f(f({},jZ),t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._onMove),this._map=void 0}},jK=class extends MI{},jJ=class extends MP{constructor(t={}){var r;super(),this._onFullscreenChange=()=>{var t;let r=window.document.fullscreenElement||window.document.webkitFullscreenElement;for(;null!=(t=r?.shadowRoot)&&t.fullscreenElement;)r=r.shadowRoot.fullscreenElement;r===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,this._pseudo=null!=(r=t.pseudo)&&r,t?.container&&(t.container instanceof HTMLElement?this._container=t.container:xf("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(t){return this._map=t,this._container||(this._container=this._map.getContainer()),this._controlContainer=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let t=this._fullscreenButton=zZ.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);zZ.create("span","maplibregl-ctrl-icon",t).setAttribute("aria-hidden","true"),t.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let t=this._getTitle();this._fullscreenButton.setAttribute("aria-label",t),this._fullscreenButton.title=t}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new jK("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new jK("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){this._pseudo?this._togglePseudoFullScreen():window.document.exitFullscreen?window.document.exitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._pseudo?this._togglePseudoFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},jQ=class{constructor(t){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=t}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=zZ.create("button","maplibregl-ctrl-terrain",this._container),zZ.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){this._container.remove(),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},j0=class{constructor(){this._toggleProjection=()=>{var t;let r=null==(t=this._map.getProjection())?void 0:t.type;"mercator"!==r&&r?this._map.setProjection({type:"mercator"}):this._map.setProjection({type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var t;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),(null==(t=this._map.getProjection())?void 0:t.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(t){return this._map=t,this._container=zZ.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=zZ.create("button","maplibregl-ctrl-globe",this._container),zZ.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._map.on("projectiontransition",this._updateGlobeIcon),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateGlobeIcon),this._map.off("projectiontransition",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},j1={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0,padding:void 0},j2=class extends MI{},j3=class extends MP{constructor(t){super(),this._updateOpacity=()=>{void 0!==this.options.locationOccludedOpacity&&(this._map._camera.transform.isLocationOccluded(this.getLngLat())?this._container.style.opacity=`${this.options.locationOccludedOpacity}`:this._container.style.opacity="")},this.remove=()=>(this._content&&this._content.remove(),this._container&&(this._container.remove(),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousemove",this._update),this._map.off("mouseup",this._update),this._map.off("drag",this._update),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new j2("close"))),this),this._update=t=>{let r,i=this._lngLat||this._trackPointer;if(!this._map||!i||!this._content)return;if(!this._container){if(this._container=zZ.create("div","maplibregl-popup",this._map.getContainer()),this._tip=zZ.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let t of this.options.className.split(" "))this._container.classList.add(t);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=zk(this._lngLat,this._flatPos,this._map._camera.transform,this._trackPointer),t&&"point"in t&&t.point&&(r=t.point),this._trackPointer&&!r)return;let n=this._flatPos=this._pos=this._trackPointer&&r?r:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&r?r:this._map._camera.transform.locationToScreenPoint(this._lngLat));let a=this.options.anchor,o=function t(r){if(!r)return t(new vu(0,0));if("number"==typeof r){let t=Math.round(Math.abs(r)/Math.SQRT2);return{center:new vu(0,0),top:new vu(0,r),"top-left":new vu(t,t),"top-right":new vu(-t,t),bottom:new vu(0,-r),"bottom-left":new vu(t,-t),"bottom-right":new vu(-t,-t),left:new vu(r,0),right:new vu(-r,0)}}if(r instanceof vu||Array.isArray(r)){let t=vu.convert(r);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:vu.convert(r.center||[0,0]),top:vu.convert(r.top||[0,0]),"top-left":vu.convert(r["top-left"]||[0,0]),"top-right":vu.convert(r["top-right"]||[0,0]),bottom:vu.convert(r.bottom||[0,0]),"bottom-left":vu.convert(r["bottom-left"]||[0,0]),"bottom-right":vu.convert(r["bottom-right"]||[0,0]),left:vu.convert(r.left||[0,0]),right:vu.convert(r.right||[0,0])}}(this.options.offset);if(!a){var s,l,u,c,h;let t=this._container.offsetWidth,r=this._container.offsetHeight,i=(s=this.options.padding)?{top:null!=(l=s.top)?l:0,right:null!=(u=s.right)?u:0,bottom:null!=(c=s.bottom)?c:0,left:null!=(h=s.left)?h:0}:{top:0,right:0,bottom:0,left:0},d;d=n.y+o.bottom.ythis._map._camera.transform.height-r-i.bottom?["bottom"]:[],n.xthis._map._camera.transform.width-t/2-i.right&&d.push("right"),a=0===d.length?"bottom":d.join("-")}let d=n.add(o[a]);this.options.subpixelPositioning||(d=d.round()),this._container.style.transform=`${jO[a]} translate(${d.x}px,${d.y}px)`,zS(this._container,a,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=xn(Object.create(j1),t)}addTo(t){return this._map&&this.remove(),this._map=t,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._map.on("terrain",this._update),this._map.on("projectiontransition",this._update),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._update),this._map.on("mouseup",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new j2("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=DQ.convert(t),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._update),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._update),this._map.on("drag",this._update),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(t){return this.setDOMContent(document.createTextNode(t))}setHTML(t){let r=document.createDocumentFragment(),i=document.createElement("body"),n;for(i.innerHTML=t;n=i.firstChild;)r.appendChild(n);return this.setDOMContent(r)}getMaxWidth(){var t;return null==(t=this._container)?void 0:t.style.maxWidth}setMaxWidth(t){return this.options.maxWidth=t,this._update(),this}setDOMContent(t){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=zZ.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(t),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(t){return this._container&&this._container.classList.add(t),this}removeClassName(t){return this._container&&this._container.classList.remove(t),this}setOffset(t){return this.options.offset=t,this._update(),this}toggleClassName(t){if(this._container)return this._container.classList.toggle(t)}setSubpixelPositioning(t){this.options.subpixelPositioning=t}setPadding(t){this.options.padding=t,this._update()}_createCloseButton(){this.options.closeButton&&(this._closeButton=zZ.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let t=this._container.querySelector("a[href], [tabindex]:not([tabindex='-1']), [contenteditable]:not([contenteditable='false']), button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled])");t&&t.focus()}},j5="6.9.0"}}),j6=g({"build/maplibre_worker.js"(t,r){r.exports='var t1=Object.defineProperty,e1=Object.defineProperties;var r1=Object.getOwnPropertyDescriptors;var nh=Object.getOwnPropertySymbols;var i1=Object.prototype.hasOwnProperty,n1=Object.prototype.propertyIsEnumerable;var ah=(t,e,r)=>e in t?t1(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,je=(t,e)=>{for(var r in e||(e={}))i1.call(e,r)&&ah(t,r,e[r]);if(nh)for(var r of nh(e))n1.call(e,r)&&ah(t,r,e[r]);return t},Si=(t,e)=>e1(t,r1(e));var rt=(t,e,r)=>new Promise((i,n)=>{var a=l=>{try{o(r.next(l))}catch(u){n(u)}},s=l=>{try{o(r.throw(l))}catch(u){n(u)}},o=l=>l.done?i(l.value):Promise.resolve(l.value).then(a,s);o((r=r.apply(t,e)).next())});var a1=Object.create,ep=Object.defineProperty,s1=Object.getOwnPropertyDescriptor,o1=Object.getOwnPropertyNames,l1=Object.getPrototypeOf,rp=Object.prototype.hasOwnProperty,fl=(t,e)=>()=>(e||(t((e={exports:{}}).exports,e),t=null),e.exports),u1=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(var n=o1(e),a=0,s=n.length,o;ae[l]).bind(null,o),enumerable:!(i=s1(e,o))||i.enumerable});return t},h1=(t,e,r)=>(r=t==null?{}:a1(l1(t)),u1(e||!t||!t.__esModule||!rp.call(t,"default")?ep(r,"default",{value:t,enumerable:!0}):r,t));function B(t,e){this.x=t,this.y=e}B.prototype={clone(){return new B(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){let e=t.x-this.x,r=t.y-this.y;return e*e+r*r},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){let e=t[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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(){let t=this.y;return this.y=this.x,this.x=-t,this},_rotate(t){let e=Math.cos(t),r=Math.sin(t),i=e*this.x-r*this.y,n=r*this.x+e*this.y;return this.x=i,this.y=n,this},_rotateAround(t,e){let r=Math.cos(t),i=Math.sin(t),n=e.x+r*(this.x-e.x)-i*(this.y-e.y),a=e.y+i*(this.x-e.x)+r*(this.y-e.y);return this.x=n,this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:B},B.convert=function(t){if(t instanceof B)return t;if(Array.isArray(t))return new B(+t[0],+t[1]);if(t.x!==void 0&&t.y!==void 0)return new B(+t.x,+t.y);throw Error("Expected [x, y] or {x, y} point format")};function c1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var Nn;function p1(){return Nn!=null||(Nn=typeof OffscreenCanvas<"u"&&!!new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Nn}var Un;function f1(){if(Un==null&&(Un=!1,p1())){let t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let r=0;r<25;r++){let i=r*4;t.fillStyle=`rgb(${i},${i+1},${i+2})`,t.fillRect(r%5,Math.floor(r/5),1,1)}let e=t.getImageData(0,0,5,5).data;for(let r=0;r<100;r++)if(r%4!=3&&e[r]!==r){Un=!0;break}}}return Un||!1}var pe=typeof Float32Array<"u"?Float32Array:Array;Math.PI/180,180/Math.PI;function d1(){var t=new pe(9);return pe!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t}function ip(){var t=new pe(3);return pe!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function y1(t){var e=t[0],r=t[1],i=t[2];return Math.sqrt(e*e+r*r+i*i)}function sh(t,e,r){var i=new pe(3);return i[0]=t,i[1]=e,i[2]=r,i}function m1(t,e){var r=e[0],i=e[1],n=e[2],a=r*r+i*i+n*n;return a>0&&(a=1/Math.sqrt(a)),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a,t}function g1(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ks(t,e,r){var i=e[0],n=e[1],a=e[2],s=r[0],o=r[1],l=r[2];return t[0]=n*l-a*o,t[1]=a*s-i*l,t[2]=i*o-n*s,t}var x1=y1;(function(){var t=ip();return function(e,r,i,n,a,s){var o,l;for(r||(r=3),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o0&&(s=1/Math.sqrt(s)),t[0]=r*s,t[1]=i*s,t[2]=n*s,t[3]=a*s,t}function w1(t,e,r){var i=e[0],n=e[1],a=e[2],s=e[3];return t[0]=r[0]*i+r[4]*n+r[8]*a+r[12]*s,t[1]=r[1]*i+r[5]*n+r[9]*a+r[13]*s,t[2]=r[2]*i+r[6]*n+r[10]*a+r[14]*s,t[3]=r[3]*i+r[7]*n+r[11]*a+r[15]*s,t}(function(){var t=v1();return function(e,r,i,n,a,s){var o,l;for(r||(r=4),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o1e-6?(p=Math.acos(f),d=Math.sin(p),y=Math.sin((1-i)*p)/d,m=Math.sin(i*p)/d):(y=1-i,m=i),t[0]=y*n+m*l,t[1]=y*a+m*u,t[2]=y*s+m*h,t[3]=y*o+m*c,t}function _1(t,e){var r=e[0]+e[4]+e[8],i;if(r>0)i=Math.sqrt(r+1),t[3]=.5*i,i=.5/i,t[0]=(e[5]-e[7])*i,t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var n=0;e[4]>e[0]&&(n=1),e[8]>e[n*3+n]&&(n=2);var a=(n+1)%3,s=(n+2)%3;i=Math.sqrt(e[n*3+n]-e[a*3+a]-e[s*3+s]+1),t[n]=.5*i,i=.5/i,t[3]=(e[a*3+s]-e[s*3+a])*i,t[a]=(e[a*3+n]+e[n*3+a])*i,t[s]=(e[s*3+n]+e[n*3+s])*i}return t}var lh=b1;(function(){var t=ip(),e=sh(1,0,0),r=sh(0,1,0);return function(i,n,a){var s=g1(n,a);return s<-.999999?(ks(t,e,n),x1(t)<1e-6&&ks(t,r,n),m1(t,t),D1(i,t,Math.PI),i):s>.999999?(i[0]=0,i[1]=0,i[2]=0,i[3]=1,i):(ks(t,n,a),i[0]=t[0],i[1]=t[1],i[2]=t[2],i[3]=1+s,lh(i,i))}})(),(function(){var t=oh(),e=oh();return function(r,i,n,a,s,o){return Ts(t,i,s,o),Ts(e,n,a,o),Ts(r,t,e,2*o*(1-o)),r}})(),(function(){var t=d1();return function(e,r,i,n){return t[0]=i[0],t[3]=i[1],t[6]=i[2],t[1]=n[0],t[4]=n[1],t[7]=n[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],lh(e,_1(e,t))}})();function A1(){var t=new pe(2);return pe!=Float32Array&&(t[0]=0,t[1]=0),t}(function(){var t=A1();return function(e,r,i,n,a,s){var o,l;for(r||(r=2),i||(i=0),l=n?Math.min(n*r+i,e.length):e.length,o=i;o=1)return 1;let e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function E1(t,e,r,i){return c1(t,e,r,i)}var d5=E1(.25,.1,.25,1);function Ji(t,e,r){return Math.min(r,Math.max(e,t))}function F1(t,e,r){let i=r-e,n=((t-e)%i+i)%i+e;return n===e?r:n}function Gt(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function k1(t){return Math.log(t)/Math.LN2%1==0}function Ia(t,e,r){let i={};for(let n in t)i[n]=e.call(r||this,t[n],n,t);return i}function T1(t,e,r){let i={};for(let n in t)e.call(r||this,t[n],n,t)&&(i[n]=t[n]);return i}function He(t){return Array.isArray(t)?t.map(He):typeof t=="object"&&t?Ia(t,He):t}var uh={};function Bt(t){uh[t]||(typeof console<"u"&&console.warn(t),uh[t]=!0)}function Ke(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function mr(t){return typeof WorkerGlobalScope<"u"&&t!==void 0&&t instanceof WorkerGlobalScope}function Ca(t){return typeof ImageBitmap<"u"&&t instanceof ImageBitmap}function I1(t,e,r,i,n){let a=Math.max(-e,0)*4,s=(Math.max(0,r)-r)*i*4+a,o=i*4,l=Math.max(0,e),u=Math.max(0,r),h=Math.min(t.width,e+i),c=Math.min(t.height,r+n);return{rect:{x:l,y:u,width:h-l,height:c-u},layout:[{offset:s,stride:o}]}}function C1(t,e,r,i,n){return rt(this,null,function*(){if(typeof VideoFrame>"u")throw Error("VideoFrame not supported");let a=new VideoFrame(t,{timestamp:0});try{let s=a==null?void 0:a.format;if(!s||!(s.startsWith("BGR")||s.startsWith("RGB")))throw Error(`Unrecognized format ${s}`);let o=s.startsWith("BGR"),l=new Uint8ClampedArray(i*n*4);if(yield a.copyTo(l,I1(t,e,r,i,n)),o)for(let u=0;u{t.removeEventListener(e,r,i)}}}function ch(t){return t*Math.PI/180}var ph="AbortError",dl=class extends Error{constructor(t=ph){super(t instanceof Error?t.message:t),this.name=ph,t instanceof Error&&t.stack&&(this.stack=t.stack)}};function yl(t){return t instanceof Error&&t.name==="AbortError"}function B1(t){if(t.aborted)throw new dl(t.reason)}var ml={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function P1(t){return ml.REGISTERED_PROTOCOLS[t.substring(0,t.indexOf("://"))]}function sp(t,e){ml.REGISTERED_PROTOCOLS[t]=e}function op(t){delete ml.REGISTERED_PROTOCOLS[t]}var fh="global-dispatcher",ya=class extends Error{constructor(t,e,r,i){super(`AJAXError: ${e} (${t}): ${r}`),this.status=t,this.statusText=e,this.url=r,this.body=i}};function lp(){var t;if(mr(self))return(t=self.worker)==null?void 0:t.referrer;if(window.location.protocol==="blob:")try{return window.parent.location.href}catch(e){}return window.location.href}var z1=t=>{var e;return t.startsWith("file:")||((e=lp())==null?void 0:e.startsWith("file:"))&&!/^\\w+:/.test(t)};function L1(t,e){return rt(this,null,function*(){let r=new Request(t.url,{method:t.method||"GET",body:t.body,credentials:t.credentials,headers:t.headers,cache:t.cache,referrer:lp(),referrerPolicy:t.referrerPolicy,signal:e.signal});t.type==="json"&&!r.headers.has("Accept")&&r.headers.set("Accept","application/json");let i;try{i=yield fetch(r)}catch(s){throw yl(s)?s:new ya(0,Ki(s).message,t.url,new Blob)}if(!i.ok){let s=yield i.blob();throw new ya(i.status,i.statusText,t.url,s)}let n;n=t.type==="arrayBuffer"||t.type==="image"?i.arrayBuffer():t.type==="json"?i.json():i.text();let a=yield n;return B1(e.signal),{data:a,cacheControl:i.headers.get("Cache-Control"),expires:i.headers.get("Expires"),etag:i.headers.get("ETag")}})}function V1(t,e){return new Promise((r,i)=>{var a;let n=new XMLHttpRequest;n.open(t.method||"GET",t.url,!0),(t.type==="arrayBuffer"||t.type==="image")&&(n.responseType="arraybuffer");for(let s in t.headers)n.setRequestHeader(s,t.headers[s]);t.type==="json"&&(n.responseType="text",(a=t.headers)!=null&&a.Accept||n.setRequestHeader("Accept","application/json")),n.withCredentials=t.credentials==="include",n.onerror=()=>{i(Error(n.statusText))},n.onload=()=>{if(!e.signal.aborted)if((n.status>=200&&n.status<300||n.status===0)&&n.response!==null){let s=n.response;if(t.type==="json")try{s=JSON.parse(n.response)}catch(o){i(o);return}r({data:s,cacheControl:n.getResponseHeader("Cache-Control"),expires:n.getResponseHeader("Expires"),etag:n.getResponseHeader("ETag")})}else{let s=new Blob([n.response],{type:n.getResponseHeader("Content-Type")});i(new ya(n.status,n.statusText,t.url,s))}},e.signal.addEventListener("abort",()=>{n.abort(),i(new dl(e.signal.reason))}),n.send(t.body)})}var Ma=function(t,e){return rt(this,null,function*(){var r,i;if(t.url.includes("://")&&!/^https?:|^file:/.test(t.url)){let n=P1(t.url);if(n){let a=yield n(t,e);return!a.data&&t.type==="arrayBuffer"?Gt(a,{data:new ArrayBuffer(0)}):a}if(mr(self)&&((r=self.worker)!=null&&r.actor))return self.worker.actor.sendAsync({type:"GR",data:t,targetMapId:fh},e)}if(!z1(t.url)){if(fetch&&Request&&AbortController&&Object.hasOwn(Request.prototype,"signal"))return L1(t,e);if(mr(self)&&((i=self.worker)!=null&&i.actor))return self.worker.actor.sendAsync({type:"GR",data:t,mustQueue:!0,targetMapId:fh},e)}return V1(t,e)})},up=(t,e)=>Ma(Gt(t,{type:"json"}),e),hp=(t,e)=>Ma(Gt(t,{type:"arrayBuffer"}),e);function dh(t,e,r){var i;(i=r[t])!=null&&i.includes(e)||(r[t]||(r[t]=[]),r[t].push(e))}function Is(t,e,r){if(r!=null&&r[t]){let i=r[t].indexOf(e);i!==-1&&r[t].splice(i,1)}}var cp=class{constructor(t,e={}){Gt(this,e),this.type=t}},ma=class extends cp{constructor(t,e={}){super("error",Gt({error:t},e))}},O1=class{on(t,e){return this._listeners||(this._listeners={}),dh(t,e,this._listeners),{unsubscribe:()=>{this.off(t,e)}}}off(t,e){return Is(t,e,this._listeners),Is(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners||(this._oneTimeListeners={}),dh(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){var n,a,s,o,l,u;let r=typeof t=="string"?new cp(t,e||{}):t,i=r.type;if(this.listens(i)){r.target=this;let h=(s=(a=(n=this._listeners)==null?void 0:n[i])==null?void 0:a.slice())!=null?s:[];for(let f of h)f.call(this,r);let c=(u=(l=(o=this._oneTimeListeners)==null?void 0:o[i])==null?void 0:l.slice())!=null?u:[];for(let f of c)Is(i,f,this._oneTimeListeners),f.call(this,r);let p=this._eventedParent;p&&(Gt(r,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(r))}else r instanceof ma&&console.error(r.error);return this}listens(t){var e,r,i,n,a;return!!((r=(e=this._listeners)==null?void 0:e[t])!=null&&r.length||(n=(i=this._oneTimeListeners)==null?void 0:i[t])!=null&&n.length||(a=this._eventedParent)!=null&&a.listens(t))}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}},pp={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number",length:2},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},"font-faces":{type:"fontFaces"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},encoding:{type:"enum",values:{mvt:{},mlt:{}},default:"mvt"},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"filter"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_color-relief","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"},"fill-extrusion-rounded-corner-distance":{type:"number",default:0,minimum:0,units:"meters","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-height-offset":{type:"number",default:0,units:"meters",requires:[{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-height-anchor":{type:"enum",values:{ground:{},absolute:{}},default:"ground",requires:["symbol-height-offset"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},"layout_color-relief":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible",expression:{interpolated:!1,parameters:["global-state"]},"property-type":"data-constant"}},filter:{type:"boolean",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"expression_name",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"fill-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-layer-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","global-state"]},"property-type":"data-constant"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"},resampling:{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}},interpolation:{type:"array",value:"interpolation_name",minimum:1},interpolation_name:{type:"enum",values:{linear:{syntax:{overloads:[{parameters:[],"output-type":"interpolation"}],parameters:[]}},exponential:{syntax:{overloads:[{parameters:["base"],"output-type":"interpolation"}],parameters:[{name:"base",type:"number literal"}]}},"cubic-bezier":{syntax:{overloads:[{parameters:["x1","y1","x2","y2"],"output-type":"interpolation"}],parameters:[{name:"x1",type:"number literal"},{name:"y1",type:"number literal"},{name:"x2",type:"number literal"},{name:"y2",type:"number literal"}]}}}}},w=pp,fp=["type","source","source-layer","minzoom","maxzoom","filter","layout"],E=class{constructor(t,e,r,i,n="error"){this.message=(t?`${t}: `:"")+r,i&&(this.identifier=i),this.severity=n,e!=null&&e.__line__&&(this.line=e.__line__)}},dn={kind:"null"},I={kind:"number"},Y={kind:"string"},tt={kind:"boolean"},ce={kind:"color"},Ba={kind:"projectionDefinition"},fr={kind:"object"},Z={kind:"value"},R1={kind:"error"},Pa={kind:"collator"},yn={kind:"formatted"},za={kind:"padding"},Qi={kind:"colorArray"},La={kind:"numberArray"},mn={kind:"resolvedImage"},Va={kind:"variableAnchorOffsetCollection"};function Ut(t,e){return{kind:"array",itemType:t,N:e}}function yt(t){if(t.kind==="array"){let e=yt(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}var $1=[dn,I,Y,tt,ce,Ba,yn,fr,Ut(Z),za,La,Qi,mn,Va];function tn(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!tn(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(let r of $1)if(!tn(r,e))return null}}return`Expected ${yt(t)} but found ${yt(e)} instead.`}function gl(t,e){return e.some(r=>r.kind===t.kind)}function dr(t,e){return e.some(r=>r==="null"?t===null:r==="array"?Array.isArray(t):r==="object"?t&&!Array.isArray(t)&&typeof t=="object":r===typeof t)}function Ge(t,e){return t.kind==="array"&&e.kind==="array"?t.itemType.kind===e.itemType.kind&&typeof t.N=="number":t.kind===e.kind}var dp=.96422,yp=.82521,mp=4/29,Ks=6/29,gp=3*Ks*Ks,N1=Math.PI/180,U1=180/Math.PI;function xp(t){return t%=360,t<0&&(t+=360),t}function vp([t,e,r,i]){t=Cs(t),e=Cs(e),r=Cs(r);let n,a,s=Ms((.2225045*t+.7168786*e+.0606169*r)/1);t===e&&e===r?n=a=s:(n=Ms((.4360747*t+.3850649*e+.1430804*r)/dp),a=Ms((.0139322*t+.0971045*e+.7141733*r)/yp));let o=116*s-16;return[o<0?0:o,500*(n-s),200*(s-a),i]}function Cs(t){return t<=.04045?t/12.92:((t+.055)/1.055)**2.4}function Ms(t){return t>.008856451679035631?t**(1/3):t/gp+mp}function bp([t,e,r,i]){let n=(t+16)/116,a=isNaN(e)?n:n+e/500,s=isNaN(r)?n:n-r/200;return n=1*Ps(n),a=dp*Ps(a),s=yp*Ps(s),[Bs(3.1338561*a-1.6168667*n-.4906146*s),Bs(-.9787684*a+1.9161415*n+.033454*s),Bs(.0719453*a-.2289914*n+1.4052427*s),i]}function Bs(t){return t=t<=.00304?12.92*t:1.055*t**(1/2.4)-.055,t<0?0:t>1?1:t}function Ps(t){return t>Ks?t*t*t:gp*(t-mp)}function q1(t){let[e,r,i,n]=vp(t),a=Math.sqrt(r*r+i*i);return[Math.round(a*1e4)?xp(Math.atan2(i,r)*U1):NaN,a,e,n]}function j1([t,e,r,i]){return t=isNaN(t)?0:t*N1,bp([r,Math.cos(t)*e,Math.sin(t)*e,i])}function G1([t,e,r,i]){t=xp(t),e/=100,r/=100;function n(a){let s=(a+t/30)%12,o=e*Math.min(r,1-r);return r-o*Math.max(-1,Math.min(s-3,9-s,1))}return[n(0),n(8),n(4),i]}var X1=Object.hasOwn||function(t,e){return Object.prototype.hasOwnProperty.call(t,e)};function ji(t,e){return X1(t,e)?t[e]:void 0}function Y1(t){if(t=t.toLowerCase().trim(),t==="transparent")return[0,0,0,0];let e=ji(W1,t);if(e){let[i,n,a]=e;return[i/255,n/255,a/255,1]}if(t.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(t)){let i=t.length<6?1:2,n=1;return[qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+=i)),qn(t.slice(n,n+i)||"ff")]}if(t.startsWith("rgb")){let i=t.match(/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(i){let[n,a,s,o,l,u,h,c,p,f,d,y]=i,m=[o||" ",h||" ",f].join("");if(m===" "||m===" /"||m===",,"||m===",,,"){let g=[s,u,p].join(""),x=g==="%%%"?100:g===""?255:0;if(x){let v=[Rr(+a/x,0,1),Rr(+l/x,0,1),Rr(+c/x,0,1),d?yh(+d,y):1];if(mh(v))return v}}return}}let r=t.match(/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/);if(r){let[i,n,a,s,o,l,u,h,c]=r,p=[a||" ",o||" ",u].join("");if(p===" "||p===" /"||p===",,"||p===",,,"){let f=[+n,Rr(+s,0,100),Rr(+l,0,100),h?yh(+h,c):1];if(mh(f))return G1(f)}}}function qn(t){return parseInt(t.padEnd(2,t),16)/255}function yh(t,e){return Rr(e?t/100:t,0,1)}function Rr(t,e,r){return Math.min(Math.max(e,t),r)}function mh(t){return!t.some(Number.isNaN)}var W1={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],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],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],rebeccapurple:[102,51,153],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]};function Je(t,e,r){return t+r*(e-t)}function ti(t,e,r){return t.map((i,n)=>Je(i,e[n],r))}function Z1(t){return t==="rgb"||t==="hcl"||t==="lab"}var Pt,gt=(Pt=class{constructor(e,r,i,n=1,a=!0){this.r=e,this.g=r,this.b=i,this.a=n,a||(this.r*=n,this.g*=n,this.b*=n,n||this.overwriteGetter("rgb",[e,r,i,n]))}static parse(e){if(e instanceof Pt)return e;if(typeof e!="string")return;let r=Y1(e);if(r)return new Pt(...r,!1)}get rgb(){let{r:e,g:r,b:i,a:n}=this,a=n||1/0;return this.overwriteGetter("rgb",[e/a,r/a,i/a,n])}get hcl(){return this.overwriteGetter("hcl",q1(this.rgb))}get lab(){return this.overwriteGetter("lab",vp(this.rgb))}overwriteGetter(e,r){return Object.defineProperty(this,e,{value:r}),r}toString(){let[e,r,i,n]=this.rgb;return`rgba(${[e,r,i].map(a=>Math.round(a*255)).join(",")},${n})`}static interpolate(e,r,i,n="rgb"){switch(n){case"rgb":{let[a,s,o,l]=ti(e.rgb,r.rgb,i);return new Pt(a,s,o,l,!1)}case"hcl":{let[a,s,o,l]=e.hcl,[u,h,c,p]=r.hcl,f,d;if(!isNaN(a)&&!isNaN(u)){let v=u-a;u>a&&v>180?v-=360:u180&&(v+=360),f=a+i*v}else isNaN(a)?isNaN(u)?f=NaN:(f=u,(o===1||o===0)&&(d=h)):(f=a,(c===1||c===0)&&(d=s));let[y,m,g,x]=j1([f,d!=null?d:Je(s,h,i),Je(o,c,i),Je(l,p,i)]);return new Pt(y,m,g,x,!1)}case"lab":{let[a,s,o,l]=bp(ti(e.lab,r.lab,i));return new Pt(a,s,o,l,!1)}}}},Pt.black=new Pt(0,0,0,1),Pt.white=new Pt(1,1,1,1),Pt.transparent=new Pt(0,0,0,0),Pt.red=new Pt(1,0,0,1),Pt),H1=["bottom","center","top"],Js=class{constructor(t,e,r,i,n,a){this.text=t,this.image=e,this.scale=r,this.fontStack=i,this.textColor=n,this.verticalAlign=a}},ze=class la{constructor(e){this.sections=e}static fromString(e){return new la([new Js(e,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof la?e:la.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}},Ae=class Li{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Li)return e;if(typeof e=="number")return new Li([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(let r of e)if(typeof r!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new Li(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Li(ti(e.values,r.values,i))}},Se=class Vi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Vi)return e;if(typeof e=="number")return new Vi([e]);if(Array.isArray(e)){for(let r of e)if(typeof r!="number")return;return new Vi(e)}}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i){return new Vi(ti(e.values,r.values,i))}},oe=class Oi{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof Oi)return e;if(typeof e=="string"){let i=gt.parse(e);return i?new Oi([i]):void 0}if(!Array.isArray(e))return;let r=[];for(let i of e){if(typeof i!="string")return;let n=gt.parse(i);if(!n)return;r.push(n)}return new Oi(r)}toString(){return JSON.stringify(this.values)}static interpolate(e,r,i,n="rgb"){let a=[];if(e.values.length!=r.values.length)throw Error(`colorArray: Arrays have mismatched length (${e.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let s=0;s=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof r=="number"&&r>=0&&r<=255?i===void 0||typeof i=="number"&&i>=0&&i<=1?null:`Invalid rgba value [${[t,e,r,i].join(", ")}]: \'a\' must be between 0 and 1.`:`Invalid rgba value [${(typeof i=="number"?[t,e,r,i]:[t,e,r]).join(", ")}]: \'r\', \'g\', and \'b\' must be between 0 and 255.`}function ei(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Dr||t instanceof gt||t instanceof xl||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e)return!0;if(Array.isArray(t)){for(let e of t)if(!ei(e))return!1;return!0}if(typeof t=="object"){for(let e in t)if(!ei(t[e]))return!1;return!0}return!1}function _t(t){if(t===null)return dn;if(typeof t=="string")return Y;if(typeof t=="boolean")return tt;if(typeof t=="number")return I;if(t instanceof gt)return ce;if(t instanceof Dr)return Ba;if(t instanceof xl)return Pa;if(t instanceof ze)return yn;if(t instanceof Ae)return za;if(t instanceof Se)return La;if(t instanceof oe)return Qi;if(t instanceof De)return Va;if(t instanceof _e)return mn;if(Array.isArray(t)){let e=t.length,r;for(let i of t){let n=_t(i);if(!r)r=n;else{if(r===n)continue;r=Z;break}}return Ut(r||Z,e)}return fr}function Gi(t){let e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof gt||t instanceof Dr||t instanceof ze||t instanceof Ae||t instanceof Se||t instanceof oe||t instanceof De||t instanceof _e?t.toString():JSON.stringify(t)}var ri=class _p{constructor(e,r){this.type=e,this.value=r}static parse(e,r){if(e.length!==2)return r.error(`\'literal\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i),a=r.expectedType;return n.kind==="array"&&n.N===0&&a&&a.kind==="array"&&(typeof a.N!="number"||a.N===0)&&(n=a),new _p(n,i)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},J1=["Unknown","Point","LineString","Polygon"],Ap=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?J1[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let e=this._parseColorCache.get(t);return e||(e=gt.parse(t),this._parseColorCache.set(t,e)),e}};function Oa(t,e,r){let i=t.length-1,n=0,a=i,s=0,o,l;for(;n<=a;)if(s=Math.floor((n+a)/2),o=t[s],l=t[s+1],o<=e){if(s===i||ee)a=s-1;else throw new ft("Input is not a number.",r);return 0}var vl=class Sp{constructor(e,r,i,n){this.type=e,this.input=r,this.key=n,this.labels=[],this.outputs=[];for(let[a,s]of i)this.labels.push(a),this.outputs.push(s)}static parse(e,r){if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=[],a=null;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);for(let s=1;s=o)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let c=r.parse(l,h,a);if(!c)return null;a||(a=c.type),n.push([o,c])}return new Sp(a,i,n,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;return n>=r[a-1]?i[a-1].evaluate(e):i[Oa(r,n,this.key)].evaluate(e)}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function Q1(t,e,r,i){let n=3*t,a=3*(r-t)-n,s=1-n-a,o=3*e,l=3*(i-e)-o,u=1-o-l;return function(h,c=1e-6){if(h<=0)return 0;if(h>=1)return 1;let p=h;for(let y=0;y<8;y++){let m=((s*p+a)*p+n)*p-h;if(Math.abs(m)m?f=p:d=p,p=(f+d)*.5}return((u*p+l)*p+o)*p}}var be=class Qs{constructor(e,r,i,n,a,s){this.type=e,this.operator=r,this.interpolation=i,this.input=n,this.key=s,this.labels=[],this.outputs=[];for(let[o,l]of a)this.labels.push(o),this.outputs.push(l)}static interpolationFactor(e,r,i,n){let a=0;if(e.name==="exponential")a=zs(r,e.base,i,n);else if(e.name==="linear")a=zs(r,1,i,n);else if(e.name==="cubic-bezier"){let s=e.controlPoints;a=Q1(s[0],s[1],s[2],s[3])(zs(r,1,i,n))}return a}static parse(e,r){let[i,n,a,...s]=e;if(!Array.isArray(n)||n.length===0)return r.error("Expected an interpolation type expression.",1);if(n[0]==="linear")n={name:"linear"};else if(n[0]==="exponential"){let u=n[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:u}}else if(n[0]==="cubic-bezier"){let u=n.slice(1);if(u.length!==4||u.some(h=>typeof h!="number"||h<0||h>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:u}}else return r.error(`Unknown interpolation type ${String(n[0])}`,1,0);if(e.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(a=r.parse(a,2,I),!a)return null;let o=[],l=null;(i==="interpolate-hcl"||i==="interpolate-lab")&&r.expectedType!=Qi?l=ce:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u=h)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',p);let d=r.parse(c,f,l);if(!d)return null;l||(l=d.type),o.push([h,d])}return!Ge(l,I)&&!Ge(l,Ba)&&!Ge(l,ce)&&!Ge(l,za)&&!Ge(l,La)&&!Ge(l,Qi)&&!Ge(l,Va)&&!Ge(l,Ut(I))?r.error(`Type ${yt(l)} is not interpolatable.`):new Qs(l,i,n,a,o,r.key)}evaluate(e){let r=this.labels,i=this.outputs;if(r.length===1)return i[0].evaluate(e);let n=this.input.evaluate(e);if(n<=r[0])return i[0].evaluate(e);let a=r.length;if(n>=r[a-1])return i[a-1].evaluate(e);let s=Oa(r,n,this.key),o=r[s],l=r[s+1],u=Qs.interpolationFactor(this.interpolation,n,o,l),h=i[s].evaluate(e),c=i[s+1].evaluate(e);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Je(h,c,u);case"color":return gt.interpolate(h,c,u);case"padding":return Ae.interpolate(h,c,u);case"colorArray":return oe.interpolate(h,c,u);case"numberArray":return Se.interpolate(h,c,u);case"variableAnchorOffsetCollection":return De.interpolate(h,c,u,this.key);case"array":return ti(h,c,u);case"projectionDefinition":return Dr.interpolate(h,c,u)}case"interpolate-hcl":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"hcl");case"colorArray":return oe.interpolate(h,c,u,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return gt.interpolate(h,c,u,"lab");case"colorArray":return oe.interpolate(h,c,u,"lab")}}}eachChild(e){e(this.input);for(let r of this.outputs)e(r)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}};function zs(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}var gr={color:gt.interpolate,number:Je,padding:Ae.interpolate,numberArray:Se.interpolate,colorArray:oe.interpolate,variableAnchorOffsetCollection:De.interpolate,array:ti},Ep=class Fp{constructor(e){this.type=yn,this.sections=e}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[1];if(!Array.isArray(i)&&typeof i=="object")return r.error("First argument must be an image or text section.");let n=[],a=!1;for(let s=1;s<=e.length-1;++s){let o=e[s];if(a&&typeof o=="object"&&!Array.isArray(o)){a=!1;let l=null;if(o["font-scale"]&&(l=r.parse(o["font-scale"],1,I),!l))return null;let u=null;if(o["text-font"]&&(u=r.parse(o["text-font"],1,Ut(Y)),!u))return null;let h=null;if(o["text-color"]&&(h=r.parse(o["text-color"],1,ce),!h))return null;let c=null;if(o["vertical-align"]){if(typeof o["vertical-align"]=="string"&&!H1.includes(o["vertical-align"]))return r.error(`\'vertical-align\' must be one of: \'bottom\', \'center\', \'top\' but found \'${o["vertical-align"]}\' instead.`);if(c=r.parse(o["vertical-align"],1,Y),!c)return null}let p=n[n.length-1];p.scale=l,p.font=u,p.textColor=h,p.verticalAlign=c}else{let l=r.parse(e[s],1,Z);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");a=!0,n.push({content:l,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Fp(n)}evaluate(e){return new ze(this.sections.map(r=>{let i=r.content.evaluate(e);return _t(i)===mn?new Js("",i,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(e):null):new Js(Gi(i),null,r.scale?r.scale.evaluate(e):null,r.font?r.font.evaluate(e).join(","):null,r.textColor?r.textColor.evaluate(e):null,r.verticalAlign?r.verticalAlign.evaluate(e):null)}))}eachChild(e){for(let r of this.sections)e(r.content),r.scale&&e(r.scale),r.font&&e(r.font),r.textColor&&e(r.textColor),r.verticalAlign&&e(r.verticalAlign)}outputDefined(){return!1}};function kp(t,e,r=0,i=t.length-1,n=t0){for(;i>r;){if(i-r>600){let l=i-r+1,u=e-r+1,h=Math.log(l),c=.5*Math.exp(2*h/3),p=.5*Math.sqrt(h*c*(l-c)/l)*(u-l/2<0?-1:1);kp(t,e,Math.max(r,Math.floor(e-u*c/l+p)),Math.min(i,Math.floor(e+(l-u)*c/l+p)),n)}let a=t[e],s=r,o=i;for(ki(t,r,e),n(t[i],a)>0&&ki(t,r,i);s0;)o--}n(t[r],a)===0?ki(t,r,o):(o++,ki(t,o,i)),o<=e&&(r=o+1),e<=o&&(i=o-1)}}function ki(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function t0(t,e){return te)}function Ra(t,e){if(t.length<=1)return[t];let r=[],i,n;for(let a of t){let s=r0(a);s!==0&&(a.area=Math.abs(s),n===void 0&&(n=s<0),n===s<0?(i&&r.push(i),i=[a]):i.push(a))}if(i&&r.push(i),e>1)for(let a=0;a2){let u=e[1];if(typeof u!="string"||!(u in jn)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);o=jn[u],i++}else o=Z;let l;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=e[2],i++}n=Ut(o,l)}else{if(!jn[a])throw Error(`Types doesn\'t contain name = ${a}`);n=jn[a]}let s=[];for(;ie.outputDefined())}},gh={"to-boolean":tt,"to-color":ce,"to-number":I,"to-string":Y},jr=class Ip{constructor(e,r,i){this.type=e,this.args=r,this.key=i}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=e[0];if(!gh[i])throw Error(`Can\'t parse ${i} as it is not part of the known types`);if((i==="to-boolean"||i==="to-string")&&e.length!==2)return r.error("Expected one argument.");let n=gh[i],a=[];for(let s=1;s4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Dp(r[0],r[1],r[2],r[3]),!i))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new ft(i||`Could not parse color from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"padding":{let r;for(let i of this.args){r=i.evaluate(e);let n=Ae.parse(r);if(n)return n}throw new ft(`Could not parse padding from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"numberArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=Se.parse(r);if(n)return n}throw new ft(`Could not parse numberArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"colorArray":{let r;for(let i of this.args){r=i.evaluate(e);let n=oe.parse(r);if(n)return n}throw new ft(`Could not parse colorArray from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"variableAnchorOffsetCollection":{let r;for(let i of this.args){r=i.evaluate(e);let n=De.parse(r);if(n)return n}throw new ft(`Could not parse variableAnchorOffsetCollection from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}case"number":{let r=null;for(let i of this.args){if(r=i.evaluate(e),r===null)return 0;let n=Number(r);if(!isNaN(n))return n}throw new ft(`Could not convert ${JSON.stringify(r)} to number.`,this.key)}case"formatted":return ze.fromString(Gi(this.args[0].evaluate(e)));case"resolvedImage":return _e.fromString(Gi(this.args[0].evaluate(e)));case"projectionDefinition":{let r=this.args[0].evaluate(e);if(Dr.parse(r))return r;throw new ft(`Could not parse projectionDefinition from value \'${typeof r=="string"?r:JSON.stringify(r)}\'`,this.key)}default:return Gi(this.args[0].evaluate(e))}}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}},Cp=class Mp{constructor(e,r){this.type=r.type,this.bindings=[].concat(e),this.result=r}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(let r of this.bindings)e(r[1]);e(this.result)}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);let i=[];for(let a=1;a=i.length)throw new ft(`Array index out of bounds: ${r} > ${i.length-1}.`,this.key);if(r!==Math.floor(r))throw new ft(`Array index must be an integer, but found ${r} instead.`,this.key);return i[r]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}},n0=class Lp{constructor(e,r,i){this.needle=e,this.haystack=r,this.key=i,this.type=tt}static parse(e,r){if(e.length!==3)return r.error(`Expected 2 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);return!i||!n?null:gl(i.type,[tt,Y,I,dn,Z])?new Lp(i,n,r.key):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!i)return!1;if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);if(!dr(i,["string","array"]))throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key);return i.indexOf(r)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}},a0=class to{constructor(e,r,i,n){this.needle=e,this.haystack=r,this.key=i,this.fromIndex=n,this.type=I}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,Z);if(!i||!n)return null;if(!gl(i.type,[tt,Y,I,dn,Z]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new to(i,n,r.key,a):null}return new to(i,n,r.key)}evaluate(e){let r=this.needle.evaluate(e),i=this.haystack.evaluate(e);if(!dr(r,["boolean","string","number","null"]))throw new ft(`Expected first argument to be of type boolean, string, number or null, but found ${yt(_t(r))} instead.`,this.key);let n;if(this.fromIndex&&(n=this.fromIndex.evaluate(e)),dr(i,["string"])){let a=i.indexOf(r,n);return a===-1?-1:[...i.slice(0,a)].length}if(dr(i,["array"]))return i.indexOf(r,n);throw new ft(`Expected second argument to be of type array or string, but found ${yt(_t(i))} instead.`,this.key)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}},s0=class Vp{constructor(e,r,i,n,a,s){this.inputType=e,this.type=r,this.input=i,this.cases=n,this.outputs=a,this.otherwise=s}static parse(e,r){if(e.length<5)return r.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return r.error("Expected an even number of arguments.");let i,n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let a={},s=[];for(let u=2;u2**53-1)return p.error(`Branch labels must be integers no larger than ${2**53-1}.`);if(typeof d=="number"&&Math.floor(d)!==d)return p.error("Numeric branch labels must be integer values.");if(!i)i=_t(d);else if(p.checkSubtype(i,_t(d)))return null;if(a[String(d)]!==void 0)return p.error("Branch labels must be unique.");a[String(d)]=s.length}let f=r.parse(c,u,n);if(!f)return null;n||(n=f.type),s.push(f)}let o=r.parse(e[1],1,Z);if(!o)return null;let l=r.parse(e[e.length-1],e.length-1,n);return!l||o.type.kind!=="value"&&r.concat(1).checkSubtype(i,o.type)?null:new Vp(i,n,o,a,s,l)}evaluate(e){let r=this.input.evaluate(e);return(_t(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}},o0=class Op{constructor(e,r,i){this.type=e,this.branches=r,this.otherwise=i}static parse(e,r){if(e.length<4)return r.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return r.error("Expected an odd number of arguments.");let i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let n=[];for(let s=1;sr.outputDefined())&&this.otherwise.outputDefined()}},l0=class eo{constructor(e,r,i,n,a){this.type=e,this.input=r,this.beginIndex=i,this.key=n,this.endIndex=a}static parse(e,r){if(e.length<=2||e.length>=5)return r.error(`Expected 2 or 3 arguments, but found ${e.length-1} instead.`);let i=r.parse(e[1],1,Z),n=r.parse(e[2],2,I);if(!i||!n)return null;if(!gl(i.type,[Ut(Z),Y,Z]))return r.error(`Expected first argument to be of type array or string, but found ${yt(i.type)} instead`);if(e.length===4){let a=r.parse(e[3],3,I);return a?new eo(i.type,i,n,r.key,a):null}return new eo(i.type,i,n,r.key)}evaluate(e){let r=this.input.evaluate(e),i=this.beginIndex.evaluate(e),n;if(this.endIndex&&(n=this.endIndex.evaluate(e)),dr(r,["string"]))return[...r].slice(i,n).join("");if(dr(r,["array"]))return r.slice(i,n);throw new ft(`Expected first argument to be of type array or string, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}},Rp=class ro{constructor(e,r){this.type=e,this.args=r}static parse(e,r){if(e.length<2)return r.error("Expected at least one argument.");let i=null,n=r.expectedType;n&&n.kind!=="value"&&(i=n);let a=[];for(let s of e.slice(1)){let o=r.parse(s,1+a.length,i,void 0,{typeAnnotation:"omit"});if(!o)return null;i||(i=o.type),a.push(o)}if(!i)throw Error("No output type");return n&&a.some(s=>tn(n,s.type))?new ro(Z,a):new ro(i,a)}evaluate(e){let r=null,i=0,n;for(let a of this.args)if(i++,r=a.evaluate(e),r&&r instanceof _e&&!r.available&&(n||(n=r.name),r=null,i===this.args.length&&(r=n)),r!==null)break;return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}};function xh(t,e){return t==="=="||t==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function u0(t,e,r){return e===r}function h0(t,e,r){return e!==r}function c0(t,e,r){return er}function f0(t,e,r){return e<=r}function d0(t,e,r){return e>=r}function $p(t,e,r,i){return i.compare(e,r)===0}function y0(t,e,r,i){return!$p(t,e,r,i)}function m0(t,e,r,i){return i.compare(e,r)<0}function g0(t,e,r,i){return i.compare(e,r)>0}function x0(t,e,r,i){return i.compare(e,r)<=0}function v0(t,e,r,i){return i.compare(e,r)>=0}function li(t,e,r){let i=t!=="=="&&t!=="!=";return class Np{constructor(a,s,o,l){this.lhs=a,this.rhs=s,this.key=o,this.collator=l,this.type=tt,this.hasUntypedArgument=a.type.kind==="value"||s.type.kind==="value"}static parse(a,s){if(a.length!==3&&a.length!==4)return s.error("Expected two or three arguments.");let o=a[0],l=s.parse(a[1],1,Z);if(!l)return null;if(!xh(o,l.type))return s.concat(1).error(`"${o}" comparisons are not supported for type \'${yt(l.type)}\'.`);let u=s.parse(a[2],2,Z);if(!u)return null;if(!xh(o,u.type))return s.concat(2).error(`"${o}" comparisons are not supported for type \'${yt(u.type)}\'.`);if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error(`Cannot compare types \'${yt(l.type)}\' and \'${yt(u.type)}\'.`);i&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ie(u.type,[l],s.key):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ie(l.type,[u],s.key)));let h=null;if(a.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return s.error("Cannot use collator to compare non-string types.");if(h=s.parse(a[3],3,Pa),!h)return null}return new Np(l,u,s.key,h)}evaluate(a){let s=this.lhs.evaluate(a),o=this.rhs.evaluate(a);if(i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!==u.kind||l.kind!=="string"&&l.kind!=="number")throw new ft(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${l.kind}, ${u.kind}) instead.`,this.key)}if(this.collator&&!i&&this.hasUntypedArgument){let l=_t(s),u=_t(o);if(l.kind!=="string"||u.kind!=="string")return e(a,s,o)}return this.collator?r(a,s,o,this.collator.evaluate(a)):e(a,s,o)}eachChild(a){a(this.lhs),a(this.rhs),this.collator&&a(this.collator)}outputDefined(){return!0}}}var b0=li("==",u0,$p),w0=li("!=",h0,y0),D0=li("<",c0,m0),_0=li(">",p0,g0),A0=li("<=",f0,x0),S0=li(">=",d0,v0),Up=class qp{constructor(e,r,i){this.type=Pa,this.locale=i,this.caseSensitive=e,this.diacriticSensitive=r}static parse(e,r){if(e.length!==2)return r.error("Expected one argument.");let i=e[1];if(typeof i!="object"||Array.isArray(i))return r.error("Collator options argument must be an object.");let n=r.parse(i["case-sensitive"]!==void 0&&i["case-sensitive"],1,tt);if(!n)return null;let a=r.parse(i["diacritic-sensitive"]!==void 0&&i["diacritic-sensitive"],1,tt);if(!a)return null;let s=null;return i.locale&&(s=r.parse(i.locale,1,Y),!s)?null:new qp(n,a,s)}evaluate(e){return new xl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}},E0=class jp{constructor(e,r,i,n,a,s){this.type=Y,this.number=e,this.locale=r,this.currency=i,this.unit=n,this.minFractionDigits=a,this.maxFractionDigits=s}static parse(e,r){if(e.length!==3)return r.error("Expected two arguments.");let i=r.parse(e[1],1,I);if(!i)return null;let n=e[2];if(typeof n!="object"||Array.isArray(n))return r.error("NumberFormat options argument must be an object.");let a=null;if(n.locale&&(a=r.parse(n.locale,1,Y),!a))return null;let s=null;if(n.currency&&(s=r.parse(n.currency,1,Y),!s))return null;let o=null;if(n.unit&&(o=r.parse(n.unit,1,Y),!o))return null;if(s&&o)return r.error("NumberFormat options `currency` and `unit` are mutually exclusive");let l=null;if(n["min-fraction-digits"]&&(l=r.parse(n["min-fraction-digits"],1,I),!l))return null;let u=null;return n["max-fraction-digits"]&&(u=r.parse(n["max-fraction-digits"],1,I),!u)?null:new jp(i,a,s,o,l,u)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":this.unit?"unit":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}},F0=class Gp{constructor(e){this.type=mn,this.input=e}static parse(e,r){if(e.length!==2)return r.error("Expected two arguments.");let i=r.parse(e[1],1,Y);return i?new Gp(i):r.error("No image name provided.")}evaluate(e){let r=this.input.evaluate(e),i=_e.fromString(r);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(r)>-1),i}eachChild(e){e(this.input)}outputDefined(){return!1}},k0=class Xp{constructor(e,r){this.input=e,this.key=r,this.type=I}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=r.parse(e[1],1);return i?i.type.kind!=="array"&&i.type.kind!=="string"&&i.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${yt(i.type)} instead.`):new Xp(i,r.key):null}evaluate(e){let r=this.input.evaluate(e);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new ft(`Expected value to be of type string or array, but found ${yt(_t(r))} instead.`,this.key)}eachChild(e){e(this.input)}outputDefined(){return!1}},we=8192;function T0(t,e){let r=I0(t[0]),i=M0(t[1]),n=2**e.z;return[Math.round(r*n*we),Math.round(i*n*we)]}function bl(t,e){let r=2**e.z,i=(t[0]/we+e.x)/r,n=(t[1]/we+e.y)/r;return[C0(i),B0(n)]}function I0(t){return(180+t)/360}function C0(t){return t*360-180}function M0(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function B0(t){return 360/Math.PI*Math.atan(Math.exp((180-t*360)*Math.PI/180))-90}function gn(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function en(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function P0(t,e,r){return e[1]>t[1]!=r[1]>t[1]&&t[0]<(r[0]-e[0])*(t[1]-e[1])/(r[1]-e[1])+e[0]}function z0(t,e,r){let i=t[0]-e[0],n=t[1]-e[1],a=t[0]-r[0],s=t[1]-r[1];return i*s-a*n===0&&i*a<=0&&n*s<=0}function $a(t,e,r,i){let n=[e[0]-t[0],e[1]-t[1]];return R0([i[0]-r[0],i[1]-r[1]],n)!==0&&!!(vh(t,e,r,i)&&vh(r,i,t,e))}function L0(t,e,r){for(let i of r)for(let n=0;n0&&c<0||h<0&&c>0}function wl(t,e,r){let i=[];for(let n=0;nr[2]){let n=i*.5,a=t[0]-r[0]>n?-i:r[0]-t[0]>n?i:0;a===0&&(a=t[0]-r[2]>n?-i:r[2]-t[0]>n?i:0),t[0]+=a}gn(e,t)}function $0(t){t[0]=t[1]=1/0,t[2]=t[3]=-1/0}function bh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t)for(let l of o){let u=[l.x+a[0],l.y+a[1]];Zp(u,e,r,n),s.push(u)}return s}function wh(t,e,r,i){let n=2**i.z*we,a=[i.x*we,i.y*we],s=[];for(let o of t){let l=[];for(let u of o){let h=[u.x+a[0],u.y+a[1]];gn(e,h),l.push(h)}s.push(l)}if(e[2]-e[0]<=n/2){$0(e);for(let o of s)for(let l of o)Zp(l,e,r,n)}return s}function N0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!ui(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=bh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!V0(o,a))return!1}return!0}function U0(t,e){let r=[1/0,1/0,-1/0,-1/0],i=[1/0,1/0,-1/0,-1/0],n=t.canonicalID();if(e.type==="Polygon"){let a=wl(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!Yp(o,a))return!1}if(e.type==="MultiPolygon"){let a=Wp(e.coordinates,i,n),s=wh(t.geometry(),r,i,n);if(!en(r,i))return!1;for(let o of s)if(!O0(o,a))return!1}return!0}var Dl=class ha{constructor(e,r){this.type=tt,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'within\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection"){let n=[];for(let a of i.features){let{type:s,coordinates:o}=a.geometry;s==="Polygon"&&n.push(o),s==="MultiPolygon"&&n.push(...o)}if(n.length)return new ha(i,{type:"MultiPolygon",coordinates:n})}else if(i.type==="Feature"){let n=i.geometry.type;if(n==="Polygon"||n==="MultiPolygon")return new ha(i,i.geometry)}else if(i.type==="Polygon"||i.type==="MultiPolygon")return new ha(i,i)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return N0(e,this.geometries);if(e.geometryType()==="LineString")return U0(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},Hp=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}},Dh=Math.PI/180,_l=class{constructor(t){let e=Dh*6378.137*1e3,r=Math.cos(t*Dh),i=1/(1-.0066943799901413165*(1-r*r)),n=Math.sqrt(i);this.kx=e*n*r,this.ky=e*n*i*.9933056200098587}distance(t,e){let r=this.wrap(t[0]-e[0])*this.kx,i=(t[1]-e[1])*this.ky;return Math.sqrt(r*r+i*i)}pointOnLine(t,e){let r=1/0,i,n,a,s;for(let o=0;o1?(l=t[o+1][0],u=t[o+1][1]):p>0&&(l+=h/this.kx*p,u+=c/this.ky*p)),h=this.wrap(e[0]-l)*this.kx,c=(e[1]-u)*this.ky;let f=h*h+c*c;f180;)t-=360;return t}};function Kp(t,e){return e[0]-t[0]}function ga(t){return t[1]-t[0]+1}function Le(t,e){return t[1]>=t[0]&&t[1]t[1])return[null,null];let r=ga(t);if(e){if(r===2)return[t,null];let n=Math.floor(r/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}if(r===1)return[t,null];let i=Math.floor(r/2)-1;return[[t[0],t[0]+i],[t[0]+i+1,t[1]]]}function no(t,e){if(!Le(e,t.length))return[1/0,1/0,-1/0,-1/0];let r=[1/0,1/0,-1/0,-1/0];for(let i=e[0];i<=e[1];++i)gn(r,t[i]);return r}function ao(t){let e=[1/0,1/0,-1/0,-1/0];for(let r of t)for(let i of r)gn(e,i);return e}function _h(t){return t[0]!==-1/0&&t[1]!==-1/0&&t[2]!==1/0&&t[3]!==1/0}function Al(t,e,r){if(!_h(t)||!_h(e))return NaN;let i=0,n=0;return t[2]e[2]&&(i=t[0]-e[2]),t[1]>e[3]&&(n=t[1]-e[3]),t[3]=i)return i;if(en(n,a)){if(Ah(t,e))return 0}else if(Ah(e,t))return 0;let s=1/0;for(let o of t)for(let l=0,u=o.length,h=u-1;l0;){let l=s.pop();if(l[0]>=a)continue;let u=l[1],h=e?50:100;if(ga(u)<=h){if(!Le(u,t.length))return NaN;if(e){let c=X0(t,u,r,i);if(isNaN(c)||c===0)return c;a=Math.min(a,c)}else for(let c=u[0];c<=u[1];++c){let p=G0(t[c],r,i);if(a=Math.min(a,p),a===0)return 0}}else{let c=io(u,e);Sh(s,a,i,t,o,c[0]),Sh(s,a,i,t,o,c[1])}}return a}function va(t,e,r,i,n,a=1/0){let s=Math.min(a,n.distance(t[0],r[0]));if(s===0)return s;let o=new Hp([[0,[0,t.length-1],[0,r.length-1]]],Kp);for(;o.length>0;){let l=o.pop();if(l[0]>=s)continue;let u=l[1],h=l[2],c=e?50:100,p=i?50:100;if(ga(u)<=c&&ga(h)<=p){if(!Le(u,t.length)&&Le(h,r.length))return NaN;let f;if(e&&i)f=q0(t,u,r,h,n),s=Math.min(s,f);else if(e&&!i){let d=t.slice(u[0],u[1]+1);for(let y=h[0];y<=h[1];++y)if(f=hr(r[y],d,n),s=Math.min(s,f),s===0)return s}else if(!e&&i){let d=r.slice(h[0],h[1]+1);for(let y=u[0];y<=u[1];++y)if(f=hr(t[y],d,n),s=Math.min(s,f),s===0)return s}else f=j0(t,u,r,h,n),s=Math.min(s,f)}else{let f=io(u,e),d=io(h,i);Gn(o,s,n,t,r,f[0],d[0]),Gn(o,s,n,t,r,f[0],d[1]),Gn(o,s,n,t,r,f[1],d[0]),Gn(o,s,n,t,r,f[1],d[1])}}return s}function W0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!1,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!1,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!1,s.coordinates,n,a))}if(a===0)return a}return a}function Z0(t,e){let r=t.geometry(),i=r.flat().map(s=>bl([s.x,s.y],t.canonical));if(r.length===0)return NaN;let n=new _l(i[0][1]),a=1/0;for(let s of e){switch(s.type){case"Point":a=Math.min(a,va(i,!0,[s.coordinates],!1,n,a));break;case"LineString":a=Math.min(a,va(i,!0,s.coordinates,!0,n,a));break;case"Polygon":a=Math.min(a,xa(i,!0,s.coordinates,n,a))}if(a===0)return a}return a}function H0(t,e){let r=t.geometry();if(r.length===0||r[0].length===0)return NaN;let i=Ra(r,0).map(s=>s.map(o=>o.map(l=>bl([l.x,l.y],t.canonical)))),n=new _l(i[0][0][0][1]),a=1/0;for(let s of e)for(let o of i){switch(s.type){case"Point":a=Math.min(a,xa([s.coordinates],!1,o,n,a));break;case"LineString":a=Math.min(a,xa(s.coordinates,!0,o,n,a));break;case"Polygon":a=Math.min(a,Y0(o,s.coordinates,n,a))}if(a===0)return a}return a}function Ls(t){return t.type==="MultiPolygon"?t.coordinates.map(e=>({type:"Polygon",coordinates:e})):t.type==="MultiLineString"?t.coordinates.map(e=>({type:"LineString",coordinates:e})):t.type==="MultiPoint"?t.coordinates.map(e=>({type:"Point",coordinates:e})):[t]}var El=class ca{constructor(e,r){this.type=I,this.geojson=e,this.geometries=r}static parse(e,r){if(e.length!==2)return r.error(`\'distance\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ei(e[1])){let i=e[1];if(i.type==="FeatureCollection")return new ca(i,i.features.map(n=>Ls(n.geometry)).flat());if(i.type==="Feature")return new ca(i,Ls(i.geometry));if("type"in i&&"coordinates"in i)return new ca(i,Ls(i))}return r.error("\'distance\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return W0(e,this.geometries);if(e.geometryType()==="LineString")return Z0(e,this.geometries);if(e.geometryType()==="Polygon")return H0(e,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}},K0=class Jp{constructor(e){let r=null;for(let i of e)if(!r)r=i.type;else{if(r===i.type)continue;r=Z;break}this.type=Ut(r!=null?r:Z,e.length),this.arr=e}static parse(e,r){if(e.length!==2)return r.error(`\'semiliteral\' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ei(e[1]))return r.error(`invalid value of type "${typeof e[1]}"`);let i=e[1],n=_t(i);if(n.kind==="array"){let a=i.map(s=>r.parse(s,null,Z));return new Jp(a)}return new ri(n,i)}evaluate(e){return this.arr.map(r=>r.evaluate(e))}eachChild(e){this.arr.forEach(e)}outputDefined(){return this.arr.every(e=>e.outputDefined())}},Fl=class Qp{constructor(e){this.key=e,this.type=Z}static parse(e,r){if(e.length!==2)return r.error(`Expected 1 argument, but found ${e.length-1} instead.`);let i=e[1];return i==null?r.error("Global state property must be defined."):typeof i=="string"?new Qp(i):r.error(`Global state property must be string, but found ${typeof e[1]} instead.`)}evaluate(e){var i,n;let r=(i=e.globals)==null?void 0:i.globalState;return!r||Object.keys(r).length===0?null:(n=ji(r,this.key))!=null?n:null}eachChild(){}outputDefined(){return!1}},Yr={"==":b0,"!=":w0,">":_0,"<":D0,">=":S0,"<=":A0,array:Ie,at:i0,boolean:Ie,case:o0,coalesce:Rp,collator:Up,format:Ep,image:F0,in:n0,"index-of":a0,interpolate:be,"interpolate-hcl":be,"interpolate-lab":be,length:k0,let:Cp,literal:ri,match:s0,number:Ie,"number-format":E0,object:Ie,semiliteral:K0,slice:l0,step:vl,string:Ie,"to-boolean":jr,"to-color":jr,"to-number":jr,"to-string":jr,var:Bp,within:Dl,distance:El,"global-state":Fl},ve=class extends Error{constructor(t,e){super(e),this.message=e,this.key=t}},J0=class tf{constructor(e,r=[]){this.parent=e,this.bindings={};for(let[i,n]of r)this.bindings[i]=n}concat(e){return new tf(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw Error(`${e} not found in scope.`)}has(e){return this.bindings[e]?!0:this.parent?this.parent.has(e):!1}},ef=class rf{constructor(e,r,i=[],n,a=new J0,s=[]){this.registry=e,this.path=i,this.key=i.map(o=>`[${o}]`).join(""),this.scope=a,this.errors=s,this.expectedType=n,this._isConstant=r}parse(e,r,i,n,a={}){return r?this.concat(r,i,n)._parse(e,a):this._parse(e,a)}_parse(e,r){(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number")&&(e=["literal",e]);let i=this.key;function n(a,s,o){return o==="assert"?new Ie(s,[a],i):o==="coerce"?new jr(s,[a],i):a}if(Array.isArray(e)){if(e.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let a=e[0];if(typeof a!="string")return this.error(`Expression name must be a string, but found ${typeof a} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;let s=this.registry[a];if(s){let o=s.parse(e,this);if(!o)return null;if(this.expectedType){let l=this.expectedType,u=o.type;if((l.kind==="string"||l.kind==="number"||l.kind==="boolean"||l.kind==="object"||l.kind==="array")&&u.kind==="value")o=n(o,l,r.typeAnnotation||"assert");else if(l.kind==="projectionDefinition"&&["string","array","value"].includes(u.kind)||["color","formatted","resolvedImage"].includes(l.kind)&&["value","string"].includes(u.kind)||["padding","numberArray"].includes(l.kind)&&["value","number","array"].includes(u.kind)||l.kind==="colorArray"&&["value","string","array"].includes(u.kind)||l.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(u.kind))o=n(o,l,r.typeAnnotation||"coerce");else if(this.checkSubtype(l,u))return null}if(!(o instanceof ri)&&o.type.kind!=="resolvedImage"&&this._isConstant(o)){let l=new Ap;try{o=new ri(o.type,o.evaluate(l))}catch(u){return this.error(u.message),null}}return o}return this.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0)}return e===void 0?this.error("\'undefined\' value invalid. Use null instead."):typeof e=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error(`Expected an array, but found ${typeof e} instead.`)}concat(e,r,i){let n=typeof e=="number"?this.path.concat(e):this.path,a=i?this.scope.concat(i):this.scope;return new rf(this.registry,this._isConstant,n,r||null,a,this.errors)}error(e,...r){let i=`${this.key}${r.map(n=>`[${n}]`).join("")}`;this.errors.push(new ve(i,e))}checkSubtype(e,r){let i=tn(e,r);return i&&this.error(i),i}},_r=class Ri{constructor(e,r,i,n,a){this.name=e,this.type=r,this._evaluate=i,this.args=n,this.key=a}evaluate(e){return this._evaluate(e,this.args,this.key)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,r){let i=e[0],n=Ri.definitions[i];if(!n)return r.error(`Unknown expression "${i}". If you wanted a literal array, use ["literal", [...]].`,0);let a=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=s.filter(([u])=>!Array.isArray(u)||u.length===e.length-1),l=null;for(let[u,h]of o){l=new ef(r.registry,ba,r.path,null,r.scope);let c=[],p=!1;for(let f=1;ftm(c)).join(" | "),h=[];for(let c=1;c>1;if(e[n]===t)return!0;e[n]>t?i=n-1:r=n+1}return!1}function sr(t){return{type:t}}_r.register(Yr,{error:[R1,[Y],(t,[e],r)=>{throw new ft(e.evaluate(t),r)}],typeof:[Y,[Z],(t,[e])=>yt(_t(e.evaluate(t)))],"to-rgba":[Ut(I,4),[ce],(t,[e])=>{let[r,i,n,a]=e.evaluate(t).rgb;return[r*255,i*255,n*255,a]}],rgb:[ce,[I,I,I],Eh],rgba:[ce,[I,I,I,I],Eh],has:{type:tt,overloads:[[[Y],(t,[e])=>Fh(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Fh(e.evaluate(t),r.evaluate(t))]]},get:{type:Z,overloads:[[[Y],(t,[e])=>Vs(e.evaluate(t),t.properties())],[[Y,fr],(t,[e,r])=>Vs(e.evaluate(t),r.evaluate(t))]]},"feature-state":[Z,[Y],(t,[e])=>Vs(e.evaluate(t),t.featureState||{})],properties:[fr,[],t=>t.properties()],"geometry-type":[Y,[],t=>t.geometryType()],id:[Z,[],t=>t.id()],zoom:[I,[],t=>t.globals.zoom],"heatmap-density":[I,[],t=>t.globals.heatmapDensity||0],elevation:[I,[],t=>t.globals.elevation||0],"line-progress":[I,[],t=>t.globals.lineProgress||0],accumulated:[Z,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[I,sr(I),(t,e)=>{let r=0;for(let i of e)r+=i.evaluate(t);return r}],"*":[I,sr(I),(t,e)=>{let r=1;for(let i of e)r*=i.evaluate(t);return r}],"-":{type:I,overloads:[[[I,I],(t,[e,r])=>e.evaluate(t)-r.evaluate(t)],[[I],(t,[e])=>-e.evaluate(t)]]},"/":[I,[I,I],(t,[e,r])=>e.evaluate(t)/r.evaluate(t)],"%":[I,[I,I],(t,[e,r])=>e.evaluate(t)%r.evaluate(t)],ln2:[I,[],()=>Math.LN2],pi:[I,[],()=>Math.PI],e:[I,[],()=>Math.E],"^":[I,[I,I],(t,[e,r])=>e.evaluate(t)**+r.evaluate(t)],sqrt:[I,[I],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[I,[I],(t,[e])=>Math.log(e.evaluate(t))],log2:[I,[I],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[I,[I],(t,[e])=>Math.sin(e.evaluate(t))],cos:[I,[I],(t,[e])=>Math.cos(e.evaluate(t))],tan:[I,[I],(t,[e])=>Math.tan(e.evaluate(t))],asin:[I,[I],(t,[e])=>Math.asin(e.evaluate(t))],acos:[I,[I],(t,[e])=>Math.acos(e.evaluate(t))],atan:[I,[I],(t,[e])=>Math.atan(e.evaluate(t))],min:[I,sr(I),(t,e)=>Math.min(...e.map(r=>r.evaluate(t)))],max:[I,sr(I),(t,e)=>Math.max(...e.map(r=>r.evaluate(t)))],abs:[I,[I],(t,[e])=>Math.abs(e.evaluate(t))],round:[I,[I],(t,[e])=>{let r=e.evaluate(t);return r<0?-Math.round(-r):Math.round(r)}],floor:[I,[I],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[I,[I],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[tt,[Y,Z],(t,[e,r])=>t.properties()[e.value]===r.value],"filter-id-==":[tt,[Z],(t,[e])=>t.id()===e.value],"filter-type-==":[tt,[Y],(t,[e])=>t.geometryType()===e.value],"filter-<":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i{let r=t.id(),i=e.value;return typeof r==typeof i&&r":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>n}],"filter-id->":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>i}],"filter-<=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i<=n}],"filter-id-<=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r<=i}],"filter->=":[tt,[Y,Z],(t,[e,r])=>{let i=t.properties()[e.value],n=r.value;return typeof i==typeof n&&i>=n}],"filter-id->=":[tt,[Z],(t,[e])=>{let r=t.id(),i=e.value;return typeof r==typeof i&&r>=i}],"filter-has":[tt,[Z],(t,[e])=>{let r=e.value,i=t.properties();return r in i&&i[r]!==void 0}],"filter-has-id":[tt,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[tt,[Ut(Y)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[tt,[Ut(Z)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[tt,[Y,Ut(Z)],(t,[e,r])=>r.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[tt,[Y,Ut(Z)],(t,[e,r])=>Q0(t.properties()[e.value],r.value,0,r.value.length-1)],all:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)&&r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(!r.evaluate(t))return!1;return!0}]]},any:{type:tt,overloads:[[[tt,tt],(t,[e,r])=>e.evaluate(t)||r.evaluate(t)],[sr(tt),(t,e)=>{for(let r of e)if(r.evaluate(t))return!0;return!1}]]},"!":[tt,[tt],(t,[e])=>!e.evaluate(t)],"is-supported-script":[tt,[Y],(t,[e])=>{let r=t.globals&&t.globals.isSupportedScript;return!r||r(e.evaluate(t))}],upcase:[Y,[Y],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Y,[Y],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Y,sr(Z),(t,e)=>e.map(r=>Gi(r.evaluate(t))).join("")],split:[Ut(Y),[Y,Y],(t,[e,r])=>e.evaluate(t).split(r.evaluate(t))],join:[Y,[Ut(Y),Y],(t,[e,r])=>e.evaluate(t).join(r.evaluate(t))],"resolved-locale":[Y,[Pa],(t,[e])=>e.evaluate(t).resolvedLocale()]});function tm(t){return Array.isArray(t)?`(${t.map(yt).join(", ")})`:`(${yt(t.type)}...)`}function ba(t){if(t instanceof Bp)return ba(t.boundExpression);if(t instanceof _r&&t.name==="error"||t instanceof Up||t instanceof Dl||t instanceof El||t instanceof Fl)return!1;let e=t instanceof jr||t instanceof Ie,r=!0;return t.eachChild(i=>{r&&(r=e?ba(i):i instanceof ri)}),r?Na(t)&&Ua(t,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"]):!1}function Na(t){if(t instanceof _r&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof Dl||t instanceof El)return!1;let e=!0;return t.eachChild(r=>{e&&!Na(r)&&(e=!1)}),e}function rn(t){if(t instanceof _r&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(r=>{e&&!rn(r)&&(e=!1)}),e}function Ua(t,e){if(t instanceof _r&&e.indexOf(t.name)>=0)return!1;let r=!0;return t.eachChild(i=>{r&&!Ua(i,e)&&(r=!1)}),r}function ii(t){return t["property-type"]==="data-driven"||t["property-type"]==="cross-faded-data-driven"}function nf(t){return!!t.expression&&t.expression.parameters.indexOf("zoom")>-1}function kl(t){return!!t.expression&&t.expression.interpolated}var Tl=/^(.*)-transition$/;function nn(t,...e){for(let r of e)for(let i in r)t[i]=r[i];return t}function Q(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}function qa(t){return typeof t=="object"&&!!t&&!Array.isArray(t)&&_t(t)===fr}function em(t){return t}function rm(t){switch(t.type){case"color":return gt.parse;case"padding":return Ae.parse;case"numberArray":return Se.parse;case"colorArray":return oe.parse;default:return null}}function im(t){switch(t){case"exponential":return sf;case"interval":return am;case"categorical":return nm;case"identity":return sm;default:throw Error(`Unknown function type "${t}"`)}}function af(t,e){let r=t.stops&&typeof t.stops[0][0]=="object",i=r||t.property!==void 0,n=r||!i,a=t.type||(kl(e)?"exponential":"interval"),s=rm(e);if(s&&(t=nn({},t),t.stops&&(t.stops=t.stops.map(h=>[h[0],s(h[1])])),t.default?t.default=s(t.default):t.default=s(e.default)),t.colorSpace&&!Z1(t.colorSpace))throw Error(`Unknown color space: "${t.colorSpace}"`);let o=im(a),l,u;if(a==="categorical"){l=Object.create(null);for(let h of t.stops)l[h[0]]=h[1];u=typeof t.stops[0][0]}if(r){let h={},c=[];for(let d=0;dd[0]),evaluate({zoom:d},y){return sf({stops:p,base:t.base},e,d).evaluate(d,y)}}}if(n){let h=a==="exponential"?{name:"exponential",base:t.base===void 0?1:t.base}:null;return{kind:"camera",interpolationType:h,interpolationFactor:be.interpolationFactor.bind(void 0,h),zoomStops:t.stops.map(c=>c[0]),evaluate:({zoom:c})=>o(t,e,c,l,u)}}return{kind:"source",evaluate(h,c){let p=c&&c.properties?c.properties[t.property]:void 0;return p===void 0?xn(t.default,e.default):o(t,e,p,l,u)}}}function xn(t,e,r){if(t!==void 0)return t;if(e!==void 0)return e;if(r!==void 0)return r}function nm(t,e,r,i,n){return xn(typeof r===n?i[r]:void 0,t.default,e.default)}function am(t,e,r){if(Q(r)!=="number")return xn(t.default,e.default);let i=t.stops.length;if(i===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[i-1][0])return t.stops[i-1][1];let n=Oa(t.stops.map(a=>a[0]),r,"");return t.stops[n][1]}function sf(t,e,r){let i=t.base===void 0?1:t.base;if(Q(r)!=="number")return xn(t.default,e.default);let n=t.stops.length;if(n===1||r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];let a=Oa(t.stops.map(h=>h[0]),r,""),s=om(r,i,t.stops[a][0],t.stops[a+1][0]),o=t.stops[a][1],l=t.stops[a+1][1],u=gr[e.type]||em;return typeof o.evaluate=="function"?{evaluate(...h){let c=o.evaluate.apply(void 0,h),p=l.evaluate.apply(void 0,h);if(c!==void 0&&p!==void 0)return u(c,p,s,t.colorSpace)}}:u(o,l,s,t.colorSpace)}function sm(t,e,r){switch(e.type){case"color":r=gt.parse(r);break;case"formatted":r=ze.fromString(r.toString());break;case"resolvedImage":r=_e.fromString(r.toString());break;case"padding":r=Ae.parse(r);break;case"colorArray":r=oe.parse(r);break;case"numberArray":r=Se.parse(r);break;default:Q(r)!==e.type&&(e.type!=="enum"||!e.values[r])&&(r=void 0)}return xn(r,t.default,e.default)}function om(t,e,r,i){let n=i-r,a=t-r;return n===0?0:e===1?a/n:(e**+a-1)/(e**+n-1)}function so(t){return{result:"success",value:t}}function Nr(t){return{result:"error",value:t}}var Il=class{constructor(t,e,r,i){this.expression=t,this._warningHistory={},this._evaluator=new Ap,this._defaultValue=r?pf(r):null,this._enumValues=r&&r.type==="enum"?r.values:null,this._globalState=i,this._rootKey=e}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e,this._evaluator.featureState=r,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,e,r,i,n,a){this._globalState&&(t=ni(t,this._globalState)),this._evaluator.globals=t,this._evaluator.feature=e||null,this._evaluator.featureState=r||null,this._evaluator.canonical=i,this._evaluator.availableImages=n||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new ft(`Expected value to be one of ${Object.keys(this._enumValues).map(o=>JSON.stringify(o)).join(", ")}, but found ${JSON.stringify(s)} instead.`,"");return s}catch(s){let o=s instanceof ft?s.path:"",l=`${o}|${s.message}`;return this._warningHistory[l]||(this._warningHistory[l]=!0,typeof console<"u"&&console.warn(of(this._rootKey,o,s.message,this._defaultValue))),this._defaultValue}}};function of(t,e,r,i){return`${t}${e}: ${r}${i==null?"":` Falling back to ${String(i)}.`}`}function lf(t){if(!t)throw Error(\'rootKey must identify the location of the expression in the style JSON, e.g. "layers[3].paint.line-width".\')}function ja(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in Yr}function er(t,e,r,i){lf(e);let n=new ef(Yr,ba,[],r?hm(r):void 0),a=n.parse(t,void 0,void 0,void 0,r&&r.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?so(new Il(a,e,r,i)):Nr(n.errors)}var an=class{constructor(t,e,r){this.kind=t,this._styleExpression=e,this.isStateDependent=t!=="constant"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this._globalState=r}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}},wa=class{constructor(t,e,r,i,n){this.kind=t,this.zoomStops=r,this._styleExpression=e,this.isStateDependent=t!=="camera"&&!rn(e.expression),this.globalStateRefs=vn(e.expression),this.interpolationType=i,this._globalState=n}evaluateWithoutErrorHandling(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluateWithoutErrorHandling(t,e,r,i,n,a)}evaluate(t,e,r,i,n,a){return this._globalState&&(t=ni(t,this._globalState)),this._styleExpression.evaluate(t,e,r,i,n,a)}interpolationFactor(t,e,r){return this.interpolationType?be.interpolationFactor(this.interpolationType,t,e,r):0}};function lm(t){return t._styleExpression!==void 0}function uf(t,e,r,i){let n=er(t,e,r,i);if(n.result==="error")return n;let a=n.value.expression,s=Na(a);if(!s&&!ii(r))return Nr([new ve("","data expressions not supported")]);let o=Ua(a,["zoom"]);if(!o&&!nf(r))return Nr([new ve("","zoom expressions not supported")]);let l=pa(a);if(!l&&!o)return Nr([new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(l instanceof ve)return Nr([l]);if(l instanceof be&&!kl(r))return Nr([new ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!l)return so(s?new an("constant",n.value,i):new an("source",n.value,i));let u=l instanceof be?l.interpolation:void 0;return so(s?new wa("camera",n.value,l.labels,u,i):new wa("composite",n.value,l.labels,u,i))}var hf=class cf{constructor(e,r,i){this.isStateDependent=!1,this.globalStateRefs=new Set,this._globalState=null,lf(r),this._parameters=e,this._specification=i,this._rootKey=r,this._defaultValue=pf(i),this._warningHistory={};let n=af(this._parameters,this._specification);this.kind=n.kind,this.interpolationFactor=n.interpolationFactor,this.zoomStops=n.zoomStops,this.interpolationType=n.interpolationType,this._innerEvaluate=n.evaluate}evaluate(e,r){try{return this._innerEvaluate(e,r)}catch(i){let n=i instanceof Error?i.message:String(i),a=`|${n}`;return this._warningHistory[a]||(this._warningHistory[a]=!0,typeof console<"u"&&console.warn(of(this._rootKey,"",n,this._defaultValue))),this._defaultValue}}static deserialize(e){return new cf(e._parameters,e._rootKey,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification,_rootKey:e._rootKey}}};function um(t,e,r,i){if(qa(t))return new hf(t,e,r);if(ja(t)){let n=uf(t,e,r,i);if(n.result==="error")throw Error(n.value.map(a=>`${a.key}: ${a.message}`).join(", "));return n.value}{let n=t;return r.type==="color"&&typeof t=="string"?n=gt.parse(t):r.type==="padding"&&(typeof t=="number"||Array.isArray(t))?n=Ae.parse(t):r.type==="numberArray"&&(typeof t=="number"||Array.isArray(t))?n=Se.parse(t):r.type==="colorArray"&&(typeof t=="string"||Array.isArray(t))?n=oe.parse(t):r.type==="variableAnchorOffsetCollection"&&Array.isArray(t)?n=De.parse(t):r.type==="projectionDefinition"&&typeof t=="string"&&(n=Dr.parse(t)),{globalStateRefs:new Set,_globalState:null,kind:"constant",evaluate:()=>n}}}function pa(t){let e=null;if(t instanceof Cp)e=pa(t.result);else if(t instanceof Rp){for(let r of t.args)if(e=pa(r),e)break}else(t instanceof vl||t instanceof be)&&t.input instanceof _r&&t.input.name==="zoom"&&(e=t);return e instanceof ve||t.eachChild(r=>{let i=pa(r);i instanceof ve?e=i:!e&&i?e=new ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):e&&i&&e!==i&&(e=new ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),e}function vn(t,e=new Set){return t instanceof Fl&&e.add(t.key),t.eachChild(r=>{vn(r,e)}),e}function hm(t){let e={color:ce,string:Y,number:I,enum:Y,boolean:tt,formatted:yn,padding:za,numberArray:La,colorArray:Qi,projectionDefinition:Ba,resolvedImage:mn,variableAnchorOffsetCollection:Va};return t.type==="array"?Ut(e[t.value]||Z,t.length):e[t.type]}function pf(t){if(t.type==="color"&&qa(t.default))return new gt(0,0,0,0);switch(t.type){case"color":return gt.parse(t.default)||null;case"padding":return Ae.parse(t.default)||null;case"numberArray":return Se.parse(t.default)||null;case"colorArray":return oe.parse(t.default)||null;case"variableAnchorOffsetCollection":return De.parse(t.default)||null;case"projectionDefinition":return Dr.parse(t.default)||null;default:return t.default===void 0?null:t.default}}function ni(t,e){let{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o}=t!=null?t:{};return{zoom:r,heatmapDensity:i,elevation:n,lineProgress:a,isSupportedScript:s,accumulated:o,globalState:e}}function cm(t){let e=!1;for(let r of t){let i=ff(r);if(i==="expression")return"expression";i==="legacy"&&(e=!0)}return e?"legacy":"neutral"}function ff(t){if(typeof t=="boolean")return"neutral";if(!Array.isArray(t)||t.length===0)return"legacy";switch(t[0]){case"has":return t.length<2||t[1]==="$id"||t[1]==="$type"?"legacy":t.length===2?"neutral":"expression";case"in":return t.length>=3&&(typeof t[1]!="string"||Array.isArray(t[2]))?"expression":"legacy";case"!in":case"!has":return"legacy";case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2])?"expression":"legacy";case"none":return"legacy";case"any":case"all":return cm(t.slice(1));default:return"expression"}}function Cl(t){return ff(t)!=="legacy"}function kh(t){return t==="$type"?["geometry-type"]:t==="$id"?["id"]:["get",t]}function pm(t){switch(t[0]){case"==":case"!=":case"<":case"<=":case">":case">=":return t.length!==3||typeof t[1]!="string"?null:[t[0],kh(t[1]),t[2]];case"in":case"!in":{if(t.length<2||typeof t[1]!="string")return null;let e=["in",kh(t[1]),["literal",t.slice(2)]];return t[0]==="!in"?["!",e]:e}case"has":case"!has":{if(t.length!==2||typeof t[1]!="string"||t[1]==="$type"||t[1]==="$id")return null;let e=["has",t[1]];return t[0]==="!has"?["!",e]:e}default:return null}}function df(t){if((t[0]==="<"||t[0]==="<="||t[0]===">"||t[0]===">=")&&t[1]==="$type")return`"$type" cannot be use with operator "${t[0]}"`;let e=pm(t);return e?`Mixing deprecated filter syntax with expression syntax is not supported. Replace ${JSON.stringify(t)} with ${JSON.stringify(e)}.`:`Mixing deprecated filter syntax with expression syntax is not supported. Convert ${JSON.stringify(t)} to expression syntax.`}function Os(t,e,r){let i=r[t];return Array.isArray(i)?Cl(i)?Ml(i,e.concat(t)):{path:e.concat(t),legacyFilter:i}:null}function Ml(t,e=[]){if(!Array.isArray(t)||t.length<1)return null;switch(t[0]){case"all":case"any":case"none":for(let r=1;r"u")return;let i=r.path.map(n=>`[${n}]`).join("");console.warn(`${e}${i}: ${df(r.legacyFilter)}`)}var dm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ai(t,e,r){if(t==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Cl(t)?fm(t,e):t=Da(t);let i=er(t,e,dm,r);if(i.result==="error")throw Error(i.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,s)=>i.value.evaluate(n,a,{},s),needGeometry:yf(t),getGlobalStateRefs:()=>vn(i.value.expression)}}function ym(t,e){return te)}function yf(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e"||e==="<="||e===">="?Rs(t[1],t[2],e):e==="any"?mm(t.slice(1)):e==="all"?["all"].concat(t.slice(1).map(Da)):e==="none"?["all"].concat(t.slice(1).map(Da).map(Xn)):e==="in"?Th(t[1],t.slice(2)):e==="!in"?Xn(Th(t[1],t.slice(2))):e==="has"?Ih(t[1]):e!=="!has"||Xn(Ih(t[1]))}function Rs(t,e,r){switch(t){case"$type":return[`filter-type-${r}`,e];case"$id":return[`filter-id-${r}`,e];default:return[`filter-${r}`,t,e]}}function mm(t){return["any"].concat(t.map(Da))}function Th(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(r=>typeof r!=typeof e[0])?["filter-in-large",t,["literal",e.sort(ym)]]:["filter-in-small",t,["literal",e]]}}function Ih(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function Xn(t){return["!",t]}function mf(t){let e=t.key,r=t.value;return r?[new E(e,r,"constants have been deprecated as of v8")]:[]}function Dt(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function xr(t){if(Array.isArray(t))return t.map(xr);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){let e={};for(let r in t)e[r]=xr(t[r]);return e}return Dt(t)}function te(t){let e=t.key,r=t.value,i=t.valueSpec||{},n=t.objectElementValidators||{},a=t.style,s=t.styleSpec,o=t.validateSpec,l=[],u=Q(r);if(u!=="object")return[new E(e,r,`object expected, ${u} found`)];for(let h in r){let c=h.split(".")[0],p=ji(i,c)||i["*"],f;if(ji(n,c))f=n[c];else if(ji(i,c)){if(r[h]===void 0)continue;f=o}else if(n["*"])f=n["*"];else if(i["*"])f=o;else{l.push(new E(e,r[h],`unknown property "${h}"`));continue}l=l.concat(f({key:(e&&`${e}.`)+h,value:r[h],valueSpec:p,style:a,styleSpec:s,object:r,objectKey:h,validateSpec:o},r))}for(let h in i)n[h]||i[h].required&&i[h].default===void 0&&r[h]===void 0&&l.push(new E(e,r,`missing required property "${h}"`));return l}function Bl(t){let e=t.value,r=t.valueSpec,i=t.validateSpec,n=t.style,a=t.styleSpec,s=t.key,o=t.arrayElementValidator||i;if(Q(e)!=="array")return[new E(s,e,`array expected, ${Q(e)} found`)];if(r.length&&e.length!==r.length)return[new E(s,e,`array length ${r.length} expected, length ${e.length} found`)];let l={type:r.value,values:r.values};a.$version<7&&(l.function=r.function),Q(r.value)==="object"&&(l=r.value);let u=[];for(let h=0;hi.maximum?[new E(e,r,`${r} is greater than the maximum value ${i.maximum}`)]:[]:[new E(e,r,`number expected, ${n} found`)]}function gf(t){let e=t.valueSpec,r=Dt(t.value.type),i,n={},a,s,o=r!=="categorical"&&t.value.property===void 0,l=!o,u=Q(t.value.stops)==="array"&&Q(t.value.stops[0])==="array"&&Q(t.value.stops[0][0])==="object",h=te({key:t.key,value:t.value,valueSpec:t.styleSpec.function,validateSpec:t.validateSpec,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:c,default:d}});return r==="identity"&&o&&h.push(new E(t.key,t.value,\'missing required property "property"\')),r!=="identity"&&!t.value.stops&&h.push(new E(t.key,t.value,\'missing required property "stops"\')),r==="exponential"&&t.valueSpec.expression&&!kl(t.valueSpec)&&h.push(new E(t.key,t.value,"exponential functions not supported")),t.styleSpec.$version>=8&&(l&&!ii(t.valueSpec)?h.push(new E(t.key,t.value,"property functions not supported")):o&&!nf(t.valueSpec)&&h.push(new E(t.key,t.value,"zoom functions not supported"))),(r==="categorical"||u)&&t.value.property===void 0&&h.push(new E(t.key,t.value,\'"property" property is required\')),h;function c(y){if(r==="identity")return[new E(y.key,y.value,\'identity function may not have a "stops" property\')];let m=[],g=y.value;return m=m.concat(Bl({key:y.key,value:g,valueSpec:y.valueSpec,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,arrayElementValidator:p})),Q(g)==="array"&&g.length===0&&m.push(new E(y.key,g,"array must have at least one stop")),m}function p(y){let m=[],g=y.value,x=y.key;if(Q(g)!=="array")return[new E(x,g,`array expected, ${Q(g)} found`)];if(g.length!==2)return[new E(x,g,`array length 2 expected, length ${g.length} found`)];if(u){if(Q(g[0])!=="object")return[new E(x,g,`object expected, ${Q(g[0])} found`)];if(g[0].zoom===void 0)return[new E(x,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new E(x,g,"object stop key must have value")];if(s&&s>Dt(g[0].zoom))return[new E(x,g[0].zoom,"stop zoom values must appear in ascending order")];Dt(g[0].zoom)!==s&&(s=Dt(g[0].zoom),a=void 0,n={}),m=m.concat(te({key:`${x}[0]`,value:g[0],valueSpec:{zoom:{}},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec,objectElementValidators:{zoom:Ga,value:f}}))}else m=m.concat(f({key:`${x}[0]`,value:g[0],valueSpec:{},validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec},g));return ja(xr(g[1]))?m.concat([new E(`${x}[1]`,g[1],"expressions are not allowed in function stops.")]):m.concat(y.validateSpec({key:`${x}[1]`,value:g[1],valueSpec:e,validateSpec:y.validateSpec,style:y.style,styleSpec:y.styleSpec}))}function f(y,m){let g=Q(y.value),x=Dt(y.value),v=y.value===null?m:y.value;if(!i)i=g;else if(g!==i)return[new E(y.key,v,`${g} stop domain type must match previous stop domain type ${i}`)];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new E(y.key,v,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let b=`number expected, ${g} found`;return ii(e)&&r===void 0&&(b+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new E(y.key,v,b)]}return r==="categorical"&&g==="number"&&(!isFinite(x)||Math.floor(x)!==x)?[new E(y.key,v,`integer expected, found ${x}`)]:r!=="categorical"&&g==="number"&&a!==void 0&&xnew E(`${t.key}${i.key}`,t.value,i.message));let r=e.value.expression||e.value._styleExpression.expression;if(t.expressionContext==="property"&&t.propertyKey==="text-font"&&!r.outputDefined())return[new E(t.key,t.value,`Invalid data expression for "${t.propertyKey}". Output values must be contained as literals within the expression.`)];if(t.expressionContext==="property"&&t.propertyType==="layout"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(t.expressionContext==="filter"&&!rn(r))return[new E(t.key,t.value,\'"feature-state" data expressions are not supported with filters.\')];if(t.expressionContext&&t.expressionContext.indexOf("cluster")===0){if(!Ua(r,["zoom","feature-state"]))return[new E(t.key,t.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(t.expressionContext==="cluster-initial"&&!Na(r))return[new E(t.key,t.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function gm(t){let e=t.value,r=t.key,i=Q(e);return i==="boolean"?[]:[new E(r,e,`boolean expected, ${i} found`)]}function oo(t){let e=t.key,r=t.value,i=Q(r);return i==="string"?gt.parse(String(r))?[]:[new E(e,r,`color expected, "${r}" found`)]:[new E(e,r,`color expected, ${i} found`)]}function sn(t){let e=t.key,r=t.value,i=t.valueSpec,n=[];return Array.isArray(i.values)?i.values.indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${i.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(i.values).indexOf(Dt(r))===-1&&n.push(new E(e,r,`expected one of [${Object.keys(i.values).join(", ")}], ${JSON.stringify(r)} found`)),n}function xm(t,e){let r=t;for(let i of e)r=r[i];return r}function vm(t,e){let r=Ml(e);return r?[new E(`${t.key}${r.path.map(i=>`[${i}]`).join("")}`,xm(t.value,r.path),df(r.legacyFilter),null,"warning")]:[]}function Pl(t){let e=xr(t.value);return Cl(e)?[...vm(t,e),...si(nn({},t,{expressionContext:"filter",valueSpec:{value:"boolean"}}))]:xf(t)}function xf(t){let e=t.value,r=t.key;if(Q(e)!=="array")return[new E(r,e,`array expected, ${Q(e)} found`)];let i=t.styleSpec,n,a=[];if(e.length<1)return[new E(r,e,"filter array must have at least 1 element")];switch(a=a.concat(sn({key:`${r}[0]`,value:e[0],valueSpec:i.filter_operator,style:t.style,styleSpec:t.styleSpec})),Dt(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&Dt(e[1])==="$type"&&a.push(new E(r,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&a.push(new E(r,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(n=Q(e[1]),n!=="string"&&a.push(new E(`${r}[1]`,e[1],`string expected, ${n} found`)));for(let s=2;s{c in r&&e.push(new E(i,r[c],`"${c}" is prohibited for ref layers`))});let h;n.layers.forEach(c=>{Dt(c.id)===o&&(h=c)}),h?h.ref?e.push(new E(i,r.ref,"ref cannot reference another ref layer")):s=Dt(h.type):e.push(new E(i,r.ref,`ref layer "${o}" not found`))}else if(s!=="background")if(!r.source)e.push(new E(i,r,\'missing required property "source"\'));else{let h=n.sources&&n.sources[r.source],c=h&&Dt(h.type);h?c==="vector"&&s==="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster source`)):c!=="raster-dem"&&s==="hillshade"||c!=="raster-dem"&&s==="color-relief"?e.push(new E(i,r.source,`layer "${r.id}" requires a raster-dem source`)):c==="raster"&&s!=="raster"?e.push(new E(i,r.source,`layer "${r.id}" requires a vector source`)):c==="vector"&&!r["source-layer"]?e.push(new E(i,r,`layer "${r.id}" must specify a "source-layer"`)):c==="raster-dem"&&s!=="hillshade"&&s!=="color-relief"?e.push(new E(i,r.source,"raster-dem source can only be used with layer type \'hillshade\' or \'color-relief\'.")):s==="line"&&r.paint&&r.paint["line-gradient"]&&(c!=="geojson"||!h.lineMetrics)&&e.push(new E(i,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \\`lineMetrics\\` enabled.`)):e.push(new E(i,r.source,`source "${r.source}" not found`))}return s==="raster"&&((l=r.paint)!=null&&l.resampling)&&((u=r.paint)!=null&&u["raster-resampling"])&&e.push(new E(i,r.paint,`layer "${r.id}" redundantly specifies "resampling" and "raster-resampling" paint properties, but only one is allowed. It is advised to use "resampling".`)),e=e.concat(te({key:i,value:r,valueSpec:a.layer,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,objectElementValidators:{"*"(){return[]},type(){return t.validateSpec({key:`${i}.type`,value:r.type,valueSpec:a.layer.type,style:t.style,styleSpec:t.styleSpec,validateSpec:t.validateSpec,object:r,objectKey:"type"})},filter:Pl,layout(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return wf(nn({layerType:s},c))}}})},paint(h){return te({layer:r,key:h.key,value:h.value,style:h.style,styleSpec:h.styleSpec,validateSpec:h.validateSpec,objectElementValidators:{"*"(c){return bf(nn({layerType:s},c))}}})}}})),e}function tr(t){let e=t.value,r=t.key,i=Q(e);return i==="string"?[]:[new E(r,e,`string expected, ${i} found`)]}function bm(t){var c;let e=(c=t.sourceName)!=null?c:"",r=t.value,i=t.styleSpec,n=i.source_raster_dem,a=t.style,s=[],o=Q(r);if(r===void 0)return s;if(o!=="object")return s.push(new E("source_raster_dem",r,`object expected, ${o} found`)),s;let l=Dt(r.encoding)==="custom",u=["redFactor","greenFactor","blueFactor","baseShift"],h=t.value.encoding?`"${t.value.encoding}"`:"Default";for(let p in r)!l&&u.includes(p)?s.push(new E(p,r[p],`In "${e}": "${p}" is only valid when "encoding" is set to "custom". ${h} encoding found`)):n[p]?s=s.concat(t.validateSpec({key:p,value:r[p],valueSpec:n[p],validateSpec:t.validateSpec,style:a,styleSpec:i})):s.push(new E(p,r[p],`unknown property "${p}"`));return s}var Ch={promoteId:wm};function _f(t){let e=t.value,r=t.key,i=t.styleSpec,n=t.style,a=t.validateSpec;if(!e.type)return[new E(r,e,\'"type" is required\')];let s=Dt(e.type),o;switch(s){case"vector":case"raster":return o=te({key:r,value:e,valueSpec:i[`source_${s.replace("-","_")}`],style:t.style,styleSpec:i,objectElementValidators:Ch,validateSpec:a}),o;case"raster-dem":return o=bm({sourceName:r,value:e,style:t.style,styleSpec:i,validateSpec:a}),o;case"geojson":if(o=te({key:r,value:e,valueSpec:i.source_geojson,style:n,styleSpec:i,validateSpec:a,objectElementValidators:Ch}),e.cluster)for(let l in e.clusterProperties){let[u,h]=e.clusterProperties[l],c=typeof u=="string"?[u,["accumulated"],["get",l]]:u;o.push(...si({key:`${r}.${l}.map`,value:h,validateSpec:a,expressionContext:"cluster-map"})),o.push(...si({key:`${r}.${l}.reduce`,value:c,validateSpec:a,expressionContext:"cluster-reduce"}))}return o;case"video":return te({key:r,value:e,valueSpec:i.source_video,style:n,validateSpec:a,styleSpec:i});case"image":return te({key:r,value:e,valueSpec:i.source_image,style:n,validateSpec:a,styleSpec:i});case"canvas":return[new E(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return sn({key:`${r}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:n,validateSpec:a,styleSpec:i})}}function wm({key:t,value:e}){if(Q(e)==="string")return tr({key:t,value:e});{let r=[];for(let i in e)r.push(...tr({key:`${t}.${i}`,value:e[i]}));return r}}function Af(t){let e=t.value,r=t.styleSpec,i=r.light,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("light",e,`object expected, ${s} found`)]),a;for(let o in e){let l=o.match(Tl);a=l&&i[l[1]]&&i[l[1]].transition?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,validateSpec:t.validateSpec,style:n,styleSpec:r})):i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)])}return a}function Sf(t){let e=t.value,r=t.styleSpec,i=r.sky,n=t.style,a=Q(e);if(e===void 0)return[];if(a!=="object")return[new E("sky",e,`object expected, ${a} found`)];let s=[];for(let o in e){let l=o.match(Tl);s=l&&i[l[1]]&&i[l[1]].transition?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:r.transition,style:n,styleSpec:r})):i[o]?s.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],style:n,styleSpec:r})):s.concat([new E(o,e[o],`unknown property "${o}"`)])}return s}function Ef(t){let e=t.value,r=t.styleSpec,i=r.terrain,n=t.style,a=[],s=Q(e);if(e===void 0)return a;if(s!=="object")return a=a.concat([new E("terrain",e,`object expected, ${s} found`)]),a;for(let o in e)a=i[o]?a.concat(t.validateSpec({key:o,value:e[o],valueSpec:i[o],validateSpec:t.validateSpec,style:n,styleSpec:r})):a.concat([new E(o,e[o],`unknown property "${o}"`)]);return a}function Dm(t){return tr(t).length===0?[]:si(t)}function _m(t){return tr(t).length===0?[]:si(t)}function Am(t){let e=t.key,r=t.value;if(Q(r)==="array"){if(r.length<1||r.length>4)return[new E(e,r,`padding requires 1 to 4 values; ${r.length} values found`)];let i={type:"number"},n=[];for(let a=0;a[new E(t,e,\'invalid unicode range, expected a value such as "U+26", "U+0-10FFFF" or "U+4??"\')],n=r.match(Mm);if(!n)return i();let[,a,s,o]=n;if(o!==void 0)return o.length>6?i():[];let l=parseInt(a,16),u=s===void 0?l:parseInt(s,16);return l>Mh||u>Mh?[new E(t,e,"unicode range is out of bounds, the maximum code point is U+10FFFF")]:l>u?[new E(t,e,`unicode range start must not be greater than its end, but ${r} is`)]:[]}function Tf(t){var o,l;let e=(o=t.key)!=null?o:"font-faces",r=t.value,i=t.validateSpec,n=(l=t.styleSpec)!=null?l:pp,a=t.style;if(!lo(r))return[new E(e,r,`object expected, ${Q(r)} found`)];let s=[];for(let u in r){let h=r[u],c=Q(h);if(c==="string")s.push(...tr({key:`${e}.${u}`,value:h}));else if(c==="array"){let p={url:{type:"string",required:!0},"unicode-range":{type:"array",value:"string"}};for(let[f,d]of h.entries()){let y=`${e}.${u}[${f}]`;s.push(...te({key:y,value:d,valueSpec:p,styleSpec:n,style:a,validateSpec:i}));let m=lo(d)?d["unicode-range"]:void 0;if(Q(m)==="array")for(let[g,x]of m.entries())s.push(...Bm(`${y}.unicode-range[${g}]`,x))}}else s.push(new E(`${e}.${u}`,h,`string or array expected, ${c} found`))}return s}var Bh={"*"(){return[]},array:Bl,boolean:gm,number:Ga,color:oo,constants:mf,enum:sn,filter:Pl,function:gf,layer:Df,object:te,source:_f,light:Af,sky:Sf,terrain:Ef,projection:km,projectionDefinition:Tm,string:tr,formatted:Dm,resolvedImage:_m,padding:Am,numberArray:Sm,colorArray:Em,variableAnchorOffsetCollection:Fm,sprite:Ff,state:kf,fontFaces:Tf};function Xi(t){let e=t.value,r=t.valueSpec,i=t.styleSpec;return t.validateSpec=Xi,r.expression&&qa(Dt(e))?gf(t):r.expression&&ja(xr(e))?si(t):r.type&&Bh[r.type]?Bh[r.type](t):te(nn({},t,{valueSpec:r.type?i[r.type]:r}))}function If(t){let e=t.value,r=t.key,i=tr(t);return i.length||(e.indexOf("{fontstack}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{fontstack}" token\')),e.indexOf("{range}")===-1&&i.push(new E(r,e,\'"glyphs" url must include a "{range}" token\'))),i}function Qt(t,e=w){let r=[];return r=r.concat(Xi({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,validateSpec:Xi,objectElementValidators:{glyphs:If,"*"(){return[]}}})),t.constants&&(r=r.concat(mf({key:"constants",value:t.constants,style:t,styleSpec:e,validateSpec:Xi}))),Cf(r)}Qt.source=ie(re(_f)),Qt.sprite=ie(re(Ff)),Qt.glyphs=ie(re(If)),Qt.fontFaces=ie(re(Tf)),Qt.light=ie(re(Af)),Qt.sky=ie(re(Sf)),Qt.terrain=ie(re(Ef)),Qt.state=ie(re(kf)),Qt.layer=ie(re(Df)),Qt.filter=ie(re(Pl)),Qt.paintProperty=ie(re(bf)),Qt.layoutProperty=ie(re(wf));function re(t){return function(e){return t(Object.assign({},e,{validateSpec:Xi}))}}function Cf(t){return[].concat(t).sort((e,r)=>e.line-r.line)}function ie(t){return function(...e){return Cf(t.apply(this,e))}}var Pm={type:"enum","property-type":"data-constant",expression:{interpolated:!1,parameters:["global-state"]},values:{visible:{},none:{}},transition:!1,default:"visible"},zm=class{constructor(t,e,r){this._rootKey=e,this._globalState=r,this.setValue(t)}evaluate(){var t;return(t=this._literalValue)!=null?t:this._compiledValue.evaluate({})}setValue(t){if(t==null||t==="visible"||t==="none"){this._literalValue=t==="none"?"none":"visible",this._compiledValue=void 0,this._globalStateRefs=new Set;return}let e=er(t,this._rootKey,Pm,this._globalState);if(e.result==="error")throw this._literalValue="visible",this._compiledValue=void 0,Error(e.value.map(r=>`${r.key}: ${r.message}`).join(", "));this._literalValue=void 0,this._compiledValue=e.value,this._globalStateRefs=vn(e.value.expression)}getGlobalStateRefs(){return this._globalStateRefs}};function Lm(t,e,r){return new zm(t,e,r)}var Ph=Qt,y5=new Set(Object.keys(w).filter(t=>t.startsWith("source_")).map(t=>t.slice(7).replaceAll("_","-")));function Vm(t,e){let r=!1;for(let i of e){if(i.severity==="warning"){Bt(i.message);continue}t.fire(new ma(Error(i.message))),r=!0}return r}function Om(t,e,r,i){return(i==null?void 0:i.validate)!==!1&&Vm(t,e(je({styleSpec:w},r)))}var uo=class Mf{constructor(e,r,i){let n=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;let s=new Int32Array(this.arrayBuffer);e=s[0],r=s[1],i=s[2],this.d=r+2*i;for(let u=0;u=c[f+0]&&n>=c[f+1])?(o[p]=!0,s.push(h[p])):o[p]=!1}}}_forEachCell(e,r,i,n,a,s,o,l){let u=this._convertToCellCoord(e),h=this._convertToCellCoord(r),c=this._convertToCellCoord(i),p=this._convertToCellCoord(n);for(let f=u;f<=c;f++)for(let d=h;d<=p;d++){let y=this.d*d+f;if((!l||l(this._convertFromCellCoord(f),this._convertFromCellCoord(d),this._convertFromCellCoord(f+1),this._convertFromCellCoord(d+1)))&&a.call(this,e,r,i,n,y,s,o,l))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let e=this.cells,r=3+this.cells.length+1+1,i=0;for(let s of this.cells)i+=s.length;let n=new Int32Array(r+i+this.keys.length+this.bboxes.length);n[0]=this.extent,n[1]=this.n,n[2]=this.padding;let a=r;for(let s=0;sr?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoomthis.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}},$m="-transition",Xa=class{constructor(t,e,r,i){this.property=t,this.value=e,this.expression=um(e===void 0?t.specification.default:e,r,t.specification,i)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}},ho=class{constructor(t,e,r){this.property=t,this.value=new Xa(t,void 0,e,r)}transitioned(t,e){return new Lh(this.property,this.value,e,Gt({},t.transition,this.transition),t.now)}untransitioned(){return new Lh(this.property,this.value,null,{},0)}},Nm=class{constructor(t,e,r){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues),this._globalState=r,this._rootKey=e}_propertyRootKey(t){return`${this._rootKey}.${String(t)}`}hasProperty(t){return t in this._properties.defaultTransitionablePropertyValues}getValue(t){return He(this._values[t].value.value)}setValue(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].value=new Xa(this._values[t].property,e===null?void 0:He(e),this._propertyRootKey(t),this._globalState)}getTransition(t){return He(this._values[t].transition)}setTransition(t,e){Object.hasOwn(this._values,t)||(this._values[t]=new ho(this._values[t].property,this._propertyRootKey(t),this._globalState)),this._values[t].transition=He(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t[`${e}${$m}`]=i)}return t}transitioned(t,e){let r=new Vh(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Vh(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}},Lh=class{constructor(t,e,r,i,n){this.property=t,this.value=e,this.begin=n+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,n=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(!a)return n;if(i>this.end||this.value.isDataDriven())return this.prior=null,n;if(ii.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Lf=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){if(t.value!==void 0){if(t.expression.kind==="constant"){let n=t.expression.evaluate(e,null,{},r,i);return this._calculate(n,n,n,e)}return this._calculate(t.expression.evaluate(new st(Math.floor(e.zoom-1),e)),t.expression.evaluate(new st(Math.floor(e.zoom),e)),t.expression.evaluate(new st(Math.floor(e.zoom+1),e)),e)}}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}},Wa=class{constructor(t,e){this.specification=t,this.name=e}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}},Xt=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Xa(r,void 0,r.name,void 0),n=this.defaultTransitionablePropertyValues[e]=new ho(r,r.name,void 0);this.defaultTransitioningPropertyValues[e]=n.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};C("DataDrivenProperty",N),C("DataConstantProperty",V),C("CrossFadedDataDrivenProperty",on),C("CrossFadedProperty",Lf),C("ColorRampProperty",Wa);var Rh=" is a PAINT property not a LAYOUT property. Use get/setPaintProperty instead?",$s=" is a LAYOUT property not a PAINT property. Use get/setLayoutProperty instead?",de=class extends O1{constructor(t,e,r){if(super(),this.id=t.id,this.type=t.type,this._globalState=r,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},this._visibilityExpression=Lm(this.visibility,`layers[${this.id}].layout.visibility`,r),t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter,this._featureFilter=ai(t.filter,`layers[${this.id}].filter`,r)),e.layout&&(this._unevaluatedLayout=new Um(e.layout,`layers[${this.id}].layout`,r)),e.paint)){this._transitionablePaint=new Nm(e.paint,`layers[${this.id}].paint`,r);for(let i in t.paint)this.setPaintProperty(i,t.paint[i],{validate:!1});for(let i in t.layout)this.setLayoutProperty(i,t.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ya(e.paint)}}setFilter(t){this.filter=t,this._featureFilter=ai(t,`layers[${this.id}].filter`,this._globalState)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){var e;if(t==="visibility")return this.visibility;if((e=this._transitionablePaint)!=null&&e.hasProperty(t))throw Error(t+Rh);if(!this._unevaluatedLayout)throw Error(`Cannot get layout property "${t}" on layer type "${this.type}" which has no layout properties.`);return this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){let t=new Set;for(let e of this._visibilityExpression.getGlobalStateRefs())t.add(e);if(this._unevaluatedLayout)for(let e in this._unevaluatedLayout._values){let r=this._unevaluatedLayout._values[e];for(let i of r.getGlobalStateRefs())t.add(i)}for(let e of this._featureFilter.getGlobalStateRefs())t.add(e);return t}getPaintAffectingGlobalStateRefs(){var e;let t=new globalThis.Map;if(this._transitionablePaint)for(let r in this._transitionablePaint._values){let i=this._transitionablePaint._values[r].value;for(let n of i.getGlobalStateRefs()){let a=(e=t.get(n))!=null?e:[];a.push({name:r,value:i.value}),t.set(n,a)}}return t}getVisibilityAffectingGlobalStateRefs(){return this._visibilityExpression.getGlobalStateRefs()}setLayoutProperty(t,e,r={}){var i;if(t==="visibility"){this.visibility=e,this._visibilityExpression.setValue(e),this.recalculateVisibility();return}if((i=this._transitionablePaint)!=null&&i.hasProperty(t)){this.fire(new ma(Error(t+Rh)));return}e!=null&&this._validate(Ph.layoutProperty,`layers.${this.id}.layout.${t}`,t,e,r)||this._unevaluatedLayout.setValue(t,e)}getPaintProperty(t){var e,r;if(t.endsWith("-transition")){let i=t.slice(0,-11);if(i==="visibility"||(e=this._unevaluatedLayout)!=null&&e.hasProperty(i))throw Error(t+$s);return this._transitionablePaint.getTransition(i)}if(t==="visibility"||(r=this._unevaluatedLayout)!=null&&r.hasProperty(t))throw Error(t+$s);return this._transitionablePaint.getValue(t)}setPaintProperty(t,e,r={}){var i;if(t==="visibility"||(i=this._unevaluatedLayout)!=null&&i.hasProperty(t))return this.fire(new ma(Error(t+$s))),!1;if(e!=null&&this._validate(Ph.paintProperty,`layers.${this.id}.paint.${t}`,t,e,r))return!1;if(t.endsWith("-transition"))return this._transitionablePaint.setTransition(t.slice(0,-11),e||void 0),!1;{let n=this._transitionablePaint._values[t],a=n.property.specification["property-type"]==="cross-faded-data-driven",s=n.value.isDataDriven(),o=n.value;this._transitionablePaint.setValue(t,e),this._handleSpecialPaintPropertyUpdate(t);let l=this._transitionablePaint._values[t].value;return l.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(t,o,l)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,e,r){return!1}isHidden(t=this.minzoom,e=!1){return this.minzoom&&t<(e?Math.floor(this.minzoom):this.minzoom)||this.maxzoom&&t>=this.maxzoom?!0:this._evaluatedVisibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculateVisibility(){this._evaluatedVisibility=this._visibilityExpression.evaluate()}recalculate(t,e){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,e)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,e)}serialize(){var e,r;let t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:(e=this._unevaluatedLayout)==null?void 0:e.serialize(),paint:(r=this._transitionablePaint)==null?void 0:r.serialize()};return this.visibility&&(t.layout||(t.layout={}),t.layout.visibility=this.visibility),T1(t,(i,n)=>i!==void 0&&!(n==="layout"&&!Object.keys(i).length)&&!(n==="paint"&&!Object.keys(i).length))}_validate(t,e,r,i,n={}){return Om(this,t,{key:e,layerType:this.type,objectKey:r,value:i},n)}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let t in this.paint._values){let e=this.paint.get(t);if(e instanceof se&&ii(e.property.specification)&&(e.value.kind==="source"||e.value.kind==="composite")&&e.value.isStateDependent)return!0}return!1}},qm,jm=()=>qm||(qm=new Xt({"raster-opacity":new V(w.paint_raster["raster-opacity"],"raster-opacity"),"raster-hue-rotate":new V(w.paint_raster["raster-hue-rotate"],"raster-hue-rotate"),"raster-brightness-min":new V(w.paint_raster["raster-brightness-min"],"raster-brightness-min"),"raster-brightness-max":new V(w.paint_raster["raster-brightness-max"],"raster-brightness-max"),"raster-saturation":new V(w.paint_raster["raster-saturation"],"raster-saturation"),"raster-contrast":new V(w.paint_raster["raster-contrast"],"raster-contrast"),resampling:new V(w.paint_raster.resampling,"resampling"),"raster-resampling":new V(w.paint_raster["raster-resampling"],"raster-resampling"),"raster-fade-duration":new V(w.paint_raster["raster-fade-duration"],"raster-fade-duration")})),Gm={get paint(){return jm()}};var Xm=class extends de{constructor(t,e){super(t,Gm,e)}},Ym={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},bn=class{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},xt=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*5),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw Error("_refreshViews() must be implemented by each concrete StructArray layout")}freeBufferAfterUpload(){this.arrayBuffer=new ArrayBuffer(0),this._refreshViews()}};function At(t,e=1){let r=0,i=0;return{members:t.map(n=>{let a=Wm(n.type),s=r=$h(r,Math.max(e,a)),o=n.components||1;return i=Math.max(i,a),r+=a*o,{name:n.name,type:n.type,components:o,offset:s}}),size:$h(r,Math.max(i,e)),alignment:e}}function Wm(t){return Ym[t].BYTES_PER_ELEMENT}function $h(t,e){return Math.ceil(t/e)*e}var ln=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.int16[i+0]=e,this.int16[i+1]=r,t}};ln.prototype.bytesPerElement=4,C("StructArrayLayout2i4",ln);var co=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.int16[n+0]=e,this.int16[n+1]=r,this.int16[n+2]=i,t}};co.prototype.bytesPerElement=6,C("StructArrayLayout3i6",co);var Nh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.int16[a+0]=e,this.int16[a+1]=r,this.int16[a+2]=i,this.int16[a+3]=n,t}};Nh.prototype.bytesPerElement=8,C("StructArrayLayout4i8",Nh);var po=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};po.prototype.bytesPerElement=12,C("StructArrayLayout2i4i12",po);var fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*4,l=t*8;return this.int16[o+0]=e,this.int16[o+1]=r,this.uint8[l+4]=i,this.uint8[l+5]=n,this.uint8[l+6]=a,this.uint8[l+7]=s,t}};fo.prototype.bytesPerElement=8,C("StructArrayLayout2i4ub8",fo);var un=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.float32[i+0]=e,this.float32[i+1]=r,t}};un.prototype.bytesPerElement=8,C("StructArrayLayout2f8",un);var yo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u){let h=this.length;return this.resize(h+1),this.emplace(h,t,e,r,i,n,a,s,o,l,u)}emplace(t,e,r,i,n,a,s,o,l,u,h){let c=t*10;return this.uint16[c+0]=e,this.uint16[c+1]=r,this.uint16[c+2]=i,this.uint16[c+3]=n,this.uint16[c+4]=a,this.uint16[c+5]=s,this.uint16[c+6]=o,this.uint16[c+7]=l,this.uint16[c+8]=u,this.uint16[c+9]=h,t}};yo.prototype.bytesPerElement=20,C("StructArrayLayout10ui20",yo);var mo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o){let l=this.length;return this.resize(l+1),this.emplace(l,t,e,r,i,n,a,s,o)}emplace(t,e,r,i,n,a,s,o,l){let u=t*8;return this.uint16[u+0]=e,this.uint16[u+1]=r,this.uint16[u+2]=i,this.uint16[u+3]=n,this.uint16[u+4]=a,this.uint16[u+5]=s,this.uint16[u+6]=o,this.uint16[u+7]=l,t}};mo.prototype.bytesPerElement=16,C("StructArrayLayout8ui16",mo);var go=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,t,e,r,i,n,a,s,o,l,u,h,c,p)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f){let d=t*14,y=t*7;return this.int16[d+0]=e,this.int16[d+1]=r,this.int16[d+2]=i,this.int16[d+3]=n,this.uint16[d+4]=a,this.uint16[d+5]=s,this.uint16[d+6]=o,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=h,this.int16[d+10]=c,this.int16[d+11]=p,this.float32[y+6]=f,t}};go.prototype.bytesPerElement=28,C("StructArrayLayout4i4ui4i1f28",go);var xo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.float32[n+0]=e,this.float32[n+1]=r,this.float32[n+2]=i,t}};xo.prototype.bytesPerElement=12,C("StructArrayLayout3f12",xo);var vo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint32[r+0]=e,t}};vo.prototype.bytesPerElement=4,C("StructArrayLayout1ul4",vo);var bo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l){let u=this.length;return this.resize(u+1),this.emplace(u,t,e,r,i,n,a,s,o,l)}emplace(t,e,r,i,n,a,s,o,l,u){let h=t*10,c=t*5;return this.int16[h+0]=e,this.int16[h+1]=r,this.int16[h+2]=i,this.int16[h+3]=n,this.int16[h+4]=a,this.int16[h+5]=s,this.uint32[c+3]=o,this.uint16[h+8]=l,this.uint16[h+9]=u,t}};bo.prototype.bytesPerElement=20,C("StructArrayLayout6i1ul2ui20",bo);var wo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*6;return this.int16[o+0]=e,this.int16[o+1]=r,this.int16[o+2]=i,this.int16[o+3]=n,this.int16[o+4]=a,this.int16[o+5]=s,t}};wo.prototype.bytesPerElement=12,C("StructArrayLayout2i2i2i12",wo);var Uh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n){let a=this.length;return this.resize(a+1),this.emplace(a,t,e,r,i,n)}emplace(t,e,r,i,n,a){let s=t*4,o=t*8;return this.float32[s+0]=e,this.float32[s+1]=r,this.float32[s+2]=i,this.int16[o+6]=n,this.int16[o+7]=a,t}};Uh.prototype.bytesPerElement=16,C("StructArrayLayout2f1f2i16",Uh);var Do=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a){let s=this.length;return this.resize(s+1),this.emplace(s,t,e,r,i,n,a)}emplace(t,e,r,i,n,a,s){let o=t*16,l=t*4,u=t*8;return this.uint8[o+0]=e,this.uint8[o+1]=r,this.float32[l+1]=i,this.float32[l+2]=n,this.int16[u+6]=a,this.int16[u+7]=s,t}};Do.prototype.bytesPerElement=16,C("StructArrayLayout2ub2f2i16",Do);var _o=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*3;return this.uint16[n+0]=e,this.uint16[n+1]=r,this.uint16[n+2]=i,t}};_o.prototype.bytesPerElement=6,C("StructArrayLayout3ui6",_o);var Ao=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g){let x=this.length;return this.resize(x+1),this.emplace(x,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x){let v=t*26,b=t*13,D=t*52;return this.int16[v+0]=e,this.int16[v+1]=r,this.uint16[v+2]=i,this.uint16[v+3]=n,this.uint32[b+2]=a,this.uint32[b+3]=s,this.uint32[b+4]=o,this.uint16[v+10]=l,this.uint16[v+11]=u,this.uint16[v+12]=h,this.float32[b+7]=c,this.float32[b+8]=p,this.uint8[D+36]=f,this.uint8[D+37]=d,this.uint8[D+38]=y,this.uint32[b+10]=m,this.int16[v+22]=g,this.float32[b+12]=x,t}};Ao.prototype.bytesPerElement=52,C("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i1f52",Ao);var So=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P){let L=this.length;return this.resize(L+1),this.emplace(L,t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P)}emplace(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S,k,z,O,P,L){let F=t*34,$=t*17;return this.int16[F+0]=e,this.int16[F+1]=r,this.int16[F+2]=i,this.int16[F+3]=n,this.int16[F+4]=a,this.int16[F+5]=s,this.int16[F+6]=o,this.int16[F+7]=l,this.uint16[F+8]=u,this.uint16[F+9]=h,this.uint16[F+10]=c,this.uint16[F+11]=p,this.uint16[F+12]=f,this.uint16[F+13]=d,this.uint16[F+14]=y,this.uint16[F+15]=m,this.uint16[F+16]=g,this.uint16[F+17]=x,this.uint16[F+18]=v,this.uint16[F+19]=b,this.uint16[F+20]=D,this.uint16[F+21]=A,this.uint16[F+22]=_,this.uint32[$+12]=S,this.float32[$+13]=k,this.float32[$+14]=z,this.uint16[F+30]=O,this.uint16[F+31]=P,this.float32[$+16]=L,t}};So.prototype.bytesPerElement=68,C("StructArrayLayout8i15ui1ul2f2ui1f68",So);var _a=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.float32[r+0]=e,t}};_a.prototype.bytesPerElement=4,C("StructArrayLayout1f4",_a);var Eo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*6,a=t*3;return this.uint16[n+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,t}};Eo.prototype.bytesPerElement=12,C("StructArrayLayout1ui2f12",Eo);var Fo=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e,r){let i=this.length;return this.resize(i+1),this.emplace(i,t,e,r)}emplace(t,e,r,i){let n=t*2,a=t*4;return this.uint32[n+0]=e,this.uint16[a+2]=r,this.uint16[a+3]=i,t}};Fo.prototype.bytesPerElement=8,C("StructArrayLayout1ul2ui8",Fo);var ko=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,e){let r=this.length;return this.resize(r+1),this.emplace(r,t,e)}emplace(t,e,r){let i=t*2;return this.uint16[i+0]=e,this.uint16[i+1]=r,t}};ko.prototype.bytesPerElement=4,C("StructArrayLayout2ui4",ko);var qh=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){let e=this.length;return this.resize(e+1),this.emplace(e,t)}emplace(t,e){let r=t*1;return this.uint16[r+0]=e,t}};qh.prototype.bytesPerElement=2,C("StructArrayLayout1ui2",qh);var To=class extends xt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,e,r,i){let n=this.length;return this.resize(n+1),this.emplace(n,t,e,r,i)}emplace(t,e,r,i,n){let a=t*4;return this.float32[a+0]=e,this.float32[a+1]=r,this.float32[a+2]=i,this.float32[a+3]=n,t}};To.prototype.bytesPerElement=16,C("StructArrayLayout4f16",To);var Vf=class extends bn{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new B(this.anchorPointX,this.anchorPointY)}};Vf.prototype.size=20;var Ll=class extends bo{get(t){return new Vf(this,t)}};C("CollisionBoxArray",Ll);var Of=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}get heightOffset(){return this._structArray.float32[this._pos4+12]}};Of.prototype.size=52;var Rf=class extends Ao{get(t){return new Of(this,t)}};C("PlacedSymbolArray",Rf);var $f=class extends bn{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}get heightOffset(){return this._structArray.float32[this._pos4+16]}};$f.prototype.size=68;var Nf=class extends So{get(t){return new $f(this,t)}};C("SymbolInstanceArray",Nf);var Uf=class extends _a{getoffsetX(t){return this.float32[t*1+0]}};C("GlyphOffsetArray",Uf);var qf=class extends co{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};C("SymbolLineVertexArray",qf);var jf=class extends bn{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}};jf.prototype.size=12;var Gf=class extends Eo{get(t){return new jf(this,t)}};C("TextAnchorOffsetArray",Gf);var Xf=class extends bn{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}};Xf.prototype.size=8;var Yf=class extends Fo{get(t){return new Xf(this,t)}};C("FeatureIndexArray",Yf);var Zm=class extends ln{};var Hm=class extends ln{},Km=class extends ln{},Jm=class extends po{},Qm=class extends fo{},tg=class extends un{},Vr=class extends yo{},jh=class extends mo{},eg=class extends go{},rg=class extends xo{},ig=class extends vo{},Gh=class extends wo{};var ng=class extends Do{};var wn=class extends _o{},Io=class extends ko{};var Co=At([{name:"a_pos",components:2,type:"Int16"}],4),ag=Co.members;Co.size,Co.alignment;var ee=class Ur{constructor(e=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=e}prepareSegment(e,r,i,n){let a=this.segments[this.segments.length-1];return e>Ur.MAX_VERTEX_ARRAY_LENGTH&&Bt(`Max vertices per segment is ${Ur.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}. Consider using the \\`fillLargeMeshArrays\\` function if you require meshes with more than ${Ur.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!a||a.vertexLength+e>Ur.MAX_VERTEX_ARRAY_LENGTH||a.sortKey!==n?this.createNewSegment(r,i,n):a}createNewSegment(e,r,i){let n={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return i!==void 0&&(n.sortKey=i),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(n),n}getOrCreateLatestSegment(e,r,i){return this.prepareSegment(0,e,r,i)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(let e of this.segments)for(let r in e.vaos)e.vaos[r].destroy()}static simpleSegment(e,r,i,n){return new Ur([{vertexOffset:e,primitiveOffset:r,vertexLength:i,primitiveLength:n,vaos:{},sortKey:0}])}};ee.MAX_VERTEX_ARRAY_LENGTH=2**16-1,C("SegmentVector",ee);function Xh(t,e){return t=Ji(Math.floor(t),0,255),e=Ji(Math.floor(e),0,255),256*t+e}var sg=At([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]),og=At([{name:"a_dasharray_from",components:4,type:"Uint16"},{name:"a_dasharray_to",components:4,type:"Uint16"}]),lg=fl(((t,e)=>{function r(i,n){for(var a=i.length&3,s=i.length-a,o=n,l,u=3432918353,h=461845907,c,p=0;p>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c,o=o<<13|o>>>19,l=(o&65535)*5+(((o>>>16)*5&65535)<<16)&4294967295,o=(l&65535)+27492+(((l>>>16)+58964&65535)<<16);switch(c=0,a){case 3:c^=(i.charCodeAt(p+2)&255)<<16;case 2:c^=(i.charCodeAt(p+1)&255)<<8;case 1:c^=i.charCodeAt(p)&255,c=(c&65535)*u+(((c>>>16)*u&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*h+(((c>>>16)*h&65535)<<16)&4294967295,o^=c}return o^=i.length,o^=o>>>16,o=(o&65535)*2246822507+(((o>>>16)*2246822507&65535)<<16)&4294967295,o^=o>>>13,o=(o&65535)*3266489909+(((o>>>16)*3266489909&65535)<<16)&4294967295,o^=o>>>16,o>>>0}e!==void 0&&(e.exports=r)})),ug=fl(((t,e)=>{function r(i,n){for(var a=i.length,s=n^a,o=0,l;a>=4;)l=i.charCodeAt(o)&255|(i.charCodeAt(++o)&255)<<8|(i.charCodeAt(++o)&255)<<16|(i.charCodeAt(++o)&255)<<24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),l^=l>>>24,l=(l&65535)*1540483477+(((l>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^l,a-=4,++o;switch(a){case 3:s^=(i.charCodeAt(o+2)&255)<<16;case 2:s^=(i.charCodeAt(o+1)&255)<<8;case 1:s^=i.charCodeAt(o)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}e.exports=r})),Mo=h1(fl(((t,e)=>{var r=lg(),i=ug();e.exports=r,e.exports.murmur3=r,e.exports.murmur2=i}))(),1),Wf=class Zf{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,r,i,n){this.ids.push(Yh(e)),this.positions.push(r,i,n)}getPositions(e){if(!this.indexed)throw Error("Trying to get index, but feature positions are not indexed");let r=Yh(e),i=0,n=this.ids.length-1;for(;i>1;this.ids[s]>=r?n=s:i=s+1}let a=[];for(;this.ids[i]===r;){let s=this.positions[3*i],o=this.positions[3*i+1],l=this.positions[3*i+2];a.push({index:s,start:o,end:l}),i++}return a}static serialize(e,r){let i=new Float64Array(e.ids),n=new Uint32Array(e.positions);return Bo(i,n,0,i.length-1),r&&r.push(i.buffer,n.buffer),{ids:i,positions:n}}static deserialize(e){let r=new Zf;return r.ids=e.ids,r.positions=e.positions,r.indexed=!0,r}};function Yh(t){let e=+t;return!isNaN(e)&&e<=2**53-1?e:(0,Mo.default)(String(t))}function Bo(t,e,r,i){for(;r>1],a=r-1,s=i+1;for(;;){do a++;while(t[a]n);if(a>=s)break;Yn(t,a,s),Yn(e,3*a,3*s),Yn(e,3*a+1,3*s+1),Yn(e,3*a+2,3*s+2)}s-r`u_${i}`),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new cg(t,e):new Ol(t,e)}},ur=class{constructor(t,e){this.uniformNames=e.map(r=>`u_${r}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setConstantDashPositions(t,e){this.dashTo=[0,t.y,t.height,t.width],this.dashFrom=[0,e.y,e.height,e.width]}setUniform(t,e,r,i){let n=null;i==="u_pattern_to"?n=this.patternTo:i==="u_pattern_from"?n=this.patternFrom:i==="u_dasharray_to"?n=this.dashTo:i==="u_dasharray_from"?n=this.dashFrom:i==="u_pixel_ratio_to"?n=this.pixelRatioTo:i==="u_pixel_ratio_from"&&(n=this.pixelRatioFrom),n!==null&&t.set(n)}getBinding(t,e,r){return r.startsWith("u_pattern")||r.startsWith("u_dasharray_")?new hg(t,e):new Ol(t,e)}},ke=class{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(n=>({name:`a_${n}`,type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r){let i=this.paintVertexArray.length,n=this.expression.evaluate(new st(0,r),e,{},r.canonical,[],r.formattedSection);this.paintVertexArray.resize(t),this._setPaintValue(i,t,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(0,n),r,i);this._setPaintValue(t,e,a)}_setPaintValue(t,e,r){if(this.type==="color"){let i=Po(r);for(let n=t;n`u_${s}_t`),this.type=r,this.useIntegerZoom=i,this.zoom=n,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:`a_${s}`,type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r){let i=this.expression.evaluate(new st(this.zoom,r),e,{},r.canonical,[],r.formattedSection),n=this.expression.evaluate(new st(this.zoom+1,r),e,{},r.canonical,[],r.formattedSection),a=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(a,t,i,n)}updatePaintArray(t,e,r,i,n){let a=this.expression.evaluate(new st(this.zoom,n),r,i),s=this.expression.evaluate(new st(this.zoom+1,n),r,i);this._setPaintValue(t,e,a,s)}_setPaintValue(t,e,r,i){if(this.type==="color"){let n=Po(r),a=Po(i);for(let s=t;s`#define HAS_UNIFORM_${i}`))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof ke||r instanceof he)for(let i of r.paintVertexAttributes)t.push(i.name);else if(r instanceof Ye){let i=r.getVertexAttributes();for(let n of i)t.push(n.name)}}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof $i||r instanceof ur||r instanceof he)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let n=this.binders[i];if(n instanceof $i||n instanceof ur||n instanceof he){for(let a of n.uniformNames)if(e[a]){let s=n.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:n,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),n)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof Ye){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof ke||r instanceof he)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof ke||r instanceof he||r instanceof Ye)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof ke||e instanceof he||e instanceof Ye)&&e.destroy()}}},vr=class{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new Jf(i,e,r);this.needsUpload=!1,this._featureMap=new Wf,this._bufferOffset=0}populatePaintArrays(t,e,r,i){for(let n in this.programConfigurations)this.programConfigurations[n].populatePaintArrays(t,e,i);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let n of r)this.needsUpload=this.programConfigurations[n.id].updatePaintArrays(t,this._featureMap,e,n,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function pg(t,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-dasharray":["dasharray_to","dasharray_from"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}function fg(t){return{"line-pattern":{source:Vr,composite:Vr},"fill-pattern":{source:Vr,composite:Vr},"fill-extrusion-pattern":{source:Vr,composite:Vr},"line-dasharray":{source:jh,composite:jh}}[t]}function Wh(t,e,r){var n;let i={color:{source:un,composite:To},number:{source:_a,composite:un}};return((n=fg(t))==null?void 0:n[r])||i[e][r]}C("ConstantBinder",$i),C("CrossFadedConstantBinder",ur),C("SourceExpressionBinder",ke),C("CrossFadedPatternBinder",Hf),C("CrossFadedDasharrayBinder",Kf),C("CompositeExpressionBinder",he),C("ProgramConfiguration",Jf,{omit:["_buffers"]}),C("ProgramConfigurationSet",vr);var zo=2**14-1,Zh=-zo-1;function Ar(t){let e=mt/t.extent,r=t.loadGeometry();for(let i of r)for(let n of i){let a=Math.round(n.x*e),s=Math.round(n.y*e);n.x=Ji(a,Zh,zo),n.y=Ji(s,Zh,zo),(an.x+1||sn.y+1)&&Bt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}function hi(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?Ar(t):[]}}var Hh=-32768;function dg(t,e,r,i,n){t.emplaceBack(Hh+e*8+i,Hh+r*8+n)}var Rl=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Hm,this.indexArray=new wn,this.segments=new ee,this.programConfigurations=new vr(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],n=[],a=null,s=!1,o=i.type==="heatmap";if(i.type==="circle"){let c=i;a=c.layout.get("circle-sort-key"),s=!a.isConstant(),o||(o=c.paint.get("circle-pitch-alignment")==="map")}let l=o?e.subdivisionGranularity.circle:1,u=new st(this.zoom),h=this.layers[0]._featureFilter.needGeometry;for(let{feature:c,id:p,index:f,sourceLayerIndex:d}of t){let y=hi(c,h);if(!this.layers[0]._featureFilter.filter(u,y,r))continue;let m=s?a.evaluate(y,{},r):void 0,g={id:p,properties:c.properties,type:c.type,sourceLayerIndex:d,index:f,geometry:h?y.geometry:Ar(c),patterns:{},sortKey:m};n.push(g)}s&&n.sort((c,p)=>c.sortKey-p.sortKey);for(let c of n){let{geometry:p,index:f,sourceLayerIndex:d}=c,y=t[f].feature;this.addFeature(c,p,f,r,l),e.featureIndex.insert(y,p,f,d,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures(t){}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ag),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i,n=1){let a;switch(n){case 1:a=[0,7];break;case 3:a=[0,2,5,7];break;case 5:a=[0,1,3,4,6,7];break;case 7:a=[0,1,2,3,4,5,6,7];break;default:throw Error(`Invalid circle bucket granularity: ${n}; valid values are 1, 3, 5, 7.`)}let s=a.length;for(let o of e)for(let l of o){let u=l.x,h=l.y;if(u<0||u>=8192||h<0||h>=8192)continue;let c=this.segments.prepareSegment(s*s,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;for(let f=0;f=3){for(let n of i)if(oi(t,n))return!0}if(gg(t,i,r))return!0}return!1}function gg(t,e,r){if(t.length>1){if($l(t,e))return!0;for(let i of e)if(Lo(i,t,r))return!0}for(let i of t)if(Lo(i,e,r))return!0;return!1}function $l(t,e){if(t.length===0||e.length===0)return!1;for(let r=0;r1?t.distSqr(r):t.distSqr(r.sub(e)._mult(n)._add(e))}function Kh(t,e){let r=!1,i,n,a;for(let s of t){i=s;for(let o=0,l=i.length-1;oe.y!=a.y>e.y&&e.x<(a.x-n.x)*(e.y-n.y)/(a.y-n.y)+n.x&&(r=!r)}return r}function oi(t,e){let r=!1;for(let i=0,n=t.length-1;ie.y!=s.y>e.y&&e.x<(s.x-a.x)*(e.y-a.y)/(s.y-a.y)+a.x&&(r=!r)}return r}function vg(t,e,r,i,n){for(let s of t)if(e<=s.x&&r<=s.y&&i>=s.x&&n>=s.y)return!0;let a=[new B(e,r),new B(e,n),new B(i,n),new B(i,r)];if(t.length>2){for(let s of a)if(oi(t,s))return!0}for(let s=0;sn.x&&e.x>n.x||t.yn.y&&e.y>n.y)return!1;let a=Ke(t,e,r[0]);return a!==Ke(t,e,r[1])||a!==Ke(t,e,r[2])||a!==Ke(t,e,r[3])}function Wr(t,e,r){let i=e.paint.get(t).value;return i.kind==="constant"?i.value:r.programConfigurations.get(e.id).getMaxValue(t)}function Ha(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function Ka(t,e,r,i,n){if(!e[0]&&!e[1])return t;let a=B.convert(e)._mult(n);r==="viewport"&&a._rotate(-i);let s=[];for(let o of t)s.push(o.sub(a));return s}function wg(t){let e=[];for(let r=0;rNl(n,e,r,i))}var kg,Tg=()=>kg||(kg=new Xt({"circle-sort-key":new N(w.layout_circle["circle-sort-key"],"circle-sort-key")})),Ig,Cg=()=>Ig||(Ig=new Xt({"circle-radius":new N(w.paint_circle["circle-radius"],"circle-radius"),"circle-color":new N(w.paint_circle["circle-color"],"circle-color"),"circle-blur":new N(w.paint_circle["circle-blur"],"circle-blur"),"circle-opacity":new N(w.paint_circle["circle-opacity"],"circle-opacity"),"circle-translate":new V(w.paint_circle["circle-translate"],"circle-translate"),"circle-translate-anchor":new V(w.paint_circle["circle-translate-anchor"],"circle-translate-anchor"),"circle-pitch-scale":new V(w.paint_circle["circle-pitch-scale"],"circle-pitch-scale"),"circle-pitch-alignment":new V(w.paint_circle["circle-pitch-alignment"],"circle-pitch-alignment"),"circle-stroke-width":new N(w.paint_circle["circle-stroke-width"],"circle-stroke-width"),"circle-stroke-color":new N(w.paint_circle["circle-stroke-color"],"circle-stroke-color"),"circle-stroke-opacity":new N(w.paint_circle["circle-stroke-opacity"],"circle-stroke-opacity")})),Mg={get paint(){return Cg()},get layout(){return Tg()}};var Bg=class extends de{constructor(t,e){super(t,Mg,e)}createBucket(t){return new Rl(t)}queryRadius(t){let e=t;return Wr("circle-radius",this,e)+Wr("circle-stroke-width",this,e)+Ha(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,unwrappedTileID:s,getElevation:o}){let l=Ka(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-n.bearingInRadians,a),u=this.paint.get("circle-radius").evaluate(e,r)+this.paint.get("circle-stroke-width").evaluate(e,r),h=this.paint.get("circle-pitch-scale"),c=this.paint.get("circle-pitch-alignment"),p,f;return c==="map"?(p=l,f=u*a):(p=Fg(l,n,s,o),f=u),ed({queryGeometry:p,size:f,transform:n,unwrappedTileID:s,getElevation:o,pitchAlignment:c,pitchScale:h},i)}},rd=class extends Rl{};C("HeatmapBucket",rd,{omit:["layers"]});var Pg,zg=()=>Pg||(Pg=new Xt({"heatmap-radius":new N(w.paint_heatmap["heatmap-radius"],"heatmap-radius"),"heatmap-weight":new N(w.paint_heatmap["heatmap-weight"],"heatmap-weight"),"heatmap-intensity":new V(w.paint_heatmap["heatmap-intensity"],"heatmap-intensity"),"heatmap-color":new Wa(w.paint_heatmap["heatmap-color"],"heatmap-color"),"heatmap-opacity":new V(w.paint_heatmap["heatmap-opacity"],"heatmap-opacity")})),Lg={get paint(){return zg()}};function Ul(t,{width:e,height:r},i,n){if(!n)n=new Uint8Array(e*r*i);else if(n instanceof Uint8ClampedArray)n=new Uint8Array(n.buffer);else if(n.length!==e*r*i)throw RangeError(`mismatched image size. expected: ${n.length} but got: ${e*r*i}`);return t.width=e,t.height=r,t.data=n,t}function id(t,{width:e,height:r},i){if(e===t.width&&r===t.height)return;let n=Ul({},{width:e,height:r},i);ql(t,n,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,e),height:Math.min(t.height,r)},i),t.width=e,t.height=r,t.data=n.data}function ql(t,e,r,i,n,a){if(n.width===0||n.height===0)return e;if(n.width>t.width||n.height>t.height||r.x>t.width-n.width||r.y>t.height-n.height)throw RangeError("out of range source coordinates for image copy");if(n.width>e.width||n.height>e.height||i.x>e.width-n.width||i.y>e.height-n.height)throw RangeError("out of range destination coordinates for image copy");let s=t.data,o=e.data;if(s===o)throw Error("srcData equals dstData, so image is already copied");for(let l=0;l{e[t.evaluationKey]=l;let u=t.expression.evaluate(e);n.setPixel(s/4/r,o/4,u)};if(t.clips)for(let s=0,o=0;s$g||($g=new Xt({"hillshade-illumination-direction":new V(w.paint_hillshade["hillshade-illumination-direction"],"hillshade-illumination-direction"),"hillshade-illumination-altitude":new V(w.paint_hillshade["hillshade-illumination-altitude"],"hillshade-illumination-altitude"),"hillshade-illumination-anchor":new V(w.paint_hillshade["hillshade-illumination-anchor"],"hillshade-illumination-anchor"),"hillshade-exaggeration":new V(w.paint_hillshade["hillshade-exaggeration"],"hillshade-exaggeration"),"hillshade-shadow-color":new V(w.paint_hillshade["hillshade-shadow-color"],"hillshade-shadow-color"),"hillshade-highlight-color":new V(w.paint_hillshade["hillshade-highlight-color"],"hillshade-highlight-color"),"hillshade-accent-color":new V(w.paint_hillshade["hillshade-accent-color"],"hillshade-accent-color"),"hillshade-method":new V(w.paint_hillshade["hillshade-method"],"hillshade-method"),resampling:new V(w.paint_hillshade.resampling,"resampling")})),Ug={get paint(){return Ng()}};var qg=class extends de{constructor(t,e){super(t,Ug,e),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,e=this.paint.get("hillshade-illumination-altitude").values,r=this.paint.get("hillshade-highlight-color").values,i=this.paint.get("hillshade-shadow-color").values,n=Math.max(t.length,e.length,r.length,i.length);t=t.concat(Array(n-t.length).fill(t.at(-1))),e=e.concat(Array(n-e.length).fill(e.at(-1))),r=r.concat(Array(n-r.length).fill(r.at(-1))),i=i.concat(Array(n-i.length).fill(i.at(-1)));let a=e.map(ch);return{directionRadians:t.map(ch),altitudeRadians:a,shadowColor:i,highlightColor:r}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&!this.isHidden()}},jg,Gg=()=>jg||(jg=new Xt({"color-relief-opacity":new V(w["paint_color-relief"]["color-relief-opacity"],"color-relief-opacity"),"color-relief-color":new Wa(w["paint_color-relief"]["color-relief-color"],"color-relief-color"),resampling:new V(w["paint_color-relief"].resampling,"resampling")})),Xg={get paint(){return Gg()}};function Wn(t){return"data"in t}var Jh=class{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this._ownedHandle=this.texture,this.update(e,i)}update(t,e,r){var u;let{width:i,height:n}=t,a=(((u=this.size)==null?void 0:u[0])!==i||this.size[1]!==n)&&!r,{context:s}=this,{gl:o}=s;this.useMipmap=!!(e!=null&&e.useMipmap),a&&this.size&&this.format===o.RGBA&&(o.deleteTexture(this.texture),this.texture=o.createTexture(),this._ownedHandle=this.texture,this.magFilter=void 0,this.minFilter=void 0,this.wrap=void 0),o.bindTexture(o.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1);let l=this.format===o.RGBA&&(e==null?void 0:e.premultiply)!==!1;if(a)if(this.size=[i,n],this.format===o.RGBA&&i>0&&n>0){let h=this.useMipmap?Math.floor(Math.log2(Math.max(i,n)))+1:1;if(o.texStorage2D(o.TEXTURE_2D,h,o.RGBA8,i,n),Wn(t)){s.pixelStoreUnpackPremultiplyAlpha.set(!1);let{data:c}=t;l&&c&&(c=Ns(c)),c&&o.texSubImage2D(o.TEXTURE_2D,0,0,0,i,n,o.RGBA,o.UNSIGNED_BYTE,c)}else s.pixelStoreUnpackPremultiplyAlpha.set(l),o.texSubImage2D(o.TEXTURE_2D,0,0,0,o.RGBA,o.UNSIGNED_BYTE,t)}else Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._uploadRawData(t,l,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._uploadDomImage(t,o));else{let{x:h,y:c}=r||{x:0,y:0};Wn(t)?(s.pixelStoreUnpackPremultiplyAlpha.set(!1),this._updateRawData(t,l,h,c,i,n,o)):(s.pixelStoreUnpackPremultiplyAlpha.set(l),this._updateDomImage(t,h,c,o))}this.useMipmap&&!(Wn(t)&&t.data===null)&&o.generateMipmap(o.TEXTURE_2D),s.pixelStoreUnpackFlipY.setDefault(),s.pixelStoreUnpack.setDefault(),s.pixelStoreUnpackPremultiplyAlpha.setDefault()}_uploadDomImage(t,e){e.texImage2D(e.TEXTURE_2D,0,this.format,this.format,e.UNSIGNED_BYTE,t)}_uploadRawData(t,e,r,i,n){let{data:a}=t;e&&a&&(a=Ns(a)),n.texImage2D(n.TEXTURE_2D,0,this.format,r,i,0,this.format,n.UNSIGNED_BYTE,a)}_updateDomImage(t,e,r,i){i.texSubImage2D(i.TEXTURE_2D,0,e,r,i.RGBA,i.UNSIGNED_BYTE,t)}_updateRawData(t,e,r,i,n,a,s){let{data:o}=t;e&&o&&(o=Ns(o)),s.texSubImage2D(s.TEXTURE_2D,0,r,i,n,a,s.RGBA,s.UNSIGNED_BYTE,o)}bind(t,e,r){let{context:i}=this,{gl:n}=i;this.texture!==this._ownedHandle&&(this.texture=this._ownedHandle),n.bindTexture(n.TEXTURE_2D,this.texture),(r===n.LINEAR_MIPMAP_NEAREST||r===n.LINEAR_MIPMAP_LINEAR)&&!this.useMipmap&&(r=n.LINEAR);let a=r||t;t!==this.magFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,t),this.magFilter=t),a!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,a),this.minFilter=a),e!==this.wrap&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,e),this.wrap=e)}generateMipmap(){if(!this.useMipmap)return;let{gl:t}=this.context;t.bindTexture(t.TEXTURE_2D,this.texture),t.generateMipmap(t.TEXTURE_2D)}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null,this._ownedHandle=null}},Pe,jl=(Pe=class{constructor(e,r,i,n=1,a=1,s=1,o=0){if(this.uid=e,r.height!==r.width)throw RangeError("DEM tiles must be square");if(i&&!["mapbox","terrarium","custom"].includes(i)){Bt(`"${i}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);return}this.stride=r.height;let l=this.dim=r.height-4;switch(this.data=new Uint32Array(r.data.buffer),Pe.byteViewCache.set(this,new Uint8Array(this.data.buffer)),i){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=n,this.greenFactor=a,this.blueFactor=s,this.baseShift=o;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let h=-2;h=l)&&this.data.copyWithin(this._idx(0,h),c,c+l),this.data.fill(this.data[c],this._idx(-2,h),this._idx(0,h)),this.data.fill(this.data[c+l-1],this._idx(l,h),this._idx(l+1,h)+1)}let u=this._getByteView();this.min=2**53-1,this.max=-(2**53-1);for(let h=0;hthis.max&&(this.max=f),f=this.dim||n<-1||n>=this.dim)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);let a=this._getByteView(),s=((n+2)*this.stride+i+2)*4,o=this.stride*4,l=e-i,u=r-n,h=this._unpackAtIndex(a,s),c=this._unpackAtIndex(a,s+4),p=this._unpackAtIndex(a,s+o),f=this._unpackAtIndex(a,s+o+4);return h*(1-l)*(1-u)+c*l*(1-u)+p*(1-l)*u+f*l*u}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(e,r){if(e<-2||e>=this.dim+2||r<-2||r>=this.dim+2)throw RangeError(`Out of range source coordinates for DEM data. x: ${e}, y: ${r}, dim: ${this.dim}`);return(r+2)*this.stride+(e+2)}unpack(e,r,i){return e*this.redFactor+r*this.greenFactor+i*this.blueFactor-this.baseShift}pack(e){return sd(e,this.getUnpackVector())}getPixels(){return new Zt({width:this.stride,height:this.stride},this._getByteView())}backfillBorder(e,r,i){if(this.dim!==e.dim)throw Error("dem dimension mismatch");let n=r*this.dim,a=r*this.dim+this.dim,s=i*this.dim,o=i*this.dim+this.dim;switch(r){case-1:n=a-2;break;case 1:a=n+2}switch(i){case-1:s=o-2;break;case 1:o=s+2}let l=-r*this.dim,u=-i*this.dim;for(let h=s;h80*r){o=t[0],l=t[1];let h=o,c=l;for(let p=r;ph&&(h=f),d>c&&(c=d)}u=Math.max(h-o,c-l),u=u===0?0:32767/u}return Ro(a,s,o,l,u),s}function od(t,e,r,i,n){let a=null;if(n===fx(t,e,r,i)>0)for(let s=e;s=e;s-=i)a=ec(s/i|0,t[s],t[s+1],a);return a&&cn(a,a.next)&&(fn(a),a=a.next),a}function br(t,e=t){let r=e===t,i=t,n;do n=!1,i!==i.next&&(hn.size===0||!hn.has(i))&&(cn(i,i.next)||Ft(i.prev,i,i.next)===0)?((r||i===e)&&(e=i.prev),Oo=!0,fn(i),i=i.prev,n=!0):(r||i!==e)&&(i=i.next,n=!r);while(n||i!==e);return e}function Ro(t,e,r,i,n){n&&ox(t,r,i,n);let a=t,s=!1;for(;t.prev!==t.next;){let o=t.prev,l=t.next;if(Ft(o,t,l)<0&&(n?Kg(t,r,i,n):Hg(t))){e.push(o.i,t.i,l.i),fn(t),t=l,a=l;continue}if(t=l,t===a){if(Oo=!1,t=br(t),Oo){a=t;continue}if(!s){t=Jg(t,e),a=t,s=!0;continue}Qg(t,e,r,i,n);break}}}function Hg(t){let e=t.prev,r=t,i=t.next,n=e.x,a=r.x,s=i.x,o=e.y,l=r.y,u=i.y,h=Math.min(n,a,s),c=Math.min(o,l,u),p=Math.max(n,a,s),f=Math.max(o,l,u),d=i.next;for(;d!==e;){if(d.x>=h&&d.x<=p&&d.y>=c&&d.y<=f&&(n!==d.x||o!==d.y)&&Ea(n,o,a,l,s,u,d.x,d.y)&&Ft(d.prev,d,d.next)>=0)return!1;d=d.next}return!0}function Kg(t,e,r,i){let n=t.prev,a=t,s=t.next,o=n.x,l=a.x,u=s.x,h=n.y,c=a.y,p=s.y,f=Math.min(o,l,u),d=Math.min(h,c,p),y=Math.max(o,l,u),m=Math.max(h,c,p),g=qo(f,d,e,r,i),x=qo(y,m,e,r,i),v=t.prevZ;for(;v&&v.z>=g;){if(v.x>=f&&v.x<=y&&v.y>=d&&v.y<=m&&v!==s&&(o!==v.x||h!==v.y)&&Ea(o,h,l,c,u,p,v.x,v.y)&&Ft(v.prev,v,v.next)>=0)return!1;v=v.prevZ}let b=t.nextZ;for(;b&&b.z<=x;){if(b.x>=f&&b.x<=y&&b.y>=d&&b.y<=m&&b!==s&&(o!==b.x||h!==b.y)&&Ea(o,h,l,c,u,p,b.x,b.y)&&Ft(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Jg(t,e){let r=t,i=!1;do{let n=r.prev,a=r.next.next;ud(n,r,r.next,a,!1)&&pn(n,a)&&pn(a,n)&&(e.push(n.i,r.i,a.i),fn(r),fn(r.next),r=t=a,i=!0),r=r.next}while(r!==t);return i?br(r):r}function Qg(t,e,r,i,n){let a=t;do{let s=a.next.next;for(;s!==a.prev;){if(a.i!==s.i&&hx(a,s)){let o=hd(a,s);a=br(a,a.next),o=br(o,o.next),Ro(a,e,r,i,n),Ro(o,e,r,i,n);return}s=s.next}a=a.next}while(a!==t)}var $o=!1;function tx(t,e,r,i){let n=[];for(let a=0,s=e.length;as&&(s=r.x),r.yo&&(o=r.y),h.xs&&(s=h.x),h.yo&&(o=h.y),r=h}while(++l<16&&r!==e);Uo[i]=r;let u=i*4;wt[u]=n,wt[u+1]=a,wt[u+2]=s,wt[u+3]=o}while(r!==e)}function nx(t,e){let r=t.z*4;e.xwt[r+2]&&(wt[r+2]=e.x),e.y>wt[r+3]&&(wt[r+3]=e.y)}function Qh(t){let e=Uo[t];for(;e.prev.next!==e;)e=e.next;return Uo[t]=e,e}function tc(t){let e=No[t];for(;e.prev.next!==e;)e=e.next;return No[t]=e,e}function ax(t,e){let r=e,i=t.x,n=t.y,a=-1/0,s;if(cn(t,r))return r;for(let p=0,f=0;pwt[f+3]||wt[f]>i||wt[f+2]<=a)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r){if(cn(t,r.next))return r.next;if(n<=r.y&&n>=r.next.y&&r.next.y!==r.y){let y=r.x+(n-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(y<=i&&y>a&&(a=y,s=r.xi||wt[f+3]h)continue;let d=Qh(p);r=tc(p);do{if(r.prev.next===r&&i>=r.x&&r.x>=o&&i!==r.x&&Ea(ni)&&(ys.x||r.x===s.x&&sx(s,r)))&&(s=r,c=y)}r=r.next}while(r!==d)}return s}function sx(t,e){return Ft(t.prev,t,e.prev)<0&&Ft(e.next,t,t.next)<0}var ae=[],Ti=[],or=new Uint32Array,Ii=new Uint32Array,Ci=new Uint32Array(256);function ox(t,e,r,i){let n=t,a=0;do n.z=qo(n.x,n.y,e,r,i),ae[a++]=n,n=n.next;while(n!==t);lx(a);let s=null;for(let o=0;o=0&&ae[n].z>i;)ae[n+1]=ae[n],n--;ae[n+1]=r}return}or.length>>a&255]++;let s=0;for(let o=0;o<256;o++){let l=Ci[o];Ci[o]=s,s+=l}for(let o=0;o>>a&255]++;i[u]=e[o],n[u]=l}}function qo(t,e,r,i,n){return t=(t-r)*n|0,e=(e-i)*n|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t|e<<1}function ux(t){let e=t,r=t;do(e.x=(t-s)*(a-o)&&(t-s)*(i-o)>=(r-s)*(e-o)&&(r-s)*(a-o)>=(n-s)*(i-o)}function hx(t,e){let r=cn(t,e)&&Ft(t.prev,t,t.next)>0&&Ft(e.prev,e,e.next)>0;return t.next.i!==e.i&&(r||pn(t,e)&&pn(e,t)&&(Ft(t.prev,t,e.prev)!==0||Ft(t,e.prev,e)!==0))&&!cx(t,e)&&(r||px(t,e))}function Ft(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function cn(t,e){return t.x===e.x&&t.y===e.y}function ud(t,e,r,i,n=!0){let a=Ft(t,e,r),s=Ft(t,e,i),o=Ft(r,i,t),l=Ft(r,i,e);return(a>0&&s<0||a<0&&s>0)&&(o>0&&l<0||o<0&&l>0)?!0:n?!!(a===0&&Hn(t,r,e)||s===0&&Hn(t,i,e)||o===0&&Hn(r,t,i)||l===0&&Hn(r,e,i)):!1}function Hn(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function cx(t,e){let r=Math.min(t.x,e.x),i=Math.max(t.x,e.x),n=Math.min(t.y,e.y),a=Math.max(t.y,e.y),s=t;do{let o=s.next;if(s.x>i&&o.x>i||s.xa&&o.y>a||s.y=0&&Ft(t,t.prev,e)>=0:Ft(t,e,t.prev)<0||Ft(t,t.next,e)<0}function px(t,e){let r=t,i=!1,n=(t.x+e.x)/2,a=(t.y+e.y)/2;do{let s=r.next;r.y>a!=s.y>a&&n<(s.x-r.x)*(a-r.y)/(s.y-r.y)+r.x&&(i=!i),r=s}while(r!==t);return i}function hd(t,e){let r=jo(t.i,t.x,t.y),i=jo(e.i,e.x,e.y),n=t.next,a=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,a.next=i,i.prev=a,i}function ec(t,e,r,i){let n=jo(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function fn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ),$o&&nx(t.prev,t.next)}function jo(t,e,r){return{i:t,x:e,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function fx(t,e,r,i){let n=0;for(let a=e,s=r-i;at)throw Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=e}getGranularityForZoomLevel(t){let e=1<32767||e>32767)throw Error("Vertex coordinates are out of signed 16 bit integer range.");let r=Math.round(t)|0,i=Math.round(e)|0,n=this._getKey(r,i);if(this._vertexDictionary.has(n))return this._vertexDictionary.get(n);let a=this._vertexBuffer.length/2;return this._vertexDictionary.set(n,a),this._vertexBuffer.push(r,i),a}_subdivideTrianglesScanline(t){if(this._granularity<2)return gx(this._vertexBuffer,t);let e=[],r=t.length;for(let i=0;i=1||b<=0)||m&&(ln)){h>=i&&h<=n&&a.push(r[(s+1)%3]);continue}if(!m&&v>0){let _=o+f*v,S=l+d*v;a.push(this._vertexToIndex(_,S))}let D=o+f*Math.max(v,0),A=o+f*Math.min(b,1);if(y||this._generateIntraEdgeVertices(a,o,l,u,h,D,A),!m&&b<1){let _=o+f*b,S=l+d*b;a.push(this._vertexToIndex(_,S))}(m||h>=i&&h<=n)&&a.push(r[(s+1)%3]),!m&&(h<=i||h>=n)&&this._generateInterEdgeVertices(a,o,l,u,h,c,p,A,i,n)}return a}_generateIntraEdgeVertices(t,e,r,i,n,a,s){let o=i-e,l=n-r,u=l===0,h=u?Math.min(e,i):Math.min(a,s),c=u?Math.max(e,i):Math.max(a,s),p=Math.floor(h/this._granularityCellSize)+1,f=Math.ceil(c/this._granularityCellSize)-1;if(u?e=p;d--){let y=d*this._granularityCellSize,m=r+l*(y-e)/o;t.push(this._vertexToIndex(y,m))}}_generateInterEdgeVertices(t,e,r,i,n,a,s,o,l,u){let h=n-r,c=a-i,p=s-n,f=(l-n)/p,d=(u-n)/p,y=Math.min(f,d),m=Math.max(f,d),g=i+c*y,x=Math.floor(Math.min(g,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(g,o)/this._granularityCellSize)-1,b=o=1||m<=0){let _=e-a,S=r-s,k=(l-s)/S,z=(u-s)/S,O=a+_*Math.min(k,z);x=Math.floor(Math.min(O,o)/this._granularityCellSize)+1,v=Math.ceil(Math.max(O,o)/this._granularityCellSize)-1,b=o0?u:l;if(b)for(let _=x;_<=v;_++){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}else for(let _=v;_>=x;_--){let S=_*this._granularityCellSize;t.push(this._vertexToIndex(S,A))}}_generateOutline(t){let e=[];for(let r of t){let i=cr(r,this._granularity,!0),n=this._pointArrayToIndices(i),a=[];for(let s=1;sn==(a===-32768)?(t.push(r),t.push(e),t.push(this._vertexToIndex(i,a)),t.push(this._vertexToIndex(n,a)),t.push(r),t.push(this._vertexToIndex(i,a))):(t.push(e),t.push(r),t.push(this._vertexToIndex(i,a)),t.push(r),t.push(this._vertexToIndex(n,a)),t.push(this._vertexToIndex(i,a)))}_fillPoles(t,e,r){let i=this._vertexBuffer,n=mt,a=t.length;for(let s=2;s=2&&((s=this._canonical)==null?void 0:s.z)===0&&(n=this._removeTrianglesOutsideTileX(n),a=a.map(o=>this._removeLinesOutsideTileX(o))),{verticesFlattened:this._vertexBuffer,indicesTriangles:n,indicesLineList:a}}_vertexOutsideTileX(t){let e=this._vertexBuffer[t*2];return e<0||e>8192}_removeTrianglesOutsideTileX(t){let e=[];for(let r=0;r0?(Math.floor(_/s)+1)*s:(Math.ceil(_/s)-1)*s,O=b>0?(Math.floor(S/s)+1)*s:(Math.ceil(S/s)-1)*s,P=Math.abs(_-z),L=Math.abs(S-O),F=Math.abs(_-y),$=Math.abs(S-m),U=g?P/D:1/0,T=x?L/A:1/0;if((F<=P||!g)&&($<=L||!x))break;if(U0?(r.push(n),r.push(s),r.push(a)):(r.push(n),r.push(a),r.push(s))}return r}function xx(t,e,r){if(e.length===0)throw Error("Subdivision vertex ring is empty.");let i=0,n=t[e[0]*2];for(let l=1;l=0?s-1:a-1,u=(o+1)%a,h=t[e[l]*2],c=t[e[l]*2+1],p=t[e[u]*2],f=t[e[u]*2+1],d=t[e[s]*2],y=t[e[s]*2+1],m=t[e[o]*2],g=t[e[o]*2+1],x=!1;if(hp)x=!1;else{let v=g-y,b=-(m-d),D=y((p-d)*v+(f-y)*b)*D&&(x=!0)}if(x){let v=e[l],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),s--,s<0&&(s=a-1)}else{let v=e[u],b=e[s],D=e[o];v!==b&&v!==D&&b!==D&&r.push(D,b,v),o++,o>=a&&(o=0)}if(l===u)break}}function pd(t,e,r,i,n,a,s,o,l){let u=n.length/2,h=s&&o&&l;if(uee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,g=!0,h=0);let v=Zi(s,i,a,o,p,y,u),b=Zi(s,i,a,o,f,m,u),D=Zi(s,i,a,o,d,g,u);r.emplaceBack(h+v-l,h+b-l,h+D-l),u.primitiveLength++}}function bx(t,e,r,i,n,a){let s=[];for(let c=0;cee.MAX_VERTEX_ARRAY_LENGTH&&(u=t.createNewSegment(e,r),l=o.count,y=!0,m=!0,h=0);let x=Zi(s,i,a,o,f,y,u),v=Zi(s,i,a,o,d,m,u);r.emplaceBack(h+x-l,h+v-l),u.primitiveLength++}}var fd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.sdfPatterns={},this.patternFeatures=[],this.layoutVertexArray=new Km,this.indexArray=new wn,this.indexArray2=new Io,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.segments2=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r,e.availableImages):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;if(this.hasDependencies){let f=Gl("fill",this.layers,l,{zoom:this.zoom},e);this.patternFeatures.push(f)}else this.addFeature(l,u,h,r,{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}addFeatures({options:t,canonical:e,patternPositions:r,patternMap:i}){this.detectSdfPatterns(i);for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,t.subdivisionGranularity)}detectSdfPatterns(t){for(let e of this.patternFeatures)for(let r in e.patterns){let i=e.patterns[r];this.recordSdfPattern(r,t[i.min]),this.recordSdfPattern(r,t[i.mid]),this.recordSdfPattern(r,t[i.max])}for(let e of this.layers){let r=e.paint.get("fill-pattern").constantOr(null);r&&(this.recordSdfPattern(e.id,t[r.from.toString()]),this.recordSdfPattern(e.id,t[r.to.toString()]))}}recordSdfPattern(t,e){if(!e)return;let r=e.sdf===!0,i=this.sdfPatterns[t];i===void 0?this.sdfPatterns[t]=r:i!==r&&Bt(`Style sheet warning: Cannot mix SDF and non-SDF fill patterns in layer "${t}"`)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wg),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,n,a){for(let s of Ra(e,500)){let o=cd(s,i,a.fill.getGranularityForZoomLevel(i.z)),l=this.layoutVertexArray;pd((u,h)=>{l.emplaceBack(u,h)},this.segments,this.layoutVertexArray,this.indexArray,o.verticesFlattened,o.indicesTriangles,this.segments2,this.indexArray2,o.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,canonical:i})}};C("FillBucket",fd,{omit:["layers","patternFeatures"]});var wx,Dx=()=>wx||(wx=new Xt({"fill-sort-key":new N(w.layout_fill["fill-sort-key"],"fill-sort-key")})),_x,Ax=()=>_x||(_x=new Xt({"fill-antialias":new V(w.paint_fill["fill-antialias"],"fill-antialias"),"fill-opacity":new N(w.paint_fill["fill-opacity"],"fill-opacity"),"fill-layer-opacity":new V(w.paint_fill["fill-layer-opacity"],"fill-layer-opacity"),"fill-color":new N(w.paint_fill["fill-color"],"fill-color"),"fill-outline-color":new N(w.paint_fill["fill-outline-color"],"fill-outline-color"),"fill-translate":new V(w.paint_fill["fill-translate"],"fill-translate"),"fill-translate-anchor":new V(w.paint_fill["fill-translate-anchor"],"fill-translate-anchor"),"fill-pattern":new on(w.paint_fill["fill-pattern"],"fill-pattern")})),Sx={get paint(){return Ax()},get layout(){return Dx()}};var Ex=class extends de{constructor(t,e){super(t,Sx,e)}recalculate(t,e){super.recalculate(t,e);let r=this.paint._values["fill-outline-color"];r.value.kind==="constant"&&r.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new fd(t)}queryRadius(){return Ha(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:e,transform:r,pixelsToTileUnits:i}){return Qf(Ka(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-r.bearingInRadians,i),e)}isTileClipped(){return!0}},Go=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Fx=At([{name:"a_centroid",components:2,type:"Int16"}],4),kx=Go.members;Go.size,Go.alignment;var Fa=class Xo{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(e){return this.minX=Math.min(this.minX,e.x),this.minY=Math.min(this.minY,e.y),this.maxX=Math.max(this.maxX,e.x),this.maxY=Math.max(this.maxY,e.y),this}expandBy(e){return this.minX-=e,this.minY-=e,this.maxX+=e,this.maxY+=e,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(e){return this.expandBy(-e)}map(e){let r=new Xo;return r.extend(e(new B(this.minX,this.minY))),r.extend(e(new B(this.maxX,this.minY))),r.extend(e(new B(this.minX,this.maxY))),r.extend(e(new B(this.maxX,this.maxY))),r}static fromPoints(e){let r=new Xo;for(let i of e)r.extend(i);return r}contains(e){return e.x>=this.minX&&e.x<=this.maxX&&e.y>=this.minY&&e.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(e){return!this.empty()&&!e.empty()&&e.minX>=this.minX&&e.maxX<=this.maxX&&e.minY>=this.minY&&e.maxY<=this.maxY}intersects(e){return!this.empty()&&!e.empty()&&e.minX<=this.maxX&&e.maxX>=this.minX&&e.minY<=this.maxY&&e.maxY>=this.minY}},g5=Fa.fromPoints([new B(0,0),new B(mt,mt)]);function Yo(t,e){return t.x===e.x&&(t.x<0||t.x>8192)||t.y===e.y&&(t.y<0||t.y>8192)}function rc(t){return t.every(e=>e.x<0)||t.every(e=>e.x>8192)||t.every(e=>e.y<0)||t.every(e=>e.y>8192)}var Dn=class{constructor(t,e,r,i,n){for(this.properties=Object.create(null),this.extent=r,this.type=0,this.id=void 0,this._pbf=t,this._geometry=-1,this._keys=i,this._values=n;t.pos>3,a===0)continue}if(a--,n===1)s+=t.readSVarint(),o+=t.readSVarint(),i&&r.push(i),i=[new B(s,o)];else if(n===2)s+=t.readSVarint(),o+=t.readSVarint(),i&&i.push(new B(s,o));else if(n===7)i&&i.push(i[0].clone());else throw Error(`unknown command ${n}`)}return i&&r.push(i),r}bbox(){if(this._geometry<0)throw Error("feature has no geometry");let t=this._pbf;t.pos=this._geometry;let e=t.readVarint()+t.pos,r=1,i=0,n=0,a=0,s=1/0,o=-1/0,l=1/0,u=-1/0;for(;t.pos>3,i===0)continue}if(i--,r===1||r===2)n+=t.readSVarint(),a+=t.readSVarint(),no&&(o=n),au&&(u=a);else if(r!==7)throw Error(`unknown command ${r}`)}return[s,l,o,u]}toGeoJSON(t,e,r){let i=this.extent*2**r,n=this.extent*t,a=this.extent*e,s=this.loadGeometry();function o(c){return[(c.x+n)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(c.y+a)*2/i)*Math.PI))-90]}function l(c){return c.map(o)}let u;if(this.type===1){let c=[];for(let f of s)c.push(f[0]);let p=l(c);u=c.length===1?{type:"Point",coordinates:p[0]}:{type:"MultiPoint",coordinates:p}}else if(this.type===2){let c=s.map(l);u=c.length===1?{type:"LineString",coordinates:c[0]}:{type:"MultiLineString",coordinates:c}}else if(this.type===3){let c=dd(s),p=[];for(let f of c)p.push(f.map(l));u=p.length===1?{type:"Polygon",coordinates:p[0]}:{type:"MultiPolygon",coordinates:p}}else throw Error("unknown feature type");let h={type:"Feature",geometry:u,properties:this.properties};return this.id!=null&&(h.id=this.id),h}};Dn.types=["Unknown","Point","LineString","Polygon"];function dd(t){let e=t.length;if(e<=1)return[t];let r=[],i,n;for(let a=0;a=this._features.length)throw Error("feature index out of bounds");this._pbf.pos=this._features[t];let e=this._pbf.readVarint()+this._pbf.pos;return new Dn(this._pbf,e,this.extent,this._keys,this._values)}};function Cx(t){let e=null,r=t.readVarint()+t.pos;for(;t.pos90||this.lat<-90)throw Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Ui(F1(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){let r=Math.PI/180,i=this.lat*r,n=e.lat*r,a=Math.sin(i)*Math.sin(n)+Math.cos(i)*Math.cos(n)*Math.cos((e.lng-this.lng)*r);return yd*Math.acos(Math.min(a,1))}static convert(e){if(e instanceof Ui)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Ui(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e)return new Ui(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}},md=2*Math.PI*yd;function gd(t){return md*Math.cos(t*Math.PI/180)}function Mx(t){return(180+t)/360}function Bx(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function Px(t,e){return t/gd(e)}function zx(t){return t*360-180}function Wo(t){let e=180-t*360;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90}function Lx(t,e){return t*gd(Wo(e))}function Vx(t){return 1/Math.cos(t*Math.PI/180)}var Yl=class xd{constructor(e,r,i=0){this.x=+e,this.y=+r,this.z=+i}static fromLngLat(e,r=0){let i=ic.convert(e);return new xd(Mx(i.lng),Bx(i.lat),Px(r,i.lat))}toLngLat(){return new ic(zx(this.x),Wo(this.y))}toAltitude(){return Lx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/md*Vx(Wo(this.y))}};function Ox(t,e,r){let i=1/(1<Nx(n,i))}function $x(t,e){let r=Rx(mt/2,mt/2,e),i=Yl.fromLngLat(r).meterInMercatorCoordinateUnits(),n=(1<1&&e[0].x===e[e.length-1].x&&e[0].y===e[e.length-1].y;)e.pop();return e}function qx(t,e,r,i,n){let a=e.sub(r),s=i.sub(r),o=a.mag(),l=s.mag();if(o<1e-6||l<1e-6){t.push(r.clone());return}a._div(o),s._div(l);let u=a.x*s.x+a.y*s.y;if(Math.abs(u)>Math.cos(5*Math.PI/180)){t.push(r.clone());return}let h=.2,c=Math.min(n,o*h,l*h),p=r.add(a.mult(c)),f=r.add(s.mult(c)),d=Math.sqrt((1+u)/2),y=r.add(a.add(s)._unit()._mult(c/d)),m=p.sub(y).angleWith(f.sub(y)),g=Math.max(2,Math.ceil(Math.abs(m)/(Math.PI/6)-1e-6));for(let x=0;x<=g;x++)t.push(p.rotateAround(x/g*m,y))}var js=8192;function Mi(t,e,r,i,n,a,s,o){t.emplaceBack(e,r,Math.floor(i*js)*2+s,n*js*2,a*js*2,Math.round(o))}var vd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.layoutVertexArray=new Jm,this.centroidVertexArray=new Zm,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasDependencies=Aa("fill-extrusion",this.layers,e);let i=new st(this.zoom),n=this.layers[0],a=n.layout.get("fill-extrusion-rounded-corner-distance"),s=n._featureFilter.needGeometry;for(let{feature:o,id:l,index:u,sourceLayerIndex:h}of t){let c=hi(o,s);if(!n._featureFilter.filter(i,c,r))continue;let p=s?c.geometry:Ar(o),f={id:l,sourceLayerIndex:h,index:u,geometry:a>0?nc(p,a,r):p,properties:o.properties,type:o.type,patterns:{}};this.hasDependencies?this.features.push(Gl("fill-extrusion",this.layers,f,{zoom:this.zoom},e)):this.addFeature(f,f.geometry,u,r,{},e.subdivisionGranularity),e.featureIndex.insert(o,f.geometry,u,h,this.index,!0)}}addFeatures({options:t,canonical:e,patternPositions:r}){for(let i of this.features){let{geometry:n}=i;this.addFeature(i,n,i.index,e,r,t.subdivisionGranularity)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r})}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,kx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Fx.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,n,a){let s=this.layers[0],o=s.layout?s.layout.get("fill-extrusion-rounded-corner-distance"):0,l=o>0?nc(e,o,i):e;for(let u of Ra(l,500)){let h={x:0,y:0,sampleCount:0},c=this.layoutVertexArray.length;this.processPolygon(h,i,t,u,a);let p=this.layoutVertexArray.length-c,f=Math.floor(h.x/h.sampleCount),d=Math.floor(h.y/h.sampleCount);for(let y=0;y{Mi(u,h,c,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,l.verticesFlattened,l.indicesTriangles)}_generateSideFaces(t,e){let r=0;for(let i=1;iee.MAX_VERTEX_ARRAY_LENGTH&&(e.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let s=n.sub(a)._perp()._unit(),o=a.dist(n);r+o>32768&&(r=0),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,n.x,n.y,s.x,s.y,0,1,r),r+=o,Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,0,r),Mi(this.layoutVertexArray,a.x,a.y,s.x,s.y,0,1,r);let l=e.segment.vertexLength;this.indexArray.emplaceBack(l,l+2,l+1),this.indexArray.emplaceBack(l+1,l+2,l+3),e.segment.vertexLength+=4,e.segment.primitiveLength+=2}}};function jx(t,e){for(let r=0;rGx||(Gx=new Xt({"fill-extrusion-rounded-corner-distance":new V(w["layout_fill-extrusion"]["fill-extrusion-rounded-corner-distance"],"fill-extrusion-rounded-corner-distance")})),Yx,Wx=()=>Yx||(Yx=new Xt({"fill-extrusion-opacity":new V(w["paint_fill-extrusion"]["fill-extrusion-opacity"],"fill-extrusion-opacity"),"fill-extrusion-color":new N(w["paint_fill-extrusion"]["fill-extrusion-color"],"fill-extrusion-color"),"fill-extrusion-translate":new V(w["paint_fill-extrusion"]["fill-extrusion-translate"],"fill-extrusion-translate"),"fill-extrusion-translate-anchor":new V(w["paint_fill-extrusion"]["fill-extrusion-translate-anchor"],"fill-extrusion-translate-anchor"),"fill-extrusion-pattern":new on(w["paint_fill-extrusion"]["fill-extrusion-pattern"],"fill-extrusion-pattern"),"fill-extrusion-height":new N(w["paint_fill-extrusion"]["fill-extrusion-height"],"fill-extrusion-height"),"fill-extrusion-base":new N(w["paint_fill-extrusion"]["fill-extrusion-base"],"fill-extrusion-base"),"fill-extrusion-vertical-gradient":new V(w["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"],"fill-extrusion-vertical-gradient")})),Zx={get paint(){return Wx()},get layout(){return Xx()}};var Hx=class extends de{constructor(t,e){super(t,Zx,e)}createBucket(t){return new vd(t)}queryRadius(){return Ha(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a,pixelPosMatrix:s}){let o=Ka(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-n.bearingInRadians,a),l=this.paint.get("fill-extrusion-height").evaluate(e,r),u=this.paint.get("fill-extrusion-base").evaluate(e,r),h=Qx(o,s,0),c=Jx(i,u,l,s),p=c[0],f=c[1];return Kx(p,f,h)}};function Bi(t,e){return t.x*e.x+t.y*e.y}function ac(t,e){if(t.length===1){let r=0,i=e[r++],n;for(;!n||i.equals(n);)if(n=e[r++],!n)return 1/0;for(;r>1),s=r-e,o,l=t[e],u=t[e+1],h=t[r],c=t[r+1];for(let p=e+3;pn){o=p,n=f;continue}if(f===n){let d=Math.abs(p-a);di&&(o-e>3&&Zo(t,e,o,i),t[o+2]=n,r-o>3&&Zo(t,o,r,i))}function t2(t,e,r,i,n,a){let s=n-r,o=a-i;if(s!==0||o!==0){let l=((t-r)*s+(e-i)*o)/(s*s+o*o);l>1?(r=n,i=a):l>0&&(r+=s*l,i+=o*l)}return s=t-r,o=e-i,s*s+o*o}function Mt(t,e,r,i){let n={type:e,geom:r},a={id:t!=null?t:null,type:n.type,geometry:n.geom,tags:i,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};switch(n.type){case"Point":case"MultiPoint":Pi(a,n.geom);break;case"LineString":Pi(a,n.geom.points);break;case"Polygon":Pi(a,n.geom[0].points);break;case"MultiLineString":for(let s of n.geom)Pi(a,s.points);break;case"MultiPolygon":for(let s of n.geom)Pi(a,s[0].points)}return a}function Wl(t){let e=t;t.points.length>64&&(e.points=new Float64Array(t.points))}function Pi(t,e){for(let r=0;r1024)throw Error("GeometryCollection nesting exceeds supported depth: 1024");if(e.geometry.type==="GeometryCollection"){r2(t,e,e.geometry,r,i,n+1);return}if(!((o=e.geometry.coordinates)!=null&&o.length))return;let a=e2(e,r,i),s=(r.tolerance/((1<0&&(s+=i?(n*h-u*a)/2:Math.sqrt((u-n)**2+(h-a)**2)),n=u,a=h}let o=e.points.length-3;e.points[2]=1,r>0&&Zo(e.points,0,o,r),e.points[o+2]=1,Wl(e),e.size=Math.abs(s),e.start=0,e.end=e.size}function Kl(t,e,r,i){for(let n=0;n1?1:r}function u2(t){return{type:"FeatureCollection",features:t.map(e=>ka(e))}}function ka(t){let e={type:"Feature",geometry:h2(t),properties:t.tags};return t.id!=null&&(e.id=t.id),e}function h2(t){let{type:e,geometry:r}=t;switch(e){case"Point":return{type:e,coordinates:bd(r[0],r[1])};case"MultiPoint":return{type:e,coordinates:Kn(r)};case"LineString":return{type:e,coordinates:Kn(r.points)};case"MultiLineString":case"Polygon":return{type:e,coordinates:r.map(i=>Kn(i.points))};case"MultiPolygon":return{type:e,coordinates:r.map(i=>i.map(n=>Kn(n.points)))}}}function Kn(t){let e=[];for(let r=0;r=r&&s=i)return null;let l=[];for(let u of t){let h=n===0?u.minX:u.minY,c=n===0?u.maxX:u.maxY;if(h>=r&&c=i))switch(u.type){case"Point":case"MultiPoint":c2(u,l,r,i,n);continue;case"LineString":p2(u,l,r,i,n,o);continue;case"MultiLineString":f2(u,l,r,i,n);continue;case"Polygon":d2(u,l,r,i,n);continue;case"MultiPolygon":y2(u,l,r,i,n);continue}}return l.length?l:null}function c2(t,e,r,i,n){let a=[];if(m2(t.geometry,a,r,i,n),!a.length)return;let s=a.length===3?"Point":"MultiPoint";e.push(Mt(t.id,s,a,t.tags))}function p2(t,e,r,i,n,a){let s=[];if(_d(t.geometry,s,r,i,n,!1,a.lineMetrics),s.length){if(a.lineMetrics){for(let o of s)e.push(Mt(t.id,"LineString",o,t.tags));return}if(s.length>1){e.push(Mt(t.id,"MultiLineString",s,t.tags));return}e.push(Mt(t.id,"LineString",s[0],t.tags))}}function f2(t,e,r,i,n){let a=[];if(Jl(t.geometry,a,r,i,n,!1),a.length){if(a.length===1){e.push(Mt(t.id,"LineString",a[0],t.tags));return}e.push(Mt(t.id,"MultiLineString",a,t.tags))}}function d2(t,e,r,i,n){let a=[];Jl(t.geometry,a,r,i,n,!0),a.length&&e.push(Mt(t.id,"Polygon",a,t.tags))}function y2(t,e,r,i,n){let a=[];for(let s of t.geometry){let o=[];Jl(s,o,r,i,n,!0),o.length&&a.push(o)}a.length&&e.push(Mt(t.id,"MultiPolygon",a,t.tags))}function m2(t,e,r,i,n){for(let a=0;a=r&&s<=i&&Kr(e,t[a],t[a+1],t[a+2])}}function _d(t,e,r,i,n,a,s){let o=sc(t),l=n===0?g2:x2,u=t.start,h,c;for(let g=0;gr&&(c=l(o,x,v,D,A,r),s&&(o.start=u+h*c)):_>i?S=r&&(c=l(o,x,v,D,A,r),k=!0),S>i&&_<=i&&(c=l(o,x,v,D,A,i),k=!0),!a&&k&&(s&&(o.end=u+h*c),e.push(o),o=sc(t)),s&&(u+=h)}let p=t.points.length-3,f=t.points[p],d=t.points[p+1],y=t.points[p+2],m=n===0?f:d;m>=r&&m<=i&&Kr(o.points,f,d,y),p=o.points.length-3,a&&p>=3&&(o.points[p]!==o.points[0]||o.points[p+1]!==o.points[1])&&Kr(o.points,o.points[0],o.points[1],o.points[2]),o.points.length&&(Wl(o),e.push(o))}function sc(t){return{points:[],size:t.size,start:t.start,end:t.end}}function Jl(t,e,r,i,n,a){for(let s of t)_d(s,e,r,i,n,a,!1)}function Kr(t,e,r,i){t.push(e,r,i)}function g2(t,e,r,i,n,a){let s=(a-e)/(i-e);return Kr(t.points,a,r+(n-r)*s,1),s}function x2(t,e,r,i,n,a){let s=(a-r)/(n-r);return Kr(t.points,e+(i-e)*s,a,1),s}function Ql(t,e){let r=e.buffer/e.extent,i=t,n=Te(t,1,-1-r,r,0,-1,2,e),a=Te(t,1,1-r,2+r,0,-1,2,e);return!n&&!a||(i=Te(t,1,-r,1+r,0,-1,2,e)||[],n&&(i=oc(n,1).concat(i)),a&&(i=i.concat(oc(a,-1)))),i}function oc(t,e){let r=[];for(let i of t)switch(i.type){case"Point":case"MultiPoint":{let n=v2(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"LineString":{let n=Gs(i.geometry,e);r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiLineString":case"Polygon":{let n=[];for(let a of i.geometry)n.push(Gs(a,e));r.push(Mt(i.id,i.type,n,i.tags));continue}case"MultiPolygon":{let n=[];for(let a of i.geometry){let s=[];for(let o of a)s.push(Gs(o,e));n.push(s)}r.push(Mt(i.id,i.type,n,i.tags));continue}}return r}function v2(t,e){let r=[];for(let i=0;io.id));t=t.filter(o=>!s.has(o.id))}if(i.add.size){let s=Zl({type:"FeatureCollection",features:Array.from(i.add.values())},r);s=Ql(s,r),n=n.concat(s),t=t.concat(s)}}if(i.update.size){let a=new Map,s=[];for(let o of t)i.update.has(o.id)?a.set(o.id,[...a.get(o.id)||[],o]):s.push(o);for(let[o,l]of i.update){let u=a.get(o);if(!u||u.length===0)continue;let h=w2(u,l,r);n=n.concat(u,h),s=s.concat(h)}t=s}return{affected:n,source:t}}function w2(t,e,r){var a,s;let i=!!e.newGeometry,n=e.removeAllProperties||((a=e.removeProperties)==null?void 0:a.length)>0||((s=e.addOrUpdateProperties)==null?void 0:s.length)>0;if(i){let o=t[0],l=Zl({type:"FeatureCollection",features:[{type:"Feature",id:o.id,geometry:e.newGeometry,properties:n?lc(o.tags,e):o.tags}]},r);return l=Ql(l,r),l}if(n){let o=[];for(let l of t){let u=je({},l);u.tags=lc(u.tags,e),o.push(u)}return o}return t}function lc(t,e){if(e.removeAllProperties)return{};let r=je({},t||{});if(e.removeProperties)for(let i of e.removeProperties)delete r[i];if(e.addOrUpdateProperties)for(let{key:i,value:n}of e.addOrUpdateProperties)r[i]=n;return r}function D2(t,e){var r,i;return t?{removeAll:t.removeAll,remove:new Set(t.remove||[]),add:new Map((r=t.add)==null?void 0:r.map(n=>[e.promoteId?n.properties[e.promoteId]:n.id,n])),update:new Map((i=t.update)==null?void 0:i.map(n=>[n.id,n]))}:{remove:new Set,add:new Map,update:new Map}}var uc=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],dt=new Uint32Array(96),_2=class Ad{static from(e){if(!e||e.byteLength===void 0||e.buffer)throw Error("Data must be an instance of ArrayBuffer or SharedArrayBuffer.");let[r,i]=new Uint8Array(e,0,2);if(r!==219)throw Error("Data does not appear to be in a KDBush format.");let n=i>>4;if(n!==1)throw Error(`Got v${n} data when expected v1.`);let a=uc[i&15];if(!a)throw Error("Unrecognized array type.");let[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new Ad(o,s,a,void 0,e)}constructor(e,r=64,i=Float64Array,n=ArrayBuffer,a){if(isNaN(e)||e<0)throw Error(`Unexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=i,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;let s=uc.indexOf(this.ArrayType),o=e*2*this.ArrayType.BYTES_PER_ELEMENT,l=e*this.IndexArrayType.BYTES_PER_ELEMENT,u=(8-l%8)%8;if(s<0)throw Error(`Unexpected typed array class: ${i}.`);if(a)this.data=a,this.ids=new this.IndexArrayType(a,8,e),this.coords=new i(a,8+l+u,e*2),this._pos=e*2,this._finished=!0;else{let h=this.data=new n(8+o+l+u);this.ids=new this.IndexArrayType(h,8,e),this.coords=new i(h,8+l+u,e*2),this._pos=0,this._finished=!1,new Uint8Array(h,0,2).set([219,16+s]),new Uint16Array(h,2,1)[0]=r,new Uint32Array(h,4,1)[0]=e}}add(e,r){let i=this._pos>>1;return this.ids[i]=i,this.coords[this._pos++]=e,this.coords[this._pos++]=r,i}finish(){let e=this._pos>>1;if(e!==this.numItems)throw Error(`Added ${e} items when expected ${this.numItems}.`);return Ho(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=[];for(;l>0;){let h=dt[--l],c=dt[--l],p=dt[--l];if(c-p<=o){for(let m=p;m<=c;m++){let g=s[2*m],x=s[2*m+1];g>=e&&g<=i&&x>=r&&x<=n&&u.push(a[m])}continue}let f=p+c>>1,d=s[2*f],y=s[2*f+1];d>=e&&d<=i&&y>=r&&y<=n&&u.push(a[f]),(h===0?e<=d:r<=y)&&(dt[l++]=p,dt[l++]=f-1,dt[l++]=1-h),(h===0?i>=d:n>=y)&&(dt[l++]=f+1,dt[l++]=c,dt[l++]=1-h)}return u}within(e,r,i){let n=[];return this.withinInto(e,r,i,n),n}withinInto(e,r,i,n){if(!this._finished)throw Error("Data not yet indexed - call index.finish().");let{ids:a,coords:s,nodeSize:o}=this;dt[0]=0,dt[1]=a.length-1,dt[2]=0;let l=3,u=0,h=i*i;for(;l>0;){let c=dt[--l],p=dt[--l],f=dt[--l];if(p-f<=o){for(let g=f;g<=p;g++)hc(s[2*g],s[2*g+1],e,r)<=h&&(n[u++]=a[g]);continue}let d=f+p>>1,y=s[2*d],m=s[2*d+1];hc(y,m,e,r)<=h&&(n[u++]=a[d]),(c===0?e-i<=y:r-i<=m)&&(dt[l++]=f,dt[l++]=d-1,dt[l++]=1-c),(c===0?e+i>=y:r+i>=m)&&(dt[l++]=d+1,dt[l++]=p,dt[l++]=1-c)}return u}};function Ho(t,e,r,i,n,a){if(n-i<=r)return;let s=i+n>>1;Sd(t,e,s,i,n,a),Ho(t,e,r,i,s-1,1-a),Ho(t,e,r,s+1,n,1-a)}function Sd(t,e,r,i,n,a){for(;n>i;){if(n-i>600){let u=n-i+1,h=r-i+1,c=Math.log(u),p=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*p*(u-p)/u)*(h-u/2<0?-1:1);Sd(t,e,r,Math.max(i,Math.floor(r-h*p/u+f)),Math.min(n,Math.floor(r+(u-h)*p/u+f)),a)}let s=e[2*r+a],o=i,l=n;for(zi(t,e,i,r),e[2*n+a]>s&&zi(t,e,i,n);os;)l--}e[2*i+a]===s?zi(t,e,i,l):(l++,zi(t,e,l,n)),l<=r&&(i=l+1),r<=l&&(n=l-1)}}function zi(t,e,r,i){Xs(t,r,i),Xs(e,2*r,2*i),Xs(e,2*r+1,2*i+1)}function Xs(t,e,r){let i=t[e];t[e]=t[r],t[r]=i}function hc(t,e,r,i){let n=t-r,a=e-i;return n*n+a*a}var Ko={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:t=>t},A2=class{constructor(t){this.options=Object.assign(Object.create(Ko),t),this.trees=Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[],this.points=[]}load(t){let e=[];for(let r of t){if(!r.geometry)continue;let[i,n]=r.geometry.coordinates,[a,s]=[Zr(i),Hr(n)],o={id:r.id,type:"Point",geometry:[a,s],tags:r.properties};e.push(o)}this.createIndex(e)}initialize(t){let e=[];for(let r of t)r.type==="Point"&&e.push(r);this.createIndex(e)}updateIndex(t,e,r){this.options=Object.assign(Object.create(Ko),r.clusterOptions),this.initialize(t)}createIndex(t){let{log:e,minZoom:r,maxZoom:i}=this.options;e&&console.time("total time");let n=`prepare ${t.length} points`;e&&console.time(n),this.points=t;let a=[];for(let o=0;o=r;o--){let l=Date.now();s=this.trees[o]=this.createTree(this.cluster(s,o)),e&&console.log("z%d: %d clusters in %dms",o,s.numItems,Date.now()-l)}e&&console.timeEnd("total time")}getClusters(t,e){return this.getClustersInternal(t,e).map(r=>ka(r))}getClustersInternal(t,e){let r=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),n=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)r=-180,n=180;else if(r>n){let h=this.getClustersInternal([r,i,180,a],e),c=this.getClustersInternal([-180,i,n,a],e);return h.concat(c)}let s=this.trees[this.limitZoom(e)],o=s.range(Zr(r),Hr(a),Zr(n),Hr(i)),l=s.flatData,u=[];for(let h of o){let c=this.stride*h;u.push(l[c+5]>1?S2(l,c,this.clusterProps):this.points[l[c+3]])}return u}getChildren(t){let e=this.getOriginId(t),r=this.getOriginZoom(t),i=Error("No cluster with the specified id: "+t),n=this.trees[r];if(!n)throw i;let a=n.flatData;if(e*this.stride>=a.length)throw i;let s=this.options.radius/(this.options.extent*2**(r-1)),o=a[e*this.stride],l=a[e*this.stride+1],u=n.within(o,l,s),h=[];for(let c of u){let p=c*this.stride;a[p+4]===t&&h.push(a[p+5]>1?E2(a,p,this.clusterProps):ka(this.points[a[p+3]]))}if(h.length===0)throw i;return h}getLeaves(t,e,r){e||(e=10),r||(r=0);let i=[];return this.appendLeaves(i,t,e,r,0),i}getTile(t,e,r){let i=this.trees[this.limitZoom(t)];if(!i)return null;let n=2**t,{extent:a,radius:s}=this.options,o=s/a,l=(r-o)/n,u=(r+1+o)/n,h={transformed:!0,features:[],source:null,x:e,y:r,z:t};return this.addTileFeatures(i.range((e-o)/n,l,(e+1+o)/n,u),i.flatData,e,r,n,h),e===0&&this.addTileFeatures(i.range(1-o/n,l,1,u),i.flatData,n,r,n,h),e===n-1&&this.addTileFeatures(i.range(0,l,o/n,u),i.flatData,-1,r,n,h),h}getClusterExpansionZoom(t){return this.getOriginZoom(t)}appendLeaves(t,e,r,i,n){let a=this.getChildren(e);for(let s of a){let o=s.properties;if(o!=null&&o.cluster?n+o.point_count<=i?n+=o.point_count:n=this.appendLeaves(t,o.cluster_id,r,i,n):n1,u,h,c;if(l)u=tu(e,o,this.clusterProps),h=e[o],c=e[o+1];else{let d=this.points[e[o+3]];u=d.tags,[h,c]=d.geometry}let p={type:1,geometry:[[Math.round(this.options.extent*(h*n-r)),Math.round(this.options.extent*(c*n-i))]],tags:u},f;f=l||this.options.generateId?e[o+3]:this.points[e[o+3]].id,f!==void 0&&(p.id=f),a.features.push(p)}}limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}cluster(t,e){let{radius:r,extent:i,reduce:n,minPoints:a}=this.options,s=r/(i*2**e),o=t.flatData,l=[],u=this.stride;for(let h=0;he&&(y+=o[g+5])}if(y>d&&y>=a){let m=c*d,g=p*d,x,v=-1,b=((h/u|0)<<5)+(e+1)+this.points.length;for(let D of f){let A=D*u;if(o[A+2]<=e)continue;o[A+2]=e;let _=o[A+5];m+=o[A]*_,g+=o[A+1]*_,o[A+4]=b,n&&(x||(x=this.map(o,h,!0),v=this.clusterProps.length,this.clusterProps.push(x)),n(x,this.map(o,A)))}o[h+4]=b,l.push(m/y,g/y,1/0,b,-1,y),n&&l.push(v)}else{for(let m=0;m1)for(let m of f){let g=m*u;if(!(o[g+2]<=e)){o[g+2]=e;for(let x=0;x>5}getOriginZoom(t){return(t-this.points.length)%32}map(t,e,r){if(t[e+5]>1){let a=this.clusterProps[t[e+6]];return r?Object.assign({},a):a}let i=this.points[t[e+3]].tags,n=this.options.map(i);return r&&n===i?Object.assign({},n):n}};function S2(t,e,r){return{id:t[e+3],type:"Point",tags:tu(t,e,r),geometry:[t[e],t[e+1]]}}function E2(t,e,r){return{type:"Feature",id:t[e+3],properties:tu(t,e,r),geometry:{type:"Point",coordinates:[wd(t[e]),Dd(t[e+1])]}}}function tu(t,e,r){let i=t[e+5],n=i>=1e4?`${Math.round(i/1e3)}k`:i>=1e3?`${Math.round(i/100)/10}k`:i,a=t[e+6],s=a===-1?{}:Object.assign({},r[a]);return Object.assign(s,{cluster:!0,cluster_id:t[e+3],point_count:i,point_count_abbreviated:n})}var Ed="geojsonvt_clip_start",Fd="geojsonvt_clip_end";function cc(t,e,r,i,n){let a=e===n.maxZoom?0:n.tolerance/((1<0&&e.size<(n?s:i)){r.numPoints+=e.points.length/3;return}let o=[];for(let l=0;ls)&&(r.numSimplified++,o.push(e.points[l],e.points[l+1])),r.numPoints++;n&&M2(o,a),t.push(o)}function M2(t,e){let r=0;for(let i=0,n=t.length,a=n-2;i0===e)for(let i=0,n=t.length;i1&&(console.log("invalidating tiles"),console.time("invalidating")),this.invalidateTiles(e),r.debug>1&&console.timeEnd("invalidating");let[i,n,a]=[0,0,0],s=cc(t,i,n,a,r);s.source=t;let o=Jn(i,n,a);if(this.tiles[o]=s,this.tileCoords.push({z:i,x:n,y:a,id:o}),r.debug){let l=`z${i}`;this.stats[l]=(this.stats[l]||0)+1,this.total++}}getClusterExpansionZoom(t){return null}getChildren(t){return null}getLeaves(t,e,r){return null}getTile(t,e,r){let{extent:i,debug:n}=this.options,a=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);let o=t,l=e,u=r,h;for(;!h&&o>0;)o--,l>>=1,u>>=1,h=this.tiles[Jn(o,l,u)];return!(h!=null&&h.source)||(n>1&&(console.log("found parent tile z%d-%d-%d",o,l,u),console.time("drilling down")),this.splitTile(h.source,o,l,u,t,e,r),n>1&&console.timeEnd("drilling down"),!this.tiles[s])?null:pc(this.tiles[s],i)}splitTile(t,e,r,i,n,a,s){let o=[t,e,r,i],l=this.options,u=l.debug;for(;o.length;){i=o.pop(),r=o.pop(),e=o.pop(),t=o.pop();let h=1<1&&console.time("creation"),p=this.tiles[c]=cc(t,e,r,i,l),this.tileCoords.push({z:e,x:r,y:i,id:c}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,i,p.numFeatures,p.numPoints,p.numSimplified),console.timeEnd("creation"));let _=`z${e}`;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(p.source=t,n==null){if(e===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(e===l.maxZoom||e===n)continue;if(n!=null){let _=n-e;if(r!==a>>_||i!==s>>_)continue}}if(p.source=null,!t.length)continue;u>1&&console.time("clipping");let f=.5*l.buffer/l.extent,d=.5-f,y=.5+f,m=1+f,g=null,x=null,v=null,b=null,D=Te(t,h,r-f,r+y,0,p.minX,p.maxX,l),A=Te(t,h,r+d,r+m,0,p.minX,p.maxX,l);D&&(g=Te(D,h,i-f,i+y,1,p.minY,p.maxY,l),x=Te(D,h,i+d,i+m,1,p.minY,p.maxY,l)),A&&(v=Te(A,h,i-f,i+y,1,p.minY,p.maxY,l),b=Te(A,h,i+d,i+m,1,p.minY,p.maxY,l)),u>1&&console.timeEnd("clipping"),o.push(g||[],e+1,r*2,i*2),o.push(x||[],e+1,r*2,i*2+1),o.push(v||[],e+1,r*2+1,i*2),o.push(b||[],e+1,r*2+1,i*2+1)}}invalidateTiles(t){if(!t.length)return;let e=this.options,{debug:r}=e,i=1/0,n=-1/0,a=1/0,s=-1/0;for(let u of t)i=Math.min(i,u.minX),n=Math.max(n,u.maxX),a=Math.min(a,u.minY),s=Math.max(s,u.maxY);let o=e.buffer/e.extent,l=new Set;for(let u in this.tiles){let h=this.tiles[u],c=1<=f||s=y)continue;let m=!1;for(let g of t)if(g.maxX>=p&&g.minX=d&&g.minY1&&console.log("invalidate tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",h.z,h.x,h.y,h.numFeatures,h.numPoints,h.numSimplified);let g=`z${h.z}`;this.stats[g]=(this.stats[g]||0)-1,this.total--}delete this.tiles[u],l.add(u)}}l.size&&(this.tileCoords=this.tileCoords.filter(u=>!l.has(u.id)))}};function Jn(t,e,r){return((1<24)throw Error("maxZoom should be in the 0-24 range");if(e.promoteId&&e.generateId)throw Error("promoteId and generateId cannot be used together.");let i=Zl(t,e);r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles")),i=Ql(i,e),e.updateable&&(this.source=i),this.initializeIndex(i,e)}initializeIndex(t,e){this.tileIndex=e.cluster?new A2(e.clusterOptions):new z2(e),t.length&&this.tileIndex.initialize(t)}getTile(t,e,r){return t=+t,e=+e,r=+r,t<0||t>24?null:this.tileIndex.getTile(t,e,r)}updateData(t,e){let r=this.options;if(!r.updateable)throw Error("to update tile geojson `updateable` option must be set to true");let{affected:i,source:n}=b2(this.source,t,r);e&&({affected:i,source:n}=this.filterUpdate(n,i,e)),i.length&&(this.source=n,this.tileIndex.updateIndex(n,i,r))}filterUpdate(t,e,r){let i=new Set;for(let n of t)n.id!=null&&(r(ka(n))||(e.push(n),i.add(n.id)));return t=t.filter(n=>!i.has(n.id)),{affected:e,source:t}}getData(){if(!this.options.updateable)throw Error("to retrieve data the `updateable` option must be set to true");return u2(this.source)}updateClusterOptions(t,e){let r=this.options.cluster;if(this.options.cluster=t,this.options.clusterOptions=e,r==t){this.tileIndex.updateIndex(this.source,[],this.options);return}this.initializeIndex(this.source,this.options)}getClusterExpansionZoom(t){return this.tileIndex.getClusterExpansionZoom(t)}getClusterChildren(t){return this.tileIndex.getChildren(t)}getClusterLeaves(t,e,r){return this.tileIndex.getLeaves(t,e,r)}},Jo=At([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),V2=Jo.members;Jo.size,Jo.alignment;var Qo=At([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),O2=Qo.members;Qo.size,Qo.alignment;var R2=Math.cos(75/2*(Math.PI/180)),Id=1/2,fc=2**14/Id,Cd=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasDependencies=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={};for(let e of this.layers)this.gradients[e.id]={};this.layoutVertexArray=new Qm,this.layoutVertexArray2=new tg,this.indexArray=new wn,this.programConfigurations=new vr(t.layers,t.zoom),this.segments=new ee,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasDependencies=Aa("line",this.layers,e)||this.hasLineDasharray(this.layers);let i=this.layers[0].layout.get("line-sort-key"),n=!i.isConstant(),a=[],s=new st(this.zoom),o=this.layers[0]._featureFilter.needGeometry;for(let{feature:l,id:u,index:h,sourceLayerIndex:c}of t){let p=hi(l,o);if(!this.layers[0]._featureFilter.filter(s,p,r))continue;let f=n?i.evaluate(p,{},r):void 0,d={id:u,properties:l.properties,type:l.type,sourceLayerIndex:c,index:h,geometry:o?p.geometry:Ar(l),patterns:{},dashes:{},sortKey:f};a.push(d)}n&&a.sort((l,u)=>l.sortKey-u.sortKey);for(let l of a){let{geometry:u,index:h,sourceLayerIndex:c}=l;this.hasDependencies?(Aa("line",this.layers,e)?Gl("line",this.layers,l,{zoom:this.zoom},e):this.hasLineDasharray(this.layers)&&this.addLineDashDependencies(this.layers,l,this.zoom,e),this.patternFeatures.push(l)):this.addFeature(l,u,h,r,{},{},e.subdivisionGranularity);let p=t[h].feature;e.featureIndex.insert(p,u,h,c,this.index)}}update(t,e,r,i){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,{imagePositions:r,dashPositions:i})}addFeatures({options:t,canonical:e,patternPositions:r,dashPositions:i}){for(let n of this.patternFeatures)this.addFeature(n,n.geometry,n.index,e,r,i,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,O2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,V2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.hasOwn(t.properties,"geojsonvt_clip_start")&&Object.hasOwn(t.properties,"geojsonvt_clip_end"))return{start:+t.properties[Ed],end:+t.properties[Fd]}}addFeature(t,e,r,i,n,a,s){let o=this.layers[0].layout,l=o.get("line-join").evaluate(t,{}),u=o.get("line-cap").evaluate(t,{}),h=o.get("line-miter-limit").evaluate(t,{}),c=o.get("line-round-limit").evaluate(t,{});this.lineClips=this.lineFeatureClips(t);for(let p of e)this.addLine(p,t,l,u,h,c,i,s);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{imagePositions:n,dashPositions:a,canonical:i})}addLine(t,e,r,i,n,a,s,o){this.distance=0,this.scaledDistance=0,this.totalDistance=0;let l=s?o.line.getGranularityForZoomLevel(s.z):1;if(t=cr(t,l),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v=2&&t[h-1].equals(t[h-2]);)h--;let c=0;for(;c0;if(k&&v>c){let L=d.dist(y);if(L>2*p){let F=d.sub(d.sub(y)._mult(p/L)._round());this.updateDistance(y,F),this.addCurrentVertex(F,g,0,0,f),y=F}}let O=y&&m,P=O?r:u?"butt":i;if(O&&P==="round"&&(_n&&(P="bevel"),P==="bevel"&&(_>2&&(P="flipbevel"),_100)b=x.mult(-1);else{let L=_*g.add(x).mag()/g.sub(x).mag();b._perp()._mult(L*(z?-1:1))}this.addCurrentVertex(d,b,0,0,f),this.addCurrentVertex(d,b.mult(-1),0,0,f)}else if(P==="bevel"||P==="fakeround"){let L=-Math.sqrt(_*_-1),F=z?L:0,$=z?0:L;if(y&&this.addCurrentVertex(d,g,F,$,f),P==="fakeround"){let U=Math.round(S*180/Math.PI/20);for(let T=1;T2*p){let F=d.add(m.sub(d)._mult(p/L)._round());this.updateDistance(d,F),this.addCurrentVertex(F,x,0,0,f),d=F}}}}addCurrentVertex(t,e,r,i,n,a=!1){let s=e.x+e.y*r,o=e.y-e.x*r,l=-e.x+e.y*i,u=-e.y-e.x*i;this.addHalfVertex(t,s,o,a,!1,r,n),this.addHalfVertex(t,l,u,a,!0,-i,n),this.distance>fc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,n,a))}addHalfVertex({x:t,y:e},r,i,n,a,s,o){let l=(this.lineClips?this.scaledDistance*(fc-1):this.scaledDistance)*Id;if(this.layoutVertexArray.emplaceBack((t<<1)+ +!!n,(e<<1)+ +!!a,Math.round(63*r)+128,Math.round(63*i)+128,(s===0?0:s<0?-1:1)+1|(l&63)<<2,l>>6),this.lineClips){let h=(this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start);this.layoutVertexArray2.emplaceBack(h,this.lineClipsArray.length)}let u=o.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,u,this.e2),o.primitiveLength++),a?this.e2=u:this.e1=u}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}hasLineDasharray(t){for(let e of t){let r=e.paint.get("line-dasharray");if(r&&!r.isConstant())return!0}return!1}addLineDashDependencies(t,e,r,i){for(let n of t){let a=n.paint.get("line-dasharray");if(!a||a.value.kind==="constant")continue;let s=n.layout.get("line-cap").evaluate(e,{})==="round",o={dasharray:a.value.evaluate({zoom:r-1},e,{}),round:s},l={dasharray:a.value.evaluate({zoom:r},e,{}),round:s},u={dasharray:a.value.evaluate({zoom:r+1},e,{}),round:s},h=`${o.dasharray.join(",")},${o.round}`,c=`${l.dasharray.join(",")},${l.round}`,p=`${u.dasharray.join(",")},${u.round}`;i.dashDependencies[h]=o,i.dashDependencies[c]=l,i.dashDependencies[p]=u,e.dashes[n.id]={min:h,mid:c,max:p}}}};C("LineBucket",Cd,{omit:["layers","patternFeatures"]});var $2,N2=()=>$2||($2=new Xt({"line-cap":new N(w.layout_line["line-cap"],"line-cap"),"line-join":new N(w.layout_line["line-join"],"line-join"),"line-miter-limit":new N(w.layout_line["line-miter-limit"],"line-miter-limit"),"line-round-limit":new N(w.layout_line["line-round-limit"],"line-round-limit"),"line-sort-key":new N(w.layout_line["line-sort-key"],"line-sort-key")})),U2,q2=()=>U2||(U2=new Xt({"line-opacity":new N(w.paint_line["line-opacity"],"line-opacity"),"line-layer-opacity":new V(w.paint_line["line-layer-opacity"],"line-layer-opacity"),"line-color":new N(w.paint_line["line-color"],"line-color"),"line-translate":new V(w.paint_line["line-translate"],"line-translate"),"line-translate-anchor":new V(w.paint_line["line-translate-anchor"],"line-translate-anchor"),"line-width":new N(w.paint_line["line-width"],"line-width"),"line-gap-width":new N(w.paint_line["line-gap-width"],"line-gap-width"),"line-offset":new N(w.paint_line["line-offset"],"line-offset"),"line-blur":new N(w.paint_line["line-blur"],"line-blur"),"line-dasharray":new on(w.paint_line["line-dasharray"],"line-dasharray"),"line-pattern":new on(w.paint_line["line-pattern"],"line-pattern"),"line-gradient":new Wa(w.paint_line["line-gradient"],"line-gradient")})),dc={get paint(){return q2()},get layout(){return N2()}},j2=class extends N{possiblyEvaluate(t,e){return e=new st(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,r,i){return e=Gt({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,r,i)}},Qn;var G2=class extends de{constructor(t,e){super(t,dc,e),this.gradientVersion=0,Qn||(Qn=new j2(dc.paint.properties["line-width"].specification,"line-floorwidth"),Qn.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){let e=this.gradientExpression();this.stepInterpolant=lm(e)?e._styleExpression.expression instanceof vl:!1,this.gradientVersion=(this.gradientVersion+1)%(2**53-1)}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=Qn.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Cd(t)}queryRadius(t){let e=t,r=yc(Wr("line-width",this,e),Wr("line-gap-width",this,e)),i=Wr("line-offset",this,e);return r/2+Math.abs(i)+Ha(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:e,featureState:r,geometry:i,transform:n,pixelsToTileUnits:a}){let s=Ka(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-n.bearingInRadians,a),o=a/2*yc(this.paint.get("line-width").evaluate(e,r),this.paint.get("line-gap-width").evaluate(e,r)),l=this.paint.get("line-offset").evaluate(e,r);return l&&(i=Dg(i,l*a)),mg(s,i,o)}isTileClipped(){return!0}};function yc(t,e){return e>0?e+2*t:t}var X2=At([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"},{name:"a_height_offset",components:1,type:"Float32"}],4),Y2=At([{name:"a_projected_pos",components:3,type:"Float32"}],4);At([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);var W2=At([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);At([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);var mc=At([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x5=At([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);At([{name:"triangle",components:3,type:"Uint16"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"},{type:"Float32",name:"heightOffset"}]),At([{type:"Float32",name:"offsetX"}]),At([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),At([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);var wr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(t){this.pluginStatus=t.pluginStatus,this.pluginURL=t.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(t){if(wr.isParsed())throw Error("RTL text plugin already registered.");this.applyArabicShaping=t.applyArabicShaping,this.processBidirectionalText=t.processBidirectionalText,this.processStyledBidirectionalText=t.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(t,e){return rt(this,null,function*(){if(this.isParsed())return this.getState();if(t.pluginStatus!=="loading")return this.setState(t),t;let r=t.pluginURL,i=new Promise(a=>{this.loadScriptResolve=a}),n=new Promise(a=>setTimeout(()=>a(),this.TIMEOUT));if(yield e(r),yield Promise.race([i,n]),this.isParsed()){let a={pluginStatus:"loaded",pluginURL:r};return this.setState(a),a}throw this.setState({pluginStatus:"error",pluginURL:""}),Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};function Z2(t){return/[\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u077F\\u07C0-\\u07FA\\u07FD-\\u07FF\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\u1800\\u1801\\u1804\\u1806-\\u1819\\u1820-\\u1878\\u1880-\\u18AA\\uA840-\\uA877\\uFB50-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF80-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDD00-\\uDD27\\uDD30-\\uDD39\\uDE60-\\uDE7E\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDEFF\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB]|\\uD805[\\uDE60-\\uDE6C]|\\uD82F[\\uDC00-\\uDC6A\\uDC70-\\uDC7C\\uDC80-\\uDC88\\uDC90-\\uDC99\\uDC9C-\\uDC9F]|\\uD83A[\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function H2(t){return/[\\u0591-\\u05C7\\u05D0-\\u05EA\\u05EF-\\u05F4\\u0600-\\u0604\\u0606-\\u060B\\u060D-\\u061A\\u061C-\\u061E\\u0620-\\u063F\\u0641-\\u064A\\u0656-\\u066F\\u0671-\\u06DC\\u06DE-\\u070D\\u070F-\\u074A\\u074D-\\u07B1\\u07C0-\\u07FA\\u07FD-\\u082D\\u0830-\\u083E\\u0840-\\u085B\\u085E\\u0860-\\u086A\\u0870-\\u0891\\u0897-\\u08E1\\u08E3-\\u08FF\\uFB1D-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFD3D\\uFD40-\\uFDCF\\uFDF0-\\uFDFF\\uFE70-\\uFE74\\uFE76-\\uFEFC]|\\uD802[\\uDC00-\\uDC05\\uDC08\\uDC0A-\\uDC35\\uDC37\\uDC38\\uDC3C\\uDC3F-\\uDC55\\uDC57-\\uDC9E\\uDCA7-\\uDCAF\\uDCE0-\\uDCF2\\uDCF4\\uDCF5\\uDCFB-\\uDD1B\\uDD1F-\\uDD39\\uDD3F-\\uDD59\\uDD80-\\uDDB7\\uDDBC-\\uDDCF\\uDDD2-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE13\\uDE15-\\uDE17\\uDE19-\\uDE35\\uDE38-\\uDE3A\\uDE3F-\\uDE48\\uDE50-\\uDE58\\uDE60-\\uDE9F\\uDEC0-\\uDEE6\\uDEEB-\\uDEF6\\uDF00-\\uDF35\\uDF39-\\uDF55\\uDF58-\\uDF72\\uDF78-\\uDF91\\uDF99-\\uDF9C\\uDFA9-\\uDFAF]|\\uD803[\\uDC00-\\uDC48\\uDC80-\\uDCB2\\uDCC0-\\uDCF2\\uDCFA-\\uDD27\\uDD30-\\uDD39\\uDD40-\\uDD65\\uDD69-\\uDD85\\uDD8E\\uDD8F\\uDE60-\\uDE7E\\uDE80-\\uDEA9\\uDEAB-\\uDEAD\\uDEB0\\uDEB1\\uDEC2-\\uDEC7\\uDED0-\\uDED8\\uDEFA-\\uDF27\\uDF30-\\uDF59\\uDF70-\\uDF89\\uDFB0-\\uDFCB\\uDFE0-\\uDFF6]|\\uD83A[\\uDC00-\\uDCC4\\uDCC7-\\uDCD6\\uDD00-\\uDD4B\\uDD50-\\uDD59\\uDD5E\\uDD5F]|\\uD83B[\\uDE00-\\uDE03\\uDE05-\\uDE1F\\uDE21\\uDE22\\uDE24\\uDE27\\uDE29-\\uDE32\\uDE34-\\uDE37\\uDE39\\uDE3B\\uDE42\\uDE47\\uDE49\\uDE4B\\uDE4D-\\uDE4F\\uDE51\\uDE52\\uDE54\\uDE57\\uDE59\\uDE5B\\uDE5D\\uDE5F\\uDE61\\uDE62\\uDE64\\uDE67-\\uDE6A\\uDE6C-\\uDE72\\uDE74-\\uDE77\\uDE79-\\uDE7C\\uDE7E\\uDE80-\\uDE89\\uDE8B-\\uDE9B\\uDEA1-\\uDEA3\\uDEA5-\\uDEA9\\uDEAB-\\uDEBB\\uDEF0\\uDEF1]/gim.test(String.fromCodePoint(t))}function K2(t){return/[\\u02EA\\u02EB\\u2E80-\\u2FDF\\u2FF0-\\u303F\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FD-\\u30FF\\u3105-\\u312F\\u31A0-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFE10-\\uFE1F\\uFE30-\\uFE4F\\uFF00-\\uFFEF]|\\uD81B[\\uDFE0-\\uDFFF]|[\\uD81C-\\uD822\\uD840-\\uD868\\uD86A-\\uD86D\\uD86F-\\uD872\\uD874-\\uD879\\uD880-\\uD883\\uD885-\\uD88C][\\uDC00-\\uDFFF]|\\uD823[\\uDC00-\\uDCD5\\uDCFF-\\uDD1E\\uDD80-\\uDDF2]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFB]|\\uD83C[\\uDE00-\\uDEFF]|\\uD869[\\uDC00-\\uDEDF\\uDF00-\\uDFFF]|\\uD86E[\\uDC00-\\uDC1D\\uDC20-\\uDFFF]|\\uD873[\\uDC00-\\uDEAD\\uDEB0-\\uDFFF]|\\uD87A[\\uDC00-\\uDFE0\\uDFF0-\\uDFFF]|\\uD87B[\\uDC00-\\uDE5D]|\\uD87E[\\uDC00-\\uDE1D]|\\uD884[\\uDC00-\\uDF4A\\uDF50-\\uDFFF]|\\uD88D[\\uDC00-\\uDC79]/gim.test(String.fromCodePoint(t))}function Qa(t){return/[\\u02EA\\u02EB\\u1100-\\u11FF\\u1401-\\u167F\\u18B0-\\u18FF\\u2065\\u20DD-\\u20E0\\u20E2-\\u20E4\\u2B97\\u2BF0-\\u2BFF\\u2E50\\u2E51\\u2E80-\\u3007\\u3012\\u3013\\u3020-\\u302F\\u3031-\\u30FB\\u30FD-\\uA4CF\\uA960-\\uA97F\\uAC00-\\uD7FF\\uF900-\\uFAFF\\uFE10-\\uFE1F\\uFE30-\\uFE48\\uFE50-\\uFE57\\uFE5F-\\uFE62\\uFE67-\\uFE6F\\uFF00-\\uFF07\\uFF0A-\\uFF0C\\uFF0E-\\uFF19\\uFF1F-\\uFF3A\\uFF3C\\uFF3E\\uFF40-\\uFF5A\\uFFE0-\\uFFE2\\uFFE4-\\uFFE7\\uFFF0-\\uFFF8]|\\uD802[\\uDD80-\\uDD9F]|\\uD805[\\uDD80-\\uDDFF]|\\uD806[\\uDE00-\\uDEBF]|[\\uD80C-\\uD810\\uD81C-\\uD822\\uD83C\\uD83D\\uD840-\\uD87E\\uD880-\\uD8BE][\\uDC00-\\uDFFF]|\\uD811[\\uDC00-\\uDE7F]|\\uD81B[\\uDFE0-\\uDFFF]|\\uD823[\\uDC00-\\uDDFF]|\\uD82B[\\uDFF0-\\uDFFF]|\\uD82C[\\uDC00-\\uDEFF]|\\uD833[\\uDEC0-\\uDFCF]|\\uD834[\\uDC00-\\uDDFF\\uDEE0-\\uDF7F]|\\uD836[\\uDC00-\\uDEAF]|\\uD83E[\\uDD00-\\uDEFF]|[\\uD87F\\uD8BF][\\uDC00-\\uDFFD]/gim.test(String.fromCodePoint(t))}function J2(t){return/[\\xA7\\xA9\\xAE\\xB1\\xBC-\\xBE\\xD7\\xF7\\u2016\\u2020\\u2021\\u2030\\u2031\\u203B\\u203C\\u2042\\u2047-\\u2049\\u2051\\u2100-\\u218F\\u221E\\u2234\\u2235\\u2300-\\u2307\\u230C-\\u231F\\u2324-\\u2328\\u232B\\u237D-\\u239A\\u23BE-\\u23CD\\u23CF\\u23D1-\\u23DB\\u23E2-\\u2422\\u2424-\\u24FF\\u25A0-\\u2619\\u2620-\\u2767\\u2776-\\u2793\\u2B12-\\u2B2F\\u2B50-\\u2B59\\u2BB8-\\u2BEB\\u3000-\\u303F\\u30A0-\\u30FF\\uE000-\\uF8FF\\uFE30-\\uFE6F\\uFF00-\\uFFEF\\uFFFC\\uFFFD]|[\\uDB80-\\uDBFF][\\uDC00-\\uDFFF]/gim.test(String.fromCodePoint(t))}function Q2(t){return/[\\r\\u0300-\\u036F\\u0483-\\u0489\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0600-\\u0605\\u0610-\\u061A\\u064B-\\u065F\\u0670\\u06D6-\\u06DD\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u070F\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u07FD\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0859-\\u085B\\u0890\\u0891\\u0897-\\u089F\\u08CA-\\u0903\\u093A-\\u093C\\u093E-\\u094F\\u0951-\\u0957\\u0962\\u0963\\u0981-\\u0983\\u09BC\\u09BE-\\u09C4\\u09C7\\u09C8\\u09CB-\\u09CD\\u09D7\\u09E2\\u09E3\\u09FE\\u0A01-\\u0A03\\u0A3C\\u0A3E-\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81-\\u0A83\\u0ABC\\u0ABE-\\u0AC5\\u0AC7-\\u0AC9\\u0ACB-\\u0ACD\\u0AE2\\u0AE3\\u0AFA-\\u0AFF\\u0B01-\\u0B03\\u0B3C\\u0B3E-\\u0B44\\u0B47\\u0B48\\u0B4B-\\u0B4D\\u0B55-\\u0B57\\u0B62\\u0B63\\u0B82\\u0BBE-\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCD\\u0BD7\\u0C00-\\u0C04\\u0C3C\\u0C3E-\\u0C44\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0C81-\\u0C83\\u0CBC\\u0CBE-\\u0CC4\\u0CC6-\\u0CC8\\u0CCA-\\u0CCD\\u0CD5\\u0CD6\\u0CE2\\u0CE3\\u0CF3\\u0D00-\\u0D03\\u0D3B\\u0D3C\\u0D3E-\\u0D44\\u0D46-\\u0D48\\u0D4A-\\u0D4E\\u0D57\\u0D62\\u0D63\\u0D81-\\u0D83\\u0DCA\\u0DCF-\\u0DD4\\u0DD6\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB3-\\u0EBC\\u0EC8-\\u0ECE\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F3E\\u0F3F\\u0F71-\\u0F84\\u0F86\\u0F87\\u0F8D-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1037\\u1039-\\u103E\\u1056-\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1084-\\u1086\\u108D\\u109D\\u1100-\\u11FF\\u135D-\\u135F\\u1712-\\u1715\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B4-\\u17D3\\u17DD\\u180B-\\u180D\\u180F\\u1885\\u1886\\u18A9\\u1920-\\u192B\\u1930-\\u193B\\u1A17-\\u1A1B\\u1A55-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A7C\\u1A7F\\u1AB0-\\u1ADD\\u1AE0-\\u1AEB\\u1B00-\\u1B04\\u1B34-\\u1B44\\u1B6B-\\u1B73\\u1B80-\\u1B82\\u1BA1-\\u1BAD\\u1BE6-\\u1BF3\\u1C24-\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE8\\u1CED\\u1CF4\\u1CF7-\\u1CF9\\u1DC0-\\u1DFF\\u200C\\u200D\\u20D0-\\u20F0\\u2CEF-\\u2CF1\\u2D7F\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F-\\uA672\\uA674-\\uA67D\\uA69E\\uA69F\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA823-\\uA827\\uA82C\\uA880\\uA881\\uA8B4-\\uA8C5\\uA8E0-\\uA8F1\\uA8FF\\uA926-\\uA92D\\uA947-\\uA953\\uA960-\\uA97C\\uA980-\\uA983\\uA9B3-\\uA9C0\\uA9E5\\uAA29-\\uAA36\\uAA43\\uAA4C\\uAA4D\\uAA7C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uAAEB-\\uAAEF\\uAAF5\\uAAF6\\uABE3-\\uABEA\\uABEC\\uABED\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE2F\\uFF9E\\uFF9F]|\\uD800[\\uDDFD\\uDEE0\\uDF76-\\uDF7A]|\\uD802[\\uDE01-\\uDE03\\uDE05\\uDE06\\uDE0C-\\uDE0F\\uDE38-\\uDE3A\\uDE3F\\uDEE5\\uDEE6]|\\uD803[\\uDD24-\\uDD27\\uDD69-\\uDD6D\\uDEAB\\uDEAC\\uDEFA-\\uDEFF\\uDF46-\\uDF50\\uDF82-\\uDF85]|\\uD804[\\uDC00-\\uDC02\\uDC38-\\uDC46\\uDC70\\uDC73\\uDC74\\uDC7F-\\uDC82\\uDCB0-\\uDCBA\\uDCBD\\uDCC2\\uDCCD\\uDD00-\\uDD02\\uDD27-\\uDD34\\uDD45\\uDD46\\uDD73\\uDD80-\\uDD82\\uDDB3-\\uDDC0\\uDDC2\\uDDC3\\uDDC9-\\uDDCC\\uDDCE\\uDDCF\\uDE2C-\\uDE37\\uDE3E\\uDE41\\uDEDF-\\uDEEA\\uDF00-\\uDF03\\uDF3B\\uDF3C\\uDF3E-\\uDF44\\uDF47\\uDF48\\uDF4B-\\uDF4D\\uDF57\\uDF62\\uDF63\\uDF66-\\uDF6C\\uDF70-\\uDF74\\uDFB8-\\uDFC0\\uDFC2\\uDFC5\\uDFC7-\\uDFCA\\uDFCC-\\uDFD2\\uDFE1\\uDFE2]|\\uD805[\\uDC35-\\uDC46\\uDC5E\\uDCB0-\\uDCC3\\uDDAF-\\uDDB5\\uDDB8-\\uDDC0\\uDDDC\\uDDDD\\uDE30-\\uDE40\\uDEAB-\\uDEB7\\uDF1D-\\uDF1F\\uDF22-\\uDF2B]|\\uD806[\\uDC2C-\\uDC3A\\uDD30-\\uDD35\\uDD37\\uDD38\\uDD3B-\\uDD43\\uDDD1-\\uDDD7\\uDDDA-\\uDDE0\\uDDE4\\uDE01-\\uDE0A\\uDE33-\\uDE39\\uDE3B-\\uDE3E\\uDE47\\uDE51-\\uDE5B\\uDE84-\\uDE99\\uDF60-\\uDF67]|\\uD807[\\uDC2F-\\uDC36\\uDC38-\\uDC3F\\uDC92-\\uDCA7\\uDCA9-\\uDCB6\\uDD31-\\uDD36\\uDD3A\\uDD3C\\uDD3D\\uDD3F-\\uDD47\\uDD8A-\\uDD8E\\uDD90\\uDD91\\uDD93-\\uDD97\\uDEF3-\\uDEF6\\uDF00-\\uDF03\\uDF34-\\uDF3A\\uDF3E-\\uDF42\\uDF5A]|\\uD80D[\\uDC40\\uDC47-\\uDC55]|\\uD818[\\uDD1E-\\uDD2F]|\\uD81A[\\uDEF0-\\uDEF4\\uDF30-\\uDF36]|\\uD81B[\\uDD63\\uDD67-\\uDD6A\\uDF4F\\uDF51-\\uDF87\\uDF8F-\\uDF92\\uDFE4\\uDFF0\\uDFF1]|\\uD82F[\\uDC9D\\uDC9E]|\\uD833[\\uDF00-\\uDF2D\\uDF30-\\uDF46]|\\uD834[\\uDD65-\\uDD69\\uDD6D-\\uDD72\\uDD7B-\\uDD82\\uDD85-\\uDD8B\\uDDAA-\\uDDAD\\uDE42-\\uDE44]|\\uD836[\\uDE00-\\uDE36\\uDE3B-\\uDE6C\\uDE75\\uDE84\\uDE9B-\\uDE9F\\uDEA1-\\uDEAF]|\\uD838[\\uDC00-\\uDC06\\uDC08-\\uDC18\\uDC1B-\\uDC21\\uDC23\\uDC24\\uDC26-\\uDC2A\\uDC8F\\uDD30-\\uDD36\\uDEAE\\uDEEC-\\uDEEF]|\\uD839[\\uDCEC-\\uDCEF\\uDDEE\\uDDEF\\uDEE3\\uDEE6\\uDEEE\\uDEEF\\uDEF5]|\\uD83A[\\uDCD0-\\uDCD6\\uDD44-\\uDD4A]|\\uD83C[\\uDDE6-\\uDDFF\\uDFFB-\\uDFFF]|\\uDB40[\\uDC20-\\uDC7F\\uDD00-\\uDDEF]/.test(t)}function gc(t){return/[\\u0E01-\\u0E3A\\u0E40-\\u0E4E\\u0E81\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EC8-\\u0ECE\\u0EDC-\\u0EDF\\u0F00-\\u0F47\\u0F49-\\u0F6C\\u0F71-\\u0F97\\u0F99-\\u0FBC\\u0FBE-\\u0FCC\\u0FCE-\\u0FD4\\u0FD9\\u0FDA\\u1000-\\u103F\\u1050-\\u108F\\u109A-\\u109F\\u1780-\\u17D3\\u17D7\\u17DC\\u17DD\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u19DE\\u19DF\\u1A20-\\u1A5E\\u1A60-\\u1A7C\\u1AA0-\\u1AAD\\u1B00-\\u1B4C\\u1B4E-\\u1B7F\\uA980-\\uA9CD\\uA9D0-\\uA9D9\\uA9DE-\\uA9EF\\uA9FA-\\uA9FE\\uAA60-\\uAAC2\\uAADB-\\uAADF]|\\uD805[\\uDF00-\\uDF1A\\uDF1D-\\uDF2B\\uDF3A\\uDF3B\\uDF3F-\\uDF46]/gim.test(String.fromCodePoint(t))}function tv(t,e){return/(?:[\\u1039\\u17D2\\u1A60\\u1BAB\\u200D\\uAAF6]|\\uD802\\uDE3F|\\uD804[\\uDD33\\uDFD0]|\\uD806[\\uDD3E\\uDE47\\uDE99]|\\uD807[\\uDD45\\uDD97\\uDF42])$/.test(t)||new RegExp("^\\\\p{gc=Mc}","u").test(e)}var ev={C:"18g,1;g2,3;4nb,1",D:"17k,1;5,1;1,1;1,5;4,d;1,7;1,2;z,2;8,g;i,12;1,2;9,1;1,1;1,2;14,3;2,1;28,9;3,f;2,4;1,1;2,3;2,6;7a,1;2,5;1,1;g,a;5,2;2,6;1,f",R:"17m,4;1,1;1,1;5,4;l,1;14,3;1,3;g,i;12,1;2,9;1,1;1,1;2,2;1,1;o,2;2x,3;f,2;4,1;1,2;3,2;6u,j;b,1;r,3;1,1;2,2;6,1",T:"174,b;1,1;1a,l;g,1;2t,7;2,6;2,2;1,4;bt,9;16,o;1,t;1clb,1"},rv={1569:[65152,0,0,0],1570:[65153,65154,0,0],1571:[65155,65156,0,0],1572:[65157,65158,0,0],1573:[65159,65160,0,0],1574:[65161,65162,65163,65164],1575:[65165,65166,0,0],1576:[65167,65168,65169,65170],1577:[65171,65172,0,0],1578:[65173,65174,65175,65176],1579:[65177,65178,65179,65180],1580:[65181,65182,65183,65184],1581:[65185,65186,65187,65188],1582:[65189,65190,65191,65192],1583:[65193,65194,0,0],1584:[65195,65196,0,0],1585:[65197,65198,0,0],1586:[65199,65200,0,0],1587:[65201,65202,65203,65204],1588:[65205,65206,65207,65208],1589:[65209,65210,65211,65212],1590:[65213,65214,65215,65216],1591:[65217,65218,65219,65220],1592:[65221,65222,65223,65224],1593:[65225,65226,65227,65228],1594:[65229,65230,65231,65232],1601:[65233,65234,65235,65236],1602:[65237,65238,65239,65240],1603:[65241,65242,65243,65244],1604:[65245,65246,65247,65248],1605:[65249,65250,65251,65252],1606:[65253,65254,65255,65256],1607:[65257,65258,65259,65260],1608:[65261,65262,0,0],1609:[65263,65264,64488,64489],1610:[65265,65266,65267,65268],1611:[65136,0,0,65137],1612:[65138,0,0,0],1613:[65140,0,0,0],1614:[65142,0,0,65143],1615:[65144,0,0,65145],1616:[65146,0,0,65147],1617:[65148,0,0,65149],1618:[65150,0,0,65151],1649:[64336,64337,0,0],1655:[64477,0,0,0],1657:[64358,64359,64360,64361],1658:[64350,64351,64352,64353],1659:[64338,64339,64340,64341],1662:[64342,64343,64344,64345],1663:[64354,64355,64356,64357],1664:[64346,64347,64348,64349],1667:[64374,64375,64376,64377],1668:[64370,64371,64372,64373],1670:[64378,64379,64380,64381],1671:[64382,64383,64384,64385],1672:[64392,64393,0,0],1676:[64388,64389,0,0],1677:[64386,64387,0,0],1678:[64390,64391,0,0],1681:[64396,64397,0,0],1688:[64394,64395,0,0],1700:[64362,64363,64364,64365],1702:[64366,64367,64368,64369],1705:[64398,64399,64400,64401],1709:[64467,64468,64469,64470],1711:[64402,64403,64404,64405],1713:[64410,64411,64412,64413],1715:[64406,64407,64408,64409],1722:[64414,64415,0,0],1723:[64416,64417,64418,64419],1726:[64426,64427,64428,64429],1728:[64420,64421,0,0],1729:[64422,64423,64424,64425],1733:[64480,64481,0,0],1734:[64473,64474,0,0],1735:[64471,64472,0,0],1736:[64475,64476,0,0],1737:[64482,64483,0,0],1739:[64478,64479,0,0],1740:[64508,64509,64510,64511],1744:[64484,64485,64486,64487],1746:[64430,64431,0,0],1747:[64432,64433,0,0]},iv={\\u0644\\u0622:[65269,65270],\\u0644\\u0623:[65271,65272],\\u0644\\u0625:[65273,65274],\\u0644\\u0627:[65275,65276]},xc=1604,nv=/[\\u0600-\\u06ff\\u0750-\\u077f\\u0870-\\u089f\\u08a0-\\u08ff\\ufb50-\\ufdff\\ufe70-\\ufeff]/;function av(t,e,r){let i=0;for(let n of t.split(";")){let[a,s]=n.split(",").map(l=>parseInt(l,36)),o=i+a;for(let l=o;l{let r=e.codePointAt(0);return{codePoint:r,type:sv(r),form:null}})}function cv(t){let e=t.filter(r=>r.type!=="T");for(let r=0;r0&&ov(e[r-1].type),a=r+1String.fromCodePoint(dv(r))).join("")}function mv(t,e,r){var n;let i=e.layout.get("text-transform").evaluate(r,{});return i==="uppercase"?t=t.toLocaleUpperCase():i==="lowercase"&&(t=t.toLocaleLowerCase()),((n=wr.applyArabicShaping)!=null?n:yv)(t)}function gv(t,e,r){for(let i of t.sections)i.text=mv(i.text,e,r);return t}function xv(t){let e={},r={},i=[],n=0;function a(u){i.push(t[u]),n++}function s(u,h,c){let p=r[u];return delete r[u],r[h]=p,i[p].geometry[0].pop(),i[p].geometry[0]=i[p].geometry[0].concat(c[0]),p}function o(u,h,c){let p=e[h];return delete e[h],e[u]=p,i[p].geometry[0].shift(),i[p].geometry[0]=c[0].concat(i[p].geometry[0]),p}function l(u,h,c){let p=c?h[0][h[0].length-1]:h[0][0];return`${u}:${p.x}:${p.y}`}for(let u=0;uu.geometry)}var Bd=typeof Intl<"u"&&"Segmenter"in Intl,ta,ea;function tl(t){if(!Bd||!Q2(t))return[...t];ta!=null||(ta=new Intl.Segmenter(void 0,{granularity:"grapheme"}));let e=[];for(let{segment:r}of ta.segment(t)){let i=e.length-1;i>=0&&tv(e[i],r)?e[i]+=r:e.push(r)}return e}function vv(t){let e=new Set;if(Bd){ea!=null||(ea=new Intl.Segmenter(void 0,{granularity:"word"}));for(let{index:i}of ea.segment(t))e.add(i);return e}let r=0;for(let i of t.split(new RegExp("\\\\b|(?=\\\\p{Ideo})","u")))e.add(r),r+=i.length;return e}function Pd(t){let e=t.codePointAt(0);return t.length>(e>65535?2:1)}function ru(t){return/\\s/u.test(String.fromCodePoint(t))}function el(t){for(let e of t)if(Qa(e.codePointAt(0)))return!0;return!1}function bv(t){for(let e of t)if(!wv(e.codePointAt(0)))return!1;return!0}function wv(t){return!Z2(t)}function vc(t){return!(Qa(t)||J2(t))}function zd(t){return new RegExp("\\\\p{sc=Arab}","u").test(String.fromCodePoint(t))}function Ld(t){return H2(t)}function Vd(t){for(let e of t)if(Ld(e.codePointAt(0)))return!0;return!1}var Gr={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u22EF":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function Dv(t){let e="",r={premature:!0,value:void 0},i=t[Symbol.iterator](),n=i.next(),a=t[Symbol.iterator]();a.next();let s=a.next();for(;!n.done;)(s.done||!vc(s.value.codePointAt(0))||Gr[s.value])&&(r.premature||!vc(r.value.codePointAt(0))||Gr[r.value])&&Gr[n.value]?e+=Gr[n.value]:e+=n.value,r={value:n.value,premature:!1},n=i.next(),s=a.next();return e}var _v={10:!0,13:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Av={40:!0};function bc(t,e,r,i,n,a){if("fontStack"in e){let s=r[e.fontStack],o=s==null?void 0:s[t];if(o)return o.metrics.advance*e.scale+n;let l=0;for(let u of t){let h=s==null?void 0:s[u];h&&(l+=h.metrics.advance*e.scale+n)}return l}{let s=i[e.imageName];return s?s.displaySize[0]*e.scale*24/a+n:0}}function wc(t,e,r,i){let n=(t-e)**2;return i?tr&&Dc(e[i-1]);)i--;this.text=e.slice(r,i).join(""),this.sectionIndex=this.sectionIndex.slice(r,i),this._graphemes=null}substring(e,r){let i=this.graphemes().slice(e,r).join(""),n=this.sectionIndex.slice(e,r);return new rl(i,this.sections,n)}toCodeUnitIndex(e){return this.graphemes().slice(0,e).join("").length}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,r)=>Math.max(e,this.sections[r].scale),0)}getMaxImageSize(e){let r=0,i=0;for(let n=0;n0?i[i.length-1]:"",a=tl(n+e);this.text+=e,this._graphemes=i.slice(0,n?-1:void 0).concat(a);let s=a.length-+!!n;for(let o=0;o=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}determineLineBreaks(e,r,i,n,a){let s=[],o=this.determineAverageLineWidth(e,r,i,n,a),l=this.hasZeroWidthSpaces(),u=this.graphemes(),h=null,c=0,p=0;for(let f=0;f0){let y=u[f-1].codePointAt(0),m=d.codePointAt(0),g=K2(y),x=gc(y)&&gc(m);(_v[y]||g||"imageName"in this.getSection(f-1)||u[f+1]!==void 0&&Av[m]||x&&(h!=null?h:h=vv(this.text)).has(p))&&s.push(_c(f,c,o,s,Sv(y,m,g&&l),!1))}ru(d.codePointAt(0))||(c+=bc(d,this.getSection(f),i,n,e,a)),p+=d.length}return Od(_c(this.length(),c,o,s,0,!0))}determineAverageLineWidth(e,r,i,n,a){let s=0,o=0;for(let u of this.graphemes()){let h=this.getSection(o);s+=bc(u,h,i,n,e,a),o++}let l=Math.max(1,Math.ceil(s/r));return s/l}};function Ev(){return(function(t){var e={R:"13k,1a,2,3,3,2+1j,ch+16,a+1,5+2,2+n,5,a,4,6+16,4+3,h+1b,4mo,179q,2+9,2+11,2i9+7y,2+68,4,3+4,5+13,4+3,2+4k,3+29,8+cf,1t+7z,w+17,3+3m,1t+3z,16o1+5r,8+30,8+mc,29+1r,29+4v,75+73",EN:"1c+9,3d+1,6,187+9,513,4+5,7+9,sf+j,175h+9,qw+q,161f+1d,4xt+a,25i+9",ES:"17,2,6dp+1,f+1,av,16vr,mx+1,4o,2",ET:"z+2,3h+3,b+1,ym,3e+1,2o,p4+1,8,6u,7c,g6,1wc,1n9+4,30+1b,2n,6d,qhx+1,h0m,a+1,49+2,63+1,4+1,6bb+3,12jj",AN:"16o+5,2j+9,2+1,35,ed,1ff2+9,87+u",CS:"18,2+1,b,2u,12k,55v,l,17v0,2,3,53,2+1,b",B:"a,3,f+2,2v,690",S:"9,2,k",WS:"c,k,4f4,1vk+a,u,1j,335",ON:"x+1,4+4,h+5,r+5,r+3,z,5+3,2+1,2+1,5,2+2,3+4,o,w,ci+1,8+d,3+d,6+8,2+g,39+1,9,6+1,2,33,b8,3+1,3c+1,7+1,5r,b,7h+3,sa+5,2,3i+6,jg+3,ur+9,2v,ij+1,9g+9,7+a,8m,4+1,49+x,14u,2+2,c+2,e+2,e+2,e+1,i+n,e+e,2+p,u+2,e+2,36+1,2+3,2+1,b,2+2,6+5,2,2,2,h+1,5+4,6+3,3+f,16+2,5+3l,3+81,1y+p,2+40,q+a,m+13,2r+ch,2+9e,75+hf,3+v,2+2w,6e+5,f+6,75+2a,1a+p,2+2g,d+5x,r+b,6+3,4+o,g,6+1,6+2,2k+1,4,2j,5h+z,1m+1,1e+f,t+2,1f+e,d+3,4o+3,2s+1,w,535+1r,h3l+1i,93+2,2s,b+1,3l+x,2v,4g+3,21+3,kz+1,g5v+1,5a,j+9,n+v,2,3,2+8,2+1,3+2,2,3,46+1,4+4,h+5,r+5,r+a,3h+2,4+6,b+4,78,1r+24,4+c,4,1hb,ey+6,103+j,16j+c,1ux+7,5+g,fsh,jdq+1t,4,57+2e,p1,1m,1m,1m,1m,4kt+1,7j+17,5+2r,d+e,3+e,2+e,2+10,m+4,w,1n+5,1q,4z+5,4b+rb,9+c,4+c,4+37,d+2g,8+b,l+b,5+1j,9+9,7+13,9+t,3+1,27+3c,2+29,2+3q,d+d,3+4,4+2,6+6,a+o,8+6,a+2,e+6,16+42,2+1i",BN:"0+8,6+d,2s+5,2+p,e,4m9,1kt+2,2b+5,5+5,17q9+v,7k,6p+8,6+1,119d+3,440+7,96s+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+1,1ekf+75,6p+2rz,1ben+1,1ekf+1,1ekf+1",NSM:"lc+33,7o+6,7c+18,2,2+1,2+1,2,21+a,1d+k,h,2u+6,3+5,3+1,2+3,10,v+q,2k+a,1n+8,a,p+3,2+8,2+2,2+4,18+2,3c+e,2+v,1k,2,5+7,5,4+6,b+1,u,1n,5+3,9,l+1,r,3+1,1m,5+1,5+1,3+2,4,v+1,4,c+1,1m,5+4,2+1,5,l+1,n+5,2,1n,3,2+3,9,8+1,c+1,v,1q,d,1f,4,1m+2,6+2,2+3,8+1,c+1,u,1n,g+1,l+1,t+1,1m+1,5+3,9,l+1,u,21,8+2,2,2j,3+6,d+7,2r,3+8,c+5,23+1,s,2,2,1k+d,2+4,2+1,6+a,2+z,a,2v+3,2+5,2+1,3+1,q+1,5+2,h+3,e,3+1,7,g,jk+2,qb+2,u+2,u+1,v+1,1t+1,2+6,9,3+a,a,1a+2,3c+1,z,3b+2,5+1,a,7+2,64+1,3,1n,2+6,2,2,3+7,7+9,3,1d+g,1s+3,1d,2+4,2,6,15+8,d+1,x+3,3+1,2+2,1l,2+1,4,2+2,1n+7,3+1,49+2,2+c,2+6,5,7,4+1,5j+1l,2+4,k1+w,2db+2,3y,2p+v,ff+3,30+1,n9x+3,2+9,x+1,29+1,7l,4,5,q+1,6,48+1,r+h,e,13+7,q+a,1b+2,1d,3+3,3+1,14,1w+5,3+1,3+1,d,9,1c,1g,2+2,3+1,6+1,2,17+1,9,6n,3,5,fn5,ki+f,h+f,r2,6b,46+4,1af+2,2+1,6+3,15+2,5,4m+1,fy+3,as+1,4a+a,4x,1j+e,1l+2,1e+3,3+1,1y+2,11+4,2+7,1r,d+1,1h+8,b+3,3,2o+2,3,2+1,7,4h,4+7,m+1,1m+1,4,12+6,4+4,5g+7,3+2,2,o,2d+5,2,5+1,2+1,6n+3,7+1,2+1,s+1,2e+7,3,2+1,2z,2,3+5,2,2u+2,3+3,2+4,78+8,2+1,75+1,2,5,41+3,3+1,5,x+5,3+1,15+5,3+3,9,a+5,3+2,1b+c,2+1,bb+6,2+5,2d+l,3+6,2+1,2+1,3f+5,4,2+1,2+6,2,21+1,4,2,9o+1,f0c+4,1o+6,t5,1s+3,2a,f5l+1,43t+2,i+7,3+6,v+3,45+2,1j0+1i,5+1d,9,f,n+4,2+e,11t+6,2+g,3+6,2+1,2+4,7a+6,c6+3,15t+6,32+6,gzhy+6n",AL:"16w,3,2,e+1b,z+2,2+2s,g+1,8+1,b+m,2+t,s+2i,c+e,4h+f,1d+1e,1bwe+dp,3+3z,x+c,2+1,35+3y,2rm+z,5+7,b+5,dt+l,c+u,17nl+27,1t+27,4x+6n,3+d",LRO:"6ct",RLO:"6cu",LRE:"6cq",RLE:"6cr",PDF:"6cs",LRI:"6ee",RLI:"6ef",FSI:"6eg",PDI:"6eh"},r={},i={};r.L=1,i[1]="L",Object.keys(e).forEach(function(R,J){r[R]=1<1,1e>2,u>2,2wt>1,1>1,1ge>1,1wp>1,1j>1,f>1,hm>1,1>1,u>1,u6>1,1>1,+5,28>1,w>1,1>1,+3,b8>1,1>1,+3,1>3,-1>-1,3>1,1>1,+2,1s>1,1>1,x>1,th>1,1>1,+2,db>1,1>1,+3,3>1,1>1,+2,14qm>1,1>1,+1,4q>1,1e>2,u>2,2>1,+1",canonical:"6f1>-6dx,6dy>-6dx,6ec>-6ed,6ee>-6ed,6ww>2jj,-2ji>2jj,14r4>-1e7l,1e7m>-1e7l,1e7m>-1e5c,1e5d>-1e5b,1e5c>-14qx,14qy>-14qx,14vn>-1ecg,1ech>-1ecg,1edu>-1ecg,1eci>-1ecg,1eda>-1ecg,1eci>-1ecg,1eci>-168q,168r>-168q,168s>-14ye,14yf>-14ye"};function d(R,J){var W=0,M=new Map,ut=J&&new Map,X;return R.split(",").forEach(function G(K){if(K.indexOf("+")!==-1)for(var Nt=+K;Nt--;)G(X);else{X=K;var vt=K.split(">"),nt=vt[0],Tt=vt[1];nt=String.fromCodePoint(W+=parseInt(nt,36)),Tt=String.fromCodePoint(W+=parseInt(Tt,36)),M.set(nt,Tt),J&&ut.set(Tt,nt)}}),{map:M,reverseMap:ut}}var y,m,g;function x(){if(!y){var R=d(f.pairs,!0),J=R.map,W=R.reverseMap;y=J,m=W,g=d(f.canonical,!1).map}}function v(R){return x(),y.get(R)||null}function b(R){return x(),m.get(R)||null}function D(R){return x(),g.get(R)||null}var A=r.L,_=r.R,S=r.EN,k=r.ES,z=r.ET,O=r.AN,P=r.CS,L=r.B,F=r.S,$=r.ON,U=r.BN,T=r.NSM,q=r.AL,at=r.LRO,ot=r.RLO,pt=r.LRE,Et=r.RLE,qt=r.PDF,Ht=r.LRI,Ve=r.RLI,ye=r.FSI,Kt=r.PDI;function Oe(R,J){for(var W=125,M=new Uint32Array(R.length),ut=0;ut0)Fe--;else if(rs>0){for(Ne=0;!lt[lt.length-1]._isolate;)lt.pop();var is=lt[lt.length-1]._isolInitIndex;is!=null&&(Nt.set(is,zt),Nt.set(zt,is)),lt.pop(),rs--}bt=lt[lt.length-1],K[zt]=bt._level,bt._override&&G(zt,bt._override)}else Lt&qt?(Fe===0&&(Ne>0?Ne--:!bt._isolate&<.length>1&&(lt.pop(),bt=lt[lt.length-1])),K[zt]=bt._level):Lt&L&&(K[zt]=nt.level);else K[zt]=bt._level,bt._override&&Lt!==U&&G(zt,bt._override)}for(var Cr=[],me=null,ar=nt.start;ar<=nt.end;ar++){var ns=M[ar];if(!(ns&o)){var Bu=K[ar],Pu=ns&n,Wy=ns===Kt;me&&Bu===me._level?(me._end=ar,me._endsWithIsolInit=Pu):Cr.push(me={_start:ar,_end:ar,_level:Bu,_startsWithPDI:Wy,_endsWithIsolInit:Pu})}}for(var as=[],Sn=0;Sn=0;kn--)if(!(M[kn]&o)){Vu=K[kn];break}var us=Mr[Mr.length-1],Hy=K[us],Ou=nt.level;if(!(M[us]&n)){for(var Tn=us+1;Tn<=nt.end;Tn++)if(!(M[Tn]&o)){Ou=K[Tn];break}}as.push({_seqIndices:Mr,_sosType:Math.max(Vu,Zy)%2?_:A,_eosType:Math.max(Ou,Hy)%2?_:A})}}for(var hs=0;hs=0;Cn--)if(!(M[j[Cn]]&o)){ps=M[j[Cn]];break}G(Ru,ps&(n|Kt)?$:ps)}}if(X.get(S))for(var Mn=0;Mn=-1;Bn--){var Nu=Bn===-1?yi:M[j[Bn]];if(Nu&a){Nu===q&&G($u,O);break}}}if(X.get(q))for(var fs=0;fs=0&&(Pr=M[j[ms]],Pr&o);ms--);for(var gs=mi+1;gs=0&&M[j[Pn]]&(z|o);Pn--)G(j[Pn],S);for(ge++;ge=0&&M[j[zn]]&o;zn--)G(j[zn],$);for(var Ln=gi+1;Ln=0;bi--){var bs=zr[bi].char;if(bs===Yu||bs===b(D(vi))||v(D(bs))===vi){Vn.push([zr[bi].seqIndex,Lr]),zr.length=bi;break}}}Vn.sort(function(Yt,ue){return Yt[0]-ue[0]});for(var ws=0;ws=0;As--){var Ju=j[As];if(M[Ju]&Xu){var Qu=M[Ju]&xi?_:A;xe=Qu===Br?Br:Qu;break}}}if(xe){if(M[j[On]]=M[j[Ds]]=xe,xe!==Br){for(var wi=On+1;wi=0;_i--)if(M[j[_i]]&o)th=_i;else{Es=M[j[_i]]&xi?_:A;break}for(var eh=Ky,Ai=Ue+1;Ai=0&&c(R[$n])&l;$n--)K[$n]=nt.level}}return{levels:K,paragraphs:vt};function rh(Yt,ue){for(var Wt=Yt;Wt=K&&c(R[nt])&l;nt--)vt[nt]=G.level;for(var Tt=G.level,di=1/0,nr=0;nrTt&&(Tt=Re),Re=di;$e--)for(var lt=0;lt=$e){for(var bt=lt;lt+1=$e;)lt++;lt>bt&&X.push([bt+K,lt+K])}}}),X}function Tr(R,J,W,M){var ut=Ir(R,J,W,M),X=[].concat(R);return ut.forEach(function(G,K){X[K]=(J.levels[G]&1?kt(R[G]):null)||R[G]}),X.join("")}function Ir(R,J,W,M){for(var ut=ir(R,J,W,M),X=[],G=0;G=0;i--){let n=nu.getBidiCharTypeName(t[i].text[0]);Tv.has(n)?(t[i].level=e,r=!0):r&&kv.has(n)?t[i].level=e:r=!1}}function Mv(t,e){let r=e,i=1/0;for(let{level:a}of t)a>r&&(r=a),(a|1)=i;a--)for(let s=0;s=a;)o++;for(let l=s,u=o;le>=n.start&&e<=n.end))==null?void 0:r.level)!=null?i:0}function zv(t,e,r,i,n){let a=Iv(t,e,i,n);Cv(a,r);let s="",o=[];for(let l of Mv(a,r)){if(Fv.test(l.text))continue;let u=Bv(l);s+=u,o.push(...Array(u.length).fill(l.index))}return{text:s,sourceIndices:o}}function Lv(t,e){let r=e.filter(a=>a>0&&aa-s),n=[];for(let a=0;a+1n.start))).map(([n,a])=>zv(t,r,Pv(i,n),n,a))}function Vv(t,e){return Rd(t,e).map(r=>r.text)}function Ov(t,e,r){return Rd(t,r).map(i=>[i.text,i.sourceIndices.map(n=>{var a;return(a=e[n])!=null?a:0})])}var il=4294967296,Ac=1/il,Sc=typeof TextDecoder>"u"?null:new TextDecoder("utf-8"),au=class{constructor(t){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.type=0,this._valueStart=-1,this.length=this.buf.length}readFields(t,e,r=this.length){let i;for(;i=this.nextField(r);)t(i,e,this);return e}readMessage(t,e){return this.readFields(t,e,this.readVarint()+this.pos)}readFixed32(){let t=this.dataView.getUint32(this.pos,!0);return this.pos+=4,t}readSFixed32(){let t=this.dataView.getInt32(this.pos,!0);return this.pos+=4,t}readFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*il;return this.pos+=8,t}readSFixed64(){let t=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*il;return this.pos+=8,t}readFloat(){let t=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,t}readDouble(){let t=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,t}readVarint(t){let e=this.buf,r=e[this.pos++];if(r<128)return r;let i=r&127,n;return n=e[this.pos++],i|=(n&127)<<7,n<128||(n=e[this.pos++],i|=(n&127)<<14,n<128)||(n=e[this.pos++],i|=(n&127)<<21,n<128)?i:(n=e[this.pos],i|=(n&15)<<28,$v(i,t,this))}readSVarint(){let t=this.readVarint();return t%2==1?(t+1)/-2:t/2}readBoolean(){return!!this.readVarint()}readString(){let t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Sc?Sc.decode(this.buf.subarray(e,t)):tb(this.buf,e,t)}readBytes(){let t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e}readPackedVarint(t=[],e){let r=this.readPackedEnd();for(;this.pos=t)return 0;let e=this.readVarint();return this.type=e&7,this._valueStart=this.pos,e>>>3}skip(t){let e=t&7;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else if(e===1)this.pos+=8;else throw Error(`Unimplemented type: ${e}`)}},Rv=class{constructor(t=new Uint8Array(16)){this.buf=ArrayBuffer.isView(t)?t:new Uint8Array(t),this.dataView=new DataView(this.buf.buffer,this.buf.byteOffset,this.buf.byteLength),this.pos=0,this.length=this.buf.length}writeTag(t,e){this.writeVarint(t<<3|e)}realloc(t){let e=this.length||16;for(;e=0&&t<128){this.pos>=this.length&&this.realloc(1),this.buf[this.pos++]=t;return}if(t>268435455||t<0){Uv(t,this);return}this.realloc(4),this.buf[this.pos++]=t&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=(t>>>=7)&127|(t>127?128:0),!(t<=127)&&(this.buf[this.pos++]=t>>>7&127)))}writeSVarint(t){this.writeVarint(t<0?-t*2-1:t*2)}writeBoolean(t){this.writeVarint(+t)}writeString(t){t=String(t),this.realloc(t.length*4),this.pos++;let e=this.pos;this.pos=eb(this.buf,t,this.pos);let r=this.pos-e;r>=128&&Ec(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r}writeFloat(t){this.realloc(4),this.dataView.setFloat32(this.pos,t,!0),this.pos+=4}writeDouble(t){this.realloc(8),this.dataView.setFloat64(this.pos,t,!0),this.pos+=8}writeBytes(t){let e=t.length;this.writeVarint(e),this.realloc(e),this.buf.set(t,this.pos),this.pos+=e}writeRawMessage(t,e){this.pos++;let r=this.pos;t(e,this);let i=this.pos-r;i>=128&&Ec(r,i,this),this.pos=r-1,this.writeVarint(i),this.pos+=i}writeMessage(t,e,r){this.writeTag(t,2),this.writeRawMessage(e,r)}writePackedVarint(t,e){e.length&&this.writeMessage(t,Gv,e)}writePackedSVarint(t,e){e.length&&this.writeMessage(t,Xv,e)}writePackedBoolean(t,e){e.length&&this.writeMessage(t,Zv,e)}writePackedFloat(t,e){e.length&&this.writeMessage(t,Yv,e)}writePackedDouble(t,e){e.length&&this.writeMessage(t,Wv,e)}writePackedFixed32(t,e){e.length&&this.writeMessage(t,Hv,e)}writePackedSFixed32(t,e){e.length&&this.writeMessage(t,Kv,e)}writePackedFixed64(t,e){e.length&&this.writeMessage(t,Jv,e)}writePackedSFixed64(t,e){e.length&&this.writeMessage(t,Qv,e)}writeBytesField(t,e){this.writeTag(t,2),this.writeBytes(e)}writeFixed32Field(t,e){this.writeTag(t,5),this.writeFixed32(e)}writeSFixed32Field(t,e){this.writeTag(t,5),this.writeSFixed32(e)}writeFixed64Field(t,e){this.writeTag(t,1),this.writeFixed64(e)}writeSFixed64Field(t,e){this.writeTag(t,1),this.writeSFixed64(e)}writeVarintField(t,e){this.writeTag(t,0),this.writeVarint(e)}writeSVarintField(t,e){this.writeTag(t,0),this.writeSVarint(e)}writeStringField(t,e){this.writeTag(t,2),this.writeString(e)}writeFloatField(t,e){this.writeTag(t,5),this.writeFloat(e)}writeDoubleField(t,e){this.writeTag(t,1),this.writeDouble(e)}writeBooleanField(t,e){this.writeVarintField(t,+e)}};function $v(t,e,r){let i=r.buf,n,a;if(a=i[r.pos++],n=(a&112)>>4,a<128||(a=i[r.pos++],n|=(a&127)<<3,a<128)||(a=i[r.pos++],n|=(a&127)<<10,a<128)||(a=i[r.pos++],n|=(a&127)<<17,a<128)||(a=i[r.pos++],n|=(a&127)<<24,a<128)||(a=i[r.pos++],n|=(a&1)<<31,a<128))return Nv(t,n,e);throw Error("Expected varint not more than 10 bytes")}function Nv(t,e,r){return r?e*4294967296+(t>>>0):(e>>>0)*4294967296+(t>>>0)}function Uv(t,e){let r,i;if(t>=0?(r=t%4294967296|0,i=t/4294967296|0):(r=~(-t%4294967296),i=~(-t/4294967296),r^4294967295?r=r+1|0:(r=0,i=i+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw Error("Given varint doesn\'t fit into 10 bytes");e.realloc(10),qv(r,i,e),jv(i,e)}function qv(t,e,r){r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos++]=t&127|128,t>>>=7,r.buf[r.pos]=t&127}function jv(t,e){let r=(t&7)<<4;e.buf[e.pos++]|=r|((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 Ec(t,e,r){let i=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(Math.LN2*7));r.realloc(i),r.buf.copyWithin(t+i,t,r.pos)}function Gv(t,e){let r=t.length,i=e.buf,n=e.pos,a=e.length;for(let s=0;sa){e.pos=n,e.writeVarint(o),i=e.buf,n=e.pos,a=e.length;continue}for(;o>127;)i[n++]=o%128|128,o=Math.floor(o/128);i[n++]=o}e.pos=n}function Xv(t,e){for(let r=0;r239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function eb(t,e,r){for(let i=0,n,a;i55295&&n<57344)if(a){if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,a=n;continue}n=a-55296<<10|n-56320|65536,a=null}else{n>56319||i+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):a=n;continue}else a&&(a=(t[r++]=239,t[r++]=191,t[r++]=189,null));n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=n&63|128)}return r}function rb(t){return typeof(t==null?void 0:t.renderWithWebGL)=="function"}function su(t){let e=0,r=0;for(let s of t)e+=s.w*s.h,r=Math.max(r,s.w);t.sort((s,o)=>o.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),r),h:1/0}],n=0,a=0;for(let s of t)for(let o=i.length-1;o>=0;o--){let l=i[o];if(!(s.w>l.w||s.h>l.h)){if(s.x=l.x,s.y=l.y,a=Math.max(a,s.y+s.h),n=Math.max(n,s.x+s.w),s.w===l.w&&s.h===l.h){let u=i.pop();u&&o=r;a--)e.push(a);r=i+1}else{for(let a=r;at.toCodeUnitIndex(a)),i=wr.isParsed()?wr:null;if(t.sections.length===1)return i?i.processBidirectionalText(t.toString(),r).map(a=>kc(a,t.sections,[...a].map(()=>0))):Vv(t.toString(),r).map(a=>nl([...a],t.sections,[...a].map(()=>0)));let n=sb(t);return i?i.processStyledBidirectionalText(t.text,n,r).map(([a,s])=>kc(a,t.sections,s)):Ov(t.text,n,r).map(([a,s])=>{let o=[...a];return nl(o,t.sections,Ud(o).map(l=>{var u;return(u=s[l])!=null?u:0}))})}function nl(t,e,r){var a;let i=new iu(t.join(""),e,[]),n=0;for(let s of i.graphemes())i.sectionIndex.push((a=r[n])!=null?a:0),n+=[...s].length;return i}function Ud(t){let e=[],r=0;for(let i of t)e.push(r),r+=i.length;return e}function kc(t,e,r){let i=[...t],n=Ud(i),a=ab(i);return nl(a.map(s=>i[s]),e,a.map(s=>{var o;return(o=r[n[s]])!=null?o:0}))}function ra(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d){let y=iu.fromFeature(t,n);c===2&&y.verticalizePunctuation();let m=y.determineLineBreaks(u,a,e,i,f),g=Vd(y.text)?ob(y,m):nb(y,m),x=[],v={positionedLines:x,text:y.toString(),top:h[1],bottom:h[1],left:h[0],right:h[0],writingMode:c,iconsInText:!1,verticalizable:!1};return mb(v,e,r,i,g,s,o,l,c,u,p,d),!ib(x)&&v}function qd(t){let e=.5,r=.5;switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:e,verticalAlign:r}}function lb(t,e,r){let i=e.getMaxScale()*24,{maxImageWidth:n,maxImageHeight:a}=e.getMaxImageSize(t),s=Math.max(i,a*r);return{verticalLineContentWidth:Math.max(i,n*r),horizontalLineContentHeight:s}}function jd(t){switch(t){case"top":return 0;case"center":return .5;default:return 1}}function ub(t,e,r,i){var a;if(t!=null&&t.rect)return t;let n=(a=e[r.fontStack])==null?void 0:a[i];return n?{rect:null,metrics:n.metrics}:null}function hb(t,e,r){return!(t===1||!e&&!Qa(r)||e&&(ru(r)||zd(r)))}function da(t){return new RegExp("\\\\p{Nd}","u").test(String.fromCodePoint(t))}function Gd(t){return new RegExp("\\\\p{Lu}","u").test(String.fromCodePoint(t))}function cb(t){return/[\\p{P}\\p{S}]/u.test(String.fromCodePoint(t))}function pb(t){let e=t.some(da)&&t.every(i=>da(i)||cb(i)),r=t.length<=3&&t.every(i=>Gd(i)||da(i));return e||r}function fb(t){return(da(t)||Gd(t))&&!zd(t)}function db(t,e){let r=!1;for(let i=0;ia.codePointAt(0)),i=r.map(Qa),n=a=>!i[a]&&!ru(r[a])&&!("imageName"in t.getSection(a));for(let a=0;au){let p=Math.ceil(i/u);r*=p/n,n=p}return{x1:e,y1:r,x2:e+i,y2:r+n}}function Tc(t,e,r,i,n,a){let s=t.image,o;if(s.content){let m=s.content,g=s.pixelRatio||1;o=[m[0]/g,m[1]/g,s.displaySize[0]-m[2]/g,s.displaySize[1]-m[3]/g]}let l=e.left*a,u=e.right*a,h,c,p,f;r==="width"||r==="both"?(f=n[0]+l-i[3],c=n[0]+u+i[1]):(f=n[0]+(l+u-s.displaySize[0])/2,c=f+s.displaySize[0]);let d=e.top*a,y=e.bottom*a;return r==="height"||r==="both"?(h=n[1]+d-i[0],p=n[1]+y+i[2]):(h=n[1]+(d+y-s.displaySize[1])/2,p=h+s.displaySize[1]),{image:s,top:h,right:c,bottom:p,left:f,collisionPadding:o}}var Ic=32640;function Cc(t,e){let{expression:r}=e;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new st(t+1))};if(r.kind==="source")return{kind:"source"};if(r.kind==="composite"){let{minZoom:i,maxZoom:n}=Db(r.zoomStops,t);return{kind:"composite",minZoom:i,maxZoom:n,interpolationType:r.interpolationType}}{let i=_b(r),n=r.evaluate(new st(t+1));return{kind:"camera",zoomStops:r.zoomStops,sizes:i,layoutSize:n,interpolationType:r.interpolationType}}}function Db(t,e){let r=0;for(;rt.evaluate(new st(e===-1/0?t.zoomStops[1]-1:e)))}var Jr=class Yd extends B{constructor(e,r,i,n){super(e,r),this.angle=i,n!==void 0&&(this.segment=n)}clone(){return new Yd(this.x,this.y,this.angle,this.segment)}};C("Anchor",Jr);function Wd(t,e,r,i,n){if(e.segment===void 0||r===0)return!0;let a=e,s=e.segment+1,o=0;for(;o>-r/2;){if(s--,s<0)return!1;o-=t[s].dist(a),a=t[s]}o+=t[s].dist(t[s+1]),s++;let l=[],u=0;for(;oi;)u-=l.shift().angleDelta;if(u>n)return!1;s++,o+=c.dist(p)}return!0}function Zd(t){let e=0;for(let r=0;ru){let d=(u-l)/f,y=new Jr(gr.number(c.x,p.x,d),gr.number(c.y,p.y,d),p.angleTo(c),h);return y._round(),!s||Wd(t,y,o,s,e)?y:void 0}l+=f}}function Sb(t,e,r,i,n,a,s,o,l){let u=Hd(i,a,s),h=Kd(i,n),c=h*s,p=t[0].x===0||t[0].x===l||t[0].y===0||t[0].y===l;e-c=0&&b=0&&D=0&&p+u<=h){let A=new Jr(b,D,x,d);A._round(),(!i||Wd(t,A,a,i,n))&&f.push(A)}}c+=g}return!o&&!f.length&&!s&&(f=Jd(t,c/2,r,i,n,a,s,!0,l)),f}function Eb(t,e,r,i,n){let a=[];for(let s of t){let o;for(let l=0;l=i&&h.x>=i)&&(u.x>=i?u=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round():h.x>=i&&(h=new B(i,u.y+(h.y-u.y)*((i-u.x)/(h.x-u.x)))._round()),!(u.y>=n&&h.y>=n)&&(u.y>=n?u=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round():h.y>=n&&(h=new B(u.x+(h.x-u.x)*((n-u.y)/(h.y-u.y)),n)._round()),(!o||!u.equals(o[o.length-1]))&&(o=[u],a.push(o)),o.push(h)))))}}return a}function Qd(t,e,r,i,n,a){let s=Mc(t,e,r,n,0);return s=Mc(s,e,i,a,1),s}function Mc(t,e,r,i,n){switch(e){case 1:return Fb(t,r,i,n);case 2:return Bc(t,r,i,n,!1);case 3:return Bc(t,r,i,n,!0)}return[]}function Fb(t,e,r,i){let n=[];for(let a of t)for(let s of a){let o=i===0?s.x:s.y;o>=e&&o<=r&&n.push([s])}return n}function kb(t,e,r,i,n){let a=i===0?Tb:Ib,s=[],o=[];for(let h=0;he&&s.push(a(c,p,e)):f>r?d=e&&(s.push(a(c,p,e)),y=!0),d>r&&f<=r&&(s.push(a(c,p,r)),y=!0),!n&&y&&(o.push(s),s=[])}let l=t.length-1,u=i===0?t[l].x:t[l].y;return u>=e&&u<=r&&s.push(t[l]),n&&s.length>0&&!s[0].equals(s[s.length-1])&&s.push(new B(s[0].x,s[0].y)),s.length>0&&o.push(s),o}function Bc(t,e,r,i,n){let a=[];for(let s of t){let o=kb(s,e,r,i,n);o.length>0&&a.push(...o)}return a}function Tb(t,e,r){let i=(r-t.x)/(e.x-t.x);return new B(r,t.y+(e.y-t.y)*i)}function Ib(t,e,r){let i=(r-t.y)/(e.y-t.y);return new B(t.x+(e.x-t.x)*i,r)}function Pc(t,e,r,i){let n=[],a=t.image,s=a.pixelRatio,o=a.paddedRect.w-2,l=a.paddedRect.h-2,u={x1:t.left,y1:t.top,x2:t.right,y2:t.bottom},h=a.stretchX||[[0,o]],c=a.stretchY||[[0,l]],p=(F,$)=>F+$[1]-$[0],f=h.reduce(p,0),d=c.reduce(p,0),y=o-f,m=l-d,g=0,x=f,v=0,b=d,D=0,A=y,_=0,S=m;if(a.content&&i){let F=a.content,$=F[2]-F[0],U=F[3]-F[1];(a.textFitWidth||a.textFitHeight)&&(u=Xd(t)),g=ia(h,0,F[0]),v=ia(c,0,F[1]),x=ia(h,F[0],F[2]),b=ia(c,F[1],F[3]),D=F[0]-g,_=F[1]-v,A=$-x,S=U-b}let k=u.x1,z=u.y1,O=u.x2-k,P=u.y2-z,L=(F,$,U,T)=>{let q=na(F.stretch-g,x,O,k),at=aa(F.fixed-D,A,F.stretch,f),ot=na($.stretch-v,b,P,z),pt=aa($.fixed-_,S,$.stretch,d),Et=na(U.stretch-g,x,O,k),qt=aa(U.fixed-D,A,U.stretch,f),Ht=na(T.stretch-v,b,P,z),Ve=aa(T.fixed-_,S,T.stretch,d),ye=new B(q,ot),Kt=new B(Et,ot),Oe=new B(Et,Ht),kr=new B(q,Ht),rr=new B(at/s,pt/s),fi=new B(qt/s,Ve/s),kt=e*Math.PI/180;if(kt){let R=Math.sin(kt),J=Math.cos(kt),W=[J,-R,R,J];ye._matMult(W),Kt._matMult(W),kr._matMult(W),Oe._matMult(W)}let Ee=F.stretch+F.fixed,ir=U.stretch+U.fixed,Tr=$.stretch+$.fixed,Ir=T.stretch+T.fixed;return{tl:ye,tr:Kt,bl:kr,br:Oe,tex:{x:a.paddedRect.x+1+Ee,y:a.paddedRect.y+1+Tr,w:ir-Ee,h:Ir-Tr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:rr,pixelOffsetBR:fi,minFontScaleX:A/s/O,minFontScaleY:S/s/P,isSDF:r}};if(!i||!a.stretchX&&!a.stretchY)n.push(L({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:o+1},{fixed:0,stretch:l+1}));else{let F=zc(h,y,f),$=zc(c,m,d);for(let U=0;U0&&(d=Math.max(10,d),this.circleDiameter=d)}else{let c=(h=a.image)!=null&&h.content&&(a.image.textFitWidth||a.image.textFitHeight)?Xd(a):{x1:a.left,y1:a.top,x2:a.right,y2:a.bottom};c.y1=c.y1*s-o[0],c.y2=c.y2*s+o[2],c.x1=c.x1*s-o[3],c.x2=c.x2*s+o[1];let p=a.collisionPadding;if(p&&(c.x1-=p[0]*s,c.y1-=p[1]*s,c.x2+=p[2]*s,c.y2+=p[3]*s),u){let f=new B(c.x1,c.y1),d=new B(c.x2,c.y1),y=new B(c.x1,c.y2),m=new B(c.x2,c.y2),g=u*Math.PI/180;f._rotate(g),d._rotate(g),y._rotate(g),m._rotate(g),c.x1=Math.min(f.x,d.x,y.x,m.x),c.x2=Math.max(f.x,d.x,y.x,m.x),c.y1=Math.min(f.y,d.y,y.y,m.y),c.y2=Math.max(f.y,d.y,y.y,m.y)}t.emplaceBack(e.x,e.y,c.x1,c.y1,c.x2,c.y2,r,i,n)}this.boxEndIndex=t.length}},Mb=class{constructor(t=[],e=(r,i)=>ri)){if(this.data=t,this.length=this.data.length,this.compare=e,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;let t=this.data[0],e=this.data.pop();return--this.length>0&&(this.data[0]=e,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:e,compare:r}=this,i=e[t];for(;t>0;){let n=t-1>>1,a=e[n];if(r(i,a)>=0)break;e[t]=a,t=n}e[t]=i}_down(t){let{data:e,compare:r}=this,i=this.length>>1,n=e[t];for(;t=0)break;e[t]=e[a],t=a}e[t]=n}};function Bb(t,e=1){let r=Fa.fromPoints(t[0]),i=Math.min(r.width(),r.height()),n=i/2,a=new Mb([],Pb),{minX:s,minY:o,maxX:l,maxY:u}=r;if(i===0)return new B(s,o);for(let p=s;pc.d||!c.d)&&(c=p),!(p.max-c.d<=e)&&(n=p.h/2,a.push(new qr(p.p.x-n,p.p.y-n,n,t)),a.push(new qr(p.p.x+n,p.p.y-n,n,t)),a.push(new qr(p.p.x-n,p.p.y+n,n,t)),a.push(new qr(p.p.x+n,p.p.y+n,n,t)))}return h.d>0&&c.d-h.d<=e?h.p:c.p}function Pb(t,e){return e.max-t.max}var qr=class{constructor(t,e,r,i){this.p=new B(t,e),this.h=r,this.d=zb(this.p,i),this.max=this.d+this.h*Math.SQRT2}};function zb(t,e){let r=!1,i=1/0;for(let n of e)for(let a=0,s=n.length,o=s-1;at.y!=u.y>t.y&&t.x<(u.x-l.x)*(t.y-l.y)/(u.y-l.y)+l.x&&(r=!r),i=Math.min(i,td(t,l,u))}return(r?1:-1)*Math.sqrt(i)}function Lb(t){let e=0,r=0,i=0,n=t[0];for(let a=0,s=n.length,o=s-1;ap*24);h.startsWith("top")?c[1]-=7:h.startsWith("bottom")&&(c[1]+=7),l[u+1]=c}return new De(l)}let a=i.get("text-variable-anchor");if(a){let o;o=t._unevaluatedLayout.getValue("text-radial-offset")===void 0?i.get("text-offset").evaluate(e,{},r).map(u=>u*24):[i.get("text-radial-offset").evaluate(e,{},r)*24,lu];let l=[];for(let u of a)l.push(u,ty(u,o));return new De(l)}return null}function Ob(t){var h,c;t.bucket.createArrays();let e=512*t.bucket.overscaling;t.bucket.tilePixelRatio=mt/e,t.bucket.compareText={},t.bucket.iconsNeedLinear=!1;let r=t.bucket.layers[0],i=r.layout,n=r._unevaluatedLayout._values,a={layoutIconSize:n["icon-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new st(t.bucket.zoom+1),t.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new st(18))};if(t.bucket.textSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.textSizeData;a.compositeTextSizes=[n["text-size"].possiblyEvaluate(new st(p),t.canonical),n["text-size"].possiblyEvaluate(new st(f),t.canonical)]}if(t.bucket.iconSizeData.kind==="composite"){let{minZoom:p,maxZoom:f}=t.bucket.iconSizeData;a.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new st(p),t.canonical),n["icon-size"].possiblyEvaluate(new st(f),t.canonical)]}let s=i.get("text-line-height")*24,o=i.get("text-rotation-alignment")!=="viewport"&&i.get("symbol-placement")!=="point",l=i.get("text-keep-upright"),u=i.get("text-size");for(let p of t.bucket.features){let f=i.get("text-font").evaluate(p,{},t.canonical).join(","),d=u.evaluate(p,{},t.canonical),y=a.layoutTextSize.evaluate(p,{},t.canonical),m=a.layoutIconSize.evaluate(p,{},t.canonical),g={horizontal:{},vertical:void 0},x=p.text,v=[0,0];if(x){let _=x.toString(),S=i.get("text-letter-spacing").evaluate(p,{},t.canonical)*24,k=bv(_)?S:0,z=i.get("text-anchor").evaluate(p,{},t.canonical),O=ey(r,p,t.canonical);if(!O){let $=i.get("text-radial-offset").evaluate(p,{},t.canonical);v=$?ty(z,[$*24,lu]):i.get("text-offset").evaluate(p,{},t.canonical).map(U=>U*24)}let P=o?"center":i.get("text-justify").evaluate(p,{},t.canonical),L=i.get("symbol-placement")==="point"?i.get("text-max-width").evaluate(p,{},t.canonical)*24:1/0,F=()=>{t.bucket.allowVerticalPlacement&&el(_)&&(g.vertical=ra(x,t.glyphMap,t.glyphPositions,t.imagePositions,f,L,s,z,"left",k,v,2,!0,y,d))};if(!o&&O){let $=new Set;if(P==="auto")for(let T=0;T{T.x<0||T.x>=8192||T.y<0||T.y>=8192||Nb(t,T,U,r,i,n,L,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,g,[D,D,D,D],S,l,v,A,k,d,e,a,u,h,s)};if(z==="line")for(let U of Eb(e.geometry,0,0,mt,mt)){let T=cr(U,F),q=Sb(T,b,_,r.vertical||y,i,24,x,t.overscaling,mt);for(let at of q){let ot=y;(!ot||!Ub(t,ot.text,O,at))&&$(T,at)}}else if(z==="line-center"){for(let U of e.geometry)if(U.length>1){let T=cr(U,F),q=Ab(T,_,r.vertical||y,i,24,x);q&&$(T,q)}}else if(e.type==="Polygon")for(let U of Ra(e.geometry,0)){let T=Bb(U,16);$(cr(U[0],F,!0),new Jr(T.x,T.y,0))}else if(e.type==="LineString")for(let U of e.geometry){let T=cr(U,F);$(T,new Jr(T[0].x,T[0].y,0))}else if(e.type==="Point")for(let U of e.geometry)for(let T of U)$([T],new Jr(T.x,T.y,0))}function $b(t,e){let r=t.length,i=e==null?void 0:e.values;if((i==null?void 0:i.length)>0)for(let n=0;n32640&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):g.kind==="composite"&&(x=[128*d.compositeTextSizes[0].evaluate(s,{},y),128*d.compositeTextSizes[1].evaluate(s,{},y)],(x[0]>32640||x[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),t.addSymbols(t.text,m,x,o,a,s,h,e,u.lineStartIndex,u.lineLength,f,y,l);for(let v of c)p[v]=t.text.placedSymbolArray.length-1;return m.length*4}function ry(t){for(let e in t)return t[e];return null}function Nb(t,e,r,i,n,a,s,o,l,u,h,c,p,f,d,y,m,g,x,v,b,D,A,_,S){let k=t.addToLineVertexArray(e,r),z=o.layout.get("symbol-height-offset").evaluate(b,{},_);z>t.maxHeightOffset&&(t.maxHeightOffset=z);let O,P,L,F,$=0,U=0,T=0,q=0,at=-1,ot=-1,pt={},Et=(0,Mo.default)("");if(t.allowVerticalPlacement&&i.vertical){let J=o.layout.get("text-rotate").evaluate(b,{},_)+90,W=i.vertical;L=new sa(l,e,u,h,c,W,p,f,d,J),s&&(F=new sa(l,e,u,h,c,s,m,g,d,J))}if(n){let J=o.layout.get("icon-rotate").evaluate(b,{}),W=o.layout.get("icon-text-fit")!=="none",M=Pc(n,J,A,W),ut=s?Pc(s,J,A,W):void 0;P=new sa(l,e,u,h,c,n,m,g,!1,J),$=M.length*4;let X=t.iconSizeData,G=null;X.kind==="source"?(G=[128*o.layout.get("icon-size").evaluate(b,{})],G[0]>32640&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):X.kind==="composite"&&(G=[128*D.compositeIconSizes[0].evaluate(b,{},_),128*D.compositeIconSizes[1].evaluate(b,{},_)],(G[0]>32640||G[1]>32640)&&Bt(`${t.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),t.addSymbols(t.icon,M,G,v,x,b,0,e,k.lineStartIndex,k.lineLength,-1,_,z),at=t.icon.placedSymbolArray.length-1,ut&&(U=ut.length*4,t.addSymbols(t.icon,ut,G,v,x,b,2,e,k.lineStartIndex,k.lineLength,-1,_,z),ot=t.icon.placedSymbolArray.length-1)}let qt=Object.keys(i.horizontal);for(let J of qt){let W=i.horizontal[J];O||(O=(Et=(0,Mo.default)(W.text),new sa(l,e,u,h,c,W,p,f,d,o.layout.get("text-rotate").evaluate(b,{},_))));let M=W.positionedLines.length===1;if(T+=Vc(t,e,W,a,o,d,b,y,z,k,i.vertical?1:3,M?qt:[J],pt,at,D,_),M)break}i.vertical&&(q+=Vc(t,e,i.vertical,a,o,d,b,y,z,k,2,["vertical"],pt,ot,D,_));let Ht=O?O.boxStartIndex:t.collisionBoxArray.length,Ve=O?O.boxEndIndex:t.collisionBoxArray.length,ye=L?L.boxStartIndex:t.collisionBoxArray.length,Kt=L?L.boxEndIndex:t.collisionBoxArray.length,Oe=P?P.boxStartIndex:t.collisionBoxArray.length,kr=P?P.boxEndIndex:t.collisionBoxArray.length,rr=F?F.boxStartIndex:t.collisionBoxArray.length,fi=F?F.boxEndIndex:t.collisionBoxArray.length,kt=-1,Ee=(J,W)=>J!=null&&J.circleDiameter?Math.max(J.circleDiameter,W):W;kt=Ee(O,kt),kt=Ee(L,kt),kt=Ee(P,kt),kt=Ee(F,kt);let ir=+(kt>-1);ir&&(kt*=S/24),t.glyphOffsetArray.length>=t.maxGlyphs&&Bt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),b.sortKey!==void 0&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey);let Tr=ey(o,b,_),[Ir,R]=$b(t.textAnchorOffsets,Tr);t.symbolInstances.emplaceBack(e.x,e.y,pt.right>=0?pt.right:-1,pt.center>=0?pt.center:-1,pt.left>=0?pt.left:-1,pt.vertical||-1,at,ot,Et,Ht,Ve,ye,Kt,Oe,kr,rr,fi,u,T,q,$,U,ir,0,p,kt,Ir,R,z)}function Ub(t,e,r,i){let n=t.compareText;if(!(e in n))n[e]=[];else{let a=n[e];for(let s=a.length-1;s>=0;s--)if(i.dist(a[s])s.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasDependencies=!0,this.hasRTLText=!1,this.maxHeightOffset=0,this.sortKeyRanges=[],this.collisionCircleArray=[],this.maxGlyphs=65535;let e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cc(this.zoom,e["text-size"]),this.iconSizeData=Cc(this.zoom,e["icon-size"]);let r=this.layers[0].layout,i=r.get("symbol-sort-key"),n=r.get("symbol-z-order");this.canOverlap=Oc(r,"text-overlap","text-allow-overlap")!=="never"||Oc(r,"icon-overlap","icon-allow-overlap")!=="never"||r.get("text-ignore-placement")||r.get("icon-ignore-placement"),this.sortFeaturesByKey=n!=="viewport-y"&&!i.isConstant();let a=n==="viewport-y"||n==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=a&&this.canOverlap,r.get("symbol-placement")==="point"&&(this.writingModes=r.get("text-writing-mode").map(s=>Nd[s])),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id),this.sourceID=t.sourceID}createArrays(){this.text=new al(new vr(this.layers,this.zoom,t=>t.startsWith("text"))),this.icon=new al(new vr(this.layers,this.zoom,t=>t.startsWith("icon"))),this.glyphOffsetArray=new Uf,this.lineVertexArray=new qf,this.symbolInstances=new Nf,this.textAnchorOffsets=new Gf}calculateGlyphDependencies(t,e,r,i,n){var l;let a=(i||this.allowVerticalPlacement)&&n,s=iu.fromFeature(t,r),o=s.graphemes();for(let u=0;u0)&&(a.value.kind!=="constant"||a.value.value.length>0),u=o.value.kind!=="constant"||!!o.value.value||Object.keys(o.parameters).length>0,h=n.get("symbol-sort-key");if(this.features=[],!l&&!u)return;let c=e.iconDependencies,p=e.glyphDependencies,f=e.availableImages,d=new st(this.zoom);for(let{feature:m,id:g,index:x,sourceLayerIndex:v}of t){let b=i._featureFilter.needGeometry,D=hi(m,b);if(!i._featureFilter.filter(d,D,r))continue;b||(D.geometry=Ar(m));let A;if(l){let z=i.getValueAndResolveTokens("text-field",D,r,f),O=ze.factory(z);this.hasRTLText||(this.hasRTLText=Gb(O)),A=gv(O,i,D)}let _;if(u){let z=i.getValueAndResolveTokens("icon-image",D,r,f);_=z instanceof _e?z:_e.fromString(z)}if(!A&&!_)continue;let S=this.sortFeaturesByKey?h.evaluate(D,{},r):void 0,k={id:g,text:A,icon:_,index:x,sourceLayerIndex:v,geometry:D.geometry,properties:m.properties,type:Dn.types[m.type],sortKey:S};if(this.features.push(k),_&&(c[_.name]=!0),A){let z=a.evaluate(D,{},r).join(","),O=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point";this.allowVerticalPlacement=(y=this.writingModes)==null?void 0:y.includes(2);let P=el(A.toString());this.calculateGlyphDependencies(A,p,z,O,P);for(let L of A.sections)L.image&&(c[L.image.name]=!0)}}n.get("symbol-placement")==="line"&&(this.features=xv(this.features)),this.sortFeaturesByKey&&this.features.sort((m,g)=>m.sortKey-g.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,{imagePositions:r}))}addFeatures({options:t,canonical:e,glyphMap:r,glyphPositions:i,iconMap:n,iconPositions:a,showCollisionBoxes:s}){Ob({bucket:this,glyphMap:r,glyphPositions:i,imageMap:n,imagePositions:a,showCollisionBoxes:s,canonical:e,subdivisionGranularity:t.subdivisionGranularity})}isEmpty(){return this.symbolInstances.length===0}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),n=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:n},s>0&&(n+=e[s-1].dist(e[s]));for(let s=0;s0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let n=r.vertexStartIndex;ni[s]-i[o]||n[o]-n[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];(r==null?void 0:r.sortKey)===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex);let i=[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex];for(let n=0;n=0&&i.indexOf(a)===n&&this.addIndicesForPlacedSymbol(this.text,a)}r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};C("SymbolBucket",iy,{omit:["layers","collisionBoxArray","features","compareText"]});function Xb(t,e){return e.replace(/{([^{}]+)}/g,(r,i)=>t&&i in t?String(t[i]):"")}var Yb,Wb=()=>Yb||(Yb=new Xt({"symbol-placement":new V(w.layout_symbol["symbol-placement"],"symbol-placement"),"symbol-spacing":new V(w.layout_symbol["symbol-spacing"],"symbol-spacing"),"symbol-avoid-edges":new V(w.layout_symbol["symbol-avoid-edges"],"symbol-avoid-edges"),"symbol-sort-key":new N(w.layout_symbol["symbol-sort-key"],"symbol-sort-key"),"symbol-z-order":new V(w.layout_symbol["symbol-z-order"],"symbol-z-order"),"icon-allow-overlap":new V(w.layout_symbol["icon-allow-overlap"],"icon-allow-overlap"),"icon-overlap":new V(w.layout_symbol["icon-overlap"],"icon-overlap"),"icon-ignore-placement":new V(w.layout_symbol["icon-ignore-placement"],"icon-ignore-placement"),"icon-optional":new V(w.layout_symbol["icon-optional"],"icon-optional"),"icon-rotation-alignment":new N(w.layout_symbol["icon-rotation-alignment"],"icon-rotation-alignment"),"icon-size":new N(w.layout_symbol["icon-size"],"icon-size"),"icon-text-fit":new V(w.layout_symbol["icon-text-fit"],"icon-text-fit"),"icon-text-fit-padding":new V(w.layout_symbol["icon-text-fit-padding"],"icon-text-fit-padding"),"icon-image":new N(w.layout_symbol["icon-image"],"icon-image"),"icon-rotate":new N(w.layout_symbol["icon-rotate"],"icon-rotate"),"icon-padding":new N(w.layout_symbol["icon-padding"],"icon-padding"),"icon-keep-upright":new V(w.layout_symbol["icon-keep-upright"],"icon-keep-upright"),"icon-offset":new N(w.layout_symbol["icon-offset"],"icon-offset"),"icon-anchor":new N(w.layout_symbol["icon-anchor"],"icon-anchor"),"icon-pitch-alignment":new V(w.layout_symbol["icon-pitch-alignment"],"icon-pitch-alignment"),"text-pitch-alignment":new V(w.layout_symbol["text-pitch-alignment"],"text-pitch-alignment"),"text-rotation-alignment":new V(w.layout_symbol["text-rotation-alignment"],"text-rotation-alignment"),"text-field":new N(w.layout_symbol["text-field"],"text-field"),"text-font":new N(w.layout_symbol["text-font"],"text-font"),"text-size":new N(w.layout_symbol["text-size"],"text-size"),"text-max-width":new N(w.layout_symbol["text-max-width"],"text-max-width"),"text-line-height":new V(w.layout_symbol["text-line-height"],"text-line-height"),"text-letter-spacing":new N(w.layout_symbol["text-letter-spacing"],"text-letter-spacing"),"text-justify":new N(w.layout_symbol["text-justify"],"text-justify"),"text-radial-offset":new N(w.layout_symbol["text-radial-offset"],"text-radial-offset"),"text-variable-anchor":new V(w.layout_symbol["text-variable-anchor"],"text-variable-anchor"),"text-variable-anchor-offset":new N(w.layout_symbol["text-variable-anchor-offset"],"text-variable-anchor-offset"),"text-anchor":new N(w.layout_symbol["text-anchor"],"text-anchor"),"text-max-angle":new V(w.layout_symbol["text-max-angle"],"text-max-angle"),"text-writing-mode":new V(w.layout_symbol["text-writing-mode"],"text-writing-mode"),"text-rotate":new N(w.layout_symbol["text-rotate"],"text-rotate"),"text-padding":new V(w.layout_symbol["text-padding"],"text-padding"),"text-keep-upright":new V(w.layout_symbol["text-keep-upright"],"text-keep-upright"),"text-transform":new N(w.layout_symbol["text-transform"],"text-transform"),"text-offset":new N(w.layout_symbol["text-offset"],"text-offset"),"text-allow-overlap":new V(w.layout_symbol["text-allow-overlap"],"text-allow-overlap"),"text-overlap":new V(w.layout_symbol["text-overlap"],"text-overlap"),"text-ignore-placement":new V(w.layout_symbol["text-ignore-placement"],"text-ignore-placement"),"text-optional":new V(w.layout_symbol["text-optional"],"text-optional"),"symbol-height-offset":new N(w.layout_symbol["symbol-height-offset"],"symbol-height-offset"),"symbol-height-anchor":new V(w.layout_symbol["symbol-height-anchor"],"symbol-height-anchor")})),Zb,Hb=()=>Zb||(Zb=new Xt({"icon-opacity":new N(w.paint_symbol["icon-opacity"],"icon-opacity"),"icon-color":new N(w.paint_symbol["icon-color"],"icon-color"),"icon-halo-color":new N(w.paint_symbol["icon-halo-color"],"icon-halo-color"),"icon-halo-width":new N(w.paint_symbol["icon-halo-width"],"icon-halo-width"),"icon-halo-blur":new N(w.paint_symbol["icon-halo-blur"],"icon-halo-blur"),"icon-translate":new V(w.paint_symbol["icon-translate"],"icon-translate"),"icon-translate-anchor":new V(w.paint_symbol["icon-translate-anchor"],"icon-translate-anchor"),"text-opacity":new N(w.paint_symbol["text-opacity"],"text-opacity"),"text-color":new N(w.paint_symbol["text-color"],"text-color",{runtimeType:ce,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new N(w.paint_symbol["text-halo-color"],"text-halo-color"),"text-halo-width":new N(w.paint_symbol["text-halo-width"],"text-halo-width"),"text-halo-blur":new N(w.paint_symbol["text-halo-blur"],"text-halo-blur"),"text-translate":new V(w.paint_symbol["text-translate"],"text-translate"),"text-translate-anchor":new V(w.paint_symbol["text-translate-anchor"],"text-translate-anchor")})),Ys={get paint(){return Hb()},get layout(){return Wb()}},ny=class{constructor(t){if(t.property.overrides===void 0)throw Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:dn,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e!=null&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};C("FormatSectionOverride",ny,{omit:["defaultValue"]});var Kb=class ol extends de{constructor(e,r){super(e,Ys,r)}recalculate(e,r){super.recalculate(e,r);let i=this.layout.get("icon-rotation-alignment");if((i.value.kind!=="constant"||i.value.value==="auto")&&(this.layout._values["icon-rotation-alignment"]=new se(i.property,{kind:"constant",value:this.layout.get("symbol-placement")==="point"?"viewport":"map"},i.parameters)),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")==="point"?this.layout._values["text-rotation-alignment"]="viewport":this.layout._values["text-rotation-alignment"]="map"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment").constantOr("viewport")),this.layout.get("symbol-placement")==="point"){let n=this.layout.get("text-writing-mode");if(n){let a=[];for(let s of n)a.includes(s)||a.push(s);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,n){let a=this.layout.get(e).evaluate(r,{},i,n),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!ja(s.value)&&a?Xb(r.properties,a):a}createBucket(e){return new iy(e)}queryRadius(){return 0}queryIntersectsFeature(){throw Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Ys.paint.overridableProperties){if(!ol.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new Il(new ny(r),`layers[${this.id}].paint.${r.property.name}`,r.property.specification),n=null;n=r.value.kind==="constant"||r.value.kind==="source"?new an("source",i):new wa("composite",i,r.value.zoomStops),this.paint._values[e]=new se(r.property,n,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:ol.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),n=Ys.paint.properties[r],a=!1,s=o=>{var l;for(let u of o)if((l=n.overrides)!=null&&l.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof ze)s(i.value.value.sections);else if(i.value.kind==="source"||i.value.kind==="composite"){let o=u=>{if(!a)if(u instanceof ri&&_t(u.value)===yn){let h=u.value;s(h.sections)}else u instanceof Ep?s(u.sections):u.eachChild(o)},l=i.value;l._styleExpression&&o(l._styleExpression.expression)}return a}};function Jb(t,e,r,i=1){var a;let n=(a=t.get("icon-padding").evaluate(e,{},r))==null?void 0:a.values;return[n[0]*i,n[1]*i,n[2]*i,n[3]*i]}var Qb,tw=()=>Qb||(Qb=new Xt({"background-color":new V(w.paint_background["background-color"],"background-color"),"background-pattern":new Lf(w.paint_background["background-pattern"],"background-pattern"),"background-opacity":new V(w.paint_background["background-opacity"],"background-opacity")})),ew={get paint(){return tw()}};var rw=class extends de{constructor(t,e){super(t,ew,e)}};var iw=class extends de{constructor(t,e){super(t,{},e),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw Error("Custom layers cannot be serialized")}};function ay(t,e){if(t.type==="custom")return new iw(t,e);switch(t.type){case"background":return new rw(t,e);case"circle":return new Bg(t,e);case"color-relief":return new Yg(t,e);case"fill":return new Ex(t,e);case"fill-extrusion":return new Hx(t,e);case"heatmap":return new Rg(t,e);case"hillshade":return new qg(t,e);case"line":return new G2(t,e);case"raster":return new Xm(t,e);case"symbol":return new Kb(t,e)}}var nw=class{constructor(t){this._methodToThrottle=t,this._triggered=!1,this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()}}trigger(){var t;this._triggered||(this._triggered=!0,(t=this._channel)==null||t.port1.postMessage(!0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}},aw={once:!0},sy=class{constructor(t,e){this.target=t,this.mapId=e,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new nw(()=>this.process()),this.subscription=hh(this.target,"message",r=>this.receive(r),!1),this.globalScope=mr(self)?t:window}registerMessageHandler(t,e){this.messageHandlers[t]=e}unregisterMessageHandler(t){delete this.messageHandlers[t]}sendAsync(t,e){return new Promise((r,i)=>{let n=Math.round(Math.random()*1e18).toString(36).substring(0,10),a=e?hh(e.signal,"abort",()=>{a==null||a.unsubscribe(),delete this.resolveRejects[n];let l={id:n,type:"",origin:location.origin,targetMapId:t.targetMapId,sourceMapId:this.mapId};this.target.postMessage(l),i(new dl(e.signal.reason))},aw):null;this.resolveRejects[n]={resolve:l=>{a==null||a.unsubscribe(),r(l)},reject:l=>{a==null||a.unsubscribe(),i(l)}};let s=[],o=Si(je({},t),{id:n,sourceMapId:this.mapId,origin:location.origin,data:Yi(t.data,s)});this.target.postMessage(o,{transfer:s})})}receive(t){let e=t.data,r=e.id,i=["file://","resource://android","null"],n=[e.origin,location.origin],a=e.origin===location.origin,s=n.some(o=>i.includes(o));if((a||s)&&!(e.targetMapId&&this.mapId!==e.targetMapId)){if(e.type===""){delete this.tasks[r];let o=this.abortControllers[r];delete this.abortControllers[r],o&&o.abort();return}if(mr(self)||e.mustQueue){this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger();return}this.processTask(r,e)}}process(){if(this.taskQueue.length===0)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length>0&&this.invoker.trigger(),e&&this.processTask(t,e)}processTask(t,e){return rt(this,null,function*(){if(e.type===""){let n=this.resolveRejects[t];if(delete this.resolveRejects[t],!n)return;e.error?n.reject(Ki(Wi(e.error))):n.resolve(Wi(e.data));return}if(!this.messageHandlers[e.type]){this.completeTask(t,null,null);return}let r=Wi(e.data),i=new AbortController;this.abortControllers[t]=i;try{let n=yield this.messageHandlers[e.type](e.sourceMapId,r,i);this.completeTask(t,null,n)}catch(n){this.completeTask(t,Ki(n))}})}completeTask(t,e,r){let i=[];delete this.abortControllers[t];let n={id:t,type:"",sourceMapId:this.mapId,origin:location.origin,error:e?Yi(e):null,data:Yi(r,i)};this.target.postMessage(n,{transfer:i})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}};function sw(t,e,r){return!(t<0||t>25||r<0||r>=2**t||e<0||e>=2**t)}var oy=class{constructor(t,e,r){if(!sw(t,e,r))throw Error(`x=${e}, y=${r}, z=${t} outside of bounds. 0<=x<${2**t}, 0<=y<${2**t} 0<=z<=25 `);this.z=t,this.x=e,this.y=r,this.key=Hi(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=lw(this.x,this.y,this.z),n=uw(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(r==="tms"?2**this.z-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,n).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=2**this.z;return new B((t.x*e-this.x)*mt,(t.y*e-this.y)*mt)}toString(){return`${this.z}/${this.x}/${this.y}`}},ow=class{constructor(t,e){this.wrap=t,this.canonical=e,this.key=Hi(t,e.z,e.z,e.x,e.y)}},uu=class ne{constructor(e,r,i,n,a){if(this.terrainRttPosMatrix32f=null,e= z; overscaledZ = ${e}; z = ${i}`);this.overscaledZ=e,this.wrap=r,this.canonical=new oy(i,+n,+a),this.key=Hi(r,e,i,n,a)}clone(){return new ne(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let r=this.canonical.z-e;return e>this.canonical.z?new ne(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ne(e,this.wrap,e,this.canonical.x>>r,this.canonical.y>>r)}isOverscaled(){return this.overscaledZ>this.canonical.z}calculateScaledKey(e,r){if(e>this.overscaledZ)throw Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);let i=this.canonical.z-e;return e>this.canonical.z?Hi(this.wrap*+r,e,this.canonical.z,this.canonical.x,this.canonical.y):Hi(this.wrap*+r,e,e,this.canonical.x>>i,this.canonical.y>>i)}isChildOf(e){if(e.wrap!==this.wrap||this.overscaledZ-e.overscaledZ<=0)return!1;if(e.overscaledZ===0)return this.overscaledZ>0;let r=this.canonical.z-e.canonical.z;return r<0?!1:e.canonical.x===this.canonical.x>>r&&e.canonical.y===this.canonical.y>>r}children(e){if(this.overscaledZ>=e)return[new ne(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,i=this.canonical.x*2,n=this.canonical.y*2;return[new ne(r,this.wrap,r,i,n),new ne(r,this.wrap,r,i+1,n),new ne(r,this.wrap,r,i,n+1),new ne(r,this.wrap,r,i+1,n+1)]}isLessThan(e){return this.wrape.wrap?!1:this.overscaledZe.overscaledZ?!1:this.canonical.xe.canonical.x?!1:this.canonical.y=0&&e=0&&r=u)return null;let c=this.canonical.x+n,p=this.wrap;return c<0?(p-=Math.ceil(-c/u),c=(c%u+u)%u):c>=u&&(p+=Math.floor(c/u),c%=u),{tileID:new ne(this.overscaledZ,p,l,c,h),x:s,y:o}}};function Hi(t,e,r,i,n){t*=2,t<0&&(t=t*-1-1);let a=1<0;n--){let a=1<pw(n,a,r),t.layers[i])}function pw(t,e,r=""){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);let i={jsonPrefix:r,keys:[],values:[],keycache:{},valuecache:{}};for(let s=0;s>31}function yw(t,e){let r=t.loadGeometry(),i=t.type,n=0,a=0;for(let s of r){let o=1;i===1&&(o=s.length),e.writeVarint(Zs(1,o));let l=i===3?s.length-1:s.length;for(let u=0;u=this._numberToString.length)throw Error(`Out of bounds. Index requested n=${t} can\'t be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}},gw=class{constructor(t,e,r,i,n){this.type="Feature",this._vectorTileFeature=t,this._x=r,this._y=i,this._z=e;for(let a in t.properties)typeof t.properties[a]=="string"&&t.properties[a].startsWith("__$json__:")&&(t.properties[a]=JSON.parse(t.properties[a].slice(10)));this.properties=t.properties,this.id=n}projectPoint(t,e,r,i){return[(t.x+e)*360/i-180,360/Math.PI*Math.atan(Math.exp((1-(t.y+r)*2/i)*Math.PI))-90]}projectLine(t,e,r,i){return t.map(n=>this.projectPoint(n,e,r,i))}get geometry(){if(this._geometry)return this._geometry;let t=this._vectorTileFeature,e=t.extent*2**this._z,r=t.extent*this._x,i=t.extent*this._y,n=t.loadGeometry();switch(t.type){case 1:{let a=[];for(let o of n)a.push(o[0]);let s=this.projectLine(a,r,i,e);this._geometry=a.length===1?{type:"Point",coordinates:s[0]}:{type:"MultiPoint",coordinates:s};break}case 2:{let a=n.map(s=>this.projectLine(s,r,i,e));this._geometry=a.length===1?{type:"LineString",coordinates:a[0]}:{type:"MultiLineString",coordinates:a};break}case 3:{let a=dd(n),s=[];for(let o of a)s.push(o.map(l=>this.projectLine(l,r,i,e)));this._geometry=s.length===1?{type:"Polygon",coordinates:s[0]}:{type:"MultiPolygon",coordinates:s};break}default:throw Error(`unknown feature type: ${t.type}`)}return this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e!=="_geometry"&&e!=="_vectorTileFeature"&&e!=="_x"&&e!=="_y"&&e!=="_z"&&(t[e]=this[e]);return t}},Sr=class{constructor(t,e,r){this._name=t,this.dataBuffer=e,typeof r=="number"?this._size=r:(this.nullabilityBuffer=r,this._size=r.size())}getValue(t){return this.nullabilityBuffer&&!this.nullabilityBuffer.get(t)?null:this.getValueFromBuffer(t)}has(t){var e;return((e=this.nullabilityBuffer)==null?void 0:e.get(t))||!this.nullabilityBuffer}get name(){return this._name}get size(){return this._size}},ts=class extends Sr{},pu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},fu=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},uy=class extends Sr{constructor(t,e,r,i){super(t,e,i),this.delta=r}},du=class extends uy{constructor(t,e,r,i,n){super(t,n?Int32Array.of(e):Uint32Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+t*this.delta}},yu=class extends Sr{constructor(t,e,r,i){super(t,i?Int32Array.of(e):Uint32Array.of(e),r)}getValueFromBuffer(t){return this.dataBuffer[0]}},xw=class{constructor(t,e,r,i,n=4096){if(this._name=t,this._geometryVector=e,this._idVector=r,this._propertyVectors=i,this._extent=n,t.length===0)throw Error("Missing layer name")}get name(){return this._name}get idVector(){return this._idVector}get geometryVector(){return this._geometryVector}get propertyVectors(){var t;return(t=this._propertyVectors)!=null?t:[]}getPropertyVector(t){return this.propertyVectorsMap||(this.propertyVectorsMap=new Map(this.propertyVectors.map(e=>[e.name,e]))),this.propertyVectorsMap.get(t)}get numFeatures(){return this.geometryVector.numGeometries}get extent(){return this._extent}getFeatures(){let t=[],e=this.geometryVector.getGeometries();for(let r=0;r>>32-t;var ul=mu,py=65536;function gu(t,e){return t-t%e}function vw(t){return gu(t+31,32)}function bw(t){if(!Number.isFinite(t)||t<=0)return py;let e=gu(Math.floor(t),256);return e===0?256:e}function ww(t){let e=t>>>0;return((e&255)<<24|(e&65280)<<8|e>>>8&65280|e>>>24&255)>>>0}function Dw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0;r[n++]=a>>>0&3,r[n++]=a>>>2&3,r[n++]=a>>>4&3,r[n++]=a>>>6&3,r[n++]=a>>>8&3,r[n++]=a>>>10&3,r[n++]=a>>>12&3,r[n++]=a>>>14&3,r[n++]=a>>>16&3,r[n++]=a>>>18&3,r[n++]=a>>>20&3,r[n++]=a>>>22&3,r[n++]=a>>>24&3,r[n++]=a>>>26&3,r[n++]=a>>>28&3,r[n++]=a>>>30&3,r[n++]=s>>>0&3,r[n++]=s>>>2&3,r[n++]=s>>>4&3,r[n++]=s>>>6&3,r[n++]=s>>>8&3,r[n++]=s>>>10&3,r[n++]=s>>>12&3,r[n++]=s>>>14&3,r[n++]=s>>>16&3,r[n++]=s>>>18&3,r[n++]=s>>>20&3,r[n++]=s>>>22&3,r[n++]=s>>>24&3,r[n++]=s>>>26&3,r[n++]=s>>>28&3,r[n]=s>>>30&3}function _w(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0;r[n++]=a>>>0&7,r[n++]=a>>>3&7,r[n++]=a>>>6&7,r[n++]=a>>>9&7,r[n++]=a>>>12&7,r[n++]=a>>>15&7,r[n++]=a>>>18&7,r[n++]=a>>>21&7,r[n++]=a>>>24&7,r[n++]=a>>>27&7,r[n++]=(a>>>30|(s&1)<<2)&7,r[n++]=s>>>1&7,r[n++]=s>>>4&7,r[n++]=s>>>7&7,r[n++]=s>>>10&7,r[n++]=s>>>13&7,r[n++]=s>>>16&7,r[n++]=s>>>19&7,r[n++]=s>>>22&7,r[n++]=s>>>25&7,r[n++]=s>>>28&7,r[n++]=(s>>>31|(o&3)<<1)&7,r[n++]=o>>>2&7,r[n++]=o>>>5&7,r[n++]=o>>>8&7,r[n++]=o>>>11&7,r[n++]=o>>>14&7,r[n++]=o>>>17&7,r[n++]=o>>>20&7,r[n++]=o>>>23&7,r[n++]=o>>>26&7,r[n]=o>>>29&7}function Aw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0;r[n++]=a>>>0&15,r[n++]=a>>>4&15,r[n++]=a>>>8&15,r[n++]=a>>>12&15,r[n++]=a>>>16&15,r[n++]=a>>>20&15,r[n++]=a>>>24&15,r[n++]=a>>>28&15,r[n++]=s>>>0&15,r[n++]=s>>>4&15,r[n++]=s>>>8&15,r[n++]=s>>>12&15,r[n++]=s>>>16&15,r[n++]=s>>>20&15,r[n++]=s>>>24&15,r[n++]=s>>>28&15,r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n]=l>>>28&15}function Sw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0;r[n++]=a>>>0&31,r[n++]=a>>>5&31,r[n++]=a>>>10&31,r[n++]=a>>>15&31,r[n++]=a>>>20&31,r[n++]=a>>>25&31,r[n++]=(a>>>30|(s&7)<<2)&31,r[n++]=s>>>3&31,r[n++]=s>>>8&31,r[n++]=s>>>13&31,r[n++]=s>>>18&31,r[n++]=s>>>23&31,r[n++]=(s>>>28|(o&1)<<4)&31,r[n++]=o>>>1&31,r[n++]=o>>>6&31,r[n++]=o>>>11&31,r[n++]=o>>>16&31,r[n++]=o>>>21&31,r[n++]=o>>>26&31,r[n++]=(o>>>31|(l&15)<<1)&31,r[n++]=l>>>4&31,r[n++]=l>>>9&31,r[n++]=l>>>14&31,r[n++]=l>>>19&31,r[n++]=l>>>24&31,r[n++]=(l>>>29|(u&3)<<3)&31,r[n++]=u>>>2&31,r[n++]=u>>>7&31,r[n++]=u>>>12&31,r[n++]=u>>>17&31,r[n++]=u>>>22&31,r[n]=u>>>27&31}function Ew(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0;r[n++]=a>>>0&63,r[n++]=a>>>6&63,r[n++]=a>>>12&63,r[n++]=a>>>18&63,r[n++]=a>>>24&63,r[n++]=(a>>>30|(s&15)<<2)&63,r[n++]=s>>>4&63,r[n++]=s>>>10&63,r[n++]=s>>>16&63,r[n++]=s>>>22&63,r[n++]=(s>>>28|(o&3)<<4)&63,r[n++]=o>>>2&63,r[n++]=o>>>8&63,r[n++]=o>>>14&63,r[n++]=o>>>20&63,r[n++]=o>>>26&63,r[n++]=l>>>0&63,r[n++]=l>>>6&63,r[n++]=l>>>12&63,r[n++]=l>>>18&63,r[n++]=l>>>24&63,r[n++]=(l>>>30|(u&15)<<2)&63,r[n++]=u>>>4&63,r[n++]=u>>>10&63,r[n++]=u>>>16&63,r[n++]=u>>>22&63,r[n++]=(u>>>28|(h&3)<<4)&63,r[n++]=h>>>2&63,r[n++]=h>>>8&63,r[n++]=h>>>14&63,r[n++]=h>>>20&63,r[n]=h>>>26&63}function Fw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0;r[n++]=a>>>0&127,r[n++]=a>>>7&127,r[n++]=a>>>14&127,r[n++]=a>>>21&127,r[n++]=(a>>>28|(s&7)<<4)&127,r[n++]=s>>>3&127,r[n++]=s>>>10&127,r[n++]=s>>>17&127,r[n++]=s>>>24&127,r[n++]=(s>>>31|(o&63)<<1)&127,r[n++]=o>>>6&127,r[n++]=o>>>13&127,r[n++]=o>>>20&127,r[n++]=(o>>>27|(l&3)<<5)&127,r[n++]=l>>>2&127,r[n++]=l>>>9&127,r[n++]=l>>>16&127,r[n++]=l>>>23&127,r[n++]=(l>>>30|(u&31)<<2)&127,r[n++]=u>>>5&127,r[n++]=u>>>12&127,r[n++]=u>>>19&127,r[n++]=(u>>>26|(h&1)<<6)&127,r[n++]=h>>>1&127,r[n++]=h>>>8&127,r[n++]=h>>>15&127,r[n++]=h>>>22&127,r[n++]=(h>>>29|(c&15)<<3)&127,r[n++]=c>>>4&127,r[n++]=c>>>11&127,r[n++]=c>>>18&127,r[n]=c>>>25&127}function kw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0;r[n++]=a>>>0&255,r[n++]=a>>>8&255,r[n++]=a>>>16&255,r[n++]=a>>>24&255,r[n++]=s>>>0&255,r[n++]=s>>>8&255,r[n++]=s>>>16&255,r[n++]=s>>>24&255,r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n]=p>>>24&255}function Tw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0;r[n++]=a>>>0&511,r[n++]=a>>>9&511,r[n++]=a>>>18&511,r[n++]=(a>>>27|(s&15)<<5)&511,r[n++]=s>>>4&511,r[n++]=s>>>13&511,r[n++]=s>>>22&511,r[n++]=(s>>>31|(o&255)<<1)&511,r[n++]=o>>>8&511,r[n++]=o>>>17&511,r[n++]=(o>>>26|(l&7)<<6)&511,r[n++]=l>>>3&511,r[n++]=l>>>12&511,r[n++]=l>>>21&511,r[n++]=(l>>>30|(u&127)<<2)&511,r[n++]=u>>>7&511,r[n++]=u>>>16&511,r[n++]=(u>>>25|(h&3)<<7)&511,r[n++]=h>>>2&511,r[n++]=h>>>11&511,r[n++]=h>>>20&511,r[n++]=(h>>>29|(c&63)<<3)&511,r[n++]=c>>>6&511,r[n++]=c>>>15&511,r[n++]=(c>>>24|(p&1)<<8)&511,r[n++]=p>>>1&511,r[n++]=p>>>10&511,r[n++]=p>>>19&511,r[n++]=(p>>>28|(f&31)<<4)&511,r[n++]=f>>>5&511,r[n++]=f>>>14&511,r[n]=f>>>23&511}function Iw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0;r[n++]=a>>>0&1023,r[n++]=a>>>10&1023,r[n++]=a>>>20&1023,r[n++]=(a>>>30|(s&255)<<2)&1023,r[n++]=s>>>8&1023,r[n++]=s>>>18&1023,r[n++]=(s>>>28|(o&63)<<4)&1023,r[n++]=o>>>6&1023,r[n++]=o>>>16&1023,r[n++]=(o>>>26|(l&15)<<6)&1023,r[n++]=l>>>4&1023,r[n++]=l>>>14&1023,r[n++]=(l>>>24|(u&3)<<8)&1023,r[n++]=u>>>2&1023,r[n++]=u>>>12&1023,r[n++]=u>>>22&1023,r[n++]=h>>>0&1023,r[n++]=h>>>10&1023,r[n++]=h>>>20&1023,r[n++]=(h>>>30|(c&255)<<2)&1023,r[n++]=c>>>8&1023,r[n++]=c>>>18&1023,r[n++]=(c>>>28|(p&63)<<4)&1023,r[n++]=p>>>6&1023,r[n++]=p>>>16&1023,r[n++]=(p>>>26|(f&15)<<6)&1023,r[n++]=f>>>4&1023,r[n++]=f>>>14&1023,r[n++]=(f>>>24|(d&3)<<8)&1023,r[n++]=d>>>2&1023,r[n++]=d>>>12&1023,r[n]=d>>>22&1023}function Cw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0;r[n++]=a>>>0&2047,r[n++]=a>>>11&2047,r[n++]=(a>>>22|(s&1)<<10)&2047,r[n++]=s>>>1&2047,r[n++]=s>>>12&2047,r[n++]=(s>>>23|(o&3)<<9)&2047,r[n++]=o>>>2&2047,r[n++]=o>>>13&2047,r[n++]=(o>>>24|(l&7)<<8)&2047,r[n++]=l>>>3&2047,r[n++]=l>>>14&2047,r[n++]=(l>>>25|(u&15)<<7)&2047,r[n++]=u>>>4&2047,r[n++]=u>>>15&2047,r[n++]=(u>>>26|(h&31)<<6)&2047,r[n++]=h>>>5&2047,r[n++]=h>>>16&2047,r[n++]=(h>>>27|(c&63)<<5)&2047,r[n++]=c>>>6&2047,r[n++]=c>>>17&2047,r[n++]=(c>>>28|(p&127)<<4)&2047,r[n++]=p>>>7&2047,r[n++]=p>>>18&2047,r[n++]=(p>>>29|(f&255)<<3)&2047,r[n++]=f>>>8&2047,r[n++]=f>>>19&2047,r[n++]=(f>>>30|(d&511)<<2)&2047,r[n++]=d>>>9&2047,r[n++]=d>>>20&2047,r[n++]=(d>>>31|(y&1023)<<1)&2047,r[n++]=y>>>10&2047,r[n]=y>>>21&2047}function Mw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0;r[n++]=a>>>0&4095,r[n++]=a>>>12&4095,r[n++]=(a>>>24|(s&15)<<8)&4095,r[n++]=s>>>4&4095,r[n++]=s>>>16&4095,r[n++]=(s>>>28|(o&255)<<4)&4095,r[n++]=o>>>8&4095,r[n++]=o>>>20&4095,r[n++]=l>>>0&4095,r[n++]=l>>>12&4095,r[n++]=(l>>>24|(u&15)<<8)&4095,r[n++]=u>>>4&4095,r[n++]=u>>>16&4095,r[n++]=(u>>>28|(h&255)<<4)&4095,r[n++]=h>>>8&4095,r[n++]=h>>>20&4095,r[n++]=c>>>0&4095,r[n++]=c>>>12&4095,r[n++]=(c>>>24|(p&15)<<8)&4095,r[n++]=p>>>4&4095,r[n++]=p>>>16&4095,r[n++]=(p>>>28|(f&255)<<4)&4095,r[n++]=f>>>8&4095,r[n++]=f>>>20&4095,r[n++]=d>>>0&4095,r[n++]=d>>>12&4095,r[n++]=(d>>>24|(y&15)<<8)&4095,r[n++]=y>>>4&4095,r[n++]=y>>>16&4095,r[n++]=(y>>>28|(m&255)<<4)&4095,r[n++]=m>>>8&4095,r[n]=m>>>20&4095}function Bw(t,e,r,i){let n=i,a=t[e]>>>0,s=t[e+1]>>>0,o=t[e+2]>>>0,l=t[e+3]>>>0,u=t[e+4]>>>0,h=t[e+5]>>>0,c=t[e+6]>>>0,p=t[e+7]>>>0,f=t[e+8]>>>0,d=t[e+9]>>>0,y=t[e+10]>>>0,m=t[e+11]>>>0,g=t[e+12]>>>0,x=t[e+13]>>>0,v=t[e+14]>>>0,b=t[e+15]>>>0;r[n++]=a>>>0&65535,r[n++]=a>>>16&65535,r[n++]=s>>>0&65535,r[n++]=s>>>16&65535,r[n++]=o>>>0&65535,r[n++]=o>>>16&65535,r[n++]=l>>>0&65535,r[n++]=l>>>16&65535,r[n++]=u>>>0&65535,r[n++]=u>>>16&65535,r[n++]=h>>>0&65535,r[n++]=h>>>16&65535,r[n++]=c>>>0&65535,r[n++]=c>>>16&65535,r[n++]=p>>>0&65535,r[n++]=p>>>16&65535,r[n++]=f>>>0&65535,r[n++]=f>>>16&65535,r[n++]=d>>>0&65535,r[n++]=d>>>16&65535,r[n++]=y>>>0&65535,r[n++]=y>>>16&65535,r[n++]=m>>>0&65535,r[n++]=m>>>16&65535,r[n++]=g>>>0&65535,r[n++]=g>>>16&65535,r[n++]=x>>>0&65535,r[n++]=x>>>16&65535,r[n++]=v>>>0&65535,r[n++]=v>>>16&65535,r[n++]=b>>>0&65535,r[n]=b>>>16&65535}function Pw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0;r[n++]=o>>>0&1,r[n++]=o>>>1&1,r[n++]=o>>>2&1,r[n++]=o>>>3&1,r[n++]=o>>>4&1,r[n++]=o>>>5&1,r[n++]=o>>>6&1,r[n++]=o>>>7&1,r[n++]=o>>>8&1,r[n++]=o>>>9&1,r[n++]=o>>>10&1,r[n++]=o>>>11&1,r[n++]=o>>>12&1,r[n++]=o>>>13&1,r[n++]=o>>>14&1,r[n++]=o>>>15&1,r[n++]=o>>>16&1,r[n++]=o>>>17&1,r[n++]=o>>>18&1,r[n++]=o>>>19&1,r[n++]=o>>>20&1,r[n++]=o>>>21&1,r[n++]=o>>>22&1,r[n++]=o>>>23&1,r[n++]=o>>>24&1,r[n++]=o>>>25&1,r[n++]=o>>>26&1,r[n++]=o>>>27&1,r[n++]=o>>>28&1,r[n++]=o>>>29&1,r[n++]=o>>>30&1,r[n++]=o>>>31&1}}function zw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0;r[n++]=o>>>0&3,r[n++]=o>>>2&3,r[n++]=o>>>4&3,r[n++]=o>>>6&3,r[n++]=o>>>8&3,r[n++]=o>>>10&3,r[n++]=o>>>12&3,r[n++]=o>>>14&3,r[n++]=o>>>16&3,r[n++]=o>>>18&3,r[n++]=o>>>20&3,r[n++]=o>>>22&3,r[n++]=o>>>24&3,r[n++]=o>>>26&3,r[n++]=o>>>28&3,r[n++]=o>>>30&3,r[n++]=l>>>0&3,r[n++]=l>>>2&3,r[n++]=l>>>4&3,r[n++]=l>>>6&3,r[n++]=l>>>8&3,r[n++]=l>>>10&3,r[n++]=l>>>12&3,r[n++]=l>>>14&3,r[n++]=l>>>16&3,r[n++]=l>>>18&3,r[n++]=l>>>20&3,r[n++]=l>>>22&3,r[n++]=l>>>24&3,r[n++]=l>>>26&3,r[n++]=l>>>28&3,r[n++]=l>>>30&3}}function Lw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0;r[n++]=o>>>0&7,r[n++]=o>>>3&7,r[n++]=o>>>6&7,r[n++]=o>>>9&7,r[n++]=o>>>12&7,r[n++]=o>>>15&7,r[n++]=o>>>18&7,r[n++]=o>>>21&7,r[n++]=o>>>24&7,r[n++]=o>>>27&7,r[n++]=(o>>>30|(l&1)<<2)&7,r[n++]=l>>>1&7,r[n++]=l>>>4&7,r[n++]=l>>>7&7,r[n++]=l>>>10&7,r[n++]=l>>>13&7,r[n++]=l>>>16&7,r[n++]=l>>>19&7,r[n++]=l>>>22&7,r[n++]=l>>>25&7,r[n++]=l>>>28&7,r[n++]=(l>>>31|(u&3)<<1)&7,r[n++]=u>>>2&7,r[n++]=u>>>5&7,r[n++]=u>>>8&7,r[n++]=u>>>11&7,r[n++]=u>>>14&7,r[n++]=u>>>17&7,r[n++]=u>>>20&7,r[n++]=u>>>23&7,r[n++]=u>>>26&7,r[n++]=u>>>29&7}}function Vw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0;r[n++]=o>>>0&15,r[n++]=o>>>4&15,r[n++]=o>>>8&15,r[n++]=o>>>12&15,r[n++]=o>>>16&15,r[n++]=o>>>20&15,r[n++]=o>>>24&15,r[n++]=o>>>28&15,r[n++]=l>>>0&15,r[n++]=l>>>4&15,r[n++]=l>>>8&15,r[n++]=l>>>12&15,r[n++]=l>>>16&15,r[n++]=l>>>20&15,r[n++]=l>>>24&15,r[n++]=l>>>28&15,r[n++]=u>>>0&15,r[n++]=u>>>4&15,r[n++]=u>>>8&15,r[n++]=u>>>12&15,r[n++]=u>>>16&15,r[n++]=u>>>20&15,r[n++]=u>>>24&15,r[n++]=u>>>28&15,r[n++]=h>>>0&15,r[n++]=h>>>4&15,r[n++]=h>>>8&15,r[n++]=h>>>12&15,r[n++]=h>>>16&15,r[n++]=h>>>20&15,r[n++]=h>>>24&15,r[n++]=h>>>28&15}}function Ow(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0;r[n++]=o>>>0&31,r[n++]=o>>>5&31,r[n++]=o>>>10&31,r[n++]=o>>>15&31,r[n++]=o>>>20&31,r[n++]=o>>>25&31,r[n++]=(o>>>30|(l&7)<<2)&31,r[n++]=l>>>3&31,r[n++]=l>>>8&31,r[n++]=l>>>13&31,r[n++]=l>>>18&31,r[n++]=l>>>23&31,r[n++]=(l>>>28|(u&1)<<4)&31,r[n++]=u>>>1&31,r[n++]=u>>>6&31,r[n++]=u>>>11&31,r[n++]=u>>>16&31,r[n++]=u>>>21&31,r[n++]=u>>>26&31,r[n++]=(u>>>31|(h&15)<<1)&31,r[n++]=h>>>4&31,r[n++]=h>>>9&31,r[n++]=h>>>14&31,r[n++]=h>>>19&31,r[n++]=h>>>24&31,r[n++]=(h>>>29|(c&3)<<3)&31,r[n++]=c>>>2&31,r[n++]=c>>>7&31,r[n++]=c>>>12&31,r[n++]=c>>>17&31,r[n++]=c>>>22&31,r[n++]=c>>>27&31}}function Rw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0;r[n++]=o>>>0&63,r[n++]=o>>>6&63,r[n++]=o>>>12&63,r[n++]=o>>>18&63,r[n++]=o>>>24&63,r[n++]=(o>>>30|(l&15)<<2)&63,r[n++]=l>>>4&63,r[n++]=l>>>10&63,r[n++]=l>>>16&63,r[n++]=l>>>22&63,r[n++]=(l>>>28|(u&3)<<4)&63,r[n++]=u>>>2&63,r[n++]=u>>>8&63,r[n++]=u>>>14&63,r[n++]=u>>>20&63,r[n++]=u>>>26&63,r[n++]=h>>>0&63,r[n++]=h>>>6&63,r[n++]=h>>>12&63,r[n++]=h>>>18&63,r[n++]=h>>>24&63,r[n++]=(h>>>30|(c&15)<<2)&63,r[n++]=c>>>4&63,r[n++]=c>>>10&63,r[n++]=c>>>16&63,r[n++]=c>>>22&63,r[n++]=(c>>>28|(p&3)<<4)&63,r[n++]=p>>>2&63,r[n++]=p>>>8&63,r[n++]=p>>>14&63,r[n++]=p>>>20&63,r[n++]=p>>>26&63}}function $w(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0;r[n++]=o>>>0&127,r[n++]=o>>>7&127,r[n++]=o>>>14&127,r[n++]=o>>>21&127,r[n++]=(o>>>28|(l&7)<<4)&127,r[n++]=l>>>3&127,r[n++]=l>>>10&127,r[n++]=l>>>17&127,r[n++]=l>>>24&127,r[n++]=(l>>>31|(u&63)<<1)&127,r[n++]=u>>>6&127,r[n++]=u>>>13&127,r[n++]=u>>>20&127,r[n++]=(u>>>27|(h&3)<<5)&127,r[n++]=h>>>2&127,r[n++]=h>>>9&127,r[n++]=h>>>16&127,r[n++]=h>>>23&127,r[n++]=(h>>>30|(c&31)<<2)&127,r[n++]=c>>>5&127,r[n++]=c>>>12&127,r[n++]=c>>>19&127,r[n++]=(c>>>26|(p&1)<<6)&127,r[n++]=p>>>1&127,r[n++]=p>>>8&127,r[n++]=p>>>15&127,r[n++]=p>>>22&127,r[n++]=(p>>>29|(f&15)<<3)&127,r[n++]=f>>>4&127,r[n++]=f>>>11&127,r[n++]=f>>>18&127,r[n++]=f>>>25&127}}function Nw(t,e,r,i){let n=i,a=e;for(let s=0;s<8;s++){let o=t[a++]>>>0,l=t[a++]>>>0,u=t[a++]>>>0,h=t[a++]>>>0,c=t[a++]>>>0,p=t[a++]>>>0,f=t[a++]>>>0,d=t[a++]>>>0;r[n++]=o>>>0&255,r[n++]=o>>>8&255,r[n++]=o>>>16&255,r[n++]=o>>>24&255,r[n++]=l>>>0&255,r[n++]=l>>>8&255,r[n++]=l>>>16&255,r[n++]=l>>>24&255,r[n++]=u>>>0&255,r[n++]=u>>>8&255,r[n++]=u>>>16&255,r[n++]=u>>>24&255,r[n++]=h>>>0&255,r[n++]=h>>>8&255,r[n++]=h>>>16&255,r[n++]=h>>>24&255,r[n++]=c>>>0&255,r[n++]=c>>>8&255,r[n++]=c>>>16&255,r[n++]=c>>>24&255,r[n++]=p>>>0&255,r[n++]=p>>>8&255,r[n++]=p>>>16&255,r[n++]=p>>>24&255,r[n++]=f>>>0&255,r[n++]=f>>>8&255,r[n++]=f>>>16&255,r[n++]=f>>>24&255,r[n++]=d>>>0&255,r[n++]=d>>>8&255,r[n++]=d>>>16&255,r[n++]=d>>>24&255}}function Uw(t,e,r,i){let n=i,a=e;for(let s=0;s<128;s++){let o=t[a++]>>>0;r[n++]=o&65535,r[n++]=o>>>16&65535}}function qw(t,e,r,i,n){let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0,u=i;for(let h=0;h<8;h++){for(let c=0;c<32;c++)if(o+n<=32){let p=l>>>o&a;r[u+c]=p|0,o+=n,o===32&&(o=0,s++,c!==31&&(l=t[s]>>>0))}else{let p=32-o,f=l>>>o;s++,l=t[s]>>>0;let d=n-p,y=-1>>>32-d>>>0,m=(f|(l&y)<>>0)}}var hl=bw(py),jw=3*hl/256+hl|0;function fy(){let t=new Uint8Array(jw);return{dataToBePacked:Array(33),dataPointers:new Int32Array(33),byteContainer:t,byteContainerI32:new Int32Array(t.buffer,t.byteOffset,t.byteLength>>>2),exceptionSizes:new Int32Array(33)}}function Gw(t=16){if(t<0)throw RangeError(`initialEncodedWordCapacity must be >= 0, got ${t}`);let e=Math.max(16,t|0);return{encodedWords:new Uint32Array(e),decoderWorkspace:fy()}}function Xw(t,e){if(e<=t.encodedWords.length)return t.encodedWords;let r=new Uint32Array(Math.max(16,e*2));return t.encodedWords=r,r}function Yw(t,e,r,i){i.byteContainer.length>>2;if(n.byteOffset&3)for(let o=0;o>>8&255,n[u+2|0]=l>>>16&255,n[u+3|0]=l>>>24&255}else{let o=i.byteContainerI32;(!o||o.buffer!==n.buffer||o.byteOffset!==n.byteOffset||o.length>>2)),o.set(t.subarray(e,e+a))}let s=r&3;if(s>0){let o=t[e+a|0]|0,l=a<<2;for(let u=0;u>>(u<<3)&255}return n}function Ww(t,e,r){let i=t[e++]|0,n=r.dataToBePacked;for(let a=2;a<=32;a=a+1|0){if(!(i>>>a-1&1))continue;if(e>=t.length)throw Error(`FastPFOR decode: truncated exception stream header (bitWidth=${a}, streamWordIndex=${e}, needWords=1, availableWords=${t.length-e}, encodedWords=${t.length})`);let s=t[e++]>>>0,o=vw(s),l=s*a+31>>>5;if(e+l>t.length)throw Error(`FastPFOR decode: truncated exception stream (bitWidth=${a}, size=${s}, streamWordIndex=${e}, needWords=${l}, availableWords=${t.length-e}, encodedWords=${t.length})`);let u=n[a];(!u||u.length>>5)|0,r.exceptionSizes[a]=s}return e}function Zw(t,e,r,i,n){switch(n){case 1:Pw(t,e,r,i);break;case 2:zw(t,e,r,i);break;case 3:Lw(t,e,r,i);break;case 4:Vw(t,e,r,i);break;case 5:Ow(t,e,r,i);break;case 6:Rw(t,e,r,i);break;case 7:$w(t,e,r,i);break;case 8:Nw(t,e,r,i);break;case 16:Uw(t,e,r,i);break;default:qw(t,e,r,i,n)}return e+(n<<3)|0}function Hw(t,e,r,i){if(r+2>e)throw Error(`FastPFOR decode: byteContainer underflow at block=${i} (need 2 bytes for [bitWidth, exceptionCount], bytePos=${r}, byteSize=${e})`);let n=t[r++],a=t[r++];if(n>32)throw Error(`FastPFOR decode: invalid bitWidth=${n} at block=${i} (expected 0..32). This likely indicates corrupted or truncated input.`);return{bitWidth:n,exceptionCount:a,bytePosIn:r}}function Kw(t,e,r,i,n,a){if(r+1>e)throw Error(`FastPFOR decode: exception header underflow at block=${a} (need 1 byte for maxBits, bytePos=${r}, byteSize=${e})`);let s=t[r++];if(s32)throw Error(`FastPFOR decode: invalid maxBits=${s} at block=${a} (bitWidth=${i}, expected ${i}..32)`);let o=s-i|0;if(o<1||o>32)throw Error(`FastPFOR decode: invalid exceptionBitWidth=${o} at block=${a} (bitWidth=${i}, maxBits=${s})`);if(r+n>e)throw Error(`FastPFOR decode: exception positions underflow at block=${a} (need=${n}, have=${e-r})`);return{maxBits:s,exceptionBitWidth:o,bytePosIn:r}}function Jw(t,e,r,i,n,a,s,o,l){let{maxBits:u,exceptionBitWidth:h,bytePosIn:c}=Kw(n,a,s,r,i,l);if(s=c,h===1){let m=1<y)throw Error(`FastPFOR decode: exception stream overflow for exceptionBitWidth=${h} (ptr=${d}, need ${i}, size=${y}) at block ${l}`);for(let m=0;m0&&(c=Jw(n,m,d,y,o,l,c,u,p))}if(h!==i)throw Error(`FastPFOR decode: packed region mismatch (pageStart=${e}, packedStart=${r}, consumedPackedEnd=${h}, expectedPackedEnd=${i}, packedWords=${i-r}, encoded.length=${t.length})`)}function t3(t,e,r,i,n,a){let s=r|0,o=t[s]|0;if(o<=0||s+o>t.length-1)throw Error(`FastPFOR decode: invalid whereMeta=${o} at pageStart=${s} (expected > 0 and pageStart+whereMeta < encoded.length=${t.length})`);let l=s+1|0,u=s+o|0,h=t[u]>>>0,c=h+3>>>2,p=u+1,f=p+c;if(f>=t.length)throw Error(`FastPFOR decode: invalid byteSize=${h} (metaInts=${c}, pageStart=${s}, packedEnd=${u}, byteContainerStart=${p}) causes bitmapPos=${f} out of bounds (encoded.length=${t.length})`);let d=Yw(t,p,h,a),y=h,m=Ww(t,f,a);return a.dataPointers.fill(0),Qw(t,s,l,u,e,i|0,n/256|0,d,y,a),m}function e3(t,e,r,i,n,a){let s=i+gu(n,256),o=i,l=r;for(;o!==s;){let u=Math.min(hl,s-o);l=t3(t,e,l,o,u,a),o=o+u|0}return l}function r3(t,e,r,i,n,a){if(a===0)return e;let s=0,o=e,l=e+r,u=n,h=n,c=n+a,p=0,f=0;for(;o>>s&255;if(s+=8,o+=s>>>5,s&=31,p|=(d&127)<28)throw Error(`FastPFOR VByte: unterminated value (expected MSB=1 terminator within 5 bytes; shift=${f}, partial=${p}, decoded=${h-u}/${a}, inPos=${o}, inEnd=${l})`)}if(h!==c)throw Error(`FastPFOR VByte: truncated stream (decoded=${h-u}, expected=${a}, consumedWords=${o-e}/${r}, vbyteStart=${e}, vbyteEnd=${l})`);return o}function i3(t,e,r){let i=0,n=0,a=new Uint32Array(e),s=r!=null?r:fy();if(t.length>0){let u=t[i]|0;if(i=i+1|0,u&255)throw Error(`FastPFOR decode: invalid alignedLength=${u} (expected multiple of 256)`);if(n+u>a.length)throw Error(`FastPFOR decode: output buffer too small (outPos=${n}, alignedLength=${u}, out.length=${a.length})`);i=e3(t,a,i,n,u,s),n=n+u|0}let o=t.length-i|0,l=e-n|0;return r3(t,i,o,a,n,l),a}function n3(t,e,r,i,n){switch(n){case 2:Dw(t,e,r,i);return;case 3:_w(t,e,r,i);return;case 4:Aw(t,e,r,i);return;case 5:Sw(t,e,r,i);return;case 6:Ew(t,e,r,i);return;case 7:Fw(t,e,r,i);return;case 8:kw(t,e,r,i);return;case 9:Tw(t,e,r,i);return;case 10:Iw(t,e,r,i);return;case 11:Cw(t,e,r,i);return;case 12:Mw(t,e,r,i);return;case 16:Bw(t,e,r,i);return;case 32:for(let u=0;u<32;u=u+1|0)r[i+u|0]=t[e+u|0]|0;return}let a=ul[n]>>>0,s=e,o=0,l=t[s]>>>0;for(let u=0;u<32;u++)if(o+n<=32){let h=l>>>o&a;r[i+u]=h|0,o+=n,o===32&&(o=0,s++,u!==31&&(l=t[s]>>>0))}else{let h=32-o,c=l>>>o;s++,l=t[s]>>>0;let p=ul[n-h]>>>0,f=(c|(l&p)<t.length)throw RangeError(`decodeBigEndianInt32sInto: out of bounds (offset=${e}, byteLength=${r}, bytes.length=${t.length})`);let n=Math.floor(r/4),a=r%4!=0,s=a?n+1:n;if(i.length0){let o=t.byteOffset+e;if(o&3)for(let l=0;l=64)throw Error("Varint too long")}return e.set(n),r}function o3(t,e,r){let i=new Float64Array(r);for(let n=0;n>4,n<128||(n=e[r.get()],r.increment(),i|=(n&127)<<3,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<10,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<17,n<128)||(n=e[r.get()],r.increment(),i|=(n&127)<<24,n<128)||(n=e[r.get()],r.increment(),i|=(n&1)<<31,n<128))return i*4294967296+(t>>>0);throw Error("Expected varint not more than 10 bytes")}function h3(t,e,r,i){return c3(t,e,r,i,Gw(r>>>2))}function c3(t,e,r,i,n){let a=i.get();if(r&3)throw Error(`FastPFOR: invalid encodedByteLength=${r} at offset=${a} (encodedBytes.length=${t.length}; expected a multiple of 4 bytes for an int32 big-endian word stream)`);let s=r>>>2,o=Xw(n,s);a3(t,a,r,o);let l=i3(o.subarray(0,s),e,n.decoderWorkspace);return i.add(r),l}function et(t){return t>>>1^-(t&1)}function Ot(t){return t>>BigInt(1)^-(t&BigInt(1))}function We(t){return t%2==1?(t+1)/-2:t/2}function p3(t){let e=new Int32Array(t.length);for(let r=0;r=4)for(;i=4)for(;i=4)for(;r=4)for(let i=t[0];r=4)for(;i=4)for(;l>>0;for(let r=1;r>>0;return e}function jc(t){let e=new BigUint64Array(t.length);e[0]=BigInt.asUintN(64,Ot(t[0]));for(let r=1;r>>0,e[1]=et(t[1])>>>0;for(let r=2;r>>0,e[r+1]=e[r-1]+et(t[r+1])>>>0;return e}function F3(t,e,r,i){let n=yy(t,e,r,i);return new Uint32Array(n)}function k3(t){return t[1]}function T3(t){return et(t[1])}function I3(t){if(t.length===2){let e=et(t[1]);return[e,e]}return[et(t[2]),et(t[3])]}function C3(t){return t[1]}function M3(t){return Ot(t[1])}function B3(t){if(t.length===2){let e=Ot(t[1]);return[e,e]}return[Ot(t[2]),Ot(t[3])]}var St;(function(t){t.PRESENT="PRESENT",t.DATA="DATA",t.OFFSET="OFFSET",t.LENGTH="LENGTH"})(St||(St={}));var jt;(function(t){t.NONE="NONE",t.SINGLE="SINGLE",t.SHARED="SHARED",t.VERTEX="VERTEX",t.MORTON="MORTON",t.FSST="FSST"})(jt||(jt={}));var Me;(function(t){t.VERTEX="VERTEX",t.INDEX="INDEX",t.STRING="STRING",t.KEY="KEY"})(Me||(Me={}));var Ct;(function(t){t.VAR_BINARY="VAR_BINARY",t.GEOMETRIES="GEOMETRIES",t.PARTS="PARTS",t.RINGS="RINGS",t.TRIANGLES="TRIANGLES",t.SYMBOL="SYMBOL",t.DICTIONARY="DICTIONARY"})(Ct||(Ct={}));var P3=[St.PRESENT,St.DATA,St.OFFSET,St.LENGTH],Gc=[H.NONE,H.DELTA,H.COMPONENTWISE_DELTA,H.RLE,H.MORTON],z3=[le.NONE,le.FAST_PFOR,le.VARINT],L3=[jt.NONE,jt.SINGLE,jt.SHARED,jt.VERTEX,jt.MORTON,jt.FSST],V3=[Me.VERTEX,Me.INDEX,Me.STRING,Me.KEY],O3=[Ct.VAR_BINARY,Ct.GEOMETRIES,Ct.PARTS,Ct.RINGS,Ct.TRIANGLES,Ct.SYMBOL,Ct.DICTIONARY];function ct(t,e){let r=N3(t,e);return r.logicalLevelTechnique1===H.MORTON?R3(r,t,e):(H.RLE===r.logicalLevelTechnique1||H.RLE===r.logicalLevelTechnique2)&&le.NONE!==r.physicalLevelTechnique?$3(r,t,e):r}function R3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:t.decompressedCount,numBits:i[0],coordinateShift:i[1]}}function $3(t,e,r){let i=$t(e,r,2);return{physicalStreamType:t.physicalStreamType,logicalStreamType:t.logicalStreamType,logicalLevelTechnique1:t.logicalLevelTechnique1,logicalLevelTechnique2:t.logicalLevelTechnique2,physicalLevelTechnique:t.physicalLevelTechnique,numValues:t.numValues,byteLength:t.byteLength,decompressedCount:i[1],runs:i[0],numRleValues:i[1]}}function N3(t,e){let r=t[e.get()],i=P3[r>>4],n={};switch(i){case St.DATA:n={dictionaryType:L3[r&15]};break;case St.OFFSET:n={offsetType:V3[r&15]};break;case St.LENGTH:n={lengthType:O3[r&15]}}e.increment();let a=t[e.get()],s=Gc[a>>5],o=Gc[a>>2&7],l=z3[a&3];e.increment();let u=$t(t,e,2),h=u[0],c=u[1];return{physicalStreamType:i,logicalStreamType:n,logicalLevelTechnique1:s,logicalLevelTechnique2:o,physicalLevelTechnique:l,numValues:h,byteLength:c,decompressedCount:h}}var ht;(function(t){t[t.FLAT=0]="FLAT",t[t.CONST=1]="CONST",t[t.SEQUENCE=2]="SEQUENCE",t[t.DICTIONARY=3]="DICTIONARY",t[t.FSST_DICTIONARY=4]="FSST_DICTIONARY"})(ht||(ht={}));var fe=class{constructor(t,e){this.values=t,this._size=e}get(t){let e=Math.floor(t/8),r=t%8;return(this.values[e]>>r&1)==1}set(t,e){let r=Math.floor(t/8),i=t%8;this.values[r]=this.values[r]|+!!e<>r&1}size(){return this._size}getBuffer(){return this.values}};function Er(t,e,r){if(!e)return t;let i=e.size(),n=t.constructor,a=new n(i),s=0;for(let o=0;o=s);){let o=t[i.increment()];if(o<=127){let l=o+3,u=t[i.increment()],h=Math.min(a+l,e);n.fill(u,a,h),a=h}else{let l=256-o;for(let u=0;u=12?X3.decode(t.subarray(e,r)):Y3(t,e,r)}function Y3(t,e,r){let i="",n=e;for(;n239?4:a>223?3:a>191?2:1;if(n+o>r)break;let l,u,h;o===1?a<128&&(s=a):o===2?(l=t[n+1],(l&192)==128&&(s=(a&31)<<6|l&63,s<=127&&(s=null))):o===3?(l=t[n+1],u=t[n+2],(l&192)==128&&(u&192)==128&&(s=(a&15)<<12|(l&63)<<6|u&63,(s<=2047||s>=55296&&s<=57343)&&(s=null))):o===4&&(l=t[n+1],u=t[n+2],h=t[n+3],(l&192)==128&&(u&192)==128&&(h&192)==128&&(s=(a&15)<<18|(l&63)<<12|(u&63)<<6|h&63,(s<=65535||s>=1114112)&&(s=null))),s===null?(s=65533,o=1):s>65535&&(s-=65536,i+=String.fromCharCode(s>>>10&1023|55296),s=56320|s&1023),i+=String.fromCharCode(s),n+=o}return i}function Ta(t,e,r,i,n){return J3(pi(t,e,r),r,i,n)}function Vt(t,e,r,i,n){return Q3(pi(t,e,r),r,i,n)}function Ze(t,e,r){return e6(pi(t,e,r),r)}function pi(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.FAST_PFOR:return h3(t,r.numValues,r.byteLength,e);case le.VARINT:return $t(t,e,r.numValues);case le.NONE:return j3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function _n(t,e,r){let i=r.physicalLevelTechnique;switch(i){case le.VARINT:return xu(t,e,r.numValues);case le.NONE:return G3(t,e,r.numValues);default:throw Error(`Specified physicalLevelTechnique ${i} is not supported (yet).`)}}function W3(t,e,r){let i=pi(t,e,r);return i.length===1?et(i[0]):T3(i)}function wu(t,e,r){let i=pi(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?et(i[0]):i[0]:k3(i)}function vy(t,e,r){return I3(pi(t,e,r))}function by(t,e,r){return B3(xu(t,e,r.numValues))}function wy(t,e,r,i){return _y(_n(t,e,r),r,i)}function Du(t,e,r,i){return Ay(_n(t,e,r),r,i)}function Z3(t,e,r,i){let n=H3(t,e,r,!1);return i?Er(n,i,0):n}function H3(t,e,r,i){if(r.physicalLevelTechnique===le.VARINT)return t6(o3(t,e,r.numValues),r,i);let n=_n(t,e,r),a=i?_y(n,r):Ay(n,r);return Float64Array.from(a,Number)}function K3(t,e,r){let i=_n(t,e,r);return i.length===1?Ot(i[0]):M3(i)}function Dy(t,e,r){let i=_n(t,e,r);return i.length===1?r.logicalLevelTechnique1===H.DELTA?Ot(i[0]):i[0]:C3(i)}function J3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;if(!i)return A3(t,a.runs,a.numRleValues);t=cl(t,a.runs,a.numRleValues),n=Nc(t)}else n=Nc(t);break;case H.RLE:n=m3(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=new Int32Array(t);break;case H.COMPONENTWISE_DELTA:if(r&&!i)return yy(t,r.scale,r.min,r.max);n=b3(t);break;case H.NONE:n=p3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function Q3(t,e,r,i){let n;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let a=e;n=qc(cl(t,a.runs,a.numRleValues))}else n=qc(t);break;case H.RLE:n=cl(t,e.runs,e.numRleValues);break;case H.MORTON:vu(t),n=t;break;case H.COMPONENTWISE_DELTA:n=r&&!i?F3(t,r.scale,r.min,r.max):E3(t);break;case H.NONE:n=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return i?Er(n,i,0):n}function _y(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;if(!r)return S3(t,n.runs,n.numRleValues);t=pl(t,n.runs,n.numRleValues),i=Uc(t)}else i=Uc(t);break;case H.RLE:i=g3(t,e.runs,e.numRleValues);break;case H.NONE:i=f3(t);break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function Ay(t,e,r){let i;switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let n=e;i=jc(pl(t,n.runs,n.numRleValues))}else i=jc(t);break;case H.RLE:i=pl(t,e.runs,e.numRleValues);break;case H.NONE:i=t;break;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}return r?Er(i,r,BigInt(0)):i}function t6(t,e,r){switch(e.logicalLevelTechnique1){case H.DELTA:if(e.logicalLevelTechnique2===H.RLE){let i=e;t=dy(t,i.runs,i.numRleValues)}return y3(t),t;case H.RLE:return i6(t,e,r);case H.NONE:return r&&d3(t),t;default:throw Error(`The specified Logical level technique is not supported: ${e.logicalLevelTechnique1}`)}}function e6(t,e){if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.NONE)return w3(t);if(e.logicalLevelTechnique1===H.RLE&&e.logicalLevelTechnique2===H.NONE){let r=e;return _3(t,r.runs,r.numRleValues)}if(e.logicalLevelTechnique1===H.NONE&&e.logicalLevelTechnique2===H.NONE){v3(t);let r=new Uint32Array(e.numValues+1);return r[0]=0,r.set(t,1),r}if(e.logicalLevelTechnique1===H.DELTA&&e.logicalLevelTechnique2===H.RLE){let r=e,i=D3(t,r.runs,r.numRleValues);return vu(i),new Uint32Array(i)}throw Error("Only delta encoding is supported for transforming length to offset streams yet.")}function es(t,e,r,i,n="int32"){let a=t.logicalLevelTechnique1;if(a===H.RLE)return t.runs===1?ht.CONST:ht.FLAT;if(a!==H.DELTA||t.logicalLevelTechnique2!==H.RLE)return t.numValues===1?ht.CONST:ht.FLAT;let s=e instanceof fe?e.size():e,o=t;if(o.numRleValues!==s)return ht.FLAT;if(o.runs===1)return ht.SEQUENCE;if(o.runs!==2)return t.numValues===1?ht.CONST:ht.FLAT;let l=i.get();if(t.physicalLevelTechnique===le.VARINT)return r6(r,i,n)?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT;let u=i.get(),h=new Int32Array(r.buffer,r.byteOffset+u,4);return i.set(l),h[2]===2&&h[3]===2?ht.SEQUENCE:t.numValues===1?ht.CONST:ht.FLAT}function r6(t,e,r){let i=new cy(e.get());if(r==="int64"){let a=xu(t,i,4);return a[2]===BigInt(2)&&a[3]===BigInt(2)}let n=$t(t,i,4);return n[2]===2&&n[3]===2}function i6(t,e,r){return r?x3(t,e.runs,e.numRleValues):dy(t,e.runs,e.numRleValues)}var Sy=class extends ts{getValueFromBuffer(t){return this.dataBuffer[t]}},Ey=class extends uy{constructor(t,e,r,i,n){super(t,n?BigInt64Array.of(e):BigUint64Array.of(e),r,i)}getValueFromBuffer(t){return this.dataBuffer[0]+BigInt(t)*this.delta}};function _u(t,e,r){return{x:Xc(t,e)-r,y:Xc(t>>1,e)-r}}function Xc(t,e){let r=0;for(let i=0;i>i;return r}var Rt;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON",t[t.MULTIPOINT=3]="MULTIPOINT",t[t.MULTILINESTRING=4]="MULTILINESTRING",t[t.MULTIPOLYGON=5]="MULTIPOLYGON"})(Rt||(Rt={}));var n6;(function(t){t[t.POINT=0]="POINT",t[t.LINESTRING=1]="LINESTRING",t[t.POLYGON=2]="POLYGON"})(n6||(n6={}));var Fr;(function(t){t[t.MORTON=0]="MORTON",t[t.VEC_2=1]="VEC_2",t[t.VEC_3=2]="VEC_3"})(Fr||(Fr={}));function a6(t){let e=Array(t.numGeometries),r=1,i=1,n=1,a=0,s=0,o=0,l=t.mortonSettings,u=t.topologyVector,h=u.geometryOffsets,c=u.partOffsets,p=u.ringOffsets,f=t.vertexOffsets,d=!f||f.length===0,y=t.containsPolygonGeometry(),m=t.vertexBuffer;for(let g=0;g[D]),r+=v,i+=v}break;case Rt.LINESTRING:{let v;y?(v=p[i]-p[i-1],i++):v=c[r]-c[r-1],r++;let b;d?(b=Or(m,s,v,!1),s+=v*2):(b=lr(t.vertexBufferType,m,f,o,v,!1,l),o+=v),e[a++]=[b],h&&n++}break;case Rt.POLYGON:{let v=c[r]-c[r-1];r++;let b=Array(v-1),D,A=p[i]-p[i-1];if(i++,d){D=Or(m,s,A,!0),s+=A*2;for(let _=0;_r?e[a++]:1);return i}function Zc(t,e,r,i){let n=new Uint32Array(e[e.length-1]+1),a=0;n[0]=a;let s=1,o=0;for(let l=0;l0;)n[a++]=t[u++]}}return n}var By=class extends Au{constructor(t,e,r,i,n,a,s,o){super(t,r,i,s!=null?s:e.length),this.indexBuffer=e,this.symbolOffsetBuffer=n,this.symbolTableBuffer=a,this.sharedDictionaryCache=o}getValueFromBuffer(t){var n,a,s;(s=this.decodedDictionary)!=null||(this.decodedDictionary=(n=this.sharedDictionaryCache)==null?void 0:n.decodedDictionary,(a=this.decodedDictionary)!=null||(this.decodedDictionary=this.decodeDictionary(),this.sharedDictionaryCache&&(this.sharedDictionaryCache.decodedDictionary=this.decodedDictionary)));let e=this.indexBuffer[t],r=this.offsetBuffer[e],i=this.offsetBuffer[e+1];return bu(this.decodedDictionary,r,i)}decodeDictionary(){var t;return(t=this.symbolLengthBuffer)!=null||(this.symbolLengthBuffer=this.offsetToLengthBuffer(this.symbolOffsetBuffer)),v6(this.symbolTableBuffer,this.symbolLengthBuffer,this.dataBuffer)}offsetToLengthBuffer(t){let e=new Uint32Array(t.length-1),r=t[0];for(let i=1;i1&&!f.nullable||d===1&&f.nullable)throw Error(`The number of streams for the child field ${f.name} does not match its nullability. nullibilty: ${f.nullable}, numStreams: ${d}`);let m;if(f.nullable){let x=ct(t,e);m=new fe(ci(t,x.numValues,x.byteLength,e),x.numValues)}let g=Vt(t,e,ct(t,e),void 0,m);if(o){if(!s)throw Error(`Incomplete shared FSST dictionary for column "${y}"`);h[p++]=new By(y,g,n,a,s,o,m,c)}else h[p++]=new Qr(y,g,n,a,m)}return h}var Kc=class extends Sr{constructor(t,e,r){super(t,new Uint8Array,r!=null?r:e.length),this.values=e}getValueFromBuffer(t){return this.values[t]}},Be;(function(t){t[t.STRING=1]="STRING",t[t.INT32=2]="INT32",t[t.UINT32=4]="UINT32",t[t.INT64=8]="INT64",t[t.UINT64=16]="UINT64",t[t.FLOAT=32]="FLOAT",t[t.DOUBLE=64]="DOUBLE",t[t.PRESENCE=128]="PRESENCE"})(Be||(Be={}));var pr;(function(t){t[t.FALSE=0]="FALSE",t[t.TRUE=1]="TRUE",t[t.START_MAP=2]="START_MAP",t[t.START_LIST=3]="START_LIST",t[t.COUNT=4]="COUNT"})(pr||(pr={}));function A6(t,e,r,i){let n=S6(r);if(i===0)return n.map(h=>new Kc(h,[]));let a=E6(t,e,i),s=(a.presentStream?a.presentCount:a.lengthStream.length)/n.length,o=[],l=0,u=0;for(let h=0;h{var i;return t.name+((i=r.name)!=null?i:"")})}function E6(t,e,r){let i=t[e.get()];e.add(1);let n=Vt(t,e,ct(t,e)),a=r-1,s=[];i&Be.STRING&&(a-=F6(t,e,s)),a-=k6(t,e,i,s),a-=T6(t,e,i,s);let o,l=0;if(i&Be.PRESENCE){let h=I6(t,e);o=h.value,l=h.count,a--}let u=new Uint32Array;if(a>0&&(u=Vt(t,e,ct(t,e)),a--),a!==0)throw Error(`Unexpected number of remaining streams while decoding map column: ${a}`);return{lengthStream:n,dictionary:s,presentStream:o,presentCount:l,flattenedValues:u}}function F6(t,e,r){let i=t[e.get()];e.add(1);let n=Py("",t,e,i);if(n)for(let a=0;aa.length)throw Error("Merged map counts underflow while decoding child streams");let f=Array(r),d=i,y=n;for(let x=0;xs.length)throw Error("Map value stream underflow while decoding feature payload");let b=M6(s,y,v,l);f[x]=b.value,y=b.nextIndex}let m=0;for(let x=i;x=r)throw Error("Unexpected end of map value stream");let n=t[e];if(n===pr.FALSE)return{value:!1,nextIndex:e+1};if(n===pr.TRUE)return{value:!0,nextIndex:e+1};if(n===pr.START_MAP){let a=Jc(t,e,r);return{value:zy(t,e+2,a,i).value,nextIndex:a}}if(n===pr.START_LIST){let a=Jc(t,e,r),s=[],o=e+2;for(;o=r)throw Error("Missing length for nested map/list payload");let i=t[e+1];if(i<2)throw Error(`Invalid nested payload length: ${i}`);let n=e+i;if(n>r)throw Error("Nested payload exceeds containing payload bounds");return n}function Ly(t,e){let r=t-pr.COUNT;if(r<0||r>=e.length)throw Error(`Scalar dictionary index out of range: ${t}`);return e[r]}function Xr(t,e){for(let r of e)t.push(r)}function B6(t,e,r,i,n,a){var s;return r.type==="scalarType"?a&&!a.has(r.name)?(my(i,t,e),null):P6(i,t,e,n,r.scalarType,r):((s=r.complexType)==null?void 0:s.physicalType)===Qe.MAP?A6(t,e,r,i):i===0?null:_6(t,e,r,a)}function P6(t,e,r,i,n,a){var l;let s;if(t===0)return null;if(a.nullable){let u=ct(e,r),h=u.numValues,c=r.get(),p=ci(e,h,u.byteLength,r);r.set(c+u.byteLength),s=new fe(p,u.numValues)}let o=s!=null?s:i;switch(n.physicalType){case it.UINT_32:case it.INT_32:return R6(e,r,a,n,o);case it.STRING:{let u=a.nullable?t-1:t;return(l=Py(a.name,e,r,u,s))!=null?l:null}case it.BOOLEAN:return z6(e,r,a,i,o);case it.UINT_64:case it.INT_64:return O6(e,r,a,o,n);case it.FLOAT:return L6(e,r,a,o);case it.DOUBLE:return V6(e,r,a,o);default:throw Error(`The specified data type for the field is currently not supported: ${n}`)}}function z6(t,e,r,i,n){let a=ct(t,e),s=a.numValues,o=e.get(),l=An(n)?n:void 0,u=ci(t,s,a.byteLength,e,l);e.set(o+a.byteLength);let h=new fe(u,s);return new m6(r.name,h,n)}function L6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=gy(t,e,n.numValues,a);return new g6(r.name,s,i)}function V6(t,e,r,i){let n=ct(t,e),a=An(i)?i:void 0,s=xy(t,e,n.numValues,a);return new fu(r.name,s,i)}function O6(t,e,r,i,n){let a=ct(t,e),s=es(a,i,t,e,"int64"),o=n.physicalType===it.INT_64;if(s===ht.FLAT){let u=An(i)?i:void 0,h=o?wy(t,e,a,u):Du(t,e,a,u);return new Sy(r.name,h,i)}if(s===ht.SEQUENCE){let u=by(t,e,a);return new Ey(r.name,u[0],u[1],a.numRleValues,o)}let l=o?K3(t,e,a):Dy(t,e,a);return new My(r.name,l,i,o)}function R6(t,e,r,i,n){let a=ct(t,e),s=es(a,n,t,e),o=i.physicalType===it.INT_32;if(s===ht.FLAT){let u=An(n)?n:void 0,h=o?Ta(t,e,a,void 0,u):Vt(t,e,a,void 0,u);return new pu(r.name,h,n)}if(s===ht.SEQUENCE){let u=vy(t,e,a);return new du(r.name,u[0],u[1],a.numRleValues,o)}let l=o?W3(t,e,a):wu(t,e,a);return new yu(r.name,l,n,o)}function An(t){return t instanceof fe}var It={ID:0,ID_NULLABLE:1,ID_LONG:2,GEOMETRY:4,SCALAR_BASE:10,STRUCT:30,MAP:31};function Vy(t){switch(t){case It.ID:case It.ID|It.ID_NULLABLE:case It.ID|It.ID_LONG:case It.ID|It.ID_LONG|It.ID_NULLABLE:return{nullable:(t&It.ID_NULLABLE)!==0,columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:(t&It.ID_LONG)!==0,type:"logicalType",logicalType:hy.ID}};case It.GEOMETRY:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.GEOMETRY,children:[]}};case It.STRUCT:return{nullable:!1,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.STRUCT,children:[]}};case It.MAP:return{nullable:!0,columnScope:qi.FEATURE,type:"complexType",complexType:{type:"physicalType",physicalType:Qe.MAP,children:[]}};default:return j6(t)}}function $6(t){return t>=It.SCALAR_BASE}function Oy(t){return t===It.STRUCT||t===It.MAP}function N6(t){if(t.type==="scalarType"){let e=t.scalarType;if(e.type==="physicalType")switch(e.physicalType){case it.BOOLEAN:case it.INT_8:case it.UINT_8:case it.INT_32:case it.UINT_32:case it.INT_64:case it.UINT_64:case it.FLOAT:case it.DOUBLE:return!1;case it.STRING:return!0;default:return!1}if(e.type==="logicalType")return!1}else if(t.type==="complexType"){let e=t.complexType;if(e.type==="physicalType")switch(e.physicalType){case Qe.GEOMETRY:case Qe.STRUCT:case Qe.MAP:return!0;default:return!1}}return console.warn("Unexpected column type in hasStreamCount",t),!1}function U6(t){var e;return t.type==="scalarType"&&((e=t.scalarType)==null?void 0:e.type)==="logicalType"&&t.scalarType.logicalType===hy.ID}function q6(t){var e;return t.type==="complexType"&&((e=t.complexType)==null?void 0:e.type)==="physicalType"&&t.complexType.physicalType===Qe.GEOMETRY}function j6(t){let e;switch(t){case 10:case 11:e=it.BOOLEAN;break;case 12:case 13:e=it.INT_8;break;case 14:case 15:e=it.UINT_8;break;case 16:case 17:e=it.INT_32;break;case 18:case 19:e=it.UINT_32;break;case 20:case 21:e=it.INT_64;break;case 22:case 23:e=it.UINT_64;break;case 24:case 25:e=it.FLOAT;break;case 26:case 27:e=it.DOUBLE;break;case 28:case 29:e=it.STRING;break;default:return null}return{nullable:!!(t&1),columnScope:qi.FEATURE,type:"scalarType",scalarType:{longID:!1,type:"physicalType",physicalType:e}}}var G6=new TextDecoder,Qc="0-3(ID), 4(GEOMETRY), 10-29(scalars), 30(STRUCT), 31(MAP)";function Eu(t,e){let r=$t(t,e,1)[0];if(r===0)return"";let i=e.get(),n=i+r,a=t.subarray(i,n);return e.add(r),G6.decode(a)}function X6(t){let e=t.name,r=t.nullable;return t.type==="scalarType"?{type:"scalarField",scalarField:t.scalarType,name:e,nullable:r}:{type:"complexField",complexField:t.complexType,name:e,nullable:r}}function Ry(t,e){let r=$t(t,e,1)[0]>>>0,i=r>=It.SCALAR_BASE?Vy(r):null;if(!i)throw Error(`Unsupported field type code ${r}. Supported: 10-29(scalars), 30(STRUCT), 31(MAP)`);let n=Si(je({},i),{name:Eu(t,e)});if(n.type==="complexType"&&Oy(r)){let a=n.complexType,s=$t(t,e,1)[0]>>>0;a.children=Array(s);for(let o=0;o>>0,i=Vy(r);if(!i)throw Error(`Unsupported column type code ${r}. Supported: ${Qc}`);let n;if($6(r))n=Eu(t,e);else if(r>>0,o=a.complexType;o.children=Array(s);for(let l=0;l>>0,a=$t(t,e,1)[0]>>>0;i.columns=Array(a);for(let s=0;s>>0,s=i.get()+a;if(s>t.length)throw Error(`Block overruns tile: ${s} > ${t.length}`);let o=$t(t,i,1)[0]>>>0;if(o!==1&&o!==2){i.set(s);continue}let[l,u]=W6(t,i),h=l.featureTables[0],c=null,p=null,f=[],d=0;for(let m of h.columns){let g=m.name;if(U6(m)){let x=null;if(m.nullable){let b=ct(t,i),D=i.get(),A=ci(t,b.numValues,b.byteLength,i);i.set(D+b.byteLength),x=new fe(A,b.numValues)}let v=ct(t,i);d=x?x.size():v.decompressedCount,c=H6(t,m,i,g,v,x!=null?x:d,r)}else if(q6(m)){let x=$t(t,i,1)[0];if(d===0){let v=i.get();d=ct(t,i).decompressedCount,i.set(v)}e&&(e.scale=e.extent/u),p=f6(t,x,i,d,e)}else{let x=N6(m)?$t(t,i,1)[0]:1;if(x===0)continue;let v=B6(t,i,m,x,d,void 0);if(v)if(Array.isArray(v))for(let b of v)f.push(b);else f.push(v)}}let y=new xw(h.name,p,c,f,u);n.push(y),i.set(s)}return n}function H6(t,e,r,i,n,a,s=!1){var h;let o=(h=e.scalarType)!=null&&h.longID?it.UINT_64:it.UINT_32,l=typeof a=="number"?void 0:a,u=es(n,a,t,r,o===it.UINT_64?"int64":"int32");if(o===it.UINT_32)switch(u){case ht.FLAT:return new pu(i,Vt(t,r,n,void 0,l),a);case ht.SEQUENCE:{let c=vy(t,r,n);return new du(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new yu(i,wu(t,r,n),a,!1)}switch(u){case ht.FLAT:return s?new fu(i,Z3(t,r,n,l),a):new Sy(i,Du(t,r,n,l),a);case ht.SEQUENCE:{let c=by(t,r,n);return new Ey(i,c[0],c[1],n.numRleValues,!1)}case ht.CONST:return new My(i,Dy(t,r,n),a,!1)}throw Error("Vector type not supported for id column.")}var K6=class{constructor(t,e){var r;switch(this._featureData=t,this.properties=this._featureData.properties||{},(r=this._featureData.geometry)==null?void 0:r.type){case Rt.POINT:case Rt.MULTIPOINT:this.type=1;break;case Rt.LINESTRING:case Rt.MULTILINESTRING:this.type=2;break;case Rt.POLYGON:case Rt.MULTIPOLYGON:this.type=3;break;default:this.type=0}this.extent=e,this.id=Number(this._featureData.id)}loadGeometry(){let t=[];for(let e of this._featureData.geometry.coordinates){let r=[];for(let i of e)r.push(new B(i.x,i.y));t.push(r)}return t}},J6=class{constructor(t){this.features=[],this.featureTable=t,this.name=t.name,this.extent=t.extent,this.version=2,this.features=t.getFeatures(),this.length=this.features.length}feature(t){return new K6(this.features[t],this.extent)}},Fu=class{constructor(t){this.layers={};let e=Z6(new Uint8Array(t));this.layers=e.reduce((r,i)=>Si(je({},r),{[i.name]:new J6(i)}),{})}},ku=class{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new uo(mt,16,0),this.grid3D=new uo(mt,16,0),this.featureIndexArray=new Yf,this.promoteId=e}insert(t,e,r,i,n,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,n);let o=a?this.grid3D:this.grid;for(let l of e){let u=[1/0,1/0,-1/0,-1/0];for(let h of l)u[0]=Math.min(u[0],h.x),u[1]=Math.min(u[1],h.y),u[2]=Math.max(u[2],h.x),u[3]=Math.max(u[3],h.y);u[0]<8192&&u[1]<8192&&u[2]>=0&&u[3]>=0&&o.insert(s,u[0],u[1],u[2],u[3])}}loadVTLayers(){return this.vtLayers||(this.encoding==="mlt"?this.vtLayers=new Fu(this.rawTileData).layers:this.vtLayers=new Xl(new au(this.rawTileData)).layers,this.sourceLayerCoder=new cu(this.vtLayers?Object.keys(this.vtLayers).sort():[ll])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let n=t.params,a=mt/t.tileSize/t.scale,s=ai(n.filter,"queryRenderedFeatures filter",n.globalState),o=t.queryGeometry,l=t.queryPadding*a,u=Fa.fromPoints(o),h=this.grid.query(u.minX-l,u.minY-l,u.maxX+l,u.maxY+l),c=Fa.fromPoints(t.cameraQueryGeometry).expandBy(l),p=this.grid3D.query(c.minX,c.minY,c.maxX,c.maxY,(y,m,g,x)=>vg(t.cameraQueryGeometry,y-l,m-l,g+l,x+l));for(let y of p)h.push(y);h.sort(t5);let f={},d;for(let y of h){if(y===d)continue;d=y;let m=this.featureIndexArray.get(y),g=null;this.loadMatchingFeature(f,m.bucketIndex,m.sourceLayerIndex,m.featureIndex,s,n.layers,n.availableImages,e,r,i,(x,v,b)=>(g||(g=Ar(x)),v.queryIntersectsFeature({queryGeometry:o,feature:x,featureState:b,geometry:g,zoom:this.z,transform:t.transform,pixelsToTileUnits:a,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return f}loadMatchingFeature(t,e,r,i,n,a,s,o,l,u,h){let c=this.bucketLayerIDs[e];if(a&&!c.some(y=>a.has(y)))return;let p=this.sourceLayerCoder.decode(r),f=this.vtLayers[p].feature(i);if(n.needGeometry){let y=hi(f,!0);if(!n.filter(new st(this.tileID.overscaledZ),y,this.tileID.canonical))return}else if(!n.filter(new st(this.tileID.overscaledZ),f))return;let d=this.getId(f,p);for(let y of c){if(a&&!a.has(y))continue;let m=o[y];if(!m)continue;let g={};d&&u&&(g=u.getState(m.sourceLayer||"_geojsonTileLayer",d));let x=Gt({},l[y]);x.paint=tp(x.paint,m.paint,f,g,s),x.layout=tp(x.layout,m.layout,f,g,s);let v=!h||h(f,m,g);if(!v)continue;let b=new gw(f,this.z,this.x,this.y,d);b.layer=x;let D=t[y];D===void 0&&(D=t[y]=[]),D.push({featureIndex:i,feature:b,intersectionZ:v})}}lookupSymbolFeatures(t,e,r,i,n,a,s,o){let l={};this.loadVTLayers();let u=ai(n.filterSpec,"queryRenderedFeatures symbol filter",n.globalState);for(let h of t)this.loadMatchingFeature(l,r,i,h,u,a,s,o,e);return l}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){var i;let r=t.id;if(this.promoteId){let n=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[n],typeof r=="boolean"&&(r=Number(r)),r===void 0&&((i=t.properties)!=null&&i.cluster)&&this.promoteId&&(r=Number(t.properties.cluster_id))}return r}};C("FeatureIndex",ku,{omit:["rawTileData","sourceLayerCoder"]});function Q6(t){return typeof t=="object"&&!!t&&"evaluate"in t}function tp(t,e,r,i,n){return Ia(t,(a,s)=>{let o=e instanceof Ya?e.get(s):null;return Q6(o)?o.evaluate(r,i,void 0,n):o})}function t5(t,e){return e-t}var $y=class{constructor(t){this.maxEntries=t,this.map=new Map}get(t){let e=this.map.get(t);return e!==void 0&&(this.map.delete(t),this.map.set(t,e)),e}set(t,e){if(this.map.has(t))this.map.delete(t);else if(this.map.size>=this.maxEntries){let r=this.map.keys().next().value;this.map.delete(r)}this.map.set(t,e)}clear(){this.map.clear()}};function Tu(t){let e=typeof t;if(e==="number"||e==="boolean"||e==="string"||t==null)return JSON.stringify(t);if(Array.isArray(t)){let n="[";for(let a of t)n+=`${Tu(a)},`;return`${n}]`}let r=Object.keys(t).sort(),i="{";for(let n=0;nthis._layers[c.id]),s=a[0];if(s.isHidden())continue;let o=s.source||"",l=this.familiesBySource[o];l||(l=this.familiesBySource[o]={});let u=s.sourceLayer||"_geojsonTileLayer",h=l[u];h||(h=l[u]=[]),h.push(a)}}},qy=class{constructor(t){let e={},r=[];for(let s in t){let o=t[s],l=e[s]={};for(let u in o){let h=o[u];if(!h||h.bitmap.width===0||h.bitmap.height===0)continue;let c={x:0,y:0,w:h.bitmap.width+2,h:h.bitmap.height+2};r.push(c),l[u]={rect:c,metrics:h.metrics}}}let{w:i,h:n}=su(r),a=new Ja({width:i||1,height:n||1});for(let s in t){let o=t[s];for(let l in o){let u=o[l];if(!u||u.bitmap.width===0||u.bitmap.height===0)continue;let h=e[s][l].rect;Ja.copy(u.bitmap,a,{x:0,y:0},{x:h.x+1,y:h.y+1},u.bitmap)}}this.image=a,this.positions=e}};C("GlyphAtlas",qy);var jy=class{constructor(t){this.tileID=new uu(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[]}parse(t,e,r,i,n){return rt(this,null,function*(){this.data=t,this.collisionBoxArray=new Ll;let a=new cu(Object.keys(t.layers).sort()),s=new ku(this.tileID,this.promoteId);s.bucketLayerIDs=[];let o={},l={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},dashDependencies:{},availableImages:r,subdivisionGranularity:n},u=e.familiesBySource[this.source];for(let S in u){let k=t.layers[S];if(!k)continue;k.version===1&&Bt(`Vector tile source "${this.source}" layer "${S}" does not use vector tile spec v2 and therefore may have some rendering errors.`);let z=a.encode(S),O=[];for(let P=0;PF.id)))}}let h=Ia(l.glyphDependencies,S=>Object.keys(S));for(let S of this.inFlightDependencies)S==null||S.abort();this.inFlightDependencies=[];let c=Promise.resolve({});if(Object.keys(h).length){let S=new AbortController;this.inFlightDependencies.push(S),c=i.sendAsync({type:"GG",data:{stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"}},S)}let p=Object.keys(l.iconDependencies),f=Promise.resolve({});if(p.length){let S=new AbortController;this.inFlightDependencies.push(S),f=i.sendAsync({type:"GI",data:{icons:p,source:this.source,tileID:this.tileID,type:"icons"}},S)}let d=Object.keys(l.patternDependencies),y=Promise.resolve({});if(d.length){let S=new AbortController;this.inFlightDependencies.push(S),y=i.sendAsync({type:"GI",data:{icons:d,source:this.source,tileID:this.tileID,type:"patterns"}},S)}let m=l.dashDependencies,g=Promise.resolve({});if(Object.keys(m).length){let S=new AbortController;this.inFlightDependencies.push(S),g=i.sendAsync({type:"GDA",data:{dashes:m}},S)}let[x,v,b,D]=yield Promise.all([c,f,y,g]),A=new qy(x),_=new ou(v,b);for(let S in o){let k=o[S];k.hasDependencies&&(Ny(k.layers,this.zoom,r),k.addFeatures({options:l,canonical:this.tileID.canonical,glyphMap:x,glyphPositions:A.positions,iconMap:v,iconPositions:_.iconPositions,patternMap:b,patternPositions:_.patternPositions,dashPositions:D,showCollisionBoxes:this.showCollisionBoxes}))}return{buckets:Object.values(o).filter(S=>!S.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:A.image,imageAtlas:_,dashPositions:D,glyphMap:this.returnDependencies?x:null,iconMap:this.returnDependencies?v:null,glyphPositions:this.returnDependencies?A.positions:null}})}};function Ny(t,e,r){let i=new st(e);for(let n of t)n.recalculate(i,r)}var Gy=class{constructor(){this.loading={},this.loaded={},this.parsing={}}startLoading(t,e){this.loading[t]=e}finishLoading(t){delete this.loading[t]}abort(t){let e=this.loading[t];e!=null&&e.abort&&(e.abort.abort(),delete this.loading[t])}getParsing(t){return this.parsing[t]}setParsing(t,e){this.parsing[t]=e}removeParsing(t){delete this.parsing[t]}markLoaded(t,e){this.loaded[t]=e}getLoaded(t){let e=this.loaded[t];if(e)return e}removeLoaded(t){delete this.loaded[t]}clearLoaded(){this.loaded={}}},Xy=class{constructor(t){this.start=`${t}#start`,this.end=`${t}#end`,this.measure=t,performance.mark(this.start)}finish(){performance.mark(this.end);let t=performance.getEntriesByName(this.measure);return t.length===0&&(performance.measure(this.measure,this.start,this.end),t=performance.getEntriesByName(this.measure),performance.clearMarks(this.start),performance.clearMarks(this.end),performance.clearMeasures(this.measure)),t}},n5=class{constructor(t,e,r,i,n){this.type=t,this.properties=r||{},this.extent=n,this.pointsArray=e,this.id=i}loadGeometry(){return this.pointsArray.map(t=>t.map(e=>new B(e.x,e.y)))}},a5=class{constructor(t,e,r){this.version=2,this._myFeatures=t,this.name=e,this.length=t.length,this.extent=r}feature(t){return this._myFeatures[t]}},s5=class{constructor(){this.layers={}}addLayer(t){this.layers[t.name]=t}};function o5(t,e,r){let{extent:i}=t,n=2**(r.z-e.z),a=(r.x-e.x*n)*i,s=(r.y-e.y*n)*i,o=[];for(let l=0;l0&&l.addLayer(d)}let h={vectorTile:l,rawData:hu(l).buffer};return this.overzoomedTileResultCache.set(s,h),h}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)throw Error("Should not be trying to reload a tile that was never loaded or has been removed");if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}},u5=class{constructor(){this.loaded={}}loadTile(t){return rt(this,null,function*(){let{uid:e,encoding:r,rawImageData:i,redFactor:n,greenFactor:a,blueFactor:s,baseShift:o}=t,l=i.width+4,u=i.height+4,h=Ca(i)?new Zt({width:l,height:u},yield ap(i,-2,-2,l,u)):i,c=new jl(e,h,r,n,a,s,o);return this.loaded||(this.loaded={}),this.loaded[e]=c,c})}removeTile(t){let e=this.loaded,r=t.uid;e!=null&&e[r]&&delete e[r]}},h5=class{constructor(t,e,r,i=c5){this.actor=t,this.layerIndex=e,this.availableImages=r,this.tileState=new Gy,this._createGeoJSONIndex=i}loadVectorTile(t){if(!this._geoJSONIndex)throw Error("Unable to parse the data into a cluster or geojson");let{z:e,x:r,y:i}=t.tileID.canonical,n=this._geoJSONIndex.getTile(e,r,i);if(!n)return null;let a=new ly(n.features,{version:2,extent:mt});return{vectorTile:a,rawData:hu(a,np).buffer}}loadTile(t){return rt(this,null,function*(){let{uid:e}=t,r=new jy(t);r.abort=new AbortController;try{let i=this.loadVectorTile(t);if(!i)return null;let{vectorTile:n,rawData:a}=i;r.vectorTile=n,this.tileState.markLoaded(e,r);let s={rawData:a};return this.tileState.setParsing(e,s),yield this._parseWorkerTile(r,t)}catch(i){throw this.tileState.markLoaded(e,r),i}})}_parseWorkerTile(t,e){return rt(this,null,function*(){let r=this.tileState.getParsing(t.uid),i=yield t.parse(t.vectorTile,this.layerIndex,this.availableImages,this.actor,e.subdivisionGranularity);if(r){let{rawData:n}=r;i=Gt({rawTileData:n.slice(0),encoding:"mvt"},i),this.tileState.removeParsing(t.uid)}return i})}abortTile(t){return rt(this,null,function*(){this.tileState.abort(t.uid)})}removeTile(t){return rt(this,null,function*(){this.tileState.removeLoaded(t.uid)})}loadData(t){return rt(this,null,function*(){var r;(r=this._pendingRequest)==null||r.abort();let e=this._startRequestTiming(t);this._pendingRequest=new AbortController;try{yield this.loadAndProcessGeoJSON(t,this._pendingRequest),delete this._pendingRequest,this.tileState.clearLoaded();let i={};return t.request&&(i.data=t.data),this._finishRequestTiming(e,t,i),i}catch(i){if(delete this._pendingRequest,!yl(i))throw i;return{abandoned:!0}}})}_startRequestTiming(t){var e;if((e=t.request)!=null&&e.collectResourceTiming)return new Xy(t.request.url)}_finishRequestTiming(t,e,r){let i=t==null?void 0:t.finish();i&&(r.resourceTiming={[e.source]:JSON.parse(JSON.stringify(i))})}reloadTile(t){return rt(this,null,function*(){let e=t.uid,r=this.tileState.getLoaded(e);if(!r)return yield this.loadTile(t);if(r.vectorTile)return r.showCollisionBoxes=t.showCollisionBoxes,yield this._parseWorkerTile(r,t)})}loadAndProcessGeoJSON(t,e){return rt(this,null,function*(){var r;if(t.request&&(t.data=(yield up(t.request,e)).data),t.data){t.data=this._filterGeoJSON(t.data,t.filter,t.source),this._geoJSONIndex=this._createGeoJSONIndex(t.data,t);return}if(t.dataDiff){(r=this._geoJSONIndex)!=null||(this._geoJSONIndex=this._createGeoJSONIndex({type:"FeatureCollection",features:[]},t)),this._geoJSONIndex.updateData(t.dataDiff,this._getFilterPredicate(t.filter,t.source));return}if(t.updateCluster&&this._geoJSONIndex.updateClusterOptions(t.geojsonVtOptions.cluster,Yy(t)),this._geoJSONIndex==null)throw Error(`Input data given to \'${t.source}\' is not a valid GeoJSON object.`)})}_filterGeoJSON(t,e,r){if(t.type!=="FeatureCollection")return t;let i=this._getFilterPredicate(e,r);return i?{type:"FeatureCollection",features:t.features.filter(n=>i(n))}:t}_getFilterPredicate(t,e){if(typeof t!="boolean"&&!(t!=null&&t.length))return;let r=er(t,`sources.${e}.filter`,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(r.result==="error")throw Error(r.value.map(i=>`${i.key}: ${i.message}`).join(", "));return i=>r.value.evaluate({zoom:0},i)}removeSource(t){return rt(this,null,function*(){var e;(e=this._pendingRequest)==null||e.abort()})}getClusterExpansionZoom(t){return this._geoJSONIndex.getClusterExpansionZoom(t.clusterId)}getClusterChildren(t){return this._geoJSONIndex.getClusterChildren(t.clusterId)}getClusterLeaves(t){return this._geoJSONIndex.getClusterLeaves(t.clusterId,t.limit,t.offset)}};function c5(t,e){let r=Gt(e.geojsonVtOptions||{},{updateable:!0,clusterOptions:Yy(e)});return new Td(t,r)}function Yy({geojsonVtOptions:t,clusterProperties:e,source:r}){if(!e||!t.clusterOptions)return t.clusterOptions;let i={},n={},a={accumulated:null,zoom:0},s={properties:null},o=Object.keys(e);for(let l of o){let[u,h]=e[l],c=er(h,`sources.${r}.clusterProperties.${l}[1]`),p=er(typeof u=="string"?[u,["accumulated"],["get",l]]:u,`sources.${r}.clusterProperties.${l}[0]`);i[l]=c.value,n[l]=p.value}return t.clusterOptions.map=l=>{s.properties=l;let u={};for(let h of o)u[h]=i[h].evaluate(a,s);return u},t.clusterOptions.reduce=(l,u)=>{s.properties=u;for(let h of o)a.accumulated=l[h],l[h]=n[h].evaluate(a,s)},t.clusterOptions}function Uy(t){return rt(this,null,function*(){if(t.endsWith(".mjs")){yield import(t);return}let e=yield fetch(t,{credentials:"same-origin"});if(!e.ok)throw Error(`Failed to load ${t}: ${e.status}`);let r=yield e.text();if(/^[ \\t]*(import|export)\\s/m.test(r)){let i=URL.createObjectURL(new Blob([r],{type:"text/javascript"}));try{yield import(i)}finally{URL.revokeObjectURL(i)}return}globalThis.eval(r)})}var p5=class{constructor(t){this.self=t,this.actor=new sy(t),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.globalStates=new Map,this.self.registerWorkerSource=(e,r)=>{if(this.externalWorkerSourceTypes[e])throw Error(`Worker source with name "${e}" already registered.`);this.externalWorkerSourceTypes[e]=r},this.self.addProtocol=sp,this.self.removeProtocol=op,this.self.registerRTLTextPlugin=e=>{wr.setMethods(e)},this.self.makeRequest=Ma,this.actor.registerMessageHandler("LDT",(e,r)=>this._getDEMWorkerSource(e,r.source).loadTile(r)),this.actor.registerMessageHandler("RDT",(e,r)=>rt(this,null,function*(){this._getDEMWorkerSource(e,r.source).removeTile(r)})),this.actor.registerMessageHandler("GCEZ",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterExpansionZoom(r)})),this.actor.registerMessageHandler("GCC",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterChildren(r)})),this.actor.registerMessageHandler("GCL",(e,r)=>rt(this,null,function*(){return this._getWorkerSource(e,r.type,r.source).getClusterLeaves(r)})),this.actor.registerMessageHandler("LD",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadData(r)),this.actor.registerMessageHandler("LT",(e,r)=>this._getWorkerSource(e,r.type,r.source).loadTile(r)),this.actor.registerMessageHandler("RT",(e,r)=>this._getWorkerSource(e,r.type,r.source).reloadTile(r)),this.actor.registerMessageHandler("AT",(e,r)=>this._getWorkerSource(e,r.type,r.source).abortTile(r)),this.actor.registerMessageHandler("RMT",(e,r)=>this._getWorkerSource(e,r.type,r.source).removeTile(r)),this.actor.registerMessageHandler("RS",(e,r)=>rt(this,null,function*(){var n,a;if(!((a=(n=this.workerSources[e])==null?void 0:n[r.type])!=null&&a[r.source]))return;let i=this.workerSources[e][r.type][r.source];delete this.workerSources[e][r.type][r.source],i.removeSource!==void 0&&i.removeSource(r)})),this.actor.registerMessageHandler("RM",e=>rt(this,null,function*(){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],this.globalStates.delete(e)})),this.actor.registerMessageHandler("SR",(e,r)=>rt(this,null,function*(){this.referrer=r})),this.actor.registerMessageHandler("SRPS",(e,r)=>this._syncRTLPluginState(e,r)),this.actor.registerMessageHandler("IS",(e,r)=>rt(this,null,function*(){yield Uy(r)})),this.actor.registerMessageHandler("SI",(e,r)=>this._setImages(e,r)),this.actor.registerMessageHandler("UL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).update(r.layers,r.removedIds,this._getGlobalState(e))})),this.actor.registerMessageHandler("UGS",(e,r)=>rt(this,null,function*(){let i=this._getGlobalState(e);for(let n in r)i[n]=r[n]})),this.actor.registerMessageHandler("SL",(e,r)=>rt(this,null,function*(){this._getLayerIndex(e).replace(r,this._getGlobalState(e))}))}_getGlobalState(t){let e=this.globalStates.get(t);return e||(e={},this.globalStates.set(t,e)),e}_setImages(t,e){return rt(this,null,function*(){this.availableImages[t]=e;for(let r in this.workerSources[t]){let i=this.workerSources[t][r];for(let n in i)i[n].availableImages=e}})}_syncRTLPluginState(t,e){return rt(this,null,function*(){return yield wr.syncState(e,Uy)})}_getAvailableImages(t){let e=this.availableImages[t];return e||(e=[]),e}_getLayerIndex(t){let e=this.layerIndexes[t];return e||(e=this.layerIndexes[t]=new i5),e}_getWorkerSource(t,e,r){var i,n;if((i=this.workerSources)[t]||(i[t]={}),(n=this.workerSources[t])[e]||(n[e]={}),!this.workerSources[t][e][r]){let a={sendAsync:(s,o)=>(s.targetMapId=t,this.actor.sendAsync(s,o))};switch(e){case"vector":this.workerSources[t][e][r]=new l5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;case"geojson":this.workerSources[t][e][r]=new h5(a,this._getLayerIndex(t),this._getAvailableImages(t));break;default:this.workerSources[t][e][r]=new this.externalWorkerSourceTypes[e](a,this._getLayerIndex(t),this._getAvailableImages(t))}}return this.workerSources[t][e][r]}_getDEMWorkerSource(t,e){var r,i;return(r=this.demWorkerSources)[t]||(r[t]={}),(i=this.demWorkerSources[t])[e]||(i[e]=new u5),this.demWorkerSources[t][e]}};mr(self)&&(self.worker=new p5(self));export{p5 as default};\n/*! Bundled license information:\n\nmaplibre-gl/dist/maplibre-gl-shared.mjs:\nmaplibre-gl/dist/maplibre-gl-worker.mjs:\n (**\n * MapLibre GL JS\n * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v6.9.0/LICENSE.txt\n *)\n*/\n'}}),j8=g({"src/plots/map/layers.js"(t,r){var i=t_(),n=tN().sanitizeHTML,a=vi(),o=y8();function s(t,r){this.subplot=t,this.uid=t.uid+"-"+r,this.index=r,this.idSource="source-"+this.uid,this.idLayer=o.layoutLayerPrefix+this.uid,this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}var l=s.prototype;function u(t){if(!t.visible)return!1;var r=t.source;if(Array.isArray(r)&&r.length>0){for(var n=0;n0}function c(t){var r={},n={};switch(t.type){case"circle":i.extendFlat(n,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":i.extendFlat(n,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity,"line-dasharray":t.line.dash});break;case"fill":i.extendFlat(n,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var o=t.symbol,s=a(o.textposition,o.iconsize);i.extendFlat(r,{"icon-image":o.icon,"icon-size":o.iconsize/10,"text-field":o.text,"text-size":o.textfont.size,"text-anchor":s.anchor,"text-offset":s.offset,"symbol-placement":o.placement}),i.extendFlat(n,{"icon-color":t.color,"text-color":o.textfont.color,"text-opacity":t.opacity});break;case"raster":i.extendFlat(n,{"raster-fade-duration":0,"raster-opacity":t.opacity})}return{layout:r,paint:n}}l.update=function(t){this.visible?this.needsNewImage(t)?this.updateImage(t):this.needsNewSource(t)?(this.removeLayer(),this.updateSource(t),this.updateLayer(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=u(t)},l.needsNewImage=function(t){return this.subplot.map.getSource(this.idSource)&&"image"===this.sourceType&&"image"===t.sourcetype&&(this.source!==t.source||JSON.stringify(this.coordinates)!==JSON.stringify(t.coordinates))},l.needsNewSource=function(t){return this.sourceType!==t.sourcetype||JSON.stringify(this.source)!==JSON.stringify(t.source)||this.layerType!==t.type},l.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==this.subplot.belowLookup["layout-"+this.index]},l.lookupBelow=function(){return this.subplot.belowLookup["layout-"+this.index]},l.updateImage=function(t){this.subplot.map.getSource(this.idSource).updateImage({url:t.source,coordinates:t.coordinates});var r=this.findFollowingMapLayerId(this.lookupBelow());null!==r&&this.subplot.map.moveLayer(this.idLayer,r)},l.updateSource=function(t){var r=this.subplot.map;if(r.getSource(this.idSource)&&r.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,u(t)){var i,a,o,s,l,c=(o=(i=t).sourcetype,s=i.source,l={type:o},"geojson"===o?a="data":"vector"===o?a="string"==typeof s?"url":"tiles":"raster"===o?(a="tiles",l.tileSize=256):"image"===o&&(a="url",l.coordinates=i.coordinates),l[a]=s,i.sourceattribution&&(l.attribution=n(i.sourceattribution)),l);r.addSource(this.idSource,c)}},l.findFollowingMapLayerId=function(t){if("traces"===t)for(var r=this.subplot.getMapLayers(),i=0;i(!y[t]&&/^[a-zA-Z0-9-]+$/.test(t)&&(y[t]=new Promise(r=>{let i=new Image(15,15);i.onload=()=>{g.addImage(t,i,{sdf:!0}),r()},i.onerror=()=>r(),i.crossOrigin="Anonymous",i.src=`https://cdn.jsdelivr.net/npm/@mapbox/maki@8.2.0/icons/${t}.svg`})),y[t])),g.setTransformRequest(function(t){return{url:t=(t=(t=t.replace("https://fonts.openmaptiles.org/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold")).replace("https://tiles.basemaps.cartocdn.com/fonts/Open Sans Extrabold","https://fonts.openmaptiles.org/Open Sans Extra Bold")).replace("https://fonts.openmaptiles.org/Open Sans Regular,Arial Unicode MS Regular","https://fonts.openmaptiles.org/Klokantech Noto Sans Regular")}}),g._canvas.style.left="0px",g._canvas.style.top="0px",u.rejectOnError(l),u.isStatic||u.initFx(t,r);var v=[];v.push(new Promise(function(t){g.once("load",t)})),Promise.all(v=v.concat(s.fetchTraceGeoData(t))).then(function(){m&&M(u,c),k(u,c),u.fillBelowLookup(t,r),u.updateData(t),u.updateLayout(r),u.resolveOnRender(o)}).catch(l)},A.updateMap=function(t,r,i,n){var a=this,o=a.map,l=r[this.id];a.rejectOnError(n);var u=[],c=E(l.style);JSON.stringify(a.styleObj)!==JSON.stringify(c)&&(a.styleObj=c,o.setStyle(c.style),a.traceHash={},u.push(new Promise(function(t){o.once("styledata",t)}))),Promise.all(u=u.concat(s.fetchTraceGeoData(t))).then(function(){a.fillBelowLookup(t,r),a.updateData(t);let n=l._fitBounds;n&&(o.fitBounds([[n.west,n.south],[n.east,n.north]],{padding:_.fitBoundsPadding,animate:!1}),M(a,l),k(a,l)),a.updateLayout(r),a.resolveOnRender(i)}).catch(n)},A.fillBelowLookup=function(t,r){var i,n,a=r[this.id].layers,o=this.belowLookup={},s=!1;for(i=0;i1)for(i=0;ir.project(t).x,_subplot:r},r.yaxis={_id:"y",c2p:t=>r.project(t).y,_subplot:r},r.updateFramework(t),r.mockAxis={type:"linear",showexponent:"all",exponentformat:"B"},u.setConvert(r.mockAxis,t)},A.initFx=function(t,r){var i=this,n=i.gd,a=i.map;function o(){h.loneUnhover(r._hoverlayer)}function s(){var t=i.getView();n.emit("plotly_relayouting",i.getViewEditsWithDerived(t))}a.on("moveend",function(t){if(i.map){var r=n._fullLayout;if(t.originalEvent||i.wheeling){var a=r[i.id];l.call("_storeDirectGUIEdit",n.layout,r._preGUI,i.getViewEdits(a));var o=i.getView();a._input.center=a.center=o.center,a._input.zoom=a.zoom=o.zoom,a._input.bearing=a.bearing=o.bearing,a._input.pitch=a.pitch=o.pitch,n.emit("plotly_relayout",i.getViewEditsWithDerived(o))}t.originalEvent&&"mouseup"===t.originalEvent.type?i.dragging=!1:i.wheeling&&(i.wheeling=!1),r&&r._rehover&&r._rehover()}}),a.on("wheel",function(){i.wheeling=!0}),a.on("mousemove",function(t){var r=i.div.getBoundingClientRect(),o=[t.originalEvent.offsetX,t.originalEvent.offsetY];t.target.getBoundingClientRect=function(){return r},i.xaxis.p2c=function(){return a.unproject(o).lng},i.yaxis.p2c=function(){return a.unproject(o).lat},n._fullLayout._rehover=function(){n._fullLayout._hoversubplot===i.id&&n._fullLayout[i.id]&&h.hover(n,t,i.id)},h.hover(n,t,i.id),n._fullLayout._hoversubplot=i.id}),a.on("dragstart",function(){i.dragging=!0,o()}),a.on("zoomstart",o),a.on("mouseout",function(){n._fullLayout._hoversubplot=null}),a.on("drag",s),a.on("zoom",s),a.on("dblclick",function(){var t=n._fullLayout[i.id];l.call("_storeDirectGUIEdit",n.layout,n._fullLayout._preGUI,i.getViewEdits(t));var r=i.viewInitial;a.setCenter(D(r.center)),a.setZoom(r.zoom),a.setBearing(r.bearing),a.setPitch(r.pitch);var o=i.getView();t._input.center=t.center=o.center,t._input.zoom=t.zoom=o.zoom,t._input.bearing=t.bearing=o.bearing,t._input.pitch=t.pitch=o.pitch,n.emit("plotly_doubleclick",null),n.emit("plotly_relayout",i.getViewEditsWithDerived(o))}),i.clearOutline=function(){v(i.dragOptions),y(i.dragOptions.gd)},i.onClickInPanFn=function(t){return function(r){var a=n._fullLayout.clickmode;a.indexOf("select")>-1&&x(r.originalEvent,n,[i.xaxis],[i.yaxis],i.id,t),a.indexOf("event")>-1&&h.click(n,r.originalEvent)}}},A.updateFx=function(t){var r=this,i=r.map,n=r.gd;if(!r.isStatic){var a=t.dragmode,s=r.dragOptions;r.dragOptions=o.extendDeep(s||{},{dragmode:t.dragmode,element:r.div,gd:n,plotinfo:{id:r.id,domain:t[r.id].domain,xaxis:r.xaxis,yaxis:r.yaxis,fillRangeItems:function(t,i){i.isRect?(t.range={})[r.id]=[l([i.xmin,i.ymin]),l([i.xmax,i.ymax])]:(t.lassoPoints={})[r.id]=i.map(l)}},xaxes:[r.xaxis],yaxes:[r.yaxis],subplot:r.id}),i.off("click",r.onClickInPanHandler),m(a)||p(a)?(i.dragPan.disable(),i.on("zoomstart",r.clearOutline),r.dragOptions.prepFn=function(t,i,n){g(t,i,n,r.dragOptions,a)},c.init(r.dragOptions)):(i.dragPan.enable(),i.off("zoomstart",r.clearOutline),r.div.onmousedown=null,r.div.ontouchstart=null,r.div.removeEventListener("touchstart",r.div._ontouchstart),r.onClickInPanHandler=r.onClickInPanFn(r.dragOptions),i.on("click",r.onClickInPanHandler))}function l(t){var i=r.map.unproject(t);return[i.lng,i.lat]}},A.updateFramework=function(t){var r=t[this.id].domain,i=t._size,n=this.div.style;n.width=i.w*(r.x[1]-r.x[0])+"px",n.height=i.h*(r.y[1]-r.y[0])+"px",n.left=i.l+r.x[0]*i.w+"px",n.top=i.t+(1-r.y[1])*i.h+"px",this.xaxis._offset=i.l+r.x[0]*i.w,this.xaxis._length=i.w*(r.x[1]-r.x[0]),this.yaxis._offset=i.t+(1-r.y[1])*i.h,this.yaxis._length=i.h*(r.y[1]-r.y[0])},A.updateLayers=function(t){var r,i=t[this.id].layers,n=this.layerList;if(i.length!==n.length){for(r=0;rNe});var Nt,Nr=m({"src/plots/map/get_map_fit_bounds.ts"(){Nt=x(pD())}}),Ni=g({"src/plots/map/layout_defaults.js"(t,r){var i=t_(),n=sr(),a=tJ(),o=y7(),{getMapFitBounds:s}=(Nr(),b(j9));function l(t,r,i,n){i("style"),i("center.lon"),i("center.lat"),i("zoom"),i("bearing"),i("pitch");let o=i("fitbounds");var l=i("bounds.west"),c=i("bounds.east"),h=i("bounds.south"),d=i("bounds.north");(void 0===l||void 0===c||void 0===h||void 0===d)&&delete r.bounds,a(t,r,{name:"layers",handleItemDefaults:u}),r._fitBounds=null;let{_fitView:{center:f,zoom:p}={},center:m,zoom:g}=t,y=m?.lon===f?.lon&&m?.lat===f?.lat&&g===p;if(o&&y){let t=s(n.fullData,n.id);t&&(r._fitBounds=t)}r._input=t}function u(t,r){function n(n,a){return i.coerce(t,r,o.layers,n,a)}if(n("visible")){var a,s=n("sourcetype"),l="raster"===s||"image"===s;n("source"),n("sourceattribution"),"vector"===s&&n("sourcelayer"),"image"===s&&n("coordinates"),l&&(a="raster");var u=n("type",a);l&&"raster"!==u&&(u=r.type="raster",i.log("Source types *raster* and *image* must drawn *raster* layer type.")),n("below"),n("color"),n("opacity"),n("minzoom"),n("maxzoom"),"circle"===u&&n("circle.radius"),"line"===u&&(n("line.width"),n("line.dash")),"fill"===u&&n("fill.outlinecolor"),"symbol"===u&&(n("symbol.icon"),n("symbol.iconsize"),n("symbol.text"),i.coerceFont(n,"symbol.textfont",void 0,{noFontVariant:!0,noFontShadow:!0,noFontLineposition:!0,noFontTextcase:!0}),n("symbol.textposition"),n("symbol.placement"))}}r.exports=function(t,r,i){n(t,r,i,{type:"map",attributes:o,handleDefaults:l,partition:"y",fullData:i})}}}),Nn=g({"src/plots/map/index.js"(t){var r=t_(),i=r.strTranslate,n=r.strScale,a=tF().getSubplotCalcData,o=tB(),s=k(),l=rr(),u=tN(),c=j7();t.name="map",t.attr="subplot",t.idRoot="map",t.idRegex=t.attrRegex=r.counterRegex("map"),t.attributes={subplot:{valType:"subplotid",dflt:"map",editType:"calc"}},t.layoutAttributes=y7(),t.supplyLayoutDefaults=Ni(),t.plot=function(t){for(var r=t._fullLayout,i=t.calcdata,n=r._subplots.map,o=0;ox/2){var b=m.split("|").join("
");y.text(b).attr("data-unformatted",b).call(u.convertToTspans,t),v=l.bBox(y.node())}y.attr("transform",i(-3,-v.height+8)),g.insert("rect",".static-attribution").attr({x:-v.width-6,y:-v.height-3,width:v.width+6,height:v.height+3,fill:"rgba(255, 255, 255, 0.75)"});var _=1;v.width+6>x&&(_=x/(v.width+6));var w=[c.l+c.w*f.x[1],c.t+c.h*(1-f.y[0])];g.attr("transform",i(w[0],w[1])+n(_))}},t.updateFx=function(t){for(var r=t._fullLayout,i=r._subplots.map,n=0;n=0;i--)t.removeLayer(r[i][1])},s.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},r.exports=function(t,r){var n=r[0].trace,a=new o(t,n.uid),s=a.sourceId,l=i(r),u=a.below=t.belowLookup["trace-"+n.uid];return t.map.addSource(s,{type:"geojson",data:l.geojson}),a._addLayers(l,u),r[0].trace._glTrace=a,a}}}),Nh=g({"src/traces/choroplethmap/index.js"(t,r){r.exports={attributes:Ns(),supplyDefaults:Nl(),colorbar:ou(),calc:p$(),plot:Nc(),hoverPoints:pZ(),eventData:pX(),selectPoints:pK(),styleOnSelect:function(t,r){r&&r[0].trace._glTrace.updateOnSelect(r)},getBelow:function(t,r){for(var i=r.getMapLayers(),n=i.length-2;n>=0;n--){var a=i[n].id;if("string"==typeof a&&0===a.indexOf("water")){for(var o=n+1;o0?+p[h]:0),d.push({type:"Feature",geometry:{type:"Point",coordinates:v},properties:x})}}var _=o.extractOpts(r),w=_.reversescale?o.flipScale(_.colorscale):_.colorscale,T=w[0][1],A=["interpolate",["linear"],["heatmap-density"],0,1>a.opacity(T)?T:a.addOpacity(T,0)];for(h=1;h=0;i--)t.removeLayer(r[i][1])},o.dispose=function(){var t=this.subplot.map;this._removeLayers(),t.removeSource(this.sourceId)},r.exports=function(t,r){var n=r[0].trace,o=new a(t,n.uid),s=o.sourceId,l=i(r),u=o.below=t.belowLookup["trace-"+n.uid];return t.map.addSource(s,{type:"geojson",data:l.geojson}),o._addLayers(l,u),o}}}),Nv=g({"src/traces/densitymap/hover.js"(t,r){var i=rs(),n=vo().hoverPoints,a=vo().getExtraText;r.exports=function(t,r,o){var s=n(t,r,o);if(s){var l=s[0],u=l.cd,c=u[0].trace,h=u[l.index];if(delete l.color,"z"in h){var d=l.subplot.mockAxis;l.z=h.z,l.zLabel=i.tickText(d,d.c2l(h.z),"hover").text}return l.extraText=a(c,h,u[0].t.labels),[l]}}}}),Nx=g({"src/traces/densitymap/event_data.js"(t,r){r.exports=function(t,r){return t.lon=r.lon,t.lat=r.lat,t.z=r.z,t}}}),Nb=g({"src/traces/densitymap/index.js"(t,r){r.exports={attributes:Nf(),supplyDefaults:Np(),colorbar:ou(),formatLabels:vr(),calc:Nm(),plot:Ny(),hoverPoints:Nv(),eventData:Nx(),getBelow:function(t,r){for(var i=r.getMapLayers(),n=0;na.addOpacity(v[r%v.length],.8))),y("customdata");var x=t.link||{},b=l.newContainer(r,"link");function _(t,r){return i.coerce(x,b,n.link,t,r)}_("label"),_("arrowlen"),_("source"),_("target"),_("value"),_("line.color"),_("line.width"),_("hoverinfo",t.hoverinfo),s(x,b,_,p),_("hovertemplate"),_("sort");var w=.333>a.luminosity(d.paper_bgcolor),T=_("color",w?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)");function A(t){if(!a.isValid(t))return t;let r=a.opacity(t);return r<=.8?a.addOpacity(t,r+.2):w?a.brighten(t,10):a.adjustLightness(t,-10)}_("hovercolor",Array.isArray(T)?T.map(A):A(T)),_("customdata"),u(x,b,{name:"colorscales",handleItemDefaults:c}),o(r,d,f),f("orientation"),f("direction"),f("valueformat"),f("valuesuffix"),f("arrangement",g.x.length&&g.y.length?"freeform":void 0),i.coerceFont(f,"textfont",d.font,{autoShadowDflt:!0}),r._length=null}}}),NA=g({"node_modules/strongly-connected-components/scc.js"(t,r){r.exports=function(t){for(var r=t.length,i=Array(r),n=Array(r),a=Array(r),o=Array(r),s=Array(r),l=Array(r),u=0;u0;){var p=t[r=f[f.length-1]];if(o[r]=0&&l[r].push(s[g])}o[r]=m}else{if(n[r]===i[r]){for(var y=[],v=[],x=0,m=u.length-1;m>=0;--m){var b=u[m];if(a[b]=!1,y.push(b),v.push(l[b]),x+=l[b].length,s[b]=h.length,b===r){u.length=m;break}}h.push(y);for(var _=Array(x),m=0;mb&&(b=u.source[r]),u.target[r]>b&&(b=u.target[r]);var _=b+1;t.node._count=_;var w,T=t.node.groups,A={};for(r=0;r0&&s(I,_)&&s(L,_)&&!(A.hasOwnProperty(I)&&A.hasOwnProperty(L)&&A[I]===A[L])){A.hasOwnProperty(L)&&(L=A[L]),A.hasOwnProperty(I)&&(I=A[I]),L*=1,p[I*=1]=p[L]=!0;var P="";u.label&&u.label[r]&&(P=u.label[r]);var z=null;P&&m.hasOwnProperty(P)&&(z=m[P]),c.push({pointNumber:r,label:P,color:h?u.color[r]:u.color,hovercolor:d?u.hovercolor[r]:u.hovercolor,customdata:f?u.customdata[r]:u.customdata,concentrationscale:z,source:I,target:L,value:+C}),E.push(I),D.push(L)}}var F=_+T.length,O=o(a.color),R=o(a.customdata),B=[];for(r=0;r_-1,childrenNodes:[],pointNumber:r,label:j,color:O?a.color[r]:a.color,customdata:R?a.customdata[r]:a.customdata})}var N=!1;return function(t,r,a){for(var o=n.init2dArray(t,0),s=0;s1})}(F,E,D)&&(N=!0),{circular:N,links:c,nodes:B,groups:T,groupLookup:A}}(r);return a({circular:u.circular,_nodes:u.nodes,_links:u.links,_groups:u.groups,_groupLookup:u.groupLookup})}}}),Nk=g({"node_modules/d3-quadtree/dist/d3-quadtree.js"(t,r){var i;i=t,function(t){function r(t,r,i,n){if(isNaN(r)||isNaN(i))return t;var a,o,s,l,u,c,h,d,f,p=t._root,m={data:n},g=t._x0,y=t._y0,v=t._x1,x=t._y1;if(!p)return t._root=m,t;for(;p.length;)if((c=r>=(o=(g+v)/2))?g=o:v=o,(h=i>=(s=(y+x)/2))?y=s:x=s,a=p,!(p=p[d=h<<1|c]))return a[d]=m,t;if(l=+t._x.call(null,p.data),u=+t._y.call(null,p.data),r===l&&i===u)return m.next=p,a?a[d]=m:t._root=m,t;do a=a?a[d]=[,,,,]:t._root=[,,,,],(c=r>=(o=(g+v)/2))?g=o:v=o,(h=i>=(s=(y+x)/2))?y=s:x=s;while((d=h<<1|c)==(f=(u>=s)<<1|l>=o));return a[f]=p,a[d]=m,t}function i(t,r,i,n,a){this.node=t,this.x0=r,this.y0=i,this.x1=n,this.y1=a}function n(t){return t[0]}function a(t){return t[1]}function o(t,r,i){var o=new s(r??n,i??a,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function s(t,r,i,n,a,o){this._x=t,this._y=r,this._x0=i,this._y0=n,this._x1=a,this._y1=o,this._root=void 0}function l(t){for(var r={data:t.data},i=r;t=t.next;)i=i.next={data:t.data};return r}var u=o.prototype=s.prototype;u.copy=function(){var t,r,i=new s(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return i;if(!n.length)return i._root=l(n),i;for(t=[{source:n,target:i._root=[,,,,]}];n=t.pop();)for(var a=0;a<4;++a)(r=n.source[a])&&(r.length?t.push({source:r,target:n.target[a]=[,,,,]}):n.target[a]=l(r));return i},u.add=function(t){var i=+this._x.call(null,t),n=+this._y.call(null,t);return r(this.cover(i,n),i,n,t)},u.addAll=function(t){var i,n,a,o,s=t.length,l=Array(s),u=Array(s),c=1/0,h=1/0,d=-1/0,f=-1/0;for(n=0;nd&&(d=a),of&&(f=o));if(c>d||h>f)return this;for(this.cover(c,h).cover(d,f),n=0;nt||t>=a||n>r||r>=o;)switch((s=[,,,,])[l=(rp||(s=c.y0)>m||(l=c.x1)=x)<<1|t>=v)&&(c=g[g.length-1],g[g.length-1]=g[g.length-1-h],g[g.length-1-h]=c)}else{var b=t-this._x.call(null,y.data),_=r-this._y.call(null,y.data),w=b*b+_*_;if(w=(l=(m+y)/2))?m=l:y=l,(h=s>=(u=(g+v)/2))?g=u:v=u,r=p,!(p=p[d=h<<1|c]))return this;if(!p.length)break;(r[d+1&3]||r[d+2&3]||r[d+3&3])&&(i=r,f=d)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(a=p.next)&&delete p.next,n?a?n.next=a:delete n.next:r?(a?r[d]=a:delete r[d],(p=r[0]||r[1]||r[2]||r[3])&&p===(r[3]||r[2]||r[1]||r[0])&&!p.length&&(i?i[f]=p:this._root=p)):this._root=a,this},u.removeAll=function(t){for(var r=0,i=t.length;rtypeof r?t:(i=i||self).d3=i.d3||{})}}),NS=g({"node_modules/d3-collection/dist/d3-collection.js"(t,r){(function(t){function r(){}function i(t,i){var n=new r;if(t instanceof r)t.each(function(t,r){n.set(r,t)});else if(Array.isArray(t)){var a,o=-1,s=t.length;if(null==i)for(;++o=u.length)return null!=t&&n.sort(t),null!=r?r(n):n;for(var l,c,d,f=-1,p=n.length,m=u[a++],g=i(),y=o();++fu.length)return i;var a,o=c[n-1];return null!=r&&n>=u.length?a=i.entries():(a=[],i.each(function(r,i){a.push({key:i,values:t(r,n)})})),null!=o?a.sort(function(t,r){return o(t.key,r.key)}):a}(h(t,0,o,s),0)},key:function(t){return u.push(t),l},sortKeys:function(t){return c[u.length-1]=t,l},sortValues:function(r){return t=r,l},rollup:function(t){return r=t,l}}},t.set=c,t.map=i,t.keys=function(t){var r=[];for(var i in t)r.push(i);return r},t.values=function(t){var r=[];for(var i in t)r.push(t[i]);return r},t.entries=function(t){var r=[];for(var i in t)r.push({key:i,value:t[i]});return r},Object.defineProperty(t,"__esModule",{value:!0})})("object"==typeof t&&"u">typeof r?t:t.d3=t.d3||{})}}),NE=g({"node_modules/d3-dispatch/dist/d3-dispatch.js"(t,r){var i;i=t,function(t){var r={value:function(){}};function i(){for(var t,r=0,i=arguments.length,a={};r=0&&(r=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw Error("unknown type: "+t);return{type:t,name:r}}),s=-1,l=o.length;if(arguments.length<2){for(;++s0)for(var i,n,a=Array(i),o=0;otypeof r?t:(i=i||self).d3=i.d3||{})}}),ND=g({"node_modules/d3-timer/dist/d3-timer.js"(t,r){var i;i=t,function(t){var r,i,n=0,a=0,o=0,s=0,l=0,u=0,c="object"==typeof performance&&performance.now?performance:Date,h="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function d(){return l||(h(f),l=c.now()+u)}function f(){l=0}function p(){this._call=this._time=this._next=null}function m(t,r,i){var n=new p;return n.restart(t,r,i),n}function g(){d(),++n;for(var t,i=r;i;)(t=l-i._time)>=0&&i._call.call(null,t),i=i._next;--n}function y(){l=(s=c.now())+u,n=a=0;try{g()}finally{n=0,function(){for(var t,n,a=r,o=1/0;a;)a._call?(o>a._time&&(o=a._time),t=a,a=a._next):(n=a._next,a._next=null,a=t?t._next=n:r=n);i=t,x(o)}(),l=0}}function v(){var t=c.now(),r=t-s;r>1e3&&(u-=r,s=t)}function x(t){!n&&(a&&(a=clearTimeout(a)),t-l>24?(t<1/0&&(a=setTimeout(y,t-c.now()-u)),o&&(o=clearInterval(o))):(o||(s=c.now(),o=setInterval(v,1e3)),n=1,h(y)))}p.prototype=m.prototype={constructor:p,restart:function(t,n,a){if("function"!=typeof t)throw TypeError("callback is not a function");a=(null==a?d():+a)+(null==n?0:+n),this._next||i===this||(i?i._next=this:r=this,i=this),this._call=t,this._time=a,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}},t.interval=function(t,r,i){var n=new p,a=r;return null==r?n.restart(t,r,i):(r*=1,i=null==i?d():+i,n.restart(function o(s){s+=a,n.restart(o,a+=r,i),t(s)},r,i)),n},t.now=d,t.timeout=function(t,r,i){var n=new p;return r=null==r?0:+r,n.restart(function(i){n.stop(),t(i+r)},r,i),n},t.timer=m,t.timerFlush=g,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof t&&"u">typeof r?t:(i=i||self).d3=i.d3||{})}}),NC=g({"node_modules/d3-force/dist/d3-force.js"(t,r){var i;i=function(t,r,i,n,a){function o(t){return function(){return t}}function s(){return(Math.random()-.5)*1e-6}function l(t){return t.x+t.vx}function u(t){return t.y+t.vy}function c(t){return t.index}function h(t,r){var i=t.get(r);if(!i)throw Error("missing: "+r);return i}function d(t){return t.x}function f(t){return t.y}var p=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,r){var i;function n(){var n,a,o=i.length,s=0,l=0;for(n=0;nh.index){var d=f-l.x-l.vx,y=p-l.y-l.vy,v=d*d+y*y;vf+c||np+c||ot.r&&(t.r=t[r].r)}function f(){if(i){var r,a,o=i.length;for(n=Array(o),r=0;r=c)){(t.data!==i||t.next)&&(0===d&&(m+=(d=s())*d),0===f&&(m+=(f=s())*f),m1?(null==i?h.remove(t):h.set(t,v(i)),r):h.get(t)},find:function(r,i,n){var a,o,s,l,u,c=0,h=t.length;for(null==n?n=1/0:n*=n,c=0;c1?(f.on(t,i),r):f.on(t)}}},t.forceX=function(t){var r,i,n,a=o(.1);function s(t){for(var a,o=0,s=r.length;otypeof r?i(t,Nk(),NS(),NE(),ND()):i(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3)}}),NI=g({"node_modules/d3-array/dist/d3-array.js"(t,r){var i;i=t,function(t){function r(t,r){return tr?1:t>=r?0:NaN}function i(t){var i;let n=t,a=t;function o(t,r,i,n){for(null==i&&(i=0),null==n&&(n=t.length);i>>1;0>a(t[o],r)?i=o+1:n=o}return i}return 1===t.length&&(n=(r,i)=>t(r)-i,i=t,a=(t,n)=>r(i(t),n)),{left:o,center:function(t,r,i,a){null==i&&(i=0),null==a&&(a=t.length);let s=o(t,r,i,a-1);return s>i&&n(t[s-1],r)>-n(t[s],r)?s-1:s},right:function(t,r,i,n){for(null==i&&(i=0),null==n&&(n=t.length);i>>1;a(t[o],r)>0?n=o:i=o+1}return i}}}function n(t){return null===t?NaN:+t}let a=i(r),o=a.right,s=a.left,l=i(n).center;function u(t,r){let i=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&++i;else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(a*=1)>=a&&++i}return i}function c(t){return 0|t.length}function h(t){return!(t>0)}function d(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function f(t,r){let i=0,n,a=0,o=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(n=r-a,a+=n/++i,o+=n*(r-a));else{let s=-1;for(let l of t)null!=(l=r(l,++s,t))&&(l*=1)>=l&&(n=l-a,a+=n/++i,o+=n*(l-a))}if(i>1)return o/(i-1)}function p(t,r){let i=f(t,r);return i&&Math.sqrt(i)}function m(t,r){let i,n;if(void 0===r)for(let r of t)null!=r&&(void 0===i?r>=r&&(i=n=r):(i>r&&(i=r),n=o&&(i=n=o):(i>o&&(i=o),n0){for(o=t[--r];r>0&&(o=(i=o)+(n=t[--r]),!(a=n-(o-i))););r>0&&(a<0&&t[r-1]<0||a>0&&t[r-1]>0)&&(i=o+(n=2*a),n==i-o&&(o=i))}return o}}class y extends Map{constructor(t,r=w){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),null!=t)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(x(this,t))}has(t){return super.has(x(this,t))}set(t,r){return super.set(b(this,t),r)}delete(t){return super.delete(_(this,t))}}class v extends Set{constructor(t,r=w){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),null!=t)for(let r of t)this.add(r)}has(t){return super.has(x(this,t))}add(t){return super.add(b(this,t))}delete(t){return super.delete(_(this,t))}}function x({_intern:t,_key:r},i){let n=r(i);return t.has(n)?t.get(n):i}function b({_intern:t,_key:r},i){let n=r(i);return t.has(n)?t.get(n):(t.set(n,i),i)}function _({_intern:t,_key:r},i){let n=r(i);return t.has(n)&&(i=t.get(i),t.delete(n)),i}function w(t){return null!==t&&"object"==typeof t?t.valueOf():t}function A(t){return t}function M(t,...r){return E(t,A,A,r)}function k(t,r,...i){return E(t,A,r,i)}function S(t){if(1!==t.length)throw Error("duplicate key");return t[0]}function E(t,r,i,n){return function t(a,o){if(o>=n.length)return i(a);let s=new y,l=n[o++],u=-1;for(let t of a){let r=l(t,++u,a),i=s.get(r);i?i.push(t):s.set(r,[t])}for(let[r,i]of s)s.set(r,t(i,o));return r(s)}(t,0)}function D(t,r){return Array.from(r,r=>t[r])}function C(t,...i){if("function"!=typeof t[Symbol.iterator])throw TypeError("values is not iterable");t=Array.from(t);let[n=r]=i;if(1===n.length||i.length>1){let a=Uint32Array.from(t,(t,r)=>r);return i.length>1?(i=i.map(r=>t.map(r)),a.sort((t,n)=>{for(let a of i){let i=r(a[t],a[n]);if(i)return i}})):(n=t.map(n),a.sort((t,i)=>r(n[t],n[i]))),D(t,a)}return t.sort(n)}var I=Array.prototype.slice;function L(t){return function(){return t}}var P=Math.sqrt(50),z=Math.sqrt(10),F=Math.sqrt(2);function O(t,r,i){var n,a,o,s,l=-1;if(i*=1,(t*=1)==(r*=1)&&i>0)return[t];if((n=r0){let i=Math.round(t/s),n=Math.round(r/s);for(i*sr&&--n,o=Array(a=n-i+1);++lr&&--n,o=Array(a=n-i+1);++l=0?(o>=P?10:o>=z?5:o>=F?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(o>=P?10:o>=z?5:o>=F?2:1)}function B(t,r,i){let n;for(;;){let a=R(t,r,i);if(a===n||0===a||!isFinite(a))return[t,r];a>0?(t=Math.floor(t/a)*a,r=Math.ceil(r/a)*a):a<0&&(t=Math.ceil(t*a)/a,r=Math.floor(r*a)/a),n=a}}function j(t){return Math.ceil(Math.log(u(t))/Math.LN2)+1}function N(){var t=A,r=m,i=j;function n(n){Array.isArray(n)||(n=Array.from(n));var a,s,l=n.length,u=Array(l);for(a=0;a=d)if(t>=d&&r===m){let t=R(h,d,i);isFinite(t)&&(t>0?d=(Math.floor(d/t)+1)*t:t<0&&(d=-((Math.ceil(-(d*t))+1)/t)))}else f.pop()}for(var p=f.length;f[0]<=h;)f.shift(),--p;for(;f[p-1]>d;)f.pop(),--p;var g,y=Array(p+1);for(a=0;a<=p;++a)(g=y[a]=[]).x0=a>0?f[a-1]:h,g.x1=a=r)&&(i=r);else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(i=a)&&(i=a)}return i}function U(t,r){let i;if(void 0===r)for(let r of t)null!=r&&(i>r||void 0===i&&r>=r)&&(i=r);else{let n=-1;for(let a of t)null!=(a=r(a,++n,t))&&(i>a||void 0===i&&a>=a)&&(i=a)}return i}function q(t,i,n=0,a=t.length-1,o=r){for(;a>n;){if(a-n>600){let r=a-n+1,s=i-n+1,l=Math.log(r),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(r-u)/r)*(s-r/2<0?-1:1),h=Math.max(n,Math.floor(i-s*u/r+c)),d=Math.min(a,Math.floor(i+(r-s)*u/r+c));q(t,i,h,d,o)}let r=t[i],s=n,l=a;for(G(t,n,i),o(t[a],r)>0&&G(t,n,a);so(t[s],r);)++s;for(;o(t[l],r)>0;)--l}0===o(t[n],r)?G(t,n,l):G(t,++l,a),l<=i&&(n=l+1),i<=l&&(a=l-1)}return t}function G(t,r,i){let n=t[r];t[r]=t[i],t[i]=n}function H(t,r,i){if(n=(t=Float64Array.from(function*(t,r){if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(yield r);else{let i=-1;for(let n of t)null!=(n=r(n,++i,t))&&(n*=1)>=n&&(yield n)}}(t,i))).length){if((r*=1)<=0||n<2)return U(t);if(r>=1)return V(t);var n,a=(n-1)*r,o=Math.floor(a),s=V(q(t,o).subarray(0,o+1));return s+(U(t.subarray(o+1))-s)*(a-o)}}function $(t,r){let i,n=-1,a=-1;if(void 0===r)for(let r of t)++a,null!=r&&(i=r)&&(i=r,n=a);else for(let o of t)null!=(o=r(o,++a,t))&&(i=o)&&(i=o,n=a);return n}function W(t,r){let i,n=-1,a=-1;if(void 0===r)for(let r of t)++a,null!=r&&(i>r||void 0===i&&r>=r)&&(i=r,n=a);else for(let o of t)null!=(o=r(o,++a,t))&&(i>o||void 0===i&&o>=o)&&(i=o,n=a);return n}function Y(t,r){return[t,r]}function Z(t,i=r){if(1===i.length)return W(t,i);let n,a=-1,o=-1;for(let r of t)++o,(a<0?0===i(r,r):0>i(r,n))&&(n=r,a=o);return a}var X=K(Math.random);function K(t){return function(r,i=0,n=r.length){let a=n-(i*=1);for(;a;){let n=t()*a--|0,o=r[a+i];r[a+i]=r[n+i],r[n+i]=o}return r}}function J(t){if(!(a=t.length))return[];for(var r=-1,i=U(t,Q),n=Array(i);++rr(...t)),n=(t=t.map(d)).map(c),a=t.length-1,o=Array(a+1).fill(0),s=[];if(a<0||n.some(h))return s;for(;;){s.push(o.map((r,i)=>t[i][r]));let r=a;for(;++o[r]===n[r];){if(0===r)return i?s.map(i):s;o[r--]=0}}},t.cumsum=function(t,r){var i=0,n=0;return Float64Array.from(t,void 0===r?t=>i+=+t||0:a=>i+=+r(a,n++,t)||0)},t.descending=function(t,r){return rt?1:r>=t?0:NaN},t.deviation=p,t.difference=function(t,...r){for(let i of(t=new Set(t),r))for(let r of i)t.delete(r);return t},t.disjoint=function(t,r){let i=r[Symbol.iterator](),n=new Set;for(let r of t){let t,a;if(n.has(r))return!1;for(;({value:t,done:a}=i.next())&&!a;){if(Object.is(r,t))return!1;n.add(t)}}return!0},t.every=function(t,r){if("function"!=typeof r)throw TypeError("test is not a function");let i=-1;for(let n of t)if(!r(n,++i,t))return!1;return!0},t.extent=m,t.fcumsum=function(t,r){let i=new g,n=-1;return Float64Array.from(t,void 0===r?t=>i.add(+t||0):a=>i.add(+r(a,++n,t)||0))},t.filter=function(t,r){if("function"!=typeof r)throw TypeError("test is not a function");let i=[],n=-1;for(let a of t)r(a,++n,t)&&i.push(a);return i},t.fsum=function(t,r){let i=new g;if(void 0===r)for(let r of t)(r*=1)&&i.add(r);else{let n=-1;for(let a of t)(a=+r(a,++n,t))&&i.add(a)}return+i},t.greatest=function(t,i=r){let n,a=!1;if(1===i.length){let o;for(let s of t){let t=i(s);(a?r(t,o)>0:0===r(t,t))&&(n=s,o=t,a=!0)}}else for(let r of t)(a?i(r,n)>0:0===i(r,r))&&(n=r,a=!0);return n},t.greatestIndex=function(t,i=r){if(1===i.length)return $(t,i);let n,a=-1,o=-1;for(let r of t)++o,(a<0?0===i(r,r):i(r,n)>0)&&(n=r,a=o);return a},t.group=M,t.groupSort=function(t,i,n){return(1===i.length?C(k(t,i,n),([t,i],[n,a])=>r(i,a)||r(t,n)):C(M(t,n),([t,n],[a,o])=>i(n,o)||r(t,a))).map(([t])=>t)},t.groups=function(t,...r){return E(t,Array.from,A,r)},t.histogram=N,t.index=function(t,...r){return E(t,A,S,r)},t.indexes=function(t,...r){return E(t,Array.from,S,r)},t.intersection=function(t,...r){t=new Set(t),r=r.map(ee);e:for(let i of t)for(let n of r)if(!n.has(i)){t.delete(i);continue e}return t},t.least=function(t,i=r){let n,a=!1;if(1===i.length){let o;for(let s of t){let t=i(s);(a?0>r(t,o):0===r(t,t))&&(n=s,o=t,a=!0)}}else for(let r of t)(a?0>i(r,n):0===i(r,r))&&(n=r,a=!0);return n},t.leastIndex=Z,t.map=function(t,r){if("function"!=typeof t[Symbol.iterator])throw TypeError("values is not iterable");if("function"!=typeof r)throw TypeError("mapper is not a function");return Array.from(t,(i,n)=>r(i,n,t))},t.max=V,t.maxIndex=$,t.mean=function(t,r){let i=0,n=0;if(void 0===r)for(let r of t)null!=r&&(r*=1)>=r&&(++i,n+=r);else{let a=-1;for(let o of t)null!=(o=r(o,++a,t))&&(o*=1)>=o&&(++i,n+=o)}if(i)return n/i},t.median=function(t,r){return H(t,.5,r)},t.merge=function(t){return Array.from(function*(t){for(let r of t)yield*T(r)}(t))},t.min=U,t.minIndex=W,t.nice=B,t.pairs=function(t,r=Y){let i=[],n,a=!1;for(let o of t)a&&i.push(r(n,o)),n=o,a=!0;return i},t.permute=D,t.quantile=H,t.quantileSorted=function(t,r,i=n){if(a=t.length){if((r*=1)<=0||a<2)return+i(t[0],0,t);if(r>=1)return+i(t[a-1],a-1,t);var a,o=(a-1)*r,s=Math.floor(o),l=+i(t[s],s,t);return l+(i(t[s+1],s+1,t)-l)*(o-s)}},t.quickselect=q,t.range=function(t,r,i){t*=1,r*=1,i=(a=arguments.length)<2?(r=t,t=0,1):a<3?1:+i;for(var n=-1,a=0|Math.max(0,Math.ceil((r-t)/i)),o=Array(a);++n=P?a*=10:o>=z?a*=5:o>=F&&(a*=2),rtypeof r?t:(i="u">typeof globalThis?globalThis:i||self).d3=i.d3||{})}}),NL=g({"node_modules/d3-path/dist/d3-path.js"(t,r){var i;i=t,function(t){var r=Math.PI,i=2*r,n=i-1e-6;function a(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function o(){return new a}a.prototype=o.prototype={constructor:a,moveTo:function(t,r){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+r)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,r){this._+="L"+(this._x1=+t)+","+(this._y1=+r)},quadraticCurveTo:function(t,r,i,n){this._+="Q"+ +t+","+ +r+","+(this._x1=+i)+","+(this._y1=+n)},bezierCurveTo:function(t,r,i,n,a,o){this._+="C"+ +t+","+ +r+","+ +i+","+ +n+","+(this._x1=+a)+","+(this._y1=+o)},arcTo:function(t,i,n,a,o){t*=1,i*=1,n*=1,a*=1,o*=1;var s=this._x1,l=this._y1,u=n-t,c=a-i,h=s-t,d=l-i,f=h*h+d*d;if(o<0)throw Error("negative radius: "+o);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=i);else if(f>1e-6)if(Math.abs(d*u-c*h)>1e-6&&o){var p=n-s,m=a-l,g=u*u+c*c,y=Math.sqrt(g),v=Math.sqrt(f),x=o*Math.tan((r-Math.acos((g+f-(p*p+m*m))/(2*y*v)))/2),b=x/v,_=x/y;Math.abs(b-1)>1e-6&&(this._+="L"+(t+b*h)+","+(i+b*d)),this._+="A"+o+","+o+",0,0,"+ +(d*p>h*m)+","+(this._x1=t+_*u)+","+(this._y1=i+_*c)}else this._+="L"+(this._x1=t)+","+(this._y1=i)},arc:function(t,a,o,s,l,u){t*=1,a*=1,o*=1,u=!!u;var c=o*Math.cos(s),h=o*Math.sin(s),d=t+c,f=a+h,p=1^u,m=u?s-l:l-s;if(o<0)throw Error("negative radius: "+o);null===this._x1?this._+="M"+d+","+f:(Math.abs(this._x1-d)>1e-6||Math.abs(this._y1-f)>1e-6)&&(this._+="L"+d+","+f),o&&(m<0&&(m=m%i+i),m>n?this._+="A"+o+","+o+",0,1,"+p+","+(t-c)+","+(a-h)+"A"+o+","+o+",0,1,"+p+","+(this._x1=d)+","+(this._y1=f):m>1e-6&&(this._+="A"+o+","+o+",0,"+ +(m>=r)+","+p+","+(this._x1=t+o*Math.cos(l))+","+(this._y1=a+o*Math.sin(l))))},rect:function(t,r,i,n){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+r)+"h"+ +i+"v"+ +n+"h"+-i+"Z"},toString:function(){return this._}},t.path=o,Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof t&&"u">typeof r?t:(i=i||self).d3=i.d3||{})}}),NP=g({"node_modules/d3-shape/dist/d3-shape.js"(t,r){var i,n;i=t,n=function(t,r){function i(t){return function(){return t}}var n=Math.abs,a=Math.atan2,o=Math.cos,s=Math.max,l=Math.min,u=Math.sin,c=Math.sqrt,h=Math.PI,d=h/2,f=2*h;function p(t){return t>=1?d:t<=-1?-d:Math.asin(t)}function m(t){return t.innerRadius}function g(t){return t.outerRadius}function y(t){return t.startAngle}function v(t){return t.endAngle}function x(t){return t&&t.padAngle}function b(t,r,i,n,a,o,l){var u=t-i,h=r-n,d=(l?o:-o)/c(u*u+h*h),f=d*h,p=-d*u,m=t+f,g=r+p,y=i+f,v=n+p,x=(m+y)/2,b=(g+v)/2,_=y-m,w=v-g,T=_*_+w*w,A=a-o,M=m*v-y*g,k=(w<0?-1:1)*c(s(0,A*A*T-M*M)),S=(M*w-_*k)/T,E=(-M*_-w*k)/T,D=(M*w+_*k)/T,C=(-M*_+w*k)/T,I=S-x,L=E-b,P=D-x,z=C-b;return I*I+L*L>P*P+z*z&&(S=D,E=C),{cx:S,cy:E,x01:-f,y01:-p,x11:S*(a/A-1),y11:E*(a/A-1)}}function _(t){this._context=t}function w(t){return new _(t)}function T(t){return t[0]}function A(t){return t[1]}function M(){var t=T,n=A,a=i(!0),o=null,s=w,l=null;function u(i){var u,c,h,d=i.length,f=!1;for(null==o&&(l=s(h=r.path())),u=0;u<=d;++u)!(u=d;--f)c.point(v[f],x[f]);c.lineEnd(),c.areaEnd()}y&&(v[h]=+t(p,h,i),x[h]=+a(p,h,i),c.point(n?+n(p,h,i):v[h],o?+o(p,h,i):x[h]))}if(m)return c=null,m+""||null}function d(){return M().defined(s).curve(u).context(l)}return h.x=function(r){return arguments.length?(t="function"==typeof r?r:i(+r),n=null,h):t},h.x0=function(r){return arguments.length?(t="function"==typeof r?r:i(+r),h):t},h.x1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:i(+t),h):n},h.y=function(t){return arguments.length?(a="function"==typeof t?t:i(+t),o=null,h):a},h.y0=function(t){return arguments.length?(a="function"==typeof t?t:i(+t),h):a},h.y1=function(t){return arguments.length?(o=null==t?null:"function"==typeof t?t:i(+t),h):o},h.lineX0=h.lineY0=function(){return d().x(t).y(a)},h.lineY1=function(){return d().x(t).y(o)},h.lineX1=function(){return d().x(n).y(a)},h.defined=function(t){return arguments.length?(s="function"==typeof t?t:i(!!t),h):s},h.curve=function(t){return arguments.length?(u=t,null!=l&&(c=u(l)),h):u},h.context=function(t){return arguments.length?(null==t?l=c=null:c=u(l=t),h):l},h}function S(t,r){return rt?1:r>=t?0:NaN}function E(t){return t}_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:this._context.lineTo(t,r)}}};var D=I(w);function C(t){this._curve=t}function I(t){function r(r){return new C(t(r))}return r._curve=t,r}function L(t){var r=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?r(I(t)):r()._curve},t}function P(){return L(M().curve(D))}function z(){var t=k().curve(D),r=t.curve,i=t.lineX0,n=t.lineX1,a=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return L(i())},delete t.lineX0,t.lineEndAngle=function(){return L(n())},delete t.lineX1,t.lineInnerRadius=function(){return L(a())},delete t.lineY0,t.lineOuterRadius=function(){return L(o())},delete t.lineY1,t.curve=function(t){return arguments.length?r(I(t)):r()._curve},t}function F(t,r){return[(r*=1)*Math.cos(t-=Math.PI/2),r*Math.sin(t)]}C.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,r){this._curve.point(r*Math.sin(t),-(r*Math.cos(t)))}};var O=Array.prototype.slice;function R(t){return t.source}function B(t){return t.target}function j(t){var n=R,a=B,o=T,s=A,l=null;function u(){var i,u=O.call(arguments),c=n.apply(this,u),h=a.apply(this,u);if(l||(l=i=r.path()),t(l,+o.apply(this,(u[0]=c,u)),+s.apply(this,u),+o.apply(this,(u[0]=h,u)),+s.apply(this,u)),i)return l=null,i+""||null}return u.source=function(t){return arguments.length?(n=t,u):n},u.target=function(t){return arguments.length?(a=t,u):a},u.x=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),u):o},u.y=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),u):s},u.context=function(t){return arguments.length?(l=t??null,u):l},u}function N(t,r,i,n,a){t.moveTo(r,i),t.bezierCurveTo(r=(r+n)/2,i,r,a,n,a)}function V(t,r,i,n,a){t.moveTo(r,i),t.bezierCurveTo(r,i=(i+a)/2,n,i,n,a)}function U(t,r,i,n,a){var o=F(r,i),s=F(r,i=(i+a)/2),l=F(n,i),u=F(n,a);t.moveTo(o[0],o[1]),t.bezierCurveTo(s[0],s[1],l[0],l[1],u[0],u[1])}var q={draw:function(t,r){var i=Math.sqrt(r/h);t.moveTo(i,0),t.arc(0,0,i,0,f)}},G={draw:function(t,r){var i=Math.sqrt(r/5)/2;t.moveTo(-3*i,-i),t.lineTo(-i,-i),t.lineTo(-i,-3*i),t.lineTo(i,-3*i),t.lineTo(i,-i),t.lineTo(3*i,-i),t.lineTo(3*i,i),t.lineTo(i,i),t.lineTo(i,3*i),t.lineTo(-i,3*i),t.lineTo(-i,i),t.lineTo(-3*i,i),t.closePath()}},H=Math.sqrt(1/3),$=2*H,W={draw:function(t,r){var i=Math.sqrt(r/$),n=i*H;t.moveTo(0,-i),t.lineTo(n,0),t.lineTo(0,i),t.lineTo(-n,0),t.closePath()}},Y=Math.sin(h/10)/Math.sin(7*h/10),Z=Math.sin(f/10)*Y,X=-Math.cos(f/10)*Y,K={draw:function(t,r){var i=Math.sqrt(.8908130915292852*r),n=Z*i,a=X*i;t.moveTo(0,-i),t.lineTo(n,a);for(var o=1;o<5;++o){var s=f*o/5,l=Math.cos(s),u=Math.sin(s);t.lineTo(u*i,-l*i),t.lineTo(l*n-u*a,u*n+l*a)}t.closePath()}},J={draw:function(t,r){var i=Math.sqrt(r),n=-i/2;t.rect(n,n,i,i)}},Q=Math.sqrt(3),ee={draw:function(t,r){var i=-Math.sqrt(r/(3*Q));t.moveTo(0,2*i),t.lineTo(-Q*i,-i),t.lineTo(Q*i,-i),t.closePath()}},et=Math.sqrt(3)/2,er=1/Math.sqrt(12),ei=(er/2+1)*3,en={draw:function(t,r){var i=Math.sqrt(r/ei),n=i/2,a=i*er,o=i*er+i,s=-n;t.moveTo(n,a),t.lineTo(n,o),t.lineTo(s,o),t.lineTo(-.5*n-et*a,et*n+-.5*a),t.lineTo(-.5*n-et*o,et*n+-.5*o),t.lineTo(-.5*s-et*o,et*s+-.5*o),t.lineTo(-.5*n+et*a,-.5*a-et*n),t.lineTo(-.5*n+et*o,-.5*o-et*n),t.lineTo(-.5*s+et*o,-.5*o-et*s),t.closePath()}},ea=[q,G,W,J,K,ee,en];function eo(){}function es(t,r,i){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+r)/6,(t._y0+4*t._y1+i)/6)}function el(t){this._context=t}function eu(t){this._context=t}function ec(t){this._context=t}function eh(t,r){this._basis=new el(t),this._beta=r}el.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:es(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);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:es(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},eu.prototype={areaStart:eo,areaEnd:eo,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)}},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._x2=t,this._y2=r;break;case 1:this._point=2,this._x3=t,this._y3=r;break;case 2:this._point=3,this._x4=t,this._y4=r,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+r)/6);break;default:es(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},ec.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||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var i=(this._x0+4*this._x1+t)/6,n=(this._y0+4*this._y1+r)/6;this._line?this._context.lineTo(i,n):this._context.moveTo(i,n);break;case 3:this._point=4;default:es(this,t,r)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=r}},eh.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,r=this._y,i=t.length-1;if(i>0)for(var n,a=t[0],o=r[0],s=t[i]-a,l=r[i]-o,u=-1;++u<=i;)n=u/i,this._basis.point(this._beta*t[u]+(1-this._beta)*(a+n*s),this._beta*r[u]+(1-this._beta)*(o+n*l));this._x=this._y=null,this._basis.lineEnd()},point:function(t,r){this._x.push(+t),this._y.push(+r)}};var ed=function t(r){function i(t){return 1===r?new el(t):new eh(t,r)}return i.beta=function(r){return t(+r)},i}(.85);function ef(t,r,i){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-r),t._y2+t._k*(t._y1-i),t._x2,t._y2)}function ep(t,r){this._context=t,this._k=(1-r)/6}ep.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:ef(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2,this._x1=t,this._y1=r;break;case 2:this._point=3;default:ef(this,t,r)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var em=function t(r){function i(t){return new ep(t,r)}return i.tension=function(r){return t(+r)},i}(0);function eg(t,r){this._context=t,this._k=(1-r)/6}eg.prototype={areaStart:eo,areaEnd:eo,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)}},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:ef(this,t,r)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ey=function t(r){function i(t){return new eg(t,r)}return i.tension=function(r){return t(+r)},i}(0);function ev(t,r){this._context=t,this._k=(1-r)/6}ev.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||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){switch(t*=1,r*=1,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:ef(this,t,r)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ex=function t(r){function i(t){return new ev(t,r)}return i.tension=function(r){return t(+r)},i}(0);function eb(t,r,i){var n=t._x1,a=t._y1,o=t._x2,s=t._y2;if(t._l01_a>1e-12){var l=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,u=3*t._l01_a*(t._l01_a+t._l12_a);n=(n*l-t._x0*t._l12_2a+t._x2*t._l01_2a)/u,a=(a*l-t._y0*t._l12_2a+t._y2*t._l01_2a)/u}if(t._l23_a>1e-12){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,h=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-r*t._l12_2a)/h,s=(s*c+t._y1*t._l23_2a-i*t._l12_2a)/h}t._context.bezierCurveTo(n,a,o,s,t._x2,t._y2)}function e_(t,r){this._context=t,this._alpha=r}e_.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)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){if(t*=1,r*=1,this._point){var i=this._x2-t,n=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;break;case 2:this._point=3;default:eb(this,t,r)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ew=function t(r){function i(t){return r?new e_(t,r):new ep(t,0)}return i.alpha=function(r){return t(+r)},i}(.5);function eT(t,r){this._context=t,this._alpha=r}eT.prototype={areaStart:eo,areaEnd:eo,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)}},point:function(t,r){if(t*=1,r*=1,this._point){var i=this._x2-t,n=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=r;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=r);break;case 2:this._point=3,this._x5=t,this._y5=r;break;default:eb(this,t,r)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var eA=function t(r){function i(t){return r?new eT(t,r):new eg(t,0)}return i.alpha=function(r){return t(+r)},i}(.5);function eM(t,r){this._context=t,this._alpha=r}eM.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||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,r){if(t*=1,r*=1,this._point){var i=this._x2-t,n=this._y2-r;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(i*i+n*n,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:eb(this,t,r)}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=t,this._y0=this._y1,this._y1=this._y2,this._y2=r}};var ek=function t(r){function i(t){return r?new eM(t,r):new ev(t,0)}return i.alpha=function(r){return t(+r)},i}(.5);function eS(t){this._context=t}eS.prototype={areaStart:eo,areaEnd:eo,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,r){t*=1,r*=1,this._point?this._context.lineTo(t,r):(this._point=1,this._context.moveTo(t,r))}};function eE(t,r,i){var n=t._x1-t._x0,a=r-t._x1,o=(t._y1-t._y0)/(n||a<0&&-0),s=(i-t._y1)/(a||n<0&&-0);return((o<0?-1:1)+(s<0?-1:1))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs((o*a+s*n)/(n+a)))||0}function eD(t,r){var i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-r)/2:r}function eC(t,r,i){var n=t._x0,a=t._y0,o=t._x1,s=t._y1,l=(o-n)/3;t._context.bezierCurveTo(n+l,a+l*r,o-l,s-l*i,o,s)}function eI(t){this._context=t}function eL(t){this._context=new eP(t)}function eP(t){this._context=t}function ez(t){this._context=t}function eF(t){var r,i,n=t.length-1,a=Array(n),o=Array(n),s=Array(n);for(a[0]=0,o[0]=2,s[0]=t[0]+2*t[1],r=1;r=0;--r)a[r]=(s[r]-a[r+1])/o[r];for(o[n-1]=(t[n]+a[n-1])/2,r=0;r1)for(var i,n,a,o=1,s=t[r[0]],l=s.length;o=0;)i[r]=r;return i}function ej(t,r){return t[r]}function eN(t){var r=t.map(eV);return eB(t).sort(function(t,i){return r[t]-r[i]})}function eV(t){for(var r,i=-1,n=0,a=t.length,o=-1/0;++io&&(o=r,n=i);return n}function eU(t){var r=t.map(eq);return eB(t).sort(function(t,i){return r[t]-r[i]})}function eq(t){for(var r,i=0,n=-1,a=t.length;++n=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,r){switch(t*=1,r*=1,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,r),this._context.lineTo(t,r);else{var i=this._x*(1-this._t)+t*this._t;this._context.lineTo(i,this._y),this._context.lineTo(i,r)}}this._x=t,this._y=r}},t.arc=function(){var t=m,s=g,_=i(0),w=null,T=y,A=v,M=x,k=null;function S(){var i,m,g=+t.apply(this,arguments),y=+s.apply(this,arguments),v=T.apply(this,arguments)-d,x=A.apply(this,arguments)-d,S=n(x-v),E=x>v;if(k||(k=i=r.path()),y1e-12)if(S>f-1e-12)k.moveTo(y*o(v),y*u(v)),k.arc(0,0,y,v,x,!E),g>1e-12&&(k.moveTo(g*o(x),g*u(x)),k.arc(0,0,g,x,v,E));else{var D,C,I=v,L=x,P=v,z=x,F=S,O=S,R=M.apply(this,arguments)/2,B=R>1e-12&&(w?+w.apply(this,arguments):c(g*g+y*y)),j=l(n(y-g)/2,+_.apply(this,arguments)),N=j,V=j;if(B>1e-12){var U=p(B/g*u(R)),q=p(B/y*u(R));(F-=2*U)>1e-12?(U*=E?1:-1,P+=U,z-=U):(F=0,P=z=(v+x)/2),(O-=2*q)>1e-12?(q*=E?1:-1,I+=q,L-=q):(O=0,I=L=(v+x)/2)}var G=y*o(I),H=y*u(I),$=g*o(z),W=g*u(z);if(j>1e-12){var Y,Z=y*o(L),X=y*u(L),K=g*o(P),J=g*u(P);if(S1?0:Q<-1?h:Math.acos(Q))/2),ea=c(Y[0]*Y[0]+Y[1]*Y[1]);N=l(j,(g-ea)/(en-1)),V=l(j,(y-ea)/(en+1))}}O>1e-12?V>1e-12?(D=b(K,J,G,H,y,V,E),C=b(Z,X,$,W,y,V,E),k.moveTo(D.cx+D.x01,D.cy+D.y01),V1e-12&&F>1e-12?N>1e-12?(D=b($,W,Z,X,g,-N,E),C=b(G,H,K,J,g,-N,E),k.lineTo(D.cx+D.x01,D.cy+D.y01),N0&&(m+=d);for(null!=r?g.sort(function(t,i){return r(y[t],y[i])}):null!=n&&g.sort(function(t,r){return n(i[t],i[r])}),l=0,c=m?(x-p*_)/m:0;l0?d*c:0)+_,y[u]={data:i[u],index:l,value:d,startAngle:v,endAngle:h,padAngle:b};return y}return l.value=function(r){return arguments.length?(t="function"==typeof r?r:i(+r),l):t},l.sortValues=function(t){return arguments.length?(r=t,n=null,l):r},l.sort=function(t){return arguments.length?(n=t,r=null,l):n},l.startAngle=function(t){return arguments.length?(a="function"==typeof t?t:i(+t),l):a},l.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:i(+t),l):o},l.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:i(+t),l):s},l},t.pointRadial=F,t.radialArea=z,t.radialLine=P,t.stack=function(){var t=i([]),r=eB,n=eR,a=ej;function o(i){var o,s,l=t.apply(this,arguments),u=i.length,c=l.length,h=Array(c);for(o=0;o0)for(var i,n,a,o,s,l,u=0,c=t[r[0]].length;u0?(n[0]=o,n[1]=o+=a):a<0?(n[1]=s,n[0]=s+=a):(n[0]=0,n[1]=a)},t.stackOffsetExpand=function(t,r){if((n=t.length)>0){for(var i,n,a,o=0,s=t[0].length;o0){for(var i,n=0,a=t[r[0]],o=a.length;n0&&(n=(i=t[r[0]]).length)>0){for(var i,n,a,o=0,s=1;stypeof r?n(t,NL()):n((i=i||self).d3=i.d3||{},i.d3)}}),Nz=g({"node_modules/@plotly/d3-sankey/dist/@plotly/d3-sankey.js"(t,r){var i,n;i=t,n=function(t,r,i){function n(t){return t.target.depth}function a(t,r){return t.sourceLinks.length?t.depth:r-1}function o(t){return function(){return t}}function s(t,r){return u(t.source,r.source)||t.index-r.index}function l(t,r){return u(t.target,r.target)||t.index-r.index}function u(t,r){return t.y0-r.y0}function c(t){return t.value}function h(t){return t.index}function d(t){return t.nodes}function f(t){return t.links}function p(t,r){let i=t.get(r);if(!i)throw Error("missing: "+r);return i}function m({nodes:t}){for(let r of t){let t=r.y0,i=t;for(let i of r.sourceLinks)i.y0=t+i.width/2,t+=i.width;for(let t of r.targetLinks)t.y1=i+t.width/2,i+=t.width}}function g(t){return[t.source.x1,t.y0]}function y(t){return[t.target.x0,t.y1]}t.sankey=function(){let t=0,i=0,n=1,g=1,y=24,v=8,x,b=h,_=a,w,T,A=d,M=f,k=6,S=2/3;function E(){let a={nodes:A.apply(null,arguments),links:M.apply(null,arguments)};return function({nodes:t,links:r}){for(let[r,i]of t.entries())i.index=r,i.sourceLinks=[],i.targetLinks=[];let i=new Map(t.map((r,i)=>[b(r,i,t),r]));for(let[t,n]of r.entries()){n.index=t;let{source:r,target:a}=n;"object"!=typeof r&&(r=n.source=p(i,r)),"object"!=typeof a&&(a=n.target=p(i,a)),r.sourceLinks.push(n),a.targetLinks.push(n)}if(null!=T)for(let{sourceLinks:r,targetLinks:i}of t)r.sort(T),i.sort(T)}(a),function({nodes:t}){for(let i of t)i.value=void 0===i.fixedValue?Math.max(r.sum(i.sourceLinks,c),r.sum(i.targetLinks,c)):i.fixedValue}(a),function({nodes:t}){let r=t.length,i=new Set(t),n=new Set,a=0;for(;i.size;){for(let t of i)for(let{target:r}of(t.depth=a,t.sourceLinks))n.add(r);if(++a>r)throw Error("circular link");i=n,n=new Set}}(a),function({nodes:t}){let r=t.length,i=new Set(t),n=new Set,a=0;for(;i.size;){for(let t of i)for(let{source:r}of(t.height=a,t.targetLinks))n.add(r);if(++a>r)throw Error("circular link");i=n,n=new Set}}(a),function(a){let o=function({nodes:i}){let a=r.max(i,t=>t.depth)+1,o=(n-t-y)/(a-1),s=Array(a);for(let r of i){let i=Math.max(0,Math.min(a-1,Math.floor(_.call(null,r,a))));r.layer=i,r.x0=t+i*o,r.x1=r.x0+y,s[i]?s[i].push(r):s[i]=[r]}if(w)for(let t of s)t.sort(w);return s}(a);x=Math.min(v,S*(g-i)/(r.max(o,t=>t.length)-1)),function(t){let n=r.min(t,t=>(g-i-(t.length-1)*x)/r.sum(t,c));for(let r of t){let t=i;for(let i of r)for(let r of(i.y0=t,i.y1=t+i.value*n,t=i.y1+x,i.sourceLinks))r.width=r.value*n;t=(g-t+x)/(r.length+1);for(let i=0;i=0;--a){let n=t[a];for(let t of n){let i=0,n=0;for(let{target:r,value:a}of t.sourceLinks){let o=a*(r.layer-t.layer);i+=function(t,r){let i=r.y0-(r.targetLinks.length-1)*x/2;for(let{source:n,width:a}of r.targetLinks){if(n===t)break;i+=a+x}for(let{target:n,width:a}of t.sourceLinks){if(n===r)break;i-=a}return i}(t,r)*o,n+=o}if(!(n>0))continue;let a=(i/n-t.y0)*r;t.y0+=a,t.y1+=a,L(t)}void 0===w&&n.sort(u),D(n,i)}})(o,r,i),function(t,r,i){for(let n=1,a=t.length;n0))continue;let a=(i/n-t.y0)*r;t.y0+=a,t.y1+=a,L(t)}void 0===w&&a.sort(u),D(a,i)}}(o,r,i)}}(a),m(a),a}function D(t,r){let n=t.length>>1,a=t[n];I(t,a.y0-x,n-1,r),C(t,a.y1+x,n+1,r),I(t,g,t.length-1,r),C(t,i,0,r)}function C(t,r,i,n){for(;i1e-6&&(a.y0+=o,a.y1+=o),r=a.y1+x}}function I(t,r,i,n){for(;i>=0;--i){let a=t[i],o=(a.y1-r)*n;o>1e-6&&(a.y0-=o,a.y1-=o),r=a.y0-x}}function L({sourceLinks:t,targetLinks:r}){if(void 0===T){for(let{source:{sourceLinks:t}}of r)t.sort(l);for(let{target:{targetLinks:r}}of t)r.sort(s)}}return E.update=function(t){return m(t),t},E.nodeId=function(t){return arguments.length?(b="function"==typeof t?t:o(t),E):b},E.nodeAlign=function(t){return arguments.length?(_="function"==typeof t?t:o(t),E):_},E.nodeSort=function(t){return arguments.length?(w=t,E):w},E.nodeWidth=function(t){return arguments.length?(y=+t,E):y},E.nodePadding=function(t){return arguments.length?(v=x=+t,E):v},E.nodes=function(t){return arguments.length?(A="function"==typeof t?t:o(t),E):A},E.links=function(t){return arguments.length?(M="function"==typeof t?t:o(t),E):M},E.linkSort=function(t){return arguments.length?(T=t,E):T},E.size=function(r){return arguments.length?(t=i=0,n=+r[0],g=+r[1],E):[n-t,g-i]},E.extent=function(r){return arguments.length?(t=+r[0][0],n=+r[1][0],i=+r[0][1],g=+r[1][1],E):[[t,i],[n,g]]},E.iterations=function(t){return arguments.length?(k=+t,E):k},E},t.sankeyCenter=function(t){return t.targetLinks.length?t.depth:t.sourceLinks.length?r.min(t.sourceLinks,n)-1:0},t.sankeyJustify=a,t.sankeyLeft=function(t){return t.depth},t.sankeyLinkHorizontal=function(){return i.linkHorizontal().source(g).target(y)},t.sankeyRight=function(t,r){return r-1-t.height},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof t&&"u">typeof r?n(t,NI(),NP()):n((i=i||self).d3=i.d3||{},i.d3,i.d3)}}),NF=g({"node_modules/@plotly/d3-sankey-circular/node_modules/d3-array/dist/d3-array.js"(t,r){(function(t){function r(t,r){return tr?1:t>=r?0:NaN}function i(t){var i;return 1===t.length&&(i=t,t=function(t,n){return r(i(t),n)}),{left:function(r,i,n,a){for(null==n&&(n=0),null==a&&(a=r.length);n>>1;0>t(r[o],i)?n=o+1:a=o}return n},right:function(r,i,n,a){for(null==n&&(n=0),null==a&&(a=r.length);n>>1;t(r[o],i)>0?a=o:n=o+1}return n}}}var n=i(r),a=n.right,o=n.left;function s(t,r){return[t,r]}function l(t){return null===t?NaN:+t}function u(t,r){var i,n,a=t.length,o=0,s=-1,u=0,c=0;if(null==r)for(;++s1)return c/(o-1)}function c(t,r){var i=u(t,r);return i&&Math.sqrt(i)}function h(t,r){var i,n,a,o=t.length,s=-1;if(null==r){for(;++s=i)for(n=a=i;++si&&(n=i),a=i)for(n=a=i;++si&&(n=i),a=0?(o>=v?10:o>=x?5:o>=b?2:1)*Math.pow(10,a):-Math.pow(10,-a)/(o>=v?10:o>=x?5:o>=b?2:1)}function w(t,r,i){var n=Math.abs(r-t)/Math.max(0,i),a=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),o=n/a;return o>=v?a*=10:o>=x?a*=5:o>=b&&(a*=2),r=1)return+i(t[n-1],n-1,t);var n,a=(n-1)*r,o=Math.floor(a),s=+i(t[o],o,t);return s+(i(t[o+1],o+1,t)-s)*(a-o)}}function M(t,r){var i,n,a=t.length,o=-1;if(null==r){for(;++o=i)for(n=i;++oi&&(n=i)}else for(;++o=i)for(n=i;++oi&&(n=i);return n}function k(t){if(!(a=t.length))return[];for(var r=-1,i=M(t,S),n=Array(i);++rt?1:r>=t?0:NaN},t.deviation=c,t.extent=h,t.histogram=function(){var t=g,r=h,i=T;function n(n){var o,s,l=n.length,u=Array(l);for(o=0;od;)f.pop(),--p;var m,g=Array(p+1);for(o=0;o<=p;++o)(m=g[o]=[]).x0=o>0?f[o-1]:h,m.x1=o=i)for(n=i;++on&&(n=i)}else for(;++o=i)for(n=i;++on&&(n=i);return n},t.mean=function(t,r){var i,n=t.length,a=n,o=-1,s=0;if(null==r)for(;++o=0;)for(r=(n=t[a]).length;--r>=0;)i[--s]=n[r];return i},t.min=M,t.pairs=function(t,r){null==r&&(r=s);for(var i=0,n=t.length-1,a=t[0],o=Array(n<0?0:n);ii(a=t[o],l)||0!==i(l,l))&&(l=a,s=o);if(0===i(l,l))return s}},t.shuffle=function(t,r,i){for(var n,a,o=(i??t.length)-(r=null==r?0:+r);o;)a=Math.random()*o--|0,n=t[o+r],t[o+r]=t[a+r],t[a+r]=n;return t},t.sum=function(t,r){var i,n=t.length,a=-1,o=0;if(null==r)for(;++a0)return[t];if((n=r0)for(t=Math.ceil(t/s),o=Array(a=Math.ceil((r=Math.floor(r/s))-t+1));++ltypeof r?t:t.d3=t.d3||{})}}),NO=g({"node_modules/elementary-circuits-directed-graph/johnson.js"(t,r){var i=NA();r.exports=function(t,r){var n,a=[],o=[],s=[],l={},u=[];n=0;for(var c=t.length;n=r});for(var a,o=i(t),s=o.components.filter(function(t){return t.length>1}),l=1/0,u=0;u1||a>1)}function M(t,r,i){return t.sort(S),t.forEach(function(n,a){var o=0;if(N(n,i)&&A(n))n.circularPathData.verticalBuffer=o+n.width/2;else{for(var s,l,u=0;ul.source.column)){var c=t[u].circularPathData.verticalBuffer+t[u].width/2+r;o=c>o?c:o}n.circularPathData.verticalBuffer=o+n.width/2}}),t}function k(t,i,a,o){var s=r.min(t.links,function(t){return t.source.y0});t.links.forEach(function(t){t.circular&&(t.circularPathData={})}),M(t.links.filter(function(t){return"top"==t.circularLinkType}),i,o),M(t.links.filter(function(t){return"bottom"==t.circularLinkType}),i,o),t.links.forEach(function(r){if(r.circular){if(r.circularPathData.arcRadius=r.width+10,r.circularPathData.leftNodeBuffer=5,r.circularPathData.rightNodeBuffer=5,r.circularPathData.sourceWidth=r.source.x1-r.source.x0,r.circularPathData.sourceX=r.source.x0+r.circularPathData.sourceWidth,r.circularPathData.targetX=r.target.x0,r.circularPathData.sourceY=r.y0,r.circularPathData.targetY=r.y1,N(r,o)&&A(r))r.circularPathData.leftSmallArcRadius=10+r.width/2,r.circularPathData.leftLargeArcRadius=10+r.width/2,r.circularPathData.rightSmallArcRadius=10+r.width/2,r.circularPathData.rightLargeArcRadius=10+r.width/2,"bottom"==r.circularLinkType?(r.circularPathData.verticalFullExtent=r.source.y1+25+r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.rightLargeArcRadius):(r.circularPathData.verticalFullExtent=r.source.y0-25-r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.rightLargeArcRadius);else{var l,u=r.source.column,c=r.circularLinkType,h=t.links.filter(function(t){return t.source.column==u&&t.circularLinkType==c});"bottom"==r.circularLinkType?h.sort(D):h.sort(E);var d=0;h.forEach(function(t,n){t.circularLinkID==r.circularLinkID&&(r.circularPathData.leftSmallArcRadius=10+r.width/2+d,r.circularPathData.leftLargeArcRadius=10+r.width/2+n*i+d),d+=t.width}),u=r.target.column,h=t.links.filter(function(t){return t.target.column==u&&t.circularLinkType==c}),"bottom"==r.circularLinkType?h.sort(I):h.sort(C),d=0,h.forEach(function(t,n){t.circularLinkID==r.circularLinkID&&(r.circularPathData.rightSmallArcRadius=10+r.width/2+d,r.circularPathData.rightLargeArcRadius=10+r.width/2+n*i+d),d+=t.width}),"bottom"==r.circularLinkType?(r.circularPathData.verticalFullExtent=Math.max(a,r.source.y1,r.target.y1)+25+r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent-r.circularPathData.rightLargeArcRadius):(r.circularPathData.verticalFullExtent=s-25-r.circularPathData.verticalBuffer,r.circularPathData.verticalLeftInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.leftLargeArcRadius,r.circularPathData.verticalRightInnerExtent=r.circularPathData.verticalFullExtent+r.circularPathData.rightLargeArcRadius)}r.circularPathData.leftInnerExtent=r.circularPathData.sourceX+r.circularPathData.leftNodeBuffer,r.circularPathData.rightInnerExtent=r.circularPathData.targetX-r.circularPathData.rightNodeBuffer,r.circularPathData.leftFullExtent=r.circularPathData.sourceX+r.circularPathData.leftLargeArcRadius+r.circularPathData.leftNodeBuffer,r.circularPathData.rightFullExtent=r.circularPathData.targetX-r.circularPathData.rightLargeArcRadius-r.circularPathData.rightNodeBuffer}r.circular?r.path="top"==(l=r).circularLinkType?"M"+l.circularPathData.sourceX+" "+l.circularPathData.sourceY+" L"+l.circularPathData.leftInnerExtent+" "+l.circularPathData.sourceY+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftSmallArcRadius+" 0 0 0 "+l.circularPathData.leftFullExtent+" "+(l.circularPathData.sourceY-l.circularPathData.leftSmallArcRadius)+" L"+l.circularPathData.leftFullExtent+" "+l.circularPathData.verticalLeftInnerExtent+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftLargeArcRadius+" 0 0 0 "+l.circularPathData.leftInnerExtent+" "+l.circularPathData.verticalFullExtent+" L"+l.circularPathData.rightInnerExtent+" "+l.circularPathData.verticalFullExtent+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightLargeArcRadius+" 0 0 0 "+l.circularPathData.rightFullExtent+" "+l.circularPathData.verticalRightInnerExtent+" L"+l.circularPathData.rightFullExtent+" "+(l.circularPathData.targetY-l.circularPathData.rightSmallArcRadius)+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightSmallArcRadius+" 0 0 0 "+l.circularPathData.rightInnerExtent+" "+l.circularPathData.targetY+" L"+l.circularPathData.targetX+" "+l.circularPathData.targetY:"M"+l.circularPathData.sourceX+" "+l.circularPathData.sourceY+" L"+l.circularPathData.leftInnerExtent+" "+l.circularPathData.sourceY+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftSmallArcRadius+" 0 0 1 "+l.circularPathData.leftFullExtent+" "+(l.circularPathData.sourceY+l.circularPathData.leftSmallArcRadius)+" L"+l.circularPathData.leftFullExtent+" "+l.circularPathData.verticalLeftInnerExtent+" A"+l.circularPathData.leftLargeArcRadius+" "+l.circularPathData.leftLargeArcRadius+" 0 0 1 "+l.circularPathData.leftInnerExtent+" "+l.circularPathData.verticalFullExtent+" L"+l.circularPathData.rightInnerExtent+" "+l.circularPathData.verticalFullExtent+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightLargeArcRadius+" 0 0 1 "+l.circularPathData.rightFullExtent+" "+l.circularPathData.verticalRightInnerExtent+" L"+l.circularPathData.rightFullExtent+" "+(l.circularPathData.targetY+l.circularPathData.rightSmallArcRadius)+" A"+l.circularPathData.rightLargeArcRadius+" "+l.circularPathData.rightSmallArcRadius+" 0 0 1 "+l.circularPathData.rightInnerExtent+" "+l.circularPathData.targetY+" L"+l.circularPathData.targetX+" "+l.circularPathData.targetY:r.path=n.linkHorizontal().source(function(t){return[t.source.x0+(t.source.x1-t.source.x0),t.y0]}).target(function(t){return[t.target.x0,t.y1]})(r)})}function S(t,r){return L(t)==L(r)?"bottom"==t.circularLinkType?D(t,r):E(t,r):L(r)-L(t)}function E(t,r){return t.y0-r.y0}function D(t,r){return r.y0-t.y0}function C(t,r){return t.y1-r.y1}function I(t,r){return r.y1-t.y1}function L(t){return t.target.column-t.source.column}function P(t){return t.target.x0-t.source.x1}function z(t,r){var i=w(t),n=P(r)/Math.tan(i);return"up"==j(t)?t.y1+n:t.y1-n}function F(t,r){var i=w(t),n=P(r)/Math.tan(i);return"up"==j(t)?t.y1-n:t.y1+n}function O(t,r,i,n){return t.y0+r>=i&&t.y1+r<=n&&(t.y0=t.y0+r,t.y1=t.y1+r,t.targetLinks.forEach(function(t){t.y1=t.y1+r}),t.sourceLinks.forEach(function(t){t.y0=t.y0+r})),t}function R(t,r,i,n){t.nodes.forEach(function(a){n&&a.y+(a.y1-a.y0)>r&&(a.y=a.y-(a.y+(a.y1-a.y0)-r));var o=t.links.filter(function(t){return i(t.source)==i(a)}),s=o.length;s>1&&o.sort(function(t,r){if(!t.circular&&!r.circular){if(t.target.column==r.target.column)return t.y1-r.y1;if(i=t,n=r,j(i)!=j(n))return t.y1-r.y1;if(t.target.column>r.target.column){var i,n,a=F(r,t);return t.y1-a}if(r.target.column>t.target.column)return F(t,r)-r.y1}return t.circular&&!r.circular?"top"==t.circularLinkType?-1:1:r.circular&&!t.circular?"top"==r.circularLinkType?1:-1:t.circular&&r.circular?t.circularLinkType===r.circularLinkType&&"top"==t.circularLinkType?t.target.column===r.target.column?t.target.y1-r.target.y1:r.target.column-t.target.column:t.circularLinkType===r.circularLinkType&&"bottom"==t.circularLinkType?t.target.column===r.target.column?r.target.y1-t.target.y1:t.target.column-r.target.column:"top"==t.circularLinkType?-1:1:void 0});var l=a.y0;o.forEach(function(t){t.y0=l+t.width/2,l+=t.width}),o.forEach(function(t,r){if("bottom"==t.circularLinkType){for(var i=r+1,n=0;i1&&n.sort(function(t,r){if(!t.circular&&!r.circular){if(t.source.column==r.source.column)return t.y0-r.y0;if(i=t,n=r,j(i)!=j(n))return t.y0-r.y0;if(r.source.column0?"up":"down"}function N(t,r){return r(t.source)==r(t.target)}t.sankeyCircular=function(){var t,n,o=0,w=0,A=1,M=1,S=24,E=y,D=s,C=v,I=x,L=32,P=2,z=null;function F(){var s,l,c={nodes:C.apply(null,arguments),links:I.apply(null,arguments)};(s=c).nodes.forEach(function(t,r){t.index=r,t.sourceLinks=[],t.targetLinks=[]}),l=i.map(s.nodes,E),s.links.forEach(function(t,r){t.index=r;var i=t.source,n=t.target;(typeof i>"u"?"undefined":u(i))!=="object"&&(i=t.source=b(l,i)),(typeof n>"u"?"undefined":u(n))!=="object"&&(n=t.target=b(l,n)),i.sourceLinks.push(t),n.targetLinks.push(t)}),function(t,r){var i=0;if(null===r){for(var n=[],o=0;oi.indexOf(t.target)&&!t.circular&&i.push(t.target)})});for(r=t.nodes,i=[],n=0;r.length;++n,r=i,i=[])r.forEach(function(t){t.height=n,t.targetLinks.forEach(function(t){0>i.indexOf(t.source)&&!t.circular&&i.push(t.source)})});t.nodes.forEach(function(t){t.column=Math.floor(D.call(null,t,n))})}(c),_(c,E),function(a,s,l){var u=i.nest().key(function(t){return t.column}).sortKeys(r.ascending).entries(a.nodes).map(function(t){return t.values});(function(i){if(n){var s,l,c,h,d,p,m,g,y,v,x,b,_=1/0;u.forEach(function(t){var r=M*n/(t.length+1);_=r<_?r:_}),t=_}var k=r.min(u,function(i){return(M-w-(i.length-1)*t)/r.sum(i,f)});k*=.3,a.links.forEach(function(t){t.width=t.value*k});var E=(s=0,l=0,c=0,h=0,d=r.max(a.nodes,function(t){return t.column}),a.links.forEach(function(t){t.circular&&("top"==t.circularLinkType?s+=t.width:l+=t.width,0==t.target.column&&(h+=t.width),t.source.column==d&&(c+=t.width))}),{top:s=s>0?s+25+10:s,bottom:l=l>0?l+25+10:l,left:h=h>0?h+25+10:h,right:c=c>0?c+25+10:c}),D=(p=r.max(a.nodes,function(t){return t.column}),m=A-o,g=M-w,y=m+E.right+E.left,v=g+E.top+E.bottom,x=m/y,b=g/v,o=o*x+E.left,A=0==E.right?A:A*x,w=w*b+E.top,M*=b,a.nodes.forEach(function(t){t.x0=o+t.column*((A-o-S)/p),t.x1=t.x0+S}),b);k*=D,a.links.forEach(function(t){t.width=t.value*k}),u.forEach(function(t){var r=t.length;t.forEach(function(t,n){t.depth==u.length-1&&1==r||0==t.depth&&1==r?t.y0=M/2-t.value*k:t.partOfCycle?0==T(t,i)?t.y0=M/2+n:"top"==t.circularLinkType?t.y0=w+n:t.y0=M-t.value*k-n:0==E.top||0==E.bottom?t.y0=(M-w)/r*n:t.y0=(M-w)/2-r/2+n,t.y1=t.y0+t.value*k})})})(l),y();for(var c=1,h=s;h>0;--h)(function(t,i){var n=u.length;u.forEach(function(a){var o=a.length,s=a[0].depth;a.forEach(function(a){var l;if((a.sourceLinks.length||a.targetLinks.length)&&!(a.partOfCycle&&T(a,i)>0))if(0==s&&1==o)l=a.y1-a.y0,a.y0=M/2-l/2,a.y1=M/2+l/2;else if(s==n-1&&1==o)l=a.y1-a.y0,a.y0=M/2-l/2,a.y1=M/2+l/2;else{var u=r.mean(a.sourceLinks,g),c=r.mean(a.targetLinks,m),h=((u&&c?(u+c)/2:u||c)-p(a))*t;a.y0+=h,a.y1+=h}})})})(c*=.99,l),y();function y(){u.forEach(function(r){var i,n,a,o=w,s=r.length;for(r.sort(d),a=0;a0&&(i.y0+=n,i.y1+=n),o=i.y1+t;if((n=o-t-M)>0)for(o=i.y0-=n,i.y1-=n,a=s-2;a>=0;--a)(n=(i=r[a]).y1+t-o)>0&&(i.y0-=n,i.y1-=n),o=i.y0})}}(c,L,E),j(c);for(var h=0;h<4;h++)R(c,M,E),B(c,M,E),function(t,r,i,n){t.links.forEach(function(a){if(!a.circular&&a.target.column-a.source.column>1){var o=a.source.column+1,s=a.target.column-1,l=1,u=s-o+1;for(l=1;o<=s;o++,l++)t.nodes.forEach(function(s){if(s.column==o){var c,h=l/(u+1),d=Math.pow(1-h,3),f=3*h*Math.pow(1-h,2),p=3*Math.pow(h,2)*(1-h),m=Math.pow(h,3),g=d*a.y0+f*a.y0+p*a.y1+m*a.y1,y=g-a.width/2,v=g+a.width/2;y>s.y0&&yo.y0&&a.y0o.y0&&a.y1o.y1)&&O(t,c,r,i))})):v>s.y0&&vs.y1&&O(t,c,r,i)})):ys.y1&&(c=v-s.y0+10,s=O(s,c,r,i),t.nodes.forEach(function(t){n(t)==n(s)||t.column!=s.column||t.y0s.y1&&O(t,c,r,i)}))}})}})}(c,w,M,E),R(c,M,E),B(c,M,E);return function(t,i,n){var a=t.nodes,o=t.links,s=!1,l=!1;if(o.forEach(function(t){"top"==t.circularLinkType?s=!0:"bottom"==t.circularLinkType&&(l=!0)}),!1==s||!1==l){var u=r.min(a,function(t){return t.y0}),c=(n-i)/(r.max(a,function(t){return t.y1})-u);a.forEach(function(t){var r=(t.y1-t.y0)*c;t.y0=(t.y0-u)*c,t.y1=t.y0+r}),o.forEach(function(t){t.y0=(t.y0-u)*c,t.y1=(t.y1-u)*c,t.width=t.width*c})}}(c,w,M),k(c,P,M,E),c}function j(t){t.nodes.forEach(function(t){t.sourceLinks.sort(h),t.targetLinks.sort(c)}),t.nodes.forEach(function(t){var r=t.y0,i=r,n=t.y1,a=n;t.sourceLinks.forEach(function(t){t.circular?(t.y0=n-t.width/2,n-=t.width):(t.y0=r+t.width/2,r+=t.width)}),t.targetLinks.forEach(function(t){t.circular?(t.y1=a-t.width/2,a-=t.width):(t.y1=i+t.width/2,i+=t.width)})})}return F.nodeId=function(t){return arguments.length?(E="function"==typeof t?t:l(t),F):E},F.nodeAlign=function(t){return arguments.length?(D="function"==typeof t?t:l(t),F):D},F.nodeWidth=function(t){return arguments.length?(S=+t,F):S},F.nodePadding=function(r){return arguments.length?(t=+r,F):t},F.nodes=function(t){return arguments.length?(C="function"==typeof t?t:l(t),F):C},F.links=function(t){return arguments.length?(I="function"==typeof t?t:l(t),F):I},F.size=function(t){return arguments.length?(o=w=0,A=+t[0],M=+t[1],F):[A-o,M-w]},F.extent=function(t){return arguments.length?(o=+t[0][0],A=+t[1][0],w=+t[0][1],M=+t[1][1],F):[[o,w],[A,M]]},F.iterations=function(t){return arguments.length?(L=+t,F):L},F.circularLinkGap=function(t){return arguments.length?(P=+t,F):P},F.nodePaddingRatio=function(t){return arguments.length?(n=+t,F):n},F.sortNodes=function(t){return arguments.length?(z=t,F):z},F.update=function(t){return _(t,E),j(t),t.links.forEach(function(t){t.circular&&(t.circularLinkType=t.y0+t.y1typeof r?i(t,NF(),NS(),NP(),NO()):i(t.d3=t.d3||{},t.d3,t.d3,t.d3,null)}}),NB=g({"src/traces/sankey/constants.js"(t,r){r.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"linear",cn:{sankey:"sankey",sankeyLinks:"sankey-links",sankeyLink:"sankey-link",sankeyNodeSet:"sankey-node-set",sankeyNode:"sankey-node",nodeRect:"node-rect",nodeLabel:"node-label"}}}}),Nj=g({"src/traces/sankey/render.js"(t,r){var i=NC(),n=(dC(),b(dD)).interpolateNumber,a=k(),o=Nz(),s=NR(),l=NB(),u=ei(),c=rr(),h=t_(),d=h.strTranslate,f=h.strRotate,p=yj(),m=p.keyFun,g=p.repeat,y=p.unwrap,v=tN(),x=e2(),_=tj(),w=_.CAP_SHIFT,T=_.LINE_SPACING;function A(t,r,i){var n,a=y(r),u=a.trace,c=u.domain,d="h"===u.orientation,f="reversed"===u.direction,p=u.node.pad,m=u.node.thickness,g={justify:o.sankeyJustify,left:o.sankeyLeft,right:o.sankeyRight,center:o.sankeyCenter}[u.node.align],v=t.width*(c.x[1]-c.x[0]),x=t.height*(c.y[1]-c.y[0]),b=a._nodes,_=a._links,w=a.circular;function T(t){"input"===u[t].sort&&(w?h.warn(`Circular Sankey diagrams do not support the "input" ${t}.sort mode; falling back to the default sort.`):n[`${t}Sort`](null))}(n=w?s.sankeyCircular().circularLinkGap(0):o.sankey()).iterations(l.sankeyIterations).size(d?[v,x]:[x,v]).nodeWidth(m).nodePadding(p).nodeId(function(t){return t.pointNumber}).nodeAlign(g).nodes(b).links(_),T("link"),T("node");var A=n();for(var M in n.nodePadding()s+m&&(o+=1,r=l.x0),s=l.x0,a[o]||(a[o]=[]),a[o].push(l),i=r-l.x0,l.x0+=i,l.x1+=i}return a})(b=A.nodes).forEach(function(t){var r,i,n,a=0,o=t.length;for(t.sort(function(t,r){return t.y0-r.y0}),n=0;n=a||(i=a-r.y0)>1e-6&&(r.y0+=i,r.y1+=i),a=r.y1+p}),n.update(A)}return{circular:w,key:i,trace:u,guid:h.randstr(),horizontal:d,reversed:f,width:v,height:x,nodePad:u.node.pad,nodeLineColor:u.node.line.color,nodeLineWidth:u.node.line.width,linkLineColor:u.link.line.color,linkLineWidth:u.link.line.width,linkArrowLength:u.link.arrowlen,valueFormat:u.valueformat,valueSuffix:u.valuesuffix,textFont:u.textfont,translateX:c.x[0]*t.width+t.margin.l,translateY:t.height-c.y[1]*t.height+t.margin.t,dragParallel:d?x:v,dragPerpendicular:d?v:x,arrangement:u.arrangement,sankey:n,graph:A,forceLayouts:{},interactionState:{dragInProgress:!1,hovered:!1}}}function M(t,r,i){var n=r.source.label+"|"+r.target.label;return r.trace=t.trace,r.curveNumber=t.trace.index,{circular:t.circular,key:n+"__"+i,traceId:t.key,pointNumber:r.pointNumber,link:r,rgb:u.rgb(r.color),alpha:u.parse(r.color).alpha,hoverRgb:u.rgb(r.hovercolor),hoverAlpha:u.parse(r.hovercolor).alpha,linkPath:S,linkLineColor:t.linkLineColor,linkLineWidth:t.linkLineWidth,linkArrowLength:t.linkArrowLength,valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,parent:t,interactionState:t.interactionState,flow:r.flow}}function S(){return function(t){var r,i,a,o,s,l,u,c=t.linkArrowLength;if(t.link.circular)return r=t.link,i=c,a="",o=r.width/2,l=(s=r.circularPathData).sourceX+s.verticalBuffer0?" L "+s.targetX+" "+s.targetY:"")+"Z"):(a="M "+(s.targetX-i)+" "+(s.targetY-o)+" L "+(s.rightInnerExtent-i)+" "+(s.targetY-o)+" A "+(s.rightLargeArcRadius+o)+" "+(s.rightSmallArcRadius+o)+" 0 0 0 "+(s.rightFullExtent-o-i)+" "+(s.targetY+s.rightSmallArcRadius)+" L "+(s.rightFullExtent-o-i)+" "+s.verticalRightInnerExtent,l&&u?a+=" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.rightInnerExtent-o-i)+" "+(s.verticalFullExtent+o)+" L "+(s.rightFullExtent+o-i-(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent+o)+" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.leftFullExtent+o)+" "+s.verticalLeftInnerExtent:l?a+=" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.rightFullExtent-i-o-(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" L "+(s.leftFullExtent+o+(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.leftFullExtent+o)+" "+s.verticalLeftInnerExtent:a+=" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.rightInnerExtent-i)+" "+(s.verticalFullExtent+o)+" L "+s.leftInnerExtent+" "+(s.verticalFullExtent+o)+" A "+(s.leftLargeArcRadius+o)+" "+(s.leftLargeArcRadius+o)+" 0 0 0 "+(s.leftFullExtent+o)+" "+s.verticalLeftInnerExtent,a+=" L "+(s.leftFullExtent+o)+" "+(s.sourceY+s.leftSmallArcRadius)+" A "+(s.leftLargeArcRadius+o)+" "+(s.leftSmallArcRadius+o)+" 0 0 0 "+s.leftInnerExtent+" "+(s.sourceY-o)+" L "+s.sourceX+" "+(s.sourceY-o)+" L "+s.sourceX+" "+(s.sourceY+o)+" L "+s.leftInnerExtent+" "+(s.sourceY+o)+" A "+(s.leftLargeArcRadius-o)+" "+(s.leftSmallArcRadius-o)+" 0 0 1 "+(s.leftFullExtent-o)+" "+(s.sourceY+s.leftSmallArcRadius)+" L "+(s.leftFullExtent-o)+" "+s.verticalLeftInnerExtent,l&&u?a+=" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.leftFullExtent-o-(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" L "+(s.rightFullExtent+o-i+(s.rightLargeArcRadius-o))+" "+(s.verticalFullExtent-o)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.rightFullExtent+o-i)+" "+s.verticalRightInnerExtent:l?a+=" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.leftFullExtent+o)+" "+(s.verticalFullExtent+o)+" L "+(s.rightFullExtent-i-o)+" "+(s.verticalFullExtent+o)+" A "+(s.rightLargeArcRadius+o)+" "+(s.rightLargeArcRadius+o)+" 0 0 0 "+(s.rightFullExtent+o-i)+" "+s.verticalRightInnerExtent:a+=" A "+(s.leftLargeArcRadius-o)+" "+(s.leftLargeArcRadius-o)+" 0 0 1 "+s.leftInnerExtent+" "+(s.verticalFullExtent-o)+" L "+(s.rightInnerExtent-i)+" "+(s.verticalFullExtent-o)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightLargeArcRadius-o)+" 0 0 1 "+(s.rightFullExtent+o-i)+" "+s.verticalRightInnerExtent,a+=" L "+(s.rightFullExtent+o-i)+" "+(s.targetY+s.rightSmallArcRadius)+" A "+(s.rightLargeArcRadius-o)+" "+(s.rightSmallArcRadius-o)+" 0 0 1 "+(s.rightInnerExtent-i)+" "+(s.targetY+o)+" L "+(s.targetX-i)+" "+(s.targetY+o)+(i>0?" L "+s.targetX+" "+s.targetY:"")+"Z"),a;var h=Math.abs((t.link.target.x0-t.link.source.x1)/2);c>h&&(c=h);var d=t.link.source.x1,f=t.link.target.x0-c,p=n(d,f),m=p(.5),g=p(.5),y=t.link.y0-t.link.width/2,v=t.link.y0+t.link.width/2,x=t.link.y1-t.link.width/2,b=t.link.y1+t.link.width/2,_="M"+d+","+y,w="C"+m+","+y+" "+g+","+x+" "+f+","+x,T="C"+g+","+b+" "+m+","+v+" "+d+","+v,A=c>0?"L"+(f+c)+","+(x+t.link.width/2):"";return _+w+(A+="L"+f+","+b)+T+"Z"}}function E(t,r){var i=l.nodePadAcross,n=t.nodePad/2;r.dx=r.x1-r.x0,r.dy=r.y1-r.y0;var a=r.dx,o=Math.max(.5,r.dy),s="node_"+r.pointNumber;return r.group&&(s=h.randstr()),r.trace=t.trace,r.curveNumber=t.trace.index,{index:r.pointNumber,key:s,partOfGroup:r.partOfGroup||!1,group:r.group,traceId:t.key,trace:t.trace,node:r,nodePad:t.nodePad,nodeLineColor:t.nodeLineColor,nodeLineWidth:t.nodeLineWidth,textFont:t.textFont,size:t.horizontal?t.height:t.width,visibleWidth:Math.ceil(a),visibleHeight:o,zoneX:-i,zoneY:-n,zoneWidth:a+2*i,zoneHeight:o+2*n,labelY:t.horizontal?r.dy/2+1:r.dx/2+1,left:1===r.originalLayer,sizeAcross:t.width,forceLayouts:t.forceLayouts,horizontal:t.horizontal,reversed:t.reversed,rgb:u.rgb(r.color),alpha:u.parse(r.color).alpha,valueFormat:t.valueFormat,valueSuffix:t.valueSuffix,sankey:t.sankey,graph:t.graph,arrangement:t.arrangement,uniqueNodeLabelPathId:[t.guid,t.key,s].join("_"),interactionState:t.interactionState,figure:t}}function D(t){t.attr("transform",function(t){return d(t.node.x0.toFixed(3),t.node.y0.toFixed(3))})}function C(t){t.call(D)}function I(t,r){t.call(C),r.attr("d",S())}function L(t){t.attr("width",function(t){return t.node.x1-t.node.x0}).attr("height",function(t){return t.visibleHeight})}function P(t){return t.link.width>1||t.linkLineWidth>0}function z(t){return t.horizontal?t.reversed?d(t.translateX+t.width,t.translateY)+"matrix(-1 0 0 1 0 0)":d(t.translateX,t.translateY)+"matrix(1 0 0 1 0 0)":t.reversed?d(t.translateX,t.translateY+t.height)+"matrix(0 -1 1 0 0 0)":d(t.translateX,t.translateY)+"matrix(0 1 1 0 0 0)"}function F(t,r,i){t.on(".basic",null).on("mouseover.basic",function(t){t.interactionState.dragInProgress||t.partOfGroup||(i.hover(this,t,r),t.interactionState.hovered=[this,t])}).on("mousemove.basic",function(t){t.interactionState.dragInProgress||t.partOfGroup||(i.follow(this,t),t.interactionState.hovered=[this,t])}).on("mouseout.basic",function(t){t.interactionState.dragInProgress||t.partOfGroup||(i.unhover(this,t,r),t.interactionState.hovered=!1)}).on("click.basic",function(t){t.interactionState.hovered&&(i.unhover(this,t,r),t.interactionState.hovered=!1),t.interactionState.dragInProgress||t.partOfGroup||i.select(this,t,r)})}function O(t,r,n,o){var s=a.behavior.drag().origin(function(t){return{x:t.node.x0+t.visibleWidth/2,y:t.node.y0+t.visibleHeight/2}}).on("dragstart",function(a){if("fixed"!==a.arrangement&&(h.ensureSingle(o._fullLayout._infolayer,"g","dragcover",function(t){o._fullLayout._dragCover=t}),h.raiseToTop(this),a.interactionState.dragInProgress=a.node,B(a.node),a.interactionState.hovered&&(n.nodeEvents.unhover.apply(0,a.interactionState.hovered),a.interactionState.hovered=!1),"snap"===a.arrangement)){var s,u,c,d,f,p=a.traceId+"|"+a.key;a.forceLayouts[p]?a.forceLayouts[p].alpha(1):function(t,r,n){for(var a,o,s,u=n.graph.nodes,c=0;c0&&s.forceLayouts[a].alpha(0)})).stop()}(t,p,a),s=t,u=r,c=a,d=p,f=o,window.requestAnimationFrame(function t(){for(r=0;r0)window.requestAnimationFrame(t);else{var r,i=c.node.originalX;c.node.x0=i-c.visibleWidth/2,c.node.x1=i+c.visibleWidth/2,R(c,f)}})}}).on("drag",function(i){if("fixed"!==i.arrangement){var n=a.event.x,o=a.event.y;"snap"===i.arrangement?(i.node.x0=n-i.visibleWidth/2,i.node.x1=n+i.visibleWidth/2):("freeform"===i.arrangement&&(i.node.x0=n-i.visibleWidth/2,i.node.x1=n+i.visibleWidth/2),o=Math.max(0,Math.min(i.size-i.visibleHeight/2,o))),i.node.y0=o-i.visibleHeight/2,i.node.y1=o+i.visibleHeight/2,B(i.node),"snap"!==i.arrangement&&(i.sankey.update(i.graph),I(t.filter(j(i)),r))}}).on("dragend",function(t){if("fixed"!==t.arrangement){t.interactionState.dragInProgress=!1;for(var r=0;rP(t)?u.rgb(t.linkLineColor):t.rgb).style("stroke-opacity",t=>P(t)?u.opacity(t.linkLineColor):t.alpha).style("fill",t=>t.rgb).style("fill-opacity",t=>t.alpha).style("stroke-width",t=>P(t)?t.linkLineWidth:1).attr("d",S()),C.style("opacity",function(){return t._context.staticPlot||p||x?1:0}).transition().ease(l.ease).duration(l.duration).style("opacity",1),C.exit().transition().ease(l.ease).duration(l.duration).style("opacity",0).remove();var I=_.selectAll("."+l.cn.sankeyNodeSet).data(g,m);I.enter().append("g").classed(l.cn.sankeyNodeSet,!0),I.style("cursor",function(t){switch(t.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var R=I.selectAll("."+l.cn.sankeyNode).data(function(t){var r=t.graph.nodes;return function(t){var r,i=[];for(r=0;rt.rgb).style("fill-opacity",t=>t.alpha),B.transition().ease(l.ease).duration(l.duration).call(L);var j=R.selectAll("."+l.cn.nodeLabel).data(g);j.enter().append("text").classed(l.cn.nodeLabel,!0).style("cursor","default"),j.attr("data-notex",1).text(function(t){return t.node.label}).each(function(r){var i=a.select(this);c.font(i,r.textFont),v.convertToTspans(i,t)}).attr("text-anchor",function(t){return t.horizontal&&t.left!==t.reversed?"end":"start"}).attr("transform",function(t){var r=a.select(this),i=v.lineCount(r),n=t.textFont.size*((i-1)*T-w),o=t.nodeLineWidth/2+3;if(!t.horizontal){var s=t.reversed?(t.visibleWidth+n)/2:(t.visibleWidth-n)/2,l=t.reversed?f(90):"scale(-1,1)"+f(90);return d(s,o)+l}var u=o,s=(t.visibleHeight-n)/2;return t.left?u=-u:u+=t.visibleWidth,d(u,s)+(t.reversed?"scale(-1,1)":"")}),j.transition().ease(l.ease).duration(l.duration)}}}),NN=g({"src/traces/sankey/plot.js"(t,r){var i=k(),n=t_(),a=n.numberFormat,o=Nj(),s=rR(),l=ei(),u=NB().cn,c=n._;function h(t){return""!==t}function d(t,r){return t.filter(function(t){return t.key===r.traceId})}function f(t,r){i.select(t).select("path").style("fill-opacity",r),i.select(t).select("rect").style("fill-opacity",r)}function p(t){i.select(t).select("text.name").style("fill","black")}function m(t){return function(r){return -1!==t.node.sourceLinks.indexOf(r.link)||-1!==t.node.targetLinks.indexOf(r.link)}}function g(t){return function(r){return -1!==r.node.sourceLinks.indexOf(t.link)||-1!==r.node.targetLinks.indexOf(t.link)}}function y(t,r,i){r&&i&&d(i,r).selectAll("."+u.sankeyLink).filter(m(r)).call(x.bind(0,r,i,!1))}function v(t,r,i){r&&i&&d(i,r).selectAll("."+u.sankeyLink).filter(m(r)).call(b.bind(0,r,i,!1))}function x(t,r,i,n){n.style("fill",function(t){if(!t.link.concentrationscale)return t.hoverRgb}).style("fill-opacity",function(t){if(!t.link.concentrationscale)return t.hoverAlpha}),n.each(function(i){var n=i.link.label;""!==n&&d(r,t).selectAll("."+u.sankeyLink).filter(function(t){return t.link.label===n}).style("fill",function(t){if(!t.link.concentrationscale)return t.hoverRgb}).style("fill-opacity",function(t){if(!t.link.concentrationscale)return t.hoverAlpha})}),i&&d(r,t).selectAll("."+u.sankeyNode).filter(g(t)).call(y)}function b(t,r,i,n){n.style("fill",function(t){return t.rgb}).style("fill-opacity",function(t){return t.alpha}),n.each(function(i){var n=i.link.label;""!==n&&d(r,t).selectAll("."+u.sankeyLink).filter(function(t){return t.link.label===n}).style("fill",t=>t.rgb).style("fill-opacity",t=>t.alpha)}),i&&d(r,t).selectAll(u.sankeyNode).filter(g(t)).call(v)}function _(t,r){var i=t.hoverlabel||{},a=n.nestedProperty(i,r).get();return!Array.isArray(a)&&a}r.exports=function(t,r){for(var n=t._fullLayout,d=n._paper,m=n._size,g=0;g"),color:_(u,"bgcolor")||l.addOpacity(g.color,1),borderColor:_(u,"bordercolor"),fontFamily:_(u,"font.family"),fontSize:_(u,"font.size"),fontColor:_(u,"font.color"),fontWeight:_(u,"font.weight"),fontStyle:_(u,"font.style"),fontVariant:_(u,"font.variant"),fontTextcase:_(u,"font.textcase"),fontLineposition:_(u,"font.lineposition"),fontShadow:_(u,"font.shadow"),nameLength:_(u,"namelength"),textAlign:_(u,"align"),idealAlign:i.event.x"),color:_(l,"bgcolor")||o.rgb,borderColor:_(l,"bordercolor"),fontFamily:_(l,"font.family"),fontSize:_(l,"font.size"),fontColor:_(l,"font.color"),fontWeight:_(l,"font.weight"),fontStyle:_(l,"font.style"),fontVariant:_(l,"font.variant"),fontTextcase:_(l,"font.textcase"),fontLineposition:_(l,"font.lineposition"),fontShadow:_(l,"font.shadow"),nameLength:_(l,"namelength"),textAlign:_(l,"align"),idealAlign:"left",hovertemplate:l.hovertemplate,hovertemplateLabels:x,eventData:[o.node]},{container:n._hoverlayer.node(),outerContainer:n._paper.node(),gd:t});f(T,.85),p(T)}}},unhover:function(r,a,o){!1!==t._fullLayout.hovermode&&(i.select(r).call(v,a,o),"skip"!==a.node.trace.node.hoverinfo&&(a.node.fullData=a.node.trace,t.emit("plotly_unhover",{event:i.event,points:[a.node]})),s.loneUnhover(n._hoverlayer.node()))},select:function(r,n,a){var o=n.node;o.originalEvent=i.event,t._hoverdata=[o],i.select(r).call(v,n,a),s.click(t,{target:!0})}}})}}}),NV=g({"src/traces/sankey/base_plot.js"(t){var r=e$().overrideAll,i=tF().getModuleCalcData,n=NN(),a=Z(),o=rg(),s=rm(),l=iS().prepSelect,u=t_(),c=e2(),h="sankey";t.name=h,t.baseLayoutAttrOverrides=r({hoverlabel:a.hoverlabel},"plot","nested"),t.plot=function(r){var a=i(r.calcdata,h)[0];n(r,a),t.updateFx(r)},t.clean=function(t,r,i,n){var a=n._has&&n._has(h),o=r._has&&r._has(h);a&&!o&&(n._paperdiv.selectAll(".sankey").remove(),n._paperdiv.selectAll(".bgsankey").remove())},t.updateFx=function(t){for(var r=0;r0}function A(t){t.each(function(t){v.stroke(i.select(this),t.line.color)}).each(function(t){v.fill(i.select(this),t.color)}).style("stroke-width",function(t){return t.line.width})}function M(t,r,i){var n=t._fullLayout,a=o.extendFlat({type:"linear",ticks:"outside",range:i,showline:!0},r),s={type:"linear",_id:"x"+r._id},l={letter:"x",font:n.font,noAutotickangles:!0,noHover:!0,noTickson:!0};function u(t,r){return o.coerce(a,s,y,t,r)}return m(a,s,u,l,n),g(a,s,u,l),s}function S(t,r,i){return[Math.min(r/t.width,i/t.height),t,r+"x"+i]}function E(t,r,n,a){var o=document.createElementNS("http://www.w3.org/2000/svg","text"),s=i.select(o);return s.text(t).attr("x",0).attr("y",0).attr("text-anchor",n).attr("data-unformatted",t).call(f.convertToTspans,a).call(h.font,r),h.bBox(s.node())}function D(t,r,i,n,a,s){var l="_cache"+r;t[l]&&t[l].key===a||(t[l]={key:a,value:i});var u=o.aggNums(s,null,[t[l].value,n],2);return t[l].value=u,u}r.exports=function(t,r,m,g){var y,b=t._fullLayout;T(m)&&g&&(y=g()),o.makeTraceGroups(b._indicatorlayer,r,"trace").each(function(r){var g,k,C,I,L,P=r[0].trace,z=i.select(this),F=P._hasGauge,O=P._isAngular,R=P._isBullet,B=P.domain,j={w:b._size.w*(B.x[1]-B.x[0]),h:b._size.h*(B.y[1]-B.y[0]),l:b._size.l+b._size.w*B.x[0],r:b._size.r+b._size.w*(1-B.x[1]),t:b._size.t+b._size.h*(1-B.y[1]),b:b._size.b+b._size.h*B.y[0]},N=j.l+j.w/2,V=j.t+j.h/2,U=Math.min(j.w/2,j.h),q=d.innerRadius*U,G=P.align||"center";if(I=V,F){if(O&&(C=N,I=V+U/2,L=function(t){var r,i;return r=t,[(i=.9*q)/Math.sqrt(r.width/2*(r.width/2)+r.height*r.height),r,i]}),R){var H=d.bulletPadding,$=1-d.bulletNumberDomainSize+H;C=j.l+($+(1-$)*_[G])*j.w,L=function(t){return S(t,(d.bulletNumberDomainSize-H)*j.w,j.h)}}}else C=j.l+_[G]*j.w,L=function(t){return S(t,j.w,j.h)};(function(t,r,n,u){var c,d,m,g=n[0].trace,y=u.numbersX,b=u.numbersY,A=g.align||"center",k=x[A],S=u.transitionOpts,C=u.onComplete,I=o.ensureSingle(r,"g","numbers"),L=[];g._hasNumber&&L.push("number"),g._hasDelta&&(L.push("delta"),"left"===g.delta.position&&L.reverse());var P=I.selectAll("text").data(L);function z(r,i,n,a){if(!r.match("s")||n>=0==a>=0||i(n).slice(-1).match(w)||i(a).slice(-1).match(w))return i;var o=M(t,{tickformat:r.slice().replace("s","f").replace(/\d+/,function(t){return parseInt(t)-1})});return function(t){return 1>Math.abs(t)?p.tickText(o,t).text:i(t)}}P.enter().append("text"),P.attr("text-anchor",function(){return k}).attr("class",function(t){return t}).attr("x",null).attr("y",null).attr("dx",null).attr("dy",null),P.exit().remove();var F,O=g.mode+g.align;if(g._hasDelta&&(F=function(){var r=M(t,{tickformat:g.delta.valueformat},g._range);r.setScale(),p.prepTicks(r);var o=function(t){return p.tickText(r,t).text},s=g.delta.suffix,l=g.delta.prefix,u=function(t){return g.delta.relative?t.relativeDelta:t.delta},c=function(t,r){return 0===t||"number"!=typeof t||isNaN(t)?"-":(t>0?g.delta.increasing.symbol:g.delta.decreasing.symbol)+l+r(t)+s},m=function(t){return t.delta>=0?g.delta.increasing.color:g.delta.decreasing.color};void 0===g._deltaLastValue&&(g._deltaLastValue=u(n[0]));var y=I.select("text.delta");function x(){y.text(c(u(n[0]),o)).call(v.fill,m(n[0])).call(f.convertToTspans,t)}return y.call(h.font,g.delta.font).call(v.fill,m({delta:g._deltaLastValue})),T(S)?y.transition().duration(S.duration).ease(S.easing).tween("text",function(){var t=i.select(this),r=u(n[0]),s=g._deltaLastValue,l=z(g.delta.valueformat,o,s,r),h=a(s,r);return g._deltaLastValue=r,function(r){t.text(c(h(r),l)),t.call(v.fill,m({delta:h(r)}))}}).each("end",function(){x(),C&&C()}).each("interrupt",function(){x(),C&&C()}):x(),d=E(c(u(n[0]),o),g.delta.font,k,t),y}(),O+=g.delta.position+g.delta.font.size+g.delta.font.family+g.delta.valueformat,O+=g.delta.increasing.symbol+g.delta.decreasing.symbol,m=d),g._hasNumber&&(function(){var r=M(t,{tickformat:g.number.valueformat},g._range);r.setScale(),p.prepTicks(r);var o=function(t){return p.tickText(r,t).text},s=g.number.suffix,l=g.number.prefix,u=I.select("text.number");function d(){var r="number"==typeof n[0].y?l+o(n[0].y)+s:"-";u.text(r).call(h.font,g.number.font).call(f.convertToTspans,t)}T(S)?u.transition().duration(S.duration).ease(S.easing).each("end",function(){d(),C&&C()}).each("interrupt",function(){d(),C&&C()}).attrTween("text",function(){var t=i.select(this),r=a(n[0].lastY,n[0].y);g._lastValue=n[0].y;var u=z(g.number.valueformat,o,n[0].lastY,n[0].y);return function(i){t.text(l+u(r(i))+s)}}):d(),c=E(l+o(n[0].y)+s,g.number.font,k,t)}(),O+=g.number.font.size+g.number.font.family+g.number.valueformat+g.number.suffix+g.number.prefix,m=c),g._hasDelta&&g._hasNumber){var R,B,j=[(c.left+c.right)/2,(c.top+c.bottom)/2],N=[(d.left+d.right)/2,(d.top+d.bottom)/2],V=.75*g.delta.font.size;"left"===g.delta.position&&(R=D(g,"deltaPos",0,-1*(c.width*_[g.align]+d.width*(1-_[g.align])+V),O,Math.min),B=j[1]-N[1],m={width:c.width+d.width+V,height:Math.max(c.height,d.height),left:d.left+R,right:c.right,top:Math.min(c.top,d.top+B),bottom:Math.max(c.bottom,d.bottom+B)}),"right"===g.delta.position&&(R=D(g,"deltaPos",0,c.width*(1-_[g.align])+d.width*_[g.align]+V,O,Math.max),B=j[1]-N[1],m={width:c.width+d.width+V,height:Math.max(c.height,d.height),left:c.left,right:d.right+R,top:Math.min(c.top,d.top+B),bottom:Math.max(c.bottom,d.bottom+B)}),"bottom"===g.delta.position&&(R=null,B=d.height,m={width:Math.max(c.width,d.width),height:c.height+d.height,left:Math.min(c.left,d.left),right:Math.max(c.right,d.right),top:c.bottom-c.height,bottom:c.bottom+d.height}),"top"===g.delta.position&&(R=null,B=c.top,m={width:Math.max(c.width,d.width),height:c.height+d.height,left:Math.min(c.left,d.left),right:Math.max(c.right,d.right),top:c.bottom-c.height-d.height,bottom:c.bottom}),F.attr({dx:R,dy:B})}(g._hasNumber||g._hasDelta)&&I.attr("transform",function(){var t=u.numbersScaler(m);O+=t[2];var r,i=D(g,"numbersScale",1,t[0],O,Math.min);g._scaleNumbers||(i=1),r=g._isAngular?b-i*m.bottom:b-i*(m.top+m.bottom)/2,g._numbersTop=i*m.top+r;var n=m[A];"center"===A&&(n=(m.left+m.right)/2);var a=y-i*n;return l(a=D(g,"numbersTranslate",0,a,O,Math.max),r)+s(i)})})(t,z,r,{numbersX:C,numbersY:I,numbersScaler:L,transitionOpts:m,onComplete:y}),F&&(g={range:P.gauge.axis.range,color:P.gauge.bgcolor,line:{color:P.gauge.bordercolor,width:0},thickness:1},k={range:P.gauge.axis.range,color:"rgba(0, 0, 0, 0)",line:{color:P.gauge.bordercolor,width:P.gauge.borderwidth},thickness:1});var W=z.selectAll("g.angular").data(O?r:[]);W.exit().remove();var Y=z.selectAll("g.angularaxis").data(O?r:[]);Y.exit().remove(),O&&function(t,r,a){var o,s,h,d,f,m,g=r[0].trace,y=a.size,v=a.radius,x=a.innerRadius,b=a.gaugeBg,_=a.gaugeOutline,w=[y.l+y.w/2,y.t+y.h/2+v/2],k=a.gauge,S=a.layer,E=a.transitionOpts,D=a.onComplete,C=Math.PI/2;function I(t){var r=g.gauge.axis.range[0],i=(t-r)/(g.gauge.axis.range[1]-r)*Math.PI-C;return i<-C?-C:i>C?C:i}function L(t){return i.svg.arc().innerRadius((x+v)/2-t/2*(v-x)).outerRadius((x+v)/2+t/2*(v-x)).startAngle(-C)}function P(t){t.attr("d",function(t){return L(t.thickness).startAngle(I(t.range[0])).endAngle(I(t.range[1]))()})}k.enter().append("g").classed("angular",!0),k.attr("transform",l(w[0],w[1])),S.enter().append("g").classed("angularaxis",!0).classed("crisp",!0),S.selectAll("g.xangularaxistick,path,text").remove(),(d=M(t,g.gauge.axis)).type="linear",d.range=g.gauge.axis.range,d._id="xangularaxis",d.ticklabeloverflow="allow",d.setScale();var z=function(t){return(d.range[0]-t.x)/(d.range[1]-d.range[0])*Math.PI+Math.PI},F={},O=p.makeLabelFns(d,0).labelStandoff;F.xFn=function(t){return Math.cos(z(t))*O},F.yFn=function(t){var r=z(t),i=Math.sin(r)>0?.2:1;return-Math.sin(r)*(O+t.fontSize*i)+Math.abs(Math.cos(r))*(t.fontSize*c)},F.anchorFn=function(t){var r=Math.cos(z(t));return .1>Math.abs(r)?"middle":r>0?"start":"end"},F.heightFn=function(t,r,i){return -.5*(1+Math.sin(z(t)))*i};var R=function(t){return l(w[0]+v*Math.cos(t),w[1]-v*Math.sin(t))};if(f=p.calcTicks(d),m=p.getTickSigns(d)[2],d.visible){m="inside"===d.ticks?-1:1;var B=(d.linewidth||1)/2;p.drawTicks(t,d,{vals:f,layer:S,path:"M"+m*B+",0h"+m*d.ticklen,transFn:function(t){var r=z(t);return R(r)+"rotate("+-u(r)+")"}}),p.drawLabels(t,d,{vals:f,layer:S,transFn:function(t){return R(z(t))},labelFns:F})}var j=[b].concat(g.gauge.steps),N=k.selectAll("g.bg-arc").data(j);N.enter().append("g").classed("bg-arc",!0).append("path"),N.select("path").call(P).call(A),N.exit().remove();var V=L(g.gauge.bar.thickness),U=k.selectAll("g.value-arc").data([g.gauge.bar]);U.enter().append("g").classed("value-arc",!0).append("path");var q=U.select("path");T(E)?(q.transition().duration(E.duration).ease(E.easing).each("end",function(){D&&D()}).each("interrupt",function(){D&&D()}).attrTween("d",(o=V,s=I(r[0].lastY),h=I(r[0].y),function(){var t=n(s,h);return function(r){return o.endAngle(t(r))()}})),g._lastValue=r[0].y):q.attr("d","number"==typeof r[0].y?V.endAngle(I(r[0].y)):"M0,0Z"),q.call(A),U.exit().remove(),j=[];var G=g.gauge.threshold.value;(G||0===G)&&j.push({range:[G,G],color:g.gauge.threshold.color,line:{color:g.gauge.threshold.line.color,width:g.gauge.threshold.line.width},thickness:g.gauge.threshold.thickness});var H=k.selectAll("g.threshold-arc").data(j);H.enter().append("g").classed("threshold-arc",!0).append("path"),H.select("path").call(P).call(A),H.exit().remove();var $=k.selectAll("g.gauge-outline").data([_]);$.enter().append("g").classed("gauge-outline",!0).append("path"),$.select("path").call(P).call(A),$.exit().remove()}(t,r,{radius:U,innerRadius:q,gauge:W,layer:Y,size:j,gaugeBg:g,gaugeOutline:k,transitionOpts:m,onComplete:y});var Z=z.selectAll("g.bullet").data(R?r:[]);Z.exit().remove();var X=z.selectAll("g.bulletaxis").data(R?r:[]);X.exit().remove(),R&&function(t,r,i){var n,a,o,s,u,c=r[0].trace,h=i.gauge,f=i.layer,m=i.gaugeBg,g=i.gaugeOutline,y=i.size,x=c.domain,b=i.transitionOpts,_=i.onComplete;h.enter().append("g").classed("bullet",!0),h.attr("transform",l(y.l,y.t)),f.enter().append("g").classed("bulletaxis",!0).classed("crisp",!0),f.selectAll("g.xbulletaxistick,path,text").remove();var w=y.h,k=c.gauge.bar.thickness*w,S=x.x[0],E=x.x[0]+(x.x[1]-x.x[0])*(c._hasNumber||c._hasDelta?1-d.bulletNumberDomainSize:1);function D(t){t.attr("width",function(t){return Math.max(0,n.c2p(t.range[1])-n.c2p(t.range[0]))}).attr("x",function(t){return n.c2p(t.range[0])}).attr("y",function(t){return .5*(1-t.thickness)*w}).attr("height",function(t){return t.thickness*w})}(n=M(t,c.gauge.axis))._id="xbulletaxis",n.domain=[S,E],n.setScale(),a=p.calcTicks(n),o=p.makeTransTickFn(n),s=p.getTickSigns(n)[2],u=y.t+y.h,n.visible&&(p.drawTicks(t,n,{vals:"inside"===n.ticks?p.clipEnds(n,a):a,layer:f,path:p.makeTickPath(n,u,s),transFn:o}),p.drawLabels(t,n,{vals:a,layer:f,transFn:o,labelFns:p.makeLabelFns(n,u)}));var C=[m].concat(c.gauge.steps),I=h.selectAll("g.bg-bullet").data(C);I.enter().append("g").classed("bg-bullet",!0).append("rect"),I.select("rect").call(D).call(A),I.exit().remove();var L=h.selectAll("g.value-bullet").data([c.gauge.bar]);L.enter().append("g").classed("value-bullet",!0).append("rect"),L.select("rect").attr("height",k).attr("y",(w-k)/2).call(A),T(b)?L.select("rect").transition().duration(b.duration).ease(b.easing).each("end",function(){_&&_()}).each("interrupt",function(){_&&_()}).attr("width",Math.max(0,n.c2p(Math.min(c.gauge.axis.range[1],r[0].y)))):L.select("rect").attr("width","number"==typeof r[0].y?Math.max(0,n.c2p(Math.min(c.gauge.axis.range[1],r[0].y))):0),L.exit().remove();var P=r.filter(function(){return c.gauge.threshold.value||0===c.gauge.threshold.value}),z=h.selectAll("g.threshold-bullet").data(P);z.enter().append("g").classed("threshold-bullet",!0).append("line"),z.select("line").attr("x1",n.c2p(c.gauge.threshold.value)).attr("x2",n.c2p(c.gauge.threshold.value)).attr("y1",(1-c.gauge.threshold.thickness)/2*w).attr("y2",(1-(1-c.gauge.threshold.thickness)/2)*w).call(v.stroke,c.gauge.threshold.line.color).style("stroke-width",c.gauge.threshold.line.width),z.exit().remove();var F=h.selectAll("g.gauge-outline").data([g]);F.enter().append("g").classed("gauge-outline",!0).append("rect"),F.select("rect").call(D).call(A),F.exit().remove()}(t,r,{gauge:Z,layer:X,size:j,gaugeBg:g,gaugeOutline:k,transitionOpts:m,onComplete:y});var K=z.selectAll("text.title").data(r);K.exit().remove(),K.enter().append("text").classed("title",!0),K.attr("text-anchor",function(){return R?x.right:x[P.title.align]}).text(P.title.text).call(h.font,P.title.font).call(f.convertToTspans,t),K.attr("transform",function(){var t,r=j.l+j.w*_[P.title.align],i=d.titlePadding,n=h.bBox(K.node());return F?(O&&(t=P.gauge.axis.visible?h.bBox(Y.node()).top-i-n.bottom:j.t+j.h/2-U/2-n.bottom-i),R&&(t=I-(n.top+n.bottom)/2,r=j.l-d.bulletPadding*j.w)):t=P._numbersTop-i-n.bottom,l(r,t)})})}}}),NK=g({"src/traces/indicator/index.js"(t,r){r.exports={moduleType:"trace",name:"indicator",basePlotModule:NH(),categories:["svg","noOpacity","noHover"],animatable:!0,attributes:N$(),supplyDefaults:NY().supplyDefaults,calc:NZ().calc,plot:NX(),meta:{}}}}),NJ=g({"lib/indicator.js"(t,r){r.exports=NK()}}),NQ=g({"src/traces/table/attributes.js"(t,r){var i=ix(),n=$().extendFlat,a=e$().overrideAll,o=W(),s=an().attributes,l=tU().descriptionOnlyNumbers;r.exports=a({domain:s({name:"table",trace:!0}),columnwidth:{valType:"number",arrayOk:!0,dflt:null},columnorder:{valType:"data_array"},header:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:28},align:n({},i.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:n({},o({arrayOk:!0}))},cells:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[],description:l("cell value")},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:20},align:n({},i.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:n({},o({arrayOk:!0}))}},"calc","from-root")}}),N0=g({"src/traces/table/defaults.js"(t,r){var i=t_(),n=NQ(),a=an().defaults;r.exports=function(t,r,o,s){function l(a,o){return i.coerce(t,r,n,a,o)}a(r,s,l),l("columnwidth"),l("header.values"),l("header.format"),l("header.align"),l("header.prefix"),l("header.suffix"),l("header.height"),l("header.line.width"),l("header.line.color"),l("header.fill.color"),i.coerceFont(l,"header.font",s.font),function(t,r){for(var i=t.columnorder||[],n=t.header.values.length,a=i.slice(0,n),o=a.slice().sort(function(t,r){return t-r}),s=a.map(function(t){return o.indexOf(t)}),l=s.length;l",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}}}}),N3=g({"src/traces/table/data_preparation_helper.js"(t,r){var i=N2(),n=$().extendFlat,a=L(),o=O().isTypedArray,s=O().isArrayOrTypedArray;function l(t){if(s(t)){for(var r=0,i=0;i=r||c===t.length-1)&&(n[a]=s,s.key=u++,s.firstRowIndex=l,s.lastRowIndex=c,s=m(),a+=o,l=c+1,o=0);return n}function m(){return{firstRowIndex:null,lastRowIndex:null,rows:[]}}r.exports=function(t,r){var o=c(r.cells.values),m=function(t){return t.slice(r.header.values.length,t.length)},g=c(r.header.values);g.length&&!g[0].length&&(g[0]=[""],g=c(g));var y=g.concat(m(o).map(function(){return h((g[0]||[""]).length)})),v=r.domain,x=Math.floor(t._fullLayout._size.w*(v.x[1]-v.x[0])),b=Math.floor(t._fullLayout._size.h*(v.y[1]-v.y[0])),_=r.header.values.length?y[0].map(function(){return r.header.height}):[i.emptyHeaderHeight],w=o.length?o[0].map(function(){return r.cells.height}):[],T=_.reduce(u,0),A=p(w,b-T+i.uplift),M=f(p(_,T),[]),k=f(A,M),S={},E=r.columnorder;s(E)&&(E=Array.from(E)),E=E.concat(m(o.map(function(t,r){return r})));var D=y.map(function(t,i){var n=s(r.columnwidth)?r.columnwidth[Math.min(i,r.columnwidth.length-1)]:r.columnwidth;return a(n)?Number(n):1}),C=D.reduce(u,0);D=D.map(function(t){return t/C*x});var I=Math.max(l(r.header.line.width),l(r.cells.line.width)),L={key:r.uid+t._context.staticPlot,translateX:v.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-v.y[1]),size:t._fullLayout._size,width:x,maxLineWidth:I,height:b,columnOrder:E,groupHeight:b,rowBlocks:k,headerRowBlocks:M,scrollY:0,cells:n({},r.cells,{values:o}),headerCells:n({},r.header,{values:y}),gdColumns:y.map(function(t){return t[0]}),gdColumnsOriginalOrder:y.map(function(t){return t[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:y.map(function(t,r){var i=S[t];return S[t]=(i||0)+1,{key:t+"__"+S[t],label:t,specIndex:r,xIndex:E[r],xScale:d,x:void 0,calcdata:void 0,columnWidth:D[r]}})};return L.columns.forEach(function(t){t.calcdata=L,t.x=d(t)}),L}}}),N5=g({"src/traces/table/data_split_helpers.js"(t){var r=$().extendFlat;t.splitToPanels=function(t){var i=[0,0],n=r({},t,{key:"header",type:"header",page:0,prevPages:i,currentRepaint:[null,null],dragHandle:!0,values:t.calcdata.headerCells.values[t.specIndex],rowBlocks:t.calcdata.headerRowBlocks,calcdata:r({},t.calcdata,{cells:t.calcdata.headerCells})});return[r({},t,{key:"cells1",type:"cells",page:0,prevPages:i,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),r({},t,{key:"cells2",type:"cells",page:1,prevPages:i,currentRepaint:[null,null],dragHandle:!1,values:t.calcdata.cells.values[t.specIndex],rowBlocks:t.calcdata.rowBlocks}),n]},t.splitToCells=function(t){var r,i,n,a,o=(n=(i=(r=t).rowBlocks[r.page])?i.rows[0].rowIndex:0,a=i?n+i.rows.length:0,[n,a]);return(t.values||[]).slice(o[0],o[1]).map(function(r,i){return{keyWithinBlock:i+("string"==typeof r&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:o[0]+i,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}})}}}),N4=g({"src/traces/table/plot.js"(t,r){var i=N2(),n=k(),a=t_(),o=a.numberFormat,s=yj(),l=rr(),u=tN(),c=t_().raiseToTop,h=t_().strTranslate,d=t_().cancelTransition,f=N3(),p=N5(),m=ei();function g(t){return Math.ceil(t.calcdata.maxLineWidth/2)}function y(t,r){return"clip"+t._fullLayout._uid+"_scrollAreaBottomClip_"+r.key}function v(t,r){return"clip"+t._fullLayout._uid+"_columnBoundaryClippath_"+r.calcdata.key+"_"+r.specIndex}function x(t){return[].concat.apply([],t.map(function(t){return t})).map(function(t){return t.__data__})}function b(t,r,a){var o=t.selectAll("."+i.cn.scrollbarKit).data(s.repeat,s.keyFun);o.enter().append("g").classed(i.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),o.each(function(t){var r,n=t.scrollbarState;n.totalHeight=R(r=t.rowBlocks,r.length-1)+(r.length?B(r[r.length-1],1/0):1),n.scrollableAreaHeight=t.groupHeight-D(t),n.currentlyVisibleHeight=Math.min(n.totalHeight,n.scrollableAreaHeight),n.ratio=n.currentlyVisibleHeight/n.totalHeight,n.barLength=Math.max(n.ratio*n.currentlyVisibleHeight,i.goldenRatio*i.scrollbarWidth),n.barWiggleRoom=n.currentlyVisibleHeight-n.barLength,n.wiggleRoom=Math.max(0,n.totalHeight-n.scrollableAreaHeight),n.topY=0===n.barWiggleRoom?0:t.scrollY/n.wiggleRoom*n.barWiggleRoom,n.bottomY=n.topY+n.barLength,n.dragMultiplier=n.wiggleRoom/n.barWiggleRoom}).attr("transform",function(t){return h(t.width+i.scrollbarWidth/2+i.scrollbarOffset,D(t))});var l=o.selectAll("."+i.cn.scrollbar).data(s.repeat,s.keyFun);l.enter().append("g").classed(i.cn.scrollbar,!0);var u=l.selectAll("."+i.cn.scrollbarSlider).data(s.repeat,s.keyFun);u.enter().append("g").classed(i.cn.scrollbarSlider,!0),u.attr("transform",function(t){return h(0,t.scrollbarState.topY||0)});var c=u.selectAll("."+i.cn.scrollbarGlyph).data(s.repeat,s.keyFun);c.enter().append("line").classed(i.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",i.scrollbarWidth).attr("stroke-linecap","round").attr("y1",i.scrollbarWidth/2),c.attr("y2",function(t){return t.scrollbarState.barLength-i.scrollbarWidth/2}).attr("stroke-opacity",function(t){return t.columnDragInProgress||!t.scrollbarState.barWiggleRoom||a?0:.4}),c.transition().delay(0).duration(0),c.transition().delay(i.scrollbarHideDelay).duration(i.scrollbarHideDuration).attr("stroke-opacity",0);var d=l.selectAll("."+i.cn.scrollbarCaptureZone).data(s.repeat,s.keyFun);d.enter().append("line").classed(i.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",i.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(i){var a=n.event.y,o=this.getBoundingClientRect(),s=i.scrollbarState,l=a-o.top,u=n.scale.linear().domain([0,s.scrollableAreaHeight]).range([0,s.totalHeight]).clamp(!0);s.topY<=l&&l<=s.bottomY||I(r,t,null,u(l-s.barLength/2))(i)}).call(n.behavior.drag().origin(function(t){return n.event.stopPropagation(),t.scrollbarState.scrollbarScrollInProgress=!0,t}).on("drag",I(r,t)).on("dragend",function(){})),d.attr("y2",function(t){return t.scrollbarState.scrollableAreaHeight}),r._context.staticPlot&&(c.remove(),d.remove())}function _(t,r,a,o){var u,c,h,d,f,g=((c=((u=a.selectAll("."+i.cn.columnCells).data(s.repeat,s.keyFun)).enter().append("g").classed(i.cn.columnCells,!0),u.exit().remove(),u).selectAll("."+i.cn.columnCell).data(p.splitToCells,function(t){return t.keyWithinBlock})).enter().append("g").classed(i.cn.columnCell,!0),c.exit().remove(),c);g.each(function(t,r){var i=t.calcdata.cells.font,n=t.column.specIndex,a={size:A(i.size,n,r),color:A(i.color,n,r),family:A(i.family,n,r),weight:A(i.weight,n,r),style:A(i.style,n,r),variant:A(i.variant,n,r),textcase:A(i.textcase,n,r),lineposition:A(i.lineposition,n,r),shadow:A(i.shadow,n,r)};t.rowNumber=t.key,t.align=A(t.calcdata.cells.align,n,r),t.cellBorderWidth=A(t.calcdata.cells.line.width,n,r),t.font=a}),((h=g.selectAll("."+i.cn.cellRect).data(s.repeat,function(t){return t.keyWithinBlock})).enter().append("rect").classed(i.cn.cellRect,!0),h).attr("width",function(t){return t.column.columnWidth}).attr("stroke-width",function(t){return t.cellBorderWidth}).each(function(t){var r=n.select(this);m.stroke(r,A(t.calcdata.cells.line.color,t.column.specIndex,t.rowNumber)),m.fill(r,A(t.calcdata.cells.fill.color,t.column.specIndex,t.rowNumber))});var y=((f=((d=g.selectAll("."+i.cn.cellTextHolder).data(s.repeat,function(t){return t.keyWithinBlock})).enter().append("g").classed(i.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),d).selectAll("."+i.cn.cellText).data(s.repeat,function(t){return t.keyWithinBlock})).enter().append("text").classed(i.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){n.event.stopPropagation()}),f);y.each(function(t){l.font(n.select(this),t.font)}),w(y,r,o,t),O(g)}function w(t,r,a,s){t.text(function(t){var r,n=t.column.specIndex,a=t.rowNumber,s=t.value,l="string"==typeof s,u=l&&s.match(/
/i),c=!l||u;t.mayHaveMarkup=l&&s.match(/[<&>]/);var h="string"==typeof(d=s)&&d.match(i.latexCheck);t.latex=h;var d,f,p=h?"":A(t.calcdata.cells.prefix,n,a)||"",m=h?"":A(t.calcdata.cells.suffix,n,a)||"",g=h?null:A(t.calcdata.cells.format,n,a)||null,y=p+(g?o(g)(t.value):t.value)+m;if(t.wrappingNeeded=!t.wrapped&&!c&&!h&&(f=T(y)),t.cellHeightMayIncrease=u||h||t.mayHaveMarkup||(void 0===f?T(y):f),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex,t.wrappingNeeded){var v=(" "===i.wrapSplitCharacter?y.replace(/a&&n.push(o),a+=u}return n}(a,u,l);1===c.length&&(c[0]===a.length-1?c.unshift(c[0]-1):c.push(c[0]+1)),c[0]%2&&c.reverse(),r.each(function(t,r){t.page=c[r],t.scrollY=u}),r.attr("transform",function(t){return h(0,R(t.rowBlocks,t.page)-t.scrollY)}),t&&(L(t,i,r,c,n.prevPages,n,0),L(t,i,r,c,n.prevPages,n,1),b(i,t))}}function I(t,r,a,o){return function(s){var l=s.calcdata?s.calcdata:s,u=r.filter(function(t){return l.key===t.key}),c=a||l.scrollbarState.dragMultiplier,h=l.scrollY;return l.scrollY=void 0===o?l.scrollY+c*n.event.dy:o,C(t,u.selectAll("."+i.cn.yColumn).selectAll("."+i.cn.columnBlock).filter(S),u),l.scrollY===h}}function L(t,r,i,n,a,o,s){n[s]!==a[s]&&(clearTimeout(o.currentRepaint[s]),o.currentRepaint[s]=setTimeout(function(){_(t,r,i.filter(function(t,r){return r===s&&n[r]!==a[r]}),i),a[s]=n[s]}))}function P(t,r,a,o){return function(){var s=n.select(r.parentNode);s.each(function(t){var r=t.fragments;s.selectAll("tspan.line").each(function(t,i){r[i].width=this.getComputedTextLength()});var n,a,o=r[r.length-1].width,l=r.slice(0,-1),u=[],c=0,h=t.column.columnWidth-2*i.cellPad;for(t.value="";l.length;)c+(a=(n=l.shift()).width+o)>h&&(t.value+=u.join(i.wrapSpacer)+i.lineBreaker,u=[],c=0),u.push(n.text),c+=a;c&&(t.value+=u.join(i.wrapSpacer)),t.wrapped=!0}),s.selectAll("tspan.line").remove(),w(s.select("."+i.cn.cellText),a,t,o),n.select(r.parentNode.parentNode).call(O)}}function z(t,r,a,o,s){return function(){if(!s.settledY){var l=n.select(r.parentNode),u=j(s),c=s.key-u.firstRowIndex,d=u.rows[c].rowHeight,f=Math.max(s.cellHeightMayIncrease?r.parentNode.getBoundingClientRect().height+2*i.cellPad:d,d);f-u.rows[c].rowHeight&&(u.rows[c].rowHeight=f,t.selectAll("."+i.cn.columnCell).call(O),C(null,t.filter(S),0),b(a,o,!0)),l.attr("transform",function(){var t=this.parentNode.getBoundingClientRect(),r=n.select(this.parentNode).select("."+i.cn.cellRect).node().getBoundingClientRect(),a=this.transform.baseVal.consolidate(),o=r.top-t.top+(a?a.matrix.f:i.cellPad);return h(F(s,n.select(this.parentNode).select("."+i.cn.cellTextHolder).node().getBoundingClientRect().width),o)}),s.settledY=!0}}}function F(t,r){switch(t.align){case"left":default:return i.cellPad;case"right":return t.column.columnWidth-(r||0)-i.cellPad;case"center":return(t.column.columnWidth-(r||0))/2}}function O(t){t.attr("transform",function(t){var r=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,r){return t+B(r,1/0)},0);return h(0,B(j(t),t.key)+r)}).selectAll("."+i.cn.cellRect).attr("height",function(t){var r,i;return(r=j(t),i=t.key,r.rows[i-r.firstRowIndex]).rowHeight})}function R(t,r){for(var i=0,n=r-1;n>=0;n--)i+=function(t){var r=t.allRowsHeight;if(void 0!==r)return r;for(var i=0,n=0;nr.length&&(t=t.slice(0,r.length)):t=[],a=0;a90&&(f-=180,u=-u),{angle:f,flip:u,p:t.c2p(n,r,i),offsetMultplier:c}}}}),Vl=g({"src/traces/carpet/plot.js"(t,r){var i=k(),n=rr(),a=Va(),o=Vo(),s=Vs(),l=tN(),u=t_(),c=u.strRotate,h=u.strTranslate,d=tj();function f(t,r,s,l,u,c,h){var d="const-"+u+"-lines",f=s.selectAll("."+d).data(c);f.enter().append("path").classed(d,!0).style("vector-effect",h?"none":"non-scaling-stroke"),f.each(function(s){var l=s.x,u=s.y,c="M"+o(a([],l,t.c2p),a([],u,r.c2p),s.smoothing);i.select(this).attr("d",c).style("stroke-width",s.width).style("stroke",s.color).style("stroke-dasharray",n.dashStyle(s.dash,s.width)).style("fill","none")}),f.exit().remove()}function p(t,r,a,o,u,d,f,p){var m=d.selectAll("text."+p).data(f);m.enter().append("text").classed(p,!0);var g=0,y={};return m.each(function(u,d){if("auto"===u.axis.tickangle)f=s(o,r,a,u.xy,u.dxy);else{var f,p=(u.axis.tickangle+180)*Math.PI/180;f=s(o,r,a,u.xy,[Math.cos(p),Math.sin(p)])}d||(y={angle:f.angle,flip:f.flip});var m=(u.endAnchor?-1:1)*f.flip,v=i.select(this).attr({"text-anchor":m>0?"start":"end","data-notex":1}).call(n.font,u.font).text(u.text).call(l.convertToTspans,t),x=n.bBox(this);v.attr("transform",h(f.p[0],f.p[1])+c(f.angle)+h(u.axis.labelpadding*m,.3*x.height)),g=Math.max(g,x.width+u.axis.labelpadding)}),m.exit().remove(),y.maxExtent=g,y}r.exports=function(t,r,n,l){var c=t._context.staticPlot,h=r.xaxis,d=r.yaxis,m=t._fullLayout._clips;u.makeTraceGroups(l,n,"trace").each(function(r){var n,l,g,v,x,b,_,w,T,A,M,k,S,E,D,C,I=i.select(this),L=r[0],P=L.trace,z=P.aaxis,F=P.baxis,O=u.ensureSingle(I,"g","minorlayer"),R=u.ensureSingle(I,"g","majorlayer"),B=u.ensureSingle(I,"g","boundarylayer"),j=u.ensureSingle(I,"g","labellayer");I.style("opacity",P.opacity),f(h,d,R,z,"a",z._gridlines,!0),f(h,d,R,F,"b",F._gridlines,!0),f(h,d,O,z,"a",z._minorgridlines,!0),f(h,d,O,F,"b",F._minorgridlines,!0),f(h,d,B,z,"a-boundary",z._boundarylines,c),f(h,d,B,F,"b-boundary",F._boundarylines,c);var N=p(t,h,d,P,L,j,z._labels,"a-label"),V=p(t,h,d,P,L,j,F._labels,"b-label");n=t,l=j,g=P,v=L,x=h,b=d,_=N,w=V,S=u.aggNums(Math.min,null,g.a),E=u.aggNums(Math.max,null,g.a),D=u.aggNums(Math.min,null,g.b),C=u.aggNums(Math.max,null,g.b),T=.5*(S+E),A=D,M=g.ab2xy(T,A,!0),k=g.dxyda_rough(T,A),void 0===_.angle&&u.extendFlat(_,s(g,x,b,M,g.dxydb_rough(T,A))),y(n,l,g,v,M,k,g.aaxis,x,b,_,"a-title"),T=S,A=.5*(D+C),M=g.ab2xy(T,A,!0),k=g.dxydb_rough(T,A),void 0===w.angle&&u.extendFlat(w,s(g,x,b,M,g.dxyda_rough(T,A))),y(n,l,g,v,M,k,g.baxis,x,b,w,"b-title"),function(t,r,i,n,s){var l,c,h=i.select("#"+t._clipPathId);h.size()||(h=i.append("clipPath").classed("carpetclip",!0));var d=u.ensureSingle(h,"path","carpetboundary"),f=r.clipsegments,p=[];for(c=0;c90&&x<270&&(w=(-l.lineCount(b)+g)*m*o-w),b.attr("transform",h(r.p[0],r.p[1])+c(r.angle)+h(0,w)).attr("text-anchor","middle").call(n.font,f.title.font)}),_.exit().remove()}}}),Vu=g({"src/traces/carpet/cheater_basis.js"(t,r){var i=t_().isArrayOrTypedArray;r.exports=function(t,r,n){var a,o,s,l,u,c=[],h=i(t)?t.length:t,d=i(r)?r.length:r,f=i(t)?t:null,p=i(r)?r:null;f&&(s=(f.length-1)/(f[f.length-1]-f[0])/(h-1)),p&&(l=(p.length-1)/(p[p.length-1]-p[0])/(d-1));var m,g=1/0,y=-1/0;for(o=0;o=10)return null;for(var a=1/0,o=-1/0,s=r.length,l=0;l0&&(p=t.dxydi([],n-1,s,0,l),v.push(u[0]+p[0]/3),x.push(u[1]+p[1]/3),m=t.dxydi([],n-1,s,1,l),v.push(d[0]-m[0]/3),x.push(d[1]-m[1]/3)),v.push(d[0]),x.push(d[1]),u=d;else for(c=Math.floor(Math.max(0,Math.min(I-2,n=t.a2i(i)))),h=n-c,b.length=I,b.crossLength=L,b.xy=function(r){return t.evalxy([],n,r)},b.dxy=function(r,i){return t.dxydj([],c,r,h,i)},o=0;o0&&(g=t.dxydj([],c,o-1,h,0),v.push(u[0]+g[0]/3),x.push(u[1]+g[1]/3),y=t.dxydj([],c,o-1,h,1),v.push(d[0]-y[0]/3),x.push(d[1]-y[1]/3)),v.push(d[0]),x.push(d[1]),u=d;return b.axisLetter=r,b.axis=_,b.crossAxis=k,b.value=i,b.constvar=a,b.index=f,b.x=v,b.y=x,b.smoothing=k.smoothing,b}function F(i){var n,o,s,l,u,c=[],h=[],d={};if(d.length=b.length,d.crossLength=M.length,"b"===r)for(s=Math.max(0,Math.min(L-2,i)),u=Math.min(1,Math.max(0,i-s)),d.xy=function(r){return t.evalxy([],r,i)},d.dxy=function(r,i){return t.dxydi([],r,s,i,u)},n=0;nb.length-1||w.push(n(F(s),{color:_.gridcolor,width:_.gridwidth,dash:_.griddash}));for(f=h;fb.length-1)&&!(g<0||g>b.length-1))for(y=b[l],v=b[g],o=0;o<_.minorgridcount;o++)!((x=g-l)<=0)&&((m=y+(v-y)*(o+1)/(_.minorgridcount+1)*(_.arraydtick/x))b[b.length-1]||T.push(n(z(m),{color:_.minorgridcolor,width:_.minorgridwidth,dash:_.minorgriddash})));_.startline&&A.push(n(F(0),{color:_.startlinecolor,width:_.startlinewidth})),_.endline&&A.push(n(F(b.length-1),{color:_.endlinecolor,width:_.endlinewidth}))}else{for(u=5e-15,h=(c=[Math.floor((b[b.length-1]-_.tick0)/_.dtick*(1+u)),Math.ceil((b[0]-_.tick0)/_.dtick/(1+u))].sort(function(t,r){return t-r}))[0],d=c[1],f=h;f<=d;f++)p=_.tick0+_.dtick*f,w.push(n(z(p),{color:_.gridcolor,width:_.gridwidth,dash:_.griddash}));for(f=h-1;fb[b.length-1]||T.push(n(z(m),{color:_.minorgridcolor,width:_.minorgridwidth,dash:_.minorgriddash}));_.startline&&A.push(n(z(b[0]),{color:_.startlinecolor,width:_.startlinewidth})),_.endline&&A.push(n(z(b[b.length-1]),{color:_.endlinecolor,width:_.endlinewidth}))}}}}),Vd=g({"src/traces/carpet/calc_labels.js"(t,r){var i=rs(),n=$().extendFlat;r.exports=function(t,r){var a,o,s,l,u,c=r._labels=[],h=r._gridlines;for(a=0;a=0;a--)o[h-a]=t[d][a],s[h-a]=r[d][a];for(l.push({x:o,y:s,bicubic:u}),a=d,o=[],s=[];a>=0;a--)o[d-a]=t[a][0],s[d-a]=r[a][0];return l.push({x:o,y:s,bicubic:c}),l}}}),Vp=g({"src/traces/carpet/smooth_fill_2d_array.js"(t,r){var i=t_();r.exports=function(t,r,n){var a,o,s,l=[],u=[],c=t[0].length,h=t.length,d=0;for(a=0;a0&&void 0!==(n=t[i][r-1])&&(o++,a+=n),r0&&void 0!==(n=t[i-1][r])&&(o++,a+=n),i0&&o0&&a1e-5);return i.log("Smoother converged to",A,"after",M,"iterations"),t}}}),Vm=g({"src/traces/carpet/constants.js"(t,r){r.exports={RELATIVE_CULL_TOLERANCE:1e-6}}}),Vg=g({"src/traces/carpet/catmull_rom.js"(t,r){r.exports=function(t,r,i,n){var a=t[0]-r[0],o=t[1]-r[1],s=i[0]-r[0],l=i[1]-r[1],u=Math.pow(a*a+o*o,.25),c=Math.pow(s*s+l*l,.25),h=(c*c*a-u*u*s)*n,d=(c*c*o-u*u*l)*n,f=c*(u+c)*3,p=u*(u+c)*3;return[[r[0]+(f&&h/f),r[1]+(f&&d/f)],[r[0]-(p&&h/p),r[1]-(p&&d/p)]]}}}),Vy=g({"src/traces/carpet/compute_control_points.js"(t,r){var i=Vg(),n=t_().ensureArray;function a(t,r,i){var n=-.5*i[0]+1.5*r[0],a=-.5*i[1]+1.5*r[1];return[(2*n+t[0])/3,(2*a+t[1])/3]}r.exports=function(t,r,o,s,l,u){var c,h,d,f,p,m,g,y,v,x,b=o[0].length,_=o.length,w=l?3*b-2:b,T=u?3*_-2:_;for(t=n(t,T),r=n(r,T),d=0;dp&&tg&&rm||ry},t.setScale=function(){var r=t._x,i=t._y,n=a(t._xctrl,t._yctrl,r,i,d.smoothing,f.smoothing);t._xctrl=n[0],t._yctrl=n[1],t.evalxy=o([t._xctrl,t._yctrl],c,h,d.smoothing,f.smoothing),t.dxydi=s([t._xctrl,t._yctrl],d.smoothing,f.smoothing),t.dxydj=l([t._xctrl,t._yctrl],d.smoothing,f.smoothing)},t.i2a=function(t){var i=Math.max(0,Math.floor(t[0]),c-2),n=t[0]-i;return(1-n)*r[i]+n*r[i+1]},t.j2b=function(t){var r=Math.max(0,Math.floor(t[1]),c-2),i=t[1]-r;return(1-i)*u[r]+i*u[r+1]},t.ij2ab=function(r){return[t.i2a(r[0]),t.j2b(r[1])]},t.a2i=function(t){var i=Math.max(0,Math.min(n(t,r),c-2)),a=r[i],o=r[i+1];return Math.max(0,Math.min(c-1,i+(t-a)/(o-a)))},t.b2j=function(t){var r=Math.max(0,Math.min(n(t,u),h-2)),i=u[r],a=u[r+1];return Math.max(0,Math.min(h-1,r+(t-i)/(a-i)))},t.ab2ij=function(r){return[t.a2i(r[0]),t.b2j(r[1])]},t.i2c=function(r,i){return t.evalxy([],r,i)},t.ab2xy=function(i,n,a){if(!a&&(ir[c-1]|nu[h-1]))return[!1,!1];var o=t.a2i(i),s=t.b2j(n),l=t.evalxy([],o,s);if(a){var d,f,p,m,g=0,y=0,v=[];ir[c-1]?(d=c-2,f=1,g=(i-r[c-1])/(r[c-1]-r[c-2])):(d=Math.max(0,Math.min(c-2,Math.floor(o))),f=o-d),nu[h-1]?(p=h-2,m=1,y=(n-u[h-1])/(u[h-1]-u[h-2])):(p=Math.max(0,Math.min(h-2,Math.floor(s))),m=s-p),g&&(t.dxydi(v,d,p,f,m),l[0]+=v[0]*g,l[1]+=v[1]*g),y&&(t.dxydj(v,d,p,f,m),l[0]+=v[0]*y,l[1]+=v[1]*y)}return l},t.c2p=function(t,r,i){return[r.c2p(t[0]),i.c2p(t[1])]},t.p2x=function(t,r,i){return[r.p2c(t[0]),i.p2c(t[1])]},t.dadi=function(t){var i=Math.max(0,Math.min(r.length-2,t));return r[i+1]-r[i]},t.dbdj=function(t){var r=Math.max(0,Math.min(u.length-2,t));return u[r+1]-u[r]},t.dxyda=function(r,i,n,a){var o=t.dxydi(null,r,i,n,a),s=t.dadi(r,n);return[o[0]/s,o[1]/s]},t.dxydb=function(r,i,n,a){var o=t.dxydj(null,r,i,n,a),s=t.dbdj(i,a);return[o[0]/s,o[1]/s]},t.dxyda_rough=function(r,i,n){var a=v*(n||.1),o=t.ab2xy(r+a,i,!0),s=t.ab2xy(r-a,i,!0);return[(o[0]-s[0])*.5/a,(o[1]-s[1])*.5/a]},t.dxydb_rough=function(r,i,n){var a=x*(n||.1),o=t.ab2xy(r,i+a,!0),s=t.ab2xy(r,i-a,!0);return[(o[0]-s[0])*.5/a,(o[1]-s[1])*.5/a]},t.dpdx=function(t){return t._m},t.dpdy=function(t){return t._m}}}}),Vw=g({"src/traces/carpet/calc.js"(t,r){var i=rs(),n=t_().isArray1D,a=Vu(),o=Vc(),s=Vh(),l=Vd(),u=Vf(),c=ot(),h=Vp(),d=oe(),f=V_();r.exports=function(t,r){var p=i.getFromId(t,r.xaxis),m=i.getFromId(t,r.yaxis),g=r.aaxis,y=r.baxis,v=r.x,x=r.y,b=[];v&&n(v)&&b.push("x"),x&&n(x)&&b.push("y"),b.length&&d(r,g,y,"a","b",b);var _=r._a=r._a||r.a,w=r._b=r._b||r.b;v=r._x||r.x,x=r._y||r.y;var T={};r._cheater&&(v=a("index"===g.cheatertype?_.length:_,"index"===y.cheatertype?w.length:w,r.cheaterslope)),r._x=v=c(v),r._y=x=c(x),h(v,_,w),h(x,_,w),f(r),r.setScale();var A=o(v),M=o(x),k=.5*(A[1]-A[0]),S=.5*(A[1]+A[0]),E=.5*(M[1]-M[0]),D=.5*(M[1]+M[0]);return A=[S-1.3*k,S+1.3*k],M=[D-1.3*E,D+1.3*E],r._extremes[p._id]=i.findExtremes(p,A,{padded:!0}),r._extremes[m._id]=i.findExtremes(m,M,{padded:!0}),s(r,"a","b"),s(r,"b","a"),l(r,g),l(r,y),T.clipsegments=u(r._xctrl,r._yctrl,g,y),T.x=v,T.y=x,T.a=_,T.b=w,[T]}}}),VT=g({"src/traces/carpet/index.js"(t,r){r.exports={attributes:Ve(),supplyDefaults:Vn(),plot:Vl(),calc:Vw(),animatable:!0,isContainer:!0,moduleType:"trace",name:"carpet",basePlotModule:ny(),categories:["cartesian","svg","carpet","carpetAxis","notLegendIsolatable","noMultiCategory","noHover","noSortingByValue"],meta:{}}}}),VA=g({"lib/carpet.js"(t,r){r.exports=VT()}}),VM=g({"src/traces/scattercarpet/attributes.js"(t,r){var i=i_(),n=iw(),a=K(),{hovertemplateAttrs:o,texttemplateAttrs:s,templatefallbackAttrs:l}=eZ(),u=tH(),c=$().extendFlat,h=n.marker,d=n.line,f=h.line;r.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:c({},n.mode,{dflt:"markers"}),text:c({},n.text,{}),texttemplate:s({editType:"plot"},{keys:["a","b","text"]}),texttemplatefallback:l({editType:"plot"}),hovertext:c({},n.hovertext,{}),line:{color:d.color,width:d.width,dash:d.dash,backoff:d.backoff,shape:c({},d.shape,{values:["linear","spline"]}),smoothing:d.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:c({},n.fill,{values:["none","toself","tonext"],dflt:"none"}),fillcolor:i(),marker:c({symbol:h.symbol,opacity:h.opacity,maxdisplayed:h.maxdisplayed,angle:h.angle,angleref:h.angleref,standoff:h.standoff,size:h.size,sizeref:h.sizeref,sizemin:h.sizemin,sizemode:h.sizemode,line:c({width:f.width,dash:f.dash,editType:"calc"},u("marker.line")),gradient:h.gradient,editType:"calc"},u("marker")),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:c({},a.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron,hovertemplate:o(),hovertemplatefallback:l(),zorder:n.zorder}}}),Vk=g({"src/traces/scattercarpet/defaults.js"(t,r){var i=t_(),n=ib(),a=t8(),o=i$(),s=iW(),l=iY(),u=iZ(),c=iX(),h=VM();r.exports=function(t,r,d,f){function p(n,a){return i.coerce(t,r,h,n,a)}p("carpet"),r.xaxis="x",r.yaxis="y";var m=p("a"),g=p("b"),y=Math.min(m.length,g.length);if(!y){r.visible=!1;return}r._length=y,p("text"),p("texttemplate"),p("texttemplatefallback"),p("hovertext"),p("mode",y")}return s}function v(t,r){var i;i=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,g.push(i+": "+r.toFixed(3)+t.labelsuffix)}}}}),VL=g({"src/traces/scattercarpet/event_data.js"(t,r){r.exports=function(t,r,i,n,a){var o=n[a];return t.a=o.a,t.b=o.b,t.y=o.y,t}}}),VP=g({"src/traces/scattercarpet/index.js"(t,r){r.exports={attributes:VM(),supplyDefaults:Vk(),colorbar:ni(),formatLabels:VS(),calc:VD(),plot:VC(),style:na().style,styleOnSelect:na().styleOnSelect,hoverPoints:VI(),selectPoints:nl(),eventData:VL(),moduleType:"trace",name:"scattercarpet",basePlotModule:ny(),categories:["svg","carpet","symbols","showLegend","carpetDependent","zoomScale"],meta:{}}}}),Vz=g({"lib/scattercarpet.js"(t,r){r.exports=VP()}}),VF=g({"src/traces/contourcarpet/attributes.js"(t,r){var i=aQ(),n=oC(),a=tH(),o=$().extendFlat,s=n.contours;r.exports=o({carpet:{valType:"string",editType:"calc"},z:i.z,a:i.x,a0:i.x0,da:i.dx,b:i.y,b0:i.y0,db:i.dy,text:i.text,hovertext:i.hovertext,transpose:i.transpose,atype:i.xtype,btype:i.ytype,fillcolor:n.fillcolor,autocontour:n.autocontour,ncontours:n.ncontours,contours:{type:s.type,start:s.start,end:s.end,size:s.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:s.showlines,showlabels:s.showlabels,labelfont:s.labelfont,labelformat:s.labelformat,operation:s.operation,value:s.value,editType:"calc",impliedEdits:{autocontour:!1}},line:{color:n.line.color,width:n.line.width,dash:n.line.dash,smoothing:n.line.smoothing,editType:"plot"},zorder:n.zorder},a("",{cLetter:"z",autoColorDflt:!1}))}}),VO=g({"src/traces/contourcarpet/defaults.js"(t,r){var i=t_(),n=a0(),a=VF(),o=oQ(),s=oL(),l=oz();r.exports=function(t,r,u,c){function h(n,o){return i.coerce(t,r,a,n,o)}if(h("carpet"),t.a&&t.b){if(!n(t,r,h,c,"a","b")){r.visible=!1;return}h("text"),"constraint"===h("contours.type")?o(t,r,h,c,u,{hasHover:!1}):(s(t,r,h,function(n){return i.coerce2(t,r,a,n)}),l(t,r,h,c,{hasHover:!1}))}else r._defaultColor=u,r._length=null;h("zorder")}}}),VR=g({"src/traces/contourcarpet/calc.js"(t,r){var i=t4(),n=t_(),a=oe(),o=ot(),s=or(),l=oi(),u=on(),c=VO(),h=VE(),d=oO();r.exports=function(t,r){var f=r._carpetTrace=h(t,r);if(!(!f||!f.visible||"legendonly"===f.visible)){if(!r.a||!r.b){var p,m,g,y,v,x,b,_,w,T,A,M,k,S,E,D,C,I=t.data[f.index],L=t.data[r.index];L.a||(L.a=I.a),L.b||(L.b=I.b),c(L,r,r._defaultColor,t._fullLayout)}var P=(p=t,A=(T=(m=r)._carpetTrace).aaxis,M=T.baxis,A._minDtick=0,M._minDtick=0,n.isArray1D(m.z)&&a(m,A,M,"a","b",["z"]),g=m._a=m._a||m.a,x=m._b=m._b||m.b,g=g?A.makeCalcdata(m,"_a"):[],x=x?M.makeCalcdata(m,"_b"):[],y=m.a0||0,v=m.da||1,b=m.b0||0,_=m.db||1,w=m._z=o(m._z||m.z,m.transpose),m._emptypoints=l(w),s(w,m._emptypoints),k=n.maxRowLength(w),S="scaled"===m.xtype?"":g,E=u(m,S,y,v,k,A),D="scaled"===m.ytype?"":x,C=u(m,D,b,_,w.length,M),"levels"===m.contours.type&&"none"!==m.contours.coloring&&i(p,m,{vals:w,containerStr:"",cLetter:"z"}),[{a:E,b:C,z:w}]);return d(r,r._z),P}}}}),VB=g({"src/traces/carpet/axis_aligned_line.js"(t,r){var i=t_().isArrayOrTypedArray;r.exports=function(t,r,n,a){var o,s,l,u,c,h,d,f,p,m,g,y,v,x=i(n)?"a":"b",b=("a"===x?t.aaxis:t.baxis).smoothing,_="a"===x?t.a2i:t.b2j,w="a"===x?n:a,T="a"===x?a:n,A="a"===x?r.a.length:r.b.length,M="a"===x?r.b.length:r.a.length,k=Math.floor("a"===x?t.b2j(T):t.a2i(T)),S="a"===x?function(r){return t.evalxy([],r,k)}:function(r){return t.evalxy([],k,r)};b&&(l=Math.max(0,Math.min(M-2,k)),u=k-l,s="a"===x?function(r,i){return t.dxydi([],r,l,i,u)}:function(r,i){return t.dxydj([],l,r,u,i)});var E=_(w[0]),D=_(w[1]),C=E0?Math.floor:Math.ceil,P=C>0?Math.ceil:Math.floor,z=C>0?Math.min:Math.max,F=C>0?Math.max:Math.min,O=L(E+I),R=P(D-I),B=[[d=S(E)]];for(o=O;o*C=0;Q--)K=n([],(X=S.clipsegments[Q]).x,w.c2p),J=n([],X.y,T.c2p),K.reverse(),J.reverse(),ee.push(a(K,J,X.bicubic));var et="M"+ee.join("L")+"Z";(function(t,r,i,o,l,u){var c,h,d=s.ensureSingle(t,"g","contourbg").selectAll("path").data("fill"!==u||l?[]:[0]);d.enter().append("path"),d.exit().remove();var f=[];for(h=0;h=0&&(d=D,p=m):Math.abs(h[1]-d[1])=0&&(d=D,p=m):s.log("endpt to newendpt is not vert. or horz.",h,d,D)}if(p>=0)break;v+=S(h,d),h=d}if(p===t.edgepaths.length){s.log("unclosed perimeter path");break}c=p,(b=-1===x.indexOf(c))&&(c=x[0],v+=S(h,d)+"Z",h=null)}for(c=0;cg&&(n.max=g),n.len=n.max-n.min}function b(t,r){var i=0;return(.1>Math.abs(t[0]-u)||.1>Math.abs(t[0]-c))&&(i=Math.max(i,o*x(r,v(a.dxydb_rough(t[0],t[1],.1)))/2)),(.1>Math.abs(t[1]-h)||.1>Math.abs(t[1]-d))&&(i=Math.max(i,o*x(r,v(a.dxyda_rough(t[0],t[1],.1)))/2)),i}}(this,i,t,n,d,r.height),!(n.len<(r.width+r.height)*h.LABELMIN)))for(var a=Math.min(Math.ceil(n.len/z),h.LABELMAX),o=0;ov):y=k>T,v=k;var S=c(T,A,M,k);S.pos=w,S.yc=(T+k)/2,S.i=_,S.dir=y?"increasing":"decreasing",S.x=S.pos,S.y=[M,A],x&&(S.orig_p=o[_]),m&&(S.tx=r.text[_]),g&&(S.htx=r.hovertext[_]),b.push(S)}else b.push({pos:w,empty:!0})}return r._extremes[u._id]=a.findExtremes(u,i.concat(f,d),{padded:!0}),b.length&&(b[0].t={labels:{open:n(t,"open:")+" ",high:n(t,"high:")+" ",low:n(t,"low:")+" ",close:n(t,"close:")+" "}}),b}r.exports={calc:function(t,r){var n=a.getFromId(t,r.xaxis),s=a.getFromId(t,r.yaxis),c=function(t,r,n){var a=n._minDiff;if(!a){var s,l=t._fullData,u=[];for(s=0,a=1/0;s"+h.labels[x]+i.hoverLabelText(l,b,u.yhoverformat)):((v=n.extendFlat({},f)).y0=v.y1=_,v.yLabelVal=b,v.yLabel=h.labels[x]+i.hoverLabelText(l,b,u.yhoverformat),v.name="",d.push(v),g[b]=v)}return d}function d(t,r,n,a){var o=t.cd,l=t.ya,h=o[0].trace,d=o[0].t,f=c(t,r,n,a);if(!f)return[];var p=o[f.index],m=f.index=p.i,g=p.dir;function y(t){return d.labels[t]+i.hoverLabelText(l,h[t][m],h.yhoverformat)}var v=p.hi||h.hoverinfo||"",x=v.split("+"),b="all"===v,_=b||-1!==x.indexOf("y"),w=b||-1!==x.indexOf("text"),T=_?[y("open"),y("high"),y("low"),y("close")+" "+u[g]]:[];return w&&s(p,h,T),f.extraText=T.join("
"),f.y0=f.y1=l.c2p(p.yc,!0),[f]}r.exports={hoverPoints:function(t,r,i,n){return t.cd[0].trace.hoverlabel.split?h(t,r,i,n):d(t,r,i,n)},hoverSplit:h,hoverOnPoints:d}}}),VZ=g({"src/traces/ohlc/select.js"(t,r){r.exports=function(t,r){var i,n=t.cd,a=t.xaxis,o=t.yaxis,s=[],l=n[0].t.bPos||0;if(!1===r)for(i=0;ir?function(t){return t<=0}:function(t){return t>=0};l.c2g=function(r){var i=l.c2l(r)-t;return(o(i)?i:0)+a},l.g2c=function(r){return l.l2c(r+t-a)},l.g2p=function(t){return t*n},l.c2p=function(t){return l.g2p(l.c2g(t))}};break;case"angularaxis":var c=t,h=r,d=c.type;if("linear"===d){var f=c.d2c,p=c.c2d;c.d2c=function(t,r){var i;return i=f(t),"degrees"===r?a(i):i},c.c2d=function(t,r){return p("degrees"===r?o(t):t)}}c.makeCalcdata=function(t,r){var i,n,a=t[r],o=t._length,s=function(r){return c.d2c(r,t.thetaunit)};if(a)for(i=Array(o),n=0;n1e-10?t:0}function d(t,r,i){r=r||0,i=i||0;for(var n=t.length,a=Array(n),o=0;o0?i:1/0}),o=i.mod(n+1,r.length);return[r[n],r[o]]},findIntersectionXY:u,findXYatLength:function(t,r,i,n){var a=-r*i,o=r*r+1,s=2*(r*a-i),l=Math.sqrt(s*s-4*o*(a*a+i*i-t*t)),u=(-s+l)/(2*o),c=(-s-l)/(2*o);return[[u,r*u+a+n],[c,r*c+a+n]]},clampTiny:h,pathPolygon:function(t,r,i,n,a,o){return"M"+d(c(t,r,i,n),a,o).join("L")},pathPolygonAnnulus:function(t,r,i,n,a,o,s){t0))!=(o<0?-1:+(o>0))){var p=n(t,i([r,0]));return["M"+u+","+c,"A"+s+","+s+" 0 0,"+(0=90||x>90&&b>=450?1:w<=0&&A<=0?0:Math.max(w,A),[x<=180&&b>=180||x>180&&b>=540?-1:_>=0&&T>=0?0:Math.min(_,T),x<=270&&b>=270||x>270&&b>=630?-1:w>=0&&A>=0?0:Math.min(w,A),b>=360?1:_<=0&&T<=0?0:Math.max(_,T),g]),I=C[2]-C[0],L=Math.abs((C[3]-C[1])/I);f/d>L?(M=d,D=(f-(k=d*L))/n.h/2,S=[c[0],c[1]],E=[h[0]+D,h[1]-D]):(M=f/L,k=f,D=(d-M)/n.w/2,S=[c[0]+D,c[1]-D],E=[h[0],h[1]]),this.xLength2=M,this.yLength2=k,this.xDomain2=S,this.yDomain2=E;var P,z=this.xOffset2=n.l+n.w*S[0],R=this.yOffset2=n.t+n.h*(1-E[1]),B=this.radius=M/I,j=this.innerRadius=this.getHole(r)*B,N=this.cx=z-B*C[0],V=this.cy=R+B*C[3],U=this.cxx=N-z,q=this.cyy=V-R,G=a.side;"counterclockwise"===G?(P=G,G="top"):"clockwise"===G&&(P=G,G="bottom"),this.radialAxis=this.mockAxis(t,r,a,{_id:"x",side:G,_trueSide:P,domain:[j/n.w,B/n.w]}),this.angularAxis=this.mockAxis(t,r,o,{side:"right",domain:[0,Math.PI],autorange:!1}),this.doAutoRange(t,r),this.updateAngularAxis(t,r),this.updateRadialAxis(t,r),this.updateRadialAxisTitle(t,r),this.xaxis=this.mockCartesianAxis(t,r,{_id:"x",domain:S}),this.yaxis=this.mockCartesianAxis(t,r,{_id:"y",domain:E});var H=this.pathSubplot();this.clipPaths.forTraces.select("path").attr("d",H).attr("transform",s(U,q)),i.frontplot.attr("transform",s(z,R)).call(u.setClipUrl,this._hasClipOnAxisFalse?null:this.clipIds.forTraces,this.gd),i.bg.attr("d",H).attr("transform",s(N,V)).call(l.fill,r.bgcolor)},j.mockAxis=function(t,r,i,n){var o=a.extendFlat({},i,n);return f(o,r,t),o},j.mockCartesianAxis=function(t,r,i){var n=this,o=n.isSmith,s=i._id,l=a.extendFlat({type:"linear"},i);d(l,t);var u={x:[0,2],y:[1,3]};return l.setRange=function(){var t=n.sectorBBox,i=u[s],a=n.radialAxis._rl,o=(a[1]-a[0])/(1-n.getHole(r));l.range=[t[i[0]]*o,t[i[1]]*o]},l.isPtWithinRange="x"!==s||o?function(){return!0}:function(t){return n.isPtInside(t)},l.setRange(),l.setScale(),l},j.doAutoRange=function(t,r){var i=this.gd,n=this.radialAxis,a=this.getRadial(r);p(i,n);var o=n.range;if(a.range=o.slice(),a._input.range=o.slice(),n._rl=[n.r2l(o[0],null,"gregorian"),n.r2l(o[1],null,"gregorian")],void 0!==n.minallowed){var s=n.r2l(n.minallowed);n._rl[0]>n._rl[1]?n._rl[1]=Math.max(n._rl[1],s):n._rl[0]=Math.max(n._rl[0],s)}if(void 0!==n.maxallowed){var l=n.r2l(n.maxallowed);n._rl[0]90&&g<=270&&(y.tickangle=180);var b=x?function(t){var r=P(i,C([t.x,0]));return s(r[0]-f,r[1]-p)}:function(t){return s(y.l2p(t.x)+d,0)},_=x?function(t){return L(i,t.x,-1/0,1/0)}:function(t){return i.pathArc(y.r2p(t.x)+d)},w=N(m);if(i.radialTickLayout!==w&&(u["radial-axis"].selectAll(".xtick").remove(),i.radialTickLayout=w),v){y.setScale();var T=0,A=x?(y.tickvals||[]).filter(function(t){return t>=0}).map(function(t){return h.tickText(y,t,!0,!1)}):h.calcTicks(y),M=x?A:h.clipEnds(y,A),k=h.getTickSigns(y)[2];x&&(("top"===y.ticks&&"bottom"===y.side||"bottom"===y.ticks&&"top"===y.side)&&(k=-k),"top"===y.ticks&&"top"===y.side&&(T=-y.ticklen),"bottom"===y.ticks&&"bottom"===y.side&&(T=y.ticklen)),h.drawTicks(n,y,{vals:A,layer:u["radial-axis"],path:h.makeTickPath(y,0,k),transFn:b,crisp:!1}),h.drawGrid(n,y,{vals:M,layer:u["radial-grid"],path:_,transFn:a.noop,crisp:!1}),h.drawLabels(n,y,{vals:A,layer:u["radial-axis"],transFn:b,labelFns:h.makeLabelFns(y,T)})}var S=i.radialAxisAngle=i.vangles?R(V(O(m.angle),i.vangles)):m.angle,E=s(f,p),D=E+o(-S);U(u["radial-axis"],v&&(m.showticklabels||m.ticks),{transform:D}),U(u["radial-grid"],v&&m.showgrid,{transform:x?"":E}),U(u["radial-line"].select("line"),v&&m.showline,{x1:x?-c:d,y1:0,x2:c,y2:0,transform:D}).attr("stroke-width",m.linewidth).call(l.stroke,m.linecolor)},j.updateRadialAxisTitle=function(t,r,i){if(!this.isSmith){var n=this.gd,a=this.radius,o=this.cx,s=this.cy,l=this.getRadial(r),c=this.id+"title",h=0;if(l.title){var d=u.bBox(this.layers["radial-axis"].node()).height,f=l.title.font.size,p=l.side;h="top"===p?f:"counterclockwise"===p?-(d+.4*f):d+.8*f}var m=void 0!==i?i:this.radialAxisAngle,g=O(m),y=Math.cos(g),x=Math.sin(g),b=o+a/2*y+h*x,_=s-a/2*x+h*y;this.layers["radial-axis-title"]=v.draw(n,c,{propContainer:l,propName:this.id+".radialaxis.title.text",placeholder:z(n,"Click to enter radial axis title"),attributes:{x:b,y:_,"text-anchor":"middle"},transform:{rotate:-m}})}},j.updateAngularAxis=function(t,r){var i,n=this,u=n.gd,c=n.layers,d=n.radius,f=n.innerRadius,p=n.cx,m=n.cy,g=n.getAngular(r),y=n.angularAxis,v=n.isSmith;v||(n.fillViewInitialKey("angularaxis.rotation",g.rotation),y.setGeometry(),y.setScale());var x=v?function(t){var r=P(n,C([0,t.x]));return Math.atan2(r[0]-p,r[1]-m)-Math.PI/2}:function(t){return y.t2g(t.x)};"linear"===y.type&&"radians"===y.thetaunit&&(y.tick0=R(y.tick0),y.dtick=R(y.dtick));var b=function(t){return s(p+d*Math.cos(t),m-d*Math.sin(t))},_=v?function(t){var r=P(n,C([0,t.x]));return s(r[0],r[1])}:function(t){return b(x(t))},w=v?function(t){var r=P(n,C([0,t.x])),i=Math.atan2(r[0]-p,r[1]-m)-Math.PI/2;return s(r[0],r[1])+o(-R(i))}:function(t){var r=x(t);return b(r)+o(-R(r))},T=v?function(t){return I(n,t.x,0,1/0)}:function(t){var r=x(t),i=Math.cos(r),n=Math.sin(r);return"M"+[p+f*i,m-f*n]+"L"+[p+d*i,m-d*n]},A=h.makeLabelFns(y,0).labelStandoff,k={};k.xFn=function(t){return Math.cos(x(t))*A},k.yFn=function(t){var r=x(t),i=Math.sin(r)>0?.2:1;return-Math.sin(r)*(A+t.fontSize*i)+Math.abs(Math.cos(r))*(t.fontSize*M)},k.anchorFn=function(t){var r=Math.cos(x(t));return .1>Math.abs(r)?"middle":r>0?"start":"end"},k.heightFn=function(t,r,i){return -.5*(1+Math.sin(x(t)))*i};var S=N(g);n.angularTickLayout!==S&&(c["angular-axis"].selectAll("."+y._id+"tick").remove(),n.angularTickLayout=S);var E=v?[1/0].concat(y.tickvals||[]).map(function(t){return h.tickText(y,t,!0,!1)}):h.calcTicks(y);if(v&&(E[0].text="∞",E[0].fontSize*=1.75),"linear"===r.gridshape?(i=E.map(x),0>a.angleDelta(i[0],i[1])&&(i=i.slice().reverse())):i=null,n.vangles=i,"category"===y.type&&(E=E.filter(function(t){return a.isAngleInsideSector(x(t),n.sectorInRad)})),y.visible){var D="inside"===y.ticks?-1:1,L=(y.linewidth||1)/2;h.drawTicks(u,y,{vals:E,layer:c["angular-axis"],path:"M"+D*L+",0h"+D*y.ticklen,transFn:w,crisp:!1}),h.drawGrid(u,y,{vals:E,layer:c["angular-grid"],path:T,transFn:a.noop,crisp:!1}),h.drawLabels(u,y,{vals:E,layer:c["angular-axis"],repositionOnUpdate:!0,transFn:_,labelFns:k})}U(c["angular-line"].select("path"),g.showline,{d:n.pathSubplot(),transform:s(p,m)}).attr("stroke-width",g.linewidth).call(l.stroke,g.linecolor)},j.updateFx=function(t,r){this.gd._context.staticPlot||(this.isSmith||(this.updateAngularDrag(t),this.updateRadialDrag(t,r,0),this.updateRadialDrag(t,r,1)),this.updateHoverAndMainDrag(t))},j.updateHoverAndMainDrag=function(t){var r,o,u=this,c=u.isSmith,h=u.gd,d=u.layers,f=t._zoomlayer,p=S.MINZOOM,v=S.OFFEDGE,w=u.radius,T=u.innerRadius,A=u.cx,M=u.cy,k=u.cxx,D=u.cyy,C=u.sectorInRad,I=u.vangles,L=u.radialAxis,P=E.clampTiny,z=E.findXYatLength,F=E.findEnclosingVertexAngles,O=S.cornerHalfWidth,R=S.cornerLen/2,B=m.makeDragger(d,"path","maindrag",!1===t.dragmode?"none":"crosshair");i.select(B).attr("d",u.pathSubplot()).attr("transform",s(A,M)),B.onmousemove=function(t){y.hover(h,t,u.id),h._fullLayout._lasthover=B,h._fullLayout._hoversubplot=u.id},B.onmouseout=function(t){h._dragging||g.unhover(h,t)};var j,N,V,U,q,G,H,$,W,Y={element:B,gd:h,subplot:u.id,plotinfo:{id:u.id,xaxis:u.xaxis,yaxis:u.yaxis},xaxes:[u.xaxis],yaxes:[u.yaxis]};function Z(t,r){return Math.sqrt(t*t+r*r)}function X(t,r){return Math.atan2(D-r,t-k)}function K(t,r){return[t*Math.cos(r),t*Math.sin(-r)]}function J(t,r){if(0===t)return u.pathSector(2*O);var i=R/t,n=r-i,a=r+i,o=Math.max(0,Math.min(t,w)),s=o-O,l=o+O;return"M"+K(s,n)+"A"+[s,s]+" 0,0,0 "+K(s,a)+"L"+K(l,a)+"A"+[l,l]+" 0,0,1 "+K(l,n)+"Z"}function Q(t,r,i){if(0===t)return u.pathSector(2*O);var n,a,o,s,l=K(t,r),c=K(t,i),h=P((l[0]+c[0])/2),d=P((l[1]+c[1])/2);if(h&&d){var f=d/h,p=-1/f,m=z(O,f,h,d);o=z(R,p,m[0][0],m[0][1]),s=z(R,p,m[1][0],m[1][1])}else d?(n=R,a=O):(n=O,a=R),o=[[h-n,d-a],[h+n,d-a]],s=[[h-n,d+a],[h+n,d+a]];return"M"+o.join("L")+"L"+s.reverse().join("L")+"Z"}function ee(t,r){return r=Math.max(Math.min(r,w),T),tp?(t-1&&1===t&&b(r,h,[u.xaxis],[u.yaxis],u.id,Y),i.indexOf("event")>-1&&y.click(h,r,u.id)}Y.prepFn=function(t,i,n){var s,d=h._fullLayout.dragmode,p=B.getBoundingClientRect();h._fullLayout._calcInverseTransform(h);var g=h._fullLayout._invTransform;r=h._fullLayout._invScaleX,o=h._fullLayout._invScaleY;var y=a.apply3DTransform(g)(i-p.left,n-p.top);if(j=y[0],N=y[1],I){var v=E.findPolygonOffset(w,C[0],C[1],I);j+=k+v[0],N+=D+v[1]}switch(d){case"zoom":Y.clickFn=es,c||(I?Y.moveFn=en:Y.moveFn=er,Y.doneFn=ea,V=null,U=null,q=u.pathSubplot(),G=!1,s=h._fullLayout[u.id],H=l.luminosity(s.bgcolor),($=m.makeZoombox(f,H,A,M,q)).attr("fill-rule","evenodd"),W=m.makeCorners(f,A,M),_(h));break;case"select":case"lasso":x(t,i,n,Y,d)}},g.init(Y)},j.updateRadialDrag=function(t,r,l){var u,c,h,d=this,f=d.gd,p=d.layers,y=d.radius,v=d.innerRadius,x=d.cx,b=d.cy,w=d.radialAxis,M=S.radialDragBoxSize,k=M/2;if(w.visible){var E,D,C,I=O(d.radialAxisAngle),L=w._rl,P=L[0],z=L[1],F=L[l],B=.75*(L[1]-L[0])/(1-d.getHole(r))/y;l?(E=x+(y+k)*Math.cos(I),D=b-(y+k)*Math.sin(I),C="radialdrag"):(E=x+(v-k)*Math.cos(I),D=b-(v-k)*Math.sin(I),C="radialdrag-inner");var j=m.makeRectDragger(p,C,"crosshair",-k,-k,M,M),N={element:j,gd:f};!1===t.dragmode&&(N.dragmode=!1),U(i.select(j),w.visible&&v0!=(l?h>P:h")}}r.exports={hoverPoints:function(t,r,a,o){var s=i(t,r,a,o);if(!(!s||!1===s[0].index)){var l=s[0];if(void 0===l.index)return s;var u=t.subplot,c=l.cd[l.index],h=l.trace;if(u.isPtInside(c))return l.xLabelVal=void 0,l.yLabelVal=void 0,n(c,h,u,l),l.hovertemplate=h.hovertemplate,s}},makeHoverPointText:n}}}),Us=g({"src/traces/scatterpolar/index.js"(t,r){r.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:Ue(),categories:["polar","symbols","showLegend","scatter-like"],attributes:Ut(),supplyDefaults:Ur().supplyDefaults,colorbar:ni(),formatLabels:Ui(),calc:Un(),plot:Ua(),style:na().style,styleOnSelect:na().styleOnSelect,hoverPoints:Uo().hoverPoints,selectPoints:nl(),meta:{}}}}),Ul=g({"lib/scatterpolar.js"(t,r){r.exports=Us()}}),Uu=g({"src/traces/scatterpolargl/attributes.js"(t,r){var i=Ut(),{cliponaxis:n,hoveron:a}=i,o=((t,r)=>{var i={};for(var n in t)u.call(t,n)&&0>r.indexOf(n)&&(i[n]=t[n]);if(null!=t&&s)for(var n of s(t))0>r.indexOf(n)&&c.call(t,n)&&(i[n]=t[n]);return i})(i,["cliponaxis","hoveron"]),{connectgaps:l,line:{color:h,dash:d,width:m},fill:g,fillcolor:y,marker:v,textfont:x,textposition:b}=p2();r.exports=p(f({},o),{connectgaps:l,fill:g,fillcolor:y,line:{color:h,dash:d,editType:"calc",width:m},marker:v,textfont:x,textposition:b})}}),Uc=g({"src/traces/scatterpolargl/defaults.js"(t,r){var i=t_(),n=t8(),a=Ur().handleRThetaDefaults,o=i$(),s=iW(),l=iZ(),u=iX(),c=ib().PTS_LINESONLY,h=Uu();r.exports=function(t,r,d,f){function p(n,a){return i.coerce(t,r,h,n,a)}var m=a(t,r,f,p);if(!m){r.visible=!1;return}p("thetaunit"),p("mode",m=u&&(x.marker.cluster=m.tree),x.marker&&(x.markerSel.positions=x.markerUnsel.positions=x.marker.positions=w),x.line&&w.length>1&&l.extendFlat(x.line,s.linePositions(t,p,w)),x.text&&(l.extendFlat(x.text,{positions:w},s.textPosition(t,p,x.text,x.marker)),l.extendFlat(x.textSel,{positions:w},s.textPosition(t,p,x.text,x.markerSel)),l.extendFlat(x.textUnsel,{positions:w},s.textPosition(t,p,x.text,x.markerUnsel))),x.fill&&!f.fill2d&&(f.fill2d=!0),x.marker&&!f.scatter2d&&(f.scatter2d=!0),x.line&&!f.line2d&&(f.line2d=!0),x.text&&!f.glText&&(f.glText=!0),f.lineOptions.push(x.line),f.fillOptions.push(x.fill),f.markerOptions.push(x.marker),f.markerSelectedOptions.push(x.markerSel),f.markerUnselectedOptions.push(x.markerUnsel),f.textOptions.push(x.text),f.textSelectedOptions.push(x.textSel),f.textUnselectedOptions.push(x.textUnsel),f.selectBatch.push([]),f.unselectBatch.push([]),m.x=T,m.y=A,m.rawx=T,m.rawy=A,m.r=y,m.theta=v,m.positions=w,m._scene=f,m.index=f.count,f.count++}}),a(t,r,c)}},r.exports.reglPrecompiled={}}}),Ug=g({"src/traces/scatterpolargl/index.js"(t,r){var i=Up();i.plot=Um(),r.exports=i}}),Uy=g({"lib/scatterpolargl.js"(t,r){r.exports=Ug()}}),Uv=g({"src/traces/barpolar/attributes.js"(t,r){var i,{hovertemplateAttrs:n,templatefallbackAttrs:a}=eZ(),o=$().extendFlat,s=Ut(),l=aA();r.exports={r:s.r,theta:s.theta,r0:s.r0,dr:s.dr,theta0:s.theta0,dtheta:s.dtheta,thetaunit:s.thetaunit,base:o({},l.base,{}),offset:o({},l.offset,{}),width:o({},l.width,{}),text:o({},l.text,{}),hovertext:o({},l.hovertext,{}),marker:(i=o({},l.marker),delete i.cornerradius,i),hoverinfo:s.hoverinfo,hovertemplate:n(),hovertemplatefallback:a(),selected:l.selected,unselected:l.unselected}}}),Ux=g({"src/traces/barpolar/layout_attributes.js"(t,r){r.exports={barmode:{valType:"enumerated",values:["stack","overlay"],dflt:"stack",editType:"calc"},bargap:{valType:"number",dflt:.1,min:0,max:1,editType:"calc"}}}}),Ub=g({"src/traces/barpolar/defaults.js"(t,r){var i=t_(),n=Ur().handleRThetaDefaults,a=ak(),o=Uv();r.exports=function(t,r,s,l){function u(n,a){return i.coerce(t,r,o,n,a)}if(!n(t,r,l,u)){r.visible=!1;return}u("thetaunit"),u("base"),u("offset"),u("width"),u("text"),u("hovertext"),u("hovertemplate"),u("hovertemplatefallback"),a(t,r,u,s,l),i.coerceSelectionMarkerOpacity(r,u)}}}),U_=g({"src/traces/barpolar/layout_defaults.js"(t,r){var i=t_(),n=Ux();r.exports=function(t,r,a){var o,s={};function l(a,s){return i.coerce(t[o]||{},r[o],n,a,s)}for(var u=0;u0?(o=i,l=n):(o=n,l=i);var o,l,d=s.findEnclosingVertexAngles(o,u.vangles)[0],f=s.findEnclosingVertexAngles(l,u.vangles)[1],p=[d,(o+l)/2,f];return s.pathPolygonAnnulus(t,r,o,l,p,c,h)}:function(t,r,i,n){return a.pathAnnulus(t,r,i,n,c,h)}),v=r.layers.frontplot.select("g.barlayer");a.makeTraceGroups(v,l,"trace bars").each(function(){var s=i.select(this),l=a.ensureSingle(s,"g","points").selectAll("g.point").data(a.identity);l.enter().append("g").style("vector-effect",d?"none":"non-scaling-stroke").style("stroke-miterlimit",2).classed("point",!0),l.exit().remove(),l.each(function(t){var r,o=i.select(this),s=t.rp0=m.c2p(t.s0),l=t.rp1=m.c2p(t.s1),u=t.thetag0=g.c2g(t.p0),c=t.thetag1=g.c2g(t.p1);if(n(s)&&n(l)&&n(u)&&n(c)&&s!==l&&u!==c){var h=m.c2g(t.s1),d=(u+c)/2;t.ct=[f.c2p(h*Math.cos(d)),p.c2p(h*Math.sin(d))],r=y(s,l,u,c)}else r="M0,0Z";a.ensureSingle(o,"path").attr("d",r)}),o.setClipUrl(s,r._hasClipOnAxisFalse?r.clipIds.forTraces:null,t)})}}}),UA=g({"src/traces/barpolar/hover.js"(t,r){var i=rR(),n=t_(),a=aF().getTraceColor,o=n.fillText,s=Uo().makeHoverPointText,l=V4().isPtInsidePolygon;r.exports=function(t,r,u){var c=t.cd,h=c[0].trace,d=t.subplot,f=d.radialAxis,p=d.angularAxis,m=d.vangles,g=m?l:n.isPtInsideSector,y=t.maxHoverDistance,v=p._period||2*Math.PI,x=Math.abs(f.g2p(Math.sqrt(r*r+u*u))),b=Math.atan2(u,r);if(f.range[0]>f.range[1]&&(b+=Math.PI),i.getClosest(c,function(t){return g(x,b,[t.rp0,t.rp1],[t.thetag0,t.thetag1],m)?y+Math.min(1,Math.abs(t.thetag1-t.thetag0)/v)-1+(t.rp1-x)/(t.rp1-t.rp0)-1:1/0},t),!1!==t.index){var _=c[t.index];t.x0=t.x1=_.ct[0],t.y0=t.y1=_.ct[1];var w=n.extendFlat({},_,{r:_.s,theta:_.p});return o(_,h,t),s(w,h,d,t),t.hovertemplate=h.hovertemplate,t.color=a(h,_),t.xLabelVal=t.yLabelVal=void 0,_.s<0&&(t.idealAlign="left"),[t]}}}}),UM=g({"src/traces/barpolar/index.js"(t,r){r.exports={moduleType:"trace",name:"barpolar",basePlotModule:Ue(),categories:["polar","bar","showLegend"],attributes:Uv(),layoutAttributes:Ux(),supplyDefaults:Ub(),supplyLayoutDefaults:U_(),calc:Uw().calc,crossTraceCalc:Uw().crossTraceCalc,plot:UT(),colorbar:ni(),formatLabels:Ui(),style:aP().style,styleOnSelect:aP().styleOnSelect,hoverPoints:UA(),selectPoints:aR(),meta:{}}}}),Uk=g({"lib/barpolar.js"(t,r){r.exports=UM()}}),US=g({"src/plots/smith/constants.js"(t,r){r.exports={attr:"subplot",name:"smith",axisNames:["realaxis","imaginaryaxis"],axisName2dataArray:{imaginaryaxis:"imag",realaxis:"real"}}}}),UE=g({"src/plots/smith/layout_attributes.js"(t,r){var i=er(),n=tq(),a=an().attributes,o=t_().extendFlat,s=e$().overrideAll,l=s({color:n.color,showline:o({},n.showline,{dflt:!0}),linecolor:n.linecolor,linewidth:n.linewidth,showgrid:o({},n.showgrid,{dflt:!0}),gridcolor:n.gridcolor,gridwidth:n.gridwidth,griddash:n.griddash},"plot","from-root"),u=s({ticklen:n.ticklen,tickwidth:o({},n.tickwidth,{dflt:2}),tickcolor:n.tickcolor,showticklabels:n.showticklabels,labelalias:n.labelalias,showtickprefix:n.showtickprefix,tickprefix:n.tickprefix,showticksuffix:n.showticksuffix,ticksuffix:n.ticksuffix,tickfont:n.tickfont,tickformat:n.tickformat,hoverformat:n.hoverformat,layer:n.layer},"plot","from-root"),c=o({visible:o({},n.visible,{dflt:!0}),tickvals:{dflt:[.2,.5,1,2,5],valType:"data_array",editType:"plot"},tickangle:o({},n.tickangle,{dflt:90}),ticks:{valType:"enumerated",values:["top","bottom",""],editType:"ticks"},side:{valType:"enumerated",values:["top","bottom"],dflt:"top",editType:"plot"},editType:"calc"},l,u),h=o({visible:o({},n.visible,{dflt:!0}),tickvals:{valType:"data_array",editType:"plot"},ticks:n.ticks,editType:"calc"},l,u);r.exports={domain:a({name:"smith",editType:"plot"}),bgcolor:{valType:"color",editType:"plot",dflt:i.background},realaxis:c,imaginaryaxis:h,editType:"calc"}}}),UD=g({"src/plots/smith/layout_defaults.js"(t,r){var i,n,a,o=t_(),s=ei(),l=tC(),u=sr(),c=tF().getSubplotData,h=t0(),d=tQ(),f=nd(),p=rn(),m=UE(),g=US(),y=g.axisNames,v=(i=function(t){return o.isTypedArray(t)&&(t=Array.from(t)),t.slice().reverse().map(function(t){return-t}).concat([0]).concat(t)},n=String,a={},function(t){var r=n?n(t):t;if(r in a)return a[r];var o=i(t);return a[r]=o,o});function x(t,r,i,n){var a=i("bgcolor");n.bgColor=s.combine(a,n.paper_bgcolor);var u,x=c(n.fullData,g.name,n.id),b=n.layoutOut;function _(t,r){return i(u+"."+t,r)}for(var w=0;w")}}r.exports={hoverPoints:function(t,r,a,o){var s=i(t,r,a,o);if(!(!s||!1===s[0].index)){var l=s[0];if(void 0===l.index)return s;var u=t.subplot,c=l.cd[l.index],h=l.trace;if(u.isPtInside(c))return l.xLabelVal=void 0,l.yLabelVal=void 0,n(c,h,u,l),l.hovertemplate=h.hovertemplate,s}},makeHoverPointText:n}}}),UR=g({"src/traces/scattersmith/index.js"(t,r){r.exports={moduleType:"trace",name:"scattersmith",basePlotModule:UC(),categories:["smith","symbols","showLegend","scatter-like"],attributes:UI(),supplyDefaults:UL(),colorbar:ni(),formatLabels:UP(),calc:Uz(),plot:UF(),style:na().style,styleOnSelect:na().styleOnSelect,hoverPoints:UO().hoverPoints,selectPoints:nl(),meta:{}}}}),UB=g({"lib/scattersmith.js"(t,r){r.exports=UR()}}),Uj=g({"src/traces/quiver/attributes.js"(t,r){var i=K(),n=eZ().hovertemplateAttrs,a=tU().axisHoverFormat,o=$().extendFlat,s=tH(),l=eW().dash,u=ix(),c=iw();r.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},x0:c.x0,dx:c.dx,y:{valType:"data_array",editType:"calc+clearAxisTypes",anim:!0},y0:c.y0,dy:c.dy,u:{valType:"data_array",editType:"calc",anim:!0},v:{valType:"data_array",editType:"calc",anim:!0},arrowref:{valType:"enumerated",values:["paper","data"],dflt:"data",editType:"calc"},lengthmode:{valType:"enumerated",values:["scaled","raw"],editType:"calc",dflt:"scaled"},lengthfactor:{valType:"number",min:0,editType:"calc",dflt:1},anchor:{valType:"enumerated",values:["tip","tail","center"],dflt:"tail",editType:"calc"},xhoverformat:a("x"),yhoverformat:a("y"),uhoverformat:a("u","noDate"),vhoverformat:a("v","noDate"),hoverinfo:o({},i.hoverinfo,{flags:["x","y","u","v","text","name"],dflt:"all"}),hovertemplate:n({},{keys:["x","y","u","v","text","name"]}),text:c.text,textposition:c.textposition,textfont:c.textfont,marker:o({arrowsize:o({},u.arrowsize,{editType:"calc"}),line:{width:{valType:"number",min:0,dflt:2,editType:"style"},dash:l,editType:"style"},editType:"calc"},s("marker",{showScaleDflt:!0,editTypeOverride:"calc"})),selected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},unselected:{marker:{color:{valType:"color",editType:"style"},line:{width:{valType:"number",min:0,editType:"style"},editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"}}}}),UN=g({"src/traces/quiver/defaults.js"(t,r){var i=t_(),n=Uj(),a=iq(),o=tV().hasColorscale,s=t2();r.exports=function(t,r,l,u){function c(a,o){return i.coerce(t,r,n,a,o)}var h=a(t,r,u,c);if(!h){r.visible=!1;return}var d=c("u"),f=c("v");if(!i.isArrayOrTypedArray(d)||0===d.length){r.u=Array(h);for(var p=0;pD&&(D=h[R]),d[R]I&&(I=d[R]),BP&&(P=B),jF&&(F=j);var q=Math.sqrt(B*B+j*j);if(q>g&&(g=q),qv&&(v=G))}}else N.x=o,N.y=o}if(r._maxNorm=g,"scaled"===A||"paper"===M){let t=D-E,i=I-C;r._scaleFactor=(0===t&&0===i?1:(t+i+Math.sqrt((t-i)*(t-i)+4*O*t*i))/(2*(O-1)))*.97/r._maxNorm}else r._scaleFactor=1;r._scaleFactor*=r.lengthfactor;let H=Array(f),$=Array(f),W=Array(f),Y=Array(f);for(var Z,X,K,R=0;Rt.i&&isFinite(s[t.i]))o=s[t.i];else{var l=r.u&&r.u[t.i]||0,u=r.v&&r.v[t.i]||0;o=Math.sqrt(l*l+u*u)}return t.mcc=a(o),t.mcc})}function u(t,r,o){var u=r[0].trace,c=u.marker||{},h=c.line||{},d=n.isArrayOrTypedArray(c.color)?void 0:c.color,f=u._hasColorscale;if(o)if(u.selectedpoints){var p=(u.selected||{}).marker||{},m=(u.unselected||{}).marker||{},g=p.line||{},y=m.line||{};o.selectAll("path.js-line").each(function(t){var r=i.select(this),n=!t.selected,o=n?m.color:p.color,c=n?void 0!==y.width?y.width:h.width:void 0!==g.width?g.width:h.width;o?(a.lineGroupStyle(r,c,o,h.dash),r.style("stroke-opacity",1)):(a.lineGroupStyle(r,c,d,h.dash),f&&l(r,u),r.style("stroke-opacity",n?s:1))}),a.selectedTextStyle(o.selectAll("text"),u)}else{var v=o.selectAll("path.js-line");v.call(a.lineGroupStyle,h.width,d,h.dash),f&&l(v,u),v.style("stroke-opacity",1),a.textPointStyle(o.selectAll("text"),u,t)}}r.exports={style:function(t){i.select(t).selectAll("g.trace.quiver").each(function(r){u(t,r,i.select(this))})},styleOnSelect:function(t,r,i){u(t,r,i)},colorscaleStroke:l}}}),UG=g({"src/traces/quiver/plot.js"(t,r){var i=k(),n=t_(),a=rr(),o=Uq().colorscaleStroke,s=Math.PI/12;function l(t,r,l,u,c,h,d){var f=u[0].trace,p=l.xaxis,m=l.yaxis;u[0][l.isRangePlot?"nodeRangePlot3":"node3"]=i.select(h);var g=i.select(h).selectAll("g.lines").data([u]);g.enter().append("g").classed("lines",!0),a.setClipUrl(g,l.layerClipId,t);var y=g.selectAll("path.js-line").data(u);y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke"),y.exit().remove();let{anchor:v,maxNorm:x=0,arrowref:b}=f,_="paper"===b?f._scaleFactor*Math.sqrt(Math.abs(p._m*m._m)):f._scaleFactor,w=f.marker.arrowsize;y.each(function(t){let r=i.select(this);if(void 0===t.x||void 0===t.y)return void r.attr("d",null);let n=("paper"===b?t._u*Math.sign(p._m):i.round(p._m*t._u))*_,a=("paper"===b?t._v*Math.sign(m._m):i.round(m._m*t._v))*_,o=void 0!==(f._input.marker||{}).arrowsize;"tip"===v?(l=p.c2p(t.x)-n,c=m.c2p(t.y)-a,u=p.c2p(t.x),h=m.c2p(t.y)):"center"===v?(l=p.c2p(t.x)-n/2,c=m.c2p(t.y)-a/2,u=p.c2p(t.x)+n/2,h=m.c2p(t.y)+a/2):(l=p.c2p(t.x),c=m.c2p(t.y),u=p.c2p(t.x)+n,h=m.c2p(t.y)+a),t._px0=l,t._py0=c,t._px1=u,t._py1=h;var l,u,c,h,d=f.marker.line.width;o||(d=Math.max(d,1.5));let g=Math.min(5.8*w*d,.7*Math.sqrt((u-l)*(u-l)+(h-c)*(h-c))),y=Math.atan2(h-c,u-l),x=u-g*Math.cos(y-s),T=h-g*Math.sin(y-s),A=u-g*Math.cos(y+s),M=h-g*Math.sin(y+s),k="M"+l+","+c+"L"+u+","+h+"L"+x+","+T+"L"+u+","+h+"L"+A+","+M;r.attr("d",k)});var T=f.marker||{},A=T.line||{},M=n.isArrayOrTypedArray(T.color)?void 0:T.color;a.lineGroupStyle(y,A.width,M,A.dash),f._hasColorscale&&o(y,f);var k=i.select(h).selectAll("g.text").data([u]);k.enter().append("g").classed("text",!0),a.setClipUrl(k,l.layerClipId,t);var S=k.selectAll("g.textpoint").data(u);if(S.enter().append("g").classed("textpoint",!0).append("text"),S.exit().remove(),S.each(function(t){var r=i.select(this);a.translatePoint(t,r.select("text"),p,m)||r.remove()}),S.selectAll("text").call(a.textPointStyle,f,t).each(function(t){var r=p.c2p(t.x),n=m.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){i.select(this).attr({x:r,y:n})})}),d&&d.duration>0){var E=i.transition().duration(d.duration).ease(d.easing);y.transition(E).style("opacity",1)}}r.exports=function(t,r,n,a,o,s){var u,c,h=!o,d=!!o&&o.duration>0;((u=a.selectAll("g.trace").data(n,function(t){return t[0].trace.uid})).enter().append("g").attr("class",function(t){return"trace quiver trace"+t[0].trace.uid}).style("stroke-miterlimit",2),u.order(),d)?(s&&(c=s()),i.transition().duration(o.duration).ease(o.easing).each("end",function(){c&&c()}).each("interrupt",function(){c&&c()}).each(function(){a.selectAll("g.trace").each(function(i,a){l(t,a,r,i,n,this,o)})})):u.each(function(i,a){l(t,a,r,i,n,this,o)}),h&&u.exit().remove()}}}),UH=g({"src/traces/quiver/hover.js"(t,r){var i=t_(),n=rR(),a=no();r.exports=function(t,r,o,s){var l=t.cd,u=l[0].trace,c=t.xa,h=t.ya,d=c.c2p(r),f=h.c2p(o);if(n.getClosest(l,function(t){return void 0===t._px0?1/0:function(t,r,i,n,a,o){let s=a-i,l=o-n,u=s*s+l*l;if(!u)return Math.sqrt((t-i)*(t-i)+(r-n)*(r-n));var c=((t-i)*s+(r-n)*l)/u;let h=i+(c=Math.max(0,Math.min(1,c)))*s,d=n+c*l;return Math.sqrt((t-h)*(t-h)+(r-d)*(r-d))}(d,f,t._px0,t._py0,t._px1,t._py1)},t),!1!==t.index){var p=l[t.index],m=c.c2p(p.x,!0),g=h.c2p(p.y,!0),y=Math.sqrt((d-m)*(d-m)+(f-g)*(f-g));t.index=p.i;var v=u.u?u.u[p.i]:0,x=u.v?u.v[p.i]:0;return i.extendFlat(t,{color:a(u,p),x0:m-3,x1:m+3,xLabelVal:p.x,y0:g-3,y1:g+3,yLabelVal:p.y,uLabelVal:v,vLabelVal:x,extraText:"u: "+v+", v: "+x,spikeDistance:y,hovertemplate:u.hovertemplate}),i.fillText(p,u,t),[t]}}}}),U$=g({"src/traces/quiver/format_labels.js"(t,r){var i=rs(),n=t_();r.exports=function(t,r,a){var o={},s={_fullLayout:a},l=i.getFromTrace(s,r,"x"),u=i.getFromTrace(s,r,"y"),c=t.x,h=t.y;o.xLabel=i.tickText(l,l.c2l(c),!0).text,o.yLabel=i.tickText(u,u.c2l(h),!0).text;var d=r.u?r.u[t.i]:0,f=r.v?r.v[t.i]:0,p=r.uhoverformat,m=r.vhoverformat;return o.uLabel=p?n.numberFormat(p)(d):String(d),o.vLabel=m?n.numberFormat(m)(f):String(f),o}}}),UW=g({"src/traces/quiver/event_data.js"(t,r){r.exports=function(t,r,i,n,a){return t.x=r.x,t.y=r.y,t.u=i.u?i.u[a]:void 0,t.v=i.v?i.v[a]:void 0,t}}}),UY=g({"src/traces/quiver/index.js"(t,r){r.exports={moduleType:"trace",name:"quiver",basePlotModule:ny(),categories:["cartesian","svg","showLegend","scatter-like","zoomScale"],attributes:Uj(),supplyDefaults:UN(),calc:UV(),crossTraceCalc:UU(),plot:UG(),style:Uq().style,styleOnSelect:Uq().styleOnSelect,hoverPoints:UH(),formatLabels:U$(),eventData:UW(),selectPoints:nl(),colorbar:ni(),animatable:!0,meta:{}}}}),UZ=g({"lib/quiver.js"(t,r){r.exports=UY()}}),UX=g({"node_modules/world-calendars/dist/main.js"(t,r){var i=mB();function n(){this.regionalOptions=[],this.regionalOptions[""]={invalidCalendar:"Calendar {0} not found",invalidDate:"Invalid {0} date",invalidMonth:"Invalid {0} month",invalidYear:"Invalid {0} year",differentCalendars:"Cannot mix {0} and {1} dates"},this.local=this.regionalOptions[""],this.calendars={},this._localCals={}}function a(t,r,i,n){if(this._calendar=t,this._year=r,this._month=i,this._day=n,0===this._calendar._validateLevel&&!this._calendar.isValid(this._year,this._month,this._day))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name)}function o(t,r){return t=""+t,"000000".substring(0,r-t.length)+t}function s(){this.shortYearCutoff="+10"}function l(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}i(n.prototype,{instance:function(t,r){t=(t||"gregorian").toLowerCase(),r=r||"";var i=this._localCals[t+"-"+r];if(!i&&this.calendars[t]&&(i=new this.calendars[t](r),this._localCals[t+"-"+r]=i),!i)throw(this.local.invalidCalendar||this.regionalOptions[""].invalidCalendar).replace(/\{0\}/,t);return i},newDate:function(t,r,i,n,a){return(n=(null!=t&&t.year?t.calendar():"string"==typeof n?this.instance(n,a):n)||this.instance()).newDate(t,r,i)},substituteDigits:function(t){return function(r){return(r+"").replace(/[0-9]/g,function(r){return t[r]})}},substituteChineseDigits:function(t,r){return function(i){for(var n="",a=0;i>0;){var o=i%10;n=(0===o?"":t[o]+r[a])+n,a++,i=Math.floor(i/10)}return 0===n.indexOf(t[1]+r[1])&&(n=n.substr(1)),n||t[0]}}}),i(a.prototype,{newDate:function(t,r,i){return this._calendar.newDate(t??this,r,i)},year:function(t){return 0==arguments.length?this._year:this.set(t,"y")},month:function(t){return 0==arguments.length?this._month:this.set(t,"m")},day:function(t){return 0==arguments.length?this._day:this.set(t,"d")},date:function(t,r,i){if(!this._calendar.isValid(t,r,i))throw(u.local.invalidDate||u.regionalOptions[""].invalidDate).replace(/\{0\}/,this._calendar.local.name);return this._year=t,this._month=r,this._day=i,this},leapYear:function(){return this._calendar.leapYear(this)},epoch:function(){return this._calendar.epoch(this)},formatYear:function(){return this._calendar.formatYear(this)},monthOfYear:function(){return this._calendar.monthOfYear(this)},weekOfYear:function(){return this._calendar.weekOfYear(this)},daysInYear:function(){return this._calendar.daysInYear(this)},dayOfYear:function(){return this._calendar.dayOfYear(this)},daysInMonth:function(){return this._calendar.daysInMonth(this)},dayOfWeek:function(){return this._calendar.dayOfWeek(this)},weekDay:function(){return this._calendar.weekDay(this)},extraInfo:function(){return this._calendar.extraInfo(this)},add:function(t,r){return this._calendar.add(this,t,r)},set:function(t,r){return this._calendar.set(this,t,r)},compareTo:function(t){if(this._calendar.name!==t._calendar.name)throw(u.local.differentCalendars||u.regionalOptions[""].differentCalendars).replace(/\{0\}/,this._calendar.local.name).replace(/\{1\}/,t._calendar.local.name);var r=this._year!==t._year?this._year-t._year:this._month!==t._month?this.monthOfYear()-t.monthOfYear():this._day-t._day;return 0===r?0:r<0?-1:1},calendar:function(){return this._calendar},toJD:function(){return this._calendar.toJD(this)},fromJD:function(t){return this._calendar.fromJD(t)},toJSDate:function(){return this._calendar.toJSDate(this)},fromJSDate:function(t){return this._calendar.fromJSDate(t)},toString:function(){return(0>this.year()?"-":"")+o(Math.abs(this.year()),4)+"-"+o(this.month(),2)+"-"+o(this.day(),2)}}),i(s.prototype,{_validateLevel:0,newDate:function(t,r,i){return null==t?this.today():(t.year&&(this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate),i=t.day(),r=t.month(),t=t.year()),new a(this,t,r,i))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return 0>this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear).year()?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var r=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return(0>r.year()?"-":"")+o(Math.abs(r.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear),12},monthOfYear:function(t,r){var i=this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return(i.month()+this.monthsInYear(i)-this.firstMonth)%this.monthsInYear(i)+this.minMonth},fromMonthOfYear:function(t,r){var i=(r+this.firstMonth-2*this.minMonth)%this.monthsInYear(t)+this.minMonth;return this._validate(t,i,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth),i},daysInYear:function(t){var r=this._validate(t,this.minMonth,this.minDay,u.local.invalidYear||u.regionalOptions[""].invalidYear);return this.leapYear(r)?366:365},dayOfYear:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate);return n.toJD()-this.newDate(n.year(),this.fromMonthOfYear(n.year(),this.minMonth),this.minDay).toJD()+1},daysInWeek:function(){return 7},dayOfWeek:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,r,i){return this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate),{}},add:function(t,r,i){return this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,r,i),r,i)},_add:function(t,r,i){if(this._validateLevel++,"d"===i||"w"===i){var n=t.toJD()+r*("w"===i?this.daysInWeek():1),a=t.calendar().fromJD(n);return this._validateLevel--,[a.year(),a.month(),a.day()]}try{var o=t.year()+("y"===i?r:0),s=t.monthOfYear()+("m"===i?r:0),a=t.day();"y"===i?(t.month()!==this.fromMonthOfYear(o,s)&&(s=this.newDate(o,t.month(),this.minDay).monthOfYear()),s=Math.min(s,this.monthsInYear(o)),a=Math.min(a,this.daysInMonth(o,this.fromMonthOfYear(o,s)))):"m"===i&&(function(t){for(;sr-1+t.minMonth;)o++,s-=r,r=t.monthsInYear(o)}(this),a=Math.min(a,this.daysInMonth(o,this.fromMonthOfYear(o,s))));var l=[o,this.fromMonthOfYear(o,s),a];return this._validateLevel--,l}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,r,i,n){if(!this.hasYearZero&&("y"===n||"m"===n)&&(0===r[0]||t.year()>0!=r[0]>0)){var a={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n];r=this._add(t,i*a[0]+(i<0?-1:1)*a[1],a[2])}return t.date(r[0],r[1],r[2])},set:function(t,r,i){this._validate(t,this.minMonth,this.minDay,u.local.invalidDate||u.regionalOptions[""].invalidDate);var n="y"===i?r:t.year(),a="m"===i?r:t.month(),o="d"===i?r:t.day();return("y"===i||"m"===i)&&(o=Math.min(o,this.daysInMonth(n,a))),t.date(n,a,o)},isValid:function(t,r,i){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var a=this.newDate(t,r,this.minDay);n=r>=this.minMonth&&r-this.minMonth=this.minDay&&i-this.minDayr.year());return t%4==0&&(t%100!=0||t%400==0)},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,r){var i=this._validate(t,r,this.minDay,u.local.invalidMonth||u.regionalOptions[""].invalidMonth);return this.daysPerMonth[i.month()-1]+(2===i.month()&&this.leapYear(i.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate);t=n.year(),r=n.month(),i=n.day(),t<0&&t++,r<3&&(r+=12,t--);var a=Math.floor(t/100);return Math.floor(365.25*(t+4716))+Math.floor(30.6001*(r+1))+i+(2-a+Math.floor(a/4))-1524.5},fromJD:function(t){var r=Math.floor(t+.5),i=Math.floor((r-1867216.25)/36524.25),n=(i=r+1+i-Math.floor(i/4))+1524,a=Math.floor((n-122.1)/365.25),o=Math.floor(365.25*a),s=Math.floor((n-o)/30.6001),l=n-o-Math.floor(30.6001*s),u=s-(s>13.5?13:1),c=a-(u>2.5?4716:4715);return c<=0&&c--,this.newDate(c,u,l)},toJSDate:function(t,r,i){var n=this._validate(t,r,i,u.local.invalidDate||u.regionalOptions[""].invalidDate),a=new Date(n.year(),n.month()-1,n.day());return a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0),a.setHours(a.getHours()>12?a.getHours()+2:0),a},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var u=r.exports=new n;u.cdate=a,u.baseCalendar=s,u.calendars.gregorian=l}}),UK=g({"node_modules/world-calendars/dist/plus.js"(){var t=mB(),r=UX();t(r.regionalOptions[""],{invalidArguments:"Invalid arguments",invalidFormat:"Cannot format a date from another calendar",missingNumberAt:"Missing number at position {0}",unknownNameAt:"Unknown name at position {0}",unexpectedLiteralAt:"Unexpected literal at position {0}",unexpectedText:"Additional text found at end"}),r.local=r.regionalOptions[""],t(r.cdate.prototype,{formatDate:function(t,r){return"string"!=typeof t&&(r=t,t=""),this._calendar.formatDate(t||"",this,r)}}),t(r.baseCalendar.prototype,{UNIX_EPOCH:r.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:r.instance().jdEpoch,TICKS_PER_DAY:86400*1e7,ATOM:"yyyy-mm-dd",COOKIE:"D, dd M yyyy",FULL:"DD, MM d, yyyy",ISO_8601:"yyyy-mm-dd",JULIAN:"J",RFC_822:"D, d M yy",RFC_850:"DD, dd-M-yy",RFC_1036:"D, d M yy",RFC_1123:"D, d M yyyy",RFC_2822:"D, d M yyyy",RSS:"D, d M yy",TICKS:"!",TIMESTAMP:"@",W3C:"yyyy-mm-dd",formatDate:function(t,i,n){if("string"!=typeof t&&(n=i,i=t,t=""),!i)return"";if(i.calendar()!==this)throw r.local.invalidFormat||r.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat,n=n||{};for(var a,o,s,l=n.dayNamesShort||this.local.dayNamesShort,u=n.dayNames||this.local.dayNames,c=n.monthNumbers||this.local.monthNumbers,h=n.monthNamesShort||this.local.monthNamesShort,d=n.monthNames||this.local.monthNames,f=(n.calculateWeek||this.local.calculateWeek,function(r,i){for(var n=1;x+n1}),p=function(t,r,i,n){var a=""+r;if(f(t,n))for(;a.length1},b=function(t,n){var a=x(t,n),o=RegExp("^-?\\d{1,"+[2,3,a?4:2,a?4:2,10,11,20]["oyYJ@!".indexOf(t)+1]+"}"),s=i.substring(A).match(o);if(!s)throw(r.local.missingNumberAt||r.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=s[0].length,parseInt(s[0],10)},_=this,w=function(t,n,a,o){for(var s=x(t,o)?a:n,l=0;l-1){p=1,m=g;for(var S=this.daysInMonth(f,p);m>S;S=this.daysInMonth(f,p))p++,m-=S}return d>-1?this.fromJD(d):this.newDate(f,p,m)},determineDate:function(t,r,i,n,a){i&&"object"!=typeof i&&(a=n,n=i,i=null),"string"!=typeof n&&(a=n,n="");var o=this;return r=r?r.newDate():null,t=null==t?r:"string"==typeof t?function(t){try{return o.parseDate(n,t,a)}catch{}t=t.toLowerCase();for(var r=(t.match(/^c/)&&i?i.newDate():null)||o.today(),s=/([+-]?[0-9]+)\s*(d|w|m|y)?/g,l=s.exec(t);l;)r.add(parseInt(l[1],10),l[2]||"d"),l=s.exec(t);return r}(t):"number"==typeof t?isNaN(t)||t===1/0||t===-1/0?r:o.today().add(t,"d"):o.newDate(t)}})}}),UJ=g({"node_modules/world-calendars/dist/calendars/chinese.js"(){var t=UX(),r=mB(),i=t.instance();function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}n.prototype=new t.baseCalendar,r(n.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,r){if("string"==typeof t){var i=t.match(o);return i?i[0]:""}var n=this._validateYear(t),a=t.month(),s=""+this.toChineseMonth(n,a);return r&&s.length<2&&(s="0"+s),this.isIntercalaryMonth(n,a)&&(s+="i"),s},monthNames:function(t){if("string"==typeof t){var r=t.match(s);return r?r[0]:""}var i=this._validateYear(t),n=t.month(),a=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"][this.toChineseMonth(i,n)-1];return this.isIntercalaryMonth(i,n)&&(a="闰"+a),a},monthNamesShort:function(t){if("string"==typeof t){var r=t.match(l);return r?r[0]:""}var i=this._validateYear(t),n=t.month(),a=["一","二","三","四","五","六","七","八","九","十","十一","十二"][this.toChineseMonth(i,n)-1];return this.isIntercalaryMonth(i,n)&&(a="闰"+a),a},parseMonth:function(t,r){t=this._validateYear(t);var i,n=parseInt(r);if(isNaN(n))"闰"===r[0]&&(i=!0,r=r.substring(1)),"月"===r[r.length-1]&&(r=r.substring(0,r.length-1)),n=1+["一","二","三","四","五","六","七","八","九","十","十一","十二"].indexOf(r);else{var a=r[r.length-1];i="i"===a||"I"===a}return this.toMonthIndex(t,n,i)},dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},_validateYear:function(t,r){if(t.year&&(t=t.year()),"number"!=typeof t||t<1888||t>2111)throw r.replace(/\{0\}/,this.local.name);return t},toMonthIndex:function(r,i,n){var a=this.intercalaryMonth(r);if(n&&i!==a||i<1||i>12)throw t.local.invalidMonth.replace(/\{0\}/,this.local.name);return a?!n&&i<=a?i-1:i:i-1},toChineseMonth:function(r,i){r.year&&(i=(r=r.year()).month());var n=this.intercalaryMonth(r);if(i<0||i>(n?12:11))throw t.local.invalidMonth.replace(/\{0\}/,this.local.name);return n?i>13},isIntercalaryMonth:function(t,r){t.year&&(r=(t=t.year()).month());var i=this.intercalaryMonth(t);return!!i&&i===r},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(r,n,a){var o,s=c[this._validateYear(r,t.local.invalidyear)-c[0]];return(o=i.newDate(s>>9&4095,s>>5&15,31&s)).add(4-(o.dayOfWeek()||7),"d"),1+Math.floor((this.toJD(r,n,a)-o.toJD())/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(r,i){r.year&&(i=r.month(),r=r.year());var n=u[(r=this._validateYear(r))-u[0]];if(i>(n>>13?12:11))throw t.local.invalidMonth.replace(/\{0\}/,this.local.name);return n&1<<12-i?30:29},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,n,a){var o=this._validate(r,l,a,t.local.invalidDate);r=this._validateYear(o.year()),n=o.month(),a=o.day();var s=this.isIntercalaryMonth(r,n),l=this.toChineseMonth(r,n),h=function(t,r,i,n){if("object"==typeof t)o=t,a=r||{};else{if(!("number"==typeof t&&t>=1888&&t<=2111))throw Error("Lunar year outside range 1888-2111");if(!("number"==typeof r&&r>=1&&r<=12))throw Error("Lunar month outside range 1 - 12");if(!("number"==typeof i&&i>=1&&i<=30))throw Error("Lunar day outside range 1 - 30");"object"==typeof n?(s=!1,a=n):(s=!!n,a={}),o={year:t,month:r,day:i,isIntercalary:s}}var a,o,s,l,h=o.day-1,d=u[o.year-u[0]],f=d>>13;l=f&&(o.month>f||o.isIntercalary)?o.month:o.month-1;for(var p=0;p>9&4095,(m>>5&15)-1,(31&m)+h);return a.year=g.getFullYear(),a.month=1+g.getMonth(),a.day=g.getDate(),a}(r,l,a,s);return i.toJD(h.year,h.month,h.day)},fromJD:function(t){var r=i.fromJD(t),n=function(t,r,i){if("object"==typeof t)o=t,s=r||{};else{if(!("number"==typeof t&&t>=1888&&t<=2111))throw Error("Solar year outside range 1888-2111");if(!("number"==typeof r&&r>=1&&r<=12))throw Error("Solar month outside range 1 - 12");if(!("number"==typeof i&&i>=1&&i<=31))throw Error("Solar day outside range 1 - 31");o={year:t,month:r,day:i},s={}}var n=c[o.year-c[0]],a=o.year<<9|o.month<<5|o.day;s.year=a>=n?o.year:o.year-1;var o,s,l,h=new Date((n=c[s.year-c[0]])>>9&4095,(n>>5&15)-1,31&n);l=Math.round((new Date(o.year,o.month-1,o.day)-h)/864e5);var d,f=u[s.year-u[0]];for(d=0;d<13;d++){var p=f&1<<12-d?30:29;if(l>13;return!m||di.year());return r%4==3||r%4==-1},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear||t.regionalOptions[""].invalidYear),13},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(13===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return(r=a.year())<0&&r++,a.day()+(a.month()-1)*30+(r-1)*365+Math.floor(r/4)+this.jdEpoch-1},fromJD:function(t){var r=Math.floor(t)+.5-this.jdEpoch,i=Math.floor((r-Math.floor((r+366)/1461))/365)+1;i<=0&&i--;var n=Math.floor((r=Math.floor(t)+.5-this.newDate(i,1,1).toJD())/30)+1,a=r-(n-1)*30+1;return this.newDate(i,n,a)}}),t.calendars.coptic=i}}),U0=g({"node_modules/world-calendars/dist/calendars/discworld.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Discworld",jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),!1},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),13},daysInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),400},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/8)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(r,i,n){return(this._validate(r,i,n,t.local.invalidDate).day()+1)%8},weekDay:function(t,r,i){var n=this.dayOfWeek(t,r,i);return n>=2&&n<=6},extraInfo:function(r,i,a){return{century:n[Math.floor((this._validate(r,i,a,t.local.invalidDate).year()-1)/100)+1]||""}},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return r=a.year()+ +(0>a.year()),i=a.month(),(n=a.day())+16*(i>1)+(i>2?(i-2)*32:0)+(r-1)*400+this.jdEpoch-1},fromJD:function(t){var r=Math.floor((t=Math.floor(t+.5)-Math.floor(this.jdEpoch)-1)/400)+1;t-=(r-1)*400;var i=Math.floor((t+=16*(t>15))/32)+1,n=t-(i-1)*32+1;return this.newDate(r<=0?r-1:r,i,n)}});var n={20:"Fruitbat",21:"Anchovy"};t.calendars.discworld=i}}),U1=g({"node_modules/world-calendars/dist/calendars/ethiopian.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=i.year()+ +(0>i.year());return r%4==3||r%4==-1},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear||t.regionalOptions[""].invalidYear),13},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(13===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return(r=a.year())<0&&r++,a.day()+(a.month()-1)*30+(r-1)*365+Math.floor(r/4)+this.jdEpoch-1},fromJD:function(t){var r=Math.floor(t)+.5-this.jdEpoch,i=Math.floor((r-Math.floor((r+366)/1461))/365)+1;i<=0&&i--;var n=Math.floor((r=Math.floor(t)+.5-this.newDate(i,1,1).toJD())/30)+1,a=r-(n-1)*30+1;return this.newDate(i,n,a)}}),t.calendars.ethiopian=i}}),U2=g({"node_modules/world-calendars/dist/calendars/hebrew.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function n(t,r){return t-r*Math.floor(t/r)}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear);return this._leapYear(i.year())},_leapYear:function(t){return 7>n(7*(t=t<0?t+1:t)+1,19)},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),this._leapYear(r.year?r.year():r)?13:12},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(r){return r=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year(),this.toJD(-1===r?1:r+1,7,1)-this.toJD(r,7,1)},daysInMonth:function(r,i){return r.year&&(i=r.month(),r=r.year()),this._validate(r,i,this.minDay,t.local.invalidMonth),12===i&&this.leapYear(r)||8===i&&5===n(this.daysInYear(r),10)?30:9===i&&3===n(this.daysInYear(r),10)?29:this.daysPerMonth[i-1]},weekDay:function(t,r,i){return 6!==this.dayOfWeek(t,r,i)},extraInfo:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return{yearType:(this.leapYear(a)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(a)%10-3]}},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);r=a.year(),i=a.month(),n=a.day();var o=r<=0?r+1:r,s=this.jdEpoch+this._delay1(o)+this._delay2(o)+n+1;if(i<7){for(var l=7;l<=this.monthsInYear(r);l++)s+=this.daysInMonth(r,l);for(var l=1;ln(3*(i+1),7)&&i++,i},_delay2:function(t){var r=this._delay1(t-1),i=this._delay1(t);return this._delay1(t+1)-i==356?2:+(i-r==382)},fromJD:function(t){t=Math.floor(t)+.5;for(var r=Math.floor((t-this.jdEpoch)*98496/0x224f0b7)-1;t>=this.toJD(-1===r?1:r+1,7,1);)r++;for(var i=tthis.toJD(r,i,this.daysInMonth(r,i));)i++;var n=t-this.toJD(r,i,1)+1;return this.newDate(r,i,n)}}),t.calendars.hebrew=i}}),U3=g({"node_modules/world-calendars/dist/calendars/islamic.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-khamīs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(r){return(11*this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year()+14)%30<11},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){return this.leapYear(t)?355:354},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(12===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 5!==this.dayOfWeek(t,r,i)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return r=a.year(),i=a.month(),(n=a.day())+Math.ceil(29.5*(i-1))+((r=r<=0?r+1:r)-1)*354+Math.floor((3+11*r)/30)+this.jdEpoch-1},fromJD:function(t){var r=Math.floor((30*((t=Math.floor(t)+.5)-this.jdEpoch)+10646)/10631);r=r<=0?r-1:r;var i=Math.min(12,Math.ceil((t-29-this.toJD(r,1,1))/29.5)+1),n=t-this.toJD(r,i,1)+1;return this.newDate(r,i,n)}}),t.calendars.islamic=i}}),U5=g({"node_modules/world-calendars/dist/calendars/julian.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=0>i.year()?i.year()+1:i.year();return r%4==0},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(4-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(2===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return r=a.year(),i=a.month(),n=a.day(),r<0&&r++,i<=2&&(r--,i+=12),Math.floor(365.25*(r+4716))+Math.floor(30.6001*(i+1))+n-1524.5},fromJD:function(t){var r=Math.floor(t+.5)+1524,i=Math.floor((r-122.1)/365.25),n=Math.floor(365.25*i),a=Math.floor((r-n)/30.6001),o=a-Math.floor(a<14?1:13),s=i-Math.floor(o>2?4716:4715),l=r-n-Math.floor(30.6001*a);return s<=0&&s--,this.newDate(s,o,l)}}),t.calendars.julian=i}}),U4=g({"node_modules/world-calendars/dist/calendars/mayan.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function n(t,r){return t-r*Math.floor(t/r)}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),!1},formatYear:function(r){var i=Math.floor((r=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year())/400);return r%=400,i+"."+Math.floor((r+=400*(r<0))/20)+"."+r%20},forYear:function(t){if((t=t.split(".")).length<3)throw"Invalid Mayan year";for(var r=0,i=0;i19||i>0&&n<0)throw"Invalid Mayan year";r=20*r+n}return r},monthsInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),18},weekOfYear:function(r,i,n){return this._validate(r,i,n,t.local.invalidDate),0},daysInYear:function(r){return this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),360},daysInMonth:function(r,i){return this._validate(r,i,this.minDay,t.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(r,i,n){return this._validate(r,i,n,t.local.invalidDate).day()},weekDay:function(r,i,n){return this._validate(r,i,n,t.local.invalidDate),!0},extraInfo:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate).toJD(),o=this._toHaab(a),s=this._toTzolkin(a);return{haabMonthName:this.local.haabMonths[o[0]-1],haabMonth:o[0],haabDay:o[1],tzolkinDayName:this.local.tzolkinMonths[s[0]-1],tzolkinDay:s[0],tzolkinTrecena:s[1]}},_toHaab:function(t){var r=n((t-=this.jdEpoch)+8+340,365);return[Math.floor(r/20)+1,n(r,20)]},_toTzolkin:function(t){return[n((t-=this.jdEpoch)+20-1,20)+1,n(t+4-1,13)+1]},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);return a.day()+20*a.month()+360*a.year()+this.jdEpoch},fromJD:function(t){var r=Math.floor((t=Math.floor(t)+.5-this.jdEpoch)/360);t%=360;var i=Math.floor((t+=360*(t<0))/20),n=t%20;return this.newDate(r,i,n)}}),t.calendars.mayan=i}}),U6=g({"node_modules/world-calendars/dist/calendars/nanakshahi.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar;var n=t.instance("gregorian");r(i.prototype,{name:"Nanakshahi",jdEpoch:2257673.5,daysPerMonth:[31,31,31,31,31,30,30,30,30,30,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Nanakshahi",epochs:["BN","AN"],monthNames:["Chet","Vaisakh","Jeth","Harh","Sawan","Bhadon","Assu","Katak","Maghar","Poh","Magh","Phagun"],monthNamesShort:["Che","Vai","Jet","Har","Saw","Bha","Ass","Kat","Mgr","Poh","Mgh","Pha"],dayNames:["Somvaar","Mangalvar","Budhvaar","Veervaar","Shukarvaar","Sanicharvaar","Etvaar"],dayNamesShort:["Som","Mangal","Budh","Veer","Shukar","Sanichar","Et"],dayNamesMin:["So","Ma","Bu","Ve","Sh","Sa","Et"],digits:null,dateFormat:"dd-mm-yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear||t.regionalOptions[""].invalidYear);return n.leapYear(i.year()+ +(1>i.year())+1469)},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(1-(n.dayOfWeek()||7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(12===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,i,a){var o=this._validate(r,i,a,t.local.invalidMonth),r=o.year();r<0&&r++;for(var s=o.day(),l=1;l=this.toJD(r+1,1,1);)r++;for(var i=t-Math.floor(this.toJD(r,1,1)+.5)+1,n=1;i>this.daysInMonth(r,n);)i-=this.daysInMonth(r,n),n++;return this.newDate(r,n,i)}}),t.calendars.nanakshahi=i}}),U8=g({"node_modules/world-calendars/dist/calendars/nepali.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(r){if(r=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year(),typeof this.NEPALI_CALENDAR_DATA[r]>"u")return this.daysPerYear;for(var i=0,n=this.minMonth;n<=12;n++)i+=this.NEPALI_CALENDAR_DATA[r][n];return i},daysInMonth:function(r,i){return r.year&&(i=r.month(),r=r.year()),this._validate(r,i,this.minDay,t.local.invalidMonth),typeof this.NEPALI_CALENDAR_DATA[r]>"u"?this.daysPerMonth[i-1]:this.NEPALI_CALENDAR_DATA[r][i]},weekDay:function(t,r,i){return 6!==this.dayOfWeek(t,r,i)},toJD:function(r,i,n){var a=this._validate(r,i,n,t.local.invalidDate);r=a.year(),i=a.month(),n=a.day();var o=t.instance(),s=0,l=i,u=r;this._createMissingCalendarData(r);var c=r-(l>9||9===l&&n>=this.NEPALI_CALENDAR_DATA[u][0]?56:57);for(9!==i&&(s=n,l--);9!==l;)l<=0&&(l=12,u--),s+=this.NEPALI_CALENDAR_DATA[u][l],l--;return 9===i?(s+=n-this.NEPALI_CALENDAR_DATA[u][0])<0&&(s+=o.daysInYear(c)):s+=this.NEPALI_CALENDAR_DATA[u][9]-this.NEPALI_CALENDAR_DATA[u][0],o.newDate(c,1,1).add(s,"d").toJD()},fromJD:function(r){var i=t.instance().fromJD(r),n=i.year(),a=i.dayOfYear(),o=n+56;this._createMissingCalendarData(o);for(var s=9,l=this.NEPALI_CALENDAR_DATA[o][0],u=this.NEPALI_CALENDAR_DATA[o][s]-l+1;a>u;)++s>12&&(s=1,o++),u+=this.NEPALI_CALENDAR_DATA[o][s];var c=this.NEPALI_CALENDAR_DATA[o][s]-(u-a);return this.newDate(o,s,c)},_createMissingCalendarData:function(t){var r=this.daysPerMonth.slice(0);r.unshift(17);for(var i=t-1;i"u"&&(this.NEPALI_CALENDAR_DATA[i]=r)},NEPALI_CALENDAR_DATA:{1970:[18,31,31,32,31,31,31,30,29,30,29,30,30],1971:[18,31,31,32,31,32,30,30,29,30,29,30,30],1972:[17,31,32,31,32,31,30,30,30,29,29,30,30],1973:[19,30,32,31,32,31,30,30,30,29,30,29,31],1974:[19,31,31,32,30,31,31,30,29,30,29,30,30],1975:[18,31,31,32,32,30,31,30,29,30,29,30,30],1976:[17,31,32,31,32,31,30,30,30,29,29,30,31],1977:[18,31,32,31,32,31,31,29,30,29,30,29,31],1978:[18,31,31,32,31,31,31,30,29,30,29,30,30],1979:[18,31,31,32,32,31,30,30,29,30,29,30,30],1980:[17,31,32,31,32,31,30,30,30,29,29,30,31],1981:[18,31,31,31,32,31,31,29,30,30,29,30,30],1982:[18,31,31,32,31,31,31,30,29,30,29,30,30],1983:[18,31,31,32,32,31,30,30,29,30,29,30,30],1984:[17,31,32,31,32,31,30,30,30,29,29,30,31],1985:[18,31,31,31,32,31,31,29,30,30,29,30,30],1986:[18,31,31,32,31,31,31,30,29,30,29,30,30],1987:[18,31,32,31,32,31,30,30,29,30,29,30,30],1988:[17,31,32,31,32,31,30,30,30,29,29,30,31],1989:[18,31,31,31,32,31,31,30,29,30,29,30,30],1990:[18,31,31,32,31,31,31,30,29,30,29,30,30],1991:[18,31,32,31,32,31,30,30,29,30,29,30,30],1992:[17,31,32,31,32,31,30,30,30,29,30,29,31],1993:[18,31,31,31,32,31,31,30,29,30,29,30,30],1994:[18,31,31,32,31,31,31,30,29,30,29,30,30],1995:[17,31,32,31,32,31,30,30,30,29,29,30,30],1996:[17,31,32,31,32,31,30,30,30,29,30,29,31],1997:[18,31,31,32,31,31,31,30,29,30,29,30,30],1998:[18,31,31,32,31,31,31,30,29,30,29,30,30],1999:[17,31,32,31,32,31,30,30,30,29,29,30,31],2e3:[17,30,32,31,32,31,30,30,30,29,30,29,31],2001:[18,31,31,32,31,31,31,30,29,30,29,30,30],2002:[18,31,31,32,32,31,30,30,29,30,29,30,30],2003:[17,31,32,31,32,31,30,30,30,29,29,30,31],2004:[17,30,32,31,32,31,30,30,30,29,30,29,31],2005:[18,31,31,32,31,31,31,30,29,30,29,30,30],2006:[18,31,31,32,32,31,30,30,29,30,29,30,30],2007:[17,31,32,31,32,31,30,30,30,29,29,30,31],2008:[17,31,31,31,32,31,31,29,30,30,29,29,31],2009:[18,31,31,32,31,31,31,30,29,30,29,30,30],2010:[18,31,31,32,32,31,30,30,29,30,29,30,30],2011:[17,31,32,31,32,31,30,30,30,29,29,30,31],2012:[17,31,31,31,32,31,31,29,30,30,29,30,30],2013:[18,31,31,32,31,31,31,30,29,30,29,30,30],2014:[18,31,31,32,32,31,30,30,29,30,29,30,30],2015:[17,31,32,31,32,31,30,30,30,29,29,30,31],2016:[17,31,31,31,32,31,31,29,30,30,29,30,30],2017:[18,31,31,32,31,31,31,30,29,30,29,30,30],2018:[18,31,32,31,32,31,30,30,29,30,29,30,30],2019:[17,31,32,31,32,31,30,30,30,29,30,29,31],2020:[17,31,31,31,32,31,31,30,29,30,29,30,30],2021:[18,31,31,32,31,31,31,30,29,30,29,30,30],2022:[17,31,32,31,32,31,30,30,30,29,29,30,30],2023:[17,31,32,31,32,31,30,30,30,29,30,29,31],2024:[17,31,31,31,32,31,31,30,29,30,29,30,30],2025:[18,31,31,32,31,31,31,30,29,30,29,30,30],2026:[17,31,32,31,32,31,30,30,30,29,29,30,31],2027:[17,30,32,31,32,31,30,30,30,29,30,29,31],2028:[17,31,31,32,31,31,31,30,29,30,29,30,30],2029:[18,31,31,32,31,32,30,30,29,30,29,30,30],2030:[17,31,32,31,32,31,30,30,30,30,30,30,31],2031:[17,31,32,31,32,31,31,31,31,31,31,31,31],2032:[17,32,32,32,32,32,32,32,32,32,32,32,32],2033:[18,31,31,32,32,31,30,30,29,30,29,30,30],2034:[17,31,32,31,32,31,30,30,30,29,29,30,31],2035:[17,30,32,31,32,31,31,29,30,30,29,29,31],2036:[17,31,31,32,31,31,31,30,29,30,29,30,30],2037:[18,31,31,32,32,31,30,30,29,30,29,30,30],2038:[17,31,32,31,32,31,30,30,30,29,29,30,31],2039:[17,31,31,31,32,31,31,29,30,30,29,30,30],2040:[17,31,31,32,31,31,31,30,29,30,29,30,30],2041:[18,31,31,32,32,31,30,30,29,30,29,30,30],2042:[17,31,32,31,32,31,30,30,30,29,29,30,31],2043:[17,31,31,31,32,31,31,29,30,30,29,30,30],2044:[17,31,31,32,31,31,31,30,29,30,29,30,30],2045:[18,31,32,31,32,31,30,30,29,30,29,30,30],2046:[17,31,32,31,32,31,30,30,30,29,29,30,31],2047:[17,31,31,31,32,31,31,30,29,30,29,30,30],2048:[17,31,31,32,31,31,31,30,29,30,29,30,30],2049:[17,31,32,31,32,31,30,30,30,29,29,30,30],2050:[17,31,32,31,32,31,30,30,30,29,30,29,31],2051:[17,31,31,31,32,31,31,30,29,30,29,30,30],2052:[17,31,31,32,31,31,31,30,29,30,29,30,30],2053:[17,31,32,31,32,31,30,30,30,29,29,30,30],2054:[17,31,32,31,32,31,30,30,30,29,30,29,31],2055:[17,31,31,32,31,31,31,30,29,30,30,29,30],2056:[17,31,31,32,31,32,30,30,29,30,29,30,30],2057:[17,31,32,31,32,31,30,30,30,29,29,30,31],2058:[17,30,32,31,32,31,30,30,30,29,30,29,31],2059:[17,31,31,32,31,31,31,30,29,30,29,30,30],2060:[17,31,31,32,32,31,30,30,29,30,29,30,30],2061:[17,31,32,31,32,31,30,30,30,29,29,30,31],2062:[17,30,32,31,32,31,31,29,30,29,30,29,31],2063:[17,31,31,32,31,31,31,30,29,30,29,30,30],2064:[17,31,31,32,32,31,30,30,29,30,29,30,30],2065:[17,31,32,31,32,31,30,30,30,29,29,30,31],2066:[17,31,31,31,32,31,31,29,30,30,29,29,31],2067:[17,31,31,32,31,31,31,30,29,30,29,30,30],2068:[17,31,31,32,32,31,30,30,29,30,29,30,30],2069:[17,31,32,31,32,31,30,30,30,29,29,30,31],2070:[17,31,31,31,32,31,31,29,30,30,29,30,30],2071:[17,31,31,32,31,31,31,30,29,30,29,30,30],2072:[17,31,32,31,32,31,30,30,29,30,29,30,30],2073:[17,31,32,31,32,31,30,30,30,29,29,30,31],2074:[17,31,31,31,32,31,31,30,29,30,29,30,30],2075:[17,31,31,32,31,31,31,30,29,30,29,30,30],2076:[16,31,32,31,32,31,30,30,30,29,29,30,30],2077:[17,31,32,31,32,31,30,30,30,29,30,29,31],2078:[17,31,31,31,32,31,31,30,29,30,29,30,30],2079:[17,31,31,32,31,31,31,30,29,30,29,30,30],2080:[16,31,32,31,32,31,30,30,30,29,29,30,30],2081:[17,31,31,32,32,31,30,30,30,29,30,30,30],2082:[17,31,32,31,32,31,30,30,30,29,30,30,30],2083:[17,31,31,32,31,31,30,30,30,29,30,30,30],2084:[17,31,31,32,31,31,30,30,30,29,30,30,30],2085:[17,31,32,31,32,31,31,30,30,29,30,30,30],2086:[17,31,32,31,32,31,30,30,30,29,30,30,30],2087:[16,31,31,32,31,31,31,30,30,29,30,30,30],2088:[16,30,31,32,32,30,31,30,30,29,30,30,30],2089:[17,31,32,31,32,31,30,30,30,29,30,30,30],2090:[17,31,32,31,32,31,30,30,30,29,30,30,30],2091:[16,31,31,32,31,31,31,30,30,29,30,30,30],2092:[16,31,31,32,32,31,30,30,30,29,30,30,30],2093:[17,31,32,31,32,31,30,30,30,29,30,30,30],2094:[17,31,31,32,31,31,30,30,30,29,30,30,30],2095:[17,31,31,32,31,31,31,30,29,30,30,30,30],2096:[17,30,31,32,32,31,30,30,29,30,29,30,30],2097:[17,31,32,31,32,31,30,30,30,29,30,30,30],2098:[17,31,31,32,31,31,31,29,30,29,30,30,31],2099:[17,31,31,32,31,31,31,30,29,29,30,30,30],2100:[17,31,32,31,32,30,31,30,29,30,29,30,30]}}),t.calendars.nepali=i}}),U7=g({"node_modules/world-calendars/dist/calendars/persian.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function n(t){var r=t-475;t<0&&r++;var i=.242197*r,n=.242197*(r+1);return i-Math.floor(i)>n-Math.floor(n)}i.prototype=new t.baseCalendar,r(i.prototype,{name:"Persian",jdEpoch:1948320.5,daysPerMonth:[31,31,31,31,31,31,30,30,30,30,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Persian",epochs:["BP","AP"],monthNames:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Dey","Bahman","Esfand"],monthNamesShort:["Far","Ord","Kho","Tir","Mor","Sha","Meh","Aba","Aza","Dey","Bah","Esf"],dayNames:["Yekshanbeh","Doshanbeh","Seshanbeh","Chahārshanbeh","Panjshanbeh","Jom'eh","Shanbeh"],dayNamesShort:["Yek","Do","Se","Cha","Panj","Jom","Sha"],dayNamesMin:["Ye","Do","Se","Ch","Pa","Jo","Sh"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(r){return n(this._validate(r,this.minMonth,this.minDay,t.local.invalidYear).year())},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-((n.dayOfWeek()+1)%7),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(12===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 5!==this.dayOfWeek(t,r,i)},toJD:function(r,i,a){var o=this._validate(r,i,a,t.local.invalidDate);r=o.year(),i=o.month(),a=o.day();var s=0;if(r>0)for(var l=1;l0?r-1:r)*365+s+this.jdEpoch-1},fromJD:function(t){var r=Math.floor(475+((t=Math.floor(t)+.5)-this.toJD(475,1,1))/365.242197);r<=0&&r--,t>this.toJD(r,12,n(r)?30:29)&&0==++r&&r++;var i=t-this.toJD(r,1,1)+1,a=i<=186?Math.ceil(i/31):Math.ceil((i-6)/30),o=t-this.toJD(r,a,1)+1;return this.newDate(r,a,o)}}),t.calendars.persian=i,t.calendars.jalali=i}}),U9=g({"node_modules/world-calendars/dist/calendars/taiwan.js"(){var t=UX(),r=mB(),i=t.instance();function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}n.prototype=new t.baseCalendar,r(n.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(r){var n=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(n.year());return i.leapYear(r)},weekOfYear:function(r,n,a){var o=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(o.year());return i.weekOfYear(r,o.month(),o.day())},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(2===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,n,a){var o=this._validate(r,n,a,t.local.invalidDate),r=this._t2gYear(o.year());return i.toJD(r,o.month(),o.day())},fromJD:function(t){var r=i.fromJD(t),n=this._g2tYear(r.year());return this.newDate(n,r.month(),r.day())},_t2gYear:function(t){return t+this.yearsOffset+ +(t>=-this.yearsOffset&&t<=-1)},_g2tYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset)}}),t.calendars.taiwan=n}}),qe=g({"node_modules/world-calendars/dist/calendars/thai.js"(){var t=UX(),r=mB(),i=t.instance();function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}n.prototype=new t.baseCalendar,r(n.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(r){var n=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(n.year());return i.leapYear(r)},weekOfYear:function(r,n,a){var o=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear),r=this._t2gYear(o.year());return i.weekOfYear(r,o.month(),o.day())},daysInMonth:function(r,i){var n=this._validate(r,i,this.minDay,t.local.invalidMonth);return this.daysPerMonth[n.month()-1]+(2===n.month()&&this.leapYear(n.year())?1:0)},weekDay:function(t,r,i){return 6>(this.dayOfWeek(t,r,i)||7)},toJD:function(r,n,a){var o=this._validate(r,n,a,t.local.invalidDate),r=this._t2gYear(o.year());return i.toJD(r,o.month(),o.day())},fromJD:function(t){var r=i.fromJD(t),n=this._g2tYear(r.year());return this.newDate(n,r.month(),r.day())},_t2gYear:function(t){return t-this.yearsOffset-(t>=1&&t<=this.yearsOffset)},_g2tYear:function(t){return t+this.yearsOffset+ +(t>=-this.yearsOffset&&t<=-1)}}),t.calendars.thai=n}}),qt=g({"node_modules/world-calendars/dist/calendars/ummalqura.js"(){var t=UX(),r=mB();function i(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}i.prototype=new t.baseCalendar,r(i.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thalāthā’","Yawm al-Arba‘ā’","Yawm al-Khamīs","Yawm al-Jum‘a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(r){var i=this._validate(r,this.minMonth,this.minDay,t.local.invalidYear);return 355===this.daysInYear(i.year())},weekOfYear:function(t,r,i){var n=this.newDate(t,r,i);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){for(var r=0,i=1;i<=12;i++)r+=this.daysInMonth(t,i);return r},daysInMonth:function(r,i){for(var a=this._validate(r,i,this.minDay,t.local.invalidMonth),o=a.toJD()-24e5+.5,s=0,l=0;lo)return n[s]-n[s-1];s++}return 30},weekDay:function(t,r,i){return 5!==this.dayOfWeek(t,r,i)},toJD:function(r,i,a){var o=this._validate(r,i,a,t.local.invalidDate),s=12*(o.year()-1)+o.month()-15292;return o.day()+n[s-1]-1+24e5-.5},fromJD:function(t){for(var r=t-24e5+.5,i=0,a=0;ar);a++)i++;var o=i+15292,s=Math.floor((o-1)/12),l=r-n[i-1]+1;return this.newDate(s+1,o-12*s,l)},isValid:function(r,i,n){var a=t.baseCalendar.prototype.isValid.apply(this,arguments);return a&&(a=(r=null!=r.year?r.year:r)>=1276&&r<=1500),a},_validate:function(r,i,n,a){var o=t.baseCalendar.prototype._validate.apply(this,arguments);if(o.year<1276||o.year>1500)throw a.replace(/\{0\}/,this.local.name);return o}}),t.calendars.ummalqura=i;var n=[20,50,79,109,138,168,197,227,256,286,315,345,374,404,433,463,492,522,551,581,611,641,670,700,729,759,788,818,847,877,906,936,965,995,1024,1054,1083,1113,1142,1172,1201,1231,1260,1290,1320,1350,1379,1409,1438,1468,1497,1527,1556,1586,1615,1645,1674,1704,1733,1763,1792,1822,1851,1881,1910,1940,1969,1999,2028,2058,2087,2117,2146,2176,2205,2235,2264,2294,2323,2353,2383,2413,2442,2472,2501,2531,2560,2590,2619,2649,2678,2708,2737,2767,2796,2826,2855,2885,2914,2944,2973,3003,3032,3062,3091,3121,3150,3180,3209,3239,3268,3298,3327,3357,3386,3416,3446,3476,3505,3535,3564,3594,3623,3653,3682,3712,3741,3771,3800,3830,3859,3889,3918,3948,3977,4007,4036,4066,4095,4125,4155,4185,4214,4244,4273,4303,4332,4362,4391,4421,4450,4480,4509,4539,4568,4598,4627,4657,4686,4716,4745,4775,4804,4834,4863,4893,4922,4952,4981,5011,5040,5070,5099,5129,5158,5188,5218,5248,5277,5307,5336,5366,5395,5425,5454,5484,5513,5543,5572,5602,5631,5661,5690,5720,5749,5779,5808,5838,5867,5897,5926,5956,5985,6015,6044,6074,6103,6133,6162,6192,6221,6251,6281,6311,6340,6370,6399,6429,6458,6488,6517,6547,6576,6606,6635,6665,6694,6724,6753,6783,6812,6842,6871,6901,6930,6960,6989,7019,7048,7078,7107,7137,7166,7196,7225,7255,7284,7314,7344,7374,7403,7433,7462,7492,7521,7551,7580,7610,7639,7669,7698,7728,7757,7787,7816,7846,7875,7905,7934,7964,7993,8023,8053,8083,8112,8142,8171,8201,8230,8260,8289,8319,8348,8378,8407,8437,8466,8496,8525,8555,8584,8614,8643,8673,8702,8732,8761,8791,8821,8850,8880,8909,8938,8968,8997,9027,9056,9086,9115,9145,9175,9205,9234,9264,9293,9322,9352,9381,9410,9440,9470,9499,9529,9559,9589,9618,9648,9677,9706,9736,9765,9794,9824,9853,9883,9913,9943,9972,10002,10032,10061,10090,10120,10149,10178,10208,10237,10267,10297,10326,10356,10386,10415,10445,10474,10504,10533,10562,10592,10621,10651,10680,10710,10740,10770,10799,10829,10858,10888,10917,10947,10976,11005,11035,11064,11094,11124,11153,11183,11213,11242,11272,11301,11331,11360,11389,11419,11448,11478,11507,11537,11567,11596,11626,11655,11685,11715,11744,11774,11803,11832,11862,11891,11921,11950,11980,12010,12039,12069,12099,12128,12158,12187,12216,12246,12275,12304,12334,12364,12393,12423,12453,12483,12512,12542,12571,12600,12630,12659,12688,12718,12747,12777,12807,12837,12866,12896,12926,12955,12984,13014,13043,13072,13102,13131,13161,13191,13220,13250,13280,13310,13339,13368,13398,13427,13456,13486,13515,13545,13574,13604,13634,13664,13693,13723,13752,13782,13811,13840,13870,13899,13929,13958,13988,14018,14047,14077,14107,14136,14166,14195,14224,14254,14283,14313,14342,14372,14401,14431,14461,14490,14520,14550,14579,14609,14638,14667,14697,14726,14756,14785,14815,14844,14874,14904,14933,14963,14993,15021,15051,15081,15110,15140,15169,15199,15228,15258,15287,15317,15347,15377,15406,15436,15465,15494,15524,15553,15582,15612,15641,15671,15701,15731,15760,15790,15820,15849,15878,15908,15937,15966,15996,16025,16055,16085,16114,16144,16174,16204,16233,16262,16292,16321,16350,16380,16409,16439,16468,16498,16528,16558,16587,16617,16646,16676,16705,16734,16764,16793,16823,16852,16882,16912,16941,16971,17001,17030,17060,17089,17118,17148,17177,17207,17236,17266,17295,17325,17355,17384,17414,17444,17473,17502,17532,17561,17591,17620,17650,17679,17709,17738,17768,17798,17827,17857,17886,17916,17945,17975,18004,18034,18063,18093,18122,18152,18181,18211,18241,18270,18300,18330,18359,18388,18418,18447,18476,18506,18535,18565,18595,18625,18654,18684,18714,18743,18772,18802,18831,18860,18890,18919,18949,18979,19008,19038,19068,19098,19127,19156,19186,19215,19244,19274,19303,19333,19362,19392,19422,19452,19481,19511,19540,19570,19599,19628,19658,19687,19717,19746,19776,19806,19836,19865,19895,19924,19954,19983,20012,20042,20071,20101,20130,20160,20190,20219,20249,20279,20308,20338,20367,20396,20426,20455,20485,20514,20544,20573,20603,20633,20662,20692,20721,20751,20780,20810,20839,20869,20898,20928,20957,20987,21016,21046,21076,21105,21135,21164,21194,21223,21253,21282,21312,21341,21371,21400,21430,21459,21489,21519,21548,21578,21607,21637,21666,21696,21725,21754,21784,21813,21843,21873,21902,21932,21962,21991,22021,22050,22080,22109,22138,22168,22197,22227,22256,22286,22316,22346,22375,22405,22434,22464,22493,22522,22552,22581,22611,22640,22670,22700,22730,22759,22789,22818,22848,22877,22906,22936,22965,22994,23024,23054,23083,23113,23143,23173,23202,23232,23261,23290,23320,23349,23379,23408,23438,23467,23497,23527,23556,23586,23616,23645,23674,23704,23733,23763,23792,23822,23851,23881,23910,23940,23970,23999,24029,24058,24088,24117,24147,24176,24206,24235,24265,24294,24324,24353,24383,24413,24442,24472,24501,24531,24560,24590,24619,24648,24678,24707,24737,24767,24796,24826,24856,24885,24915,24944,24974,25003,25032,25062,25091,25121,25150,25180,25210,25240,25269,25299,25328,25358,25387,25416,25446,25475,25505,25534,25564,25594,25624,25653,25683,25712,25742,25771,25800,25830,25859,25888,25918,25948,25977,26007,26037,26067,26096,26126,26155,26184,26214,26243,26272,26302,26332,26361,26391,26421,26451,26480,26510,26539,26568,26598,26627,26656,26686,26715,26745,26775,26805,26834,26864,26893,26923,26952,26982,27011,27041,27070,27099,27129,27159,27188,27218,27248,27277,27307,27336,27366,27395,27425,27454,27484,27513,27542,27572,27602,27631,27661,27691,27720,27750,27779,27809,27838,27868,27897,27926,27956,27985,28015,28045,28074,28104,28134,28163,28193,28222,28252,28281,28310,28340,28369,28399,28428,28458,28488,28517,28547,28577,28607,28636,28665,28695,28724,28754,28783,28813,28843,28872,28901,28931,28960,28990,29019,29049,29078,29108,29137,29167,29196,29226,29255,29285,29315,29345,29375,29404,29434,29463,29492,29522,29551,29580,29610,29640,29669,29699,29729,29759,29788,29818,29847,29876,29906,29935,29964,29994,30023,30053,30082,30112,30141,30171,30200,30230,30259,30289,30318,30348,30378,30408,30437,30467,30496,30526,30555,30585,30614,30644,30673,30703,30732,30762,30791,30821,30850,30880,30909,30939,30968,30998,31027,31057,31086,31116,31145,31175,31204,31234,31263,31293,31322,31352,31381,31411,31441,31471,31500,31530,31559,31589,31618,31648,31676,31706,31736,31766,31795,31825,31854,31884,31913,31943,31972,32002,32031,32061,32090,32120,32150,32180,32209,32239,32268,32298,32327,32357,32386,32416,32445,32475,32504,32534,32563,32593,32622,32652,32681,32711,32740,32770,32799,32829,32858,32888,32917,32947,32976,33006,33035,33065,33094,33124,33153,33183,33213,33243,33272,33302,33331,33361,33390,33420,33450,33479,33509,33539,33568,33598,33627,33657,33686,33716,33745,33775,33804,33834,33863,33893,33922,33952,33981,34011,34040,34069,34099,34128,34158,34187,34217,34247,34277,34306,34336,34365,34395,34424,34454,34483,34512,34542,34571,34601,34631,34660,34690,34719,34749,34778,34808,34837,34867,34896,34926,34955,34985,35015,35044,35074,35103,35133,35162,35192,35222,35251,35280,35310,35340,35370,35399,35429,35458,35488,35517,35547,35576,35605,35635,35665,35694,35723,35753,35782,35811,35841,35871,35901,35930,35960,35989,36019,36048,36078,36107,36136,36166,36195,36225,36254,36284,36314,36343,36373,36403,36433,36462,36492,36521,36551,36580,36610,36639,36669,36698,36728,36757,36786,36816,36845,36875,36904,36934,36963,36993,37022,37052,37081,37111,37141,37170,37200,37229,37259,37288,37318,37347,37377,37406,37436,37465,37495,37524,37554,37584,37613,37643,37672,37701,37731,37760,37790,37819,37849,37878,37908,37938,37967,37997,38027,38056,38085,38115,38144,38174,38203,38233,38262,38292,38322,38351,38381,38410,38440,38469,38499,38528,38558,38587,38617,38646,38676,38705,38735,38764,38794,38823,38853,38882,38912,38941,38971,39001,39030,39059,39089,39118,39148,39178,39208,39237,39267,39297,39326,39355,39385,39414,39444,39473,39503,39532,39562,39592,39621,39650,39680,39709,39739,39768,39798,39827,39857,39886,39916,39946,39975,40005,40035,40064,40094,40123,40153,40182,40212,40241,40271,40300,40330,40359,40389,40418,40448,40477,40507,40536,40566,40595,40625,40655,40685,40714,40744,40773,40803,40832,40862,40892,40921,40951,40980,41009,41039,41068,41098,41127,41157,41186,41216,41245,41275,41304,41334,41364,41393,41422,41452,41481,41511,41540,41570,41599,41629,41658,41688,41718,41748,41777,41807,41836,41865,41894,41924,41953,41983,42012,42042,42072,42102,42131,42161,42190,42220,42249,42279,42308,42337,42367,42397,42426,42456,42485,42515,42545,42574,42604,42633,42662,42692,42721,42751,42780,42810,42839,42869,42899,42929,42958,42988,43017,43046,43076,43105,43135,43164,43194,43223,43253,43283,43312,43342,43371,43401,43430,43460,43489,43519,43548,43578,43607,43637,43666,43696,43726,43755,43785,43814,43844,43873,43903,43932,43962,43991,44021,44050,44080,44109,44139,44169,44198,44228,44258,44287,44317,44346,44375,44405,44434,44464,44493,44523,44553,44582,44612,44641,44671,44700,44730,44759,44788,44818,44847,44877,44906,44936,44966,44996,45025,45055,45084,45114,45143,45172,45202,45231,45261,45290,45320,45350,45380,45409,45439,45468,45498,45527,45556,45586,45615,45644,45674,45704,45733,45763,45793,45823,45852,45882,45911,45940,45970,45999,46028,46058,46088,46117,46147,46177,46206,46236,46265,46295,46324,46354,46383,46413,46442,46472,46501,46531,46560,46590,46620,46649,46679,46708,46738,46767,46797,46826,46856,46885,46915,46944,46974,47003,47033,47063,47092,47122,47151,47181,47210,47240,47269,47298,47328,47357,47387,47417,47446,47476,47506,47535,47565,47594,47624,47653,47682,47712,47741,47771,47800,47830,47860,47890,47919,47949,47978,48008,48037,48066,48096,48125,48155,48184,48214,48244,48273,48303,48333,48362,48392,48421,48450,48480,48509,48538,48568,48598,48627,48657,48687,48717,48746,48776,48805,48834,48864,48893,48922,48952,48982,49011,49041,49071,49100,49130,49160,49189,49218,49248,49277,49306,49336,49365,49395,49425,49455,49484,49514,49543,49573,49602,49632,49661,49690,49720,49749,49779,49809,49838,49868,49898,49927,49957,49986,50016,50045,50075,50104,50133,50163,50192,50222,50252,50281,50311,50340,50370,50400,50429,50459,50488,50518,50547,50576,50606,50635,50665,50694,50724,50754,50784,50813,50843,50872,50902,50931,50960,50990,51019,51049,51078,51108,51138,51167,51197,51227,51256,51286,51315,51345,51374,51403,51433,51462,51492,51522,51552,51582,51611,51641,51670,51699,51729,51758,51787,51816,51846,51876,51906,51936,51965,51995,52025,52054,52083,52113,52142,52171,52200,52230,52260,52290,52319,52349,52379,52408,52438,52467,52497,52526,52555,52585,52614,52644,52673,52703,52733,52762,52792,52822,52851,52881,52910,52939,52969,52998,53028,53057,53087,53116,53146,53176,53205,53235,53264,53294,53324,53353,53383,53412,53441,53471,53500,53530,53559,53589,53619,53648,53678,53708,53737,53767,53796,53825,53855,53884,53913,53943,53973,54003,54032,54062,54092,54121,54151,54180,54209,54239,54268,54297,54327,54357,54387,54416,54446,54476,54505,54535,54564,54593,54623,54652,54681,54711,54741,54770,54800,54830,54859,54889,54919,54948,54977,55007,55036,55066,55095,55125,55154,55184,55213,55243,55273,55302,55332,55361,55391,55420,55450,55479,55508,55538,55567,55597,55627,55657,55686,55716,55745,55775,55804,55834,55863,55892,55922,55951,55981,56011,56040,56070,56100,56129,56159,56188,56218,56247,56276,56306,56335,56365,56394,56424,56454,56483,56513,56543,56572,56601,56631,56660,56690,56719,56749,56778,56808,56837,56867,56897,56926,56956,56985,57015,57044,57074,57103,57133,57162,57192,57221,57251,57280,57310,57340,57369,57399,57429,57458,57487,57517,57546,57576,57605,57634,57664,57694,57723,57753,57783,57813,57842,57871,57901,57930,57959,57989,58018,58048,58077,58107,58137,58167,58196,58226,58255,58285,58314,58343,58373,58402,58432,58461,58491,58521,58551,58580,58610,58639,58669,58698,58727,58757,58786,58816,58845,58875,58905,58934,58964,58994,59023,59053,59082,59111,59141,59170,59200,59229,59259,59288,59318,59348,59377,59407,59436,59466,59495,59525,59554,59584,59613,59643,59672,59702,59731,59761,59791,59820,59850,59879,59909,59939,59968,59997,60027,60056,60086,60115,60145,60174,60204,60234,60264,60293,60323,60352,60381,60411,60440,60469,60499,60528,60558,60588,60618,60648,60677,60707,60736,60765,60795,60824,60853,60883,60912,60942,60972,61002,61031,61061,61090,61120,61149,61179,61208,61237,61267,61296,61326,61356,61385,61415,61445,61474,61504,61533,61563,61592,61621,61651,61680,61710,61739,61769,61799,61828,61858,61888,61917,61947,61976,62006,62035,62064,62094,62123,62153,62182,62212,62242,62271,62301,62331,62360,62390,62419,62448,62478,62507,62537,62566,62596,62625,62655,62685,62715,62744,62774,62803,62832,62862,62891,62921,62950,62980,63009,63039,63069,63099,63128,63157,63187,63216,63246,63275,63305,63334,63363,63393,63423,63453,63482,63512,63541,63571,63600,63630,63659,63689,63718,63747,63777,63807,63836,63866,63895,63925,63955,63984,64014,64043,64073,64102,64131,64161,64190,64220,64249,64279,64309,64339,64368,64398,64427,64457,64486,64515,64545,64574,64603,64633,64663,64692,64722,64752,64782,64811,64841,64870,64899,64929,64958,64987,65017,65047,65076,65106,65136,65166,65195,65225,65254,65283,65313,65342,65371,65401,65431,65460,65490,65520,65549,65579,65608,65638,65667,65697,65726,65755,65785,65815,65844,65874,65903,65933,65963,65992,66022,66051,66081,66110,66140,66169,66199,66228,66258,66287,66317,66346,66376,66405,66435,66465,66494,66524,66553,66583,66612,66641,66671,66700,66730,66760,66789,66819,66849,66878,66908,66937,66967,66996,67025,67055,67084,67114,67143,67173,67203,67233,67262,67292,67321,67351,67380,67409,67439,67468,67497,67527,67557,67587,67617,67646,67676,67705,67735,67764,67793,67823,67852,67882,67911,67941,67971,68e3,68030,68060,68089,68119,68148,68177,68207,68236,68266,68295,68325,68354,68384,68414,68443,68473,68502,68532,68561,68591,68620,68650,68679,68708,68738,68768,68797,68827,68857,68886,68916,68946,68975,69004,69034,69063,69092,69122,69152,69181,69211,69240,69270,69300,69330,69359,69388,69418,69447,69476,69506,69535,69565,69595,69624,69654,69684,69713,69743,69772,69802,69831,69861,69890,69919,69949,69978,70008,70038,70067,70097,70126,70156,70186,70215,70245,70274,70303,70333,70362,70392,70421,70451,70481,70510,70540,70570,70599,70629,70658,70687,70717,70746,70776,70805,70835,70864,70894,70924,70954,70983,71013,71042,71071,71101,71130,71159,71189,71218,71248,71278,71308,71337,71367,71397,71426,71455,71485,71514,71543,71573,71602,71632,71662,71691,71721,71751,71781,71810,71839,71869,71898,71927,71957,71986,72016,72046,72075,72105,72135,72164,72194,72223,72253,72282,72311,72341,72370,72400,72429,72459,72489,72518,72548,72577,72607,72637,72666,72695,72725,72754,72784,72813,72843,72872,72902,72931,72961,72991,73020,73050,73080,73109,73139,73168,73197,73227,73256,73286,73315,73345,73375,73404,73434,73464,73493,73523,73552,73581,73611,73640,73669,73699,73729,73758,73788,73818,73848,73877,73907,73936,73965,73995,74024,74053,74083,74113,74142,74172,74202,74231,74261,74291,74320,74349,74379,74408,74437,74467,74497,74526,74556,74586,74615,74645,74675,74704,74733,74763,74792,74822,74851,74881,74910,74940,74969,74999,75029,75058,75088,75117,75147,75176,75206,75235,75264,75294,75323,75353,75383,75412,75442,75472,75501,75531,75560,75590,75619,75648,75678,75707,75737,75766,75796,75826,75856,75885,75915,75944,75974,76003,76032,76062,76091,76121,76150,76180,76210,76239,76269,76299,76328,76358,76387,76416,76446,76475,76505,76534,76564,76593,76623,76653,76682,76712,76741,76771,76801,76830,76859,76889,76918,76948,76977,77007,77036,77066,77096,77125,77155,77185,77214,77243,77273,77302,77332,77361,77390,77420,77450,77479,77509,77539,77569,77598,77627,77657,77686,77715,77745,77774,77804,77833,77863,77893,77923,77952,77982,78011,78041,78070,78099,78129,78158,78188,78217,78247,78277,78307,78336,78366,78395,78425,78454,78483,78513,78542,78572,78601,78631,78661,78690,78720,78750,78779,78808,78838,78867,78897,78926,78956,78985,79015,79044,79074,79104,79133,79163,79192,79222,79251,79281,79310,79340,79369,79399,79428,79458,79487,79517,79546,79576,79606,79635,79665,79695,79724,79753,79783,79812,79841,79871,79900,79930,79960,79990]}}),qr=g({"src/components/calendars/calendars.js"(t,r){r.exports=UX(),UK(),UJ(),UQ(),U0(),U1(),U2(),U3(),U5(),U4(),U6(),U8(),U7(),U9(),qe(),qt()}}),qi=g({"src/components/calendars/index.js"(t,r){var i=qr(),n=t_(),a=P(),o=a.EPOCHJD,s=a.ONEDAY,l={valType:"enumerated",values:n.sortObjectKeys(i.calendars),editType:"calc",dflt:"gregorian"},u=function(t,r,i,a){var o={};return o[i]=l,n.coerce(t,r,o,i,a)},c={d:{0:"dd","-":"d"},e:{0:"d","-":"d"},a:{0:"D","-":"D"},A:{0:"DD","-":"DD"},j:{0:"oo","-":"o"},W:{0:"ww","-":"w"},m:{0:"mm","-":"m"},b:{0:"M","-":"M"},B:{0:"MM","-":"MM"},y:{0:"yy","-":"yy"},Y:{0:"yyyy","-":"yyyy"},U:"##",w:"##",c:{0:"D M d %X yyyy","-":"D M d %X yyyy"},x:{0:"mm/dd/yyyy","-":"mm/dd/yyyy"}},h={};function d(t){var r=h[t];return r||(r=h[t]=i.instance(t))}function f(t){return n.extendFlat({},l,{description:t})}function p(t){return"Sets the calendar system to use with `"+t+"` date data."}var m={xcalendar:f(p("x"))},g=n.extendFlat({},m,{ycalendar:f(p("y"))}),y=n.extendFlat({},g,{zcalendar:f(p("z"))}),v=f("Sets the calendar system to use for `range` and `tick0` if this is a date axis. This does not set the calendar for interpreting data on this axis, that's specified in the trace or via the global `layout.calendar`");r.exports={moduleType:"component",name:"calendars",schema:{traces:{scatter:g,bar:g,box:g,heatmap:g,contour:g,histogram:g,histogram2d:g,histogram2dcontour:g,scatter3d:y,surface:y,mesh3d:y,scattergl:g,ohlc:m,candlestick:m},layout:{calendar:f("Sets the default calendar system to use for interpreting and displaying dates throughout the plot.")},subplots:{xaxis:{calendar:v},yaxis:{calendar:v},scene:{xaxis:{calendar:v},yaxis:{calendar:v},zaxis:{calendar:v}},polar:{radialaxis:{calendar:v}}}},layoutAttributes:l,handleDefaults:u,handleTraceDefaults:function(t,r,i,n){for(var a=0;a{n.preventDefault(),n.stopPropagation(),n.clipboardData.setData("text",t),r.removeEventListener("copy",i,!0)};r.addEventListener("copy",i,!0),document.execCommand("copy")},(G=X||(X={})).boxSizing=function(t){let r=window.getComputedStyle(t),i=parseFloat(r.borderTopWidth)||0,n=parseFloat(r.borderLeftWidth)||0,a=parseFloat(r.borderRightWidth)||0,o=parseFloat(r.borderBottomWidth)||0,s=parseFloat(r.paddingTop)||0,l=parseFloat(r.paddingLeft)||0,u=parseFloat(r.paddingRight)||0,c=parseFloat(r.paddingBottom)||0;return{borderTop:i,borderLeft:n,borderRight:a,borderBottom:o,paddingTop:s,paddingLeft:l,paddingRight:u,paddingBottom:c,horizontalSum:n+l+u+a,verticalSum:i+s+c+o}},G.sizeLimits=function(t){let r=window.getComputedStyle(t),i=parseFloat(r.minWidth)||0,n=parseFloat(r.minHeight)||0,a=parseFloat(r.maxWidth)||1/0,o=parseFloat(r.maxHeight)||1/0;return a=Math.max(i,a),o=Math.max(n,o),{minWidth:i,minHeight:n,maxWidth:a,maxHeight:o}},G.hitTest=function(t,r,i){let n=t.getBoundingClientRect();return r>=n.left&&r=n.top&&i=i.bottom)){if(n.topi.bottom&&n.height>=i.height){t.scrollTop-=i.top-n.top;return}if(n.topi.height||n.bottom>i.bottom&&n.height0;){if(f(a)){r++;continue}if(f(o)||f(s)){i++;continue}if(f(u)){n++;continue}if(f(c)){i++;continue}if(f(l)){n++;continue}if(!f(h))return 0}return(r=Math.min(r,255))<<16|(i=Math.min(i,255))<<8|(n=Math.min(n,255))},a=/^#[^\s\+>~#\.\[:]+/,o=/^\.[^\s\+>~#\.\[:]+/,s=/^\[[^\]]+\]/,l=/^[^\s\+>~#\.\[:]+/,u=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,c=/^:[^\s\+>~#\.\[:]+/,h=/^[\s\+>~\*]+/,d=/:not\(([^\)]+)\)/g;var U=O(R()),q=class{constructor(){this._first=null,this._last=null,this._size=0}get isEmpty(){return 0===this._size}get size(){return this._size}get length(){return this._size}get first(){return this._first?this._first.value:void 0}get last(){return this._last?this._last.value:void 0}get firstNode(){return this._first}get lastNode(){return this._last}*[Symbol.iterator](){let t=this._first;for(;t;)yield t.value,t=t.next}*retro(){let t=this._last;for(;t;)yield t.value,t=t.prev}*nodes(){let t=this._first;for(;t;)yield t,t=t.next}*retroNodes(){let t=this._last;for(;t;)yield t,t=t.prev}assign(t){for(let r of(this.clear(),t))this.addLast(r)}push(t){this.addLast(t)}pop(){return this.removeLast()}shift(t){this.addFirst(t)}unshift(){return this.removeFirst()}addFirst(t){let r=new ee.LinkedListNode(this,t);return this._first?(r.next=this._first,this._first.prev=r,this._first=r):(this._first=r,this._last=r),this._size++,r}addLast(t){let r=new ee.LinkedListNode(this,t);return this._last?(r.prev=this._last,this._last.next=r):this._first=r,this._last=r,this._size++,r}insertBefore(t,r){if(!r||r===this._first)return this.addFirst(t);if(!(r instanceof ee.LinkedListNode)||r.list!==this)throw Error("Reference node is not owned by the list.");let i=new ee.LinkedListNode(this,t),n=r.prev;return i.next=r,i.prev=n,r.prev=i,n.next=i,this._size++,i}insertAfter(t,r){if(!r||r===this._last)return this.addLast(t);if(!(r instanceof ee.LinkedListNode)||r.list!==this)throw Error("Reference node is not owned by the list.");let i=new ee.LinkedListNode(this,t),n=r.next;return i.next=n,i.prev=r,r.next=i,n.prev=i,this._size++,i}removeFirst(){let t=this._first;if(t)return t===this._last?(this._first=null,this._last=null):(this._first=t.next,this._first.prev=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value}removeLast(){let t=this._last;if(t)return t===this._first?(this._first=null,this._last=null):(this._last=t.prev,this._last.next=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value}removeNode(t){if(!(t instanceof ee.LinkedListNode)||t.list!==this)throw Error("Node is not owned by the list.");t===this._first&&t===this._last?(this._first=null,this._last=null):t===this._first?(this._first=t.next,this._first.prev=null):t===this._last?(this._last=t.prev,this._last.next=null):(t.next.prev=t.prev,t.prev.next=t.next),t.list=null,t.next=null,t.prev=null,this._size--}clear(){let t=this._first;for(;t;){let r=t.next;t.list=null,t.prev=null,t.next=null,t=r}this._first=null,this._last=null,this._size=0}};(Y=q||(q={})).from=function(t){let r=new Y;return r.assign(t),r},(ee||(ee={})).LinkedListNode=class{constructor(t,r){this.list=null,this.next=null,this.prev=null,this.list=t,this.value=r}};var G,H,$,W,Y,Z,X,K,J,Q,ee,et,er=class{constructor(t){this.type=t}get isConflatable(){return!1}conflate(t){return!1}},ei=class extends er{get isConflatable(){return!0}conflate(t){return!0}};!function(t){let r,i=null,n=(r=Promise.resolve(),t=>{let i=!1;return r.then(()=>!i&&t()),()=>{i=!0}});function a(t,r){let i=s.get(t);i&&0!==i.length?(0,U.every)((0,U.retro)(i),i=>!i||function(t,r,i){let n=!0;try{n="function"==typeof t?t(r,i):t.messageHook(r,i)}catch(t){u(t)}return n}(i,t,r))&&h(t,r):h(t,r)}t.sendMessage=a,t.postMessage=function(t,r){r.isConflatable&&(0,U.some)(o,i=>i.handler===t&&!!i.msg&&i.msg.type===r.type&&!!i.msg.isConflatable&&i.msg.conflate(r))||d(t,r)},t.installMessageHook=function(t,r){let i=s.get(t);i&&-1!==i.indexOf(r)||(i?i.push(r):s.set(t,[r]))},t.removeMessageHook=function(t,r){let i=s.get(t);if(!i)return;let n=i.indexOf(r);-1!==n&&(i[n]=null,p(i))},t.clearData=function(t){let r=s.get(t);for(let i of(r&&r.length>0&&(U.ArrayExt.fill(r,null),p(r)),o))i.handler===t&&(i.handler=null,i.msg=null)},t.flush=function(){c||null===i||(i(),i=null,c=!0,f(),c=!1)},t.getExceptionHandler=function(){return u},t.setExceptionHandler=function(t){let r=u;return u=t,r};let o=new q,s=new WeakMap,l=new Set,u=t=>{console.error(t)},c=!1;function h(t,r){try{t.processMessage(r)}catch(t){u(t)}}function d(t,r){o.addLast({handler:t,msg:r}),null===i&&(i=n(f))}function f(){if(i=null,o.isEmpty)return;let t={handler:null,msg:null};for(o.addLast(t);;){let r=o.removeFirst();if(r===t)return;r.handler&&r.msg&&a(r.handler,r.msg)}}function p(t){0===l.size&&n(m),l.add(t)}function m(){l.forEach(g),l.clear()}function g(t){U.ArrayExt.removeAllWhere(t,y)}function y(t){return null===t}}(et||(et={}));var en=class{constructor(t){this._pid=ew.nextPID(),this.name=t.name,this._create=t.create,this._coerce=t.coerce||null,this._compare=t.compare||null,this._changed=t.changed||null}get(t){let r=ew.ensureMap(t);return this._pid in r?r[this._pid]:r[this._pid]=this._createValue(t)}set(t,r){let i,n=ew.ensureMap(t);i=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(t);let a=this._coerceValue(t,r);this._maybeNotify(t,i,n[this._pid]=a)}coerce(t){let r,i=ew.ensureMap(t);r=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(t);let n=this._coerceValue(t,r);this._maybeNotify(t,r,i[this._pid]=n)}_createValue(t){return(0,this._create)(t)}_coerceValue(t,r){let i=this._coerce;return i?i(t,r):r}_compareValue(t,r){let i=this._compare;return i?i(t,r):t===r}_maybeNotify(t,r,i){let n=this._changed;n&&!this._compareValue(r,i)&&n(t,r,i)}};(en||(en={})).clearData=function(t){ew.ownerData.delete(t)},(ey=ew||(ew={})).ownerData=new WeakMap,f=0,ey.nextPID=()=>`pid-${`${Math.random()}`.slice(2)}-${f++}`,ey.ensureMap=function(t){let r=ey.ownerData.get(t);return r||(r=Object.create(null),ey.ownerData.set(t,r),r)};var ea=O(R()),eo=(O(B()),class{constructor(t){this.sender=t}connect(t,r){return eT.connect(this,t,r)}disconnect(t,r){return eT.disconnect(this,t,r)}emit(t){eT.emit(this,t)}});(ev=eo||(eo={})).disconnectBetween=function(t,r){eT.disconnectBetween(t,r)},ev.disconnectSender=function(t){eT.disconnectSender(t)},ev.disconnectReceiver=function(t){eT.disconnectReceiver(t)},ev.disconnectAll=function(t){eT.disconnectAll(t)},ev.clearData=function(t){eT.disconnectAll(t)},ev.getExceptionHandler=function(){return eT.exceptionHandler},ev.setExceptionHandler=function(t){let r=eT.exceptionHandler;return eT.exceptionHandler=t,r},function(t){function r(t){let r=n.get(t);if(!(!r||0===r.length)){for(let t of r){if(!t.signal)continue;let r=t.thisArg||t.slot;t.signal=null,u(a.get(r))}u(r)}}function i(t){let r=a.get(t);if(!(!r||0===r.length)){for(let t of r){if(!t.signal)continue;let r=t.signal.sender;t.signal=null,u(n.get(r))}u(r)}}t.exceptionHandler=t=>{console.error(t)},t.connect=function(t,r,i){i=i||void 0;let o=n.get(t.sender);if(o||(o=[],n.set(t.sender,o)),l(o,t,r,i))return!1;let s=i||r,u=a.get(s);u||(u=[],a.set(s,u));let c={signal:t,slot:r,thisArg:i};return o.push(c),u.push(c),!0},t.disconnect=function(t,r,i){i=i||void 0;let o=n.get(t.sender);if(!o||0===o.length)return!1;let s=l(o,t,r,i);if(!s)return!1;let c=i||r,h=a.get(c);return s.signal=null,u(o),u(h),!0},t.disconnectBetween=function(t,r){let i=n.get(t);if(!i||0===i.length)return;let o=a.get(r);if(!(!o||0===o.length)){for(let r of o)r.signal&&r.signal.sender===t&&(r.signal=null);u(i),u(o)}},t.disconnectSender=r,t.disconnectReceiver=i,t.disconnectAll=function(t){r(t),i(t)},t.emit=function(r,i){let a=n.get(r.sender);if(!(!a||0===a.length))for(let n=0,o=a.length;nt.signal===r&&t.slot===i&&t.thisArg===n)}function u(t){0===o.size&&s(c),o.add(t)}function c(){o.forEach(h),o.clear()}function h(t){ea.ArrayExt.removeAllWhere(t,d)}function d(t){return null===t.signal}}(eT||(eT={}));var es=class{constructor(t){this._fn=t}get isDisposed(){return!this._fn}dispose(){if(!this._fn)return;let t=this._fn;this._fn=null,t()}},el=class{constructor(){this._isDisposed=!1,this._items=new Set}get isDisposed(){return this._isDisposed}dispose(){this._isDisposed||(this._isDisposed=!0,this._items.forEach(t=>{t.dispose()}),this._items.clear())}contains(t){return this._items.has(t)}add(t){this._items.add(t)}remove(t){this._items.delete(t)}clear(){this._items.clear()}};(ex=el||(el={})).from=function(t){let r=new ex;for(let i of t)r.add(i);return r};var eu=class extends el{constructor(){super(...arguments),this._disposed=new eo(this)}get disposed(){return this._disposed}dispose(){this.isDisposed||(super.dispose(),this._disposed.emit(void 0),eo.clearData(this))}};(eb=eu||(eu={})).from=function(t){let r=new eb;for(let i of t)r.add(i);return r};var ec=class t{constructor(t){this._onScrollFrame=()=>{if(!this._scrollTarget)return;let{element:t,edge:r,distance:i}=this._scrollTarget,n=Math.max(1,Math.round(Math.pow((eA.SCROLL_EDGE_SIZE-i)/eA.SCROLL_EDGE_SIZE,2)*eA.SCROLL_EDGE_SIZE));switch(r){case"top":t.scrollTop-=n;break;case"left":t.scrollLeft-=n;break;case"right":t.scrollLeft+=n;break;case"bottom":t.scrollTop+=n}requestAnimationFrame(this._onScrollFrame)},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.document=t.document||document,this.mimeData=t.mimeData,this.dragImage=t.dragImage||null,this.proposedAction=t.proposedAction||"copy",this.supportedActions=t.supportedActions||"all",this.source=t.source||null}dispose(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){let t=new PointerEvent("pointerup",{bubbles:!0,cancelable:!0,clientX:-1,clientY:-1});eA.dispatchDragLeave(this,this._currentTarget,null,t)}this._finalize("none")}}get isDisposed(){return this._disposed}start(t,r){if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(t,r),this._promise=new Promise(t=>{this._resolve=t});let i=new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,clientX:t,clientY:r});return document.dispatchEvent(i),this._promise}handleEvent(t){switch(t.type){case"pointermove":this._evtPointerMove(t);break;case"pointerup":this._evtPointerUp(t);break;case"keydown":this._evtKeyDown(t);break;default:t.preventDefault(),t.stopPropagation()}}moveDragImage(t,r){this.dragImage&&(this.dragImage.style.transform=`translate(${t}px, ${r}px)`)}_evtPointerMove(t){t.preventDefault(),t.stopPropagation(),this._updateCurrentTarget(t),this._updateDragScroll(t),this.moveDragImage(t.clientX,t.clientY)}_evtPointerUp(t){if(t.preventDefault(),t.stopPropagation(),0!==t.button)return;if(this._updateCurrentTarget(t),!this._currentTarget)return void this._finalize("none");if("none"===this._dropAction){eA.dispatchDragLeave(this,this._currentTarget,null,t),this._finalize("none");return}let r=eA.dispatchDrop(this,this._currentTarget,t);this._finalize(r)}_evtKeyDown(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&this.dispose()}_addListeners(){document.addEventListener("pointerdown",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("pointerup",this,!0),document.addEventListener("pointerenter",this,!0),document.addEventListener("pointerleave",this,!0),document.addEventListener("pointerover",this,!0),document.addEventListener("pointerout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)}_removeListeners(){document.removeEventListener("pointerdown",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointerenter",this,!0),document.removeEventListener("pointerleave",this,!0),document.removeEventListener("pointerover",this,!0),document.removeEventListener("pointerout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)}_updateDragScroll(t){let r=eA.findScrollTarget(t);(this._scrollTarget||r)&&(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=r)}_updateCurrentTarget(t){let r=this._currentTarget,i=this._currentTarget,n=this._currentElement,a=eA.findElementBehindBackdrop(t,this.document);this._currentElement=a,a!==n&&a!==i&&eA.dispatchDragExit(this,i,a,t),a!==n&&a!==i&&(i=eA.dispatchDragEnter(this,a,i,t)),i!==r&&(this._currentTarget=i,eA.dispatchDragLeave(this,r,i,t));let o=eA.dispatchDragOver(this,i,t);this._setDropAction(o)}_attachDragImage(t,r){if(!this.dragImage)return;this.dragImage.classList.add("lm-mod-drag-image");let i=this.dragImage.style;i.pointerEvents="none",i.position="fixed",i.transform=`translate(${t}px, ${r}px)`,(this.document instanceof Document?this.document.body:this.document.firstElementChild).appendChild(this.dragImage)}_detachDragImage(){if(!this.dragImage)return;let t=this.dragImage.parentNode;t&&t.removeChild(this.dragImage)}_setDropAction(r){if(r=eA.validateAction(r,this.supportedActions),!(this._override&&this._dropAction===r))switch(r){case"none":this._dropAction=r,this._override=t.overrideCursor("no-drop",this.document);break;case"copy":this._dropAction=r,this._override=t.overrideCursor("copy",this.document);break;case"link":this._dropAction=r,this._override=t.overrideCursor("alias",this.document);break;case"move":this._dropAction=r,this._override=t.overrideCursor("move",this.document)}}_finalize(t){let r=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,r&&r(t)}},eh=ec||(ec={});class ed extends DragEvent{constructor(t,r){super(r.type,{bubbles:!0,cancelable:!0,altKey:t.altKey,button:t.button,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,detail:0,metaKey:t.metaKey,relatedTarget:r.related,screenX:t.screenX,screenY:t.screenY,shiftKey:t.shiftKey,view:window});let{drag:i}=r;this.dropAction="none",this.mimeData=i.mimeData,this.proposedAction=i.proposedAction,this.supportedActions=i.supportedActions,this.source=i.source}}eh.Event=ed,eh.overrideCursor=function(t,r=document){return eA.overrideCursor(t,r)},function(t){let r;function i(r,o=document){if(r){if(n&&r==n.event)return n.element;t.cursorBackdrop.style.zIndex="-1000";let i=o.elementFromPoint(r.clientX,r.clientY);return t.cursorBackdrop.style.zIndex="",n={event:r,element:i},i}{let r=t.cursorBackdrop.style.transform;if(a&&r===a.transform)return a.element;let i=t.cursorBackdrop.getBoundingClientRect();t.cursorBackdrop.style.zIndex="-1000";let n=o.elementFromPoint(i.left+i.width/2,i.top+i.height/2);return t.cursorBackdrop.style.zIndex="",a={transform:r,element:n},n}}t.SCROLL_EDGE_SIZE=20,t.validateAction=function(t,r){return o[t]&s[r]?t:"none"},t.findElementBehindBackdrop=i;let n=null,a=null;t.findScrollTarget=function(r){let n=r.clientX,a=r.clientY,o=i(r);for(;o;o=o.parentElement){let r;if(!o.hasAttribute("data-lm-dragscroll"))continue;let i=0,s=0;o===document.body&&(i=window.pageXOffset,s=window.pageYOffset);let l=o.getBoundingClientRect(),u=l.top+s,c=l.left+i,h=c+l.width,d=u+l.height;if(n=h||a=d)continue;let f=n-c+1,p=a-u+1,m=h-n,g=d-a,y=Math.min(f,p,m,g);if(y>t.SCROLL_EDGE_SIZE)continue;switch(y){case g:r="bottom";break;case p:r="top";break;case m:r="right";break;case f:r="left";break;default:throw"unreachable"}let v=o.scrollWidth-o.clientWidth,x=o.scrollHeight-o.clientHeight,b;switch(r){case"top":b=x>0&&o.scrollTop>0;break;case"left":b=v>0&&o.scrollLeft>0;break;case"right":b=v>0&&o.scrollLeft0&&o.scrollTop{n===d&&t.cursorBackdrop.isConnected&&(document.removeEventListener("pointermove",l,!0),t.cursorBackdrop.removeEventListener("scroll",u,!0),a.removeChild(t.cursorBackdrop))})};let h=500,d=0;(r=document.createElement("div")).classList.add("lm-cursor-backdrop"),t.cursorBackdrop=r}(eA||(eA={}));var ef=O(R()),ep=O(B());function em(){return eM.keyboardLayout}var eg=class t{constructor(r,i,n=[]){this.name=r,this._codes=i,this._keys=t.extractKeys(i),this._modifierKeys=t.convertToKeySet(n)}keys(){return Object.keys(this._keys)}isValidKey(t){return t in this._keys}isModifierKey(t){return t in this._modifierKeys}keyForKeydownEvent(t){return this._codes[t.keyCode]||""}};(e_=eg||(eg={})).extractKeys=function(t){let r=Object.create(null);for(let i in t)r[t[i]]=!0;return r},e_.convertToKeySet=function(t){let r=Object(null);for(let i=0,n=t.length;i{this._commands.delete(t),this._commandChanged.emit({id:t,type:"removed"})})}notifyCommandChanged(t){if(void 0!==t&&!this._commands.has(t))throw Error(`Command '${t}' is not registered.`);this._commandChanged.emit({id:t,type:t?"changed":"many-changed"})}describedBy(t,r=ep.JSONExt.emptyObject){var i;let n=this._commands.get(t);return Promise.resolve(null!=(i=n?.describedBy.call(void 0,r))?i:{args:null})}label(t,r=ep.JSONExt.emptyObject){var i;let n=this._commands.get(t);return null!=(i=n?.label.call(void 0,r))?i:""}mnemonic(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.mnemonic.call(void 0,r):-1}icon(t,r=ep.JSONExt.emptyObject){var i;return null==(i=this._commands.get(t))?void 0:i.icon.call(void 0,r)}iconClass(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.iconClass.call(void 0,r):""}iconLabel(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.iconLabel.call(void 0,r):""}caption(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.caption.call(void 0,r):""}usage(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.usage.call(void 0,r):""}className(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.className.call(void 0,r):""}dataset(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return i?i.dataset.call(void 0,r):{}}isEnabled(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isEnabled.call(void 0,r)}isToggled(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isToggled.call(void 0,r)}isToggleable(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isToggleable}isVisible(t,r=ep.JSONExt.emptyObject){let i=this._commands.get(t);return!!i&&i.isVisible.call(void 0,r)}execute(t,r=ep.JSONExt.emptyObject){let i,n=this._commands.get(t);if(!n)return Promise.reject(Error(`Command '${t}' not registered.`));try{i=n.execute.call(void 0,r)}catch(t){i=Promise.reject(t)}let a=Promise.resolve(i);return this._commandExecuted.emit({id:t,args:r,result:a}),a}addKeyBinding(t){let r=eN.createKeyBinding(t);return this._keyBindings.push(r),this._keyBindingChanged.emit({binding:r,type:"added"}),new es(()=>{ef.ArrayExt.removeFirstOf(this._keyBindings,r),this._keyBindingChanged.emit({binding:r,type:"removed"})})}processKeydownEvent(r){if(r.defaultPrevented||this._replaying)return;let i=t.keystrokeForKeydownEvent(r);if(!i){this._replayKeydownEvents(),this._clearPendingState();return}if(t.isModifierKeyPressed(r)){let{exact:t}=eN.matchKeyBinding(this._keyBindings,[i],r);t?(r.preventDefault(),r.stopPropagation(),this._startModifierTimer(t)):this._clearModifierTimer();return}this._keystrokes.push(i);let{exact:n,partial:a}=eN.matchKeyBinding(this._keyBindings,this._keystrokes,r),o=0!==a.length;if(!n&&!o){this._replayKeydownEvents(),this._clearPendingState();return}if((n?.preventDefault||a.some(t=>t.preventDefault))&&(r.preventDefault(),r.stopPropagation()),this._keydownEvents.push(r),n&&!o){this._executeKeyBinding(n),this._clearPendingState();return}n&&(this._exactKeyMatch=n),this._startTimer()}holdKeyBindingExecution(t,r){this._holdKeyBindingPromises.set(t,r)}processKeyupEvent(t){this._clearModifierTimer()}_startModifierTimer(t){this._clearModifierTimer(),this._timerModifierID=window.setTimeout(()=>{this._executeKeyBinding(t)},eN.modifierkeyTimeOut)}_clearModifierTimer(){0!==this._timerModifierID&&(clearTimeout(this._timerModifierID),this._timerModifierID=0)}_startTimer(){this._clearTimer(),this._timerID=window.setTimeout(()=>{this._onPendingTimeout()},eN.CHORD_TIMEOUT)}_clearTimer(){0!==this._timerID&&(clearTimeout(this._timerID),this._timerID=0)}_replayKeydownEvents(){0!==this._keydownEvents.length&&(this._replaying=!0,this._keydownEvents.forEach(eN.replayKeyEvent),this._replaying=!1)}async _executeKeyBinding(t){if(0!==this._holdKeyBindingPromises.size){let t=[...this._keydownEvents],r=(await Promise.race([Promise.all(t.map(async t=>{var r;return null!=(r=this._holdKeyBindingPromises.get(t))?r:Promise.resolve(!0)})),new Promise(t=>{setTimeout(()=>t([!1]),eN.KEYBINDING_HOLD_TIMEOUT)})])).every(Boolean);if(this._holdKeyBindingPromises.clear(),!r)return}let{command:r,args:i}=t,n={_luminoEvent:{type:"keybinding",keys:t.keys},...i};if(!this.hasCommand(r)||!this.isEnabled(r,n)){let i=this.hasCommand(r)?"enabled":"registered",n=`Cannot execute key binding '${t.keys.join(", ")}':`,a=`command '${r}' is not ${i}.`;console.warn(`${n} ${a}`);return}await this.execute(r,n)}_clearPendingState(){this._clearTimer(),this._clearModifierTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0}_onPendingTimeout(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()}},eE=eS||(eS={});function eD(t){let r="",i=!1,n=!1,a=!1,o=!1;for(let s of t.split(/\s+/))"Accel"===s?K.IS_MAC?n=!0:a=!0:"Alt"===s?i=!0:"Cmd"===s?n=!0:"Ctrl"===s?a=!0:"Shift"===s?o=!0:s.length>0&&(r=s);return{cmd:n,ctrl:a,alt:i,shift:o,key:r}}function eC(t){let r="",i=eD(t);return i.ctrl&&(r+="Ctrl "),i.alt&&(r+="Alt "),i.shift&&(r+="Shift "),i.cmd&&K.IS_MAC&&(r+="Cmd "),i.key?r+i.key:r.trim()}eE.parseKeystroke=eD,eE.normalizeKeystroke=eC,eE.normalizeKeys=function(t){return(K.IS_WIN?t.winKeys||t.keys:K.IS_MAC?t.macKeys||t.keys:t.linuxKeys||t.keys).map(eC)},eE.formatKeystroke=function(t){return"string"==typeof t?r(t):t.map(r).join(", ");function r(t){let r=[],i=K.IS_MAC?" ":"+",n=eD(t);return n.ctrl&&r.push("Ctrl"),n.alt&&r.push("Alt"),n.shift&&r.push("Shift"),K.IS_MAC&&n.cmd&&r.push("Cmd"),r.push(n.key),r.map(eN.formatKey).join(i)}},eE.isModifierKeyPressed=function(t){let r=em(),i=r.keyForKeydownEvent(t);return r.isModifierKey(i)},eE.keystrokeForKeydownEvent=function(t){let r=em(),i=r.keyForKeydownEvent(t),n=[];return t.ctrlKey&&n.push("Ctrl"),t.altKey&&n.push("Alt"),t.shiftKey&&n.push("Shift"),t.metaKey&&K.IS_MAC&&n.push("Cmd"),r.isModifierKey(i)||n.push(i),n.join(" ")},function(t){t.CHORD_TIMEOUT=1e3,t.KEYBINDING_HOLD_TIMEOUT=1e3,t.modifierkeyTimeOut=500,t.createCommand=function(t){return{execute:t.execute,describedBy:c("function"==typeof t.describedBy?t.describedBy:{args:null,...t.describedBy},()=>({args:null})),label:c(t.label,n),mnemonic:c(t.mnemonic,a),icon:c(t.icon,u),iconClass:c(t.iconClass,n),iconLabel:c(t.iconLabel,n),caption:c(t.caption,n),usage:c(t.usage,n),className:c(t.className,n),dataset:c(t.dataset,l),isEnabled:t.isEnabled||o,isToggled:t.isToggled||s,isToggleable:t.isToggleable||!!t.isToggled,isVisible:t.isVisible||o}},t.createKeyBinding=function(t){var r;return{keys:eS.normalizeKeys(t),selector:function(t){if(-1!==t.selector.indexOf(","))throw Error(`Selector cannot contain commas: ${t.selector}`);if(!J.isValid(t.selector))throw Error(`Invalid selector: ${t.selector}`);return t.selector}(t),command:t.command,args:t.args||ep.JSONExt.emptyObject,preventDefault:null==(r=t.preventDefault)||r}},t.matchKeyBinding=function(t,r,i){let n=null,a=[],o=1/0,s=0;for(let l=0,u=t.length;lr.length?2:1}(u.keys,r);if(0===c)continue;if(2===c){-1!==h(u.selector,i)&&a.push(u);continue}let d=h(u.selector,i);if(-1===d||d>o)continue;let f=J.calculateSpecificity(u.selector);(!n||d=s)&&(n=u,o=d,s=f)}return{exact:n,partial:a}},t.replayKeyEvent=function(t){var r;let i,n,a;t.target.dispatchEvent((r=t,i=document.createEvent("Event"),n=r.bubbles||!0,a=r.cancelable||!0,i.initEvent(r.type||"keydown",n,a),i.key=r.key||"",i.keyCode=r.keyCode||0,i.which=r.keyCode||0,i.ctrlKey=r.ctrlKey||!1,i.altKey=r.altKey||!1,i.shiftKey=r.shiftKey||!1,i.metaKey=r.metaKey||!1,i.view=r.view||window,i))},t.formatKey=function(t){return K.IS_MAC?r.hasOwnProperty(t)?r[t]:t:i.hasOwnProperty(t)?i[t]:t};let r={Backspace:"⌫",Tab:"⇥",Enter:"⏎",Shift:"⇧",Ctrl:"⌃",Alt:"⌥",Escape:"⎋",PageUp:"⇞",PageDown:"⇟",End:"↘",Home:"↖",ArrowLeft:"←",ArrowUp:"↑",ArrowRight:"→",ArrowDown:"↓",Delete:"⌦",Cmd:"⌘"},i={Escape:"Esc",PageUp:"Page Up",PageDown:"Page Down",ArrowLeft:"Left",ArrowUp:"Up",ArrowRight:"Right",ArrowDown:"Down",Delete:"Del"},n=()=>"",a=()=>-1,o=()=>!0,s=()=>!1,l=()=>({}),u=()=>{};function c(t,r){return void 0===t?r:"function"==typeof t?t:()=>t}function h(t,r){let i=r.target,n=r.currentTarget;for(let r=0;null!==i&&!i.hasAttribute("data-lm-suppress-shortcuts");i=i.parentElement,++r){if(J.matches(i,t))return r;if(i===n)break}return -1}}(eN||(eN={}));var eI=O(R()),eL=class{constructor(t){this.type="text",this.content=t}},eP=class{constructor(t,r,i,n){this.type="element",this.tag=t,this.attrs=r,this.children=i,this.renderer=n}};function ez(t){let r={},i,n=[];for(let t=1,a=arguments.length;t=o.length){eO(n[i],r);continue}let l=o[i],u=n[i];if(l===u){s=s.nextSibling;continue}if("text"===l.type&&"text"===u.type){s.textContent!==u.content&&(s.textContent=u.content),s=s.nextSibling;continue}if("text"===l.type||"text"===u.type||!l.renderer!=!u.renderer){eI.ArrayExt.insert(o,i,u),eO(u,r,s);continue}let c=u.attrs.key;if(c&&c in a){let t=a[c];t.vNode!==l&&(eI.ArrayExt.move(o,o.indexOf(t.vNode,i+1),i),r.insertBefore(t.element,s),l=t.vNode,s=t.element)}if(l===u){s=s.nextSibling;continue}let h=l.attrs.key;if(h&&h!==c||l.tag!==u.tag){eI.ArrayExt.insert(o,i,u),eO(u,r,s);continue}(function(t,r,i){let n;if(r!==i){for(n in r)n in eR||n in i||("on"===n.substr(0,2)?t[n]=null:t.removeAttribute(n));for(n in i)n in eR||r[n]===i[n]||("on"===n.substr(0,2)?t[n]=i[n]:t.setAttribute(n,i[n]));r.className!==i.className&&(void 0!==i.className?t.setAttribute("class",i.className):t.removeAttribute("class")),r.htmlFor!==i.htmlFor&&(void 0!==i.htmlFor?t.setAttribute("for",i.htmlFor):t.removeAttribute("for")),r.dataset!==i.dataset&&function(t,r,i){for(let n in r)n in i||t.removeAttribute(`data-${n}`);for(let n in i)r[n]!==i[n]&&t.setAttribute(`data-${n}`,i[n])}(t,r.dataset||{},i.dataset||{}),r.style!==i.style&&function(t,r,i){let n=t.style,a;for(a in r)a in i||(n[a]="");for(a in i)r[a]!==i[a]&&(n[a]=i[a])}(t,r.style||{},i.style||{})}})(s,l.attrs,u.attrs),u.renderer?u.renderer.render(s,{attrs:u.attrs,children:u.children}):t(s,l.children,u.children),s=s.nextSibling}!function t(r,i,n,a){for(let o=i.length-1;o>=n;--o){let n=i[o],s=a?r.lastChild:r.childNodes[o];"text"===n.type||(n.renderer&&n.renderer.unrender?n.renderer.unrender(s,{attrs:n.attrs,children:n.children}):t(s,n.children,0,!1)),a&&r.removeChild(s)}}(r,o,l,!0)};let eR={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};var eB,ej,eN,eV,eU,eq,eG=class{constructor(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1}};(eY=eq||(eq={})).calc=function(t,r){let i=t.length;if(0===i)return r;let n=0,a=0,o=0,s=0,l=0;for(let r=0;r0&&(s+=i.stretch,l++)}if(r===o)return 0;if(r<=n){for(let r=0;r=a){for(let r=0;r0&&n>.01;){let r=n,a=s;for(let o=0;o0&&n>.01;){let r=n/u;for(let a=0;a0&&n>.01;){let r=n,a=s;for(let o=0;o=i.maxSize?(n-=i.maxSize-i.size,s-=i.stretch,i.size=i.maxSize,i.done=!0,u--,l--):(n-=c,i.size+=c)}}for(;u>0&&n>.01;){let r=n/u;for(let a=0;a=i.maxSize?(n-=i.maxSize-i.size,i.size=i.maxSize,i.done=!0,u--):(n-=r,i.size+=r))}}}return 0},eY.adjust=function(t,r,i){0===t.length||0===i||(i>0?function(t,r,i){let n=0;for(let i=0;i<=r;++i){let r=t[i];n+=r.maxSize-r.size}let a=0;for(let i=r+1,n=t.length;i=0&&o>0;--i){let r=t[i],n=r.maxSize-r.size;n>=o?(r.sizeHint=r.size+o,o=0):(r.sizeHint=r.size+n,o-=n)}let s=i;for(let i=r+1,n=t.length;i0;++i){let r=t[i],n=r.size-r.minSize;n>=s?(r.sizeHint=r.size-s,s=0):(r.sizeHint=r.size-n,s-=n)}}(t,r,i):function(t,r,i){let n=0;for(let i=r+1,a=t.length;i0;++i){let r=t[i],n=r.maxSize-r.size;n>=o?(r.sizeHint=r.size+o,o=0):(r.sizeHint=r.size+n,o-=n)}let s=i;for(let i=r;i>=0&&s>0;--i){let r=t[i],n=r.size-r.minSize;n>=s?(r.sizeHint=r.size-s,s=0):(r.sizeHint=r.size-n,s-=n)}}(t,r,-i))};var eH=class{constructor(t){this._label="",this._caption="",this._mnemonic=-1,this._icon=void 0,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new eo(this),this._isDisposed=!1,this.owner=t.owner,void 0!==t.label&&(this._label=t.label),void 0!==t.mnemonic&&(this._mnemonic=t.mnemonic),void 0!==t.icon&&(this._icon=t.icon),void 0!==t.iconClass&&(this._iconClass=t.iconClass),void 0!==t.iconLabel&&(this._iconLabel=t.iconLabel),void 0!==t.caption&&(this._caption=t.caption),void 0!==t.className&&(this._className=t.className),void 0!==t.closable&&(this._closable=t.closable),this._dataset=t.dataset||{}}get changed(){return this._changed}get label(){return this._label}set label(t){this._label!==t&&(this._label=t,this._changed.emit(void 0))}get mnemonic(){return this._mnemonic}set mnemonic(t){this._mnemonic!==t&&(this._mnemonic=t,this._changed.emit(void 0))}get icon(){return this._icon}set icon(t){this._icon!==t&&(this._icon=t,this._changed.emit(void 0))}get iconClass(){return this._iconClass}set iconClass(t){this._iconClass!==t&&(this._iconClass=t,this._changed.emit(void 0))}get iconLabel(){return this._iconLabel}set iconLabel(t){this._iconLabel!==t&&(this._iconLabel=t,this._changed.emit(void 0))}get caption(){return this._caption}set caption(t){this._caption!==t&&(this._caption=t,this._changed.emit(void 0))}get className(){return this._className}set className(t){this._className!==t&&(this._className=t,this._changed.emit(void 0))}get closable(){return this._closable}set closable(t){this._closable!==t&&(this._closable=t,this._changed.emit(void 0))}get dataset(){return this._dataset}set dataset(t){this._dataset!==t&&(this._dataset=t,this._changed.emit(void 0))}get isDisposed(){return this._isDisposed}dispose(){this.isDisposed||(this._isDisposed=!0,eo.clearData(this))}},e$=class t{constructor(r={}){this._flags=0,this._layout=null,this._parent=null,this._disposed=new eo(this),this._hiddenMode=t.HiddenMode.Display,this.node=eK.createNode(r),this.addClass("lm-Widget")}dispose(){this.isDisposed||(this.setFlag(t.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&t.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),this.title.dispose(),eo.clearData(this),et.clearData(this),en.clearData(this))}get disposed(){return this._disposed}get isDisposed(){return this.testFlag(t.Flag.IsDisposed)}get isAttached(){return this.testFlag(t.Flag.IsAttached)}get isHidden(){return this.testFlag(t.Flag.IsHidden)}get isVisible(){let t=this;do{if(t.isHidden||!t.isAttached)return!1;t=t.parent}while(null!=t);return!0}get title(){return eK.titleProperty.get(this)}get id(){return this.node.id}set id(t){this.node.id=t}get dataset(){return this.node.dataset}get hiddenMode(){return this._hiddenMode}set hiddenMode(r){this._hiddenMode!==r&&(this.isHidden&&this._toggleHidden(!1),r==t.HiddenMode.Scale?this.node.style.willChange="transform":this.node.style.willChange="auto",this._hiddenMode=r,this.isHidden&&this._toggleHidden(!0))}get parent(){return this._parent}set parent(r){if(this._parent!==r){if(r&&this.contains(r))throw Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){let r=new t.ChildMessage("child-removed",this);et.sendMessage(this._parent,r)}if(this._parent=r,this._parent&&!this._parent.isDisposed){let r=new t.ChildMessage("child-added",this);et.sendMessage(this._parent,r)}this.isDisposed||et.sendMessage(this,t.Msg.ParentChanged)}}get layout(){return this._layout}set layout(r){if(this._layout!==r){if(this.testFlag(t.Flag.DisallowLayout))throw Error("Cannot set widget layout.");if(this._layout)throw Error("Cannot change widget layout.");if(r.parent)throw Error("Cannot change layout parent.");this._layout=r,r.parent=this}}*children(){this._layout&&(yield*this._layout)}contains(t){for(let r=t;r;r=r._parent)if(r===this)return!0;return!1}hasClass(t){return this.node.classList.contains(t)}addClass(t){this.node.classList.add(t)}removeClass(t){this.node.classList.remove(t)}toggleClass(t,r){return!0===r?(this.node.classList.add(t),!0):!1===r?(this.node.classList.remove(t),!1):this.node.classList.toggle(t)}update(){et.postMessage(this,t.Msg.UpdateRequest)}fit(){et.postMessage(this,t.Msg.FitRequest)}activate(){et.postMessage(this,t.Msg.ActivateRequest)}close(){et.sendMessage(this,t.Msg.CloseRequest)}show(){if(this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.BeforeShow),this.clearFlag(t.Flag.IsHidden),this._toggleHidden(!1),this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.AfterShow),this.parent)){let r=new t.ChildMessage("child-shown",this);et.sendMessage(this.parent,r)}}hide(){if(!this.testFlag(t.Flag.IsHidden)&&(this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.BeforeHide),this.setFlag(t.Flag.IsHidden),this._toggleHidden(!0),this.isAttached&&(!this.parent||this.parent.isVisible)&&et.sendMessage(this,t.Msg.AfterHide),this.parent)){let r=new t.ChildMessage("child-hidden",this);et.sendMessage(this.parent,r)}}setHidden(t){t?this.hide():this.show()}testFlag(t){return(this._flags&t)!=0}setFlag(t){this._flags|=t}clearFlag(t){this._flags&=~t}processMessage(r){switch(r.type){case"resize":this.notifyLayout(r),this.onResize(r);break;case"update-request":this.notifyLayout(r),this.onUpdateRequest(r);break;case"fit-request":this.notifyLayout(r),this.onFitRequest(r);break;case"before-show":this.notifyLayout(r),this.onBeforeShow(r);break;case"after-show":this.setFlag(t.Flag.IsVisible),this.notifyLayout(r),this.onAfterShow(r);break;case"before-hide":this.notifyLayout(r),this.onBeforeHide(r);break;case"after-hide":this.clearFlag(t.Flag.IsVisible),this.notifyLayout(r),this.onAfterHide(r);break;case"before-attach":this.notifyLayout(r),this.onBeforeAttach(r);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(t.Flag.IsVisible),this.setFlag(t.Flag.IsAttached),this.notifyLayout(r),this.onAfterAttach(r);break;case"before-detach":this.notifyLayout(r),this.onBeforeDetach(r);break;case"after-detach":this.clearFlag(t.Flag.IsVisible),this.clearFlag(t.Flag.IsAttached),this.notifyLayout(r),this.onAfterDetach(r);break;case"activate-request":this.notifyLayout(r),this.onActivateRequest(r);break;case"close-request":this.notifyLayout(r),this.onCloseRequest(r);break;case"child-added":this.notifyLayout(r),this.onChildAdded(r);break;case"child-removed":this.notifyLayout(r),this.onChildRemoved(r);break;default:this.notifyLayout(r)}}notifyLayout(t){this._layout&&this._layout.processParentMessage(t)}onCloseRequest(r){this.parent?this.parent=null:this.isAttached&&t.detach(this)}onResize(t){}onUpdateRequest(t){}onFitRequest(t){}onActivateRequest(t){}onBeforeShow(t){}onAfterShow(t){}onBeforeHide(t){}onAfterHide(t){}onBeforeAttach(t){}onAfterAttach(t){}onBeforeDetach(t){}onAfterDetach(t){}onChildAdded(t){}onChildRemoved(t){}_toggleHidden(r){if(r)switch(this._hiddenMode){case t.HiddenMode.Display:this.addClass("lm-mod-hidden");break;case t.HiddenMode.Scale:this.node.style.transform="scale(0)",this.node.setAttribute("aria-hidden","true");break;case t.HiddenMode.ContentVisibility:this.node.style.contentVisibility="hidden",this.node.style.zIndex="-1",this.node.style.opacity="0"}else switch(this._hiddenMode){case t.HiddenMode.Display:this.removeClass("lm-mod-hidden");break;case t.HiddenMode.Scale:this.node.style.transform="",this.node.removeAttribute("aria-hidden");break;case t.HiddenMode.ContentVisibility:this.node.style.contentVisibility="",this.node.style.zIndex="",this.node.style.opacity=""}}};!function(t){var r,i,n,a;(r=t.HiddenMode||(t.HiddenMode={}))[r.Display=0]="Display",r[r.Scale=1]="Scale",r[r.ContentVisibility=2]="ContentVisibility",(i=t.Flag||(t.Flag={}))[i.IsDisposed=1]="IsDisposed",i[i.IsAttached=2]="IsAttached",i[i.IsHidden=4]="IsHidden",i[i.IsVisible=8]="IsVisible",i[i.DisallowLayout=16]="DisallowLayout",(n=t.Msg||(t.Msg={})).BeforeShow=new er("before-show"),n.AfterShow=new er("after-show"),n.BeforeHide=new er("before-hide"),n.AfterHide=new er("after-hide"),n.BeforeAttach=new er("before-attach"),n.AfterAttach=new er("after-attach"),n.BeforeDetach=new er("before-detach"),n.AfterDetach=new er("after-detach"),n.ParentChanged=new er("parent-changed"),n.UpdateRequest=new ei("update-request"),n.FitRequest=new ei("fit-request"),n.ActivateRequest=new ei("activate-request"),n.CloseRequest=new ei("close-request"),t.ChildMessage=class extends er{constructor(t,r){super(t),this.child=r}};class o extends er{constructor(t,r){super("resize"),this.width=t,this.height=r}}t.ResizeMessage=o,(a=o=t.ResizeMessage||(t.ResizeMessage={})).UnknownSize=new a(-1,-1),t.attach=function(r,i,n=null){if(r.parent)throw Error("Cannot attach a child widget.");if(r.isAttached||r.node.isConnected)throw Error("Widget is already attached.");if(!i.isConnected)throw Error("Host is not attached.");et.sendMessage(r,t.Msg.BeforeAttach),i.insertBefore(r.node,n),et.sendMessage(r,t.Msg.AfterAttach)},t.detach=function(r){if(r.parent)throw Error("Cannot detach a child widget.");if(!r.isAttached||!r.node.isConnected)throw Error("Widget is not attached.");et.sendMessage(r,t.Msg.BeforeDetach),r.node.parentNode.removeChild(r.node),et.sendMessage(r,t.Msg.AfterDetach)}}(e$||(e$={})),(eZ=eK||(eK={})).titleProperty=new en({name:"title",create:t=>new eH({owner:t})}),eZ.createNode=function(t){return t.node||document.createElement(t.tag||"div")};var eW=class{constructor(t={}){this._disposed=!1,this._parent=null,this._fitPolicy=t.fitPolicy||"set-min-size"}dispose(){this._parent=null,this._disposed=!0,eo.clearData(this),en.clearData(this)}get isDisposed(){return this._disposed}get parent(){return this._parent}set parent(t){if(this._parent!==t){if(this._parent)throw Error("Cannot change parent widget.");if(t.layout!==this)throw Error("Invalid parent widget.");this._parent=t,this.init()}}get fitPolicy(){return this._fitPolicy}set fitPolicy(t){if(this._fitPolicy!==t&&(this._fitPolicy=t,this._parent)){let t=this._parent.node.style;t.minWidth="",t.minHeight="",t.maxWidth="",t.maxHeight="",this._parent.fit()}}processParentMessage(t){switch(t.type){case"resize":this.onResize(t);break;case"update-request":this.onUpdateRequest(t);break;case"fit-request":this.onFitRequest(t);break;case"before-show":this.onBeforeShow(t);break;case"after-show":this.onAfterShow(t);break;case"before-hide":this.onBeforeHide(t);break;case"after-hide":this.onAfterHide(t);break;case"before-attach":this.onBeforeAttach(t);break;case"after-attach":this.onAfterAttach(t);break;case"before-detach":this.onBeforeDetach(t);break;case"after-detach":this.onAfterDetach(t);break;case"child-removed":this.onChildRemoved(t);break;case"child-shown":this.onChildShown(t);break;case"child-hidden":this.onChildHidden(t)}}init(){for(let t of this)t.parent=this.parent}onResize(t){for(let t of this)et.sendMessage(t,e$.ResizeMessage.UnknownSize)}onUpdateRequest(t){for(let t of this)et.sendMessage(t,e$.ResizeMessage.UnknownSize)}onBeforeAttach(t){for(let r of this)et.sendMessage(r,t)}onAfterAttach(t){for(let r of this)et.sendMessage(r,t)}onBeforeDetach(t){for(let r of this)et.sendMessage(r,t)}onAfterDetach(t){for(let r of this)et.sendMessage(r,t)}onBeforeShow(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onAfterShow(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onBeforeHide(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onAfterHide(t){for(let r of this)r.isHidden||et.sendMessage(r,t)}onChildRemoved(t){this.removeWidget(t.child)}onFitRequest(t){}onChildShown(t){}onChildHidden(t){}};(eX=eW||(eW={})).getHorizontalAlignment=function(t){return eJ.horizontalAlignmentProperty.get(t)},eX.setHorizontalAlignment=function(t,r){eJ.horizontalAlignmentProperty.set(t,r)},eX.getVerticalAlignment=function(t){return eJ.verticalAlignmentProperty.get(t)},eX.setVerticalAlignment=function(t,r){eJ.verticalAlignmentProperty.set(t,r)};var eY,eZ,eX,eK,eJ,eQ=class{constructor(t){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=t,this.widget.node.style.position="absolute",this.widget.node.style.contain="strict"}dispose(){if(this._disposed)return;this._disposed=!0;let t=this.widget.node.style;t.position="",t.top="",t.left="",t.width="",t.height="",t.contain=""}get minWidth(){return this._minWidth}get minHeight(){return this._minHeight}get maxWidth(){return this._maxWidth}get maxHeight(){return this._maxHeight}get isDisposed(){return this._disposed}get isHidden(){return this.widget.isHidden}get isVisible(){return this.widget.isVisible}get isAttached(){return this.widget.isAttached}fit(){let t=X.sizeLimits(this.widget.node);this._minWidth=t.minWidth,this._minHeight=t.minHeight,this._maxWidth=t.maxWidth,this._maxHeight=t.maxHeight}update(t,r,i,n){let a=Math.max(this._minWidth,Math.min(i,this._maxWidth)),o=Math.max(this._minHeight,Math.min(n,this._maxHeight));if(a"center",changed:e1}),e0.verticalAlignmentProperty=new en({name:"verticalAlignment",create:()=>"top",changed:e1});var e2,e3=class extends eW{constructor(){super(...arguments),this._widgets=[]}dispose(){for(;this._widgets.length>0;)this._widgets.pop().dispose();super.dispose()}get widgets(){return this._widgets}*[Symbol.iterator](){yield*this._widgets}addWidget(t){this.insertWidget(this._widgets.length,t)}insertWidget(t,r){r.parent=this.parent;let i=this._widgets.indexOf(r),n=Math.max(0,Math.min(t,this._widgets.length));if(-1===i){N.ArrayExt.insert(this._widgets,n,r),this.parent&&this.attachWidget(n,r);return}n===this._widgets.length&&n--,i!==n&&(N.ArrayExt.move(this._widgets,i,n),this.parent&&this.moveWidget(i,n,r))}removeWidget(t){this.removeWidgetAt(this._widgets.indexOf(t))}removeWidgetAt(t){let r=N.ArrayExt.removeAt(this._widgets,t);r&&this.parent&&this.detachWidget(t,r)}init(){super.init();let t=0;for(let r of this)this.attachWidget(t++,r)}attachWidget(t,r){let i=this.parent.node.children[t];this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.insertBefore(r.node,i),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach)}moveWidget(t,r,i){this.parent.isAttached&&et.sendMessage(i,e$.Msg.BeforeDetach),this.parent.node.removeChild(i.node),this.parent.isAttached&&et.sendMessage(i,e$.Msg.AfterDetach);let n=this.parent.node.children[r];this.parent.isAttached&&et.sendMessage(i,e$.Msg.BeforeAttach),this.parent.node.insertBefore(i.node,n),this.parent.isAttached&&et.sendMessage(i,e$.Msg.AfterAttach)}detachWidget(t,r){this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach)}};(e2||(e2={})).clampDimension=function(t){return Math.max(0,Math.floor(t))};var e5=e2,e4=class t extends e3{constructor(t){super(),this.widgetOffset=0,this._fixed=0,this._spacing=4,this._dirty=!1,this._hasNormedSizes=!1,this._sizers=[],this._items=[],this._handles=[],this._box=null,this._alignment="start",this._orientation="horizontal",this.renderer=t.renderer,void 0!==t.orientation&&(this._orientation=t.orientation),void 0!==t.alignment&&(this._alignment=t.alignment),void 0!==t.spacing&&(this._spacing=e2.clampDimension(t.spacing))}dispose(){for(let t of this._items)t.dispose();this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,super.dispose()}get orientation(){return this._orientation}set orientation(t){this._orientation!==t&&(this._orientation=t,this.parent&&(this.parent.dataset.orientation=t,this.parent.fit()))}get alignment(){return this._alignment}set alignment(t){this._alignment!==t&&(this._alignment=t,this.parent&&(this.parent.dataset.alignment=t,this.parent.update()))}get spacing(){return this._spacing}set spacing(t){t=e2.clampDimension(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())}get handles(){return this._handles}absoluteSizes(){return this._sizers.map(t=>t.size)}relativeSizes(){return e7.normalize(this._sizers.map(t=>t.size))}setRelativeSizes(t,r=!0){let i=this._sizers.length,n=t.slice(0,i);for(;n.length0&&(t.sizeHint=t.size);eq.adjust(this._sizers,t,i),this.parent&&this.parent.update()}}init(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(t,r){let i=new eQ(r),n=e7.createHandle(this.renderer),a=e7.averageSize(this._sizers),o=e7.createSizer(a);N.ArrayExt.insert(this._items,t,i),N.ArrayExt.insert(this._sizers,t,o),N.ArrayExt.insert(this._handles,t,n),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.node.appendChild(n),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach),this.parent.fit()}moveWidget(t,r,i){N.ArrayExt.move(this._items,t,r),N.ArrayExt.move(this._sizers,t,r),N.ArrayExt.move(this._handles,t,r),this.parent.fit()}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._items,t),n=N.ArrayExt.removeAt(this._handles,t);N.ArrayExt.removeAt(this._sizers,t),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.node.removeChild(n),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach),i.dispose(),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}updateItemPosition(t,r,i,n,a,o,s){let l=this._items[t];if(l.isHidden)return;let u=this._handles[t].style;r?(i+=this.widgetOffset,l.update(i,n,s,a),i+=s,u.top=`${n}px`,u.left=`${i}px`,u.width=`${this._spacing}px`,u.height=`${a}px`):(n+=this.widgetOffset,l.update(i,n,o,s),n+=s,u.top=`${n}px`,u.left=`${i}px`,u.width=`${o}px`,u.height=`${this._spacing}px`)}_fit(){let r=0,i=-1;for(let t=0,n=this._items.length;t0&&(s.sizeHint=s.size),i.isHidden){s.minSize=0,s.maxSize=0;continue}i.fit(),s.stretch=t.getStretch(i.widget),n?(s.minSize=i.minWidth,s.maxSize=i.maxWidth,a+=i.minWidth,o=Math.max(o,i.minHeight)):(s.minSize=i.minHeight,s.maxSize=i.maxHeight,o+=i.minHeight,a=Math.max(a,i.minWidth))}let s=this._box=X.boxSizing(this.parent.node);a+=s.horizontalSum,o+=s.verticalSum;let l=this.parent.node.style;l.minWidth=`${a}px`,l.minHeight=`${o}px`,this._dirty=!0,this.parent.parent&&et.sendMessage(this.parent.parent,e$.Msg.FitRequest),this._dirty&&et.sendMessage(this.parent,e$.Msg.UpdateRequest)}_update(t,r){this._dirty=!1;let i=0;for(let t=0,r=this._items.length;t0){let t;if(t=c?Math.max(0,o-this._fixed):Math.max(0,s-this._fixed),this._hasNormedSizes){for(let r of this._sizers)r.sizeHint*=t;this._hasNormedSizes=!1}let r=eq.calc(this._sizers,t);if(r>0)switch(this._alignment){case"start":break;case"center":l=0,u=r/2;break;case"end":l=0,u=r;break;case"justify":l=r/i,u=0;break;default:throw"unreachable"}}for(let t=0,r=this._items.length;t0,coerce:(t,r)=>Math.max(0,Math.floor(r)),changed:function(t){t.parent&&t.parent.layout instanceof e4&&t.parent.fit()}}),e8.createSizer=function(t){let r=new eG;return r.sizeHint=Math.floor(t),r},e8.createHandle=function(t){let r=t.createHandle();return r.style.position="absolute",r.style.contain="style",r},e8.averageSize=function(t){return t.reduce((t,r)=>t+r.size,0)/t.length||0},e8.normalize=function(t){let r=t.length;if(0===r)return[];let i=t.reduce((t,r)=>t+Math.abs(r),0);return 0===i?t.map(t=>1/r):t.map(t=>t/i)};var e6,e8,e7,e9,te=class extends e4{constructor(t){super({...t,orientation:t.orientation||"vertical"}),this._titles=[],this.titleSpace=t.titleSpace||22}get titleSpace(){return this.widgetOffset}set titleSpace(t){t=e5.clampDimension(t),this.widgetOffset!==t&&(this.widgetOffset=t,this.parent&&this.parent.fit())}get titles(){return this._titles}dispose(){this.isDisposed||(this._titles.length=0,super.dispose())}updateTitle(t,r){let i=this._titles[t],n=i.classList.contains("lm-mod-expanded"),a=e9.createTitle(this.renderer,r.title,n);this._titles[t]=a,this.parent.node.replaceChild(a,i)}insertWidget(t,r){r.id||(r.id=`id-${V.UUID.uuid4()}`),super.insertWidget(t,r)}attachWidget(t,r){let i=e9.createTitle(this.renderer,r.title,!r.isHidden);N.ArrayExt.insert(this._titles,t,i),this.parent.node.appendChild(i),r.node.setAttribute("role","region"),r.node.setAttribute("aria-labelledby",i.id),super.attachWidget(t,r)}moveWidget(t,r,i){N.ArrayExt.move(this._titles,t,r),super.moveWidget(t,r,i)}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._titles,t);this.parent.node.removeChild(i),super.detachWidget(t,r)}updateItemPosition(t,r,i,n,a,o,s){let l=this._titles[t].style;l.top=`${n}px`,l.left=`${i}px`,l.height=`${this.widgetOffset}px`,r?l.width=`${a}px`:l.width=`${o}px`,super.updateItemPosition(t,r,i,n,a,o,s)}};(e9||(e9={})).createTitle=function(t,r,i=!0){let n=t.createSectionTitle(r);return n.style.position="absolute",n.style.contain="strict",n.setAttribute("aria-label",`${r.label} Section`),n.setAttribute("aria-expanded",i?"true":"false"),n.setAttribute("aria-controls",r.owner.id),i&&n.classList.add("lm-mod-expanded"),n};var tt,tr=class extends e${constructor(t={}){super(),this.addClass("lm-Panel"),this.layout=tt.createLayout(t)}get widgets(){return this.layout.widgets}addWidget(t){this.layout.addWidget(t)}insertWidget(t,r){this.layout.insertWidget(t,r)}};(tt||(tt={})).createLayout=function(t){return t.layout||new e3};var ti=class extends tr{constructor(t={}){super({layout:tL.createLayout(t)}),this._handleMoved=new eo(this),this._pressData=null,this.addClass("lm-SplitPanel")}dispose(){this._releaseMouse(),super.dispose()}get orientation(){return this.layout.orientation}set orientation(t){this.layout.orientation=t}get alignment(){return this.layout.alignment}set alignment(t){this.layout.alignment=t}get spacing(){return this.layout.spacing}set spacing(t){this.layout.spacing=t}get renderer(){return this.layout.renderer}get handleMoved(){return this._handleMoved}get handles(){return this.layout.handles}relativeSizes(){return this.layout.relativeSizes()}setRelativeSizes(t,r=!0){this.layout.setRelativeSizes(t,r)}handleEvent(t){switch(t.type){case"pointerdown":this._evtPointerDown(t);break;case"pointermove":this._evtPointerMove(t);break;case"pointerup":this._evtPointerUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}}onBeforeAttach(t){this.node.addEventListener("pointerdown",this)}onAfterDetach(t){this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(t){t.child.addClass("lm-SplitPanel-child"),this._releaseMouse()}onChildRemoved(t){t.child.removeClass("lm-SplitPanel-child"),this._releaseMouse()}_evtKeyDown(t){this._pressData&&(t.preventDefault(),t.stopPropagation()),27===t.keyCode&&this._releaseMouse()}_evtPointerDown(t){if(0!==t.button)return;let r=this.layout,i=N.ArrayExt.findFirstIndex(r.handles,r=>r.contains(t.target));if(-1===i)return;t.preventDefault(),t.stopPropagation(),document.addEventListener("pointerup",this,!0),document.addEventListener("pointermove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);let n,a=r.handles[i],o=a.getBoundingClientRect();n="horizontal"===r.orientation?t.clientX-o.left:t.clientY-o.top;let s=window.getComputedStyle(a),l=ec.overrideCursor(s.cursor);this._pressData={index:i,delta:n,override:l}}_evtPointerMove(t){t.preventDefault(),t.stopPropagation();let r,i=this.layout,n=this.node.getBoundingClientRect();r="horizontal"===i.orientation?t.clientX-n.left-this._pressData.delta:t.clientY-n.top-this._pressData.delta,i.moveHandle(this._pressData.index,r)}_evtPointerUp(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse())}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._handleMoved.emit(),document.removeEventListener("keydown",this,!0),document.removeEventListener("pointerup",this,!0),document.removeEventListener("pointermove",this,!0),document.removeEventListener("contextmenu",this,!0))}},tn=ti||(ti={});class ta{createHandle(){let t=document.createElement("div");return t.className="lm-SplitPanel-handle",t}}tn.Renderer=ta,tn.defaultRenderer=new ta,tn.getStretch=function(t){return e4.getStretch(t)},tn.setStretch=function(t,r){e4.setStretch(t,r)},(tL||(tL={})).createLayout=function(t){return t.layout||new e4({renderer:t.renderer||ti.defaultRenderer,orientation:t.orientation,alignment:t.alignment,spacing:t.spacing})};var to=class extends ti{constructor(t={}){super({...t,layout:tP.createLayout(t)}),this._widgetSizesCache=new WeakMap,this._expansionToggled=new eo(this),this.addClass("lm-AccordionPanel")}get renderer(){return this.layout.renderer}get titleSpace(){return this.layout.titleSpace}set titleSpace(t){this.layout.titleSpace=t}get titles(){return this.layout.titles}get expansionToggled(){return this._expansionToggled}addWidget(t){super.addWidget(t),t.title.changed.connect(this._onTitleChanged,this)}collapse(t){let r=this.layout.widgets[t];r&&!r.isHidden&&this._toggleExpansion(t)}expand(t){let r=this.layout.widgets[t];r&&r.isHidden&&this._toggleExpansion(t)}insertWidget(t,r){super.insertWidget(t,r),r.title.changed.connect(this._onTitleChanged,this)}handleEvent(t){switch(super.handleEvent(t),t.type){case"click":this._evtClick(t);break;case"keydown":this._eventKeyDown(t)}}onBeforeAttach(t){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),super.onBeforeAttach(t)}onAfterDetach(t){super.onAfterDetach(t),this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this)}_onTitleChanged(t){let r=N.ArrayExt.findFirstIndex(this.widgets,r=>r.contains(t.owner));r>=0&&(this.layout.updateTitle(r,t.owner),this.update())}_computeWidgetSize(t){let r=this.layout,i=r.widgets[t];if(!i)return;let n=i.isHidden,a=r.absoluteSizes(),o=(n?-1:1)*this.spacing,s=a.reduce((t,r)=>t+r),l=[...a];if(n){let r=this._widgetSizesCache.get(i);if(!r)return;l[t]+=r;let n=l.map(t=>t-r>0).lastIndexOf(!0);-1===n?l.forEach((i,n)=>{n!==t&&(l[n]-=a[n]/s*(r-o))}):l[n]-=r-o}else{let r=a[t];this._widgetSizesCache.set(i,r),l[t]=0;let n=l.map(t=>t>0).lastIndexOf(!0);if(-1===n)return;l[n]=a[n]+r+o}return l.map(t=>t/(s+o))}_evtClick(t){let r=t.target;if(r){let i=N.ArrayExt.findFirstIndex(this.titles,t=>t.contains(r));i>=0&&(t.preventDefault(),t.stopPropagation(),this._toggleExpansion(i))}}_eventKeyDown(t){if(t.defaultPrevented)return;let r=t.target,i=!1;if(r){let n=N.ArrayExt.findFirstIndex(this.titles,t=>t.contains(r));if(n>=0){let a=t.keyCode.toString();if(t.key.match(/Space|Enter/)||a.match(/13|32/))r.click(),i=!0;else if("horizontal"===this.orientation?t.key.match(/ArrowLeft|ArrowRight/)||a.match(/37|39/):t.key.match(/ArrowUp|ArrowDown/)||a.match(/38|40/)){let r=t.key.match(/ArrowLeft|ArrowUp/)||a.match(/37|38/)?-1:1,o=this.titles.length;this.titles[(n+o+r)%o].focus(),i=!0}else"End"===t.key||"35"===a?(this.titles[this.titles.length-1].focus(),i=!0):("Home"===t.key||"36"===a)&&(this.titles[0].focus(),i=!0)}i&&t.preventDefault()}}_toggleExpansion(t){let r=this.titles[t],i=this.layout.widgets[t],n=this._computeWidgetSize(t);n&&this.setRelativeSizes(n,!1),i.isHidden?(r.classList.add("lm-mod-expanded"),r.setAttribute("aria-expanded","true"),i.show()):(r.classList.remove("lm-mod-expanded"),r.setAttribute("aria-expanded","false"),i.hide()),this._expansionToggled.emit(t)}},ts=to||(to={});class tl extends ti.Renderer{constructor(){super(),this.titleClassName="lm-AccordionPanel-title",this._titleID=0,this._titleKeys=new WeakMap,this._uuid=++tl._nInstance}createCollapseIcon(t){return document.createElement("span")}createSectionTitle(t){let r=document.createElement("h3");for(let i in r.setAttribute("tabindex","0"),r.id=this.createTitleKey(t),r.className=this.titleClassName,t.dataset)r.dataset[i]=t.dataset[i];r.appendChild(this.createCollapseIcon(t)).className="lm-AccordionPanel-titleCollapser";let i=r.appendChild(document.createElement("span"));return i.className="lm-AccordionPanel-titleLabel",i.textContent=t.label,i.title=t.caption||t.label,r}createTitleKey(t){let r=this._titleKeys.get(t);return void 0===r&&(r=`title-key-${this._uuid}-${this._titleID++}`,this._titleKeys.set(t,r)),r}}tl._nInstance=0,ts.Renderer=tl,ts.defaultRenderer=new tl,(tP||(tP={})).createLayout=function(t){return t.layout||new te({renderer:t.renderer||to.defaultRenderer,orientation:t.orientation,alignment:t.alignment,spacing:t.spacing,titleSpace:t.titleSpace})};var tu=class t extends e3{constructor(t={}){super(),this._fixed=0,this._spacing=4,this._dirty=!1,this._sizers=[],this._items=[],this._box=null,this._alignment="start",this._direction="top-to-bottom",void 0!==t.direction&&(this._direction=t.direction),void 0!==t.alignment&&(this._alignment=t.alignment),void 0!==t.spacing&&(this._spacing=e5.clampDimension(t.spacing))}dispose(){for(let t of this._items)t.dispose();this._box=null,this._items.length=0,this._sizers.length=0,super.dispose()}get direction(){return this._direction}set direction(t){this._direction!==t&&(this._direction=t,this.parent&&(this.parent.dataset.direction=t,this.parent.fit()))}get alignment(){return this._alignment}set alignment(t){this._alignment!==t&&(this._alignment=t,this.parent&&(this.parent.dataset.alignment=t,this.parent.update()))}get spacing(){return this._spacing}set spacing(t){t=e5.clampDimension(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())}init(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,super.init()}attachWidget(t,r){N.ArrayExt.insert(this._items,t,new eQ(r)),N.ArrayExt.insert(this._sizers,t,new eG),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach),this.parent.fit()}moveWidget(t,r,i){N.ArrayExt.move(this._items,t,r),N.ArrayExt.move(this._sizers,t,r),this.parent.update()}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._items,t);N.ArrayExt.removeAt(this._sizers,t),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach),i.dispose(),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_fit(){let r=0;for(let t=0,i=this._items.length;t0)switch(this._alignment){case"start":break;case"center":u=0,c=l/2;break;case"end":u=0,c=l;break;case"justify":u=l/i,c=0;break;default:throw"unreachable"}for(let t=0,r=this._items.length;t0,coerce:(t,r)=>Math.max(0,Math.floor(r)),changed:th}),tc.sizeBasisProperty=new en({name:"sizeBasis",create:()=>0,coerce:(t,r)=>Math.max(0,Math.floor(r)),changed:th}),tc.isHorizontal=function(t){return"left-to-right"===t||"right-to-left"===t},tc.clampSpacing=function(t){return Math.max(0,Math.floor(t))};var td=class extends tr{constructor(t={}){super({layout:tF.createLayout(t)}),this.addClass("lm-BoxPanel")}get direction(){return this.layout.direction}set direction(t){this.layout.direction=t}get alignment(){return this.layout.alignment}set alignment(t){this.layout.alignment=t}get spacing(){return this.layout.spacing}set spacing(t){this.layout.spacing=t}onChildAdded(t){t.child.addClass("lm-BoxPanel-child")}onChildRemoved(t){t.child.removeClass("lm-BoxPanel-child")}};(tC=td||(td={})).getStretch=function(t){return tu.getStretch(t)},tC.setStretch=function(t,r){tu.setStretch(t,r)},tC.getSizeBasis=function(t){return tu.getSizeBasis(t)},tC.setSizeBasis=function(t,r){tu.setSizeBasis(t,r)},(tF||(tF={})).createLayout=function(t){return t.layout||new tu(t)};var tf=class t extends e${constructor(r){super({node:tO.createNode()}),this._activeIndex=-1,this._items=[],this._results=null,this.addClass("lm-CommandPalette"),this.setFlag(e$.Flag.DisallowLayout),this.commands=r.commands,this.renderer=r.renderer||t.defaultRenderer,this.commands.commandChanged.connect(this._onGenericChange,this),this.commands.keyBindingChanged.connect(this._onGenericChange,this)}dispose(){this._items.length=0,this._results=null,super.dispose()}get searchNode(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]}get inputNode(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]}get contentNode(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]}get items(){return this._items}addItem(t){let r=tO.createItem(this.commands,t);return this._items.push(r),this.refresh(),r}addItems(t){let r=t.map(t=>tO.createItem(this.commands,t));return r.forEach(t=>this._items.push(t)),this.refresh(),r}removeItem(t){this.removeItemAt(this._items.indexOf(t))}removeItemAt(t){N.ArrayExt.removeAt(this._items,t)&&this.refresh()}clearItems(){0!==this._items.length&&(this._items.length=0,this.refresh())}refresh(){(this._results=null,""!==this.inputNode.value)?this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit":this.node.getElementsByClassName("lm-close-icon")[0].style.display="none",this.update()}handleEvent(t){switch(t.type){case"click":this._evtClick(t);break;case"keydown":this._evtKeyDown(t);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}}onBeforeAttach(t){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)}onAfterDetach(t){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)}onAfterShow(t){this.update(),super.onAfterShow(t)}onActivateRequest(t){if(this.isAttached){let t=this.inputNode;t.focus(),t.select()}}onUpdateRequest(t){if(!this.isVisible)return void eV.render(null,this.contentNode);let r=this.inputNode.value,i=this.contentNode,n=this._results;if(n||(n=this._results=tO.search(this._items,r),this._activeIndex=r?N.ArrayExt.findFirstIndex(n,tO.canActivate):-1),!r&&0===n.length)return void eV.render(null,i);if(r&&0===n.length){let t=this.renderer.renderEmptyMessage({query:r});eV.render(t,i);return}let a=this.renderer,o=this._activeIndex,s=Array(n.length);for(let t=0,r=n.length;t=n.length)i.scrollTop=0;else{let t=i.children[o];X.scrollIntoViewIfNeeded(i,t)}}_evtClick(t){if(0!==t.button)return;if(t.target.classList.contains("lm-close-icon")){this.inputNode.value="",this.refresh();return}let r=N.ArrayExt.findFirstIndex(this.contentNode.children,r=>r.contains(t.target));-1!==r&&(t.preventDefault(),t.stopPropagation(),this._execute(r))}_evtKeyDown(t){if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey))switch(t.keyCode){case 13:t.preventDefault(),t.stopPropagation(),this._execute(this._activeIndex);break;case 38:t.preventDefault(),t.stopPropagation(),this._activatePreviousItem();break;case 40:t.preventDefault(),t.stopPropagation(),this._activateNextItem()}}_activateNextItem(){if(!this._results||0===this._results.length)return;let t=this._activeIndex,r=this._results.length,i=tt-r),h=s.slice(0,c),d=s.slice(c);for(let t=0,r=d.length;ti.command===t&&V.JSONExt.deepEqual(i.args,r))||null}}var tx=class t extends e${constructor(r){super({node:tR.createNode()}),this._childIndex=-1,this._activeIndex=-1,this._openTimerID=0,this._closeTimerID=0,this._items=[],this._childMenu=null,this._parentMenu=null,this._aboutToClose=new eo(this),this._menuRequested=new eo(this),this.addClass("lm-Menu"),this.setFlag(e$.Flag.DisallowLayout),this.commands=r.commands,this.renderer=r.renderer||t.defaultRenderer}dispose(){this.close(),this._items.length=0,super.dispose()}get aboutToClose(){return this._aboutToClose}get menuRequested(){return this._menuRequested}get parentMenu(){return this._parentMenu}get childMenu(){return this._childMenu}get rootMenu(){let t=this;for(;t._parentMenu;)t=t._parentMenu;return t}get leafMenu(){let t=this;for(;t._childMenu;)t=t._childMenu;return t}get contentNode(){return this.node.getElementsByClassName("lm-Menu-content")[0]}get activeItem(){return this._items[this._activeIndex]||null}set activeItem(t){this.activeIndex=t?this._items.indexOf(t):-1}get activeIndex(){return this._activeIndex}set activeIndex(t){(t<0||t>=this._items.length)&&(t=-1),-1===t||tR.canActivate(this._items[t])||(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this._activeIndex>=0&&this.contentNode.childNodes[this._activeIndex]&&this.contentNode.childNodes[this._activeIndex].focus(),this.update())}get items(){return this._items}activateNextItem(){let t=this._items.length,r=this._activeIndex,i=r{this.activeIndex=t}})}eV.render(o,this.contentNode)}onCloseRequest(t){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;let r=this._childMenu;r&&(this._childIndex=-1,this._childMenu=null,r._parentMenu=null,r.close());let i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),super.onCloseRequest(t)}_evtKeyDown(t){t.preventDefault(),t.stopPropagation();let r=t.keyCode;if(13===r)return void this.triggerActiveItem();if(27===r)return void this.close();if(37===r)return void(this._parentMenu?this.close():this._menuRequested.emit("previous"));if(38===r)return void this.activatePreviousItem();if(39===r){let t=this.activeItem;t&&"submenu"===t.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next");return}if(40===r)return void this.activateNextItem();let i=em().keyForKeydownEvent(t);if(!i)return;let n=this._activeIndex+1,a=tR.findMnemonic(this._items,i,n);-1===a.index||a.multiple?-1!==a.index?this.activeIndex=a.index:-1!==a.auto&&(this.activeIndex=a.auto):(this.activeIndex=a.index,this.triggerActiveItem())}_evtPointerUp(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.triggerActiveItem())}_evtPointerMove(t){let r=N.ArrayExt.findFirstIndex(this.contentNode.children,r=>X.hitTest(r,t.clientX,t.clientY));if(r===this._activeIndex)return;if(this.activeIndex=r,(r=this.activeIndex)===this._childIndex){this._cancelOpenTimer(),this._cancelCloseTimer();return}-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();let i=this.activeItem;i&&"submenu"===i.type&&i.submenu&&this._startOpenTimer()}_evtPointerEnter(t){for(let t=this._parentMenu;t;t=t._parentMenu)t._cancelOpenTimer(),t._cancelCloseTimer(),t.activeIndex=t._childIndex}_evtPointerLeave(t){if(this._cancelOpenTimer(),!this._childMenu){this.activeIndex=-1;return}let{clientX:r,clientY:i}=t;X.hitTest(this._childMenu.node,r,i)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}_evtPointerDown(t){this._parentMenu||(tR.hitTestMenus(this,t.clientX,t.clientY)?(t.preventDefault(),t.stopPropagation()):this.close())}_openChildMenu(r=!1){let i=this.activeItem;if(!i||"submenu"!==i.type||!i.submenu)return void this._closeChildMenu();let n=i.submenu;if(n===this._childMenu)return;t.saveWindowData(),this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,et.sendMessage(this,e$.Msg.UpdateRequest);let a=this.contentNode.children[this._activeIndex];tR.openSubmenu(n,a),r&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}_closeChildMenu(){this._childMenu&&this._childMenu.close()}_startOpenTimer(){0===this._openTimerID&&(this._openTimerID=window.setTimeout(()=>{this._openTimerID=0,this._openChildMenu()},tR.TIMER_DELAY))}_startCloseTimer(){0===this._closeTimerID&&(this._closeTimerID=window.setTimeout(()=>{this._closeTimerID=0,this._closeChildMenu()},tR.TIMER_DELAY))}_cancelOpenTimer(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)}_cancelCloseTimer(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)}static saveWindowData(){tR.saveWindowData()}},tb=tx||(tx={});class t_{renderItem(t){let r=this.createItemClass(t),i=this.createItemDataset(t),n=this.createItemARIA(t);return ez.li({className:r,dataset:i,tabindex:"0",onfocus:t.onfocus,...n},this.renderIcon(t),this.renderLabel(t),this.renderShortcut(t),this.renderSubmenu(t))}renderIcon(t){let r=this.createIconClass(t);return ez.div({className:r},t.item.icon,t.item.iconLabel)}renderLabel(t){let r=this.formatLabel(t);return ez.div({className:"lm-Menu-itemLabel"},r)}renderShortcut(t){let r=this.formatShortcut(t);return ez.div({className:"lm-Menu-itemShortcut"},r)}renderSubmenu(t){return ez.div({className:"lm-Menu-itemSubmenuIcon"})}createItemClass(t){let r="lm-Menu-item";t.item.isEnabled||(r+=" lm-mod-disabled"),t.item.isToggled&&(r+=" lm-mod-toggled"),t.item.isVisible||(r+=" lm-mod-hidden"),t.active&&(r+=" lm-mod-active"),t.collapsed&&(r+=" lm-mod-collapsed");let i=t.item.className;return i&&(r+=` ${i}`),r}createItemDataset(t){let{type:r,command:i,dataset:n}=t.item;return"command"===r?{...n,type:r,command:i}:{...n,type:r}}createIconClass(t){let r="lm-Menu-itemIcon",i=t.item.iconClass;return i?`${r} ${i}`:r}createItemARIA(t){let r={};switch(t.item.type){case"separator":r.role="presentation";break;case"submenu":r["aria-haspopup"]="true",t.item.isEnabled||(r["aria-disabled"]="true");break;default:t.item.isEnabled||(r["aria-disabled"]="true"),t.item.isToggled?(r.role="menuitemcheckbox",r["aria-checked"]="true"):r.role="menuitem"}return r}formatLabel(t){let{label:r,mnemonic:i}=t.item;if(i<0||i>=r.length)return r;let n=r.slice(0,i),a=r.slice(i+1),o=r[i];return[n,ez.span({className:"lm-Menu-itemMnemonic"},o),a]}formatShortcut(t){let r=t.item.keyBinding;return r?eS.formatKeystroke(r.keys):null}}tb.Renderer=t_,tb.defaultRenderer=new t_,function(t){t.TIMER_DELAY=300,t.SUBMENU_OVERLAP=3;let r=null,i=0;function n(){return i>0?(i--,r):o()}function a(t){return"separator"!==t.type&&t.isEnabled&&t.isVisible}function o(){return{pageXOffset:window.pageXOffset,pageYOffset:window.pageYOffset,clientWidth:document.documentElement.clientWidth,clientHeight:document.documentElement.clientHeight}}t.saveWindowData=function(){r=o(),i++},t.createNode=function(){let t=document.createElement("div"),r=document.createElement("ul");return r.className="lm-Menu-content",t.appendChild(r),r.setAttribute("role","menu"),t.tabIndex=0,t},t.canActivate=a,t.createItem=function(t,r){return new s(t.commands,r)},t.hitTestMenus=function(t,r,i){for(let n=t;n;n=n.childMenu)if(X.hitTest(n.node,r,i))return!0;return!1},t.computeCollapsed=function(t){let r=Array(t.length);N.ArrayExt.fill(r,!1);let i=0,n=t.length;for(;i=0;--a){let i=t[a];if(i.isVisible){if("separator"!==i.type)break;r[a]=!0}}let o=!1;for(;++ih+f&&(r=h+f-v),!o&&i+x>d+p&&(i>d+p?i=d+p-x:i-=x),y.transform=`translate(${Math.max(0,r)}px, ${Math.max(0,i)}px`,y.opacity="1"},t.openSubmenu=function(r,i){let a=n(),o=a.pageXOffset,s=a.pageYOffset,l=a.clientWidth,u=a.clientHeight;et.sendMessage(r,e$.Msg.UpdateRequest);let c=r.node,h=c.style;h.opacity="0",h.maxHeight=`${u}px`,e$.attach(r,document.body);let{width:d,height:f}=c.getBoundingClientRect(),p=X.boxSizing(r.node),m=i.getBoundingClientRect(),g=m.right-t.SUBMENU_OVERLAP;g+d>o+l&&(g=m.left+t.SUBMENU_OVERLAP-d);let y=m.top-p.borderTop-p.paddingTop;y+f>s+u&&(y=m.bottom+p.borderBottom+p.paddingBottom-f),h.transform=`translate(${Math.max(0,g)}px, ${Math.max(0,y)}px`,h.opacity="1"},t.findMnemonic=function(t,r,i){let n=-1,o=-1,s=!1,l=r.toUpperCase();for(let r=0,u=t.length;r=0&&fi.command===t&&V.JSONExt.deepEqual(i.args,r))||null}return null}}}(tR||(tR={}));var tw=tB||(tB={});function tT(t,r){let i=t.rank,n=r.rank;return i!==n?i=this._titles.length)&&(t=-1),this._currentIndex===t)return;let r=this._currentIndex,i=this._titles[r]||null,n=t,a=this._titles[n]||null;this._currentIndex=n,this._previousTitle=i,this.update(),this._currentChanged.emit({previousIndex:r,previousTitle:i,currentIndex:n,currentTitle:a})}get name(){return this._name}set name(t){this._name=t,t?this.contentNode.setAttribute("aria-label",t):this.contentNode.removeAttribute("aria-label")}get orientation(){return this._orientation}set orientation(t){this._orientation!==t&&(this._releaseMouse(),this._orientation=t,this.dataset.orientation=t,this.contentNode.setAttribute("aria-orientation",t))}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(t){this._addButtonEnabled!==t&&(this._addButtonEnabled=t,t?this.addButtonNode.classList.remove("lm-mod-hidden"):this.addButtonNode.classList.add("lm-mod-hidden"))}get titles(){return this._titles}get contentNode(){return this.node.getElementsByClassName("lm-TabBar-content")[0]}get addButtonNode(){return this.node.getElementsByClassName("lm-TabBar-addButton")[0]}addTab(t){return this.insertTab(this._titles.length,t)}insertTab(t,r){this._releaseMouse();let i=tj.asTitle(r),n=this._titles.indexOf(i),a=Math.max(0,Math.min(t,this._titles.length));return -1===n?(N.ArrayExt.insert(this._titles,a,i),i.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(a,i)):(a===this._titles.length&&a--,n===a||(N.ArrayExt.move(this._titles,n,a),this.update(),this._adjustCurrentForMove(n,a))),i}removeTab(t){this.removeTabAt(this._titles.indexOf(t))}removeTabAt(t){let r=t>=0&&t-1?this._currentIndex:0;for(let t=0,r=i.length;tX.hitTest(r,t.clientX,t.clientY));if(-1===i)return;let n=this.titles[i],a=r[i].querySelector(".lm-TabBar-tabLabel");if(a&&a.contains(t.target)){let t=n.label||"",r=a.innerHTML;a.innerHTML="";let i=document.createElement("input");i.classList.add("lm-TabBar-tabInput"),i.value=t,a.appendChild(i);let o=()=>{i.removeEventListener("blur",o),a.innerHTML=r,this.node.addEventListener("keydown",this)};i.addEventListener("dblclick",t=>t.stopPropagation()),i.addEventListener("blur",o),i.addEventListener("keydown",t=>{"Enter"===t.key?(""!==i.value&&(n.label=n.caption=i.value),o()):"Escape"===t.key&&o()}),this.node.removeEventListener("keydown",this),i.select(),i.focus(),a.children.length>0&&a.children[0].focus()}}_evtKeyDownCapturing(t){t.eventPhase===Event.CAPTURING_PHASE&&(t.preventDefault(),t.stopPropagation(),"Escape"===t.key&&this._releaseMouse())}_evtKeyDown(t){var r,i,n;if("Tab"!==t.key&&t.eventPhase!==Event.CAPTURING_PHASE){if("Enter"===t.key||"Spacebar"===t.key||" "===t.key){let r=document.activeElement;if(this.addButtonEnabled&&this.addButtonNode.contains(r))t.preventDefault(),t.stopPropagation(),this._addRequested.emit();else{let i=N.ArrayExt.findFirstIndex(this.contentNode.children,t=>t.contains(r));i>=0&&(t.preventDefault(),t.stopPropagation(),this.currentIndex=i)}}else if(tM.includes(t.key)){let a,o=[...this.contentNode.children];if(this.addButtonEnabled&&o.push(this.addButtonNode),o.length<=1)return;t.preventDefault(),t.stopPropagation();let s=o.indexOf(document.activeElement);-1===s&&(s=this._currentIndex),"ArrowRight"===t.key&&"horizontal"===this._orientation||"ArrowDown"===t.key&&"vertical"===this._orientation?a=null!=(r=o[s+1])?r:o[0]:"ArrowLeft"===t.key&&"horizontal"===this._orientation||"ArrowUp"===t.key&&"vertical"===this._orientation?a=null!=(i=o[s-1])?i:o[o.length-1]:"Home"===t.key?a=o[0]:"End"===t.key&&(a=o[o.length-1]),a&&(null==(n=o[s])||n.setAttribute("tabindex","-1"),a?.setAttribute("tabindex","0"),a.focus())}}}_evtPointerDown(t){if(0!==t.button&&1!==t.button||this._dragData||t.target.classList.contains("lm-TabBar-tabInput"))return;let r=this.addButtonEnabled&&this.addButtonNode.contains(t.target),i=this.contentNode.children,n=N.ArrayExt.findFirstIndex(i,r=>X.hitTest(r,t.clientX,t.clientY));if(-1===n&&!r||(t.preventDefault(),t.stopPropagation(),this._dragData={tab:i[n],index:n,pressX:t.clientX,pressY:t.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},this.document.addEventListener("pointerup",this,!0),1===t.button||r))return;let a=i[n].querySelector(this.renderer.closeIconSelector);a&&a.contains(t.target)||(this.tabsMovable&&(this.document.addEventListener("pointermove",this,!0),this.document.addEventListener("keydown",this,!0),this.document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===n?this.currentIndex=-1:this.currentIndex=n,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}_evtPointerMove(t){let r=this._dragData;if(!r)return;t.preventDefault(),t.stopPropagation();let i=this.contentNode.children;if(!(!r.dragActive&&!tj.dragExceeded(r,t))){if(!r.dragActive){let t=r.tab.getBoundingClientRect();"horizontal"===this._orientation?(r.tabPos=r.tab.offsetLeft,r.tabSize=t.width,r.tabPressPos=r.pressX-t.left):(r.tabPos=r.tab.offsetTop,r.tabSize=t.height,r.tabPressPos=r.pressY-t.top),r.tabPressOffset={x:r.pressX-t.left,y:r.pressY-t.top},r.tabLayout=tj.snapTabLayout(i,this._orientation),r.contentRect=this.contentNode.getBoundingClientRect(),r.override=ec.overrideCursor("default"),r.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),r.dragActive=!0}if(!r.detachRequested&&tj.detachExceeded(r,t)){r.detachRequested=!0;let n=r.index,a=t.clientX,o=t.clientY,s=i[n],l=this._titles[n];if(this._tabDetachRequested.emit({index:n,title:l,tab:s,clientX:a,clientY:o,offset:r.tabPressOffset}),r.dragAborted)return}tj.layoutTabs(i,r,t,this._orientation)}}_evtPointerUp(t){if(0!==t.button&&1!==t.button)return;let r=this._dragData;if(r){if(t.preventDefault(),t.stopPropagation(),this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),!r.dragActive){if(this._dragData=null,this.addButtonEnabled&&this.addButtonNode.contains(t.target))return void this._addRequested.emit(void 0);let i=this.contentNode.children,n=N.ArrayExt.findFirstIndex(i,r=>X.hitTest(r,t.clientX,t.clientY));if(n!==r.index)return;let a=this._titles[n];if(!a.closable)return;if(1===t.button)return void this._tabCloseRequested.emit({index:n,title:a});let o=i[n].querySelector(this.renderer.closeIconSelector);return void(o&&o.contains(t.target)&&(this._tabSizeFrozen=!0,this._tabCloseRequested.emit({index:n,title:a})))}0!==t.button||(tj.finalizeTabPosition(r,this._orientation),r.tab.classList.remove("lm-mod-dragging"),setTimeout(()=>{if(r.dragAborted)return;this._dragData=null,tj.resetTabPositions(this.contentNode.children,this._orientation),r.override.dispose(),this.removeClass("lm-mod-dragging");let t=r.index,i=r.targetIndex;-1===i||t===i||(N.ArrayExt.move(this._titles,t,i),this._adjustCurrentForMove(t,i),this._tabMoved.emit({fromIndex:t,toIndex:i,title:this._titles[i]}),et.sendMessage(this,e$.Msg.UpdateRequest))},tj.parseTransitionDuration(r.tab)))}}_releaseMouse(){let t=this._dragData;t&&(this._dragData=null,this.document.removeEventListener("pointermove",this,!0),this.document.removeEventListener("pointerup",this,!0),this.document.removeEventListener("keydown",this,!0),this.document.removeEventListener("contextmenu",this,!0),t.dragAborted=!0,t.dragActive&&(tj.resetTabPositions(this.contentNode.children,this._orientation),t.override.dispose(),t.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging")))}_adjustCurrentForInsert(t,r){let i=this.currentTitle,n=this._currentIndex,a=this.insertBehavior;if("select-tab"===a||"select-tab-if-needed"===a&&-1===n){this._currentIndex=t,this._previousTitle=i,this._currentChanged.emit({previousIndex:n,previousTitle:i,currentIndex:t,currentTitle:r});return}n>=t&&this._currentIndex++}_adjustCurrentForMove(t,r){this._currentIndex===t?this._currentIndex=r:this._currentIndex=r?this._currentIndex++:this._currentIndex>t&&this._currentIndex<=r&&this._currentIndex--}_adjustCurrentForRemove(t,r){let i=this._currentIndex,n=this.removeBehavior;if(i!==t){i>t&&this._currentIndex--;return}if(0===this._titles.length){this._currentIndex=-1,this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:-1,currentTitle:null});return}if("select-tab-after"===n){this._currentIndex=Math.min(t,this._titles.length-1),this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if("select-tab-before"===n){this._currentIndex=Math.max(0,t-1),this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}if("select-previous-tab"===n){this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(t,this._titles.length-1),this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:this._currentIndex,currentTitle:this.currentTitle});return}this._currentIndex=-1,this._currentChanged.emit({previousIndex:t,previousTitle:r,currentIndex:-1,currentTitle:null})}_onTitleChanged(t){this.update()}_evtPointerLeave(t){if(!this._tabSizeFrozen)return;this._tabSizeFrozen=!1,this._frozenTabWidths=null,this._unfreezeRunID++;let r=this._unfreezeRunID;this._clearUnfreezeTransitionState(),this.addClass("lm-mod-unfreezing");let i=this.contentNode.children;for(let t=0,r=i.length;t{let i=t.propertyName;("width"===i||"flex-basis"===i)&&this._finalizeUnfreezeRun(r)};this._unfreezeTransitionListener=t,this.node.addEventListener("transitionend",t),this.node.addEventListener("transitioncancel",t),this._unfreezeFallbackTimerID=window.setTimeout(()=>{this._finalizeUnfreezeRun(r)},2e3)}this.update()}_setFrozenTabSize(t,r){let i=`${r}px`;t.style.width=i,t.style.flexBasis=i}_finalizeUnfreezeRun(t){t===this._unfreezeRunID&&(this._clearUnfreezeTransitionState(),this.removeClass("lm-mod-unfreezing"))}_clearUnfreezeTransitionState(){this._unfreezeTransitionListener&&(this.node.removeEventListener("transitionend",this._unfreezeTransitionListener),this.node.removeEventListener("transitioncancel",this._unfreezeTransitionListener),this._unfreezeTransitionListener=null),0!==this._unfreezeFallbackTimerID&&(clearTimeout(this._unfreezeFallbackTimerID),this._unfreezeFallbackTimerID=0)}_clearTabSizeFreezeState(){this._tabSizeFrozen=!1,this._frozenTabWidths=null,this.removeClass("lm-mod-unfreezing");let t=this.contentNode.children;for(let r=0,i=t.length;r=tI.DRAG_THRESHOLD||n>=tI.DRAG_THRESHOLD},tI.detachExceeded=function(t,r){let i=t.contentRect;return r.clientX=i.right+tI.DETACH_THRESHOLD||r.clientY=i.bottom+tI.DETACH_THRESHOLD},tI.layoutTabs=function(t,r,i,n){let a,o,s,l;"horizontal"===n?(a=r.pressX,o=i.clientX-r.contentRect.left,s=i.clientX,l=r.contentRect.width):(a=r.pressY,o=i.clientY-r.contentRect.top,s=i.clientY,l=r.contentRect.height);let u=r.index,c=o-r.tabPressPos,h=c+r.tabSize;for(let i=0,o=t.length;i>1);if(ir.index&&h>f)o=`${-r.tabSize-d.margin}px`,u=Math.max(u,i);else if(i===r.index){let t=s-a,i=l-(r.tabPos+r.tabSize);o=`${Math.max(-r.tabPos,Math.min(t,i))}px`}else o="";"horizontal"===n?t[i].style.left=o:t[i].style.top=o}r.targetIndex=u},tI.finalizeTabPosition=function(t,r){let i,n;if(i="horizontal"===r?t.contentRect.width:t.contentRect.height,t.targetIndex===t.index)n=0;else if(t.targetIndex>t.index){let r=t.tabLayout[t.targetIndex];n=r.pos+r.size-t.tabSize-t.tabPos}else n=t.tabLayout[t.targetIndex].pos-t.tabPos;let a=i-(t.tabPos+t.tabSize),o=Math.max(-t.tabPos,Math.min(n,a));"horizontal"===r?t.tab.style.left=`${o}px`:t.tab.style.top=`${o}px`},tI.resetTabPositions=function(t,r){for(let i of t)"horizontal"===r?i.style.left="":i.style.top=""};var tD,tC,tI,tL,tP,tz,tF,tO,tR,tB,tj,tN,tV=class extends eW{constructor(t){super(),this._spacing=4,this._dirty=!1,this._root=null,this._box=null,this._items=new Map,this.renderer=t.renderer,void 0!==t.spacing&&(this._spacing=e5.clampDimension(t.spacing)),this._document=t.document||document,this._hiddenMode=void 0!==t.hiddenMode?t.hiddenMode:e$.HiddenMode.Display}dispose(){let t=this[Symbol.iterator]();for(let r of(this._items.forEach(t=>{t.dispose()}),this._box=null,this._root=null,this._items.clear(),t))r.dispose();super.dispose()}get hiddenMode(){return this._hiddenMode}set hiddenMode(t){if(this._hiddenMode!==t){for(let r of(this._hiddenMode=t,this.tabBars()))if(r.titles.length>1)for(let t of r.titles)t.owner.hiddenMode=this._hiddenMode}}get spacing(){return this._spacing}set spacing(t){t=e5.clampDimension(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())}get isEmpty(){return null===this._root}[Symbol.iterator](){return this._root?this._root.iterAllWidgets():(0,N.empty)()}widgets(){return this._root?this._root.iterUserWidgets():(0,N.empty)()}selectedWidgets(){return this._root?this._root.iterSelectedWidgets():(0,N.empty)()}tabBars(){return this._root?this._root.iterTabBars():(0,N.empty)()}handles(){return this._root?this._root.iterHandles():(0,N.empty)()}moveHandle(t,r,i){let n,a=t.classList.contains("lm-mod-hidden");if(!this._root||a)return;let o=this._root.findSplitNode(t);o&&0!=(n="horizontal"===o.node.orientation?r-t.offsetLeft:i-t.offsetTop)&&(o.node.holdSizes(),eq.adjust(o.node.sizers,o.index,n),this.parent&&this.parent.update())}saveLayout(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}}restoreLayout(t){let r=new Set,i;i=t.main?tN.normalizeAreaConfig(t.main,r):null;let n=this.widgets(),a=this.tabBars(),o=this.handles();for(let t of(this._root=null,n))r.has(t)||(t.parent=null);for(let t of a)t.dispose();for(let t of o)t.parentNode&&t.parentNode.removeChild(t);for(let t of r)t.parent=this.parent;i?this._root=tN.realizeAreaConfig(i,{createTabBar:t=>this._createTabBar(),createHandle:()=>this._createHandle()},this._document):this._root=null,this.parent&&(r.forEach(t=>{this.attachWidget(t)}),this.parent.fit())}addWidget(t,r={}){let i=r.ref||null,n=r.mode||"tab-after",a=null;if(this._root&&i&&(a=this._root.findTabNode(i)),i&&!a)throw Error("Reference widget is not in the layout.");switch(t.parent=this.parent,n){case"tab-after":this._insertTab(t,i,a,!0);break;case"tab-before":this._insertTab(t,i,a,!1);break;case"split-top":this._insertSplit(t,i,a,"vertical",!1);break;case"split-left":this._insertSplit(t,i,a,"horizontal",!1);break;case"split-right":this._insertSplit(t,i,a,"horizontal",!0);break;case"split-bottom":this._insertSplit(t,i,a,"vertical",!0);break;case"merge-top":this._insertSplit(t,i,a,"vertical",!1,!0);break;case"merge-left":this._insertSplit(t,i,a,"horizontal",!1,!0);break;case"merge-right":this._insertSplit(t,i,a,"horizontal",!0,!0);break;case"merge-bottom":this._insertSplit(t,i,a,"vertical",!0,!0)}this.parent&&(this.attachWidget(t),this.parent.fit())}removeWidget(t){this._removeWidget(t),this.parent&&(this.detachWidget(t),this.parent.fit())}hitTestTabAreas(t,r){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=X.boxSizing(this.parent.node));let i=this.parent.node.getBoundingClientRect(),n=t-i.left-this._box.borderLeft,a=r-i.top-this._box.borderTop,o=this._root.hitTestTabNodes(n,a);if(!o)return null;let{tabBar:s,top:l,left:u,width:c,height:h}=o,d=this._box.borderLeft+this._box.borderRight,f=this._box.borderTop+this._box.borderBottom,p=i.width-d-(u+c),m=i.height-f-(l+h);return{tabBar:s,x:n,y:a,top:l,left:u,right:p,bottom:m,width:c,height:h}}init(){for(let t of(super.init(),this))this.attachWidget(t);for(let t of this.handles())this.parent.node.appendChild(t);this.parent.fit()}attachWidget(t){this.parent.node!==t.node.parentNode&&(this._items.set(t,new eQ(t)),this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterAttach))}detachWidget(t){if(this.parent.node!==t.node.parentNode)return;this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterDetach);let r=this._items.get(t);r&&(this._items.delete(t),r.dispose())}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_removeWidget(t){if(!this._root)return;let r=this._root.findTabNode(t);if(!r)return;if(tN.removeAria(t),r.tabBar.titles.length>1){r.tabBar.removeTab(t.title),this._hiddenMode===e$.HiddenMode.Scale&&1==r.tabBar.titles.length&&(r.tabBar.titles[0].owner.hiddenMode=e$.HiddenMode.Display);return}if(r.tabBar.dispose(),this._root===r){this._root=null;return}this._root.holdAllSizes();let i=r.parent;r.parent=null;let n=N.ArrayExt.removeFirstOf(i.children,r),a=N.ArrayExt.removeAt(i.handles,n);if(N.ArrayExt.removeAt(i.sizers,n),a.parentNode&&a.parentNode.removeChild(a),i.children.length>1)return void i.syncHandles();let o=i.parent;i.parent=null;let s=i.children[0],l=i.handles[0];if(i.children.length=0,i.handles.length=0,i.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===i){s.parent=null,this._root=s;return}let u=o.children.indexOf(i);if(s instanceof tN.TabLayoutNode){s.parent=o,o.children[u]=s;return}let c=N.ArrayExt.removeAt(o.handles,u);N.ArrayExt.removeAt(o.children,u),N.ArrayExt.removeAt(o.sizers,u),c.parentNode&&c.parentNode.removeChild(c);for(let t=0,r=s.children.length;t=i.length)&&(n=0),{type:"tab-area",widgets:i,currentIndex:n}}(r,i):function(r,i){let n=r.orientation,a=[],o=[];for(let s=0,l=r.children.length;s{let n=a(t,c,h),o=r(u.sizes[i]),s=c.createHandle();d.children.push(n),d.handles.push(s),d.sizers.push(o),n.parent=d}),d.syncHandles(),d.normalizeSizes(),d)};class i{constructor(t){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;let r=new eG,i=new eG;r.stretch=0,i.stretch=1,this.tabBar=t,this.sizers=[r,i]}get top(){return this._top}get left(){return this._left}get width(){return this._width}get height(){return this._height}*iterAllWidgets(){yield this.tabBar,yield*this.iterUserWidgets()}*iterUserWidgets(){for(let t of this.tabBar.titles)yield t.owner}*iterSelectedWidgets(){let t=this.tabBar.currentTitle;t&&(yield t.owner)}*iterTabBars(){yield this.tabBar}*iterHandles(){}findTabNode(t){return -1!==this.tabBar.titles.indexOf(t.title)?this:null}findSplitNode(t){return null}findFirstTabNode(){return this}hitTestTabNodes(t,r){return t=this._left+this._width||r=this._top+this._height?null:this}createConfig(){return{type:"tab-area",widgets:this.tabBar.titles.map(t=>t.owner),currentIndex:this.tabBar.currentIndex}}holdAllSizes(){}fit(t,r){let i=0,n=0,a=r.get(this.tabBar),o=this.tabBar.currentTitle,s=o?r.get(o.owner):void 0,[l,u]=this.sizers;return a&&a.fit(),s&&s.fit(),a&&!a.isHidden?(i=Math.max(i,a.minWidth),n+=a.minHeight,l.minSize=a.minHeight,l.maxSize=a.maxHeight):(l.minSize=0,l.maxSize=0),s&&!s.isHidden?(i=Math.max(i,s.minWidth),n+=s.minHeight,u.minSize=s.minHeight):u.minSize=0,u.maxSize=1/0,{minWidth:i,minHeight:n,maxWidth:1/0,maxHeight:1/0}}update(t,r,i,n,a,o){this._top=r,this._left=t,this._width=i,this._height=n;let s=o.get(this.tabBar),l=this.tabBar.currentTitle,u=l?o.get(l.owner):void 0;if(eq.calc(this.sizers,n),s&&!s.isHidden){let n=this.sizers[0].size;s.update(t,r,i,n),r+=n}if(u&&!u.isHidden){let n=this.sizers[1].size;u.update(t,r,i,n)}}}t.TabLayoutNode=i;class n{constructor(t){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=t}*iterAllWidgets(){for(let t of this.children)yield*t.iterAllWidgets()}*iterUserWidgets(){for(let t of this.children)yield*t.iterUserWidgets()}*iterSelectedWidgets(){for(let t of this.children)yield*t.iterSelectedWidgets()}*iterTabBars(){for(let t of this.children)yield*t.iterTabBars()}*iterHandles(){for(let t of(yield*this.handles,this.children))yield*t.iterHandles()}findTabNode(t){for(let r=0,i=this.children.length;rt.createConfig()),sizes:r}}syncHandles(){this.handles.forEach((t,r)=>{t.setAttribute("data-orientation",this.orientation),r===this.handles.length-1?t.classList.add("lm-mod-hidden"):t.classList.remove("lm-mod-hidden")})}holdSizes(){for(let t of this.sizers)t.sizeHint=t.size}holdAllSizes(){for(let t of this.children)t.holdAllSizes();this.holdSizes()}normalizeSizes(){let t=this.sizers.length;if(0===t)return;this.holdSizes();let r=this.sizers.reduce((t,r)=>t+r.sizeHint,0);if(0===r)for(let r of this.sizers)r.size=r.sizeHint=1/t;else for(let t of this.sizers)t.size=t.sizeHint/=r;this.normalized=!0}createNormalizedSizes(){let t=this.sizers.length;if(0===t)return[];let r=this.sizers.map(t=>t.size),i=r.reduce((t,r)=>t+r,0);if(0===i)for(let i=r.length-1;i>-1;i--)r[i]=1/t;else for(let t=r.length-1;t>-1;t--)r[t]/=i;return r}fit(t,r){let i="horizontal"===this.orientation,n=Math.max(0,this.children.length-1)*t,a=i?n:0,o=i?0:n;for(let n=0,s=this.children.length;nthis._createTabBar(),createHandle:()=>this._createHandle()},spacing:r.spacing,hiddenMode:r.hiddenMode}),this.overlay=r.overlay||new t.Overlay,this.node.appendChild(this.overlay.node)}dispose(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),super.dispose()}get hiddenMode(){return this.layout.hiddenMode}set hiddenMode(t){this.layout.hiddenMode=t}get layoutModified(){return this._layoutModified}get addRequested(){return this._addRequested}get renderer(){return this.layout.renderer}get spacing(){return this.layout.spacing}set spacing(t){this.layout.spacing=t}get mode(){return this._mode}set mode(t){if(this._mode===t)return;this._mode=t,this.dataset.mode=t;let r=this.layout;switch(t){case"multiple-document":for(let t of r.tabBars())t.show();break;case"single-document":r.restoreLayout(w.createSingleDocumentConfig(this));break;default:throw"unreachable"}et.postMessage(this,w.LayoutModified)}get tabsMovable(){return this._tabsMovable}set tabsMovable(t){for(let r of(this._tabsMovable=t,this.tabBars()))r.tabsMovable=t}get tabsConstrained(){return this._tabsConstrained}set tabsConstrained(t){this._tabsConstrained=t}get addButtonEnabled(){return this._addButtonEnabled}set addButtonEnabled(t){for(let r of(this._addButtonEnabled=t,this.tabBars()))r.addButtonEnabled=t}get isEmpty(){return this.layout.isEmpty}*widgets(){yield*this.layout.widgets()}*selectedWidgets(){yield*this.layout.selectedWidgets()}*tabBars(){yield*this.layout.tabBars()}*handles(){yield*this.layout.handles()}selectWidget(t){let r=(0,N.find)(this.tabBars(),r=>-1!==r.titles.indexOf(t.title));if(!r)throw Error("Widget is not contained in the dock panel.");r.currentTitle=t.title}activateWidget(t){this.selectWidget(t),t.activate()}saveLayout(){return this.layout.saveLayout()}restoreLayout(t){this._mode="multiple-document",this.layout.restoreLayout(t),(K.IS_EDGE||K.IS_IE)&&et.flush(),et.postMessage(this,w.LayoutModified)}addWidget(t,r={}){"single-document"===this._mode?this.layout.addWidget(t):this.layout.addWidget(t,r),et.postMessage(this,w.LayoutModified)}processMessage(t){"layout-modified"===t.type?this._layoutModified.emit(void 0):super.processMessage(t)}handleEvent(t){switch(t.type){case"lm-dragenter":this._evtDragEnter(t);break;case"lm-dragleave":this._evtDragLeave(t);break;case"lm-dragover":this._evtDragOver(t);break;case"lm-drop":this._evtDrop(t);break;case"pointerdown":this._evtPointerDown(t);break;case"pointermove":this._evtPointerMove(t);break;case"pointerup":this._evtPointerUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}}onBeforeAttach(t){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("pointerdown",this)}onAfterDetach(t){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("pointerdown",this),this._releaseMouse()}onChildAdded(t){w.isGeneratedTabBarProperty.get(t.child)||t.child.addClass("lm-DockPanel-widget")}onChildRemoved(t){w.isGeneratedTabBarProperty.get(t.child)||(t.child.removeClass("lm-DockPanel-widget"),et.postMessage(this,w.LayoutModified))}_evtDragEnter(t){t.mimeData.hasData("application/vnd.lumino.widget-factory")&&(t.preventDefault(),t.stopPropagation())}_evtDragLeave(t){t.preventDefault(),this._tabsConstrained&&t.source!==this||(t.stopPropagation(),this.overlay.hide(1))}_evtDragOver(t){t.preventDefault(),this._tabsConstrained&&t.source!==this||"invalid"===this._showOverlay(t.clientX,t.clientY)?t.dropAction="none":(t.stopPropagation(),t.dropAction=t.proposedAction)}_evtDrop(t){if(t.preventDefault(),this.overlay.hide(0),"none"===t.proposedAction){t.dropAction="none";return}let{clientX:r,clientY:i}=t,{zone:n,target:a}=w.findDropTarget(this,r,i,this._edges);if(this._tabsConstrained&&t.source!==this||"invalid"===n){t.dropAction="none";return}let o=t.mimeData.getData("application/vnd.lumino.widget-factory");if("function"!=typeof o){t.dropAction="none";return}let s=o();if(!(s instanceof e$)||s.contains(this)){t.dropAction="none";return}let l=a?w.getDropRef(a.tabBar):null;switch(n){case"root-all":this.addWidget(s);break;case"root-top":this.addWidget(s,{mode:"split-top"});break;case"root-left":this.addWidget(s,{mode:"split-left"});break;case"root-right":this.addWidget(s,{mode:"split-right"});break;case"root-bottom":this.addWidget(s,{mode:"split-bottom"});break;case"widget-all":case"widget-tab":this.addWidget(s,{mode:"tab-after",ref:l});break;case"widget-top":this.addWidget(s,{mode:"split-top",ref:l});break;case"widget-left":this.addWidget(s,{mode:"split-left",ref:l});break;case"widget-right":this.addWidget(s,{mode:"split-right",ref:l});break;case"widget-bottom":this.addWidget(s,{mode:"split-bottom",ref:l});break;default:throw"unreachable"}t.dropAction=t.proposedAction,t.stopPropagation(),this.activateWidget(s)}_evtKeyDown(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&(this._releaseMouse(),et.postMessage(this,w.LayoutModified))}_evtPointerDown(t){if(0!==t.button)return;let r=this.layout,i=t.target,n=(0,N.find)(r.handles(),t=>t.contains(i));if(!n)return;t.preventDefault(),t.stopPropagation(),this._document.addEventListener("keydown",this,!0),this._document.addEventListener("pointerup",this,!0),this._document.addEventListener("pointermove",this,!0),this._document.addEventListener("contextmenu",this,!0);let a=n.getBoundingClientRect(),o=t.clientX-a.left,s=t.clientY-a.top,l=window.getComputedStyle(n),u=ec.overrideCursor(l.cursor,this._document);this._pressData={handle:n,deltaX:o,deltaY:s,override:u}}_evtPointerMove(t){if(!this._pressData)return;t.preventDefault(),t.stopPropagation();let r=this.node.getBoundingClientRect(),i=t.clientX-r.left-this._pressData.deltaX,n=t.clientY-r.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,i,n)}_evtPointerUp(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse(),et.postMessage(this,w.LayoutModified))}_releaseMouse(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,this._document.removeEventListener("keydown",this,!0),this._document.removeEventListener("pointerup",this,!0),this._document.removeEventListener("pointermove",this,!0),this._document.removeEventListener("contextmenu",this,!0))}_showOverlay(t,r){let{zone:i,target:n}=w.findDropTarget(this,t,r,this._edges);if("invalid"===i)return this.overlay.hide(100),i;let a,o,s,l,u=X.boxSizing(this.node),c=this.node.getBoundingClientRect();switch(i){case"root-all":a=u.paddingTop,o=u.paddingLeft,s=u.paddingRight,l=u.paddingBottom;break;case"root-top":a=u.paddingTop,o=u.paddingLeft,s=u.paddingRight,l=c.height*w.GOLDEN_RATIO;break;case"root-left":a=u.paddingTop,o=u.paddingLeft,s=c.width*w.GOLDEN_RATIO,l=u.paddingBottom;break;case"root-right":a=u.paddingTop,o=c.width*w.GOLDEN_RATIO,s=u.paddingRight,l=u.paddingBottom;break;case"root-bottom":a=c.height*w.GOLDEN_RATIO,o=u.paddingLeft,s=u.paddingRight,l=u.paddingBottom;break;case"widget-all":a=n.top,o=n.left,s=n.right,l=n.bottom;break;case"widget-top":a=n.top,o=n.left,s=n.right,l=n.bottom+n.height/2;break;case"widget-left":a=n.top,o=n.left,s=n.right+n.width/2,l=n.bottom;break;case"widget-right":a=n.top,o=n.left+n.width/2,s=n.right,l=n.bottom;break;case"widget-bottom":a=n.top+n.height/2,o=n.left,s=n.right,l=n.bottom;break;case"widget-tab":{let t=n.tabBar.node.getBoundingClientRect().height;a=n.top,o=n.left,s=n.right,l=n.bottom+n.height-t;break}default:throw"unreachable"}return this.overlay.show({top:a,left:o,right:s,bottom:l}),i}_createTabBar(){let t=this._renderer.createTabBar(this._document);return w.isGeneratedTabBarProperty.set(t,!0),"single-document"===this._mode&&t.hide(),t.tabsMovable=this._tabsMovable,t.allowDeselect=!1,t.addButtonEnabled=this._addButtonEnabled,t.removeBehavior="select-previous-tab",t.insertBehavior="select-tab-if-needed",t.tabMoved.connect(this._onTabMoved,this),t.currentChanged.connect(this._onCurrentChanged,this),t.tabCloseRequested.connect(this._onTabCloseRequested,this),t.tabDetachRequested.connect(this._onTabDetachRequested,this),t.tabActivateRequested.connect(this._onTabActivateRequested,this),t.addRequested.connect(this._onTabAddRequested,this),t}_createHandle(){return this._renderer.createHandle()}_onTabMoved(){et.postMessage(this,w.LayoutModified)}_onCurrentChanged(t,r){let{previousTitle:i,currentTitle:n}=r;i&&i.owner.hide(),n&&n.owner.show(),(K.IS_EDGE||K.IS_IE)&&et.flush(),et.postMessage(this,w.LayoutModified)}_onTabAddRequested(t){this._addRequested.emit(t)}_onTabActivateRequested(t,r){r.title.owner.activate()}_onTabCloseRequested(t,r){r.title.owner.close()}_onTabDetachRequested(t,r){if(this._drag)return;t.releaseMouse();let{title:i,tab:n,clientX:a,clientY:o,offset:s}=r,l=new V.MimeData;l.setData("application/vnd.lumino.widget-factory",()=>i.owner);let u=n.cloneNode(!0);s&&(u.style.top=`-${s.y}px`,u.style.left=`-${s.x}px`),this._drag=new ec({document:this._document,mimeData:l,dragImage:u,proposedAction:"move",supportedActions:"move",source:this}),n.classList.add("lm-mod-hidden");let c=()=>{this._drag=null,n.classList.remove("lm-mod-hidden")};this._drag.start(a,o).then(c)}},tq=tU||(tU={});tq.Overlay=class{constructor(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.style.position="absolute",this.node.style.contain="strict"}show(t){let r=this.node.style;r.top=`${t.top}px`,r.left=`${t.left}px`,r.right=`${t.right}px`,r.bottom=`${t.bottom}px`,clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"))}hide(t){if(!this._hidden){if(t<=0){clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden");return}-1===this._timer&&(this._timer=window.setTimeout(()=>{this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden")},t))}}};class tG{createTabBar(t){let r=new tk({document:t});return r.addClass("lm-DockPanel-tabBar"),r}createHandle(){let t=document.createElement("div");return t.className="lm-DockPanel-handle",t}}tq.Renderer=tG,tq.defaultRenderer=new tG,(g=w||(w={})).GOLDEN_RATIO=.618,g.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},g.LayoutModified=new ei("layout-modified"),g.isGeneratedTabBarProperty=new en({name:"isGeneratedTabBar",create:()=>!1}),g.createSingleDocumentConfig=function(t){if(t.isEmpty)return{main:null};let r=Array.from(t.widgets()),i=t.selectedWidgets().next().value,n=i?r.indexOf(i):-1;return{main:{type:"tab-area",widgets:r,currentIndex:n}}},g.findDropTarget=function(t,r,i,n){let a;if(!X.hitTest(t.node,r,i))return{zone:"invalid",target:null};let o=t.layout;if(o.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===t.mode){let a=t.node.getBoundingClientRect(),o=r-a.left+1,s=i-a.top+1,l=a.right-r,u=a.bottom-i;switch(Math.min(s,l,u,o)){case s:if(sd&&c>d&&u>f&&h>f)return{zone:"widget-all",target:s};switch(l/=d,u/=f,Math.min(l,u,c/=d,h/=f)){case l:a="widget-left";break;case u:a="widget-top";break;case c:a="widget-right";break;case h:a="widget-bottom";break;default:throw"unreachable"}return{zone:a,target:s}},g.getDropRef=function(t){return 0===t.titles.length?null:t.currentTitle?t.currentTitle.owner:t.titles[t.titles.length-1].owner};var tH=class t extends eW{constructor(t={}){super(t),this._dirty=!1,this._rowSpacing=4,this._columnSpacing=4,this._items=[],this._rowStarts=[],this._columnStarts=[],this._rowSizers=[new eG],this._columnSizers=[new eG],this._box=null,void 0!==t.rowCount&&T.reallocSizers(this._rowSizers,t.rowCount),void 0!==t.columnCount&&T.reallocSizers(this._columnSizers,t.columnCount),void 0!==t.rowSpacing&&(this._rowSpacing=T.clampValue(t.rowSpacing)),void 0!==t.columnSpacing&&(this._columnSpacing=T.clampValue(t.columnSpacing))}dispose(){for(let t of this._items){let r=t.widget;t.dispose(),r.dispose()}this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,super.dispose()}get rowCount(){return this._rowSizers.length}set rowCount(t){t!==this.rowCount&&(T.reallocSizers(this._rowSizers,t),this.parent&&this.parent.fit())}get columnCount(){return this._columnSizers.length}set columnCount(t){t!==this.columnCount&&(T.reallocSizers(this._columnSizers,t),this.parent&&this.parent.fit())}get rowSpacing(){return this._rowSpacing}set rowSpacing(t){t=T.clampValue(t),this._rowSpacing!==t&&(this._rowSpacing=t,this.parent&&this.parent.fit())}get columnSpacing(){return this._columnSpacing}set columnSpacing(t){t=T.clampValue(t),this._columnSpacing!==t&&(this._columnSpacing=t,this.parent&&this.parent.fit())}rowStretch(t){let r=this._rowSizers[t];return r?r.stretch:-1}setRowStretch(t,r){let i=this._rowSizers[t];i&&(r=T.clampValue(r),i.stretch!==r&&(i.stretch=r,this.parent&&this.parent.update()))}columnStretch(t){let r=this._columnSizers[t];return r?r.stretch:-1}setColumnStretch(t,r){let i=this._columnSizers[t];i&&(r=T.clampValue(r),i.stretch!==r&&(i.stretch=r,this.parent&&this.parent.update()))}*[Symbol.iterator](){for(let t of this._items)yield t.widget}addWidget(t){-1===N.ArrayExt.findFirstIndex(this._items,r=>r.widget===t)&&(this._items.push(new eQ(t)),this.parent&&this.attachWidget(t))}removeWidget(t){let r=N.ArrayExt.findFirstIndex(this._items,r=>r.widget===t);if(-1===r)return;let i=N.ArrayExt.removeAt(this._items,r);this.parent&&this.detachWidget(t),i.dispose()}init(){for(let t of(super.init(),this))this.attachWidget(t)}attachWidget(t){this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterAttach),this.parent.fit()}detachWidget(t){this.parent.isAttached&&et.sendMessage(t,e$.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&et.sendMessage(t,e$.Msg.AfterDetach),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_fit(){for(let t=0,r=this.rowCount;t!t.isHidden);for(let t=0,i=r.length;t({row:0,column:0,rowSpan:1,columnSpan:1}),changed:function(t){t.parent&&t.parent.layout instanceof tH&&t.parent.fit()}}),v.normalizeConfig=function(t){return{row:Math.max(0,Math.floor(t.row||0)),column:Math.max(0,Math.floor(t.column||0)),rowSpan:Math.max(1,Math.floor(t.rowSpan||0)),columnSpan:Math.max(1,Math.floor(t.columnSpan||0))}},v.clampValue=function(t){return Math.max(0,Math.floor(t))},v.rowSpanCmp=function(t,r){let i=v.cellConfigProperty.get(t.widget),n=v.cellConfigProperty.get(r.widget);return i.rowSpan-n.rowSpan},v.columnSpanCmp=function(t,r){let i=v.cellConfigProperty.get(t.widget),n=v.cellConfigProperty.get(r.widget);return i.columnSpan-n.columnSpan},v.reallocSizers=function(t,r){for(r=Math.max(1,Math.floor(r));t.lengthr&&(t.length=r)},v.distributeMin=function(t,r,i,n){if(i=n)return;let o=(n-a)/(i-r+1);for(let n=r;n<=i;++n)t[n].minSize+=o};var t$=class t extends e${constructor(r={}){super({node:A.createNode()}),this._activeIndex=-1,this._tabFocusIndex=0,this._menus=[],this._childMenu=null,this._overflowMenu=null,this._menuItemSizes=[],this._overflowIndex=-1,this.addClass("lm-MenuBar"),this.setFlag(e$.Flag.DisallowLayout),this.renderer=r.renderer||t.defaultRenderer,this._forceItemsPosition=r.forceItemsPosition||{forceX:!0,forceY:!0},this._overflowMenuOptions=r.overflowMenuOptions||{isVisible:!0}}dispose(){this._closeChildMenu(),this._menus.length=0,super.dispose()}get childMenu(){return this._childMenu}get overflowIndex(){return this._overflowIndex}get overflowMenu(){return this._overflowMenu}get contentNode(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]}get activeMenu(){return this._menus[this._activeIndex]||null}set activeMenu(t){this.activeIndex=t?this._menus.indexOf(t):-1}get activeIndex(){return this._activeIndex}set activeIndex(t){(t<0||t>=this._menus.length)&&(t=-1),t>-1&&0===this._menus[t].items.length&&(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this.update())}get menus(){return this._menus}openActiveMenu(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))}addMenu(t,r=!0){this.insertMenu(this._menus.length,t,r)}insertMenu(t,r,i=!0){this._closeChildMenu();let n=this._menus.indexOf(r),a=Math.max(0,Math.min(t,this._menus.length));if(-1===n){N.ArrayExt.insert(this._menus,a,r),r.addClass("lm-MenuBar-menu"),r.aboutToClose.connect(this._onMenuAboutToClose,this),r.menuRequested.connect(this._onMenuMenuRequested,this),r.title.changed.connect(this._onTitleChanged,this),i&&this.update();return}a===this._menus.length&&a--,n!==a&&(N.ArrayExt.move(this._menus,n,a),i&&this.update())}removeMenu(t,r=!0){this.removeMenuAt(this._menus.indexOf(t),r)}removeMenuAt(t,r=!0){this._closeChildMenu();let i=N.ArrayExt.removeAt(this._menus,t);i&&(i.aboutToClose.disconnect(this._onMenuAboutToClose,this),i.menuRequested.disconnect(this._onMenuMenuRequested,this),i.title.changed.disconnect(this._onTitleChanged,this),i.removeClass("lm-MenuBar-menu"),r&&this.update())}clearMenus(){if(0!==this._menus.length){for(let t of(this._closeChildMenu(),this._menus))t.aboutToClose.disconnect(this._onMenuAboutToClose,this),t.menuRequested.disconnect(this._onMenuMenuRequested,this),t.title.changed.disconnect(this._onTitleChanged,this),t.removeClass("lm-MenuBar-menu");this._menus.length=0,this.update()}}handleEvent(t){switch(t.type){case"keydown":this._evtKeyDown(t);break;case"pointerdown":this._evtPointerDown(t);break;case"pointermove":case"pointerleave":this._evtPointerMove(t);break;case"focusout":this._evtFocusOut(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}}onBeforeAttach(t){this.node.addEventListener("keydown",this),this.node.addEventListener("pointerdown",this),this.node.addEventListener("pointermove",this),this.node.addEventListener("pointerleave",this),this.node.addEventListener("focusout",this),this.node.addEventListener("contextmenu",this)}onAfterDetach(t){this.node.removeEventListener("keydown",this),this.node.removeEventListener("pointerdown",this),this.node.removeEventListener("pointermove",this),this.node.removeEventListener("pointerleave",this),this.node.removeEventListener("focusout",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()}onActivateRequest(t){this.isAttached&&this._focusItemAt(0)}onResize(t){this.update(),super.onResize(t)}onUpdateRequest(t){var r;let i=this._menus,n=this.renderer,a=this._activeIndex,o=this._tabFocusIndex>=0&&this._tabFocusIndex-1?this._overflowIndex:i.length,l=0,u=!1,c=Array(s=null!==this._overflowMenu?s-1:s);for(let t=0;t{this._tabFocusIndex=t,this.activeIndex=t}}),l+=this._menuItemSizes[t],i[t].title.label===this._overflowMenuOptions.title&&(u=!0,s--);if(this._overflowMenuOptions.isVisible){if(this._overflowIndex>-1&&!u){if(null===this._overflowMenu){let t=null!=(r=this._overflowMenuOptions.title)?r:"...";this._overflowMenu=new tx({commands:new eS}),this._overflowMenu.title.label=t,this._overflowMenu.title.mnemonic=0,this.addMenu(this._overflowMenu,!1)}for(let t=i.length-2;t>=s;t--){let r=this.menus[t];r.title.mnemonic=0,this._overflowMenu.insertItem(0,{type:"submenu",submenu:r}),this.removeMenu(r,!1)}c[s]=n.renderItem({title:this._overflowMenu.title,active:s===a&&0!==i[s].items.length,tabbable:s===o,disabled:0===i[s].items.length,onfocus:()=>{this._tabFocusIndex=s,this.activeIndex=s}}),s++}else if(null!==this._overflowMenu){let t=this._overflowMenu.items,r=this.node.offsetWidth,a=this._overflowMenu.items.length;for(let u=0;uthis._menuItemSizes[a]){let r=t[0].submenu;this._overflowMenu.removeItemAt(0),this.insertMenu(s,r,!1),c[s]=n.renderItem({title:r.title,active:!1,tabbable:s===o,disabled:0===i[s].items.length,onfocus:()=>{this._tabFocusIndex=s,this.activeIndex=s}}),s++}}0===this._overflowMenu.items.length&&(this.removeMenu(this._overflowMenu,!1),c.pop(),this._overflowMenu=null,this._overflowIndex=-1)}}eV.render(c,this.contentNode),this._updateOverflowIndex()}_updateOverflowIndex(){if(!this._overflowMenuOptions.isVisible)return;let t=this.contentNode.childNodes,r=this.node.offsetWidth,i=0,n=-1,a=t.length;if(0==this._menuItemSizes.length)for(let o=0;or&&-1===n&&(n=o)}else for(let t=0;tr){n=t;break}this._overflowIndex=n}_evtKeyDown(t){let r=t.keyCode;if(9===r){this.activeIndex=-1;return}if(t.preventDefault(),t.stopPropagation(),13===r||32===r||38===r||40===r){if(this.activeIndex=this._tabFocusIndex,this.activeIndex!==this._tabFocusIndex)return;this.openActiveMenu();return}if(27===r){this._closeChildMenu(),this._focusItemAt(this.activeIndex);return}if(37===r||39===r){let t=37===r?-1:1,i=this._tabFocusIndex+t,n=this._menus.length;for(let r=0;rX.hitTest(r,t.clientX,t.clientY));if(-1===r)return void this._closeChildMenu();if(0===t.button)if(this._childMenu)this._closeChildMenu(),this.activeIndex=r;else{t.preventDefault();let i=this._positionForMenu(r);tx.saveWindowData(),this.activeIndex=r,this._openChildMenu(i)}}_evtPointerMove(t){let r=N.ArrayExt.findFirstIndex(this.contentNode.children,r=>X.hitTest(r,t.clientX,t.clientY));if(r===this._activeIndex||-1===r&&this._childMenu)return;let i=r>=0&&this._childMenu?this._positionForMenu(r):null;tx.saveWindowData(),this.activeIndex=r,i&&this._openChildMenu(i)}_positionForMenu(t){let{left:r,bottom:i}=this.contentNode.children[t].getBoundingClientRect();return{top:i,left:r}}_evtFocusOut(t){this._childMenu||this.node.contains(t.relatedTarget)||(this.activeIndex=-1)}_focusItemAt(t){let r=this.contentNode.childNodes[t];r&&r.focus()}_openChildMenu(t={}){let r=this.activeMenu;if(!r)return void this._closeChildMenu();let i=this._childMenu;if(i===r)return;this._childMenu=r,i?i.close():document.addEventListener("pointerdown",this,!0),this._tabFocusIndex=this.activeIndex,et.sendMessage(this,e$.Msg.UpdateRequest);let{left:n,top:a}=t;(typeof n>"u"||typeof a>"u")&&({left:n,top:a}=this._positionForMenu(this._activeIndex)),i||this.addClass("lm-mod-active"),r.items.length>0&&r.open(n,a,this._forceItemsPosition)}_closeChildMenu(){if(!this._childMenu)return;this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0);let t=this._childMenu;this._childMenu=null,t.close(),this.activeIndex=-1}_onMenuAboutToClose(t){t===this._childMenu&&(this.removeClass("lm-mod-active"),document.removeEventListener("pointerdown",this,!0),this._childMenu=null,this.activeIndex=-1)}_onMenuMenuRequested(t,r){if(t!==this._childMenu)return;let i=this._activeIndex,n=this._menus.length;switch(r){case"next":this.activeIndex=i===n-1?0:i+1;break;case"previous":this.activeIndex=0===i?n-1:i-1}this.openActiveMenu()}_onTitleChanged(){this.update()}},tW=t$||(t$={});class tY{renderItem(t){let r=this.createItemClass(t),i=this.createItemDataset(t),n=this.createItemARIA(t);return ez.li({className:r,dataset:i,...t.disabled?{}:{tabindex:t.tabbable?"0":"-1"},onfocus:t.onfocus,...n},this.renderIcon(t),this.renderLabel(t))}renderIcon(t){let r=this.createIconClass(t);return ez.div({className:r},t.title.icon,t.title.iconLabel)}renderLabel(t){let r=this.formatLabel(t);return ez.div({className:"lm-MenuBar-itemLabel"},r)}createItemClass(t){let r="lm-MenuBar-item";return t.title.className&&(r+=` ${t.title.className}`),t.active&&!t.disabled&&(r+=" lm-mod-active"),r}createItemDataset(t){return t.title.dataset}createItemARIA(t){return{role:"menuitem","aria-haspopup":"true","aria-disabled":t.disabled?"true":"false"}}createIconClass(t){let r="lm-MenuBar-itemIcon",i=t.title.iconClass;return i?`${r} ${i}`:r}formatLabel(t){let{label:r,mnemonic:i}=t.title;if(i<0||i>=r.length)return r;let n=r.slice(0,i),a=r.slice(i+1),o=r[i];return[n,ez.span({className:"lm-MenuBar-itemMnemonic"},o),a]}}tW.Renderer=tY,tW.defaultRenderer=new tY,(x=A||(A={})).createNode=function(){let t=document.createElement("div"),r=document.createElement("ul");return r.className="lm-MenuBar-content",t.appendChild(r),r.setAttribute("role","menubar"),t},x.findMnemonic=function(t,r,i){let n=-1,a=-1,o=!1,s=r.toUpperCase();for(let r=0,l=t.length;r=0&&h1&&this.widgets.forEach(t=>{t.hiddenMode=this._hiddenMode}))}dispose(){for(let t of this._items)t.dispose();this._box=null,this._items.length=0,super.dispose()}attachWidget(t,r){this._hiddenMode===e$.HiddenMode.Scale&&this._items.length>0?(1===this._items.length&&(this.widgets[0].hiddenMode=e$.HiddenMode.Scale),r.hiddenMode=e$.HiddenMode.Scale):r.hiddenMode=e$.HiddenMode.Display,N.ArrayExt.insert(this._items,t,new eQ(r)),this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeAttach),this.parent.node.appendChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterAttach),this.parent.fit()}moveWidget(t,r,i){N.ArrayExt.move(this._items,t,r),this.parent.update()}detachWidget(t,r){let i=N.ArrayExt.removeAt(this._items,t);this.parent.isAttached&&et.sendMessage(r,e$.Msg.BeforeDetach),this.parent.node.removeChild(r.node),this.parent.isAttached&&et.sendMessage(r,e$.Msg.AfterDetach),i.widget.node.style.zIndex="",this._hiddenMode===e$.HiddenMode.Scale&&(r.hiddenMode=e$.HiddenMode.Display,1===this._items.length&&(this._items[0].widget.hiddenMode=e$.HiddenMode.Display)),i.dispose(),this.parent.fit()}onBeforeShow(t){super.onBeforeShow(t),this.parent.update()}onBeforeAttach(t){super.onBeforeAttach(t),this.parent.fit()}onChildShown(t){this.parent.fit()}onChildHidden(t){this.parent.fit()}onResize(t){this.parent.isVisible&&this._update(t.width,t.height)}onUpdateRequest(t){this.parent.isVisible&&this._update(-1,-1)}onFitRequest(t){this.parent.isAttached&&this._fit()}_fit(){let t=0,r=0;for(let i=0,n=this._items.length;i{this.createGraph(this._model)})}renderModel(t){if(this.hasGraphElement())return JSON.stringify(this._model?.data[this._mimeType])===JSON.stringify(t.data[this._mimeType])?Promise.resolve():(this._model=t,this.createGraph(t));this._model=t;let r=t.data["image/png"];return null!=r?(this.updateImage(r),Promise.resolve()):this.createGraph(t)}hasGraphElement(){return null!==this.node.querySelector(".plot-container")}updateImage(t){this.hideGraph(),this._img_el.src="data:image/png;base64,"+t,this.showImage()}hideGraph(){let t=this.node.querySelector(".plot-container");null!=t&&(t.style.display="none")}showGraph(){let t=this.node.querySelector(".plot-container");null!=t&&(t.style.display="block")}hideImage(){let t=this.node.querySelector(".plot-img");null!=t&&(t.style.display="none")}showImage(){let t=this.node.querySelector(".plot-img");null!=t&&(t.style.display="block")}createGraph(r){let{data:i,layout:n,frames:a,config:o}=r.data[this._mimeType];return n.height||(n.height=360),(async()=>(null===t.Plotly&&(t.Plotly=await Promise.resolve().then(()=>O(j())),t._resolveLoadingPlotly()),t.loadingPlotly))().then(()=>t.Plotly.react(this.node,i,n,o)).then(i=>{this.showGraph(),this.hideImage(),this.update(),a&&t.Plotly.addFrames(this.node,a),this.node.offsetWidth>0&&this.node.offsetHeight>0&&t.Plotly.toImage(i,{format:"png",width:this.node.offsetWidth,height:this.node.offsetHeight}).then(t=>{let i=t.split(",")[1];r.data["image/png"]!==i&&r.setData({data:{...r.data,"image/png":i}})}),this.node.on("plotly_webglcontextlost",()=>{let t=r.data["image/png"];if(null!=t)return this.updateImage(t),Promise.resolve()})})}onAfterShow(t){this.update()}onResize(t){this.update()}onUpdateRequest(r){t.Plotly&&this.isVisible&&this.hasGraphElement()&&t.Plotly.redraw(this.node).then(()=>{t.Plotly.Plots.resize(this.node)})}static{this.Plotly=null}static{this.loadingPlotly=new Promise(r=>{t._resolveLoadingPlotly=r})}},tJ={safe:!0,mimeTypes:[tX],createRenderer:t=>new tK(t)},tQ=[{id:"@jupyterlab/plotly-extension:factory",rendererFactory:tJ,rank:2,dataType:"json",fileTypes:[{name:"plotly",mimeTypes:[tX],extensions:[".plotly",".plotly.json"],iconClass:"jp-MaterialIcon jp-PlotlyIcon"}],documentWidgetFactoryOptions:{name:"Plotly",primaryFileType:"plotly",fileTypes:["plotly","json"],defaultFor:["plotly"]}}];i.d(r,{MIME_TYPE:()=>tX,RenderedPlotly:()=>tK,default:()=>tQ,rendererFactory:()=>tJ})},3(t){var r,i,n,a=t.exports={};function o(){throw Error("setTimeout has not been defined")}function s(){throw Error("clearTimeout has not been defined")}try{r="function"==typeof setTimeout?setTimeout:o}catch(t){r=o}try{i="function"==typeof clearTimeout?clearTimeout:s}catch(t){i=s}function l(t){if(r===setTimeout)return setTimeout(t,0);if((r===o||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(i){try{return r.call(null,t,0)}catch(i){return r.call(this,t,0)}}}var u=[],c=!1,h=-1;function d(){c&&n&&(c=!1,n.length?u=n.concat(u):h=-1,u.length&&f())}function f(){if(!c){var t=l(d);c=!0;for(var r=u.length;r;){for(n=u,u=[];++h1)for(var i=1;i{"use strict";var e,n,r,t,o,i,u,a,c,l,f,s,p,h,d,v,g,y,m,b,S,j,w,E,k,x,T,P,A,C,O,D,M,L,N,$,_,z={0(e,n,r){var t={"./index":()=>r.e(0).then(()=>()=>r(2)),"./mimeExtension":()=>r.e(0).then(()=>()=>r(2))},o=function(e,n){return r.R=n,n=r.o(t,e)?t[e]():Promise.resolve().then(()=>{throw Error('Module "'+e+'" does not exist in container.')}),r.R=void 0,n},i=function(e,n){if(r.S){var t="default",o=r.S[t];if(o&&o!==e)throw Error("Container initialization failed as it has already been initialized with a different share scope");return r.S[t]=e,r.I(t,n)}};r.d(n,{get:()=>o,init:()=>i})}},I={};function R(e){var n=I[e];if(void 0!==n)return n.exports;var r=I[e]={exports:{}};return z[e](r,r.exports,R),r.exports}R.m=z,R.c=I,R.d=(e,n,r)=>{var t=(n,r)=>{for(var t in n)R.o(n,t)&&!R.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,[r]:n[t]})};t(n,"get"),t(r,"value")},R.f={},R.e=e=>Promise.all(Object.keys(R.f).reduce((n,r)=>(R.f[r](e,n),n),[])),R.u=e=>""+e+".03957c7088ad5ed0.js?v=03957c7088ad5ed0",R.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),R.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),U={},R.l=function(e,n,r,t){if(U[e])return void U[e].push(n);if(void 0!==r)for(var o,i,u=document.getElementsByTagName("script"),a=0;a{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},R.S={},R.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"jupyterlab-plotly",version:"7.1.0",factory:()=>R.e(0).then(()=>()=>R(2)),eager:0,treeShakingMode:null}]},uniqueName:"jupyterlab-plotly"},q={},B={},R.I=function(e,n){n||(n=[]);var r=B[e];if(r||(r=B[e]={}),!(n.indexOf(r)>=0)){if(n.push(r),q[e])return q[e];R.o(R.S,e)||(R.S[e]={});var t=R.S[e],o=function(e){"u">typeof console&&console.warn&&console.warn(e)},i=R.initializeSharingData.uniqueName,u=function(e,n,r,o){var u=t[e]=t[e]||{},a=u[n];(!a||!a.loaded&&(!o!=!a.eager?o:i>a.from))&&(u[n]={get:r,from:i,eager:!!o})},a=function(r){var t=function(e){o("Initialization of sharing external failed: "+e)};try{var i=R(r);if(!i)return;var u=function(r){return r&&r.init&&r.init(R.S[e],n)};if(i.then)return c.push(i.then(u,t));var a=u(i);if(a&&a.then)return c.push(a.catch(t))}catch(e){t(e)}},c=[],l=R.initializeSharingData.scopeToSharingDataMapping;return(l[e]&&l[e].forEach(function(e){"object"==typeof e?u(e.name,e.version,e.factory,e.eager):a(e)}),c.length)?q[e]=Promise.all(c).then(function(){return q[e]=1}):q[e]=1}},R.g.importScripts&&(J=R.g.location+"");var U,q,B,J,Y=R.g.document;if(!J&&Y&&(Y.currentScript&&"SCRIPT"===Y.currentScript.tagName.toUpperCase()&&(J=Y.currentScript.src),!J)){var V=Y.getElementsByTagName("script");if(V.length)for(var F=V.length-1;F>-1&&(!J||!/^http(s?):/.test(J));)J=V[F--].src}if(!J)throw Error("Automatic publicPath is not supported in this browser");R.p=J=J.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),R.consumesLoadingData={chunkMapping:{},moduleIdToConsumeDataMapping:{},initialConsumes:[]},e=function(e){return e.split(".").map(function(e){return+e==e?+e:e})},n=function(n){var r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?[0].concat(e(r[1])):[0];r[2]&&(t.length++,t.push.apply(t,e(r[2])));let o=t[t.length-1];for(;t.length&&(void 0===o||/^[*xX]$/.test(o));)t.pop(),o=t[t.length-1];return t},t=function(e){return 1===e.length?[0]:2===e.length?[1].concat(e.slice(1)):3===e.length?[2].concat(e.slice(1)):[e.length].concat(e.slice(1))},o=function(e){return[-e[0]-1].concat(e.slice(1))},i=function(e){let n=/^(\^|~|<=|<|>=|>|=|v|!)/.exec(e),i=n?n[0]:"",u=r(i.length?e.slice(i.length).trim():e.trim());switch(i){case"^":if(u.length>1&&0===u[1]){if(u.length>2&&0===u[2])return[3].concat(u.slice(1));return[2].concat(u.slice(1))}return[1].concat(u.slice(1));case"~":return[2].concat(u.slice(1));case">=":return u;case"=":case"v":case"":return t(u);case"<":return o(u);case">":return[,t(u),0,u,2];case"<=":return[,t(u),o(u),1];case"!":return[,t(u),0];default:throw Error("Unexpected start value")}},u=function(e,n){if(1===e.length)return e[0];let r=[];for(let n of e.slice().reverse())0 in n?r.push(n):r.push.apply(r,n.slice(1));return[,].concat(r,e.slice(1).map(()=>n))};return u(n.split(/\s*\|\|\s*/).map(function(e){let n=e.split(/\s+-\s+/);if(1===n.length){e=e.trim();let n=[],r=/[-0-9A-Za-z]\s+/g;for(var a,c=0;a=r.exec(e);){let r=a.index+1;n.push(i(e.slice(c,r).trim())),c=r}return n.push(i(e.slice(c).trim())),u(n,2)}let l=r(n[0]),f=r(n[1]);return[,t(f),o(f),1,l,2]}),1)},r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?e(r[1]):[];return r[2]&&(t.length++,t.push.apply(t,e(r[2]))),r[3]&&(t.push([]),t.push.apply(t,e(r[3]))),t},t=function(e,n){e=r(e),n=r(n);for(var t=0;;){if(t>=e.length)return t=n.length)return"u"==i;var u=n[t],a=(typeof u)[0];if(i==a){if("o"!=i&&"u"!=i&&o!=u)return o=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var t=1,i=1;i0?".":"")+(t=2,u)}return r}for(var c=[],i=1;i=n.length||"o"==(f=(typeof(l=n[u]))[0])){if(!c)return!0;if("u"==s)return a>t&&!o;return""==s!=o}if("u"==f){if(!c||"u"!=s)return!1}else if(c)if(s==f)if(a<=t){if(l!=e[a])return!1}else{if(o?l>e[a]:ltypeof console&&console.warn&&console.warn(e)},y=function(e,n,r,t){g(d(e,n,r,t))},m=function(e){return e.loaded=1,e.get()},S=(b=function(e){return function(n,r,t,o){var i=R.I(n);return i&&i.then?i.then(e.bind(e,n,R.S[n],r,t,o)):e(n,R.S[n],r,t,o)}})(function(e,n,r){return u(e,r),m(a(n,r))}),j=b(function(e,n,r,t){return n&&R.o(n,r)?m(a(n,r)):t()}),w=b(function(e,n,r,t){return u(e,r),m(h(n,r,t)||y(n,e,r,t)||a(n,r))}),E=b(function(e,n,r){return u(e,r),f(n,e,r)}),k=b(function(e,n,r,t){return u(e,r),s(n,e,r,t)}),x=b(function(e,n,r,t){return u(e,r),v(n,e,r,t)}),T=b(function(e,n,r,t){return u(e,r),p(n,e,r,t)}),P=b(function(e,n,r,t,o){return n&&R.o(n,r)?m(h(n,r,t)||y(n,e,r,t)||a(n,r)):o()}),A=b(function(e,n,r,t){return n&&R.o(n,r)?f(n,e,r):t()}),C=b(function(e,n,r,t,o){return n&&R.o(n,r)?s(n,e,r,t):o()}),O=b(function(e,n,r,t,o){var i=n&&R.o(n,r)&&h(n,r,t);return i?m(i):o()}),D=b(function(e,n,r,t,o){return n&&R.o(n,r)?p(n,e,r,t):o()}),M=function(e){var r=!1,t=!1,o=!1,i=!1,u=[e.shareScope,e.shareKey];return(e.requiredVersion?(e.strictVersion&&(r=!0),e.singleton&&(t=!0),u.push(n(e.requiredVersion)),o=!0):e.singleton&&(t=!0),e.fallback&&(i=!0,u.push(e.fallback)),r&&t&&o&&i)?function(){return D.apply(null,u)}:r&&o&&i?function(){return O.apply(null,u)}:t&&o&&i?function(){return C.apply(null,u)}:r&&t&&o?function(){return T.apply(null,u)}:t&&i?function(){return A.apply(null,u)}:o&&i?function(){return P.apply(null,u)}:r&&o?function(){return x.apply(null,u)}:t&&o?function(){return k.apply(null,u)}:t?function(){return E.apply(null,u)}:o?function(){return w.apply(null,u)}:i?function(){return j.apply(null,u)}:function(){return S.apply(null,u)}},L={},R.f.consumes=function(e,n){var r=R.consumesLoadingData.moduleIdToConsumeDataMapping,t=R.consumesLoadingData.chunkMapping;R.o(t,e)&&t[e].forEach(function(e){if(R.o(L,e))return n.push(L[e]);var t=function(n){L[e]=0,R.m[e]=function(r){delete R.c[e],r.exports=n()}},o=function(n){delete L[e],R.m[e]=function(r){throw delete R.c[e],n}};try{var i=M(r[e])();i.then?n.push(L[e]=i.then(t).catch(o)):t(i)}catch(e){o(e)}})},N={1:0},R.f.j=function(e,n){var r=R.o(N,e)?N[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var t=new Promise((n,t)=>r=N[e]=[n,t]);n.push(r[2]=t);var o=R.p+R.u(e),i=Error();R.l(o,function(n){if(R.o(N,e)&&(0!==(r=N[e])&&(N[e]=void 0),r)){var t=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+t+": "+o+")",i.name="ChunkLoadError",i.type=t,i.request=o,r[1](i)}},"chunk-"+e,e)}},$=(e,n)=>{var r,t,[o,i,u]=n,a=0;if(o.some(e=>0!==N[e])){for(r in i)R.o(i,r)&&(R.m[r]=i[r]);u&&u(R)}for(e&&e(n);a{"use strict";var e,n,r,t,o,i,u,a,c,l,f,s,p,h,d,v,g,y,m,b,S,j,w,E,k,x,T,P,A,C,O,D,M,L,N,$,_,z={0(e,n,r){var t={"./index":()=>r.e(0).then(()=>()=>r(2)),"./mimeExtension":()=>r.e(0).then(()=>()=>r(2))},o=function(e,n){return r.R=n,n=r.o(t,e)?t[e]():Promise.resolve().then(()=>{throw Error('Module "'+e+'" does not exist in container.')}),r.R=void 0,n},i=function(e,n){if(r.S){var t="default",o=r.S[t];if(o&&o!==e)throw Error("Container initialization failed as it has already been initialized with a different share scope");return r.S[t]=e,r.I(t,n)}};r.d(n,{get:()=>o,init:()=>i})}},I={};function R(e){var n=I[e];if(void 0!==n)return n.exports;var r=I[e]={exports:{}};return z[e](r,r.exports,R),r.exports}R.m=z,R.c=I,R.d=(e,n,r)=>{var t=(n,r)=>{for(var t in n)R.o(n,t)&&!R.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,[r]:n[t]})};t(n,"get"),t(r,"value")},R.f={},R.e=e=>Promise.all(Object.keys(R.f).reduce((n,r)=>(R.f[r](e,n),n),[])),R.u=e=>""+e+".d6f08baae2d5090c.js?v=d6f08baae2d5090c",R.g=(()=>{if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}})(),R.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),U={},R.l=function(e,n,r,t){if(U[e])return void U[e].push(n);if(void 0!==r)for(var o,i,u=document.getElementsByTagName("script"),a=0;a{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},R.S={},R.initializeSharingData={scopeToSharingDataMapping:{default:[{name:"jupyterlab-plotly",version:"7.1.0",factory:()=>R.e(0).then(()=>()=>R(2)),eager:0,treeShakingMode:null}]},uniqueName:"jupyterlab-plotly"},q={},B={},R.I=function(e,n){n||(n=[]);var r=B[e];if(r||(r=B[e]={}),!(n.indexOf(r)>=0)){if(n.push(r),q[e])return q[e];R.o(R.S,e)||(R.S[e]={});var t=R.S[e],o=function(e){"u">typeof console&&console.warn&&console.warn(e)},i=R.initializeSharingData.uniqueName,u=function(e,n,r,o){var u=t[e]=t[e]||{},a=u[n];(!a||!a.loaded&&(!o!=!a.eager?o:i>a.from))&&(u[n]={get:r,from:i,eager:!!o})},a=function(r){var t=function(e){o("Initialization of sharing external failed: "+e)};try{var i=R(r);if(!i)return;var u=function(r){return r&&r.init&&r.init(R.S[e],n)};if(i.then)return c.push(i.then(u,t));var a=u(i);if(a&&a.then)return c.push(a.catch(t))}catch(e){t(e)}},c=[],l=R.initializeSharingData.scopeToSharingDataMapping;return(l[e]&&l[e].forEach(function(e){"object"==typeof e?u(e.name,e.version,e.factory,e.eager):a(e)}),c.length)?q[e]=Promise.all(c).then(function(){return q[e]=1}):q[e]=1}},R.g.importScripts&&(J=R.g.location+"");var U,q,B,J,Y=R.g.document;if(!J&&Y&&(Y.currentScript&&"SCRIPT"===Y.currentScript.tagName.toUpperCase()&&(J=Y.currentScript.src),!J)){var V=Y.getElementsByTagName("script");if(V.length)for(var F=V.length-1;F>-1&&(!J||!/^http(s?):/.test(J));)J=V[F--].src}if(!J)throw Error("Automatic publicPath is not supported in this browser");R.p=J=J.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),R.consumesLoadingData={chunkMapping:{},moduleIdToConsumeDataMapping:{},initialConsumes:[]},e=function(e){return e.split(".").map(function(e){return+e==e?+e:e})},n=function(n){var r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?[0].concat(e(r[1])):[0];r[2]&&(t.length++,t.push.apply(t,e(r[2])));let o=t[t.length-1];for(;t.length&&(void 0===o||/^[*xX]$/.test(o));)t.pop(),o=t[t.length-1];return t},t=function(e){return 1===e.length?[0]:2===e.length?[1].concat(e.slice(1)):3===e.length?[2].concat(e.slice(1)):[e.length].concat(e.slice(1))},o=function(e){return[-e[0]-1].concat(e.slice(1))},i=function(e){let n=/^(\^|~|<=|<|>=|>|=|v|!)/.exec(e),i=n?n[0]:"",u=r(i.length?e.slice(i.length).trim():e.trim());switch(i){case"^":if(u.length>1&&0===u[1]){if(u.length>2&&0===u[2])return[3].concat(u.slice(1));return[2].concat(u.slice(1))}return[1].concat(u.slice(1));case"~":return[2].concat(u.slice(1));case">=":return u;case"=":case"v":case"":return t(u);case"<":return o(u);case">":return[,t(u),0,u,2];case"<=":return[,t(u),o(u),1];case"!":return[,t(u),0];default:throw Error("Unexpected start value")}},u=function(e,n){if(1===e.length)return e[0];let r=[];for(let n of e.slice().reverse())0 in n?r.push(n):r.push.apply(r,n.slice(1));return[,].concat(r,e.slice(1).map(()=>n))};return u(n.split(/\s*\|\|\s*/).map(function(e){let n=e.split(/\s+-\s+/);if(1===n.length){e=e.trim();let n=[],r=/[-0-9A-Za-z]\s+/g;for(var a,c=0;a=r.exec(e);){let r=a.index+1;n.push(i(e.slice(c,r).trim())),c=r}return n.push(i(e.slice(c).trim())),u(n,2)}let l=r(n[0]),f=r(n[1]);return[,t(f),o(f),1,l,2]}),1)},r=function(n){var r=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(n),t=r[1]?e(r[1]):[];return r[2]&&(t.length++,t.push.apply(t,e(r[2]))),r[3]&&(t.push([]),t.push.apply(t,e(r[3]))),t},t=function(e,n){e=r(e),n=r(n);for(var t=0;;){if(t>=e.length)return t=n.length)return"u"==i;var u=n[t],a=(typeof u)[0];if(i==a){if("o"!=i&&"u"!=i&&o!=u)return o=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var t=1,i=1;i0?".":"")+(t=2,u)}return r}for(var c=[],i=1;i=n.length||"o"==(f=(typeof(l=n[u]))[0])){if(!c)return!0;if("u"==s)return a>t&&!o;return""==s!=o}if("u"==f){if(!c||"u"!=s)return!1}else if(c)if(s==f)if(a<=t){if(l!=e[a])return!1}else{if(o?l>e[a]:ltypeof console&&console.warn&&console.warn(e)},y=function(e,n,r,t){g(d(e,n,r,t))},m=function(e){return e.loaded=1,e.get()},S=(b=function(e){return function(n,r,t,o){var i=R.I(n);return i&&i.then?i.then(e.bind(e,n,R.S[n],r,t,o)):e(n,R.S[n],r,t,o)}})(function(e,n,r){return u(e,r),m(a(n,r))}),j=b(function(e,n,r,t){return n&&R.o(n,r)?m(a(n,r)):t()}),w=b(function(e,n,r,t){return u(e,r),m(h(n,r,t)||y(n,e,r,t)||a(n,r))}),E=b(function(e,n,r){return u(e,r),f(n,e,r)}),k=b(function(e,n,r,t){return u(e,r),s(n,e,r,t)}),x=b(function(e,n,r,t){return u(e,r),v(n,e,r,t)}),T=b(function(e,n,r,t){return u(e,r),p(n,e,r,t)}),P=b(function(e,n,r,t,o){return n&&R.o(n,r)?m(h(n,r,t)||y(n,e,r,t)||a(n,r)):o()}),A=b(function(e,n,r,t){return n&&R.o(n,r)?f(n,e,r):t()}),C=b(function(e,n,r,t,o){return n&&R.o(n,r)?s(n,e,r,t):o()}),O=b(function(e,n,r,t,o){var i=n&&R.o(n,r)&&h(n,r,t);return i?m(i):o()}),D=b(function(e,n,r,t,o){return n&&R.o(n,r)?p(n,e,r,t):o()}),M=function(e){var r=!1,t=!1,o=!1,i=!1,u=[e.shareScope,e.shareKey];return(e.requiredVersion?(e.strictVersion&&(r=!0),e.singleton&&(t=!0),u.push(n(e.requiredVersion)),o=!0):e.singleton&&(t=!0),e.fallback&&(i=!0,u.push(e.fallback)),r&&t&&o&&i)?function(){return D.apply(null,u)}:r&&o&&i?function(){return O.apply(null,u)}:t&&o&&i?function(){return C.apply(null,u)}:r&&t&&o?function(){return T.apply(null,u)}:t&&i?function(){return A.apply(null,u)}:o&&i?function(){return P.apply(null,u)}:r&&o?function(){return x.apply(null,u)}:t&&o?function(){return k.apply(null,u)}:t?function(){return E.apply(null,u)}:o?function(){return w.apply(null,u)}:i?function(){return j.apply(null,u)}:function(){return S.apply(null,u)}},L={},R.f.consumes=function(e,n){var r=R.consumesLoadingData.moduleIdToConsumeDataMapping,t=R.consumesLoadingData.chunkMapping;R.o(t,e)&&t[e].forEach(function(e){if(R.o(L,e))return n.push(L[e]);var t=function(n){L[e]=0,R.m[e]=function(r){delete R.c[e],r.exports=n()}},o=function(n){delete L[e],R.m[e]=function(r){throw delete R.c[e],n}};try{var i=M(r[e])();i.then?n.push(L[e]=i.then(t).catch(o)):t(i)}catch(e){o(e)}})},N={1:0},R.f.j=function(e,n){var r=R.o(N,e)?N[e]:void 0;if(0!==r)if(r)n.push(r[2]);else{var t=new Promise((n,t)=>r=N[e]=[n,t]);n.push(r[2]=t);var o=R.p+R.u(e),i=Error();R.l(o,function(n){if(R.o(N,e)&&(0!==(r=N[e])&&(N[e]=void 0),r)){var t=n&&("load"===n.type?"missing":n.type),o=n&&n.target&&n.target.src;i.message="Loading chunk "+e+" failed.\n("+t+": "+o+")",i.name="ChunkLoadError",i.type=t,i.request=o,r[1](i)}},"chunk-"+e,e)}},$=(e,n)=>{var r,t,[o,i,u]=n,a=0;if(o.some(e=>0!==N[e])){for(r in i)R.o(i,r)&&(R.m[r]=i[r]);u&&u(R)}for(e&&e(n);a Date: Fri, 6 Nov 2026 15:35:48 -0600 Subject: [PATCH 4/4] Add attribution to CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bef869aa01..f19cf28a27b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - Add support for converting matplotlib reference lines (`axhline`, `axvline`, and horizontal/vertical `axline`) as well as axes-coordinate lines into Plotly layout shapes in `mpl_to_plotly`, including support for date axes [[#5719](https://github.com/plotly/plotly.py/pull/5719)], with thanks to @robertoffmoura for the contribution! ### Fixed -- Fix figures in JupyterLab not redrawing when their output is updated with `update_display_data` (for example `DisplayHandle.update`), which also kept animations in other kernels on their first frame [[#5865](https://github.com/plotly/plotly.py/pull/5865)] +- Fix figures in JupyterLab not redrawing when their output is updated with `update_display_data` (for example `DisplayHandle.update`), which also kept animations in other kernels on their first frame [[#5865](https://github.com/plotly/plotly.py/pull/5865)], with thanks to @AllenDowney for the contribution! - Fix `mpl_to_plotly` tick marker mirroring, axis positioning, and trace visibility for twinned and overlaid subplots (such as `twinx` and `twiny`) [[#5310](https://github.com/plotly/plotly.py/pull/5310)], with thanks to @robertoffmoura for the contribution! - Fix `mpl_to_plotly` losing matplotlib axis line colors by exporting the color of each axis's displayed spine to the plotly x and y axis `linecolor` [[#5311](https://github.com/plotly/plotly.py/pull/5311)], with thanks to @robertoffmoura for the contribution! - Fix concurrent first access to lazily initialized graph object properties, which could raise `ValueError("Invalid value")` [[#5691](https://github.com/plotly/plotly.py/pull/5691)], with thanks to @hb1915 for the contribution!